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, 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 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 ( 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"...

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


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.
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.
are two alternatives within JAM to get the same information:

temp_var FROM table...

column temp_var FROM table...
This one can be tricky.
If there is no JAM variable with the same name as the the selected
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
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
figure out some quirky behaviour, and all the other logic and syntax is
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...


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:


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("Request Parameters\n");
Enumeration params = request.getParameterNames();
while (params.hasMoreElements()) {
String param = (String) params.nextElement();
output.append(param +" - " + request.getParameter(param));

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


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>");
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.

Thursday, April 10, 2008

A Servlet Filter For Easier Debugging

I whipped up this quick Java Servlet Filter (javax.servlet.Filter) to aid in development and debugging. This simply dumps all the HTTP request attributes and parameters and Session attributes to the log. Like any other Servlet filter, it can be chained with other filters like the timing filter, GZIP filter, etc.

This isn't meant to be a tutorial on Servlet filters, I am assuming you either know (or know how to figure out) what filters are, and how to tie them into your application in the web.xml descriptor.

I "printed" the source into a PDF to keep the formatting in tact. Here is the link, or if your PDF plugin is working, it should appear in an iframe below....

Saturday, April 05, 2008

Spring Has Sprung Again

Grandpa Duane's funeral too a lot out of us this week, but now we're trying to get back to normal. And now it's becoming clear that Spring is rapidly approaching. The snow is melted and now the daffodils and tulips are coming up around the house. I haven't worn a jacket all week, and today we're doing "springy" things like pulling trees out of the ground with my truck (YEEEHAAWW!), cleaning up the yard, starting seeds for our herb garden, planning out our chicken purchase, rolling the lawn, etc.

Tuesday, March 18, 2008

Now I Really Do Feel Old

I was listening to "Hard Attack" channel 27 on Sirius satellite radio this morning on my way to the bus stop. Then the guy comes on and says they're about to play some classic metal from a long time ago, and then they play Vote With A Bullet by Corrosion of Conformity.

I start thinking to myself, "c'mon, it wasn't that long ago!" I remember borrowing that CD from Greg Miller like it was yesterday. I must have listened to it a thousand times before begrudgingly giving it back to its rightful owner. But that wasn't yesterday, it was when we were in high school in the early 90's. In fact, that was way back when people borrowed CD's from friends instead of "sharing" them as mp3's over peer-to-peer networks. Since Greg wanted his back, I actually went out and bought my own -- how many high school kids do that anymore? Holy crap, I AM OLD!

Monday, March 17, 2008

Oracle on Windows Authentication Woes (And Solutions)

For my current project, I need to have my own development Oracle instance. Instead of carving out space on one of the servers, I figured it's a good time to just bite the bullet and install Oracle XE on my desktop (Windows XP). For the most part, it has been a fairly painless experience.

Except that several times already, when trying to run imports or simply connecting via SQL-Plus, I get the following crap:
C:\oraclexe\app\oracle\product\10.2.0\server\BIN>sqlplus XXXXXX/XXXXX

SQL*Plus: Release - Production on Mon Mar 17 08:50:29 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.

ORA-12638: Credential retrieval failed
The first time it happened, I simply restarted the OracelServiceXE and OracleXETNSListener services. Then it happened again today, and restarting services had no effect. And I am NOT rebooting my whole machine just to get Oracle to work.

But thanks to someone named "babu george" on this forum, I fixed the issue quite simply by getting rid of NTS authentication.

In your sqlnet.ora file, simply comment out the (NTS) line and create a new line with (NONE) in place of (NTS).
Alas, don't get me started on how much I love Windows.

Friday, March 14, 2008

Trashy Yet Effective Oracle Trick

I need to post this so I can remember it next time I screw up...

I was running an Oracle import (imp) on my local Oracle 10g XE instance today, and realized I did it incorrectly and imported everything into the SYSTEM schema. Oh crap, I can't just wipe everything out, it's my SYSTEM schema! I need surgical precision to only remove the crap and leave all the Oracle stuff unscathed.

I could go through and drop each table I created, but there were hundreds.

Then, like a tornado in a trailerpark, it hit me. An idea that walks the fine line between genius and insanity. All the new table names started with a common prefix, which for sake of discussion I will call "BLAH_". So in Squirrel I run the following query:

select 'drop table system.' || table_name || ';' from all_tables where owner = 'SYSTEM' and table_name like 'BLAH_%'

Then cut and paste the results back into the Squirrel query runner and run the results as a script.

I'm sure there's an "official" way to accomplish the same thing, but screw that, this was extremely quick and kind of fun.

Trashy yet effective.

Tuesday, March 11, 2008

Whores, Spitzer, Swallows

I don't usually dive into politics on here, but everyone loves a good high profile prostitution sting....

With Gov. Spitzer, a.k.a. Client #9, getting busted using the services of a high class prostitution ring, some serious questions need to be answered. I'm not talking about the normal political crap like will he be impeached?, will he resign?, will he be arrested?, will other high-profile clients be outed?, etc. I'm mean questions like, what is the difference between a high priced hooker and a regular street hooker, anyways?

Really, they both take money from strangers and then slide down the dudes' meat-poles. They collect more DNA samples in a day than the CSI folks collect all year. That's a nasty, filthy whore, whether it costs $50 or $5000.

So what does the extra cash buy?

  • Is there such a thing as a higher class of venereal disease?
  • Does draining your man-goo feel better when you also drain your bank account?
  • Is it somehow less disgusting to think a thousand rich dudes impaled the whore with their man-swords, as opposed to a thousand regular dudes?
  • Do they share a glass of champagne with you after the deed, instead of hitting the crack pipe and watching Jerry Springer?
  • Do you get a souvenir hat or t-shirt or something? Like when you ride a roller coaster and they snap your picture coming down the big drop off?
Hindsight being 20/20 and all, I'm guessing the soon-to-be-former-governor of New York is probably thinking a 6 pack of Corona, a bottle of hand lotion, and some adult pay-per-view might have been the safer choice for a night out on the town.

Thursday, February 28, 2008

Anticipation is Worse Than Real Thing

Well, they say the anticipation and waiting is harder than the actual event, for example waiting for a dental procedure or something like that. They're right -- 2 of my recent stresses have been relieved in the past two days, and all the fretting has been for nothing.

My truck passed NYS inspection without even needing so much as a windshield wiper blade. I was worried about the rear brakes, since the front ones were in such bad shape when I did them last month (needed new pads, new rotors, and on one side I ended up replacing the whole caliper and shearing off a banjo bolt, but that's another story). Getting the brakes replaced would have cost a butt load of cash we just don't have right now.

Then yesterday we finally got our act together and did our taxes. The big nagging fear, no matter how much math you do throughout the year, is that all of a sudden we owe the government butt loads of cash we don't have. Nope, we're still getting a return -- nothing too elaborate, but at least we're not paying.

Goes to prove another saying right -- "Procrastination is a lot like masturbation. It feels good while you're doing it, but in the end you just screw yourself".

Monday, February 25, 2008

FCKeditor - Embedded HTML Editor

For a recent project, I wanted something fancier than a regular HTML text area to allow user input with formatting. "Something like the editor on Blogger", I thought.

After hitting Google, I ran across FCKeditor. I had heard of it before, and even played with the demo once, but never did anything with it. Never had much of a reason to. Today that all changed.

After reading through the Developers Guide, I downloaded the ZIP, unpacked into my public web directory, and had it working in no time. In less than 30 minutes, I had the FCKeditor completely tied into an existing Rails form, replacing a boring old text area. After a few minutes of testing inserts and updates, and some cross-browser testing with Firefox and Internet Exploiter, I was happy.

There were only a few lines of JavaScript code to add to the page, and those are all spelled out in the Developer's Guide, so I don't feel the need to repeat those here.

Overall, I was pleasantly surprised. Unlike a lot of open source projects out there, this was extremely easy to get started with, easy to install and embed into existing applications, and the documentation was pretty good for a change. The quality so far has also been nothing short of impressive. (the editor is more full-featured than the one Blogger uses.)

It's licensed under the GPL, LGPL, or MPL (your choice), and can be embedded in any project, open source or commercial. Also, in addition to the JavaScript version I used today, there are versions for JSP, ColdFusion, PHP, Python, etc.

This project today was just a personal side project, but I think FCKeditor might find it's way into my arsenal for work projects as well.

Thursday, February 07, 2008

Reading And Writing Text Files in Ruby

On a recent project, I had everything automated up to the point where I had to give feedback to the business analysts on what, if any, of their data had to be fixed and re-run.

I ended up writing some Ruby scripts to run through a file of transaction responses, and sort out the various error types into separate files, and produce a summary report of the error counts in each category.
Now the only manual part was cutting and pasting the summary into an email, and attaching the various sorted files.

I was pleasantly surprised at how easy it was to read and write text files in Ruby. Let's say you just want to read a text file, line by line, and spit it back out, a la "cat"..., "r").each { |line| puts line }
Wow, that was easy, eh? Let's try reading that file into an array for use later...
results = [], "r").each { |line| results << line }
Let's say you want to capitalize everything in the file, and spit it out to a new file...
out_file ="upper_case.txt","w")
results.each do |line|
out_file.puts line.upcase

That was easy. It's probably obvious, but the first argument passed to the File constructor is the filename, and second is the read/write flag.

For comparison' sake, let's read a file in Java and spit it out line for line...
BufferedReader is = new BufferedReader(new FileReader(fileName));
String line = "";

try {
while (line != null)
line = is.readLine();
catch (Exception e) { /* do nothing for now */ }
try {is.close();}catch(Exception f) { }

Definitely not "hard", but it is a bit more code. Writing a file is very similar, except of course you use FileWriter and BufferedWriter instead of FileReader and BufferedReader, and write to the file instead of reading from it.

I'm not really trying to prove anything here -- Ruby isn't better than Java, Java isn't too hard or too verbose, etc. I like Java. I like Ruby. Against my better judgment, I even like Oracle, but that's another topic. I just found that working with files was easier than I expected, even for a Ruby beginner like myself.

Tuesday, February 05, 2008

Funny Thing About Taxes

The other day's product description included a funny little rant about taxes....

"The worst thing about taxes is that you’re supposed to compute the total yourself. What if you ate at a restaurant and when you said hey, what do I owe you? They said you figure it out. And you thought about what you’d eaten and said well, I guess that’d be about $7.25, and they said no, it’s $11.40. Plus now we’re going to charge you an extra three bucks for trying to cheat us. If they knew what you owed them, what was the point of making you figure it out? Just to be jerks, probably. Or maybe in hopes you’d miss high, which is basically how taxes work."

Thursday, January 31, 2008

Lucid Vending Dreams

They better have Twinkies, Ho-Ho's, and Doritos in this machine as well, or there might be a riot when the munchies kick in....

Tuesday, January 29, 2008

More Childish Artwork

My wife got a sweet scanner/copier/fax/printer/toaster for Christmas, so I got to scan a piece of "art" I did with my kids. I guess it's a redneck programmer, complete with bad teeth.

And the other one is a duck....