Geeks With Blogs

The Wrecking Bawl Destructuring query language, one keyword at a time. December 2006 Entries
Bransky's Law

I've come up with a new law, like Murphy's Law or Godwin's Law, and named it after myself, at least until I come up with a more interesting or more amusing law.

Bransky's Law:  If you throw some wires together, they will become tangled beyond what you think should be possible.

Posted On Friday, December 29, 2006 4:16 PM

.Net and animated GIFs in Windows forms

Apparently when you use an animated GIF as a background image in a control (e.g. button or picturebox), the image lacks animation, i.e. it just sits there with its starting layer.  This is kind of annoying, but I was able to work around it in this particular instance by using PictureBox.Image.  I suppose if I were really desperate I could have used Thread.Sleep with a bunch of different images on rotation to make it look like an animated GIF.

Posted On Monday, December 18, 2006 10:32 PM

recycle those trees!
Here's some great info from Mother Earth Living: 5 Ways to Recycle Your Christmas Treeby Tabitha Alterman, Mother Earth News Associate EditorFor many of us, decorating a Christmas tree is our favorite part of the holiday season. If you're one of the more than 30 million people who put up a live tree this year, you might want to consider extending its usefulness once the season ends. Instead of tossing your perfectly shaped pine or fir into the garbage where it will only end up in a landfill, try ......

Posted On Tuesday, December 12, 2006 11:32 PM

casting SQL parameters
A coworker and I discovered the other day that we got an error when we tried using CAST on a parameter in the same line as the procedure call. For example: EXEC [procname] @param1, CAST(@param2 AS DATETIME) result: Invalid syntax near 'cast'. That statement didn't work till we separated it into two lines, like so: SET @param2 = CAST(@stringdatevar AS DATETIME) EXEC [procname] @param1, @param2 I haven't been able to google up any proof that the first call should cause an error, so it would be greatly ......

Posted On Tuesday, December 12, 2006 8:41 PM

I'm curious what percentage of developers use SET NOCOUNT ON in their stored procedures on a regular basis, particularly when they don't know exactly what code (particularly ASP.Net code) will be used to call the procedure. My general practice has been to not use it just because I don't know when my fellow coders will use SQLDataReader.RecordsAffected or SQLDataAdapter.Update() (thanks again Jon), but I often wonder if I should just always include it and then just change it when I get a complaint. ......

Posted On Tuesday, December 12, 2006 7:57 PM

unknown chars in SQL Server
I imported a text file into SQL Server 2005 today and ended up with squares at the end of the last column. Turns out the text file, despite being tab delimited, had a tab prior to CR/LF at the end of each row. I was confused at first as to how to get rid of the squares, but then I figured it out. SELECT ASCII(RIGHT(column,1)) FROM table --gives 9, which is TAB in the ASCII table UPDATE table SET column = REPLACE(column, CHAR(9), '') --replaces tabs with nothing ......

Posted On Monday, December 11, 2006 4:21 PM

Google is scary?
This is a very interesting article about how Google knows your every move: I don't think there's proof that Google has done anything completely crazy yet (depending on your stance on China and the whole bit), but I can see a day when, for example, somebody says they have proof that a candidate for president searched for "join communist club" or something controversial like that, when really the candidate's eighth cousin was using the computer ......

Posted On Friday, December 8, 2006 10:59 PM

Google is weird
I just remembered something annoying that happened yesterday.  I can't remember what my search terms were, but I added a word to the search and got a greater number of results!  As far as I understand it, that should never happen.  I've contacted Google about this once, and they somehow fixed it the last time. 

Posted On Friday, December 8, 2006 9:17 PM

SQL Server 2005 service packs
It took me a month, but I finally figured out how to get SP1 for SQL Server 2005 installed on my test server: by installing SP2. I was getting errors (something about Debug registry and some other stuff) from setup on the Database Engine upgrade for SP1. So I tried going directly to SP2, and got a new error. Turns out I had to delete the msi file from C:\Windows\Installer that was mentioned in the log file. Not sure if that was the problem for SP1, but SP2 is cumulative, so whatever. UPDATE Feb. ......

Posted On Friday, December 8, 2006 9:10 PM

.Net console apps and \"
I discovered something weird with .Net console apps. Say I have an app called testapp and want to run it from a command line like this: C:\>testapp /s Server /f "C:\testfolder\testfile\" >output.txt That won't work the way you might expect it to. The framework doesn't treat \" (backslash followed by a double quote) the way it should (in my opinion) and so the last argument is "C:\testfolder\testfile\" >output.txt I just throw up a message in my app telling the user not to end the path with ......

Posted On Friday, December 8, 2006 5:00 PM

bit fields in SQL Server 2005
Yesterday a coworker asked why she got an error when trying to enter a "1" in a bit column in a table in Management Studio. I figured she must have entered an extra space or something. I was wrong. Turns out that in SQL Server 2005, at least when entering data using Management Studio, you have to enter true or false! Who thought that was a good idea? There must be something I'm not understanding. Why Microsoft?! Why must I type three or four extra characters?! Why won't you let me be lazy ......

Posted On Friday, December 8, 2006 4:45 PM

Welcome to my blog!
Welcome to my blog, where I shall post my random thoughts on SQL Server, C#, VB, ASP.Net, and various other trucs (if you'll pardon my French).  By day I'm the resident SQL expert and occasional .Net programmer at a web design company in the Pacific Northwest.  By night I'm a musician, writer, video game enthusiast, and renewable energy advocate.

Posted On Friday, December 8, 2006 4:39 PM

Copyright © Alex Bransky | Powered by: