What “MinMax persistance type of cookie requires a ModuleId” really means

August 25, 2006 @ 1:36 pm by walter — Filed under: .NET

I got this while working on a DotNetNuke module today:

ASP.NET MinMax persistenace error -screen shot

What this really means is

One of your user controls could not be compiled, and the error message from the compiler is plainly available in the file C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\dnn3\9ed962
a0\9cd87477\zyn7emjq.out , but I’m not written well enough to to tell you that myself

I really must move this project from .NET Framework 1.1 (and DotNetNuke 3.x) to .NET Framework 2.0 (and DNN 4.x). I don’t know if this will improve the error handling in the slightest, but at least I’ll know I’m swearing at the latest version of the software.

Rounding 5 cents DOWN (C# and VFP examples)

August 15, 2006 @ 10:55 pm by walter — Filed under: .NET, Visual FoxPro

In New Zealand small change is changing … we’re getting new 50c, 20c and 10c coins, and the 5c coin is being dropped. To match this the guidelines for rounding cash values are also changing.

Previously, the general guidelines were that values were rounded to the nearest 5c - values ending in 1,2,6,7 rounded down, and those ending in 3,4,8,9 were rounding up.

Now we need to round to 10c. However, the New Zealand Retailers Association guidelines state that values ending in 5c (ie exactly in the middle) are to be rounded DOWN (towards zero). This is not conventional mathematical rounding, that you’d find in a function called round() in most programming languages’ standard libraries. So I had to do some work.
(more…)

Linux answering machine?

August 9, 2006 @ 9:55 pm by walter — Filed under: Linux

Someone came in the other day - well, it was probably a week or two now - asking about a “Linux answering machine”.

Turned out he had a Windows machine with a 56k modem attached, which was operating as an answering machine. I knew those modems were supposed to be “voice capable” but this is the first time I’d ever heard of anyone actually using this (except as a gimmick). He wanted to get rid of Windows entirely since his main machine was running Xandros.

My first thought was of Asterisk, which has got a lot of good press recently and has an active development community. However even Trixbox (formerly Asterisk@home) doesn’t scale down as far as a voice modem! I was also vaguely aware of vgetty, but one look at the documentation and it’s obviously techie territory.

Then I stumbled across VOCP. (more…)

Convert Foxpro RGB value to ARGB for GDI+

May 19, 2006 @ 2:25 pm by walter — Filed under: Visual FoxPro

I can’t remember if there is a method for this buried in _GDIPLUS.VCX or not, but if you don’t want to use a GpColor object just to convert colours, the following tiny function would do:

function FoxRGBToARGB( tnRGB as integer, tnAlpha as integer )
   return  ;
      bitor( bitlshift(bitand(iif(vartype(m.tnAlpha)=='N', m.tnAlpha, 0xFF), 0xFF ),24) ;
	, bitlshift(bitand(m.tnRGB,0xFF),16) ;
	, bitand(m.tnRGB,0x0000FF00) ;
	, bitrshift(bitand(m.tnRGB,0x00FF0000),16) )

Example use:

m.foxrgb = getcolor()
m.argb = FoxRGBToARGB( m.foxrgb, 0xFF )
? transform(argb,'@0')

This technique is basically lifted from the foxrgb_assign method from the GpColor class, plus adding in the alpha value

VFP function to get the first line of a piece of text

March 24, 2006 @ 12:20 pm by walter — Filed under: Visual FoxPro

This is the story of a useful little utility function to extract the “first line” out of a block of multi-line text. If all you want is the function, then you can stop on the first page. If you’re interested in how someone can spend an hour writing a simple function that is less than 25 lines long, and why it ended up how it is, then read to the gory end!

function GetFirstLine( tcText [, tnMaxLen] [, tcEllipses] )
(more…)

« Previous Page