Unmute the sound card using the ALSA utils

On Arch Linux all the channels are mute by default. To unmute your sound card you can do it manually in the ncurses-gui-based alsamixer of the alsa-utils package which looks like shown on the following picture.

MM means that the channel is muted wheras OO marks it to be unmuted. The vertical bars visualize the volume which can be turned up and down with the up and down cursor keys. The Master and PCM channels need to get unmuted to hear some sound from your computer.

The same job can be done with amixer with the sound card number, the channel and the volume controls as arguments.

amixer set -c 0 Master 25 unmute
amixer set -c 0 PCM 25 unmute

Each sound card is enumerated, the first is 0, the second is 1 and so forth. To find out the appropriate number of a card the declaration can be found out by executing aplay -l.

➜  ~  aplay -l                                                              [0]
**** List of PLAYBACK Hardware Devices ****
card 0: I82801CAICH3 [Intel 82801CA-ICH3], device 0: Intel ICH [Intel 82801CA-ICH3]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

The settings are stored in /var/lib/alsa/asound.state, to reload them after a reboot, the alsa daemon can be added in your /etc/rc.conf (on distributions not following the bsd style the system configuration file might differ).

...
DAEMONS=(... @alsa ...)
...

The @ symbol means that the daemon is started in the background which speeds up the boot time.

Other useful commands can be found here:
http://slopjong.de/2009/01/25/useful-mac-commands

DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare

Create an empty git branch

If a new git branch is created the code base is the same as in the master branch but sometimes you want to create an empty git branch without any ancestors.

Scott Chacon shows in The Git Community Book how this is done.

The trick is that no matter in what branch you are currently you just need to set the HEAD reference to your desired branch name and deleting the old git index.

From the master branch (or any other) you execute the following commands.

git symbolic-ref HEAD refs/heads/playground
rm .git/index
git clean -fdx 

In this example playground will be the new empty git branch. Adapt the reference refs/heads/playground to whatever you want it to be, e.g. refs/heads/your-new-branch.

DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare

Installing python modules in your home

If you are working on a computer where you need python modules that are not installed and you haven’t enough privileges you can install them in your home folder following these instructions:

cd lxml-2.3
python setup.py build
python setup.py install --home=~

In this example I’m compiling the lxml source. In the third line the setup script creates the directory structure ~/lib/python (notice that you just gave it ~ as the home option) and places the lxml module inside.

As a last step you need to add ~/lib/python to the path list set in the PYTHONPATH variable in your ~/.bashrc and if it doesn’t exist, define it.

DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare

Download files recursively with wget

With wget you can download files directly in a shell. If you want to download a whole site, known as downloading recursively, you can set the r option.

wget -r http://inkscape.gristle.org

By default wget respects the robots file and thus only downloads the non-private files. The protocol of the robots exclusion standard is pure advisory, this means that the robots.txt contains rules that a search engine or other robots are not allowed to access certain files but they might ignore them.

Wget can be adviced to ignore that rules and thus it downloads the private files anyway. Set the e option as shown next.

wget -e robots=off -r http://inkscape.gristle.org

Other useful commands can be found here:
http://slopjong.de/2009/01/25/useful-mac-commands

DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare

How does channel coding work using hamming codes?

In telecommunication and information theory, channel coding, also known as forward error correction (FEC), is a system of error control for data transmission, whereby the sender systematically adds redundant data to its messages, also known as an error-correcting code (ECC). The American mathematician Richard Hamming pioneered this field in the 1940s and invented the first FEC code, the Hamming (7,4) code, in 1950.1

As a showing example in a communication between two nodes, e.g. two computers, it can happen that the data get corrupted which means that one bit flips from 0 to 1 or from 1 to 0 due to electromagnetic fields or other physical disturbances. Channel encodings like the hamming code help us to avoid data loss or retransmissions due to transmission errors which occured on the way from the sender to the receiver and give the receptor the possibility to correct faulty bits directly as they arrive.

Beside the hamming algorithm there are other encodings of which some will be discussed in other articles coming at a later time. In this article you will learn how to calculate the redundancy bits using the hamming algorithm and how one-bit errors are detected and corrected. The howto is divided into three sections, the first describes how the hamming code is generated, the second briefly describes the transmission and the third is about detecting and correcting bit errors.

Continue reading »

DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare