Ben's Blog

nature encounters ben April 04, 2014

Coyote

coyote

I.T., unix / linux ben April 02, 2014

Gnuplot one-liner from Hell

Here’s a convenient one liner to chronologically plot data on the command line

Screenshot

Screen Shot 2014-04-02 at 11.18.44 AM

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]

poultry, self sustainability ben March 30, 2014

Chickens ain't dumb

IMG_3132

miscellaneous ben March 26, 2014

Why yes Amazon

I wish to share my buying with all of facebook, twitter and email.

Screen Shot 2014-03-26 at 1.36.01 PMGUESS WHAT GUYS? I just bought a ‘PS2 Keyboard to USB Adapter’! That’s right! I bet you’re jonesing all the crap I buy.

In all fairness I did just blog about it.

life in the U.S., self sustainability ben February 17, 2014

Snow

IMG_0503

 

self sustainability, wood ben February 02, 2014

Sexy!

It still needs a bit of work.

IMG_2744

I.T., poultry, self sustainability ben January 08, 2014

Staying warm under the heat lamp

chickengif

Lego / Duplo ben December 24, 2013

Protected: Cool Duplo Project #07 – Slippers

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

Lego / Duplo ben December 24, 2013

Protected: Cool Duplo Project #06 – Portal to Another Universe

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

Lego / Duplo ben December 06, 2013

Cool Duplo Project #05 – The Tallest Tower in the World

IMG_1760

 

Lego / Duplo ben December 06, 2013

Protected: Cool Duplo Project #04 – Hacked Train

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

Lego / Duplo ben December 06, 2013

Protected: Cool Duplo Project #03 – Spinning Tops

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

Lego / Duplo ben December 06, 2013

Cool Duplo Project #02 – Toy Carts

IMG_1535

IMG_1450

Lego / Duplo ben December 06, 2013

Protected: Cool Duplo Project #01 – Monocular

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

miscellaneous ben December 05, 2013

A liability of inheriting books from religious family members

The cognitive dissonance is so strong with that one it took my brain minutes to accept what was going on. Trying to find every other possible explanations between the moment of surprise and the moment of acceptance.

The classic replacing “trillions” by “thousands”.

IMG_0814

White-out can fix Satan’s science (no copyright, feel free to use this in your next advertisement campaign).

IMG_0815

Homo Erectus is getting a free upgrade & a skirt!

IMG_0816

Censorship: a tool that is always on the right side of history.

I.T., web development ben November 20, 2013

Pulling the number keyboard in iOS' Safari while disabling client side input validation

Safari on iOS allows you to pull a specific keyboard for an input field. For example if I have a field expecting numeric input, we’ll make sure that our input has the attribute of “number” rather than the usual “text” as such:

[html]<input type="number"/>[/html]

This will save users a few clicks; however Safari forces input validation on the client-side when you do that. Meaning if you wanted a numeric keyboard by default while allowing other characters, you input will fail.

IMG_0798

Not only is it highlighted in red, this.value also returns null as opposed to what is clearly in the field, rendering it unusable.

When the field is set to “-10”

Screen Shot 2013-11-20 at 10.14.10 AM

When the field is set to “+10”

Screen Shot 2013-11-20 at 10.14.03 AM

One would think that explicitly defining a pattern to check for would let Safari know that we are interested in trumping its input validation but such is not the case. As a result, the following does not help our cause:

[html]<input type="number" pattern="(-+){0,1}[0-9]{1,}">[/html]

So here’s a completely hackish way to get the keyboard you want with no input validation:

[html]<input type="number" pattern="(-+){0,1}[0-9]{1,}" onFocus="that=this; setTimeout(function(){ that.setAttribute(‘type’,’text’); },10);" onBlur="that=this; setTimeout(function(){ that.setAttribute(‘type’,’number’); },10);"/>;[/html]

That’s right, after iOS pulled the right keyboard, we change the field type to “text”. Note that the client will still display some red around the field as it will perform the validation but at least this.value will return what’s in the friggin’ field.

Note 1: the setTimeout is necessary, if we perform the change immediately onFocus, safari pulls the text keyboard.

Note 2: the that=this indirection is necessary to save a reference of the object to the context of setTimeout.

I.T., miscellaneous, video games ben November 16, 2013

Protected: 3 years

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

hunting, self sustainability ben November 16, 2013

A great day

having great fun with a great friend.

 IMG_1214

It was hard not to fall asleep on a day like this

IMG_1208

The cool thing about hunting is that failure still means you got some awesome hiking done.

miscellaneous ben October 11, 2013

Safe sex, beaconning through the night

Hard to see but 2 condom vending machines are blinking away their presence on the side of a wall in the middle of the night.

[flv:http://ben.akrin.com/wp-content/uploads/2013/10/IMG_0503.MOV.flv 640 426]

miscellaneous ben October 11, 2013

Welcome to France!!!

A massive 4-sided display of nothing but cheese. This is how it’s done.

miscellaneous ben October 10, 2013

I found my childhood right where I left it

miscellaneous ben October 10, 2013

Welcome to France!

 

self sustainability ben September 29, 2013

Applesauce yum

Posts pagination

← Previous 1 … 42 43 44 … 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