Salient Solutions

wrasslin ones and nones for fun and profit - Sky Sanders' Blog
posts - 96, comments - 70, trackbacks - 0

December 2009 Entries

Application.DoEvents() - not just for Forms

You can use Application.DoEvents() in a headless library, just add a reference to System.Windows.Forms. What prompted me to try this is a headless browser implementation I found here. Of course the first thing I felt compelled to do is replace the Application.DoEvents() by spawning a thread to run the loop poll. That did not work as planned and the mshtml class just stalled. Not feeling like reinventing the wheel, I added the reference to Forms, put the DoEvents back inline and bingo! Reflecting DoEvents, it appears that a message pump is being run. Not something I have any desire to touch....

posted @ Saturday, December 19, 2009 10:29 PM | Feedback (0) |

Short: Inline multithreading with lambdas

Not going to write a novel. just a snippet. Mayhaps will explain when I am sure I know what I am talking about. private static void InlineThreadingWithLambda() { int local = 0; var thread = new Thread(() => { ...

posted @ Wednesday, December 16, 2009 3:03 AM | Feedback (0) | Filed Under [ CodeProject-Tip ]

Read StandardOutput and StandardOutput in one method via inline multi-threading with anonymous delegates

Conventional strategies for reading both StandardOut and StandardError involve helper methods and state objects similar to Listing 1 Listing 1: How it has been done: public static void RunProcessConventional(string command, string args) { var proc = new Process { StartInfo = ...

posted @ Wednesday, December 16, 2009 2:42 AM | Feedback (1) |

One line of code to rule them all -or- C# closures and variable scope, the not so obvious

While trolling the interwebs trying to clear up some lexical ambiguity that clouds my mind at times regarding c# closures, lambdas, actions, predicates, anonymous methods and delegates and ran across a post on Rick's blog with a comment that brought a long forgotten hair-pulling-outty session I had while writing some JavaScript UI code. Specifically, the not so obvious way that closure scope combined with delegates can creep up and bite you on the ass if you don't pay attention. public class ClosureScopeStudy { public void AccessingAModifiedClosure_OR_WhatNotToDoAndHowToFixIt() ...

posted @ Wednesday, December 16, 2009 2:28 AM | Feedback (0) |

Google Maps API 3 Javascript Intellisense released

I started work on a new Google Maps project and decided it was time to shift to V3 and needed a new VS 2008 intellisense helper file. 5 or 6 hours of UltraEdit regular expression slashing and hacking and here you go.  http://gmapvsdoc.codeplex.com/ UPDATE: 02/25/10 - the api shifted a bit so I rebuilt the file.

posted @ Saturday, December 05, 2009 9:20 AM | Feedback (2) |

Powered by: