Pad a Numeric Field with 0 in DB2

June 10th, 2009 by Jim Olding | No Comments

Say you’re storing a time in a 6 position numeric field in DB2 (in HHMMSS format), and you need to pull the hour. SUBSTR(FIELD,1,2) will work great as long as the time is 10am or later, but before that, you’ll start pulling weird times like 91:00. This is because SUBSTR does not pad a numeric field with zeroes in query. To force a prepended 0, do SUBSTR(DIGITS(FIELD),1,2).

Tags: ,

Backing Up with Virtualmin and S3

June 3rd, 2009 by Jim Olding | 2 Comments

Virtualmin is a great open source server management tool. In fact, its what I use for my hosting. Amazon S3 is a great, affordable online storage service. What do you get when you combine them? A great way to back up your servers.

Virtualmin has had support for local and remote backups for some time now, but the idea of weekly 8GB FTP sessions to my home server doesn’t seem so grand (it would interrupt the Linux ISO torrents). So I signed up with S3, and for less than the cost of a egg mcmuffin, I can keep 4 weeks of full system backups available for restore at a moments notice.

This guide assumes you’ve got Virtualmin Pro (not sure if the free version does S3 - it does, give it a try!), and an active S3 account.

Read the rest of this entry »

Tags: , , ,

Bomb Threat Gone Stupid

April 29th, 2009 by Jim Olding | 1 Comment

From WOOD-TV:

“A man accused of calling in a bomb threat at a courthouse was arrested after being spotted in an elevator in the building.”

Long story short, this guy who was to be sentenced for credit card fraud decided that calling in a bomb threat to the courthouse was a smart way to delay his sentencing. He called in the threat from his house, and then showed up at the courthouse.

Of course, as soon as the threat came in, police traced the call to him and had his description.  As he tried to get off an elevator, he ran right into a Sheriff’s officer who was just handed a printout of his photo and his description.  The inevitable occurred, and he now faces additional charges with calling in the bomb threat.

Tags: ,

Unused SQL Query

April 23rd, 2009 by Jim Olding | No Comments

I was moving some of my code to .Net 3.5 earlier this week and cleaning up some of the migration issues. One of the warnings was that readJobs was an unused local variable. Not too unusual, till I found that it was this gem it was referencing:

Dim readJobs As SqlDataReader = cmdJobs.ExecuteReader(CommandBehavior.Default)
While readJobs.Read()
End While
readJobs.Close()

Tags: ,

Removing or Changing the NBX 8 Pool

March 18th, 2009 by Jim Olding | No Comments

FlowerCo uses extensions which start with an 8 (well, technically they have 3 digit extensions internally and use 8 as a prefix on incoming calls). Switching them over to an NBX will be easy, except for the fact that by default, 8 prefixes are for the 8 pool, and extensions start at 1000.

Open up your dialplan and delete any TableEntrys which reference your 8 pool route, then update your ExtensionRange to include 8000 series extensions. If you want to maintain the functionality of the 8 pool, you can change it to use a 7 as the prefix by deleting references to the Diagnostics route in your initial tables, and replacing that TableEntry to be Local pointing to your 8 route

ExtensionRange Telephone 8000 8099
TableEntry Create 1 30 8 4 4 Internal  0 8
TableEntry Create 1 10 7 8 8 Local  0 1

Don’t forget to update your auto-discover settings to start assigning phones at 8000 (System-Wide Settings -> Enable Features System-Wide). If you want to remove the 8 pool entirely, just remove any of its entries in Table 1 and Table 2 of your dialplan.

Tags: , ,

Going Green in the Home Datacenter

March 12th, 2009 by Jim Olding | 3 Comments

If you’ve been to my place, you know my basement sounds like a hair dryer. I have 5 machines running 24/7 most of the time. Noise and electric bills finally got to me, so I picked up a Kill-A-Watt to track power usage, per machine. What I found out is that having those machines on constantly accounts for 1/3 of my electric bill, almost 330 kilowatt-hours per month.

The 2 biggest hits towards power usage were # of drives, and processor type. More drives = more motors to spin. The most power-hungry drives were the Ultra320 SCSI drives, followed by PATA drives and finally SATAs. Processor power usage seemed to follow a slightly different curve, with a 2nd gen P4 using the most power, followed by P3s, Pentium Ds, and the Core 2 Duo.

Read the rest of this entry »

Tags: , , ,

Stop Orb from using 100% Drive Space on Server 2008

March 10th, 2009 by Jim Olding | No Comments

Orb is a media server application which allows you to stream all of your videos, music, and photos to almost any device on your network or the internet.

However, it is not officially supported on Server 2008. Since 2008 is based on Vista, I figured why not give it a shot. And it works. There is just one small problem: It throws an absolute fit if it can’t access a file and starts filling the drive with log files. That causes problems when a machine goes to sleep and Orb tries to index files from a SMB share.

I managed to put together a small batch file which will stop the Orb services, clean up the log files, and restart Orb. Running this on the scheduler once a day seems to have stopped the drive space problem.

@echo off
net stop OrbMediaService
taskkill /f /im orbtray.exe
taskkill /f /im orb.exe
taskkill /f /im orbmediaservice.exe
c:
cd\programdata\orbnetworks\logs
del *.log1
del *.back
net start OrbMediaService
cd\
cd \Program Files (x86)\Orb Networks\Orb\bin
start OrbTray.exe

Tags: ,