David and I have been working hard on getting the beta version of Mobile Tweete stable its getting there slowly. It is proving to be a bit more challenging than first anticipated as we are using an asynchronous famework .

When we aren’t fixing the bugs, we are adding features! David has been working on adding OAuth to Tweete, and I added the ability to reply to all persons mentioned in a tweet, and also the ability to copy hashtags when replying to a users tweet – this is useful for keeping the context when in a conversation.

Expect more features in the near future – we have a huge list of nice little tweaks to add!

Today I finally released the new version of Mobile Tweete (0.7). Some of you might have noticed that I skipped 0.6 which was never released publicly due to it being a very unstable codebase. It had a whole bunch of new features, but the base code kept erroring out. All of these problems have been fixed in version 0.7.

Mobile Tweete 0.7 has a bunch of new features which I decided made it a much more useable experience. I also tried to listen to comments via search.twitter.com and incorporated a bunch of suggestions from users. The new features in 0.7b are:

Top menus can now be configured

Individual Quick Action buttons can be turned on/off

Tweete now supports ‘profiles’ which apply different settings depending on the device you are browsing from

Change the colours of Tweete by using the colour scheme picker, or use your Twitter colour settings!

Ability to turn avatars on/off on the timeline

Search menu item now – uses search.twitter.com api

Change how many tweets you want to display on each page (max 200)

Added themes & users can now develop and submit custom themes for inclusion in Tweete

Turn the header bar on/off

The ability to enable a restrictive input box or not. i.e. limit input at 140 chars

Auto-refresh interval can be specified if you would like the page automatically updated

Customize the ReTweet syntax

Reading resume line, this basically adds a line on the /home page which points out where you were up to last time you viewed the page so you don’t re-read old tweets.

I just want to make others aware of a little quirk with Google Chrome’s Javascript engine (V8), eval’d associative JSON arrays (aka objects) are returned in the incorrect order . The problem is that the engine doesn’t do what a programmer would expect it to do, but the programmer should be aware of why its happening and that it does happen.

Basically, take the following psuedo associative array/object and its corresponding JSON version:

Pretty basic huh? But that happens when we loop over this array/object? In Firefox, Safari and IE we get the same result, which is the array elements in the order listed above. Chrome on the other hand returns the items out of order. Now I know you are probably thinking, “its an array/object, order doesn’t matter”. This is technically true, but not if you are relying on the order for some reason, then you might find bugs cropping up. Check out the code below:

We have recently moved from Mantis to Trac at work for our bug/task tracking, but we have encountered a slight issue with Trac’s workflow management. The issue is that we wanted to be able to move a ticket from the ‘assigned’ state to the ‘new’ state. This is a common scenario if a team member leaves or goes on holiday while they have tasks assigned to them. Quite often you wouldn’t just want to blindly ‘reassign’ these issues to another member, but reset them to their new status so another member can pick the task up when they have the time.

We decided to introduce a new state called ‘reset’ in the trac.ini [ticket-workflow] block which allows us to easily reset a ticket to the ‘new’ status as if it had just been created in the system. The new block looks like this:

After months of complaining about the lack of features on the official mobile twitter client, and the download overhead of slandr, I decided to write my own mobile twitter client. One that focuses on most needed functionality without the huge download overhead. I call it Tweete.

I’m still working on Tweete, but at the moment I have a beta release running that you are welcome to try out which you can find here: m.tweete.net. I’ve tried to keep the pages fairly light, at the moment each page is around 5k, which is roughly the same as the official mobile twitter client, but Tweete has extra features. Slandr on the other hand is around 25k per page load (last time I checked). My mobile handset browser (WM6 IE) doesn’t support gzipping content, so I’ve tried to make pages as light as possible without gzipping.

To use Tweete, simply login with your twitter login details and away you go; no need to create an account or maintain another password.

Currently the following features are implemented in Tweete:

Send updates

User & friends timeline (with pagination)

View replies

View direct messages & send direct messages

Pagination for direct messages & replies

Mirrored Twitter URL structure

User profiles

Follow & Unfollow users

API Limit handling

The following features are planned:

Delete tweets & direct messages

And the following may or may not be implemented:

Customize css colours from twitter account settings

If anyone has any suggestions, feel free to contact me with them (or leave a ticket at the Tweete Trac page) and I’ll see what I can do :)

For those of you who are interested in implementation details; I used the Kohana PHP Framework. Kohana is designed from ground up as a lightweight secure php framework for rapid application development. I have had a look at a number of frameworks for php, and in my opinion, is the most easy and logical to use.

Whilst reading guides on how to setup a rails dev server under OS X (both Tiger and Leopard), I kept running into issues installing the mysql gem. The guides would instruct you to install the mysql client libraries from the mysql website, which is fine. But to get improved performance under rails, you must install the mysql gem, but in doing so, I would constantly run into issues getting the gem to install correctly. The issues normally arises after running the following command:

sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql

And the resulting error is:

checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Basically, the gem compile fails as a result of not knowing where the correct mysql files are, despite the fact that the command line switch points to the mysql folder.

While writing some software for work which works out distances between geographic locations, I discovered some nastiness with the natsort() function in php.

This function implements a sort algorithm that orders alphanumeric strings in the way a human being would while maintaining key/value associations. This is described as a “natural ordering”.

So, given this definition of natsort, I’ll now outline a working example and then an example of the problem I encountered.
Lets say we have a list of values in an array that need to be sorted descending whilst maintaining key/value pairs. E.g:

$a = array(4 => 9.1, 3 => 4.2, 10 => 4.5);
natsort($a);

As you would expect, the resulting array looks a little something like this.

print_r($a);
Array
(
[3] => 4.2
[10] => 4.5
[4] => 9.1
)

But what happens when the values in the array we are trying to sort are a little more complex:

As you can see, the sort order is incorrect. As you have probably picked up, the 4.5xxx number’s decimal places are 1 less than the other two numbers. As soon as you change 4.5361796771 to 4.53617967711 and run natsort() over it, it returns the correct order.

Conclusion: Don’t use natsort() when sorting floats of different precision as it will return incorrect values! Use something like asort() if you want to maintain key/value pairs, or sort() if you don’t care about the key ordering.