Turn your computer into an Internet TV – Miro

I always wanted to just have an Internet TV, no cable, no satellite, no terrestrial. Even when it comes to TV I want to watch what I want when I want, not when the broadcaster wants. Internet TV was the ideal. Main thing I missed was really good content with really good quality. Only hope was torrents, but it was not the same experience though. You have to download the movie file using a torrent client and then start watching it using a media player. YouTube videos were a big pain to save to share with my friends. Video feeds were another story; I couldn’t find a single descent client that will just work.

Finally there is a free and open source media player + Internet TV, Miro. You can download Miro from http://www.getmiro.com/. It is released under GNU GPL, you are free to use, change and redistribute.

Miro is a great piece of software that makes Internet TV a reality. It is capable of playing most video files if not all, built in guide to video feeds and podcasts with the capability to play them within Miro itself, capable of playing and saving YouTube videos, download Torrents and watch them in Miro, and best of all access to great variety of HD content. All this makes Miro the only media player you will ever want.

Miro binaries are available for all major flavors of Linux, MacOS, Windows. If you are not able to use any of the binaries you could always compile and install from source 😉

I’m impressed about what Miro can do, I think you will also be impressed. Download Miro now from http://www.getmiro.com/.

Epiphany Anti-Phishing extension

I’m happy to announce the release of safe-browsing 0.0.1 for Epiphany, the GNOME Web browser. It will try match the url you are trying to access with the Google Safe Browsing black list of urls. If it is a match the view pane will be disabled such that the user can only view the page but not interact. The user will be free to browse away from the page by typing a new url. The extension will also add a indicator to the browser status bar. In the next relase an error page will be displayed instead of even displaying the evil page.

You can also report phishing sites by clicking Help -> Report Web Forgery…

You can download the extension safe-browsing-0.0.1.tar.gz

Follow the steps bellow to install the extensionn. I’m assuming you have already installed epiphany and epiphany-extensions.

Step 1 – Download the extension archive

 $ wget http://www.mohanjith.net/downloads/gnome/epiphany/extensions/safe-browsing/safe-browsing-0.0.1.tar.gz

Step 2 – Extract the extension archive to epiphany extensions directory

 $ cd /usr/lib/epiphany/2.20/extensions/ $ tar -xzvf [Location_to_archive] .

Step 3 – Restart epiphany and enable Safe browsing extension

Goto Tools -> Extensions and then select the check box against Safe browsing.

Step 4 – Goto a phishing site

Goto a phishing page, e.g. http://202.168.224.161/c.html at the time of posting.

Hope this extension will make your browsing experience safer.

Using GNOME remotely via SSH

Have you ever wished that you had a GUI on a remote Linux server without using VNC? Actually you can use GNOME or any other GDM on a remote server via SSH, yep I’m not joking.

You need to have SSH and X11 running on both the client and the server. In addition on the server GNOME should be installed and SSH daemon should be running.

Step 1 – Turn on X11 forwarding on the server:

Add the following if it doesn’t exist or just change no to yes in /etc/ssh/ssh_config and save it.

ForwardAgent yes
ForwardX11 yes
ForwardX11Trusted yes

Add the following if it doesn’t exist or just change to yes in /etc/ssh/sshd_config and save it.

X11Forwarding yes

Step 2 – Connect to the remote server viw SSH with X11 forwarding

In order to enable X11 forwarding when you connect to a remote server via SSH you need to provide the commandline option -X. See the example bellow.

 $ ssh -X username@server

Step 3 – Start GNOME Session

You need to start the GNOME session for the GUI to show. By default GNOME session is not started for remote connections. It might take a while for any change to appear, you should notice GNOME startup sequence appearing in the client and couple of messages in your terminal.

However I do not recommend running X11 or GNOME on a production server, but this should be handy if you want to connect to your home computer from office for example.

WSO2 WSF/PHP with Lighttpd

I wanted to test drive WSO2 WSF/PHP on Lighttpd because I couldn’t find any documentation specific for Lighttpd, or any one complaining that it cannot be done. I set up a new VMWare image running Debian so that I can blog all the steps involved in getting WSO2 WSF/PHP working on Lighttpd running on Debian.

Step 1: Install Lighttpd, PHP5

I used apt-get to install Lighttpd and PHP5

 $ sudo apt-get install lighttpd php5 

Step 2: Download and install WSO2 WSF/PHP.

I downloaded the Debian package.

 $ axel -an 5 http://dist.wso2.org/products/wsf/php/wso2-wsf-php-1.2.0-debian.deb
$ dpkg -i wso2-wsf-php-1.2.0-debian.deb

Step 3: Enable WSO2 WSF/PHP

I created a new file /etc/php5/conf.d/wsf.ini and added the following line.

 extension=wsf.so 

Step 4: Enable FastCGI and PHP

Fastest method to run PHP on Lighttpd is FastCGI, so we will be enabling FastCGI.

 $ sudo lighty-enable-mod fastcgi

On Debian Lighttpd FastCGI configuration file contains the configuration for PHP4. We will have to edit /etc/lighttpd/conf-enable/10-fastcgi.conf to look like bellow.

server.modules   += ( "mod_fastcgi" )

## Start an FastCGI server for php5 (needs the php5-cgi package)
fastcgi.server = ( ".php" =>
((
"bin-path" => "/usr/bin/php5-cgi",
"socket" => "/tmp/php.socket",
"max-procs" => 2,
"idle-timeout" => 20,
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "4",
"PHP_FCGI_MAX_REQUESTS" => "10000"
),
"bin-copy-environment" => (
"PATH", "SHELL", "USER"
),
"broken-scriptfilename" => "enable"
))
)

Step 5: Restart Lighttpd

You have to reload the Lighttpd configuration files.

 $ sudo /etc/init.d/lighttpd restart

You have successfully installed WSO2 WSF/PHP on PHP5 and Lighttpd. It is time to test whether it is a success. Simplest approach would be to see phpinfo() page. Create a php file with the following line of code and place it in the document root. Then using a web browser goto that URL. In the page search for wsf section. This contains all the configurations about the WSF extension.

I went throught to the trouble of actually consuming a SOAP web service to see whether this setup actually works and it was a success, but that is simply out of the scope of this post. These instructions should work on other Linux distributions with minor changes and any platform with few changes.

Fly WSO2 WSF/PHP with Lighttpd. Have fun.

Flying light with lighty

I moved all my sites to my all new server. There I’m running Lighttpd as the front facing web server. I do have Apache HTTP Server running for the sake of svn serving. It was not very hard to migrate sites from Apache HTTP Server to Lighttpd. Only feature I missed was .htaccess file support or substitute. I just had to migrate all the operations taking place in the .htaccess files to the Lighty configuration file.

Overall migration was smooth. I have nothing to complain, memory foot print is small as it could get. Since I’m serving only PHP and Python I’m making use of FastCGI and it is really fast. You wouldn’t believe me if I tell you the performance gains. I can serve 700 requests per second when it comes to my Geo-IP web service (I believe the limit was the resources on the test machine), the server is not even sweating. If I was running the same application on Apache HTTP Server it would barely serve 230 requests per second, 204% performance gain.

If you visit any of my sites except for the blog itself (which is hosted at Blogger.com) you would see the performance. mohanjith.net responds within a second, that’s lighting fast. All this with a Debian running on Xen with 128MB physical memory and 256MB swap.

I would recommend Lighty to any one with simple serving requirements. It saves lot of server resources.

MakeNSIS on Linux

I was supposed to create a Windows installer recently, but I just hate using Windows. NSIS was the chosen installer creator. I was lucky to be able to compile the NSIS installer on Linux.

The installer just ran without any glitches on wine. So testing the installer as not an issue as well.

Let me guide you through installing NSIS on Linux and how to use it on Linux.

Requires

  1. Python
  2. SCons

Steps

  1. Download both the release and the source of x.xx.
  2. nsis-x.xx.zip nsis-x-xx-src.tar.gz

  3. Extract both into one parent parent directory
  4. <parent>
    |
    +-- nsis-x.xx
    +-- nsis-x.xx-src

  5. Change to the source directory
  6. $ cd nsis-x.xx-src

  7. Compile makensis using scon
  8. $ scons SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all

  9. Copy makensis to the release
  10. $ cp build/release/makensis/makensis ../nsis-x.xx/makensis

  11. Change to the <parent>
  12. $ cd ..

  13. Install – Copy makensis to the install location
  14. $ sudo cp -r nsis-x.xx/* /usr/local/share/nsis/

  15. Create the link from the bin directory to the makensis such that
    makensis is accessible from the command line.
  16. $ sudo link /usr/local/share/nsis/makensis /usr/bin/makensis

Adding color to subversion

If you love the command line and svn but would like to add some color as well, you could try colorsvn.
colorsvn is identical to svn when it comes to commands, but the results are shown in color.

colorsvn is particularly handy if there are any conflicts created during an update.

See http://colorsvn.tigris.org/ for more.

svnserve Init script

I was annoyed to have to start the svnserve as a daemon everytime I restarted the machine. I also wanted to use service configuration(GNOME) to deal with the service.

I looked all over the web and failed to find the a good one. So I thought of writing it my self. Last weekend I sat down and wrote the script. Here is the result.

This was tested on fc6 running kernel 2.6.20-1.2962.fc6. Subversion 1.4.2 (subversion-1.4.2-2.fc6). It should work in any distro with init.

To make service configuration aware of svn serve you will have to first copy the script to /etc/init.d and then run the following.

$ /sbin/chkconfig ---add svnserve

Also remember to create the configuration(/etc/sysconfig/subversion) file with the following lines in it to enable threading.

OPTIONS="--threads"

You can put any options you could send to svnserve in the configuration file.

PS: here is the Init script it self for your viewing before downloading

#!/bin/bash
#
# /etc/rc.d/init.d/subversion
#
# Starts the Subversion Daemon
#
# chkconfig: 2345 90 10
# description: Subversion Daemon
# processname: svnserve
# pidfile: /var/lock/subsys/svnserve

source /etc/rc.d/init.d/functions

[ -x /usr/bin/svnserve ] || exit 1

### Default variables
SYSCONFIG="/etc/sysconfig/subversion"

### Read configuration
[ -r "$SYSCONFIG" ] && source "$SYSCONFIG"

RETVAL=0
prog="svnserve"
desc="Subversion Daemon"
pidfile="/var/run/$prog.pid"

start() {
echo -n $"Starting $desc ($prog): "
daemon $prog -d $OPTIONS --pid-file $pidfile
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
touch /var/lock/subsys/$prog
fi
echo
}

obtainpid() {
pidstr=`pgrep $prog`
pidcount=`awk -v name="$pidstr" 'BEGIN{split(name,a," "); print length(a)}'`
if [ ! -r "$pidfile" ] &&amp;amp; [ $pidcount -ge 2 ]; then
pid=`awk -v name="$pidstr" 'BEGIN{split(name,a," "); print a[1]}'`
echo $prog is already running and it was not started by the init script.
fi
}

stop() {
echo -n $"Shutting down $desc ($prog): "
if [ -r "$pidfile" ]; then
pid=`cat $pidfile`
kill -s 3 $pid
RETVAL=$?
else
RETVAL=1
fi
[ $RETVAL -eq 0 ] && success || failure
echo
if [ $RETVAL -eq 0 ]; then
rm -f /var/lock/subsys/$prog
rm -f $pidfile
fi
return $RETVAL
}

restart() {
stop
start
}

forcestop() {
echo -n $"Shutting down $desc ($prog): "

kill -s 3 $pid
RETVAL=$?
[ $RETVAL -eq 0 ] && success || failure
echo
if [ $RETVAL -eq 0 ]; then
rm -f /var/lock/subsys/$prog
rm -f $pidfile
fi

return $RETVAL
}

status() {
if [ -r "$pidfile" ]; then
pid=`cat $pidfile`
fi
if [ $pid ]; then
echo "$prog (pid $pid) is running..."
else
echo "$prog is stopped"
fi
}

obtainpid

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
RETVAL=$?
;;
condrestart)
[ -e /var/lock/subsys/$prog ] && restart
RETVAL=$?
;;
status)
status
;;
forcestop)
forcestop
;;
*)
echo $"Usage: $0 {start|stop|forcestop|restart|condrestart|status}"
RETVAL=1
esac

exit $RETVAL

Installing Huawei ETS1000 on Linux

*** Update for Ubuntu 8.10 ***

You will have to copy the driver files to the correct location. Please run the following command.

sudo cp /lib/firmware/$(uname -r)/ti_3410.fw /lib/firmware/ti_usb-3410.bin

***

I managed to install my ETS1000 Series Fixed Wireless Terminal on Linux and go online. I thought of sharing the steps I took to install the modem on Linux such that you might be able to help someone with the same problem. This should work for any of the CDMA modems that will be using TI USB 3410 cable (the cable you get when you pay for Bell Net) as the problem is with the USB/Serial Cable not the HUAWEI modem.

System Requirements

* Linux with kernel above 2.6.** (Check it by command in console uname -a).
(Personally Tested on FC6, should work on any Linux Distribution)

Let’s Start

It is well assumed that Linux is up on your system and your USB/Serial cable is plugged in.
Now in console type command dmesg -c search for the following lines

ti_usb_3410_5052 1-1:2.0 : TI USB 3410 1 port adapter converter detected
usb 1-1: TI USB 3410 1 port adapter converter now attached to /dev/ttyUSB0

If u even see ttyUSB0 in the kernel message then also your modem is detected and you are ready to start,now just configure your wvdial.conf in /etc and start your dialup.

If not then possibly u will be seeing the following error messages in bundle but i will paste only two lines here.

ti_usb_3410_5052 1-1:1.0: TI USB 3410 1 port adapter converter detected

ti_usb_3410_5052: probe of 1-1:1.0 failed with error -5

Note that the problem is only the USB/Serial Cable not the HUAEWI modem.

Now we have to make one rule file in /etc/udev/rules.d/026_ti_usb_3410.rules

The file may not exist, but don’t worry.

In console login as a root

su

password *****

cd /etc/udev/rules.d/

vi 026_ti_usb_3410.rules (Now Paste the following lines in it)

SUBSYSTEM=="usb_device" ACTION=="add"
SYSFS{idVendor}=="0451",SYSFS{idProduct}=="3410" \
SYSFS{bNumConfigurations}=="2" \
SYSFS{bConfigurationValue}=="1" \
RUN+="/bin/sh -c 'echo 2 > /sys%p/device/bConfigurationValue'"

SAVE AND EXIT (:wq)

Now once again plug out ur USB/Serial cable and then plugin.

Again type dmesg -c in console

Check the kernel message and find the following line

ti_usb_3410_5052 1-1:2.0: TI USB 3410 1 port adapter converter detected
usb 1-1: TI USB 3410 1 port adapter converter now attached to /dev/ttyUSB0

CONGRATULATIONS it is finally done.

Now edit your /etc/wvdial.conf (Mine as a Sample below working fine)

My /etc/wvdial.conf

[Dialer ptcl]

Modem = /dev/ttyUSB0

Baud = 230400

Phone = #777

Init1 = ATZ

Stupid Mode = 1

Dial Command = ATDT

Username = YourUsername

Password = YourPassword

PPPD Options = crtcts multilink usepeerdns lock defaultroute

Important Note: Stupid Mode should be set to 1 otherwise the hash sign # with Dialing phone number will not be treated by wvdial.

LAST PROBLEM

When u will connect to ptcl with wvdial ptcl command as a root , it will not browse any page and will disconnect.

You have to set the nameserver in the /etc/resolv.conf .You can get the nameserver IPs from the terminal window when wvdial is trying to connect to your ISP.

Put those two nameserver in /etc/reslov.conf.

Now again as a root in console wvdial ptcl.

FINALLY YOU ARE DONE.

DVD movies on mplayer – Excellent

I bought my self a Shrek2 (know it is old, but didn’t want to spend too much) DVD and wanted to check how well mplayer will handle it. To my surprise, there wasn’t a glitch. The movie was crystal clear. It’s as good as watching on a DVD player.

So I thought I would do more research and find out how mplayer decode the DVD so well without even loading the processor so much. To much of my surprise player does support hardware decoding of DVDs via graphic card (I have a nVidia GeForce with nVidia proprietary drivers). This is only supported in one of nVidia’s own media player when it comes to Windows, but mplayer did it.

Thanks allot for the mplayer project for a such a feature rich application.