Tuesday, August 02, 2011

Waipo Valley Hike

While some people think i spend all my time on a perpetual vacation, it is sadly not the case. Everyday there is a little bit of something or another to be done.

However since i've been on the Big Island i've made an effort to try and relax, and actually have a vacation. Its not like i'll be having another one anytime soon. Being an iPhone developer and having loads of time off aren't compatible ideals.

So yesterday i started creaming myself on the prospect of visiting Waipo Valley, however it seemed so distance, and far from anywhere that it may as well have been on another planet. Initially i dismissed it, and decided instead to head for Akaka falls, a lovely 400ft waterfall only 20 minutes bus ride away.

However when my bus got to Akaka falls i didn't get off. It was a beautiful day, my camera was charged and my memory card was empty. I rode all the way to Waimea, in the north of the island, glimpsing the Towering Mount Kea, on the left and the steep coast to my right.



Though my consumption and research using the fantastic Offmaps i had learnt about a trail, just to the north of Waimea, that appeared to reach the valley. There is a more direct trek, that takes you to the head of the valley, however this is several Kilometers outside of town (READ not near the bus stop). So i decided to go a slightly different way, that allowed to me to go through town.


After walking though a residential neighbourhood to the north of the town. I found the entrance to the trail (above). Like all good hikers, i just ignored it and marched on.


After climbing the first hill, i got to what looked like a water treatment plant. Despite the signs at the gate, i vehicle from the Hawaii water department drove past me, but said or did nothing.


After the passing the water treatment facility i got to yet another gate, informing me that i was doing something or another wrong ... i ignored it and continued the march. With this particular gate i had to choices, jump it, or use the huge hole in the fence. It's always great to have options.


I was greeted by field full of cattle. I have to say that walking though a field of cattle by yourself is one of the strangest experiences i've ever had. They all just stare at you, and track your every movement silently. It reminded me a lot of when i was in China.


Climbing the hill further revealed a 50 million gallon reservoir, that was bone dry. I assume it fills up with rainwater run off over the winter, and then drains in the summer. This was one of three big reservoirs buried in the hills.


After another 5-10 minutes of walking a finally reached the Kohala Forest Reserve, at this point i knew it was on. I opened that gate and marched onward.


It went from grassy cattle pasture, to rainforest in the blink of an eye. The trail was easy to follow, but due to my naivety i was wearing trainers...


Trainers that got completely murked. There is a water pipe that runs along the trail, in several places it is leaking, which caused the mud trail to flood. Initially just walking on the grass was enough, but there were several places where this simply wasn't enough.

The landscape changed quite rapidly, going from rainforest to hilly plateau in a matter of minutes. While your at least 3 miles away from the nearest human being, you amazingly have 3 bars of AT & T service. I had turned data off to save battery. I'm not the worlds most amazing hiker so i didn't really want to be stranded in the middle of nowhere with half a sandwich, and Nutri-grain bar.
By this time i was almost 2 hours into the hike, I wasn't physically tired but the trail isn't scenic. There isn't much to see, and certainly no one to talk to. While i knew roughly how much further i had to go, the fact that i knew i had to retrace all my steps was beginning to depress the hell out of me. Especially as i was starting to consider if this dotted line that i had sacrificed my time to was actually a route to nowhere. I spotted a small hill up ahead, and made a deal with myself. If the canyon wasn't over the hill, then it was time to call it a day.


And there it was, 2000ft straight down, almost 4 miles in the middle of nowhere. I was at photographic "pay dirt". After about 10 minutes of this beautiful vista, i high tailed it out of there, rain clouds where all around, and this is the last place you want to be when it rains, especially considering that i wanted to salvage what was left of my trainers.

Overall i learnt a couple of things about my hike.

  • Never give up
  • Carry more food & water
  • Get hiking boots
  • Hawaii (Especially the Big Island) is beautiful.

Monday, August 01, 2011

Hawaii: Oahu & Hawai'i (aka The Big Island)

To be completely honest i knew very little about Hawaii as whole before i came here. But i've learnt a lot in the last 5 days. Mainly that i need to learn to drive. So thats definitely on the list for when i get home (finally).


