... until the collector arrives ...

This "blog" is really just a scratchpad of mine. There is not much of general interest here. Most of the content is scribbled down "live" as I discover things I want to remember. I rarely go back to correct mistakes in older entries. You have been warned :)


IE vs. Invalid Colspan

From time-to-time I have seen IE render tables on web pages without drawing the border on the right-most column of cells.  Today I found out at least one cause for that behaviour.  It happens if you have a table cell with a colspan that is too large, but only in strict mode and when using CSS.


Mathematica Debugger

The new debugger in Mathematica 6.0 looks broken to the untrained eye (like mine).  If you load up all of your modules and then turn on debugging, you might be frustrated by the fact that none of your breakpoints work (even though they show visually and are listed in the breakpoint list).  Or by the fact that you cannot step into code.  It took me a while to figure out that it all works if you turn on debugging before you load your modules.

It would be nice if Mathematica gave an indication that a breakpoint was being ignored.  Or if the debugger documentation mentioned this gotcha.  Or if the debugger had any documentation at all :-)

Mathematica Pure Function Scope Problem

Consider this snippet:

f[x_] := g[Function[a, x]];
g[fn_] := Module[{h}, h[a_] := fn[a]; h[0]];

Executing this sequence generates errors messages:

Function::flpar: Parameter specification {0} in Function[{0},999] should be a symbol or a list of symbols. (x3)
$RecursionLimit::reclim: Recursion depth of 256 exceeded. (x4)


However, if you change the name of the function variable in the first line from a to z, then all works as expected:

f[x_] := g[Function[z, x]];

=> 999

Another workaround is to compile the function:

f[x_] := g[Compile[a, x]];

=> 999

The problem appears to be caused by a name conflict between the pure function's argument a and the helper function h's argument a.  This is a really nasty problem because the definitions are completely separate -- one would have to perform a global code analysis to turn up such problems.

Windows Media Encoder

Windows Media Encoder has a feature whereby you can publish streaming video of your screen via HTTP or MMS.  You can use Screen Capture as a source and Pull from encoder as an output.  You may have to fiddle with the compression options to get the right balance of quality and bandwidth.  Use the Edit button for a custom compression set-up under the Compression tab -- especially to set the video size to be the same as the input.    The frame rate can be really low -- 3fps doesn't look bad.  Note that you will probably have to reduce screen resolution to 800x600, 16-bit colour to avoid a cryptic "not supported" error.

There is a nice "how to" article on the Microsoft site, Getting Started with Screen Capture Using Windows Media Encoder.



Quantrix is an Excel-like modelling tool that consolidates formula handling (so that you do not have to read the formula in every cell to see what's going on).  The pivot table functionality is a bit slicker than Excel as well.



EclEmma is an Eclipse plug-in for the EMMA Java code coverage tool.


SQL Server 2000 vs Executing Text Values as SQL

In SQL Server 2000, it is possible to execute a long SQL statement that is stored in a text column in a table.  It is just ugly.  Take a look:

declare @s0 varchar(8000)
declare @s1 varchar(8000)
...boring lines omitted...
declare @s18 varchar(8000)
declare @s19 varchar(8000)
select @s0=substring(sqlText, 1, 8000)
, @s1=substring(sqlText, 1+8000, 8000)
...more boring lines omitted...
, @s18=substring(sqlText, 1+18*8000, 8000)
, @s19=substring(sqlText, 1+19*8000, 8000)
from tableWithSqlInIt
exec (@s0+@s1+@s2+@s3+@s4+@s5+@s6+@s7+@s8+@s9+@s10+@s11+@s12+@s13+@s14+@s15+@s16+@s17+@s18+@s19)

The exhibited statement only works for text columns whose values are no longer than 160,000 characters (20 x 8000).  Adjust to taste.  Also, if you are using NTEXT columns, then you must use NVARCHAR(4000) and segment the value into blocks of 4000 to avoid overrunning SQL Server's 8000 byte limit.

Blog Archive