byte[] inbf = new byte[1024];
(Remember C# rarely lets you declare a variable without initialising it)
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 )
Tuesday, March 30, 2010
Monday, March 22, 2010
Path closing and filling
The area enclosed by an SVG path is filled in if the /fill/ attribute is anything other than "none".
Whether the path is closed or not (with z) does not affect filling, it only affects the strokes.
Whether the path is closed or not (with z) does not affect filling, it only affects the strokes.
Thursday, March 11, 2010
SVG text
Experiments show that a line of SVG text has four strata or horizontal layers of equal height:
TOP QUARTER only used by descenders from the line above
UPPER CAPITAL QUARTER only used by upper parts of capitals, and ascenders
UPPER MINISCULE QUARTER midparts of capitals, and upper part of x-height
LOWER QUARTER lowest part of x-height
-------------
DESCENDER QUARTER (overlaps TOP QUARTER of line below)
That's to say, if you specify your text to have font-size 6 then the space occupied by the four quarters will be 6 units, with each quarter taking up 1.5 units. Similarly you should use 6 as the dy when placing tspans to do multiple lines of text.
(It seems that while Arial follows this pattern, other fonts may not, any unfamiliar font should be experimentally displayed first for measurement).
TOP QUARTER only used by descenders from the line above
UPPER CAPITAL QUARTER only used by upper parts of capitals, and ascenders
UPPER MINISCULE QUARTER midparts of capitals, and upper part of x-height
LOWER QUARTER lowest part of x-height
-------------
DESCENDER QUARTER (overlaps TOP QUARTER of line below)
That's to say, if you specify your text to have font-size 6 then the space occupied by the four quarters will be 6 units, with each quarter taking up 1.5 units. Similarly you should use 6 as the dy when placing tspans to do multiple lines of text.
(It seems that while Arial follows this pattern, other fonts may not, any unfamiliar font should be experimentally displayed first for measurement).
Wednesday, March 10, 2010
StringBuilder
The way to replace the contents of a StringBuilder seems to be
sb.Length = 0;
sb.Append("New stuff");
sb.Length = 0;
sb.Append("New stuff");
string comparison
s1 == s2
is the same as saying
s1.Equals(s2)
and neither of them is a C++ 'is it exactly the same object' trap.
There is also Compare but I'm not clear as to the difference.
is the same as saying
s1.Equals(s2)
and neither of them is a C++ 'is it exactly the same object' trap.
There is also Compare but I'm not clear as to the difference.
string concatenation
Concatenate strings with + . If you're doing this in a loop, you should be using a StringBuilder not a String (StringBuilder.append).
However, an expression like
s1 + s2 + s3 + s4
is apparently optimised by the compiler so that it is not done as three separate string copies.
However, an expression like
s1 + s2 + s3 + s4
is apparently optimised by the compiler so that it is not done as three separate string copies.
Tuesday, March 9, 2010
Property calls on command results
To get a property of the object returned by a command, do thusly
(get-date).tofiletime()
NB that
(get-date).tofiletime
will get you the 'tofiletime' member itself, a bit like a function pointer in C and probably not what you want.
(get-date).tofiletime()
NB that
(get-date).tofiletime
will get you the 'tofiletime' member itself, a bit like a function pointer in C and probably not what you want.
where-object
where-object takes a bit of code as a parameter. Context seems to be that $_ is the object. Alpha comparison operators are used.
gci | where-object { $_.length -lt 500 }
gci | where-object { $_.length -lt 500 }
select-object
Despite its name select-object determines which properties ('columns') of the object are to be displayed.
gci | select-object length
gci | select-object length
Thursday, March 4, 2010
Tuesday, March 2, 2010
Monday, March 1, 2010
Perl for loops
for($n = 0; $n<10; ++$n) {
}
print $n;
will print 10, not 9. $n is incremented the last time control returns to the for - ++$n happens before the $n<10 check, because the loop control statement means
1. If this is the first iteration, $n = 0
2. if $n < 10, execute the loop body...
3. .. then ++$n
4. goto 1
}
print $n;
will print 10, not 9. $n is incremented the last time control returns to the for - ++$n happens before the $n<10 check, because the loop control statement means
1. If this is the first iteration, $n = 0
2. if $n < 10, execute the loop body...
3. .. then ++$n
4. goto 1
Subscribe to:
Comments (Atom)