Scott Hanselman

Permanent Redirects with HTTP 301

October 20, '05 Comments [5] Posted in ASP.NET | DasBlog | XmlSerializer | HttpModule
Sponsored By

The very latest version of DasBlog uses a 301 Permanent Redirect to send aggregators to my feed's new location at FeedBurner. Because it's a 301, most aggregators automatically update their data with a new location and don't bother asking for the original one again.

Here's how to do a hardcoded 301 redirect within ASP.NET:

response.StatusCode = 301;
response.Status = "301 Moved Permanently";
response.RedirectLocation = "http://www.hanselman.com/blog";
response.End();

You can also do this, which I see a lot while looking at the bathroom wall of code folks call Google Groups:

Response.AddHeader("Location","http://www.hanselman.com/blog");

They pretty much do the same thing, but color me reactionary, I like to use the APIs available just for cleanliness's sake.

Of course this is a redirect, not an URL rewrite. Redirect's go all the way back to the requester and provide a hint on where to go next, while rewrites leave the requested the URL the same and tell the web server that something else was requested.

DasBlog has a lovely rewriting HttpModule that you're welcome to use. Erv Walter extended it and added support for redirecting URLs as well as fixing host names. These things are particularly useful if you do not have direct access to your web server's administrative console.

Fritz Onion, my hero but a man I've never met, also has a great redirecting module that's very elegant and coincidentally uses Craig Andera's "Only Configuration Section Handler You'll Ever Need" which is a fantastically snazzy chunk of code that I just can't seem to get folks here at work to latch onto.

Whichever one of these models you use, or if you write the redirect yourself, remember the "principle of least surprise."

If I type in the URL, I don't care how you get me there, just get me there.

UPDATE: It was asked in email "Whats a [good] way around postback URLs getting f'ed up when rewriting URLs." To answer that, I point you to an oldy, but a goody, a blog post with a clever title that no one really every appreciated, IMHO: "Postbacks for Algernon"

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

The Emancipation of Browsercaps.ini

October 20, '05 Comments [3] Posted in ASP.NET
Sponsored By

Friends and readers, what’s the Microsoft story, do you think, around the BrowserCaps.ini file? The general feel amongst the public is very bad as it’s perceived (and correctly so) that Cyscape has totally dropped the ball maintaining this important file file. Now, there’s a grass roots group over at codeproject to keep the file updated: http://www.codeproject.com/aspnet/browsercaps.asp. Kudos to them for pulling together an update.

If you've ever been confused why a panel renders as a DIV on IE and TABLE on FireFox, you need to update your machine.config right away.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Upgrading my Blackberry's Software and getting the Hotkeys to work

October 17, '05 Comments [5] Posted in Reviews
Sponsored By

I just updated my older Blackberry 7280's software from version 3.7.0.76 [Platform 1.6.0.114 - 2003] to version 4.0.2.49 [Platform 1.6.1.53].

It was a pretty big jump, updating the firmware/software on the crackberry from a version 2 years old to the latest one. It's the same version the newer color ones use, I think.

I love it when just updating the software of a device like this gives me lots of new features. This upgrade gave me:

  • Alphanumeric Speed Dial from the Phone Screen. "H" for home and the like.
  • Whole new Phone Screen with a direct dialing box with LARGE NUMBERS. YAY!
  • All new Alerts and Ringing Phone dialog boxes. Yes, of course! Fill the whole screen with the name of who's calling. Brilliant. Only took 4 versions to get that right. :)
  • All new calculator with on-screen keyboard map. Best phone calculator I've used.
  • Updated Tasklist with icons indicating level of completion.

Believe me, I'd love to get a Windows Mobile phone - if only it could keep up with my Blackberry. I've got wireless calendar syncing, global Active Directory lookup, "rightclick" equivalent context menus for phone numbers anywhere, instant email delivery, speed speed speed, battery life for a week, and no stylus. I kept watching folks take out there tiny stylii and tapping away on their phones. Seemed odd to me. If the interface to a phone is so obtuse that I have to use a stylus, it's time to re-explore the UI metaphor, no?

One thing that was an irritant that you, as a newer blackberry user, may not realize you're missing:

TIP: BlackberryOS 4.0 turned OFF the home screen hotkeys by default. That means you don't have the quick hotkeys like "C" for Compose or "A" for Address Book that I used all the time on previous versions. I have been told, by many newer Blackberry folks that this feature isn't available on the new version. However, if you go to the main Phone screen, click the scroll wheel, select Options, then General Options, then turn "Dial From Home Screen" to OFF you'll get all these hotkeys back.

TIP: I've experimented with all the different Blackberry fonts, and I find "BBMillback Tall 10 Bold AntiAliased" to be the best balance of size and clarity.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Maxivista Undocumented Registry Tweaks

October 16, '05 Comments [4] Posted in NDoc
Sponsored By

Mv2_registry_tweakBy now, you know I love Maxivista (Buy it here). I use it on a TabletPC, turning my Tablet into a 3rd monitor, using only software drivers and the network.

Here's some (as of yet) undocumented registry hacks from a Maxivista Insider:

MaxiVista adds two registry entries of note, specifically "fps" and "checktime" to the following registry key:

My Computer\HKEY_CURRENT_USER\Software\MaxiVista\A2\(YourUserName)

Checktime
Checktime determines the time interval when new picture updates are being sent. Smaller values, increase the responsiveness of the viewer screen for the cost of higher CPU load and presumably more network traffic. If the mouse cursor is laggy then users should play around with this setting. Ordinarily I don't notice the difference between my machine's attached monitors, but if you do, try this switch to speed up the refresh a bit.

Recommended value range: 5..20ms (default: 20ms)

fps
Determines the maximum frame rate per second. Decreasing this value reduces the network load. May be useful for slow wireless network connections. Sometimes I use Maxivista over wireless and lowering to 20 fps definitely takes the load off an 11Mbs network, while still keeping the monitor totally usable.

Recommended value range: 20..33 fps (default: 33fps)

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

All the world abuzz about Sudoku

October 14, '05 Comments [12] Posted in Gaming | Tools
Sponsored By

Sudoku1At a conference recently, I asked a delegate from Japan about Sudoku (??, sudoku) presuming that he, being from the originating country, would have some insights I didn't. Oddly enough he hadn't heard of it. Is this Japanese game sweeping the world, save Japan?

From WebSudoku.com: The rules of Sudoku are simple. Enter digits from 1 to 9 into the blank spaces. Every row must contain one of each digit. So must every column, as must every 3x3 square.

Folks seem obsessed with it. When I came upon the puzzle I figured it was a fluke, a curiosity, but then I noticed that American Airlines had Sudoku proudly displayed next to their Crossword Puzzles in the in-flight magazine. It's big in the UK. Some are 'unsolvable' (really hard, no logic applies). PocketMod includes pages with generated Sudoku puzzles.

Personally, I did a few, found it hard, found it interesting, but not that engaging. I mean, it doesn't tickle the nice parts of my brain like Crosswords. I feel that Crosswords require thinking, while Sudoku requires processing. Maybe that's not phrased well, but I think that since most programmers first instinct is to write a solver, and some write the solver faster than they can solve the puzzle just proves my point. Computers are a tool, my brain is not a computer. But, my brain can use a computer to solve a Soduku better than by itself. Trying to make my brain work like a computer just makes it ache.

BTW, don't mis-spell it, because Soduku is rat-bite fever!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.