Wednesday, November 16, 2011

Developing on a Chromebook - Part 2: Cloud, it's not me, it's you.

...You're just not ready for me yet.

Cloud9IDE is way too buggy (sudden disconnects, unable to commit and push, endless loading, random error popups). Because of this and other shortcomings of a Chromebook (e.g. complicated opening of archives) changing just one typo in my Chrome extension's source code and deploying the new code to my browser takes me a few minutes and lots of nerves.

So, what do we (or, Chromebooks) need in order to make using it for development more comfortable?

1. Easier archive management
I want to be able to double click an archive in order to open / mount it, open / mount it using the context menu and also extract all of its files into the current directory... with just two clicks! If I'm not mistaken it should be possible to realize this using a Chrome extension (file handlers?).

2. Automated Chrome extension "building" and packaging
One thing I love about Heroku.com is how you deploy your apps: git push heroku master and you're done. Why not take this principle to Chrome extensions and Chromebooks: git push origin master, and it packages a shiny .crx file for you. You navigate to your building server (or GitHub, where the .crx file is stored?), click the file and it is being installed automatically.

3. Vim. Vim? Vim! Oh, no...
Yes, there is vim preinstalled on Chromebooks. I couldn't believe that it's real, but you're really able to start vim after rooting your Chromebook, pressing Ctrl + Alt + T, typing shell and typing vim. But the version of vim shipped with Chrome OS / Gentoo Linux seems to be different than what I'm used to in Ubuntu. At first, navigating by arrow keys appends characters ("A", "B", ...) to your currently opened file and deleting characters doesn't work. However, I figured out that enabling (or disabling?) compatibility mode fixes most of these issues (:set nocp in command mode). Some things, like editing your vimrc still doesn't work. Bummer. :/

4. Version control with git.
Writing code locally with vim on your Chromebook is cool, but who cares about that if you can't get it off of your device? I don't. I'm not really hoping for preinstalled git (although I would appreciate a packaged version of git), but I'm hoping for a workaround, like a combination of a full-blown git.js and the HTML5 file-system API, or some web service I can upload my code to in order to get it uploaded to my git repository.

5. A local editor. Local9IDE, anyone?
vim could replace a local editor in the browser, but latter would be a better solution when aiming for the masses. Like David Notario said, there's no doubt vim is "An editor for the masses"... not.
My friend Dominic started working on a local editor using Cloud9IDE components (namely, the ace editor) a few days ago. We'll see how this project evolves...

PS: My solution to problem #3 and #4 seems to be a high-end router with DD-WRT, vim and git installed, running all day long at home, waiting for my Chromebook to connect via SSH. :)

Want to read more about this topic? Check out the other posts of this series:
Part 1: Chromebook
Part 3: X-Forwarding
Part 4: Ubuntu

Friday, November 11, 2011

Google AppEngine vs. Heroku

Note: most of the restrictions for AppEngine should be resolved with Managed VMs launching soon.

As you might know I'm currently working on my top-secret project, called JOPPFM. It requires some heavy work on the server-side, so choosing the best PaaS / SaaS is critical. At first, I planned to use AppEngine. Unfortunately AppEngine restricts you to use HTTP only, but I need IMAP / POP and XMPP too.
A few weeks ago Heroku introduced support for Java, and I've decided to ditch AppEngine in favor of Heroku, because the easy deployment (using git) and the freedom (use whatever protocols you want, unlimited bandwidth, unlimited database read and writes, etc) fascinated me. So I started developing JOPPFM for Heroku and yesterday I finally managed to get a first prototype up and running.

During development I faced lots of problems and shortcomings of Heroku and decided to migrate to AppEngine after finishing the first prototype. So, here I am. I think I'm now able to compare those two services for you...

Documentation
Take a look at AppEngine's extensive documentation here. Almost every feature AppEngine offers is described here. Note that this documentation is language-specific! No general blabla, but actual code in the language you're working with.
Heroku offers an extensive documentation too... but not for Java. Almost all official wiki entries are for Ruby. The Java-specific documentation you can find on heroku.com is their announcement of Java support on their blog, which describes the first steps of getting an app up there. Fortunately one of their employees, James Ward, seems to be a Java developer himself and wrote a great "workbook": "Heroku for Java Workbook".

Still, that's not comparable to what Google offers. Goal for AppEngine.

