PITADEV
Curiosity killed the developer's project.

Which.bat -- "whereis" for old Unix people who hack their Windows something fierce

Wednesday, 17 June 2009 16:20 by kevin

(file under: interesting info that's difficult to Google)"Vintage Plastic Witch with Bat" photo by Flickr user "riptheskull"

If you're like me*†, you download a huge amount of open-source and free utilities that don't have installers, write a bunch of batch files and scripts to automate common tasks, and use cmd.exe constantly‡.  So, you're setting up a new VirtualPC image, and you know you want to have the Sysinternals utilities on your new machine €, but you don't want to re-download them and you don't know where the heck you unzipped them to.  Where oh where could pslist.exe be?  Wait, you're an old Unix guy.  When you want to know where in your path an executable file is, you say "which".

Gladly, the great Raymond Chen solved your problem years ago, though you didn't know it till now:

@for %%e in (%PATHEXT%) do @for %%i in (%1%%e) do @if NOT "%%~$PATH:i"=="" echo %%~$PATH:i

Paste this line into a file in your Windows directory (or elsewhere in your path; c:\scripts or something like that), save as "which.bat" (or "whereis.bat" if you're not really an old Unix guy and you've just been pretending up till now).  Use like so: "which pslist".  To which it replies "c:\Program Files\Sysinternals\pslist.exe".  Simple as that.

Talk to you next season! 

 

*alive!  All recent appearances to the contrary.

and I realize you probably aren't, aside from being alive

 I tried getting into PowerShell a few times, and I'm sure I'll eventually end up there, but at some of the basic shell commands, it's just not fast enough for me. I sometimes do this cycle 20 times in a minute:

cd [beginning of dir] [tab-to-complete] [enter]
dir /od
cd [other dir beginning][tab-to-complete][enter]

I just cant wait 5 seconds (every single time.) for PowerShell to "Get-ChildItem" when it would have taken 1 second for cmd.exe to "dir".  

(yes, €) You may not have known that you know you want the Sysinternals Suite until now.  I'm glad I could be part of your self-discovery process.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories:   Dev Info
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

The CodePlex Learning Curve

Monday, 25 August 2008 14:47 by aj
 This morning I fired up Google Reader and was excited to see this post on DotNetKicks about a new "Image Generator" control in ASP.NET 3.5.  I do a fair amount of image manipulation for my current position, and displaying images to clients is always an issue.  Currently, we're using a Java viewer that works nicely on the client, once it's been finally loaded in the browser.  Unfortunately, the load time is prohibitive, what with a nearly 1.5 MB download, not to mention the time it takes for the JRE to fire up and load the plugin.  So I'm always on the lookout for new ways to display images in a browser.  This tool is advertised as a "speedy way of generating, transforming, caching images in ASP.net."  All right!  I've worked with several APIs that are available from various vendors, and though a couple of them have solutions that are quite good, a freely available tool would be great.  I hurried over to CodePlex and downloaded the assembly and examples.

One thing I always find strange about downloading stuff from CodePlex is that I often have trouble figuring out where to put it.  Like many developers, I'm sure, I have a huge directory tree packed with all of my code, which is organized to me, but would probably be impossible to dig through for anyone else.  After downloading, I attempted to drop the assembly into the GAC, but got the ubiquitous "Assembly <xxx> is required to be strongly named" error.  OK, then.  I settled on creating a "strongly named" folder in my code-maze, dropped the DLL into it, and created a website project to play around with it.  Then I remembered the sample projects, and happily using my new two-monitor setup at work (finally!!), I opened the example "SimpleGeneratedImage" website on one monitor and my test project on the other.  After jockeying the referenced assembly to get it pointed at the right file, I F5'd the example project and was a little startled to see this error:

Could not load file or assembly 'System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Hmmm, I don't see that reference anywhere.  Ah, there it is, in the web.config.  OK, what the hell is that guy?  As you can probably tell by now, I haven't had the time to keep up with the super-huge pink elephant sitting in the middle of the virtual ASP.NET room that is MVC.  So I plugged "System.Web.Abstractions" into a Google search and the first hit I get is Microsoft's page for ASP.NET MVC Preview 2.  Ah ha.  I have done a little poking around on the MVC framework, but always get interrupted with "real" work. I do know enough that CodePlex is probably a good place to start.  So I headed back over to CodePlex's ASP.NET section and found a download for ASP.NET MVC CodePlex Preview 4, which I figured would suffice, since 4 > 2.  Upon clicking the link for the application download and agreeing to the license, I watched Firefox download an .msi file.  Awesome!  An MSI!  Someone had the brilliant idea of creating a deployment project to simplify the integration for me, the lowly tool user!  I happily ran the MSI and watched the install, then switched back to my VS2008 IDE with the sample project loaded and rebuilt.  

Could not load file or assembly 'System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

What the hell?  Shouldn't the MSI have taken care of all of this?  Maybe I have the wrong MSI?  Wait, it didn't even ask me where to install itself.  I find the install folder in Program Files\Microsoft ASP.NET\ASP.NET MVC CodePlex Preview 4\Assemblies, and there's the elusive System.Web.Abstractions.dll.  I switch to view my GAC, assuming I'd find the files registered there.  Nope.  OK, then, I'll do it the old fashioned way.  I gacutil the three "System" DLL's, and they don't give me any "strong naming" issues and appear to register fine.  Except, I notice that the version on the System.Web.Abstractions assembly is "0.0.0.0."  Hmm, that's odd.  Must be a weird refresh thing.  I switch back to my IDE and rebuild.

Could not load file or assembly 'System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Son of a bitch!

Now, I know this isn't really a big deal, but it really burns my ass that these uber-developers can't take a few minutes and 1) let me know that there are prerequisites and 2) make an MSI file that actually does something.  This issue keeps coming up for me with the various plugins and toolkits I "install."  In a deadline-driven developing world, I do as much as I can to keep up with emerging patterns and practices.  But when I run into roadblocks that could be eradicated with some simple forethought by the developing team, it stifles my ability (and my desire) to use this stuff.  I understand that CodePlex is generally for open-source, bleeding edge code that might eventually get included in the framework, and hence isn't "polished."  But when did developers forget that their audience is probably going to like them a lot more if they make their stuff easy to integrate?

After complaining more to a friend, he made me feel really stupid by pointing out that I just needed to install .Net 3.5 SP1.  After this install, I was able to build everything just fine.  Of course, I haven't had the time to actually do anything with it.  So, lesson learned: When downloading and installing stuff from CodePlex, make sure the framework is the latest and greatest.  

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:   , ,
Categories:   Dev Info | Rants
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed