Tuesday, November 06, 2007

Customizable classes for objects

Thoughts on object oriented programming, classes, objects and polymorphism

I am in the middle of a project that involves code from another organization. This organization is trying to make their code as flexible as possible through configuration settings, user only classes and templates. I also maintain code for another system from another organization that provides no flexibility for customization of code. I starting thinking, did some Google searches, and didn't find anything; so I'm putting my thoughts here.

The typical class design model I see in all media is the base class containing all the base functionality then you extend that class one or more times to provide additional logic. So myFoo extends Foo. Foo contains a lot of good methods and logic but my organization needs one additional property and method; myFoo is created. Here is where I start thinking this sucks. Any class that instantiates Foo, must now instantiate myFoo instead.

If the external organization delivers those classes we changed to use myFoo, now we must go back and make those changes again.

Wouldn't it make sense to deliver a Foo that extends a baseFoo, have all the classes that use Foo just use Foo? The developing organization makes changes to the baseFoo classes and the customizing organizations make customizations to the Foo classes.

This method of class design is just as vulnerable to catastrophic changes as the widely taught method. If you change the data schema you will still need to change the data objects, business objects, presentation objects, etc. Nothing will prevent that mess for occurring or, well, being a mess. If, however, a hundred classes use Foo would it make sense to change all (or ones that need) to use myFoo?

Tuesday, October 23, 2007

Blast from the past

I came across some really old "vanity web page" crap I did back in 1998. It was just a start and never got published but, hey.

Bachelor Necessities

As a bachelor with many (too many) years of experience I feel it is my duty to document my experience somewhere. For those of you about ready to embark on the journey of bachelor life or those already on the trodden path, here are some things you might want to pick up along the way.

A Mini Fridge
This really isn't a necessity but something, for some strange mystical reason, a guy must have. Typical uses: beer. Typical placement: garage, basement, bedroom, television room - wherever you spend the most time. Estimated cost, $100.
George Foreman Grill
God bless you George "look at the lines, that's good eatin'" Foreman. This little bugger is so helpful and so easy to use any guy, no matter how dumb you are, can master one. Doesn't do a good job on steaks with bones in them but is perfect for frozen chicken breasts (don't bother thawing, just chuck'em on), burgers, fish, and just about all meats. Estimated cost, about $70.
An Outdoor Grill
You can go propane but you'll find you get the most use out of a small charcoal grill you can take with you in your car or let rust on your back porch/front step. Estimated cost, about $30.
Crock Pot
Another gift from the heavens to the bachelor. Just follow the recipes that come with the device. So easy, I was actually able to teach my dumb-ass complete waste of an ex-friend "L" how to cook. See my chili recipe. Estimated cost, about $40.
Microwave
Like, duh. Just buy a good one then treat it well and it will outlast you, all the women you are intimate with, and probably every dwelling you'll ever be in (even your casket). Estimated cost, who the hell knows - I bought mine ten years ago.
Big Screen TV
Even if you are stuck in the bedroom of your parent's house, you need a big screen TV. The big screen TV represents the following: a symbol of your manliness you can share with friends at football parties, a showcase for your best DVD movies and/or your porn collection, and a constant reminder of just how in debt you really are. Estimated cost, about $3600 (gotta get a good one, man).

Chili ala' Grouch

If you read my "bachelor necessities" above you should have noticed a crock-pot as one of the items there. This is what I use because a) I'm lazy, b) I'm a guy and need the flexibility of a crock-pot to hide my cooking inadequacies.

Ingredients

  • Two pounds of ground chuck or ground round (i.e. raw hamburger)
  • A can of chili beans
  • A can of tomato sauce (name brand, no generic)
  • A can of tomato paste
  • A can of diced tomatoes (or cut up a bunch of tomatoes, no seeds)
  • A can of green chilies (usually found in "Mexican" section)
  • One stalk of celery
  • One onion
  • Two green peppers
  • One jalapeno pepper
  • Two or more cloves of garlic (comes in bulbs, peel them to get cloves)
  • Chili powder (spice)
  • Pepper (the kind you shake)
  • One bay leaf (another spice) or Chinese 5-spice (yes, a it's a spice too)
  • Cumin (a spice)

Instructions

  1. Brown the ground beef (this means you cook the hamburger until it turns brown, I had a family member that wondered why his chili had so much blood at the top - he was adding it raw). Here is how I do it: a) throw the wad on my George Foreman Grill, b) insert the sliced cloves of garlic into the meat, c) liberally add pepper and chili powder, d) grill, e) crumble into the crock pot.
  2. While your biff is browning, cut up the veggies. Put the onion, celery, and jalapeno (and garlic) into the crock.
  3. Open the cans. Dump in the green chilies.
  4. Drain the grease from the beef (or don't, I don't care) and put it in the pot.
  5. Add the bay leaf (or a couple shakes of 5-spice), a pinch of cumin, some pepper, some chili powder.
  6. Dump in the tomato paste, then beans, then tomato sauce, then rinse cans with about a cup (measuring cup, i.e. a little bit) of water then dump into crock.
  7. Start cookin (5-7 hours on high, 10-12 hours on low).
  8. About one (high) or two (low) hours before the chili is done, stir in the green peppers. The reason I do this is because when I added the peppers at the beginning that's all I could taste in the chili - green peppers.
  9. When done cooking, serve hot and enjoy with a beer. Don't ruin with crackers or I'll shoot you.

Variations: Tex/Mex". Replace can of chili beans, stalk of celery, and green peppers with black and/or pinto beans, a half a can of corn, a red pepper and a yellow pepper. Unlike the chili beans (which usually come in a sauce), you should drain and wash the black/pinto beans.

Dealing with Depression

If you are like me, and (according to some news sources) like over thirty percent of the population in the United States, you deal with depression on (sometimes) a daily basis. These feelings usually manifest themselves in the form of feelings of hopelessness or you might feel tired all the time.

What not to do.

Drugs are NOT the Answer.

When I say drugs I am describing anything from prescription drugs like Prozac to binge drinking. Drugs are only a temporary solution to the problem and usually make things worse. I have seen some co-workers on the drug Prozac and they are both psychos, one step away from full-out fruitcake. I have family members on different prescriptions and they aren't any better. One has been on various prescriptions for twenty (yes, 20) years. The physicians just keep giving him the line "let's try this one". These quacks have no idea what they are doing, they just continue to milk the system. One of my friends smoked marijuana (i.e. pot, reefer, weed) to escape his depression. That loser is still depressed and now half his tenth-grade brain is gone. The common thread is that all of these people are still taking drugs and they are all still just as depressed, if not more than they ever were.

Shrinks are NOT the Answer

If you a rock star or some wealthy Hollywood name, then a "shrink" might work for you. For the rest of us that need to work for a living, you might as well just stop someone on the street or sit next to someone at a fast food joint because you are likely to get the same answers. Basically you pay a "shrink" to listen and make observations but every single session boils down to a prescription (see above). They do not have the answers or if they do they are canned answers you could probably get from a box of cereal or Miss Cleo. I saw a psychiatrist once, and that was enough. There are no easy answers to anything, but there is something that can be prescribed.

Is God the answer?

