Disable the ContextSwitchDeadlock MDA error in VS .NET 2008
I had written a handy little VB.NET app that copied a list of scripts to a set of servers. Well, sometimes these scripts take a little while to finish executing (adding indexes to large tables), so my tool would come back with the following error when I'd run it in debug mode.
"ContextSwitchDeadlock was detected Message: The CLR has been unable to transition from COM context 0x54a5d8 to COM context 0x54a748 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations."
How to inner join an inline table valued function in SQL
When faced with the task of creating an inline table valued function in T-SQL, sometimes you'll want to inner join this function with other tables. It seems like it should be straight forward to do, but it really isn't. There's a variety of workarounds, including options such as creating a view that references the new user defined table valued function. If performance isn't a tremendous concern to your application, the "cross apply" method is probably the most straight forward. Keep in mind that this method was introduced as of SQL Server 2005. So if you're using SQL 2000 or an earlier version, you're out of luck. Honestly, I've found that the performance hit with using cross apply is greatly exaggerated. Here's how it would work.
Kingston HyperX SH100S3B/120G SSD review
Partially due to the rising of hard drive prices that I discussed in a previous post, I decided to go with a solid state drive (SSD) as my main drive in my new build. I've heard about a lot of performance benefits from switching to a SSD, especially for installing your OS on and running system intensive resources. You can find stats referring to this such as 500mb/s sequential read times, 300mb/s sequential write times, etc. This all sounds great, but when you actually see a SSD based system in action - it'll blow your nerdy little mind.
Read more
Unlocking the Sapphire Toxic Radeon HD 6950 (100312TXSR)
If you're lucky enough to own one of these Toxic 6950 cards by Sapphire Tech that Newegg occasionally has in stock...
http://www.newegg.com/Product/Product.aspx?Item=14-102-951&SortField=1&SummaryType=0&Pagesize=10&PurchaseMark=&SelectedRating=-1&VideoOnlyMark=False&VendorMark=&IsFeedbackTab=true&Keywords=%28keywords%29&Page=1#scrollFullInfo
There's actually an incredibly easy method to unlock the additional shaders on this card to effectively make it a 6970. Not every one of these cards can be unlocked using this method, but it worked great for mine. The Newegg commenter LA_Kings_Fan (go Calgary Flames, by the way) maps out a number of simple steps to unlock this card.
- Install card, turn on computer, windows likely installs drivers before you install included CD software.
- Make sure Drivers installed, either off CD software, or from WIN 7 auto load.
- While running, install GPU-Z /or TriXX software ... Open Program, review Factory Defaults of card, Note shaders & core clocks, etc.
- In GPU-Z /or TriXX SAVE your factory BIOS Position #1. DO NOT SKIP THIS STEP. You might need it in case something goes wrong & need to reinstall factory BIOS, better SAFE & SAVED than sorry!
- Shut Down Windows, turn off Computer.
- Flip Dual BIOS switch near Back Plate/SLI Bridge area to position #2.
- Turn on Computer & reboot up.
- Re-open TriXX /or GPU-Z, check Shaders ... if 1536, CONGRAT’S card UNLOCKED & No BIOS FLASH required ... if still 1408, Bummer No Factory Un-Lock, you could still try FLASHING, but it’s Risky, Voids Warranty & can BRICK card, remember NOT 100%
Thanks again to LA_Kings_Fan for this. The 100312TXSR is a simply amazing video card for the price (around $260 after MIR when I got it), so I'd recommend that you keep watch of Newegg's inventory for this card to come back in stock.
Return to previous line of code in Visual Studio .NET 2008/2010
Here's a quick tip that probably won't change your development life, but will also probably come in handy when you're looking through a hierarchical chain of function calls in your code. I used to program in Visual Basic 6. I don't have a lot of fond memories of it, but there's one function that came in handy. That was the "Return to Previous Line" right-click function (I can't remember if that's exactly what it was called, but that was the idea). If I was debugging a function or sub-function that happened to call upon several other functions or subs from different modules and classes, the "Return to Previous Line" ability made it easier to find my way back to the original calling stack. Well...
Read more
When ReadXml returns blank rows (or no rows)
Here's one I ran into today. I'm programming along in VB.NET and I have an instance where I need to import data from an XML file into a DataSet (or in my case, a DataTable). I had (essentially) the following code.
Dim dt As New DataTable
dt.TableName = "newtable"
dt.ReadXML("c:\test.xml")
' Do stuff with dt.Rows(0)
Great. Well, this LOOKED like it would work. The solution would build without errors. When I ran the program in debug mode, however, I would get an exception error stating.
"There is no row at position 0"
Well WTF? What is this? After a bit of digging and poking around, I found that I had made a mistake by giving my DataTable variable a TableName value. This caused some clashing with the XML file that I was trying to import, as the table names did not match. This resulted in my imported DataTable having zero rows. The solution is to name your DataTable (if you need to) AFTER you import your XML file into the table. Such as...
Dim dt As New DataTable
dt.ReadXML("c:\test.xml")
dt.TableName = "newtable"
' Do stuff with dt.Rows(0)
Internal hard drive prices rising (and when they might fall)
This might be a little bit of old news at this point.
Due to tragic flooding in Thailand, prices for hard drives (and especially internal hard drives) have escalated through the roof. They're basically at - I'd say - 2006 levels as far as dollars per GB goes. I'm putting together a new build for my wife at the moment, so - this news sucks, to say the least. I'm equipping her computer with a SSD that I already bought for her routine programs and basic operation (such as Photoshop and Illustrator) - however, she needs a massive storage drive to go along with this. As far as an ETA on when the prices will normalize again, I've heard anything from 2 months to 2 years. It really won't be until the flooding lets up until anyone can really accurately speculate when prices will change. My thoughts are with the people of Thailand - good luck and I look forward to your future production!
Update a Limited Amount of SQL Datarecords
I'd consider myself a fairly advanced SQL programmer. I can do most anything that I ever need to do through SQL, though I still learn something new almost every day. I hope that I always will learn new ways to write efficient queries and manipulate databases. I'm not embarrassed to admit that I just finally figured out how to update a limited amount of records within an update query. It's actually a really easy process, with a slight nuance that I'll get into.
Read more