Author Archive

Wake Forest Ranked #22 in Pre-Season Discussion

June 30th, 2008

Wake Forest hasn’t had three consecutive winning seasons since the inception of the Atlantic Coast Conference in 1953. Things are looking up, however, as ESPN.com writer Mark Schlabach has placed the Demon Deacs at #22 on his pre-season top-25 ranking. Let’s Go DEACS!!!

Full ranking here: Bulldogs back at No. 1 in updated Top 25

How to fix the widescreen issue with your Everio GZ-MGxxx camcorder

June 19th, 2008

So, for Christmas 2007 I got a JVC Everio GZ-MG130U HDD video camera. I love it! The video quality is great, the battery is pretty good, you record straight to HDD (30GB in my case) and you can even record in 16:9.  JVC Everio GZ-MG130U

But… you can’t playback in 16:9… what??!?!?!  Yeah, for some reason JVC doesn’t write the proper widescreen flag properly in ther MPEG2-PS file format (for which they use the .MOD extension). So, how do you fix your videos?

» Read more: How to fix the widescreen issue with your Everio GZ-MGxxx camcorder

Wingsuits and Base Jumping – AMAZING!!

January 4th, 2008

This redefines “extreme sports”. Found these videos and more at Life in the Fastlane blog:

 

Man, Mountain & Wingsuit
Wing suit flying through the hills of France with expert base jumper Dave Barlia.



Man, Mountain, Wingsuit – video powered by Metacafe
Skydiving Wing Suit with Jet Engines

[youtube]http://www.youtube.com/watch?v=eS2rjcVcaqQ[/youtube]

Access your Amazon S3 buckets with a Windows client

January 2nd, 2008

I’ve been working with the Simple Storage Service (S3) from Amazon Web Services (AWS) recently. They have a great set of services and API’s available for the services at AWS but you are responsible for building whatever UI you need to manage them. Well, thanks to the developer community, there are great tools popping up (some open, some not).

I just downloaded BucketExplorer and started using it to view and upload/download files in my S3 buckets. It is extremely easy to use and did exactly what I wanted.

Here’s a screen shot of what it looks like. You can download an evaluation copy here

Bucket Explorer screen shot

Another nice tool that I am trying out is the open source backup client S3Backup. It is in beta as of this post, but it seems to have some good basic functionality. You can get a copy here. You can create a simple schedule (uses Windows Task Scheduler; which means no extra “watcher” process to keep running!) and backup any files on your machine (even from network shares, assuming you have the permissions & connectivity setup).

The interface to S3Backup looks like this:

The Theory of Huckativity

December 18th, 2007

The Theory of Huckativity

Carter + Clinton = Huckabee

[Note: I can't take credit for this - I think i first saw it on a RedState comment ]

MySQL ON DUPLICATE KEY INSERT

December 18th, 2007

Have you ever wanted to write a single query that would update fields in a table – but you can’t be 100% sure the record exists yet for you to update? For example, you might have a table that holds configuration data for your application. There will be one record for each user in your system. You could use their “UserID” as the primary key (that is crucial to making this work).

Well, instead of doing this:

<?php
$sql = "SELECT COUNT(UserID) FROM configuration WHERE UserID='SomeUser'";
$result = mysqli_query($db,$sql);
if ($result && mysqli_num_rows($result)>0) {
$aResult = mysqli_fetch_array($result);
$iRecordExists = ($aResult[0]>0?1:0);
}

if ($iRecordExists>0) {
//do an update
$sql = "UPDATE configuration SET someField='someValue' WHERE UserID='SomeUser'";
mysqli_query($db,$sql);
}
else {
//do an insert
$sql = "INSERT INTO configuration SET someField='someValue', UserID='SomeUser'";
mysqli_query($db,$sql);
}
?>

You could just do this:


<?php
//insert the user's configuration field - if the record already exists - update instead
$sql = "INSERT INTO configuration SET UserID='SomeUser', someField='someValue' ON DUPLICATE KEY UPDATE someField='someValue' ";
mysqli_query($db,$sql);
?>

Simply put, the query will attempt to insert the configuration record first. If it finds that the specified UserID already has a configuration record in the table, it will simply update the existing record according to the values you include after “ON DUPLICATE KEY UPDATE”. You can include more than one field to update as well.

[Update: As Paul questioned in the comment below, the WHERE clause is not correct (in my original post). The trick is, you have to include the primary key as part of the insert statement - such as UserID in the example above.]

Sunrise Over Asia

December 12th, 2007

Sunrise Over Asia

Taken near the end of a flight over to Malaysia in September 2007.

Where’d the Media Go?

December 6th, 2007

Great editorial cartoon – found it at the Old Gold & Black

Where'd the media go?

Trouble with PHP regular expression; REG_ERANGE error

November 29th, 2007

I had a situation where I needed to validate an email address that included an apostrophe. It is not widely known that the apostrophe (and a bunch of other symbols for that matter) are valid characters in the official RFC2822 specification for email address formats.

Anyway, I kept getting an error when I tried to add the apostrophe to my character classes in my regex. It gave me a strange error referencing REG_ERANGE. After some googling, I came across this blog post which led me to the answer. The problem is related to the placement of the dash (”-”) character in the regex.

Example 1:

if (ereg("[^a-zA-Z0-9_-.]", $userid)) {
    echo 'bad';
}
else {
    echo 'good';
}

The problem? The dash, or hyphen, being before the period. It thinks it’s a range, like you see in a-z. This may not be a bug, per se, but it’s certainly not smart enough for me.

The solution? Simply put the dash at the end of the regex.

Example 2:

if (ereg("[^a-zA-Z0-9_.-]", $userid)) {
    echo 'bad';
}
else {
    echo 'good';
}

No thanks, Chuck Norris… or Mike Huckabee

November 27th, 2007

I’m still making up my mind about the pantheon of Republican candidates for president. I was briefly excited about the candidacy of former Arkansas governor Mike Huckabee. Then I started doing some research…

Even though I might draw the ire of Chuck Norris (have you seen this commercial? hilarious!), I can NOT handle the following clip:

[youtube]http://www.youtube.com/watch?v=DaJW7nXw30A[/youtube]

From what I gather – there is broad consensus that the go-to option used to pay for government programs during Huckabee’s administration was to raise taxes.

NO THANKS!