Beginning Astrophotography

August 5th, 2010

It’s been quite some time since I posted anything about photography, but lately I’ve gotten the bug for astrophotography.
I spent quite a bit of time searching the web for information about astrophotography, what kind of equipment is required, how much it costs, etc.
Decent telescopes can be had for a few hundred dollars, and Dobsonians seem to provide a very good value for beginners. Not surprisingly, though, it takes a lot more money to set up for astrophotography.

Reading some more, I discovered that while it can be expensive to set up all of the equipment for photographing planets and deeper-space objects, interesting photographs of the sky can be taken with a digital camera, wide-angle lens, and tripod.

This is my first attempt – a 30-second exposure with my Nikon D70s, 18mm-70mm lens set to 18mm. I used a DC-1 wired remote to trip the shutter.
The sky was cloudy, and I could only see one star (the brightest one in the photo), but the long exposure captured many more stars.

Cloudy Night Sky, Lambertville NJ - 5 August 2010, 10:00PM EDT

Click the image for a larger view

For a first attempt, I think it came out great – much better than I expected.
I’m pretty excited about going to northern Ontario, CA next week. It’s extremely rural there, and there should be some great night skies.
The Perseid meteor showers should be at their peak, and I’m hoping to get some great meteor shots.

An Open Letter To jQuery Plugin Authors

July 17th, 2010

The following applies to the authoring of all software libraries, not just jQuery plug-ins, but I’ve been looking at lots of jQuery UI widgets lately, so….

As the author of a shiny new jQuery plug-in, I’m sure that after all of your hard work, you would be very pleased to have other programmers / web developers actually use your plug-in.
For many of you, that’s just not going to happen. Here’s why:

1. Documentation is not optional. Code samples are really nice to have, but are not a substitute for complete and accurate documentation.

I can’t tell you how many jQuery UI widgets I’ve looked at that have no documentation (“I haven’t had time to write it yet”).
There’s a little thing in the software community known as the “ten minute test“. If I can’t figure out how to use the major features of your library/widget/plugin in ten minutes, I’m not going to spend any more time on it, no matter how “great” it is.

2. For data-bound UI widgets, Ajax support is not optional. Nor is adding / editing / deleting data programmatically after the widget is first rendered.

Transforming html into a data widget (e.g. an html table into a grid) is great for a demo, but most real-world applications will need data from a server.

3. For data-bound UI widgets supporting Ajax, JSON support is not optional.

No – I’m just not going to use XML. Get over it.

4. For data-bound UI widgets supporting Ajax, data samples are not optional.

It’s nice to provide server-side code samples for producing the data that the widget consumes, but they are no substitute for actual examples of the xml and JSON data.

I don’t generally program in PHP, and I’m not going sit and decipher your sample PHP code to try to figure out your data format.

Folks who are contemplating using your plug-in are programmers, and should be able to figure out how to produce the required data format in their chosen server-side language – just tell them what it is.

Walnut Chocolate Chip Cookies

April 24th, 2010

This blog is mostly about computer programming, but I’m a fairly serious foodie, so I occasionally post a favorite recipe. I see that it’s been almost a year and a half since my last recipe, so I guess it’s about time!

I make these chocolate-chip cookies more often than I probably should, but everyone always raves about them :-)
The recipe is basically the one from the back of the Nestle semi-sweet morsels package, but with a few tweaks and techniques.

I think that the major difference is the addition of finely-chopped walnuts, instead of “chopped” nuts – it gives the whole cookie a wonderful walnut flavor.

Ingredients:

  • 2 1/4 cups all-purpose flour
  • 1 tsp. baking powder
  • 1 tsp. salt
  • 1 cup (2 sticks) butter, softened
  • 3/4 cup granulated sugar
  • 3/4 cup packed brown sugar
  • 1 tsp. vanilla extract
  • 2 large eggs
  • 2 cups (1 12 oz. package) semi-sweet chocolate chips (I use Ghirardelli, but Nestle is fine too).
  • 1 cup finely chopped walnuts

Preheat your oven. The Nestle recipe says 375° F, but this depends on your oven. I have a convection oven, so I wind up using 325° F

Combine the flour, baking powder, and salt in a small bowl.

Put the butter, granulated sugar, brown sugar, and vanilla extract into the bowl of a stand mixer, and beat until creamy

Add the eggs, one at a time, beating well after each addition.

Gradually beat in the flour mixture until well mixed.

Put mixer on lowest setting, and gradually add the nuts and chocolate chips, mix through.

The next part can be done simply, but works best with some special equipment – a cookie scoop and air-insulated cookie sheets.

Using a cookie scoop (or a heaping teaspoon), drop 12 cookies onto each cookie sheet, and bake:
This is where your mileage will vary somewhat – you’ll probably have to experiment a bit to get the timing and rack position right.
In my convection oven, it takes about 12-14 minutes. If baking 2 sheets at a time, switch their positions halfway through.

Remove cookie sheets, and let cookies cool for 10 minutes or so, and then remove them from the cookie sheets, and put on a wire rack to cool.

Enjoy!

Running Roo Applications in Tomcat 5.5

April 19th, 2010

spring logo

I used Spring Roo for a small, public web application recently, and all went well until I attempted to deploy it on a hosted VPS.
The application didn’t deploy, and I got the dreaded error message:

java.lang.NoClassDefFoundError: javax/el/ValueExpression

A little poking around led me to this Roo bug report that details the problem. Roo generates a dependency in your pom.xml that isn’t supported by Tomcat 5.5

I was developing and testing the application on Tomcat 6, and failed to check what version of Tomcat was available for deployment.

The fix for this issue is to swap out the version of the jstl library in your pom.xml

Replace

         <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>com.springsource.javax.servlet.jsp.jstl</artifactId>
            <version>1.2.0</version>
         </dependency>

with

         <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>com.springsource.javax.servlet.jsp.jstl</artifactId>
            <version>1.1.2</version>
         </dependency>

and your Roo application should work fine in both Tomcat 5.5 and Tomcat 6

Remote-Control Your Linux (or other) Computer With Your iPhone

March 25th, 2010

Mac users have long had a plethora of apps and devices for remotely controlling their computers. A frequent use for this is controlling presentations when presenting to a group, with a laptop connected to a projector.

I wanted this functionality for my Linux (Ubuntu) laptop, while using OpenOffice.org’s Impress application, but thought that I was just out of luck. Recently inspired to search again, I found that there are a few iPhone applications that act as VNC clients.

ControlPad

I purchased and installed Tienshaio Ma’s ControlPad app. It’s not a full VNC client (no display), but a remote keyboard/mouse that uses the VNC protocol. I installed it, enabled VNC on my laptop, and everything just came up working as advertised. I can now very easily control Impress from my iPhone.

Congratulations and thanks to Tienshaio Ma – I highly recommend this app. It should work just as well on any OS that supports VNC.

Integration Testing Applications With System Time Dependencies

March 23rd, 2010

I’m about to start working on an existing web application that has business rules concerning the timelines of processes.
Things like “when X happens, if it’s been more than 14 days since Y happened, do Z”.

Believe it or not, in the past, this has been integration-tested by doing Y, waiting 14 or more days of actual wall time, and then doing X, then observing the result.
It makes testing really take a lot of time!

So, how to test this sort of thing properly, yet in a reasonable amount of time?
The naive answer is to simply do Y, set the system clock forward 15 or so days, do X, and observe the result.

In practice, however, this can cause some considerable problems – especially if the application server isn’t the only thing running on that hardware that cares about the system time.
It also means that you have to disable auto-updates to the system time via NTP.

Thanassis Tsiodras over at the Software Engineering Laboratory at the National Technical University of Athens has published this code that can be used to modify the system time for a single application in Linux.

I modified his code slightly to allow the time offset to be read from an environment variable:


