Friday, November 13, 2009

 

Gah slimtimer!

I can't believe it...slimtimer is down this morning and there aren't any updates, aren't any nothing. What is goin on!?

Thursday, July 03, 2008

 

Retrospective, Part 1

Contrary to appearances, Card in Hand is not dead - it is however slow going. But, things are changing, and have changed so much over the past 3 years that I thought it might make sense to document the life of CardInHand (and its predecessor). From the beginning. And so...

FlashCards 0.93

Back in the Fall of 2004 I decided to take a Spanish class. How exciting. Immediately I realized that I needed some flashcards, and dutifully filled out quite a number. But, I had an old PalmIII and thought that there's gotta be some good study program out there. At first, I couldn't find any mostly because I wasn't looking hard enough and also b/c, hey, I'm a programmer - I like to make things. I threw together a program with SuperWaba, a mobile Java runtime.


FlashCards v0.93

My goal was to have the Palm monitor my progress through the flashcards. Pretty quick I learned that there was an algorithm that did just this. It was called the Leitner method. My program, called 'FlashCards', duplicated this method.

FlashCards v0.93: Edit card data screen.

This first version let you create your own cards on the Palm, and it would selectively quiz you on the flash cards based on how you had done before.

FlashCards v0.93: list of decks of cards on the Palm.

On the whole, the program did exactly what I needed it to. Unfortunately, it was pretty hard to see exactly what it was it was doing. How was it selecting the cards you saw? How was I doing? My next version of the program set to address these problems.

Friday, February 02, 2007

 

serialization and SOAP and...

I am struggling to figure out the best way to procede with regard to the card in hand webapp. My data classes have a custom serialization for the superwaba library that I was using in the first two versions of the application. It all looked okay to simply extend that, and use it for j2me. I made a j2me implementation and it works find for serializing all the data.

But the problem I'm having is that now I want to extend or project these data classes into the rails world - or something like that. At first I thought I needed something of a separation of logic from the data. That is have plain empty bean classes and a parallel class for all logic. I could then use the beans easily within a webapp framework (I'm using xfire at the moment). But then I came accross this wonderful anti-pattern description.

I completely see this anti-pattern being what I was about to do: separate all the logic out of its associated logic. Wrong. However, since I'm resolved to implement a webapp to expose both data and specifically logic to the world I do have to consider how I keep the application layer thin - keep logic out of the webapp layer, when I'm accessing logic only available in my data classes on the Java webapp.

Right right. It doesn't make sense to have useless structural code. We all like the idea of MVC, but it is senseless to brainlessly recreate data only classes and not associate it with the appropriate logic. Not that any non-Java SOAP client would be able to use this logic...

At the moment I'm madly converting all of my data classes into Beans, so that I can send them over the wire. But I'm beginning to doubt that this is the best method to attain my end. Its either that or, recreate a custom parser on each end for my flavor of binary. That doesn't sound fun.


Tuesday, June 27, 2006

 

J2ME and Maven2 solved!

