BibleGateway.com Verse Of The Day
Thursday, June 21, 2007
NYS Child Car Seat Inspection
If you child has outgrown the seat, or if the seat fails to meet current regulations for any reason, they hand you a new replacement seat. Yes, a FREE replacement seat. They also let you know about the various height and weight guidelines for the different types of seats so you know better what you should be doing. We went to one last month and ended up getting 2 new seats because Raina had just outgrown the seat she was in, and Taryn was very close to outgrowing hers.
Another bonus was free popcorn, hotdogs, and pop. Can't go wrong there even if your seats are up to code.
Check out http://www.nysgtsc.state.ny.us/seat-cal.htm to see when the inspections will be held near you.
Robb's Salsa Recipe
This is how I did it last night, but it usually varies a bit depending on what's available at Wegmans.
Ingredients
- 2-3 lbs. "Tomatoes on the Vine"
- 1-2 Vidalia onions, depending on size
- 2 -3 Jalapeno peppers
- 1 big Poblano pepper
- 1 tbsp. Fresh of chopped Garlic
- 1 bunch of fresh Cilantro
- 2 nectarines or peaches
- Heat cast iron skillet on high, get it really hot. Add a little dab of oil.
- Cut poblano pepper and onion into quarters and place in skillet to sear outside. You don't want to completely cook the onions and peppers, just sear them on the outside to bring out a nice roasted smoky flavor and soften them up just a tad.
- Place everything into a food processor and chop the crap out of it. May need to do multiple batches in the chopper depending on its size. Chop to a consistency you like, some like it chunky, some smooth, and everything in between.
- Pour into a sealable bowl and store in refrigerator. Let the flavors meld together for awhile before enjoying for best results.
- If you choose to share, DON'T DOUBLE DIP! That's nasty.
- The peaches sound odd or even downright gross if you've never tried it, but they add a certain sweetness without being overbearing. BTW, peaches and nectarines are pretty much the same thing, except peaches have fuzz and nectarines don't. I prefer the non-fuzzy nectarine.
- Roasting the vegetables on the grill would probably be even tastier than the cast iron skillet method.
- Add corn and black beans, and maybe even a bit of cumin for a bit of southwestern flair
- To turn up the heat, add more Jalapenos, Habaneros, or some of your favorite hot sauce. I have young children now, so I try to not get carried away with heat.
- Of course, green peppers are popular in salsa. I find them a bit overbearing though when raw.
Tuesday, June 19, 2007
Monkey Butt
Thursday, June 14, 2007
Getting Thread Dump Of Running Java Process
-bash-3.00$ jpsThen using that process id, run jstack:
25515 Bootstrap
26912 Jps
jstack 25515
Tuesday, June 12, 2007
My First Vaguely Useful Ruby Script
file_renamer.rb
#!/usr/bin/env ruby
require 'fileutils'
require 'find'
class FileRenamer
attr_accessor :directory
# constructor
def initialize(directory=".")
@directory = directory
FileUtils.cd(@directory, :verbose => true)
end
#add prefix to each file in dir, ignoring directories
def add_prefix(prefix)
Dir.foreach(@directory) {|x| rename_file(x,"#{prefix}#{x}") }
end
#add postfix to end of each file in dir, ignoring directories
def add_postfix(postfix)
Dir.foreach(@directory) {|x| rename_file(x,"#{x}#{postfix}") }
end
#rename a file unless it is a directory
def rename_file(from, to)
print "#{from}"
if FileTest.directory?(from)
puts "/ remains unchanged"
else
FileUtils.mv(from, to, :verbose => false)
puts " changed to #{to}"
end #if
end
# rename all files in directory to base_name + a sequence
def rename_with_base(base_name)
idx = 0
Dir.foreach(@directory) do |x|
if !FileTest.directory?(x)
rename_file(x,"#{base_name}#{idx}")
idx += 1
end
end
end
def list_dir
Dir.foreach(@directory) do |x|
print "#{x}"
if FileTest.directory?(x)
puts "/"
elsif FileTest.executable?(x)
puts "*"
elsif FileTest.symlink?(x)
puts "->"
end #if
end #do
end
end
# test it...
fn = FileRenamer.new("C:/test")
fn.list_dir
fn.add_prefix("test")
fn.rename_with_base("start")
fn.add_postfix(".txt")
Monday, June 04, 2007
Set The Captives Free!
On Saturday, I opened up the gate while I went in to get them fresh water, and by the time I got back with the water, they were all out in the yard scratching and pecking and making happy little chicken noises. I let that go on for a few hours while I played outside with the girls.
On Sunday I left them out for a few hours again. Actually I left them out twice Sunday, for a few hours the first time and just about 20 minutes the second time. The second time was a fluke. They used to never try to leave even with the gate open. But now they know what it's like out there, and they leave whenever they can.
I liked seeing the chickens roam about on their own. They mostly stayed right near the coop, foraging in the high weeds for bugs and making the occasional foray into the garden. I still only do it when I am outside with them, though, because some of our neighbors don't feel the need to control their dogs, and just let them roam about in other people's yards.
Lexi got out of the yard at one point Sunday and had a good chase with the chickens. She was within about 4 inches of a Buff Orpington dinner at one point right before I caught her. If a small puppy can be that fast and aggressive toward the chickens, I hate to think what would happen if full grown dogs came into our yard with the chickens out. So I still leave them "ccoped" up when I'm not right there watching and still keep them full of 20% grower/starter and cracked corn.
Wednesday, May 30, 2007
Ruby On Rails On Oracle Hurdles, Part 2
Other than getting connected to an Oracle database (officially "Hurdle #1"), which I discussed yesterday, I've hit a few more snags.
Hurdle #2: Table naming. I'm trying to hook up to an in-house authentication/authorization database that is used by several of our application platforms. For RoR's "coding by convention" to work properly, you would ideally have plural table names, e.g. reps, rep_roles. Then when you generate your scaffolding, you would use singular names for the controller and view, e.g. rep, rep_role.
The existing database had singular table names. Generating scaffolding would come up with an error about the reps table not existing. Of course not, it's rep. My initial thought is, "how can I fool RoR?" And the answer was obvious, create views and see what happens.
create view reps as select * from rep;
create view rep_roles as select * from rep_role;
With newly created views sitting in from of the tables, I go back to the trusty command line and try to generate my scaffolding again. PRESTO!! It worked. It's a hack, it's trashy, it's shameful. But it works, and it was quicker than ripping apart the framework and touching code in inappropriate fashion.
So, Hurdle #2 has been overcome.
Hurdle #3: This one is what I alluded to yesterday about simple keys. These tables don't have simple "id" type keys. In MySQL when I was starting an app from scratch, of course I would use an auto-increment id. Works great. But according to the RoR on Oracle article (http://www.oracle.com/technology/pub/articles/saternos-rails.html), there are expectations for the primary key column being "id" and having a sequence with a naming convention of "singular-table-name"_seq, e.g. rep_seq for table reps.
Well, that's not going to happen here, not for this database. And despite the tagline of the article ("Learn techniques for creating a Ruby on Rails Web application that utilizes a legacy schema."), the article really doesn't address natural primary keys, whether they are simple one-column keys or complex multiple-column keys.
I can generate the scaffolding and launch the server. I get pages displaying all the rows in the table. But clicking on the show, edit, etc. links fail. The error, obviously is that it couldn't find an "id" column to look up the record by. I also noticed the PK fields aren't showing up on the list view or in the "create new" record view.
I've been working on other projects most of the day, so haven't had a chance to work on it beyond identifying what doesn't work.
So, Hurdle #3 remains a hurdle for now.
And I just had a few minutes to Google, and found this article (http://www.oracle.com/technology/pub/articles/tate-activeerecord.html) which basically says the same thing I am realizing. To quote:
But Active Record is not for every application. It does not handle legacy schemas nearly as well. For those, you need a mapping framework, not one that merely wraps tables with simple classes.
But then there is this blog (http://paulmwatson.com/journal/category/ruby-on-rails/) that has some encouraging words about setting the table name and PK column with the set_primary_key and set_table_name methods of the ActiveRecord model. (The specific post is at http://paulmwatson.com/journal/2006/11/02/wrangling-rails/)
Now that is worth a try, but still not so sure it will work for a VARCHAR primary key field, and still not going to cut it for multiple-column primary keys.
Tuesday, May 29, 2007
Hooking Up Ruby To Oracle
I started by following the examples at http://www.oracle.com/technology/pub/articles/haefel-oracle-ruby.html
to get the Ruby Oracle libraries installed. That part was easy, download the OCI8 Ruby package at http://rubyforge.org/projects/ruby-oci8 and run it.
Then I whipped up a script to test the connection from an example I found online (forget the URL to reference -- sorry if I stole your crap, dude!) That script basically looks like this (with usernames and passwords changed to protect the innocent.
test-conn.rb
|
I was pumped! That seems easy, and then I can get out of the MySQL realm and start hooking up Rails to existing enterprise DB's and really show this stuff to be useful in our environment. Sorry MySQL fanatics, we are (mostly) an Oracle shop -- I have nothing against MySQL for my personal projects.
Anyways, she didn't work out so well. I figured it would work since I have Oracle installed on my PC, but got the following popup when I ran that script.
There was also a Ruby stack trace on the command line. Basically I did some Google'ing and found this posting (http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/238003) which at least gave me the clue I needed to look for OCI.dll on my system. My thought was it was getting confused between the Oracle 8 and Oracle 9 versions loaded on my machine.Searching and searching, I don't have OCI.dll on my machine. Back to Google (a developer's best friend IMO, it always confuses me when other developers don't try this first when they get stumped) That's when I came across this page (http://www.dll-files.com/dllindex/dll-files.shtml?oci) that let me download OCI.dll. Dropped that in C:\WINNT\system32 (I'm on Windows 2000 at work, might be WINDOWS instead of WINNT for you), and re-ran the above test-conn.rb script.
IT WORKS! Ruby on Rails on Oracle, here I come (again)
I'm guessing my next big hurdle (or potentially a roadblock instead of a hurdle) will be the lack of support for complex primary keys. Starting an application from scratch, you can design your database with that limitation in mind, but building applications for existing databases becomes another issue. I'm sure someone smarter than me has already addressed these concerns, so it might just be a matter of more Google searches.
Monday, May 28, 2007
Thursday, May 24, 2007
Ruby Syntax Sampler Script
So here's my lame attempt at playing with "Ruby proper" -- the language, devoid of frameworks. This is my trashy syntax_sampler.rb script that demonstrates some of the basics of Ruby.
require 'net/http'
#define a class
class SyntaxSampler
# define a constant
Dude = "Constants are capitalized. They cannot be declared in methods"
# the constructor method in Ruby is always "initialize"
def initialize( name )
@name = name # instance var starts with at sign
end
def print_name
puts @name
end
# big ugly method
def dostuff
print "x = "
x = 5
puts x
print "x + x = "
puts x + x
print "x * x = "
puts x * x
print "x**x = "
puts x**x
print "x/2 is "
puts x/2
print "but x/2.0 is "
puts x/2.0
names = ['robb', 'paula', 'raina', 'taryn'] #assign array to 'names'
print "crappers reversed is "
puts "crappers".reverse
print "\nPrint the Array: #{names}" # embed values right in print instead of 2 lines
puts "\nReverse the Array: #{names.reverse}"
puts "for methods with no args, parenthesis optional..."
puts names.reverse()
print "\nCapitalize Each Array Item: "
names.each {|name| print "#{name.capitalize} " }
print "\nUpper case Each Array Item: "
names.each {|name| print "\n\t - #{name.upcase} " }
puts "\n\n'5' as an integer = #{"5".to_i}"
puts "\n19.0 as a string = #{19.0.to_s}"
puts "\n'a19' as an integer = #{"a19".to_i}"
puts "\n'19a3' as an integer = #{"19a3".to_i}"
puts Dude
# define a global var
$wicked = "Global vars start with a dollar sign"
puts $wicked
end
def anothermethod
puts $wicked # make sure that var is really global scope
end
def mirror( something )
puts "#{something} #{something.reverse}"
end
def mirrordefval( something = "dude")
puts "#{something} #{something.reverse}"
end
end
class DiffClass
def initialize
end
def rundiff
puts $wicked # really is global, even across classes
10.times {print " x "} # everything is an object
puts
# use the above "required" module to do something...
Net::HTTP.start( 'www.ruby-lang.org', 80 ) do |http|
print( http.get( '/en/LICENSE.txt' ).body )
end
# shortcut for string arrays, no more pesky commas and quotes
food = %w{elk deer caribou squirrel pig chicken cow}
puts food
# basic if/else control structure
count = 5
if count > 10
puts "Try again"
elsif count == 5
puts "You lose"
else
puts "Enter a number"
end
# a while loop
xx = 0
while xx < 10
print "#{xx}..."
xx += 1
end
print "done"
end
end
# classes and methods are defined, now run them....
ss = SyntaxSampler.new("Robb")
ss.print_name
ss.dostuff
ss.anothermethod
ss.mirror("hello, I'm passing params baby") # with parens
ss.mirrordefval "yo yo yo" # no parens
ss.mirrordefval # no params sent in, use default value
puts $wicked # still don't believe me? it IS GLOBAL DAMMIT!
dc = DiffClass.new
dc.rundiff()
#now a little introspection for your sorry ass
puts "\n\nMethods of SyntaxSampler class...."
SyntaxSampler.instance_methods.each {|mm| print "#{mm} "}
puts "\n\nNow eliminate inherited methods...."
# this looks like a simpler way to print out a list, eh?
puts SyntaxSampler.instance_methods(false).join(" ")
exit # not really needed here
Friday, May 18, 2007
Getting Started With Ruby On Rails
- Download and install Ruby. For Windows, there is a .exe installer. Make sure you pick the installer that comes with the "gems" package updater. I installed at c:\ruby to keep things simple. Installers are at http://www.ruby-lang.org/en/downloads/
- Once installed, you made need to add your Ruby bin directory to your PATH environment variable. On 2000, I had to do that, on XP, it just worked from the command line without doing that.
- In a command line window, cd into c:\ruby and run: gem install rails --include-dependencies
- To create the application, I created a webapp directory under c:\ruby.
- Change directory into c:\ruby and type: rails webapp
- Change directory into c:\ruby\webapp and type ruby script/server
- Once that comes up, open up a browser and check out http://localhost:3000
- There you have it, Rails is up and running on Webrick server.
- I already had MySQL installed, so next step was quick for me. If you don't already have it, go download and install MySQL.
- While you're in a downloading kind of mood, you might as well grab the Eclipse plugin for Ruby if you are an Eclipse guy. You could use any editor, like Notepad++, FreeRIDE (is that still supported? not in latest Ruby release, but it was in last release I downloaded), etc.
- With MySQL up and running, create a database and some tables.
- Edit your c:\ruby\webapp\config\database.yml file to point at your database.
- Run ruby script/generate to create controllers, models, etc.
- Edit your c:\ruby\webapp\routes.rb file to add your "routes" for your app.
To create a controller, I did this....
C:\ruby\webapp>ruby script/generate controller recipe list
exists app/controllers/
exists app/helpers/
create app/views/recipe
exists test/functional/
create app/controllers/recipe_controller.rb
create test/functional/recipe_controller_test.rb
create app/helpers/recipe_helper.rb
create app/views/recipe/list.rhtml
And then enter http://localhost:3000/recipe/list into your browser. So far I got the screen below running without writing a single line of code. Not bad for about 30-45 minutes' worth of work.

It's amazing what you learn when you actually look at a tutorial. Instead of generating models blindly and getting the above, I should have been creating scaffolding to get something useful. I created a table call "robbs" in my database and added a single row (from MyEclipse DB Explorer). Notice my table is "robbs" plural, and the scaffolding controller and view is simply "robb" singular. Then by running the following command, I get this....
C:\ruby\webapp>ruby script/generate scaffold robb robb
exists app/controllers/
exists app/helpers/
exists app/views/robb
exists app/views/layouts/
exists test/functional/
dependency model
exists app/models/
exists test/unit/
exists test/fixtures/
identical app/models/robb.rb
identical test/unit/robb_test.rb
identical test/fixtures/robbs.yml
create app/views/robb/_form.rhtml
create app/views/robb/list.rhtml
create app/views/robb/show.rhtml
create app/views/robb/new.rhtml
create app/views/robb/edit.rhtml
create app/controllers/robb_controller.rb
create test/functional/robb_controller_test.rb
create app/helpers/robb_helper.rb
create app/views/layouts/robb.rhtml
create public/stylesheets/scaffold.css
Thursday, May 17, 2007
My Ruby Dilemna
I looked at Ruby a while back, maybe 2004/5-ish, when it was just starting to make a buzz. It seemed interesting because it was an object oriented scripting language. Loosely typed, to-the-point syntax, etc. I liked the concept, but ultimately I couldn't find a use for it to get me off the ground. When I really needed a shell script, it was quicker to just use ksh or bash and the standard array of unix utilities--awk, sed, cut, grep, etc.
Spare time is precious, and there are a lot of things besides programming to fill it with. And how often do you really get time at work to sit down and learn a new technology, pure R&D and personal development type stuff?
And if I do sit down to learn something new, should I really be spending time on a "toy" like Ruby when I could be brushing up on new Java stuff? Afterall, Java/J2EE are paying the bills, so shouldn't I be the best Java guy I can be, instead of dabbling in flavor-of-the-month technologies?
Then I saw a demo for Ruby on Rails. Wow, that blows the mind of a STRUTS/JSP/Servlet kinds of guy like me. It looks so cool, so fast, so easy, can it really be like the demo? It sparked my interest, but again, the buzz was that this was more of a "toy" than a real enterprise alternative, and lots of negative press was spent decrying lack of security and scalability, blah blah blah. Short attention span, drifting off, blah blah blah.
So now a friend of mine is diving head first into Ruby on Rails along with a few of his friends at work. His genuine enthusiasm has piqued my interest for a 3rd time. He is enthusiastic without being one of those zealots that are screaming loudly about how Ruby is going to kill Java or kill .Net or kill Python or whatever. No languages have to die here, people, it's just one more tool in the toolbox -- do you throw away your drill when you buy a new hammer?
And after all this time, Ruby is still out there and gaining support, so I can't really label it "flavor-of-the-month" or "toy" anymore. To be honest, I thought the same thing about Java back in '96/'97-ish when it was just being used to write applets embedded in HTML pages. I dabbled with some Java, but as a C/SQL/Motif programmer, Java seemed completely useless for real apps. I wasn't convinced until I saw the proof-of-concept office suite Corel wrote in Java -- whoa, real applications like drawing and word processing and spreadsheets running in a graphics "desktop" with icons and stuff! Now I write Java every day. So given that my judgement on this sort of thing sucks goat, I think Ruby, esp. Ruby on Rails, deserves another, more serious, look.
Using the instructions on this link, I was able to use Ruby GEMS to download and install Rails. Then a few commands and I got my sample skeleton project up and running. About 20 minutes worth of "work" while I sit here trying to figure out a production support issue for work. And here it is, my local server running my skeleton project....

And now, some links.....
Ruby Programming Language
Ruby On Rails
Ruby in 20 Minutes tutorial
Learning Ruby by comparing to languages you already know
More Ruby documentation
RDT Ruby IDE plugin for Eclipse
Why's Poignant Guide To Ruby
Using Oracle with Ruby
Wednesday, May 16, 2007
Mini KISS
http://www.minikissonline.com/
Tuesday, May 15, 2007
Freaky Word Tricks For Your Shriveled Little Mind
An interesting email I got recently. Must be some amount of truth to it because I could read it without much difficulty...
This is weird, but interesting!
fi yuo cna raed tihs, yuo hvae a sgtrane mnid too
Cna yuo raed tihs? Olny 55 plepoe out of 100 can.
i cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg. The phaonmneal pweor of the hmuan mnid, aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it dseno't mtaetr in waht oerdr the ltteres in a wrod are, the olny iproamtnt tihng is taht the frsit and lsat ltteer be in the rghit pclae. The rset can be a taotl mses and you can sitll raed it whotuit a pboerlm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. Azanmig huh? yaeh and I awlyas tghuhot slpeling was ipmorantt! if you can raed tihs forwrad it
FORWARD ONLY IF YOU CAN READ IT.
Monday, May 14, 2007
More Chicken Pictures
The chickens have more than tripled in size since we got them a few weeks ago.The buff orpington's seem to be the beefiest of them all right now, and a few of the reds are still kind of scrawny looking. They are all almost fully feathered out now, though -- with just their undersides and necks looking downy now.
I picked one up the other day and could not believe how thick the legs are already. These things went from fluffy little balls to something that resembles actual chickens now. Every day I go back there I notice a difference. I think if I just sat back there in the coop, I would actually see them grow. Well, maybe not.
Friday, May 11, 2007
I've Got Some Time
And when I had no answers, I asked Google instead. According to the Murray McMurray hatchery site, this is the answer:
"Most hens will start laying between 5-7 months of age. They will lay best at 1 to 2 years of age. All pullets (female chicken under 1 year of age) lay small eggs at first and after a while will lay larger eggs. Younger hens will lay 1 egg every 3-4 days. A hen 30 weeks old can lay 2 eggs every 3 days. Some have been known to lay an egg a day. All breeds have different laying abilities."So I have a little time before I really need to panic. They are getting pretty big though, and when I fed them this morning, one of them was actually up on the perch. They are almost fully feathered out now as well. By the end of May we should be grillin' up our first chickens.
MMMmmmm, chickens!
Thursday, May 10, 2007
9 Week Old Lexi
Wednesday, May 09, 2007
Bear Kills Moose in Alaska Driveway as Residents Watch
FOX News
I've seen stray cats hunting for mice in my driveway, but never anything as exciting as a brown bear killing a moose. If I had been in this situation, I probably would have grabbed the camera AFTER grabbing my rifle and skinning knife.
Click on the URL below for the rest of this story:
http://www.foxnews.com/story/0,2933,270936,00.html
Monday, May 07, 2007
Winchester 1300 - Possible Issue Shooting Slugs?
He thought maybe he was inadvertently pulling the slide open because he wasn't expecting that much recoil, so I tried it. I rested the gun over the "V" of my pointer finger and thumb, not holding the forestock at all. The action came all the way open and ejected the spent casing for me as well.
Now we aren't sure if the barrel is keeping the bolt from fully locking properly, or if this is a side effect of the Winchester "Speed Pump" feature (I never really knew what that feature was supposed to do anyways), or if it is a matter of too much shell for the gun to handle?
Each shot was dead accurate at about 70 yards, and it didn't seem to be an "unsafe" condition as it was firing accurately and ejecting the spent casing, but it could definitely catch you off guard in a hunting situation if you are used to doing all the work of pumping a new round in.
I've fired everything from light target loads to heavy 3" magnum turkey and goose loads to rifled slugs through my Mossberg 500 and never had this happen, so I can't image a 2-3/4 slug being too much for a 1300 to handle.
My initial research on the web found another guy in a forum that this happened to, but haven't been able to find too much more info on it. I'll have to keep looking, and in the meantime he was going to have a gunsmith look at it to see if there is an issue with the bolt locking mechanism.
