Hosting a flat html webpage for free
Live Coding Championship
6 November 2017
I was watching the Twitch stream of the live coding championships at the recent Wolfram Technology conference.
It was obviously a first pass at something which actually looks like a lot of fun but a couple of things jumped out at me - things you wouldn't notice with a polished 'final' version of the answer.
The first was seeing that even the experts would get bugs or 'off by one' errors - off by one errors are the worst because the answer looks reasonable and not obviously wrong. It was interesting to see how they would iterate their solution to a final version. I think this real-time format shows that no-one just types out massively long chunks of code as if they see them written on a big whiteboard in their mind - they seem to start with something small and add functions to it to get the result in the format they want.
Secondly, the clear code was often easier to write and review than 'pure' code. They weren't doing clever recursive pure function wizardry - they were just nesting named functions and relying on Mathematica to figure it out. The code may not be the fastest to run, but it's the fastest to discover. And remember, most of the code you write will be thrown away never to be re-used so you want to optimise the time it takes to discover the right approach, not the time it takes to compute.
Lastly, writing good questions is really hard!
It was also interesting to see how Stephen Wolfram narrated his way through the submitted answers. As expected, he identifies the critical function, typically the inner-most function and then reads the logic of each successive function being applied. There is a bit of 'the curse of the magic word' that makes getting started dependent on knowing a good place to start but that's just part of the learning curve.
I recommend watching it, you may or may not be able to follow the code logic but watching how people develop code is a very interesting perspective.
25 July 2017
Just clearing out some notes to myself and I may as well save them here.
Back in 2014 I subscribed to the ZombieBot Challenge and became part of the resistance. It's a great idea that gets you building a little robot one challenge at a time. While you pay up front, you don't get the next challenge until you prove you've completed the current challenge and solved a riddle. It's really quite fun and I can see why they are popular with schools trying to get tech into their curriculum.
I haven't kept up with them and while checking their homepage for the link above, I've noticed they're upgraded their kit to be 3D printed snap housing for the sensors and the Arduion mini - nice.
For what it's worth I found the first couple of challenges pretty straightforward (the first being really neat) and then there was a big leap up around Challenge 4 or 5. I didn't have the time or energy to figure out the C code they were writing to make the robot behave and before long, I found I was plumbing together the wiring and just dumping their code on the Arduino to complete the challenge. In addition, I think I was the first person they had do the challenge using a Mac and I had to do some Google searches to figure out how to get the Arduino connected to my Mac and uploading the code. Also, some of the help page photos were out of date so i wasn't able to follow those directly.
But as I said, that was more than a couple of years ago and both of those aren't so much problems as less-than-perfect hints - it just forced me to hunt around for a solution, try some things myself and muddle my way through. Pretty much what any learning journey looks like...
All up, if you're looking for an introduction to Arduino and sensors, especially if you want to mess around with the default programs to make it do something else that you're interested in, ZombieBots are a good way to go.
19 May 2017
Hard to believe it's been nearly a year since I dropped a note on the blog. Around August last year, I stumped up a few hundred $$ and bought a home copy of Mathematica and i've spent most of my spare time since then getting myself up to speed with the basics - enough to teach someone else and to use it as a platform for self-learning for the rest of Z School.
It's a reasonably steep learning curve since tutorials are always written by someone with a typical user in mind - none of whom considered high school students their average user! I think I've got the gist of it now and I'm putting in place some of the other ideas I have for getting Z School off the ground.
That and getting the website hosted properly and ZSN up and running have taken up all the time I have for this project. But now that it's mostly done I'm really looking forward to 2018! ;-)
Nix the Tricks
26 July 2016
Just a quick note to mention a short book I just read written by a maths teacher in the US. In the book they rage against the 'maths is just a bunch of tricks that generate the correct answers' meme that most of primary and secondary education seems to confirm.
They have a whole bunch of tricks that deserve better treatment including a couple of my WTFs - butterfly multiplication and the triangle formulas.
Anyway, the book is free to download as a pdf or buy on-line. Nix the Tricks by Tina Cardone and the online math community known as MTBoS.
Is Gravity a Social Construct?
6 June 2016
It's been a while - funny how life and earning a living can take up blog time...
A Sci21 video just bubbled up on my radar from Professor Shaun Hendy describing how gravity can be both an objective fact yet the scientific theory of gravity is also subjective in some sense of the word. Anyway, better to let Prof Hendy tell you why in his own words!
31 December 2015
I'm a big fan of Kalid's website Better Explained. In a comment on Hacker News he pointed out that a neat percentge calculation trick is to swap the % with the number - sometimes it's easier to do in your head and will always give you the same number.
What he meant was, 50% of 100 (50) is the same as 100% of 50 (also 50). Or 16% of 25 (? I can't do that in my head...) is the same as 25% of 16 (oh, that's just a quarter of 16 which is 4!). It works with any question like that.
The reason is pretty straight forward: a% of b = c can be calculated as a/100 * b = c and we know that the left hand side can also be written as a/100 * b/1 which can be combined to give ab/100 and then broken apart again to give a * b/100 which is just saying a * b%. Connect all that together and you get a% * b = b% * a = c.
Cute. Funny how even stuff you think hold no surprises anymore can still be seen from a different perspective.
19 November 2015
I thought I was the only one who considers simple webpages a first-class, A-OK and altogether fantastic bit of technology even without fancy schmancy graphics and gradient logo buttons strewn all over the place.
Turns out I'm not alone. Here's one and here's another. Be warned though: the authors seem to have strong opinions on design and functionality! ;-)
Confession: I Don't Know My Times Tables
17 October 2015
It's true. I still remember being in primary school having to do a quiz every day on times tables and never getting more than a couple right. There was girl who was regularly called to the front of the class to recite the 16 times table (which is odd on a couple of different levels looking back as an adult). I just couldn't stand the thought of memorising 12-odd sets of times tables... so I didn't.
I was reminded of this while reading the article "Learn Math Without Fear". The article is discussing what must be the most talked about aspect of maths education - facts vs number sense. For a lot of people, maths is a bunch of facts, some rules for generating numbers from other numbers and obscure names for triangles. This is a very valid opinion given most people's maths experience and as someone who's taught students at uni, I can guarantee you that applying this philosophy to maths will get you right through your degree - probably with excellent marks. Personally, I'd rather find something interesting to think about - my favourite maths typically doesn't have numbers and is mostly about drawing doodles!
The problem is, somewhere around your final year of your under-graduate degree and certainly within a year or two of your post-graduate degree, the education system does a bait-and-switch without really telling you. After what was probably around 15 years of requiring you to generate acceptable answers to fairly straight-forward questions, you are now required to generate excellent questions about incredibly vague and incomplete answers. It's tricky and not at all clear how this happens but most students figure it out. I don't think it's a coincidence that the transition typically occurs once you are learning within a small peer group with a mentor on a topic that you have chosen because you find it interesting.
What does this have to do with memorising your times tables? Often, students that have doubled-down on the memorisation route to answering questions have a really really hard time switching to question-asking mode whereas those students that have always kind of muddled along with a few core concepts well understood that are applied over and over again seem to handle it well. I think the rote memorisation of the times tables (or not) are one of the first times you'll see people make a decision on their natural style.
Unfortunately, being quick with your times tables is then confused with "being good at maths". That kind of message is self-reinforcing and before you know it, people have convinced themselves to not try - it's like someone trying to play the violin for a couple weeks and then deciding they're not musical and never trying again.
So how do you survive without knowing your times tables? I found some of them easy to remember for whatever reason, figured out that you could flip some of the questions around so 5x7 was the same as 7x5 (even as I wrote that I only knew the answer from memory to 7x5 ;-) and from there add and subtract in your head quickly. Of the 100 odd numbers in the 10x10 grid, I probably know 20-odd off by heart, the rest I work out from there - you'd be surprised how easy it is.
Oh and by the way why learn past 10x10? Once you know how to break the number into (10+x) x (10+y), it's just 100 + 10x + 10y + xy (seriously, just draw a square and rule some lines to see the squares and rectangles) and that's just adding but it leads to this really interesting thing called Completing the Square...
Feynman's Lectures on Physics
15 October 2015
Richard Feynman was one of the iconic physicists of the 20th century - not only brilliant but a great story teller who always seemed to have just the right question at the right time to clear up any mystery.
He became very famous to the general public in the late 80s as part of the Challenger shuttle disaster enquiry with a now famous demonstration of how an O-ring caused the explosion. The wiki page has a good intro.
I'd also recommend his book Surely You're Joking Mr Feynman! which recounts his many adventures as a young scientist leading up to and during his role in the Manhatten project developing the first atomic bombs.
But anyway, what prompted me to write this post is that Feynman is also famous for writing and giving one of the best introductory physics classes ever - The Feynman Lectures in the early 1960s. The copyright to these have been a nightmare for decades but CalTech has recently put them on-line for free. The lectures are generally considered to be one of the best university entry level texts ever written. They are wonderfully written even if you're not a physicist and I can't recommend them enough.
Interesting aside - his book on Quantum Electro Dynamics based on a set of 4 lectures for a general audience was debuted at the University of Auckland in 1979! There are various videos of the lectures on the web - it's amazing to see a master at work holding the audience with nothing but a blackboard and a piece of chalk...
If I ever get the chance to study physics properly, this is my textbook!
Choosing a Software Toolbox
15 September 2015
One of the hardest decisions to make in Z School has been which software package to focus on. Deciding on spreadsheets as an entry to data analysis seems a bit odd from a computer scientist or technical viewpoint but after you've worked in a corporate environment you realise that the world literally runs on spreadsheets.
Not knowing their strengths and weaknesses is a big gap if you ever have to step outside of academia. The history of spreadsheets in general is also pretty cool. They have been around for hundreds of years, literally as boxes on a big sheet of paper so that complex calculations could be carried out by highly trained operators - any maths at all in say, 15th century Venice put you in line for a solid job - it was the BCom analyst role of the day. Developing a computer version is also a pretty good story from the wild dark days of the late 80s. In the beginning, there was VisiCalc...
After spreadsheets, which are really the scratch pads of modern life, you have a number of options - all of which seem to be fine. It used to be the case that some high end technical computing packages were simply too expensive for home use but free and open source software seems to have driven down prices dramatically. The 4 options I've considered are Python, Mathematica, Matlab and Maple.
Here's how I see it:
H2S Superconducting at 203 Kelvin
23 August 2015
A new super-conductor has just been announced in the journal Nature. Wired magazine covers it here. Turns out H2S is superconductive at 203 K. This is only about 70 degrees lower than the freezing point of water! And about 70 degrees hotter than the previous record.
It's important to notice though that they had to squash it to something like 900,000 atmospheres of pressure!
It's funny to think that I've just finished the Ohm's Law and Series Resistor videos showing what 'normal' looks like and within a few few years at university you can be working with substances that completely screw up your ideas of what normal actually is!
Zero resistance leads to some weird effects like the Meissner effect and can only be understood (if that's the right word) using quantum mechanics - the very weird science of the very, very small. As Richard Feynman says: I think I can safely say that nobody understands quantum mechanics.
19 July 2015
As far as I'm concerned a blog is written for yourself and only incidentally for anyone else to read. A state-of-mind which also happens to be true for the vast majority of blogs on the net.
For that reason, I'm going to bookmark anything I find interesting that I wish I'd seen when I was a young student.
Lockhart's Lament falls in that category. A rather scathing review of America's mathematics education from a pracising mathemetician.
His view of how students perceive maths while at school is 100% true for me - I didn't give a fig about memorising the correct names for triangles or memorising anything for that matter - to this day I haven't learnt my times tables! I have a few down by heart but for most I add or subtract in my head from the 'easy' ones. It's not efficient but in my professional life I've very rarely been asked to recite my 8 times table so I get by.
So heres to appreciating that sometimes you should learn about things because they are fun, or interesting or just plain mind-blowing. Sudoko puzzles have got nothing compared to a good science or maths problem! I never enjoyed maths until i relaxed and found bits and pieces that were interesting - funny how I had to finish school and university before I found the freedom to do that!
Inclined Plane Experiment Observed in the Wild
14 July 2015
I was hanging out at a tertiary institute in Christchurch the other day and wandered past a room where there were a pair of inclined planes were being set up.
It's not often you see this experiment in the wild so I wandered in and asked them if it was the classic ball-and-ramp experiment and why it was being set up.
Turns out they were doing a school holiday programme and the kids were being introduced to the ballistics equations and had to knock over a bunch of plastic soldiers as part of the challenge. It looked like they were going to have a lot of fun (I wish I'd had this sort of stuff to do in the holidays when I was a kid - although I suspect I would have rather watched TV ;-).
I had just uploaded the Z School videos on the inclined plane and introduced the constant acceleration equations as being slopes and slopes of slopes etc and asked if they were doing a similar thing. I got the impression they wouldn't have the time and the equations would just be given to them. This is how I first saw them and it was a mystery to me for years where these mythical and magical equations came from. I figured scientists received them inscribed on stone tablets after some sort of mystical process, probably involving Stonehenge circles... I think it's a pity, sure it's a little more complicated but I think removing the mystery and showing how these equations can be 'discovered' is a much more fascinating thing to learn (even if the only thing your remember is that they were worked out somehow) than how to plug'n'chug some numbers on a random equation you're given.
I asked about how they calculated the speed of the ball as it came down the ramp. They used something called a photogate sensor from Vernier (who I thought just made high spec rulers). Turns out there's a whole range of sensors and widgets you can buy for physics type experiments. That's pretty cool but you have to use a special programing language that doesn't appear to be free. As the guy said who was setting the experiment up "it's about $4000 worth of kit to get the data". And then all it spits out is the velocity in m/s. You miss all the pleasure of doing your own measurements, seeing how they scatter around a mid-point and worst of all, science is seen as something that requires $1000s of dollars of equipment and a PhD in electrical engineering just to set something up that Galileo did 300 years ago. Thanks but no thanks, I'll stick with my golf ball, a slide and a cheap as stopwatch! ;-) If I go the automated data acquisition route I'd rather learn how to make my own with an Arduino - that's a superpower that I can take anywhere.
Text Editors for Programming
3 June 2015
A text editor is the generic term for what most people call word processors. To a programmer, a word processor is a specilised program for writing documents. Most people use Microsoft Word, Apple Pages and a very powerful programme, beloved by programmers, for creating beautiful documents is called LaTEX.
For actually writing programmes, you are literally spoiled for choice - and everyone is passionate about their preference. There's even a term for it - the editor wars.
Feel free to wander around and wonder what the difference is between vi and Emacs and why people seem so consumed about their choice.
If you spend 10-12 hours a day programing and manipulating text then yeah, go ahead and invest the 100s of hours needed to learn how to play these powerful instruments (but first, learn to touch type - it's by far your biggest asset these days).
If you're just kicking the tyres or spend 90% of your time doing something other than programming then pick something that's Not Obviously Wrong (using Notepad is wrong :-) - a cross-platform simple editor is Gedit. People who make their living programming computers use it so it should serve you well for quite some time.
Go to the Gedit website and download and install the latest version. Heads-up: I've got an old MacbookPro running OS X 10.9.5 and the latest version of Gedit that would work for me was 2.30.2. It's fine - I'm a beginner. Make sure you turn on the highlight mode - it really does help.
2 June 2015
I've just started getting the footage for finding out Ohm's Law (V=IR) and there's a whole bunch of 'stuff' that needs explaining around prefix notation and linear relationships etc. Looking around on the web for how other people have covered this material I've found a pretty common 'trick' where they write the formula inside a little triangle and then 'cover up the one you're looking for and what's left is how to calculate it'. Here's a pretty typical example.
This is such a bad idea. There's a blog I enjoy reading called Math With Bad Drawings (and yes, the drawings are terrible) and one of his recent posts was about how learning tricks to get the right answer is just building an imaginary ceiling in your understanding. Go read it, he tells a great story.
My favourite quote: "A student who can answer questions without understanding them is a student with an expiration date."
Learning to use these magic triangles and that horrific 'butterfly' multiplication thing is going to bite you big time in the very near future.
Learn how to work with formulas, move them around, re-arrange them - it just takes practice but trust me, this kind of skill lasts a lifetime and is transferable to any problem in any discipline. Remember, if it looks like a trick or something you just have to remember how to do to get the right answer, you're not understanding, you're just memorising.
Working with GST
3 May 2015
For boring reasons not relevent to this blog, I had to work out the GST component of a bunch of prices.
I'm not an accountant so I figure out GST by thinking through the formula 1.15x = incl-GST price where x is the price before adding GST. Take the original price and times it by 1.15 and you get the incl-GST price.
If you have the incl-GST price and want to find the ex-GST price, just divide the incl-GST price by 1.15. Want to know the GST amount? Using the above, I would subtract the ex-GST price away from the incl-GST price but use the same formulas. Not overly efficient perhaps but spreadsheets make this sort of thing trivial to do over and over again.
Anyway, turns out the IRD recommends that to find the GST amount of any incl-GST price, you times the price by 3 and then divide that number by 23. Huh !?!
Don't believe me? Check out page 5 of this guide from the IRD.
I hunted around for someone to explain why this weird 'trick' worked (Google is so much quicker than thinking...) but when I read "Don't worry about how the multiply by 3 then divide by 23 works, it just does!" I got annoyed and figured it out - turns out it's easier than you think.
Have a go at working it out. I don't know how to do a fancy schmancy button to reveal the answer so I changed the colour of the text to the same as the background. To get a hint, just highlight the apparently blank area below! There are a couple of hints before the explanation.
HINT 1 = Try multiplying the top and bottom by whole numbers up to 9 - do any of them seem familiar?
HINT 2 = GST is 15%. An easy example would be to work out the new GST inclusive price on something that costs $100.
Take $100 and add 15% GST - your new price is $115 right? Since this new price is made up of the original $100 and the $15 of GST, the ratio of the original price to the final price must re-calculate the original price and similarly the ratio 15/115 must re-calculate the amount owing to GST. And 15/115 simplifies to 3/23, the weird number recommended by the IRD.
I know that typically you are supposed to simplify fractions down to their smallest common factors but I tend to leave them as they are as much as possible. The number 15/115 gives you a big clue as to what is going on in a GST calculation - otherwise it just looks like magic! The same thing occurs when you leave in the 2 with pi - it reminds you to think about circles and repitition!
Re-sizing my Blog Width
3 May 2015
I looked around for a way to control the width of my blog column and found out about the div tag. A div tag is described as a 'container' and you can customise a lot of the presentation within each div using the 'style' options. I think of them as being a seperate post-it note with my text written on it.
I combined the div tag with a specified pixel width, told them to float left and gave the text div a lightish background colour option for this layout. i left the first blog post alone so you can see the difference. These 'float' tags are pretty cool - you can use them to automate a lot of the page layout. I found a helpful page here.
To update this blog page I had to hunt and find examples of the following:
9 April 2015
It's amazing how long it seems to take to get anything done on a side project! I've avoided building a website for a few reasons: