Thursday, December 26, 2013

This is England

This 2006 British film is set in the England of the early 1980's. It shows the skinhead subculture through a group of bored youths in a nondescript English town. One of the members is of Caribbean descent and they all seem to get along fine, with the characteristic dress code, pins etc. Apart from their looks, what distinguishes them from the rest of society may be the language where 'f***' and 'f***ing' appear obligatory in every sentence. At least once, but possibly more often.

Problems appear when the group is invited to join some far-right National Front sympathizers, thus illustrating how part of the skinhead movement got contaminated by the extreme right. Some of the original group decide to go with the psychopath that takes them to a pathetic National Front meeting. After that, things become more violent and the film does not have a happy ending.

The sound track is very good.

Overall, the film provides a fascinating glimpse of the skinhead subculture.

☆☆☆☆

Tuesday, December 24, 2013

Birth date: getting the creation time of an ext4 file

The ext4 file system type stores the actual birth date/time of a file, unlike most other Linux file system types. Normally, one would expect that, using the stat system call, the corresponding stat command would be able to show this birth date.

Unfortunately, this is not the case, as illustrated next (see an earlier post for the code of devof). We use blkid to obtain the type of the file system stored on a device.

$ sudo blkid $(devof file)
/dev/sda2: UUID="bla-bla" TYPE="ext4"
$ stat --format="%w" file
-

It seems that the programs that can/should show a file's birth date are not yet updated. According to this stack exchange entry, only debugfs can currently be used to actually show the birth date.

$ ls -id file # get inode number of file
12061569 file 
$ sudo debugfs -R 'stat <12061569>' $(devof file)
Inode: 12061569   Type: regular    Mode:  0664   Flags: 0x80000
Generation: 2431365914    Version: 0x00000000:00000001
User:  1001   Group:  1001   Size: 551
File ACL: 0    Directory ACL: 0
Links: 1   Blockcount: 8
Fragment:  Address: 0    Number: 0    Size: 0
 ctime: 0x52b9e4e6:597d4918 -- Tue Dec 24 20:47:50 2013
 atime: 0x52b9ebd9:429a6374 -- Tue Dec 24 21:17:29 2013
 mtime: 0x52b9e4e6:57950118 -- Tue Dec 24 20:47:50 2013
crtime: 0x52b9e049:977a1be0 -- Tue Dec 24 20:28:09 2013
Size of extra inode fields: 28
EXTENTS:
(0):27330211

The following lscrtime script shows the birth date for each argument file in such a form that is easy to sort.

#!/bin/bash
readonly USAGE="lscrtime file.."

function fatal() {
  echo "fatal error: $1" 2>&1; exit 1
}

for f
do
  [ -e "$f" ] || fatal "$f not a file";
  ff=$(readlink -f "$f") # follows symlink, yields full path
  inode=$(ls -di "$ff" | awk '{ print $1}')
  dev=$(devof "$ff")
  fstype=$(sudo blkid ${dev} | sed -e 's/.*TYPE="//' -e 's/".*//')

  [ "$fstype" == "ext4" ] || fatal "works only with ext4 FS"

  crtime=$(sudo debugfs -R "stat <${inode}>" $dev 2>/dev/null |
    grep 'crtime:' | sed -e 's/.*-- //'
    )
  birth=$(date --date="$crtime" +"%F %T") # yyy-mm-dd hh:mm:ss
  echo "$birth $f"
done

Le Fils

A gripping Dardenne film about Olivier, a father who, by chance, meets the teenager Francis, who, 5 years ago, killed his son in a bungled theft. The two meet because Francis wants to learn carpentry which is taught by the father. The film's pace is slow and pleasant: as a viewer you only learn about the murder background after 30 minutes or so. Although nothing much happens, I was glued to the screen, fascinated by the evolution of the relationship between Francis and Olivier.

☆☆☆☆

Saturday, December 14, 2013

Finding the device where a file is stored.

