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?
Using SCode with MT 3.2 and Logjamming.com
/- Prerequisites: MT 3.2 or higher, GD library, and GD Perl Module all installed and working.
- Download plugin: http://www.movalog.com/plugins/wiki/SCode
- Extract to local disk, preserving directory structure.
- Upload contents of "php" folder to /cgi-bin/mt/php/ in ASCII mode
(if you used Josh & Loren's MT install suggestions).
- Upload contents of "plugins" folder to /cgi-bin/mt/plugins/
- Change the attributes of /cgi-bin/mt/plugins/SCode/mt-scode.cgi
to 755 or -rwxr-xr-x (use WS-FTP to do this).
- 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.
- 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.
- 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.
- To insert the CAPTCHA item into your comment posting templates in the default way:
- 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> - 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> - Remember to save both templates and then rebuild your site.
- 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.
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.
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.
- First off, create a standard .aspx web forms page and drag a Gridview and a SqlDataSource (my example will use the AdventureWorks Sample DB).
- 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>
-
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
-
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>
-
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>
- 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. - 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:
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.
New Look!
/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?