Blog Upgrade

**NOTICE:** This weekend I'm going to do an upgrade to my blog.  It may be unavailable intermittently. **UPDATE:** The upgrade to [MT4](http://www.movabletype.com/) is done. Now I just need to re-prettify the templates. That should keep me off the streets for awhile... This weekend we are expecting snow, if you can believe it; so I'll be cuddling up with a warm cuppa and my favorite web tools.
Read More

Turkish Star Trek FTW!

A co-worker just forwarded me a collection of old Turkish movie knock-offs.  They are hilarious!  Especially Turkish Star Trek.  Notice how the title sequence is a direct rip-off of the original, just masked over with orange, and the transporter effects are just putting the camera out of focus and scratching the emulsion off the film.  The analog gauges on the transporter control also crack me up.  Great stuff!  If you have a faster-than-dialup connection, these are worth savoring, over and over-- like a cheap wine.  Other notables include Badi (Turkish E.T.) when he shoots smoke out of his navel, and how the desert planet in Star Wars is apparently covered in trampolines.

In other news, it's the fourth birthday of this blog-- I started it back on March 6, 2003.  I can't believe how fast time flies.  A lot sure has happened since then. I've moved three times, almost died of pancreatitis, got married, lost a kitty, gained a kitty, and more.  Quite the saga eh?

Read More

