Blog


Blog

A blog that I like to keep updated with any interesting findings or new stuff that I try everyday while I code or while I am looking for a solution to an existing problem.

VirtualBox - Failed to create the host-only adapter [OSX]

VirtualBox - Failed to create the host-only adapter [OSX]

This morning I went to fire up my local vagrant machine on OSX and I got the following error:

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Clearing any previously set network interfaces...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["hostonlyif", "create"]

Stderr: 0%...
Progress state: NS_ERROR_FAILURE
VBoxManage: error: Failed to create the host-only adapter
VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterface, interface IHostNetworkInterface
VBoxManage: error: Context: "int handleCreate(HandlerArg*, int, int*)" at line 66 of file VBoxManageHostonly.cpp

The solution for me was to remove VirtualBox, download a newer version from https://www.virtualbox.org/wiki/Downloads and reinstall it. After that vagrant up was working again.

In case it does not work try to update or reinstall vagrant too, but the main culprit was VirtualBox as it was not able to create any host adapters.

Wordpress - Send post data to external (3rd party) service

Wordpress - Send post data to external (3rd party) service

Did you ever want to send Wordpress post data as soon as a post is created, or published, or updated? Maybe even when the post is trashed or deleted? Using Wordpress hooks it's very easy to create a custom wordpress plugin, activate it from the administration area and immediately start sending the data to a 3rd (third) party or a custom external service.

Check how it's done

Ookla - Could not connect to test server issue

Ookla - Could not connect to test server issue

Recently I had to debug and issue with our hosted Ookla speed test application. To cut it short the flash application was loading fine, license key was correct too but when running the speed test it was showing a latency error like the one below.

First we thought the issue was a firewall issue, as it is stated clearly in the error message, and although there were issues with the firewall iptables but it was not the main issue that was causing the error. The issue was that the Ookla server daemon was not started so the application could not connect to the hosted Ookla server to run the test.

The solution was to run the ./OoklaServer --daemon and include the daemon in the boot scripts, so that whenever the hosting server is restarted the daemon would start automatically. This varies according to how you setup the Ookla server the first time.

To test if the Ookla server was working correctly I also used http://www.ookla.com/hosttester.php to make sure that the server was setup correctly.

You can find more information on the Ookla unix server daemon here http://www.ookla.com/support/a22705918/NetGauge-Server-Daemon-Setup .

If you want to setup the daemon to startup automatically follow the guide http://www.ookla.com/support/a23471557/NetGauge-Linux-Startup-Script-Options

Drupal 7 – Enable a theme from a custom module via code

Drupal 7 – Enable a theme from a custom module via code

Sometimes you are required to enable a theme programmatically from a module without needing to do it manually all the time, so to do this I have used the hook_init() function to get a list of all the themes in Drupal which contains all the themes info.

Then I am using the name of the theme (the one in the .info file) and after checking if the status is disabled I call themeenable function and pass an array with the theme name I want to enable. The themeenable function accepts an array of theme names, so you are able to enable multiple themes at once.