Scott Hanselman

The 2007 Walk Against Diabetes approaches

September 23, '07 Comments [5] Posted in Diabetes
Sponsored By

Hello folks. The Walk Against Diabetes approaches - it's coming up this October 20th, 2007. You can get details and join the Walk with my family and I at the American Diabetes Association. All donations go straight to the ADA for Research, Education and Advocacy.

Last year we (meaning, YOU, the readers of this blog) raised over $12,000, blowing past my goal of $10,000. Turns out we raised more money than any single team in Portland and they made me this year's Walk Ambassador.

So, I set the bar higher for 2007 with a goal of $50,000. As of this writing we are at $25,421.68! We've almost doubled last year, but only 51% of this year's goal.

What's Next

172400618_240x240_Front_Color-AshGrey However, don't count us out yet. With only a month left I've got a few ideas up my sleeve. Along with Jason Mauer and Rich Claussen, we've got a fund raising promotion idea that will truly blow your mind. If you're in Portland, SW Washington, or willing to drive from Seattle, mark your calendars for Thursday, October 11th from about 8pm to Midnight and watch the blog for details. If you don't make it, there will be pictures and video galore - of the mind-blowing, face-melting variety. Watch for the announcement coming soon.

Again, do visit the Diabetes Site to DONATE or JOIN THE TEAM AND WALK.

Microsofties

If you're reading this blog and you work for Microsoft, perhaps you've not gotten around to giving yet. Remember that Microsoft will MATCH your donation dollar for dollar. Just visit http://give on the Microsoft Intranet, and select the Portland Chapter of the American Diabetes Association and mention "Team Hanselman" in the notes. Feel free to send me a copy of the PDF or screenshot and I'll make sure things get there they should.

What have we accomplished?

Maybe you've just started reading this blog recently? Here's some of the promotional stuff we've done this year to help raise awareness:

Get Educated about Diabetes

Here's some potentially interesting Diabetes Links for you to read:

Thanks

Thanks VERY much to everyone who has given so far. This has been an amazing here.

Special thanks to our MicroISV partners:

  • Scott Cate and his EasySearchASP.NET gift! He donated all the proceeds to EasySearchASP.NET to the ADA from August 23rd through September 7th! Very generous and a great MicroISV idea. Thanks to the folks that purchased his product and indirectly supported the fight against Diabetes
  • Leon Bambrick for donating 50% of the proceeds for TimeSnapper. If you have to keep a timecard or keep track of exactly what it is you do all day? Get TimeSnapper - It's Tivo for your Mind.
  • The very awesome Martin Plante, lead at slimCODE Solutions, for starting us off by giving all the earnings from his slimKEYS product during the May 6th to May 11th to help fight diabetes. An amazing idea and a very nice gesture. Thanks Martin! Check out SlimKEYS in my post on Replacing Start Run.

Kitsch and Merchandise for the Cause

172400631_150x150_Front_Color-PinkSalmonPhil Deveau emailed me and said:

"I'm going to be riding in a 50K bike ride in November of this year for diabetes (www.diabeteschallenge.com).  I'm training with a couple other guys, every day, if you have a store or something where I could purchase a team Hanselman hat, I'd be proud to wear it while I'm training and on the race day"

172400608_150x150_FrontWhat a fantastically nice thing to offer! Of course, I have no merchandise, BUT I do have Jon Galloway on Skype Speeddial. Jon created a 2000x2000 Transparent PNG of the Team Hanselman Logo (also a Galloway creation), and fired it off to me, and 20 minutes later I present to you, Dear Reader, The Team Hanselman Fight Against Diabetes Store.

172400645_150x150_Front_Color-WhiteJust when you though you couldn't get away from my giant disembodied head, I show up on a T-Shirt. When will it end? It will never end, thanks to the Team Hanselman Diabetes Store. Madness.

 Here's your hat, Phil, along with T-Shirts, Sweats, Hoodies, Buttons, and, of course, the Team Hanselman Baby Onesie. Rock the Onesie on Oct. 20th to help in the Fight Against Diabetes.

