Monday, January 16, 2012

Things in the works.

Lots of changes recently. I am unemployed now. Could not have come at a worst time, but at the same time I have made good use of my free time. Read lots of books, specifically about Specification by Example to address some of the short comings I have encountered with Agile methodologies, and I have taken the time to learn a few new languages. Groovy, Ruby, and a few others. Learned a lot about Magento as an eCommerce platform, and surprisingly it is very comparable to some of the big boys, even in its community edition. I have also refreshed my memory on Solr/Lucene.

I will have some new articles coming up. I let too much B.S. keep me from maintaining this site previously, which is a shame because I really enjoyed it. Onward and upward.

Wednesday, September 21, 2011

BIRT: Using Resource Bundles

A question that has recently been posted on the BIRT Exchange has got me revisiting an old problem with BIRT, localization. BIRT has a localization mechanism built in, but this only works for labels with the UI. You can also use Javascript and the report context to access messages. But I wanted to look at another way to accomplish this same task? It would stand to reason that since BIRT is running inside OSGi, and OSGi is just a fancy layer on top of Java, that we should have access to the localization features in Java, right? That would be correct.

I prefer to use Java Event Handlers for this. It is possible using Javascript event handlers, but that is a bit of a pain. So, in the following example, I will show a simple Java Report Event Adapter that will load up a Resource Bundle based on the Locale passed in from BIRT, and initialize a HashMap that can be used in BIRT to retrieve those values.

The first thing I do is create a separate Java project, and extend the ReportEventAdapter class. I then created a initialize event, although this would work in the beforeFactory event as well. All you need to do is use the same coding you would use in Java to load the ResourceBundle, and retrieve your keys and values. Using the reportContext passed in, you can load the Locale, and set a global variable that can be used in the report design to retrieve those values. The Java code is below.

package com.digiassn.blogspot.birt.event.handlers;

import java.util.HashMap;
import java.util.ResourceBundle;

import org.eclipse.birt.report.engine.api.script.IReportContext;
import org.eclipse.birt.report.engine.api.script.ScriptException;
import org.eclipse.birt.report.engine.api.script.eventadapter.ReportEventAdapter;

public class ResourceReportEventAdapter extends ReportEventAdapter {
private static String LABEL_KEY = "myLabel";
private static String RESOURCE_NAME = "myResource";

@Override
public void initialize(IReportContext reportContext) throws ScriptException {
super.initialize(reportContext);

ResourceBundle resourceBundle = ResourceBundle.getBundle(RESOURCE_NAME, reportContext.getLocale());

String stringValue = resourceBundle.getString(LABEL_KEY);

HashMap<String, String> resourceValues = new HashMap<String, String>();
resourceValues.put(LABEL_KEY, stringValue);

reportContext.setGlobalVariable("resources", resourceValues);
}

}



The next piece of the puzzle is where to put the .properties files. You should put them into the projects /src folder. If you put them under a package, you would reflect that in the getBundle call above. I just kept mine at the root.



So now, how do you leverage this in a report? Create a new report project. Right-mouse click in the Navigator, and go to Properties. Select Report Design/Classpath. Click on the Add Projects button, and select the Java project with your Event Adapter.



In my example report, I dropped a Dynamic Text Element in, and used the following expression:

var resourceMap = reportContext.getGlobalVariable("resources");

resourceMap.get("myLabel");

And that’s it. Its read for preview. I can now localize this however I choose. If I wanted to, in my data set, I could have an additional column with the key to retrieve, and just retrieve it from my map. This allows for external localization.

Be sure to check the BIRT Internationalization FAQ at http://wiki.eclipse.org/BIRT/FAQ/Internationalization. You can use a standard reportContext.getMessage call in a similar manner.

Wednesday, June 22, 2011

BIRT 3.7 Released

Imagine my surprise, BIRT 3.7 was released today. I didn't even know until a client pointed it out to me =)

You can get it over at the Eclipse BIRT Homepage at http://www.eclipse.org/birt, along with a list of what is new and notable in this release.

Monday, March 28, 2011

Tech: Nintendo 3DS

I am once again crossing that threshold between professional writings and personal for this article. It has been over a day since I purchased the Nintendo 3DS, the newest hand held gaming device by big N. Let me cut to the chase. Is it worth it? In the short term, no. But this has nothing to do with the hardware, or the novelty of the 3D, which is, in a word, phenomenal. No, the shortcoming is with the game library that came out at launch. Don't get me wrong, Super Street Fighter 4 was the tipping point for me, but as of this writing, that all there really is. I'm thinking of getting Ridge Racer, and Pilotwings, but truth be told, I'm only considering that as a justification to use more of the 3D features. In the long run, this is more evolutionary than revolutionary, and when Zelda comes out, along with several other titles, this will be the device to be had, even if it will be in its inevitable 3Ds Lite form.

