English
Get Spotify working with PulseAudio on Ubuntu Linux
I had problems getting Spotify to work under Ubuntu and Wine, with a Microsoft LifeChat LX-3000 headset. The sound chopped 2-3 times per second.
Using OSS and normal Wine worked fine with the internal sound card of the laptop, but not with the USB headset.
I found this discussion thread and tried different remedies. The one that worked was Neil Wilson's fork of Wine, WinePulse, with support for PulseAudio.
You can update your system with unsupported packages from this untrusted PPA by adding ppa:neil-aldur/ppa to your system's Software Sources. Not using Ubuntu 9.10 (karmic)?
Läs mer: Release Packages : Neil Wilson
Review: Burnt by the Sun at the National Theatre, London, UK
(this review written in March 2009, but I forgot to post it so here it comes)
Summary: A reasonably well executed performance, conveying a very important insight. Go see it if:
- You have not seen the movie it is based on
- You prefer everything to be in English,
- Or just strongly prefer the stage before the screen.
However the movie in my mind surpasses it. But with some work it could get closer. Some of Kotov's lines and lines of reasoning are great in the play.
This review contains spoilers.
The play "Burnt by the Sun" is based on the superb film by the same name, by Nikita Michalkov. Peter Flannery has adapted it to the stage. Before the performance I listened to Flannery talking about how he adapted the film.
Not enough shouting and pauses :-)
Act 1 (of 2) suffers from not enough shouting, physical acting and meaningful pauses in conversation. Emotions need to be acted out stronger whether they are from feelings of (true or feigned) joy, or from anger and malice. In film you get away with small gestures due to the camera's focus, but on stage stronger stuff is needed, especially if you do not use a spotlight. The play starts off unfocused emotionally due to this. Another way to get more focus to act 1 (besides shouting then) would be to cut down on the number of characters on stage. Two or three of the datja's inhabitans could have been cut from the script. Possibly rewriting lines to have more punch. This is all rectified in act 2 where fewer people on stage leads to stronger focus, and the language gets more direct.
The play stays eerily true to the film: Before seeing the play I hadn't realised that every scene and nearly every line of that film is etched in my memory. It was therefore easy to check off lines and plot devices as they came, and suffice to say that Flannery has not touched anything he wasn't forced to due to a different format.
Affability
In the last scene of the play Rory Kinnear's Mitia comes off a bit too affable and emotionaly worked up, interspersing opera singing with his Russian roulette. Sitting still in a chair, reciting a children's rhyme and squeezing the trigger on numbers in the rhyme would be more consistent with the temperament of the character and his slavic devil-may-care attitude. He comes off as a bit too much of an affable tragic case now, like Jeremy Iron's Sebastian Flyte, or Klaus-Maria Brandauer's Hendrik Höfgen, while it is clear that Mitia knows exactly what game he is playing. He could probaby still do the opera bit, but jump into some ridiculous pose before each pull to cut to the core of the character.
Kinnear does a good job otherwise in a demanding role and Ciaran Hinds as Kotov grows as the play progresses, but he needs to throw his weight around more in act 1. The actress playing the daughter does a perfectly good job. The play moves on quite swiftly and make it hard to evaluate the other performances in depth.
During the interview with Flannery that I attended I got interested in seing other things he has written. I like his ambition of presenting multiple views at the same time, and what seemed to be a humanistic approach, being mature enough not to cling to some extremist ideology. His work seems to be a quest for knowledge.
Compared to the movie the play more clearly depicts the main conflict as duty-egoism, but also subverts this by showing that also tough man Kotov can break, and just from one sentence. There is also a budding feminist angle present in the play that is missing in the film. Flannery actually lets the wife speak up a couple of times about what she thinks of the situation. Flannery did mention that in the film the wife acts like a child, and the daughter more as a wife, and that he reversed this for the play, also to get some load off the actress playing the daughter.
One reason I went to see this play, that I stumbled upon due to me meting a friend and mixing up BFI and the National Theatre (the serendipity of being a tourist) and getting last minute tickets, is that I was curious about if it could help me figure out how much of the strength of the movie comes from the technical and artistic performances and how much comes from the drama itself.
When the play ended, I was as gripped of the drama of the story as ever before. And the end of the stage play is the same as in another film of the 90s, La Haine.
HD Video from Canon HF200 on Ubuntu Linux - convert and play
Notes to self on how to play videos from the camera on my Linux computer.
The files that the Canon HD video camera outputs have the suffix MTS. These can be played by Videolan client on my Dell Celeron-equipped laptop. Well, kind of: It plays the first two frames or so, then chokes on the video and keeps playing the sound.
The mts files can be converted to other formats with ffmpeg. The video from the Canon camera seems to be interlaced. If you use ffmpeg straight off the bat like so:
ffmpeg -i canonvideo.mts -sameq video.mp4
lines will be all wavy because the canon format is interlaced. Use the -deinterlace option like this:
ffmpeg -deinterlace -i canonvideo.mts -sameq video.mp4
The mp4 file then plays effortlessly with vlc on the computer.
It should be possible to make the output interlaced as well, with the ilme option
However this:
ffmpeg -i 00002.MTS -sameq -flags ilme video.mp4
still creates wavy lines. There are a number of idioms with ilme in them floating around the Internet, and I am not sure how to use it.


