30 Dec 2011 – Singapore
Decided to give my blog a fresh coat of Bootstrap paint. I used Bootstrap for a small project called muxx.it earlier this month and loved it — it is definitely one of the best pieces of software to come out this year (especially for design-sense-challenged folks such as myself).
The main reason I wanted to re-design my blog was that I’ve been meaning to pen a year-end of review of what’s been quite a roller-coaster twelve months. I didn’t want to publish something on what was quite frankly, an ugly and dated site, and so here we are.
Hopefully I’ll get down to writing my year-end review in the next couple of days.
24 Jun 2010 – Singapore
I gave a quick presentation yesterday at the June installment of the Singapore Ruby Brigade held at HackerspaceSG. As always, SRB is a great place to meet people and catch up with all the great work that’s going on here. Many thanks to Jason for organising the monthly meetups and to Zhenyi for his camerawork yesterday which has brought SRB June online.
It was also great to listen to Ming Yeow and his experiences (both the highs and the lows) while building MrTweet as well as experiencing every layer of the ‘startup stack’ (as he put it) such as product management, fund raising, hiring and networking. For a person who’s been three months into a startup, his talk definitely gave some good pointers as well as validation for the processes we’ve already implemented.
My slides from yesterday are at Slideshare.
30 Apr 2010 – Singapore
The whole brouhaha about the openness (or lack thereof) of Apple and its evilness has had me confused for a while now. On the one hand, I really admire Apple’s gumption in taking on the behemoth that was the mobile phone industry, turning it around and winning in the marketplace because of its sheer awesomeness. On the other hand, the closed nature of the AppStore, the haphazard way in which Apple rejects apps and it’s borderline anti-competitive stance against Adobe and languages which are neither C or C++ have gone against the principles of openness of the Web – principles I firmly believe in.
That’s when the epiphany struck. Turn your clocks back to 2005, when a Danish guy with a funny accent demoed how easy it was to make an AJAX-powered blog in a shiny new web-framework called Ruby On Rails. While there were existing web frameworks at the time (Struts, Servlets, PHP et al), Rails changed the way you developed web applications. No more spaghetti SQL in your HTML templates, no more worrying about databases and no more figuring out how you can do AJAX (because Rails came with a snazzy DSL called RJS). For a developer who had no experience doing web applications and databases, Rails was a dream come true. It is my belief that Rails empowered a new generation of developers (and cross-over developers like myself) to get into web application development.
Even after a couple of years after the introduction of Rails, all was not well. It was still a bitch to deploy your web application. Ruby as a language was severely handicapped by poor performance, as compared to its other counterparts such as PHP and Python, which led to a lot of FUD that Rails can’t scale. The enterprise mocked Rails as a toy and not something you can build “serious” applications with. Even serious Rails developers complained that Rails forced you to tread the golden-path prescribed by DHH, and if you had to deviate from it, it certainly meant that you were entering a ball of hurt (Merb was a result of such a complaint).
Fast-forward to 2010, and look at how all-encompassing the Rails landscape has become. Ruby On Rails has become such a game-changer that there are multiple companies providing simple deployment solutions which enable you to deploy web applications to the cloud with the press of a button. Sun (sorry EngineYard), Microsoft, Smalltalk and Apple have multiple implementations of Ruby all conforming to a single spec. The fact that Microsoft (and the erstwhile Sun) is pushing for IronRuby to become a part of the .NET suite is certainly proof that Ruby is ready for the enterprise. And, Merb itself is being merged into Rails 3 to address concerns of modularity, while still maintaining the Rails ethos of convention over configuration and sensible defaults.
So, on to the iPhone. The iPhone has changed the mobile phone in a similar way to how Rails changed the world for web developers. Can you imagine being able to distribute applications to mobile phones and actually make money off it before 2008? Can you imagine the mobile internet being mainstream before the iPhone? The iPhone is still a relative child in “technology-years”. Call me naive but in my opinion, the iPhone platform is not evil, it’s just young and immature. Distractions such as the dogmatic App Store and the perceived anti-competitiveness are growing pains. Apple and the iPhone have been able to do so much more than so many other mobile phone companies in the last 20 years. So give it some time.
I understand that there are crucial differences between the stories of Rails and the iPhone – the number one being that Rails itself was open-source and thus is the exact opposite of the iPhone/iPhone OS. But the whole Rails 3 project shows the ability of the Rails Core (and DHH) to admit that Rails is not perfect and that it’s willing to adapt and keep ahead of the competition. They realised that it’s not just enough that Rails is easy to use, it now has to be both powerful and modular and easy to use. They felt that it was now mature and mainstream enough (in that there were enough Rails copycats) that they needed to raise the bar again.
Similarly, it’s absurd to think that the iPhone and it’s associated ecosystem will not adapt to how users view their mobile phones in a few years time. The mobile web will be more mature by then and mobile operating systems and hardware will have advanced to such a stage that it would make my MacBook Pro feel like a calculator from the 80s. Most importantly, more people will begin to see mobile phones as information/communication appliances and not just devices used to make calls. It’s in Apple’s best interests to adapt and keep raising the bar, and it is my belief that they will.
6 Apr 2010 – Singapore
So as you may or may not know, Andy and I are building Gameplan (which, to paraphrase Jon Stewart will be the best expletive sports league management software on the planet). We’ve already started in great earnest, and we’re looking forward to kicking on and making lots of progress. By the way, we are chronicling our progress at Naked Startup.
There’re two interesting technical gotchas which we experienced in the last three days, that I’d like to share.
How do you test that a model acts_as_authentic?
We could check if any of the standard AuthLogic methods, such as password or password= are present in the model, but that felt a little dirty. The other way is to see if AuthLogic modules are included in the model. Trouble is that, AuthLogic includes a bunch of modules to every ActiveRecord class as Rails boots up. However, we discovered that there are certain modules which are only included when you use the method ‘acts_as_authentic’ in your class. So the corresponding unit test will be:
If there is a simpler way we’ve missed, we’d love to hear about it!
Uniqueness validation tests fail in Shoulda
All we wanted to do was to test whether we’ve included the uniqueness_validation for the ‘permalink’ attribute in our model, but it gave us a cryptic ’Can’t find Competition’ error. Turns out that existing records in a database is a pre-requisite for Shoulda to run these tests successfully, as Johan Andersson points out. The corresponding unit test will be:
As a bonus tidbit, I’d just like to say that pair programming is pretty darn awesome. For the last few days, I haven’t checked my email, Twitter, Facebook or browsed anything other than RDocs (and Googling for answers) any time between 9am and 6pm, and that makes us very productive. Long may it continue!
2 Nov 2009 – Singapore
I’ve been trying to find a way to send SMS’s as part of my upcoming iPhone app – MovieFu . Essentially why I need to access the SMS functionality is for a user to quickly share movie showtimes with friends who don’t have access to the Internet.
The iPhone URL Scheme
The iPhone OS Reference Library recommends that we use the ‘sms://’ protocol to send SMS’s. Essentially if we need to send an SMS to a number such as 87654321, we can launch the SMS app with the URL ‘sms://87654321’. While this is fine and dandy for most cases, I would also like the body of the SMS pre-filled so that the user does not have to re-enter all that information.
My workaround (which hopefully isn’t a PITA)
Bear in mind that this solution will probably be rendered obsolete by the next update of iPhone OS which will include an awesome MFSMSComposeViewController (sic) of some sort, but for the time being my workaround flows like this:
The body of the SMS which I want to be sent is copied to the clipboard. The user is then presented with a UIActionSheet which provides this option: ‘Copy and Paste in SMS’. When the user selects that option, the SMS app is opened with a blank recipient list, and the user can then tap once in the body to invoke the ‘copy-paste-select-all’ widget, thus allowing you to paste the details of the showtime you want to share.
This is illustrated below:
Above: Action Sheet which brings up the various options, one of which is ‘Copy and Paste in SMS’.
Above: Once the SMS screen is launched, the user can then tap the text area, by which time the details would have copied to the clipboard, bring up the ‘paste’ menu and voila, the details are ready to be sent to your friends.
The associated code-snippet is here:
Feedback
What do you guys think of this solution? While this is not ideal, I think this solves the problem of pre-generating content for an SMS to be sent. Would love to hear what you think about it.