Heading to JavaOne this year

Filed under: — posted by alexey on April 18, 2008 @ 5:40 pm

WTK 2.5.2 issue

Filed under: — posted by alexey on December 10, 2007 @ 5:17 pm

WTK 2.5.2 introduced pretty annoying bug to a very usefull feature, that is, ability to run the midlet from the command line, so that you can see all the system.out printed to the console.
it was always possible to do the following:

\%PATH_TO_WTK%\bin\emulator.exe -Xdescriptor:MyMidlet.jad

But since I upgraded to WTK 2.5.2 for CLDC 1.1, I’ve started getting this exception:
Exception in thread “main” java.lang.NoClassDefFoundError: com/sun/kvem/environment/EmulatorWrapper

Unfortunately searches on google did not reveal any solution, so i reverted back to WTK 2.5.1 and everything is fine.

technorati tags: j2me wtk

Motorola V3M slow startup.

Filed under: — posted by alexey on August 9, 2007 @ 1:52 pm

Here is the interesting issue observed on the Motorola V3M. Application (in fact it’s VM) startup time deteriorates.

When midlet owns multiple RecordStores it’s startup time is painfully slow, in fact you don’t even see any message from the system that it is doing something, as the phone simply freezes. So far I found out that V3M freezes for about 0.5s for every RecordStore, so if your midlet has about 100 record stores as mine has, it takes about 50 seconds to startup, OUCH!

So I’ve reimplemented the persistence layer instead of using single record store per cache entry, use single RecordStore for all the cache, and then store each cache entry into a Record.

Now here is another problem, when you delete record RecordStore.deleteRecord(recordId) the system does not reclaim that memory, it simply marks it deleted. Same happens if you do setRecord(new byte[0]{}, 0, 0), it still does not reclaim the memory. The only way to reclaim the memory is to copy only life data into the new record store and delete the old one, pretty much re compact it. Well it is a slow operation, and how often would you do it? AS for writing 400K it takes about 5-6 seconds on V3M, and it is such intensive operation, that even repaints don’t go though.

Well, i wouldn’t write this post just to rant on the device, as I’m so used to the limitations of the mobile devices. I do have mini solution, at least the one that works for me.

Thanks God, V3m has 6 megs of heap, so i keep my 400K of cache in memory, and on user inactivity( as well as pauseApp and destroyApp), i simply flush it to RMS into the single RecordStore and single Record inside of it. So it works pretty fast, as I don’t have to read it, and i do not delay UI by expensive recomapacting, my startup time is also blazing fast.

technorati tags: j2me motorola v3m razr rms

Looks like Flex data binding is not bidirectional

Filed under: — posted by alexey on April 9, 2007 @ 4:45 pm

I have a AS3 class Loan that is being fetched from the server and the whole Loan class is marked as [Bindable]

Now in the Form I have a: <mx:TextInput text=”{currenLoan.loanAmount}” />
The problem is that user modifies the text in the textInput, it does not automatically update the variable that the control is bound to. I’m not sure if it is supported by Flex though, as I have this expectation from XForms.

As the solution to the problem I had to define the binding as <mx:Binding source=”{myTextInput.text}” destination=”{currentLoan.loanAmount}” /> So then any changes in the TextInput are being committed to the original loan object.

I wonder if there are any better, elegant solutions to this?

technorati tags: flex binding ria

Fantastic artilce for entrepreneurs

Filed under: — posted by alexey on March 22, 2007 @ 5:28 pm

Great article that outlines the similarities in of entrepreneur and King Leonidas of 300.

In fact I would go further, this is not just the entrepreneurs who would benefit but any manager and team lead. This article inspires the leadership in all of us.

Here it is, enjoy!

technorati tags: entrepreneurship leadership 300 CEO

A must tool for any J2ME (JavaME) developer

Filed under: — posted by alexey on @ 1:24 pm

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

Flex Builder 2 as Eclipse plugin — unsuccessfully

Filed under: — posted by alexey on March 21, 2007 @ 9:19 am

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

Feedback on RIA book

Filed under: — posted by alexey on March 15, 2007 @ 9:51 pm

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

Good article that provides breakdown of PIM

Filed under: — posted by alexey on March 13, 2007 @ 5:41 pm

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

Flex2 feedback

Filed under: — posted by alexey on March 11, 2007 @ 8:13 pm

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


next page


image: detail of installation by Bronwyn Lace