Friday, May 28, 2010

In Reponse To...

This blog post is in response to Mark Stephens who wrote a comment to my JPedal LGPL Direct Links blog post. Thank you Mark for your comment. I'd like to reply to it here, since I'm likely going longer than a traditional comment block would support.

Here is Mark's comment:
Adam,

Its done automatically and you are taken straight to the page with the download links on. As you say, you don't even need to post a valid email address if you are paranoid.

We just ask for an email address so we can get an idea where the software is being downloaded from. IS that so unreasonable?

We go to a lot of trouble to make a version of the software freely available, we spend our lives updating it and answering questions on the forums and wonder why we bother when we see your comments...

Thanks again Mark, I appreciate the dialog.

First, you're right, currently the download link to the LGPL JPedal viewer is available on the page after submitting the 'name and email' form (I just tried it out). However, this was NOT the case when I wrote the blog post originally. I had to wait for an email to be sent to me in order receive the download link location.

So, kudos to you guys for changing your form. If it had been this way originally, I wouldn't have written my post. I think it's perfectly acceptable for you to ask for name and email, if you choose. According to the LGPL, you can even charge for downloads of your Free Software.

With the previous procedure, I had to post a valid email address, so being paranoid was not an option. This was because, again, the links were not present on the page following the form submission. I even tried an @mailinator.com email address waiting for the links that way, again with no luck. This gave rise to my suspicion that a manual process was in place, since Mailinator email addresses tend to get through otherwise.

So no, in my opinion, what you're doing (now) is not unreasonable to ask. What is unreasonable, in the spirit of Open Source Software, is to expect valid data to download your software (in this case, valid email). Though, of course, not required by most (all?) open source licenses, many Free Software advocates tend also to be privacy minded and expect to be able to download anonymously and for free. And if we can't, we assert the rights which you gave us, to legally distribute your Open software (for free) or, at the very least, do what I did and provide the direct download links.

This is all, therefore, water under the bridge. Your new procedure changes the need for me to provide direct download links to your software. Like I said, I wouldn't have written my original post if it had been the case.

Your second argument, however, doesn't hold water. You seem to suggest that you are going out of your way to make your software available to the open source software community for some benevolent cause. That you are heavy burdened by your LGPL initiatives.

The fact is that releasing an Open Source version of your software benefits you and supports your business model, because otherwise, you wouldn't have done it to begin with. In your case, you are hoping to provide an upgrade path from LGPL users to commercially licensed users, by removing support for printing and extraction in your LGPL product. In your business model, you are releasing your software as LGPL somewhat as a taste of the full package, almost like a limited trial edition. What you're doing is no more about Free Software (capital F) than what a "freeware" publisher is doing.

If you are "spending your lives" supporting your free software version without any direct or indirect benefit, then if I were you, I would be questioning your involvement. If you are so burdened by your support of the LGPL version, since you are obviously strictly motivated to this release for financial reasons, then I am just not seeing that the math is working out for you.

I have no idea why you took such offense at my original post, but if Open Source is not benefiting your business model (now or in the future), then honestly we (the Open Source Community) really don't want your code. If you are strictly in this to support your bottom line, and you are so bothered by posts like mine or support/complaints in your forums, then maybe you should just stop. It would be sad to lose your contributions, but it's better this way.

We, the OSS community, want partners and contributors who are supportive and happy about our cause. And, if you are able to make a buck in the process, even better. We have no problem with that either.

However, to imply that you are somehow burdened by the support of your software without rewards, or that you expect some sort of kissing of your backside because of your contributions, well, maybe it's time to say goodbye. We'd hate to see you leave, but rather that than to know that you are somehow dissatisfied with the Open Software Value Proposition. It's no skin off our backs, either way.

Friday, April 23, 2010

Open Source Java PDF Viewing Library Review

Here's a quick review of three open source Java based PDF libraries which can be used to view PDF documents in a Swing application. While there are some very good PDF generation libraries (iText and friends), there are fewer libraries which help render a PDF document into a type suitable for viewing in Swing.

JPedal
http://www.jpedal.org/

I've used JPedal in previous projects. It seems to work decently, but looking at the source code, the project is very disorganized and likely prone to bugs.

In my previous project, I had always exited my application by calling System.exit() or using the EXIT_ON_CLOSE parameter to the default close operation on a JFrame. It wasn't until playing with JPedal in a new project that I realized JPedal is hanging my swing app and preventing it from shutting down if my frames are simply disposed of. That is, if after having rendered a PDF document using JPedal, an application won't shutdown without having issued a System.exit().

I couldn't even find a single JPedal example where they used anything but System.exit(), so it seems they're probably aware of the problem and possibly hiding it? Don't know. I tried every combination I could find to cleanly close and dispose the JPedal resources to no avail. After looking at the source code, it doesn't necessarily surprise me.

I gave up on JPedal and was forced to move onto other choices.

PDF Renderer
https://pdf-renderer.dev.java.net/

This is/was a Sun sponsored open source project started by a few key Swing developers. I have met Richard Bair in person and he's a real great guy. So, this seemed like a logical next project to take a look at.

The API is by far the easiest to use. It's very simple to get a Swing based view of a PDF document up. However, the library currently only supports older PDF document versions. I have read that there is a patch available to allow rendering of new PDF. *bah* I was hoping for a solution that didn't require building the code myself. And, it somewhat looks like the project has stalled, which shouldn't be surprising given Sun's push on JavaFX and now Oracle.

Onto the next project.

Apache PDFBox
http://pdfbox.apache.org/

This turned out to be a good working solution. The API is a bit more confusing than the other two, and I couldn't seem to find an existing Swing component to render a PDF. But, the PDPage class of PDFBox has a convertToImage() method which returns a BufferedImage. So, it was fairly easy to take the generated image and draw onto the canvas of a JComponent.

My conversion code looks something like:
PDDocument doc = null;
try {
 doc = PDDocument.load(inputStream);
 final PDPage page = (PDPage) doc.getDocumentCatalog().getAllPages().get(0);

 PipedInputStream pis = new PipedInputStream();
 final PipedOutputStream pos = new PipedOutputStream(pis);
   
 new Thread(new Runnable() {
  @Override
  public void run() {
   try {
    ImageIO.write(page.convertToImage(), "png", pos);
   } catch (IOException e) {
    e.printStackTrace();
   }     
  }
 }).start();

 // create image panel
 JPanel panel = new ImagePanel(pis);
   
} finally {
 if (doc != null) {
  doc.close();    
 }
}
My ImagePanel requires an InputStream (for reasons specific to the application), thus why the use of the I/O pipes. I also wish I knew a better way to get just the first page of the PDF document (without a call to getAllPage()), since this is all I was interested in (the application is generating a preview of the first PDF page).

PDFBox renders the newest PDF documents (from what I can tell), so this is good. Like I said, the API is a bit more difficult to learn, though it's now seemingly straight forward (as can be seen from the above). PDFBox is also in the Maven central repository, which is great for Maven development. All in all, I'm pretty happy with PDFBox.

jPodRenderer
http://opensource.intarsys.de/home/en/index.php?n=JPodRenderer.HomePage

I just found jPod tonight, having skipped over it a few times when searching. It actually looks pretty promising, especially since they have a specific renderer which will render to both AWT and SWT. So, that's cool. Looks like they have dependency on quite a few jars, though, and they don't seem to be in the central Maven repository, which stinks because of the dependencies. Anyway, if anyone has a review of jPod, send a link my way; I'd like to read about it.

Updated May 28th, 2010.
ICEpdf
http://www.icepdf.org/

Thanks to Mark Stephens at JPedal for providing this link. I wasn't aware of the project.

Friday, April 16, 2010

JPedal LGPL Direct Links

I get tired of the hoops some companies expect you to go through to download the Free Software versions of their products. JPedal, a PDF viewing library for Java, is one such example. They have an LGPL version of their library, but you must fill out a form asking for email and name in order to get it. Big deal, right? Just make something up, right? Seems like they have someone manually processing these requests, which means delays in getting what you need.

This is Free Software, isn't it? So, here are the direct links to the JPedal LGPL licensed software:

Binary: http://www.jpedal.org/download/lgpl/jpedal_lgpl.jar

Source: http://www.jpedal.org/download/lgpl/jpedal_lgpl_src.zip

p.s. According to the source, the latest version (as of this writing) is: 4.11b76

