BibleGateway.com Verse Of The Day

Monday, April 30, 2007

2 More Days And Lexi Is Ours!

Here she is, at almost 8 weeks old. She turns 8 weeks Wednesday, May 2, so we can pick her up then.

Sunday, April 29, 2007

The Chickens Are Home

Today I put the finishing touches on the chicken run. Paula cleaned out the building that will serve as the coop while I finished putting the gate on. We put the perch in there, carried the chickens outside in laundry baskets, and hung up the brooder heat lamp. I got bigger feeder and waterer and set those up, and Paula went and got more corncob bedding to put down on the floor. So the chickens our our of our home and into their home.

And it was about time. They got to the point where they could fly out of the wading pool even with the 12" cardboard walls surrounding it. This morning one of them was running around the living room chirping because it was lost and couldn't get back in the pool. Later in the morning I saw a couple of them fly out when they got excited about something. They also started to do a little picking on one of the Buff Orpingtons, which meant it was time for them to get more space per bird.

Of course, now that they have so much more room, I went out to take pictures and they are all huddled together in the corner. When we got home from dinner, I peeked in the side window and they were all laying down right under the brooder lamp. But they have the space if they need it, so I feel better. And they aren't running around in my living room, so my wife feels better.

By the end of May they should be right about eatin' size, and it will be time to fire up the grill and have some friends over. Nice and fresh.

I still need to build or buy nest boxes, but I should have a few weeks before they get to that point, so it isn't an emergency yet.

Tuesday, April 24, 2007

More Puppy Pix 4/24

More pictures of the Wheaten puppies.
We get to pick ours up May 2!!

Thursday, April 19, 2007

The Other Chick - A Mystery!

This is the extra chick we got with our order from Murray. Still not sure what kind of chicken it is. Once the wing feathers start coming in more it should be a lot easier to tell, or I could just wait until it's fully grown.

Wednesday, April 18, 2007

Go Ahead And Make Yourself At Home

These 3 deer were among the 7 that visited our feeder the other day. It's not all that uncommon for them to be in our yard with the apple trees and the fact that we back up to an abandoned apple orchard. It's not even uncommon for them to poke their noses in the squirrel feeder and eat out of there. But this particular deer decided to make herself right at home and just layed down right smack dab in the middle of our yard.

Obviously she doesn't know who lives here. Hard to not think of a full freezer with scenes like this.

Who Says Programmers Can't Get Chicks?


Here's a close up of a Rhode Island Red chick, about 5 days old, sitting on my kitchen table.

Tuesday, April 17, 2007

The Chicks Have Arrived

The chicks have arrived! I finally got to bed around 6am after working on that file upload all night, and drifted off to sleep around 6:20 -- just in time for my cell phone to ring at 6:30. I jumped up and answered assuming it was work calling about the failed upload, but it was the post office letting me know the chickens have arrived. I rolled over andwent back to sleep for a few hours, then picked them up around lunch time. One had died in transit, but there were still 26 birds in there, so they must have put in 2 extra instead of just the one extra. We got 5 Buff Orpington roosters, 20 Rhode Island Red straight-run (as they hatch, no sexing), plus the one "exotic" chick Murray McMurray throws in for free. It is black with a stripe, so not sure what kind it is yet. Looking through the catalog it could be any number of breeds -- we'll see once it gets bigger.

We have our old kiddie pool set up in the back living room for them right now. We got the starter kit from Murray McMurray that has the cardboard draft shield, brooder lamp and red heat bulb, thermometer, 2 waterers, and 2 feeders. It seemed like a good deal versus buying all the individual pieces separately.

Right now our house if full of the CHEEP CHEEP CHEEP of 26 baby chickens. The girls think they are so cute and wanted to know what we would name them. Our answer of course NO NAMES, these are LIVESTOCK not PETS!

