Emailing a webpage from the command line

There are many situations whey you have information on a web page that needs to be emailed to individuals on a regular basis. Often times all that is needed is some type of script that will grab a URL, put it in an email and send it to the correct person. This article is going to look at some of the tools that can be used to do this. I’m testing it on OS X, but it should work under Linux, Unix and possibly Cygwin as well.
Continue reading “Emailing a webpage from the command line”

Using Javascript to Refresh Parent

First let me say that I’m not a huge fan of Javascript. I understand the need for Javascript, but generally I prefer to program for a server environment instead of worrying about the client. However I ran into an issue this week that required Javascript, so here is what I learned about refreshing a parent window.

I had a web page that would list a bunch of items. Users needed to be able to click the “add” button and open a pop-up window that would let them choose an item to add to the list. The pop-up window displayed a hierarchy of choices so users had to click on it several times in order to make their selection.
Continue reading “Using Javascript to Refresh Parent”

Dealing with Slow XSLT Transformations

I have some XSLT stylesheets that I use to integrate information from Amazon with my reading list on my website. This weekend I decided to create another list using Amazon’s “People Who Bought this Book also Bought” feature. After a couple generations of downloading books that were related to books I read, I ended up with an XML file with about 1,500 books in it. I tried running the transform using Xerces and it took 13 hours.

Obviously this wasn’t going to work, so I refactored parts of the XSLT and was able to cut that time in half. 6 hours still seemed like it was taking far too long. I considered doing away with the stylesheets and doing the transforms manually using Java to write directly to a file. After doing some searches I discovered that apache.org has a good solutions for this problem that is part of the Xalan-J project. Basically it allows you to take an XSLT stylesheet and compile it into java byte code called a “translet”. You can then run the transform using Xalan and the compiled java translet. This makes things run much quicker. It appears that this is because the transform doesn’t need to deal with the XSLT file and because of other optimizations.
Continue reading “Dealing with Slow XSLT Transformations”

Running out of Memory with Java

The other day when doing some particularly large xslt conversions I kept running out of memory in the JVM. After doing a bit of research I found two command line arguments that help solve the problem. -mx allows you to set the maximum size of the memory allocation pool while -ms allows you to set the starting size.

For example:
java -ms50M -mx1000M ProgramThatNeedsLotsOfMemory

will execute ProgramThatNeedsLotsOfMemory with a starting memory allocation of 50M and let it grow up to 1GB. You can also use K to specify the memory size in kilobytes, but I’m not sure why that would be useful unless you are on a machine with very little memory.

After looking into the documentation a little more it appears that the new syntax for these commands is -Xms and -Xmx, so you’ll have to choose the one that works depending on your version of the JVM.

Home Theater

When we started looking at finishing the basement at our house, I really wanted to put in a home theater. Eventually we ended up with a 6 seat theater with a 12 foot screen and surround sound. The total cost was less than you might pay for a large screen television and it was a lot of fun to setup. Now instead of going to the theater and paying $6 to $8 per ticket, we rent a video and have friends over to the house. Here is how we set things up.

Yahoo has a credit card that earns points that can be redeemed for SuperCertificates that can be redeemed for Amazon.com gift certificates that can be redeemed for Amazon merchandise. It is rather round about, but we were able to get our projector for free using the method. It took 2 years of saving our points, but we weren’t in a hurry and it was a lot easier to justify the projector when we got it for free.

InFocus X2 Multimedia Projector ( PC / Mac )The projector is an InFocus X1A DLP Multimedia Video Projector. I believe it has now been replaced by the InFocus X2 Multimedia Projector which is a little brighter, but very similar. Both projectors have a theater mode that helps keep the color realistic like film. Many “business presentation” projectors distort the color in order to make a brighter image so they don’t look as good for watching movies. The X1 can handle a wide variety of inputs making it idea for a budget home theater where you may want to start with your existing components and upgrade in the future.
Continue reading “Home Theater”