#include <stdlib.h>
#include <stdio.h>
#include <dlfcn.h>
#include <sys/time.h>
#include <time.h>

/*
Modified version of http://users.softlab.ece.ntua.gr/~ttsiod/tricks.html#timewarp
*/
int offset_in_seconds()
{
 static int firstTime = 1;
 static int offset = 0;

 if(firstTime)
 {
 firstTime = 0;
 char * offsetParm = getenv("OFFSET_IN_SECONDS");
 if(offsetParm == NULL)
 {
 offsetParm = "0";
 }

 offset = atoi(offsetParm);
 }

 return offset;
}

int gettimeofday(struct timeval *tp, struct timezone *tzp)
{
 int ret;
 ret = __gettimeofday(tp, tzp);
 tp->tv_sec += offset_in_seconds();
 return ret;
}

int (*oclock_gettime) (clockid_t clk_id, struct timespec * tp) = NULL;

int clock_gettime(clockid_t clk_id, struct timespec *tp)
{
 static int firstTime = 1;
 int ret;
 if (firstTime)
 {
 firstTime = 0;
 oclock_gettime = dlsym(RTLD_NEXT, "clock_gettime");
 }
 ret = oclock_gettime(clk_id, tp);
 tp->tv_sec += offset_in_seconds();
 return ret;
}

It should be pretty simple to use this to run your favorite app server for testing.

Keeping It DRY – Automation of Repetitive Tasks

February 26th, 2010

I’m woking on a “legacy” Java app that’s written in Struts and uses EJBs. No Jetty or Tomcat for me – gotta use a “real” J2EE container – in this case, JBoss.

Unfortunately, I haven’t figured out a good way to run JBoss against my sources, as I would if using something like the jetty or tomcat plugins for maven.  So I find myself redeploying the app frequently when working on the UI.

Of course, JBoss is only good for a handful of redeployment cycles before it goes four paws up with a “java.lang.OutOfMemoryError: PermGen space” error. And when it does this, the processes must be killed. On Linux, this involves doing a “ps” command to find the process ids, and then using the “kill” command to kill them. Easy stuff, but very repetitive.

I’m a big fan of the “Pragmatic Programmer” Series of Books, so I quickly thought of the “Don’t Repeat Yourself” (DRY) principle put forth there.

The result? A simple shell script for killing JBoss:

ps -ef | grep jboss | grep -v grep | awk '{print $2}' | xargs kill -9

Relative Cost of Printing On Different Printers

January 2nd, 2010

I have an ancient, yet trustworthy HP6L black-and-white laser printer that I bought back in 19??

About a year ago, I replaced the last of a long line of crappy ink-jet color printers with an HP-CP1815ni color laser printer.

I assumed that for printing in black-and-white, the 6L, being black-and-white only, would be cheaper. I just looked up the prices of the toner cartridges, and their yields.

Turns out that the color laser has a lower per-page cost for black-and-white than the b&w.
A toner cartridge for the 6L is around $75, and is rated for 2,500 pages, while the color printer’s black cartridge is about $90, but yields 5,000 pages.

Lesson for the day – check your assumptions!

VirtualBox vs. VMware on Ubuntu 9.10 Karmic Koala

November 3rd, 2009

I updated my server to the 9.10 “Karmic Koala” release of Ubuntu.
Unlike my recent laptop upgrade, I upgraded instead of doing a fresh install – I have too much software installed there to go through re-installation if I don’t have to.

As I have mentioned here before, one of the things that I run on that server is a virtual instance of Windows XP, to support QuickBooks. For our business accounting needs, we then simply RDP to the virtual Windows XP instance to use QuickBooks.

I’ve been running that virtual machine on VMware. I like VMware. It works well, is well-polished, and the “Server” version is free. The one problem is that every time there’s a change to the Linux kernel, parts of VMWare have to be recompiled against the new kernel. This happens just often enough to be an annoyance, but until now, has not been a deal-breaker.

