Tuesday, November 30, 2010

Hacking the Wireless Toolkit for Mac

Today I spend a whole day trying to fix an J2ME build issue: the build script works on windows, but failed on Mac. My working environment is:
WTK
   - Windows PC: WTK 2.5.2
   -  Mac:     WTK 2.5.2 Linux version, copied preverify from JavaME SDK 3.0 Mac
Build tool is Antenna
   - Windows: antenna 1.1.0
   - Mac:  antenna 1.2.1 ( the earlier versions have preverify issue on Mac )

Actually we usually build J2ME application on windows or Linux box, this is the first time to build on Mac. I checked the build log, the log shows the preverify error.
Since I used Sun's latest version of preverify file for Mac, I never suspect it might have issue. I thought issue might due to Mac is picky with the Antenna build script, so I spent lots of time trying to tweaking the build script, but no luck. So I started to thinking the problem might be the preverify file I used for Mac.

Finally I have to google and I was so lucky that I found Sam's blog post: J2ME Development on OS X, revisited. This is a fantastic article, the most important for me is he tells me how to get the Mac version of preverify:  Download the phoneME project source code, and the preverify for mac is under phoneme_feature/cldc/build/share/bin/darwin_powerpc/, as the author suggested, I downloaded the PhoneME feature M2 source code, and I did found the preverify, and after I copied the preverify in my  WTK /bin folder of my mac machine, then when I run the build script, it works, awesome. I really admire this guy, how could he find out this tool!

Now let me describe how to install WTK 2.5.2 on Mac in step by step, please note this only works if you still use WTK 2.5.x, and it is only useful for building the application, the emulator and other tools are not working, you can use JavaME SDK 3.0 for Mac, but based on my today's experience, its preverify still has issues:

Download and Install the WTK 2.5.2

  • Goto here to download the Sun's WTK 2.5.2 for Linux, file is called sun_java_wireless_toolkit-2_5_2-linux.bin
  • Execute the downloaded file (sh sun_java_wireless_toolkit-2_5_2-linux.bin)
  • When asked for a path to JDK, enter “/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/bin/”
  • Follow the instructions, probably best to install into /Applications/WTK2.5.2

Get the preverify binary

  • Download the PhoneME project feature source code,  choose the M2 source bundle
  • Extract phoneME build, it creates a directory called “phoneme_feature”
  • Copy /phoneme_feature/cldc/build/share/bin/darwin_powerpc/preverify and overwrite the preverify binary in your WTK bin folder.
  • You might need to change the permission to w+x of preverify.
You might need to install Rosetta before running preverify
Today one of my colleague found this issue on this macbook, when I give him a copy of preverify binary file,  when he run it on his machine, it prompt need to install Rosetta to run it.  it said the Rosetta comes with the MacOS installation CD, so if you have the similar issue, then install it first.

Other tools:
Antenna:  please use the latest version for Mac (1.2.1).
Gant:  the groovy based DSL for build script, it built-in support all the ant tasks, but you don't need to write XML any more, I just started using it, and I love it.

Wednesday, November 17, 2010

Review of BlackBerry Eclipse Plugin for Mac OS X

Today I have a chance to look at BlackBerry's Eclipse Plugin for Mac OS X.  Since it is only a preview version, I did not expect too much. After install and play a while, my excitement vs. disappointment is half and half.

The software contains the full Eclipse 3.5 and it's Eclipse Plugin, like the windows version of earlier this year. It requires to install the BlackBerry Desktop manager for Mac.

What I don't like:

  •  Does not support simulator yet.  From the IDE menu, I could not find the where I can launch the BlackBerry simulator,  then when I read the manual document, I realize this feature is not supported, it only support running/debug on the actual device via USB cable.  
  • On-device debugging is kind of working. It takes a long time to connect the device, it can stop at the break point, but  the variable value is wrong, always 0 or null.
  • Support BlackBerry OS 6 only.
  • Signing is more restricted, in windows version you can hack the signing tool by putting the file  sigtool.csk and sigtool.db in the \bin folder of blackberry SDK component folder.  It does not working on Mac version now.
Now I understand why it is called a preview version.