Thanks again to you, the community. I'm proud to call you all my peeps. I appreciate you, your comments, your support, your emails. Even the anonymous cowards in the comments. Especially you. ;)

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

Multi-threaded Debugging in Visual Studio 2008

September 21, '07 Comments [4] Posted in ASP.NET | Microsoft | Programming
Sponsored By

This might be old news but it was a treat for me. In debugging some multithreaded code recently got to use the improved debugger support for threads in Visual Studio 2008 (I'm running Beta 2) that John Robbins blogged about last month and Soma blogged last week.

Take a look at the IDE screenshot below (click to Zoom).

Multi-threaded Debugging

There's a few cool and subtle things going on here. Take a look at the current instruction location in yellow. It's right at the end of the CheckDependancyCallback method - but see the gray highlight with the squiggly "thread" in the margin? That's the current location of another thread of execution.

You can name your threads now just by entering their name in the Threads toolbox window, and some threads without names will get an automatic name. You can also flag threads you're interested in watching so you don't have to remember the Thread ID.Take a look at the Debug toolbar as well. You can see the Debug Location including Process and Thread (what thread I'm currently debugging).

What a treat.

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

Hanselminutes Podcast 82 - 10 Foot Development for Media Center

September 21, '07 Comments [7] Posted in Microsoft | Podcast
Sponsored By

GreenButton My eighty-second podcast is up. Every copy of Windows Vista Home Premium and above has Media Center on it. Have you run your copy? Turns out that you can develop your own '10 foot apps' (that can be run with a remote from your couch) with Visual Studio Express or even Notepad. Scott talks to Charlie Owen to find out how.

Subscribe: Subscribe to Hanselminutes Subscribe to my Podcast in iTunes

If you have trouble downloading, or your download is slow, do try the torrent with Āµtorrent or another BitTorrent Downloader.

Links from the Show

Do also remember the complete archives are always up and they have PDF Transcripts, a little known feature that show up a few weeks after each show.

Telerik is our sponsor for this show.

Check out their UI Suite of controls for ASP.NET. It's very hardcore stuff. One of the things I appreciate about Telerik is their commitment to completeness. For example, they have a page about their Right-to-Left support while some vendors have zero support, or don't bother testing. They also are committed to XHTML compliance and publish their roadmap. It's nice when your controls vendor is very transparent.

As I've said before this show comes to you with the audio expertise and stewardship of Carl Franklin. The name comes from Travis Illig, but the goal of the show is simple. Avoid wasting the listener's time. (and make the commute less boring)

Enjoy. Who knows what'll happen in the next show?

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

Managing Multiple Configuration File Environments with Pre-Build Events

September 21, '07 Comments [35] Posted in ASP.NET | Musings | Programming
Sponsored By

ScottGu mentioned an idea to me last week that he'd had for managing configuration files like web.config depending on what the current build config is. Bil Simser mentioned one part of this in January and Rob Chartier offered batch file help on a mailing list in June. Since ScottGu is busy Managing Generally (he IS the General Manager) so I said I'd prove the concept for him.

Here's the general idea. It's not too hard. I'll use an ASP.NET Web Site and web.config as an example, but this will work with most any kind of project, exe's or .dll's.

1. From Visual Studio, go File | New Project, and select ASP.NET Web Application.
Note: Do NOT "New Web Site" as we want a .csproj and we're going to use a Pre-Build Event, not supported by Web Sites. I've named mine FooFoo.

New Project (2)

2. Right click in the Toolbars and ensure that the "Standard" toolbar is showing. You'll know if you see a dropdown that says "Debug" next to one that says "Any CPU."

Click the dropdown and select "Configuration Manager."

image

You'll probably have Debug and Release configurations, but you can also make custom ones and base them on existing configuration. In this dialog I've made a new "Deploy" and I'll base it on the "Release" configuration.

WindowClipping (8)

Make sure to create a Solution Configuration AND a Project Configuration, as they are different. Here I've made one called Deploy for the Project also. If you get an error message, be aware of the "Create new project configurations" checkbox. You might get a warning if you are making a new configuration and the dialog tries to make another configuration with the same name; uncheck the checkbox if that happens.

deploy

Of course, you can have as many Configurations as you'd like.

3. Add some custom configuration stuff in web.config, like connectionStrings:

<connectionStrings>
    <add name="Foo"
         connectionString="Data Source=localhost;Initial Catalog=DatabaseName;
                           User Id=sa;Password=debug;"
         providerName="System.Data.SqlClient" />
</connectionStrings>

See now I've made the password in my nonsense connectionString = "debug"? Now, create three new web.config's by CTRL-dragging the web.config on top of the project. Name them web.config.debug, web.config.deploy, and web.config.release. Make the password equal to "deploy" and "release" respectively.

WindowClipping (6)

4. Ok,  now we've got different configuration and different configuration files. Let's create a batch file called "copyifnewer.bat" and here's the contents:

@echo off
echo Comparing two files: %1 with %2

if not exist %1 goto File1NotFound
if not exist %2 goto File2NotFound

fc %1 %2 
if %ERRORLEVEL%==0 GOTO NoCopy

echo Files are not the same.  Copying %1 over %2
copy %1 %2 /y & goto END

:NoCopy
echo Files are the same.  Did nothing
goto END

:File1NotFound
echo %1 not found.
goto END

:File2NotFound
copy %1 %2 /y
goto END

:END
echo Done.

Basically this batch file will copy a file over another if the files don't match. It's not strictly "copyifnewer" (like, not at all) but it does the job.

Why bother with a batch file to check for changes and not just copy over the file every time? Well, each time you copy over a web.config it restarts all the designers and running AppDomains that are watching that file. No need to copy over a file if it hasn't changed...everything will churn less.

Put this copyifnewer.bat file in the root of your project.

WindowClipping (10)

Why not use PowerShell? One word - speed. Batch files are fast. Full stop. This is a build, so it needs to be fast.

5. Create a Pre-build Event. Right-click on your Project and select Properties. Click Build Events and in the "Pre-build event command line" and enter this value:

"$(ProjectDir)copyifnewer.bat" "$(ProjectDir)web.config.$(ConfigurationName)" "$(ProjectDir)web.config"

 Notice the magic dust, the $(ConfigurationName) project variable, that contains "Debug" or "Release" or "Deploy."

WindowClipping (9)

6. Build. Now if you build, you'll see in the Build Output the batch file being run and the files being copied. Because it's a Pre-Build Event it'll be seen in both the Build Output in Visual Studio .NET. 

When you build within Visual Studio the currently selected item in the drop-down list is the current configuration.

image

The configuration value can also be passed in on the command line when building with MSBUILD. 

msbuild FooFoo.sln /p:Configuration=Deploy

 Administrator Visual Studio 2008 Beta 2 Command Prompt

And there you go. The connection string in the web.config now contains deployment-specific configuration data.

<connectionStrings configSource="separateConnStrings.config"/>

Bad things are that you've got to keep web.config's in sync if there's lots of settings, but you could totally break it apart via "include files."

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 Nuclear Option: Resetting The Crap Out Of Your Network Adapters in Vista

September 20, '07 Comments [7] Posted in Musings
Sponsored By

I was having a number of strange network issues on a laptop today. Here's the complete nuclear option for resetting your whole IP stack. This is for when "Diagnose and Repair" isn't cutting it. Thanks to JohnP for his help.

  • Go to the Start Menu, type cmd and right click, and select "Run As Administrator"
  • Type the following commands, each followed by pressing enter.
    • ipconfig /flushdns
    • nbtstat -R
    • nbtstat -RR
    • netsh int reset all
    • netsh int ip reset
    • netsh winsock reset

UPDATE: On Windows 7, you'll need to do this to reset your network adapters:

  • ipconfig /flushdns
  • nbtstat -R
  • nbtstat -RR
  • netsh int reset all
  • netsh int ipv4 reset
  • netsh int ipv6 reset
  • netsh winsock reset

Now, reboot and pray. Possibly not in that order.

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.