Trouble with Time Zones and Day Light Savings in iOS

As you all know, Suneth and I are working on 60Hz 2.0 and we had the weirdest date related problem yesterday. We have a weekly calendar which tells you when your library shows air and what are the premiering (returning or new series) airing on any particular day.​

Yesterday, our calendar looked like this!!​

​We have 2 Sundays!!!

​Huh??

After a lot of digging around the problem was this: yesterday, Sydney timezone rolled back an hour due to day light savings.​

We calculate each day by dropping its time component from [NSDate date]. We use a special category which gives us today [NSDate today] and work our way back to calculate the week and all the other relative days. For the first cell, which is correct, we have April 7th, Midnight. When it comes to Monday, Sydney rolled an hour backwards. Instead of getting April 8 Midnight, we're getting April 7th, 11PM. This accounts for the second 7th of April! After looking for bugs in all over the code, we finally figured it out.​

The fix was to simply take midday for today calculations. Adding 12 hours to today fixes and stays away from all kinds of DST issues (I hope).​

Windows 8 Should Have Shipped With... Windows

I think Windows 8 is great. It is fast, the UI is simplified and it is a much needed reset for the Windows ecosystem.

The problem is, however, the way Microsoft’s latest desktop offering ignores the desktop users altogether. Windows, as its name states, has always been about desktop + windows. This is a metaphor that has worked for as long as I’ve been using computers! It’s been tweaked a whole bunch, but at a basic level, the idea totally works! Windows 8 is really a touch first OS now. It is awkward to use mouse with it.

So here’s Microsoft’s “vision” for the future:

A future where people do one thing at a time (and everything’s a giant screen :S)...? Well, actually, there’s more to that vision. There’s a very powerful theme running all over this video that many people don’t pick up on, and that is, context.

Context is everything. With a world that is constantly changing and moving, it has becomes so much more important. Problem is, computers haven’t been great at this. Humans are a funny bunch and computers have a hard time predicting anything with enough confidence to enable a fluid software experience that changes with context.

This is why Google Now! really excites me. It is Google’s stab at a move in the right direction. It is automatic and it tries to be a little bit smart for you -- in the background.

I digress.

If we combine the lack of context with the single task focus on Windows 8, it is not a good cup of tea for most desktop users. Microsoft thinks people would just work on a presentation or queue music or surf the web (or 2 at a time). But this is how my desktop looks like:

Screen Shot 2013-04-07 at 8.06.15 PM.png

Yep - It’s a mess. And people are generally messy. So here’s my pitch to Microsoft:

Stay true to the namesake. Let Metro apps work in a Window mode! Here’s a sample metro app (Outlook):

12_1fe6b8e8.png

Let it window down to this:

mail_windowed.png

The toolbars will form the application’s ribbon. The top menus like tabs in IE will also become tabs up top. Being on the desktop mode, developers can allow for more complex options in the ribbon too. Like Android where menu button and ActionBar overflow works interchangeably, so will the ribbon and full screen toolbars. There's a lot of missing features here, but you get the idea.

If the user is detected to be in the desktop, the app should start windowed like above. If they maximize or start the app on a tablet, it should automatically go into the tablet mode layout. Given the power of XAML and it’s great great layout system, I don’t think this is impossible.

This would have taken us to a new UI design language without completely alienating all Windows Desktop users.

Let people work in the desktop. It works best for multitasking. Keep the new start menu, but add more daring context awareness. Then we’ll have a wonderful OS with a more coherent experience.

Coming up with a fresh icon for 60Hz app

We've been working hard to get tvQ 2.0 out on the App Store (currently doing some beta testing). We really needed a new icon that captured the essence of our new UI and still kept a somewhat familiar vibe.​ Needed it to be cleaner, more modern and still very much recognisable on the iPhone dashboard.

Here's the old ​design and icon:

IMG_0761.png
IMG_0768.png
Icon@2x.png

So we began by looking some existing icons that reflected somewhat of the vibe that we needed our icon to give out to the users. Here are some icon designs that really inspired us...​

Of course, there was some dribbble.com surfing as usual and Suneth found this fantastic pinterest collection: http://pinterest.com/johnsonyung/app-icon/.​

I think it is important to look at what else is out there. Creativity is really a fusion of a collection of ideas put together in a very personal way. And all these ideas don't have to be original. As a part time designer, it isn't so easy to come up with a completely original design either.​

So here's the look and feel of our rewritten tvQ app:​

iPhone IMG_0012_2.jpg
iPhone IMG_0003_2.jpg

And here's the new icon... I think we've managed to do an icon that reflected the new design but kept a little bit of the old feel. Love it!​

Icon-72@2x.png
 

Build for a need

As developers we love to build cool stuff. It is like building legos. We love putting the blocks together to form something amazing. Often though, we tend to not think about the larger implications. We don’t ask ourselves if this is what is needed? Is it even useful? We often have the opinion of “we build it because we can”.

This may very well work for you in your own personal time. However, if you’re trying to make a difference, be it the world around you or at your workplace, you have to stop just doing stuff. We shouldn’t just leave the task of rationalising the need for something to people in the marketing department. We have the chance to get down and dirty with a product and really mould it. To do that, we should really question its purpose carefully.

There’s so much time and money wasted in the tech industry where people build things that aren’t needed. We should try to break away and use new techniques like The Lean Startup to make useful things. “Build it and they will come” is not a thing.

Selectively merging branches with git

git-checkout is the key here. Here are the quick steps:

  1. Checkout the branch you want to merge into: git checkout production
  2. git checkout feature_branch_name <list of files> to merge just the changes from specific files: git checkout push-notif-branch app/controllers/controller.rb config/certificates/* …
  3. Git automatically does a git add into your initial branch with the files you specified. Just follow up with a git commit -m “message” and you’re done!

Rails Validating Field vs Association

​One really interesting thing I came across recently is validating a field vs association. I’ve always written something like this (assume this is a… Company model with a attribute called owner_id and a belongs_to association called owner):

validates_presence_of :owner_id

What’s better to write is:

validates_presence_of :owner 

This actually makes sure that your :owner_id actually maps to a real object in the database. So you can’t just set a random integer as owner_id and get away with it!

Sadly this has made testing a little bit harder. Tearing through FactoryGirl documentation again now!