What I like most is the blackberry tool "javaloader" is  now supported in Mac, I tested it works on Mac, you can install/remove an application using  javaloader via USB cable. Really nice!   

The javaloader file is under the folder like:
BBEclipse/plugins/net.rim.ejde.componentpack6.0.0_6.0.0.29/components/bin
If you are familiar with the Blackberry Windows version of Eclipse Plugin, you will find they have the same folder structure. Just remember you have to manually change the permission to make sure it is executable.  You can also find the preverify tool in the same folder, and fledge tool in the simulator folder, which is supposed to launch the simulator, unfortunately it does not working right now.

Another interesting thing is I wonder how it build the application in the IDE.  From the console window I got following output:

Compiling CLDC Application:
java -jar /Users/steve/Desktop/BBEclipse/plugins/net.rim.ejde.componentpack6.0.0_6.0.0.29/components/bin/rapc.jar -convertpng -quiet codename=deliverables/Standard/6.0.0/HelloWorldDemo deliverables/Standard/6.0.0/HelloWorldDemo.rapc -exepath=/Users/steve/Desktop/BBEclipse/plugins/net.rim.ejde.componentpack6.0.0_6.0.0.29/components/bin/ -sourceroot=/Users/steve/dev/workspace/HelloWorldDemo/src:/Users/steve/dev/workspace/HelloWorldDemo/res -import=/Users/steve/Desktop/BBEclipse/plugins/net.rim.ejde.componentpack6.0.0_6.0.0.29/components/lib/net_rim_api.jar /Users/steve/dev/workspace/HelloWorldDemo/bin

Compiling MIDlet application:
java -jar /Users/steve/Desktop/BBEclipse/plugins/net.rim.ejde.componentpack6.0.0_6.0.0.29/components/bin/rapc.jar -convertpng -quiet codename=deliverables/Standard/6.0.0/MIDletDemo -midlet deliverables/Standard/6.0.0/MIDletDemo.rapc -exepath=/Users/steve/Desktop/BBEclipse/plugins/net.rim.ejde.componentpack6.0.0_6.0.0.29/components/bin/ -sourceroot=/Users/steve/dev/workspace/MIDletDemo/src:/Users/steve/dev/workspace/MIDletDemo/res -import=/Users/steve/Desktop/BBEclipse/plugins/net.rim.ejde.componentpack6.0.0_6.0.0.29/components/lib/net_rim_api.jar /Users/steve/dev/workspace/MIDletDemo/bin

Now we understand that in Mac,  it uses java to launch rap compiler, and it has some option I never seen before: like  -convertpng, -exepath, etc.  I wonder RIM might upgrade it new version of RAPC compiler.



Sunday, November 14, 2010

More about "Drive"

I just by accident read Martin Fowler's article: Can Not Measure Productivity.  The author concluded that you can not measure developer's productivity, because the output is not measurable. Even if you try to measure the performance by using the wrong metrics, things even become worse. In the article, he recommend a book called Measuring and Managing Performance in Organizations, written by Robert Austin. but it seems it is not published any more, I just found a slide of the book., and a brief introduction of the book. 

Quotes from the book introduction:
Because people often react with unanticipated sophistication when they are being measured,measurement-based management systems can become dysfunctional,interfering with achievement of intended results. Fortunately, as the author shows, measurement dysfunction follows a pattern that can be identified and avoided.
 Here I got some quotes from the slide:

        "A system of incentives is dysfunctional if the resulting effort allocation provides less value to the customer than when there is no supervision.” (Austin)

Measurement versus Delegation
• Full Supervision: incentives via measurement
  – Relies on extrinsic motivators
    • Money
    • Continued employment
    • “Forcing Contract”
• No Supervision: incentives via “delegation”
  – Relies on intrinsic motivators
    • Pride of workmanship, joy in being part of the team
    • Identification with the company’s values and goals
    • Desire to please the customer

Intrinsic versus Extrinsic Motivators
Intrinsic motivators are much more powerful
• But appear to be overridden by extrinsic motivators
• Japanese versus American management styles
  – Japanese rely heavily on delegation
  – But it is cheaper for them
  – It is both a strength and a weakness
