So a few days ago I came across this video on Digg discussing a programming question sometimes used in interviews, code the game FizzBuzz.  I've never had to do this since I've applied for a programming job, but I liked the idea of trying to figure out how many ways I could code FizzBuzz in Swift.  To make this a bit more fun I gave myself an hour to try and come up with the most convoluted and the simplest solutions I could.

The Rules

  1. Print the numbers 1 through 100, one number to a line
  2. If the number is divisible by 3, print "Fizz" instead
  3. If the number is divisible by 5, print "Buzz" instead
  4. If the number is divisible by both 3 and 5, print "FizzBuzz" instead

The Loop

So the first part of this game is a simple loop and there were really only two options available a for and a while loop.  They would look something like this.

var counter : Int = 1
let counterLimit : Int = 100

//While Loop Option
while counter <= counterLimit {
    //Do Something
    counter += 1

//For Loop Option
for i in 1...counterLimit {
    //Do Something

Running The Tests

The rest of the program just requires that we test the number to see if it is divisible by 3, 5 or both.  The sequence of our tests matters because doing things backwards would require more tests to cover the same scenarios.

//Requires fewer tests
for i in 1...100 {
    if i % 3 == 0 && i % 5 == 0 { print ("Fizz Buzz") }
    else if i % 3 == 0 { print ("Fizz") }
    else if i % 5 == 0 { print ("Buzz") }
    else { print ("\(i)") }

//Requires more tests
for i in 1...100 {
    if i % 3 == 0 && i % 5 != 0 { print ("Fizz") }
    else if i % 5 == 0 && i % 3 != 0 { print ("Buzz") }
    else if i % 3 == 0 && i % 5 == 0 { print ("Fizz Buzz") }
    else { print ("\(i)") }


The simplest solution I could think of was the same as what was presented in the video, although you could get "fancy" using an array to capture the results instead of just printing them out.  But that may not be as efficient from a resources perspective.

for i : Int in 1...100 {

    var output : String = ""

    if i % 3 == 0 { output += "Fizz" }
    if i % 5 == 0 { output += "Buzz" }
    if output == "" { output = String(i) }

    print ("\(output)")



My complicated answer just does a lot of work that can be simplified through the use of the modular (%) operator.  There are clearly better ways of doing this.

//Function to determine remainder equals 0 (true)
func remainder (number : Int, divideBy : Int) -> Bool {
    let result = number % divideBy
    if result == 0 {
        return true
    } else {
        return false

for i in 1...100 {

    if remainder(number: i, divideBy: 3) && remainder(number: i, divideBy: 5) {
        print ("Fizz Buzz")
    } else if remainder(number: i, divideBy: 3) {
        print ("Fizz")
    } else if remainder(number: i, divideBy: 5) {
        print ("Buzz")
    } else {
        print ("\(i)")
AuthorLee B Wilson

Last year for Black Friday, had a fantastic deal on an Acer c720 Chromebook so I decided to grab one.  I'd been wanting to test ChromeOS and live "la vida google" for a while.  After 2-3 months I decided that ChromeOS wasn't for me.  I'm an old school computer user, I need a command line, and I need actual applications and not web apps.  This isn't to say that ChromeOS is a bad operating system, it wasn't, and if you live purely online I think it will get the job done.  

That said, I had this c720 which I now needed to find a purpose for.  I had heard that the c720 could be converted into a nice Linux laptop, and so for my maker project in February I decided that I would convert the c720 into an Ubuntu laptop so I could write code, and goof around online.

Here are the steps I followed to make this work.  I'll include the source URLs when I can.

Step 0 : Remove the screw.


In order to get the c720 to boot consistently into Ubuntu you need to be able to flash the NVRAM of the c720.  There is physical write protection on the motherboard in the form of a screw, URL below has an excellent picture of the motherboard and where that screw is located.  It isn't hard to remove.  Once removed just replace the bottom cover but don't screw in the bottom panel, you'll need to replace the screw later.

Step 1: Enable Developer Mode and Flash the NVRAM


ChromeOS uses a special BIOS and so in order to have a reliable Ubuntu machine you first need to flash the BIOS to get SeaBios running.  

  1. Press and hold ESC + F3 then press the POWER button.  This puts the Chromebook in Recovery Mode
  2. Press CTRL+D to enable Developer Mode and CONFIRM.  The Chromebook will work for a bit and reboot.  Leave it alone for a few minutes while it completes.
  3. At this point you've restored the machine and it has losts its configurations.  When you get to the configuration screen press CTRL + ALT + F2 to bring up the prompt.
  4. Login with the userid chronos.  There is no password.
  5. At the prompt access the superuser shell
    1. sudo bash
  6. Enable SeaBIOS
    1. crossystem dev_boot_usb=1 dev_boot_legacy=1
  7. Reboot the machine

At the white splash screen you can press CTRL + L to boot into SeaBIOS.  Otherwise the machine will boot into ChromeOS if you wait a few seconds.  To make SeaBIOS boot by default we need to run a few more commands.  Return to the ChromeOS superuser shell and run the following.

sudo su

flashrom --wp-disable

flashrom --wp-status

This last command should return the following values (there could be more)


Set SeaBios as the default by running 0x489

flashrom --wp-enable

Turn off the c720 and return the screw you removed from Step 0.

With that done you can now install Ubuntu.  Insert your 14.04 install media and install Ubuntu normally.  Make sure to attach an external USB mouse to the c720, by default the trackpad on the c720 will not work with Ubuntu 14.04

Step 2 : Ubuntu

Once installed and online give Ubuntu a few minutes and it will prompt you to perform some updates.  Let Ubuntu update, once done we can fix the trackpad and boot time issues.


First we'll fix the trackpad.  Luckily someone online has written a script to get all the work done for us.  To get started open a Terminal window and enter the following:

bash kz917j

Type in your administrator password when/if prompted and reboot when done.  Make sure not to touch the machine while processing.

To fix the boot time and other issues with the suspend, follow the instructions on this site.  I'm not including them here because it involves editing a couple of files and I like how the author of this site presented the information.


With that done you should have a functional Ubuntu laptop for not a lot of money.  You may need to map some of the volume and brightness keys, but that can be easily done through the System Settings panels in Ubuntu.  In addition, I be careful with any update that involves changes to the kernel and that might break some of these fixes.

AuthorLee B Wilson

So i decided to start my 2015 Making Challenge with something BIG.  For years I've been working from home and have never been happy with my working environment.  With that in mind in 2015 I'm completely remodeling my work environment.  The first step was to build something that could serve as my datacenter in a box.  This gives me a single place to consolidate everything electronic in my office, printers, NAS, server, etc.  The result was this 5 foot plus monster on wheels.

The frame is all 2x4s with 1/2inch MDF for the panelling and shelves.  There is still plenty of wiring work to do on this project but it has consolidated fantastically the clutter in my office.  This will allow me to get rid of some extra furniture and make more space in the office for new things.

AuthorLee B Wilson