BibleGateway.com Verse Of The Day

Friday, October 17, 2008

A Website For Everything

I don't care what you're looking for, there's a website for just about everything and anything. Case in point, http://www.monkeys-for-sale.com. The internet's not just for porn anymore.

Monday, September 29, 2008

The Chicken Nest Boxes Are Finally Done

The chicken nest boxes Are finally done.....and just in time! As I was working on the finishing touches, I went out to give the birds some fresh water and found a a brown egg on the ground.

Below is a photo of the completed nest box right inside the coop. It's a double-seater, which should be plenty since I only have 4 hens left. I put a hook on the bottom to hand the waterer from as well. I'm hoping the water won't get as nasty if it's hanging instead of sitting on the ground.
The design is fairly basic -- 2 nests with a perch on the front and a hinged top to ease egg gathering. I built the whole thing from various wood I had laying around the barn: some 2x3's, 2x2's, 1x12's, and a half-sheet of plywood. The only thing I purchased especially for this box was the set of hinges.

Below is a picture of the nearly completed nest box in my workshop. Here I'm demonstrating the hinged top and making sure the sizing is right -- notice the Blue Araucana hanging out in there trying tofigure out what's going on.
Once I moved this into the coop, I placed a small smooth rock in one side hoping it would look enough like an egg to let them know what the thing is for.

Yesterday I went in to check, and the rock was moved aside, and a nice brown egg was laying there.

Overall I would have to say I am pleased with the nest box. It took longer to build than I was hoping, but that's mostly because other things kept coming up. I could have purchased pre-built nest boxes, but what fun is that? This was a lot of fun to build, and finding my first egg in there made it all worthwhile.

Wednesday, September 17, 2008

You've Got Mail


Just a silly dude I drew while coloring with my daughter the other day. Sometimes you gotta break out the crayons....

Thursday, September 04, 2008

Error 2 (net::ERR_FAILED): Unknown error.

