Downgrade Iphone 3G from IOS4 to 3.1.3

November 23rd, 2010 by pyrat


Apple could be evil?

Note: This guide is only for the Iphone 3G.

Disclaimer: It is illegal to jailbreak your phone and it will void your warranty. I take no responsibility for any phone related issues due to following this guide. Use at your own risk and know what you are doing!

Rant

The Iphone 3G is getting on a bit now, its a few years old and is no longer available for purchase. If you want the latest and greatest functionality you should buy a new Iphone.

However, for most things (phone, ipod, mobile safari, apps, messaging) it is still a great phone which is as good as most smartphones.

Apple recently released IOS4 which is really targeted at iphone 4 and ipad users. The iphone 3G cannot handle running this OS and becomes slow and unresponsive. Apps often crash and something as simple as sending a text message takes ages.

Apple have tried to address this with 4.1 and the upcoming 4.2 release but essentially this is an operating system not really designed for this device.

They should really have just made this update not available for Iphone 3G users as it would have kept their devices performing well. Instead it makes the device seem slow and old and in some ways forces customers to upgrade their device.

I accept that my Iphone is an “old” device now, but dont want to cripple it with software updates.

If you are running IOS4.0 and want to revert back to the blazing fast world of 3.1.3 these instructions are for you.

Unfortunately there are many different permutations of upgrade and downgrade scenarios. I can only explain what worked to downgrade and am by no means an IOS expert.

Tools

Sometimes these ipsw files will reside on your system but download them as I did to stay with the guide.

Make sure you have Contacts synced

Make sure you have your contacts synced with your address book and dont mind losing text message history etc. Contacts are synced to the address book app and in turn you have backup this also.

Restore to 3.1.3

After you have all the files listed above do the following to restore to 3.1.3

Put the phone in recovery mode

  • Plug in your iPhone.
  • Power it down by holding the sleep/lock button and sliding to power off.
  • Once it’s powered down, press and hold both the sleep/lock button and the home button for ten seconds.
  • After ten seconds, release the power button but continue holding down the home button.
  • If you did it right, iTunes will pop up a window telling you that it’s detected an iPhone in recovery mode and your iPhone’s screen will be black. If it didn’t work, start from the beginning and try again.

Restore to 3.1.3

Discard the alert that you’re in recovery mode. Click on the iPhone under Devices sidebar in iTunes -> hold Shift -> click the Restore button (if you’re on OS X, Alt/Opt+Click). A pop up a window prompting you to choose a file appears. You want to navigate to the 3.1.3 OS you located or downloaded above. Select that file, and iTunes will start the OS restore process. Expect this to take around 10 minutes or so.

After its done, you may get an error message (error 1015) and your iPhone will boot up with a “Connect to iTunes” screen. Open RecBoot, and click Exit Recovery Mode. In a few seconds, RecBoot would help you out of plug-me-into-iTunes recovery mode and you’ll boot right into your freshly downgraded 3.1.3.

Adapted from this excellent guide

Jailbreak 3.1.3

  • Start redsn0w 0.9.4 and point it to the respective original iPhone 3.1.2 firmware to proceed. Yes you need to point it to iPhone 3.1.2 instead of 3.1.3 because redsn0w 0.9.4 is still unable to validate the latest firmware.
  • Please make sure to check “install cydia” in the redsn0w setup.
  • Now make sure your device is both OFF and PLUGGED IN to the computer before you click “Next”.
  • redsn0w will guide you through the rest of the jailbreaking process.

Adapted from this excellent guide

Unlock 3.1.3

Open Cydia and wait for it to organise itself. This took ages for me.

  • touch on the sources area of cydia
  • Touch on “Edit” and then on “Add”. You will be prompted to enter a url source as seen in the screenshot below. Type “http://repo666.ultrasn0w.com” and touch on “Add Source”.
  • Cydia will now automatically update your sources by following a series of automated steps.
  • Once the repository has been added successfully, Search for “ultrasn0w” in Cydia and install this application. The latest version 1.1 of this app will automatically unlock your iPhone so that you can use it with any carrier with proper carrier name/logo.

Adapted from this excellent guide

Sync with Itunes

This should copy across contacts and applications. You may need to setup other information such as music syncing and podcasting sync settings up again.

Hope this helps, and let me know of any issues with this guide.

Lofoten, the real deal. – (Days 10 – 12) – Arctic Cycle 2010

September 26th, 2010 by pyrat

Day 10

day 10
Day 10

Today we were feeling quite lazy and did an easy jaunt through the jagged mountains of Lofoten (Austvågøya) to the town of Solvær (capital of lofoten). Solvær as OK and we had a tasty snack and bought some delicious bread. (Vestfjordbrod from Kringla Bakeri in the main square.)

Climbers at partywave
Climbers at partywave

We continued onto hip and happening Henningsvær, the climbing captial of Lofoten. We relaxed in the climbing cafe over some Nordland Pils and partook in a magnificent shower. Finally we retired to PARTYWAVE the cool climbers wild campsite and evaded the clouds of angry mosquitos.

Helen reading the girl with the dragon tattoo
Helen reading the girl with the dragon tattoo

I tried to get a pair of Norrøna Lofoten ski pants for cheap (RRP circa £400) but the climber dude wasnt having any of it. Note to self: when haggling its better to make sure it is a one on one haggle and there are no other advisers in the vicinity.

Sunset at henningsvær
Sunset at henningsvær

Sunset at henningsvær
Sunset at henningsvær

Stats

63.82km
19.9 Avg
49.6 Max
980 kcal
3:11:55 ptime
960.6km fae NK

Day 11

day 11
Day 11

Woke up to find out that a beast of some kind had got into our tent porch in the night and eaten most of our food!!

Looking across to henningsvær
Looking across to henningsvær

Very picturesque beautiful cycle on one of the recommended motorbike roads. Finally got my ipod out and have started listening to music when I am cycling.. pumpin!

Helen had a dark day today.

