navigation
 Wednesday, January 24, 2007

.NET 3.0 has a number of command line utilities like the service utility (svcutil.exe) that can be awkward to run if you're already in Explorer, deep in a folder structure.  Phillip's svn blog reminded me of a trick with the registry to get the command prompt window populated with the current path.

30netprompt.gif

You can use this technique for any command line or batch file you want to attach to the Explorer context menu. 

  1. Add a key (any name and content appears to work) to HKEY_CLASSES_ROOT\Folder\shell.
  2. Below that add a key "command" and set the text to be whatever command you want executed.  I copied the command line from the .NET 3.0 SDK "CMD Shell" (see registry export listing below), but you could use any command line entry.  The nice thing about the .NET 3.0 cmd shell is that it sets the environment so you can access svcutil.exe and other 3.0 specific utilities.

Registry export listing:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Folder\shell\Command Prompt]
@=".NET 3.0 Command Prompt"

[HKEY_CLASSES_ROOT\Folder\shell\Command Prompt\command]
@="C:\\WINDOWS\\system32\\cmd.exe /E:ON /V:ON /T:0E /K \"C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0\\Bin\\SetEnv.Cmd\""

Built in to Windows Vista

If you're running Vista then you're in luck, it's built-in!  Check out this article showing how to shift-right-click a folder to get the "Command Prompt Here" context menu item:

http://blogs.msdn.com/tims/archive/2006/09/18/windows-vista-secret-1-open-command-prompt-here.aspx

posted on January 24, 2007  #    by Noel Rice  Comments [0]

Dr. T takes you through a well-explained tour of C# 3.0's new features. http://blogs.msdn.com/madst/archive/2007/01/23/is-c-becoming-a-functional-language.aspx

posted on January 24, 2007  #    by Adam Anderson  Comments [0]
 Tuesday, January 23, 2007

While it's true that the .NET 3.0 doesn't directly add any ASP.NET functionality, it's also true that the .NET 3.0 install makes changes in your \Framework\v2.x directory.  Although the install introduction warned that a reboot might be necessary, it didn't turn out to be necessary and the install was relatively painless.  ...Untill we tried to install on a server running a 2.x webservice and received an error indicating that assembly ServiceModel.DLL couldn't be found. 

The primary assembly for Windows Communication Foundation (WCF) services is ServiceModel.DLL. Another seemingly unrelated fact is that hosting a WCF service in IIS requires a service file with a ".svc" extension in a virtual directory.  How is the svc file processed?  An Http handler for the "*.svc" extension is associated with ServiceModel.DLL.  And how does the .NET 2.0 based ASP.NET know to suddenly start looking for this service file?  The 3.0 install adds a new http handler to the web.config file in the \WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG directory.

<configuration>
  <system.web>
  ...
    <httpHandlers>
    ...
 <add
           path="*.svc"
           verb="*"
           type="System.ServiceModel.Activation.HttpHandler,
           System.ServiceModel, Version=3.0.0.0, ...

An IIS restart allowed the web service to resume without error.

posted on January 23, 2007  #    by Noel Rice  Comments [0]
 Monday, January 22, 2007
Confused as to how you set up synchronization with your PDA in Vista? I was... here is what I found.
posted on January 22, 2007  #    by John Waters  Comments [0]
 Wednesday, January 10, 2007
Find out about a new network protocol from Microsoft that draws neat maps of your network on your Vista machine, and how to make it work play nicely with XP machines on your network…
posted on January 10, 2007  #    by John Waters  Comments [0]
 Tuesday, January 09, 2007

I've written and revised a reasonable number of DotNetNuke modules, as well as Falafel's course material for DNN, and I think I can probably create binary Private Assemblies in my sleep.

I was a little unnerved, then, when I was getting something ready for an important customer this morning, and discovered some very weird and different behavior in my test environment than in the development environment. Specifically, I had written a module which collected some extended profile information from Joe User when he was logged in, which I didn't want to collect for the host user or for members of the Administrator group. So I'd upload the new module (logged in as host), then log out and go register a new user name, going immediately to the new module page, where the first thing I needed to do was enter the profile information. Dutifully, I would enter the information and submit it. And nothing would get updated. Yet this worked perfectly in my development environment.

Did I say it didn't get updated? That's not exactly true. I was feeling pretty confused, so when Lino the Wise walkd past my office, I grabbed him and said "Boss, I need some help". He listened patiently as I explained the problem, then turned to my keayboard to demonstrate.

And it worked just like it should. Lino laughed, and said it was because he was standing there that the problem got scared and went away. Then so did Lino. And the problem came right back. After a while longer, I got another coworker to come in. And again I explained the problem. And again, the program performed correctly. These two times, out of perhaps a hundred attempts.

I tried lots of things. Rebooting, of course, and iisreset. Clearing out the temporary files. Creating a fresh virtual site with the same name as the old one, then a new virtual site with a different name. Nothing worked.