The dog on the other hand is a pet, she will have a name (Lexi -- we picked her out last night, and get to bring her home in a few more weeks) -- we won't eat the dog! Try to explain that to a 2 and 3 year old and it suddenly becomes clear how arbitrary the whole thing is -- how certain animals can share our homes as pets (dogs, cats, guinea pigs), other animals get killed for sharing our homes without asking (mice, rats, moles), and other animals get raised solely to eat (chickens, cows, pigs).


Thursday, April 12, 2007

Working With Velocity Templates

I used Velocity as the templating engine for my persistence code generator project. It is really simple and clean to set up and use, which is refreshing compared to a lot of the Apache projects which are obtuse and over-abstracted for the sake of inflating programmer's egos.

Why use Velocity? I use it for code generation -- connect to a database, get the meta data, and generate the DAO, VO, and DaoFactory Java classes to work with that database. But you could use it to generate any sort of text, whether it is HTML, JSP, ASP, emails, documentation, source code, etc.


Below is a very simple stub to show how easy it is to work with Velocity. This is the bare minimum Java code you need to merge your data into a template and generate an output file. Of course, you would have more than one bind variable in the context would probably have to deal with more complex data structures, but this gives you the basics...


import java.io.File;
import java.io.FileWriter;
import java.util.Properties;

import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.exception.MethodInvocationException;
import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.exception.ResourceNotFoundException;

public class VelocityExample
{

public void execute() throws Exception
{
//Set up Velocity engine and context
Properties p = new Properties();
VelocityEngine ve = new VelocityEngine();
VelocityContext vctx = new VelocityContext();

p.setProperty("file.resource.loader.path", "/path/to/your/velocity/templates");
ve.init(p);

// put any number of properties in the context. These are
// used as bind vars in the Velocity template. For example
// In template any instance of ${someProperty} will be replaced
// with someValue.
vctx.put("voClassName", "ExampleVo");

// Get your template
Template templ = ve.getTemplate("YourTemplate.vm");
// and a writer to new file to be generated
FileWriter writer = new FileWriter("/path/and/filename/of/generatedfile");

// merge template with context and write to your output file
templ.merge(vctx, writer);
writer.flush();
writer.close();
}
}


