Wednesday, January 27, 2010

BIRT: Get Access to Chart Element and Modify Properties from ReportRunnable in BIRT 2.5

Helping someone out from the forums on BIRT Exchange. The question was how can you get access to a chart in a ReportRunnable object, modify its properties, and run the report with the modified properties. While I have given pieces of how to do that here and here, I have never put them together in a single example. Below is an example of how to do this.

package com.digiassn.blogspot.birt;

import java.util.logging.Level;

import org.eclipse.birt.chart.model.ChartWithoutAxes;
import org.eclipse.birt.chart.model.attribute.ChartDimension;
import org.eclipse.birt.core.exception.BirtException;
import org.eclipse.birt.core.framework.Platform;

public class ModifyChart {

* @param args
public static void main(String[] args) {
try {
IReportEngine engine = null;
EngineConfig config = null;

// Configure the Engine and start the Platform
config = new EngineConfig();
// set log config using ( null, Level ) if you do not want a log file
config.setLogConfig("C:/temp", Level.FINE);

//start birt platform and create factories
IReportEngineFactory factory = (IReportEngineFactory) Platform
engine = factory.createReportEngine(config);

//open report design
IReportRunnable design = engine

//get chart element handle called "PieChart"
ExtendedItemHandle eih = (ExtendedItemHandle) design.getDesignHandle()

//get the actual chart instance since Charts are extended item handles
ChartWithoutAxes cwa = (ChartWithoutAxes) eih.getReportItem().getProperty(

//set title of chart to New Label
cwa.getTitle().getLabel().getCaption().setValue("New Label");

//set 2d with depth

// Create task to run and render the report,
IRunAndRenderTask task = engine.createRunAndRenderTask(design);

// Set rendering options - such as file or stream output,
// output format, whether it is embeddable, etc
HTMLRenderOption options = new HTMLRenderOption();


// Set output format

// run the report and destroy the engine
// Note - If the program stays resident do not shutdown the Platform or
// the Engine;

} catch (ExtendedElementException e) {
} catch (EngineException e) {
} catch (BirtException e) {



The thing to remember about charts in BIRT reports is that they are Chart types stored withing a ExtendedItemHandler. So you need to find the ExtendedItemHandler first, then get the chart inside of it. Charts can be ChartsWithAxis (bar charts, lines charts), or ChartsWithoutAxis (pie charts). Reference on the chart types can be found here.


Musing: Mobile Technology

One of the things that is always on my mind is how can I keep myself mobile, without the need to carry around a laptop. For a few years I have kept it in the back of my mind that my smartphone would be perfect for this, however previous models didn't quite do everything that I needed. I can say, this is no longer the case with the Droid.

I am writing this sitting in a Chipotle and using my foldout keyboard on my Motorola Droid. I am using the wireless tether that I hacked previously to connect my iPod Touch online so I can play Scrabble (until there is a native Droid version that is). I am using the GDocs application to write this (although I have a few other text editors that save locally instead of "in the cloud"). Using the Droid Meebo app, I can stay connected to coworkers via IM. Since the Droid multitasks, I can have the IM, email, tether app, and a few other things running simultaneously. The only thing I lack here is VOIP via WiFi, which I suspect will be simplified enough soon enough. I think my next tasks here are to try to run a modified BIRT Designer. Then I can do some rudimentary troubleshooting on BIRT reports when not at my desk.

I couldn't do all this 5 years ago on the Razr, or last year with the Touch/Vogue. The difference between mobile and desktop is closing. I wonder how businesses deal with the security issues with this new found mobility?

Monday, January 25, 2010

Droid: WiFi Tethering/Hotspot on the Droid

Since the announcement of the Pre+ for Verizon would have WiFi hotspot built in, I have been salivating for the wireless hotspot functionality. Of course, I kicked myself because I just bought a Droid. Well, I can hold off my wanting because some clever hackers figured out how to do the same thing with the Droid. That’s right, the Droid is capable of being a WiFi hotspot.

So how is this feat accomplished?

That’s it. Pretty easy. Took me about 20 minutes to do. Although not indicated in the article because it assumes prior understanding, the “ADB” application refered to requires the Android SDK, and is a tool located under the “tools” folder. Also, the step to “flash_image” was actually not needed since this is part of the Android Root Helper application. Also, during the WirelessTetherPather programs final stages, it asks you to “login, and run the tether app”. This actually refers to running the “Wireless tether for Root users” application under your applications menu on the Droid, not running it using Busybox using ADB. That step confused me for some reason.

If your having problems finding the “Droid Root Helper” application, you can use the one I found here. Apparently, it is also in the Marketplace.

That’s it, the last little void from my HTC Touch has been filled. Seriously, how could Verizon NOT want this? This is just so freaking awesome, it should be a standard feature.

Monday, January 18, 2010

Getting HP Foldable Bluetooth Keyboard FA287A Working on Motorola Droid

I’ve had an old Bluetooth keyboard I used to use with my HP Ipaq. It is a model number FA287A. I’ve always had a fondness for this keyboard and using it with my mobile devices. It has a number pad on the top, and it has a nice feel to the keys. I managed to get this keyboard working on my HTC Touch Vogue with some help from this driver.

I am happy to discover that this keyboard, which has served me well for years, lives on with my Motorola Droid. That’s right, this oddball keyboard that was designed specifically for the HP Ipaq, works with my Android based mobile phone. How is this possible? Thanks to a little application called KeyPro available in the Android Marketplace, and at (note, this site was down at the time of this writing, the URL comes from Google).

To get this working, I used the following steps.

  • Installed KeyPro from the Marketplace.
  • Opened up Droids settings app.
  • Went into Language and Keyboard, and clicked on the check next to KeyPro.
  • Clicked Back.
  • Clicked on Wireless and Networks.
  • Turned on Bluetooth.
  • Went into Bluetooth Settings
  • Clicked on Scan for Devices, it found “BT-FoldableKB”
  • Paired with it, and put in Passcode “0000”
  • Pushed the Home button
  • Opened the apps menu, started KeyPro
  • Opened the Settings menu.
  • Changed the Keyboard Model to “Freedom Universal”
  • Clicked on the Scan next to Keyboard Address textbox.
  • It found the “BT-FoldableKB”.
  • Scrolled down and clicked on Save.

Keypro then showed status at bottom of app saying “initialized”, then “connecting”, then “connected”. With it connected, I clicked on the Search button. Nothing happened. So I held my finger up to the search text box for a second, and a dialog poped up for Input Method. I clicked on Input Method, and selected KeyPro. And guess what. Now what I typed showed up. I can use my Bluetooth keyboard on my Android. This works out great when I want to take notes in a meeting and I don’t want to bring my laptop with me, and another reason to leave my IPod Touch at home.

Saturday, January 02, 2010

Squid: Watching Hulu on your PS3 using HTTP_HEADER User Agent modification

Some time ago, probably about a year, I watched “Terminator, The Sarah Conner Chronicles” on Hulu over the PS3. I had reached a certain level of euphoria as I realized my media center in my theater room was complete. I tried this recently, only to be greeted with a message letting me know that the PS3 platform was no longer supported for Hulu content. Seriously? Filtering based on platform now? I'll tolerate the limited commercials, but I don't like being told what platforms I can watch content on.

Fortunately, I found this little gem with a workaround using Squid, one of my favorite tools, to replace the HTTP header en-route, making Hulu think the request is coming from a Windows machine. And old trick, and Firefox even has a plugin that will replace the HTTP header for you, but the PS3 doesn’t have that ability. I remember an article I wrote several years ago talking about using Squid and SSH to get around filtering proxies within a corporate LAN. I’ve also used Squid to simulate slower bandwidth using delay pools for UAT testing. Right up there with Netcat and SSH as useful tools to have on your machine.