Dec 22, 2009

Blog migration from Spaces to Blogger

I migrated my blog from Windows Live Spaces to Blogger via Wordpress in the process of resurrecting http://vineetgupta.com/.


Choice of blogging platform – the two choices were wordpress and blogger. Wordpress has a lot of plugins going for it, and supports static pages. However, I ended up choosing blogger for the following reasons:


  • Everything in blogger is free. Wordpress charges for certain services which were important to me – custom domains and custom CSS
  • The number of Google services I ended up using / intend to use for vineetgupta.com are quite a lot – Google Apps, Google App Engine, AdSense, Feedburner, Analytics, etc. It would be silly then to have a dependency outside the Google ecosystem, unless I was getting a tangible benefit
  • The Blogger Data API shares several concepts with the GData API, thus reducing learning curve.

 


Migrating the blog contents – this was real pain and quite an adventure. To cut a long story short:


  • Used Live Space Mover to pull out my posts from windows live spaces to a wordpress format file.

    • This is a python script that uses Beautiful Soup for parsing the Live Spaces content.
    • Works flawlessly – was able to import the exported file into wordpress without a hitch.
  • I naively assumed that blogger would provide a way of importing from wordpress, but it does not.
    • There are a number of third party programs that try to make this work using Blogger’s import feature .. nothing worked for me including the famous Google Blog Convertors.
    • There is a lack of clear guidance on specifying the expected layout of the Atom stream that can be imported by Blogger. I tried multiple variations and even the simplest ones failed. I wonder if anyone has ever been able to import an atom feed to blogger, that was not exported from blogger itself.
  • Frustrated with the import feature, I investigated Blogger’s Data API and stumbled upon Wordpress to Blogger – another Py script that again uses beautiful soup to parse the wordpress file and then makes posts to Blogger using the GData protocol To make this work, I had to make some changes:

    • Set datetime format = H:M everywhere
    • Modified the static date used for GMT published dates in the wordpress template
    • Finally, there was some bug in the comment publishing code, so I removed the comments from the wordpress export (by modifying Live Space Mover to not write comments).
  • This worked well and I was able to start migrating posts, however Blogger imposes a 50 posts / day rate limit, so I was only able to migrate 42 posts (used 8 postings for testing and debugging). I still have about half the blog contents waiting to be migrated which I intend to do tomorrow.
    • Despite all this, I have not been able to migrate comments (because of the bug I mentioned above). Some amount of testing and debugging can surely fix this, but I am not sure if I would be able to spare the time.
  • Feedback for Google:
    • Document the import Atom steam feature properly
    • Support importing from popular blogging platforms

Dec 9, 2009

Groovy, Scala and Clojure – A Comparison

We recently started off on a couple of projects that target the JVM. The team had no prior Java experience but had worked on C#/.Net. We found Java tedious and ceremonial and decided to investigate the other languages that target the JVM – Groovy, Scala and Clojure. These notes summarize findings based on my interpretation of the language specs, examples and scanning the project sites. They are not based on any real programming experience on these languages.
1. Groovy
  • Language
    • Syntax very similar to Java, therefore easy for a Java programmer to pick up. Semantically seems to be influenced from Ruby
    • Scripting language – the engine can be used in the JSR 223: Scripting for the Java Platform API classes
    • Dynamically typed
    • Eagerly evaluated
  • Why not use JRuby or Jython instead to target the JVM?
    • Groovy is targeted to the Java developer – superset syntax and tighter integration
    • So if you have a background with Python or Ruby, you would use JRuby or Jython. Java libraries syntax may feel awkward while being called from a Ruby / Python
  • Frameworks
    • Grails – Rails inspired
    • Griffon – for the desktop
  • Projects - http://groovy.codehaus.org/Related+Projects
  • Books – Groovy in Action seems to be the authoritative one
  • Community - http://groovy.codehaus.org/Community+and+Support

2. Scala
  • Language
    • Statically typed, Type inferred
    • Not a scripting language like Groovy
    • OO with functional features
    • Targets both JVM and CLR (with quirks)
    • Eagerly evaluated
    • Higher order functions
    • Automatic closures
    • Mixins and Traits
    • List Comprehensions
    • No concept of static (fields, methods, classes) – singletons instead
    • Tail call optimization
    • Concurrency support – Actors (like Erlang)
  • Frameworks – Lift – Rails like
  • Books – Programming in Scala – written by Martin Odersky himself
  • Community - http://www.scala-lang.org/node/1707

3. Clojure
  • Language
    • Lisp dialect that targets the JVM and the CLR
    • Focus on functional programming and concurrency
    • Immutable objects
    • Macros
    • Multi-method dispatch instead of OO (see http://en.wikipedia.org/wiki/Multiple_dispatch to understand this)
    • Tail call optimization – via recur
    • Concurrency support – Refs (STM), Agents and Atoms
  • Books – Programming Clojure
  • Community - http://clojure.org/community

Conclusion
  • Groovy - If you are an experienced Java programmer and need to do scripting work.
  • Clojure – If you have a Lisp background and want to target the JVM. Take the high ground on concurrency – very promising.
  • Scala – If you want sophistication, and the best of OO and functional. Most impressive.
  • Cool part is that like the CLR, you can do language interop here – so choose the best language for the job
Personally, I am excited about Scala – I think it will replace Java as the mainstream language on the JVM in the long-term. Clojure is exciting because I always wanted to learn Lisp – here’s the perfect opportunity!