Matt Casto's .NET Journal RSS 2.0
 Wednesday, August 01, 2007
This is old news for most developers, but I'm throwing it out there anyway. I've known about Microsoft's LogParser for a long time now, but today is the first time I've actually used it.

I needed to get some quick stats about the usage of some WCF services from an IIS log of an application recently put into production. I downloaded LogParser 2.2, googled and found some examples, experimented with some queries, and within 2 hours had a batch file that was creating two simple text file reports that would quickly tell you about service usage.

Here's the batch file contents I created:
@echo off
if "%1" == "" goto reqparam
@echo on

@echo * Getting total hits per service into %1_ServiceHits.txt

"C:\Program Files\Log Parser 2.2\logparser.exe" -i:iisw3c "SELECT DISTINCT
cs-uri-stem AS Url, COUNT(*) AS Hits INTO %1_ServiceHits.txt FROM %1 WHERE
(cs-uri-stem LIKE '%%.svc') GROUP BY Url ORDER BY Hits DESC" -o:NAT -rtp:-1

@echo * Getting hits per hour into %1_HitsPerHour.txt

"C:\Program Files\Log Parser 2.2\logparser.exe" -i:iisw3c "SELECT date,
QUANTIZE(time, 3600) AS Hour, cs-uri-stem AS Url, COUNT(*) AS Hits INTO
%1_HitsPerHour.txt FROM %1 WHERE (cs-uri-stem LIKE '%%.svc') GROUP BY date,
Hour, Url ORDER BY date, Hour, URL" -o:NAT -rtp:-1

@echo off
goto end
:reqparam
@echo Missing Parameter - IIS log filename
:end

And here's an example of the output:
Url                       Hits 
------------------------- ------
/AwesomeService.svc 208862
/SweetService.svc 133267
/GoodService.svc 41577
/MundaneService.svc 41271
/HappyService.svc 10300
/CrappyService.svc 2950

Just for fun, here's a command that will create a pie chart.
"C:\Program Files\Log Parser 2.2\logparser.exe" -i:iisw3c "SELECT DISTINCT
cs-uri-stem AS Url, COUNT(*) AS Hits INTO c:\temp\iisreport.gif FROM
c:\temp\ex070730.log WHERE (cs-uri-stem LIKE '%.svc') GROUP BY Url ORDER BY Hits
DESC" -chartType:PieExploded3D -chartTitle:"Service Hits"

Which generated this image:

Its a little bit ugly because of the values put in front of the chart, but it wasn't worth it to me to spend the time figuring out which command line option would turn that off.

* PS - I've noticed that the unofficial website for LogParser seems to be down. Bummer.

Labels:

Wednesday, August 01, 2007 11:27:00 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
tools
 Friday, June 15, 2007
If you've ever been annoyed about having to activate a window, or part of a window, in order to scroll with your mouse wheel, then KatMouse is for you. KatMouse is a free application that allows you to scroll the window below your mouse cursor, even if it's not the active window or is behind other window(s). It's so simple that it's a no-brainer install.

I heard about this app from Roy Osherove's recent utilities post. Roy also mentions AutoHotKey, which is an excellent little open source keystroke/scripting app. The cool thing about AutoHotKey is that you can create automation scripts, compile them, and then run them on client machines without installing any software.

Labels:

Friday, June 15, 2007 6:43:00 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
tools
 Thursday, February 01, 2007
I just received the copy of Windows Developer Power Tools O'Reilly sent me as thanks for my participation on Windows Developer Tools Day two weeks ago. It's a massive book, but seems to be organized so well that it will be easy to read a chapter or two each evening.

In fact, after seeing Jim Holmes' post about the WinDevPowerTools Rollout, I went there and set up my own profile. As tools are added to the site, and as I'm able to check out more tools that I read about on the book, I'll update my profile there.



A lot of the tools that I use regularly either haven't been added to the list or aren't covered by the book. I'm not sure about what's covered by the book yet because I haven't had any time to dig into it yet. I would love it if I could add tools that I use that might not have been covered by the book.

Labels:

Thursday, February 01, 2007 10:07:00 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
tools
 Friday, January 26, 2007
While searching for the VS 2005 CMD Prompt Here shell extension I stumbled upon some other tools that I really like. First of all, the Clean Sources application does exactly the same thing as a command line application that I whipped up two days ago, except it provides better feedback and is integrated into the explorer shell.

But the best find was by Omar Shahine, the same author of Clean Sources - Clipboard To Image. This application takes care of the manual steps I constantly find myself doing when I take screenshots of application or diagrams, and it even defaults to the PNG format! (yay)

Now I just have to integrate it into SlickRun and move on to being more productive.

** Note:
After playing with Clipboard to Image for a bit, I noticed that if you try to overwrite an existing image, the overwrite never actually happens. So you just have to create a new image each time.

