Ben's Blog

ben

1186 Articles

self sustainability ben July 31, 2018

Counter Measures

The fauna has taken a huge bite out of our work this year. A woodchuck ate the garden, crows ravaged the blueberry plants, deer went after young fruit trees & currants, finally a racoon simply killed all the keets and didn’t even eat them. One animal after another has gone after our work and voided much of it, this is the first year this happens to such a scale and it is making us feel besieged.

It’s interesting just how much brutal competition there is in nature. I used to think of nature as an idealized garden of Eden, but it’s closer to a ruthless competition which often ends in death. I despise man’s expansionist dominance over nature, yet living closer to nature means participating in the competition. Hawks circles over our baby, ticks & mosquitoes suck our blood, raccoons take out our flocks, deer reap the fruits of our sweat. I’m fine with letting nature get its share but nature is perfectly fine taking it all. I don’t enjoy exerting human dominance but I can’t let that go, it’s time to be more aggressive.

 

Intel gathering

 

The little fuckers parade around the chicken coop like they own the place

 

Unfortunately not at a set time at which I could throw them a little welcome party

 

A trap does stay up all night, notice to pull string in case the skunk gets in there

 

Well at least I caught something with the box the trap came in

 

Super scary scarecrow

 

The trees are now in prison until they have more mass

building, self sustainability ben July 15, 2018

Protected: One more finished room

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

self sustainability ben July 04, 2018

Protected: Brutal heat wave

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

poultry, self sustainability ben July 01, 2018

Keets

The chickens were “gifted back to nature” last Winter. No egg production and a new baby in the house brought this shortcut we didn’t like taking.

I’ve updated the list of traditions and cultural artifacts I understood since moving to Vermont for the occasion. It made me understand how so many religions have the concept of sacrificing animals to deities, and the idea of offerings to gods in general. I heard the coyotes come from the next hill over the same night and rejoice at the bounty. I never had issues with coyotes, coincidence? I think not. Everything happening at night feels supernatural. It’s not the first time we take animals deep into the forest to be cleaned up, and this was likely a frequent occurrence in the lives of humans when religions popped up.

We’re populating the coop this time with Guinea Hens. Apparently they’re like guard dogs, but they also eat ticks, and snakes, and they require little feeding.

I.T., web development ben June 23, 2018

An HTML5 canvas Flood Fill that doesn’t kill the browser

I took the longest time implementing the fill tool  on Mandalagaba. How hard could it be? Recurse through pixels looking for a color and update them to a new color.

While this method certainly works and is easy to implement, it is also extremely slow. Slow in a way that hangs the browser, yielding infamous messages from the browser.

Here we’ll take a look at various Javascript flood fill implementations along with their drawbacks. Jump to #4 if you are only interested in the best one.

2018-10-04 – edit – added fill algorithm #5 which proposes an alternate approach to filling pixel by pixel. Depending on your project it may or may not serve your needs better.

In all cases, the code is available in the example iframe, look for the function flood_fill.

1. Simple Recursive

Not much to explain here, we simply recursively call the function on adjacent pixels when they match the color we are trying to fill over.

Click to change color / pop-out link

It’s reasonably fast but the problem with this one is that any fill area slightly large yields too much recursion which breaks subsequent JS. This Canvas box is 200x200px and at 300x300px, Firefox complained about:It’s easy to see how this implementation will not satisfy a reasonably featured paint program. Even if your browser let you stack more function on the heap, I would bet it would lead to slowness.

2. Iterative

We simply take the previous idea of looking at adjacent pixels and filling them, and make it iterative instead so the function calls don’t get stacked to a ceiling.

Click to change color / pop-out link

The problem with this is is that is is sloooow. So slow it stalls browser. Most of time is spent having to keep track of pixels_stack. Recursion doesn’t have that need but as we’ve seen, it has other issues.

3. Recursive-Iterative (AKA catch-your-breath iterative)

This is a twist on #2 which every so often, recurses on itself via a setTimeout to let the browser catch it breath a little. It also yields a cool visual effect.

Click to change color / pop-out link

I really like the visual effect, and it makes the slowness tolerable. But the issue is that Mandalagaba has a network engine and allows for re-rendering of one’s work. So synchronization is a big deal, and you know what makes synchronization easy? Not having to worry about it.

So as long as I can help it, my life is a lot easier if the operations the users can perform are atomic. Operations need to be able to be processed one after the other counting on the fact that the ones that came before have completed.

The first 2 solutions are atomic but suck; this 3rd one, however cool it may be, isn’t.

4. The Holy Grail

I’m not sure where this algorithm originated from, but I’ve gotten to know it on this web page which explains it very well (with GIFs!). It is iterative and goes about finding pixels to fill in a much smarter way.

Click to change color / pop-out link

That’s it, no drawback here 🙂 I’ve tested it on large canvasses and this is what is implemented on Mandalagaba. Now of course, in a real application there is a ton more complexity dealing with smoothing edges and blending alpha. I only wanted to expose boiled down versions of these algorithms so they are easier to wrap your mind around.

5. The Holier Grail?

While #4 is fastest algorithm for filling pixel by pixel, I found myself in the need to have a fill operation in for form of a path which is filled with the native HTML5 canvas capabilities. This algorithm is a bit different from all the other ones in that it doesn’t go through every pixel and fills it. What it does is pathfinding to draw the outline of the shape of be filled, and then simply calls the native canvas fill() function. It does come with certain drawbacks and so I wouldn’t recommend it unless you specifically need this sort of approach.

Click to change color / pop-out link

Feel free to ask questions in the comments.

agriculture, self sustainability ben June 19, 2018

Haying Fever

I’m getting good at changing implements

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

A nightmare if you’re allergic to pollen

Stuck in the mud once more… The truck will pull it out.

Take 2, with board to help not sink in. We need more culverts.

Off we go! later suckers, me & my tractor have got some fields to mow.

self sustainability ben June 19, 2018

Chestnut leaves

All 3 chestnut saplings are looking great with fresh new leaves.

agriculture, self sustainability ben June 12, 2018

Garlic Baby

Farmer baby is satisfied with the garlic inspection.

agriculture, self sustainability ben June 12, 2018

Black gold

From one Vermont hill

To our Vermont hill

Featuring: some guy with a giant ass tractor

Compost is gold, we haven’t been so good at making our own and the raspberries haven’t grown so well. This year we’re trying to pamper them more by weeding them more aggressively and making sure they’ve got more than enough nutrients in the soil.

building, self sustainability ben June 12, 2018

Room flooring

This is a bedroom a kid will grow up and become a teenager in, I laid tongue and groove pine because I could use the hardest of woods, there will be holes through it. I figured it’ll be easier to be ok with the damage if it’s not super expensive wood. The result looks great but it will wear faster. I love the angles in that room, Robin has not been in it for weeks, we’re keeping it a surprise and will have a ribbon cutting ceremony in a couple of days.

The old crowbar helping straighten up recalcitrant boards

Working in tight spaces

Construction baby managing the crew

building, self sustainability ben June 01, 2018

A first in 3 years

A nicely finished room, no visible insulation, studs or vapor barrier. It is incredibly satisfying to work on finishing a room. Since we now have enough space in the house, all the others will follow. We are done making temporary arrangements.

A guide for the circular is incredibly useful for making rip cuts.

How trims are born

Finer work is super satisfying

I opened the windows and discovered the view a few weeks ago, giving them a nice frame makes it all the more enjoyable.

nature encounters ben May 31, 2018

Snake on a food coma

I kicked this guy out from under the outside shower, it was incredibly hard to get it moving. Then I noticed the bump on his body, thank you for taking care of rodents snake bro.

nature encounters ben May 28, 2018

The Robins really like that spot

They’re back every year laying in the same few trees. A little higher this year.

self sustainability, water ben May 14, 2018

Protected: Flowering marsh, a nascent swim hole & the incredible prospect of getting the tractor over the stream

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

maple syrup, nature encounters, self sustainability ben May 14, 2018

Maple seedling

Something is making this year an excellent one for maples to come out of the ground. Maple seedlings are everywhere.

self sustainability ben May 14, 2018

Marking rocks to save mower blades

I’ll pop them out when the backhoe is attached. I took a lots of rocks out and these are the last ones :).

agriculture, self sustainability ben May 11, 2018

18 more blueberries in the ground

all out geekery, I.T. ben May 05, 2018

Nosy Monster alive and well

The Nosy Monster has been sitting on my desk idle for a while now, I’ve always wanted to work on it a bit and make it more reactive to web input. Finally, I bit the bullet and it’s now a lot smoother to operate. Instead of clicking for pre-timed commands, the start of a key press actuates and the end stops. With a websocket communication layer and a socket python command server, the commands find their way from keyboard to motors super fast.

To account for wireless imperfections and AP hopping, I also wrote the logic such that there isn’t a “start” and a “stop” command. Instead there is only a “start” command which gets sent every 200ms and if it isn’t heard every 300ms, Nosy Monster stops. This ensures it won’t be locked in a state of actuation which could lead to perilous situations.

I intend on polishing the code & publish a tutorial that hopefully a 7 year old could handle.

The Nosy Monster was deployed at the Dartmouth Thayer School of Engineering’s open house. I didn’t know how robust it was going to be under sustained kid use.

It turned out to be a huge hit, I let the kids drive it around a bit and then I’d throw the Nosy Monster in another room where they would have to find their way around with no visibility other than the camera. It performed flawlessly through the evening.

It’s always an enormous point of satisfaction to see kids get into something you made. Once I sent the RC car “to Mars” (the other room), the kids were really focused.  All but one got stuck and never came home. I should have had a prize for the one, but what’s next, participation trophies?

With a much more usable and reliable toy, I decided to setup the same kind of maze in a house room under construction.

I moved the camera up on a stick for a better angle of vision, the next model will have a fisheye camera.

Without a reverse, it takes a few tries to get through the maze without getting stuck. He had to learn to be careful.

I’m bubbling up with ideas  of cool things to do with the concept and acquired techniques. From a solar powered exterior land rover, to battle bots.

agriculture, self sustainability ben April 28, 2018

Oddly fascinated by the leaves

We’ve been watching an excellent crowdfunded documentary series called Woodlanders. It brought to our attention a guy working to reintroduce the chestnut tree to American forests. We couldn’t believe it was even possible to acquire young chestnuts so we pretty much had to place an order. It arrived this week and to our surprise it still had leaves from the season previous. This is when it hit us what it meant to be planting this.

aesthetics ben April 24, 2018

Mandala session on a huge touch screen

agriculture, self sustainability ben April 24, 2018

Spring finally showed up

We’re moving the garden to an area closer to the house and with much better soil

Found a few carrots from last season 🙂

Added 18 blueberry plants to the ~40 we have now; 18 more to come in 2 weeks.

self sustainability, wood ben April 17, 2018

As green as it gets

I threw the last logs in the stove and promptly went after a couple more small ash trees. For a brief moment, we were all out of firewood.

We’ll take all the drying we can get

This is the greenest we’ve burnt, literally minutes between tree to firewood. Ash is seriously impressive.

self sustainability, solar power ben April 11, 2018

Solar monitoring back online

The solar instrumentation has been lacking for a couple of months since the solar panels’ current sensor blew up. It took 2 months because there has been a lot mistakes and learning along the way. It should have been simple, replace the 30A sensor by a 100A one right?

Well it wasn’t. First I ordered the wrong 100A sensor, meant for AC use. Then I had a myriad of issues around calibration.

  • at the 5V input port, a 0V reading didn’t translate to 0A, this sensor goes from -100A to 100A so it is 2.5V which translate to 0A.
  • with the skew from miscalibration, the value I was getting made no sense for what I know the panels can make
  • orientation matters as again, this sensor can read negative values
  • a cloudy day makes fluctuations hard to detect
  • moving the sensor from one interface kit to another after calibration resulted in another skew.

All these little things I could have picked on their own, but together they conspired to make me thoroughly confused and left me seeking support from the Phidgets forums. I was once more impressed by Phidgets, the help I got was fast and efficient. Phidgets are more expensive but I was proven once more that they are worth every penny. They have many other advantages, I have nothing but good things to say about them.

Calibration, I really need to tidy things up in there

I’ve learned a LOT of lessons with this one. Not the least of which is to be ok with the imperfections of analog data. I’m a discrete data type of guy, it doesn’t come naturally to accept skews & variations.

Posts pagination

← Previous 1 … 25 26 27 … 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