Having flown into Oahu, i spent most of my time in Waikiki, Honolulu. As i was warned it was chock full of Japanese tourists showing off their Canon's and Nikons. I have nothing against my friends from the land of the Rising Sun, however i do suffer from a serious case of Lens envy.

After 6 days in the Japanese version of the Costa Del Sol, i've  flown to Hilo, on the big island, aka Hawai'i. Today, i felt like an idiot for even spending more than two days in Oahu.

Firstly the big island, is well, BIG. The road that runs around the entire coast is almost 300 miles long. I spent today in the car with some good people from Holland, we barely explored a quarter of the island. This place is huge.


What really stuck me is the differences in the flora in various parts of the island. In some places it looks like a Rain forrest, while in others it looks like the surface of Mars. The above is the beautiful rainbow falls.


This is an example of the rainforest like terrain. It even has a canopy that the Brazil Rainforest would be jealous of. Really makes me look forward to the day i finally set foot on the continent of South America, Un dia, un dia.


Then there is the black volcanic rocks. While i know the landscape was formed by magma, it almost seems as if it's been scared by it. I've been fortunate enough to see some amazing things. But this is truly fascinating.

Saturday, July 30, 2011

Auto incrementing version numbers in Xcode

Over the last month or so i've had to kick out a lot of betas for a project. Seeing as i use the fantastic Test Flight. I have to change the version number before i upload each build otherwise Test Flight will overwrite an existing build which is the last thing that we want.

I don't think anyone actually enjoys editing a plists, whether its in Xcode plist editor or the down and dirty XML. So has a result it was the perfect opportunity to get familiar with xcode's build process, and how to tie external scripts into it.

I use 3 segment version numbers (1.1.1), where the first digit is the major version, second digit is the minor version, and the 3rd digit is the build. For the benefit of the team, i wanted to have the latest commit hash in the build number so that people could quickly reference it and know whats going on.

With some direction from this post by Duane Sibilly i was able to hack together the below.

Friday, July 29, 2011

Wednesday, July 20, 2011

Goodnight San Francisco


The Mighty Pacific

When i'm not winning iOS Dev Camp, answering emails or writing code i like to take photos. Lots and lots of photos. As my time in the Bay Area comes to an end, i thought that it might be nice if i actually took the time to visit the Pacific Ocean.

Initially it was foggy (like it usually is) however it soon cleared up.


The birds came out...


As did the people ...


The sun shone ...


And everything was well with the universe (if only for today)

Friday, July 15, 2011

I Took a Picture [SF Edition]

HDR of San Francisco with 3 RAW 14Mpx Exposures processed in Photomatix Pro (Unlicensed ^_^ )

Sunday, July 10, 2011

Monday, July 04, 2011

The Golden Gate


After years of just seeing it in photos i got the opportunity to photograph it myself. It was the culmination of a fantastic day; the end of WWDC and an excellent talk by Buzz Aldrin.

Many people have asked during my journey if i keep a journal. While i don't in a conventional sense, photo's like these will help me remember this experience for a lifetime. 

What isn't always obvious is that the Golden Gate is essentially in the middle of nowhere. There is no easy way to get there from downtown San Francisco without a car, so i had to get my bike on, by chance i was able to rent one at a bike shop near 4th & Harrison. The $400 deposit scared the crap out of me at first, but it was alright in the end.

San Francisco is hilly place, so my plan was to cycle along the Embarcadero, which runs parallel to the shoreline (read: nice and flat). The previous link goes to my little weekend project. I built an app called gpxshare which allows people to upload and share GPX tracks for free. 



This was some what of a rambling post, but i just wanted to share some of these awesome pictures.

Tuesday, May 24, 2011

Core Data & Multi-Threading, part 1337

So i've made yet another Core Data Discovery, at this rate i might need to write a ebook. Now we all know that the golden rule of using Core Data with different threads is to not share contexts between threads.
So if you need to refer to an object on multiple threads you need to use it's NSManagedObjectID. Thats all well and good, but what if you need to call [NSManagedObjectContext save:] multiple times. Well in short it's gonna suck. Well thats cool you say, i can just use the id anyway ... Not quite. There are two types of ID's, permanent and temporary.
Now in my experience Core Data seems to get confused when you use temporary ID's to look up objects on another NSManagedObjectContext. So really to stop these conflicts we need to get a permanent id, but we need to obtain one of these ID's without saving the NSManagedObjectContext.


Well are you ready for the magic ... Shazam

[NSManagedObjectContext obtainPermanentIDsForObjects: error:]

This awesome method will take an array of managed objects, and give them permanent ID's. From my brief tests the overhead is minimal compared to the traditional save method.

Thats all i've got for today, keep on trucking.

[]'s 4 life

Monday, May 09, 2011

Asynchronous Core Data searches with Blocks

I was recently fortunate enough to be able to drop iOS 3 support on a project. This meant that i could start to play around fully with Blocks on iOS. One thing that has always got on my nerves is that there is no built in support for asynchronous Core Data searches.

Previously i tried to wrap up potentially long operations in a special FRCoreDataOperation a subclass of NSOperation. However this was a pain, as i would then have to subclass it or modify the parent class to provide me with a simple callback when the task was complete.

What i really longed for was the way in which you make Ajax requests in jQuery, that of course requires closures, which are of course provided in the form of Blocks. So after hacking around for a bit i came up with this.

Now this is my first real time using blocks outside of simple things like iteration etc. It means that i can do

Now here's the part where i pat myself on the back. The callbacks are executed on the main thread, after the async fetch request is completed. Plus it gets better, The NSArray, for the onComplete block contains a list of the returned objects that are registered with the NSManagedObjectContext for the main thread, or in other words the NSManagedObjectContext you used to perform the fetch.

Once i touch down in the valley i plan to extend this to manage saves as well, making the basic CRUD operations with Core Data "scroll like butter".

Sunday, April 24, 2011

Roaming in jamaica

£6 per MB and it's EDGE, give me strength please.

One flip side this country is a very different to the one I left. But for the most part different for the better.

Going to my grandparents house for the first time in 10 years has been fairly emotional. I'm still expecting to see them around house despite the fact the both have been dead for sometime.

I've compared it to a time machine, as it feels like I've just fast forwarded into the future. One without two people that I had come to know and love so well.

When I landed the lady at customs asked why I hadn't been back in so long (10 years), I'm slowly learning that it's because I knew subconsciously that it would be an emotional roller coaster.

Tuesday, April 12, 2011

Animating a series of images with CALayer

So you want a to animate a series of images, flip book style. While it is true you can use UIImageView, everyone knows that is for wimps. Real men (& ladies ;) ) use CALayer (like a boss)...

But how? Well you might have some how got in your head that CALayer's contents property supports a NSArray of CGImages. Well this is not the answer, remember that the contents property takes an 'id'as a argument so it supports virtually everything under the sun and then some. Hell, if you felt like making crazy things happen you could just throw a NSData object in there.

Anyways, the actual solution is to use a CAKeyFrameAnimation, to manage the rotation of your images, control the frame rate, and ultimately the duration.

Well all is said and done it should look at this

Sunday, April 10, 2011

Drawing text with a Gradient

Problem

You want to draw (unicode) text with filled with a gradient.

Solution

Since my middle name is now "Core Graphics", let me help you out. It's actually pretty simple. Create your desired gradient in a your image editor of choice, and save it as a PNG. Import it into your project and then ...

Yep folks thats it. Now if you find that your gradient is slightly out of place, you can use CGContextSetPatternPhase to help. You of course would use this before your drawing statement. The docs say:

The pattern phase is a translation that Quartz applies prior to drawing a pattern in the context. The pattern phase is part of the graphics state of a context, and the default pattern phase is (0,0). Setting the pattern phase has the effect of temporarily changing the pattern matrix of any pattern you draw. For example, setting the context’s pattern phase to (2,3) has the effect of moving the start of pattern cell tiling to the point (2,3) in default user space.

