Choose color scheme

Ben's blog

  • 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”.


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


    Homo Erectus is getting a free upgrade & a skirt!


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

  • 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:

    <input type="number"/>

    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.


    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:

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

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

    <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);"/>;

    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.

  • 3 years

    Is how long it took before he discovered the arcade is actually more than a piece of furniture. He is still figuring out the controls as he is used to the iPad where there is little to no indirection between the controls and the output.


  • A great day

    having great fun with a great friend.


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


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

  • 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: 640 426]

  • Welcome to France!!!

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

  • Wooden bridge to more wood part 2

    This Subaru has hauled anything from motorcycles, compost & chicken coops; it’s only suiting to give it another job.

     This 90° turn was a huge bitch.

    Almost there.

    I’m not sure what I’ll do for boards yet, probably more hemlock cuts. I can’t wait to have it ready to use!