Sons of Anarchy

Posted: October 1, 2010 in TV

“I realized that in my downward spiral of hopelessness,
I was actually falling into my own hole created by my absence of
basic human graces.  The most obvious was forgiveness.
If I was wronged by anyone — in or out of the club,
I had to be compensated — money or blood.
There was no turning the other cheek.
When relationships become a ledger of profit and loss,
you have no friends, no loved ones — just pluses and minuses.
You are absolutely alone.”  — Sam Crow, Sons of Anarchy

I’m thinking about starting a new blog / page about TV shows that I frequently watch (there just might be a few).   What do you think?


Anyone remember the days when Battlefield Bad Company 2 didn’t correctly quit? I remember one time taking a look at my task manager and lo-and-behold there were at least 6 different “BFBC2Game.exe” tasks running. I wasn’t even in the middle of playing.

I had totally forgotten about those days. Probably because DICE finally fixed it and I haven’t noticed. Today, however, I double-clicked my desktop shortcut for BFBC2 and I saw it flicker a CMD prompt. I was like — wha?!? After my 2-second investigation, I remembered the above fact. I also found my good ol’ batch script. My shortcut points to my batch script which was aptly named ‘runBFBC2.bat’. Here’s the contents of the file:

@echo off
taskkill /F /IM BFBC2Game.exe

Essentially, anytime you click the icon to launch the game, it would first kill off any old lingering tasks. Clever. However, it didn’t necessarily keep one task from running all the time, but it did keep me from playing the game AND having a dozen other instances of the game running at the same time. Thank goodness for gigs and gigs of RAM!!

Kernel Error

Posted: September 8, 2010 in Uncategorized

I never fail to chuckle when I see this in my logmonitor:

kernel: lp0 on fire

Often, I find myself re-using code over and over.  I thought I would share some really really … poor code with you.  However, it gives you an example of ONE way that does work.

<title>Table List</title>

$host  = $_SERVER['HTTP_HOST'];
$uri   = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$extra = 'itemlist.php';

$qs_array = explode("&",$qs);

$db = "inventory";

if (isset($_GET["p"])) { $p = $_GET["p"] ;} else { $p = "1";}
if (isset($_GET["id"])) $id = $_GET["id"];
if (isset($_GET["a"])) { $action = $_GET["a"];} else { $action = "n";}
if (isset($_GET["table"])) {$tbl = $_GET["table"];} else { $tbl = "character";}
if (isset($_GET["idcol"])) { $idcol = $_GET["idcol"];} else { $idcol = "char_id";}

$pre_where = "";
$post_where = "";