So when all is said and done you get this lovely effect

text drawn with a gradient Best of all this effect works all the back to iOS 2.0!

Saturday, April 02, 2011

Problem: Symbolicate won't ... um symbolicate.

Long live Crash reports, Crash reports are dead. We all love em right, couldn't live without them. But what happens when crash reports go bad. Sadly this isn't a lead up to a blockbuster movie but in fact a real life issue.

As much as a i love Xcode 4, (and i really love it) it swallows errors that symbolicatecrash script spits out. This caused me to send loads of time trying to fix an issue that i knew nothing about.

Well here's the solution. 

1. Do a project clean in Xcode (cmd+shift+K)
2. Delete the entire 'PROJECT/build' directory
3. Go to ~/Library/Application Support/iPhone Simulator/VERSION/Applications/UUID and delete each folder that contains your application name. Be sure to do so for each Version of the SDK.

And then attempt to symbolicate your reports.

I'm led to believe that some genius (who i'll target at WWDC and buy him/her a beer) thought it would be a great idea to use Spotlight to find dSYM files. Sadly i don't believe they thought (or could) apply any sort of search order, leading to spotlight returning random binaries. (When good ideas go wrong).

FYI. If your a member of the Xcode Team, i genuinely appreciate all the work that you folks put into 4.x.  

Thursday, March 31, 2011

Coming to America

So after managing to avoid the states in all forms for well over a decade it's time to go back. I'll be able to enjoy the benefits of naked body scanners, and requests to show my papers.

Anyways the trip is split into 4 parts, over two months.

A. New York city
B. Jamaica
C. Los Angeles
D. WWDC in San Francisco.

Interestingly, I have no return ticket, not because I'm planning on becoming an illegal (please note TSA) but because I'm not sure if I'm coming back to the UK or if I will carry on heading west, and reunite myself with the Chinese people (they miss me you know).

The first leg is booked for April 18th, so as song says I'll be "new York da da da dada da new York" HOV ...

While WWDC should be a blast the most emotional part will be going back to Jamaica almost 10 years to the date that I left.

Bon voyage

Tuesday, March 15, 2011

Jonathan @ 24

Well would you look at that. I'm 24 years old. Kinda strange I might add. Well being the kinda introspective dude I am, I thought I would look at my highlights over my 23rd year on this planet.

....

Yeah so that's it, fascinating don't you think. But seriously my 23rd year was a good year, and I'll strive to make my 24 th even better, with the usual smattering of travel adventures, odd situations and hard core forking.

Thursday, February 10, 2011

Creating Push Notification certificates that you can use .cert -> .pem

Thanks to this helpful the post, the rest of the world knows how to convert .cert files (the ones the ADC gives you) into .pem files, the ones you need to actually send notifications to apple.

To further aid this, threw together a little shell script that takes two arguements, the certificate.p12 file and the private key.p12 file and creates a apns_certificate.pem file. Saves a bit of typing and also gives you a hard copy of the commands needed to create the certificates

Wednesday, February 09, 2011

From Russia With Code


I had the privilege of travelling to Kiev, Ukraine for Business. For me this was first trip to eastern europe. Thus far i had only been as far as Hambug, Germany. Which even at it's height was in West Germany, and i believe in the UK control area, so it wasn't even that different. I'm writing this on the plane but i expect the culture difference to be close to that of china, but with out the squat toilets ...

In a way this is good prep for me as i've always wanted to ride the train from Moscow all the way to 北京, and maybe even on to Pongyang, DPRK (insert joke here).

The Standout things
* Everyone seems to like drinking tomato juice, in lieu of fruit juice.
* Haven't seen a samovar yet.
* Yes, they drink a lot of vodka.
* You never drink vodka without eating ... unlike the UK
* It's not as destitute as you would think
* A lot of people speak english, especially in service industry.
* My Russian is awful
* It kinda looks like that level from Call of Duty 4 modern warfare, you know, this one, seriously.

Sad i was only there for three days, three cold days, where i didn't go outside much. But hopefully i should go back in the summer so i'll have more to say and show then.