Scott Hanselman

Troy, the movie...and a new unit of measurement is born

May 14, '04 Comments [2] Posted in Movies
Sponsored By

The amount of energy required to launch one ship: One milli-helen.

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

What a night...will it ever end?

May 14, '04 Comments [5] Posted in Musings
Sponsored By

Madness.  It's 1:39am. 

I went to Fry's this evening and spent some of my winnings.  I got a 10,000 RPM WDC 75 GIG SATA drive.  This is my first foray into Serial ATA.  I feel like the time I switched from MFM/RLL to IDE.  It's a whole new world out there.

I've got a lovely Intel 865PERL motherboard with SATA on the board itself - so theorectically I can run this new drive as my C: drive without any drivers (like you need with add-on SATA cards.)

Thing is, last week, thinking I was clever, I flashed the BIOS from the old version P12 to the new P15 - and I've been regretting it ever since. 

The machine boots like once every 12 reboots, and you have to power it off HARD and let it (the capacitors?) REALLY cool off.  It's madenning.  First I thought it was the old IDE Promise RAID card, then I thought it was an impending Hard Drive failure, then I thought it was a Firewire problem.  Now the box is opened up like a dissected High School frog and this is the only thing I can think it is.

I googled my BRAINS out trying to figure this out.  You know, there's a LOT of people out there on the USENET having hardware troubles! :)

I found this one guy who appeared to have the same problem.  And from the sound of it, we may just be the two people on the planet that are having this problem.

Anyway, I've removed this jumper and that, flashed the bios again with a recovery bios (copied onto the only 3.5" Floppy in the ENTIRE house, with some paper I wrote 12 years ago...I formatted it with impunity, so as to avoid catching some Word 2.0 Macro Virus, or a Stoned ANSI bomb).

It APPEARS to be booting up.  Now I begin the long process of designing a storage and backup strategy for this family!

I hope this BIOS sticks.

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

Accessing the ASP.NET FormsAuthentication "Timeout" Value

May 13, '04 Comments [3] Posted in ASP.NET | Internationalization | XML
Sponsored By

Here's a heck of a thing.  I'm doing my own FormsAuthentication Cookie/Ticket, rather then using the built in FormsAuthentication.RedirectFromLoginPage, as I need support for UserData, and other encrypted goodness.  So, I need to:

    // Create the authentication ticket            
            FormsAuthenticationTicket authTicket = new
                FormsAuthenticationTicket(1, //version
                userName, // user name
                DateTime.Now,             //creation
                DateTime.Now.AddMinutes(??), //Expiration
                false, //Persistent
                userDataGoodness); //Secret Sauce

but, I want to use the Timeout value that is already in the Web.config:

    <authentication mode="Forms">
            <!-- TODO: Set requireSSL to true for production -->
            <forms requireSSL="false"
                slidingExpiration="true"
                loginUrl="~/login.aspx"
                name="AuthenticationTicket"
                protection="All"
                timeout="20" />
        </authentication>

which seems reasonable, eh?  Plus, as I'm a nice guy (hopefully not a hack) I like to do things the Kosher way.  I'd had to hack this up.  So, I figure I'll use something like 'FormsAuthentication.Timeout' - except it doesn't exist.  I can get to everything else, just not the Timeout.

And the Googling and Reflecting begins.  Sometimes I think that's my full time job, Googling and Reflecting.