Using SCode with MT 3.2 and Logjamming.com

  1. Prerequisites: MT 3.2 or higher, GD library, and GD Perl Module all installed and working.
  2. Download plugin: http://www.movalog.com/plugins/wiki/SCode
  3. Extract to local disk, preserving directory structure.
  4. Upload contents of "php" folder to /cgi-bin/mt/php/ in ASCII mode (if you used Josh & Loren's MT install suggestions).
  5. Upload contents of "plugins" folder to /cgi-bin/mt/plugins/
  6. Change the attributes of /cgi-bin/mt/plugins/SCode/mt-scode.cgi to 755 or -rwxr-xr-x (use WS-FTP to do this).
  7. Log into you MT install and check to see if SCode is listed in the Plugins item on System Shortcuts.  If so, then you put the files in the proper places.  If not: rinse, repeat, wipe hands on pants.
  8. Open the SCode Settings and change the Temp Directory to: /home/httpd/vhosts/YOUR.DOMAIN.HERE/httpdocs/tmp  this is where SCode stores it's images, and it must be read & write-able by MT .  Click Save Changes to save & exit.
  9. Navigate to the blog you want to enable SCode on and go to Settings... Plugins.  Click Show Settings in the SCode listing and make sure the Enable checkbox is checked.  Save Changes to save & exit.
  10. To insert the CAPTCHA item into your comment posting templates in the default way:
  11. Edit the Individual Entry Archive template and add the <MTSCodeInsert> tag to make the section near the end read like:
    <div id="comments-open-footer" class="comments-open-footer">
    <MTSCodeInsert>
    <input type="image" accesskey="v" src="/images/static/btn-preview.png" name="preview" id="comment-preview" value="Preview" />
    <input type="image" accesskey="s" src="/images/static/btn-post.png" name="post" id="comment-post" value="Post" />
    </div>
  12. Edit the Comment Preview template and add the <MTSCodeInsert> tag to make the section 2/3 of the way through read like:
    <div id="comments-open-footer" class="comments-open-footer">
    <MTSCodeInsert>
    <input type="submit" name="preview" id="comment-preview" accesskey="v" value="Preview" />
    <input type="submit" name="post" id="comment-post" accesskey="s" value="Post" />
    <input type="button" name="cancel" id="comment-cancel" value="Cancel" onclick="window.location='<$MTEntryPermalink$>'" />
    </div>
  13. Remember to save both templates and then rebuild your site.
  14. To test the functionality of the CGI script, you can browse to http://www.YOURDOMAINHERE.com/cgi-bin/mt/plugins/SCode/mt-scode.cgi if everything is working, you will see a test CAPTCHA with a number of 99999 (if you left the default length of 6).  For a further test, enter a bogus comment and then enter an incorrect code-- depending on where you have the SCode Action button set in System Overview, your comment will either be junked or you will receive an error on submit.  Either way, the only spam you'll be dealing with will be in your Mac & Cheese.

For further info, see James Seng's SCode site, and Tim Houghton's Digitalife site to sort out the GD stuff.

Read More

Gotcha CAPTCHA?

A new era of spam-free blog comments is upon us! Using the cool Movable Type plugin SCode from James Seng, I was able to implement a CAPTCHA style Turing Test of my blog commenters. This is a randomly generated security image that a potential poster must read and then enter into a text box. This works because computers running automated scripts cannot process the intrinsic content  of a picture and determine what numbers are rendered, and thus they cannot post vast amounts of spam in the comments on this blog. For more info, read about CAPTCHAs at Wikipedia.

It took some doing, but with the wonderfull support of my host Logjamming.com, I was able to get the plugin running. Stay tuned as I will write a more detailed entry on how exactly to install SCode on a Logjamming hosted MT installation. I've been told that several other customers have been interested in getting SCode running for their blogs, and that the main problems centered around the GD Perl image library installed.

Read More

Nested Gridviews in ASP.NET 2.0

The other day at work I figured out a clever way to nest Gridview controls without doing any work with Datasets in the code-behind, which is the the only other method I've ever found. Since I haven't seen any instances of my method on the 'net, I thought I'd write up a quick blog entry so other folks could benefit. If you are using standard paging, the most data source connections you will have will be eleven; hardly cause for worrying about server utilization.

  1. First off, create a standard .aspx web forms page and drag a Gridview and a SqlDataSource (my example will use the AdventureWorks Sample DB).
  2. Configure the SqlDataSource to connect to the Production.Products table. The code should look like:

    <asp:SqlDataSource ID="SqlDataSource1" runat="server"

    ConnectionString="<%$ ConnectionStrings:AdventureWorksConnectionString %>"

    SelectCommand="SELECT * FROM Production.Product">

    </asp:SqlDataSource>

  3. Next, configure the GridView to use the SqlDataSource and add a few basic columns, including ProductID as the last column as a TemplateField. This is where we will embed the nested GridView, so make sure you use the ItemTemplate and delete the EditItemTemplate. Here is my example:

    <asp:GridView ID="GridView1" runat="server"

    DataSourceID="SqlDataSource1"

    AllowPaging="True"

    AllowSorting="True" AutoGenerateColumns="False">

    <Columns>

    <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />

    <asp:BoundField DataField="ProductNumber" HeaderText="Product Number" SortExpression="ProductNumber" />

    <asp:BoundField DataField="Color" HeaderText="Color" SortExpression="Color" />

    <asp:BoundField DataField="ListPrice" DataFormatString="{0:c}" HeaderText="List Price"

    HtmlEncode="False" SortExpression="ListPrice" />

    <asp:TemplateField HeaderText="Product List Price History" InsertVisible="False" SortExpression="ProductID">

    <ItemTemplate>

    </ItemTemplate>

    </asp:TemplateField>

    </Columns>

    </asp:GridView

  4. Next, drag another GridView and a SqlDataSource into the ItemTemplate section of the TemplateField in the source code editor. See below:

    <asp:TemplateField HeaderText="Product List Price History" InsertVisible="False" SortExpression="ProductID">

    <ItemTemplate>

    <asp:GridView ID="GridView2" runat="server">

    </asp:GridView>

    <asp:SqlDataSource ID="SqlDataSource2" runat="server"></asp:SqlDataSource>

    </ItemTemplate>

    </asp:TemplateField>

  5. Now switch to Design view and click Edit Templates on the SmartButton for GridView1. Now point the SqlDataSource at the ProductListPriceHistory table and then bind GridView2 to SqlDataSource2. In source view, the ItemTemplate section should now look like this:

    <ItemTemplate>

    <asp:GridView ID="GridView2" runat="server"

    AutoGenerateColumns="False"

    DataKeyNames="ProductID,StartDate"

    DataSourceID="SqlDataSource2">

    <Columns>

    <asp:BoundField DataField="ListPrice"

    DataFormatString="{0:c}"

    HeaderText="List Price"

    HtmlEncode="False" SortExpression="ListPrice" />

    <asp:BoundField DataField="ModifiedDate"

    DataFormatString="{0:d}"

    HeaderText="Modified Date"

    HtmlEncode="False" SortExpression="ModifiedDate" />

    </Columns>

    </asp:GridView>

    <asp:SqlDataSource ID="SqlDataSource2" runat="server"

    ConnectionString="<%$ ConnectionStrings:AdventureWorksConnectionString %>"

    SelectCommand="SELECT * FROM Production.ProductListPriceHistory">

    </asp:SqlDataSource>

    </ItemTemplate>

  6. Now comes the sneaky part. Were are going to use the String.Format functionality of the Eval one-way databinding syntax to dynamically change the SelectCommand for SqlDataSource2 for each parent row in GridView1. Here's what it looks like:

    <asp:SqlDataSource ID="SqlDataSource2" runat="server"

    ConnectionString="<%$ ConnectionStrings:AdventureWorksConnectionString %>"

    SelectCommand='<%# Eval("ProductID", "SELECT * FROM Production.ProductListPriceHistory WHERE ProductID = {0} ")%>' >

    </asp:SqlDataSource>


    Notice that we have to use single quotes to delimit the SelectCommand property so that the Eval engine can then use double quotes.
  7. If so set up everything right (and I copied it into this listing right) you should see output like this on Page 31 of the GridView1 control:
    NestedGridview1.png
Read More

Shiny New Stuff

Browsers: dump your caches! My blog has a new look showing off my mad Photoshop skillz. Carbon fibre, shiny red plastic buttons and see-thru lozenges. It's all new from the ground up (I actually started over from the default templates and style sheets in MT). Not much going on this weekend, as you probably could have guessed :) Jakki went to a hockey game last night and I stayed up working the tutorials on www.tutorialized.com. Emelie is here now, demo-ing her first attempt at Jakki-mole.

In other, less geeky, news: congrats to the Seahawks for getting into the NFC division championships and winning a playoff game for the first time since 1984.

Update 1/16/06 - I fixed the text color on the textboxes so a normal human can see it. Before only people wearing nightvision goggles or mutants with infravision could read it.

Read More

New Look!

Today I upgraded the ol' blog to MT 3.2 and installed StyleCatcher, a theme management system. Now I can quickly change the look and feel of the blog as often as my heart desires. You may notice that some bits are gone, as I upgraded the templates as well, but I will be putting them back in as soon as I can. This time I was smart and backed up EVERYTHING first. So click on stuff, geek out and enjoy.
Read More

The Big Deek

So it was raining somethin' fierce when I got up this morning, and because of that and today being Friday, I decided to drive to work. Since I was no longer limited to just what I could schlepp down to the bus stop, I took my camera to work. Here are a few shots:


My desk.


My co-workers. Tim is in yellow, and Pat's the other one.


Our wing (3NW). It used to be the birthing ward.

By the way, "The Big Deek" or just "Deek" is what we call "Deaconess Medical Center". The one photo I didn't take was of the tiny bathroom in each office. Remember, this used to be a patient ward. Neat, huh?

Read More

Email Notifications

New blog features! Over on the right sidebar on the main page, you should see a place to subscribe (or unsub) from the Notify List. When you subscribe, newly trained monkeys will compose and send you an email with a link to follow to verify your subscription. By virtue of these gifted primates, you can't be subscribed by someone else, and you can't spam other people. Slick huh? Just remember to send a few bananas the monkeys' way, and you will receive a handy dandy email when my blog is updated-- this will save you EONS of time, as I imagine you sit for hours in front of your computer with my site pulled up, fretfully stabbing your browser's Refresh button, as you await shiny new content. Now you have no excuse for not having a life!
Read More

Oil Change

Today I got the first and last oil change I will need in 2005. Since my factory warranty expired in October, I have decided to change to Amsoil synthetic. There is a local shop down the street. One filling of oil is good for one year or 25,000 miles, whichever comes first. You must get the filter changed every six months or 12,500 miles. The grade I went with is a Series 2000 0W-30 oil. It has some features I think are important for a turbo car like mine, such as up to one full quart will stay up in the cylinder head after it is shut down, this means that when the oil pressure drops because the car is shut off, the turbo will still have lubrication while it spins down. I'm curious to see how it affects my mileage, I need to take some data out of my log book and put it in Excel so I have a history baseline to compare it with. If anyone knew my grandfather, Don, you would understand my strange compulsion to do this. In other news, Jakki is registering for classes at Spokane Community College as I type this, but she is bummed out because she has to go down to the registration office and she has a cold. Here's hoping she will be better by tomorrow, because we are traveling to Seattle to visit some of my relatives and some of Jakki's. The coffee roasting has been going good, and I have only set the smoke detectors off two times this week. They are a tad bit sensitive, but I plan to replace the filter in the range hood, and that will remedy the problem, or I will attack the smoke detector with a bat.
Read More