[mejsvideo mp4=”http://ben.akrin.com/videos/IMG_5040.MOV.mp4″ ogg=”http://ben.akrin.com/videos/IMG_5040.MOV.ogv” webm=”http://ben.akrin.com/videos/IMG_5040.MOV.webm” poster=”http://ben.akrin.com/videos/IMG_5040.MOV.jpg” width=”640″ height=”360″]
Cool Duplo Project #10 – Falling Dominoes
[mejsvideo mp4=”http://ben.akrin.com/videos/IMG_5031.MOV.mp4″ ogg=”http://ben.akrin.com/videos/IMG_5031.MOV.ogv” webm=”http://ben.akrin.com/videos/IMG_5031.MOV.webm” poster=”http://ben.akrin.com/videos/IMG_5031.MOV.jpg” width=”640″ height=”360″]
Words English speakers confuse frequently
You’re your
Than then
duel dual
Their They’re There
course coarse
affect effect
bare bear
principal principle
capital capitol
hanger hangar
complement compliment
advice advise
waste waist
allusive elusive
sight site
roll role
peddle pedal
will grow as I find more…
Crazy Swarmy Week-End
I missed swarms so far because the hives are far from the house and so I only see them every few days. This week end was a trial by fire when it comes to swarming.
Finally, the neighbors spotted a swarm. It landed on a hemlock branch 40′ high. I tried everything to get to the branch including a 32′ extension ladder to no avail. So we put swarm catching box nearby and I kept a very close eye on them hoping to catch them on their take off to their new chosen home. Except one hour they’re on the branch doing nothing unusual and the next, gone! All gone, except for a couple of trailing bees seeming as lost as I was; the whole thing just vanished.
Up
Well that was a waste of time and efforts. Especially considering they took almost a 24h to figure out where to go. The next morning, the neighbors tell me that the buzzing is back… That can’t be, whether the swarm is confused or I have a new one on my hands.
Can you see them?
They are on a hop hornbeam this time, same height but an easy fell. And we proceed to do just that. We tie it to another tree to ease the sucker down with friction and it all works beautifully for the first 45 degrees but it all came crashing down for the remaining 45. The bees were not happy about that. They flew back to where the tree initially stood, I was afraid they would find another high branch nearby; but they eventually flew back to their branch of origin which was now very accessible to me.
Settling down after the ride (make sure to turn the volume up)
Definitely a foreign feeling to have your hand in there
I inspected the other 2 hives to see what they were up to and heard a piping queen in both! Meaning these were indeed 2 different swarms.
Piping queen, tried to find her but time ran short as the other bees were starting to dislike my intrusion
Lesson learned: tall trees are a bad idea around hives. I’m going to have to find a better spot for them.
All of this wouldn’t have been possible without awesome people like Nina who lent me a swarm catching box and good advice, and Peter who is always ready for an adventure. I wouldn’t have been able to catch my first swarm without their help.
Summer in VT is pretty crazy
iPXE booting with vlan support
Getting a version of iPXE that supports vlans
Download
ipxe_with_vlan_support_2014-06-12.iso
Build it yourself
[code]
git clone git://git.ipxe.org/ipxe.git
cd ipxe/src
sed -i ‘s///#define VLAN_CMD/#define VLAN_CMD/’ config/general.h
make
[/code]
There is multiple ways you can use your compiled binary, for testing just mounting bin/ipxe.iso and booting from it is good.
Using it
Boot from the ROM/ISO.
CTRL+B to get a command line when prompted.
Then assuming a desired vlan ID of 123:
[code]
vcreate –tag 123 net0
dhcp net0-123
chain tftp://${next-server}/${filename}
[/code]
Acres
In what is probably the biggest step taken towards our dream, we just bought a chunk of land of ~50 acres.
We have little money left to do anything with it at the moment but we’ll throw a house on it in due time. We are cleaning it up in the mean time.
It is an invigorating feeling to stare at your life goal.
PHP 2-dimensional array sorting algorithms
For 2-dimensional arrays looking like:
[code]
Array
(
[0] => Array
(
[id] => 1
[name] => roger
[age] => 31
)
[1] => Array
(
[id] => 2
[name] => brutus
[age] => 24
)
[2] => Array
(
[id] => 3
[name] => ganesh
[age] => 92
)
)
[/code]
I find that comb sort is usually the fastest but its worst case is much worst than quick sort so it could become a bottleneck depending on your data.
[php]
<?php
ini_set( ‘memory_limit’, ‘128M’ ) ;
/**
* @desc bubble_sort for 2 dimensional array (all the arrays of the 2nd dimension need to have the field $sort_by)
* @param array^2 $data the array of arrays
* @param string $sort_by the parameter that will be used for comparison
* @param string $sort_direction "asc": ascending, "desc": descending
*/
function bubble_sort( $data, $sort_by, $sort_direction ) {
if( $sort_direction==’asc’ ) {
for( $i=1 ; $i<count($data) ; $i++ ) {
for( $j=1 ; $j<count($data) ; $j++ ) {
if( $data[$j-1][$sort_by]>$data[$j][$sort_by] ) {
$temp = $data[$j-1] ;
$data[$j-1] = $data[$j] ;
$data[$j] = $temp ;
}
}
}
} else {
for( $i=1 ; $i<count($data) ; $i++ ) {
for( $j=1 ; $j<count($data) ; $j++ ) {
if( $data[$j-1][$sort_by]<$data[$j][$sort_by] ) {
$temp = $data[$j-1] ;
$data[$j-1] = $data[$j] ;
$data[$j] = $temp ;
}
}
}
}
return $data ;
}
/**
* @desc comb_sort for 2 dimensional array (all the arrays of the 2nd dimension need to have the field $sort_by)
* @param array^2 $data the array of arrays
* @param string $sort_by the parameter that will be used for comparison
* @param string $sort_direction "asc": ascending, "desc": descending
*/
function comb_sort( $data, $sort_by, $sort_direction ) {
$gap = count( $data ) ;
$swaps = -1 ;
while( !($gap<=1 && $swaps==0) ) {
if( $gap>1 ) {
$gap = $gap/1.3 ;
if( $gap==10 || $gap==9 ) {
$gap = 11 ;
}
}
$i = 0 ;
$swaps = 0 ;
while( !(($i+$gap)>=count($data)) ) {
if( ($sort_direction==’asc’ && $data[$i][$sort_by]>$data[$i+$gap][$sort_by]) ||
($sort_direction==’desc’ && $data[$i][$sort_by]<$data[$i+$gap][$sort_by]) ) {
$temp = $data[$i] ;
$data[$i] = $data[$i+$gap] ;
$data[$i+$gap] = $temp ;
$swaps = 1 ;
}
$i++ ;
}
}
return $data ;
}
/**
* @desc quick_sort for 2 dimensional arrays (all the arrays of the 2nd dimension need to have the field $sort_by)
* @param array^2 $data the array of arrays
* @param string $sort_by the parameter that will be used for comparison
* @param string $sort_direction "asc": ascending, "desc": descending
*/
function quick_sort( $data, $sort_by, $sort_direction ) {
if( count($data)<=1 || $sort_by==” ) {
return $data ;
} else {
$pivot = $data[0][$sort_by] ;
$x = $y = array() ;
for( $i=1 ; $i<count($data) ; $i++ ) {
if( $data[$i][$sort_by]<$pivot ) {
if( $sort_direction=="asc" ) {
$x[] = $data[$i] ;
} else {
$y[] = $data[$i] ;
}
} else {
if( $sort_direction=="asc" ) {
$y[] = $data[$i] ;
} else {
$x[] = $data[$i] ;
}
}
}
return array_merge( quick_sort($x, $sort_by, $sort_direction), array($data[0]), quick_sort($y, $sort_by, $sort_direction) ) ;
}
}
?>
[/php]
Gnuplot one-liner from Hell
Here’s a convenient one liner to chronologically plot data on the command line
Screenshot
Command
[bash]
export width=`stty size | cut -d " " -f2`; export height=`stty size | cut -d " " -f1`-10; cat /tmp/data | sed "s/ /T/" | gnuplot -e "set terminal dumb $width $height; set autoscale; set xdata time; set timefmt \"%Y-%m-%dT%H:%M:%S\"; set xlabel \"time\"; set ylabel \"counter\"; plot ‘-‘ using 1:2 with lines"
[/bash]
Data
/tmp/data contains the following:
[code]2000-01-01 00:00:00 1
2000-01-01 01:00:00 2
2000-01-01 02:00:00 3
2000-01-01 03:00:00 2
2000-01-01 04:00:00 3
2000-01-01 05:00:00 4
2000-01-01 06:00:00 5
2000-01-01 07:00:00 4
2000-01-01 08:00:00 3
2000-01-01 09:00:00 4
2000-01-01 10:00:00 4
2000-01-01 11:00:00 5
2000-01-01 12:00:00 4
2000-01-01 13:00:00 4
2000-01-01 14:00:00 3
2000-01-01 15:00:00 2
2000-01-01 16:00:00 3
2000-01-01 17:00:00 4
2000-01-01 18:00:00 4
2000-01-01 19:00:00 5
2000-01-01 20:00:00 6
2000-01-01 21:00:00 6
2000-01-01 22:00:00 7
2000-01-01 23:00:00 8
2000-01-02 00:00:00 7
2000-01-02 01:00:00 7
2000-01-02 02:00:00 6
2000-01-02 03:00:00 8
2000-01-02 04:00:00 9
2000-01-02 05:00:00 9
2000-01-02 06:00:00 9
2000-01-02 07:00:00 8
2000-01-02 08:00:00 7
2000-01-02 09:00:00 5
2000-01-02 10:00:00 4
2000-01-02 11:00:00 4
2000-01-02 12:00:00 4
2000-01-02 13:00:00 3
2000-01-02 14:00:00 2
2000-01-02 15:00:00 2
2000-01-02 16:00:00 1[/code]


