Monday, February 15, 2010

Simple Java Event Bus

I've just released some code that has come in handy for quite a few projects I've worked on. It's called the Simple Java Event Bus and is released under the New BSD license. You can download the code here: http://code.google.com/p/simpleeventbus/

An event bus is a useful pattern for decoupling the components of a highly meshed application. Event bus is a substitute for the Observer pattern, useful when too many observers/observables exist to keep a clean design. Components can couple directly to the EventBus instead of to each other, allowing events or messages to be published to the bus. Listeners to the bus will then be notified about the event if they have interest in the event type.

I have used other event bus implementations in live code. However, I have found that the above library to be the most simple to use and to get started quickly with. Hope you can benefit from the code as well.

Monday, December 14, 2009

Tuesday, November 3, 2009

Economics in One Lesson

This is one of those links you tuck away and revisit when you need a fresh perspective or a reset of values when things are hazy...
Economics is haunted by more fallacies than any other study known to man. This is no accident. The inherent difficulties of the subject would be great enough in any case, but they are multiplied a thousandfold by a factor that is insignificant in, say, physics, mathematics or medicine-the special pleading of selfish interests. While every group has certain economic interests identical with those of all groups, every group has also, as we shall see, interests antagonistic to those of all other groups. ...
Economics in One Lesson

Tuesday, October 13, 2009

So You Want to Learn Japanese

You’ve eaten at a few Japanese restaurants, seen some anime, hosted an exchange student, and had a Japanese girlfriend. And now, somewhere in the back of your tiny brain, you think that Japanese would be a good language to learn…

http://pepper.idge.net/japanese/

Wednesday, June 24, 2009

How Much Student Loan Debt is Too Much?

How much student loan debt is too much? Anything over $0.00 is too much. It's that simple. There is absolutely no reason (and no return on investment) for a student to go high into debt at an expensive school than to stay locally and pay in-state tuition at a state school. The differentiation between the education at the "upper end" schools (which are exponentially more spendy) vs. the traditional state schools is insignificant.

On average, tuition for in-state schools is around $6000 / year (two semesters). That's literally $500 / month. Who can't afford that? Simple budgeting and cash flow affords that education. For $12000 / year, or $1000 / month, a student can stay at the dorms with a meal plan. What's exactly wrong with flipping a burger or delivering a pizza while attending school? How hard exactly is it to earn $1000 / month??

See, the "entitlement" mentality is infecting us, and debt has become the facilitator to these entitlements. It's absolutely criminal that parents are setting up their children for a large debt obligation right at the start of their adult life. Student loans are particularly nasty, since they don't disappear during bankruptcies, etc. How many people do you know in their 30's and 40's still paying off student loan debts? I actually knew this number at one point, but have forgotten, but it's exceptionally high.

My children are going to earn their way through school. I hope to have saved a little up for them, of course, and I hope they get scholarships. But, ultimately I hope they learn the value of hard work, budgeting, and staying off the American crack which we call debt.

Wednesday, March 4, 2009

The New Urkel


Received this in my inbox... Pretty funny.

Tuesday, February 17, 2009

The Greatest Shortcoming of the Human Race

"The greatest shortcoming of the human race is our inability to understand the exponential function." -- Dr. Albert A. Bartlett

http://www.youtube.com/watch?v=F-QA2rkpBSY

(this is the starting section of the whole video, part 1 of 8)

Thursday, January 15, 2009

Ask a Ninja Identity Revealed

I've just revealed the secret identity of the famed ninja from Ask a Ninja... The voice and mannerisms are too close to be coincidence.

Start watching (and listening!) at around 2:13...

Elmo Live Reveals the Ninja's Identity

Note that the ninja in the opening intro sequence of all Ask a Ninja episodes has blue eyes, while the ninja in the actual episode has brown and is a little slimmer. This fits because the lab tech in the Elmo Live video clearly has brown eyes.

This will obviously be my last post, as I assume a painful and long drawn out death. Perhaps simply even typing these words, the power of the ninja will reach through the internet, up into my computer, and {#`%${%&`+'${`%&NO CARRIER

Friday, December 5, 2008

Proof of Global Warming

Daddy, is Santa Real?

What follows is from my archive (a previous blog) from 2006...

---

I'm a proud father, though I'm frustrated too. What can you do about some things but to just shake your head and wonder.

I'm a member of the Ogden Athletic Club. One of the biggest selling points for the club (in my mind) is the nursery care they provide for young children. My experience with their childcare has so far been mostly positive, but I have to write about an incident that happened a week or two ago.

My daughter, 3 years old (almost 4), was in tears on the way home from the club. My wife had picked her up from the nursery and relayed to me what had happened that made my little princess so distraught.

A fellow boy had apparently mentioned something about Santa Claus, probably about all the toys Santa was going to bring him. You know, something typical and innocent to say around Christmas time. My daughter, with a pure heart and only good intentions, promptly informed the boy that in fact Santa wasn't real, that he's just make believe and that Santa would not be bringing him any presents.

What's a strong willed girl to do but to set the young man straight? It's my daughter's nature to try and help out when and where she can. She's very smart and understands things at a level most children her age don't. When someone says something she inherently knows is wrong, it's her duty in life to inform them the truth. What's a smart strong-willed 3 year old supposed to do?

So my wife walks in after the situation had apparently cooled down some, but there was still tension in the air. Apparently, many of the kids were offended by my daughter's words, they were yelling at her and she was left to defend her position basically alone. "Well, who brings us the presents then?" asked the boy.

"Our parents give us presents," was my daughter's reply.

One nursery assistant, having her own child in nursery that day, promptly grabbed her daughter and dragged her away from the situation. She was so afraid of her daughter hearing that Santa wasn't real, to hear the truth. Why not take that opportunity to teach the child? Teach your child that some people have certain beliefs, and that others have other beliefs, and that it's all ok for each to have their own.

I get the feeling that the nursery staff was a little peeved at my daughter's actions. My wife described the tension in the air, and I would believe it given that no teacher intervened in the verbal argument between my daughter and the rest of the class.

I can't expect her to know all the nuances and dances we perform to keep the cultural Santa mythology going. She's not a politician yet, she just tells it like it is; 3 year old's don't have a sense of political correctness. Just as true as it was in my daughter's mind that Santa wasn't real, it was true in the boy's mind that Santa was real. It's black or white for this age, there is no understanding of gray issues, political correctness, or historic fictional characters.

In my daughters mind, God is real and Santa is make believe, and I frankly like it that way. I can understand why the boy felt so offended and confused (my daughter contradicted the boy's parents). And I understand why my daugther was in tears over getting verbally ganged up on by her peers.

What I don't understand is why we continue to lift up Santa, yet put down God. Why do we lie to our children and let them so wholeheartedly believe in something that in a few short years they will realize is not true. Wouldn't it be better telling our children that Santa is just a fictional figure head, someone who is fun to talk or pretend about, something to tickle our fancy and imaginations like any good story book? As opposed to setting them up for disappointment and breaking trust in their parents?

I want my children to wholeheartedly trust me with everything. I will only ever tell my children the truth, because I want to model and teach them true faith, true trust and love. Setting our children up for disappointment by perpetuating a lie burns bridges and makes our children's hearts callus.

My biggest disappointment is with the nursery workers. Their inaction speaks volumes. Their inability to act and deal with the situation really demonstrates how sacred the lie of the Santa Christmas has become. The original St. Nicholas advocated people sell their goods and give to the poor. Shouldn't that be what Santa is all about? Shouldn't that be what we're teaching our children?

MPF File Extractor

I always thought that the .mpf file extension was a proprietary file format used with Microsoft's Clip Organizer product or via their online clipart gallery. In fact, it's not very exciting or difficult to extract clip art (or I assume other media) from the package file, since it's only an xml file with the clipart files encoded as Base64 inside.

I have a legal copy of the Clip Organizer product. However, I don't necessarily install it (nor want to) on every computer. But, I do make extensive use of Microsoft's online clipart gallery which means I get a lot of ClipArt.mpf files lying around.

Searching, I found a PERL script to extract mpf files. But, I don't use Perl regularly, so getting the right perl modules installed wasn't exciting. I decided it would just be easier to write a parser / extractor in Java. If you're interested, here is the (free) java source code.

The class requires the Apache Commons Codec library to be in the classpath.

Friday, October 24, 2008