Monday, February 24, 2014

Hopefully this Apple TLS/SSL bug debacle settles the age old coding-style debate...


... about whether you should omit curly braces around your if block, if there's only one statement.

Just go ahead and add them in.

Read Adam Langley's analysis about the issue here: https://www.imperialviolet.org/2014/02/22/applebug.html


Friday, July 12, 2013

[ruby] Calling :methods on BasicObject


So, I just learnt a couple of days ago that you could pass in false to  :methods , and it'll filters out the inherited methods and return an array of only the methods that are defined in the class.
And as I spent time playing with it, I thought I'll check how BasicObject would respond to, if I called methods(false) on it.

My assumption was that BasicObject would possibly be the only class which would return back the same array for :methods(true) and :methods(false) - since it doesn't inherit from anything.

So here's what I did

BasicObject.methods(false) # => []

An empty array? Given that BasicObject is the root of Ruby's object hierarchy, it didn't make sense that BasicObject could respond differently for :methods(true) and :methods(false) - So where were those methods coming from?

After a few mins of trying to Google, I reached out to [Chew Choon Keat](http://blog.choonkeat.com/) and he figured the obvious problem here. It wasn't BasicObject responding to the call - The receiver was instead a Class object.

:instance_methods seems to be respond like how I expected it to though.

Oh, and :methods is defined in the Kernel module, that gets included into Object class.

#TIL

Thursday, July 11, 2013

RVM install fails when you have developer preview of xcode5 installed

I was just installing ruby-2.0.0-p247 on my machine (high time, I know!), and rvm kept failing silently.  It would download ruby, extract, proceed till configure, and failed at the installation phase.

So I ran

rvm install --debug ruby-2.0.0-p247 

And this exposed the location of the installation log file.  

The log, showed that the failure was with a missing path within Xcode.app - 

Apple's Xcode5 developer preview app 1 & 2 were just named Xcode5-DP.app, but with the Developer preview 3, the app's called Xcode5-DP3.app - And for some reason rvm's install scripts were looking for a path inside Xcode5-DP.app. Strange.

Anyway, I then proceeded to symlink Xcode5-DP3.app as Xcode5-DP.app, did a rvm install again, and this time, installation went smooth.

Blogging this, just in case someone else runs into the same issue. I can't be the only one who's so late to the party? 

Monday, March 11, 2013

Learn Ruby on Rails in Bahasa Indonesia

Nia Mutiara, a dear friend and colleague of mine has started writing Ruby on Rails tutorials in Bahasa Indonesia, (and has created this try.ruby like application too!), to help her local developer community adapt Ruby on Rails.

Here's an attempt to send her some hits. If you have friends in Indonesia contemplating learning programming, send them over to her page!  http://nyan.catcyb.org/mengenal-ruby/



Wednesday, June 27, 2012

Apple iTunes store launches in Singapore

iTunes store arrived in Singapore today. It only took about 9 years, but hey! we can finally buy music tracks legally online! All 16 billion of them! And movies rentals too!

They also launched it in a few other neighbouring countries (WJ article).

http://www.apple.com/sg/itunes/






You next Google music.

Talking about being unavailable in Singapore, Adobe CreativeCloud is right on top of that list for me. Go adobe! 

Tuesday, April 24, 2012

Adobe CreativeSuite 6 launches. No CreativeCloud outside US, Canada and Mexico


Update: Creative Cloud for teams is now available in Singapore too. Read more

The Creative Suite 6 launch event just ended.

The most exciting piece that I was looking forward to was the CreativeCloud subscription license that allows access to almost all CS applications (and more) for USD 49.99. Sounded like a great deal, and was super excited! Only when I tried to preorder did I notice the country choice for Billing addresses only allows USA, Canada and Mexico. A customer care person on the online chat support page confirmed this too.


Everyone would agree that most software piracy happens in places where people can't afford to spend a couple of thousands of US dollars on software. They probably don't make that much money in a month. This subscription license seemed to have a potential to change that. At $49.99 a month, adobe would've potentially had a chance to earn possibly millions of new paying customers. Sure Adobe must know this and they must be working on releasing it to the rest of the world over time. But delayed launch of this is going to make pirated versions available in these regions and then adobe coming in late with a subscription license gives these users a choice of choosing between $49.99 and a free version. *sigh*

Update: Adobe Customer Care responded to my tweet pointing me to their FAQ that says
We intend to make Creative Cloud as widely available as possible. Adobe will share more details about country availability over time.

Saturday, September 10, 2011

Why Flash Media Server 4.5 is NOT the end of Flash

Adobe announced Flash Media Server 4.5 couple of days ago at the IBC conference. It didn't take long before the 'tech journalists' started writing ill-informed posts about how this marks the demise of Flash. This post is my humble attempt to educate them about what Flash ecosystem really is.


"Flash content" ≠ videos.

Almost all posts in the above techmeme cluster seem to interchangeably use "flash content" when they are really talking about just videos. 'Flash content' means anything that can be interpreted by the Flash Player aka the Flash runtime. 

The notion of FlashRuntime being a video player seems to come from the common reference of 'Flash Player'. It was originally called a player because it used to be a player for streaming vector animations. Over the past decade, Flash player has grown to do a lot more, and hence its more appropriate to consider it the 'FlashRuntime', than as 'FlashPlayer'. 

I will henceforth refer to FlashPlayer as FlashRuntime to be unambiguous. 

The FlashRuntime is a programmable environment that can download Flash content (packaged as .swf files) and execute it. Flash content can include text, images, audio, video and vector drawings. Soon this will also include native 3D content.

Since Video is one of the content types that FlashRuntime understands, a developer can write a videoPlayer that works inside FlashRuntime. All those video players you see on youtube, vimeo, hulu etc are created by those website developers, not Adobe. FlashRuntime provides a platform for them to build it. Adobe just provides the platform ( and sells tools to create flash content).

There are other types of Flash content that people use all the time. Browser based games like Farmville, angrybirds, Planet vs zombies etc. are also Flash content

scribd.com serves documents online through a Flash based reader. This is Flash content too. 
aviary.com allows editing images in the browser using an application written for the FlashRuntime.
audiotool.com helps artists create electronic music from the browser. This application is created using Flash too. 
You could call these applications 'flash content' too. Thats what they are, from the FlashRuntime's perspective.

So video can be part of Flash content. But not all flash content is video.


Flash Media Server does not serve all Flash content.

Flash Media Server  provides services that help create Flash content. One of the main uses of Flash Media Server is streaming Video content (Read more). So a developer can create a videoplayer that plays streaming video from Flash Media Server. 

What changed in Flash Media Server 4.5

In its earlier days, Flash Media Server used to stream live video only over a custom protocol(RTMP). So, users who had restricted access to the web (for eg., inside corporate firewalls) were not able to view these videos. Adobe then came up with HTTP Dynamic Streaming protocol. This allowed live video to be streamed over standard HTTP. Anyone with access to HTTP could now watch videos from Flash Media Server. 

When Apple built iOS, they created a new protocol - HTTP Live Streaming - to stream live video to iOS devices. This protocol was the only way to stream live video to iOS devices. 

This created a problem for Adobe's Flash Media Server customers. They didn't want to create two servers - one for iOS devices and another for everything else. Enter Flash Media Server 4.5.

Flash Media Server 4.5 now streams videos using Apple's protocol too. This helps Adobe's customers to stick to their existing infrastructure. If an iOS video player needs the HTTP Live Streaming stream, FMS will deliver that. If another video player asks for the RTMP stream or HTTP Dynamic Stream, the same FMS will deliver that too.

Thats all to it. This new feature in FMS4.5 will not allow *all* flash content to be available on iOS devices. It streams videos to iOS devices. It allows Adobe to keep their FMS customers from switching to its competitors in the video streaming server market.

Will this have any impact on Flash Runtime usage? 

The FlashRuntime has been capable of handling videos from non-FMS servers since the time flashRuntime included external video capabilities. Google videos, for example - built their custom video streaming server right from the beginning. This is the server app that now serves youtube videos.

Youtube will probably replace their FlashRuntime based video player  when HTML5 enabled browsers reach a substantial chunk of their user base. 

This FMS4.5 release does not change anything. 

Is Flash dying? 

When I first started developing Flash content, there was a lot of chatter about how flash is 99% bad and Flash is evil. Then video came along, and Flash not just survived but became the best tool for video delivery. Now that browsers are catching up with native video (and canvas), the anti-flash chatter seems to gain momentum again. Meanwhile, Flash Runtime seems to be on the verge of another pivot with the upcoming FlashPlayer 11. This upcoming version includes hardware accelerated 3D support. May be Flash will move on in this direction, and become a defacto standard there. May be not.  The point is - to hurt Adobe, developers will have to stop using Adobe tools. If Adobe built tools that enable developers to create Flash like content, but native to browsers (HTML+CSS+js) and Flash developers will move on to using those tools, Adobe might not even mind FlashPlayer dying.

FMS4.5 will only help Adobe make new customers. Existing customers are not going to move away - infact their lives just got a little easier. So please stop writing Apple - 1 / Adobe - 0 posts.  Thank you. Now, do this:

Friday, July 29, 2011

[Singapore] How to get Starhub ZTE MF626 USB modem working on OSXLion

Update 18th Nov 2012: I upgraded to a new machine, and this broke again. The link below to the Vodafone Broadband Manager doesn't exist either.

So I went to Starhub today, and was told there was no way out other than to buy a new modem ( the one from Huewei starts at S$88) I didn't want to spend money on this, so went to look for the latest Vodafone broadband software. Found it here: http://www.business.vodafone.com/site/bus/public/enuk/support/10_productsupport/laptop_connectivity/40_software/software/10_latest/p_software.jsp. Sure enough, after installing the vodafone software, the starhub connection manager started working again. Vodafone - 1 ; Starhub - 0.

Dug around a little bit this time, apparently the drives that ship with the modem are 32 bit drivers only. OSX Lion and above don't load 32 bit drivers anymore AFAIK, so that's why the bundled driver software doesn't work anymore.

Wish Starhub updated their software and hosted it somewhere on their website.



-------------------------------------
Old post:

Starhub's ZTE MF626 modem doesn't work on OSX Lion (10.7). Looks like the USB modem driver is outdated. Starhub doesn't seem to have an upgrade available yet. So, DIY time!

Thankfully, Vodafone has updated their connection manager for OSXLion ( thanks http://openmindlifestyle.wordpress.com/2011/07/22/tip-workaround-for-zte-mf626-broadband-modem-on-mac-os-x-lion-10-7/). Here's how to setup Vodafone's upgraded modem driver and connect to Starhub.

  1. Remove existing ZTEUSBModem Service from your network preferences panel.
  2. Install the Vodafone Broadband manager available here. This installs the drivers as well.
  3. Restart.
  4. Go to System Preferences > Network. Choose ZTEUSBModem. Key in *99# as the phone number to dial to. Click Connect. (Might take a couple of minutes to connect)
The Starhub Connection Manager doesn't seem to be able to use this updated driver. Just check the 'Show modem status on menu bar' option in the Network Preferences panel; Its simpler than using the Starhub Connection Manager anyway.

Friday, December 31, 2010

HTTP PUT & DELETE from an Actionscript REST client

REST based APIs use the HTTP verbs - POST, GET, PUT and DELETE to accomplish Create, Read, Update, and Delete operations on data respectively. Flash player for various reasons only supports GET and POST. This makes writing REST apps a little harder (an additional line on the client side, and support for an extra request header on the server end) than it should be.


Thankfully, most popular web frameworks provide some support to accomplish this. Ruby on Rails supports overriding the http method using the X-HTTP-Method-Override request header.

The below code tells the RoR server app to consider the request as a PUT operation:

var request:URLRequest = new URLRequest(resource);
request.data = dataToUpdateOnResource;
request.method = URLRequestMethod.POST;
request.requestHeaders.push(new URLRequestHeader("X-HTTP-Method-Override", "PUT" URLRequestMethod.PUT));
var loader:URLLoader = new URLLoader();
loader.load(request);

HTTP DELETE can be achieved using the same.

Saturday, March 27, 2010

Flex 4 launch event at Singapore

Adobe announced the availability of Flash Builder 4 and the opensource Flex SDK 4 earlier this week. This release brings us a major overhaul of the Flex SDK, while also adding support to new technologies(FXG), and future tools like Flash Catalyst.

Here is an excerpt from the official blogpost, detailing where to go to learn more:


As you can see, there are lots of great new features and enhancements in Flex 4 and Flash Builder 4 - too many, in fact to list here. We recommend that you read the "What's New in Flash Builder 4?", "What's New in Flex 4?", and "Introduction to Spark" articles, as well as check out the rest of the new content published on the Adobe Developer Connection site to learn more. Additionally, you can watch David Wadhwani, Vice President and General Manager of the Flash Platform Business Unit describe the new set of products being added to the Flex product family.
I like the Flex testdrive page that they put up as well.

To commemorate the release, The Flex User Group, Singapore and Adobe Singapore have planned a launch event. Flash Platform Evangelist Harish Shivaramakrishnan will be flying in from Bangalore, India to introduce Flex 4 features, and Flash Catalyst. Hu Shunjie will also be discussing the new Spark component architecture. For detailed Schedule, head over to the official FUG blogpost here.

Attendees also stand to win a Flash Builder 4 Premium license from Adobe. Seats are limited, so go ahead, and register for your seat now.