Sync fileset from local to remote using default phpstorm tools

In a previous post I discussed syncing projects to remote servers using Komodo, Eclipse and Netbeans.

I have come to dislike all of the above editors and ide’s for various reasons. So, I thought I would give phpstorm a go, so far so good and here is how to run an rsync command…

phpstorm does come with some nice built in tools and ways to send your files to other places… but none of those options are via rsync. Phpstorm does allow you to create your own “External Tools” which is fine for this job. The external tool can then be hooked up to a shortcut and away you go.

Step 1 – Create the new “tool”

File > Settings > Tools > External Tools
Click the little green plus and a new box should popup, enter the details and save, eg (note that the program and parameters are separated here. Leave the working directory blank.):

Step 2 – Check the tool works

Check the tool works by running it manually: Tools > External Tools > rsyn…:

Step 3 – Linking the tool to a macro

Assuming that step 2 ran smoothly (if it did not, please visit here to trouble shoot the rsync command), record a macro that essentially does what you just did.

Edit > Macros > Start Recording Macro

Now repeat step 2.

After the rsync command has run, stop the macro:

Edit > Macros > Stop Recording Macro

Give it a name and hit save.

Step 4 – Linking the macro to a keyboard shortcut

File > Settings > Appearance & Behaviour > Keymap

By default on my installation the “Editor actions” is open, hit the tiny down arrow to close it.

Open the “Macros” folder and you should see the macro you just created, right click on it and you will see a few options… choose keyboard shortcut and assign a shortcut in the first box by pressing the shortcut you want to assign to it… eg ctrl+alt+r

If nothing is already assigned to this shortcut you are good to go, just hit ok then apply and you are good to go.

Unroot moto g 2nd gen

This post is taken from a few other posts around the net, but the firmware placed on a gdrive for you/me.  Also see: to upgrade to lollipop. I had many issues with unrooting the handset, mainly around locking the bootloader.

Getting Prepared

1 – Get the 2nd Gen. Moto G firmware: GDrive or from filefactory but is a super slow on the non paid for service, a pain that i already went through and put on gdrive

2 – Download mini fastboot kit: [mirror]
3 – Download and install Motorola USB Drivers (alternate link) your computer.
4 – Enable USB Debugging on your Moto G 2014: go to Settings> About and tab Build version 7 times to unlock Developer options. The go to Settings> Developeroptions and enable USB Debugging.
5 – Charge your phone to ensure at least 70% battery. Restore Moto G 2014 to Stock


1 – Download the firmware file and extract it to a folder.
2 – Extract and copy its content to the same folder where the extracted firmware files exist.
3 – Reboot your Moto G into the Bootloader Mode. Either…
a – Turn off your phone and then press and hold the Volume Down + Power buttons simultaneously for a few seconds.
b – Connect your Moto G to computer using the USB cable. Open the firmware folder where you have copied the mfastboot files. Launch a command window, type the following command and press the Enter key:

4 – Now here is how to flash the stock firmware. Make sure the device is connected via USB cable and launch a command window from inside the firmware folder and type the following commands one by one:

5 – If you also want to lock your phone’s bootloader, type the following command and hit the Enter key:

6 – Finally, reboot your device by typing:

7 – Your Moto G will reboot now but if it is unable to pass the boot screen, try this:

a) turn off the device,
b) go to Bootloader mode, launch command window wipe cacahe and userdata by issuing these commands:

8 – To relock the bootloader on your Moto G 2014, type the following command and hit the Enter key:

Wait till your phone boots up. Done (or you should be, it is easy to get the process wrong)!

Net Neutrality – Join the Internet Countdown

I cannot actually put script tags on blogger, but if i could i would.

“Telling everyone about the vote is a key part of winning real net neutrality. We need your help to do just that. If you use twitter, click “Join with Twitter” below, and you can sign up to tweet once a day from now until the vote, or just once right before the vote. It’s your choice. If you don’t have twitter, then sign up with your email and we’ll send you a list of different ways you can help.”

var _cd_options = { theme: ‘red’ };

A dev server running multiple nodejs and apache sites

This post assumes you have nodejs and apache running on either ubuntu or debian. And that you know how to setup an apache vhost.

It also assumes you have a nodejs app running and listening on port 8000.

  1. Enable proxy and proxy_http mods in apache.
  2. Create a new vhost, eg

That is pretty much it. Now anything accessing your server on will be mapped internally to port 8000 to the sub directory of ‘app’. You can add more vhosts like this to accommodate more nodejs apps, just make sure they are listening on a different port. As each nodejs app is enclosed in its own vhost your existing apache apps will continue as normal.

Syncing local code base to dev servers with Netbeans, Eclipse and Komodo Edit via Rsync


As a developer, one of the things you strive for is technical parity between your development and live environment, especially on big projects, a slight misalignment in a php version or apache config can often result in a bug, minor or serious, making its way though to the screens of your clients. not what you want.

