What Every JavaScript Developer Should Know About Floating Point Numbers
After I gave my talk on JavaScript (really, I was there trying to shamelessly plug my book - Underhanded JavaScript and its alternate title: JavasScript Technical Interview Questions), there was a Q&A session. I could answer most questions, but Khalid Hilaby asked me a very interesting and quite general question on JavaScript number types. He had simply wanted to know more about floats in JavaScript and why they act so strangely. While I could answer the question, I felt I didn’t answer it well enough. I loaded my article on Pointer Tagging in Go to explain the structure of a floating point number, explained a bit on floating point arithmetic, and how in the past they had to have special CPUs for floating points (FPUs)* Nowadays they're all integrated , and then sort of meandered from there.
Now that I am back in Sydney and well rested, I thought I’d give the question a second try. The result is the article - What Every JavaScript Developer Should Know About Floating Points on Flippin’ Awesome. This is the full unedited version before I edited down for length and appropriateness for Flippin’ Awesome.
[Read More]You Should Roast Your Coffee In Two Stages (Now Comes With: OpenCV Tricks!)
If you follow me on Twitter (and you should), you will know that since about 3 months ago, I started roasting my own coffee. Yes, my coffee madness has culminated over the years to this. This was my first roast:
Since then I have roasted 16 batches. The variables I vary are: temperature, time, pre-roast mass, and technique. I use a regular $10 popcorn popper from KMart to roast my beans (I originally wanted to purchase a Behmor, but I decided that I should stay lean while learning how to roast coffee) – and I have a thermometer to roughly gauge the temperatures of the popcorn popper. Eventually I’ll hook the thermometer up to an Arduino, but that’s a story for another day.
Despite all the controls, I had problems with my roasts. They were okay to drink – not as bad as buying supermarket coffee, but they weren’t excellent. The main problem was consistency. My roasts were not consistent – some beans were darker than the others. Here were the factors that caused the beans to be inconsistently roasted:
- Different sized beans – Can’t do much here.
- Uneven heating – various causes:
- Popcorn popper too hot
- Popcorn popper doesn’t agitate the beans fast enough (too heavy? too light?)
- Popcorn popper doesn’t agitate the beans randomly enough
- Location of beans in popper
I eventually narrowed it down to the fact that the popcorn popper was too hot – it burns some beans before they could be agitated out. In fact, after the first two throwaway attempts of the roasting, I realized that 7 minutes or so in a popcorn popper as recommended by amateur roasters on the Internet would just burn my beans.
I did a quick lookup, and true enough, most amateur roasters on the web are Americans (or live in America). Are American popcorn poppers different?
[Read More]The Switchless Switch
In my previous blog post about why a kettle costs so much, the one statement that perhaps riled the most people up is where I said Tesla Model S’ touch screen control panel was a stupid idea. In fact, the link to the Model S control panel is amongst the top most clicked links out. I do think it’s a stupid idea, but I must disclaim that I have never driven a Tesla, so I may be talking out of my ass based purely on logical reasoning and not a practical experience* P/S: Tesla, come to Australia already. .
The logical reasoning goes something like this: I am driving down the road at 110 km/h. My eyes are on the road, as all safe drivers do. The radio station suddenly plays Justin Bieber* I’m only using Justin Bieber as a punching bag because everyone uses him thusly. I actually have no opinions on popular music given that the music I regularly listen to are dated to 300-400 years ago , and the car gets cold suddenly because Bieber is a witch. I want to: a) change the current radio station; b) raise the temperature of the vehicle interior. But first I have to go to the media control app. Then I need to change my media playback from a radio station to a Spotify playlist containing all my favourite Tchaikovskys. Then I need to access the climate control app to raise the temperature by a few Celcius.
The question is this: How many times have I taken my eyes off the road, and how long for each time?
[Read More]Javascript: Wat, Again
I gave a talk on Javascript recently at Javascript.my‘s unshift() miniconf in Kuala Lumpur. After regretting giving many talks without a recording to track my performance improvements when giving talks, I decided that starting this year, I would record and transcribe my talks. Here’s the first one for 2014. The slides are embedded here as well.
I had originally planned to record my talk and use an automatic transcriber to transcribe. But the recording quality was indeed quite poor as my phone battery was running out. I had to use Audacity to clean it up quite a bit. And despite that, automatic transcription with OS X’s Dictation didn’t work as well as I expected it to.
Anyhow, here’s the transcription of my talk. A lot of bits were filled in and edited (I really have a lot of uh, and ums when I speak) as the recording got quite garbled as time went on. Towards the end it was a totally unrecognizable warble. I was scheduled to give a 30 minute talk but I ended up talking for about 50 minutes. The last 20 minutes are not transcribed.
[Read More]Why Does A Good Kettle Cost $90+?
Yesterday morning I woke up to a house without electricity - that meant I woke up in a puddle of sweat because the fan was no longer turned on. It turned out that my housemate, while making coffee, had tripped the mains of the house. The kettle had caused the trip. It was no longer safe to use the kettle and so I had to buy a new kettle.
[Read More]