First Android app completed.

My first Android app has now been completed and is available on the Android Marketplace, it’s not going to be any use to anyone who is not using the vps247 cloud service, but for anyone is it’s a very handy app.

Here is quick overview of the features available in the app:

1. Resource viewer, displays current memory, disk, IP and bandwidth usage:

2. Server viewer, displaying all servers and a traffic light to indicate the server status, servers can be tapped to show detailed information and access start/stop controls:

3. IP address viewer:

4. Create new servers, which has a nice interface with sliders and drop downs to make it easy to configure a new server. The available resources are used to dynamically generate the creation interface:

To download the app, just search for ‘vps247’ in the Android Marketplace and it should show up!


Today is a confusing day for 32 bit PHP

As many people probable know, there are some glaring inconsistencies between 32 bit and 64 bit PHP, especially when it comes to large numbers and floats.

For some reason, best known to the PHP developers, 32 bit PHP is limited to the maximum signed 32 bit integer size of 2147483647, while 64 bit PHP uses the 64 bit equivalent of 9223372036854775807. Many languages overcome the 32 bit / 64 bit differences by storing 64 bit ints as 2 32 bit ints to allow the usage of 64 bit integers on 32 bit systems, hence providing complete consistency between the two platforms.

These inconsistencies similarly apply to floating point precession, presumably a float in 32 bit PHP is equivalent to a 32 bit float in C, whereas it appears that in 64 bit PHP it’s actually a double.

Here is a nice example of the inconsistency, today’s unix timestamp in float form:

32 bit:

php > echo (float) 1285200000;

64 bit:

php > echo (float) 1285200000;

This is an important thing to remember with PHP, despite the fact it is a loosely typed language, they behaviour is equivalent to the C behaviour for the particular architecture of your server.


Neat trick to beat the sendmail FQDN check

When you install sendmail on a local machine and want to test some mail sending feature of your project, sendmail has a tendency to hang for a couple of minutes each time you try and send mail.

Looking in the /var/log/mail.log will reveal it is trying to determine the fully qualified domain name:

Sep 16 09:20:01 MyHostName sm-msp-queue[14171]: My unqualified host name (MyHostName) unknown; sleeping for retry
Sep 16 09:21:01 MyHostName sm-msp-queue[14171]: unable to qualify my own domain name (MyHostName) -- using short name

Here is a quick fix which resolves the problem:

1. Edit /etc/hosts
2. Change the record for so that it looks something like this localhost.localdomain localhost MyHostName

3. Restart sendmail

This now makes sendmail think it’s FQDN is localhost.localdomain, and mail now sends instantly!


First attempt at a (useful) Android app

I’ve had the Android SDK installed for a few months, but down to lack of ideas and time I’ve not really done anything with it.

One of the hosting companies (VPS247) I am using at the moment have just released an iPhone app, as well as an API, they’re exposing almost the full functionality of their cloud hosting admin area via the API which is quite a nice idea. With lack the lack of an Android app I decided to have a go.

So far I’ve created a ‘login’ which just requires the API key of your account:

Once you’ve entered a valid 40 character API key, the API is then queried twice for your account resource info and details of virtual servers that are currently setup (I’ve blurred my host names as I don’t think anyone really needs to know these):

Here is the package file if anyone want’s to give it a try: VPS247Monitor