thoughts from brian samson

REI Online

REI Logo
I ran into a deal on the REI.com outlet site today that looked pretty sweet. It was already a pretty good deal, but when I saw it was from REI, I thought, “Wow, I wonder if they’ll let me use my dividend online?” It turns out this is one of the few times when a company gets it right on their website. During the checkout process they asked for my REI member number and had a little checkbox that said “Use my dividend.” A couple clicks later and this sweet multitool is shipped to my house for less than $20. Way to go, REI.

A flag pin for your Mac

I was reading this text file on my MacBook the other day that had some strange copy/paste behavior. It turns out this was because of one of the dozens of “space” characters in Unicode, one of which was being interpreted as a linefeed in some editors and as a space in others. So I went to the Edit Menu -> Special Characters (which is in almost every cocoa app) to check it out. In the end I figured out how to replace my special character with a normal one and went about my business, only to later notice activating that menu had the side effect of enabling the “Input Menu” in my title bar. If you are in America like me, the icon for this menu is an awesome American flag logo. So now even your Mac can have its very own flag lapel pin!

Mac flag pin

(The “Input Menu” is available via System Preferences -> International -> Input menu)

MySQL and BLOB sizes

I’m doing a ruby on rails project with MySQL that needs to store some images, and I thought to use the database. However MySQL’s default blob size is only 64K, so I wanted to use their LONGBLOB column instead. No big deal, and in fact they will automatically detect which of their myriad BLOB types to use based on the length of a BLOB column. Nice!

Now for a quick pop quiz. One of the following statements is a syntax error from MySQL. Can you guess which one?

A) CREATE TABLE test (id int, data blob(2147483647));

B) CREATE TABLE test (id int, data blob(2147483648));

C) Neither, they are almost exactly the same, how could one be a syntax error?

If you guessed ‘C’ congratulations, you are smarter than (at least one) MySQL developer. But you lose the quiz, because he correct answer is ‘B’, which generates the following error:


ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘2147483648))’ at line 1

I deciphered from their cryptic documentation that LONGBLOB columns can have up 2^32 -1 bytes (almost 2 gigabytes), and apparently if you enter a number larger than that it’s invalid syntax. Thanks for wasting that hour of my life, MySQL.

And by the way, if you need to create a LONGBLOB column in a Ruby on Rails ActiveRecord migration, use this line:

add_column :table_name, :column_name, :binary, :limit => (2.gigabytes - 1) #mysql is terrible software

More bars in more places

I recently bought an iPhone and I absolutely love it except for one thing: AT&T service. I’m not the type of person who makes a lot of phone calls anyway (apparently this is normal), but it would still be nice to be able to make a phone call in my house which is located barely a mile from 2 major freeways (60, I-10) in the heart of Tempe, AZ. I get dropped calls probably 40% of the time I call from inside my house and 10% while I’m outside. You don’t know how inconvenient it is to have to run outside and pray as I answer the rare important phone call.



Today I it was particularly bad, so I went to check their coverage map, which is a great web 1.5 app. I was only mildly surprised to see AT&T acknowledgement that I reside only in an area of “Good” coverage:
AT&T Coverage in Tempe

My house is right in the middle of that orange splotch, across the street from the park with the lake. And the coverage is supposed to be “Good,” right? Sure, if you take the time to read AT&Ts own definition of “Good,” which says that at best, I get possibly some in building-coverage. And that’s GOOD. Maybe I need to stand in the street, where the signal strength should be sufficient.

possibly some in building coverage

TurboTax is Awful Software

TurboTax vs The real form
Mary Bridget used TurboTax online again this year, and I’ve always thought it was bad, but this takes the cake. Usually TurboTax uses a “wizard” style, asking simple questions and then using the answers to fill in the right boxes. It has some problems though, like asking if MB was “Materially involved in the operation of her business,” which is an easy question for a tax professional, but is met only with “What business?” by a normal person.

While filling out her Wisconsin tax return (which it turns out she is not even required to file), TurboxTax presented her with this page, which is nothing more than a reformatted word-for-word copy of the actual form. I truly don’t see how this could possible be construed as being worth $30. Not to mention that this particular schedule was unnecessary as MB did not itemize her federal deductions, and also that TurboTax had her fill out the regular Wisconsin “Form 1″ and not the “Form 1NPR” for non or part-year residents. The entire issue is moot, however, because I looked it up on a friend’s advice and she isn’t even required to file a return at all, a fact that was mysteriously absent from the TurboTax site.

DotNetNuke 4 C-sharp Modules

DotNetNuke 4 is written for ASP.NET 2.0 using Visual Basic. I’m not a big fan of VB, so I do all my .NET development in C#. Luckily, Microsoft has made these languages play very well together, so you can write C# classes that extend classes in assemblies compiled from VB. However the DotNetNuke guys don’t have a lot of documentation about using C#. Their tutorials for writing modules are also very “in-the-box” that assume you want to write modules that work in a very specific way, especially when it comes to the database.

Their module development is very structured, including an MVC-type of framework that feels very forced. They have good ideas about the number of abstraction layers in the data access, but it seems far too complex for, say, a simple guestbook module, and the process assumes that you are creating a new kind of object that will require persistance. It also requires you to slop code all over your DNN installation, where I wanted to package a up the module a little more cleanly. So I started thinking, “what about the Hello World?” So I wrote one in C#.

Read the rest of this entry »

C# Embedded Xsl Resource Resolving

I ran into a problem today developing a web app that uses XML/XSLT for the display. This particular widget is designed to run as a custom control and it compiles to a .dll, so I had to embed my XSL files. This wasn’t a problem until I tried to clean up the XSLs by dividing them into smaller pieces and using xsl:include from between them.

The problem turned out to have a quick solution that took about an hour. Write a Custom XmlResolver. Now the one on the Microsoft Website is pretty extensive if you want to learn all about it. But if you want to just drop a class file in your project you can use mine. It resolves everything relative to the namespace that you put it in, so be sure to change that to something appropriate, espeically if you have your default namespace set in Visual Studio.

Note this is quick and dirty and doesn’t do anything with credentials, which I figure is OK since you probably have permission to get to your embedded resources.

Click below to see the full code:
Read the rest of this entry »

AllSportGPS

The company I work for just launched a new product the this week that I absolutely love. It’s called AllSport GPS, and it’s a really cool application for your cell phone that tracks your work outs. I use it everytime I ride my bike.

The coolest part of it is that it uploads your workout data to the website when you are done, so I can show off my new top speed on my way home, or my hilarious wrong turn going to retreive my car from the night before.

DotNetNuke 4 Custom Authentication / Single Sign On

Updated on 8/12/2008 — It has come to my attention this solution stopped working with DotNetNuke 4.8. I believe it should work with 4.5 - 4.7. I don’t work with DNN anymore so I probably can’t be very helpful, but if someone else has written a newer post on the topic, I’d be happy to link there.

So I’ve been working with DotNetNuke as our portal solution at work. My first task was to plug in to the authentication scheme to make it use our existing user database. This seems like a simple request, and in the end it was.

My big problem was the lack of documentation. First of all there is very little experience out there with DNN4. Secondly, the other providers of SSO are either commercial or very confusing, especially for a Java-turned-C# developer like myself. So I thought I’d lay it out, because it’s not very hard.
Read the rest of this entry »

Games post

Big surprise: I play games on the internet.

I play set game pretty much every day and its awesome.

Also I was playing this other cool 3d puzzle game yesterday and it was a lot of fun. Levels 16, 19, and 23 I thought were real tough but you can beat them.

« Previous Entries