Playing MKV files on PS3

I have been working alot on finding a good solution to this issue. And the answer is that there is no good solution at all to this problem. There are many ways to play mkv files on a ps3, but all of them include either converting the files on transcoding them on the fly.

I have found one soultion that works rather good, it includes a windows program and a few cli programs used on OS X or Linux. The Windows program I use is called tsMuxerGUI and I run it using wine. There is also a Linux version of this but I never got it working on OS X (Okay, diden’t try that hard! ;) )

Continue reading ‘Playing MKV files on PS3′

How to set up a automated task with launchd

Launchd is designed to replace cron in OS X. I will show you a quick example on how to set up a automated task that runs every five minutes and one running every day using launchd.
Create a plist-file for the task and put it in /Library/LaunchAgents/. Below is a example of a plist-file.

Continue reading ‘How to set up a automated task with launchd’

Two nifty tsm commands

See how much data that was copied during a “backup stg”:

q ACT BEGINDATE=TODAY-1 MSGno=1214 SEARCH=*

See how much active data stored by one client:

EXPORT NODE * FILED=BACKUPActive PREVIEW=YES

do a “q proc” see when the process finishes, and use:

q actlog s="ANR0986I"

too see the results.

Native support for audio and video in HTML5

HTML5 has some new cool futures. Among others is native audio and video support. I have written a very small guide on how to do this.

Here’s a quick and dirty example on how to play video

<video src="video.mov" id="movie" width="320" widht="240"></video>
        <script>
          var video = document.getElementById("movie");
        </script>
        <p><button type="button" onclick="movie.play();">Play</button>
           <button type="button" onclick="movie.pause();">Pause</button>
           <button type="button" onclick="movie.currentTime = 0;">
<< Rewind</button>

This will play the file video.mov and give there buttons to control the video, one to play, one to pause and one to rewind.

Now a example on how to play audio

<audio src="kinks.mp3" id="audio"></audio>
        <script>
          var audio = document.getElementById("audio");
        </script>
        <p><button type="button" onclick="audio.play();">Play</button>
           <button type="button" onclick="audio.pause();">Pause</button>
           <button type="button" onclick="audio.currentTime = 0;">
 << Rewind</button>

This examples gives you the same controls as in the video example.

To able to use this you need a nightly build of WebKit for Safari. Webkit supports both OS X and Windows. If you are using Opera take a look at this page for examples and a development build download. Firefox apparently already supports HTML5, but not the audio and video tags shown here. Tags will be supported in version 3 of Firefox. Download a beta here.

A smoother Terminal.app experince?

As a follow up to to Rune’s post on how to get a smooth Terminal.app I made my own profile. It’s pretty much the same config but I did some small changes which makes it a bit easier on the eyes.

  • The background has opacity
  • Antialias text
  • Changed color of marked text

Download:smooth_terminalterminal

Critical bug in Safari.app?

I found something today that I believe is a bug in Safari.app. The bug makes Safari.app crash. I have reported the bug to Apple, but as we all know, Apple is not so good at giving feedback.
So if anyone can confirm the bug I would be very happy. I’m not using any extra extensions for Safari.app.

Here is how to reproduce the bug:

1. Using Safari.app go to http://www.imdb.com and search for a random movie, for example Independence Day

2. When the search is done you get a set of images above the first hit. In this example images from Independence Day.

3. Press on one of the images. Before this image is successfully loaded press a new image. Do this a few times and Safari will crash.

This actual a really easy bug to reproduce, but I have not been able to get any useful information for either error report or by using dtrace (I should mention that my dtrace skills are limited). The error report and system information is included below.

I think this bug is related to how Safari.app handles images (I may be very wrong here). But if this is the case it could be possible to create a special formated image or java-script that crashes Safari.app. If this is the case it could maybe also be possible to run code via this image or java-script.

If anyone is able to reproduce the bug leave a comment or send me a email at alexanderSPAM@FILTERdavalex.net.

launchd - Mac OS X init system

Working as a Linux Systems Administrator I frequently work with the init system on Linux sytems. OS X has a similar system called launchd.

The init system used in Linux reads init-scripts from /etc/init.d/. These scripts are regular bash-scripts that tells init.d what to do with a defined application. OS X reads XML files from /System/Library/LaunchDaemons/. In OS X you can control these services using the command “launchctl”.

I’ll show you how to add some extra security features to the tftp server in OS X and how to start it using launchctl. This will give you a quick overview on how launchd works.

First off all you have to add some new lines to tftp.plist.
Open tftp.plist in your favorite editor.

mate /System/Library/LaunchDaemons/tftp.plist

Under the key “ProgramArguments” add a new string

<string>-s</string>

This will chroot tftp to the directory configured in the string below. By default this string is /private/tftpboot/. This means that you have to put the files that you want you clients to reach under this directory.

You may also want to add the -l flag to enable logging to syslog. Have a look at “man tftpd” for additional arguments.
If you want to learn more about how plist files are built, take a look athttp://developer.apple.com/macosx/launchd.html

You can now start the tftp service using the following command:

sudo launchctl load \
-w /System/Library/LaunchDaemons/tftp.plist

And stopped with:

sudo launchctl unload \
-w /System/Library/LaunchDaemonds/tftp.plist

Please remember that the tftp protocol allows any user to read and write files to your system. Use with caution.

Lets check that everything works:

cd /private/tftpboot
sudo touch test-file
sudo chmod 666 test-file

cd $HOME
touch test-file
echo "TESTINGTESTING" > test-file
tftp localhost
put test-file

If there no errors are returned, everything works fine! :)

launchctl has a interactive mode, take a look at it:

sudo launchctl

Running “help” should give you alot of usefull information.

X11 forwarding with copy and paste functions

Do you use X11 forwarding and are not able to copy/paste text to you local machine? Here is the solution using X11.app in OS X.

When running X11 forwarding from Terminal.app you are not able to copy and paste text between the native applications and the ones running with X11 forwarding. X11.app has support for this, so here is what you do:

In OS X Leopard you don’t have to use the open-x11 shell script to open X11 applications, Leopard fixes this for you and starts the X11 server automatically. You can do something like this:

applepai:~ davalex$ xterm -bg black -fg white -e "ssh -X \
davalex@10.211.55.4 revelation"

If you are using earlier versions of OS X use this command:

applepai:~ davalex$ open-x11 xterm -bg black -fg white -e\
 "ssh -X davalex@10.211.55.4 revelation"

Your application will start and the copy and paste functions will work perfectly!

Enable debug menu in Safari

Safari has an hidden debug menu which can be quite usefull when debugging web-pages. Its not as future rich as firebug for Firefox, but it has some useful functions.

To enable this menu go to your terminal and execute the following code when Safari.app is not running.

% defaults write com.apple.Safari IncludeDebugMenu 1

Easy way to add locales in Ubuntu

When using debian you can use dpkg-reconfigure to add new locals. The way to add locales in ubuntu has been changed a bit. Here is quick guide on how to do this

First you have to edit the file /var/lib/locales/supported.d/local

vim /var/lib/locales/supported.d/local

Here you probably have only one entry, at least I did.

en_US.Uen_US.UTF-8TF-8

Add the locales you want you system to support in this file. I added the following:

no_NO.UTF-8 UTF-8
no_NO ISO-8859-1
nn_NO.UTF-8 UTF-8
nn_NO ISO-8859-1
nb_NO.UTF-8 UTF-8
nb_NO ISO-8859-1

This gives me support for the Norwegian language and the “new-norwegian” language. When this is done, save the file and run the following command to regenerate all locales:

dpkg-reconfigure locales