A few weeks back Jordan (designer @ Just Develop It) brought in his rubiks cube into the office and we were all amazed that he could complete the cube. The fact he could do it in under 5 minutes just added to the amazement. Between writing code and sleeping, Rich and myself found ourselves trying to solve the cube wondering what logic we could apply to come to a solution. After about a week not being able to complete more than the first 2 layers I cracked and looked around youtube.com for a way to complete the cube.

Much to my suprise, there was a logical way to solve the cube based on a few algorithms. Easy when you know how :) So, the youtube video I found was by pogobat and made the cube easy to understand. You can see the video here: http://uk.youtube.com/watch?v=HsQIoPyfQzM. The algorithms for the cube are as follows:

  1. Fi U Li Ui
  2. Ri Di R D
  3. U R Ui Ri Ui Fi U F
  4. Ui Li U L U F Ui Fi
  5. F R U Ri Ui Fi
  6. R U Ri U R U U Ri
  7. U R Ui Li U Ri Ui L
  8. Ri Di R D

Ok, the letters above dont mean very much unless you can watched the video. You always need to hold the cube in the same position for any of this to work :)

F = The face closest to you (Front)
U = The face on the top (Up)
L = The face in your left hand (Left)
R = The face in your right hand (Right)
D = The face on the bottom of the cube (Down)

There is also i. This stands for ‘inverted’ or ‘counter clockwise’

If you see Ri, you should turn the right face counter clockwise. Should you see R you should turn the right face clockwise. Be sure to only move that one face and not rotate the cube, else it will all end in disaster :)

Once I got to grips with the algorithms, everything slotted into place and I could complete the cube serveral times in one night. Its a very impressive skill to learn.

Get yourself onto youtube.com and watch the video linked above and learn the cube for yourself :)

I have been spending a few days looking into optimisation for a few of our products, the biggest of which is Intellichat, which this great MySQL function is soon to be used for. Intellichat handles thousands of chats every hour, we average at about 190,000 chats a day, which is increasing daily. Every one of these chats holds information about the chat, from the Agent name, through the the IP address that launched the chat. This data allows us to provide detailed statistics to our customers from which Agent name converts best to which Country generates the most sales for their product.

*** Please note that all data sizes below are taken from the PHPMyAdmin row size and not the individual data size as listed in the mysql manual ***

Since starting out, I had always used a char(15) which uses 16 bytes to store ’192.168.0.1′. Since discovering the INET_ATON function, I can now store the same IP address in just 7 bytes. Here are the results from the 3 main data types you should use for this type of data.

VARCHAR(15) - 20 bytes to store '192.168.0.1'
CHAR(15) - 16 bytes to store '192.168.0.1'
INT(UNSIGNED) - 7 bytes to store '192.168.0.1'

So, if you don’t already know the INET_ATON function, it simply converts the IP address you give it to an integer. This means that when you store 192.168.0.1 into the database, the data value is held as 3232235521. Its a great way to save some space in your database, and you will also have the added benefit of faster searches (looking for IPs within a range can be greatly improved by doing something similar to the following).

mysql> SELECT INET_NTOA(ip) FROM ip_addresses WHERE ip BETWEEN INET_ATON('192.168.0.1')
AND INET_ATON('192.168.0.255');

If you wish to translate the numerical IP back into the IP address you originally saved, you can use the INET_NTOA function, which will just reverse the original function.

Conversion in action:

mysql> SELECT INET_ATON('192.168.0.1');
+--------------------------+
| INET_ATON('192.168.0.1') |
+--------------------------+
|               3232235521 |
+--------------------------+
1 row in set (0.03 sec)

And to convert back:

mysql> SELECT INET_NTOA('3232235521');
+-------------------------+
| INET_NTOA('3232235521') |
+-------------------------+
| 192.168.0.1             |
+-------------------------+
1 row in set (0.00 sec)

One thing to note when using this function is to ensure you use an INT UNSIGNED column. If you used a signed INT you will not be able to store any IP addresses where the first octet is greater than 127. For those of you who dont know what that means, 127.255.255.255 is the last IP address you will be able to store :) .

I have finally started working on a new product for JDI a few weeks back, its called Visitors 2 You.   This product is based around Search Engine Optimisation, allowing customers to enter in their domain, and a few search criteria they expect / want to appear under, and we will start recording historical data of search positions, link popularity and a few other bits.  I have been looking to get a product like this for the past few months to watch our own websites grow, see our improvements in Search Engine Rankings and make sure we are always improving our sites for both customers and search engines.