Most references that I found while searching for a simple way to find the device where a particular file is stored pointed to the df command. However, this does not work if the file is managed by a 'virtual' file system type such as ecryptfs that automatically encrypts its stored contents.

  me@pc :~$ df file.txt
  Filesystem        1K-blocks     Used Available Use% Mounted on
  /home/me/.Private 237996696 173473232 52433916 77% /home/me 

One solution could be to take the 'virtual' filesystem and use df to find its underlying file system etc. until a 'real' file system representing a storage device is found.

  me@pc :~$ df /home/me/.Private
  Filesystem     1K-blocks      Used Available Use% Mounted on
  /dev/sda1      237996696 173473824  52433324  77% /

Another way is based on the full pathname of the file: simply find the longest prefix of the file's pathname that corresponds to a mounted device from /dev.
The bash script shown below shows how to do this:
  1. Use the readlink command to obtain the full 'canonical' pathname of the input file name.
  2. Select all /dev devices that are currently mounted from /etc/mtab. The second column of /etc/mtab, referenced as $2 in the awk program, contains the mount point. Since the first character of a string is at index 1 in awk (instead of 0, as in C), the test
    (index(fnm, $2) == 1)
    succeeds iff fnm, which was imported into the awk program using -v fnm=$path, has the mount point $2 as a prefix. In such a case, the mount point path is printed.
  3. After sort, the mount point that is the longest prefix is the last line of the output, selected using the tail command into the $mpoint variable.
  4. It only remains to retrieve the device mounted on $mpoint by selecting appropriately from /etc/mtab.

#!/bin/bash
readonly USAGE="devof file"

function fatal() {
  echo "$1" 2>&1; exit 1
}

