Archive

Archive for the ‘Java’ Category

Flash: what’s all the fuss over?

June 23rd, 2009

Update:  Here is a fantastic example of someone who has completely gone off the rails with respect to Flash…

Wow…nothing generates conversation in the tech industry like Adobe Flash. In just the past couple of days I’ve read articles about how HTML5 might be a ‘Flash killer’ along with articles on the release of Flash on the major mobile platforms, aside from iPhone. Along with those articles comes a lot commentary ranging from the people complaining about the lack of Flash on the iPhone to those with a strangely visceral hate for Flash who think that the lack of Flash on the iPhone is a bonus of the platform.

HTML 5 as Flash Killer

With all due respect to John Gruber over at Daring Fireball Adobe doesn’t view HTML 5 as a threat to Flash not because of anything to do with Internet Explorer but because of the history of HTML and CSS themselves. HTML 5 has a lot of great features and sounds like a real winner paired with CSS3 but modern browsers still can’t get the older standards right. There are still many workarounds required to get things rendering the same way on different browsers. Granted the situation is better than it used to be but these things simply aren’t an issue on a Flash-based user interface. While the browsers continue to play catch-up in the compatibility space Adobe will keep adding compelling features to Flash. I just don’t see HTML 5 being a serious challenger to Flash anytime soon.

Flash on Mobile Devices

I’d love Flash to be available on the iPhone. I really don’t get the reaction people have to Flash in general but when people go as far as saying that no Flash on the iPhone is a feature….please. Get a grip already. The iPhone experience would be that much richer with Flash available on the phone. HTML 5/CSS3 support on mobile Safari could be 100% compliant but until people start adopting those features on a mass scale it won’t be an alternative to having Flash available on the phone (see above).

I’m just not getting the dust-up over this stuff. Flash is a tool like anything else. Wider support of both HTML 5/CSS3 and Flash makes the web better, not worse. To those who would rather not have Flash exist at all: I think the web is a richer place with You Tube, Pandora, etc. than without them and they exist because of the ubiquitous nature of Flash. You seriously don’t? Because they wouldn’t exist right now if it weren’t for Flash.

  • Share/Save/Bookmark

Ubuntu 9.04 on VMWare Fusion 2.0.4

May 1st, 2009

Happy to say that with minimal fuss I was able to get the newest release of Ubuntu Desktop, 9.04, running on VMWare Fusion on my Mac.   Five easy steps:

  1. Follow this blog post for the install (he also links to the bits I am here) – but don’t worry about his suggestion for the mouse driver since the VMWare tools install takes care of it.
  2. Once the install is completed uninstall VMWare tools (they were installed as part of step 1 but not all of it was done..vmhgfs isn’t set up).  You might have to remount the install “CD” by selecting “Install VMWare Tools” from the Virtual Machine menu.   In any case untar the tools tarball and run the uninstaller.  The uninstaller is in the bin directory of the vmware-tools-distrib directory you created.
  3. Follow the directions here for getting vmhgfs to work.
  4. Rerun the vmware tools installer in the distribution directory you created in step 2.
  5. Bask in the glow of a job well done :)
  • Share/Save/Bookmark
Author: Categories: Apple, General, Java, Linux, Mac, Programming, Technology Tags: , ,

JasperReports underlining all text in HTML reports in Internet Explorer?

April 2nd, 2009

Last week I ran into an odd situation with our HTML output from JasperReports in Internet Explorer 7.  All text, link or otherwise,  was being underlined and I’m not really sure of the root cause other than it would appear we ran into a CSS rendering bug.   The same thing does not happen in Firefox 3 (though my research indicated that the same issue occurs in Firefox 2).

In rendering HTML output JasperReports inserts various anchor tags of the form:

<a name="JR_PAGE_ANCHOR_0_1">

It doesn’t use these with href attributes but it does use them for some purpose.

Our global CSS file indicates that anything that is inside an anchor tag should be underlined.  This would make sense assuming that anchors are used for links (a pretty good assumption).    We also use the Dojo JavaScript framework and the Dijit ContentPane widget allows using the ContentPane (normally used with a DIV) to show external content.   That external content can be “scrubbed” to allow it to play in a nicer fashion with the overall site design.  That is where the problem occurs.

The scrubbing of the content coming in to the DIV, to filter out things like styles, TITLEs, and other tags, is where IE seems to have issues.  Those anchor tags mentioned previously, and which look fine in IE when previewing a report inside of the iReport designer, now all have text inside them underlined.   The quick fix, or so I thought, was to remove the A tag from our global CSS file.  That fixes things until someone hovers over any text at which point another CSS rule comes in to play for a:hover and all text is again underlined.    Probably time for another CSS tweak…

  • Share/Save/Bookmark

Chart caching issues with JasperReports web output? A solution!

March 24th, 2009

Just a quick posting about an issue I was running in to that was solved pretty easily with a minimal amount of work.  Providing it here as a tip for people new to JasperReports and using it to deliver HTML reports via the web.

The issue I was running in to was caching of report charts when outputting to HTML format.  When JRHtmlExporter creates links to images in the report output it uses the format img_x_y_z[_z_z] where x, y, and z are as follows:

  • x is the index of a document within the list of documents to export in batch mode.
  • y is the page index.
  • z values are a series of one or more element indexes that locate the image on the page,
    looping through nested frames if needed.

(taken from the JasperReports Definitive Guide – pg. 197)

The issue is if you run a report which generates a chart and then rerun the report with similar parameters which doesn’t result in a change to the image name you will end up with a cached copy of the chart image…probably not what you want.

The solution is simple:  when you define your IMAGES_URI paramter for the JRHtmlExporter tack on the current system time as follows:

exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "/jasper/image?time="+System.currentTimeMillis()+"&image=");

In this example I’m using the system time to “randomize” the image url which makes sure that the images are always displayed properly. Note too that I’m using the image servlet that’s included as part of JasperReports.

I hope this helps someone. I was scratching my head for a bit over this one but the solution is pretty simple.

  • Share/Save/Bookmark
Author: Categories: General, Java, Programming, Technology Tags:

Thanks for the Weblogic support Oracle!

March 11th, 2009

I know that it’s a tough thing to move forum contents from one system to another and I know that Oracle and BEA, prior to their buyout by Oracle, had a different forum system than Oracle.   I also understand that Oracle would want to move the Weblogic forum traffic to their own forums once the buyout was complete.   However why didn’t Oracle keep the BEA forums in place in a read-only format?

Seriously.  I’ve been trying to research some Weblogic 9.2 issues I’ve been dealing with and Google results return a lot of hits to the BEA forums.  Clicking on one of those links brings you to the Oracle forums….at the top level of the forums.   It would appear that those postings were never moved.  Again I understand this given the difficulty of moving from one system to another but they should have kept the old system in place for those of us who need to get answers for our Weblogic problems.

The odd thing is that Oracle kept the BEA edocs site in place with the same URL.  Why didn’t they do the same thing with the forums?

Update:

Thanks to Justin for pointing me to the read-only forums.  They are located at the following url:  http://forums.oracle.com/forums/category.jspa?categoryID=202

They still don’t have them at the original URL so that a Google search will bring up the posts but at least they have the data available.

  • Share/Save/Bookmark

We need tagging standards

January 19th, 2009

There really aren’t many types of tagging out there but we need applications and websites to use one method of tagging.

Delicious uses tags separated by spaces.   Wordpress uses tags separated by commas.  I believe the tagging system in most Mac applications that use tagging use the comma method.

Application developers should stick with the comma method.  Spaces limit the usefulness of tags because in many cases an item needs more than one word to have a descriptive tag.    I just tagged this page in my Delicious tags and had to tag it as “writing resources reference”.  I’d love to be able to say “writing reference” or “writing resources” and have those be one tag.  If I want a more descriptive tag Delicious forces me to use hyphens or underscores (writing-reference) which I think doesn’t look clean.

I hope people stop using the “separate tags with spaces” method.  It really isn’t very useful.

  • Share/Save/Bookmark
Author: Categories: General, Java, Programming, Technology Tags: , ,

Remember the Milk customer service? Yeah right.

November 13th, 2008

