Sunday, June 7, 2009

Angeles Crest and Newcombs Ranch Inn





Just a couple of photos from Newcombs Ranch Inn on the Angeles Crest Hwy. Lots of bikes up there. Saw a Hayabusa, lots of Ducati's, couple of awesome Triumphs, Audi S5. I was the only Evo. An STI passed by along with an Exige in yellow and a 08 M3 in white. They make a fantastic tasting chili. Note to self : Go easy on the coffee next time I'm there.

There were a few accidents up the road pass Newcombs but I didn't go up that far on the way to Wrightwood. Apprently someone went over the railing. Saw the medevac helicopter. Road wasn't too busy, and most everyone pulled over to the side when I was behind them, except for 1 stupid van. Even I pulled over to the side for the bikes.

Will this be a regular Sunday thing? Maybe. Shane you need to take the 135 up.
Posted by Picasa

Friday, May 15, 2009

Change your working directory

By default whenever you run a batch file, the working directory is usually the directory that contains the batch file.

However, if you drag and drop a file onto the batch file to use the dropped file as an argument, windows uses your user directory as the working directory.

This line below is probably the most awesome line to use at the start of a batch file to make the working directory point to the directory that contains the batch file no matter where it starts.

cd /d %~dp0

Thursday, May 14, 2009

Announcing mptoolkit

Since I work a lot with batch files to make my life easier, I needed a framework to do multithreaded batch files.

So I created mptoolkit.

This is an excerpt from the wiki

mptoolkit is a multi processing toolkit for windows batch files.

The toolkit consists of 3 executables that you should either, have next to your batch file, or in your system path somewhere.

The executables use files with .pid extensions to track how many processes are running and will do so directly next to the executable.

mpstart
Checks to see how many instances of mprun are running by looking for .pid files in the same directory as the executable. If it is greater than or equal to number of cores x 2, then it will wait until one of the instances of mprun finishes, effectively pausing the execution flow of your batch file. It calls mprun as a detached process to actually perform your command when it detects that it has space in the "thread pool".

mprun
Runs your command. mprun writes out it's own process ID, then runs the command you tell it by using cmd.exe /C %*. The reason mpstart and mprun are separated is because to allow execution flow to continue in the batch file, mpstart needs to exit.

mpwait
mpwait will pause execution of your batch files until all pid's are deleted from the directory. You can use this for synchronization purposes.

Example :

FOR /L %%G IN (1,1,20) DO mpstart ping localhost -n %%G -w 1000
mpwait

This example will start pings of increasing wait times of up to number of cores x 2 and wait until all are completed before exiting the batch file.

On a dual core processor, your task manager should look something like what is shown here :

From mptoolkit


5 cmd.exe's running - 1 for the batch process, 4 for execution

4 mprun's - actually performing the work

1 mpstart - currently in waiting for one of the previous mprun's to finish working.

Tuesday, May 12, 2009

SVN on XAMPP

XAMPP's standard apache.conf isnt really set up for svn. It's memory usage grows and grows and will eventually blow up.

The default is


# ThreadsPerChild: constant number of worker threads in the server process
# MaxRequestsPerChild: maximum  number of requests a server process serves
ThreadsPerChild 250
MaxRequestsPerChild  0

I change it to

ThreadsPerChild 64
MaxMemFree 100
MaxRequestsPerChild  0
Win32DisableAcceptEx

and everything seems to work fine.

Wednesday, March 18, 2009

How to Fix “Could Not Connect to the System Event Notification Service” Error in Windows Vista

How to Fix “Could Not Connect to the System Event Notification Service” Error in Windows Vista

This totally worked!

Here for posterity

1- Log on to your Windows system. Just ignore the error message for the time being.

2- Go to Windows Start button -> All Programs -> Accessories

3- Right click on Windows Command Prompt and choose Run as administrator. Wait for the Command Prompt to launch.

4- Using the command prompt, navigate to the C:\Windows\System32\ folder.

5- Type “netsh” and press Enter. The prompt will change to netsh>

6- Type “Winsock reset“. Press Enter once more.

7- Reboot your computer.

Friday, February 27, 2009

Using pageheap.exe

I used pageheap today and it actually did what they told me it would do. Awesome! Why does MS have so many awesome tools that they don't tell us about and are rather arcane to find documentation on. Oh well.
How you use it :

1. Install Debugging tools for Windows. Add it to your path. It'll make your life a WHOLE LOT easier.
2. Type gflags.exe /p /enable yourapp.exe /debug WinDbg.exe
3. Run your app.
4. When youre done make sure to disable it  gflags.exe /p /disable yourapp.exe
5. You can check to see what you have page heap enabled by just typing  gflags.exe /p

Debugging Tools for Windows

Some pretty good debugging tools for windows can be found here.

Most importantly the use of umdh.exe to find memory leaks in your application.

Steps are pretty simple :

1. Install debugging tools.
2. Set gflags -i yourapp.exe +ust
3. Run app and find a good place to halt it where your baseline memory should be.

4. Get a heapdump of it. umdh -pn:yourapp.exe -f:first.log
5. Run the stuff where you want to find leaks for. Then return to where the baseline should be.
6. Get another dump. umdh -pn:yourapp.exe -f:second.log
7. Test the first dump against the second ump. umdh first.log second.log > compare.txt
8. Look at compare to see what still has allocations in the heap.
9. Look in second.log and find the Baseline that is in compare if there is any. You should be able to see the function that called the alloc/new. That's it.

Also not to be left out since I found this after writing this.

How to use pageheap.exe. This should help you find other things like, double free, overruns and underruns.

If you're willing to actually use a memory manager in your code. You can try Paul Nettle's MMGR.

And if all else fails, you could always try a commercial app like Memory Validator.


Thursday, February 26, 2009

VSPTree

I was bored. So here is what I made.

VSPTree is a graphical tool for the Visual Studio 2008 Standalone Profiler. It is named so because it gives you a tree view of the calltree generated from VSP files generated by the profiler.

Project page is Here.

Tuesday, February 24, 2009

Statistical Profiling for Free

1. Download the Profiler. Here .

2. Add the Profiler to the path.
- C:\Program Files\Visual Studio 9\Team Tools\Performance Tools.

3. Add the environment variable
- _NT_SYMBOL_PATH = symsrv*symsrv.dll*c:\localcache*http://msdl.microsoft.com/download/symbols

4. Run the application
- VsPerfCmd /start:sample /output:"FenixDebug.vsp" /launch:"FenixMultiDebug.exe"

5. When done testing. Exit the Application

6. Shutdown the profiler
- VsPerfCmd -shutdown

7. Generate the Report
- VsPerfReport /summary:all /packsymbols FenixDebug.vsp

8. Parse the reports. Easiest way is to use excel, but I might be working on a graphical tool soon.

CPU Profiling

If you ever wanted to know what eats all your CPU. Here.http://blogs.msdn.com/adioltean/archive/2004/12/21/329321.aspx