Well, so much for Google Chrome, at home at least. I installed at work yesterday (XP Pro) and used it all day. Started to kind of like it, albeit some features I am used to are not there, yet. (See yesterday's post for my first impressions.)

But once I got home and installed it on my laptop (XP home), every page I go to gives me an error saying the webpage is not available. Firefox and IE work fine, my firewall settings are to allow Chrome to access, everythign looks good. I reinstalled with no luck, I disabled my firewall, no luck.

So I installed on my desktop (XP as well), and same thing. I can get to the main Google page but cannot search. I got to Microsoft's homepage, but can't go anywhere from there. Same thing, where Firefox and IE work fine.

Several issues we posted on Google Code site for this error so it's not just in my imagination, here are a few samples (search for error msg, there were about 10-12 when I posted this)....
I guess it is a beta, so instead of whining I will just stop using it until the next version comes out.

This webpage is not available.

The webpage at http://www.google.com/chrome might be temporarily down or it may have moved permanently to a new web address.

More information on this error

Below is the original error message

Error 2 (net::ERR_FAILED): Unknown error.

Wednesday, September 03, 2008

Google Chrome versus Hype


Well, everybody in the online world seems to be writing about Google Chrome browser. Lots of hype, both good and bad. It's going to kill of Firefox and Internet Explorer, it's the final nail in the coffin for Microsoft, it's buggy, it's evil, it's great, it's just a beta, it's the next big thing, it will fizzle out and nobody will care about it, etc.

Well, I jumped on the bandwagon. I am currently using it to write this post. I used it off and on throughout the day alongside Firefox and Explorer. Here are my thoughts, as if anybody asked....
  • It has some nice features, some of which are admittedly borrowed from other browsers. They are nice, but not enough to make me switch, not nice enough to make Microsoft tremble in fear.
  • It is lacking some features of other browsers that I have come to rely on, and for that reason it's not "replacing" my other browsers any time soon (or ever).
    • Viewing XML and XSL files -- they show up blank or with some text here and there. Basically it tries to treat them like HTML and ignores most of the tags.
    • Sidebar - I have been using sidebar for the menu panel of my Bookmarks Launcher+ app. (shameless plug)
    • RSS support, e.g. Firefox's live bookmarks feature
    • Plugins, especially 'Firebug'.
  • It seems pretty zippy, but speed wasn't an issue with my other browsers, so not sure this one will make it "win".
  • Some of the stuff was a little odd to get used to at first, e.g. lack of menu bar or title bar,lack of bookmarks menu (unless you check the "Always show bookmarks bar" option under the wrench icon.
  • The "New Tab" window is kind of neat once you get used to it -- the lack of bookmarks menu above is actually right there when you open a new tab, along side thumbnails of most often visited sites, and a list of recently closed tabs, and ability to search your history.
  • Read some reports of the back button not working. It's been working for me. Even still, it is a beta, there will be bugs.
  • I like the idea of each tab being a separate process in case one gets hung up. I have had that problem a lot with Firefox, especially when trying to open PDF's or long loading pages. To that end, the Task Manager window and the info for nerds link is kind of cool.
My impression, it's a browser. Pure and simple. For some reason Google felt the need to reinvent the browser with lots of mature fully featured browsers already out there.

Chrome isn't bad, but it's not worth all the hype either. It will be interesting to see if it carves out a small niche, takes huge chunks of market share, or just fizzles out comepletly. My guess if either niche or fizzle at this point.

Monday, August 18, 2008

Simple JSP To List Java JVM Environment

Here's a simple JSP to list out all the JVM environment keys and values. Very simple, but occasionally useful. For example, a few weeks ago I needed to see which SSL keystore (javax.net.ssl.trustStore) our test servers were using.

I'm sure every Java developer has written similar code at some point, so I won't claim it's original, unique, or ingenious. But if you find it useful, go ahead and use it instead of writing another.


Wednesday, July 16, 2008

Making Your JVM Trust Those SSL Certificates

Guess I should follow-up with a "part 2" on yesterday's post about saving off SSL certificates. The whole point of me going through the exercise was that one of the web services we consume is SSL and the certificate expired. The new certificate was self-signed, so our Java code threw exceptions saying a trusted certificate was not found.

So the second step for me was to import them so my JVM(s) would recognize the certificate as "trusted".

To get your JVM to trust the certificate, you import it into your keystore using the keytool executable (found in your JDK bin directory):
[jboss@j2apptest01 bin]$ ./keytool -import -alias SomeWebserviceName -file ~/SomeCertificateFileName.CER
If the keystore does not exist yet, the tool will prompt you to enter a keystore password. Remember that password, as you will need to use it to import new certificates or export or view current ones.

It will then display all the keys and other info about the certificate and ask you to confirm that you really want to import. You will want to verify the keys match up to what you think you are importing, of course. Then type "yes" and it should tell you the certificate was added.

After that, our calls to the web service started to ork again, like magic.

Tuesday, July 15, 2008

Saving SSL Certificates From A Website

These instructions saved by butt recently, so I have to post so I don't lose them. I was able to figure out how to save the certificate OK, I just didn't know how to get the actual *.CER file so I could import to my JVM's keystore. I didn't know about the Windows app "certmgr.msc"... http://balajiramesh.wordpress.com/2007/12/28/save-ssl-certificate-to-cer-file/

Tuesday, June 17, 2008

Redneck Father's Day 2008

Ahhh, Father's Day. If I were a Dad from one of those stupid sit-coms, it would be all about ugly neckties, tired cliche's, and some witty one-liners. But, no, I'm a Wayne County Dad. We roll a little differently out here.

My father's day gift? 250 rounds of 9mm ammo. Perfect!
I have to give credit to my sister-in-law Jen for taking the picture. She got it just as I shot so there is a smoke cloud coming out the barrel, the action is still cycling, and if you look where I circled, the casing is flying through the air.

The day starts off like any other Sunday, with a lovely breakfast (Paula made the eggs and bacon, Raina made me toast--and lot's of it), and then going to church. Then we go to Uncle Greg's house for some brunch.

Then home so my brother-in-law and family could come over. He brought some clays, his 12 gauge and his 9mm. I brought out my XD-9 and Paula's 20 gauge Benelli. I'd say we probably only went through a few boxes of shotgun shells, but probably at least 300 rounds of 9mm.

Then we came back to house to eat grilled deer meat and slow roasted prime rib, and had some beers.

Many rounds of ammo were fired in the making of this Father's Day, and there was no shortage of meat either. Let me show you where to put that ugly necktie!

Tuesday, June 10, 2008

Three Baby Geese

Here's a picture of our 3 baby geese (about 2-1/2 weeks old) in the coop. Not sure what kind of geese they are yet. We also have 3 ducklings (I think 2 are Khaki Campbelss and the other I think may be a Cayuga, but not sure yet on either) and about 10-11 chickens (not sure of the types yet).

Sunday, May 18, 2008

Jboss SQL Deployer

I whipped up a fairly simple SQL deployer for Jboss this past week. It is currently fairly limited, but also very straight forward and should be easy to maintain.

It consists of a class implementing java.lang.Runnable (a Thread) that wakes up every 20 seconds or so and scans a directory for any new SQL files. Of course there is also a class implementing java.io.FileFilter to look for just SQL scripts. To turn this into a JMX service, I wrote a simple BeanShell wrapper to drop into the deploy directory.

Once a SQL file is found, the code assumes the first line will contain the DataSource JNDI name, so it knows what database to connect to. Then it currently assumes the rest of the file is one query. The query results are formatted and dumped to STDOUT.

To make this truly useful, I will have to make it accept updates as well as queries, and parse the file looking for multiple SQL statements instead of assuming it is just one. Other than those limitations, it works great with the few tests I have done so far. I have been testing under Jboss 4.0.3, but this should work with any version of Jboss with the BSHDeployer.

SqlFileScanner.java


SqlFileFilter.java



sqldeployer.bsh



Why would you use this? That's always a good question to ask, and this time I have an answer besides "because you can".
  • Running ad hoc queries right from your app server, using the same Jboss DataSource bindings your applications are using, and from the same server your apps are running, can be very helpful in troubleshooting issues.
  • Let's say you use Realms instead of username/password in the DataSource XML descriptor, for security reasons. Now you can troubleshoot database issues as that user even without knowing the DB username and password.
  • Set up simple reporting jobs without needing an Oracle client installed on the machine -- run them right from Jboss.
Conslusion
I think I may create a new open source project to house this as well as all the other Java "odds and ends" I have written over the years, like some of the code generators, MQ tools, servlet filters, JSP tags, etc. The hardest part will probably be coming up with a meaningful project name -- who wants to download and install "RobbsRandomJavaCrap.jar"?

Tuesday, May 13, 2008

The Wait Is Over

We applied for our pistol permits a few weeks ago, and finally got them this past Saturday. It took 2 days shy of 3 weeks from the time we turned the applications in to the time they arrived in the mail. That's the great thing about Wayne County. Just a few miles west, in Monroe County, it takes anywhere from 6 months to a year to get your permit. Our sister-in-law applied over 2 months ago. She's still waiting.

So the first two days of having our Springfield XD-9, we fired about 170 rounds of ammo through it. That thing is really fun to shoot, but it could start to get expensive when you tear through a magazine in about 30-40 seconds.

I'm loving the XD. I like the extra safety features like the grip safety and split trigger, the cocked indicator and the chambered round indicator. And on the range, the gun shoots very nicely-- comfortable to grip, low recoil, fast follow-up shots, no jamming or misfires. The XD is also extremely easy to take down and put back together without any tools. And while a lot of handguns have a reversible magazine release, the XD simply has a magazine release on both sides -- no need to change anything. It also has a built-in accessory rail for tactical flashlights or laser sights if you so choose.

The XD came with a plastic carrying case, holster, 2 magazines, a speed loader, magazine holster that holds 2 magazines, cleaning brush, and a gun lock. Gander Mountain threw in another gun lock and a "gun sock".

My decision came down between the Springfield XD or the Beretta PX4 Storm, and I can honestly say I don't regret my decision at all. The Beretta is a nice gun, but if I were to buy another handgun, I would get another XD in a heartbeat.

Monday, May 12, 2008

Homesteader's Delight

We ordered our chickens over the weekend from Murray McMurray, after having some poor luck getting birds locally this year. Instead of just getting chickens, we opted for the Homesteader's Delight, which is described as such:
If you are a small land holder and would like a small number of birds but a great variety, this is the assortment you've been waiting for. We will send you 10 Brown Egg Laying Chickens (female), 2 Ducklings (straight run), 2 Goslings (straight run), and 2 Turkeys (straight run). Our choice of variety of all the above.
The variety should be interesting. They should be arriving the week of May 19th. Time to get that coop cleaned out!

Thursday, May 01, 2008

Some Old-School JAM and JPL Tips

The JAMster Speaks...

I was cleaning out the barn and found a CD of some old code and documents I had written at an old job, kind of a "portfolio" CD if you will. We used JAM to build Motif screens.

JAM let you visually build your screens, and had it's own procedural programming language, JPL (JAM Programming Language). JAM came with the necessary C code to handle launching of the screens and handling events. You could write your own custom C code to be called from the screens, or write your code in the JPL file for the screen, or a combination of both. One nice thing is you could write SQL code right inline with the rest of your JPL (just prepend the keyword "sql") and everything was taken care of, even down to binding the result set to variables.

It's not exactly cutting edge technology now, but I know it is still in use by at least a few companies. This is not a tutorial for non-JAMsters, but rather a collection of troubleshooting tips I had taken note of. Maybe this could be of use to someone just inheriting legacy apps, or who knows when I might run into JAM again. Yuck!

For reference, these tips are mostly for JAM 5 and 7, but they may be applicable for other versions as well.
























SELECT 1 FROM table...This is often
done to see if a record meeting your criteria (where clause) exists in
the table.
Doing this from a JAM screen (at least in Jam 5) will produce a
@dmrowcount of
0 (zero), even if there are records in the table meeting the criteria.
There
are two alternatives within JAM to get the same information:

1. SELECT
COUNT(*)
temp_var FROM table...

2. SELECT
column temp_var FROM table...
SELECT column FROM
table
This one can be tricky.
If there is no JAM variable with the same name as the the selected
columns,
then JAM will create those variables and put the results of the query
in those
variables. If the variables do exist already, JAM will overwrite the
values
with the results of the query, even when the query returns nothing (it
will essentially
clear the variables).
Mixed Case VariablesMixed case variables
can be a real problem with JAM, and the error messages are not
intuitive enough
to let you know what the real problem is. Keep tihs in mind when you
can’t
figure out some quirky behaviour, and all the other logic and syntax is
proper.
Changes in screen file don’t seem to take effectCheck the local
directory you are running from. JAM will use screen, JPL, and
dictionary files fro mthe current directory before
checking in the SMPATH, regardless of what the SMPATH is set to.



Check the data
dictionary. The screen fields and variables can be stored in here, as
well as
in the screen definition file. Data dictionary tends to overwrite
local (screen) vars.
Some Useful environment VarsMost of the relevant environment variables
start with SM, e.g. SMVARS, SMPATH

  • Also worth noting is that while it might make sense that they would just make use of the underlying Motif widgets, in some cases that was not the case. Simple text boxes for instance would not work with bi-directional Hebrew whereas pure Motif screens did. We had to have JYACC / Prolifics issue a patch for us before we could release to an Israeli customer.
  • There were also issues with some characters in the Turkish (ISO-8859-9) character set. Their database layer simply could handle it for some reason. Wouldn't bring back results, wouldn't update, and yet We ended up having to write our own generic database access layer using Pro-C, and replacing all the JPL "sql" statements with "call" statements into our library.

Tuesday, April 29, 2008

Some Notes On The Jboss BeanShell Deployer

I've been playing a little with the BeanShell Deployer in Jboss lately. Technically, it's pretty cool. Drop a .bsh script in the deploy directory and the hot deployer picks it up just as if you dropped a .war/.ear/.sar file in there. If it's a simple script, the bsh deployer runs it immediately. Or you can implement any or all of the methods of the ScriptService interface (below) and your script will be deployed as a service mbean.
public interface ScriptService
extends org.jboss.system.Service
{
public String objectName ();
public String[] dependsOn ();
public Class[] getInterfaces ();

public void setCtx (ServiceMBeanSupport wrapper);
}

It was extremely easy to write a few scripts and drop them in the deploy directory. Of course, you can start with the requisite "Hello World" script, which upon deployment, prints out to the console. A few more minutes of scripting (adding the above methods) yields a service mbean that can be managed via JMX.

But then the obvious questions: Why? Why would I write mbeans using bsh instead of Java? What do I gain? What do I lose? Is it really any quicker?

I don't really have good answers for the why question yet. I did write a few services using bsh. They were easy enough to implement, but nothing that couldn't have been done in a similar time frame using Java. You lose compile time error checking, but you avoid some of the plumbing regarding build scripts, deployment descriptors, and building .ear or .sar files.

I did write a few services. One connected to a Websphere MQ (a.k.a. MQ Series) queue manager to get queue depths and print them to the Jboss console. I ripped most of the code right from an existing MQ tool I wrote a few years ago. So not the most useful thing in the world, but it proves out importing existing Java classes and the Java syntax. Another used JDBC to connect to an audit database and purge old transactions. Again, nothing that couldn't be done in regular old Java code in the same amount of time.

Overall, I didn't feel like I was saving any time. For one, the syntax is Java. That's great for code re-use (either cutting/pasting or importing libraries), but Java syntax doesn't have that "lightweight scripting" feel to it. Also, the lack of compile-time error checking doesn't save you much time if you have to run the script to find errors. Make a simple mistake like a type mismatch or failing to catch a specific exception, and your IDE and/or compiler will tell you about it. Do the same thing in a bsh script, and you find out after you deploy it and run it.

I think this could prove useful in the future, as one more tool in my programming toolbox, but have to admit I don't have a lot of use for it right now. Maybe I'm just not seeing the big picture, or just haven't run across the scenario where this is the ideal way to solve a problem. If you are using the bsh deployer, please let me know what you are doing with, or what types of problems you are solving with it.

Once I have a reason to use it, at least I know it is easy to do. And once the why question starts to have answers, maybe I'll explore writing a JRuby or Groovy deployer. Or actually, what would be really useful would be a SQL script deployer, so you could run ad-hoc queries against your Jboss DataSources without writing JDBC code or having to launch a DB tool like Squirrel or TOAD. Since Jboss deployers are service mbeans, maybe I could write the SQL deployer in bsh...


GoodSearch

If you're looking for a way to feel all warm and fuzzy inside, like you're making a difference in this world, but are just absolutely sick of all this "green" crap, check out the GoodSearch search engine. The underlying search engine is Yahoo, so you should still find what you're looking for. The difference is you choose a charity when you first go to the site, and when you search, half the advertising revenue GoodSearch makes from your search goes to the charity you designated. From what I read in the Seneca Park Zoo newsletter, it comes out to about a penny per search.

You're giving back without opening your wallet or going out of your way. Anybody can do it, and it all just happens while you're doing what you would normally be doing anyways.


GoodSearch: You Search...We Give!

Monday, April 21, 2008

And Now We Wait

We bought our SAI XD-9 this weekend and turned in our pistol permit applications today. Now we just wait, and wait, and wait some more, to get our permit so we can actually pick up the gun.

I feel like a little kid waiting for Santa Claus to come. From what I keep hearing, the process does not take nearly as long for Wayne County as it does for other counties in NYS. We'll see.....

Monday, April 14, 2008

The BeanShell Servlet Filter Summary

OK, now that I step back and look at this post I wrote a few days ago, I realize I use too many words, tend to blather on and on and on.

So to summarize:
  • What's the point? It's a Java Servlet Filter that delegates to BeanShell scripts to do the actual Filter work.
  • Does it really work? Yes. I am currently running it in Glassfish, but should work in any Java servlet container. It's still just a proof-of -concept and needs to be cleaned up to make it production ready.
  • Where's the code? Of course, you still have to go to that post to see the code, but you can skip the blathering on and on and on.
  • What's the point? Well, just because it can be done I guess. My theoretical ramblings on "why" are what made the post so long in the first place.

Saturday, April 12, 2008

Dynamic Servlet Filters Using JVM Scripting

What got me on the subject of Servlet Filters in the first place was an idea that occurred to me recently. Servlet Filters aren't the sort of thing that can be easily altered at runtime. They are mapped in the web.xml file, so if there are Filters you only want for development or test, but not production (like the DebugFilter I presented in the last post), you have to jump through some hoops to make that happen. You could edit the web.xml before deployment, or have separate dev/test/prod web.xml files that ANT copies into place depending on the build, or have some sort of runtime flag (DB property, value bound in JNDI, etc.) that will either run the Filter logic, or just pass through to the next in chain.

But what if you could not only enable or disable the Filter, but also change it's behavior, on the fly at runtime without special build or deploy steps. I was pondering this idea and came up with the concept of a Servlet Filter, that by itself, does nothing.

Nothing? Well, nothing by itself.

"By itself" is the key phrase here. Instead of doing something in the Java code (getting timings, checking security, auditing calls, printing debug statements, etc.) it just instantiates a scripting engine, like BeanShell (BSH), JRuby, Groovy, etc. It starts up the scripting engine, passes the Request and/or Response objects, and runs a script that you have identified. That script does all the meat-n-potatoes work, and the Filter then calls next in chain like it normally would. And the best part is, the script could be changed at runtime, from a simple do-nothing-and-return to full blown screwing around with the Request and Response objects.

I've developed a proof-of-concept (POC) and have it running under Glassfish v2 application server. I used BeanShell for the scripting engine in the POC, but as stated above, any of the scripting engines for the JVM should work. This isn't quite ready for primetime, but it fully works.

There are actually 2 scripts called by this filter, one before the chain.doFilter() call is made, and one after. That way you have the flexibility to do operations either on the request, on the response, or both.

First, the Java code for the Filter:


Then, the 2 BSH scripts:

BSHServletFilter_PRE.bsh


import java.servlet.*;
import java.servlet.http.*;
import java.util.*;

System.out.println("This is the BSHServletFilter_PRE.bsh script!!!");

StringBuffer output = new StringBuffer();
output.append("\nRequest Attributes\n");
Enumeration attrs = request.getAttributeNames();
while (attrs.hasMoreElements()) {
String attr = (String) attrs.nextElement();
output.append(attr +" - " + request.getAttribute(attr));
output.append("\n");
}

output.append("Request Parameters\n");
Enumeration params = request.getParameterNames();
while (params.hasMoreElements()) {
String param = (String) params.nextElement();
output.append(param +" - " + request.getParameter(param));
output.append("\n");
}

System.out.println(output.toString());
System.out.println("This consludes the BSHServletFilter_PRE.bsh script!!!");



BSHServletFilter_POST.bsh


System.out.println("This is the BSHServletFilter_POST.bsh script!!!");
System.out.println("About to alter the response...");
response.getWriter().print("<h1>This response is from the BSH script</h1>");
response.getWriter().flush();
System.out.println("Done altering the response");


And the browser screenshot...

This is currently just at the POC stage. It is working as-is, running under Glassfish. But as you will immediately notice, the filenames for the scripts are hard-coded, and there is definitely some more cleanup to make this production quality code. But, you can change the behaviors of the filter, for better or worse, at runtime without any compiling, deploying, or restarting of servers. You can even "disable" the filter by writing BSH scripts that do nothing.