Network not running in a CentOS VirtualBox machine

Be sure that your network options in VirtualBox are configured like this:

virtualbox-network

  • Attached to: Bridget Adapter
  • Name: (your network device)
  • Promiscuous Mode: Deny
  • Cable Connected: Check

Then inside the CentoOS virtual machine edit the /etc/sysconfig/network-scripts/ifcfg-eth0 file so the eth0 device is loaded on boot and it’s fully controlled by the /etc/sysconfig/network-scripts/ scripts instead of the NetworkManager daemon:

ONBOOT=yes
NM_CONTROLLED=no

Then restart the network:

service network restart

Now you should have an eth0 adapter up and running:

# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:08:CA:1C:18:5A
          inet addr:192.168.0.100  Bcast:192.168.0.255  Mask:255.255.255.224
          inet6 addr: fe80::20b:cdff:fe1c:185a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2341604 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2217673 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:293460932 (279.8 MiB)  TX bytes:1042006549 (993.7 MiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:5019066 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5019066 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:816 (816.0 b)  TX bytes:816 (816.0 b)

No splash screen on NetBeans

I’m not a fan of the splash screens the applications, even less on those that place it on top of all your applications all along.

netbeans-splashs-creen

The NetBeans splash screen is easy to hide. You can run Netbeans with the command line option “--nosplash” or add this option to the default ones in the configuration file. This configuration file is in different places depending on the operatin system, but it usually in:

GNU/Linux: "installation folder"/etc/netbeans.conf
Mac OS X: /Applications/NetBeans/NetBeans 8.0.app/Contents/Resources/NetBeans/etc/netbeans.conf
Windows: C:\Program Files\Netbeans\etc\netbeans.conf

Now that you know where the config file is, edit it and add “--nosplash” to the netbeans_default_options option:

netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true --nosplash"

Compile ffmpeg with libfdk_aac support: encoding AAC with ffmpeg

I wanted to add libfdk_aac support to ffmpeg because the documentation says it’s the best quality option for AAC encoding.

ffmpeg-logo

The problem was that when I tried to configure ffmpeg with libfdk_aac using the “–enable-libfdk-aac” flag it gave me this error:

Unknown option "--enable-libfdk-aac".
See ./configure --help for available options.

I was compiling the what I thought it was latest ffmpeg version (0.11.5) available from the releases site and that was a huge mistake: the last release is 2.3.3 and ffmpeg is now using git. So I cloned the repository and then the “–enable-libfdk-aac” flag worked fine:

git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg

If you want to be sure ffmpeg will have support for libfdk_aac look for this line inside the “Enabled encoders” section when you run the configure command:

a64multi5          libfdk_aac         prores

CPU load indicator using Pi-Stop with a Raspberry Pi

I bought a Pi-Stop just for fun and to introduce my nieces to coding. Pi-Stop is an educational pistop traffic light add-on for Raspberry Pi and was designed in partnership between 4Tronix.co.uk and PiHardware.com.

piStopCpuLoad

I first started trying some simple Python scripts to use the GPIO lines, then used the RPIO library to dim the LEDs with PWM, etc. Then it come to my mind that this simple and funny device could be used for something more serius: a CPU load indicator. Just some minutes later I had it done. It’s my first real Python program so it may be not perfect but it’s been a good start on the language. The code can be downloaded from github. Contributions are really appreciated :)

https://github.com/enekochan/piStopCpuLoad

The are 2 different versions of it:

  • piStopCpuLoad.py: Uses RPi.GPIO to interface with the GPIO port.
  • piStopCpuLoadPwm.py: Uses RPIO library and a PWM approach to dim the LEDs. You’ll have to install RPIO to use this script.

You can see it in action here:

Adding custom action to a keycode in XBMC

There are some USB IR remotes out there specifically made to be used in media centers. I bought one of those to setup my parents Raspberry Pi.

usb-ir-remote

It looked like everything worked out of the box with XBMC but then we noticed that the volume down button was not doing anything. So I had to check which keycode was being issued to bind it to the appropiate action in XBMC. You have to activate the debug on XBMC (Settings->System->Debugging) and then pressed the key a couple of times. Then look at the log file (temp/xbmc.log in your userdata directory, which in Linux is ~/.xbmc) for something like this:

18:25:59 T3034951680   DEBUG: OnKey: f14 (0xf09d) pressed, action is ...

You can use cat and grep for that:

$ cat ~/.xbmc/temp/xbmc.log | grep pressed

And there you have your keycode in hexadecimal format. Just convert it to decimal, which in this case is 65197, and then you need to know the name of the action you want to give to that keycode. The list can be found in ButtonTranslator.cpp:

        {"volumedown"        , ACTION_VOLUME_DOWN},

Finally add the key binding in keymaps/keyboard.xml file in your userdata directory:

<keymap>
  <global>
    <keyboard>
      <key id="65197">volumedown</key>
    </keyboard>
  </global>
</keymap>

Ref: http://wiki.xbmc.org/index.php?title=keymap#Keyboards
http://wiki.xbmc.org/index.php?title=HOW-TO:Modify_keyboard.xml