• Delegation may not be cost effective either
• Sometimes neither style works
  – “Large software development firm”

Summary
• You may think you have full supervision
• But you are almost certainly wrong
• The ship’s wheel is not directly connected to the rudder

• Austin versus Deming
  – W. Edwards Deming, Out of the Crisis, MIT Press, 2000
  – Former BTL lead Japanese quality movement in 1980s
  – Methodology summarized in his “Fourteen Points”

So based on the text above, we can conclude that the book of "Measuring and Managing Performance in Organizations" share the same concept with the book of "Drive", use different perspective, it proves that people's performance and productivity is unmeasurable, the manager should not rely on external performance incentive, but should rely on people's intrinsic motive. It also proved that this idea share with Deming's 14 point. Interesting.

Another useful link: 
 http://www.slideshare.net/RobMyers64/metrics-in-an-agile-world

Saturday, November 13, 2010

Manage Change by Managing Unchanged

As a software developer, we have to deal with different changes:
 -  The changing requirements, which means change code, bug fix, revers engineering...
 -  The changing technologies, you have to deal with new buzz, new API, new languages...

How can we deal with these changing? because chasing change is really hard, because:
  • New stuff in software industry are too much, they are out of control, every year there are so many buzz, languages and SDKs waiting for you;
  • Some new stuffs are quite easy to obsolete, some time even when you try to start learning it, it is just gone.
  • Understand too many details in short time is really stressful
  • They are quite context specific, they will be useless in different area.
Since human's time and energy is limited, how can we manage these changes properly? Why not focus on unchanged stuff instead of changing stuff? What I mean the unchanged is something behind the detailed technologies. For example, like principles, rules, patterns, philosophy etc. They are more general which means last longer, they are also the high level abstract knowledge which easier to transfer another area, so based on these 2 characteristics, they are manageable.

Another interesting characteristic about unchanged is they are meta level of details. For example, measure an object's change of position, then we use velocity, which is can be thought of meta position: the change of position; if we want to measure the change of velocity, then we use accelerator. This example means the higher meta level, the less likely to change and easier to manage.  Another example is in software developing, in object oriented developing, the object's meta level is class, the class's meta level is meta class, we manage the class to make the code more reusable, we manage the meta class to make the code more dynamic and more adaptable.

So how does the concept of "Manage change by manage unchanged" help in the software development?
  •  We should focus more on classics, like algorithm, data structure, fundamental computer theory, OO design patterns, OO SOLID principles, etc. because they are fundamental and general, they are powerful, they are going to still valid for a long time;
  • When you learn a new technology, or a new SDK or even a new language, don't try to remember every details, which will overkill you, but you should focus more on the principles, rules or philosophy, since detailed technologies are easy to forget, but when you understand the principles behind the details, it is much easier to memorize, and much easier to transfer to another area;
  • It help you to identify which technology is worth learning by analyzing its unchanged properties
  • In software design, when we design an adaptive software system, first we need to identify the changed stuff and unchanged, then design the structure based on unchanged, then isolate and encapsulate the changed stuff; make sure the system depends on unchanged, not on changed, this is the famous Dependency Inversion Principle.

Thursday, November 11, 2010

Mind map: Continuous Delivery Notes

In QCon San Francisco, I attended the tutorial -"Continuos Delivery", it is a great training. I learned a lot, then I realized I have to record and organize what I learned - which is the part of the GTD principle. Also at the meeting I noticed that Dan North used a Mind Map for his presentation, which is awesome. The software he used is called FreeMind,  so I just tried to use this tool to take my notes in the mind map format. The notes like this:

Since this is my first time to use it, it is pretty basic, but it is good enough for me right now. It is a good starting point. FreeMind provide lots of nice features, please check the pdf manual for details.

I realize that using Mind map to take notes and posted on the website is a great idea. I already use mind map to take notes, but just manually drawing, this is a great tool.

The next step I need to figure out how to embed the actual map on the website. This article tells you how to install and use the FreeMind Applet on your website, then it seems I need to have my own website, so right now it is time for me to build my own website.

Saturday, November 6, 2010

Impressions of Qcon San Francisco 2010 conference

