Go to content Go to search

Facebook, physical proximity in the virtual world and multilingualism in South Africa · Wednesday April 6, 2011 by Rudolf Vavruch

The effect of Facebook on daily life

As a web programmer, when a website changes or breaks or acts differently from the expected norm, depending on the situation I either feel sympathy or anger towards the developers / sysadmin / production manager etc. And hope that they will fix it soon.

I have noticed that this isn't the case for many of my friends and acquaintances who are not involved in the construction of the web. As the web opens up to more and more people it has become part of their daily lives. When a site - such as Facebook - changes or breaks - it is a 'thing' in their lives. Their day and their mood can be affected by code changes performed by someone thousands of miles away.

There is a Japanese word or phrase that describes the feeling or relationship a person has with an inanimate object. The love of a pair of shoes, an iPhone, the begrudging love of a troublesome car etc. It seems that this now includes the "virtual" world as well.

The physical location in a virtual world

When my girlfriend calls me on the telephone, she asks,"are you at the flat / work / whatever". When she starts chatting to me online she asks, "are you here?"

In a sense when speaking to her online I am speaking to her from within her Gmail, her web browser.

Someone once wrote that the reason so many ordinary people get "net rage" is because someone has dared to post something offensive directly into their sanctity of in their own private space.

Whether that is true or not, there is a perception of a person being physically closer to you when reading something from them online than is actually the case.

Multilingualism in South Africa

As a white South African I can speak English and Afrikaans more or less fluently. I cannot however speak any of the native languages. This has recently started to bother me. In effect I am a foreigner in my own home country since I cannot speak a language that 80% of the people living around me speak.

True, I doubt most Xhosa's can speak Zulu and most Zulu's can't speak Tswana, etc. But no matter where I am, I am in a language minority.

Comment

Advertising and selling music on the web · Sunday November 22, 2009 by Rudolf Vavruch

I was surprised to discover how little some musicians know about the possibilities for advertising and monetisation the Web offers them. You don’t even need to know much more than how to use a web browser to make the most of these many of these services.

Everyone knows about MySpace and Facebook, and arguably every band should have a presence on both of them. There are also MySpace alternatives such as Virb to investigate.

There are a gazillion other music sites carving out their own niches such as Pandora, iLike, lala, MOG, Spotify to mention a few.

However, personally I think the following are the holy trinity of music sites that every band should have a presence on:

Last.fm

The original idea behind Last.fm goes like this: you install a program that watches the action in your music player (Rhythmbox, Winamp, iTunes, etc.) and saves what you listen to a your account on the site. Then based on what people with similar taste enjoy it recommends other bands you may enjoy.

From a band’s point of view you can upload tracks for users to discover your music online. There is a pay to play scheme flowering there.

My recommendation: If your band page does not exist yet (they get automagically created when someone listens to a track of yours), create it. Make sure there are sexy photos of you and that the write-up is informative. Suggest bands you might be similar to. Upload some tracks for users to get to know you with, possibly even give them a track or two to download so they can listen to it over and over again until it is enscribed on their brain. Lastly make sure that any MP3s you release are tagged properly so that Last.fm can pick it up.

The Sixty One

Using game mechanics the creators of this site inspire users to discover new music and to push—Digg-style—their favorite music to the top of the pile. They have a store where you can buy music from artists as well.

My recommendation: If you’re not on there, get on there now. Upload your tunes and interact with your fans. It’s a great way to expose yourself to a wider audience.

Bandcamp.com

You have a beautiful website, and you want your fans to listen to your music and be able to buy high quality music from it but you don’t have the know how, the hard drive space or cash to pay for the service. Enter bandcamp. They provide the platform for fans to listen to music and to buy a number of different file formats from you. The site isn't geared to be browsed or explored, rather it is intended that you link to your band’s page directly from somewhere else.

They give you a lot of options for how you want to sell your music. Set price, name your own price, certain types of format for free / different price, etc.

My recommendation: If you don’t have player and store on your website (and even if you do, bandcamp is worth a look) check them out.

Other things to do

Tag your MP3s. Seriously. If you put any music in MP3 (or other file format) out there at all, do yourself and everyone else a favour and tag them properly, that means your band name and the song title minimum.

Give your listeners a few free full length tracks to download, even if they are lower quality. Unless you have a deal with a major record label that can pay your way onto radio, or you regularly tour all over the world, where else are people going to hear it? Why restrict your listener base to only those that can make your gigs? Give fans the benefit of the doubt and let them get to know you.