Now for the long description. I purchased the 3DS since I am a pretty heavy mobile gamer due to my traveling schedule. I usually carry on me my DS Lite, and my original PSP fat (hacked of course) so that I can keep myself entertained on planes, airports, and hotels. So the 3DS was an enticing option.

The 3DS is, in a nutshell, an updated version in the DS and DSi line. All titles for those platforms are playable, with the addition of the new 3DS titles. Covering 3 generations of the platform is pretty impressive, considering that the DS only covered the DS and Gameboy Advance, and the DSi dropped the Advance and only played DS and DSi titles. The problem for me, however, is that I do still have a good collection of Advance titles, such as the re-releases of Zelda 1 and 2, Phantasy Star, and several Final Fantasy installments. So, for me, it looks like I'll still be carrying around the DS Lite. Which brings up a major issue with the 3DS, the battery. The battery, for me, lasted around 3 - 4 hours. Of course, I did crank the 3D the entire time, but from what I have read, turning the 3D off doesn't make that big of a difference. So on a plane ride for me its no big deal, but I might be switching over to the Lite mid flight.

Once the 3Ds is turned on, it borrows a lot of its "feel" from the Wii. Thats hard to describe in words, but the overall tone, color schemes, and sound effects seemed very Wii'ish. Thats not a bad thing by any means, and navigating the menus is a very intuitive. The 3D camera is really slick, as is the AR games.

But the real meat is in the gaming. I spent all my time playing Street Fighter, of course. And to be honest, I was blown away by the 3D. It really is unlike any gaming experience I have ever had. Just something about landing that final special move, and the camera panning around with real perceived depth is just breath taking. I was a little disappointed that the two hood rats were missing from the background of the North American Diner stage, but I suppose there is only so much processing power in this handheld, and processing the "Oh Snaps" might have been too much.

There are several features that have a notice that it will be featured in some future update, such as the web browser, which means there are pieces of the entire 3DS experience that are missing. But I guess thats what I get for being an early adopter.

Like I said above, this is a really neat device. But the short term benefit just seems lacking. Long term this can really be THE device to have, especially once the game library grows, especially considering that DS and DSi titles cannot take advantage of the 3D capabilities. But once the Zelda, Mario, and Laytons come out that do take advantage of these features, this is going to be a great system. And something about the Professor Laytons stylized art might be really slick with the 3D option turned on =)

Wednesday, March 09, 2011

BIRT: Connecting to MS Sql Server Database

  1. Download the Microsoft JDBC driver from http://msdn.microsoft.com/en-us/sqlserver/aa937724
  2. Note: If youre using Java 1.5, you will use sqljdbc.jar, if your using Java 1.6, you will use sqljdbc4.jar.
  3. Open Eclipse
  4. Create a new Report or open an existing report
  5. Open the Data Explorer Tab
  6. If this is an existing report, Double Click on an existing Data Source, otherwise create a new Data Source. Call it whatever.
  7. From the Data Source editor, click on the Manage Drivers button.

  1. In the Manage JDBC Drivers Dialog, click on Add…

  1. Navigate to where you have either the sqljdbc.jar or sqljdbc4.jar file, and click Open. This will add the driver to the BIRT Designer.
  2. Now, click on the Drivers Tab.
  3. Double click on the SqlServerDriver entry to edit it. Put in a name, and a URL template that will prompt you on the correct URL pattern to use.

  1. Click on OK, and OK, until you get to the Data Source Editor Dialog.
  2. Select the SQL Server driver from the drop down list. It will automatically put in the template. Replace the IP Address, and Database name with the ip of your Sql Server Database, and the name of the database.

  1. Enter the correct User Name and Password.

That’s it, your done. Test Connection to make sure the information is correct, and hit OK.

Wednesday, March 02, 2011

Tech: Asus Motherboard Box Doubles as PC Case

In the "Why didn't they think of this before" category, Asus is beginning a trial where they ship some of their motherboards in a box that, when opened post shipping, just needs you to add components and doubles as the PC case itself. While not exactly the most visually appealing design, it REALLY is something that is worth looking into, especially if your building your own PC and aren't too concerned with the visuals of an all black case and adding "das blinking lights".

http://www.itworld.com/hardware/138740/asus-motherboard-box-doubles-a-pc-case