Monthly Archives: March 2012

Villa Francais

The people at Rewired state and MIPCube have put me up in this hotel for 5 days, how nice of them. Can you believe I never ended up swimming in this pool, the freezing cold water of the beach was just to inviting, at 2 am, 3 seperate times. A trick to going skinny dipping at 2am, when you come out, get dressed immediately, and head for the nearest bar to get some whiskey.

Villa Francais, 33 Avenue Wester Wemyss, 06150 Cannes, France

Mohito Yacht, Cannes, France

This is the amazing Yacht that Rewired State and MIPCube are putting us up on for the weekend. Will see how much work we can get done in these beautiful surroundings.

The aim is to come up with apps for the TV industry, and helping people stay in touch with their favorite TV shows.

Format String for the iPhone NSDateFormatter

It is quite common to have to display time information in your app, be it the current time, news feed’s creation date, scheduled meeting time or birthday reminders. However, not all of them are displayed the same way and may require different formatting. To do that with Objective-C for iPhone apps, NSDateFormatter is what we need.

In most cases, you’d just need to use the default styles defined in NSDateFormatterStyle.

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateStyle:NSDateFormatterMediumStyle];
[dateFormatter setTimeStyle:NSDateFormatterShortStyle];
NSLog(@"%@", [dateFormatter stringFromDate:[NSDate date]]);

[dateFormatter release];

// Output: Dec 2, 2008 3:58 PM

But at times, you’d prefer to set your own time format, and that’s where it starts to get tricky.

It is actually quite simple, all you have to do is to create a format string to tell NSDateFormatter how to format your time string.

[dateFormatter setDateFormat:@"hh:mm:ss"]
// Output: 03:58:27

The problem is, the official documentation from apple doesn’t really tell you what specifiers are available to format your string. Even worse, it doesn’t conform to the ISO 8601 standard! What a bummer! And after a bit of searching on the net and still come up short, I have decided to just hack a little bit of code together to dump a list of specifiers and their results.

(EDIT: Apparently, there is now a link to the Unicode Date Field Symbol Table that Apple follows, even though my test shows that it still doesn’t conform 100% to the standard. Thanks Benjamin and Adam for finding it.)

a:	AM/PM
A:	0~86399999 (Millisecond of Day)

c/cc:	1~7 (Day of Week)
ccc:	Sun/Mon/Tue/Wed/Thu/Fri/Sat
cccc:	Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday

d:	1~31 (0 padded Day of Month)
D:	1~366 (0 padded Day of Year)

e:	1~7 (0 padded Day of Week)
E~EEE:	Sun/Mon/Tue/Wed/Thu/Fri/Sat
EEEE:	Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday

F:	1~5 (0 padded Week of Month, first day of week = Monday)

g:	Julian Day Number (number of days since 4713 BC January 1)
G~GGG:	BC/AD (Era Designator Abbreviated)
GGGG:	Before Christ/Anno Domini

h:	1~12 (0 padded Hour (12hr))
H:	0~23 (0 padded Hour (24hr))

k:	1~24 (0 padded Hour (24hr)
K:	0~11 (0 padded Hour (12hr))

L/LL:	1~12 (0 padded Month)
LLL:	Jan/Feb/Mar/Apr/May/Jun/Jul/Aug/Sep/Oct/Nov/Dec
LLLL:	January/February/March/April/May/June/July/August/September/October/November/December

m:	0~59 (0 padded Minute)
M/MM:	1~12 (0 padded Month)
MMM:	Jan/Feb/Mar/Apr/May/Jun/Jul/Aug/Sep/Oct/Nov/Dec
MMMM:	January/February/March/April/May/June/July/August/September/October/November/December

q/qq:	1~4 (0 padded Quarter)
qqq:	Q1/Q2/Q3/Q4
qqqq:	1st quarter/2nd quarter/3rd quarter/4th quarter
Q/QQ:	1~4 (0 padded Quarter)
QQQ:	Q1/Q2/Q3/Q4
QQQQ:	1st quarter/2nd quarter/3rd quarter/4th quarter

s:	0~59 (0 padded Second)
S:	(rounded Sub-Second)

u:	(0 padded Year)

v~vvv:	(General GMT Timezone Abbreviation)
vvvv:	(General GMT Timezone Name)

w:	1~53 (0 padded Week of Year, 1st day of week = Sunday, NB: 1st week of year starts from the last Sunday of last year)
W:	1~5 (0 padded Week of Month, 1st day of week = Sunday)

y/yyyy:	(Full Year)
yy/yyy:	(2 Digits Year)
Y/YYYY:	(Full Year, starting from the Sunday of the 1st week of year)
YY/YYY:	(2 Digits Year, starting from the Sunday of the 1st week of year)

z~zzz:	(Specific GMT Timezone Abbreviation)
zzzz:	(Specific GMT Timezone Name)
Z:	+0000 (RFC 822 Timezone)

(Letters not listed here did not return any result.)

Basically, you put the above letters together in a NSString to tell NSDateFormatter what to display.

In most cases, you can concatenate a letter together a number of times, and you will get a 0 padded version of it up to the number of letters you have concatenated (eg: @”ssssss” => @”000059″). In other cases, the longer concatenated version will give a different result (eg: @”M” => @”12″, @”MMMM” => @”December”).

Also, some of the different letters seem to be giving out the same results (eg. the q’s & the Q’s), while others have subtle differences (eg. the v’s & the z’s). One of the silly one is the uppercase Y’s, where the year jumps ahead at the end of the year, so unless you really want that, it’s better to just stick with the lowercase y’s.

Stolen from here:

Marco Media hackathon

There the idea stayed until I went to the Marco Media hackathon, and had a whole weekend to flesh out the idea. Unfortunately not enough people thought the idea was good enough, so I worked on it on my own. But being around others working on their projects for 44 hours straight was incredibly stimulating. And I managed to mock up a working app, with the website as well.

I was so confident in my app that I actually used it to present. I loaded up the webpage on the projector, and borrowed an iPad.


The whole project started after a conversation with a mate of mine back in Australia. He teaches distance learning students, and has to explain mathematical concepts to them over the phone. This is for you Steve.

The idea then say in the back of my mind, while I tried to find time to work on it. This was over a year.

Late at Tate, London, UK

A number of Art Galleries and Museums around London open up in the evenings and start serving drinks. A great way to meet interesting people, see Art work in an adult environment, and a fascinating drinks venue.

I have only been to the Late at Tate events so far, hoping to make it to a few others later this month.

Old description of the future

As a cynic whoose outlook has been validated by events for over forty years, I predict:

In ten years, computers will be 128 times “Moore powerful.” However, Microsoft, now involved in world government (now simply called, “gummint”), has continued to develop, and use, higher and higher level languages to write the (only remaining legal) operating system in, and the operating system and its native applications are now 256 times larger and slower – so computers will do things for us as 1/2 the rate they do today.

Our mornings will still begin with waking up. Mornings will still suck, and you still won’t like them.

Today, your coffee can be brewed while you sleep. Tomorrow’s robokitchen won’t allow you to have coffee, because in doses roughly equivalant to pouring the Black Sea down their little throats, it causes cancer in laboratory mice (who now have been specially bred to have no immune system at all.)

Of course, you aren’t the only one who has to get going in the morning. Your spouse and kids will be taken care of, too. One morning you’ll get up, and find that your children have been permanently taken to a “re-education facility” because the “smart toilet” reported to the Federal government that they had marijuana in their system from the junior prom, the night before. Your spouse is presently at the lawyers, suing for divorce (in 2014, 3 out of 4 people in the world are now lawyers.)

Your spouse might telecommute – but for the lawyer, she has to be there in person. You won’t have to take the kids to school, because they’ve been taken away from you by the gummint. School based education and socialization – Cliquing 101, pre-teen sexual activity, learning to crib, mandatory studies of how God(tm) created the earth in 4000 B.C. and the gummint in 2008 A.D. – that’s all over for now. Your kids will be learning how to hack the universal credit machine at the mall from the other kids in gummint custody.

Although you have an advanced degree, you work at McDonalds because the gummint doesn’t like your attitude. So you drive to work. On your bicycle, because that’s all you can afford. You’ll arrive at work windblown and very sweaty. No one will want to venture very close to you. You won’t have to worry about car keys, because you (and 99% of the rest of the population, which is huge because the pope, now a cabinet level post in the gummint, has told everyone to have plenty of children, bless you, bless you) can’t afford a car.

Throughout the day, your non-removable wristband, a mandated citizen ID technology, will keep the gummint apprised of your wearabouts, alert to report any transaction upon which you fail to pay taxes, any jaywalking event, or use/consumption of banned substances such as coffee or pornography.

Recording your entire life will take a lot of storage, but the cost of gummint data storage will be entirely paid by your taxes, so that’s no problem. The images of your life will be beamed through the air to an archive that only the gummint can access. Step over the line just once, and you’ll automatically be tried, convicted and punished, all without the intervention of a human being.

Your McDonald’s sales kiosk will have a smart wall of its own, giving every worker a chemical and hormonal scan for banned substances. And no matter which chair you sit on anywhere, the chair will monitor your nervous system for anti-gummint reactions to gummint infomercials, which are projected in the air 22 hours a day from your gummint wristband. The chair is networked to the gummint, of course.

On the way home from work, you’ll stop to pick up a few things at the grocery store. No standing in line, though, to check out: you’ll just waltz out the front door, as the Radio Frequency ID chips in the products you’ve bought allow their highly inflated costs to be tallied and your account automatically debited. You won’t have enough credit left to pay for heating again next January. Your personality profile will be analyzed as you walk out the door to see if you’re buying products that have been forbidden to you. If you have, courteous and snappily dressed gummint representatives will escort you to a reunion with your children.

You might make dinner yourself, if you enjoy cooking. You can have fried prole outmeal, baked prole outmeal, or stewed prole oatmeal. But if not, your automated kitchen will again take care of everything, including reporting your precise consumption of prole dole to the gummint. And you’ll have a humanoid robot, too — the descendant of today’s dancing Honda Asimo — that will stand guard in your home and bedroom in case you were to do something illicit, like teach critical thinking to your children, or attempt sex in anything other than the missionary position, or masturbate, which has been illegal worldwide since the 2011 ascension of the Christian Right to Microsoft’s helm.

After dinner, you’ll watch personally tailored higher quality gummint informercials available instantly on your wall-screen TV for precisely two hours. Your wristband ceases to project holographic infomercials for these two hours. However, tonight your viewing is interrupted by the divorce service from your spouse, and the lawyer bill.

(Micropayments will work flawlessly: you’ll be debited for each infomercial you are exposed to throughout the day, no matter if you paid attention to them or not.)

Meanwhile, your kids will be off in gummint custody, enjoying fully immersive virtual reality re-education — who’d have thought homework could be such fun? Eventually, though, it’ll be time for them to get ready for bed. Sadistic prison guards will introduce them to long-term felons, and their education will really begin!

And, a little later, you’ll turn in for the night, as well. But perhaps just before you fall asleep, a thought will occur to you — something you just have to remember to do the next day. Oh yes – you’ll have to increase your personal debt load to pay the lawyer. No need to tell your wristband, though – it already knows, and you’ll have no option but to pay. So no heat in February, either.

So have I got it right? Only time will tell. Feel free to tell your wristband about it. Of course, if you do, you’ll be incarcerated for anti-gummint talk, so maybe you’d better just shut the hell up.

We now return you to your regularly scheduled infomercial.

Robert J Sawyer, Canadian Sci-Fi Author

The only problem with Boris Bikes

The only problem I have found with the Boris Bikes can become a bit of an issue. I was at a meeting that went until 9:30pm, in the city, and it was a bit tricky finding a bike. It took me 4 different cycle stations to get a bike, and then once I got back to my home cycle station, it took me 3 times to find one with an empty slot. And I took the last empty slot in that one.

Maybe they are just getting too popular, and are used by not just tourists, but Londoners like me trying to get to and from work. It also looks like Boris is building out more and more.

Get our Boris bike app for your iPhone, iPad and iPod Touch.