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....