Monday, January 22, 2007
SD Time's Linkapalooza alerted me to this site which provides 12 standard CSS templates to quickly create a professional appearing website. I think we'll all agree many sites could use a smidgen of professionalism :) Check them out!

1/22/2007 11:50:10 AM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Thursday, January 11, 2007
This is a classic example of English understatement. I wish I could talk like that. The words I mean, not the accent, that's easy. The way he describes what happened to him (getting arrested in the most violent manner for jaywalking) is a great display of being able to being polite and accusatory at the same time. The vid is a bit long but worth it, I think.

http://www.timesonline.co.uk/article/0,,11069-2541133,00.html

1/11/2007 1:00:10 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [1]  | 
 Monday, October 02, 2006
After reading about a half dozen reviews online on the Vantec NexStar LX NAS enclosure I decided to get one. I have a small network at home with 3 desktops and a laptop. It makes sense to have a LAN accessible shared storage location to keep things like documents and downloads. We just moved so my budget is a bit limited. The NexStar seemed the ideal solution as it is a BYOD (Bring You Own Disk) solution. I have a few unused IDE drives lying around so this would be cool.

The first disk I tried, an old Maxtor 90840D6 with 8GB capacity did not work over the LAN. It worked fine using the USB connection. Using the web interface I was unable to configure shares on the disk. Bummer. So I put in a somewhat newer Maxtor 52049H4 with 20 GB capacity. Because NAS shares can only reside on a FAT32 partition I had to reformat the drives before installing. It also precludes me from arbitrarily trying other drives I have as they are NTFS drives with content I don't want to lose if I can help it. Back to the 20GB drive. This time I was able to create shares. Wooo! I needed to download an application and figured it was a good opportunity to store this on the NAS box for sharing. Firefox put the .zip on the share without issue. I then attempted to open the archive with 7-Zip . The archive opened fine but files could not be extracted. WinZip couldn't either.

I then proceeded to do various experiments to conclude the following:

  • USB access works fine
  • ftp writes corrupt files
  • ftp reads corrupt files
  • NAS reads corrupt files
  • NAS writes corrupt files
This failure is so blatant that it's hard to believe Vantec would have shipped a product so horribly broken. It's also hard to believe the device could be so thoroughly broken without any complaints online. I suspect that it's a drive compatibility issue. Somehow these 2 old IDE drives do not work with the NAS/LAN code in de device. Other testers have used newer drives and have not encountered these problems.

Please add a comment if you have any experience (good or bad) with this box. I would prefer to not have to buy a new hard drive but it may be the only solution. I have contacted vantec and hope to hear from them soon.

10/2/2006 12:48:20 PM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [46]  | 
 Monday, August 07, 2006
We'll see what this is good for but I've now claimed my blog on Technorati. I'm supposed to put this snippet on the page:

8/7/2006 2:34:04 PM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [2]  | 
 Tuesday, May 30, 2006
I had several sites hosted at Blazernetwork for about a year or so. Service was reasonable, not great. Email outages were too frequent but at least they'd get repaired and we'd be up and running again soon after. Not this time. Last Friday afternoon email and web services went off the air and they haven't returned since (it's Tuesday now). All attempts to reach them were fruitless. Apparently they let their domain name expire. Not a good thing when that's needed to translate names into IP addresses.

Thankfully I was able to figure out the IP addresses for the Blazer machines where my stuff is hosted. An old email had the IP address of the mail host and it's still running so I could copy my IMAP folders over to my local computer. I then wrote a simple Perl script that uses wget to attempt retrieval of a file using ftp in the address range of the email server (assuming a 24 bit subnet mask). I then transfered all my files. Finally I needed a copy of my MS SQL database so I wrote another Perl script that attempts to open a socket on the MS SQL port number in that same range of IP addresses. Bingo!

I now use http://www.bananahosting.com which appears to work fine for now. I hope it stays that way as moving websites really is a pain. Luckily it uses HSphere so the learning curve isn't that great. It's a small shop but Johnny is on the ball and provides great support in his forums.

5/30/2006 12:18:14 PM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  | 
 Monday, May 01, 2006
Anyone familiar with ADO, ADO.NET and PHP will grumble when it appears that DBI, the standard database access module for Perl, prefers to return arrays of values instead of hashes. The reason we want to get hashes is that we can address the elements of our recordset with the names of the columns instead of knowing the number of the column. ADO and ADO.NET objects are powerful enough to allow both numeric (Set.Item(x)) and symbolic (Set.Item('Value')) access but with DBI you need to choose.

For my web application I wrote 2 classes, one a database abstraction class that encapsulates connecting to the database and provides some shortcuts for getting queries executed and second a Business Logic (BL) class that implements the, well, business logic of the application. I'm implementing a test management database so the BL class does such things as entering results, getting lists of tests that fit certain criteria etc.


sub all_array_hashes($) {
        my $self = shift;
        my $sql = shift;
      
        my $sth = $self->{"dbh"}->prepare($sql, {RaiseError=>1});
       
        $sth->execute();
        return $sth->fetchall_arrayref({});
}

Here is the all_array_hashes method of my DB class. Note the standard naming of $sth and the $dbh objects. The tricky part is the empty hash {} being passed into fetchall_arrayref({}). This tells the method to construct an array of references to hashes and return a reference to it. Tada! Try explaining that after drinking a few glasses of alcoholic beverage of choice. I use this method for most queries that return a bunch of rows with several fields. I'm sure I give up some efficiency by doing this but I'm a firm believer in spending a few $$ on proper servers to save lots of $$$ on code writing and maintenance. Of course this is in contradiction to using Perl/MySQL instead of ASP.NET/SQL Server but that's a decision I could not make.

Here is an example of a BL method that uses the method shown above:

sub testcase_results($) {
    my ($self, $testcase_id) = @_;
    if (!$testcase_id || $testcase_id eq "") {
        return 0;
    }
    my $sql = qq{
        SELECT * FROM TestStatus WHERE Testcase_ID=$testcase_id
        ORDER BY Date_Time_Finished  DESC
    };
    return $self->{'db'}->all_array_hashes($sql);
}


This routine returns a reference to an array of references to hashes that contains all the results for a particular testcase_id. Here is a snippet that uses the result:

my $results = $bl->testcase_results($testcase_id);
my @status_array = @{$results};
for (my $index = 0; $index <= $#status_array; $index++) {
        my $status = $status_array[$index]->{'Status'};
        $stat_table .= "<tr " . QAUtil::row_css($index) . ">" .
                "<td>" . $status_array[$index]->{'Date_Time_Finished'} . "</td>" .
                "<td>" . $status_array[$index]->{'Build'} . "</td>" .
                "<td class=$status>$status</td>" .
                "<tr>\n";
}


You can see how I first dereference the $result parameter into the array @status_array. Then I walk the array, taking care to use <= because $#status_array provides the last valid index of the array, not the number of elements. So each element $status_array[$index] is dereferenced with ->{Element} where Element is the name of the column from our query.

You'll note that I hardcode the table structure rather than using CGI::td functions etc. This is how I code PHP although I use Table, TableRow and TableCell in ASP.NET. I guess the learning curve of figuring out how to make each CGI function do what I wanted to do was a tad steep given the project schedule pressures so I stuck to what I knew. Besides, it's good to keep your hands in the HTML sometimes as that really shows you what you're generating. The QAUtil::row_css() routine returns a css class appropriate for the index. In this case it alternates between class=odd and class=even which gives the rows different colors.

A more Perly way of traversing the array is as follows:

for my $element (@{$element_array}) {
    print "<tr><td>" . $element->{SomeField} . "</td></tr\n";
}


Where $element_array was previously returned from testcase_results().

I hope this is useful for someone! If it is please post a comment. Please don't take this example as 'gospel'. There are so many ways of achieving the same goal with Perl and CGI that I won't try very hard to defend mine. It's just what worked for me. Use what you need and find your own way of doing things.

5/1/2006 11:21:25 AM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  | 
Check out the new http://www.tungstentech.com home page which uses the open source DotNetNuke portal. It would be nice to move this blog under the portal but I'll first need to find a good replacement.

5/1/2006 11:09:00 AM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  | 
I've had to adopt Perl/CGI to do web coding in the office at http://www.datadomain.com and since I'm figuring out how to do certain things I may as well post them here and hope the 'recipes' help someone else.

5/1/2006 11:07:08 AM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  | 
 Tuesday, February 07, 2006
Beware of email scams from Hakin Michael [hakincarz_link@yahoo.com]. Read about it on the front page of the main site http://www.tungstentech.com.

2/7/2006 8:20:06 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Tuesday, January 10, 2006
I'm selling my Silver 2000 Audi S4 with Tiptronic. It has about 54K miles and is in great shape. Never had any 'go-fast' parts installed and while it was driven like an S4 should be it was never raced nor trashed. Asking $18K which is $500 below Blue Book.



See all the details here: Dedicated page

1/10/2006 1:13:45 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  |