VMware has typically been slow to catch up to major kernel changes, and this upgrade was no exception.
Usually, someone comes out with a patch to the installer fairly quickly. This time, there is a patch, but it didn’t work for me.
I was able to get VMWare started, but unable to keep it running. It would crash, and then when I tried to run it again, it would tell me that it needed to be recompiled. After a couple of cycles of this nonsense, I decided to look elsewhere.

I’ve been using Sun’s VirtualBox at work for some time now, and it’s been very stable, though not quite as polished as VMWare.  VirtualBox also supports and installs the DKMS (Dynamic Kernel Module Support), which promises to automatically recompile the VirtualBox driver when the kernel gets updated. Theoretically, this means that with VirtualBox, I won’t have to deal with this problem any more.

So, I set up VirtualBox, installed XP and QuickBooks, and everything is working fine.
I was pleased to see that the newest version of VirtualBox also supports bridged networking as part of the “normal” VM creation, via the GUI.

BTW, for the curious, I keep the QuickBooks file on the Linux host’s file system, and expose it to XP via a Samba share.
This makes it ridiculously easy to back up the file, and, as with the current switch-over from VMware to VirtualBox, I don’t have to worry about losing it in some virtual machine disaster.

One last thought. VMware, even when it is working, has lately taken the really annoying approach of re-implementing their console as a web application. If ever there was an application that should not be a web app, it’s a virtual machine console.
Of course, you can’t really implement the VM’s window in a web app, so they then go to a browser plugin. This works sometimes, but this is a silly way to do things, with a lot of overhead. I can see where it would be useful sometimes, but it shouldn’t be the only way to administer VMs. Also, the VMware console uses it’s own instance of Tomcat, but comes configured so that it conflicts with all other default installations of Tomcat (the shutdown port is left to it’s default value).
This is an amateur mistake, and has gone unfixed for quite some time.  VirtualBox, on the other hand, has a nice, sane, desktop console. +1 for Sun!

Ubuntu 9.10 Karmic Koala on Dell Inspiron 6000

October 31st, 2009

Ubuntu’s 9.10 Karmic Koala release dropped yesterday, and I dove right in, downloaded it (via BitTorrent), and installed it on my aging Dell Inspiron 6000 laptop.

I didn’t do an upgrade, I reformatted my primary partition, and installed it clean. I keep my /home directory on a separate partition precisely so that I can do this easily, every 6 months as a new release comes out.

Installation was quick and easy, and so far, I’ve seen no major problems.

Notes so far:

  • As expected, the “Extra” visual effects (Compiz) does not work properly (the laptop has an ATI Mobility Radeon X300). “Normal” visual effects mode works fine.
  • The base installation is missing just about every useful codec. This blog post is a nice guide to installing all of the media “goodies” in Karmic.When I first installed all of the packages listed here, none of the video codecs seemed to work properly, including “Movie Player” crashing whenever I tried to open a video of any type. I figured that I’d either have to uninstall the packages, or maybe just re-install Karmic, and then install one package at a time, until I found the culprit. Fortunately, at this point, I powered the laptop off. When I started it again, everything worked fine, and has continued to do so.
  • I was seriously impressed with the short boot time in Jaunty Jackalope, and Karmic’s boot time is even faster. All I can say is, “Wow!”
  • Karmic has a new login screen, that lists the user names, and has you pick one. Frankly, I don’t care for it. First, my fingers are “trained” to type my user name and password to log in, and now I frequently type my user name in the password field. Second, not that I need to worry about it so much on my home laptop, but displaying a list of the user names lowers the barrier for someone attempting to log in who shouldn’t be able to. Third, I think that the new screen is very ugly. I like Ubuntu, but their themes always seem to suck bigtime. Brown themes, black login page with blocky graphics…ugh. Fortunately, this stuff is easy to change.
  • I don’t do a wide variety of things with this laptop – basically web browsing and Java programming. Occaisional audio editing. Occaisional image editing. Not too much else, so I can’t really comment on the range of applications that ship with this version. I’ll report more as I find anything interesting.