Visitors 2 You aims to help you improve your natural search positions through a range of methods, from code improvement, correct meta tags, improved content and much more.  We aim to have this product live within the next week or so, so make sure you signup to the newsletter and be the first to know when you can signup.

We are always looking for new features to add into the product to make sure its the only SEO tool you need, so if you have any ideas, feel free to email them to me : brooke [at] justdevelop.it

Visitors 2 You can be accessed at: www.visitors2you.com

The Ultimate Wireless Base Station – Apparently

I purchased a 1TB Apple Time Capsule two weeks ago in the hope that it would work perfectly with iTunes, Apple TV and most of all, file sharing.

Im sorry to report that it did a pretty awful job at all of these things I expected to come as standard.  On the up side of this, the wireless connectivity I received was amazing, and I can’t fault apple there.

The Setup Process

When I first plugged in my Time Capsule, I got a wireless signal straight away and connected my laptop instantly.  I installed the CD that came in the HUGE box and the setup program ran away and connected and asked me for more information to join the network.   As I was in the office at the time, I decided to give this a miss until I got home (where the TC would be living), and tried to access the default network share.  This just prompted me for some logins, obviously I hadn’t setup the device, so I shut everything down and waited till I got home.  So far, not looking too great compared to other NAS drives I have purchased.

When I arrived home, I plugged in and went through the setup.  Now, apple have some great ‘Extend your wireless network’ option, which sounds great, but in fact simply just brings down your existing network and the time capsule.  So I had to reset the device settings and go again.  Finally, I got everything setup and working as it should.

Connecting To The Drive

Apple decided it wanted to have the IP address of 192.168.0.2, (very annoying as there is already a machine in the office on that IP, so using the Time Capsule when connected to VPN was a big no no unless I wanted to change all my local IP setup.  So I went ahead and just didn’t connect to VPN until I had transferred all my files.  And I wish it was that easy.  \\192.168.0.2 – The usual ‘Windows’ way only worked about 50% of the time.  I can’t even start to wonder how I can ping the TC but not connect to the file share.  I then setup a hostname for the damn thing and got going on \\timecap which actually worked out pretty well.

After I started transferring the 600GB or so (in a few different connections) the whole thing would seem to close all the transfer windows and the drive would appear offline.   I then had to wait about 10 minutes and it would automagically come back online.  During this time, I was able to access the internet without problems, but the time capsule configuration tool could not see the device, and nor could windows.  I was however connected to the wireless network provided by the TC (so I guess it only half crashed).

Refund Time

So, obviously 90% of Apple devices are not for me, and im not at all upset about that.  I have the iPhone and the Apple TV, but I think that is about as far as my life will delve into Apple.  I phoned Apple today and after telling them I had a windows machine, they were fresh out of ideas of how to fix the problems (I would like to point out, they didn’t have any ideas… at all).  I requested a full refund, and somehow, being passed around various departments, this ended up to be a replacement?  I shouldn’t think so Apple.  I want my money back!  In the end they decided they could give me a refund, so im waiting for a call from their courier to arrange a time for collection.

It sucks that Apple can’t create products that just work… they are big enough!

I have ordered up my new NAS drive, which supports iTunes amongst other things, so I hope all goes well :)

________________________________________
SEAGATE BARRACUDA 7200.11 1TB SATA II 7200RPM 32MB CACHE 11MS 300MB/S
________________________________________
SYNOLOGY DS108J 1-BAY SATA NAS SERVER FOR HOME AND SMALL WORKGROUP
________________________________________

It arrives tomorrow! YEY! I can hopefully get my data off the Time Capsule and onto my new drive before the TC is collected.

When I have a mind block programming, Photoshop is usually just around the corner.  I put together a quick wallpaper based on the mascot from Grab A Mascot for my iPhone.  It makes a nice change from the earth or some leaves.  Apple should really think about releasing some new wallpapers for their iphone as standard, and maybe a few GOOD ring tones wouldn’t go a miss.  I guess its to make you pay for ringtones on iTunes.  The iphone seems to come with nothing these days, I even had to buy a new Dock becuase they conveniently rounded the back of the phone to ensure the new phone does not fit in the old dock.  Now they either have some evil marketing guys or don’t think about their users when developing new devices.  Talking about the compatibility issues, my in-car-charger which worked perfectly with my original iPhone is now unsupported.  A CHARGER!  Do they actually think about anything?

