Mapping/Connecting a Drive Letter to a WebDAV or Front Page website

Mapping/Connecting a Drive Letter to a WebDAV or Front Page website

Update:

Apparently Windows XP makes this possible through an integrated WebDAV client and updated Net Use command.  For icing: if you have a Passport, you can map your online Documents folder to a drive letter with this command:
net use * “http://www.msnusers.com/My Web Documents/Documents” /persistent:yes /user:


Tons of cool possibilities with this…  (Now if we could just do the same with FTP!)


I just setup a webDAV-enabled website in IIS, enabled HTTPS, setup a couple virtual directories with pass-through authentication to my file server, and voila! thanks to the above trick, I can have secure, full-control remote access to it from anywhere.


Actually, there was a lot of toil to the process, since there are a lot of bugs and tricky bits with DAV, HTTPS, and UNC Virtual Directories.  Here’s useful info I found when wrestling my share of them…

WebDAV:


HTTPS/SSL:

Passthrough Authentication:

Web Folders:

Virtual PC: Shrinking a new Virtual Disk

Lemme see if I’ve got this process straight now. Create the Virtual Machine, then…



  1. Host: Compress the Virtual Disk file.
  2. VM: Start the VM and Install the Guest OS.
  3. Guest: Disable pagefile entirely, and restart OS.
  4. Guest: Stop all services.
  5. Guest: Compress entire hard drive(s).
  6. Guest: Defrag til the cows come home (at least 20x).
  7. Guest: Restart needed network services, so I can…
  8. Guest: Install Eraser, create a new “zeroes” method of unused space overwriting, setup unused space task.
  9. Guest: Run Eraser (possibly 2x).
  10. Guest: Shut down OS & VM.
  11. Host: Run Virtual Disk Wizard to compress Virtual Disk to new file.
  12. Host: Defrag Virtual Disk file til the cows come home.

Dang… that’s involved! VMWare definitely beats Virtual PC here.


It’s several hours worth of drive grinding, in fact, but it’ll get that image file as small as possible, and should make it run faster.


Alright, so I’ve doc’d the process for future reference. Some further explanation and tips:



  • I compressed twice, both in the guest and host OS. This does several things:

    1. Sacrifices CPU for better hard disk performance, which is Virtual PC’s speed bottleneck.
    2. Frees more space in the Guest OS, which can then be zeroed-out and shrunk more effectively by the Host OS’s file compression.
    3. Achieves an overall smaller image file. When combined with “trimming the Windows fat” *, it can make VMs of most basic Windows installs fit on a single CD.

  • I stopped all services for the compression and defrag. This unlocks more files which can then be compressed and defragged.
  • I defragged til the cows come home, because…

    1. A spanking fresh Windows install is already quite fragmented, and file compression fragments it much more.
    2. Windows’ built-in defragger is by no means thorough. Running it several dozen times is as close as it gets. Fortunately this can (now) easily be scripted for easy walking-away.
    3. Theoretically, free-space defragmentation should also help the external compression scheme too, but this is the worst . Most 3rd-party defrag tools would be more effective at this.

  • Step 8 may need to be repeated. I’m not sure why, but sometimes Eraser doesn’t do the trick the 1st try. The indication of this is the Virtual Disk file not actually shrinking.
  • I suggest disabling Undo disks for this process. It only adds one more looong step of merging the undo disk with the original.
  • Step 3: If you’ve got the RAM (say 1GB), give it to the VM and disable its pagefile. That’ll further bypass the slow disk issue.
  • Step 12: I use Defragmentor Lite for single-file defragging. I also sometimes find it effective to switch between that and Windows’ defrag utility.
  • * “Trimming the Windows Fat”

    1. Uninstalling via Windows Add/Remote Components: MSN Explorer and most of Windows’ Accessories (I just keep Paint around for screenshots).
    2. Uninstalling via various obscure commands:

      • Agent: %windir%\system32\RunDll32.exe advpack.dll,LaunchINFSection %windir%\INF\agtinst.inf, RemoveAgent
      • Messenger: %windir%\System32\RunDll32.exe advpack.dll,LaunchINFSection %windir%\INF\msmsgs.inf,BLC.Remove

    3. Deleting various nonessential files:

      1. All temp files
      2. Search for files matching “*.bmp; *.wma; *.wmv; *.wav”. Of these, most of the biggest ones can be deleted without being noticed.
      3. Possibly %windir%/DriveCache/ ? Hardware won’t change in a VM. I’ve successfully done it before without problem. The worst that should happen is prompting for the install CD. Not sure what other repercussions this could have.


As way of disclaimer: I’m no expert/guru/pro with VPC. These are just my learnings and observations so far after a few years’ use and fiddling. I’ll gladly defer to the pros on this, but I haven’t seen much on this subject either.


2005-03-12 update: I just found out that SP1 for VPC makes the disk prep steps slightly simpler (the “zeroing” part).  It does this via a new Virtual Disk Pre-compactor CD image which it makes available for mounting, which saves the extra hassle of installing and configuring Eraser.  (via Robert Moir’s excellent VPC site)

“Show friendly HTTP error messages”

I’d just like to volunteer something: “Show friendly HTTP error messages” was one of the worst thought-out features ever added to IE.


The few times I’ve missed it on a new development workstation have been absurdly baffling (“give me some useful error information!!!”).  The many times a user has said “it doesn’t work” but had no more details and no error message have been all the more painful to track down.


Argh!


(at least the fix is scriptable, so I’ve just added it to my standard “prefs” scripts..)

Brain dump: Getting VS.net intellisense AND easy deployment with ASP.net

No not that kind of Brain Dump — I just figured I’d mention this stuff, in case it comes up again/for someone else…

I’ve been fighting with ASP.net and Visual Studio.net (2003).   VS.net pushes code-behind files (aspx.vb or aspx.cs) hard, since they help separate logic and presentation (a good thing).  One particular way is by disabling Intellisense (the #A1 best main reason I use VS.net and InterDev before it) in the aspx file itself.  

Next problem:  Ok, I bought into using code-behind file for UI/logic separation.  Unfortunately every little change to the code-behind requires a rebuild, and therefore a restart of the app (logging me out, since I’m using tracking auth in session).  So I then have to re-login and find where I was all over again… for each and every change to the code-behind!

(BTW, contrary to popular misconception, code-behinds don’t improve performance.  Well, they’re pre-compiled, so they may be faster on the very first page load than inline code [which is compiled on that first load], but afterwards they’re identical in speed.)

Alright, screw the code-behind, I think.  back to my own code separation — one big logic block before the presentation block, with minimal connections between.  Big errors! (something about method body, I recall)  — I can’t put functions/subs there.

My first discovery: you can use functions/procs in the aspx.  You just can’t have them inside <% shorthand ASP tags %>— they only work inside explicit script tags (e.g. <SCRIPT runat="server"></SCRIPT>).  Apparently <%%> and <SCRIPT runat="server"></SCRIPT> are no longer equivalent to each other, as they were in Classic ASP.

SO, my gears turned and came up with a solution to the mess: a homebrew code-behind.  I ripped out the contents of the code-behind, put them in a separate aspx file (inside a <SCRIPT runat="server"></SCRIPT> block), and just include it.  This solves the rebuild/restart problem, and still maintains code separation.

Downside: no Intellisense!  (since VS.net now only enables it for what it recognizes as code-behind files)

Next discovery: The @Page directive can have an src attribute/property to reference the code-behind file (it normally uses Inherits and Codebehind attributes/properties to enable the code-behind).  src does NOT require rebuilding to take effect.  It also works with a normal code-behind files, so you get blessed Intellisense.  (more info here: Inherits vs. Src vs. Codebehind)

So I now have a solution, just with something like <%@ Page Language="vb" src="report.aspx.vb" inherits="report" %>. (The inherits is still needed for object/class references).

One catch: VS.net complains loudly when it loads a page with this src attribute:

The file could not be loaded into the Web Forms designer.  Please correct the following error and then try loading it again:

The @ Page or @ Control directive contains a src= attribute, which is not supported in Visual Studio.

Make sure all of the classes used in the page are built or referenced in the project.   Click Help for more information.

It loads fine on the second try, but color-coding on any inline code is then disabled.  (Workaround for that: remove the src and inherits attributes, save, reopen the page and re-add those attributes. All works fine as long as VS.net stays open after that.)  For me, it’s a small-enough price to pay for code-separation, easy deployment and Intellisense.  (Microsoft’s src info here, but no explanation why VS.net doesn’t fully support ASP.net, certainly none why it actively hinder its use). 

Some further, unrelated discoveries:



  • Response.IsClientConnected is extremely expensive.  If you need it in a long loop, only check it once every 100 or more records.  Going from every 10 rows to every 100 gave me a 7x speed increase.
  • Option Strict — enforces good coding, since it makes you explicity declare all types and early-bind your objects.  Unfortunately (I think) it also adds a lot more coding for explicit type conversions too (for instance from recordset field values).  It seems the parser checks the type conversions in a second pass, so it may be easy enough to turn it on for the first pass and off again when it starts throwing type conversion complaints.

 

SBS 2003

Yeehaw. Having fun with my first migration to Small Business Server 2003. I’ve used and experimented with it a bit, but not actually done a migration.


It wasn’t until today that I noticed something about it (and this probably applies to Windows 2003 in general). There are a lot of annoying old GUI defaults that they’ve fixed. Off the top of my head: Windows Explorer’s “Hide extensions for known file types” is now off by default, and the default item view is now “Details” instead of “Icons”. (“Simple folder view” IS still on, but hey, every little bit helps.)


SBS’s Internet Explorer could still use some default GUI improvements. I’m particularly annoyed by the huge-by-default “Media” toolbar button. This should always go away, and “Font Size” and “Full Screen” should take its place. (Interestingly, the Media button disappeared from IE with XPSP2. Hopefully the same will happen w/SP1 for SBS2003).


Something strange is going on. Twice now I’ve rebooted only to have video disappear. I even switched monitors. It seemed like jiggling the vid card fixed it, but it hasn’t worked this second time.


Grr. I’ll save it for tomorrow…


Update:
Well, I opened the case (a joyously easy Dell case) and found the video card loose.  Reseating it fixed the video.  But it’s happened again now, and reseating isn’t working.  In fact, I think it isn’t booting.  This is very bad!


Update 2:
It was bad memory.  I basically amputated one component at a time, and it started booting again when I got to the RAM (last thing of course).  One DIMM good, the other bad — just like that.   Dell’s making it all good tho: two replacements by Friday 9am.  Support contracts are a nice thing…

One more: Motives

Introvert I am, I’m also analyzing my motives for how I’m blogging, and why I’m blogging at all.


My space.  Life gets crowded sometimes.  Work and family roles fill up most of it.  I guess I’m seeking a space all of my own, a “studio” (even if just a virtual studio) where I can work on being (and figuring out) Me.


Publishing.  This is the biggest motivation.  As a web developer, I’ve built a ton of stuff I want to share with the world.  I started doing this a couple years ago and self-publishing it in a section of my business site.  It’s always seemed a bit odd, though, since it wasn’t really business.  (Giving away stuff for free doesn’t pay the bills now does it?).  Furthermore, if that business ever went away, I’d still want to keep doing and publishing that stuff.


Self-Unification:  Sounds weird, and it is.  It falls somewhere between the first two, and has bothered me recently.  It was the final straw that got me here typing now.  I tend to cope with the complications of life by compartmentalizing my life, but many things fit more than one compartment.  The aforementioned publishing issue is one major symptom of this.


I guess these are all facets of the same issue.  I’m a developer at heart (I’d keep coding even if I was suddenly independently wealthy), and that creates tensions I have problems rectifying.  If I was only a developer by day, it’d be fine — I’d leave work at work.  I can’t leave it there though.


Heck, the reason I chose this profession is a story of its own, but one highlight is this:  I was just starting my 4th year of an English Lit degree circa 1997, and still didn’t know what I was going to do with it (and was not a little panicky about that).  I was wrapping up my 2nd or 3rd website when my “A-ha!” moment happened — I realized that a) I loved what I was doing, and b) I could get paid to do it.


I think my second “A-ha” has been more gradual.  A major part of it has been the blog phenomenon (I’ll never forget my confusion at how google suddenly started returning a bunch of schmo developer’s personal sites when I was doing work research, and how it was not only extremely pertinent, but often better than the official documentation!).  Another big part was reading the fairly amazing Cluetrain Manifesto (read it now!), which pretty much just verbalized what had been churning.  This “A-ha” is basically that business is about people, including me, and so I can’t treat my career (my calling?) like a job.  It’s not just what I do, or where I spend 8hrs/day — it’s part of me.


I consider myself extremely fortunate to have found a profession I love (even if it’s still by the “sweat of my brow” ), but I guess that love needs its own space.


I love to code.


(Perhaps that should by my blog tagline?)

Blah Blah BLAH! (aka Goals)

Sheesh, it’s been mere minutes, and that opening post already looks to me like verbal-diarrhea!  That’s the problem with thinking while you talk.


I know I said it was “about me” and all that junk, but what’s the point if even I don’t want to look at it?!?  This is the web after all.  I’ve been reading almost 200 blogs for a couple years now, and I’ve gotten to be a way better skimmer than I ever was in school. 


So: why say it if nobody read it?  


It’s a battle between Expression and Communication.  To define: Expression is about simply “getting something out”.  Communication is about “getting something in” — into someone else’s head.  Apparently I look at language and the web as a medium of communication, but not expression? 


Is Expression of an idea valid on its own, even if nobody hears it?  Why do we speak?  (If a tree falls in a forest and nobody hears it….)


I dunno.  Perhaps I should just boil stuff down anyway. 


I’ll try a list — they’re hard to make wordy. My intentions:



  • Voice: be open and uninhibited, but succinct
  • Subjects:

    • talk about big web/dev/tech news
    • publish lots of my existing web/dev/tech-related tools/code/articles
    • thoughts on life (if you haven’t noticed yet!)
    • obligatory fun/funny links
    • some sort of music features (as-yet-undetermined)

  • Means:

    • That’s just it, though, I’ve got enough means.  This is about the end.  Therefore, Keep It Simple Stupid!
    • And to that end, I’m self-hosting (yes, I am a control-freak), but building atop the .Text blog engine (to avoid creating yet another content mgmt system — done enough of those thanks!)

Works for me.  Heh, I’m sure you care :>

Batter up (aka Voice)

Check check, “sssibilance”


Alright, “hello world” woulda worked too, but I hate clichés.  Now pardon me while I find my own voice…


Reluctant as I am to get near what seem like cliché opening posts, I now understand why they they’re popular.  In particular, the usual statement of intentions — such as “I plan to talk about technical things and my seven beautiful schnauzers” — now makes sense to me.  It’s a way of setting a goal and reminding yourself to pursue it.  The “yourself” part is what’s weird tho…


See, blogging rubs against several parts of my social conditioning — inhibitions in fact.  One is manners: it’s rude to talk about yourself too much.  The other is the avoidance of seeming like a “know-it-all”:  I learned to wrap statements in phrases like “I think” or “that’s my opinion.” 


Blogging is pure vanity,” and vanity is bad, right? 


Those inhibitions just don’t fit here, though, which I realized the moment I started typing.  Basically, a blog (mine anyway — there I go already, case-in-point) is about me, it’s all about me.  Terms like “I think” and “that’s just my opinion” do belong in a conversation (they’re certainly conducive to a friendly one, tho perhaps not as lively of one :>).  Yes, they have their place in a dialog, but not in a monologue.


(Aside:  apparently we Americans aren’t consistent in our -log/logue spelling?  I’m not, anyway.  I never noticed that before.)


So there should be a time and place to be completely self-centered, and it’s more commonly known as introspection.  I am definitely an introvert, so I do plenty of that.  The difference here is that doing this in a blog is introspection-out-loud.  I’m used to filtering what I express, all the way from my grand secret plans for world domination, down to simple parts of speech, which just happens to be conversational-lube.  …Not that I plan to give away my secret plans (suffice it to say it begins just after “get stinking rich”), but I don’t wanna sound or feel stilted either.


This is a journal/log, though, and more personal expression than I’m used to lately.  However, y’all would get bored quick if it was always this verbose.  I just had to get that out of my system first. 


I guess that’s another issue: I do want to take a dump-it-out-first approach here, rather than the filter-and-refine-it for the audience style I learned as an English major.  It’s a forest-for-the-trees situation: I feel like my unwavering focus on succinct expression has made me miss larger ideas. (Ironic bit here: I just spent a lot of effort expressing that very thought in language — hopefully it’s not always a catch-22).   *


Anyway, hopefully saying it out-loud and without reservation will pave that road for an interesting journey.  …So that’s my intention for this blog: to express myself without the cruft of social inhibitions. 


That’s one intention, anyway.  I’ll get to the other(s?) shortly…



* (Ironic bit#2 here: I just re-edited the post for succinctness anyway, so perhaps the old-school first draft/final draft approach is the answer to my bad edit-as-you-think habit).


So, is this thing on?