Found a ‘mall’ and had some tasty ice cream. Tried for find a some snow and ran to a white patch on some hillside. Unfortunately it was a very white stone slab :-( . This ends my 32 month stint of being on snow every month!!

Attempting to find snow
Attempting to find snow

Stopped off at a proper campsite and made some funny sunset pictures.

jumpin team
jumpin team

wicked air
wicked air

sunset
sunset

Stats

90.79km
20.5kph Avg
57.0kph max
1434 Kcal
4:24:23 Ptime
1051.4 km fae NK

Day 12

day 12
Day 12

A slow start to the day at Ramberg Gjesthus Campsite but a heart warming story of a 90 year old Australian man who had been in nearby Skelfjord aged 19 and returned to witness the opening of a war memorial. He has been reunited with a 76 year old man whom he gave a box of delicious chocolates to 71 years ago.

break time
break time

We cycled the remaining length of flakstadøya to Moskenesøya and all the way to the famed å. We spent the rest of the gloriously sunny day relaxing and pottering about in å and moskenes.

end of the road
end of the road

Lofoten Hills
Lofoten Hills

At the ferry port we met a kiwi / south african couple who were driving an insane mercedes camper van. (something similar to “this”“http://www.flickr.com/photos/cinemadreams/3027634842/in/photostream/”) They were driving it around the world and had heaps of good chat.

Our time in Lofoten was coming to a close as the sun went down behind the jagged peaks. We munched on our final wild dinner, washing it down with some Nordlands Pils.

Lofoten Dusk
Lofoten Dusk

Lofoten Dusk
Lofoten Dusk

Stats

45.85km
20.6 kph AVG
58.5 kph MAX
731.8 kcal
2:13:23 ptime
1097.2 km fae NK

FINISH!

å

*å*

Senja, Andøya and Vesteralen – Days 7 – 9 (Arctic Cycle 2010)

September 20th, 2010 by pyrat

Banter sunset
Banter sunset

Day 7

day 7
day 7 map

Weather good / amazing! Had the best ferry waffle experienced so far. (Brensholmen -> Botnhavn). Staying at obscene hut called Senjabu. Buily in 2002 it is in very good nick and seems like someone’s own house.

Senja view
Senja view

Did a beast of a shop and cooked mince n tatties for dinner. Bought some beer to drink despite the weight!

Senja view
Senja view again

Welcome to the hut.
Welcome to the hut.

Brushing the teeth at senjabu dnt #2
Brushing the teeth at senjabu dnt #2

Stats

81.87km
19.6 kph avg (NR)
54.4 kph max
1235 Kcal
4:10:13 ptime
699.4km fae NK

Day 8

day 8
day 8

Water and hills
Water and hills

Sensational senja
Sensational senja

Left senjabu and had a beautiful and amazingly fun circa 2 hour ride to Gryllefjord. Saw lots of jellyfish, trucks and shags. One moderate mountain pass.

Arrived at 11:43am to find out that the ferry had gone ar 11. Next one was due at 7pm!! We spent several relaxing hours reading and fishing. (fishing with rudimentary equipment didnt work out too well.) Went to shop for dinner at 5pm and found out that the evening ferry to Andesnes was cancelled!! Bad weather apparently.. but I think it was a Birthday Party as the weather was lovely.

Basically we have been proper winging it with the ferries so far on the trip. Just rocking up and waiting a short time for a boat. This was the first time that the flying by the seat of your pants approach has bitten us in the bum after years of success. So the jury is still out… fly by the seat of your pants or plan?

Cat
Cat

Preparing the mobile kitchen
Preparing the mobile kitchen

Biked a few kilometres back up the fjord and found a stony campspot. Enjoyed a delightful beach dinner in textbook sunset conditions. (Prawns, salmon, sweetcorn, cheesy pasta, Tuborgs.)

Helen tucking into a tuborg at dinner time.
Helen tucking into a tuborg at dinner time.

(started the regular consumption of beer)

Sunset gryllefjord
Sunset gryllefjord

White women can jump
White women can jump

Stats

42.11 km
20.3 kph avg (NR)
59.1 kph max
777 kcal
2:04:09 ptime
741.5 km fae NK

Day 9

day 9
day 9

Bye bye gryllefjord
Bye bye gryllefjord

Finally escaped from Gryllefjord in a ferry that should have been in a museum. Rip off costs for shitty coffee (30kr (£3) + 5kr (50p) for a refill!!) We spoke to the captain about the previous days cancellation and it was clear that they just couldnt be f*cked the previous day. Annoying to say the least!

Due to the pitiful distance covered the previous day we decided to pound out a big one.

Rest
Rest

After some choppy seas we made it to Andøya (Awesome Andøya). Andesnes is a surprisingly big place and with the wind behind us we smashed through 50km in 2 hours.

Went for a 1hr effort, 10 min break schedule for most of the day, grinding out 6hrs of cycling effort in this manner. Sunshine and obscene views most of the time!

Helen and Bridge
Helen and Bridge

At the ferry to get to lofoten.
At the ferry to get to lofoten.

Arrived at Melbu and didnt like the look of it so decided to go even further than planned at get the last ferry to Lofoten. Possibly the best sunset I have ever seen was experienced as Helen danced to some attrocious pop music on the ferry. Would have been better without the pop music!

Stats

155.21 km (NR)
23.4 kph (NR)
56.4 kph Max
2588 Kcal (NR)
6:37:34 ptime
896.8 km fae NK

Troms – Days 4 – 6 – (Arctic Cycle Trip 2010)

September 10th, 2010 by pyrat

Lyngen alps and bike
Lyngen alps and bike

Day 4

day 4
day 4

Glorious blue sky weather. Three mountain passes. Longest day so far. Cycled until 9pm.

Lunchtime
Lunchtime

Hills n water
Hills n water

Getting more mountainous as we leave alta
Getting more mountainous as we leave alta

Self portrait
Self portrait

Hammering it down a mountain descent in the dying light, racing a jeep, with the majestic tops of lyngen is what its all about.

Stayed in our first hut! Shock! Was top class to have a shower and wash away the filth that has accumulated when wild camping.

Stats

137.61 km
17.8kph avg
58.7 kph max
2283 Kcal
7:42:16 ptime
440.3 km fae NK

Day 5

day 5
day 5

From Rotsundelv late start, all clean after shower and bed sleep in a hut. (luxury) Chillaxed 31km to Olderdalen where we had a delicious ice and caught ferry to Lyngseidet.

Fixing helen's bike for her
Fixing helen’s bike for her

Fish drying
Fish drying

KIOSK
KIOSK

Amazing sunshine and views of lyngen alps’ glaciers all day. Cycled past Svendsby and round the top of Jægervatnet. Bit of a dirt track into forest then hike into Jægervasshytta in fierce evening sunshine.

Lyngen alps and Helen
Lyngen alps and Helen

Maxim and Lyngen
Maxim and Lyngen

Relaxed night in gorgeous and well equipped hut with a calm watery view. Ahhh! Deilig? Ja.

Stats

67.43 km
18.0 kph avg
61.2 kph max (equal best)
930 kcal
3:43:35 ptime
507.7 km fae NK

Day 6

day 6
day 6

From Jægervasshytta we walked out to bike transition then back to Svendsby to catch another ferry. German tourists.

Met kjent mann at Fagernes and he showed us some quite back roads into Tromsø. Also cycled part of the Tromsø marathon route.

jægervasshytta
jægervasshytta

Old school advert - before the internet
Old school advert – before the internet

jægervasshytta dnt #1
jægervasshytta dnt #1

Tromsø
Tromsø

Demolished a monster of a pizza at Peppes Pizza in Tromsø. American tourists. Kjent mann #2 helped us out of Tromsø. There was an incredibly steep hill to cycle over. Got filmed by the google maps street view camera for the umpteenth time this trip.

Onto kvaløya (whale island) and eventually found a mosquito-rich camping spot. Made a fire to scare them away.

Welcome to our campsite.
Welcome to our campsite.

Stats

109.82 km
19.8 kph avg (new record)
63.7 kph max (new record)
1729 kcal
5:36:07 ptime
617.5 km fae NK

Textmate Multiple Line Insert

September 10th, 2010 by pyrat

Something I am always forgetting is the multiple line commands in textmate.

Prefix multi line

  • option + select vertical line before multiple lines
  • Start typing and this will appear before the multiple lines

Postfix multi line

  • Regularly select text
  • cmd + option + a
  • start typing

Finnmark – Days 1 – 3 (Arctic Cycle 2010)

September 5th, 2010 by pyrat

Nordkapp! We're pretty far north by the way!
Nordkapp! We’re pretty far north by the way!

Day 1

day1 map
day1 map

After building the bikes at Nordkapp. We bought the most expensive sandwiches of our life (circa £9 each) and headed off south in gale force winds.

We cycled past some reindeer who looked at us strangely. The weather was rough with it feeling like winter and almost sleeting. The leaves were turning brown on what trees we could find.

What finnmark is all about.
What finnmark is all about.

We had to cycle through an obscene tunnel that was 7km long and went 208 metres under sea level. It was actually good to be out of the wind.

At one point we had to walk with the bikes it was that windy. The campsite was super bleak and it was great to get into our sleeping bags and warm up. Dinner was replaced by salami sandwiches as it was too wild to get the stove on the go.

Exceptionally bleak and cold campsite #1
Exceptionally bleak and cold campsite #1

Stats

72.18km
18.6kph Avg Speed
61.2 kph max
1348 kcal
3:52:39 pedal time.

Note: the stats come from Helen’s bike computer. I am certain that throughout the trip I broke 70kph on some descents but cant prove it as I threw my computer away before the trip.

Day 2

day2 map
day2 map

First use of the stove today allowed us to eat some tasty pasta. First use of the statoil cup got us some free coffee at a statoil petrol station. We saw a library bus:

Its a library bus!
Its a library bus!

We bumped into a guy from Belgium who had been cycling for the last 3 months. He had a youth hostel key for Alta which we are going to pass tomorrow. We promised to hand it in for him.

Found a nice campsite next to a salmon river.

Sink your farts it might rain
Sink your farts it might rain

Stats

109.07 km
18.1kph Avg
52.8kph max
1421 Kcal
6:00:23 ptime
181.2km fae NK

Day 3

day3 map
day3 map

Started badly. We left the wire lock at camp 2 and Ally had to cycle 5.6km back to fetch it. Helen felt weak for the first 1-2 hours. Met loads of cyclists heading North. Had fun in the Metropolis of Alta, visiting a supermarket and another Statoil (free coffee). Handed in key for Belgian dude at Youth Hostel.

The sun is out!
The sun is out!

With the evening came our first sunshine and we caned it well past the target campspot of Talvik, mainly because campsite searching took so long as finding spots in farm areas at the side of fjord can be tough.

Cool sunshine shot
Cool sunshine shot

We found a sweet spot in the end so it worked out well.

Campsite nearish Talvik
Campsite nearish Talvik

Stats

121.45km
18.2kph Avg
56.8kph Max
1851 Kcal
6:38:56 Ptime
302.7km fae NK

Arctic Cycle Trip Equipment List

September 3rd, 2010 by pyrat

Bikes
Bikes

Im just back from a 2 week cycle touring trip in the North of Norway.

Below is an equipment list which lists individual items and shared items for 2 people. Having more than one person is great because it allows you to shared items and therefore carry less. Lightweight is the way to go here, we even threw things away and Helen sent stuff home to minimise weight.

Bike specific

spare inner tube
spare brake blocks*
Bike lights for tunnels.
2 water bottles (litre each)
helmet
bike shoes
neoprene booties

Clothes

bike shorts
lycra leggings
cycletop
sunglasses + case
bike gloves
semi waterproof gloves
thin gloves
windproof jacket
waterproof jacket
waterproof trousers
light insulation jacket (eg. primaloft)
2 buffs
lightweight shoes
pants x1
boxers x2
tshirt x1
small towel
thermal x3 (long sleeves)
leisure trousers (lightweight)
sawn off toothbrush
hat

Stuff

phone
mp3
book
passport
watch
credit cards
cash
medication (eg. inhaler)

Sleeping

Down Jacket
Sleeping bag
Thermarest
Wee pillow

Shared Items

bike lock
sun tan cream
Stove + Lighter
Pans
Tent
Tent footprint
Cooking Oil
Washing up stuff
Mugs
Spoons
Pen knife
wee book + pen
wee bit of shampoo
toothpaste
first aid
survival bag
puncture repair kit
pump
multitool
maps and route info
compass
flight documents
camera

Bikes

Basically all the other cycle tourers we met had much much more stuff than us and were on slow bikes.


heavy bike

My Bike

I went for an approach of converting an actual racing bike for cycle touring on which went really well. It was essentially the same setup I used for credit card touring through the alps a couple of years ago with the addition of an alpkit drybag on the back which held the tent and 2 thermarests.

Speeding along on the cannondale caad5
Speeding along on the cannondale caad5

As a side note, often when saving weight people scrimp on underbody insulation. This is a bad move as it can make sleeping really uncomfortable. Therefore we decided to take the thermarests which ensured for a cosy nights sleep. They also pack down relatively well when wrapped round a tent.

The bike was very fast and once up to speed would cruise at 25 – 30 kph no problem. The downside is that it is a bit of a weak bike for load carrying so you have to be nice to it when it comes to bumps / gravel / curbs etc. The wheels have not that many spokes so will buckle easily.

Helen’s Bike

Tour tastic
Tour tastic

For Helen’s bike we went for a more solid solution. A burly cyclocross racing bike with a rack and some carradice waterproof panniers. This setup is a reliable setup for touring as the frame and wheels are strong with high gearing for when the need arises to go fast.

The downside is that the panniers end up holding more stuff, dont have very good handling and are not as aerodynamic as the racing bike bags I was running. This meant that on downhills my bike was a lot faster. As it cut through the air a lot better.

In general I think the best solution would have been for both Helen and I to use similar equipment as often it was hard to stay together as my bike was that much faster.

HTML5 Inside – Geolocation

August 14th, 2010 by pyrat

Gps in orienteering
GPS tracking used in World Champs Orienteering

In this series I am going to write about the new whizz bang things which fall under the HTML5 umbrella. I am going to attempt to find out whether it is ‘hype or hardcore’.

Geolocation

Geolocation is the art of finding out where a user is. This can be as rough as country, or as fine grained as an exact latitude / longitude coordinate set.

Traditionally geolocation in the browser consisted of querying the user’s IP again a database. Usually this allowed you to find out what city a user was in. Nowadays, there is a geolocation API which is targetted specifically toward Mobile devices.

The W3C has an api for geolocation which is in draft stage at the time of writing.

Modern versions of Firefox, Chrome, Safari and Opera offer geolocation support. As far as I am aware all of these browsers actually implement the geolocation by querying a service provided by google. The google gears (deprecated) geolocation api has been natively implemented by the major browsers.

How does the actual geolocation work?

Note: The API Described is the old gears API but as HTML Geolocation currently uses this it should be seen to be relatively similar.

An HTTP POST is made containing JSON data which looks like the following.

  {
    "version": "1.1.0",
    "host": "maps.google.com",
    "home_mobile_country_code": 310,
    "home_mobile_network_code": 410,
    "radio_type": "gsm",
    "carrier": "Vodafone",
    "request_address": true,
    "address_language": "en_GB",
    "location": {
      "latitude": 51.0,
      "longitude": -0.1
    },
    "cell_towers": [
      {
        "cell_id": "42",
        "location_area_code": 415,
        "mobile_country_code": 310,
        "mobile_network_code": 410,
        "age": 0,
        "signal_strength": -60,
        "timing_advance": 5555
      },
      {
        "cell_id": "88",
        "location_area_code": 415,
        "mobile_country_code": 310,
        "mobile_network_code": 580,
        "age": 0,
        "signal_strength": -70,
        "timing_advance": 7777
      }
    ],
    "wifi_towers": [
      {
        "mac_address": "01-23-45-67-89-ab",
        "signal_strength": 8,
        "age": 0
      },
      {
        "mac_address": "01-23-45-67-89-ac",
        "signal_strength": 4,
        "age": 0
      }
    ]
  }

It has been designed to work with both mobile and wifi_enabled devices. The browser implementations map to native APIs on the device. So either a simple Lat/Lng is submitted potentially obtained from GPS (easy for google) or wifi_tower mac_addresses, or cell_tower information. Google can use this information to try to geocode a location.

The response is also in JSON. We love JSON here at simplyexcited, XML is dirty.

  {
    "location": {
      "latitude": 51.0,
      "longitude": -0.1,
      "altitude": 30.1,
      "accuracy": 1200.1,
      "altitude_accuracy": 10.1,
      "address": {
        "street_number": "100",
        "street": "Amphibian Walkway",
        "postal_code": "94043",
        "city": "Mountain View",
        "county": "Mountain View County",
        "region": "California",
        "country": "United States of America",
        "country_code": "US"
      }
    }
  }

The old json api is readable on this wiki page

Why this is good.

The geolocation api allows you to build location aware web applications which have access to native location apis. Bringing native hardware to web applications makes the future bright and takes us to a more webby non-native future.

How do I use it then?

Google maps V3 API has a great example of geocoding to put your location on a map.

  <!DOCTYPE html>
  <html>
  <head>
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
  <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
  <title>Google Maps JavaScript API v3 Example: Map Geolocation</title>
  <link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
  <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
  <script type="text/javascript" src="http://code.google.com/apis/gears/gears_init.js"></script>
  <script type="text/javascript">
 
  var initialLocation;
  var siberia = new google.maps.LatLng(60, 105);
  var newyork = new google.maps.LatLng(40.69847032728747, -73.9514422416687);
  var browserSupportFlag =  new Boolean();
  var map;
  var infowindow = new google.maps.InfoWindow();
 
  function initialize() {
    var myOptions = {
      zoom: 6,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
 
    // Try W3C Geolocation method (Preferred)
    if(navigator.geolocation) {
      browserSupportFlag = true;
      navigator.geolocation.getCurrentPosition(function(position) {
        initialLocation = new google.maps.LatLng(position.coords.latitude,position.coords.longitude);
        contentString = "Location found using W3C standard";
        map.setCenter(initialLocation);
        infowindow.setContent(contentString);
        infowindow.setPosition(initialLocation);
        infowindow.open(map);
      }, function() {
        handleNoGeolocation(browserSupportFlag);
      });
    } else if (google.gears) {
      // Try Google Gears Geolocation
      browserSupportFlag = true;
      var geo = google.gears.factory.create('beta.geolocation');
      geo.getCurrentPosition(function(position) {
        initialLocation = new google.maps.LatLng(position.latitude,position.longitude);
        contentString = "Location found using Google Gears";
        map.setCenter(initialLocation);
        infowindow.setContent(contentString);
        infowindow.setPosition(initialLocation);
        infowindow.open(map);
      }, function() {
        handleNoGeolocation(browserSupportFlag);
      });
    } else {
      // Browser doesn't support Geolocation
      browserSupportFlag = false;
      handleNoGeolocation(browserSupportFlag);
    }
  }
 
  function handleNoGeolocation(errorFlag) {
    if (errorFlag == true) {
      initialLocation = newyork;
      contentString = "Error: The Geolocation service failed.";
    } else {
      initialLocation = siberia;
      contentString = "Error: Your browser doesn't support geolocation. Are you in Siberia?";
    }
    map.setCenter(initialLocation);
    infowindow.setContent(contentString);
    infowindow.setPosition(initialLocation);
    infowindow.open(map);
  }
  </script>
  </head>
  <body onload="initialize()">
    <div id="map_canvas"></div>
 
  </body>
  </html>

View the working example

Simplest working example

Stick this in your firebug console and run it.

  if(navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(function(position) {
      alert("Your lat/lng pair is" + position.coords.latitude + ", " + position.coords.longitude);
    });
  } else {
    alert("Your browser does not support W3C geolocation.");
  }

Conclusion

So.. Geolocation. Hype or Hardcore? I think hardcore.

Sencha / ExtJS Rant

July 29th, 2010 by pyrat

Rant

Decided to start ranting about things as I become more of a grumpy old man!
I am not an expert in extjs but have a working competance.

  • It is really slow to develop with.
  • Memorizing apis and setting keys on objects is dull and leads to messy code.
  • The templating system is dirty.
  • HTML in javascript is bad.
  • Not SEO friendly.
  • CSS is clumsy and ugly, just like the rendered html. (You essentially have an empty html document which ExtJs writes to.)
  • When you get an error or problem it is common to see the ‘white screen of death’ with accompanying cryptic error messages.
  • Testing seems non existant and its really just a method of apple-r / ctrl-f5 and pray.

Mobile Web Development

  • Mobile web development is mainly using the advanced nature of webkit CSS3, built-in hardware accelerated animations and using touch events rather than click events.
  • Design for the mobile web is a knowledge of what webkit gives you and the ability to work with small screens effectively.
  • Mimicking native applications is not the way forward. Look at gmail for iphone as an example of how good custom approaches can be.
  • Writing web applications for the mobile web should harness the advantages of a web based approach, not shoehorn a native approach into a monolithic javascript object.

These advantages include:

  • Writing HTML and CSS by hand. (lets get semantic man!)
  • Unobtrusive javascript. – Javascript is great, unobtrusive javascript is amazing.
  • Generating HTML with your favourite web framework (rails, django, symphony). This is powerful but also you need to think about html manifests and caching to not affect performance on shaky connections. If you shift paradigm and think of the web framework as an html generator / ajax interface this helps. (helped me)
  • Knowledge of the fancy new functionality that webkit browsers provide is the main new skill required.
  • Keeping a lot of your business logic in a web framework allows for easy testing using mature tools.

Canoeing in the Stockholm Archipelago

July 9th, 2010 by pyrat

Canoeing in the Stockholm Archipelago
Canoeing in the Stockholm Archipelago

The plan was to take a trip to the Stockholm archipelago and experience ‘endless islands’ in the most simple form of sea transport.
The sea kayak. We wanted to go as wild as possible so made the decision to try and get kayaks from as far out as possible in the archipelago
so that we were in the wilderness as quickly as possible.

I had only been in a sea kayak once before going on the trip, but had done a wee bit of freshwater kayaking. This proved to be enough, but I was glad
that I had been taught some paddling technique from former world adventure race champion Chris Forne.

Other preparation was to get a few drybags together and to test out some kit which we plan to use on a slightly bigger expedition later in the
summer.

Day 1

I woke up in a large ferryboat approaching Stockholm having been in Helsinki the night before. The last thing I could remember was
doing klinsmans over a bunch of swedes laid out in the corridor. Too much high quality russian vodka had been consumed!

After arriving in Stockholm, priority was to stock up on food. We bought food for the whole trip in one go. There is a wee bit of thinking required to
do this, but its much better having all the food sorted in a oner. Cost about £60 for all the food.

A bus, then a slow ferry took us to the town of Berg on the Island of Moja. From here, it was time to sort out all our stuff and leave the beer soaked
jeans and smelly orienteering shoes behind!

Getting our sh*t together
Getting our shit together

After getting maps from the kayak guy, fixing a broken rudder and getting everything packed, we were on our way. We paddled for about 2.5 hours through beautiful thin waterways in the evening sunshine.

We randomly picked a little island that looked like a good starting point for the next day and went about getting out of the boat. Turned out there is a lot of bare rock in the archipelago which has a slimy covering. This means you have to pick out inlets and grassy areas for landing the kayak. We found this out the hard way. First, I got out of the boat and proceeded to fall over and swim in the deep water. Next, I held onto the boat and ‘helped’ Helen get out of the water. The result was she went swimming too!

Sunset with the Kayak
Sunset with the Kayak

We setup campsite and for the first time felt the sense of peace and chilledness that was to set the tone for the next few days.

Tree Banter
Tree Banter

Day 2

The plan for day 2 was to do an 8km open water stretch to reach the Store Nåsa nature reserve. A collection of wild islands in the outer archipelago.

Wilderness
Wilderness

For some reason I was crapping it, the idea of falling out of the kayak in open sea seemed daunting. Luckily nothing with awry and we made it to the islands in the mid afternoon. We setup camp then I tried some fishing with the rudimentary fishing equipment I had taken along. I was unsuccessful but luckily we had enough food to get by.

Jarlsberg and Wine
Jarlsberg and Wine

Day 3

Bantered about the outer islands looking at the protected birdlife and lazing around in the sunshine. We went swimming in the afternoon sun and got attacked by a couple of arctic tern birds.

Arctic Tern
Arctic Tern

The wind dropped so we decided to make the open water paddle back to the moja reserve. Quick dinner and wine, then hardcore paddling. Open water navigation is difficult, you really need to trust your compass and not your eyes!

We found another top class little island, with a top view and no mosquitos. Best of the trip.

Sweet campsite
Sweet campsite

Day 4

As we had been carrying all our drinking water (cooking with sea water however) we were running a little low so decided to try and take a detour via a well to get some more water.

Cooking equipment
Cooking equipment

We hunted for a bit, then had lunch, then tried again and managed to find it! Cold fresh water on a hot sunny day was ideal.

Well
Well

A couple of hours paddling and later we started looking for an island to setup camp. The first one I was attacked by another arctic tern, then at the second one I disturbed a family of toads sheltering in a drying up bog.

We managed to find another camp spot which was pretty sweet.

Sweet Campsite
Sweet Campsite

Day 5

This was the last day of the trip, we left relatively early for us (9:30am) and proceeded back towards berg to return the kayak.

We stopped at a wee town for some lunch then made the paddle back to Berg. On the way we nearly hit a ferry head on and the result was the we had to ride the wake! We hit is straight on a were happy we had spray decks!

When we arrived back in Berg it was midsummer, a big party in Sweden; especially big in moja. There were loads of fast speedboats with noisy engines. I have decided that if I had the pleasure of being able to decide between getting a yaught, or getting a speedboat, I would go for a speedboat any day! Those things are PHAT.

Ended up in 747 that night. (converted into a hostel at Stockhol Arlanda Airport)


Jumbo Hostel

Doing it yourself

Can fully recommend this trip, it was pretty relaxed with not a great deal of physical effort. You could have gone more full on and did bigger kayaking distances than us if you like.

Hired the kayaks from Möja Havskajaker

  • Remember you need all your water so make sure you have enough vessels. 2l per person per day is enough.
  • Buy all your food before starting the trip. There is a supermarket in Berg but recommend just buying all of the stuff you need in Stockholm as there is more choice in the supermarkets there.
  • You can get petrol in the islands so a liquid fuel stove works quite well.
  • Watch out for mosquitos as there were quite a few at night so you need a mossie proof tent and the ability to choose good campspots.

Walking into the sunset
Walking into the sunset