Thursday, November 28, 2013

Lisp, A Brave New World

Well, at least for me, Lisp is a "Brave new world"


I finally got the urge to learn Lisp after reading Paul Grahams "The Blub Paradox".
I'm surprised to say, "Nothing beats the feeling of accomplishing Hello World".
The last time I felt this was with C (using turbo c). Not sure with Java's hello world though XD.


Achieving this is just 2 steps:
1. Download 'Lisp in a box' from http://common-lisp.net/project/lispbox/ and unzip.
2. Run the launcher and type "Hello World".

Friday, November 8, 2013

A long shot, JTyrian



 It has been years since I have done game programming. Back then it was J2ME or with Swing using a lot of JPanel. I did attempt to learn Java 3D or those popular game programming libraries like JMonkeyEngine, but nah, all I came up was HelloWorld.

But the wheel of time has turned & now there's LibGDX. It's great, IMO, documentation for beginners is not so great. Luckily I found this blog that has a series of tutorials.

So far so good, I've made the program work up to post #3. The source code is @ revision 6 & is open source here.

Thursday, November 7, 2013

Another primitive File I/O gotcha!

A part of the feature I'm writing is to load multiple regex from a file. The file is simple, each line represents a regular expression.

\b(cat|kitten)\b
\b(dog|curr)\b
\b(buffalo|tamaraw)\b

Now I needed to test my method that uses these regex:

public class Animals {
private List regexes;
public Animals(List regexes) {
this.regexes = regexes;
}
public String detectAnimal(String input) {
// for each regex, create a java.util.Pattern and at the first match, return Matcher.group()
}
}

The test data for animals is around 1 million that is stored in DB. For me to be able to test this is to use Groovy's DataSet to loop through the test data. For each iteration, run the detectAnimal method and save to DB. Easy enough.

Now here's the big Gotcha. Below is the Groovy code I used to build my List of regexes. Note that I used this code only for testing purposes.

File file = new File(Animals.class.getResource(Animals.DEFAULT_CONFIG_FILE).getFile()) Animals animal = new Animal(Arrays.asList(file.getText().split('\n')))

A character '\r' was not removed from the resulting list of regex which looks like this:
\b(cat|kitten)\b\r
\b(dog|curr)\b\r
\b(buffalo|tamaraw)\b
This essentially breaks all the regexes except the last one: \b(buffalo|tamaraw)\b Debugging this (I used Eclipse) was tricky since '\r' or carriage return is non-printable character.

To make this much more complicated, in the Java code, I have already written the code that loads the config file which uses Apache Commons IO FileUtils. This code was located in a Project wite Utils class which uses a java static block to load config files. Which, honestly, I don't like. Since using static blocks is a bad practice.

Honestly, this might have clouded my judgement of not using this Utils class. Also since Groovy is a shiny new language, so I was excited in using the new & improved File class. But apparently, Groovy's File class does not have readLines as opposed to FileUtils from Apache Commons.

TODO, make this post more readable

Tuesday, October 30, 2012

Pokémon Exception Handling

from http://www.codinghorror.com/blog/2012/07/new-programming-jargon.html

Pokémon Exception Handling

Pokemon
For when you just Gotta Catch 'Em All.
try {
}
catch (Exception ex) {
   // Gotcha!
} 

Friday, March 25, 2011

Rivals Schools' NEW ALBUM is here! got worn-out in coding, I'll enjoy music for now :)

Rival Schools, a New York based Post-hardcore band, one of my favorite underrated music. For me, Walter Schreifels (vocals & guitar) is a gifted music genius who writes good lines & riffs.

If you are a fan of underrated music, or looking for one, this is definite constant, no exception.

They're new album titled "Pedals" is a long-awaited album for fans, after the former "United By Fate", Walter has been busy with his solo album and side projects.

Track listing

  1. "Wring It Out" – 3:28
  2. "69 Guns" – 3:22
  3. "Eyes Wide Open" – 3:00
  4. "Choose Your Adventure" – 3:25
  5. "Racing to Red Lights" – 4:03
  6. "Shot After Shot" – 3:14
  7. "A Parts for B Actors" – 3:38
  8. "Big Waves" – 2:59
  9. "Small Doses" – 3:59
  10. "The Ghost Is Out There" – 3:20

Personally I like '69 Guns', (great live performance below).
live@ spinner's The Interface, austin, tx


see the lyrics here

You can also listen to purevolume for the Album's single & an exclusive live.

sources: wikipedia.org, wikia.com, spinner.com

Thursday, March 24, 2011

A Junior Java Software Developer Diary # 2

Funny day long of coding. While we (me, justin & gladys) our team does our very own daily conference (chat) methodology :), I got caught typing a jejemon style word. "paupdatezzzz", was just me telling that I'm already tired.


I am neutral with all the kill em' all jejemon buzz, but it got interesting and funny. 

There are already a lot of jejemon stuff including a wikipedia article and a cool http://www.jejeschool.com :) And as for my idea, jejemon programming language!

I already made a sample for the language construct :D Happy coding!

Monday, March 21, 2011

A Junior Java Software Developer Diary

A Junior Java Software Developer Diary

Since around a month ago I've been learning a ton of information from a Godlike Java Architech ;)
So before I forget some of these priceless lessons & experience, I'll  be making a series of log about it :0.

Everything from real-world requirements gathering, proposing a design, architecture design, tools to everyday coding.

I'm really feeling lucky ;)