My journey of 5-day Qconsf 2010 is just finished, now I am on the plane flying back to Toronto. This my first time to attend Qcon conference, the whole conference is so nice, I really enjoyed the whole conference. Now I am trying to write down what I thought about this conference. It will be just an overview, I will give more detailed post for each interesting talks in future.

2 Days tutorial: fantastic
1. Joseph Yoder and Rebecca Wirfs-Brock's Adaptive Object Model is really nice, actually I supposed to take Dan North's architect course, but I changed my mind in the last minute. I really missed Dan North's course, but AOM is really good. because it provide several patterns to make the application architecture more flexible, which is really important for using static language like Java. I think it is really useful to use this model in my current java application development.

2. Continuous Delivery
I am Martin Fowler's follower, finally I have a chance to listen to Martin Fowler training. My current build process is really painful, I think I have an idea to improve my current build system, including:
  •      break down one big build script to several pieces,
  •      create dependency
  •      use code analysis
  •      use build server like Hudson
  •      use Junit test
  •      set up build artifact
  •      unify configuration of developing environment and deploy environment 
  •      decouple the dependency of developing build script from deploy build script.
  •      use puppet and cucumber
  •      simplify the ant build script: use gradle or gant
My goal: shorten the deploy build time, shorten the developing unit test build time, try to automate every thing, shorten feedback, improve productivity
  
Martin's Friday's Keynote is also fantastic, I bought his latest book: Domain Specific Language, my suggestion is just to buy any of his book, you will not be disappointed.

overview of 3-day talks
The 3 days talks are really good, every day I feel struggle to choosing which one I should choose. I choose Java track (wednesday), NoSQL(Thursday), Parallelism programming(Friday). I will say most talks are really good, some talks you will find which is not you expected. My most favourite is Michael Feather's talk:the most important part is about conway's law: your code structure mirror your organization structure, wow!, totally striking, before I have some kind of impression, but I did not aware this rule, fantastic! Michael's talk is so important because it gives your insight to deeper thinking. like zen medication, action of awaken and awareness. Thank you Michael!

My favorite speakers
I am so happy that I have chance to meet following famous speakers:
  • Martin Fowler
  • Dan North
  • Ralph Johnson
  • Dan Ingalls
  • Erik Meijer
  • Michael Feathers
Some speakers I am not familiar, they give really wonderful talking:
   Joe and rebecca
   Stuart Halloway

What I learned
NoSQL, Concurrency & parallel programming and functional programming are my blind spots. Thorough 3 ays conference,  I just get some concepts, since they are all very good speakers, I know what I am going to learn next steps.
Especially when I attended two talks by Stuart Halloway about Clojure, I learned that clojure is such a elegant beautiful language, and the more important is closure defines/redefines the concepts about value, time, perception, which are totally different with traditional object oriented model. OO is not the only thing to observe the world. This is big mindset change. Stuart's second talk about time model in clojure is brilliant, pretty philosophy, it will take me longer time to fully understand them.

who I meet
 Mark:  I talked to him a lot, who is a ruby guy, I got lots of information about tools of ruby from him.
 Jai:  Java guy, I found we read quite similar computer books,
 Wei: java guy, I learned some form him about NoSQL.
 Daniel: .NET guy, I am so impressed by his productivity of blogging,  I noticed he just he keep writing in a Martin Fowler's keynotes talking,  I thought he might do something else,like checking email, but when after the talk, he told me he just finished his another blog post about the talk, oh my god! Compare to him, usually I take notes on my notebook, then later type them on the computer; it always take a longer time to write a blog post, I need to learn this skill. how to blog your thought easier and faster.

And I talked many other guys I forget their names,  I found we almost read same books, shared same vision, like "learn a new language every year", it is a very good chance to learn, get feedback, you will aware your ignorance, your blind spot, you need to learn more !

It is really interesting that a group of people come from different country, with different back ground, share the same philosophy.

Next actions
  Am I going to come QCon next year? Maybe, it depends on my own budget.
  Get more involved in infoq.com? I talked to Floyd about submitting articles to infoq, which is a good idea, but you have to commit to submit at least one article each week, which is sound stressful to me right now, it is challenge you have to overcome. Do it!