Freedom
TL;DRHeroku wins this point. You're allowed to do almost everything! Run threads from servlets, connect to an IMAP server, etc. The only "restriction" I remember at the moment is a timeout at ~60 or 90 seconds on HTTP connections. However, this only counts for idle HTTP connections. Push some data out there every 30 seconds and you're good to go...
So, if you already have a Java server running, you could run it without any modifications on Heroku.
AppEngine is restricted by design. I guess it's for the sake of security and performance. That's a good reason to restrict developers, but I would still love to workaround this somehow...

Administration
For this purpose, Heroku offers... erm... nothing? Ok, I have to admit: if I didn't mix up SaaS (which Heroku is) and PaaS, SaaS doesn't offer administration tools by design. That's what it's supposed to do: run your app. Additionally, you have access to your app's output, but that's it.
PaaS however, which AppEngine is, offers you great tools for logging events and errors, measuring your load and performance and so on. AppEngine does that job pretty well. Heroku 1 : AppEngine 2.

Free candy
Both, AppEngine and Heroku offer you some free stuff. Every month, again and again! Basically they offer the same: one instance is free. Additionally, you get unlimited bandwidth and a 5MB (!) database.
The free tier at AppEngine is... different. Take a look at it yourself here.
It depends on your needs which service wins this category.

Storing Data
I'm not sure if I prefer direct access to a (Postgre-) SQL database, or if I prefer a wrapper, like the excellent objectify-appengine. Again, decide yourself...

That's it. I hope you keep these facts in mind for your next app.

Friday, November 4, 2011

Developing on a Chromebook - Part 1: The Chromebook

"It's just chro without me."
Last week our local GTUG organized a Chrome Hackathon. It was a fun event featuring tons of code, free drinks, free pizza, more code and free swag. If you want to see what the event looked like, you can watch a slideshow compiled by Fabian.

The extension I've been working on was a new version of Announcify, which I've built together with Dominic Bartl and Kariem Hussein. Dominic worked on that mindblowing blur effect and the rest of the design, Kariem built the fancy settings (he showed up late, like 5 hours after kickoff ;)) and I was responsible for the "Announcify" part of the extension - fetching a website's content and announcing it paragraph by paragraph.
And thanks to Dominic's mindblowing effects, Kariem's naughty marketing tricks and - maybe - Announcify's beautiful voice, we won the grand prize: a Chromebook. :)

Now that I (finally!) own a Chromebook, I want to use it for as much work as possible. Unfortunately, that's not that easy if you're an Java and Android developer, but I'll talk about that in part 2 of this series. This part is about the Chromebook itself...

My first impression was pure excitement. Maybe because I just won a laptop worth 400€, but I was excited anyway. The first thing I noticed was its weight. I really thought it was lighter, but actually it's quite heavy for a "thin client" like a Chromebook. Anyway, excitement didn't stop: I liked everything else I've seen so far.
After unboxing everything like a baby at christmas, I opened the Chromebook and... WOW! It unfolds like silk! :P Easy and smooth.

After a first setup and some exploring of the system, I decided to immediately switch to Developer Mode. Reboot, set everything up again, update, install tons of apps using the addictive new interface of the Chrome Web Store, reboot again and... be no more able to login? Urgh. Ok, this seemed to be a bug in a recent version of ChromeOS, but it's fixed now. I had to wipe my Chromebook like five times, but that's not a big deal. You know, everything's in the cloud... ;)

Besides the mentioned "cool"s and "booh"s, I really love the animation when logging out of your account and shutting down. Of course, shutting down and booting is blazingly fast. Google didn't lie when promising us a 8 seconds boot.

One thing most of the reviewers complained about was the touchpad. And... yes, I'm still not used to it. Right click is really uncomfortable, but I guess Google wants to eliminate right clicks in the web browsers in the future... Other than that, scrolling is fun, but is buggy every now and then too.
However, the most important part of a laptop / Chromebook, which ultimately distinguishes it from a tablet, the keyboard, is great. Perfect for typing and minimalistic. No num pad and lots of other keys missing too. At first! For example, I desperately missed page up / down, or delete. By accident I found that they're just packed into key combos:
  • page up / down - alt + up / down
  • caps lock - caps left + caps right
  • delete - alt + backspace

I'm sure there are a lot more combinations available.

I can't really talk about speed and annoying sounds at the moment, because I experienced both, slowness and a loud fan. However, my first experience (and my experience at the time of writing this article) is a fast system.

All in all, if you asked me whether you should buy this thing is "if you can afford it, definitely yes", no matter who you are. Sure, this thing is primarily targeted at Otto and Jimmy Normal at the moment, but it's capable of some magic tricks turning it into a beastie.

Want to read more about this topic? Check out the other posts of this series:
- Part 2: Cloud
- Part 3: X-Forwarding
- Part 4: Ubuntu