Convert ARGB to int value (Java)

Feb 26, 2011 by

In some Java implementations/SDKs the Color class does not have the

int Color.argb(int, int, int, int)

method.

One SDK that, as far as I know, does not have this method is the BlackBerry SDK.

This code snippet can be used to perform just that:


public final class ColorBB {


    public static int argb(int A, int R, int G, int B){    
        byte[] colorByteArr = { (byte) A, (byte) R, (byte) G, (byte) B };
        return byteArrToInt(colorByteArr);
    }

   
    public static final int byteArrToInt(byte[] colorByteArr) {
        return (colorByteArr[0] << 24) + ((colorByteArr[1] & 0xFF) << 16) + ((colorByteArr[2] & 0xFF) << 8) + (colorByteArr[3] & 0xFF);
    }

}
Let me know in the comments if you have any improvement/modification ideas.

read more

Java code to work with MillennialMedia, SMAATO and NexAge web advertising APIs

Dec 18, 2010 by

I wrote yesterday about my (mostly) negative experience working with these companies, but some of you might give it a try and maybe your results will be much better or maybe things have actually improved lately. In any case, the code here should get you up to speed covering most of the dirty work of working with these companies’ APIs.

I will post 4 classes here:

  • AdGrabber -  main abstract class to give all other specific grabbers structure and save some repeating code
  • MillenialAdGrabber - MillennialMedia specific grabber
  • NexAgeAdGrabber - right, NexAge specific grabber
  • SomaAdGrabber - the SMAATO ad grabber. Their ad platform is dubbed SOMA, hence the name

If you are using this code, please give an attribution when applicable with a link to this post.

read more

BlackBerry PlayBook vs. Apple iPad – browser comparison

Nov 17, 2010 by

In the following video, the web experience on the BlackBerry Playbook is compared to the web experience on the iPad. It is clearly shown (the video is made by RIM) that PlayBook significantly outperforms the iPad. While these tests are definitely subjective since they are performed by RIM, so they could choose website favorable to the PlayBook and otherwise objectively-subjectively give the PlayBook some edge, the interesting thing to note is that the PlayBook uses the open source WebKit browser initially developed by Apple. It is a very interesting camparo nevertheless.

Would be very interesting to see the Samsung Galaxy Tab running Android participate in this comparison, especially since it has the same 7″ form factor as the PlayBook and it has Flash enabled of course.

Enjoy the video and let me know what you think!

Blackberry PlayBook vs. Apple iPad comparison:

read more

Android vs. iPhone vs. BlackBerry Users

Nov 9, 2010 by

This is a great comics I came across, very  concise and true!

Android vs. BlackBerry vs. iPhone

I especially liked the dinosaur. BlackBerry are dinosaur outdated both in the features and especially from the development perspective. I covered this before in my Android vs. BlackBerry development post.

read more

Some notes on QNX – the new BlackBerry PlayBook OS

Sep 30, 2010 by

So, as you probably already know, the coming BlackBerry table will be powered by the QNX pronounced almost like Unix – “ku-nee-ks”. So what is QNX?

Below are some notes from the session delivered for developers right after the tablet was introduced during the keynote speech at the DevCon2010.

QNX – is a highly distributed, self healing POSIX compliant, real time operating system.

Real time here basically means preemptive partitioning, which in turn means patented scheduling mechanism for dynamic resource allocation. Here we are talking about CPU as the main resource.

Self Healing – since the system is based on POSIX – message passing, only the core kernel (0.1 million lines of code in total, compared to 70+ million lines in Windows and 9+ million lines in Linux kernels) and the process manager are at the core, all the other processes, can be hot restarted. The key issue here to take home is that QNX is highly modular system unlike the much more monolithic Windows and Linux systems. The monolithic kernel only consists of the microkernel and the process manager – a small partition of all OS code which can be highly optimized and is easier to monitor for bugs. All the rest of the OS systems are “hot pluggable” modules which run in their own processes and can be restarted without taking down the whole system. This is the main point of QNX being highly resilient system and the term used by Dan Dodge the co-founder and the CEO of QNX systems - self healing.

QNX will support Adobe mobile Air and Flash for start and is fully capable of running the Java JVM which should enable the table to run any Java applications written with native BlackBerry SDK for OS 6.0 (and probably anything above level 6.0 SDK). There is also an option of a native C/C++ development for QNX. Momentics – the native developer environment – an Eclipse plugin. QNX is apparently company #3 to join the Eclipse project early on – at the Eclipse 1.0 stage and the main contributor to the C/C++ CDT project. The Momentics environment has a rich set of tooling for coding, debugging and profiling the natively written applications for the QNX.

If you are interested in the latest updates, you should head to the following resources:

    read more

    BlackBerry Developer Conference – subjective notes – note one

    Sep 27, 2010 by

    From the few sessions it was clear that RIM as a whole is still not getting it – the consumer market for smart phones has long surpassed the enterprise market. They are still trying to cater to weird enterprise scenarios and impress developers with these capabilities. RIM has to wake up and realize that the number of developers caring about enterprise features declines exponentially.
    Same as with the networking which is a pure hell because there are at least 7 different ways to establish a network connection, they are trying to cater to different scenarios and have all these different ways of doing pretty much the same thing in 5 ways. Seriously – WHY??? Just give us one but RELIABLE way of doing something. Don’t you get it that we – the developers don’t want to implement something in more than one way and then debug it forever or yet, to have to implement something in 3 ways because you are not sure (and don’t really have a good way of telling) which way will work for every specific user. You have to start repeating this every day as your daily mantra – the simpler it is, the less it breaks. This is a universal engineering fact. Would you please already get this? When you do it will make the life of developers so much easier.
    read more