From Hell

How fucking cool would it be to be the Grim Reaper?!

By pure accident is how I stumbled on to Reaper. I don’t remember why, but for some reason, the TV was rockin’ the CW channel. At eight or so, this gem of a show started and I was instantly enthralled in it. Why can’t all TV be this fucking good?! A little synopsis:

Sam (played by Bret Harrison; second from left in photo) has it easy for the first 20 years of his life. His parents allow him to slide through everything with the least possible effort. As a direct result, Sam skipped college, works a dead-end job at the local Work Bench home improvement store, and spends the remainder of his time playing video games. Curious as he was about the reasoning for his parents lack of motivation, he doesn’t find out until his 21st birthday. The ungodly reason his parents let him slide? They sold his soul to the devil before he was even born.

His parents, guilt-ridden, attempt to explain the circumstances that led them to forfeit his soul, Sam can’t quite grasp what is happening to him. When Satan himself (played awesomely by Ray Wise; far right in the photo) drops by to personally explain that Sam must now track down evil souls that have escaped and return them to Hell, Sam refuses his bizarre fate. After getting a small taste of Satan’s temper, however, Sam figures out that breaking a deal with the devil has nasty consequences. Despite this, Sam is fascinated by the devil’s charm and his flattering insistence that Sam is full of untapped potential.

Armed with a constantly changing (and hilarious) series of vessels — starting with a Dirt Devil mini-vacuum — to collect the escapees, Sam finds that his new job is dangerous and frightening, even though he’s assisted by his goofball friends Bert “Sock” Wysocki (Tyler Labine; second from right in photo) and Ben (Rick Gonzalez; not pictured), along with Sock’s ex-girlfriend-turned-paralegal, Josie (Valarie Rae Miller; not pictured). Sock has been Sam’s closest friend and slacker role model for many years and was immediately the first Sam turned to with the news of his new gig with the devil.

Sam knows he’ll have to go to great lengths to hide his new identity from the person who matters most in his world: his smart and pretty co-worker Andi (Missy Peregrym; far left in picture). Trapped by his lack of self-confidence, Sam has loved Andi from afar, despite Sock’s constant urging that he ask her out. Now she’s stuck in a safe job and a safe friendship with Sam.

Though his life has suddenly turned weird and scary, Sam is surprised to find that he somehow feels good about his newfound “mission” — removing evil-doers from the world and sending them back where they belong. Back when nothing was expected of him, Sam never had to push himself to achieve. Now, with his friends and his trusty vessel-of-the-week at his side, Sam is ready to face his destiny as the Reaper.

This show has my kind of comedy: dry but quick-witted and clever humor intermixed with interesting and captivating stories. This might have just become my favorite show, but I’ll need to watch next week to be sure. And I will be tuning in next week. If you haven’t heard of this show, check it out on the CW, Tuesdays 9/8 CST.

I need to unplug…

This looks just like me, 'cept without the cool shades or badassness.

I can’t recall the last time I spent more than a single night away from my laptop. What with the private projects I carry on, websites I maintain, e-mail, Skype, three trillion social networks (I only maintain a Facebook and MySpace account), I feel as though I’m constantly jacked into the Matrix. But without all the cool-as-shit bullet-dodging, ass-kicking, slow-fucking-to-jungle-beats, and flying skills, it just doesn’t hold the element of glamour that it once did. Haha, and let one night pass in which I don’t log onto MySpace or Facebook… it seems as though the whole fucking planet is falling apart according to some people.

But I’m exhausted. Additionally, I’d like to get out to the gym (stop your snickering, fuckers, I know how to do a push-up) and actually get in shape. I’d like to accomplish this soon enough for my drastic cigarette consumption reduction in January. I can’t do that with a trillion damned projects constantly going on, various things needing my ever-constant attention and care. To those who have a stroke if I don’t somehow appear online at least once a night to satisfy whatever oddly, sexual urges you must have, cut the cable. It’s time. You can digitally walk on your own. Now, gimme my dick back. I’m done with side projects for a while. Don’t worry: if I’m working on one of your projects now, I’ll satisfy my obligations and offer technical support… as usual. To others, gimme time. I’m feeling a little burnt up (although money talks, so if we can get past a few language barriers between your wallet and mine I’m sure I might be able to accomodate just one more project).

