Indoor Herb Garden

I was looking for an indoor herb garden solution that does not take up to much space. And I also wanted the option to move it to the garden in spring or summer. I checked out various options, for example this Vertical Garden. It looks fantastic, but it has a high price point and a large footprint.

So I ended up buying with this stackable solution. It’s affordable and made in the USA. There are two color options. Hunter green is a bit prettier, but the stone colored one allows me to label what I planted on the pot with a dry erase pen.

I added a herb seed kit and a seed starter.

Everything arrived faster than expected so after I picked up my daughter from daycare we went to home depot to get some herb and vegetable soil. We were lucky and got a great deal ($2.30 instead of $12 a pack) so we got a few since we plan to plant mint in a few days, too. Fall/Winter is a good time to purchase these things.

So we were good to go…

Great little helper
Planting the seeds
And now: Waiting!

Bierstadt Trail – Rocky Mountain National Park

Yesterday we hiked the Bierstadt Trail at the Rocky Mountain National Park. It is an about 5 km long loop trail with an elevation gain of 200 meters.

The elevation starts right and at the beginning and is there-and-back. Once you climbed up the 200 meters there is an even loop trail on the plateau around Bierstadt lake.

Here’s a screenshot from AllTrails.

You’ll find the most amazing view.

Hiking & board games @Yosemite

Last weekend we visited Yosemite National Park. What a great place to hike. Of course we brought some board games. I just wanted to share some advice and impressions.
20151107_100252

  • If you drive to Yosemite from San Francisco International Airport, a great place to stay is Yosemite Gold Country Lodge in Coulterville. This place is run by Ken, a really nice guy who invited us to his farm. The rooms are spacious, feature a fireplace (gas) and a fridge. Outside there is a grill. So you can get some meat from the store and have a BBQ at night.
    20151107_085418 20151107_085423 20151106_181636 20151109_110347 20151109_111625
  • From there it only takes about one hour to get to the entrance of Yosemite and about two hours to get to the trails. Probably longer due to taking pictures along the road.
    DSC_0093-002 DSC_0131-002 DSC_0127-002  DSC_0188-002
  • Hotels inside the park are expensive. But you can get a heated tent at a reasonable price at Camp Curry. But be prepared: It can be quite cold in November! But you wake up to an amazing view.
    DSC_0785 DSC_0714 DSC_0709 20151109_070719 20151109_065112 20151109_065108
  • Just right outside the park, at El Portal, there are a few Hotels where one can get a deal through Expedia. We stayed at the Cedar Lodge. But: No free Wifi, , no coffee, etc. But the rooms are ok. However, the food at this place is supposed to be pretty bad if you believe TripAdvisor ratings. It was supposed to be better at next to the hotel Yosemite View Lodge: The River Restaurant & Lounge. So this is where we went. The salad bar was great. Lynns Burger was burned (really totally black) at their first try, but she sent it back and got a good one quickly.
    DSC_0142-002
  • Getting food (some cheese, bread, juice and milk) for the hike at a local grocery store is probably the best option.
    DSC_0344-001 DSC_0348-001 20151108_094334 20151108_094326
  • Some of the hiking trails are paved with asphalt to be accessible for everybody. Some are a bit more difficult and go into the wilderness. The best way to select one that suits your skills is the Chimani Yosemite App. It is available for Android and iOS. They also have an app that features all National Parks in the USA. I really recommend getting it! The links point to the Android version in the Google Play Store since I do not have any iOS devices.DSC_0251-001 DSC_0270-002
    DSC_0255-002 DSC_0327-002
  • Wildlife in Yosemite Valley is not so wild anymore.
    DSC_0166-001 DSC_0763 DSC_0778 DSC_0801
  • Bringing some games along is a must for every board game fanatic! It is just a lot of fun playing in such a great environment. This time we brought Tash Kalar: Arena of Legends by Vlaada Chvátil (Czech Games Edition), Tiny Epic Galaxies by Scott Almes (Gamelyn Games) and Star Realms by Robert Dougherty and Darwin Kastle (White Wizard Games). All of theses games are very portable. For Tash Kalar I just carry the game board, cards and chips. Tiny Epic is tiny anyway and Star Realms is just a deck of cards.
    DSC_0536 DSC_0543 DSC_0564 DSC_0572 DSC_0567 DSC_0577 DSC_0292-002 DSC_0560 DSC_0556 DSC_0421-001 DSC_0418-001 DSC_0416-001 DSC_0407-001 DSC_0401-001
  • On the way back to San Francisco we stayed at Ken’s Motel again. Tiny Epic in the hotel room…
    DSC_0932 DSC_0931 DSC_0930  DSC_0928
  • Enjoy!
    DSC_0382-001 DSC_0376-001
    DSC_0522DSC_0520DSC_0519DSC_0518DSC_0517DSC_0516DSC_0515DSC_0383-001DSC_0363-001DSC_0768-001DSC_0798-001DSC_0806DSC_0815DSC_0819DSC_0829DSC_0867DSC_0897DSC_0899DSC_0292

