My Macbook Broke “sobs”

I have started doing development on my iPad which should be interesting.

The reasons is that my Macbook broke recently “sob” so I have been working on Windows again for a bit which is not too bad… But there are things that I miss like the Terminal and Alfred App. While I have found ways to make Windows work in a similar way it just isn’t the same.

The solution for me then is to move all of my development into the “cloud”. I say that in quotes because the cloud lives in my company’s data centre :D . So I have been using Vim (with a ton of cool plugins) and SSH for most of my development now. I read this blog post a while ago and wanted to try it out but I didn’t have an iPad then. Now I do so I am going to give it a bash (hehe, no pun intended).

I am currently using the zaTelnet app but I want to move to iSSH sometime soon. zaTelnet is not too bad but it is a bit like Putty which I find a bit basic, also it does not support VNC or X Server.

The server is running Ubuntu Server 12.04 on Citrix Xenserver. Then it just has the standard LAMP stack as well as Xdebug for PHP and Drupal development. I am using Vim for writing code with the NERDTree plugin which is a file manager sidebar toggle allowing you to open multiple file in Vim without needing to know all of the file paths.

I am also running Tmux which allows you to have multiple window sessions inside your terminal and you can also save those sessions and come back to them whenever you feel like it

I will be blogging about how I find working on the iPad in a series of blog posts :) so look out for that. Also if you would like me to post my Vim configs and plugins and any other configuration files let me know in the comments or send me an email.

SQLite3 + Dropbox == Awesome

Dropbox is one of the coolest apps I have ever used and everyone knows how to use it. I can tell my clients to Dropbox me files and they don’t roll their eyes. Finally something useful out there. No, this isn’t an advert for Dropbox I will explain my excitement in a minute.

I wrote a PHP/MySQL contact manager for a client a little while ago, it was the successor to an Excel VBA app that succeeded a Psion Series 3 from 1993. So the client was very happy with the system everything working perfectly. But then he wants to be able to access his database of contacts from other computers as well (work / home / etc…). Initially I was going to build an addon that allowed him to export a file and import it on the other end. But I didn’t really like that idea because it relies too much on the client to get it right, which is not a good thing at all. (Think late night phone calls and weekends filled with a moaning client)

It took a while to realise that perhaps Dropbox could do exactly what I wanted, the thing that held me up was MySQL. Enter SQLite3. I have know about SQLite3 for a while now but I have never used it much. I knew it was a portable database that lived in a single file but have never had a use for it. Until now.

PHP also makes it really simple to convert from a MySQL database to a SQLite3 database, thought I did spend a lot of time fiddling with export tools. I ended up porting the table structure and then writing a simple MySQL query that pushed all the data into the SQLite3 database. It took me around two hours to convert the contact manager from MySQL to SQLite3 which is not bad. All the queries work without needing to change, basically you just change any mysql_* function to sqlite_* and hey presto you’re done :) .

And for the cherry on top I use Dropbox to store the SQLite3 database and then reference it from the PHP application running in XAMPP on his local machines. Then whenever he updates his database on one computer it updates them all. Also with Dropbox he can work offline as well and then sync when he connects.

Of course I know this is not the elixir to everything but for something simple like this where there is one guy using an app on several computers it is perfect.

I think maybe for my next project I will start working on building a Dropbox clone to use in my own office, maybe with a few extra features more useful to developers. Haha, no… but then again…

Add new files to SVN

This is a fairly common issue and one that I have run into on more than a couple of occasions. How do you add new files to an SVN project without running the add command for every file/directory?

You use this clever one line script that I found at Snipplr:

svn status | grep "^\?" | awk '{print $2}' | xargs svn add

And as long as your file names don’t have spaces in them the script will add them recursively to your SVN project. By the way if you have spaces in your file names then you are being silly. :P

PHP SSH2 on Fedora Core the easy way

Installing the PHP SSH2 extension on Fedora is a pain in the backside unless you know how. There are countless examples for Ubuntu but everyone seems to leave the Red Hat family in the dark.

Here is the easy way to do it:

[theamoeba@amoeba2]# yum install php-pecl-ssh2
[theamoeba@amoeba2]# service httpd restart