I will, of course, continue my blogging. In fact, I’ll probably have a new blog every day this week, what with the final Formula 1 race of the year this weekend in addition to my own escapades on the track. This weekend will be the penultimate event of the year and it’s looking as though the decent weather will hold out. Thank god. My balls weren’t sure how to dress every day.

I digress. Time to unplug for the night. If it’s exceedingly important, I can be reached tomorrow some time. If someone has died, they’ll still be that way in the morning.

ASP.NET: Export to Excel

About as useful as a monkey fucking a football.

I’ve taken over a previous employee’s ASP.NET project at work, and in this process I have found that this person did absolute shit work. No joke, this code sucks in the dirtiest and most degrading sense of the word (use your imagination here, folks). I’m basically at a crossroads of either re-writing the entire fucking application, which would take months and months of eight-hour-a-day work, or washing my hands of the whole business and moving on to my next project. Unfortunately, before I can do either of those I have to put out a few immediate fires. One of those fires, and today’s topic, is how to efficiently grab a large chunk of data from Microsoft SQL 2005 and spit out a Microsoft Excel document. I’m only calling it an Excel doc because it applies to my specific scenario, but the file that it kicks out is a simple comma-delimited file arranged in such a fashion as is acceptable for most spreadsheet software packages.

This first piece of code will handle the data retrieval and document dialog prompting, while simultaneously jumping over to the second piece of code to actually create the Excel doc. In my case, since this was merely a quick, down-and-dirty fix to an existing problem, I didn’t even bother with dinner and foreplay and tied this straight to a button event handler. If this was meant to be a work of art, I’d have shoved all this shit into the business logic layer, as is proper for an application of the size I’m working on. Now, on to the data retrieval and document prompting…


private void btnGenerateExcel_Click(object sender, System.EventArgs e)
{
// Go get the SQL connection string from the web.config file.
string ConfigSQL = ConfigurationSettings.AppSettings[”SiteSqlServer”];

// Instantiate a new connection based on our newly acquired connection string.
SqlConnection conn = new SqlConnection(ConfigSQL);

// Let’s define the SQL stored procedure we’ll be executing to get our data.
SqlCommand cmd = new SqlCommand(”RetrieveAllRecords”, conn);

// Set the command object so it knows it’s a stored procedure.
cmd.CommandType = CommandType.StoredProcedure;

// The stored procedure is expecting a variable parameter.
cmd.Parameters.Add(new SqlParameter(”@ID”, variableID);

// Declare the adapter and let’s go get our data!
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;

// We need a “bucket” to put this data in so we can access it.
DataSet ds = new DataSet();
da.Fill(ds);

// Time to turn this into an Excel doc.
ExcelController ctrl = new ExcelController();
string strData = csv.Export(ds, true);
byte[] data = ASCIIEncoding.ASCII.GetBytes(strData);
Response.Clear();

// We’re back! Make the user download the file!
Response.AddHeader(”Content-Type”, “application/Excel”);
Response.AddHeader(”Content-Disposition”, “inline;filename=ExcelDocTest.csv”);
Response.BinaryWrite(data);
Response.End();
}

That wasn’t so bad, was it? Shit, I forgot to mention: I usually write everything in C#.NET these days, so if you’re still chugging along on VB.NET, I’d suggest making the move over. Microsoft won’t support VB forever. Might as well get ahead of the curve now. I digress.

The second part of this, and arguably the biggest bitch, is the actual processing of our dataset into csv format. I’ve put this into a business logic layer class or else I would have ended up leaving a huge fucking eyesore of endless code inside my only code-behind file. Dirty code? Fuck that. Do it right.


public class ExcelController
{
public string Export(Dataset ds, bool exportColumnHeadings)
{
// First thing’s first: create our variables
string header = string.Empty;
string body = string.Empty;
string record = string.Empty;

// We’re automatically doing this from Part 1, but…
// If you want column headings included in the file…
if (exportColumnHeadings)
{

foreach (DataColumn col in ds.Tables[0].Columns)
{
header = header + (char)34 + col.ColumnName + (char)34 + “,”;
}

header = header.Substring (0, header.Length - 1);
}

// Time to iterate through the rows to retrieve what we need.
foreach (DataRow row in ds.Tables[0].Rows)
{
Object[] arr = row.ItemArray;
for (int i = 0; i < arr.Length - 1; i++)
{
if (arr[i].ToString().IndexOf(”,”) > 0)
{
record = record + (char)34 + arr[i].ToString() + (char)34 + “,”;
}
else
{
record = record + arr[i].ToString() + “,”;
{
}
body = body + record.Substring(0, record.Length - 1) + Environment.NewLine; record = “”;
}
if (exportColumnHeadings)
{
return (header + Environment.NewLine + body);
}
else
{
return body;
}
}
}


So there you have it. Ten pounds of shit in a five pound bag… or something. There’s nothing pretty about it. It’s nothing to write home to mom about, but when you absolutely need a quick fix for something like this, it can’t be beat.

Lewis Hamilt0wned!

Race winner Kimi Raikkonen (FIN) Ferrari in parc ferme. Formula One World Championship, Rd16, Chinese Grand Prix, Race Day, Shanghai International Circuit, Shanghai, China, Sunday, 7 October 2007

Lewis Hamilton started the Chinese Grand Prix with a fantastic pace from pole. As the rain started to fall in Shanghai, all drivers were equipped with Bridgestone “intermediate” wet tires. The rain fell for about ten minutes while the drivers and engineers debated on which tires should be put on for the first round of pit stops. With time running out, Lewis pitted first on lap 10. Even though his tires were absolutely ripped up from the combination of wet and dry track surfaces, he forewent the change of tires and stayed on the worn ones. He received about five laps worth of fuel and left pit lane. Weather updates every 30 seconds continued to promise of more rain, so that when Ferrari’s Felipe Massa came in, he too forewent a new set of tires in exchange for a quick fuel fill-up. But the rain never came. At lap 20, cars began to come in for soft-dry tires. At this point, Kimi’s pace coupled with Lewis’s lack of grip came down to an epic battle between the two for the race lead. In a brilliant move, Kimi overtook Lewis in corner 12 and immediately poured on the speed. The gap between Kimi and Lewis widened, until Lewis’s tires forced him into the pits for fresh ones. Unfortunately, pit lane itself was still wet, and Lewis’s lack of traction put him into the gravel at the mouth of pit lane. In dramatic fashion, Lewis stayed on the throttle, digging the back end of his McLaren Mercedes so deep that he beached the car. The entire chassis was immovable, resting entirely on its carbon-fibre underpanel, all four wheels spinning helplessly inches above the gravel. As crews came out to attempt to push the craft back onto the tarmac, Kimi began cranking out hot laps, cushioning his lead by ten seconds. In the end, Lewis ended his race early, and Kimi drove brilliantly to win the race.

Elsewhere, Fernando Alonso drove with a purpose to second place, making the fight for the World Drivers Championship a three-way showdown at the final grand prix at Brazil’s Interlagos. Interestingly, had Lewis won at Shanghai, Fernando would not have competed in the Brazilian Grand Prix after throwing a temper tantrum following Saturday’s qualifying. McLaren Mercedes team principal Ron Dennis told reporters that Fernando’s attitude would cost him his seat. Now, it appears, McLaren Mercedes is trying to salvage what they can from the season, since they won’t be winning the Constructors Championship. It looks as though they’re just going to throw as many drivers as possible at it and hope one of them takes it. So the stage is set two weeks from now for a showdown the likes of which Formula 1 hasn’t seen since the mid-eighties.

As it stands, rookie Lewis Hamilton (Vodafone McLaren Mercedes) continues to lead the fight with 107 points. Two-time reigning world champion Fernando Alonso (Vodafone McLaren Mercedes) trails closely with 103 points, while the Susan Lucci of F1, Kimi Raikkonen (Scuderia Ferrari Marlboro), brings up the rear with 100 points. That’s seven points spread between three drivers, meaning that Interlagos, and the championship as a whole, is anyone’s for the taking. If Lewis wins, it’s all over for everyone. In order for Fernando to take the championship, he needs Lewis to finish at least four points beneath him. Kimi has it the roughest of all, and not only needs Lewis to finish sixth or worse, but also needs Fernando to finish third or worse.

But as difficult as Kimi’s situation sounds, Shanghai proved that in Formula 1, anything can happen.

Down to the wire…

Lewis Hamilton (GBR) McLaren Mercedes MP4/22 passes the team after winning the race Formula One World Championship, Rd15, Japanese Grand Prix, Race Day, Fuji Speedway, Fuji, Japan, Sunday, 30 September 2007

The mad pursuit of this year’s Formula 1 World Drivers Championship could be decided at this weekend’s Chinese Grand Prix. Currently, rookie Lewis Hamilton leads all drivers with 107 points. The Vodafone McLaren Mercedes driver is followed closely by team mate and back-to-back reigning world champion, Fernando Alonso with 95 points. At this point, mathematically speaking, there’s only one other driver who could give chase or challenge to either Fernando or Lewis, and that’s Ferrari’s Iceman, Kimi Raikkonen with 90 points. With China being the penultimate race, that means there’s only 20 maximum points to any one driver. My analysis…

Lewis Hamilton has been gold this year. Not only is he the first black driver in F1 history, he could also be the first rookie to ever win the WDC. While some might consider his position to be a comfortable one given the current points situation, this is Formula 1. Anything can happen, and it often does. Last weekend’s Japanese Grand Prix, for those that watched it, was fucking insane. Yet, despite the torrential downpour of rain and horrible winds, Lewis was able to dominate the entire race after the first corner of the first lap, as it’s much easier to see when there’s no backspray in your face. His team mate, however, wasn’t so lucky. Fernando Alonso lost control of his craft late in the race, but the results were devastating: up to the Japanese Grand Prix, he was only two points behind Lewis. Not scoring at least a podium finish would have been bad enough, but not scoring any points almost crushed his chances. There are those who speak of Lewis as though he were the second coming of Michael Schumacher. The pressure is going to be intense this weekend, which is where Michael liked to be. We’ll see whether Lewis can stand up to it or be pushed aside by those more seasoned than he.

Fernando Alonso… what a fucking queen. His overall miserable demeanor, irrational aggression towards his mechanics and team mates, his back-stabbing testimony to the FIA of McLaren Mercedes’ thievery of confidential Ferrari designs, and his arrogant bitch attitude just because he’s the reigning two-time world champion… fuck Fernando Alonso. If there’s anything this guy’s capable of aside from whining, griping, and bitching, it’s chugging cock like it was cool. His destructive crash last weekend was hilarious. His team hates him, he’s a fucking tool, and he sucks as a driver in the rain. He sold out his team and then made a deal with the devil to go back and drive for Renault next year. The only thing that could make me any happier, would be if he wiped out his car again this weekend, taking Lewis with him. This would ultimately give a better chance to…

Kimi Raikkonen, my favorite and current pick to win the WDC. For some reason, I always root for the underdog. Kimi is, mathematically, the least likely to win the WDC this year. It would require Lewis to finish below seventh place both races. It would require Fernando to finish below fifth place both races. Both of which are unlikely to happen. Ferrari has already won the Constructors Championship this year after McLaren Mercedes were stripped of all their points for cheating, so why do I insist on a Ferrari driver winning the WDC as well? I dunno. Maybe to make this season’s end just as exciting as last year’s showdown between Michael Schumacher and Fernando Alonso (which Fernando ultimately won; Schumacher retired).

This might just be the most exciting race of the year.

Who then now?! My name is Rob Morrow. I am a Central Illinois native, a proud omnivore, a software developer by day and when the sun goes down I morph into a musical ninja. I am... [Read more]