TimedLoginEnable=trueOnce done, restart gdm (this will force an immediate logout):
TimedLoginDelay=10
TimedLogin=myusername
$ sudo /etc/init.d/gdm restart
TimedLoginEnable=trueOnce done, restart gdm (this will force an immediate logout):
TimedLoginDelay=10
TimedLogin=myusername
$ sudo /etc/init.d/gdm restart
This blog post describes how to control your MPlayer media playback using the Hama MCE remote control on Linux. The instructions and software were tested on Ubuntu Jaunty, but they should work on any Linux 2.6 system which has sysfs mounted and which has USB HID support compiled to the kernel (can be checked with ls -l /sys/bus/usb/drivers/usbhid).
The instructions are for the model Hama MCE Remote 52451, also known as VRC-1100, but similar instructions might work with other remotes as well.
If you want to use the Hama MCE with XBMC, see these instructions.
The Hama MCE dongle, when connected to the USB port of a Linux machine, registers itself as two USB HID devices: a keyboard and a mouse. Most of its buttons generate regular keyboard events, for example, the numeric keys correspond to numpad keys, and its Enter key corresponds to the Enter key. You can use its mouse controls to move the mouse or click (the left and right buttons). On Ubuntu Jaunty, even the volume buttons work (they adjust the master volume).
However, if you don't want to use your Hama MCE remote as a regular keyboard or mouse, but you'd like to control MPlayer (and possibly some few other applications you specify) with it, then you need special software. LIRC, the de facto standard remote control driver and server does support USB HID devices in general, but the Hama MCE sends some quite unusual events which LIRC seems to be impossible to make recognize. (For example, the hashmark button sends Shift, 3 and 5, and some other buttons send Shift or Control too, and LIRC doesn't seem to be able to track the Shift and Control state, which would be needed to distinguish some buttons from each other.)
So I've implemented my own lircd, hama_mce_lircd.py, which can read button presses and other events from the Hama MCE remote, and it can broadcast them to applications via the socket /dev/lircd, using the traditional lircd protocol. The link above contains installation, usage and configuration instructions for controlling MPlayer with Hama MCE, using hama_mce_lircd.py.
Each button works and can be bound to any MPlayer input.conf command, with the following limitations (of the dongle hardware):
An alternative and more generic Python Linux event reading and mangling library with Hama MCE support is available at http://github.com/rmt/pyinputevent/.
Here is how to use hama_mce_lircd.py with MPlayer:
$ wget -O /tmp/lircrc.hama \
http://pts-mini-gpl.googlecode.com/svn/trunk/hama-mce-linux/lircrc
$ wget -O /tmp/hama_mce_lircd.py \
http://pts-mini-gpl.googlecode.com/svn/trunk/hama-mce-linux/hama_mce_lircd.py
$ sudo killall lircd
$ sudo mkdir -p /var/run/lirc
$ sudo python /tmp/hama_mce_lircd.py /var/run/lirc/lircd
(connect the USB dongle, wait 3 seconds, and watch the script detect it)
(keep it running, open another terminal window)
$ mplayer -lircconf /tmp/lircrc.hama ${VIDEO_FILENAME}
The most important Hama MCE remote keys supported by lircrc.hama: Pause, Stop, Volume Up, Volume Down, Channel Plus (to speed up playback), Channel Minus (to slow down playback), Info (for showing/hiding OSD with the time indicator) the big round button (for seeking), the up and down arrows (for adjusting the subtitle delay).

Would you like to have your custom clock for geeks (geek clock, math clock)? You can
design and print the front plate of your own analog geek clock using LaTeX and TikZ. Here is how I did it (download):
% geek_clock.texI used pdflatex and TikZ in TeX Live 2008 to compile the file above to a PDF file, which I printed, cut and glued to a stock clock.
% by pts@fazekas.hu at Thu Oct 22 14:24:35 CEST 2009
\documentclass[a4paper]{article}
\usepackage{tikz}
\usepackage[latin2]{inputenc}
\usepackage{t1enc}
\usepackage{lmodern}
\pdfpagewidth=\paperwidth
\pdfpageheight=\paperheight
\newenvironment{fullpage}{%
\shipout\vbox\bgroup\kern-1in\moveleft1in\vbox to\paperheight\bgroup
\parindent0pt\hsize\paperwidth
}{%
\vfil\egroup\egroup
}
\begin{document}
% Define a few constants for easy configuration
\def\framehalf{9.2cm}
\def\radius{8.8cm}
\def\onedegrad{8.6cm}
\def\fivedegrad{8.5cm}
\def\tendegrad{8.2cm}
\def\labelrad{8.3cm}
\begin{fullpage}
\vfil\noindent\hfil
\begin{tikzpicture}[scale=1]
\draw (-\framehalf,-\framehalf) --
(\framehalf,-\framehalf) --
(\framehalf,\framehalf) --
(-\framehalf,\framehalf) -- cycle;
\draw (0,0) circle (\framehalf);
\draw (0,0) circle (\radius);
\draw[fill=black] (0,0) circle (2.5mm);
\node[draw, circle, inner sep=.2mm] (a) at (0,0) {};
% main lines
\foreach \x in {0, 6,...,360}
\draw[line width=1.5pt] (\x:\onedegrad) -- (\x:\radius);
% labels and longer lines at every 6 degrees
\foreach \x in {30, 60, ..., 360} {
\draw[line width=4pt] (\x:\tendegrad) -- (\x:\radius);
}
\node[scale=3,anchor=north east] at (450-1*30:\labelrad)
{$B'_L$\kern-1ex};
\node[scale=2.5,anchor=east] at (450-2*30:\labelrad)
{\lower8ex\hbox{$\displaystyle \sum_{i=0}^{\infty}1/2^i$\kern-2ex}};
\node[scale=3,anchor=east] at (450-3*30:\labelrad)
{$7\odot-5$};
\node[scale=3,anchor=south east] at (450-4*30:\labelrad)
{$\lceil\pi\rceil$};
\node[scale=3,anchor=south east] at (450-5*30:\labelrad)
{$(2\varphi-1)^2$\kern-4ex};
\node[scale=3,anchor=south] at (450-6*30:\labelrad)
{$3!$};
\node[scale=3,anchor=south west] at (450-7*30:\labelrad)
{$\!6.\overline{9}$};
\node[scale=4,anchor=west] at (450-8*30:\labelrad)
{\raise1ex\hbox{${\bullet}{\circ}{\circ}{\circ}$}};
\node[scale=2.5,anchor=west] at (450-9*30:\labelrad)
{$\lfloor(7\cdot.1\!-\!.7)^{\textrm{-6e-2}}\rfloor$};
\node[scale=2.5,anchor=west] at (450-10*30:\labelrad)
{\lower6ex\hbox{$\displaystyle{5\choose2}$}};
\node[scale=2.5,anchor=north west] at (450-11*30:\labelrad)
{\lower3ex\hbox{\kern-3ex$7^5\mathop{\mathrm{mod}} 13$}};
\node[scale=3,anchor=north] at (450-12*30:\labelrad)
{$\sqrt[3]{1728}$};
\end{tikzpicture}
\end{fullpage}
\end{document}
The PDF version of the clock face is available here. It looks like this:
References:
$ gconftool-2 --type boolean -s /apps/gnome_settings_daemon/screensaver/start_screensaver falseWithout setting start_screensaver to false above, gnome-settings-daemon would restart gnome-screensaver whenever a GNOME application gets started. (Firefox a GNOME Terminal is GNOME applications in Ubuntu Jaunty, but icewm and xterm aren't.)
$ killall gnome-screensaver
// Tuto2.as, an example ActionScript 2 scriptTo compile it, download MTASM first:
import flash.external.ExternalInterface;
class Tuto2 {
static var app : Tuto2;
function Tuto2() {
_root.createTextField("tf",0,0,0,800,200);
_root.tf.mutliline = true;
_root.tf.text = "first";
var myformat = new TextFormat();
myformat.color = 0x00000;
myformat.underline = true;
myformat.size = 30;
// Set this, because the default font, "Times New Roman" may not be available on Linux.
myformat.font = "serif";
_root.tf.setTextFormat(myformat);
_root.tf.text = ExternalInterface.call + "\nHello";
// Call this again after changing the text, otherwise the formatting is lost.
_root.tf.setTextFormat(myformat);
}
static function main(mc) { // Entry point.
app = new Tuto2();
}
}
$ wget http://www.mtasc.org/zip/mtasc-1.12-linux.tgzThen compile with:
$ mkdir mtasc
$ cd mtasc
$ tar xzvf ../mtasc-1.12-linux.tgz
$ cp .../Tuto2.as .
$ ./mtasc -version 8 -swf tuto2.swf -main -header 800:200:20 Tuto2.asThe corresponding HTML would look like this for Firefox:
<embed src="tuto2.swf"To make it cross-browser, use SWFObject to embed it. Once created, load the HTML in your browser to view the Flash animation you've just created.
quality="high" bgcolor="#eeeeee" fgcolor="#000000" width="800" height="2
name="tuto" id="tuto" align="middle" allowScriptAccess="always"
allowFullScreen="true" type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
$ wget http://fpdownload.adobe.com/pub/flex/sdk/builds/flex3/flex_sdk_3.4.0.9271.zipHere is a sample ActionScript 3 program:
$ mkdir flex
$ cd flex
$ unzip ../flex_sdk_3.4.0.9271.zip
$ bin/mxmlc -help
// Tuto3.as, a sample ActionScript3 programHere is how to compile it (creates Tuto3.swf):
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.utils.getTimer;
import flash.external.ExternalInterface;
public class Tuto3 extends Sprite {
function Tuto3() : void {
var circle : Sprite = new Sprite();
circle.graphics.beginFill(0xFF7744);
circle.graphics.drawCircle(0, 0, 30);
circle.graphics.endFill();
addChild(circle);
//myInit();
//addEventListener(Event.ADDED_TO_STAGE, myInit);
ExternalInterface.addCallback("myFunction", myInit);
}
public function myInit(e : Event = null) : String {
var startTime : Number = getTimer();
var tField : TextField = new TextField();
var tFormat : TextFormat = new TextFormat();
tFormat.size = 20;
// Set this, because the default font, "Times New Roman" may not be available on Linux.
tFormat.font = "serif";
tField.autoSize = "left";
tField.background = true;
tField.border = true;
tField.multiline = true;
tField.x = 20;
tField.y = 40;
tField.text = "hello1";
tField.setTextFormat(tFormat);
var endTime : Number = getTimer();
trace('hello2 ' + startTime + ' ' + (endTime - startTime));
tField.text = 'ms=' + (endTime - startTime);
// Call this again after changing the text, otherwise the formatting is lost.
tField.setTextFormat(tFormat);
addChild(tField);
}
}
}
$ ./bin/mxmlc -target-player 10 -default-size 800 200 -optimize Tuto3.asHere is the corresponding HTML:
<html><head><script type="text/javascript">The HTML above also demonstrates calling an ActionScript method form JavaScript. To call a JavaScript function from ActionScript, do
function myonload() {
// document.tuto for Firefox, window.tuto for Internet Explorer
var tuto = document.tuto || window.tuto || document.getElementById("tuto");
if (tuto && tuto.myFunction)
document.getElementById("result").innerHTML = tuto.myFunction();
}
</script></head><body onload="myonload()">
<embed src="Tuto3.swf"
quality="high" bgcolor="#eeeeee" fgcolor="#000000" width="800" height="200"
name="tuto" id="tuto" align="middle" allowScriptAccess="always"
allowFullScreen="true" type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
<div id="result">no result yet</div>
</body></html>
ExternalInterface.call("JavaScriptFunctionName", arg1, ...)Don't forget to copy the .html and the .swf to a http:// location, otherwise ExternalInterface won't work because the security limitations imposed by the Flash Player.$ apt-get install spidermonkey-binAfter that, the command smjs file.js is available. In the executed JavaScript, the function print(expr) can be used to print a line to the terminal window, and
load(filename) can be used to load another .js file.$ sudo apt-get install gcc g++ make autoconf2.13 mercurialThis creates the shell/js executable, which can be used just like smjs.
$ hg clone http://hg.mozilla.org/tracemonkey/
$ cd tracemonkey/js/src
$ CC='gcc -m32' CXX='g++ -m32' AR=ar \
./configure --disable-debug --enable-optimize --target=i686-pc-linux-gnu
$ make
$ ls -l shell/js
$ bash -c 'More information about compiling and benchmarking TraceMonkey can be found on http://blog.mozilla.com/nnethercote/2009/07/27/how-i-work-on-tracemonkey/.
cd shell || exit 1; rm -f js
function c++() { command c++ -static "$@"; }
function g++() { command g++ -static "$@"; }
eval "`make js`"; cd ..; ls -l shell/js'
~/.gnome2/f-spot/photos.db. This blog post explains how to update the database manually if picture files were renamed or moved. Without the manual update, F-Spot would not recognize the moved files, and it it will not see the tags and other information attached to them.apt-get install sqlite3Then get the list with
sqlite3 ~/.gnome2/f-spot/photos.db "SELECT uri FROM photos"Please note that newer versions of Ubuntu have the database file as ~/.config/f-spot/photos.db instead, so you may have to change the command above.
sqlite ~/.gnome2/f-spot/photos.db ".dump photos" >f-spot.table_photos.sqlCopy the backup before modification:
cp f-spot.table_photos.sql f-spot.modified_photos.sqlModify the file f-spot.modified_photos.sql in your favorite text editor to rename the files, and update the table with
sqlite ~/.gnome2/f-spot/photos.db "DROP TABLE photos"As an alternative, if you don't want to use a text editor, run something like
sqlite -init f-spot.modified_photos.sql ~/.gnome2/f-spot/photos.db
sqlite3 ~/.gnome2/f-spot/photos.db "UPDATE photos SET uri=REPLACE(uri, '/OLD_DIR/', '/NEW_DIR/')"If F-Spot doesn't notice the changes, restart F-Spot.
sudo udevadm triggerand wait a few seconds. It's OK that the system becomes unresponsive for 5 seconds.
This blog post describes how to get rid of pulseaudio (the PulseAudio sound server) on a Debian or Ubuntu system. The solution presented here is tested with Debian Etch, Ubuntu Hardy and Ubuntu Intrepid. As a side effect, the GNOME system sounds (the short sound effect played when clicking etc.) won't work.
PulseAudio contains a sound server used for software mixing, multiplexing (audio playback from multiple programs at the same time) and filtering. However, in some cases it is the sound server which actually prevents proper multiplexing, because it locks the sound card, so if a program (e.g. mplayer) is using pulseaudio for playback, and the second program (e.g. Skype) wants to use ALSA, the second program will not be able to start playback because the sound card is locked by pulseaudio. One simple solution is to get rid of pulseaudio, and let applications use ALSA with the default output device. This takes advantage of hardware mixing or Dmix, which does software mixing for simultaneous playbacks.
To get rid of the pulseaudio sound server, run:
$ sudo apt-get remove pulseaudio
$ sudo killall pulseaudio
$ sudo killall pulseaudio
pulseaudio: no process killed
$ (echo Package: pulseaudio; echo Pin: release a=fakerepo; echo Pin-Priority: 1999) |
sudo tee -a /etc/apt/preferences
The last command (the one which appends to /etc/apt/preferences) is a hack to make the pulseaudio package impossible to install (i.e. apt-get install pulseaudio will fail with an unhelpful error message).
On Ubuntu Karmic (as of 2010-03-02), removing PulseAudio prevents the volume control panel applet from working. One workaround is to install some replacement packages from the audiohacks repository (https://launchpad.net/~dtl131/+archive/ppa). The commands are:
$ echo 'deb http://ppa.launchpad.net/dtl131/ppa/ubuntu karmic main' | sudo tee /etc/apt/sources.list.d/audiohacks.list' $ sudo apt-get update $ sudo apt-get install gnome-applets gnome-applets-data gnome-media \ gnome-media-common gnome-session-canberra gnome-settings-daemon \ libcanberra-gtk-module libcanberra-gtk0 libcanberra0 libgnome-media0
On Ubuntu Lucid (as of 2010-06-11), removing PulseAudio also prevents the volume control panel applet from working. One workaround is to install some replacement packages from the audiohacks repository (https://launchpad.net/~dtl131/+archive/ppa). The commands are:
$ sudo add-apt-repository ppa:dtl131/ppa $ sudo apt-get update $ sudo apt-get remove pulseaudio gstreamer0.10-pulseaudio $ sudo apt-get install gstreamer0.10-alsa gnome-alsamixer alsa-oss \ python-alsaaudio gnome-applets gnome-media gnome-settings-daemon \ libcanberra0 libcanberra-gtk-module libcanberra-gtk0 libgnome-media0 \ gnome-applets-data libcanberra-gstreamer alsamixergui alsa-tools
On Lucid, run gstreamer-properties, and change the output to ALSA.
If you are logged in graphically, log out and log in again. (Logging out kills all running interactive applications.) After logging in, right click on an empty area on your GNOME panel, select Add to Panel, select Volume Control, and add it.
\jpg, which can be used to include external (JPEG) images, optionally overriding the image width and/or height, like below:\jpg file.jpg % at original sizeIt is OK to assume that no file name starts with width, height or depth. The space after the dimension (e.g. 5cm) is mandatory.
\jpg width5cm file.jpg % scale proportionally (keeping aspect ratio)
\jpg height6cm file.jpg % ditto
\jpg width5cm height6cm file.jpg % resize ignoring aspect ratio
\jpg height6cm width5cm file.jpg % ditto
%The basic solution above creates a vbox (using \vrule) containing an \hrule of the specified size, and then measures the size of the vbox. Thus the parsing of the optional width and height arguments gets delegated to to the TeX \hrule primitive. A \vtop is used instead of a \vbox so a depth can be detected.
% jpgcmd_simple.tex: a simple braceless image inclusion TeX macro
% by pts@fazekas.hu at Mon Aug 31 13:42:49 CEST 2009
%
% This is one of the winning solutions for the problem proposed by Kees
% van der Laan on the conference EuroTeX 2009 (2009-08-31).
\def\jpgfilename#1 {%
\egroup % end of the \setbox0\vbox
%\showthe\dp0
\ifdim\dp0=0pt \else \errmessage{depth specified for jpg}\fi%
%\pdfximage
% \ifdim\wd0=0pt \else width\wd0\fi
% \ifdim\ht0=0pt \else height\ht0\fi
% {#1}%
%\pdfrefximage\pdflastximage
\message{JPG file=#1 width=\the\wd0 \space height=\the\ht0;}%
\endgroup}
\def\jpg{%
\begingroup
\setbox0\vtop\bgroup
\hsize0pt \parindent0pt
\everypar{\jpgfilename}%
\hrule height0pt }
ABC\jpg height3cm smiley.jpg
DEF\jpg width3cm smiley.jpg
GHI\jpg width4cm height3cm smiley.jpg
JKL\jpg width3cm smiley.jpg
MNO\jpg smiley.jpg % test for \par in the line below
PQR\jpg depth5mm smiley.jpg
\end
%This solution accepts the optional argument scale with or without a unit after its optional argument (the default unit is pt), and it also accepts an equals sign (=) after the optional argument keywords. The implementation is a lot longer now since it has to parse the optional arguments manually. It uses some well-known TeX macro programming tricks to scan a string character-by-character. The \ifxgroup macro is worth mentioning: it is an \ifx, but it accepts the code for the then and else branches as brace-delimited arguments. Using braces here is a fundamental trick for implementing nested ifs and recursion, because otherwise the the macros in the then and else branches would receive \else and \fi (respectively) instead of the next token.
% jpgcmd_versatile.tex: a versatile braceless image inclusion TeX macro
% by pts@fazekas.hu at Thu Sep 3 11:01:07 CEST 2009
%
% This is one of the winning solutions for the problem proposed by Kees
% van der Laan on the conference EuroTeX 2009 (2009-08-31).
% If #2 starts with #1, then do #3{#z}, otherwise do #4. We get #z by removing
% #2 from the beginning of #1.
\def\ifprefix#1#2#3#4{%
\ifprefixloop#1\hbox\vbox!#2\hbox\vbox!{#3}{#4}%
}
\def\firstoftwo#1#2{#1}
\def\secondoftwo#1#2{#2}
\def\ifxgroup#1#2{%
\ifx#1#2\expandafter\firstoftwo\else\expandafter\secondoftwo\fi}
\def\striphbox#1\hbox\vbox!#2#3{#2{#1}}
\def\ifprefixloop#1#2\vbox!#3#4\vbox!{%
\ifxgroup#1\hbox{\striphbox#3#4\vbox!}{%
\ifxgroup#1#3{\ifprefixloop#2\vbox!#4\vbox!}\secondoftwo}}
% Tests.
\def\paren#1{(#1)}
\message{\ifprefix{}{barden}{1\paren}{0}!}
\message{\ifprefix{bar}{barden}{1\paren}{0}!}
\message{\ifprefix{bar}{bad}{1\paren}{0}!}
\message{\ifprefix{bar}{ba}{1\paren}{0}!}
\newdimen\jpgwidth
\newdimen\jpgheight
\newdimen\jpgscale
\def\jpg{%
\jpgwidth0pt
\jpgheight0pt
\jpgscale0pt
\jpgparse}
% #2 can start with or without =.
\def\jpgsetdimen#1#2{#1#2 \jpgparse}
\def\skipuntilhbox#1\hbox{}
% #2 can start with or without =.
% #2 can end with `pt' or not.
\def\jpgsetfloat#1#2{
\afterassignment\skipuntilhbox
#1#2pt\space\space\hbox\jpgparse}
\def\jpgdeptherror#1{%
\errmessage{depth specified for jpg}\jpgparse}
\def\jpgparse#1 {%
\ifprefix{height}{#1}{\jpgsetdimen\jpgwidth}{%
\ifprefix{width}{#1}{\jpgsetdimen\jpgheight}{%
\ifprefix{depth}{#1}{\jpgdeptherror}{%
\ifprefix{scale}{#1}{\jpgsetfloat\jpgscale}{%
\jpgshow{#1}}}}}}
\def\jpgshow#1{%
\message{JPG file=#1 width=\the\jpgwidth\space height=\the\jpgheight\space
scale=\the\jpgscale;}%
}
ABC\jpg height3cm smiley.jpg
DEF\jpg width3cm smiley.jpg
GHI\jpg width4cm height=3cm smiley.jpg
JKL\jpg width3cm scale=4 smiley.jpg
% test for \par in the line above
MNO\jpg width3cm scale=4pt smiley.jpg
PQR\jpg smiley.jpg
STU\jpg depth5cm smiley.jpg
\end
sudo apt-get update && sudo apt-get install nvidia-glx-190 nvidia-190-libvdpauIf you don't have a Driver "nvidia" line in your /etc/X11/xorg.conf, then run sudo nvidia-xconfig to generate the proper lines. Make sure that your InputDevice in that file is not /dev/psaux; it should be Option "Device" "/dev/input/mice". Now do these as root:
# /etc/init.d/gdm stop # kills your X sessionNow you should have full video acceleration
# rmmod nvidia # may fail
# modprobe nvidia
# echo nvidia >>/etc/modules
# /etc/init.d/gdm start
$ wget http://www.avenard.org/files/ubuntu-repos/testing/mplayer_1.0-svn29435-x264-vdpau-190-0ubuntu2_amd64.debPlay the video with mplayer -vo vdpau -vc ffmpeg12vdpau,ffwmv3vdpau,ffvc1vdpau,ffh264vdpau, FILENAME.VID. This will consume between 30% and 40% of CPU (as measured using top) with OSD or subititles and between 8% and 9% without OSD or subtitles. Please note that the comma at the end of the -vc argument specifies that MPlayer should try other video codecs if those specified in -vc don't work for the video being played. Please note that that -vo vdpau supports non-accelerated software codecs as well, but there is a performance cost (e.g. for a non-accelerated 320x200 video file I tried -vo xv consumed 5% CPU and -vo vdpau consumed 15% CPU), but -- unfortunately -- it is not possible to make MPlayer autodetect when to use -vo xv and when to use -vo vdpau.
$ sudo dpkg -i mplayer_1.0-svn29435-x264-vdpau-190-0ubuntu2_amd64.deb
$ sudo apt-get -f install
wget http://movies.apple.com/movies/fox/allaboutsteve/allaboutsteve-tlrc_h1080p.movGet more information about HD video playback on Ubuntu and an nVidia ION board at http://gagravarr.livejournal.com/137571.html. If you don't want to specify the accelerated codec flags every time on the command line, you should copy them to your ~/.mplayer/config file, for example:
vo=vdpau
vc=ffmpeg12vdpau,ffwmv3vdpau,ffvc1vdpau,ffh264vdpau,
#vo=xv
ao=alsa
#subcp=latin2
stop-xscreensaver=1
font=Arial
subfont-text-scale=3
subfont-osd-scale=3
sudo killall pulseaudioPlease also make sure that no other program might be using the soundcard: disable system sounds, kill all web browsers (to kill the flash player), and kill all media players.
$ mplayer -ao alsa $FILETo force audio output on the analog stereo jack, run
$ mplayer -ao alsa:device=front=NVidia $FILETo force audio output on HDMI, run
$ mplayer -ao alsa:device=hdmi=NVidia $FILETo force output on S/PDIF, run
$ mplayer -ao alsa:device=iec958=NVidia $FILETo list all available audio output devices, run
$ aplay -LPlease note than when specifying anything other than -ao alsa to MPlayer, you may lose DMIX support, so you won't be able to run two playbacks at the same time, and MPlayer would print:
[AO_ALSA] Unable to set hw-parameters: Device or resource busyIt is possible to fix that by using plain -ao alsa and specifying the the output device in $HOME/.asourdrc. Using the environment variable ALSA_CARD does work, but ALSA_PCM_DEVICE doesn't seem to work. Set up your $HOME/.asoundrc like this:
defaults.pcm.!card NVidiaThe device number 0 is analog output, 1 is S/PDIF and 3 is HDMI. The device numbers come from the output of aplay -l.
defaults.ctl.!card NVidia
defaults.pcm.!device 0
defaults.ctl.!device 0
This blog post explains how to disable the notification box with dark gray (black) background in the top right corner of the Mac OS X screen whenever somebody sends you a Skype chat message. The instructions given here have been verified and found working on Mac OS X 10.5.8 (Leopard), but they may not work in Snow Leopard (10.6).
One of the following solutions should work. Please try both.
S=$(defaults read com.apple.Terminal "Window Settings" | perl -0777 -pe '$X=q#If you don't get any error messages, exit from the Terminal application (closing the individual terminal windows is not enough) and start it again.
"$F729" = "\033[1;2H";
"$F72B" = "\033[1;2F";
"$F72C" = "scrollPageUp:";
"$F72D" = "scrollPageDown:";
F729 = "\033[H";
F72B = "\033[F";
F72C = "\033[5~";
F72D = "\033[6~";
#; s@(keyMapBoundKeys *= *\{.*?)\};\n@$1$X};@gs')
test "$S" && defaults write com.apple.Terminal "Window Settings" "$S"
cat >>~/.inputrc <<'END'To make the PageUp and PageDown keys search the shell history forward and backward for a command with a prefix before the cursor, run
set meta-flag On
set convert-meta Off
set output-meta On
END
bind -f ~/.inputrc
cat >>~/.inputrc <<'END'
"\e[5~": history-search-backward
"\e[6~": history-search-forward
END
bind -f ~/.inputrc
root@OpenWrt:~# /etc/init.d/dnsmasq stopOnce this is done, ask for a new IP address at your computer.
root@OpenWrt:~# true >/var/dhcp.leases
root@OpenWrt:~# /etc/init.d/dnsmasq start
* Based on information form http://en.wikipedia.org/wiki/BibTeX
* See also: http://amath.colorado.edu/documentation/LaTeX/reference/faq/bibstyles.html
* Nonstandard entries: url=, annote=, crossref=,
* No url= field in standard types, should be put to note={URL \url{...}}.
* There are no comments in BibTeX .bib files, not even %
* ?NAME= describes an optional field.
* BibTeX silently ignores ignores a field whose name it doesn't know.
.bib file entry templates
"""""""""""""""""""""""""
@article{NAME,
author={},
title={},
journal={},
year=,
?volume={},
?number={},
?pages={},
?month=,
?note={},
?key={},
}
@book{NAME,
author/editor={},
title={},
publisher={},
year=,
?volume={},
?series={},
?address={},
?edition={},
?month=,
?note={},
?key={},
?pages={},
}
@booklet{NAME,
title={},
?author={},
?howpublished={},
?address={},
?month=,
?year=,
?note={},
?key={},
}
@conference{NAME,
author={},
title={},
booktitle={},
year=,
?editor={},
?pages={},
?organization={},
?publisher={},
?address={},
?month=,
?note={},
?key={},
}
@inbook{NAME,
author/editor={},
title={},
chapter/pages={},
publisher={},
year=,
?volume={},
?series={},
?address={},
?edition={},
?month=,
?note={},
?key={},
}
@incollection{NAME,
author={},
title={},
booktitle={},
year=,
?editor={},
?pages={},
?organization={},
?publisher={},
?address={},
?month=,
?note={},
?key={},
}
@inproceedings{NAME,
author={},
title={},
booktitle={},
year=,
?editor={},
?pages={},
?organization={},
?publisher={},
?address={},
?month=,
?note={},
?key={},
}
@manual{NAME,
title={},
?author={},
?organization={},
?address={},
?edition={},
?month=,
?year=,
?note={},
?key={},
}
@mastersthesis{NAME,
author={},
title={},
school={},
year=,
?address={},
?month=,
?note={},
?key={},
}
@misc{NAME,
?author={},
?title={},
?howpublished={},
?month=,
?year=,
?note={},
?key={},
}
@phdthesis{NAME,
author={},
title={},
school={},
year=,
?address={},
?month=,
?note={},
?key={},
}
@proceedings{NAME,
title={},
year=,
?editor={},
?publisher={},
?organization={},
?address={},
?month=,
?note={},
?key={},
}
@techreport{NAME,
author={},
title={},
institution={},
year=={},
?type={},
?number={},
?address={},
?month=,
?note={},
?key={},
}
@unpublished{NAME,
author={},
title={},
note={},
?month=,
?year=,
?key={},
}
Description of entries and fields
"""""""""""""""""""""""""""""""""
* @article: An article from a journal or magazine.
* @book: A book with an explicit publisher.
* @booklet: A work that is printed and bound, but without a named publisher or
sponsoring institution.
* @conference: The same as inproceedings, included for Scribe compatibility.
* @inbook: A part of a book, usually untitled. May be a chapter (or section or
whatever) and/or a range of pages.
* @incollection: A part of a book having its own title.
* @inproceedings: An article in a conference proceedings.
* @manual: Technical documentation.
* @mastersthesis: A Master's thesis.
* @misc: For use when nothing else fits.
* @phdthesis: A Ph.D. thesis.
* @proceedings: The proceedings of a conference.
* @techreport: A report published by a school or other institution, usually
numbered within a series.
* @unpublished: A document having an author and title, but not formally
published.
* address=: Publisher's address (usually just the city, but can be the full
address for lesser-known publishers)
* annote=: An annotation for annotated bibliography styles (not typical)
* author=: The name(s) of the author(s) (in the case of more than one author,
separated by and)
* booktitle=: The title of the book, if only part of it is being cited
* chapter=: The chapter number
* crossref=: The key of the cross-referenced entry
* edition=: The edition of a book, long form (such as "first" or "second")
* editor=: The name(s) of the editor(s)
* eprint=: A specification of an electronic publication, often a preprint or a
technical report
* howpublished=: How it was published, if the publishing method is nonstandard
* institution=: The institution that was involved in the publishing, but not
necessarily the publisher
* journal=: The journal or magazine the work was published in
* key=: A hidden field used for specifying or overriding the alphabetical order
of entries (when the "author" and "editor" fields are missing). Note that
this is very different from the key (mentioned just after this list) that is
used to cite or cross-reference the entry.
* month=: The month of publication (or, if unpublished, the month of creation).
Example 1=: month=jan. Example 2=: month="17~" # feb.
* note=: Miscellaneous extra information
* number=: The "number" of a journal, magazine, or tech-report, if applicable.
(Most publications have a "volume", but no "number" field.)
* organization=: The conference sponsor
* pages=: Page numbers, separated either by commas or double-hyphens. For books,
the total number of pages.
* publisher=: The publisher's name
* school=: The school where the thesis was written
* series=: The series of books the book was published in (e.g. "The Hardy Boys"
or "Lecture Notes in Computer Science")
* title=: The title of the work
* type=: The type of tech-report, for example, "Research Note"
* url=: The WWW address
* volume=: The volume of a journal or multi-volume book
* year=: The year of publication (or, if unpublished, the year of creation)
#! /bin/bashPlease note that you may want to adjust the GRUB4DOS_ZIP variable above in order to download a more recent version of GRUB4DOS, when its available. you can get the list of versions from http://download.gna.org/grub4dos/.
# by pts@fazekas.hu at Sat Jul 11 16:24:31 CEST 2009
GRUB4DOS_ZIP=grub4dos-0.4.4-2009-06-20.zip
GRUB4DOS_DIR=grub4dos-0.4.4 # as extracted from $GRUB4DOS_ZIP
set -ex
TO_INSTALL=''
type -p mkisofs || TO_INSTALL="$TO_INSTALL mkisofs"
type -p wget || TO_INSTALL="$TO_INSTALL wget"
type -p unzip || TO_INSTALL="$TO_INSTALL unzip"
test "$TO_INSTALL" && sudo apt-get install $TO_INSTALL
wget -O "$GRUB4DOS_ZIP" http://download.gna.org/grub4dos/"$GRUB4DOS_ZIP"
unzip -o "$GRUB4DOS_ZIP"
test "$GRUB4DOS_DIR"/grldr
rm -rf grldr.iso.dir
mkdir grldr.iso.dir
cp "$GRUB4DOS_DIR"/{grldr,menu.lst} grldr.iso.dir
mkisofs -R -b grldr -no-emul-boot -boot-load-size 4 -o grldr.iso grldr.iso.dir
: All OK, CD image grldr.iso created.
$ sudo apt-get install growisofs
$ growisofs -dvd-compat -Z /dev/cdrom=grldr.iso
#! /bin/bashPlease note that you may want to adjust the GRUB4DOS_ZIP variable above in order to download a more recent version of GRUB4DOS, when its available. you can get the list of versions from http://download.gna.org/grub4dos/.
# by pts@fazekas.hu at Sat Jul 11 11:02:14 CEST 2009
GRUB4DOS_ZIP=grub4dos-0.4.4-2009-06-20.zip
GRUB4DOS_DIR=grub4dos-0.4.4 # as extracted from $GRUB4DOS_ZIP
set -ex
TO_INSTALL=''
type -p wget || TO_INSTALL="$TO_INSTALL wget"
type -p mformat || TO_INSTALL="$TO_INSTALL mtools"
type -p unzip || TO_INSTALL="$TO_INSTALL unzip"
test "$TO_INSTALL" && sudo apt-get install $TO_INSTALL
wget -O "$GRUB4DOS_ZIP" http://download.gna.org/grub4dos/"$GRUB4DOS_ZIP"
unzip -o "$GRUB4DOS_ZIP"
dd if=/dev/zero of=grldr.img bs=1474560 count=1
mformat -i grldr.img -f1440 ::
"$GRUB4DOS_DIR"/bootlace.com --floppy --chs grldr.img
mcopy -i grldr.img "$GRUB4DOS_DIR/grldr" ::GRLDR
mcopy -i grldr.img "$GRUB4DOS_DIR/menu.lst" ::menu.lst
: All OK, 1.44MB floppy image grldr.img created.
$ cat grldr.img >/dev/fd0
\documentclass{article}
%** Usage: \romannumeral\stars{NUMSTARS}
%** This expands to a NUMSTARS stars (* tokens) in a single expansion step.
\def\stars#1{%
\expandafter\mtostar\expandafter{\expandafter}\romannumeral\number#1 000z}
\def\firstoftwo#1#2{#1}%
\def\secondoftwo#1#2{#2}%
\def\mtostar#1#2{%
\ifx#2z\expandafter\firstoftwo\else\expandafter\secondoftwo\fi
{0 #1}{\mtostar{#1*}}%
}
\begin{document}
\expandafter\def\expandafter\mystars\expandafter{\romannumeral\stars{4}}%
\texttt{(\meaning\mystars)}
\end{document}
\documentclass{article}Select the language to use with \secondlanguagetrue or \secondlanguagefalse. Whenever you have a text fragment which needs to be typeset differently depending on the languagem, use the \bilingual command, as demonstrated above.
\makeatletter
\newif\ifsecondlanguage
\def\@bracedfirst#1#2{{#1}}
\def\@bracedsecond#1#2{{#2}}
\def\do@localized#1[#2]{%
\let\@@localized\@undefined
\newcommand\@@localized[#2]{#1}\@@localized}%
%** Typeset different text depending on the current value of \ifsecondlanguage.
%** Usage: \bilingual{LANG1PAT}{LANG2PAT}[ARGCOUNT]{ARG1}{ARG2}...
%** If \ifsecondlanguage is true, pattern LANG2PAT is used, else LANG1PAT is
%** used. Arguments #1, #2 etc. in the pattern are substituted with
%** ARG1, ARG2 etc.
\def\bilingual{%
\expandafter\expandafter\expandafter\do@localized\csname
@braced\ifsecondlanguage second\else first\fi\endcsname
}
\begin{document}
\secondlanguagetrue
\bilingual
{This is addition: #1; and this is multiplication: #2.}
{Translation to another language: #1 and another translation: #2.}
[2]{$x+y$}{$x*y$}
\secondlanguagefalse
\bilingual
{These are additions: #1, #2; and this is multiplication: #3.}
{Translation to another language: #1, #2 and another translation: #3.}
[3]{$x+y$}{$x\oplus y$}{$x*y$}
\end{document}
svn ls URL://TO/SVN/REPOSITORY --username MYUSER
# apt-get updateFor the sake of completeness we mention (but we recommend against using) svn-push as an alternative of svn-pusher. svn-push is a tool written in C, available in the SVN contrib directory, and it does something like svn-pusher, but it's dumber: it can commit only a single revision at once, and it needs the head revision number. Here is how to compile it:
# apt-get install libsvn-core-perl
# echo no | cpan -i SVN::Pusher # this may take about a minute
# type -p svn-pusher
/usr/local/bin/svn-pusher
# svn-pusher help
$ wget http://svn.collab.net/repos/svn/trunk/contrib/client-side/svn-push/svn-push.cFor the sake of completeness, we also mention the SVN::Push Perl module, which provides the svnpush command. SVN::Pusher seems to be more up-to-date.
$ sudo apt-get install libsvn-dev
$ gcc -W -Wall -I/usr/include/subversion-1 -I/usr/include/apr-1.0 \
-Doff64_t='unsigned long long' -o svn-push svn-push.c -lsvn_client-1
$ ./svn-push
Usage : svn-push -r N:M SRC_URL DEST_URL
$ wget http://cvs2svn.tigris.org/files/documents/1462/44372/cvs2svn-2.2.0.tar.gzYou don't need Subversion itself for this step – cvs2svn (if run with --dumpfile=) needs only Python and the standard Unix sort utility.
$ tar xzvf cvs2svn-2.2.0.tar.gz
$ cvs2svn-2.2.0/cvs2svn --help
svnadmin dump PATH/TO/SVN/REPOSITORY >PROJECT.dumpOtherwise use svn-pusher like this:
$ svnadmin create PROJECT.copyAs an alternative to svn-pusher, you can use svnsync as well (part of the standard SVN installation), see blog post Dump a SVN repository from a URL how to do it. Please note that both svn-pusher and svnsync are quite slow (as compared to svnadmin dump), and svnsync is better supported and documented since it is part of standard SVN.
$ svn-pusher push URL://OF/SVN/REPOSITORY PROJECT.copy
$ svnadmin dump PROJECT.copy >PROJECT.dump # this may take some time
$ rm -rf PROJECT.copy
$ perl -pi -e's@^(Node-path: )@${1}PROJECT.merge/@' PROJECT.dumpAfter that, please make sure you add the directory creation into revision 1 of PROJECT.dump. Use your text editor to insert the following lines just below the first PROPS-END line:Node-path: PROJECT.merge
Node-kind: dir
Node-action: add
$ svnadmin create myprojectsPlease note that cvs2svn adds the creation of the directories trunk, tags and branches to the *.dump file. This will be a problem in svnadmin load myprojects <myproject2.dump, because this tries to add directory trunk, which already exists in repository mpyrojects, so the operation will fail. The solution is to edit the file myproject2.dump, and remove the following lines from near the beginning:
$ cvs2svn --dumpfile=myproject1.dump cvsrepo/dir/myproject1
$ svnadmin load myprojects <myproject1.dump
$ cvs2svn --dumpfile=myproject2.dump cvsrepo/dir/myproject2
$ # (edit myproject2.dump, see below)
$ svnadmin load myprojects <myproject2.dump
$ svn ls -R file://$PWD/myprojects
Node-path: trunk
Node-kind: dir
Node-action: add
Node-path: branches
Node-kind: dir
Node-action: add
Node-path: tags
Node-kind: dir
Node-action: add
$ svnadmin create PROJECT.copyPlease note that revision numbers in messages reported by svn-pusher are usually off by one, e.g. Committed revision 1 from revision 0. This is normal, the revision numbers will match perfectly in the target repository.
$ svnadmin load PROJECT <PROJECT.dump
$ svn-pusher push file://$PWD/PROJECT.copy URL://TO/TARGET/SVN/REPOSITORY # slow
$ rm -rf PROJECT.copy
def Hello(self, x, y):
return x * y + "foo" # bar
Rake::Task[:'test:units'].prerequisites.delete('db:test:prepare')Step 2. Create file test/unit_test_helper.rb with the following contents:# similar to autogenerated test/test_helper.rbStep 3. Make sure all your unit tests (i.e. =*.rb= files in =test/unit=, recursively) start with the line require 'unit_test_helper' instead of require 'test_helper'. Don't forget any of the =*.rb= files, otherwise you'll get an error message at test file load time.
#
fail "some of the unit tests has loaded test_helper.rb. Please change " +
"(require 'test_helper') to (require 'unit_test_helper') in " +
"tests/unit/**/*.rb" if $".include?('test_helper.rb')
fail "some of the unit tests has loaded test_help.rb. Please make sure that " +
"the first line is (require 'unit_test_helper') in tests/unit/**/*.rb" if
$".include?('test_help.rb')
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
HIDE_ActiveRecord = self.class.send(:remove_const, :ActiveRecord)
require 'test_help' # rails 2.3.2 standard module
ActiveRecord = self.class.send(:remove_const, :HIDE_ActiveRecord)
class FakeConnection
class InvalidActionError < StandardError
end
COLUMNS = {}
def self.columns(table_name, name=nil)
if COLUMNS.has_key?(table_name)
COLUMNS[table_name]
else
raise InvalidActionError, "please create something like this first: " +
"FakeConnection::COLUMNS[#{table_name.inspect}] = [ " +
"ActiveRecord::ConnectionAdapters::Column.new(name=..., " +
"default=nil, sql_type=\"text\", null=false), ...]"
end
end
DB_ERROR_MSG = 'You cannot access the database from a unit test'
def self.quote_table_name(*args) # called from ActiveRecord::Base.find
raise InvalidActionError, DB_ERROR_MSG, caller
end
def self.quote_column_name(*args) # called from ActiveRecord::Base.delete
raise InvalidActionError, DB_ERROR_MSG, caller
end
def self.select_all(*args) # called from ActiveRecord::Base.find_by_sql
raise InvalidActionError, DB_ERROR_MSG, caller
end
def self.transaction(*args) # called from ActiveRecord::Base.save
raise InvalidActionError, DB_ERROR_MSG, caller
end
end
class << ActiveRecord::Base
def connection
FakeConnection
end
end
FakeConnection::COLUMNS['foos'] = [After this, you can do a Foo.new in your tests – but you won't be able to save the object, and Foo.find, Foo.find_by_sql and Foo.delete won't work either. If you try any of those, a FakeConnection::InvalidAction gets raised. To test such a functionality, use an integration test instead of a unit test. To do so, create your test file as test/integration/*.rb instead of test/unit/*.rb.
ActiveRecord::ConnectionAdapters::Column.new(
name="bar1", default=nil, sql_type="varchar(255)", null=false),
ActiveRecord::ConnectionAdapters::Column.new(
name="bar2", default=nil, sql_type="integer", null=false),
]
# apt-get install libsqlite3-devYou also have to install some development packages in order to be able to compile and install REE. Do this:
# apt-get install libpq-dev # optional, needed if Rails app connects to PostgreSQL
# apt-get install libmysqlclient15-dev # needed if app connects to MySQL
# apt-get install wget gcc g++ make libc6-dev libreadline5-dev zlib1g-dev libssl-devShould other packages be missing, the installer script run below will tell you the apt-get install command to run.
# cd /usr/srcThe installer is an interactive script, and it would have asked questions and waited for you to press Enter occasionally if you hadn't called it with the -a flag. Nevertheless, it show you some nice, colorful messages indicating progress. In a few minutes, it finishes compilation and installation to /usr/local/ruby-enterprise-1.8.6. Please note that the installer runs /usr/local/ruby-enterprise-1.8.6/gem install to download, compile and install some gems (Ruby modules). Please note that -c--enable-pthread is necessary to work around a bug in ruby-enterprise-1.8.6-20090421.tar.gz, which causes fork()ed subprocesses to exit early with SIGVTALRM.
# wget http://rubyforge.org/frs/download.php/55511/\
ruby-enterprise-1.8.6-20090421.tar.gz
# tar xzvf ruby-enterprise-1.8.6-20090421.tar.gz
# ruby-enterprise-1.8.6-20090421/installer \
-c--enable-pthread -a/usr/local/ruby-enterprise-1.8.6
# strip /usr/local/ruby-enterprise-1.8.6/bin/ruby
# apt-get install libmysqlclient15-devIf you have any other gems needed by your Rails application, install them now (similarly to the postgres gem above). Please note that all gems should be installed as root in the setup described in this tutorial, and gems are shared among Rails applications.
# /usr/local/ruby-enterprise-1.8.6/bin/gem install --no-ri --no-rdoc mysql
# apt-get install libpq-dev
# /usr/local/ruby-enterprise-1.8.6/bin/gem install --no-ri --no-rdoc postgres
export GEM_HOME=/usr/local/ruby-enterprise-1.8.6/lib/ruby/gems/1.8Log in again, and check that type -p ruby gem rake rails prints a filename inside /usr/local/ruby-enterprise-1.8.6. Make sure that all scripts in /home/myrails/myapp/scrit/* start with /usr/bin/env ruby, and they don't have a specific Ruby interpreter (such as /usr/bin/ruby) hardcoded. Create the initial database of your Rails application (by running rake db:migrate etc.). Quickly try your application by starting
export PATH="/usr/local/ruby-enterprise-1.8.6/bin:$PATH"
/home/myrails/myapp/script/server --environment=productionand visiting http://localhost:3000/ . Try some functionality which accesses the database. As soon as it works fine, stop the server script.
# apt-get install apache2 apache2-prefork-dev libapr1-devThe passenger-install script gives you nice, colorful instructions how to configure your Apache. Memorize those instructions, and feel free to use them in place of the instructions given in this tutorial. Configure your Apache2 as usual. (Setting up and populating a DocumentRoot, setting up SSL (https://) and setting up Apache VirtualHost entries is not covered in this tutorial.) Create file /etc/apache2/mods-available/passenger.conf containing the right paths, for example (type it without the line break):
# /usr/local/ruby-enterprise-1.8.6/bin/passenger-install-apache2-module -a
PassengerRoot /usr/local/ruby-enterprise-1.8.6/lib/ruby/gems/1.8/gemsCrete file /etc/apache2/mods-available/passenger.load containing the right paths, for example (type it without the line break):
/passenger-2.2.2
PassengerRuby /usr/local/ruby-enterprise-1.8.6/bin/ruby
LoadModule passenger_module /usr/local/ruby-enterprise-1.8.6/lib/ruby/gems/Run this:
1.8/gems/passenger-2.2.2/ext/apache2/mod_passenger.so
# ln -s ../mods-available/passenger.load /etc/apache2/mods-enabled/Restart apache with
# ln -s ../mods-available/passenger.conf /etc/apache2/mods-enabled/
# /etc/init.d/apache2 restartWait about 60 seconds, and make sure you don't get any Passenger-related error messages at the end of /var/log/apache2/error.log.
<VirtualHost server.name:80>in your /etc/apache2/sites-available/default. Do not specify RailsBaseUrl /, that wouldn't work. Restart Apache, and visit http://server.name/ . The first page download may take a few seconds, because Phusion Passenger starts the Rails application at that time. The latency of further downloads should be negligible. If you get a colorful, but unhelpful error message like The page you were looking for doesn't exist.; You may have mistyped the address or the page may have moved., then visit http://localhost/ instead, on which Phusion Passenger doesn't hide the exception raised by Rails. Examining /var/log/apache2/error.log can also help you diagnose the problem.
ServerName server.name
DocumentRoot /home/myrails/myapp/public
</VirtualHost>
# ln -s /home/myrails/myapp/public /var/www/myappMake sure you have these lines in your Apache2 configuration (most probably /etc/apache2/sites-available/default):
DocumentRoot /var/wwwIt's OK to have multiple RailsBaseUri directives, both for multiple or a single application. Restart Apache2 if needed. Visit http://server.name/myrails . If you see an unhelpful error message instead of your application's main page, then visit http://localhost/myrails to get the details. Examining /var/log/apache2/error.log can also help you diagnose the problem.
<Directory /var/www>
Options +FollowSymlinks
</Directory>
RailsBaseUri /myrails
# touch /home/myrails/myapp/tmp/restart.txtand visit the application's URL. The first download should take a few seconds, because Phusion Passenger is restarting your Rails application.