Posts

Showing posts from February, 2012

How to manually update the BIOS on an HP a1600n desktop with A8M2N-LA motherboard

After wrestling with this over 3 days, I found out a way to update the BIOS on this machine and thought I would post it online. Many people are having difficulty applying the HP update from the HP site especially on Vista and Windows 7. Without this update, the processor does not support virtualization. 1. Download processmon from the windows site after searching on Google. 2. While running the BIOS update, just before it fails, look into the processmon to see which folder the installer.exe is running from. 3. Copy the contents of the temp folder to the desktop before closing the failed BIOS update message. 4. Open the desktop folder and set the winflash.exe properties to vista compatibility and run as administrator. 5. Run winflash.exe, select the 507.rom file from the file menu 6. Select update all in the left side options. 7. Say update on the toolbar. 8. When the modal dialog opens up, select update. 9. Let it update, and it will automatically restart windows 10. When it

Defensive Programming Techniques for any language

Never put code in else. What goes within else can change if someone changes conditions tomorrow. Always check exact a.k.a else if (condition) explicitly. Never assume something of the underlying framework. If the object supports a close + dispose, calling close() maybe a good idea, there was a case where the framework would not actually call close when dispose was called. So this is a good idea. Don't assume that books provide the best practices for anything. Try it out and find the best practices yourself. Your life can be a hell of NULL condition checks when you define properties of lists or complex objects. Maybe the best idea is to instantiate these properties in the constructor so they will never be NULL to begin with? Try not to put any kind of conditions within conditions which make it difficult to read the code, set the IF condition in such a way if possible that you don't even process further if it is false, then the next line of code will be at the same level

How to crop an image in c#

This works: using  ( Image  FullsizeImage =  Image .FromFile(sourceFilePath))         {              using  ( Bitmap  NewImage =  new   Bitmap (FullsizeImage.Width, ThumbHeight))             {                  using  ( Graphics  newgraphics =  Graphics .FromImage(NewImage))                 {                     newgraphics.DrawImage(FullsizeImage, 0, 0,                                            new   Rectangle (0, 0, FullsizeImage.Width, ThumbHeight),                                             GraphicsUnit .Pixel);                     newgraphics.Flush();                 }                 NewImage.Save(outFilePath,  ImageFormat .Png);             }         }

How to enable and generate unit test code coverage metrics in your VS2010 solution

Right click on the solution >> Add file >> Add a test settings file After it is added, VS will open a prompt for the test settings. Go to the Data and Diagnostics section, select code coverage and then click configure (left top in the same section as the checkboxes). Select all projects you want to have code coverage metrics for, other than the unit test project. Close this window, and then click apply. Remember: You can get back to this, by going to the Test menu on the top, "Edit Test Settings" and selecting the new test settings created. Now run all tests in the solution, and after they have completed execution, click on the "Show Code Coverage Results" icon on the extreme right top of the test results pane. You can now expand the heirarchy and see the code coverage results. If you get this error: "Strong name verification failed for the instrumented assembly Please ensure that the right key file for re-signing after instrumentation i

Intel Graphics Woes?

If your laptop is a dell e6510 or has a sandybridge processor with intel graphics, you need this driver: http://downloadcenter.intel.com/confirm.aspx?httpDown=http://downloadmirror.intel.com/20392/a08/Win7Vista_64_152250.zip&lang=eng&Dwnldid=20392&DownloadType=Drivers&OSFullname=Windows+7+(64-bit)*&ProductID=3231 Without it, graphics performance will suffer and your laptop cannot detect external monitors or projectors.

Windbg for IIS

This article is great: http://blog.whitesites.com/Debugging-Faulting-Application-w3wp-exe-Crashes__634424707278896484_blog.htm Just use the below commands instead for .NET 4.0: .loadby sos clr !clrstack