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

Thursday, December 18, 2008

The wonder of OpenMP

It took me about 5 minutes to make an app multithreaded with openMP.

Step 1 : Turn on openMP flag

 

Step 2 :  Add #pragma omp parallel for to the existing for statement like so
#pragma omp parallel for
for ( int i = 0; i < parlist.count(); i++)
{
    // Do your code here.
   // Cannot jump out of for loop. No breaks, no returns.
}
Step 3 : Profit!

Wednesday, December 10, 2008

Some audio madness

I just found the most awesome command line utility for audio processing. EVER! SoX.

I don't think I'll ever need anything other than this and batch files to do transcoding of audio or even batch processing of audio ever again. GUI's are nice and all, but nothing beats command line apps!

Also, another wav editor instead of audacity which people seem to have many complaints about. Wavosaur.

And lastly, for those musicians out there. LMMS. A Digital Audio Workstation app that now finally has windows support. Awesome!

Here is a sample batch file that you can put inside your SoX folder :

SET PATH=%PATH%;%~dp0
FOR %%G IN (%1\*.wav) DO (
    sox %%G "temp.wav" rate -v 8000
    del %%G
    move temp.wav %%G
)
pause

I would use this for downsampling 44khz audio recordings to 8k for the Wii Remote. i.e. Lit's phone calls. It's destructive since it converts in place, so make sure your audio is under version control!

Wednesday, December 3, 2008

Multithreaded compiling with VC Express or make -j


For posterity: To turn on multicore compiles in VC Express 2008, in the commandline options of the compiler options. Add a /MP