Setting up nested style templates in iReport and JasperReports

Style templates are a great way to abstract style definitions that are shared across a report out to an external file. This makes them easier to maintain and understand of course, but once your report library grows you will likely consider setting up one or a small number of shared style templates, probably with particular styles per report in sub templates.

The master template file, let’s call it shared_styles.jrtx, might look something like this:

<?xml version="1.0"?>
<!DOCTYPE jasperTemplate
 PUBLIC "-//JasperReports//DTD Template//EN"
 "http://jasperreports.sourceforge.net/dtds/jaspertemplate.dtd">
<jasperTemplate>
 <style name="Default" isDefault="true" fontName="Circus"/>
 <style name="distinct" forecolor="#A0A0A0" backcolor="#FFFFFF" \
vAlign="Middle" fontSize="13" isBold="true" isItalic="true"/>
 </style> 
</jasperTemplate>

And let’s imagine a single sub-template, sprocket_styles.jrtx:

<?xml version="1.0"?>
<!DOCTYPE jasperTemplate
 PUBLIC "-//JasperReports//DTD Template//EN"
 "http://jasperreports.sourceforge.net/dtds/jaspertemplate.dtd">
<jasperTemplate>
 <template><![CDATA[shared_styles.jrtx]]></template> 
 <style name="quiet" backcolor="#FFFFCC" fontSize="8" \
  forecolor="#CCCCCC"/>
</jasperTemplate>

For this to work, you need to add the directory containing these two jrtx files to the classpath that is passed to jasperreports.

You can also add this directory to the classpath in iReport (Preferences), and both will load the styles appropriately. This approach lets you keep your styles separate and easy to work with, and it even minimizes the change required for each report to incorporate style templates: you only need to add a style reference to the appropriate sub-template for the report, and it will load the shared one.

Posted in iReport, JasperReports, Reporting | 4 Comments

Evading UUID woes when upgrading to iReport 4.6

If you get this sort of nonsense as soon as you create a new report in iReport 4.6 (important caveat: and after having been running an older version like 4.1):

com.jaspersoft.jasperserver.api.JSExceptionWrapper: org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute ‘uuid’ is not allowed to appear in element ‘jasperReport’.

Then you simply need to update your classpath with the new and shiny jars that came with your recently upgraded iReport. The steps below are written with OS X in mind, but the process should be fairly similar on other platforms.

  1. Open iReport Preferences (Cmd + ,)
  2. Classpath tab
  3. Note any jar files with iReport in their path having versions older than what you are running
  4. Add Jar -> /Applications/iReport_4.6.0.app**
  5. Select any jar files that match the old ones above, add them
  6. Remove the old versions

** Important side note: In a perfect world, you would be able to open that .app file in iReport and navigate its perfectly reasonable contents. This not being that world: open a terminal and run this:

ln -s /Applications/iReport_4.6.0.app/Contents/Resources/\ ireport/ireport/modules/ext /Applications/iReport_4.6.0_ext

That will create a shortcut you can select, taking you to where all the new jars live. When you are done your classpath should look something like this:

classpath

Save, close and restart iReport for good measure, and create a new report. No UUID errors! And: no errors opening files created in older versions of iReport.

Caveat emptor: When you modify any of the aforementioned templates and save them, a uuid property will be added to at least the jasperReport element. Not a big deal for me so far, but if you open the saved file in an older version of iReport for some report you might get an error. Let me know if you try!

Posted in iReport, Reporting | Tagged , , | 1 Comment

Changing your name in iPad mail accounts

When adding a second Gmail account to my iPad recently, I needed to differentiate the two accounts clearly. I decided on “Gmail – ” followed by the beginning of the account name. All well and good so far. However, a friend pointed out that this name was showing up as my name in emails sent from my iPad. Not what I was going for.

As it turns out, what I needed to set to keep things clear is Account Description. When adding a new account, the Account Name (shown as your name in outgoing mail) is set to the Account Description value by default. To change the Name, go to Settings -> Mail, Contacts, Calendars. Then under Accounts select the desired account, then click the Account line on the next screen as well. Here you can change Name and Description independently:

Posted in Apple, Mobile | Leave a comment

Transfering Google-synced iPad Notes between accounts

The short path to transferring iPad Notes between Google accounts:

  1. Create a Notes label in your new Gmail
  2. Connect the old and new Gmail to a mail client that allows multiple accounts and transferring messages between them
  3. Transfer all messages in the old Gmail’s Notes folder to the new Gmail’s Notes folder (Gmail labels are manifested as folders in Evolution)
  4. Turn off Notes sync with the old Google account on the iPad
  5. Turn on Notes sync with the new Google account

The longer tale

The iPad Notes application has the ability to sync your notes to Google, Yahoo and other accounts, along with iCloud. While dealing with the ramifications of changing to a new primary Google account, I needed to get all my notes moved over. During this process, I learned some interesting things about Notes and Gmail in particular.

Line-wise diffs only

When you sync your iPad notes with a Google account, notes appear as email messages with a newly created label applied called “Notes”. While the view on the iPad is a continuous document, modifications to notes actually show up as new messages in the same conversation under the Notes label. This provides the perk of a primitive diff view for your notes since the changes are shown in a different color.

Update: After some additional testing, I cannot discern the pattern of how these notes are updated as messages in Gmail. I have several that definitely show diffs and threaded conversations as evidenced by the image above (purple text was the first form; black was the most recent update). But this next test shows no such markup or evidence of what were definitely multiple messages:

Test synced note showing no signs of diffs or multiple messages despite the disparate update times...

Nice-to-have optional features aside, seeing as these notes are nothing more than emails with an intuitive label, transferring them to a new Google account got pretty simple. First though, I was unhappily reminded that Gmail does not allow you to forward more than one message at a time. To get around this, I set up both Gmail accounts within the desktop Evolution client. Then it was simply a matter of going to the old Notes folder, selecting all, Copy to Folder, navigate to the new account’s Notes folder, done. Be aware that you should first create a Notes label in the new Gmail account since it won’t exist before you sync notes from an iPad with the account. (And while we are on that topic, be aware that you have to quit and restart Evolution for it to pick up new folders.)

Posted in Apple, Desktop, Google, Linux, Mobile | Leave a comment

Handy Excel Tip: Open workbook in new instance

I’ve written before about using Excel for some remote data collection and analysis tasks. One thing that often annoyed me in such situations was the inability to utilize multiple monitors. Whenever I wanted to break out a sheet, or especially when opening a new workbook, I found there is no way in default Excel to open the item in a new instance. It would always open in the same window, severely limiting potentially useful layout arrangements.

As is unfortunately common with Windows improvements… there’s a registry modification to solve it. All credit goes to OnlineTechTips: this article got me fixed up quickly.

Basically you just download a zip file, extract the contents, and rename the file whose title indicates the behavior you’d like in place. After this you just double click to run the file. This is a very convenient way to provide a fix, much easier than following descriptions of where in the registry tree to find what entries and what values to set them as. One of them even adds the option to open in a new Excel window to the right click context menu.

Posted in Desktop, Office | Tagged , , , , | 1 Comment