Ok, so that's the code, what does the template look like? Below is the template I use to generate VO's (or DTO's) -- a class with properties and getters/setters methods for each property.

Notice is looks a lot like a Java class already, except for all those pesky $var's and #directives. Anything you put in the velocity context is available from the template. You reference the properties using $property or ${property}, and if it is a complex type you can reference fields using dot notation like ${property.name}, or loop through List's and arrays using #foreach directives.


// ====================================================================
// DO NOT EDIT THIS FILE. IT HAS BEEN AUTO-GENERATED BY DAO-GEN.
// YOUR CHANGES WILL BE LOST NEXT TIME THE CODE IS GENERATED!
// ====================================================================

package ${voPackageName};

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import java.sql.Date;
import java.sql.Timestamp;


/**
* @author DaoGen
* @version cvs: $Id: VoTemplate.vm,v 1.2 2006/12/12 20:13:23 ran488 Exp $
*/
public class ${voClassName}
extends BaseVo
implements Serializable
{

#foreach( $field in $persistableFields )
/** $field.colName */
private $field.javaType $field.jFieldName ;

#end


/** Constructor */
public ${voClassName}()
{
super();
}


// Getters and Setters
#foreach( $field in $persistableFields )


/**
* Setter for DB column $field.colName
* @return void
* @param $field.typeName
*/
public void set${field.jProperFieldName}( $field.javaType $field.jFieldName )
{
this.${field.jFieldName} = $field.jFieldName;
}


/**
* Getter for DB column $field.colName
* @return value
*/
public $field.javaType get${field.jProperFieldName}()
{
return this.${field.jFieldName};
}
#end
}




For a more real-world example of the Java code, here is the method I use to generate the VO from the above example. This method actually generates the DAO implementation and interface and the VO for each table in a database.



/**
* @param db
* @param basePath
* @param ve
* @param vctx
* @throws ResourceNotFoundException
* @throws ParseErrorException
* @throws Exception
* @throws IOException
* @throws MethodInvocationException
*/
private void generateTablePersistentObjects(Database db, String basePath, VelocityEngine ve, VelocityContext vctx) throws ResourceNotFoundException, ParseErrorException, Exception, IOException, MethodInvocationException
{
Template voTempl = null;
Template daoIntfcTempl = null;
Template daoImplTempl = null;
voTempl = ve.getTemplate("VoTemplate.vm");
daoIntfcTempl = ve.getTemplate("DaoTemplate.vm");
daoImplTempl = ve.getTemplate("DaoImplTemplate.vm");

// The MEAT and POTATOES
for (Table table : db.getTables())
{
// put everything from table into Velocity context
vctx.put("voClassName", table.getJProperFieldName() + "Vo");
vctx.put("daoImplClassName", table.getJProperFieldName() + "DaoImpl");
vctx.put("daoInterfaceName", table.getJProperFieldName() + "Dao");
vctx.put("dbTableName", table.getTableName());
vctx.put("javaTableName", table.getTableName());
vctx.put("persistableFields", table.getColumns());
vctx.put("primaryKeyFields", table.getPrimaryKeys());
vctx.put("schema", table.getTableSchema());
vctx.put("tableType", table.getTableType());
vctx.put("numPkFields", table.getPrimaryKeys().size());

FileWriter voWriter = new FileWriter(basePath+"vo"+File.separator+table.getJProperFieldName()+"Vo.java");
voTempl.merge(vctx, voWriter);
voWriter.flush();
voWriter.close();

FileWriter daoIntfcWriter = new FileWriter(basePath+"dao"+File.separator+table.getJProperFieldName()+"Dao.java");
daoIntfcTempl.merge(vctx,daoIntfcWriter);
daoIntfcWriter.flush();
daoIntfcWriter.close();

FileWriter daoImplWriter = new FileWriter(basePath+"dao"+File.separator+table.getJProperFieldName()+"DaoImpl.java");
daoImplTempl.merge(vctx,daoImplWriter);
daoImplWriter.flush();
daoImplWriter.close();
}
}


For more info check out http://velocity.apache.org/

There is also an Eclipse plugin for the templates at http://veloedit.sourceforge.net/.

Monday, April 09, 2007

More Puppy Pix

We went to see the Wheaton Terrier puppies again last Thursday. A few of the pictures are here....http://www.frontiernet.net/~nicholson150/puppies.html They are up and playing now, pushing each other around, wrestling, barking at each other.

Tuesday, April 03, 2007

K&N Performance Air Filter Kits

I was wondering what the difference between the FIPK eries 57) kit and the "Performance" Series 77 kit was, other than the 77 kit being chrome instead of plastic. My assumption was the new 77 was supposed to be higher performance as well, but I was wrong.

According to the K&N website, the series 57 kits gives an extra 10.49 horsepower for the 5.7L HEMI, while the 77 only gives 8.34 HP (dyno chart), and the 57 seems to be more consistent boost across the RPM range.

FIPK Installation Instructions for 5.7L HEMI V8.

Monday, April 02, 2007

More Puppy Pictures

The Wheaten Terrier puppies at about 3-1/2 weeks....



Thursday, March 29, 2007

ETA On Chickens: 4/16

I just ordered my chickens, and they should arrive the week of April 16th. Got them from Murray McMurray hatchery via internet. They will be shipped out as day old chicks, ready to go, so I just need ot pick them up at the post office as soon as they arrive. We got a striaght run of 20 Rhode Island Reds, 5 Buff Orpington roosters, plus whatever the extra free "exotic" chick is they put in there with them.

I also ordered the starter kit (brooding lamp, waterers, feeders, etc) from them earlier today. So now the dream of rasining chickens is reality, no turning back.

Fire up the barbeque!

Wednesday, March 28, 2007

Chicken Perch Finished


Tonight I finally finished building the perch for our chickens. Here is a picture of the finished product. Actually not completely done, as I would like to sand the actual perches a bit better and maybe hit the whole thing with a coat of paint or stain.

Now I just need to build the nest boxes, fix the roofing, fence in the run area, and purchase the chickens along with some supplies like feeders and waterers, food, grit, etc.

Tuesday, March 27, 2007

A Big Day

We had a big day yesterday. I came home from work and Paula had a pan of homemade macaroni and cheese in the oven.

And my new tonneau cover was on the porch, freshly delivered from Amazon.com. I got the Lund Genesis Tri-Fold and it really was about a 5 minute install, no exaggeration. Line it up at front of bed, clamp down the front, unbuckle the mid section and unfold. Clamp down two rear clamps. Done. Took longer to pull into the barn (all the while tearing up my very wet lawn with my very big and heavy truck tires).

Then we packed up the kids and went out to look at some puppies. We ended up putting down a deposit on a Soft Coated Wheaten Terrier female. They are 3 weeks old right now, so we have wait until May. We played with the mom, "Claire", and watched the puppies for about an hour before we finally left. Marion Morse is the breeder, and she is in Webster, NY. website link

Tuesday, March 13, 2007

Lights Mod For Ram

On the Dodge Ram, the grill is attached to the hood, and the whole kit and kaboodle lifts as one piece. Here's an ingenius method for mounting driving lights so they sit behind the grill, mounted on the cross bar in front of the radiator. When I get around to mounting my driving lights, I'll be a lame ass and copy these guys. http://www.dodgetalk.com/forums/showthread.php?t=141886

Friday, February 23, 2007

Apache "Maintenance" Pages Using mod_rewrite

Just found out about the power of mod_rewrite in the Apache web server. To enable a system wide "maintenance" page (system not available type thing) you need enter only 2 lines of code in the httpd.conf file and restart apache. This is so simple, it kind of baffles me why this example wasn't mentioned in the 2 links I used to figure it out.

The pattern matches for everything except maintenance.html and sends the request to maintenance.html. That is important, because at first I tried to redirect all requests by matching on ^/(.*) but that got into an endless loop, since it would redirect request to maint page which redirected to the maint page which redirected to, well you get the idea.

Here is my rule:
RewriteEngine On
#RewriteRule !^/maintenance.html$ /maintenance.html [R,L]


Save file, cd ../bin and sudo ./apachectl restart and presto! All requests go to maintenance.html instead of the intended destination. Comment out those 2 lines, restart, and all normal.

Links of interest:

FOLLOWUP - 3/29
My maintenance redirect wasn't working for requests already coming in over SSL. I had to add the rule to the secure virtual host config section as well for it to work. Special thanks to "shimmyshack" on the alt.apache.configuration newsgroup for pointing me in the right direction.

Thursday, February 22, 2007

2007 DST Issues And Java

This daylight savings time (DST) issue is a pain in my buttI didn't need right now. We still have legacy applications running on JRE 1.2.2, and since it is Silverstream 3.5, changing anything out from under will destroy the world and it will not run right, if at all.

Links to Sun's FAQ is at http://java.sun.com/developer/technicalArticles/Intl/USDST_Faq.html
Of notable interest here is this little tidbit of crap:
  1. Do my operating system's timezone patches fix the Java platform's timezone data?
    • No. The Java SE platform's timezone data is not read from the local or host operating system.
    • The Java SE platform maintains a private repository of timezone data in locally installed files (.../jre/lib/zi) as part of the Java Runtime Environement (JRE) software.
      • Applying whatever operating system timezone patches (for example Solaris OS, Linux, Windows) will have no effect on the accuracy of the Java SE platform's timezone data.

Well isn't that lovely? Java doesn't rely on the underlying OS to get timezone info. I'm sure there's a "good" reason, but it seems like pointless redundancy to me. Why set it up on the OS if the JVM doesn't use it? Sure there is probably some backward OS that has no concept of timezones, so Java abstracts everything to a point of uselessness just like Swing UI's.

If installing or updating new JRE is not an option (say, in production where the app server and all the apps haven't been tested on newer JRE's) The JRE updater tool is found at http://java.sun.com/developer/technicalArticles/Intl/USDST_Faq.html -- not sure how reliable ot stable that thing is, but we'll find out in our dev and test environments soon enough.

There is a brief discussion on the Jboss forums at http://jboss.org/index.html?module=bb&op=viewtopic&t=98682 as well. Or for Websphere http://www-1.ibm.com/support/docview.wss?rs=180&context=SSEQTP&dc=D600&uid=swg21219396#actions.

Venison And Mushrooms In Gravy

This is a simple "recipe" we did tonight that was extremely good -- very tender meat and great flavor. We didn't really have a recipe, so I don't know what to call it (Bambi swimming in gravy?)

1 lb. venison, cut in 1" cubes
2 cups mushrooms, sliced or cubed
Beef gravy, mix or pre-made.
Flour
Salt
Pepper
Garlic Powder

  1. Heat up a cast iron skillet with a little bit of oil.
  2. Mix the salt, pepper, garlic powder into some flour on a plate or in a plastic bag.
  3. Dredge meat cubes in the seasoned flour and brown each side in the pan. Don't worry about cooking all the way through, just searin the juices. Once browned, remove the meat from the skilet and set aside.
  4. Sautee the mushrooms in the same pan, using a little oil or butter as necessary to soften them up. Remove and set aside with the meat.
  5. Pour the gravy (or mix up the gravy mix according to directions, we used 3 packages but 2 would have been fine) into the skillet.
  6. Put the meat and mushrooms back into the skillet, lower heat, cover, and simmer for about 30 minutes or so, until meat is tender and fully cooked.
We dumped this over white rice and it was delicious.

Next time I would probably try adding some sauteed onions in with the mushrooms as well. There's really no reason why you couldn't substitute some other meat for the venison, e.g. elk, caribou, bear, rabbit, squirrel, or even beef.

Wednesday, February 14, 2007

"Peterbilt" Dodge Ram

This thing is sweet. He must have spent a lot of cash and time on this custom project. I only looked at the pictures so far, but I plan on going back to read it later. He started with a Ram 3500 and put a Peterbilt cab on it, truck bed off an old Chevy, 40" Mickey Thompson's, etc. Must be seen to be believed....

http://www.autoblog.com/2006/09/13/when-a-dodge-ram-just-isnt-sufficiently-truck-like

Server Printing Using Java Print Service

The first and most obvious thing you will notice about the Java Print Service (JPS) API's is that it is pretty much geared toward client side printing. For example, to look up print services you use javax.print.PrintServiceLookup, which has methods to lookup the default print service, lookup all the print services that match the given AttributeSets and/or DocFlavor's. That all makes sense if you are building a print dialog with the default printer selected already, and a list of all the other printers defined on the system, to allow the user to choose one.

On the server, however, printing is just one more stop in a process flow. It has to just happen automatically, which means you have a specific printer in mind for the stuff to go to. Notice on the PrintServiceLookup class, there is no method to get a specific named printer service. In my mind, that is a deficiency, but one that is easily rectified.

Here is the code I use to lookup a named printer service. The name is kept in a properties file that gets bound to JNDI, or it could be kept in a database, etc. Basically you pass in null for the DocFlavor and AttributeSet to get all print services on the machine. Then loop through those looking for a match, and return the matching service, or throw an Exception.



import javax.print.*;

...

public PrintService getNamedPrintService(String prnName)
throws Exception
{
PrintService[] prnSvcs;
PrintService prnSvc = null;

// get all print services for this machine
prnSvcs = PrintServiceLookup.lookupPrintServices(null, null);

if (prnSvcs.length > 0)
{
int ii = 0;
while ( ii < prnSvcs.length )
{
log.debug("Named Printer found: "+prnSvcs[ii].getName());
if (prnSvcs[ii].getName().equalsIgnoreCase(prnName))
{
prnSvc = prnSvcs[ii];
log.debug("Named Printer selected: "+prnSvcs[ii].getName()+"*");
break;
}
ii++;
}
}

if (prnSvc == null)
{
throw new Exception("Printer " + prnName + " was not found on this system.");
}

return prnSvc;
}