Anti-nuisance lawsuit warning: The purpose of these notes is to remind me, Zoegond, of stuff or to help me work stuff out. They may contain mistakes.

Quick

  • ($a, $b....) = unpack("A2A7...", $packed)
  • push( array, list )

Monday, May 9, 2011

divisors

Q&D aliquot divisor finder

function divisors0(n) {
var divs = [];
var f = 1;
while (f * f <= n) {
if (f == 1 && n != 1) {
divs.push(f);
} else if (f * f == n) {
divs.push(f);
} else if (n % f == 0) {
divs.push(f);
divs.push(n / f);
}
f = f + 1;
}
divs.sort( function(a,b) { return a-b; } );
return divs;
}

Friday, May 6, 2011

C# namespaces

Don't give a class the same name as its namespace as the compiler will stupidly claim that it can't tell them apart, even when it's obvious in context.

C variable initialisation

C variables are not initialised by the compiler unless they're static.

'If they have told me, I've forgotten.'

Thursday, May 5, 2011

Autoit3 concatenation

Autoit3 concatenates strings with &.

If you use + it will perform numeric addition and your result will be a single number.

Followers

Blog Archive