Ben's Blog

Lego / Duplo ben September 03, 2014

Cool Duplo Project #16 – Frame of reference swapping

Gotta mess with their minds early.

[mejsvideo mp4=”http://ben.akrin.com/videos/IMG_5224.MOV.mp4″ ogg=”http://ben.akrin.com/videos/IMG_5224.MOV.ogv” webm=”http://ben.akrin.com/videos/IMG_5224.MOV.webm” poster=”http://ben.akrin.com/videos/IMG_5224.MOV.jpg” width=”640″ height=”360″]

Lego / Duplo ben August 25, 2014

Protected: Cool Duplo Project #15 – Glasses

This content is password-protected. To view it, please enter the password below.

I.T. ben August 25, 2014

Mysqldump only certain fields of a table

The trick here is to not use mysqldump

[code]mysql -u root -p -e “SELECT `field_01` AS ‘new_name_01`,`field_02` as `new_name_02` FROM database.schema” -X > /tmp/output.xml[/code]

And to load it back into the new table which exists and has the fields new_name_01 & new_name_02:

[code]mysql -u root -p –local-infile -e “LOAD XML LOCAL INFILE ‘/tmp/output.xml’ INTO TABLE database.new_schema ROWS IDENTIFIED BY ‘<row>’;”[/code]

life in the U.S. ben August 22, 2014

Doomsday Preppers caters to opposing audiences

IMG_5050

X-Factor: your ability to pack explosives into dead racoons will be a valuable asset when the city folks come steal your shit.

Lego / Duplo ben August 21, 2014

Cool Duplo Project #14 – Train Induced Weight Shifting Train Track

[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″]

Lego / Duplo ben August 16, 2014

Cool Duplo Project #13 – Boat

IMG_1837

Lego / Duplo ben August 16, 2014

Protected: Cool Duplo Project #12 – Big Rig

This content is password-protected. To view it, please enter the password below.

Lego / Duplo ben August 16, 2014

Protected: Cool Duplo Project #11 – Raised Platform

This content is password-protected. To view it, please enter the password below.

Lego / Duplo ben August 16, 2014

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″]

Lego / Duplo ben August 16, 2014

Protected: Cool Duplo Project #09 – Reverse Center of Mass Spinning Top

This content is password-protected. To view it, please enter the password below.

Lego / Duplo ben August 16, 2014

Cool Duplo Project #08 – Robots

 Waldo

IMG_4967

Fat Head

IMG_5026

Mechwarrior

IMG_4245

Pincher

IMG_4247IMG_4248

Nanobot

IMG_4968

Macrobot

IMG_5165

miscellaneous ben July 15, 2014

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…

apiculture, self sustainability ben July 15, 2014

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

IMG_4109

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?

IMG_4126

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)

[mejsvideo mp4=”http://ben.akrin.com/videos/IMG_4129.MOV.mp4″ ogg=”http://ben.akrin.com/videos/IMG_4129.MOV.ogv” webm=”http://ben.akrin.com/videos/IMG_4129.MOV.webm” poster=”http://ben.akrin.com/videos/IMG_4129.MOV.jpg” width=”640″ height=”360″]
I brought the swarm catching box to them and hand scooped them to the entrance little by little. It took a while with branches, leaves in the way and barely cooperative bees. Eventually a critical mass was reached and they all went in.

Definitely a foreign feeling to have your hand in there

IMG_4170

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

[mejsvideo mp4=”http://ben.akrin.com/videos/IMG_4192.MOV.mp4″ ogg=”http://ben.akrin.com/videos/IMG_4192.MOV.ogv” webm=”http://ben.akrin.com/videos/IMG_4192.MOV.webm” poster=”http://ben.akrin.com/videos/IMG_4192.MOV.jpg” width=”640″ height=”360″]

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.

nature encounters ben June 29, 2014

Showy Lady's Slipper and its spider

IMG_3932Wikipedia

apiculture, self sustainability ben June 29, 2014

The hives are getting full

The Langstroth is doing good but the top bar is raging.

IMG_4002

Bees gorging in honey dripping from broken comb.

IMG_3990

nature encounters ben June 26, 2014

Luna Moth

IMG_0051

 

life in the U.S., miscellaneous ben June 18, 2014

Summer in VT is pretty crazy

weird noises, lightning bugs, thunderstorms and giant moths.

Hey pssssssssst! Let me in! I want to snuggle. luna_moth

 

Wikipedia

self sustainability ben June 15, 2014

Protected: It ain't easy being cheap

This content is password-protected. To view it, please enter the password below.

I.T. ben June 11, 2014

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]

self sustainability, trip to a new life ben May 11, 2014

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.

IMG_3601

IMG_3583

apiculture, self sustainability ben May 11, 2014

Let's hope for a better season

 

IMG_3499

IMG_3501

IMG_3554

poultry, self sustainability ben May 11, 2014

biodegradation – the chicken difference

Without chickens

IMG_3470

 

With chickens

IMG_3471

I.T., web development ben April 16, 2014

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]

Posts pagination

← Previous 1 … 41 42 43 … 52 Next →

This blog is solar powered

Interactive

Handwriting Capture
Mandalagaba
IPv6 link-local to MAC converter
IPv6 MAC to link-local converter
Markov Text Generation
Markov Word Generation
Markov Music Generation
Duplogrifier
Flood Fill Algorithms
Homestead Metrics
RGB Playground
Web Games

Categories

  • aesthetics111
    • plots54
    • specular holography6
  • Books3
  • I.T.202
    • 3D modeling / printing21
    • AI6
    • all out geekery36
    • electronics27
    • homestead automation6
    • maniacal paranoia25
    • plotters49
    • unix / linux29
    • video games4
    • web development29
    • web games3
  • Lego / Duplo67
  • life in the U.S.42
  • miscellaneous202
  • nature encounters114
  • old vinyls3
  • organs2
  • self sustainability560
    • agriculture105
    • apiculture38
    • apple20
    • building131
    • canning3
    • crochet6
    • foraging6
    • hunting10
    • maple syrup47
    • poultry39
    • preserving2
    • solar power28
    • water23
    • wood84
  • trip to a new life6
Theme by Bloompixel. Proudly Powered by WordPress