Archive for April, 2010

Simplicity with o2

26 April 2010 23:23

If you’ve got yourself an iPhone, particular a 3G, odds are you’re out of, or, coming up to being out of contract. You’re probably paying £35/m right now as well. If like me you’re holding on for June/July to see if a new iPhone is launched, which, it probably will be you’re not going to want to jump into a 18/24 month contract to upgrade to a 3GS (albeit tempting). O2 actually seem to have an answer in their reasonable new Simplicity SIM only tariffs. For £20/m you can get unlimited texts and 300 minutes inclusive.

It’s also really easy to switch online once you’ve found the right links. If you click on the “Shop” dropdown at the top you’ll see an Upgrade Your Phone link. Follow that, enter your mobile number and then the code you’ll get by SMS. Once in you can pick from the don’t want a phone section and just pick the new tariff. You can also just go on a month to month rolling contract which is great, saves you money and hopefully makes you ready for the iPhone 4G. You can also “downgrade” to these tariffs and save £5/m if you go for a 12 month contract.

I’ve gone through the process just now and as yet not received a confirmation email but hopefully that’ll turn up soon!

Edit: Still no email but now the O2 iPhone app shows I’m on to simplicity 20 tariff.

Filed: Personal, Technology // Tagged: , , , // No Comments

MySQL and 0x0B

23 April 2010 12:01

You may or may not know about the wonderful vertical tab character 0x0B. It’s a character that’s not easy to see and can cause issues across a number of different programming languages. In my case a Rails developer was having trouble passing some data from an API. A JSON parser was throwing errors about a specific character. Originally we suspected line breaks were causing the issue but after more digging and examination using Textmate and the Text bundle we spotted the invisible characters and having converted it to hex found out it was 0x0B. A quick Google brings back quite a few results of people having the same problem.

In order to find them in the database I knocked up the following SQL:

SELECT * FROM table WHERE data LIKE CONCAT('%',CHAR(0x0B),'%');

Then to replace them quickly (assuming the 3 records have ID’s 1,2 and 3):

UPDATE table SET data = REPLACE(data,CHAR(0x0B),'') WHERE id IN (1,2,3);

Filed: Technology // Tagged: , , // 1 Comment

Tweeting from the command line

21 April 2010 17:22

I read an article over at OS X Daily about posting a tweet from the command line using the twitter API. Taking this one step further here’s a handy little script that’ll even stop you posting nothing and stuff that’s too long.

#!/bin/bash
TWEET=$1
TWEETLEN=${#TWEET}
if [ $TWEETLEN -eq 0 ] || [ $TWEETLEN -gt 140 ]; then
	if [ $TWEETLEN -gt 140 ]; then
		let EXTRA=$TWEETLEN-140
		echo "Usage: tweet \"message\" (140 chars or less, you're $EXTRA over)"
	else
		echo "Usage: tweet \"message\" (140 chars or less)"
	fi
	exit 1
else
	curl -u username:password -d status="$1" http://twitter.com/statuses/update.xml
fi
exit 0

Save the file as “tweet” and make sure it’s in the path with executable permissions of 755.

chmod 755 tweet

Filed: Technology // Tagged: , , // 2 Comments

 
What's ianteresting?   •   Twitter   •   About   •   Contact
©2010 Ian Winter. All Rights Reserved.   •   Powered by WordPress   •   Hosted at Memset