SVN-Monitor is picking up some nice features. I particularly liked the author's blog entry about using SVN-Monitor to make Subversion accessible to non-developers: How Ive put my wife into SVN.
... until the collector arrives ...
2009-04-27
Up-calls as a Code Smell
Of late, I've been doing a lot of class hierarchy refactoring (in Java). I think that "up calls", methods that call a method in a superclass, are bad news. Calling the super implementation of a method or constructor is not so bad (being the Java equivalent of a Beta inner invocation). At least, it is no worse than having implementation-inheritance in the first place. But I have observed that if a class calls any other method from a superclass, then the code is usually messed up: hierarchy inversion, is-a/has-a confusion, too many responsibilities, or some other sin. Thus, the presence of an up-call is a code smell which should make one step back and think about refactoring.
Disclaimer: I'm talking about API here, not SPI...
2009-04-24
NTFS Alternate Data Streams
Not all commands support alternate data stream (ADS) filename syntax. Most built-in DOS commands have no idea. However, file redirection works so you can do things like MORE <somefile.txt:streamname. WordPad will take an ADS path, but Notepad has trouble with them because it always wants to add a ".txt" extension.
Windows SP2 Attachment Manager
Windows XP SP2 introduced the Attachment Execution Service. It manages a set of security rules that apply to files that are transmitted to the computer as attachments. One of the key features is that downloaded files are tagged as to their originating security zone. When you attempt to run the file, Windows consults the zone information and then executes using those zone's rules.
I came across this when an HTA failed to perform SQL operations, complaining that cross-domain access was permitted. The HTA had been tagged as being in the Internet zone which, of course, prohibits such operations. The main evidence for this problem could be found on the file's properties page. It contained the message:
This file came from another computer and might be blocked to help protect this computer.
There was also a button offering to unblock the file.
Internally, the file contains an NTFS alternate data stream named Zone.Identifier.
Their is a group policy setting that controls whether zone identifiers are attached to files:
User Configuration\
Windows Settings\
Administrative Templates\
Attachment Manager\
Do no preserve zone information in file attachments
2009-04-19
Git on Windows
There is a nice walkthrough of installing msysgit on Windows: An Illustrated Guide To Git on Windows.
2009-04-17
Factorial in SQL Server 2005
Just for laughs, here is factorial calculation in SQL Server 2005:
with factorial as (
select 0 as "n", CAST(1 AS DECIMAL(38)) as "n!"
union all
select "n" + 1, "n!" * ("n" + 1) from factorial
)
select top 34 * from factorial
Maximal recursive depth can be achieved using the MAXRECURSION option:
with maximal as (
select 0 as n
union all
select n + 1 from maximal
)
select top 32768 * from maximal
option (maxrecursion 32767)
2009-04-07
SQL Server Access Violations
I've been getting a lot of access violations in SQL Server 2005 SP2 recently. I cannot say with certainty what the cause is, but I strongly suspect the presence of CROSS APPLY in queries of moderate complexity. In every case, removing the CROSS APPLY made the problem go away. Furthermore, the queries would work correctly in SQL Server 2008. I have yet to successfully use CROSS APPLY in anything other than a trivial case.
The access violation causes entries in the SQL Server error log that look like this:
2009-04-03 13:59:58.80 spid53 * Exception Address = 012828F6 Module(sqlservr+002828F6)
2009-04-03 13:59:58.80 spid53 * Exception Code = c0000005 EXCEPTION_ACCESS_VIOLATION
2009-04-03 13:59:58.80 spid53 * Access Violation occurred writing address 00000000