Wednesday, December 15, 2010

Interesting xml parsing technique using jaxb and StAX

Use and analysis of Jax-B (xml to java binding) and StAX, which is a pull based xml parser. This combination makes ease of parsing (jax-b) and memory management (StAX).

However, because there are two different libraries in use, I would argue that complexity is now a wash.

http://www.javarants.com/2006/04/30/simple-and-efficient-xml-parsing-using-jaxb-2-0/

Tuesday, September 28, 2010

Wednesday, September 8, 2010

Routers

Just found out about tomato firmware for wireless routers. Seems that linksys makes a router specifically to be flashed by third parties. WRT54GL seems to be quite a winner. Tomato will allow wireless bridging and client mode

cable modem <--wired--> wireless router <--wireless--> wireless router <--wired--> Device

Wednesday, August 18, 2010

Cygwin fun

Two fun things I've learned about cygwin today... The first is about emacs!

I forget the exact reason, but "c-x c-c" won't quit unless you add "set CYGWIN=binmode tty ntsec " to your Cygwin.bat in the cygwin directory.

Secondly files that are created in windows need to be stripped of their line ends. You can do this by running d2u on the file you are trying to use in cygwin.

Sunday, August 1, 2010

Args4j vs jcommander

http://java.dzone.com/articles/life-too-short-parse-command?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+javalobby%2Ffrontpage+%28Javalobby+%2F+Java+Zone%29&utm_content=Google+Reader

Found this article on google reader and am just posting here to ponder the difference in args4j amd jcommander

Thursday, July 29, 2010

Prime number

http://www.dzone.com/links/rss/a_regular_expression_to_check_for_prime_numbers.html

Just in case that link ever fails in the future, a regular expression to check for PRIME numbers? This breaks my mind too much.

Regular expressions are extremely powerful: /^1?$|^(11+?)\1+$/ checks if a number is prime or not.

Monday, July 26, 2010

Cribbage calculator

While playing cribbage with my girlfriend (who always kicks my behind in it) I decided I needed a little help doing the calculations to compute the score in your hand at the end of a round. I looked into the app store and there is no "cribbage calculator". Maybe I didn't look hard enough, but either way this has inspired me to try and do my first android application.

http://download.oracle.com/docs/cd/E17476_01/javase/1.5.0/docs/guide/language/enums.html

Thats probably a good place to start to construct a deck.

My next goal after that is to have the ai do a search based on your hand to see how many points you should have (but that will come later).

Assuming i can prototype the calculator, I'll then port that to an android app with graphics and such at some point in the future.

Tuesday, July 6, 2010

Custom Components

In the book Android 2- Application Develpment there is a section in chapter 4 that describes how to create compound components. He shows the basics of creating one, but doesn't actually show you how to use it. Unfortunately his example code only shows him overwriting one of the two constructors.

Constructor(Context context){
super(Context context);
}

Constructor(Context context, AttributeSet attrs){
super(Context context, AttributeSet attrs);
}

It is important that you overwrite both in my opinion, but especially the second. If you don't, your application won't be able to set the layout from your xml file attributes. Goes to show how important it is to correctly overwrite the constructors.

Random droid error

While following my guide/tutorial reading I ran across the strangest error with the Droid SDK and eclipse. In case any of you also have a "compiling" error in eclipse that won't let you start up the droid emulator due to a "Unparsed aapt error(s)! Check the console for output" but you dont have any real coding errors you might want to consider just deleting that error message and re-running the application to compile.

It worked for me without any code/bug fixing. This took me a good hour before I figured googling the issue might be a good idea. So hopefully I'll save some of you an hour too.

Thursday, June 24, 2010

Droid development

I'm beginning some Droid development! This is pretty exciting as this may be very useful on my resume in the future.

Here is a little write up for how to set up a droid environment

Visit this site to get instructions on installing the droid SDK

http://developer.android.com/sdk/index.html

Key environment setup for eclipse development
You must have at least JDK 5 (JRE is not enough)
At least Eclipse version 3.4
Eclipse JDT plugin (included in most Eclipse IDE packages)
In Eclipse you may need to point to the correct system library to the installed JDK



Installing android development for eclipse
Download the Android SDK for your specific platform
Android Development Tools plugin
Add an Android platform/Component to your Android SDK environment

Goals

Hello

This blog is meant to be used to catalog and share anything interesting that I might be learning with Java. Although this is primarly a java development blog, I will also throw in bits of technologies other than java as well to try and be a well rounded programmer.

Time to blog!