Maybe… Part of the problem with religion or other social groups is that they remove your self-esteem by placing everything in someone else's hands. Instead of depending upon yourself, being responsible, and understanding your strengths and weaknesses, everything is now controlled by an external entity (i.e. God or insert religious icon here). It works for you if you can completely give yourself. For most people it works temporarily until that first bout of doubt sets in, then there is the possibility

My Solution?

Be depressed.

Seriously. Believe it or not, depression is a completely normal state of being just as happiness, sadness, ecstasy, and indifference are. It's okay to be depressed. If you are depressed, chances are good there is a reason why you are depressed. A couple of days later, you might still be depressed or you might do a one-hundred percent turn-around and be glowing with joy. It might even take a month or a year or your entire puberty. It's part of life. Depression makes happy days happier but can be overwhelming at times. Most people that "suffer" from depression have succumbed to it. Don't succumb to it. When the day is done, go over to the calendar and mark off the day because it's over.

Monday, October 01, 2007

Quick comments on CentOS 5

I have installed CentOS 5 on three machines so far; here are some notes:
  • all three machines needed the boot time linux resolution:1024x768 to get a usable display on the anaconda installer and lvm is not available if you install in text mode
  • it took four hours to get a workable desktop install (including updates, not including additional software)
  • on an IBM Thinkcentre I've had to disable then enable the network interface each time to get Internet connectivity
  • the Gnome desktop looks nice, a little cleaner than Ubuntu (I like the blue and themeset)

Tuesday, August 28, 2007

C#/.Net vs Java vs ?

C#/.Net seems like a solid language and framework but you are locked into Microsoft for just about everything.

Java has so many frameworks and layers that it's hard to keep track of all of them. Then again, it has support from IBM, Oracle on the high-end and in the Open Source world and can be lightweight to almost overkill (EJB).

Thursday, August 02, 2007

A few things to think about

  • Can you cry under water?
  • How important does a person have to be before they are considered assassinated instead of just murdered?
  • Why do you have to "put your two cents in".. but it's only a "penny for your thoughts"? Where's that extra penny going to?
  • Once you're in heaven, do you get stuck wearing the clothes you were buried in for eternity?
  • Why does a round pizza come in a square box?
  • What disease did cured ham actually have?
  • How is it that we put man on the moon before we figured out it would be a good idea to put wheels on luggage?
  • Why is it that people say they "slept like a baby" when babies wake up like every two hours?
  • If a deaf person has to go to court, is it still called a hearing?
  • Why are you IN a movie, but you're ON TV?
  • Why do people pay to go up tall buildings and then put money in binoculars to look at things on the ground?
  • Why do doctors leave the room while you change? They're going to see you naked anyway.
  • Why is "bra" singular and "panties" plural?
  • Why do toasters always have a setting that burns the toast to a horrible crisp, which no decent human being would eat?
  • If Jimmy cracks corn and no one cares, why is there a stupid song about him?
  • Can a hearse carrying a corpse drive in the carpool lane?
  • If the professor on Gilligan's Island can make a radio out of a coconut, why can't he fix a hole in a boat?
  • Why does Goofy stand erect while Pluto remains on all fours? They're both dogs!
  • If Wiley E. Coyote had enough money to buy all that ACME crap, why didn't he just buy dinner?
  • If corn oil is made from corn, and vegetable oil is made from vegetables, what is baby oil made from?
  • If electricity comes from electrons, does morality come from morons?
  • Do the Alphabet song and Twinkle, Twinkle Little Star have the same tune?
  • Why did you just try singing the two songs above?
  • Why do they call it an asteroid when it's outside the hemisphere, but call it a hemorrhoid when it's in your butt?
  • Did you ever notice that when you blow in a dog's face, he gets mad at you, but when you take him for a car ride; he sticks his head out the window?

Friday, July 27, 2007

LVM on Linux

I feel stupid for saying this but I played around with LVM on Ubuntu Linux for the first time today. I need to get out more. The benefits to LVM are flexibility. The major downside is critical failure of a physical volume will screw all logical volumes in that pool. Ubuntu Linux has LVM almost completely automated; just choose use the whole disk with LVM and it creates a non-LVM boot partition then a physical volume with the rest. Easy. Adding another physical disk was easy:

root@homer:~# fdisk -l

There will be a message similar to this one, "Disk /dev/sdb doesn't contain a valid partition table", if the disk is brand new. If not, the partition table might require some modifications.

root@homer:~# fdisk /dev/sdb

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-130, default 1):
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130):
Using default value 130

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

The pvdisplay command can be used to determine the volume group name (VG Name) and display physical volumes. Now to create the physical volume, extend the volume group to include the new physical volue, then create a logical volume within the group.

root@homer:~# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created

root@homer:~# vgextend Ubuntu /dev/sdb1
Volume group "Ubuntu" successfully extended

root@homer:~# lvcreate --name share_01 --size 1016M Ubuntu
Logical volume "share_01" created

Once created, put the ext3 filesystem on the new logical volume

root@homer:~# mkfs.ext3 /dev/Ubuntu/share_01
mke2fs 1.38 (30-Jun-2005)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
130048 inodes, 260096 blocks
13004 blocks (5.00%) reserved for the super user
First data block=0
8 block groups
32768 blocks per group, 32768 fragments per group
16256 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

Create a mount point then modify the fstab so this new volume mounts.

mkdir /share
root@homer:~# cp /etc/fstab /etc/fstab_20072707
root@homer:~# vi /etc/fstab

Note the backup of fstab made! Reboot the machine and the new logical volume should be available on the mount point

Adding another drive to the pool was just as easy:

root@homer:~# fdisk /dev/sdc

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-130, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130):
Using default value 130

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
root@homer:~# pvcreate /dev/sdc1
Physical volume "/dev/sdc1" successfully created
root@homer:~# vgextend Ubuntu /dev/sdc1
Volume group "Ubuntu" successfully extended

To increase the size of the shared volume:

root@homer:~# umount /share
root@homer:~# lvextend -L2032M /dev/Ubuntu/share_01
Extending logical volume share_01 to 1.98 GB
Logical volume home_01 successfully resized
root@homer:~# e2fsck -f /dev/Ubuntu/share_01
e2fsck 1.38 (30-Jun-2005)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/Ubuntu/share_01: 11/130048 files (0.0% non-contiguous), 8197/260096 blocks
root@homer:~# resize2fs /dev/Ubuntu/share_01
resize2fs 1.38 (30-Jun-2005)
Resizing the filesystem on /dev/Ubuntu/share_01 to 520192 (4k) blocks.
The filesystem on /dev/Ubuntu/share_01 is now 520192 blocks long.

root@homer:~# mount /dev/Ubuntu/share_01 /share_01

Too easy... Here are some links that were very helpful:

Thursday, July 19, 2007

On through the Blog-o-sphere

Occasionally, usually at work when my brain has numbed to the point of being able to be attached to a pole and used to mop floors, I'll use the Next Blog button at the top and just go through the Blog-o-sphere. Here is what I found:
  • 1 epileptic seizure inducing
  • 4 done by 18-21 year old that write like 8 year olds
  • 1 well done, with good content
  • 3 Orientals with nothing better to do than spend money and post pictures of what they ate that day
  • 2 foreign language, living in America complaining about America
  • 1 learning English, living in America, and complaining about America
  • 9 foreign language, outside of America
  • 1 horribly hip, teenage / college student with six zillion picture phone images
  • 1 test / single nothing post
  • 2 myspace wannabe, break stylesheet, l337 individual
  • 1 foreign student in America
  • 1 cool, but with a hundred embedded youtube objects
  • 1 ugly with a hundred embedded youtube objects and link buttons
  • 1 spam
  • 1 American documenting her travels abroad
  • 1 comic book related
  • 1 real estate broker
The good news is the spam blogs are disappearing and almost gone. Also, the myspace wannabe and seizure inducing blogs are down as well. Hopefully they all went to myspace where it's okay to have six jillion youtube objects, pictures, horrifying templates and all sorts of cool but worthless crap. There are a lot of foreign blogs now, which I can't read. The blogs written in English are written at a kindergarden level. Oh well, I can't complain though. I'm certainly not perfect. I do think the blogging craze is starting to die down a little; maybe youtube and similar directions are now the cool thing and blogging is just, ick, words.

Overpriced on eBay

Sometimes I just don't understand buyers on eBay; sellers, too.

I've been watching a specific Dell LCD for a little while now. It retails from Dell at around $320 brand spanking new shipping and tax included. Someone just bought a used one, no warranty, no return instructions from the seller for $321 after shipping on eBay; and they probably would have spent more. The other four almost identical options are shaping up to be similar bidding slap-fests that will end near or over the purchase price for a brand new item with warranty and vendor support.

One seller was selling SATA 150 drives as SATA II drives. When I asked a question about the model number not being the same as a spec from the auction it went unanswered. This seller usually opens up a lot of six to eight of these with very short open times, around a day or less.

I like Shuttle computers, the mini-xPC a.k.a. shoebox computers. A lot of them are being sold as "normally sell for $300 or more"; which is not the case. Not really true for these, though, more like $240 tops and for older technology. You can buy a newer model with current socket / chipset for around $190 plus the memory and processors are actually priced the same or cheaper for more capacity.

Tuesday, July 17, 2007

Blogger to mySQL

The goal of this process was to get the Blog of the Dead (the story blog I work on) into a mySQL database at another location so new readers could start from the beginning then read the blog chronologically starting with the first gripping hours up through where I got bored with the whole thing. Blogger really wasn't designed to relive a story or sequential posts but it suited my purposes at the time.

The mySQL table uses the post date and time as the primary key and includes the author, Blogger permalink, post title and post body. I didn't save comments. Originally I looked at the Google API set but that only seemed to work with recent posts and you had to have feeds enabled.

Note: this only works for Bloggers using the classic templates (like me).

Step 1: Save your existing template

Copy the code for your existing template and save it somewhere locally, you will need to restore it later

Step 2: Replace your template

<Blogger><$BlogItemDateTime$>»<$BlogItemTitle$>»<$BlogItemAuthor$>»<$BlogItemPermalinkUrl$>»<$BlogItemBody$>
«</Blogger>

Step 3: In Settings | Formatting

  1. set Show to 999 days on main page
  2. set Timestamp format to MM/DD/YYYY HH:MM:SS AM|PM
  3. set Convert line breaks to no

Step 4: In Settings | Archiving

  1. set Archive Frequency to No Archive

Step 5: View your blog

Save the source for your blog somewhere locally

Step 6: Reset everything

Reset your formatting and archiving settings then template back to their original settings and content.

You should now have a text file that will need a little massaging to get into mySQL. I used UltraEdit to get the date/time into an ISO standard format and convert Windows CR/LF combinations to simple CR's. The resulting text file can be locally loaded with no column enclosures, no escape characters, \r plus the line terminator character as record ends, and the column separator character as your column separator. I'll revist this later with more details instructions with SED, etc.; I simply wanted to get my notes stored somewhere.

Thursday, July 05, 2007

VMWare Server networking tips

If you are installing a Linux operating system and using two virtual network interfaces: one bridged (i.e. can see the real interface and get to the world) and one host-only, define the host-only interface first then when finished with the virtual machine wizard add the bridged interface. The host only will be assigned eth0, the bridged eth1. On installation each will use DHCP and the nameservers for eth1 will by default override those for eth0.

Monday, June 25, 2007

Testing 1-2-3

I want to see how labels are handled with classic templates.

<p>I want to see how labels are handled with classic templates.<p class="blogger-labels">Labels: <a rel='tag' href="http://grouchgeek.blogspot.com/search/label/testing">testing</a></p></p>

It looks like Blogger just inserts a paragraph for you at the end and from the looks of the documentation you have no control over that. Nice...

Saturday, June 23, 2007

Crew cases, part two

Just a quick update. The painting is done on the two cases. The yellow case; well the paint job didn't quite turn out perfect and I gave up trying to get a nice smooth gloss after three coats of color and two clear coats. It looks good from a distance or on casual notice but when you get close you notice the dull spots. Oh well.

Still left to do are the Crew logo, the "Columbus Crew" on one of the 5 1/4" drive panels, and possible the LH in a circle (for Lamar Hunt). The black case is fully operational with and AMD X2 processor, 4GB ram, 500GB and 80GB x 2 RAID-0 running Ubuntu Linux 64bit 7.04 desktop. This machine will serve as a VMWare Server server development system with images on the striped array; with management, squid cache, apache, tomcat, mysql and maybe Oracle images. Fun. The yellow will be a Windows 2003 Server based development machine and swap out drive sets with Linux based server development.

Thursday, June 14, 2007

Informative links about computers

Just putting this here for my own personal reference and might build on it in the future; or have other people build on it.Power supply buyer's guide

Monday, June 11, 2007

No more FOX in the mornings

I am no longer going to wake up on the weekends to watch FOX and Friends on weekend mornings. This weekend on Bulls and Bears there were two blondes, one arguing and spouting off one-sided political vomit about another worthless blonde that deserves zero publicity. Ann Coulter discussing Paris Hilton. Good lord. One annoying stick figure she-male talking about a talentless socialite stick-figure.

That's it. No more.

I almost tuned out when they took Juliet Huddy off but then there was Kiran Chetry to look at but now Kiran is with CNN replaced by Gretchen Carlson and now Page Hopkins. I like Page but she's no Juliet or Kiran.

Ann Coulter discussing Paris Hilton was the last straw, though. Two days later and my stomach is still sore and unable to accept anything stronger than pudding or yogurt. (And I do realize that discussing this is actually "publicity" for both but if some lowly blog like this one is "publicity" then that actually makes me feel a little better about the rest of the world that thinks both need to be forever hidden from the public eye in a jail or sealed in lucite or carbonite or something).

Wednesday, June 06, 2007

Keeping CPUs busy

I guess I either don't understand the finer points of computer performance or don't understand why some people don't understand what I consider to be simple knowledge about computer performance.

"The CPUs on the server are running at high utilization, 60 to 80 percent"

Okay. So?

Are you paging (swapping) heavily? No. Is the disk I/O rate normal, low or very heavy? It's about normal. Is there a looping or run-away process or service? No.

Then what is the problem? (this isn't happening with my current employer, by the way)

It seems to me that if you aren't paging then you are not using all of your server's memory, else you would be swapping and that could be bad. If there are no looping processes then the software and operating system are functioning normally. If the disk (or network) I/O are normal then the software is reading and writing data like it should be. Again, what is the problem because it sounds to me like the CPUs are doing what they are supposed to be doing, utilizing themselves and if your I/O rates aren't through the roof then you are probably getting a portion of the CPU utilization through application buffer and cache hits (a really good thing, by the way). You don't spend a dump-truck full of money on a bunch of processors just to have them sit there at 10 percent utilization most of the time; you want them doing work! Throw more memory at them to boost cache and buffer hit rates or if that doesn't seem to help (which sometimes it doesn't; there is a sweet spot when doing read caching just because you can only cover so much especially when data is scattered on disk) maybe consider moving temporary spaces to memory (or covering them heavily).

The point is: you want your server processors to be busy if there is work to be done. Maybe I'm wrong or just don't understand things correctly but it seems like putting a motorcycle engine on a scooter; if you're never going to have the thing above 2 miles per hour then why all the horsepower? I see the same thing on the workstation. If all you are going to be doing is surfing the Internet, typing memos and using central application software do you really need a 2.8Ghz P4 sitting there doing nothing? I got in an argument with a pro-Firefox guy recently. He said Opera can use over 160 MB of memory. So? Is any other application using it? No. Then what harm? I'd rather have Opera intelligently caching as much as possible while there is no effect on other applications. "Well it shouldn't use that much!" Sigh.

IBM has a technology called Capacity on Demand (CoD) "so companies don't have to pay for computing resources until they use them." They have on/off and reserve processing that can be activated in increments of time (like a day) for end-of-period processing or for sporadic work loads. The company I work for has already had some fun with it. There are other aspects of CoD and it is a decent idea but I have to believe that IBM isn't in it just to keep customers happy; they are making their money.

Tuesday, June 05, 2007

Subliminal ideas

Ever been on hold with some company, usually a tech support line or any other cost center that earns them zero cash, and listened to that grainy music? Ever wish when you had a caller on the line that just talks and talks and talks and talks and talks forever about nothing and just wants to vent or occupy your time? Ever wish you could put that person on hold, press a button and have something subliminal play within the music while they were on hold? I think I'm onto something here.

Lets say I'm some cable company where ninety percent of calls are people saying the cable is out even though you have a message up front saying so. When this person actually gets through they could have on-hold music that subliminally repeats "hey lard-ass, the cable will be back shortly why don't you go for a walk or ride a bike for a while?" Maybe the on-hold subliminals for a sales line would be something like "buy this product and you sure to be getting oral pleasure from your spouse or spousal life acquaintance".

Of course, the applications are endless. And they don't necessarily have to be devious, do they? How about a calm, reassuring "your mind is calm, your life is happiness" while on hold? Maybe not at a hospital or funeral home but you get the idea.

Friday, June 01, 2007

Rally's orange cream shake

Before I'm going to change back to a healthy diet of greens, proteins, fiber, plenty of water, etc. I was going to go for one last "heart-attack-in-a-sack". For those of you who don't know me personally that would be a Rally's Big Buford sandwich, fries and a soft drink. Instead of the combo meal I skipped the soft drink and got one of those orange cream shakes they have been advertising. Here is the deal:
  1. doesn't taste a thing like oranges; imagine drinking liquid candy valentine hearts (the ones with I LUV U and other dumb sayings on them), that is what it tastes like
  2. it is creamy (and foamy) but that's because it is a shake; I don't detect a dairy cream taste at all
  3. it is a shake
I'm killing the taste of the thing with the Buford but that shake is going to put up a fight for control of my stomach acids for the next five hours during which my belly will probably sound like an angry flock of geese.

Saturday, May 26, 2007

Crew cases, part one

One of my summertime projects is to modify two computer cases to bear a likeness to the Columbus Crew soccer team's home and away jerseys. I already had the black case and components so there wasn't much effort involved there. The yellow case, however, needs to be painted; transforming it from beige to yellow.

Safety first, always paint in a well-ventilated area with proper protection.

The beige case has already been wet-sanded with 600 grit sandpaper and had it's primer coat.

Here is the case after the first coat of yellow.

I've already done part of the black case. To the left of it is the guts of the yellow case.

What's left to do? I need to create a mask or stencil so I can spray paint "Columbus Crew" in Copperplate font on one of the removable drive panels. I need to find two Crew logo stickers, about an inch high, to put above that. On the other side of the logo I'd like to do the Lamar Hunt (LH) patch. I'd also like MLS logo stickers for the bottom.

Thursday, May 24, 2007

BEA JRockit on Ubuntu

I've decided to play around with Ubuntu again today using 7.04 (Feisty) desktop running VMWare Server with a 6.06 LTS server running as a guest. I wanted to get Tomcat working and was able to do so with the Sun JDK6. I also tried to get the examples to work under BEA's JRockit accelerated Java VM and here is how I installed it:

sudo -s
wget http://download2.bea.com/pub/jrockit/60/jrockit-R27.2.0-jdk1.6.0-linux-ia32.bin
chmod +x jrockit-R27.2.0-jdk1.6.0-linux-ia32.bin
./jrockit-R27.2.0-jdk1.6.0-linux-ia32.bin -mode=console

I answered the following to the prompts


1
2
/usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0


Next, I created a symbolic link for the JRocket folder (Ubuntu does this for the Sun Java and GCJ alternatives). I also updated all the "alternatives" used by Debian systems.

ln -s /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0 /usr/lib/jvm/java-6-jrockit
update-alternatives --install /usr/bin/appletviewer appletviewer /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/appletviewer 64
update-alternatives --install /usr/bin/apt apt /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/apt 64
update-alternatives --install /usr/bin/extcheck extcheck /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/extcheck 64
update-alternatives --install /usr/bin/idlj idlj /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/idlj 64
update-alternatives --install /usr/bin/jarsigner jarsigner /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/jarsigner 64
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/javac 64
update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/javadoc 64
update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/javah 64
update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/javap 64
update-alternatives --install /usr/bin/java-rmi.cgi java-rmi.cgi /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/java-rmi.cgi 64
update-alternatives --install /usr/bin/jconsole jconsole /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/jconsole 64
update-alternatives --install /usr/bin/jdb jdb /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/jdb 64
update-alternatives --install /usr/bin/jps jps /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/jps 64
update-alternatives --install /usr/bin/jrunscript jrunscript /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/jrunscript 64
update-alternatives --install /usr/bin/jstat jstat /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/jstat 64
update-alternatives --install /usr/bin/jstatd jstatd /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/jstatd 64
update-alternatives --install /usr/bin/native2ascii native2ascii /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/native2ascii 64
update-alternatives --install /usr/bin/rmic rmic /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/rmic 64
update-alternatives --install /usr/bin/schemagen schemagen /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/schemagen 64
update-alternatives --install /usr/bin/serialver serialver /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/serialver 64
update-alternatives --install /usr/bin/wsgen wsgen /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/wsgen 64
update-alternatives --install /usr/bin/wsimport wsimport /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/wsimport 64
update-alternatives --install /usr/bin/xjc xjc /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/xjc 64
update-alternatives --install /usr/bin/java java /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/jre/bin/java 64
update-alternatives --install /usr/bin/keytool keytool /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/jre/bin/keytool 64
update-alternatives --install /usr/bin/orbd orbd /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/jre/bin/orbd 64
update-alternatives --install /usr/bin/pack200 pack200 /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/jre/bin/pack200 64
update-alternatives --install /usr/bin/policytool policytool /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/jre/bin/policytool 64
update-alternatives --install /usr/bin/rmid rmid /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/jre/bin/rmid 64
update-alternatives --install /usr/bin/servertool servertool /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/jre/bin/servertool 64
update-alternatives --install /usr/bin/tnameserv tnameserv /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/jre/bin/tnameserv 64
update-alternatives --install /usr/bin/unpack200 unpack200 /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/jre/bin/unpack200 64
update-alternatives --set appletviewer /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/appletviewer
update-alternatives --set apt /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/apt
update-alternatives --set extcheck /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/extcheck
update-alternatives --set idlj /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/idlj
update-alternatives --set jarsigner /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/jarsigner
update-alternatives --set javac /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/javac
update-alternatives --set javadoc /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/javadoc
update-alternatives --set javah /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/javah
update-alternatives --set javap /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/javap
update-alternatives --set java-rmi.cgi /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/java-rmi.cgi
update-alternatives --set jconsole /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/jconsole
update-alternatives --set jdb /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/jdb
update-alternatives --set jps /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/jps
update-alternatives --set jrunscript /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/jrunscript
update-alternatives --set jstat /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/jstat
update-alternatives --set jstatd /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/jstatd
update-alternatives --set native2ascii /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/native2ascii
update-alternatives --set rmic /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/rmic
update-alternatives --set schemagen /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/schemagen
update-alternatives --set serialver /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/serialver
update-alternatives --set wsgen /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/wsgen
update-alternatives --set wsimport /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/wsimport
update-alternatives --set xjc /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/xjc
update-alternatives --set java /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/jre/bin/java
update-alternatives --set keytool /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/jre/bin/keytool
update-alternatives --set orbd /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/jre/bin/orbd
update-alternatives --set pack200 /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/jre/bin/pack200
update-alternatives --set policytool /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/jre/bin/policytool
update-alternatives --set rmid /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/jre/bin/rmid
update-alternatives --set servertool /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/jre/bin/servertool
update-alternatives --set tnameserv /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/jre/bin/tnameserv
update-alternatives --set unpack200 /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/jre/bin/unpack200
update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/jar 64
update-alternatives --install /usr/bin/rmiregistry rmiregistry /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/jre/bin/rmiregistry 64
update-alternatives --set jar /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/bin/jar
update-alternatives --set rmiregistry /usr/lib/jvm/jrockit-R27.2.0-jdk1.6.0/jre/bin/rmiregistry

I'm sure there are other things I still need to do like all the environment variables and a path but this is a good start and everything I've tried under Tomcat has worked.

Wednesday, May 23, 2007

Oracle SQL Developer on Ubuntu

This is for Ubuntu 7.04 (Feisty) desktop and hasn't been throughly tested (i.e. I got connected to our Oracle boxes, queried some data, did a happy dance, then disconnected). This assumes you are installing from a CDROM with the .rpm in a directory called Oracle and all of your SQLNet .ora files in Oracle/network/admin (tnsnames.ora and possibly others):

sudo -s
aptitude install rpm sun-java6-sdk
rpm -i --nodeps /media/cdrom/Oracle/sqldeveloper-1.1.3.27.66-1.noarch.rpm
tr -d '\r' < /media/cdrom/Oracle/network/admin/tnsnames.ora > /etc/tnsnames.ora
tr -d '\r' < /media/cdrom/Oracle/network/admin/sqlnet.ora > /etc/sqlnet.ora

Note that rpm will issue a warning about Application not being a valid desktop category but that can be ignored, SQL Developer will be in Programming on the Gnome desktop menu. The 'tr' is used just in case your tnsnames.ora and sqlnet.ora came from a Windows environment (which will cause SQLPlus and SQL Developer to not recognize entires in them).

Monday, May 21, 2007

Oracle instant client, Ubuntu, and ORA-12154

I've been pulling my f'ing hair out for a couple hours trying to figure out why I couldn't connect to our Oracle databases from an installation of Oracle's instant client for Linux on Ubuntu 7.04 (although this should apply to other installations). No matter what environment variables I set or where I placed tnsnames.ora I would always get a ORA-12154 could not resolve service name error. Here was the problem (thanks to Rajesh Jayaprakash's Linux tricks and how to's): the tnsnames.ora and the sqlnet.ora files were created on Windows and had the extra carriage returns in them. Removing the carriage returns solved the problem.

How f'ing stupid. For those that want quick installation instructions assuming you have the installation files on the root of a mounted CDROM:

sudo -s
mkdir /opt/oracle
cd /opt/oracle
unzip /media/cdrom/instanclient-basic- (etc.version.blah.blah)
unzip /media/cdrom/instanclient-sdk- (etc.version.blah.blah)
unzip /media/cdrom/instanclient-sqlplus- (etc.version.blah.blah) optional
ln -s instantclient_10_2 client
cd client
ln -s libclntsh.so.10.1 libclntsh.so
ln -s libocci.so.10.1 libocci.so
tr -d '\r' < /media/cdrom/tnsnames.ora > /etc/tnsnames.ora
tr -d '\r' < /media/cdrom/sqlnet.ora > /etc/sqlnet.ora

To use SQLplus from a shell you need to add the ORACLE_HOME=/opt/oracle variable and add /opt/oracle/client to variable LD_LIBRARY_PATH to the /etc/bash.bashrc (for example).

Wednesday, May 09, 2007

eBay, spoofs and spam

For the first time in probably over five years I decided to make some purchases off of eBay. I am in the process of building my "Fortress of Nerditude" in the basement and wanted a small wide screen LCD to serve as secondary PC display, TV, DVD screen, etc. A while ago I was looking at Dell LCD displays and since Dell no longer sells them I found some reasonably priced on eBay. So I make a bid for one but I'm outbid. Then came the flood of spoof mail and SPAM. On that single item alone I have received 17 (and counting) bogus mail messages from people claiming to the be the "seller" offering a second chance to buy the item or mail addresses to use to buy the product directly from them. This was the first time I had encountered this phenomenon but it infuriated me. Most were designed to look like authentic messages from eBay and all seem to be generated by the same program (all contain similar spelling errors). Some attempts were pathetic, in broken English. What is sad about all this is this was only one bid from a user ID that has never bid on anything else. What kind of message is eBay sending by allowing people who use the eBay system to send this crap? (I read they were changing the bidding system to hopefully eliminate this). I have a thick skin and a little tolerance for this crap but how could I recommend the eBay experience to family if getting assaulted by spoofs and spam is the result?

It's been a long time

How does that Boston song go? Oh well. It has been a long time since I've used the therapeutic power of writing to help me through life. It's not like my life has been boring and uneventful. Last month my girlfriend of almost four years (close to six if you count online and times I drove up to see her) left me to return home. She filled up a 24 foot moving truck, a couple cars and a van with stuff and headed north with her son and dog. After one weekend of feeling miserable I reversed my attitude and was determined to stay positive through the whole situation. I started looking for people and started contacting friends that I had either lost track of or simply just didn't talk to much. My search found someone who is now moved in with me and renting one of the bedrooms of my house. I have started the sizable cleanup effort inside the house and have a couple of the rooms ready to repaint. I have plans for my deck off to the homeowners association and hope to start real work on that soon.

Wednesday, February 28, 2007

Taquitos and a depressing area

I decided to cash in some of my Discover cash back bonus to get some money off a purchase at Staples, using to get a UPS battery backup for the family server so I can move the existing one to my xPC mini that doesn't have one but I think I'll leave it where it is and put the big, new UPS on my power workstation and move its UPS to the xPC. Yeah, got it. I was hungry and knew there was nothing but scraps at home so I decided to get some drive-thru.

There used to be two Taco Bell stores within a hundred yards of each other when I used to live off the southern end of Hamilton road. Eventually they closed one of the stores, leaving the one next to the Ohio BMV building open. It's in a horrible location; there is really only one way in and one way out and it is cramped. I tried one of those new grilled steak taquitos; nothing spectacular. You really can't taste the carne asada steak, just the cheese and you are encouraged to dip the things in guacamole, sour cream or salsa; three overpowering tastes. Hey it's only fast food, right? One hundred and ten fat calories later I'm sitting here wondering how dark and dreary that part of town has become.

I think the Service Merchandise was the first to go a long time ago, then the Phar-mor after that. Anybody remember Service Merchandise and how you walked around with those clipboards and when you wanted something you wrote down the catalog number then let someone process you then went to exit to get your purchases off the conveyor belt? Fun. That whole section is just dead now; pitch dark. The Good Year center is also closed. It used to be a great place to get tires until the screwed up an oil change; two extra quarts of oil in the crank case and a missing transmission fluid dipstick. More fun. Well, it's dead too. The compact disk store I used to buy all my metal music at is gone. What was the name? Twenty clicks on their card got you a free CD, which was awesome until I found stores on The Ohio State University's campus area. I could always get my music there cheaper and at a downright bargain if I waited for the used discs to roll in. I think there is a Toys R' Us back there. I used to go to Media Play for blank tapes and crap but I'm not sure if it is still there. The BWC building is shut down. The adult bookstore and a strip club are still there. Both AMC theaters are closed. The Big Bear and Central Hardware stores are long gone along with most of the shops in the immediate area. The tuxedo rental place when I got a tux for my friend Terry's wedding is gone along with the golf shop and photo store.

On the bright side, the Olive Garden still does well and there is an Ocean "something" restaurant close to it. Pizza Hut still seems open even though I admit to never having gone there. Papa Johns seems to do okay in the building that used to be a Rally's and a long time ago a Ritzy's that I worked at for a one day special event.

Of course, there is Eastland Mall. Lazarus turned into Macy's then shut down and Macy's took over Kaufmann's almost immediately after it was built. The food court has been rebuilt which is a good thing. I have purchased leather jackets from the same store under three different names. Now that store is gone.

I'm shocked at the change in the area I used to call home. It's just dirty, dark, dreary and depressing to look at.

Tuesday, February 20, 2007

Spam flood, again

Did anybody else get almost triple the amount of unsolicited emails overnight? I usually get a couple hundred but this morning I had just over a thousand waiting for me in my oldest mail account's bulk folder.

Seriously, though; why hasn't someone done something about this? Most messages I am getting appear to be from an eight year old list (i.e. great mortgage rates for the apartment I lived in eight years ago) so you figure someone would have found the ass-bag responsible for spreading that list and fed them to crocodiles somewhere. If you scan through most of your bulk mail message there isn't one damn legitimate business in there. Even if only half of the message are fraudulent, in the above case there were over 500 individual instances of attempted fraud.

Wednesday, February 14, 2007

Surviving the clear death

What started out as the "white death" promised by the weather nerds turned out to be just as bad in most places as they originally predicted. Instead of the "white" death things are more of a "clear death" due to the volume of crystal clear ice covering everything. Thankfully we were lucky and (knock on wood) have yet to lose power. After taking out the trash this morning I decided to take some photos of the neighborhood. I live outside the city and here are some shots of the ice and snow; some of them are quite pretty to look at.

The dog didn't like ice and sleet last night. Get me out of here! Poor thing had to wait for the early morning to go potty.

Tuesday, February 13, 2007

Surviving the white death

Yeah the weather was pretty bad today. It took about eighty-five minutes to get to work today only to get to spend a couple of hours of quality time with the one or two that made it in only to be sent back home again. I work downtown and live on the southeast side of Columbus (Ohio) and the local weather nerds (and nerd-ettes) were saying 4"-8" of snow plus sleet and freezing rain.

The drive home was treacherous but only due to stupidity on the part of other drivers. SR-33 south had one side plowed and those of us using it were going a steady 40 miles per hour with plenty of distance between us. I kid you not, I was passed on the left, in the unplowed portion, by some dumb-ass doing about fifty while talking on his cell phone. He had handicapped tags so I'm assuming the handicap was a mental one. Seriously, is it really worth risking your life and the life of others just to get those couple extra feet (which ended up as zero feet because I pulled into the same shopping center behind the idiot). I was also passed by one of those double-trailer trucks fish-tailing back and forth as it plowed through the slush and sleet, sending chunks of snow and ice into the air to crash against the windshield. There were two dimwits following the trucker in their SUV with no more than a car length between them. Sometimes I wonder how we survive.

The dog hates the ice. He loves playing in the snow but tends to panic and get frustrated when he breaks through the ice and sinks up to his neck in the snow beneath.

Just looking at the ice outside I cannot help but remember the ice storm we got before Christmas in 2004. This year's storm is similar in regards to what is dropping where. The volumes of snow are up north and the ice is down south. In 2004 we lost power and had to fleet to my parent's house until the power came back late night around 11pm or so. There have already been power outages in neighborhoods very close to us that were serviced by our power company. I'm hoping that the power survives the night and doesn't die on us in the middle of the night. I'm sure the noise of all the UPS battery back-up alarms going off will wake us. I think I'm going to turn the heat up a little bit just in case; the extra cost now might buy an extra couple of hours of heat if the power does go.

Thursday, February 08, 2007

Psycho SQL

Back in the old days on an AS/400 with DB2/400, we didn't have the luxury of a CASE statement or IF or DECODE and performance was at a premium when attacking a gigantic detail table. We needed a way to provide real time performance on huge tables summarizing values by quarter without the benefit of a temporary work table or sub-queries. The AS/400 did not have "if-logic" but it had MIN(value1,value2), MAX(value1,value2) and absolute value (ABS(value)) so I cheated and used those functions with some math to produce the result set.

The goal for each quarterly column was to reduce the month (m in examples below) down to a zero or a one (false and true) then multiply that times the quantity and amount being totalled (value). Zero (false) when multiplied would produce a zero and therefore not add anything to the SUM. One (true) when multipled would produce the same number and be added to the SUM.


SELECT grouping_code
, SUM(value*(1-MIN(MAX(m-3,0),1)))
, SUM(value*(1-MIN(MAX(ABS(m-5)-1,0),1)))
, SUM(value*(1-MIN(MAX(ABS(mm-8)-1,0),1)))
, SUM(value*(1-MIN(MAX(ABS(mm-11)-1,0),1)))
FROM large_freakin_detail_table
WHERE criteria = 'whattheywerelookingfor'
GROUP BY grouping_code

So you are probably wondering what the blue heck all that SUM MIN MAX ABS crap is doing. Sometimes it is best to look at results. Assume the left-most column is the month (1 through 12) and see how that number is transformed into a true (1) or false (0) through the magic of math.


SUM(value*(1-MIN(MAX(m-3,0),1)))

m-3 MAX MIN 1-r
1 -2 0 0 1
2 -1 0 0 1
3 0 0 0 1
4 1 1 1 0
5 2 2 1 0
6 3 3 1 0
7 4 4 1 0
8 5 5 1 0
9 6 6 1 0
10 7 7 1 0
11 8 8 1 0
12 9 9 1 0

The first quarter is simple: subtract 3 (March) then take the highest of that value or zero. The 0 is higher than -2, -1 and 0, but not higher than 1, 2, etc. Now we have a zero in months 1, 2 and 3 (1st quarter). By looking for the lowest value between 1 and the last result you will get a 1 for 1 or more but the zeroes will stay 0. Subtract the result from 1 (0 = 1, 1 = 0) and now you have the true/false value to multiply against an amount to either zero it or not before adding it to the SUM. Tricky, eh?


SUM(value*(1-MIN(MAX(ABS(m-5)-1,0),1)))

# m-5 ABS r-1 MAX MIN 1-r
1 -4 4 3 3 1 0
2 -3 3 2 2 1 0
3 -2 2 1 1 1 0
4 -1 1 0 0 0 1
5 0 0 -1 0 0 1
6 1 1 0 0 0 1
7 2 2 1 1 1 0
8 3 3 2 2 1 0
9 4 4 3 3 1 0
10 5 5 4 4 1 0
11 6 6 5 5 1 0
12 7 7 6 6 1 0

The remaining quarters are more difficult but by using the absolute value (the positive value) you can eventually get the number you are looking for.


SUM(amount*(1-MIN(MAX(ABS(mm-8)-1,0),1)))

# m-8 ABS r-1 MAX MIN 1-r
1 -7 7 6 6 1 0
2 -6 6 5 5 1 0
3 -5 5 4 4 1 0
4 -4 4 3 3 1 0
5 -3 3 2 2 1 0
6 -2 2 1 1 1 0
7 -1 1 0 0 0 1
8 0 0 -1 0 0 1
9 1 1 0 0 0 1
10 2 2 1 1 1 0
11 3 3 2 2 1 0
12 4 4 3 3 1 0

This query used one sweep through the gigantic table and one sort for the group by. Grouping on month would have added an additional sort so that was not an option.

Wednesday, February 07, 2007

Form input validation: selective service

I while ago I attempted to locate any information on the selective service number and means of simple validation of selective service numbers collected through the Internet. The answer I received from Public and Intergovernmental Affairs at the Selective Service System was:

The first two digits of a man's Registration Number, who was born January 1, 1960, or later, will be his year of birth (such as 78, 80, 84, etc.), followed by a dash and eight other digits, making ten digits total. These last remaining eight digits are just random numbers (84-XXXXXXX-X).

Like the social security number there are no check digits hidden in the number (so, no code). To do client-side Javascript validation the appropriate regular expression would be: /^(\d{2})-?(\d{7})-?(\d)$/; or /^\d{2}-?\d{7}-?\d$/; if you didn't feel like saving components in an array.

I just love going through old mail messages :D

Useful terminology

  1. Intaxication: Euphoria at getting a tax refund, which lasts until you realize it was your money to start with.
  2. Reintarnation: Coming back to life as a hillbilly.
  3. Bozone (n.): The substance surrounding stupid people that stops bright ideas from penetrating. The bozone layer, unfortunately, shows little sign of breaking down in the near future.
  4. Foreploy: Any misrepresentation about yourself for the purpose of getting laid.
  5. Cashtration (n.): The act of buying a house, which renders the subject financially impotent for an indefinite period.
  6. Giraffiti: Vandalism spray-painted very, very high.
  7. Sarchasm: The gulf between the author of sarcastic wit and theperson who doesn't get it.
  8. Inoculatte: To take coffee intravenously when you are running late.
  9. Hipatitis: Terminal coolness.
  10. Osteopornosis: A degenerate disease. (This one got extra credit.)
  11. Karmageddon: It's like, when everybody is sending off all these really bad vibes, right? And then, like, the Earth explodes and it's like a serious bummer.
  12. Decafalon (n.): The grueling event of getting through the day consuming only things that are good for you.
  13. Glibido: All talk and no action.
  14. Dopeler effect: The tendency of stupid ideas to seem smarter when they come at you rapidly.
  15. Arachnoleptic fit (n.): The frantic dance performed just after you've accidentally walked through a spider web.
  16. Beelzebug (n.): Satan in the form of a mosquito that gets intoyour bedroom at three in the morning and cannot be cast out.
  17. Caterpallor (n.): The color you turn after finding half a grub in the fruit you're eating.
  18. Ignoranus: A person who's both stupid and an asshole.

Tuesday, February 06, 2007

George Carlin's new rules for 2007

  1. Stop giving me that pop-up ad for classmates.com! There's a reason you don't talk to people for 25 years. Because you don't particularly like them! Besides, I already know what the captain of the football team is doing these days -- mowing my lawn.
  2. Don't eat anything that's served to you out a window unless you're a seagull. People are acting all shocked that a human finger was found in a bowl of Wendy's chili. Hey, it cost less than a dollar. What did you expect it to contain? Lobster?
  3. Stop saying that teenage boys who have sex with their hot, blonde teachers are permanently damaged. I have a better description for these kids: "Lucky bastards."
  4. If you need to shave and you still collect baseball cards, you're a dope. If you're a kid, the cards are keepsakes of your idols. If you're a grown man, they're pictures of men.
  5. Ladies, leave your eyebrows alone. Here's how much men care about your eyebrows: Do you have two of them? Okay, we're done.
  6. There's no such thing as flavored water. There's a whole aisle of this crap at the supermarket, water, but without that watery taste. Sorry, but flavored water is called a soft drink. You want flavored water? Pour some scotch over ice and let it melt. That's your flavored water.
  7. Stop screwing with old people. Target is introducing a redesigned pill bottle that's square, with a bigger label. And the top is now the bottom. And by the time grandpa figures out how to open it, his ass will be in the morgue. Congratulations, Target, you just solved the Social Security crisis.
  8. The more complicated the Starbucks order, the bigger the asshole. If you walk into a Starbucks and order a "decaf grande, half-soy, half-low fat, iced vanilla, double-shot, gingerbread cappuccino, extra dry, light ice, with one Sweet-n'-Low, and one NutraSweet," ooh, you're a huge asshole.
  9. I'm not the cashier! By the time I look up from sliding my card, entering my PIN number, pressing "Enter," verifying the amount, deciding, no, I don't want cash back, and pressing "Enter" again, the kid who is supposed to be ringing me up is standing there eating my Almond Joy.
  10. Just because your tattoo has Chinese characters in it doesn't make you spiritual. It's right above the crack of your ass. And it translates to "beef with broccoli." The last time you did anything spiritual, you were praying to God you weren't pregnant. You're not spiritual. You're just high.
  11. Competitive eating isn't a sport. It's one of the seven deadly sins. ESPN recently televised the U.S. Open of Competitive Eating, because watching those athletes at the poker table was just too damned exciting. What's next, competitive farting? Oh wait. They're already doing that. It's called "The Howard Stern Show."
  12. I don't need a bigger mega M&Ms. If I'm extra hungry for M&Ms, I'll go nuts and eat two.
  13. If you're going to insist on making movies based on crappy, old television shows, then you have to give everyone in the Cineplex a remote so we can see what's playing on the other screens. Let's remember the reason something was a television show in the first place is that the idea wasn't good enough to be a movie.
  14. No more gift registries. You know, it used to be just for weddings. Now it's for babies and new homes and graduations from rehab. Picking out the stuff you want and having other people buyit for you isn't gift giving, it's the white people version of looting.
  15. And this one is long overdue: No more bathroom attendants. After I zip up, some guy is offering me a towel and a mint like I just had sex with George Michael. I can't even tell if he's supposed to be there, or just some freak with a fetish. I don't want to be on your web cam, dude. I just want to wash my hands.
  16. When I ask how old your toddler is, I don't need to hear "27 months." "He's two" will do just fine. He's not a cheese. And I didn't really care in the first place.
  17. If you ever hope to be a credible adult and want a job that pays better than minimum wage, then for God's sake don't pierce or tattoo every available piece of flesh. If so, then plan your future around saying, "Do you want fries with that?"

Tuesday, January 30, 2007

Planned Ubuntu + VMWare Server desktop

How does this sound? Ubuntu 6.10 Edgy Desktop with VMWare Server with virtual machines:
  • Ubuntu 6.06 LTS Server (dedicated apt-cacher instance)
    • bridged network - to Internet
    • host-only network - apt-cacher listening for host-only network requests
  • Ubuntu 6.06 LTS Server (web servers)
    • bridged network - from Internet; listening on HTTP
    • host-only network - to apt-cacher server, application servers, database servers
  • Ubuntu 6.06 LTS Server (application servers)
    • host-only network - communicate with web servers and database servers
  • Ubuntu 6.06 LTS Server (database servers)
    • host-only network

I figured all virtual servers should be in a protected, host-only network. Only servers that need to get to or listen for requests on the Internet would have a bridged connection to the routers and the Internet. Application and database servers would not be accessibly to any machine other than the web servers and the dedicated apt cache server. Here is my installation game plan:

  1. install base VM with Ubuntu 6.06 LTS, bare minimum, update, upgrade
  2. shut down base VM, add host-only network interface, start-up, reconfigure network, shut down
  3. clone base VM to apt-cache VM
  4. start-up then install and configure apt-cacher on apt-cache VM
  5. start-up then reconfigure base VM to use apt-cacher on the apt-cache VM; shut down base VM
  6. clone base VM to base HOSTONLY VM
  7. start-up base HOSTONLY VM then reconfigure network, shut down, remove bridged network interface
  8. clone base VM and base HOSTONLY VM based on needs

I have some questions about such a virtualized setup. Should I bind either Samba or NFS to the host only network so I can get files to and from various machines (maybe using the apt-cache machine as a distribution point)? Should I bind DNS to the host only network on one of the machines? Should I create a dedicated backup and restore machine?

Monday, January 29, 2007

Squealing clothes dryer

Try to imagine the most annoying, shrill, squeak you can imagine (something other than the wife or girlfriend nagging you about something) and imagine that happening occasionally, on and off, every time you run the clothes dryer. According to askmehelpdesk.com this is a common problem in a series of dryers and can be traced to a bad rear drum bearing. Here is where I deal out some praise and some criticism.

First of all I would like to thank "applguy" in the advice forums. His instructions were completely accurate and easy to follow down to the color of certain items and where "four hands are better than two". I had the dryer fixed in less than an hour and I consider the task pretty easy.

I purchased the Kenmore washer and dryer set from Sears and they deserve some criticism. I purchased a bearing kit from them through their online service (alternative was a phone call). The steel ball plate was not identical to the old one and the parts envelope was burnt at the bottom and all parts except two screws were missing. That's some fine Q/A there folks. How someone missed a burnt parts envelope is beyond me. I had to use the ball bearing and the hardware from the original unit. The bearing bracket unit inside the dryer was barely lubricated and the lubricant they used had turned to rubber. No wonder the thing was ground and squealing.

While I had the dryer opened up I made sure to vacuum out all the lint and crud inside and wipe down some areas. Thankfully, the machine is now quiet again.

Wednesday, January 17, 2007

Addicted to hand sanitizer

Help. I find myself applying moisturizing (with vitamin E) hand sanitizer to my hands every 15 to 30 minutes while in my office at work. It is starting to freak me out a little bit.

Thursday, January 11, 2007

Upgrade and Ubuntu

Now on the new version of Blogger. Yeah. Big whupdeedoodoo.

Also, if you are an Ubuntu Linux user and have noticed that fetching anything from us.archive.ubuntu.com is painfully slow then remove the "us." prefix placed there at installation from the apt/sources.list file. Your apt-get speeds will be measured in K instead of B from now on. Anybody know why the us. repository is so slow?

Tuesday, January 02, 2007

A few "Grouchy Gripes"

Just a few things that annoy me about the web today...

Web 2.0 expandable sections

I like Google Mail and all that fun stuff but a lot of things about the "next version" of the web are just annoying. One of the things I find most annoying are the "expandable sections"; where you have to click the little plus sign next to or directly on a link to expand and make visible a block of text and/or images. Nowhere is this more annoying than in "frequently asked questions" and technical support pages. I swear if I have to click on another "do you support this feature?" link just to see a "no" open up underneath it I will scream.

Portals just to have portals

A government agency recently changed their perfectly working set of static HTML pages into a hideous, moderately functional, PHP driven "portal" (and yes it has a thing to click on to hide the portal, see above, grrr). Why? Now all of our bookmarks to key pages do not work. Why spent a crap-load of development time on static content? The content of some pages hasn't changed in nine years! The "portal" offers virtually no functionality beyond what was there before.

AJAX bloat

This technology is starting to get out of hand. I see more and more of it cropping up in places where it shouldn't be used. One application I use frequently used AJAX to dynamically build a button bar for editing. I looked at the code (which was working flawlessly without AJAX) and by using AJAX to load button images and insert them as objects into the document object there was a savings of 11K; yup, a whopping 11 kilobytes of transmission. Of course, now there is a mess of JavaScript to do all of this and it causes a memory leak in Opera (the browser I use). If it works perfectly without AJAX then why change everything and risk alienating a minority? Also, one of the things I don't think all these AJAX people realize is that they piss off the "lowest common denominators" out there. There are people with crummy laptops and old computers that cannot handle a lot of this new stuff. There are moms and dads out there with older Pentium computers that cannot justify an upgrade. Meanwhile, the "web gurus" of the world keep adding stuff to something that functioned just perfectly before it.