I was looking for a way to create a case-insensitive Hash class. One suggestion was to use NormalizedHash (http://pastie.caboo.se/154304), and override methods on the String keys. This doesn't work as expected.
I found that Hash makes a duplicate of the String key. This unfortunately removes any methods added in the singleton class. (surprise!)
Here is the code to demonstrate this behavior: http://pastie.caboo.se/154595
----
Shortly after writing the above post, I came across a little footnote in Hash#[]= which says... "(a String passed as a key will be duplicated and frozen)"
I learn something new every day. (I wish this information was given in the class description instead of the method description where it is easly missed.)
Tuesday, February 19, 2008
Wednesday, December 12, 2007
Monday, November 26, 2007
Monday, September 17, 2007
My SQL Server 2005 is Slow
Testing code that queries SQL Server 2005, I kept observing long delays. Sometimes my tests would execute in less than one second, which was expected. Frequently, they would take 30 to 120 seconds!
A little digging into the SQL Server, I found the two top waits were SQLTRACE_BUFFER_FLUSH and RESOURCE_SEMAPHORE, both of which would grow in correlation to delays I observed when running my unit tests.
A little reading found: this forum topic and this kb article. The former being the most useful. It turns out SQL 2005 will run a trace by default; to assist in fixing problems later. (read "default trace enabled" in SQL Books Online) Unfortunately on my development box, it appears the trace is the source of my delays. So my solution is to turn off the default trace using:
After this, my tests always ran in less than one second!
A little digging into the SQL Server, I found the two top waits were SQLTRACE_BUFFER_FLUSH and RESOURCE_SEMAPHORE, both of which would grow in correlation to delays I observed when running my unit tests.
A little reading found: this forum topic and this kb article. The former being the most useful. It turns out SQL 2005 will run a trace by default; to assist in fixing problems later. (read "default trace enabled" in SQL Books Online) Unfortunately on my development box, it appears the trace is the source of my delays. So my solution is to turn off the default trace using:
exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'default trace enabled',0
reconfigure
After this, my tests always ran in less than one second!
Wednesday, August 08, 2007
Wednesday, August 01, 2007
IronRuby alpha
John Lam has posted a nice article about the current work on IronRuby. My development team has already started using Ruby to write unit tests. We are currently using CRuby but plan to port to IronRuby once it is released. Our product is written on .Net so IronRuby will fit our project very well.
Diff tools
SourceGear just released an update to their free DiffMerge program. This product caught my eye because it has a 3-way merge. My current favorit Diff tool is Beyond Compare 2 from Scooter Software ($30). It has more features than DiffMerge, but doesn't include the 3-way merge which I sometimes need. The best merge tool I've ever used is Araxis Merge, but it costs $269 for the pro edition, I can't justify the extra cost vs the $30 Beyond Compare 2. Araxis Merge's price tag was worth it when I was working with an offshore team. I had to 3-way merge code from the US and India across many files and directories. It would have been too expensive in time if I didn't use Araxis Merge for that task.
Subscribe to:
Posts (Atom)