Finding line count in DOS

In Unix, there's this nifty binary called "lc" which gives you the line count of the file.

However, in DOS, you have to be a little more creative. Below is a DOS command I use to count the number of lines in a text file.

FIND /v /c "nonsense" filename.ext

The "nonsense" parameter is some text that is sure not to match any line in the file.

How to get JAX-WS Web Service Method Name

I'm not sure if this will always work, but here is some sample code that I put into a Handler to log the web service method name that is being called. I wanted to be able to track each method, and see which ones were getting use.

This web service was running on IBM WebSphere 6.1.


public boolean handleMessage(LogicalMessageContext context) {
	String webMethodOperationName = null;
	try {
		Field mepCtxField = context.getMessage().getClass().getDeclaredField("mepCtx");
		mepCtxField.setAccessible(true);
		Object mepCtx = mepCtxField.get(context.getMessage());
		
		Field requestMCField = mepCtx.getClass().getDeclaredField("requestMC");
		requestMCField.setAccessible(true);
		Object requestMC = requestMCField.get(mepCtx);
		
		Field operationDescField = requestMC.getClass().getDeclaredField("operationDesc");
		operationDescField.setAccessible(true);
		Object operationDesc = operationDescField.get(requestMC);
		
		Field webMethodOperationNameField = operationDesc.getClass().getDeclaredField("webMethodOperationName");
		webMethodOperationNameField.setAccessible(true);
		webMethodOperationName = (String) webMethodOperationNameField.get(operationDesc);
	}
	catch (Exception e) {
		log.warn("Cannot find method name of operation.");
	}
	
	System.out.println(webMethodOperationName);
	
	return true;
} 

Simple Lego Ship (with Blender mesh files)

This is a 3D model of a Lego ship that we made (over and over) when we were kids. For some reason, the simplicity of the space craft facinated us. We made many other spaceships, but this one stuck with me for some reason. Here's how it fits together.

The image below shows the pieces required. They are (from left to right): thruster, jet booster, seat, and steering wheel.

Lego Ship Pieces

This next two images shows it going together.

Lego Ship Step 1

Lego Ship Step 2

Finally, here's the ship fully assembled.

Lego Ship Fully Assembled

Here's how the ship looks with a Lego Astronaut on it.

Lego Ship and Man

Finally, we also had an alternative version where the thruster is a gun. I don't know if I like this one or not. It would definitely be more useful in a hostile environment, though.

Lego Ship and Man with Gun

I've also saved the Blender mesh files below. Feel free to download and use them.

Download the Blender mesh files

Lego Astronaut Blender Mesh Files

Lego Astronaut

Here is a Lego man that I did with Blender (v 2.4.9). I've decided I would post this, since when I did a search for one, I couldn't find one. I will try to keep it up to date. The link to the mesh files are below.

Download the Blender Files (this contains LegoMan.blend, face.jpg, and suit_logo2.jpg)

My First Indigo Bunting Sighting

Since I started paying attention to birds just a few years ago or so, I've always been fascinated with the Indigo Bunting. Probably for two reason. One (in my opinion), it's one of the more exotic looking birds that Minnesotans can see. And two, no matter how hard I tried, I could never see one in the woods. Just pictures in books. It always bugged me.

This morning that all changed though. While I was sitting at the breakfast table, I looked out at the feeder. At first I thought "that's an indigo bunting out there!" But, since that's never my luck, I figured it must be a bluebird. Once I saw that the chest was also blue, though, I ran and grabbed my video camera.

I couldn't believe it. I was actually seeing an indigo bunting. And, not out in some quiet, wooded area, but right in my back yard. Right here in Saint Paul, MN. When I got back to the window with the camera, it was still there. And, it stayed there for quite some time. Here's the video.

The funny thing is that lately I began thinking my back yard lacked bird traffic. It doesn't have a lot of trees, so I've always figured I'd have problems getting birds to visit. Now, I wonder if these sightings are more common than I think. I haven't really been bird watching for long, so it was definitely a blast to see. I hope it comes back again soon.

Best CSS trick I’ve ever needed to know

I often have to put CSS hacks in my HTML (thank you IE6), and when I do, I usually refer to this simple set of rules to help me determine what browsers I need the hack to work for.

Essentially, it boils down to this:

1) A dot in front of a style will cause the style to only be read by IE 6 and IE 7.
2) An underscore in front of the style will cause the style to only be read by IE 6.

See below:

margin-top: 1px; /* All Browsers */
.margin-top: 2px; /* Read by IE6 and IE7 only */
_margin-top: 3px; /* Read by IE6 only */

Here's a link to the original post.

Enjoy.

Vali-Hi Drive-In

I don't know, for some reason, I like this photo. It was taken randomly doing 55 mph east on I-94. Under those conditions, I thought it turned out pretty well.

Vali-Hi Drive-In

I love drive-ins. The Vali-Hi drive-in is a great place for the family to go. There's nothing like sitting outside to watch a movie on a summer night. My only hope is that these will still be around when my kids are old enough to stay up until the first showing.

Making Gravlax

Recently, at a party, I experienced Gravlax for the first time. When I asked about the recipe, I was told it was easy to make. As a salmon lover, this was perfect for me. So, I had to make it for myself. Here's how it went.

Note: This isn't a real recipe. I'm just paraphrasing what I did. You can find many great recipes out there if you need to follow more strict rules.

Step 1: Get a fillet of fresh Atlantic salmon. I froze my fillet for 7 days after I bought it. This may or may not have already been done. Also, it may or may not have been necessary. But, 7 days in the freezer should kill any chance of getting ringworm. So, I took the extra precaution.

Atlantic Salmon Filet

Step 2: Mix 1 part salt and 1 part sugar. Optionally, you can add crushed pepper. Rub the mixture into the salmon.

Salmon Salt and Sugar Rub

Step 3: Next, add dill. Don't skimp on the dill.

Chopped Dill

Step 4: Now, wrap up the salmon with a plastic wrap or aluminum foil.

Wrapped Gravlax

Step 5: Put the salmon in the refrigerator. Let it cure in there for 3 days, turning it over once each day.

Step 6: Slice up and serve. I added some capers, dill, lemon, red onion, and cream cheese.

Gravlax

Odd-Looking Grasshopper

Red Grasshopper

I've never seen a grasshopper like this. So, I thought I would post a picture to share.

It's shorter and stubbier than what I've usually seen. It also appears to be a little red.

What's stranger is that was another identical one nearby that was white. It was gone by the time I came back with the camera, though.