Skip to content

Good article that provides breakdown of PIM

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

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

VM issues with Samsung A900

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).

technorati tags: j2me A900 jvm sprint

Annual Minutes Disclosure — SCAM. Corporate owners be aware.

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.

J2ME Optimizations

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

Ever experienced untraceable ArrayIndexOutofBoundsException on RAZR?

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:

Dependency on google, aka GMAIL down.

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.

technorati tags:

Windows reserves 20% of network bandwith.

Here is the description of the “Limit Reservable bandwith” on win xp pro.

Determines the percentage of connection bandwidth that the system can reserve. This value limits the combined bandwidth reservations of all programs running on the system.

By default, the Packet Scheduler limits the system to 20 percent of the bandwidth of a connection, but you can use this setting to override the default. If you enable this setting, you can use the “Bandwidth limit” box to adjust the amount of bandwidth the system can reserve.

If you disable this setting or do not configure it, the system uses the default value of 20 percent of the connection.

This article explains the details on how to reclaim you bandwidth :)

technorati tags:

Super Duper Great Maven plugin

I always loved the PMD plugin and the idea of detecting bad code at build time. So the guys at jutils provide the maven plugin lint4j that is able to detect whole bunch of potential problems in your code in regards of security and scalability:

Lint4j was created to help software developers detect defects and security vulnerabilities before writing the first test case.

technorati tags:

Email Push for free

Here is the great blog post that describes the way to get your emails onto the mobile device without the need to pay for black berry server nor Good. The underlying idea is to use IDLE command in IMAP protocol. From you j2me email client one connects to IMAP server and get’s into the IDLE mode (blocking on input). Once there is a new message on the server, it is reported and j2me client can easily download the header and full message at that time.

technorati tags: