Wednesday, May 11, 2011

GSoC

Although I really don't have time to devote to it, I am acting as a mentor on a Google Summer of Code project (Maven related) for OpenMRS.

Tonight we finally were able to connect on Skype and have a productive session going through the bumps of getting started.
I was able to get my dev VM environment up (despite its protests) and we could walk through using the existing code together, tackling errors and exceptions as the appeared.

Sadly this is really the only window of time I have available, in the hour before sleep.

Monday, May 2, 2011

jQuery Plugins

I've been trying out a few jQuery plugins lately: templates and globalization
Although the documentation for them is somewhat lacking
I made a few examples using them and I was impressed with the results

I originally started looking at the templates plugin as an alternative to the datatables plugin
Not to replace datatables, but just as a simpler solution for filling in tables rows without needs like paging and sorting
I originally found the jQote plugin and then the templates plugin. Very different syntax between the two, and I chose the later.
It was as simple as creating a template for a row (in script tag, mixing html and javascript) and passing in a JSON array of data.
Works well with REST services passing json data back.
Also with JSON mappings for descriptions, like supporting multiple languages (re-render template with new JSON data).
One thing I didn't use from any of the template plugin examples was the use of appendTo(), instead just setting the html() value.

For globalization, I just wanted to be able to format dates, format numbers, and parse dates.
But also have the flexibility to easily change this formatting (like month name in the date or currency) based on the locale.

These two plugins are in a beta version, and I look forward to them being released and official jQuery plugins (as mentioned in news stores from last year).

Maven, New Comic

I had an old Java project lying around, a simple class to parse a Wikipedia page and send an email when text changed.
I used it to notify myself when a new issue of a comic, the Walking Dead, was available.
Finally I took some time and converted it over to Maven.
Surprising as it is, I didn't have it installed on here, so I had to set it up.
I created a basic pom and ended up changing to using commons-email instead of just the mail api and smtp.
Finally I ran the class using the maven exec plugin.
I also configured the main class and classpath in the jar plugin, incase I decide to run it as a jar instead.

I like Maven, I am an enthusiast, but migrating to Maven is not smooth, especially with ongoing development.
Usually a branch gets created, porting and testing the project in Maven, while trunk dev continues.
And since merging can be ugly and lose information, it can be better to just redo the changes on trunk when ready to move over.
I've done this in the past by creating a bash script to run on the trunk when ready, moving the files to the standard layout and adding the poms.

So the comic issue notifier code works well as long as someone else is updating the wiki page,
which didn't happen this time, so updated the page myself.

Read through the new Walking Dead issue #84.
Glad to see the possibility of Carl surviving, the group working together, and Rick finding himself.
I was disgusted with Rick in the last issue, running away and leaving people he cared about to die.
This issue restored some of my faith in him.
Though if Carl died, I can just imagine him spiraling out of control.
I really hope this doesn't happen, Carl is badass, like the gunslinger, and I hope he continues on.
Waiting time, another month to find out.

Sunday, May 1, 2011

TV, Fringe

Although I like XBMC, it is not without its issues.
Sometimes new shows are not picked up when trying to update the library.
I've seen this happen a few times.
But recently I found that exiting library mode, navigating to the show, and looking up the show information solved the problem.

I've gotten into Fringe more lately. I'm caught up with all episodes on Hulu.
There is s03e19 LSD in Olivia's mind with Inception-like creepy moments where everyone on the street stops and looks, and animation with zombies! Thankfully this episode ended Olivia's annoying Bell voice.
Then s03e20 6:02 AM with Peter and Olivia finally together, the surprise of the machine rejecting Peter, and the start of the machine's destructiveness.
And just finished s03e21 Sam Weiss explaining a little about Sam, and having the very dramatic moment of Peter and the machine with his life building up to that moment.
These episodes have been exciting and pulling the pieces together.
But now only one episode is left for the season! I have no idea where it is going, apparently the future?