After much much too much head scratching I have discovered 'the way' to develop with maven in general. Maybe I'll write up a little more in depth description of 'the way' later, but for now a summary:

  1. Maven needs a scripting language. Enter groovy. Groovy rocks. If you wanna migrate some ant scripts or take advantage of ant taskdefs for some specific library, then groovy is the way to do it. Although maven2 has an Ant plugin to run arbitrary ant code, it is in essence useless for all but the simplest tasks (Unfortunately I discovered that the groovy-maven-plugin is slightly broken. You can't use the AntBuilder out of the box. Worry not, there is a workaround. See http://jira.codehaus.org/browse/MOJO-429 for more information).
  2. When standard libraries don't have maven plugins don't despair. You can:
    1. write your own. It's really easy. I advice writing it in Java, not Ant. Do this if you want glory or expect to use it more than once.
    2. just interface with the ant taskdef, or straight to the library yourself using groovy. Do this if it's a one off.
  3. Probably the biggest problem when starting with maven is that a library you need isn't in the public repository. Use Maven - Guide to installing 3rd party JARs


Back to getting that J2MEPolish example running. Again, I was missing a dependency:

mvn install:install-file -Dfile=blackberry-4.0.jar -DgroupId=j2mepolish -DartifactId=blackberry -Dversion=4.0 -Dpackaging=jar


I fixed my groovy-maven-plugin by adding the Ant dependency to the groovy-maven-plugin pom.xml. I could then use the AntBuilder. I have to say I was skeptical at first, but once I got started, wow!

Rather than writing a maven plugin for proguard (yes there should be one, no I'm not writing it to get an example application running), it was simply a matter of using the Ant taskdef from within groovy. Here is my groovy script:

import groovy.util

def libraryjars = ""
def ant = new AntBuilder()

for (dep in project.artifacts) {
if (dep.artifactId =~ /enough-client/) j2medep = dep
else if (dep.artifactId =~ /proguard/) {
proguard = dep
ant.taskdef(name:"proguard",classname:"proguard.ant.ProGuardTask",classpath:dep.file)
}
else {
libraryjars += "\n-libraryjar ${dep.file}"
}
}

def configuration = "-injars target/classes"+
"\n-injars ${j2medep.file}"+
"\n-outjars target/proguard.jar"+
"\n${libraryjars}"+
"\n-overloadaggressively"+
"\n-ignorewarnings"+
"\n-defaultpackage ''"+
"\n-allowaccessmodification"+
"\n-dontobfuscate"+
"\n-keep public class com.grimo.me.product.midpsysinfo.MIDPSysInfoMIDlet"

println "executing proguard for:\n ${configuration}"

ant.proguard(configuration)
ant.move(file:"target/classes",tofile:"target/oldclasses")
ant.unzip(src:"target/proguard.jar",dest:"target/classes")

This weaved together underlying dependencies, preverified, and made the jad. I then used the mpowerplayer to run the app. It had a little issue with localization, but apart from that the app really ran. Wow, that took a week of odd hours.

Blogged with Flock


Wednesday, June 21, 2006

 

Proguard investigations.

Rather than integrating proguard directly in maven2, I decided to follow the directions over at the proguard site to integrate it into the WTK.

Hmm, but that didn't do anything. I think maybe that only works if you use something in the wtk folder to build the project. Darn.

There is a plugin for proguard out there. I guess I'll have to look it up. Didn't find one, I've submitted a question to the proguard mailing list to see what I can find out. I think I'm gonna have to write my own.

 

Skip J2MEPolish - lets just fiddle with J2ME

Making some progress here. After I got the java files to compile, the next step is to have the WTK preverify my compiled classes. Someone, Frank Seidinger bless his soul, has created a maven plugin for j2me. It'll do the preverify and the jad creation. It's currently in the codehaus sandbox, so you have to surf through the subversion repository, check it out, and compile it yourself if you want to use it.

I found out I was still missing something - the j2me java.lang.Object! Oops:

mvn install:install-file -Dfile=/WTK2.2/lib/cldcapi10.jar -DgroupId=javax.microedition -DartifactId=cldc -Dversion=1.0 -Dpackaging=jar
mvn install:install-file -Dfile=/Users/danesummers/Documents/WTK2.2/lib/cldcapi11.jar -DgroupId=javax.microedition -DartifactId=cldc -Dversion=1.1 -Dpackaging=jar

It preverifies with cldc 1.0.

I can even get it to generate the jar files...but there is a slight problem. Since this is a j2mepolish example, well, there are some j2mepolish requirements...and those aren't in my jar file. How do I make them go in?

 

Twiddling with J2MEPolish

The samples don't work out of the box for J2MePolish, because wtk2.2 isn't for osx (linux). I copied the preverify app from mpowerplayer over wtk2.2's - now the samples compile! I can use the mpowerplayer application to run the j2me sample application. Sweet.

Now...maven? I copied over one of the sample application from J2MEPolish into a stock maven2 project.

I got some of the sources to compile by adding in the WTK libraries one at a time. So far I've only added a few jars for WTK:

mvn install:install-file -Dfile=~/WTK2.2/lib/midpapi10.jar -DgroupId=javax.microedition -DartifactId=midp -Dversion=1.0 -Dpackaging=jar
mvn install:install-file -Dfile=~/WTK2.2/lib/midpapi20.jar -DgroupId=javax.microedition -DartifactId=midp -Dversion=2.0 -Dpackaging=jar
mvn install:install-file -Dfile=/Users/danesummers/Documents/WTK2.2/lib/mmapi.jar -DgroupId=javax.microedition -DartifactId=mmapi -Dversion=1.0 -Dpackaging=jar

And a few more jars for J2MEPolish:

mvn install:install-file -Dfile=/Users/danesummers/Documents/J2MEPolish/import/enough-j2mepolish-client.jar -DgroupId=j2mepolish -DartifactId=enough-client -Dversion=1.0 -Dpackaging=jar
mvn install:install-file -Dfile=/Users/danesummers/Documents/J2MEPolish/import/nokia-ui.jar -DgroupId=nokia -DartifactId=ui -Dversion=1.0 -Dpackaging=jar

And here are the dependencies:



<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.microedition</groupId>
<artifactId>midp</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>nokia</groupId>
<artifactId>ui</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>javax.microedition</groupId>
<artifactId>mmapi</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>j2mepolish</groupId>
<artifactId>enough-client</artifactId>
<version>1.0</version>
</dependency>
</dependencies>


Hey it actually compiles in maven. Thats a start I guess.

Wednesday, June 14, 2006

 

Starting j2me port.

I remember that last year a friend of mine tried to start doing j2me work on OSX, and he had a lot of trouble. Sun doesn't provide an OSX package of the WTK, or any emulator. You gotta cobble together the thing yourself. So far I've gotten thus far:

1. Using the linux installer for WTK2.2 install the WTK.
2. Install j2mepolish
3. install mpowerplayer

Remaining items to scratch my head on:

1. Do I need to use J2MEUnit?
2. How am I going to integrate the wtk and building into my maven2 project?

Thursday, June 08, 2006

 

Site Temporarily Back Up

The website is still down, but in the meantime, I've setup the installer so that people can at least install their desktop tool.

Hopefully I'll get those repository dumps by the weekend so I can put up the real site and start making a few sales!

Well, we'll see.

This page is powered by Blogger. Isn't yours?