There comes a time in any mobile project of significant size, where no matter how careful you were, you missed something (or you over optimized) and you have memory leak.
WTK2.5 comes a long way to show the count of live objects in memory, but it does not allow to trace the references to see why the heck it is not garbage collected and what is referencing it. It works pretty much the same way as Memory Monitor that ships with WTK, by connecting to the emulator vm and extracting info from there.
That is why I like YourKit Java Profiler as it does exactly that, help you trace those unwanted references.
technorati tags: j2me profiling yourkit memory leak
Wednesday, March 21, 2007
I’ve tried using the Flex Builder 2 as Eclipse plugin and failed.
I have 3.2 WTP with J2EE and Hibernate Tools plugins. After installing the Flex Builder 2 as plugin into my existing Eclipse I had problems.
Every second time flexbuilder tries to compile the flex project it would crash with OutOfMemoryException. I even tried to increase the memory from 512M to 1024M and still it’s crashing, looks like it is blowing the stack at some point.
I ended up running two IDEs at once: one eclipse for backend and one flex builder standalone for front end development.
technorati tags: Flex Builder flex eclipse outofmemory
I’m going through the “Rich Internet Applications with Flex and Java” by guys from Farata Systems.
Overall I like that authors are hardcore consultants with deep knowledge of Java, so it is very easy to understand the concepts that book presents as they are targeted to Java developers specifically. I also like the fact that there are quite afew good tips that help java developers broaden their horizons by thinking outside the JAVA and/or Static WEB.
On the other hand it seems that the samples applications are designed in a way where you a going through hundreds of pages and multiple modifications of code without the ability to run it.
I’m on chapter 5 right now, developing stocks portfolio application hooking up with FDS, and it is really painful as it’s not always clear of which file needs to be changed as well on setting up the Flex Builder 2 FDS project.
I wish that authors would also ship sample code with the Ebook (pdf).
[Flex] RTMP-Server failed to start up: java.net.BindException: Address already in use: bind
This weird exception happened for me when I inserted destination with url property into the wrong configuration file. URL destinations should go to proxy-config.xml.
technorati tags: ria flex riabook
There is a new article that describes jsr 75 PIM package implementation.
Here is also some sample code that opens up the contacts loops through the list and extracts Name and phoneNumber from each record.
if (PhoneConstants.JSR75_INCLUDED) {
PIM pimInstance = PIM.getInstance();
ContactList list = (ContactList) pimInstance.openPIMList( PIM.CONTACT_LIST, PIM.READ_WRITE);
Enumeration contacts = list.items();
while (contacts.hasMoreElements()) {
Contact contact = (Contact) contacts.nextElement();
String name = "";
if (list.isSupportedField(Contact.TEL)) {
for (int i = 0, size = contact.countValues(Contact.TEL); i < size; i++) {
String telStr = contact.getString(Contact.TEL, i);
int attr = contact.getAttributes(Contact.TEL, i);
String phoneType = null;
if ((attr & Contact.ATTR_SMS) != 0) {
phoneType = "sms";
} else if ((attr & Contact.ATTR_MOBILE) != 0) {
phoneType = "mobile";
} else if ((attr & Contact.ATTR_HOME) != 0) {
phoneType = "home";
}
}
}
}
}
// TODO: find out how to post code snippets in WordPress
technorati tags: j2me jsr75 PIM
For the last couple of weeks I’ve been going through Adobe Flex 2: Training from the Source book and playing with Flex Builder2.
Overall Flex looks as a very solid platform and I look forward using it this year. Though flex builder, that is the IDE that Adobe sells for 499$ is not worth your dollars. The main benefit of it is the syntax highliting and automatic compilation. It is missing all the good features of eclipse that make us java developers so productive: refactoring, source generation, quick type, call list, variable references, and even code formating is missing both for Action Script and MXML.
Ofcourse those minor issues are not blockers, more just annoyances.
There is one issue that I believe flex as platform is missing, or I wasn’t able to find it yet:that is Global Exception Handling.
I would like to be able to define global error handlers on my mx:application so that I can catch all unhandled exceptions and show custom error display or submit http post to my server.
technorati tags: flex flex2 adobe error handling ria
It looks like some VM bug where the inheritance of classes brakes.
I have 3 classes
class a { public void method1(){}}
class b extends a {public void method1{}}
class c extends b {public void method1{}}
As you can see each class overrides the implementation of method1.
During runtime it happens sometime that the object is instanceof c, though when method1 is invoked, vm uses class a implementation from the top class in the inheritance tree.
I wonder if Sprint did any over the air buggy firmware update in the last month, as I’m absolutely sure that it this worked fine on A900 month ago, and it does work on all the other devices (as it’s supposed to).
Sunday, November 26, 2006
oh my!. I’m very agitated right now. I almost fall the victim of Annual Minutes Disclosure — SCAM.
I actually received three different letters asking me to fill out Annual Minutes Disclosure Statement and submit payments in the range of 125$ – 150$. They all have different addresses and all include the name of my corporation and California Corporation Number.
Thanks to the greediness of the scammers, as if I only received one of such letters I would blindly pay it.
The funny part is that they have a disclosure at the bottom of the letters stating that they are not government agency, and this disclosure is BOLD, making it harder to treat as a disclosure when you glance over it.
Friday, September 29, 2006
At the current phase of the project I’m into the optimization. We have a CSSHelper class that has all the possible css values set in the map that is statically initialized. So on RAZR it takes 50 seconds to just load the class into the memory, absolutely unacceptable.
So poking around the web I found this great slides from JavaOne on optimization techniques: Effective J2ME.
Below is a small paragraph on static array initialization:
Static Array Initialization
• Problem
• Array initialization performed in static initializer
• This can cause significant code bloat and slow down class loading and initialization
• Impact
• Application startup, memory footprint
• Guideline
• Move initialization out of static initializer and do programmatic initialization or read data from I/O
Solution here is to create binary file that would be created at build time and packaged into the jar. Add init() method to the class to read the binary file from the jar as resource.
technorati tags: j2me razr optimization static array initialization
Thursday, September 14, 2006
Recently spent some time tracing where the heck this Exception is comming from. I’ve put the try/catch on every thread.run() and still was not able to catch it.. bummer.
Well the problem is that we are using Canvas.callSerially() a lot, and i guess on RAZR there is some (undocumented) limit.
So starting a new Thread rather then relying on callSerially() solved the problem.
technorati tags: j2me razr exception
Tuesday, September 5, 2006
It all started when I was not able to open new mail that comes into my gmail account, which I use to consolidate all my email accounts. The error looked like this:
“oops… the system was unable to perform your operation(error code 766).
please try again in a few seconds.â€
Now it is a Murphy’s law, that it is down right when I need it the most. I guess I need to do some research on web mail UI that I can install in my own server. Zimbra looks really promising in that area, though lack of documentation hurts.