teleren/devto huggingface dataset:
Install Consul on Ubuntu 14.04
Tags: consul, ubuntu
Published: 2015-04-05 09:19:00

---
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/y9hxcwi5y92j6zfcxbjx.jpg
title: Install Consul on Ubuntu 14.04
slug: install-consul-on-ubuntu-14-04
date: 2015-04-05 9:19
tags:
 - consul
 - ubuntu
---

To install Consul on Ubuntu 14.04, first make sure you have unzip available:

    $ apt-get install -y unzip
    
Now, grab the Consul archive, [make sure to get the latest & the right architecture](https://dl.bintray.com/mitchellh/consul/), at the time of writing it is 0.5.0, and for Ubuntu it's linux_amd64:

    $ wget https://dl.bintray.com/mitchellh/consul/0.5.0_linux_amd64.zip
    
Now unzip it.

    $ unzip 0.5.0_linux_amd.zip
    
Now move `consul` to somewhere in your PATH:

    $ mv consul /usr/bin/local/consul
    
Finally, check it works:

    $ consul --version
    
    Consul v0.5.0
    Consul Protocol: 2 (Understands back to: 1)
    
Good job!
Git Tips and Tricks
Tags: git, productivity, beginners
Published: 2020-11-05 12:57:48

---
title: Git Tips and Tricks
published: true
date: 2015-04-04 00:00:00 UTC
tags: git,productivity,beginners
canonical_url: https://allanmacgregor.com/posts/git-tips-and-tricks
---

Recently I’ve been collecting a large collection of git shortcuts, tips and tricks. The following commands have been tested on linux and some of them will required a recent version of git.

I expect that many of you will find them useful as much as I do. So let’s get started with some simple but helpful commands to search and review your git repository history.

## Show log for only a specific branch

The following command can be used if you are working on a project with a particular dirty history or a log of branches

```
git log --first-parent {branch_name}
```

## Show the log as a single line

The following command will show the commit has and the first line of the commit comment.

```
git log --pretty=oneline --abbrev-commit
```

A more advanced and nicer version of the command above is:

```
git log --graph --pretty=oneline --abbrev-commit --date=relative
```

## Search for a string in all commits across the entire git history

This can be really useful when looking for a particular piece of code to see when it was added/removed:

```
git log -S{text_to_search}
```

## Shows branches that are all merged in to your current branch

```
git branch --merged
```

And in the same way we can see all the branches that haven’t yet been merged.

```
git branch --no-merged
```
Rename Ubuntu droplet
Tags: digitalocean, droplet, ubuntu
Published: 2015-04-01 12:06:00

---
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/y9hxcwi5y92j6zfcxbjx.jpg
title: Rename Ubuntu droplet
slug: rename-ubuntu-droplet
date: 2015-04-01 12:06
tags:
 - digitalocean
 - droplet
 - ubuntu
---

To rename a Digital Ocean Ubuntu droplet, update `/etc/hostname` and `/etc/hosts`, then run:

    service restart hostname

You'll need either root access or sudo for this.
Getting Started with Phonegap
Tags: engineering, phonegap, mobile
Published: 2020-10-05 10:50:36

---
title: Getting Started with Phonegap
published: true
date: 2015-03-31 00:00:00 UTC
tags: Engineering,PhoneGap,Mobile
canonical_url: 
---

PhoneGap now also known as Apache Cordova, is a powerful tool for mobile development which allows you to develop in HTML/JS markup and quickly generate out various mobile compatible apps. This prevents your developers from having to learn and understand multiple platform specific…

   
[Read On](https://www.loginradius.com/engineering/blog/getting-started-phonegap/)
ES6 compatible sleep function
Tags: javascript, es6
Published: 2015-03-24 16:33:00

---
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/y9hxcwi5y92j6zfcxbjx.jpg
title: ES6 compatible sleep function
slug: es6-compatible-sleep-function
date: 2015-03-24 16:33
tags:
 - javascript
 - es6
---

While debugging locally, it can be hard to see how an application runs in the wild as the network has no delay. Quite often, you get around this using a sleep function.

Pre-ES6 generators, you might do this with a callback, maybe using a setTimeout that calls the callback.

    function sleep(ms, callback) {
        setTimeout(callback, ms);
    }

With ES6 generators, where you want to `yield sleep(1000)` etc, you can't use callbacks. What you can do is return a function that takes a single parameter, `done`, which through closure has access to the parameter you want to pass in, `ms`. When the returned function is called by whatever cog under the hood calls the returned functions when yielding, your inner function will have access to the `ms` parameter you passed in, along with a callback that JS passes in, which when called, will continue on from where you yielded the sleep.

    function sleep(ms) {
        return function(done) {
            setTimeout(done, ms);
        }
    }

    yield sleep(1000);
    
This is now available on npmjs.org. To install:

    npm install es6-sleep

To use, let's say while inside some Koa middleware:

    var sleep = require('es6-sleep');

    app.use(function *() {
        // do something
        yield sleep(1000);
        // continue
    });

Hopefully that makes sense. It does in my head.
Animate the modal popup using CSS
Tags: slide, css, swirl, popup
Published: 2020-10-05 10:50:44

---
title: Animate the modal popup using CSS
published: true
date: 2015-03-23 00:00:00 UTC
tags: Slide,CSS,Swirl,PopUp
canonical_url: 
---

Learn how to animate the modal popup using CSS keyframe

   
[Read On](https://www.loginradius.com/engineering/blog/animating-simple-css-popup-tutorial/)
Networking Event
Published: 2022-09-25 18:55:53

---
title: Networking Event
published: true
date: 2015-03-22 20:00:45 UTC
tags: 
canonical_url: https://www.funkysi1701.com/posts/2015/networking-event/
---

I recently went to an event called ITBoss organised by [Core Com Consulting](http://www.corecomconsulting.co.uk/blog/archive?tag=276). It was really good, helped partly by a free bar and great food.

The event was hosted in a pub in central Leeds, so I rushed to the train station from work to get there. And yes I was the first to arrive (Why do I always do that?). The event was targeted at IT Leaders and Managers and was limited to about 20 people.

To begin with I just chatted to the hosts and other people as we waited for everyone to arrive. Once we got going we had a short presentation about the need for Strategy. Interestingly the next day I suggested a strategy meeting with my director, so something must have sunk in from this.

The main gist of the talk was that IT leaders need to pop there head up from day to day work to look at where they are going, and this should be matched with the overall direction of the company. I agree with this, recently I have been thinking of what direction our infrastructure needs to go in, it is currently just in my head, but at least that is a start. However our company directors are poor at sharing their long term vision, so it is hard for me to know where the company is going. I need to step up and challenge this behavior, so I can deliver the changes that are needed. Not easy but that is what the best IT leaders are doing.

After this we broke for food, which was very nice. I had a chat with a couple of people. I found it interesting that one gentleman was surprised that I wanted to get into development. I think I understand why, most of the people in the room where senior managers, while I share their job titles, I don’t share their salaries. He saw development as a demotion, I see it as a promotion.

After food we had some discussion questions. Mine was the first, How to convince others of the need for change? Some interesting ideas where presented, but it is the need to work closely with others, find out their requirements which is the difficult part not anything technical. The other topics of discussion where relating to recruiting people with skills that you have no knowledge of and around the topic of security and privacy in this modern age. Both were very interesting with lots of viewpoints expressed.

I enjoyed the evening and hope to go to another at some point. Previous events I have been to have been technical, but lacked the networking that this one had. While I am not very good at networking, at this event it was easy to have a conversation or two with people.
Source Control Fail
Tags: softwaredevelopment, developer, git, programming
Published: 2020-01-25 22:08:31

---
title: Source Control Fail
published: true
date: 2015-03-16 21:32:00 UTC
tags: SoftwareDevelopment,developer,git,programming
canonical_url: https://www.funkysi1701.com/posts/source-control-fail-dgn
---

Every developer uses source control, it is a great tool for keeping track of changes to your code, seeing who has done what.

However I keep messing up, my use of it. I am fairly disciplined when creating new features, all my changes will get committed to source control and when I am happy I will deploy these changes to the live system. But as soon as there is a bug, especially one where the client is chasing for a fix, I will deploy a fix as soon as humanly possible on to the live system.

At first glance there is nothing wrong with what I have described but what happens the next time I deploy a new feature. Yes the bug the client was complaining about gets deployed with the new feature as the fix was never committed into source control. The client gets angry as the bug he was screaming about is back again.

Every change you make to the system **MUST** be committed to source control. If it isn’t that change will look like it never existed. I have worked with source control for over 5 years why do I keep making this rookie mistake over and over.

Troy Hunt has a [blog post](http://www.troyhunt.com/2011/05/10-commandments-of-good-source-control.html) about the 10 commandments of using source control. His number two commandment is “If it’s not in source control, it doesn’t exist” He talks more about code you have written being not saved into source control, but the principal is the same for my example as his.

There are ways to automatically deploy from source control, however most of the time you don’t want your live database being rebuilt because you fixed a typo. Additional steps will need to be implemented and there is still the chance that you might want to bypass these steps to fix the urgent problem. The only way past this problem is for you and everyone on your team to be disciplined and only ever commit to source control first, and only after that deploy live (either automatically or manually)
CSS Responsive Grid, Re-imagined
Tags: css, grid, responsive
Published: 2020-10-05 10:50:51

---
title: CSS Responsive Grid, Re-imagined
published: true
date: 2015-03-16 00:00:00 UTC
tags: CSS,Grid,Responsive
canonical_url: 
---

I know what you're thinking. Why am I writing this blog? There's like a bunch of apps out there that do this thing automatically. See, that's the problem, "automatically". That means you have no control over it when it messes things up. Even if you do, you might mess things up…

   
[Read On](https://www.loginradius.com/engineering/blog/css-responsive-grid/)
Azure Traffic Manager
Tags: itadmin, azure, clouds, devops
Published: 2021-01-16 15:53:16

---
title: Azure Traffic Manager
published: true
date: 2015-03-12 21:20:36 UTC
tags: ITAdmin,Azure,clouds,devops
canonical_url: https://www.funkysi1701.com/posts/azure-traffic-manager-3k9k
description: However Azure has some amazing features that you can configure to help manage when downtime occurs
---

I have spent most of the day tweaking my Azure websites. Lots of fun!

Last week unfortunately Azure had some problems and many websites that were running in the North Europe data centre were unavailable for several hours. And you guessed it my websites were hosted here.

All hosting providers are going to have downtime from time to time and this is just something you have to take on the chin. The important thing to do in times like these is communicate with your customers about what is going on and that you are doing everything you can to restore service.

However Azure has some amazing features that you can configure to help manage when downtime occurs.

Azure is Microsoft’s global cloud platform. And it really is global, there are data centres in North Europe, West Europe, Brazil, Japan, two more in Asia and five in the US. In the event of problems it is highly unlikely that more than one of these would go down at once. If all of these are unavailable, I expect the planet earth is facing some kind of cataclysmic event and the fact that my website is down is not a priority.

[![IC750592](https://i0.wp.com/www.funkysi1701.com/wp-content/uploads/2015/03/IC750592.jpg?resize=662%2C347)](https://i0.wp.com/www.funkysi1701.com/wp-content/uploads/2015/03/IC750592.jpg)To take advantage of these multiple data centres, Azure has something called a Traffic Manager.

Traffic Manager has various settings but I am using it in failover mode. This means that if one website goes down, the next one is used.

All you need to do is create a traffic manager, add two or more websites to it (called endpoints) and choose a page that needs to be monitored so Azure knows which websites are up and which are down.

If you are using SSL or custom domain names, there are a few extra steps you need to do. Your custom domain name needs pointing at the traffic manager, not the individual websites. The websites themselves have three domain names, the traffic manager address, the azure address and the custom domain name. The SSL certificate can then be assigned to each website that you have added to the traffic manager.

That was easy wasn’t it, and now if a website goes down traffic manager will use the next one. While testing this, the transition to the next website was almost immediate. I did notice that if you had a browser showing the website open during a problem you sometimes got an error page, I think this was probably due to browser caching, reopening a tab or browser fixed this issue.
Tidying my desktop
Tags: itadmin, desktop, powershell, programming
Published: 2021-01-17 20:51:09

---
title: Tidying my desktop
published: true
date: 2015-03-11 20:02:42 UTC
tags: ITAdmin,desktop,powershell,programming
canonical_url: https://www.funkysi1701.com/posts/tidying-my-desktop-2f1a
description: My desktop is always a mess. I constantly download files there and forget all about them.
---

My desktop is always a mess. I constantly download files there and forget all about them.

Every now and then I copy files into sub directories, so my desktop looks sane for a day or two before it gets out of control again.

Why don’t I write a script that I can schedule to do this for me. Then my desktop will always be tidy.

I have written a few simple batch scripts, but of course the best scripting language out there at the moment is PowerShell. Lets use that.

Windows provides a nice little utility for writing scripts called the Windows PowerShell ISE, so let's start by loading that up.

PS has lots of help included to help you, just run **Get-Help [name of ps command]**

To move files you can use **Move-Item** which works very similar to copy, specify source and destination. In my case I moved files based on their file extension.

Move-Item \*.pdf folder

Now all I need to do is schedule this script to run either every day or so, or maybe every time I login or switch my computer on.

PowerShell can do lots more interesting things which hopefully I will blog about soon.
Intercepting XMLHttpRequest requests
Tags: javascript
Published: 2015-03-11 12:20:00

---
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/y9hxcwi5y92j6zfcxbjx.jpg
title: Intercepting XMLHttpRequest requests
slug: intercepting-xmlhttprequest-requests
date: 2015-03-11 12:20
tags:
 - javascript
---

Let's kick off the continuation of my code blogging with a very helpful little snippet. I'm just removing this from a codebase so it can sit here for eternity instead.


    (function(open) {
        XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {
            // do some magic
            open.call(this, method, url, async, user, pass);
        };
    })(XMLHttpRequest.prototype.open);
    
This will intercept the request before it happens, and once you've done whatever changes you need to do, be it logging or tagging, you can continue it.
An Intro to Curl & Fsockopen
Tags: curl, fsock
Published: 2020-10-05 10:48:09

---
title: An Intro to Curl & Fsockopen
published: true
date: 2015-03-09 00:00:00 UTC
tags: curl,Fsock
canonical_url: 
---

What are they? cURL and Fsock are both methods used to communicate with different types of servers using communication protocols. Fsock is included in PHP and cURL is a library that can be installed on a server or utilized on many different platforms. Example: cURL- Fsock- How to…

   
[Read On](https://www.loginradius.com/engineering/blog/intro-curl-fsockopen/)
Database Deployment
Published: 2022-09-25 18:56:50

---
title: Database Deployment
published: true
date: 2015-03-05 20:00:45 UTC
tags: 
canonical_url: https://www.funkysi1701.com/posts/2015/database-deployment/
---

One of my jobs is adding extra features to our internal databases. There is a fair amount of risk in doing this. I could make a change to one of the queries in the database that stops the rest of the company using it as they need to. This could be a costly mistake, almost as bad as the database server being inaccessible.

One way to reduce this risk is to test, test and test the database. First I take a backup of the database and make my changes to that. I can do anything I like to my backup database without worrying that it will affect anyone else. Once I have finished making my changes and I have tested that everything is working exactly as I want, I need to apply my changes to the production database.

Until recently I made a note of every change that I have made and then made the same change to the production database. But what if I forget to apply one of my changes to production, I have a broken database on my hands, disaster!

But there is a better way to track database changes. SSDT or SQL Server Data Tools.

Create a Database project with Visual Studio, you can then point this at your live database. This will scan the database and save scripts for all the Tables, Views, Stored Procedures, Triggers and any other object in the database. This doesn’t import the data, just the structures that contain the data. So no data protection issues or problems because your database is terabytes in size.

Now comes the really cool part, Visual Studio allows you to build a copy of the database from these scripts. All you need to do is edit the scripts and test like you did before. Once you are happy with your changes and everything is working as you want, you can point your visual studio project back at your production database and it will magically deploy all your changes, or if you are as paranoid as me about breaking things, it will create a script that you can thoroughly analyse before running on your production database.

I do not know why I never thought of setting this up until recently, it will reduce the number of times I roll out my changes but forget to setup permissions, (these can be scripted) or forget that tiny change I did weeks ago but never rolled out.

And of course all the changes that you make can be saved in source control, so easy to see what changes have been made and by whom.

This process even works with complicated database structures, in my case I needed to setup three database projects that depend on each other. Dependencies can be setup, and the test databases can even be built with different names for testing on the production server, (although I wouldn’t recommend it!)
Enqueuing Scripts in WordPress
Tags: wordpress, php
Published: 2020-10-05 10:47:52

---
title: Enqueuing Scripts in WordPress
published: true
date: 2015-03-02 00:00:00 UTC
tags: WordPress,PHP
canonical_url:
---

In this tutorial I want to explain the different methods to enqueue scripts and style sheets in WordPress. This can be a really confusing process for new WordPress developers. There are three different areas that a developer can enqueue scripts for; the first is the client side…

   
[Read On](https://www.loginradius.com/engineering/blog/enqueuing-scripts-wordpress/)
Learning to Love RegEx: a Find and Replace example
Tags: regex, howto, beginners
Published: 2018-01-12 15:06:42

---
title: "Learning to Love RegEx: a Find and Replace example"
published: true
tags: regex,howto, beginner
canonical_url: https://SeanKilleen.com/2015/02/learning-to-love-regex-find-replace/
---

# Problem

Someone in my blog publishing pipeline – Github, Jekyll, etc. – Changed how headings are formatted. Instead of `#Heading`, I had to specify `# Heading`. This makes sense, I just had converted this blog from elsewhere and it wasn’t high on my priorities at first. But all of a sudden things broke, so I had to change a lot of headings quickly.

# Solution

I needed to find any instances of `##[Any Character]` and add a space in-between, across all of my blog files.

This kind of thing always sets off a light bulb in my brain for regular expressions. I’ll be honest, I’m not a RegEx wiz in any sense of the word, but with some Googling I was able to figure it out.

## Creating the RegEx

The requirements are to find two pound signs `##` Followed by any letter (uppercase or lowercase).

The RegEx for this is `##[A-Za-z]`.

## Adding the Capture Group

In order for Notepad++ to be able to replace the RegEx (rather than just find it), we have to create a capture group to capture that first letter (so that `A` becomes `A ` with a space)

To do this, we wrap the first character portion in parentheses, giving us `##([A-Za-z])`. This will create a capture group note that Notepad++ can refer to using `\1`.

## Replacing the text

- In Notepad++, we open the Find & Replace window.
- We Search for `##([A-Za-z])`
- We replace it with `## \1` (the original heading, plus a space, plus the first character)
- We make sure that the search mode is RegEx
- We perform the find and replace across all files.

This took care of a huge amount of changes for me and probably saved an hour or two of my life. Really makes one appreciate the value of RegEx.

Hope this is helpful!

[Learning to Love RegEx: a Find and Replace example](https://SeanKilleen.com/2015/02/learning-to-love-regex-find-replace/) was originally published by Sean Killeen at [SeanKilleen.com](https://SeanKilleen.com) on February 27, 2015.
Prevent Gulp from stopping watching of files after exception
Tags: frontend, gulp, web, webdeveloper
Published: 2020-05-04 15:39:49

---
title: Prevent Gulp from stopping watching of files after exception
published: true
date: 2015-02-26 10:43:39 UTC
tags: frontend,gulp,web,web-developer
canonical_url: 
---

Recently I developed some small project and decided to try and build automated workflow with [Gulp](http://gulpjs.com/). It was very fun and easy. I really liked its features and node-like syntax.

My project included [React.js](http://facebook.github.io/react/) and I used their [JSX](http://facebook.github.io/react/docs/jsx-in-depth.html) technology. I wanted to debug my code, thus I needed to compile JSX into vanilla JavaScript. Here is where Gulp came to my rescue. You can easily install gulp-react and it does the magic.

After building my tasks and integrating a compiling I wanted to run my tasks constantly. That’s not a problem when you use Gulp. Just use **gulp.watch()** and there you are. But after I’ve started to change code, I’ve understood, that my compiled file isn’t updating. When I took a look into a console, I noticed the exception after which my watching task stopped:

![exception](https://dev-to-uploads.s3.amazonaws.com/i/gtvvmhbztv3jan9ddzxr.png)

The fix for this problem was another gulp package that called [gulp-plumber](https://www.npmjs.com/package/gulp-plumber). This plugin prevents pipe breaking caused by exceptions. Generally saying, it overrides pipe method of gulp and removes **onerror** handler which un-pipes streams on an error by default.

To sum it up, it was a really good experience using Gulp and its plugins.

* * *