[[ $# == 1 ]] || fatal "usage: $USAGE"
[[ -e "$1" ]] || fatal "'$1' not a file";

# readlink -f: follow symbolic links
path=$(readlink -f "$1")
# get paths that are mount points of /dev/* devices
# select those mount points that are a prefix of $path
# grab the longest prefix path $mpoint
mpoint=$(egrep '^/dev' /etc/mtab |
awk -v "fnm=$path" \
    '{ if (index(fnm, $2) == 1) print $2 }' |
  sort | tail --lines=1
)
# now print the device that is mounted on $mpoint
egrep '^/dev' /etc/mtab |
  awk -v "m=$mpoint" '{ if ($2 == m ) print $1 }'

If you are interested in learning more about bash, I can highly recommend this Bash Guide, which assumes that you already know the basics, as explained e.g. in this tutorial.

Saving Grace

A British comedy (2000) set in pittoresque Cornwal, mostly in the village of Port Isaac. Coincidentally, this is the same village where, later, also Doc Martin would be filmed. The main character of the series, Martin Clunes, plays the village doctor in 'Saving Grace' as well.

As in the Doc Martin series, Cornish people all seem to be eccentrics, so one wonders whether this is actually true. The story is simple: a recent widow discovers that her late husband left her with lots of debts and tries to save her house by growing marijuana. This leads to a number of predicatable jokes, e.g. most of the village's inhabitants unknowingly getting stoned.

I was not impressed.

☆☆

Tuesday, December 10, 2013

Google options and alternatives

Like most people, I knew that it is possible to restrict the domain of the results of a google search. E.g.
site:.fr unpopular president
which would only show results from France.
It turns out that there are plenty of other options (indicated by a keyword such as site followed by a colon (:). The best description I could find was in this Wikipedia article.
Here is a list of the options:
stocks: site: intext: allintitle: intitle: allinurl: inurl: cache: link: related: info: filetype:
The effect of each option should be clear from the name, e.g. allintitle: will only return pages that have all query terms in their title while filetype:pdf will only show pdf documents satisfying the query. See also xkcd about file extensions.

DuckDuckGo

If you're worried about privacy, an excellent alternative to Google is DuckDuckGo which promises, among other things, not to track you. The results I got were similar to Google's. In any case, you can have your search request forwarded to Google by adding !g to your query.

Some DuckDuckGo Options
There's lots of other interesting options, some of which are shown on the picture.

Monday, December 9, 2013

Parenti Serpenti

Also known as Dearest Relations, this is an excellent comedy. The scene is a small Italian town where an old couple receives their grown-up children and grandchildren for the end of year festivities. The film starts as a nice portrait of the local traditions surrounding Christmas etc. The relationships between the siblings, and their partners, are not perfect but that only adds to the charm. As does the fact that the old father is clearly loosing his marbles, which greatly annoys his wife.

Things get nasty when the old mother declares that she and her husband want to live with one of their offspring. This leads to a lively discussion among the children, none of them being keen on welcoming their old parents into their home. All will be resolved in the end, in a most hilarious (and cynical) manner.

☆☆☆☆

Tuesday, December 3, 2013

Pepi, Luci, Bom y otras chicas del monton

This is an early (1980) film by Pedro Almodóvar. It follows three women: Pepi, the lesbian rock singer Bom, and Luci, a masochist married to a Franquist policeman. The story is set in post-Franco Spain, illustrating the newly found sexual freedom that went with the reinstatement of democracy.

While there are some funny episodes, I found the film rather boring.


OECD's PISA report for 2012 is out

The results of the 2012 Program for International Student Assessment (or PISA) are out. The document "What 15-year-olds know and what they can do with what they know: Key results from PISA 2012" makes for very interesting reading, although it only details the results for Mathematics.

Flanders did rather well, again.

For Mathematics, it came, together with Switzerland, 9th (out of 64) after Shanghai, Singapore, Hong Kong, Taipei, Korea, Macao, Japan and Liechtenstein(!). The UK ended up 26th and the US 36th.

For Reading, Flanders got a score of 518, putting it in the 10th position after Shanghai (570), Hong Kong (545), Singapore (542), Japan (538), Korea (536), Finland (524), Taipei (523), Canada (523) and Ireland (523).

Finally, for Science it did rather less well and ended up with a score of 518, putting it in 17th place after Shanghai (580), Hong Kong (555), Singapore (551), Japan (547), Finland (545), Estonia (541), Korea (538), Vietnam (528), Poland (526), Canada (525), Liechtenstein (525), Taipei (523), Germany (524), The Netherlands (522), Macao (521), Australia (521).

Sunday, December 1, 2013

Les Femmes du 6ème étage

A film with two of my favorite French actors, Fabrice Luchini and Sandrine Kimberlain cannot be all bad. In fact, this is an excellent 'feel good' movie. The title "The women on the sixth floor" refers to the floor containing the "chambres de bonnes" in a building otherwise filled with large apartments for the bourgeois that employ the people living on the 6th floor.
The story is set in the early 1960's. Jean-Louis Joubert (Luchini), a financial advisor, becomes infatuated with the new Spanish maid, Maria, who has her own worries, including a child left behind in Spain. His wife (Kimberlain) suspects that he is having an affair with a society figure and kicks him out. He moves to a tiny room on the 6th floor in the same building. This is the first time in his life that he has his own room, and he enjoys it tremendously. He ingratiates himself with the other servants living there.
Unfortunately, Maria leaves for Spain to reunite with her son, without telling him. Still, all ends well (of course) after a while. A pleasure to watch.
☆☆☆☆

Saturday, November 30, 2013

Blogger or Wordpress?

I like the default look of this blog on Blogger: simple, stylish and easy to read. Still, there's a few things that I don't like:
  • E.g. the 'pop-ups' urging you to involve Google+ in your posts. I don't mind being reminded once but they keep at it in a most annoying way.
  • Also, I'm amazed that I am reduced to using the on-line editor to prepare posts. Why can I not simply use my favorite editor vim to prepare a post and then upload it?
  • Finally, it's OK to use <pre> and <code> for source code but for longer excerpts, syntax coloring and highlighting of selected lines is highly desirable. Syntaxhighlighter is OK but it is not exactly easy to use while prettify is too primitive. Compared to that, Wordpress provides an easy to use interface to SyntaxHighlighter which has everything you need and then some.

So I wondered whether I would perhaps be better off with Wordpress?

Tim Brooks provides a detailed comparison of Wordpress and Blogger from which I conclude that I'd better stick to Blogger unless I use the self-hosting method: installing wordpress, which is open source under the GPL license, on my own server. On Ubuntu, it seems trivial to install Wordpress.

Sapore di mare

This film ("Time for Loving" in English) can cause double nostalgia: for the 1960's in which the story is set, and for the 1980's when it was made. The latter is evident to me from how the story is developed, it reminds me of some toe-curling French comedies like "Les Bronzés". There the humor is so bad that it becomes hilarious. So it is with "Sapore di mare": I loved it although it is very mediocre.

The story is about youngsters on holiday in Viareggio on the Tuscan coast and how they enjoy themselves with members of the opposite sex. There are the obligatory stereotypes: an older woman with a nerd, a 'player' from a rich family, a naive and initially innocent girl with a modest background, an experienced English girl (!) etc. Apparently there is a sequel, so it must have been a big success at the time.

☆☆☆

Thursday, November 28, 2013

The best tutorial on Monads

I like monads and Haskell, although I'm not a frequent user, and I remember that it took me a long time to grok monads. It may be that I'm a bit slow. Anyway, I finally got there.

Yesterday, however, I stumbled upon a tutorial that, had I read it before, would have saved me a lot of time:

You Could Have Invented Monads! (And Maybe You Already Have.).
So, if you are struggling with monads, give it a try. I wish I did at the time.

Concatenating .avi files

I thought it would require the use of a sophisticated video editing tool. However, it turns out that in Ubuntu it's dead easy.

    avimerge -i file1.avi file2.avi -o outputfile.avi

Avimerge lives in the transcode package, so you may have to do the following first.

    sudo apt-get install transcode  


Wednesday, November 27, 2013

La Grande Bellezza

The english title is The Great Beauty. The beauty here refers to the city of Rome, and probably more specifically its night life. The main character, Jep Gambardella, is a writer who wrote only one book, which was a huge success. After that, he got distracted by the temptations of Rome and became a journalist and society figure who 'knows everyone'. The film consists of several loosely connected little stories, often moving and/or funny involving e.g. a 'saint' nun, modeled on 'mother Teresa', a gastronome cardinal, a midget editor etc. Many scenes play on the terrace of Jep's apartment, overlooking the Colosseum, a fantastic view at night.

One quote that I liked:

.. a friend, every now and again, needs to make their friend feel as a child.

The strong point of the film is the atmosphere it creates. It has been compared with other great movies about Rome, see the wikipedia article. Although, it is not as good as the 'originals', it is well worth watching.

☆☆☆☆

Thursday, November 14, 2013

Ripping a DVD and hard-wiring subtitles

One way to back up a DVD is just to copy its 'raw' contents, resulting in a file like movie.iso which contains all DVD data files organized as an iso-9660 file system. We use the dd command to copy from the raw DVD device.
DEV=/dev/sr0 # name of DVD reader device
ISO=movie.iso # name of target file
umount ${DEV} # dd works on unmounted devices
dd bs=32000000 if=${DEV} of=${ISO} ||
  { echo "dd from $DEV failed"; exit 1;} 
To get access to the files, we can mount movie.iso in read-only mode.
ME=$(id -u) # our user id to 'own' the mounted file system
sudo mount -t iso9660 \
  -o ro,loop,nosuid,nodev,uid=${ME},gid=${ME},mode=0777 \
  ${ISO} /mnt || { echo "mount ${ISO} failed"; exit 1; }
Now we can explore /mnt and find it has a directory video_ts which contains files as in the example below.
$ ls /mnt/video_ts

video_ts.bup  vts_01_0.vob  vts_02_1.vob  vts_02_6.vob
video_ts.ifo  vts_01_1.vob  vts_02_2.vob  vts_02_7.vob
video_ts.vob  vts_02_0.bup  vts_02_3.vob  vts_02_8.vob
vts_01_0.bup  vts_02_0.ifo  vts_02_4.vob
vts_01_0.ifo  vts_02_0.vob  vts_02_5.vob

$ du -sm . # how many megabytes do these files take?
7590
There are two video sequences represented by the .vob files with names starting with vts_01 and vts_02 respectively. Looking at the total sizes of these files, it is clear that the main movie is stored in vts_02_0.vob...vts_02_8.vob.
It is also clear that, partly due to the use on most DVD's of the older mpeg-2 codec, the video sequences take a lot more space, almost 8GB, than if they were encoded with a more efficient codec. Still, media players such as vlc can play the movie.iso file, including handling menus, choosing subtitles etc. as on the original DVD.
If we want to save space, however, we can convert the vts_02_0.vob...vts_02_8.vob sequence to a single .mp4 file in our home directory. For this we can use the avconv command.
cat vts_02_*.vob | avconv -i pipe:0 ~/movie.mp4
Due to the better codec, the size of movie.mp4 is now about 1.5GB, a huge improvement while maintaining quality. Unfortunately, if the original DVD provides a choice of subtitles, they will not be included in the copy. A simple solution would be to make a copy that has one of the subtitle languages hardwired into it.
Apparently, DVD's store subtitle information in so called SPU (SubPicture Units). Essentially, these are images containing the subtitle text that are presumably inserted at the appropriate moments in the video stream. The SPUs come with an index which indicates at what time which picture of the selected subtitle language has to be shown.
So, one way to solve the problem would be to find a program that is able to extract the subtitle data (and index) and then define a post-processing filter that would add the subtitles in the chosen language.
Surprisingly, there seems to be only one program under Linux that supports the definition of a filter as described above: the avidemux video editor. Fortunately, avidemux also contains a tool to extract the SPU data and index from the video input. Unfortunately the command line interface for avidemux does not seem to support subtitle manipulation, so we are forced to use the GUI (Graphical User Interface).

Click 'open' button to load video file(s).
Clicking the indicated button lets us select a video file, we take the first one from the vts_02_*.vob sequence. Normally, we'd expect to select all the following files in the sequence but apparently Avidemux cleverly does that automatically.

It may be that Avidemux takes a while to load the file(s) because it indexes them. Once the movie has been loaded, not much has changed on the interface but see the arrows on the next image.
Clicking on the indicated button will show information on the format of the movie, as shown in the pop-up on the right.

The movie is loaded.
Properties of the loaded movie.
Now, we are ready for the extraction of the subtitle information. Click on tools in the top bar (not shown) and select VOB -> VobSub. A window pops up, shown on the right below, where you select the first .vob file (the same as was used to load the movie into avidemux), the accompanying .ifo file: vts_02.ifo and finally, a file name prefix that will be used to store the subtitle information that is about to be extracted. Note that the latter file cannot be in (under) the /mnt directory since /mnt contains a read-only file system.
Clicking OK starts the process and will produce two files: vts_02.sub and vts_02.idx containing, respectively, the subtitle images and the index describing when they have to be displayed.
Finally, we define a filter which will add subtitles in a selected language to the video output to be produced by avidemux. For that we first define the (container) format and the video codec, as shown on the left below.
Clicking on Filters under Video brings a pop-up menu where we select the subtitle menu that inserts "vobsub" frames. Double clicking on the "vobsub" selection brings up another menu where we select the file ~/tmp/vts_02.idx containing the subtitles information. Once that is done, we can also select the subtitle language that is to be hardwired into the output.

After all that, we are ready to produce the output. This is done by clicking the Save (next to Open) button. "Save" may not be an intuitive name for what is essentially a video transformation process but, since avidemux is mainly a video editor, it actually makes sense.

Wednesday, November 13, 2013

Google Backup for ISP DNS Servers

I'm using a standard WIFI setup where the ISP also provides the DNS server. In ubuntu Network Manager, this can be seen under connection information where the address of the DNS server is listed as '192.168.1.1', i.e. the ISP-provided router.

Recently, there were some problems: I could connect to machines using their numeric address (e.g. 91.189.90.58) but not using their 'name' (e.g. 'www.ubuntu.com'). It followed that the ISP's DNS server was down. It came back up after a few hours, but I decided that I needed a backup DNS server.

Fortunately, Google provides free public DNS servers at addresses 8.8.8.8 and 8.8.4.4.

After a lot of searching, I finally found out that defining these extra backup DNS servers is not done via the network manager but via the configuration file for the DHCP client which lives in

/etc/dhcp/dhclient.conf
For my purpose, it was sufficient to add the following line to this file:
append domain-name-servers 8.8.8.8 and 8.8.4.4;
Et voilà: next time the ISP's DNS server packed up, the system seamlessly switched to Google's servers.

Tuesday, November 12, 2013

Nmcli and keeping an eye on the VPN

Virtual Private Network (VPN) connections are often used by particular applications such as P2P clients. If, for some reason, the VPN connection goes down while the underlying non-VPN connection to the ISP is still up, the P2P client may continue operating "in the open", which may be undesirable e.g. because the use of the client is illegal in the ISP's country.

Below is a small script that regularly checks the VPN connection and, if the connection is down, stops the application that we wish to only operate over the VPN.

Landstander wrote a bash script to do just that. It contained a few errors, which were corrected by sgleo87 here.

Thanks to this script, I learned that the (in)famous NetworkManager used by Ubuntu can be accessed using a command line program, called nmcli. The program can operate on 3 objects: 'dev' (devices), 'con' (connections) and 'nm' (the network manager proper). The main operations that can be performed on an object are 'status', 'enable' and 'sleep'. The script below uses the 'status' operation on 'con', which outputs a table containing data on each connection. One of the columns is called 'VPN' and for each connection there'll be a 'yes' or 'no' entry indicating whether the connection represented by the row is a VPN connection or not.

My version of the script is shown below. The main change is that this version does not attempt to restart the application when the VPN connection is back. The rationale is that since the admin needs to take action to restart the VPN, she might as well restart the application. There are also some more sanity checks and comments.

#!/bin/bash
PROGRAM=myprogram # the program to be stopped if VPN does
EMAIL_ADDRESS=jj@gmail.com # the admin's email address

function fatal() {
  echo "fatal error: $1" 2>&1; exit 1
}

while true 
do
  pid=$(pidof ${PROGRAM}) || fatal "pidof ${PROGRAM}"
  # nmcli 
  #   -t : terse
  #   -f VPN: print 'VPN' column
  #   con: object, the connections
  #   status: command, output status table
  # grep -c: prints count of matching lines
  ok=$(nmcli -t -f VPN con status |  grep -c yes) 
  echo -n "$(date): "
  if [ $ok -gt 0 ]
  then
    echo "ok"
  else
    echo "ERROR: VPN DOWN, KILLING ${PROGRAM}"
    kill -9 ${pid}
    # warn the admin
    mutt -s "VPN DOWN" ${EMAIL_ADDRESS} </dev/null
    exit 1
  fi
  sleep 1 # seconds to wait between checks
done

Using Gmail via Mutt

Often, using a command line mail client is much more efficient than e.g. a web-based one. Some example cases:
  • If, like me, you have a Gmail account, it is, as far as I know, not possible to easily use the Gnu Privacy Guard without resorting to encrypting files "by hand" and then uploading them as attachments. It wouldn't make much sense anyway, decrypting stuff on Google's servers for all of the NSA to see.
  • Another use case for a command line mail client is when you want to send mail from within a script. E.g. the following bash script fragment sends a message with an attachment and a subject line:
    mutt -a picture.jpg -s "a subject" jj@gmail.com <<EOF
      As promised, the picture is attached.
      Blah blah.
    EOF
    
    where mutt refers to the, imo, best command line mail client program.

Luckily, you can use the Gmail service as an IMAP server for your preferred command line mail client.

Below are the instructions to set up mutt such that it will use Gmail to send and receive messages. Note that any message sent/received will also be available on line, i.e. in the folders of your gmail account.

  1. First, you need to install mutt. In ubuntu
    sudo apt-get install mutt
    
    On my 13.10 ubuntu system, also the mail server postfix was installed and the system prompted for postfix configuration options. Since I was not going to use postfix, I selected 'no configuration'.
  2. Next you fill in the configuration file called .muttrc in your home directory. The instructions can be found on the GMailOverIMAP page of the Mutt developer resources site and are merely repeated here.
    set imap_user = 'yourusername@gmail.com'
    set imap_pass = 'yourpassword'
    
    set spoolfile = imaps://imap.gmail.com/INBOX
    set folder = imaps://imap.gmail.com/
    set record="imaps://imap.gmail.com/[Gmail]/Sent Mail"
    set postponed="imaps://imap.gmail.com/[Gmail]/Drafts"
    
That's it.

Showing source code in a post

Since I'm interested in computer science, I'll probably want to show some source code at some point in the future. There appear to be many possibilities, of which I looked at 3.
  1. The obvious way would be to use <pre> like so:
    int fib(unsigned int n) {
      if ( n <=1 )
        return n;
      else
        return fib(n-1) + fib(n-2);
    }
    
    unsigned int a[] = 
      { fib(1), fib(2), fib(3) };
    
  2. Using SyntaxHighlighter: this gives nice results but the method seems complicated and I wondered whether something simpler is available.
  3. Google-code's prettify seems simple enough. Here's the input: <script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script> <pre class="prettyprint lang-cpp"> int fib(unsigned int n) { ... </pre> And here's the result:
    int fib(unsigned int n) {
      if ( n <=1 )
        return n;
      else
        return fib(n-1) + fib(n-2);
    }
    
    unsigned int a[] = 
      { fib(1), fib(2), fib(3) };
    
    So adding one "script" line gives you syntax coloring and a box around the code.
I guess, I'll use (1) or (3).

Sunday, November 10, 2013

xkdc

I belatedly discovered xkcd and now I'm hooked: wasting time hitting that "random" button. Here's an example:

Friday, November 8, 2013

Gianni e le donne

This delightful comedy seems to be a prequel to Pranzo di ferragosto . The main character, Gianni, is the same. Only he's still married and his mother lives in her own home, which she manages to squander without her son getting any say.
The film is mainly about the attempts of the middle-aged Gianni to seduce a young woman, any good looking one. He's been put up to this project by his lawyer friend who seems as desperate as he is. Moreover, he discovers that a far older and fatter acquaintance of his manages to get it off with a voluptuous blonde running a neighborhood shop.
Needless to say, all his attempts come to nothing. The women he tries to woo usually make use of his services (cooking, walking the dog, finding bottles hidden by their daughters, ..) but fail to succumb to his charms.
I found Pranzo di ferragosto slightly more hilarious, but also this movie is well worth watching. ☆☆☆☆

Sunday, November 3, 2013

The Naked Civil Servant

This is a 1975 TV film based on the autobiography of Quentin Crisp. The strange title was coined by him. Since, for several years, his main source of income was modeling (naked) in (state) art schools, he considered himself a "naked civil servant".
Crisp was a very effeminate gay man, and he made no effort to hide the fact: dyeing his hair, using make-up etc. Before the second world war, and even afterwards, this honesty was not without risk: the film shows how he got beaten up on several occasions, just because he looked "abnormal". The term used at the time for his "condition" was "sexual perversion". The scene were the army refuses to take him because of this "perversion" is hilarious.
All in all a very entertaining movie and a reminder that anti-gay bigotry existed in Europe for longer than I thought. E.g., amazingly, practicing homosexuality was illegal in the UK until 1967: ☆☆☆.

Saturday, November 2, 2013

Il est plus facile pour un Chameau...

The title of this film refers to a statement by Jesus, according to Matthew 19:24 for the experts, that
"... it is easier for a camel to go through the eye of a needle than for a rich man to enter the kingdom of God. "
And that is the subject of the film: the rich heiress Frederica, played by Valeria Bruni Tedeschi feels uncomfortable about being rich. Her boyfriend, a committed leftist, is no help since he thinks property is theft. Besides moaning about her condition, e.g. she repeatedly bothers a priest with her "problem", there is precious little she actually does about it. The story did not convince me at all and a number of the characters seem superfluous.

The only parts I actually enjoyed were the flashbacks to Frederica's childhood which were delightful. Especially the one where she is kidnapped and manages to convince (a) her kidnappers that she is a communist too, and (b) her father that the kidnappers are nice people and that he should invite them for dinner.

All in all, a very mediocre film: ☆☆

Putting images in a post

Loading an image into a post on Blogger is easy: there's a fairly recognizable icon representing a picture above the editing window.
When you click that, you get to select an image, either locally or from a number of other sources.
Selecting a layout for the image.
Next you are asked to select a "layout" as shown on the left. If you choose "left" or "right", text will float around the image. If you choose "center", it will not. The text coming right after the image (in the HTML view) will "flow" next to the image. So the easiest way to insert images may be to first prepare all the text, then put your cursor where you want an image to appear and click the image icon.
Note that while uploading (from the HTML view) an image, you don't get the chance to put a caption for the image. You can do that afterwards by switching to the 'Compose' view and then clicking on the image.

By the way, the above screenshot was produced using the excellent gnome screenshot program which should be available on most Linux distributions. It certainly came with my Ubuntu 12.4 system.

Thursday, October 31, 2013

Pieds nus sur les limaces

In this beautiful movie, Ludivine Sagnier plays Lily, a young woman with the mind of an unruly child who cannot be trusted to take care of herself.

Ludivine Sagnier as Lily
Lily lives happily with her mother in the countryside and enjoys nature in many, not always conventional, ways. E.g. she doesn't mind having slugs (the "limaces" from the title) crawl over her and she has an office where she skins small animals to make slippers. When her mother dies unexpectedly, her conventional sister Clara, a lawyer, attempts to enlist the help of a neighbor to keep an eye on Lily. When that does not work, she feels obliged to move in with Lily and only see her husband at weekends.

Gradually, Clara starts to loosen up and becomes more like Lily. In the end, the exasperated husband seems to have disappeared and both sisters try to make a living selling furry slippers and home-made marmalade from their roadside stand.

A well-made "feel good" movie with excellent acting and lots of bucolic views of the sunny French countryside: ☆☆☆☆

Wednesday, October 30, 2013

Pranzo di ferragosto

Possibly the best comedy I have seen this year. The English title is the literal translation of the original: Mid August Lunch. Not sure why "lunch" is there but "ferragosto" refers to an ancient festival around thet 15th of August when all self-respecting Romans have fled the heat of the city.

Except those that cannot afford to go, such as the protagonist, the middle aged Gianni, who lives with his ancient (93) mother in an apartment for which they are behind with the rent. A friend is prepared to help them out on the condition that they take in his elderly mother as a lodiger, while the friend is away on amorous business. As a result of some other events, Gianni ends up as the host of four old women.

Not all of them are well-behaved and they cause him a lot of problems. E.g. he has a hard time fighting off the advances of one of them. Admirably, he never looses his temper and I really appreciated how he was able to pamper all of his guests, not in the least with his fantastic cooking.

This was one of those movies that I fondly remember long after I have seen them: ☆☆☆☆☆

Tuesday, October 29, 2013

Manuale d'amore 3

Also known as "The Ages of Love" was made in 2011.

This romantic comedy features three independent stories about "love", bound together by a cupid offering some brief comments. The first story is the best, it is set in a lovely Italian village and contains some hilarious scenes. The second and third are somewhat related as they concern people living in the same building in central Rome. In the second story, a media personality gets involved with a nymphomaniac and lives to regret it, although probably not for long (the living). The third one illustrates that it is never too late, even after a heart transplant, to team up with a young but experienced woman.

An uncomplicated well made comedy that was a pleasure to watch: ☆☆☆.

Thursday, October 24, 2013

Gouttes d'eau sur pierres brûlantes

This is a very good film made in 2000 by François Ozon of Swimming pool fame but I hated watching it.  According to wikipedia, the film is based on a play by Rainer Werner Fassbinder, and this German origin shows in the decor and the sound track.

The acting is great as is the story. But the story is depressing and the characters represent horrible people. So, to me, it was a very good 'feel bad' movie. ☆☆☆