Here's my thought process, for your edutainment:

  • THOUGHT: Surely they must have thought about this.
  • ANSWER VIA GOOGLE: In a 2002 MSDN Online Chat, someone asked this question and was told: “Unfortunately, we don't expose this configuration property currently.“ but given these helpful tips:
    1. You could try reading it using System.Management
      (ME: But this would require giving WMI access to ASP.NET and doing something like:

      string path = "root\\NetFrameworkV1:forms";
      ManagementObject pm = new ManagementClass(path).CreateInstance();
      pm["Selector"] = "config://localhost"; // represents the machine.config file
      pm.Get();
      Response.Output.WriteLine("timeout = {0}<br>", pm["timeout"]);

      Yuck.)
    2. You can retrieve the value you set by casting User.Identity to an instance of FormsIdentity and accessing the fields on that object.
      (ME: This only allows me to see the result AFTER I've already set it once.  I need this to work the first time, and I'd like to read it as a configuration item, not a side effect.

  • THOUGHT: Someone on Google Groups must have done this before.
  • ANSWER FROM GOOGLE GROUPS: Noone has a clue, but many have hacked things worse that my upcoming hack. NOTE: Don't do this, and remember Scott's Rule of Programming 0x3eA)
    1. Private Function TimeOut_Get() As Integer
      'Get formsauthentication TimeOut value
      'Kludge, timeout property is not exposed in the class
      FormsAuthentication.SetAuthCookie("Username",
      False)
      Dim ticket As FormsAuthenticationTicket =
      FormsAuthentication.Decrypt(Response.Cookies
      (FormsAuthentication.FormsCookieName).Value)
      Dim ts As New TimeSpan(ticket.Expiration.Ticks -
      ticket.IssueDate.Ticks)
      Return ts.Minutes
      End Function

  • THOUGHT: I could just put the configuration somewhere else in my web.config and let folks keep the two in sync.
  • ANSWER FROM MY CONSCIENCE: That would mean that there would be invalid states if they didn't match.

Note, here's where insanity and over engineering set in...

  • THOUGHT: I can just use HttpContext.GetConfig and read it myself.
  • ANSWER VIA REFLECTOR: AuthenticationConfig and all it's properties are internal.

  • THOUGHT: I can use Reflection and read the privates myself. 
    Remember, Relector and a little Red Wine will always give you access to Private Members.
  • ANSWER VIA MY CONSCIENCE: I don't really want to Reflect my way to salvation

  • THOUGHT: Screw it, let's just SelectSingleNode once and feel back for 10 minutes.
  • ANSWER:

                System.Xml.XmlDocument x = new System.Xml.XmlDocument();
                x.Load(UrlPath.GetBasePhysicalDirectory() + "web.config");
                System.Xml.XmlNode node = x.SelectSingleNode("/configuration/system.web/authentication/forms");
                int Timeout = int.Parse(node.Attributes["timeout"].Value,System.Globalization.CultureInfo.InvariantCulture.NumberFormat);

I know it could be better, but I'll put it in a constructor, add some error handling and move on. All this thinking only took about 20 minutes, so don't think I spent the afternoon sweating it.  More time was spent on this post! :)

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 Problem of Peristance: Storing and Backing up One's Life a Gigabyte at a Time

May 11, '04 Comments [13] Posted in Africa
Sponsored By

I had a scare this weekend.  Last week I flashed the BIOS on my lovely Intel Motherboard (you remember, the one I got last August for a song) and forgot about it.  A few days later I had to reboot for some reason and after the intial BIOS POST...nothing.  Just a non-blinking hard drive light.  The weird thing is, if I let the box sit for an hour, it boots.  But, if there's trouble, it won't boot again until I let it sit. 

Needless to say, I was a little concerned as I was trying desperately to burn a series of DVDs from the seven hours of digital video I shot in Africa.  I shot all these Digtal 8mm tapes then ripped them to my external firewire drive. It ended up being about 80 gigs of data.  When my C: drive didn't boot, it got me a little panicky and I started thinking about storage.