Labels:

Friday, January 26, 2007 11:50:00 AM (Eastern Standard Time, UTC-05:00)  #    Comments [2] -
tools
 Thursday, January 04, 2007
Yesterday I posted about input devices, and mentioned that I couldn't configure the thumb button of my Microsoft USB Comfort Optical Mouse 3000 to enter the Alt+Tab keystroke. So what did I set as the functionality of the thumb button? I just had it configured to the default Back button functionality, which I found myself never using, and left it at that. Then I found a utility that lended itself very well to being mapped to the thumb button.

Clipboard Recorder is a utility that stores the last 100 snippets of text that have been copied to the clipboard. Among it's several interfaces, there is a pop-up menu that can be activated with the keystroke Ctrl+Alt+V. I mapped this keystroke to my mouse's thumb button and, viola! My favorite mouse configuration ever!

Clipboard Recorder Pop-up

I don't know how I lived without a clipboard history up to now. As a software developer, it is indispensable. Copying and pasting sections of code is something done every day, and it's very nice to be able to copy code knowing that you'll need it later, but not worrying about overwriting it in the clipboard, and maybe having to store it in a temporary text file. Also, our defect management software at work leaves a lot to be desired, and I find myself copying and pasting the same 3-4 pieces of information into several places, including VSS.

I love Clipboard Recorder and that's why I registered it on "Support Your Favorite Small Software Vendor Day" last month.

Some other utilities that I use daily:
And some utilites that I use every now and then:
Also, I have del.icio.us utilities links to tools that I want to check out some day.

Update:
I'm counting this as my official "Tools Day" blog post, in support of Jim Holmes and James Avery's new book "Windows Developer Power Tools".

Labels:

Thursday, January 04, 2007 10:26:00 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
tools
 Wednesday, January 03, 2007
I love ThinkGeek. I get their newsletter and get a kick out of checking out what new products they're carrying. I also maintain a wishlist there and occasionally add items that I think are cool. That way, whenever anyone asks me what I want for Christmas or my birthday, I can just tell them to check out my wishlist on ThinkGeek and Amazon (I keep one there too).

I often forget what I added to the wishlist just because I thought it was cool at the time. At Christmas this year, my brother in law surprised me by getting me something from there that I'd forgotten about. The StealthSwitch!

Hiding windows at work is pretty juvenile. When my father saw what I'd gotten, he said that some people at his office had installed a program called "the big cheese" or something like that, which would display a fake spreadsheet when they hit F1. He had the IT department un-install it and limit his employee's rights so they can't install applications now. Of course, he was concerned that I was doing something at work that I wanted to hide. But that's not the case!

I wanted the StealthSwitch foot pedal to play with as a third input device. I'm not a keyboard Nazi, but I am particular about the input devices that I use. I use the Microsoft Natural MultiMedia Keyboard and love the over sized Delete key arrangement, but really don't like what they did with the function keys. I am really a mouse guy and I fall back to using the mouse even when I know keyboard shortcuts for some things. For instance, I know that Ctrl+B builds in Visual Studio, but I have a custom toolbar shortcut that I use instead.

I used to have a cheap mouse with a thumb button that I had configured to enter the Alt+Tab keystroke. I found it to be VERY convenient since my right hand is on the mouse so often. When that mouse went bad, I got a Microsoft USB Comfort Optical Mouse 3000 because it has a thumb button and the scroll wheel features the horizontal tilt. While the mouse looks good, the horizontal scrolling isn't useful, and I'm disappointed by it because the Intellipoint software doesn't allow me to enter Alt+Tab as a keystroke for the thumb button. Tab isn't captured by the keystroke form, and I even tried to enter it directly into the registry but the driver didn't recognize it.

Enter the StealthSwitch. The software installed from the CD that came with the device only allowed for hiding windows, and even then it was limited to hiding all windows, the current window, or all but windows with a short list of keywords in the title. Even if I was going for the window hiding functionality, I would want to specify particular windows to hide and this didn't allow that. I figured I was going to have to write some software to use the pedal's input.

Then I found a newer version of the software on the (incredibly bad) StealthSwitch website. The latest version not only allows you to list the windows you do want to hide, but also has a screen to configure custom actions. Eureka!
StealthSwitch Custom Configuration

Now I can have my Alt+Tab functionality again, and I don't have to worry about where my hands are ... I use my foot! Maybe I should look into the specialized foot pedals meant to replace the mouse or augment game play.

Or, I could give the Zero Tension Mouse a try ... nah, never mind.

Labels: ,

Wednesday, January 03, 2007 8:37:00 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
devices | tools
Central Ohio Day of .NET

About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2008
Matt Casto
Sign In
All Content © 2008, Matt Casto
Theme based on DasBlog theme 'Business' created by Christoph De Baene (delarou)