If you’re looking for a way to distribute your music in blog posts or send people links they can listen to, I recommend having a look at SoundCloud, one of the best music distribution sites I have come across.

At the end of the day it is all about marketing yourself and providing potential fans with an easy way of getting to know you and existing fans an easy way of getting their paws on your music, and the sites mentioned in this post provide a great way to do that.

Comment

Bash script to download SXSW podcasts · Monday November 2, 2009 by Rudolf Vavruch

For the last few years I have listened to the podcasts from SXSW while travelling to work or more recently while at gym.

Each year the number of podcasts has increased to the point where this year I am now too lazy to click through to every page and DownThemAll!. Besides it’s more fun to write a bash script to do the heavy lifting.

You will need …

  • cURL
  • grep
  • uniq
  • wget
  • bash version 4 or above. If you don’t have bash 4, there are slightly different instructions for you.

Except for cURL, and maybe wget, everything else should come standard with your Linux distro. To check which version of bash you’re running enter the following at the command line:

echo $BASH_VERSION

Consult your distro’s documentation on how to install anything you might be missing and continue to the next section.

The script

Open your favorite text editor and copy and save the following into a new file (I called mine getpodcasts.sh):


#!/bin/bash
for i in {0..13..1}; do
	curl -s http://2009.sxsw.com/interactive/news/videos_and_podcasts/more?page=$i | grep -o 'http.*\.mp3' | uniq | wget -i -w 2 -
done

Let’s go through the script line by line:

#!/bin/bash
The first line tells bash what interperter to use for this script. You could replace /bin/bash with /usr/bin/python or /usr/bin/php if you had written the script in python or php.
for i in {0..13..1}; do
This starts the bash for (start..end..increment) loop. This type of for loop will only work in bash v4 and above. If you are using an older version of bash, find out more about other for loops. I got the number 13 from their web page. There are 13 pages.
curl -s http://2009.sxsw.com/interactive/news/videos_and_podcasts/more?page=$i
The next line will be broken up into its’ components. You can try each component from the command line to watch how the text output gets transformed as we add components to the command. First is the cURL instruction, here we’re using it to download and spit out SXSW HTML pages. cURL normally prints out its’ progress, but the -s tells cURL to be silent. The URL ends with an $i which is incremented with each pass of the loop. Essentially the for loop and cURL are downloading podcast pages one page at a time.
grep -o 'http.*\.mp3'
Grep searches each line of the downloaded pages for anything that looks like an MP3 URL, -o tells it to print out only the matching part of each line.
uniq
Removes duplicates. The grep matches at least two of the same podcast on each page, and uniq condenses this down to one only. Ordinarily I would use sort -u to first sort and then remove duplication, but since the returned data is already sorted we can just use a uniq.
wget -w 2 -i -
Finally we start downloading the podcasts with wget. The -w 2 tells wget to wait 2 seconds in between each download. This is just to be friendly to the servers. The -i - tells wget to use stdin (the text piped through from uniq) as input file for download links.

Finally

Save your script and chmod it so that it can be executed:

chmod u+x getpodcasts.sh

Run it:

./getpodcasts.sh

It may take a moment while cURL downloads the initial web page (and then every 4 or so podcasts it will pause again), but soon you should be up to your ears in podcasts.

P.S.

If all you want is a list of podcast URLs in a file, there are 2 things you need to do. Firstly change the 3rd line to:

echo `curl -s http://2009.sxsw.com/interactive/news/videos_and_podcasts/more?page=$i | grep -o 'http.*\.mp3' | uniq`

ie. Drop the wget, add an echo in the front and wrap the whole line in '`' (not sure what they're called).

Secondly run the script like so to save the data in a file called podcasts.txt:

./getpodcasts.sh > podcasts.txt

Comment [1]

Inside every DVD is a small movie trying to get out. Part 1: A quick guide to K9Copy · Monday July 20, 2009 by Rudolf Vavruch

The problem with backing up a regular store bought movie DVD is that it simply won’t fit into a normal blank DVD. The movie DVD is a 9GB monster, and the blank a svelte 4.4GB. There are two solutions to this: reencoding and transcoding. This article is a quick guide to performing a transcode using K9Copy (similar to DVDShrink) on GNU/Linux.

Simplifying terribly, reencoding takes the better part of a day or longer and the result is an .avi or similar file. These are so much smaller than the original that you can fit four or more reencoded movies onto a single 4.4GB DVD, but they won’t play in a regular DVD player. On the other hand a transcode takes about an hour and results in a single movie on 4.4GB DVD, which will play on a regular DVD player.

Transcoding works by lowering the quality of the movie to make it smaller. The smaller the desired end result, the worse it is going to look, but with a normal sized movie you shouldn’t be able to tell the difference.

You will need

  • To have successfully consulted your distros documentation and installed K9Copy.
  • I’ve heard that you will need about 8GB of hard drive space free. Never tested this.
  • Optional: Also have installed MPlayer.

Method

  1. Insert the DVD you want to copy.
  2. After it has loaded, open K9Copy.
  3. Press Open. I think this is the biggest barrier to entry in this program.

  4. K9Copy should load a tree structure showing all the titles available on the DVD.

    A DVD can contain up to 99 titles, one of them will be the movie you’re looking for. The others are things like menus, extras, trailers and warnings. As a rule of thumb the largest title is the one you’re looking for. To check you have the right one, run the following in the command line (replace n with a number from 1 to 99):

    mplayer dvd://n

    Other things to try while viewing in Mplayer is pressing “#” to cycle through the audio tracks in the title and “j” to cycle through subtitles.

  5. Open the title you want. Don’t be confused by the titlesets, you want the title, in the image below the title I want is number 1 (mplayer dvd://1) but it is part of titleset 5 - I honestly don’t know what titlesets are).

    You can transcode the entire DVD: menus, extras, trailers and all, but those take up space which will leaves less space for the actual movie, and the end result may suffer. So it’s a tradeoff, I tend to only keep the main feature.

  6. Under the title, select the video, audio, and subpictures (subtitles) you want to copy. In the image below I have selected the video and only one audio stream, for this movie I don’t need the other audio streams nor do I need any of the subtitles.

  7. Select Copy, find somewhere to save it, and wait.

First the DVD will be copied to your hard drive and then formatted into an .iso image that you can easily burn to a blank DVD. If you want to check your iso image before burning you can do so with this command (replace filename.iso with the name of the file you created):

mplayer dvd:// -dvd-device filename.iso

As before you can cycle through your audio and subtitle tracks to see that they are all there.

Note: You will not be able to see any copied menus in MPlayer, these will only show up when you place the burnt DVD into a DVD player.

Hope this helped you, in part 2, I will describe reencoding a DVD into an H.264 mkv file.

PHP cURL over SSL · Friday July 17, 2009 by Rudolf Vavruch

If you’re getting stuck trying to use cURL over https in PHP, try setting both the verify peer and verify host options to false:


$url = 'https://myverysecret.domain/secrets/';
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_exec($curl);

Comment

PAM and the Bad password blues · Monday May 25, 2009 by Rudolf Vavruch

Warning: Only try this at home! Using weak passwords on a computer that this is accessable from the wild and dark Internet, is tantamount to walking up to a spammer and saying “I’d simply love to be part of your zombie network—where do I sign up?”. I could safely do the following because this server is not accessable from the Internet and never will be, it's a local test box for my own personal use.

I was creating a new user on a local CentOS 5.3 VirtualBox and while I was setting the password I received the following error: BAD PASSWORD: it is based on a dictionary word

After soul searching I found I didn’t feel coming up and then remembering a complicated enough password to make PAM happy, ie. not a dictionary word, long enough etc.

So I spent a while reading up on PAM—which, as it turns out, is a small team of alluring ladies and well worth stealing a look at. Turns out my problem has a name, and that name is pam_cracklib.so. Ms. CrackLib will diligently check a new password against her dictionary and then check whether it is significantly different from the previous version, whether it is long enough, etc. Much of what she does is negotiable, but the dictionary check in the beginning she won’t budge on.

So either we mess with her dictionary reading abilities—by say giving her a blank dictionary or hiding her glasses—or we take her out of the loop completely. I opted for the latter and set about cutting her out of my life.

The surgery took place in /etc/pam.d/system-auth. I took the following liines:


password    requisite     pam_cracklib.so try_first_pass retry=3
password    sufficient    pam_unix.so md5 shadow nullok try_first_pass use_authtok

and turned them into:

#password    requisite     pam_cracklib.so try_first_pass retry=3
password    sufficient    pam_unix.so md5 shadow nullok try_first_pass

Just commented out the pam_cracklib.so line and removed the use_authtok from the line below, otherwise passwd complains about Authentication information cannot be recovered

Comment

SQL - Find the last DISTINCT items · Tuesday April 7, 2009 by Rudolf Vavruch

This took me a while to figure out, so thought it worth documenting. Here is a simplified example that explains the problem and solution, tested on MySQL 5.0.

An office worker keeps track of who she has contacted. After a while she builds up a table as follows:

id contact
1 josef
2 harry
3 sally
4 pudding
5 pudding
6 sally
7 harry
8 sally

Now she needs to see who she contacted the most recently and in what order. In other words, with the above data she wants the following list: sally, harry, pudding, josef.

Her initial immediate reaction is SQL like this:


SELECT DISTINCT contact FROM table ORDER BY id DESC;

This returns the correct data, but in the wrong order: pudding, sally, harry, josef. This is because DISTINCT seems to remember only the first instance as it appears in the table, all the rest are considered duplicates and ignored.

After some effort, the solution turns out to be not to use DISTINCT, but rather GROUP BY and ORDER BY MAX() to invoke magic:


SELECT contact FROM table GROUP BY contact ORDER BY MAX(id) DESC;

Excitingly that returns the correct data in the correct order. We could still use a DISTINCT in there, but it is superfluous and would add unnecessary computation, GROUP BY does the job of DISTINCT.

The example could be further complicated. For example the the table could have a timestamp added (ORDER BY MAX would work on that too), and a user id so that multiple office workers could use it (include a WHERE user_id = x to find only for a particular user).

Drop in the ocean · Tuesday December 30, 2008 by Rudolf Vavruch

Wikipedia is one of the most visited sites on our planet. Yet it remains almost eriely devoid of advertising. Instead they cover their running costs from donations given by grateful users.

I use Wikipedia daily. As a way fo saying thanks and as vote of confidence in what they are doing in the project, I have decided to donate $10 a month to Wikipedia. Call it an early News Years Resolution. Or a freely given subscription to my favorite encyclopedia.

Wikipedia Affiliate Button

Comment [1]

YSlow: Two page hits for the price of one! · Monday December 29, 2008 by Rudolf Vavruch

While working on a custom logging class in a Kohana PHP application, I noticed that the test log message was being written twice. Not only was it being written twice but the duplicate log entry was being written with a separate pid (see posix_getpid()).

In the Firefox output there was only one pid. Flumoxed I hunted through my code trying to find something that would cause a ninja version of the application to run. Finally in the Apache logs I saw that there were two hits made for each refresh.

That got me thinking. I had recently installed the YSlow addon in Firefox, and had set it to Autorun in the hopes of becoming more better acquainted with it through daily use. Turning Autorun off fixed the problem. YSlow obviously reloads the page in the background each time you refresh.

I haven’t done front-end work in while so I can safely leave YSlow off until I do. I am looking forward to making full use of YSlow.

As a foot note, I am finding Kohana PHP a joy to work with and I recommend anyone who is using or considering using a PHP framework to a have look at it.

Comment

Monitoring bandwidth with bwm-ng · Tuesday October 7, 2008 by Rudolf Vavruch

I discovered how to watch the bandwidth of server today using a tool called bwm-ng. It’s in the Ubuntu Hardy repos, you can install with the following command:

sudo aptitude install bwm-ng

When you run it in a terminal without parameters, it displays a running update of how much bandwidth is being used. This makes it a handy tool to get an immediate idea of what your network traffic is like, and there are also options to examine disk IO. Besides the “live running commentary” mode, it can also output in other forms as well, for example CSV.

To create a poor man’s ntop, i.e. generate a log file of a servers bandwidth throughput over time; I wrote a script that is cronned every minute, the interesting part looks like this:

bwm-ng -o csv -c 6 -T rate -I eth0 >>bandwidth.log

Here‘s a run down of what the parameters do:

-o csv
Output to CSV format. Annoyingly you have to download the tarball from the site linked above to get the file which contains the legend for the CSV generated. Why not just include it in the man page? Being the considerate type I have included this information later in this post.
-c 6
Print only 6 reads. Not 6 lines, but 6 reads of all the interfaces, including a total line.
-T rate
Type rate. Show only the rate, other options for this parameter are avg and max. Without this parameter the output also show amount of data and packets transferred.
-I eth0
Comma separated whitelist of interfaces to show. Can also be used to blacklist interfaces. Even with only one interface this still prints a total line.

This generates the something which looks like this:

1222420795;eth0;526.73;237.62;764.36;120;266;1.98;3.96;5.94;2;1;0.00;0.00;0;0
1222420795;total;526.73;237.62;764.36;120;266;1.98;3.96;5.94;2;1;0.00;0.00;0;0

And as promised the legend for the output:

unix_timestamp;iface_name;bytes_out;bytes_in;bytes_total;packets_out;packets_in;packets_total;errors_out;errors_in

All this data is then appended to a file called bandwidth.log ( >>bandwidth.log).

Previous