if (isset($id)) {
$pre_where = " WHERE " . $idcol . " = " . $id;
$post_where = " WHERE " . $idcol . " = " . $id;
} else {
$pre_where = " WHERE 0 = 1";
$post_where = " WHERE 0 = 1";

setlocale(LC_MONETARY, 'en_US');
// Connecting, selecting database
$dbconn = pg_connect("host=localhost dbname=$db user=username password=password")
or die('Could not connect: ' . pg_last_error());

$query = "select tablename from pg_tables where tableowner='username' order by tablename";
$result = pg_query($query) or die('Query failed: ' . pg_last_error());
<a href="index.php">back</a>
<table border="1">
while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) {
<td><? echo $line['tablename']; ?></td>
<td><a href="list.php?table=<? echo trim($line['tablename']); ?>">list</a></td>


*** updated *** this one uses PostgreSQL not mySQL.

So, those that know me well know that I play quite a few computer games.  Recently, I have been recording quite a bit of the gameplay.  My primary drive (C:) has Windows 7 64-bit Premium loaded on it.  It is a 60GB SSD that runs really nice and fast.  I pretty much only use it for the OS and my primary games.  I have the majority of the games installed to (D:).   It’s a 1TB Seagate drive with pretty good response times.  There’s very little on this drive other than games and other large media.

Naturally, this drive (D:) was a perfect location to save recordings from my games.  I have FRAPS installed to the (D:) drive and that is also where the videos get saved.  What you may or may not know is that every ~2 minutes of gameplay equates to a 4GB file.  The files are saved in a RAW format with no compression.  One night I realized I had over 500GB of video.  I began formulating the best way to regulate how much drive space was required without losing any of the videos.  I settled on the idea of transferring the files to my linux box using a Scheduled Task and having a cron job on the linux box that would automatically re-encode the files with a divx codec and save the files in a MUCH smaller file.

I setup my Windows machine to Schedule a Task.  See the link for a tutorial.  I setup the task to execute a batch file every night at 4AM.  I did restrict the scheduler to kill the process if it runs more than 12 hours and I also made sure that the scheduler does not start a new process if it is already running.  So what does this batch file do?  Glad you asked:

@echo off
echo Moving Fraps videos to samba GameVideos folder
move /Y D:\FRAPS\Movies\* M:\Downloads\GameVideos\

So basically, the batch file just moves all of my local Fraps videos off my local drive and places it into a folder on my Samba share.  For clarification, my Samba share is a 12 TB (or so) share that I have setup and mounted as my (M:) drive.  It is hosted by a Linux server.  It currently runs Fedora 9.

Next, I setup my linux box to automatically re encode all of the videos in XVid format.  After some brief googling, I opted for a 2-pass encoding.  See the mencoder wiki for additional examples and command-line options.  My setup might not be the best one out there.  For reference, this file is located at /home/jday/bin/ on my system.

ls -1 /mnt/media/Downloads/GameVideos > /tmp/parsevideolist
while read myline; do
 mencoder "/mnt/media/Downloads/GameVideos/$myline" -ovc xvid -oac mp3lame -xvidencopts threads=7:pass=1 -o /dev/null && _
 mencoder "/mnt/media/Downloads/GameVideos/$myline" -ovc xvid -oac mp3lame -xvidencopts threads=7:pass=2:bitrate=-100000 -o "/mnt/media/Downloads/GameVideos_smaller/$myline" && _
 rm -f "/mnt/media/Downloads/GameVideos/$myline"
done < /tmp/parsevideolist

One thing you may quickly notice is that I added an xvidencopts switch for multi-threading.  I have a quad-core Intel Q6600 running hyperthreaded.  This means it is capable of processing 8 threads simultaneously.  I wanted to leave one core available so that the system would still be usable.  The other thing you may quickly notice is the negative bitrate.  This allows me to say I want to target a 100MB file for the output.  mencode will calculate the bitrate accordingly.

After verifying that the shell script works as expected, it was added to my cron.daily list (I added the file /etc/cron.daily/fraps_video_shrinker and chmod’ed it to allow it to be executed).  The contents of the cron file:

/home/jday/bin/ >> /dev/null

Pretty simple.  As an FYI, the file is the one shown above.

Now, every day at 4AM my Windows system starts moving the Fraps videos off onto my linux box.  The next morning, my linux box will re-encode the video and upon successful encoding, it will delete the original.

Next Day Additions:

So, the next day after I set this all up, I am STILL processing videos.  Admittedly, it’s a lot of data to encode.  What I did notice is that I have over 200 video files.  I also found that all of the files have less than 2 minutes of video time.  I wanted to figure out a way to “tar” all of the videos together from the same day.  Here’s what I came up with.  I run mencoder again and have it put all files from the same day together as one AVI file.  This file I have saved as /home/jday/bin/



ls -1 $viddir > /tmp/videoquiltlist

while read myline; do

 this_prog=`echo "$myline" | awk '{ print $1 }'`;
 this_date=`echo "$myline" | awk '{ print $2 }'`;
 this_time=`echo "$myline" | awk '{ print $3 }'`;

 if [ "$prev_date" = "" ]; then
 ## This is our first line ##
 runcmd="mencoder -ovc copy -oac copy -o $outdir/$this_prog-$this_date.avi";
 runcmd="$runcmd \"$viddir/$prev_line\"";

 echo "$myline" | awk '{ print $1" "$2" "$3 }';

 if [ "$prev_date" != "$this_date" ]; then
 ## run the merging ##
#       echo $runcmd;
 bash -c "$runcmd";
#       echo "";
 ## reset the runcmd ##
 runcmd="mencoder -ovc copy -oac copy -o $outdir/$this_prog-$this_date.avi";


#   echo "$myline";

done < /tmp/videoquiltlist

runcmd="$runcmd \"$viddir/$prev_line\"";
#echo $runcmd;
bash -c "$runcmd";

I have also added this file to my cron job.  /etc/cron.daily/fraps_video_shrinker now looks like this:

/home/jday/bin/ >> /dev/null
/home/jday/bin/ >> /dev/null


So, I bit the bullet and bought a couple of new graphics cards. Previously, I was using my BFG GTX 285. However, lately I have had some really nasty artifacting, textures disappearing and general screen flashing while playing Battlefield: Bad Company 2. I figure — I spend enough time PC gaming that I should probably invest in something that will make the experience more enjoyable. So here’s what I bought. I got two of the following cards:


EVGA Part # 01G-P3-1373-TR

763 MHz GPU
336 CUDA Cores
1024 MB, 256 bit
3800 MHz (effective)
121.6 GB/s Memory Bandwidth

I have them setup in SLI using the newest nVidia drivers (258.96 at this time).

Note:  I happened to have an SLI bridge laying around that came with one of the motherboards that I have.  I used it because neither of these cards came with one.

After I installed, I went from <30fps in BFBC2 with all medium settings and forcing DX9 @ 1900×1200 and all other video options off

Now, I average 90-120fps in BFBC2 with the detail settings on High and the AA @ 4x and the bloom on and the other options on (except vsync is still off).

Short version: It crashes old Mozilla browsers.

Longer Version:
So at work, we have around 500 computers running RedHat 7.1. These systems all have Mozilla 1.7.11 on them. Unfortunately, we have a while before we have the capability to upgrade them. We are currently in the process of testing a migration to CentOS 5.x (insert newest number). However, with RedHat 7.1 there is no package manager, and you are left to “rpm hell” if you try to upgrade anything. Any newer version of a browser requires a newer kernel (as well as newer OTHER packages). The newer kernel is not an option simply because we do not compile OUR software to the newer kernel. Technically, we can and we do, but we are not currently distributing it yet. So, we are stuck with the browser we have: Mozilla 1.7.11.

What you also must know is that a LOT of people have as their homepage. Well now they have the pleasure of calling us at the support center every time they try to even start mozilla. The system is a closed system that the customers don’t have terminal access. So, they are really pretty stuck unless they call us.

The fix: Launch mozilla with an alternate website in the startup string. Then reset your homepage to something that doesn’t crash (i.e. – yahoo currently doesn’t crash the browser).

The end result: Don’t Use on Mozilla. There have been a number of other websites that have crept up that crash this version of Mozilla by simply navigating to the website. However, none have been quite so frequented as I know it’s a shame that we aren’t all happily using the latest and greatest browser out there – whether it’s Firefox, Chrome, Safari, Opera, or any other low-end browser (I mean even text-based browsers are still better than IE – right??? — w3m FTW)

Here’s a good read as to why doing memcheck and having ECC ram are both good things:

Also here’s a great mockery:

Gaming Rig (Update 2)

Posted: February 5, 2010 in Uncategorized

Well the CoGage TrueSpirit heatsink came today. At first I was really impressed. It’s rather large and in charge. However, when I went to install it, I ran into some problems.

Like I said when I started this process — I am jumping ship from AMD to Intel. I can’t explain how much easier an AMD CPU heatsink/fan is to install versus these STUPID Intel “push/clip/twist/lock” designs. The entire time I was installing the heatsink, I really thought I was going to wind up snapping my motherboard from the amount of pressure required to get the heatsink to clip down. After I “finished” installing the heatsink and fan, I was not satisfied with how much play there was with the heatsink. By this, I mean I could not tilt/tip the thing because it was secured down, however, it was loose enough (or poorly designed enough) such that I could twist it either direction (~30degrees). I naturally concluded that this was not a final solution for the system and decided to look into other CPU heatsink / cooling options.

I ended up buying this Corsair H50 water-cooling system. It seems about my speed for water-cooling. I might overclock a little bit, but not enough to warrant going all out on hoses, radiators, pumps, reservoirs, and making the whole thing redundant…. blah blah…. this looks good enough for my taste.

    Windows 7 USB Install

On a separate topic, the UNetBootin described here does NOT work for making a Win7 iso bootable on USB. I am currently in the middle of copying files and trying THIS method instead.
*revisiting UNetBootin (which I love for any Linux distro) — This method may work better … the USB drives I had were virgin, so I’m not sure what the partition types were set to.
* Here is the “windows” way to do it

After some thought – my initial methods did not work due to the lack of proper initialization of the USB drive. It was brand new and needed to be formatted with the correct partition type.

New Rig (Update)

Posted: February 5, 2010 in Uncategorized

So, I remember spilling ~1.5 liters of Coke on my computer desk about 2 months ago. I have a glass desk, and I remember cleaning it up – to what I thought was “all good”. Well yesterday I started my system upgrade process by gutting my Lian Li case only to find dried up pop ALL over the case. It was on the inside, the outside … everywhere. I spent probably 2 hours just cleaning it out.

I took a bunch of pictures in the process, but I still have not finished the system. I am still waiting on the delivery of the heat sync. Once that gets here, I’ll take some final pictures and post them.

Also, I run Windows 7 64-bit Premium (thanks to my active .edu email address(es)). I originally got it from digital river — who had the MOST retarded .exe distributions. I have since converted them to iso’s. Last night while I was cleaning, I also started the process of initializing one of my USB drives with the Win7 ISO. I used UNetBootin to put the ISO image on the USB drive and it automatically makes it bootable. Needless to say, I’m hoping my install goes rather quick tonight.

Also, I will say that I’m stoked about how well the cable-management ended up. It is a whole lot more simple. I took out the DVD-RW and that saved some cabling. I also found a good way to hide the SATA cables. There were some other front-of-the-case ports that I opted not to hook up. All-in-all it turned out pretty slick — IMO.

I’ll post pics later tonight.