Awesome window manager: Missing icons in Control Center

If you’re running the awesome window manager and are using the gnome-session or gnome-settings-daemon as well as the gnome-control-center you might have noticed it is missing some icons (see screenshot on the right).
This is due to an entry in the “gnome*panel*.desktop” files located in “/usr/share/applications”: 

OnlyShowIn=GNOME;

You can quickly fix this by changing it to:

OnlyShowIn=GNOME;Awesome;

Of course you do not have to do this by hand. Simply use this handy command:

sudo find /usr/share/applications/ -name "gnome*panel*desktop" -print 
 | xargs sudo sed -i 's/OnlyShowIn=GNOME;/OnlyShowIn=GNOME;Awesome;/g'

Python 3.4 and Django on Ubuntu 13.10

Why bother about Python versions? 

I recently started a new project creating a web application. As I have a lot of Python programming experience I chose Python with Django over Ruby on Rails. At the beginning of a new project I prefer using the latest versions of the frameworks the application will depend on. Starting now with Python 2.7 would mean that sooner or later there would be additional work porting the codebase to Python 3. Yesterday, Python 3.4 was released. One of the biggest improvements is that it has pip already included which makes handling virtual environments and installing the latest release of Django really easy.

Building Python from source

The downside is, that Linux distributions do not include the latest Python release yet. Most of them still ship with Python 2.7 as default version. The next Fedora and Ubuntu releases might change that, but for now you need to compile it from source. Luckily that is not a hard task. Go to the download page and grab the latest Python release (recommended if you read the post later and a newer version was released) or past the following command into a terminal.

First make sure you have everything installed to compile Python from source.

sudo apt-get install build-essential

Before downloading create a temporary directory to make the cleanup easier. At the end you can just delete “tmpPython”.

mkdir tmpPython
cd tmpPython
wget --no-check-certificate https://www.python.org/ftp/python/3.4.0/Python-3.4.0.tgz
tar xvf Python-3.4.0.tgz

After the archive is extracted, cd into the source directory. Create a directory to install to, then run configure, build and install.

cd Python-3.4.0
sudo mkdir /opt/Python34
./configure --prefix=/opt/Python34 && make -j4
sudo make install

Now you have Python 3.4 installed on your system.
Add the the path containing the executable to your environment.

export PATH=/opt/Python34/bin:$PATH

Also make sure to add this line to your .bashrc file (or .zshrc if you’re using zsh).

echo "export PATH=/opt/Python3.4/bin:$PATH" >> $HOME/.bashrc

Creating a virtual environment

Go to the directory where you want to create the virtual environment. I recommend /opt if you collaborate with others within the environment (you have to create everything with sudo) or your home directory if you work alone. Then run pyvenv to create it.
pyvenv-3.4 djangoEnv
source djangoEnv/bin/activate

The bash prompt changes to

(djangoEnv) mpei@earth /opt

and that means that you are now within this virtual environment.
This command shows you what you have installed:

pip freeze

Installing Django

Just use pip to install the latest version of Django and its extension:
sudo pip install django django-extensions

And you’re done! You can check the installed versions by running “pip freeze” again. Maybe another blog post on Django and databases? Or the first steps in Django? We’ll see… bye bye!

Organizing C/C++ includes

After starting my new job programming in a big software project I spent some thought on organizing includes and give a recommendation. Here’s what I’ve come up with. As always, some things are obvious, some are not…

  1. You should only include what is necessary to compile the source code. Adding unnecessary
    includes means a longer compilation time, especially in large projects.
  2. Each header and corresponding source file should compile cleanly on its own. That
    means, if you have a source file that includes only the corresponding header, it
    should compile without errors. The header file should include not more
    than what is necessary for that.
  3. Try to use forward declarations as much as possible. If you’re using a
    class, but the header file only deals with pointers/references to
    objects of that class, then there’s no need to include the definition of
    the class. That is what forward declarations are designed for!

    // Forward declaration

    class MyClass;

  4. Note that some system headers might include others. But apart from a few
    exceptions, there is no requirement. So if you need both
    <iostream> and <string> include both, even if you can
    compile only with one of them.
  5. To prevent multiple-inclusions, with loops and all such attendant horrors is having an #ifndef guard.

    #ifndef _FOO_H
    #define _FOO_H
      …contents of header file…
    #endif

  6. The order in which the includes appear (system includes and user includes) is up to the coding standard you follow.
  7. If you have the choice of picking a coding standard regarding the order at the beginning of a new project, I recommend to go from local to global, each
    subsection in alphabetical order. That way you can avoid introducing
    hidden dependencies. If you reverse the order and i.e. myclass.cpp
    includes <string> then <myclass.h>, there is no way to catch
    at build time that myclass.h may itself depend on string. So if later someone includes myclass.h but does not need string, he’ll
    get an error that needs to be fixed either in the cpp or in the header
    itself. 
  8. So the recommended order would be:
    • header file corresponding to its .cpp file
    • headers from the same component
    • headers from other components
    • system headers

If you use the Eclipse IDE (which I highly recommend), you can use a very nice feature that helps you organizing includes (“Source -> Organize Includes”).

5 Steps: Build a custom kernel in Debian Wheezy (…including NVIDIA drivers)

There may be many reasons to build your custom kernel. Either you have bought a new piece of hardware that is not supported by your current distribution, enable or disable features or just because you can.

Here are five easy steps to build a custom kernel on a debian system including NVIDIA kernel module. There may be way better tutorials on building a custom kernel out there, I just want to give you the essential steps that I use…

As I am writing this the latest kernel from the mainline is version 3.5. The latest stable release, which is what I recommend to build, is 3.4.6. But the following steps are for building the latest release from the mainline. 
So become root by typing “su” and entering your password in the console.
Make sure you have the requirements for building a kernel and the nvidia modules installed. If not you can install them by running:
$ apt-get install -f module-assistant build-essential

1. Download the full source code from kernel.org and extract it to /usr/src:

$ cd /usr/src/

$ wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.5.tr.bz2
$ tar -jxf linux-3.5.tar.bz2

2. Take the configuration of your current kernel by running:

$ make oldconfig
The script asks you for settings of features that were not available in your current kernel and therefore not available in the current configuration. I recommend to select the default values (by simply pressing ENTER several times).

3. Edit the kernel configuration

make xconfig

This will bring up a GUI that makes it easy to edit the kernel configuration.

4. Build the kernel, install the modules and install the kernel

$ make
$ make modules_install
$ make install

Then reboot the system. Boot the new kernel you installed by selecting it from the GRUB boot menu. The system will not boot to graphical desktop unless you have configured X to use the nouveau driver. So the last step is installing the NVIDIA driver.

5. Install the NVIDIA driver

Log in as root and run the module assistant to compile and install the NVIDIA kernel module.

$ m-a auto-install nvidia-kernel
After the installation is finished reboot the system and you’re done 🙂


Update: How to patch the custom kernel 

Kernel 3.5.1 was released. There is no need to Download the full source. You can simply download the patch and apply it to your source. Become root by typing “su” and your password and change to /usr/src.
Download the patch:
$ wget http://www.kernel.org/pub/linux/kernel/v3.0/patch-3.5.1.bz2
Extract it: 
$ bunzip2 patch-3.5.1.bz2
Change to source dir and apply the patch:
$ cd linux-3.5
$ patch -p1 < ../patch-3.5.1
Configure, build and install the updated kernel:
$ make oldconfig
$ make
$ make modules_install
$ make install
You also need to repeat the last step from above to rebuild the NVIDIA driver:
$ m-a auto-install nvidia-kernel
Reboot and enjoy the latest version of Linux 🙂 

TeX Live 2012

Last weekend, TeX Live 2012 has been released. Most Linux distributions are still stuck with TeX Live 2009. If you want to enjoy the latest versions of all TeX packages can download it from here.
Another huge advantage compared to using the package that comes with the Linux distribution is, that you can use tlmgr, the TeX Live package manager.
After unpacking the archive, move to the resulting
install-tl-* subdirectory and start the installation by running install-tl. Leave everything at default values and press “I” to start the installation.
This will take some time since the installer has to download all packages.
Then add the following to either your .bashrc or .zshrc depending if you’re using bash or zshell.
export PATH=”/usr/local/texlive/2012/bin/x86_64-linux:$PATH”
export MANPATH=”/usr/local/texlive/2012/texmf/doc/man:$MANPATH”
export INFOPATH=”/usr/local/texlive/2012/texmf/doc/info:$INFOPATH”
export TEXMFHOME=”/usr/local/texlive/2012/texmf”
export TEXMFCNF=”/usr/local/texlive/2012/texmf/web2c”
I suggest to add these lines also to the .bashrc or .zshrc of root.
If you want to update your Tex Live distribution later you now can simply type:
tlmgr update –all