25 And Over / Passing Lane Squatters

25 And Over – Playtime’s Over, Kiddies


Hilarious and disturbing in how much it has needed to be said.  My favorite bit:


4. Develop a physical awareness of your surroundings. As children, we live in our own heads, bonking into things, gnawing on twigs, emitting random squawks because we don’t know how to talk yet. Then, we enter nursery school. You, having graduated college or reached a similar age to that of the college graduate, need to learn to sense others and get out of their way. Walk single file. Don’t blather loudly in public spaces. Give up your seat to those with disabilities or who are struggling with small children. Take your headphones off while interacting with clerks and passersby. Do not walk along and then stop suddenly. It is not just you on the street; account for that fact.”


My own contribution to this is the boring “keep right except to pass.”   I’m usually just bothered by two things when driving:



  • Passing Lane Squatters (as I’ve dubbed them, except the term sometimes follows a less-descriptive, more emotional adjective), and…
  • Failure to Indicate (as in turns or lane-changes).

Unfortunately, the entire Passing Lane situation is complicated by two other things:



  • My Lovely State‘s lack of any laws related to the Passing Lane, and…
  • My Larvaly State‘s perverse plethora of Left-side Exit Lanes!  (pardon the alliteration)

Hence the righteous indignation (which might otherwise lead me to shoot cars with paintball guns) must remain at bay. 


Laws can be changed, but Exit Lanes are forever.


 

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:UserName@passport.com


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.