Martin Fowler on the will to design :
In order to work, evolutionary design needs a force that drives it to converge. This force can only come from people—somebody on the team has to have the determination to ensure that the design quality stays high.
This will does not have to come from everyone (although it’s nice if it does), usually just one or two people on the team take on the responsibility of keeping the design whole. This is one of the tasks that usually falls under the term ‘architect’.
I gave a talk at OpenWest about Perl’s AnyEvent module and some of its primitive operations.
I gave a presentation at OpenWest about Perl dependency isolation using perlbrew
and plenv
+ carton
:
I re-learned some electrical terms today that may be useful later when working with GFCI circuits.
- Line (usually black, also known as “hot”): comes in from the electrical panel
- Load (usually black, sometimes red): is a continuation of line and goes out to downstream devices. Non-GFCI circuits will not have a load.
- Neutral (usually white): completes the AC circuit and carries excess current to ground
- Ground (bare): carries any inadvertent current away from the circuit in case of a fault
The catchphrase is “line in, load out”.
Given a multi-level deep hash reference:
my $conf = {
bucket => {
list => {
h => 'help me',
_sub => sub { say "something" }
}
},
file => {
upload => {
h => 'help me too',
_sub => sub { say "else" }
}
}
};
We want to remove all of the _sub
keys and put them in a separate hash reference with the same structure. This does that:
I gave a talk about Perl dependency isolation at Salt Lake Perl Mongers.
Some notes for using Devel::Cover
.
Gathering coverage
CPAN::Reporter
doesn’t have a build step, so we prove -l
; we also don’t want to cover the world, so we set -inc=lib
:
HARNESS_PERL_SWITCHES=-MDevel::Cover=-inc=lib prove -l
or:
PERL5OPT=-MDevel::Cover prove t/some-test.t
This will run the prove
utility and turn on code coverage.
Selecting only one file to cover
cover -select=lib/Some/Module.pm
You may add multiple -select
options.
Ignoring files to cover
cover -ignore_re=^/var/core_lib -ignore=/usr/bin/prove
I needed to come up with a way to spread out chunks of a subnet among a handful of users, so I came up with this routine:
sub hash256 {
my $str = shift;
my $hmac = hmac_sha256($str);
my $val = unpack "L*" => $hmac;
my $hash = $val % 256;
return $hash;
}
Used:
for my $str ( qw/scott paul mark jayce rvd james/ ) {
say sprintf "%-15s %d" => $str, hash256($str);
}
Now the result of my $hash = hash256('joe')
can be used as, say, the third octet in a cidr: 192.168.$hash.0/24
.
scroll mode
tmux
has a scroll mode where you can use page up/page down and arrows to scroll the buffer back. To enter scroll mode, C-b <page up>
. To get out of scroll mode, <Esc>
. Also C-b [
turns on scroll mode.
sharing
Poor man’s screen sharing:
$ tmux -S /tmp/tmux-shared new-session -s session-name
(detach)
$ chmod 777 /tmp/tmux-shared
(attach)
Person 2 attaches:
$ tmux -S /tmp/tmux-shared attach-session -s session-name
I gave a talk about functional programming with Perl at Salt Lake Perl Mongers.