Since I ran out of Penny Arcade DND podcasts, I went looking for a new podcast.
I stumbled across the Fringe podcast and I have enjoyed it so far.

Wore my superman shirt recently and finally watched an episode of Smallville after a long break.
Like Fringe, s10e12 titled Collateral took place inside the minds of the characters, in a virtual reality reminding me of the Matrix.
Over halfway through the final season!

Random

I found myself staring into an empty breadbowl
and it reminded me of Minecraft
digging or exploding a cavern underground
and I haven't played it in a while
but it is still fresh in my mind

I always find myself excited by SVG images
usually through my viewing of Wikipedia
to be a scalable image and XML data
like HTML5, too bad browser support is still lacking for it

Sunday, April 24, 2011

REST and Bugs

Sometimes the need to code out ideas just infects the mind or becomes an obsession enough that you have to get it out. Maybe that's the normal mode of operation when you are actually interested in the work.

Lately I've been working with Jersey, the JAX-RS (JSR 311) REST library.
I've worked with servlets, I've worked with JAX-WS annotations, and this seems to merge the two nicely.
My initial reaction was that it was super easy to create simple GET methods and return XML or JSON using JAXB annotated classes.

My second reaction was that I couldn't organize the services the way I wanted. For example, Jersey doesn't allow the resources to share the same path. This is exactly what I wanted. First to be able to put it only on the interface and share it in both the real and test resources. Then to be able to use a path annotation for the package and have path annotations only on the resource methods to differentiate them. And I'm guessing this would be possible if the path namespace was by method (or package/class/method) and not by class.
But although it works, path annotating interfaces is annoying because of the ugly logged warning messages.

My third reaction was that inputting data wasn't as simple as returning data. While the GET return handled the conversion to JSON/XML well, it proved more difficult for the incoming parameters. I was attempting to pass in both simple string parameters and complex JSON or XML data together with the later being automatically converted to the JAXB entities like the method return values. I eventually found that I could accomplish what I wanted using a POST with query params, where the body contained the structured data and the Consumes annotation (like the Produces) determined how to interpret it.

In other news, I've tried out the PMD (again) and FindBugs maven plugins, both helping to point out and prevent bugs in code.
In testing I saw results pointing out string concatenation in a loop, not closing resources for certain conditions, bad null check logic, unused fields and imports, empty catch blocks.
Finding faulty null logic with findbugs has been very useful to point out where these assumptions are different in code (passing null in one location and assuming it is not null in another).
My only complaint with findbugs is not being able to generate the html report outside the site goal like the pmd plugin.

I'm not sure if it exists, but what would be useful is a tool to point out classic test lines in code. I mean where two adjacent lines of code both define a value for the same field, but one is commented out and the other is not. This is especially true where one of the lines defines a hardcoded value.
But I guess the answer is to have a proper unit test that says "hey, you left this crap line here". And to use version control and review your commits thoroughly.

Tuesday, April 19, 2011

Last PA DnD Podcast

I didn't realize that I was mostly through the last episode of series 4 in the Penny Arcade DnD podcasts, but I finished it and the bonus on the way into work this morning.

Now I am sad to say that I have run out of these podcasts (until more are made). These were fun to listen to and I flew through them. I eagerly await more to devour.

TV Sidenote

Enjoyed the s02e14 episode of Community with its DnD game, especially the evil Pierce. It was a much more free form game than I expected, but fun.

In a related note, haven't finished the latest DnD podcasts yet, but still watching lots of PATV, going through the latest season.

Still enjoying White Collar, now on season 2. But one thing I despise are the green screen clips for Elizabeth. They should have setup the plot to have her away, maybe only on phone calls, but instead there are these aweful looking and obviously staged clips. ugh.

After finally watching an episode of Supernatural after a long break, watching other shows, I really had missed it.