Here's my setup:

  • 45 gig Western Digital EIDE 7200RPM C: Drive
    • Contains Windows, my desktop and profile. Also Program Files.  No data to speak of.  This is the SYSTEM drive.
  • TWO 20 gig Seagate EIDE 7200 RPMs MIRRORED with a Promise PCI RAID card
    • The RAID card was the shiznit 4 years ago.  It's a FastTrak66.  I'm sure it's obsolete now, but it's non-certified Windows 2000 Drivers work fine in Windows XP. 
    • This array contains a 4 gig partition called DATA with all My Documents and Mo's Documents (her My Documents on her machine points here, although she doesn't know it).  While I'm not a fan of partitions, I keep this at 4gig as I figure that's a good "working size" and it forces me to fit and backup all of the Family's Documents onto one single-layer DVD.  I back this up to a DVD+RW weekly.
    • The remaining 16 gig partition is called STORAGE and is random.  I consider it secondary but persistant storage.  I back this up less frequently, maybe monthly.
  • 200 gig Western Digital External Firewire Z: Drive
    • This is the media drive.  All my Ripped Music is here, all my Video is here, and all my Audible Books are here. 
  • 75 gig No Name External Firewire Drive
    • This drive is largely unused.  I have used it for a Photoshop Scratch Disk or for a Virtual Memory Swap file.  However, once it freaked out (I'm starting to not trust Firewire) and can't count on it.

Here's the issue.  How do I truly back my life up?   As we begin to collect all this 'Media' how to we protect it? 

What to Backup of my Digital Life?

I have a ReplayTV with 80gigs of storage (80 hours of video) but arguably the whole drive is scratch.  If I lost it all, I'd be sad, but hey, it's TV.  There will always be more.  Certainly I don't need to back it up. 

My C: drive? No worries...well, some, but really, I could pave it and start over, as the DATA is on the RAID Array.  I back up the RAID array weekly onto one DVD+RW, and put that in an off site location.

But what about the BIG stuff?  How do I backup 200 gigs?  50 DVDs?  Not feasible.  More and more people are starting to backup their lives on Moving Magnetic Media, and I'm starting to think it's just a ploy to sell more $50 120gig drives. 

No one outside of the enterprise seems to mention Tape Backup for the home.  PC Magazine is much more likely to suggest that the Small Office/Home Office user buy a Network Storage Device (read: another computer with another hard drive) and suggest that it be hidden in the closet. 

But if I really care about my data, how can I protect it?

I Can't Keep Everything

A good example is this recent rip of 80 gigs of video.

Digital 8mm Source Tapes -> 80 gigs of AVIs -> Nero Vision DVD Project -> Rendered DVD Image File -> Final DVD

I certainly can't keep 80 gigs of AVIs around, but if I yank them

Digital 8mm Source Tapes -> DELETED -> Nero Vision DVD Project -> Rendered DVD Image File -> Final DVD

What happens if I have to make a change to the DVD?  Since the Project is really a series of timestamp "pointers" to the original video, do I just rip the video AGAIN and hope the pointers line up?  If I take the advice of the MyLifeBits guy at Microsoft Research, I'd just keep buying Firewire drives and save EVERYTHING.

What do you do to protect your data?

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

Hooked on Skype

May 10, '04 Comments [2] Posted in Diabetes | Africa
Sponsored By

Ya, even though I’m the one that hooked you on it, it’s worth reiterating.  Skype is SO cool.  The sound quality is disturbingly good.  I’ve talked to Canadians, Africans and Austrians and it’s crystal clear.  I just got off the Skype with John Bristowe and interestingly enough we were both on wireless on our laptops behind Lord knows what firewalls and had a lovely conversation. 

FYI: I’m “glucopilot” on Skype.  Check it out!

Today, Scott "the German who doesn't speak German" Hanselman introduced me to one of best pieces of software I've seen in the last time: Skype [http://www.skype.com]

Skype is a free, non-adware P2P voice over IP application (from the makers of kazaa) which doesn't force you to reconfigure your firewall and which provides voice quality which is better than, or at least comparable to a phone. With no noticeable lag and no blank-out periods like transatlantic phone calls.

It rocks for me because a lot of my friends are distributed amongst five different continents and Skype allows me to keep in touch with them better than IM would allow me to. Today I've already talked to friends in the US and Africa just as easily as using IM. I'm impressed. [Ingo Rammer's Weblog]

Update: I've added a 'Skype me!' badge to the left, underneath the email me.  Skype supports pluggable protocol/custom url handers.  Note the 'callto://' syntax.  Slick. 

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.