The musing and sometimes not so wise words of Jonathan Dalrymple, Global Traveller, Programmer, Financial Rocket Scientist, Conspiracy Theorist, Part-time comedian, full-time funny man and whatever else i randomly decide to do.
Monday, May 17, 2010
IPhone OS 4: The multi-tasking myth
Recently i had a prospective client who wanted to take advantage of iPhone OS 4 new "multitasking" feature. I had to break the bad news to them that there is no true multi tasking,just apis to allow specific things to be done in the background.
And that is the key phase "multitasking api", real multitasking doesn't require an api it just happens. Sure you might need some events to determine focus, but beyond that you just write code as if your app was the only one in existence.
So heres a quick run down of mulitasking on the iPhone. If your application adheres to any of the following use cases then checkout the new 4.0 sdk
Always on VOIP client
Receive device location updates
Play music in the background
Send messages to be received after a predetermined interval.
Operate for an addition 5-10 seconds after termination.
For everything else the solution is push notifications, Yay!
Thursday, April 01, 2010
You had me going for a sec!
So i click accept, my chairman is ken bates after all so it's not impossible!
Well apparently it is. Not sure how i'm going to explain that £100 million pound bid for messi. Football's coming home you know!
Tuesday, March 30, 2010
Trends in iPhone app design
appreciate design changes in other developers app. However due to my
recent brush with RSI I suddenly have some more time. So here is list
of my favourites.
Finanical times
I love the fade transition that they use when you change the device
orientation. I mean really love it. And from a development point of
view it has a couple of major wins. Namely that unlike the standard
rotation animation, you have a nice delay between the switching of the
views. Ideal if you want to load some Additional content or an
additional view. Granted you would have to do this quickly as you
don't want you user staring at a blank screen while you parse so e XML
or execute a network operation.
Also I assume it's just a case if Animating the properties of the ui
to change the super view opacity to get the desired effect.
Yahoo finance
Loving the charts btw. The Apple UIG generally tells devs to stay away
from displaying multiple types of content. However this app does a
nice job of making it work. This design should also scale nicely to
the iPad.
I have a fetish for finance apps not only because of my forays into
the markets, but unlike most apps they need to deliver a lot content/
information to their users.
The other neat thing about this app is that it give the user control
over the size of the widgets that are display for each security. You
can also swap the arranged ment of the items. Now I guessing this is a
hell of a lot of interface code. On top of the code they are using to
generate the graphs. But awesome ui.
Sunday, March 28, 2010
Mocking Core Location
This is fresh out of the oven, i plan to add a timer and exec the sendUpdate method after a set delay and read the locations from a text file. I'll post it up on git hub if i ever get it done
Update 29/03/10
Since writing this post i've put up a working version of the code on GitHub, Fork away
Monday, March 22, 2010
SVG Graphics on the iPhone
Yeah, that performance sucks.
My problem is two fold, my client wants to export the data as a vector. Common sense wil tell you, that importing multiple vectors and then trying to export them again as a vector, in raster/bitmap based container isn't going to work.
So it looks like me and the SVG spec are going to get really cosy. The only blessing here is that SVG's that my client wants to use are fairly simple, so i should need to implement the entire spec.
Sunday, March 21, 2010
Non Global Singletons in Obj-C
Generally speaking, Cocoa coventions (at least in all the documentation i've read), recommendation for sharing object instances across multiple controllers is to make it part of the application delegate. Personally i hate this, as it leads to a congested app delegate full of random iVars. Now it could be argued that if you find yourself in this place your doing it wrong, and in all truth you probably are. But considering that apple themselves suggest placing the CoreData ObjectContext in the app delegate, i think we're in good company.
My solution takes advantage of one of objective-c's many unique features, categories. Categories allow you to add methods to a class without modifing or subclassing. To most non cocoa programmers i just blew your mind, just wait to you find out about Swizzling!
Essentially i define a category on the class that i want to use as a singleton. In my scenario i wanted to have a single CLLocationManager In my entire app. This is because i need to access the devices location on a regular basis, and i want a global accuracy configuration ... and i just wanna try out some stuff :).
Code time
What i have done is simulated the typical method that you would expect to see for a singleton instance, but behind the scenes this method calls a property on the app delegate to get the shared instance variable.
In my eyes the positives to this approach are:
No global variable for the instance.
The Share instance is where you would expect it to me, and if required can be serialized on app exit.
Accessing the instance is as easy as [CLLocationManager sharedInstance] vs [[[[UIApplication sharedApplication] delegate] locationManager]
Lastly, if the internets tell me that this is a wacky idea i can refractor this to classic singleton, without making mass changes to my app. Thoughts and opinions.
Friday, March 12, 2010
Reverse Engineering: Youtube & h.264 for the masses
Like any sensible mac user i signed up to the youtube beta as soon as i heard about it. My beloved 2007 macbook is starting to show it's age, and while it can handle 1080p videos without melting (it's sweats a fair bit!), flash videos truly bring it to its knees.
So first thing i did was select a random youtube video, this one happened to be a short about the upcoming indian premier league (i personally hate cricket, but anyways...).
I was immediately disheartened, it wasn't going to be as easy as simply reformatting the link ...
This format is new and exclusive to the HTML 5 beta, from my research the h.264 content delivered to the iphone has a different format, and is served from a different domain.
Domains/SubDomains
Also a quick glance shows that a different series of subdomains are used, and while i haven't tested, i'm guessing these are a series of load balance servers, so there is no guarantee that the video will be on the same server.
Signature(s)
Even more bad news the signature param appears to change on every request, suggesting that it's generated for each session. I tested this, my using the same account to watch the same video, but once in safari and once in chrome, checking the signatures each time.
Signature A
25BF3979A2386835A59AE3DA23076950B6323FB1.670A622C94E87A9192D1CD62885B2589D6EC9A1F
Signature B
B2F0121150A88F697711D19D2F1F8B18EBFC3058.9FE89BCC68B319D255A83A613C84A2040CAF3B2B
Beyond the signature nothing else seems to change. My guess is that youtube will have to open this up when they start to provide video embed tags instead or in addition to the standard object/embed mashup.
Retardation, tells me those are 2 SHA1 hashes separated by a dot, the age old question is whats the plain text?
Conclusion
I'm not kevin Mitnick (Holla at me Kevin ;) ). My minimal security knowledge tells me that the plain text includes a variable that is changing. My assumption is that it user session key, but with no know access to it. (Unless the people aka google are
So for now the h.264 videos are safe :(
Monday, February 22, 2010
CakePHP & User Uploads
Thankfully cakes media views allow you to specify a folder anywhere on the webserver!
What i decided to do was to make a simple controller called media and route all of my USG images through it.
class MediaController extends AppController {
/**
*
* @var string
* @access public
*/
var $name = 'Media';
var $uses = array();
/**
* Index action.
*
* @access public
*/
function index( $file = null, $size = 's' ) {
$this->view = 'Media';
$components = split('\.',$file);
$params = array(
'id'=> $components[0],
'name'=> $components[0],
'extension'=> $components[1],
'path' => ROOT . DS. 'media' . DS .'filter'. DS . $size .DS . 'transfer' . DS . 'gen' . DS
);
$this->set($params);
}
}
So the controller looks a little something like this in it's raw form. I'm using the Media plugin, hence the addition folder paths. The key thing to note is the 'Path' key/val pair in the $params array. Notice you can pass an absolute file path! so in theory you could even mount another drive, and serve your media from there, pretty awesome.
This way, i can use a url like this
example.com/media/filename.jpg/l
To get a large image, and
example.com/media/filename.jpg/s
And this to get a small image.
Quite handy!
Sunday, February 21, 2010
Its 2010, Time to blog
I've had an online property called Russian Space Station since late 2001, If for history's sake alone, The show must go on!
Monday, February 15, 2010
MWC 2010
interesting so far, and a overal good experience. Sadly none of the
folks that I know personally are here. But this is a different type of
event than what I'm used to going to. I mainly went because the ticket
was free, when yo get a 700 euro ticket for free you don't really
complain. So thanks to the folks from vodaphone.
The scale of this thing is crazy, my legs are knackered and I've only
been here for an hour and a half.
Jonathan
Wednesday, October 21, 2009
Riding down the river
the other ...
Ok maybe I'll skip the comedy. China is a beautiful country I've seem
so much but I know i've seen so little. I'm not quite sure where this
boat is taking me but part of me doesn't care. In the last few weeks
I've begun to appreciate the romance of traveling the world.
I love work, I especially love my work, and in this day and age of
technology who is to say that I can't pack up my MacBook get on a
plane and become a nomadic programmer sucking down torrents when the
opportunity strikes, war driving in foreign lands...
It's a dream, just like my house in andorra and my grey Aston martin.
However as I'm learning from this trip dreams can come true. Hopefully
I won't wake from this one to find the world doesn't agree with my
plans.
Quote of the week
Tanya "how many Mosquitos are there here?"
Me "12..."
Tuesday, October 20, 2009
Dreams do come true
know that this city borders hong kong.
I've had a fasination with hong kong since I was about 7. The concept
of a far flung British enclave full of skyscrapers amazed me.
I remember watching the hand over ceremony in 97 thinking, I would
love to be there.
More importantly I was watching it with my grandfather. I always told
I wanted to go, and perhaps even live there. While the latter hasn't
happened I would like to think that he is proud of me for achieving my
dream.
Jonathan
Thursday, July 09, 2009
Hei se ren zai zhongguo!!
I had wanted to blog about my experiences while i was there, but a combination factors, namely i was having to much fun, stopped me from doing so.
My trip lasted 21 days, in that time my perspective and views on the world changed dramatically.
The motif i left China with was:
"Ignorance is dead, long live ignorance". I went to China thinking that i was a fairly open minded person, dismissing all but the most absurd things.
I should preface this by saying that i realise that the china i saw was the watered down westernized version. Any cultured battered by a foreign civilization(US/west) over several decades is going to experience some level of change.
Politics
China (mainland) is very different from anything i've experienced before. First people who call the country a developing nation/3rd world country are misled. Sure there are undeveloped parts of the country, they are called villages. The cities are bigger than anything the west has offer, and in some ways better.
China isn't a developing nation, its developed! It is the new superpower, financially, and strategically. I've admired how the government conducts itself outside of its borders. Slowly buying up resources around the world, in deals that could considered slightly unfair, but are deals not invasions (iraq) backed with questionable events(9/11). This is how the British empire started many moons ago. On the basis of (one-sided) trade, and a mighty navy to protect that trade. The US 'empire' also started like this, and guess who has the biggest naval fleet now?
Having read the above you might think i disagree with this practice. Not really, its the cycle of life, the strong prey on the weak ... The Eagle and the Mouse.
The food
Thanks to china, a new mime emerged in my life, "noodle time". This is basically when my craving for noodles gets to much and i have to statisfy it, with ... Noodles!! Rice noodles, eggs noodles, whatever!
The food is amazing, i would marry a chinese woman, just to get that (the food) on a regular basis. One of my favourites is jian bing which is crepe made with eggs, fried dough (this is the magic), hot sauce, spring onions and some other magic. Best breakfast in the world.
Next up is stir fried noodles, simple, quick and very tasty. If i had to rate the rood, i would give it 10 stars out of 5, i ate like pig.
Shopping
Ever heard of a factory direct store, think of china as one great big one. All of your favourite brands at one tenth of the price if not less. Sadly this doesn't extend to electronics. Well not if you want ones that work, more on that later.
People
Chinese people are really friendly and in general extremely welcoming to westerners. While i was there i was consantly being asked to take pictures with people, and i mean 'with' not 'of'.
Language
i speak chinese right, so that means i should have had no problem communicating right? Not quite, it helped but at first it was awful. The problem with my chinese was that i had a decent vocaburary, but very poor pronouncation. The other problem was that my listening skills were poor, this was highlighted when i conversed with the locals, and they (assuming i was fluent) would reel off something at me! In the latter stages of my trip i could comprehend most of the nouns in the sentence, along with the odd adjective or verb and use common-sense to work out the meaning of the sentence.
The peak of my chinese came in yangshou, where i talked to a rickshaw driver about my iPod Touch, while playing Mahjong. Even got a discount fare out of him, other highlights where drunk bargining with the traders in yangshou and getting a certain polo shirt.
Conclusion
Absolutely awesome. I loved china, and can't wait to go back. God willing i will one day, how long for is just a question of how long they will give me a visa for!
Zaijian
Friday, June 26, 2009
Ah, the sixties

This program made me wonder what is the big thing of our generation. Yes i know that we have the internet, but is that all we get? Might sound greedy but if you think back to the sixties they had colour TV, Jet Airplanes, moon landings etc. Is the current parallel Twitter and Facebook?
Sunday, May 10, 2009
freaking out chinese people in doha
Of course first and foremost this is a technology blog. So lets chop up game. The in flight entertainment was pretty awesome, i watched grand torino, and the valkyrie, played a little tetris. But the most awesome thing, (if it had worked) live TV! Nothing fancy just news channels. I guess it's too much to ask for skysports @ 40k in 2009.
Also while at heathrow, i checked out the HP mininote 1k. I've wanted a netbook for a while but i've been hoping pingguo (apple) would service my mobile needs. Oh, just to say again, while my ipod touch is awesome for movies and web browsing(especially compared to this e61), when it comes to blogging, its pants.
i love travelling, don't get me wrong, but would love it even more if i could be playing FM right now ... Dalrymple wins the cup ...
Friday, May 08, 2009
It's over!
Heres some extremely basic python for transforming a simple list of CRLF separated values into a sql statement.
def main():
fh = open('list.txt')
sql = open('sqlDump.txt','w')
i = 0
for line in fh:
statement = "INSERT INTO table (name) VALUES ('%s');\r" % line.rstrip()
sql.write( statement )
fh.close()
sql.close()
if __name__ == '__main__':
main()
Nothing special.
Off to china on sunday!!
再见
Tuesday, April 28, 2009
The iPod Touch is awesome
Messenging devices need keyboards.
For all intends and purposes this thing is basically a netbook/net tablet.
China (and my dissertation!) is only days away. All i'm lacking now is the camera.
** UPDATE **
Never edited a blog post in my life, but there is first time for everything, and this perfectly illustrates my point.
This post was short for a reason. I wrote it on a ipod touch. I hate typing on touch screens, i like keyboards. Why you ask? Tactile feedback! A simple beep is great, but imagine, if you could actually press a key, and feel the response from it! Wouldn't that be awesome! RIMM thought the same thing, and created the Storm, sadly RIMM should have stolen a page from Palm, and took a handful of Apple engineers to create the UI. Cause the Storm sucks badly (plus no Wifi what year did you think it was!)
Virtual keyboards not only provide no tactile feedback, but they also take up screen real estate. Granted that in most situations you only need it for a couple of seconds to put in a web address or to send a tweet. If you are from the long form generation, and can see past the reality distortion field (no physical keyboard eliminates the need for multiple skus!! ), you will know that keyboards are just better. Thats why i'm clinging to my e61 with a death grip, it's huge, ugly, but it messages like no other (well until palm pre time!).
Tuesday, April 21, 2009
中國 is calling

I decided to blog from the park today. The primary reason behind this the 18 degree weather. You have to take advantage of this things when you have the chance.
In all the time i've had my beloved blackbook, i've never really used it outside. Quite frankly i don't know why. It looks quite cool(i think) to just sit here, with google reader watching the news and the world go by all at the same time.
At the moment there are two things dominating my mind, well actually three, but i'm only going to write about two.
China,
I'm getting so excited it's scary. Currently i'm waiting to see if the lovely folks in the chinese government will grant me entry to their beautiful county. I'm practicing my chinese often, and my tonal pronunciation is getting better.
I still haven't decided whether or not to bring my mac. I didn't want to, but i planned to have a palm pre in my possession by this time! But if i really want to podcast, and stay fairly connect, and considering that my e61's battery doesn't hold a charge like it used to it maybe that time. Plus i get to play FM for hours, oh the fun i'm gonna have! Just imagine a 22 year old man clapping to a screen at 40k feet!
My degree,
It's almost over i can taste the end, and it tastes sweet. Not quite 草莓 (Strawberry)but nice. There is still a fair bit of work left to do, but all things are possible, and i'm on target. Sadly i doubt i'm going to get a stunning degree, but at this point i just want to be free of academia. But at the time of writing there are only another 2 and bit weeks left, so bring it on. (remind me i said that).
With summer coming up, and hopefully more time on my hands i'll hopefully blog a bit more. It's not like i'm going to be doing loads now that i 'have' to hold down a job, but still if people can have 100k followers on twitter i surely must be able to blog once a week. Maybe i need to but some twiiter integration on this thing! Speaking of integration, The usual summer process of redsign should be happening soon, both the blog and the company site, i need to attempt to be serious, if only for a moment.
再見
Quote of the Day
"The greatest skill you can have as a man is being able to cook"
Mark Udall, One of my lectures
Friday, April 10, 2009
Couch DB as messaging queue
Ah, Messaging queues so distinctly british!
Thursday, April 02, 2009
Beijing Bitches
My route is:
Beijing > Shanghai > Xi'an > Yichang > Three Gorges Dam > Yangshuo > Hong Kong
I've even started a podcast. The Only Negro In China Podcast. I recorded the first episode yesterday, expect to see it online soon.
Exciting times