Anyway, my wallpaper:

iPhone wallpaper

Sorry for getting side tracked.

In short, it really doesn’t matter.  After watching a MySQL web conference by Jay Pipes, I was gutted when I found out that they are actually exactly the same.  I know im not alone in thinking that it affected the size of the data field.  An unsigned int has the max value of 4294967295 no matter if its INT(1) or int(10) and will use 4 bytes of data.

So, what does the number in the brackets mean?  It pretty much comes down to display, its called the display-width.  The display width is a number from 1 to 255. You can set the display width if you want all of your integer values to “appear”.  If you enable zerofill on the row, the field will have a default value of 0 for int(1) and 0000000000 for int(10).

There are 5 main numeric data types, and you should choose each one on its own merits.   Based on the data you expect (or in some cases hope) to hold, you should use the correct data type.  If you dont ever expect to use a value of above 127 and below -128, you should use a tinyint.  This will only use 1 byte of data, which may not seem like much of a difference between the 4 used by an int, but as soon as you start to store more and more data, the effect on speed and space will be noticable.

Anyway, I thought I should share my new found knowledge of the display width with everyone, because it will save me thinking its optimising stuff changing from 10 to 5, haha.

After putting off the Intellichat migration last week due to issues with the load balancer (we had to order up a new more powerful one), we are finally in the last stages of testing.  I had a little chat with Dan Ushman at Singlehop today and asked him to pop over to the data center to get some pics of all our servers.  Singlehop used to have a great photographer, but he has moved over to London now, so I appologise for Dan’s photography skills but its pretty cool to see the servers for the first time.

We are set to go live within the next 14 hours, so testing is coming to an end and we will be up early in the morning to migrate everything over.  With any luck we are planning for 0% downtime, apart from the 15 minute drop in chats.

I hope you enjoy the pics :)





After adding the status.justuptime.com feature last week, we in the JDI office have taken full advantage of the system and have it on our main development screen and I even have it on my docked iPhone (sorta like a third screen :) ).

Everyone in the office is able to keep an eye on all of our servers and someone can quickly jump onto fix any problems that come up.  One of our servers was seen to be down earlier so I took a photo, the server was back up and running within 2 minutes of going down thanks to the quick response system we have setup at Just Host so all is good :) .

Why not get your website or servers into JustUptime.com and make life easy for yourself.  Automate the way you monitor your uptime and get the reports you need to keep your eye on the ball.

Being the first friday in the month, I thought I should introduct a new item to the development room.  We now have the ‘Friday Feature’ where we work on a ‘nice to have’ feature for one of our products.  These features will generally be quick bits which add some ‘cool’ to our products.

Just Uptime was the first product to have the JDIFF, and I thought an iPhone site to check the status of all your checks within the system would be pretty cool.  Any Just Uptime user is able to login to the new service which can be found at http://status.justuptime.com, this page can be viewed from any mobile device as well as your web browser, however, it was designed for the iPhone.

The service puts all checks found to be down at the top of the list making it easier for you to spot any problems as and when they come up and the page auto refreshes every 60 seconds.

I took some screenshots of the system so you can see it in action just below.

Last night I thought it would be a good idea to check out OpenSuse, so I downloaded the DVD and burned the only DVD I had with the image.  As soon as I got home, my vulnerable laptop was begging to keep windows at its heart, but in the end, after putting the OpenSuse DVD into the drive, it took complete control of the laptop and started the installation process.

The OpenSuse installation was very easy and did almost everything for me, apart from filling out my name etc.  It shrank my windows partition, and created a load more to use itself.  When I booted my laptop up in the morning, I got straight into my new operating system and started playing.  When I realised my wireless card was not installed by default, I thought I should switch over to windows and get any drivers I needed.  I restarted my machine and got the boot loader, and selected Vista.  Much to my horror, I was thrown straight back into the OpenSuse installation.

After hunting around online for solutions, I finally found the app bcdedit.exe stored in the system32 directory on my windows install (I was running repair mode off the Vista CD).  Running this, I could see all of my boot options and the paths they were using.  I noticed that the path for windows was still “\grldr.mbr” instead of the windows default “\windows\system32\winload.exe”.

Using the following command in command prompt, I managed to restore my Windows Boot Sequence.

bcdedit /set {default} path “\windows\system32\Winload.exe”

{default} should be replaced with the Guid of the loader you need, however {default} should work for most windows installs.