Slow motion a video and save to file
This guide shows you, on Linux, how to make a slow motion video of an mp4 video (in this case downloaded from Youtube), with the pitch of the sound intact. There is probably a one-line command to do this in mencoder, ffmpeg or vlc, if so please enlighten me. This guide starts with a terse summary, and then continues with a more verbose explanation.
Summary
You need:
- mencoder (part of mplayer)
- ffmpeg
- sox
All are open source and freely downloadable.
Assume the video is called "normal.mp4", that should be made into a slow motion video called "slomo.mp4", with the pitch intact so we do not get those grovelling noises.
First to slow down the video to half speed, use mencoder, part of mplayer:
mencoder -ovc copy -oac mp3lame -speed 0.5 normal.mp4 -o slow.mp4
Extract the sound with ffmpeg:
ffmpeg -vn -i slow.mp4 slow.wav
You may now discard the slow.mp4 file.
Pitch it up:
sox slow.wav slow_but_pitched_up.wav pitch 1200
Make a slow version of normal.mp4 with no sound:
mencoder -ovc copy -nosound -speed 0.5 normal.mp4 -o slow_no_sound.mp4
You can put sound and video together with with mencoder:
mencoder -ovc copy -audiofile slow_but_pitched_up.wav -oac faac slownosound.mp4 -o slomo.mp4
or use ffmpeg:
ffmpeg -i slownosound.mp4 -i slow_but_pitched_up.wav -map 0.0 -map 1.0 slomo.asf
(the sound needs to be compressed above, methinks)
If you can make an mp4 file instead of an asf file, so much better. On my machine it complained about not having the correct codec for sound; I am still looking into that.
Slow motion an mp4 video on Ubuntu Linux 9.10
--longer explanation and screenshots --
If you watch a video in vlc, you can slow it down, the sound is slower but stays at the original pitch, which is neat. I was unable to find a "Ok, good, now play through this and save it to a file" setting in vlc, so below is the road i treaded to finally convert a video file into a slow motion video file, with pitch intact.
First to slow down the video to half speed, use mencoder, part of mplayer:
mencoder -ovc copy -oac mp3lame -speed 0.5 normal.mp4 -o slow.mp4
This will slow the video down to half speed, but unfortunately it also speeds down the sound. Mplayer has a switch for affecting the pitch but mencoder does not pick it up.
The -speed flag above indicates the speed, with 0.5 being half speed.
So far I have been unable to make mencode preserve the pitch (i.e pitch shift it back), but sox can pitch shift. However it only operates on sound files. So, the sound of the mp4 file needs to be separated out, then sox can operate on it, then we combine the sound and video again.
Separating out the sound
On my Ubuntu 9.10 I hade to install "libavcodec-extra" to get it to work. The command is like this:
ffmpeg -vn -i slow.mp4 slow.wav
Now sox can operate on it. AFAICT sox should be able to read mp3 too, but not on my machine, despite library installations and hand waving.
Pitching up the sound
Now sox can pitch it up
sox slow.wav slow_but_pitched_up.wav pitch 1200
Sox is special in that it wants the input and output files first, and then after them, the command line arguments. Sox has a flag called "pitch" pitch takes among other things a percentage value, where 100 is one semitone, and hence 1200 is an octave. We want an octave shift since we slowed down the the video to 50%, and an octave is a doubling of frequency (pitch).
Combining slow motion video and pitched up sound
Now we need to combine the sound and the video.
You can put sound and video together with with mencoder:
mencoder -ovc copy -audiofile slow_but_pitched_up.wav -oac faac slownosound.mp4 -o slomo.mp4
There is some problem with that file though since ffmpeg reports:
Seems stream 0 codec frame rate differs from container frame rate: 29.97 (30000/1001) -> 14.99 (15000/1001)
It plays fine in vlc, though
You can use ffmpeg like so:
ffmpeg -i slownosound.mp4 -i slow_but_pitched_up.wav -map 0.0 -map 1.0 slomo.asf
If you can make an mp4 file instead of an asf file, so much better. On my machine it complained about not having the correct codecs with ffmpeg.
vlc has a gui for combining sound and video for different files. First, for it to work I had to produce a slow version of the video with no sound, so rerun the command from the beginning of the guide, but make a video file with no sound:
mencoder -ovc copy -nosound -speed 0.5 normal.mp4 -o slow_no_sound.mp4
Then the GUI in vlc can combine them. Start vlc and choose "Convert/Save" from the "File" menu:

In the dialogue, select your slow motion file with no sound. Tick "Show more options", "Play another media synchronously" and click "Browse" to add extra media, and select the sound file there.

Click "Converts/Save" in the above dialog, and you get the below dialog:

Here you have to experiment a little to select a profile that uses codecs that
- you have on your system
- vlc realises you have on the system
Happy slow motioning!
There is this command in vlc, I wonder if it could be used for something:
--audio-time-stretch, --no-audio-time-stretch
Enable time streching audio (default enabled)
This allows to play audio at lower or higher speed withoutaffecting
the audio pitch (default enabled)
How to use the reverse-i-search in bash
A quicker alternative to hitting the up arrow to get back the old command that you typed some time ago, is to hit Ctl-r, and then type a substring from the command you're looking for.
For example if you want to type "ssh -p 1022 username@ahost.domain", if you have typed it before you can just hit Ctl-r follwed by 1022 .
If you do not get the command you are looking for, hit Ctl-r again and it will find the next line in your command history that fits the pattern.
If you want to go to some other command press ctrl+r again to move backwards This will speed up your whole process
Läs mer: Just another Programmer: reverse i search for linux users
Getting hard disks up to DMA speed on Proliant ML110/CentOS Linux
A machine that I use as a home server, a HP Proliant ML110 G5, has taken very long to copy large files. A 5GB file seemed to take about 3 hours. This is of course wholly unreasonable. Something must be wrong, but where? I suspected it wasn't using DMA mode, which is a quicker mode of data transfer. Googling around I found that the hdparm should be able to check DMA mode and set it if not enabled. Well hdparm reported it was not set and furthermore that it could not be set. A hint that something was wrong was also that the drives where identified as /dev/hd*, not /dev/sd*. So further googling revealed it could be a BIOS setting. I looked into BIOS but everything was OK there. Eventually I found this page that says that the correct kernel driver may not be loaded, and instead a generic very conservative driver is loaded:
Google suggests booting with ide0=noprobe ide1=noprobe to make sure the ata-piix driver is used. If you don't want to reinstall then make sure initrd contains the ata-piix driver and that references to /dev/hd* are replaced with /dev/sd* in fstab etc.
Read more: [CentOS] Re: DMA mode
So the question is: Do I have the ata-piix driver on my system? It is probably not a good idea to disable something and not having the thing you want to have enabled, installed. It turns out the file you should be looking for on the file system (at least on my CentOS) is called "ata_piix", not "ata-piix".
I edited the menu.lst file in the grub directory of the /boot directory to include "ide0=noprobe ide1=noprobe" as parameters (You may want to make a new boot option for this so you can easily go back). I then rebooted and edited fstab to mount the new /dev/sd* devices after checking in /dev what they were, and rebooted again.
Before and after
Before the performance according to hdparm was like this:
/dev/hda:
Timing cached reads: 5052 MB in 2.00 seconds = 2526.92 MB/sec
Timing buffered disk reads: 10 MB in 3.71 seconds = 2.69 MB/sec
[root@firefly ~]# hdparm -tT /dev/hdc
/dev/hdc:
Timing cached reads: 4920 MB in 2.00 seconds = 2460.83 MB/sec
Timing buffered disk reads: 10 MB in 3.71 seconds = 2.70 MB/sec
[root@firefly ~]# hdparm -d1 /dev/hdc
And now it is like this:
[root@firefly ~]# hdparm -tT /dev/sda
/dev/sda:
Timing cached reads: 4948 MB in 2.00 seconds = 2475.64 MB/sec
Timing buffered disk reads: 180 MB in 3.02 seconds = 59.53 MB/sec
[root@firefly ~]# hdparm -tT /dev/sdb
/dev/sdb:
Timing cached reads: 4840 MB in 2.00 seconds = 2421.36 MB/sec
Timing buffered disk reads: 286 MB in 3.02 seconds = 94.67 MB/sec
So a neat improvement on buffered disk reads of factor 35 or 35 000% on my second disk, and an improvement of factor 22 or 22 000% on the slightly older drive. Copying the 5GB file now seemed to take around 2 minutes, which is an even bigger difference in speed.
Here is some background information on SATA in Linux and drivers.
How to change default application for a file type in Gnome
Find a file with the file suffix that you want to be opened by the application. Right click on the file, select "Properties", and on the "Open with" tab click the radio button in fron of the desired application.
The reason I did not find this option at first, is that the "properties" context menu are properties of the individual file (or should be at least), and not of the file type, meconsiders.
hi im using gnome and when i try to change my default application for like mp3's or anything by using **right click file > properties > open with tab > and select applicatio
Läs mer: Cant change default application /'open with' in gnome - Ubuntu Forums
Clone & max out resolution on both screen-projector in Linux
Summary: Use
sudo xrandr --output VGA --pos 0x0
If your projector is called VGA. Read on for more detailed info
How to clone your screen with a projector, when they have different resolutions
I have a Dell vostro 1015 laptop with a resolution of 1366x768 pixels, and an Epson Emp-tw420 projector with a resolution of 1280x720 pixels. I run Ubuntu 9.04. Problem is when I hold a presentation I want to clone the screen of the laptop to the projector, and a negotiation starts and I end up with a measly 1024x768 on both screens. This is the highest resolution that both screens support. It is a waste of pixels especially on the projector's side.
The solution is to tell Ubuntu to have both screens active side by side (or one above the other), and set the maximum resolution of each and then use the xrandr utility to set both screen to start at the the top left (0x0).
If you type xrandr in a terminal you will get information on both screens and one will have an offset, expressed something like:
VGA connected 1280x720+1366x0
In this case VGA is the name it has given to my projector, 1280x720 is the resolution and 1366x0 is the offset of the screen. the trick is to move the offset to 0x0 so that the screens show the same thing. You do this if your projector is called VGA with:
sudo xrandr --output VGA --pos 0x0
So now I have the same output on both screens at full resolution. The projector does not show the rightmost 86 pixels and the lowermost 48 pixels of the laptop's screen. But that is quite OK as long as I do not need to run in 1024x768.
You could probably achieve this in xorg. conf but the above command is convenient as is. I had to manually set the aspect ratio to wide on the Epson projector afterwards.
Review Dell Vostro 1015
Summary
The Dell Vostro 1015 is a capable machine with
- a good screen
- good battery life (according to Dell, not according to me, if you get the small battery)
- good connectivity
- a good webcam
- a good price,
... but is somewhat let down by its substandard keyboard and touchpad.
Keyboard and touchpad
+

The keyboard is the part of the 1015 that I least agree with so far. It flexes in the middle a bit, mushy in feel, but the tops of the keys are spaced ok with a gap in between them. The Pg Up and Pg Down keys are awkwardly placed; they are in a column with Home above and End below them. I would have preferred them to be positioned left and right of the up arrow key instead. Keys are a bit unresponsive and some key presses of mine are not recorded as I type if I type with a light touch. No back lighting of the keys.

The touchpad is too small and has a scroll function along the right and bottom edges that I don't agree with. This scroll functionality can be shut off in the OS, but I would have preferred the scroll strips to be separated from the touch pad, and in the best of worlds, I would like to do apple style finger combinations on the touch pad.
Update: I have just enabled software in Ubuntu Linux on the machine, that allows multi touch with two finger scrolling, yay!.
Connectivity 



- Bluetooth
- 4 USB ports
- VGA
- Wireless
- Gbit Ethernet
- 56K modem
- IEE1394 (Firewire)
- ExpressCard slot
...are all Included but no HDMI, and the wireless does not handle 802.11n draft. There is also a built in web cam with a generous 2mpix resolution, and it gives sharp video. 4 star rating due to inclusion of Firewire and Bluetooth on such a cheap laptop and a decent resolution on the web cam.
Ports 


Left hand side ports: VGA (outside of picture), Ethernet and two of the USB ports. The ExpressCard port cover has the blue LEDs for power, networking. Bluetooth and hard disk activity shining through it from the front. BTW manufacturers, go back to red LEDs, they are much less intrusive in the dark
There are no connectors on the back side. Instead they are on the left, right and front edges which I believe is par for the course nowadays. Placing them along both sides means you get locked in by cables while sitting. As an example the power cord is on the right hand side and the Ethernet cord on the left hand side. So when you stand up, lifting the laptop out of your lap, you're trapped. If the VGA port on the left hand side traded places with the power connector's, 90% of the time you could have all cables on the left hand side only. The sound connectors are in the front which means when connected, the cable connectors poke into your belly.
Screen 

+
The only reliable high contrast screen laptop manufacturers are Apple and Sony, but Dell often has very good brightness and contrast on their laptops (see notebookcheck.net). The screen of the 1015 is bright, but I suspect the contrast is just OK. The vertical viewing angle is narrow. Contrast trick: tilting the screen slightly away seems at least subjectively to increase contrast and there is enough brightness anyway. The screen is not blank but instead has a matte surface, so no glare from light sources behind you. The screen is fairly low resolution at 1280x800 1366x768. The store where I bought it lists the resolution as 1280x800 on their site, but the xrandr program on my machine reports it to be 1366x768 pixels. This gives it a 16:9 aspect ratio, which is the HDTV aspect ratio.
Battery life ?
According to Dell it has a good battery life, but on Ubuntu Linux I get about 90 minutes which is not so good. That is with the 4 cell battery and with full backlighting and WiFi and Bluetooth switched on, no DVD activity. Linux is known to be much worse at power consumption so possibly the battery life would be better under Windows, something I have not tried. The Linux program dmidecode reports the battery to have a 22Wh capacity which is kind of on the low side for a battery in a laptop. Dell Sweden does not carry the 1015 at all, Dell UK carries it but not the batteries, but on the Dell US site one can see that the 6 cell battery at 48Wh, has more than double the capacity of the 4 cell. Some versions odf the 1015 ship with a 6 cell battery.
Verdict
It is cheap, especially with a low end processor like the Celeron-equipped one that I bought. If you tolerate the keyboard and touchpad it is a good buy.
I got mine pre-built from a third party since I needed it urgently and there was a significant difference in price in that store up to the C2D. Had I had the time to order one custom built directly from Dell it would have been with a C2D and bigger battery. Actually after looking at the Swedish Dell store I see that they do not carry the 1015. How odd. Dell UK seems to carry it and judging from the hits on this article my guess it is also available in Germany, Poland and India (but I haven't checked).
Had I gone with the more expensive pre-built C2D I probably would have been irritated with the mushy keyboard for the price so I made the right call. Again for the price the screen is quite good. I have had it a week now, and so far it delivers for the price. The Celeron model I got was as noted pre-built and has the small 4-cell battery and I have not had time to check how long the battery lasts on Windows (I am chiefly running Linux on it which may shorten battery life compared to Windows).
How I got a Toshiba with Radeon Xpress 200M to work on Ubuntu 9.04
My Toshiba L30-149 just presented garbage on screen after an upgrade from 8.04 to 8.10. It persisted in doing so when I continued the upgrade to 9.04. I used the below guide. The proprietary fglrx driver was replaced and after that I stopped getting garbage on screen and instead got a login screen.
This guide will show you how to use the Free, Open Source driver for many ATI graphics cards called "radeon" or "ati". It will provide 2D and 3D acceleration in your video hardware. This driver is not as fast as the closed-source, proprietary "fglrx" driver from AMD/ATI Inc. for some cards, but has better dual-head support, and supports some older chipsets that fglrx does not.
Läs mer: The open source ATI driver (xserver-xorg-video-ati) - Community Ubuntu Documentation