Nathan's profileNates StuffPhotosBlogListsMore ![]() | Help |
|
December 11 Merry Christmas! Free DivX ProI actually can't take credit for this find. My friend Nate J. sent this link to me. It's DivX Bundle Pro free for the Hollidays. Download your copy before the link goes away and you will never see it again!
--Nathan Zaugg December 10 Visual Studio 2008 RTM Changes to LINQ to SQLFor those who haven't heard Visual Studio 2008 has officially been released! That also means that the .net Framework 3.5 has also been released! For those who have done the Beta's there is a couple of method renaming that has happened that will break your bits! Summary
I think I can understand why they made the change. When you had a line that looked like "dbContext.Documents.Add( mydoc );" it never really felt like I was inserting a record into my database (in fact you are not inserting, not yet! Not until you call .SubmitChanges(); on the DataContext. The same goes for the delete. It was never clear if LINQ was going to "notice" the new record and make sure it is properly added to the database. So here are are some Linq Samples that we all love!
db.Documents.InsertOnSubmit( d );
// Delete a record (or multiple) var doc = from d in db.Documents
// Select One and Select Many
var OldDocs = from doc in db.Documents where doc.ModifiedDate > DateTime.Now.AddMonths(-12) select doc; foreach (Document doc3 in OldDocs) { doc3.Archived = true; } // Many ToList :: Select many and return to a typed list now var NewDocs = from doc in db.Documents where doc.CreatedDate > DateTime.Now.AddMonths(-1) select doc; List<Document> newDocList = NewDocs.ToList(); // Many Custom Type :: Select many documents but return specific type List<Notifications> changeNotifications = (from doc in db.Documents where doc.CreatedDate > DateTime.Now.AddMonths(-1) || doc.ModifiedDate > DateTime.Now.AddMonths(-2) select new Notification() { NotificationType = ChangeNotificationTypeEnum.All, NotificationDate = doc.ModifiedDate ?? doc.CreatedDate, Text = doc.Title }).ToList(); December 05 Debugging with Process MonitorNow I am not much of a low-level debugger type. I've seen people use WinDbg like it was an extension of their hand! I am not one of those people but I would sure like to be. Lately I have been working on a project that does some pretty tricky code hooking of some User Mode API calls in Kernal32.dll. Specifically I was hooking calls to CreateFileA, CreateFileW, DeleteFileA, and DeleteFileW in Kernel32.dll. Everything was working as expected but when I drag a file in Windows Explorer I can see the CreateFile call being made in the Kernel, but I was not trapping those calls.
Of course, I looked in the call stack in Process Monitor, but without debug symbols, this information is pretty much useless. All I could see is that Kernal32.dll called down to a lower kernel call and was eventually caught as CreateFile. Well, I recently tried to get the symbols to work in Process Monitor and ran into some difficulty. First, I needed the latest version of WinDbg installed as it uses the latest version of DbgHelp.dll. Secondly the symbol path (as unusual as it is already in WinDbg) is slightly different. For some reason Process Monitor needs to know not only where the symbols are but also the path to the executables that match those symbols. I had to use the path: srv*E:\Symbols\*http://msdl.microsoft.com/download/symbols;E:\Windows\;E:\Windows\system32;E:\Windows\system32\Drivers
My Symbol Settings
My Stack Trace now shows with symbols
So my problem was that it is really making a call to CopyFileExW which uses the Kernel's CreateFile function as part of the work it is doing. Process Monitor doesn't really know what the "parent" call for the stack is in the User Mode as it is a kernel level hook. So while it looks like the call to CreateFileW in Kernel32.dll should have hooked this call, Kernal32.dll is actually a user mode dll and is just a shim to pass the call back to the Kernel to do the work.
Fun Stuff!
--Nathan Zaugg December 03 Hot Air BaloonThis was just so funny I coulden't resist!
Nate Zaugg
A man in a hot air balloon realized he was lost. He reduced altitude and spotted a woman below. He descended a bit more and shouted, "Excuse me,can you help me? I promised a friend I would meet him an hour ago, but I don't know where I am." The woman below replied, "You're in a hot air balloon hovering approximately 30 feet above the ground. You're between 40 and 41 degrees north latitude and between 59 and 60 degrees west longitude."
"You must be in Information Technology," said the balloonist.
"I am," replied the woman, "How did you know?"
"Well," answered the balloonist, "everything you told me is,technically correct, but I've no idea what to make of your information, and the fact is I'm still lost Frankly, you've not been much help at all. If anything, you've delayed my trip."
The woman below responded, "You must be in Management."
"I am," replied the balloonist, "but how did you know?"
"Well," said the woman, "you don't know where you are or where you're going. You have risen to where you are, due to a large quantity of hot air. You made a promise, which you've no idea how to keep, and you expect people beneath you to solve your problems. The fact is you are in exactly the same position you were in before we met, but now, somehow, it's my fault." |
|
|