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'