Sunday, February 27, 2011

Econut: TV Reference of the Day

Today I was Marshall from How I Met Your Mother s06e17 Garbage Island.
But instead of searching through a dumpster for O-rings, I was looking for cardboard.

I was making a run dropping off trash and recycles. When I went to put the trash bag in the dumpster but I couldn't.
The dumpster was filled with boxes that hadn't been broken down.
I instead walked to the next dumpster and threw my trash in.
Now at this point I could have walked away, but of course I didn't.
I reached in the first dumpster and started hauling out the boxes. These were large Home Depot moving boxes.
I took out as many as I could without climbing in, broke them down, and filled the car. I was planning to drop off recycles next anyway.
I ended up with 7 of these large boxes to add to my 4-5 bags worth of other recycles.

I also saw that one of the Silk soymilk containers had a green cap. I entered the UPC code on my phone so I could submit it online (for things like wind power). Sadly I see the green caps website isn't available at the moment (apparently ended last year).

Saturday, February 26, 2011

Comic Ts

I hardly ever buy new clothes, so I guess it's worth noting when I do.
Especially when I pickup some fun DC comic t-shirts.
Including the Superman shield and the zombie Black Lantern Batman from Blackest Night

J2ME Phone Number as Integer

In my current project, we used a mobile application based on Openxdata/Epihandy (forked earlier), which is an xForms J2ME app.

One of the problems encountered was entering phone numbers in a form field.
The closest type supported was a numeric type, using the MIDP Textfield NUMERIC contraint.
As the doc states, this value should be parseable by CLDC Integer,parseInt()
The Nokia series 40 phones we were using, Nokia 1680s, presented various issues during the project including editing a numeric Textfield used for a phone number.
The original phone number value entered could be larger than (or equal to) the max Integer value (2147483647), but the value would be lost when trying to edit the field.
On editing, the value would fail to parse as an Integer, throwing a NumberFormatException, and default to an empty Textfield.
As a workaround, we added validation to only allow values less than the max integer value.

This solution worked fine for our testing using Maine area code 207 phone numbers, and in production entering local phone numbers (9 digits) on the phone with the country code added on the server.
But this approach fails for almost all other US area codes (most greater than 214-748-3647) including the one I needed to support for a demo.

The MIDP Textfield supports a phone number constraint, which I added in our mobile app as a fix/feature. I reviewed the existing code and found there were just a few case codings needed. For the xForm, the type is actually string, but includes a format attribute with the value phonenumber, similar to how other added types are handled.

This has been a lingering limitation and I'm happy to see it being resolved. We've used phone number fields on almost all forms, especially since we've sent text messages to numbers entered. Obviously the numeric Textfield was insufficient for phone numbers.
Now the server side just needs to account for the possible + prefix instead of numeric only validation. To provide a consistent US phone number format, I used the regular expression \\+?1?([0-9]{10}) and selected the matching group.

Saturday, February 19, 2011

Superman! Reading, Comics, Shows

Mixed on latest reading from the library.
Breakpoint by Richard Clark was okay. I especially liked the first half or so where the US internet infrastructure is attacked and largely cutoff from the rest of the world. That felt believable, but I'm less inclined to believe the genetic/biologic advancements which dominated the second half.
The Fahrenheit 451 graphic novel was also just okay.
The All Star Superman #1 graphic novel was okay, I especially liked the older version of Lex.

So on the same topic of Superman, I've seen videos of DC Universe Online and it sounds fun to create your own hero/villain, although I don't play subscription games.

So also on the topic of Superman, apparently Lex will be returning for the finale of Smallville!
Also In TV shows, I've been catching up on Fringe on Hulu and still enjoying it.
I hope the new Battlestar is good and makes up for Caprica (still haven't finished, lost interest).

I still haven't read Walking Dead #81 yet, but I glanced at the letter hacks and was surprised.
The earlier mentioned letter hack I wrote in was actually printed!

Software Job Interview

Looking at jobs and trying out using the PDF export from LinkedIn as my resume. Not ideal since it doesn't include all the information from the profile and not easy for format. I tried the LinkedIn Resume builder, but it lost the formatting (newlines) from profile text. I could try using the APIs myself at some point.

For one application, I was asked to send in code samples. I emailed in 6 classes including servlets, a controller, a check digit validator, and unit tests from my last two projects. A mixed group that I wasn't really happy with, some well written, some documented, but atleast all self contained. Not much choice, I had to send them in almost immediately, so no time to write up a new project.

I went in for an interview today and it reminded me of an interview from years ago where I was asked to draw class diagrams on the whiteboard and explain how to reverse characters in a string.

Today's interview included these type of tests that now seem cliche to me:
  • Explaining what example code did, utilities involving generics to convert between types
  • Write code on whiteboard using example code, implement conversion using generics from int to string and change to any object to string
  • Explain what test cases to write for example code, a stack interface
  • Explain possible problems for example code, concurrency issue with access while populating a static hashmap solved by synchronizing the method
  • Answer a brain teaser, determine the fewest balance weighings to find the heaviest ball of 8, explain thought process, answer of 3 easy but best is 2

I didn't ask a lot of great questions, mostly since its an interview, which is not conducive to thinking since I am not relaxed.
But I did ask how they build their code and I was somewhat shocked to hear it is coded in Java. They apparently had looked at Maven earlier but like/go with it. Now I am a Maven evangelist. My thought was that Maven is Java, and I'm sure it would be easy to write Maven plugins (or use existing) to handle the special build code. And I'm sure Maven would handle the versioning and project metadata better.

And of course the classic "where do you see yourself in 5 years?" question. My joke recursive answer is "asking someone the same question, 'where do you see yourself in 5 years?' who will answer ..." on and on.

And in the end I paid $7 for the garage parking.

Maven Intro, Google Voice

I finally found/made time for my todo list and worked on the Maven branch for the Google Voice API project on GoogleCode
This is just the first step, adding the pom to be able to build the project using Maven
Really having any way to build the project outside the IDE is huge
But it's not worth progressing any farther without buy-in from the owners/developers.

I've started a Maven wiki page as an introduction to using Maven and explaining the current state of the branch.

Friday, February 11, 2011

Story of an Infected Computer: Part 3

and the saga continues...

Today the machine was infected with Spyware Protection (defender.exe)
It pretends to be an antispyware program, warning of threats and infections
It was very annoying (closing applications, preventing task manager from staying open, etc)
But thankfully easy to remove (renamed exe, reboot, and remove)
SuperAntiSpyware did detect and remove the registry key for it
I might try Microsoft Security Essentials if I ever clean and reinstall Windows

Saturday, February 5, 2011

Story of a Revived Computer: Part 2

And so it is continued finally...

Put in the order at Newegg for a new power supply for the dead machine
Also included new fans for the front of the case since the old ones were caked in dust, had burnt out LEDs, and were from the original build years ago

Picked up the box from UPS on Friday and put them in today
I also cleaned out dust after removing the old power supply and fans, and also organized the cables.
And now it is back up and running.
So apparently the problem was related to the power supply (thankfully).

Here's the current mix of parts:

With the new power supply, the hard drive is my remaining worry because of its age

Friday, February 4, 2011

Google Voice, Android, JSON

I ended up looking at a Google Code Project providing an API for Google Voice recently when I was asked to add it to a Maven repository.
I wrote up some suggestions to improve the project:
  1. Add a build (Ant or Maven, etc), only Eclipse project files at the moment
  2. Add tags, where is the 1.6 release source files?
  3. Replace the json library using an unconventional package name ( instead of org.json)
  4. Add unit tests (such as testing the SMSParser), there is only a functional test
I reviewed the libraries used in the project (dom4j, jaxen, jtidy, json), found versions available in Maven central to use, and offered to help create a Maven pom and get the project into Maven central.
After emailing these thoughts to the project owner, I was surprised to hear I would be added as a committer on the project.

Even more surprising was my research into the json library, which is a copy of the library with a different package.
Apparently the package name was changed to avoid conflicting with the Android json library which uses the same package and class names, but different sources. The Android version is missing constructors and methods in some of the classes, but also has more methods in others (JSONTokener and especially JSONStringer).

But the shocking part is that the latest Android artifacts in Maven central (after 2.1_r1) depend on a version of the library (org.json:json:20080701), which is just wrong. These are not the right classes to compile against for Android. And frustrated Android developers consider the library "broken". It would make more sense to use an android-json library, but I don't see it happening at the moment.
Instead of using the Maven central artifacts, anyone developing in Maven and using the Android json library apparently needs to use the SDK deployer (only way to get the original Android jar into a Maven repo). Or use a different json library (or a different class package, as done in this case).

Thursday, February 3, 2011

Hulu and Daily Show

So maybe my opinion of Hulu is changing again
I've had my issues in the past with streaming problems and recently shows changing to be plus only
But I've caught up with Fringe on Hulu without any of these issues
And tonight I noticed the Daily Show suddenly appeared back in my queue
After the Daily Show had left Hulu almost a year ago, I largely stopped watching
I'm glad to see it back and available on Hulu, I find it more convenient and better quality (hopefully) than the comedy central site

Wednesday, February 2, 2011

Last Night on Earth Rules

I was gifted the Last Night on Earth zombie board game for x-mas, and a group of us played it on New Years.

While trying to understand the rules, I decided to condense the rule book into a one page flow diagram. This was fun and also ended up helping me run the game as the ZM. Sadly we only played 1 basic game, so there is still a lot left to try (more scenarios, characters, items, weapons, etc)

Finally after a month, I was able to find time to improve the diagram, adding in missing information from the character sheets and rules. I also bolded the basic steps, to help in following the basic scenario and avoid those related to the advanced scenarios.

So here is version 2: Download Visio PDF