For this reason it might not be feasible to run your dev environment with the likes of XAMPP or EasyPHP. A better alternative is to run a virtual box on your local machine and ensure that the settings of the virtual match the live production server, take a look at VMWare player  or Oracle’s free VM VirtualBox

With running a virtual server on your machine you are of course faced with another obstacle in getting the files into the said box in a timely and efficient manner without slowing down the speed of development.

You could use SAMBA to mount the apache web root from the VM box onto your OS drive on your local machine (eg C:projxwww ). This would enable your CVS to view the files of your project, downside being your code actually lives in the files of the virtual machine.. not ideal (if you use git and something like sourcetree on a very large project with 1000’s of files this becomes impossible as SourceTree takes too long to continually read the files in your VM).

So, enter rsync.

Using rsync to synchronise your local working copy of a project to a dev server is (from my experience) by far and away the most efficient method. When you hook this up to a ‘on save’ trigger your setup will start to fly. The bonus of this method really frees you up to have your dev server instance anywhere in the world, from a VM to a cloud in the “sky”.

You can achieve the rsync on save setup with macro in Komodo Edit, or via ANT files in Eclipse. I have yet to find a straight forward was to achieve this setup with Netbeans, and after a few reach outs to the Netbeans community I am not sure it is possible.

Example rsync command to sync files from a local folder to a remote destination (previous post on this for more detail, the setup on windows and unix is different for rsync):


The same rysnc command in an ANT file might look like:


Setup on Komodo Edit

Komodo editI find the easiest to setup due to its pretty cool macros you can write in javascript or python.

1 – In your project, open the right hand side bar. You should see a toolbox with the name of your project next to it:

2 – Right click on the your project (in my case ‘MyProject’). Select Add / New Macro. The macro box should appear and look like this:

3 – Give your macro a nice name eg “rync to dev server”. Then you are free to start writing your macro in javascript or python. For this example I’m going to write a very basic javascript macro:

4 – With a very simple macro written you now need to hook it up to a trigger. Head over to the ‘Triggers’ tab and set to look like this:

That’s it. Komodo will now run the rsync command (or whatever other command) each time you save (or whatever you set the trigger to be).

Of course, Komodo Edit is not an IDE.. and as such doesn’t include a while wealth of time saving tools that might want.. (I for example love working with a code navigator that shows all the methods etc that the file opened contains, Komodo does have an IDE version but is aint free:

Setup on Eclipse

The setup on Eclipse is done via an .ant file like the one above. Not as simple as the Komodo implementation but fairly easy non the less.

1 – Create your ant file and save into your project files as something like rsync.ant:


2 –  In your project explorer bar, right click on your project, then select properties. In the dialog box that appears, choose “Builders” on the left hand side, then choose “New…”. A new box appears, choose “Ant Builder”:

2 -Enter a name relevant to the task, eg Rsync to dev. Then select your .ant file: From the “Main” tab click the “Browse Workspace” button in the “Build file” section and select your ant file:

3 – With your ant build file selected, head over to the “Targets” tab and select “Set Targets…” next to the “Auto Build” section. You will note that the only option we have to choose from is something called ‘deploy’,  this is because that is all we have in the ant file:        You could add more sections to your ant file and do a whole range of things.. but we’re handling rsync for now:

4 – Save/ok your way out of the properties box. The last step is to set the auto build going. Click ‘project/build automatically’

That’s it. Each time a file is saved in the project the project will “build” automatically and run your ant file which in turn will run rsync.

(after writing this I painfully learnt that eclipse is a bit of a bitch, it crashed on me twice when attempting to index two projects (one at approx 9800 files and one at approx 18000 files. Coupled with these issues the Outline (imo one of the main reasons for using an ide) didn’t work as one would expect with javascript files).

Netbeans Setup

I failed to find a way to get Netbeans to run an rsync command on file save. I did find an alternative, which isn’t too painfull.

1 – Create your .ant file (same as above) and save at the root of your project.

2 – Find the file in the file naviagtor on the left (or where ever you placed then window). Right click on the file, select ‘Run Target’ > Deploy.

3 – After your ant file has run once you can then re-run the same process again by clicking
Run > Repeat Build / run: Myproj(deploy)  Or the shortcut being ctrl + f11

My preference

Hard to say. I would possibly say Netbeans. I do like Komodo’s javascript macros and they do have a nifty API you can plug into, but life without a code navigator/ outline gets a little unbearable when project switching.

The interface of Eclipse was fairly crisp and seemed to show potential, but with two crashes in the space of an hour didn’t exactly fill me with confidence.

Komodo IDE… I did give this a try too. It’s OK. There is a code navigator which is good, but one common thread between Komodo Edit and IDE is that Komodo seems to go a little funny when you also use Mozilla Firefox… it’s as is they are colliding with something behind the scenes.. Who knows.