I’m really frustrated by an ongoing issue with iCalendar feeds coming from my lists at Remember the Milk being consumed improperly by Google Calendar.  And the thing that is most frustrating?  They don’t seem to give a damn that the problem may very well be on their end.

Have a look at the help forum posting here.  The conversation gets real interesting when user wernst starts to do some digging into why the feeds aren’t working.  What he uncovers is that the RTM iCalendar feeds contain an excessive amount of timezone information.   He even sets up a new account, removes everything from the lists so that there are no to-dos and no events, and then grabs the feed.  That feed also contains excessive amounts of timezone information even though it has no events associated with it.   Emily from RTM insists its all about the timezones:

(for anyone curious, those lines describe the timezone; extremely important for ensuring your tasks display at the correct time!)

That’s all well and good but why is the timezone being described, in detail back to the year 1918, for a feed that has no events?  As wernst points out the feeds coming from AirSet, which can parse the RTM feeds, and which he then forwards to Google Calendar, don’t have all of that timezone information and, *gasp*, Google Calendar reads them properly.

So it very well might be an issue on Google’s end but I think it’s pretty clear that RTM is generating feeds, that while valid, don’t work properly everywhere.   I could probably form some valid XML that not all parsers can deal with.  That doesn’t mean I shouldn’t fix the XML to make it easier to parse.  RTMs position is that since Google is grabbing the feeds regularly the issue is out of their hands.   Google may very well be getting the feeds in a timely manner.  That doesn’t mean they’re parsing them properly.

To the folks at RTM:  your customer service in this instance sucks.  I can’t be much more blunt than that.  You had a paying customer do a lot of work for you and you’re passing it off like you can’t possibly have anything to do with the problem since Google manages to at least grab the feeds OK.  BOOO!!!!

I love your application but you guys need some work on the customer service front.  Sheesh.  Google is the 800lb gorilla here.  You’d do well to work with them to figure out what the hell is happening for the many users of both your service and theirs.  Just insisting that the calendar feeds are valid and then closing the posting certainly isn’t going to fix anything.

  • Share/Save/Bookmark

Oddities of running JasperReports with Weblogic 9.2 on Windows

September 25th, 2008