I finally noticed (while doing some further testing, with a second user name) that the information from a previously logged in user was being displayed. I had been in the habit of logging in as host, uploading the new module, then logging out and immediately registering a new user. I resorted to brute force: I displayed the current user id on the form. When I'd enter and submit the new user's information, I checked and found that DNN's this.ModuleId function said I was userId=1 (host). Since I was disabling profile update through this particular page for host and administrators, my updates were getting thrown away. Apparently the couple of times it did update were when I was explaining the issue to co-workers - thus taking longer, letting the cache time out (??) and by the time I loaded the offending page, everything behaved properly.

I loaded DNN 4.4.0, and the problem went away. I had been developing and testing in DNN 4.3.5, because this was a custom job and that's what the customer was using. And the heck of it is, they (or actually, their users) will probably not ever encounter the problem because of the way the module will be used, one user at a time from computers all around the country. This particular bug hatched to frustrate only the developer. Too bad I didn't find that out more quickly...

posted on January 9, 2007  #    by Rick Miller  Comments [0]
 Wednesday, December 27, 2006
One way you might want to customize your Sharepoint home page is to add your company logo to an "Image" web part displayed on the page - in fact, the team site template comes with a "site image" preconfigured on the page. You can change the image presented here by putting the page into edit mode, then edit the "Site Logo" web part, and select the logo. It can be any logo, accessible from anywhere, of any recognized graphic type. Very flexible.
 
And then they turn right around and bite you in the butt, because if you have a logo on your local machine, and you want to use it as the site logo, how the heck do you load it up onto the server? I poked around for a while looking for something that would let me transfer a file up to the server and specify where I wanted it to end up, but had to finally connect to the server by mapping a network drive, and copy the file into the default file location. And oh yeah, you'd better know where the file goes and/or where you placed it, because when you click on the button with the ellipses (...), don't think you're going to find a file open dialog - nope. All you get is a bigger text box into which you can type the logo's path.
 
Our company logo is a JPG file about 450 kb in size, and in its natural state, the image is something like 2109 x 1398 pixels. Too big to fit onto a normal screen, much less squeeze down into a reasonable-sized corner of the screen like you might want for a company logo on a home page. So - when you put in the path to the JPG, there are two possibilities for resizing the logo, both of which sound promising. The options presented for the question "Should the WebPart have a fixed height" are "Yes" (with an option for entering the size in pixels, picas, points, inches, etc), and the second is "No. Adjust height to fit zone". There are corresponding entries for the width. If you pick yes, and enter a reasonable size in pixels (120 x 80), what you get is a logo-sized area with scrollbars which permit you to scroll across the entire 2109 x 1398 pixels. Not very useful. OK, let's choose "No", and let the image be adjusted to fit the zone. Or not - all this choice does is adjust the zone size to fit the image. In other words, the "Site Logo" web part becomes huge, so instead of getting a shrunken logo displayed in a reasonable-sized area, the area baloons up, the logo is displayed full size, and you can now scroll the entire web page using the sdcroll bars on the browser if you want to see the whole thing.
 
Aargh. All I found to do was to edit and re-save the JPG as a smaller size, then use that logo.
posted on December 27, 2006  #    by Rick Miller  Comments [1]
 Tuesday, December 05, 2006

So I recently discovered programming.reddit.com, a site that lists the latest and greatest programming articles and blogs that other people have read and rated, and I noticed a trend: a lot of the articles are about functional programming languages. This piqued my curiosity. After all, what's the big deal? I learned some Scheme in college, and it was weird compared to programming in an imperative style. Besides, functional languages don't even have objects, so they don't have the same power of abstraction, right? (wrong, and wrong again.) Well, since then, I've read several fascinating articles on the advantages of functional programming languages, and this article was one of the best. Then I learned that Microsoft is researching a functional language for .NET, and that many of C# 3.0's features were lifted from it.

So now I'm wondering, will functional programming become the way of the future? I've decided that it's important enough to acquaint myself with functional programming techniques. I surveyed many functional languages, trying to decide which one to choose.

I want to learn F# eventually, but I don't want it to be my first functional language, because it allows a mixture of functional and imperative programming, and while that might be a powerful combination once I'm fluent in both styles, I don't want to be tempted to fall into familiar imperative patterns while I learn this new style of programming.

Clean looks pretty nice; it performed admirably well for a functional language in the Computer Language Shootout, and it even has its own IDE written entirely in Clean! It is a modern language, but its development and usage isn't as widespread as Haskell's, below.

At long last, I come to Haskell. Haskell is a pure functional language, so I won't have the crutch of imperative programming to fall back on. It was designed to be an open standard, consolidating existing functional languages into a common one as a basis for future language design, which also means that it will be an epicenter of new language developments. While the project to create a Haskell IDE written in Haskell is still underway, there is a Haskell plugin for Visual Studio, which is still pre-release, but the author feels that it's getting close.

In the end, I've decided to pursue learning Haskell first, and then probably F#. If I have any great epiphanies, either for or against functional programming, I'll be sure to post my thoughts here.

posted on December 5, 2006  #    by Adam Anderson  Comments [0]
 Thursday, November 16, 2006

This is an interesting article about the performance and scalability of temp table and table variable in SQL Server 2000 and 2005. http://www.lakesidesql.com/articles/?p=12

posted on November 16, 2006  #    by Adam Anderson  Comments [0]