Ubuntu 14.04 not seeing Wifi Networks

I installed a fresh Ubuntu 14.04 on an old MacAir (how to do that is explained here) and took me hours to get it to see the Wifi networks. There were many suggestions on many sites but the solution that finally worked for me was Hadaka’s answer from ubuntuforums

Just for information, check your pci id via

lspci -n | grep 0280

Then some cleaning up

sudo apt-get autoremove
sudo apt-get remove --purge bcmwl-kernel-source  #for good measure
sudo apt-get remove --purge b43-fwcutter firmware-b43-installer

sudo rm /var/lib/apt/lists/*
sudo rm /var/lib/dpkg/lock
sudo rm /var/cache/apt/archives/lock
sudo dpkg --configure -a

sudo apt-get update # I didn't do this as I didn't have a network

Now the important part is:

sudo apt-get install linux-firmware-nonfree

however, as I didn’t have a network I downloaded linux-firmware-nonfree_1.14ubuntu1_all.deb to a USB stick (you might want to get a newer version) from here to a connected computer and then

sudo dpkg -i linux-firmware-nonfree_1.14ubuntu1_all.deb

and then

sudo modprobe b43

Finally, rebooted and was able to see and connect to WiFi networks

Generating call graphs with Doxygen

Obviously you should first download and install Doxygen

Next, you should download and install Graphviz which will install the dot tool

in a nutshell, you create the documentation by running:

doxygen my_conf_file

Where my_conf_file contains all the required parameters for the generated documentation. If you use the doxygen wizard from the UI, a configuration file will be generated with some default parameters, however you need to change the following parameters in the generated configuration file if you want caller and/or called function graphs to be generated:

HAVE_DOT               = YES
EXTRACT_ALL            = YES
EXTRACT_STATIC         = YES
CALL_GRAPH             = YES
CALLER_GRAPH           = YES
MAX_DOT_GRAPH_DEPTH    = 10

Note that if you use the above parameters on a non-trivial code base then the documentation generation might take a long time. Read the doxygen documentation to better understand the implications.

Delacorte Numbers

There really isn’t such a mathematical term – it was introduced at the latest Al Zimmermann’s Programming Contests and is defined in the contest rules (at azpcs.net – site should be back up around mid December January, a replacement is currently up at trdb.org ).

As I’m participating in this contest and have created some useful C++ classes to solve these types of optimisation problems I’ll be publishing them on github after cleaning them up when the contest is over (January 3rd).

JSON to HTML bullet points

I needed to convert a JSON hierarchy to an HTML bullet hierarchy and all the solutions I found on the Web were overkill. Enjoy.

<!DOCTYPE html>
<head>
<script>
var g_tree = {
   "1":{
      "11":{
         "111":{
            "option1":1,
            "option2":1,
            "option3":1
         },
         "112":{
            "option1":1,
            "option2":1,
            "option3":1
         },
         "113":{
            "option1":1,
            "option2":1,
            "option3":1
         }
      },
      "12":{
         "121":{
            "option1":1,
            "option2":1,
            "option3":1
         },
         "122":{
            "option1":1,
            "option2":1,
            "option3":1
         },
         "123":{
            "option1":1,
            "option2":1,
            "option3":1
         }
      },
      "13":{
         "131":{
            "option1":1,
            "option2":1,
            "option3":1
         },
         "132":{
            "option1":1,
            "option2":1,
            "option3":1
         },
         "133":{
            "option1":1,
            "option2":1,
            "option3":1
         }
      }
   },
   "0":{
      "21":{
         "211":{
            "option1":1,
            "option2":1,
            "option3":1
         },
         "212":{
            "option1":1,
            "option2":1,
            "option3":1
         },
         "213":{
            "option1":1,
            "option2":1,
            "option3":1
         }
      },
      "20":{
         "221":{
            "option1":1,
            "option2":1,
            "option3":1
         },
         "222":{
            "option1":1,
            "option2":1,
            "option3":1
         },
         "223":{
            "option1":1,
            "option2":1,
            "option3":1
         }
      },
      "23":{
         "231":{
            "option1":1,
            "option2":1,
            "option3":1
         },
         "232":{
            "option1":1,
            "option2":1,
            "option3":1
         },
         "233":{
            "option1":1,
            "option2":1,
            "option3":1
         }
      }
   }
};

function json2ul(json, str)
{
        if (typeof(json)!='object')
                return '';

        str += '<ul>';
        var names = [];
        for (key in json)
                names.push(key);
        names.sort();
        var len = names.length;
        for (var i=0; i<len; i++) {
                var key = names[i];
                str += "<li>"+key;
                str += json2ul(json[key], '');
                str += "</li>";
        }
        str += '</ul>';

        return str;
}

function init()
{
        document.body.innerHTML=json2ul(g_tree, '');
}
</script>
</head>
<body onLoad='init()'>
</body>
</html>

Atom editor on Ubuntu

To Install the atom editor for Linux (taken from here):

$ sudo add-apt-repository ppa:webupd8team/atom
$ sudo apt-get update
$ sudo apt-get install atom

I needed syntax highlighting for Lua. My suggestion is:

  • Start atom, press <Ctrl><Shift>P
  • Type: install packages
  • Select ‘Settings View: Install Packages’
  • Search for language-lua package
  • install the language-lua package

You should get the syntax highlighting + other goodies explained here

Ubuntu 14.04 LTS very slow on VirtualBox

Got the solution from here:

  • Shut down the guest machine
  • Select the Ubuntu 14.04 virtual machine and click the Settings button
  • Select the ‘Display’ item from the list on the left
  • In the Video tab on the right, check the ‘Enable 3D Video Acceleration’ option
  • Select the ‘Storage’ item from the list on the left
  • In the ‘Storage Tree’ view on the right, select the Controller:SATA item
  • In the corresponding attributes to it’s right, check the ‘Use Host I/O Cache’ option
  • Close the settings and restart the virtual machine. It should be considerably faster now.