I posted this on the JasperReports forums but wanted also to put it here in case it helps someone out (since I have my Java topic going to the Java Blogs aggregator.

At work I am currently using Weblogic 9.2 running on Windows XP for web application development.  I am also using MyEclipse 6.5 to code and deploy to the Weblogic deployment.  We have also been using JasperReports since version 2.0.5.

For several months I had not been using Windows XP but a Mac. I had to switch due to work rules and just ran into a problem lately where I have not been able to run any reports.   This problem has not been happening on our Linux servers or workstations nor was it happening on the Mac.  The problem was when trying to load a report the application would throw the following exception:

java.lang.NullPointerException
at net.sf.jasperreports.engine.JRPropertiesMap.readObject(JRPropertiesMap.java:185)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
Truncated. see log file for complete stacktrace

I had seen this problem once before when trying to run a compiled report that was compiled with version 2 of the library on a server running version 3 of the library.  A class loading issue was the obvious cause but I couldn’t figure out why in this case because our system has been running JasperReports 3 for awhile now and I hadn’t gone back to version 2 so what was the problem.

Lucian pointed out that in version 3 I shouldn’t be getting this error because the sources for 3.0.1 don’t correspond to the error.  He said it looked like an older version and suggested finding out where the JRPropertiesMap class was being loaded from with:

System.out.println(JRPropertiesMap.class.getPackage().getImplementationVersion());

or

System.out.println(JRPropertiesMap.class.getResource("/net/sf/jasperreports/engine/JRPropertiesMap.class"));

The first call reported that I was in fact using JRPropertiesMap from version 2.0.5 of JasperReports.  Huh?  I haven’t been deploying Jasper 2.05 for ages.  We switched to version 3.0.1 awhile back.  I looked in my build paths for the various modules and only 3.0.1 was there and it was the only version of JasperReports in APP-INF/lib in the deployment.  Where was 2.0.5 coming from?

The second call above located the problem for me.   Weblogic caches things in your domain and it was caching, and loading, Jasper 2.0.5. In fact I had 4 versions of the library in there: 2.0.5, 3.0,3.0.1, and 3.1.0. On my system this location is located at “C:/opt/bea/user_projects/domains/f58_domain/servers/AdminServer/tmp/_WL_user/_appsdir_rocketscienceApp_dir/r6vnzf/APP-INF/lib/”.

Problem solved but I really don’t get what is going on here because it has been months since I deployed 2.0.5 with the application and the Windows XP machine I’m using now is brand new with a new install of WebLogic.  I copied over my workspace from the Mac and maybe thats where the problem started but I still find that improbable since a coworker, who’s on Vista, is also having the same problem.    Only the Windows boxes are having the problem.

Very odd indeed but at least I won’t be losing any more hair over this one.

Thanks again to Lucian for pointing me in the right direction!

  • Share/Save/Bookmark
Author: Categories: General, Java, Programming, Technology Tags: ,

Chrome is the new black? (Google Chrome that is)

September 10th, 2008

“If JavaScript gets any faster, then developers will question if they should develop in Flash or (Microsoft’s) Silverlight (technologies),” – Marc Andreessen 9/9/08

That quote was talking about Chrome, which, if you’ve been reading any tech journalism as of late, is Google’s new browser (currently Windows-only).   Granted  Andreessen gets props for the Mosaic and Netscape browsers, big props even.   That being said I think he’s way off.

As great as the Chrome JavaScript engine (V8) sounds it’s only part of the puzzle when considering using HTML/JavaScript in place of Flash or Silverlight.  Fast JavaScript?  Great.   What about everything else a Flash or Silverlight application provides like, in the case of both, platform/browser independence, or in the case of Silverlight alone, multiple languages in which to create a program.  With Flash or Silverlight I don’t have to worry about using a JavaScript library that has to take into account all of the weirdness of each of the different browser implementations of JavaScript.  I don’t have to worry about CSS implementation differences between browsers.  And I don’t have to worry about HTML at all.

And while Chrome and the V8 JavaScript engine might be fast the folks at the Mozilla project haven’t exactly been sitting still.   TraceMonkey is also a JIT-ing JavaScript compiler, and in fact in benchmarks TraceMonkey is faster than V8 and is open-source as well (not to mention that the father of JavaScript, Brendan Eich, is working on it).

Listen, don’t get me wrong, I like Chrome.  I think they’ve brought some interesting ideas to the table like the idea of having each tab in the browser operate in it’s own process.  There are a lot of good things about Chrome and it’s good that it’s open source but in the end it’s Google and they’re pursuing this project for their own interests.   If applications only target Chrome (because of V8 and the built-in Gears functionality) where is the win?

At this point I just don’t see why Chrome is a big deal.  Firefox still offers more and they’re not sitting still on the features front.  Flash and Silverlight have nothing to worry about with Chrome right now or the foreseeable future.   I guess Chrome really isn’t the new black.

  • Share/Save/Bookmark

Running JasperReports with subreports in an app server environment

July 29th, 2008

I’ll start with the moral of the story: read documentation carefully as it may contain the answer you seek.  These things are covered in the pay-for documentation available from JasperSoft but you have to skip around a bit to get what you need.

With that out of the way I’ll note that if you don’t buy The Definitive Guide to JasperReports (or support for that matter) you don’t seem to have many good options for documentation aside from the forums which are hit or miss at best.  And with the new version of the  JasperForge website, which is unfortunately worse than the old one, even that is a dicey proposition.  Because I now have clarity on how to get subreports working in an application server environment I’m going to share with others that they may avoid the struggle I did ;)   In my particular case the application server is Weblogic 9.2 but I suspect the application server itself is irrelevant.  The issue is with how JasperReports runs embedded subreports.

Briefly, the default method to run subreports is to use multiple threads.  Each subreport inside a report gets its own Runnable via a call to JRThreadSubreportRunnerFactory.createSubreportRunner().   The default subreport runner is set via a property net.sf.jasperreports.subreport.runner.factory in the file default.jasperreports.properties (located in the JasperReports jar file).  The default for this is net.sf.jasperreports.engine.fill.JRThreadSubreportRunnerFactory.  Unfortunately this doesn’t work so well in an environment that discourages the use of multiple threads like an application server environment.

The solution from the guys at JasperSoft was to refactor the subreport runner facilities so that interchangeable implementations could be used. The facility that should be used to run reports with embedded subreports in an application server environment is JRContinuationSubreportRunner and it’s corresponding factory JRContinuationSubreportRunnerFactory.   These require a different version of the JasperReports jar file as well as an additional jar from the Apache Commons project both of which are included with the JasperReports distribution.  We now need to use jasperreports-2.0.5-javaflow.jar in place of jasperreports-2.0.5.jar (in my case….your case migh be a different version number).  We also need to use commons-javaflow-20060411.jar.

So we’re good right?  Problem solved.  Well…not so fast.  There are some oddities that need to be dealt with first.

  1. In the javaflow version of the JasperReports jar the default is still to use the threaded version of the subreport runner instead of the continuation version.  Huh?  Since we’re specifically using that version of the jar shouldn’t the default actually be the continuation version of the subreport runner?
  2. The javaflow version of the jar still contains the threaded subreport runner which is kind of confusing.  I’m not sure why I’d want to use that since I’m already using a special version of the jar anyhow to *avoid* threading issues.  I suppose it provides a fall-back but to me it’s confusing.
  3. The regular jar file contains the continuation version of the subreport runner but you can’t use it since it isn’t instrumented for javaflow use.  Again this is confusing and I can’t understand why those classes are there if they can’t even be used.  If you try to use it you get the following stack trace:

    java.lang.IllegalStateException: stack corruption. Is class net.sf.jasperreports.engine.fill.JRContinuationSubreportRunner instrumented for javaflow?
    at org.apache.commons.javaflow.bytecode.StackRecorder.execute(StackRecorder.java:102)
    at org.apache.commons.javaflow.Continuation.continueWith(Continuation.java:170)
    at org.apache.commons.javaflow.Continuation.startWith(Continuation.java:129)
    at org.apache.commons.javaflow.Continuation.startWith(Continuation.java:102)
    at net.sf.jasperreports.engine.fill.JRContinuationSubreportRunner.start(JRContinuationSubreportRunner.java:57)
    Truncated. see log file for complete stacktrace

    If I can’t use it why is it there in the first place?

The last “gotcha” is the need to set up a properties file so that you override the default of using the threaded version of the subreport runner.  This is an easy workaround however as it only requires a couple of things:

  1. Set a system property called net.sf.jasperreports.properties that points to a properties file that contains the required JasperReports properties.  It doesn’t need to be a specific one for JasperReports if you already have a properties file for other things.  It can point to that or you can create a new one.The other thing to note about this is that you only need provide the properties that you have to override.  The reporting framework is set up to use defaults for the ones you don’t provide.  If you’re paranoid copy the one that comes with the jar file and change what you need in there and point to it with the property mentioned above.
  2. Paste the following in that properties file:
    net.sf.jasperreports.subreport.runner.factory=net.sf.jasperreports.engine.fill.JRContinuationSubreportRunnerFactory

Now everything should work.  Let’s recap the steps:

  1. Add the jasperreports-2.0.5-javaflow.jar to your classpath (or whichever version of JasperReports you are using).
  2. Add the commons-javaflow-20060411.jar to your classpath (or whichever version ships with your version of JasperReports).
  3. Set a system property called net.sf.jasperreports.properties that points to a properties file that contains the required JasperReports properties.
  4. Paste the following in that properties file:
    net.sf.jasperreports.subreport.runner.factory=net.sf.jasperreports.engine.fill.JRContinuationSubreportRunnerFactory

I hope this post is useful to someone.  I didn’t struggle all that long with this but I definitely would have appreciated having some good documentation without having to pay for it.

Update: As of JasperReports 3.0.1 Steps 3 & 4 above should no longer be necessary as the JRContinuationSubreportRunnerFactory is now the default.

  • Share/Save/Bookmark
Author: Categories: Java Tags: , ,