Profile cover photo
Profile photo
Steve Kerrison
64 followers -
Researcher, teacher, sysadmin, embedded developer, computer architect and electronics meddler.
Researcher, teacher, sysadmin, embedded developer, computer architect and electronics meddler.

64 followers
About
Posts

For some reason I always edit my .vimrc in nano
Add a comment...

Just replaced Nautilus with Nemo. Ahhh, that's better.
Add a comment...

Today I've been writing a netfilter-queue for modifying IP packets. Every time I do something involving Ethernet, IP, TCP and what-not, I'm reminded how crazy the headers are. For example, you can add up to 40 bytes of IP option data to an IP header (allocated in 4 byte chunks) via a 4-bit length field. Each option has a field to specify that particular option's type (8-bit), and length (8-bit). The length field denotes the number of bytes in that option header. A single option could be, at most, 40 bytes including its type and length fields, so we have a couple more bits than we need there in the length. Bit of an imbalance between the 4-bit IP header length and 8-bit option field length, and a couple of wasted bits that might have been better spent on a more expressive type field.

Oh well, at least IPv6 is a fair bit nicer!
Add a comment...

The data ring on the Xeon Phi is 64 bytes wide? That's a lot of metal going around in a circle!
Add a comment...

So I'm debugging a piece of code, where the problem is obviously me corrupting some memory somewhere. But, in the process of working out where that is, I see the strangest piece of library code for strlen.

The C equivalent of what it's doing:

size_t n = 1;
do {
  x = y[n];
  y++;
} while (x);

Where x is a char and y is a char pointer. I guess incrementing n and incrementing y are functionally equivalent in this case, but I like how the compiler (I hope it was the compiler and not hand-written) chose to increment the base rather than the offset. It actually costs an extra instruction in the end because it has to do a bit of pointer arithmetic to work out the string length.

Or have I gone crazy? That is also plausible
Add a comment...

PHP's function signature for array_filter:

array array_filter ( array $input [, callable $callback = "" ] )

PHP's function signature for array_map:

array array_map ( callable $callback , array $arr1 [, array $... ] )

Just one example of why PHP is stupid.
Add a comment...

Post has attachment
Five ways of generating random  numbers in a shell, with particular thought given to BSD systems where you sometimes have sh, and not a lot else. http://dannyman.toldme.com/2008/07/04/shell-sh-bash-random-splay/
Add a comment...

So here's a thought: Does having a laptop + external monitor combo actually help you avoid eye fatigue?

Here's my point... in such a setup the laptop screen is more than likely a different distance from your eyes than the external monitor. So, as you switch focus between the two monitors, you're exercising your eye rather than holding the same depth. Granted, it's not quite "focus on macro and then infinity" like you're supposed to do in order to give your eyes a "break" from computer use, but maybe it's enough to increase eye-endurance?
Add a comment...

Post has attachment
Please can this be the default gzip implementation?
Add a comment...

Post has attachment
Need a quick way of turning a LaTeX equation into an SVG for importing into something that has a crap equation editor, or none at all? Don't know what software to install? Don't bother, use this instead: 

http://latex.codecogs.com/svg.latex?EQUATIONGOESHERE

e.g.

http://latex.codecogs.com/svg.latex?E_p%20=%20\sum_i%20\left(%20B_i%20\times%20N_i%20\right)%20+%20\sum_{i,j}%20\left(O_{i,j}%20\times%20N_{i,j}%20\right)%20+%20\sum_k%20E_k
Add a comment...
Wait while more posts are being loaded