Everything written by "Bryan J Swift":

2007-12-31 01:43:16

Some Thoughts About Scala on Google’s Java AppEngine

I’ve spent some more time over the last two weeks working on putting an idea of mine into action. My plan was to use Google AppEngine to serve the application and store it’s data in BigTable. After I spent some time with JDO annotations and making sure I got them correct I sent the application to the AppEngine dev server using Ant on my local machine and received an odd runtime exception. I received a similar error when I pushed the application up to Google’s servers. After spending quite a bit of time trying to debug an unfamiliar error I asked on the Java AppEngine Mailing List if there was a problem with JDO annotations and Scala. The response I got was that it was a known issue with the 1.1.0 version of the DataNucleus enhancement process.

I did as the thread suggested and replaced the datanucleus-1.1.0 jars in the AppEngine SDK with downloaded 1.1.2 jars. This eliminated the runtime exception when deployed to both the dev server and Google’s servers when attempting to save data. Sadly when I attempted to take the next logical step with the application code and retrieve data for display as well as save it I ran into a new exception. As far as I can tell the error is due to the internals of Google’s datanucleus-appengine (1.1.0) jar being incompatible with the newer datanucleus jar files.

Despite how much I would have liked for persistence to be handled easily on the AppEngine, mostly because I wanted to use the Google’s servers rather than having to host it myself, I am not really upset about being unable to use the JDO annotations. I could attempt to use JPA annotations rather than JDO and see if they work better but to be perfectly honest using the annotations forced the me to use mutable model classes which felt pretty un-Scala like to me. So for now I’m back to the proverbial drawing board on persistence and I’m even considering not using a persistence framework and interacting with the database through plain old SQL statements. I recognize this will force me to maintain the schema myself but at least I would feel like I was using the Scala language properly.

I did look for some Scala persistence frameworks but most everything I found is using Java based persistence in Scala classes and I’m just hoping to find a solution which feels more, I don’t know… correct.

May 4, 2009

My Experience Learning Scala

Sometime in the last week I read an article about Scala, actually I think it was the interview with Twitter engineers about Scala vs. Ruby, and it really sparked an interest in the language for me. I’m sure at least part of the reason is because I’ve been writing mostly JavaScript lately and reading a description of Scala it seemed like a number of the functional programming practices I’ve picked up writing JavaScript would carry over well. At the same time though Scala is built on top of Java, a language I’ve become intimately familiar with even if it has fallen somewhat into disuse. Last week after reading the article and feeling this resonance with what I read further about Scala I decided to jump into it and see how much I could pick up.

The Scala website is well documented and has a number of good tutorials but something just wasn’t clicking in my head about the syntax or the language in general. I think feeling like I could get a handle on this language quickly is what has really driven me to obsess about it this past week. I ordered Programming in Scala from Amazon (before Amazonfail as it’s being called on Twitter [From AmazonFail to SorryAmazon]) which I’ve read about 200 pages of and continued to read over (and over) the pdf tutorials available to me. This weekend I started putting together an application written in Scala to be deployed on Google’s AppEngine since they released Java support and Scala compiles to Java. Additionally, my tentative plan for the application is to make use of a number of ‘Social APIs’ which are coming up more and more at work but I still know quite little about. The first API I decided to work with was Twitter’s and in just a couple of days (maybe 16 hours) of work I have the basic model classes written along with BDD specs for them using Scala Specs, and I’m also able to pull the data I want from Twitter and deploy to the AppEngine service. All in all I’d say not bad for a weekend’s work. There is of course quite a bit left to do before the application is finished but I’m proud of the first steps I’ve made. If inclined, the source for this experiment is publicly viewable as twitter-favorites on github.

April 12, 2009

Releasing My First Wordpress Theme

When I started work on the Wordpress theme for this blog I did so with thoughts of eventually releasing it into the wild but at the time releasing it was by no means the immediate goal. I wrote the theme myself because I wanted a reason to dive into some PHP as well as because I knew familiarity with (one of) the most popular blogging platforms could only be good for me. I started work on it around the time Wordpress 2.5 was released and github shows my first commit on 10 May 2008 though I know I started working on it prior to that because the first commit contains a pretty recognizable set of files.

After working on it for a while I it got to a point where I was more or less satisfied with the way it looked in my primary browsers of concern1. I largely ignored IE(Internet Explorer) because to be honest I didn’t expect much traffic and what traffic I figured I get I didn’t believe would be using IE. As a result I was content with my theme and while I realize it’s not a pillar of web design or anything I think it serves it’s purpose and features the important part, the content, prominently.

This all brings me up to about a week ago2 when I decided I could use some supplementary income and at the time I thought things looked ‘ok’ in IE and so it would be quick to polish things off, get it uploaded and wait to see if it got approved. However, once I read the information available on themeforest and realized what files where required and that there was an approval process I realized I had to take this a little more seriously. Not to mention that when I actually looked at the theme (and hence this site) in IE I realized how wrong I had been about the couple of quick fixes and then upload.

Knowing someone was going to be reviewing my work also made me a little more critical of it. I had included some MooTools in order to accomplish some pretty basic things. I did this mostly out of laziness and so upon looking at my work critically I knew this needed to come out because the 7 or so lines of JavaScript I had written using MooTools were certainly not enough to justify the library’s inclusion (as much as I do love me some Moo). So I took out MooTools and rolled my own native JavaScript to handle things like IE6’s lack of :hover support and IE’s general lack of :last-child support.

There were also some pretty nasty float bugs to clean up and in the process of all that I decided to take a sip the CSS3 Kool-Aid and smarten my suckerfish menus up for browsers supporting box-shadow. After the bugs were squashed and a little CSS3 was tossed in there I had to do something I never thought I’d have to do for a Wordpress theme; write documentation. After documentation it was just putting together zip files and taking some screenshots.

All in all I think developing this theme was a good experience3 and I’m actually looking forward to creating another theme as soon as I have a good idea for it.

  1. Firefox, Camino and Safari 

  2. my github graph says I started committing again in earnest on 18 Jan 2009 

  3. it was also the first project I used git for 

January 25, 2009