Saw some of the Social network the other day and remembered how much I like the soundtrack (of course since I'm a NIN fan), that I have it, and now I am listening to it again.

Monday, April 11, 2011

VirtualBox

I spent most of the weekend trying to setup a new dev environment.
This machine is already filled up enough and I'd rather not clutter it up more.
So the answer of course is... virtual machine!

But it wasn't a simple or short process.
I had VirtualBox installed previously, Innotek version.
And I found a ready Fedora image, since I've usually worked with Linux under RedHat/Fedora/CentOS.
But I decided to upgrade to a newer VirtualBox version.
I tried the latest Oracle 4.0.4 version but it failed to start.
So then I tried a Sun 1.6.6 version, this installed and started fine.
It did warn about upgrading my previous Innotek settings, apparently the reason the Oracle version failed to start. Only a warning, it then updated the settings and continued on.
But after several attempts at trying to add the guest additions, I found I couldn't use this version.
So I removed the old settings and went back to the Oracle version.
Success. I was also able to add the guest additions (despite the mixed/lack of great documentation).
I found this newer version (unlike the two Sun/Innotek previous) already had mouse integration, so I mainly needed the additions for the video support (larger view).
To add the additions I roughly did the following: yum update, yum install dkms gcc kernel-headers kernel-devel, reboot, mount additions iso, run linux additions.
The kernel-headers and kernel-devel will be for the latest kernel version, hence the reason for the update (especially the kernel to match).
Having the original OS image came in very handy, being easy to start the process over and over and over.

Now I continued on to install the minimal pieces I needed: Java, Maven, SVN.
For Java it was the Sun rpm download and install, for Maven it was just the download and env vars (java_home, m2_home, path in .bashrc), for SVN it was the package installer.
All different paths but all the same end, I could run from the command line.
But for another reason I wanted to use the Java plugin in Firefox, but luckily I was able to find reference to link the Sun libnpjp2.so in jre lib to libjavaplugin.so in mozilla plugins.
In the end the original VM image grew by almost 2G with all these updates and installs.

Friday, April 8, 2011

Words, DND, Dead

I've gotten addicted to Words With Friends recently on iPod
I had a run with some good points, including wandS + joustS (52) - could have played gnawS (73), loving (30), Oracle + gO (48)
Those were in the same game, giving a 150+ lead. Also played hand (42) in another game.
I played best when I planned my next moves right after playing a word, so I had options and their points.

Finished Series 3 of the PA DND podcasts with the fall of Aeofel.
Just started Series 4, switching out Chris Perkins for Jerry as DM and adding Kris Straub. Definitely a different feeling, but a nice change. I do hope to see/hear more DND adventures with the previous characters and Chris.
I've also been catching up on older PATV, including the DND episode.

On the topic of DND, although I'm interested in it, I've never played.
I've mostly grown up playing video games:
Atari with Star Wars, Combat, Dig Dug, Off the Wall, Jungle Hunt, Frogger
Gameboy with Tetris, Super Mario, Metroid,...
Any arcade games like Centipede, Pac Man, Mortal Kombat, Street Fighter, Tekken, especially liked Spy Hunter,...
PC with Wolfenstein, Doom, Diablo, lots of free games on CDs including Descent,...
A friend's Nintendo with Super Mario, Double Dragon,...
A friend's Sega with Sonic
Tons of Super Nintendo with Donkey Kong Country, Ninja Turtles, Super Mario, Shaq Fu, Smart Ball, Super Ghouls & Goblins, F-Zero, Super Punchout,...
Other friend's consoles including Playstation like Tony Hawk and Guitar Hero,...
Wii with Sports and Super Smash Bros
More PC like GTA, Max Payne, Battlefield 2, Combat Arms, Half Life, Counter Strike, Left 4 Dead, Minecraft, Portal,.....
Ok, I'll stop, there are just too many to attempt to list and no way I will remember them all
But the point is, I've been a video game guy
And yes, I've played card and board games but definitely not as much, so DND is completely new for me

Read through the latest Walking Dead comic #83 and wow, it finally hit the fan in a big way. It came out a week early but I didn't get to finding out or reading it till this week.