[HOWTO] Run HTML files as PHP in Hostgator

I recently moved some of my websites to Hostgator shared hosting. One of my sites required html files to be run as PHP. The HTML files contained PHP code which needed to be executed. The site was added as an Addon Domain in Hostgator. That can be done in most hosts by creating a .htaccess host in the root directory of the website (The root directory of the website is something like /pubic_html/yoursite.com/ in cpanel, by default) and adding the following line to it:

AddHandler application/x-httpd-php .html

.
The same can also be achieved by adding the following to .htaccess:

<FilesMatch "^.*.html">
    SetHandler application/x-httpd-php
</FilesMatch>

But in hostgator, none of those will work. You will need to write x-httpd-php5 instead of x-httpd-php i.e.

AddHandler application/x-httpd-php5 .html

If you wish to add other extensions, lets say .htm too for example, you can simply put in:

AddHandler application/x-httpd-php5 .html .htm

[HOWTO] Modify youtube-dl to make it bandwidth friendly by adding option to download lowest quality video

youtube-dl is a command line utility that can be used to download Youtube videos. It has many command line switches ; most notably -t to save the video with title of the video as filename, -c to continue the download instead of starting over. It can be installed in Ubuntu Lucid Lynx and Maverick Meerkat via Synaptic by enabling universe repository. Then running the following command will update it to the latest version:

sudo youtube-dl -U

If you want to use it in older Ubuntu releases or other Linux distros, visit the official site.
It also has a switch -f with which you can select a Youtube Video Format to download. Like this:

youtube-dl2 -f 34 "http://www.youtube.com/watch?v=2_VFKqw1q2Q"

That will download video with format code 34 if available. 34 is 360p flv format. You will need to know the formats to be able to use this options and all this information is available in Youtube Wikipedia Article. If the format you requested is not available, it will print the message:

ERROR: unable to download video (format may not be available)

I don’t know why someone would like to do it, but an option f-1 is available which downloads all available qualities of the video. If you don’t provide any format information, it will download the best quality version of the video. You can always try your luck with the following formats that are supported for youtube, arranged in decreasing quality:
38, 37, 22, 45, 35, 34, 43, 18, 6, 5, 17, 13
That is, if format 38 is available, it will download it and if it isn’t it will download 37 and so on.

But what if you want to download the lowest quality or worst quality of video to be able to download quickly? It currently does not have such an option and we will add it. To do so, open it up in a text editor. I’m using gedit:

gksu gedit /usr/bin/youtube-dl

and then find the following code (in the version 2010.08.04 that I have, it starts in line 938):

938
939
940
941
942
943
			if requested_format is None:
				video_url_list = [(existing_formats[0], get_video_template % existing_formats[0])] # Best quality
			elif requested_format == '-1':
				video_url_list = [(f, get_video_template % f) for f in existing_formats] # All formats
			else:
				video_url_list = [(requested_format, get_video_template % requested_format)] # Specific format

and now add an elif block as shown below:

938
939
940
941
942
943
944
945
			if requested_format is None:
				video_url_list = [(existing_formats[0], get_video_template % existing_formats[0])] # Best quality
			elif requested_format == '-1':
				video_url_list = [(f, get_video_template % f) for f in existing_formats] # All formats
			elif requested_format == '0':
				video_url_list = [(existing_formats[len(existing_formats)-1], get_video_template % existing_formats[len(existing_formats)-1])] # worst quality
			else:
				video_url_list = [(requested_format, get_video_template % requested_format)] # Specific format

Now, to download the worst quality version available, you can just pass -f 0 option i.e.

youtube-dl2 -f 0 "http://www.youtube.com/watch?v=2_VFKqw1q2Q"

This should download the worst quality version and make the download size smaller. However, sometimes worst quality in the list does not mean smallest size (I had seen examples of this while I was doing a youtube downloader project a year ago, but don’t know any examples to point out right now), they should almost always be so.

If the developers want to implement this (the lowest size download feature) in the main project, I think the best way to do it is to actually query header information of the video url and find the actually sizes, compare them and then download the one with the least size.

[HOWTO] Make Ubuntu 10.04 Lucid Lynx Mono Free

Ubuntu 10.04 comes with 3 default applications that depend on mono. They are
F-Spot, a photo manager
Tomboy, a note taking application
Gbrainy, brain teaser game and trainer
To get rid of mono and still keep the functionality, we need non-mono alternatives to these applications. Lets look at those. But first, let me write something about why someone may want to remove Mono.

Why remove Mono?
There are several reasons why someone may want to remove Mono from their Ubuntu installation. You may want to gain some free space. Mono takes up a lot of space for just a few applications. If you remove and replace them with others. This may not seem important if you want to run Ubuntu off normal harddisks these days, but it may be crucial if you want to remaster Ubuntu with few added applications and still want to distribute it on a CD or limited sized USB drive.
You may want to remove Mono for other reasons like it is an implementation of standard set by Microsoft or just because it is a short name for a contagious disease.

Why not remove Mono?
You may not want to remove Mono if you just want to free some space from your installation because it may not be the case when you start installing other applications based on Mono. You see, the alternatives also have dependencies and the different dependencies for all the alternatives may occupy more space than Mono.
Also, Mono seems to be a popular platform and there are many great applications like Docky, Banshee, Beagle etc. which need it. Moreover, many new applications may come up which need Mono and you may have to install it anyway.

Enough of that. Now, lets get to the applications.
F-Spot
F-Spot is to be removed from default install from Ubuntu 10.10 Maverick Meerkat and is being replaced by Shotwell. So, you can install Shotwell as a replacement to F-Spot. There is yet another photo manager called Gthumb but I think Shotwell is the better choice.

Tomboy
Tomboy is a really great note taking application. However, an almost exact clone which can import and use all the notes created by tomboy is available. It is called Gnote. Tomboy can be safely replaced with Gnote. Gnote is a C++ port of Tomboy and claims to be faster. Also, if you use the gnote stable ppa by adding ppa:gnote/ppa to your software sources, you can install gnote 0.7.x which features a nice gnome-panel applet for Gnote.

Gbrainy
I don’t know a good replacement for this great game, but it is just a mind teaser game. So, if you can do without it, just remove it.

Following is the step by step procedure for doing this.

Repositories
Open up Synaptic (System>Administration>Synaptic Package Manager) and click on Settings>Repositories. Make sure “Community maintained open source software (universe)” is selected. Now click Other Software tab and click Add. Then copy/paste the following

ppa:gnote/ppa

and click Add Source. This will add gnote PPA so that you can install the latest version of Gnote. Close the repositories window. Click on Reload so that the software lists are fetched from all repositories.

Removal of Mono and Installation of Alternatives
Search for shotwell and gnote in Synaptic Package Manager and mark them for installation. Search for mono-runtime and mark it for removal. This will ask for your confirmation that several other mono related packages including F-Spot, Tomboy and Gbrainy will be marked for removal. Just confirm it and click on Apply. This should free about 40 MB of Disk Space and download about 3 MB only.
To add Gnote panel applet, press Alt+F2 and type in killall gnome-panel and then when the panel loads back, Right click on it and select Add oo Panel, search for Gnote and click Add.

Other Softwares that depend on mono and alternatives
There are few other great softwares based on mono that are great but aren’t included in the default install. However, lets discuss them too. If you have any of those installed, they will be removed too. So, lets get to their alternatives.

Docky
Many Ubuntu users use Mac OS like docks these days. One such great dock is Docky. But there are some other good docks which can serve as a replacement for Docky. One of them is Avant-Window-Navigator. It is not so friendly in terms of disk space though. It consumes over 40MB of disk space and hence defeats the purpose if you are trying to remove mono because of disk space usage. Cairo dock may serve as a good replacement in that case.

Banshee
Banshee is a popular music player and media management application and favorite gnome media manager for lot of Linux users. However, the default Music Manager Rhythmbox should serve as a good replacement for it for a lot of users. Exaile is also good one.

Gnome-do
I never really got used to this application. I primarily used it for Docky (Docky was originally a part of Gnome-do) and never used other features that it had to offer. However, there are some huge fans of this application. It claims to get things done faster in Gnome. There is another application called kupfer (it is not a KDE application as the name suggests, yes I’m talking about its initial letter :D ) which claims to to provide similar functionality. It also has a lot of plugins and you should really give it a try. But it does not look sleek as Gnome-do though.

Beagle
Beagle is a indexing and searching tool for the Desktop. Tracker, Pinot or Google-Desktop-Search should serve as replacements.

Bless Hex Editor
Bless is a GUI hex editor which is really awesome. There is a replacement called ghex for it but it is not as good though.

Muine Music Player
Muine is a simple music player. It aims to be and remain simple music player. I haven’t really used it but I think the default movie player Totem, which can be used as audio player too of course, can provide everything that Muine has to offer.

Graphmonkey
This one is a graph drawing application written in GTK#. I found a replacement called extcalc (qt3 application) but it is not as simple (which in other words also means it is more powerful and includes more features such as scripting :) ).

Tangerine
Tangerine is a DAAP server which can serve music to Apple iTunes, Rhythmbox, Banshee, Amarok, XBMC, Limewire or any other music player that supports this protocol. I haven’t actually used it but there is another package mt-daapd which claims to provide similar functionality.

Smuxi
It is an IRC client. There are several IRC clients that should replace it. I use X-Chat.

Mistelix
Mistelix is a DVD authoring application. I don’t actually do any of that, but according to this article, one or a combination of Q DVD-Author, DVDStyler, DeVeDe, ManDVD, and tovidgui should be able to provide what Mistelix does.

gtwitter
This is a twitter client. The default application Gwibber should be a good replacement for this.

gnome-rdp
gnome-rdp is a remote desktop client for Gnome. It can be replaced by reminna.

Cowbell
It claims to be a music organizer and tagger. I am assuming EasyTag or Picard should serve as a replacement.

Tasque
Tasque brings Remember The Milk service (TODO list management) to the Desktop. However, Avant Window Navigator, Screenlets or Deskbar can offer similar functionality with RTM-related plugins.

Blam
Blam is an RSS Aggregator. Liferea, Yarssr and many other applications provide this functionality.

DFO
DFO (Desktop Flickr Organizer) is a photo manager which integrates with Flickr. I think only Kflickr (KDE Based) comes as close.

Drapes
Wallpaper rotator for Gnome. Nitrogen and Wally should serve as replacements.

gshare/giver
These are easy file sharing applications. BaShare can serve as a replacement.

last-exit
It is a Desktop Last.fm player. Rhythmbox or lastfm should serve as a replacement.

LAT
LAT is a LDAP Administration tool. Luma or GQ can serve as replacements.

themonospot
It is a simple media information extractor. MediaInfo serves as an excellent replacement.

bareftp
Bareftp is a FTP client. Filezilla Client, gFTP-GTK and various other GUI FTP clients can replace bareftp.

hipo
It is an iPod manager. gtkpod serves as a replacement.

Sysinfo
It is a System Information Tool. It can be replaced with Hardinfo. Ailurus also has this feature.

thelastripper
It is a Last.fm stream dumper. lastfmproxy and streamdumper can be used to do the same.

gnome-subtitles
Gnome subtitles is a sub-title editor. SubtitleEditor can serve as a replacement.

autopano-sift
Panorama images creation helper. Hugin should be a replacement.

youtranslate
It is a translation application which makes the use of online translators such as Google Translate. freespeak should serve as a good replacement.

Mono
Mono is an open source, cross-platform, implementation of C# and the CLR that is binary compatible with Microsoft .NET. If you don’t want to use it but still want to develop C# applications that run on Linux, you can go for dotGNU. But unlike Mono, it is not available from Ubuntu software center or officially supported by Cannonical.

C#
If you want to develop cross platform applications or applications for Linux and don’t want to use Mono, C# is not the language you should go with. A better language may be Java, Python or Vala.

Final Notes
I have tried to list all the applications that may prevent you from removing mono. However, I have not used all the programs that I have listed (at least not used them enough to get used to them or to know what features they offer or even to the extent to know them in any way). So, if you think I have missed a program or an alternative, please let me know via comments.
Thank you for reading.

[HOWTO] Install Adobe AIR In Ubuntu 10.10 Maverick Meerkat and Lucid Lynx 64bit

Here is how I installed Adobe AIR in Ubuntu 10.10 Maverick Meerkat Alpha 64bit. The same should work for Ubuntu 10.04 Lucid Lynx 64bit.

Installing ia32libs
You probably have it installed already if you chose to install flash-player or some other application that makes use of 32-bit libraries. If you haven’t, you should install it from Synaptic Package Manager or by executing the following command in the terminal:

sudo apt-get install ia32-libs

Getting Adobe Air Package/Installer
I downloaded bin version from Adobe Air Download Page. You can also choose deb version but it is not recommended as it causes problems that I will explain later.

Installation
To install, make sure you have no synaptic or apt running. Launch the terminal and change the directory to where you have saved the deb file. For example, if it is the Downloads directory, type in:

cd ~/Downloads

Alternately, you can right click on the directory where the deb has been downloaded and select “Open in Terminal” (you will need to have nautilus-open-terminal installed for this)
Now, execute the following command:

chmod +x AdobeAIRInstaller.bin
./AdobeAIRInstaller.bin

If you get the following error

Sorry, an error has occured
Adobe AIR could not be installed because another application is already being installed. Complete the first installation before proceeding with this one.

then just quit Synaptic or any other package manager you might be running and it should install fine.

If you downloaded deb version, then use the following:

sudo dpkg -i adobeair.deb

Installation of AIR Applications
Now, you can install Air Applications. To do so, goto Applications>Accessories>Adobe AIR Application Installer.
You can also open terminal and type in

Adobe\ AIR\ Application\ Installer

You can just type in “A” and press TAB and it should work.

However I get the following error while running the application via terminal;

/usr/lib/gio/modules/libgvfsdbus.so: wrong ELF class: ELFCLASS64
Failed to load module: /usr/lib/gio/modules/libgvfsdbus.so
/usr/lib/gio/modules/libgioremote-volume-monitor.so: wrong ELF class: ELFCLASS64
Failed to load module: /usr/lib/gio/modules/libgioremote-volume-monitor.so
/usr/lib/gio/modules/libgioremote-volume-monitor.so: wrong ELF class: ELFCLASS64
Failed to load module: /usr/lib/gio/modules/libgioremote-volume-monitor.so
/usr/lib/gio/modules/libgvfsdbus.so: wrong ELF class: ELFCLASS64
Failed to load module: /usr/lib/gio/modules/libgvfsdbus.so

I have not experienced any problems with it.
Select the AIR application and follow the on screen instructions. You can leave the install location as /opt and the application will be installed without problems. You should also see desktop shortcuts for installed AIR applications.

Uninstallation of AIR Applications
Search for the application name in Synaptic Package Manager. You should be able to remove it from there.

Uninstallation of Adobe AIR
If you don’t need Adobe AIR anymore, you can remove it. To do so, search for Adobe AIR in Synaptic Package manager and remove it. This works only if you have installed via the bin version. The deb version does not show up. This is probably an issue with the current version and hopefully it gets solved in the next version (or do the programs installed with –force-architecture not show at all??). This is the reason why I did not recommend the deb installer. Worst of all, when you install the deb version, you see the AIR applications in package manager but there is no Adobe AIR and hence you have broken dependency problems. This will force you to remove all AIR applications before you can use Synaptic or any other package manager again.

Hope this helps.

[HOWTO] Switch fastest mirrors for yum to make package updates/download faster in CentOS/Fedora/RHEL

I just installed CentOS 5.5 in one of my servers and it seems great. I ran yum for the first time and it selected a mirror for me which was really very slow, almost useless. So, package updates and installation were taking a lot of time. I decided to switch to a different repo but didn’t have an idea which, so I decided to let the same fastest-mirrors plugin decide the mirrors. To force yum-fastestmirror plugin to check for fastest mirrors, you must delete the file /var/cache/yum/timedhosts.txt by running the following command as root:

rm /var/cache/yum/timedhosts.txt

Then, running yum will check for fastest mirror next time it is run. It should pick up a better mirror, but in my case, it just picked the same mirror over and over. So, I decided to block it altogether so that yum-fastestmirror is forced to choose another one.To do that, I opened the file /etc/yum/pluginconf.d/fastestmirror.conf as root and uncommented the line (removed the “#”) with “exclude” and added the culprit mirror “mirror.eshk.hk” to the exclude list so that the line looked like the following:

exclude=mirror.eshk.hk

If yum-fastestmirror keeps on giving selecting slow mirrors, you can add additional mirrors to the exclude list (separate mirror names with commas) and remove /var/cache/yum/timedhosts.txt again and repeat it again and again till you are satisfied with the speeds.

Minimized Window Thumbnails in Compiz

Here is a video showing live animated thumbnails for minimized windows in compiz:

This was posted in compiz developer SmSpillaz’s blog.
Hope this will be added to stable compiz soon.

[HOWTO] Install Limewire in Ubuntu 10.04 Lucid Lynx or 10.10 Maverick Meerkat

Limewire is a P2P file sharing application available for Linux, Windows and Mac OS X. It can be downloaded from Official Limewire Website or Click here for Direct Download. After downloading it, if you double click it (LimeWireLinux.deb), you may get the following error:

Error: Dependency is not satisfiable: sun-java6-jre|icedtea-java7-jre|sun-java6-jdk|icedtea-java7-jdk

Read the rest of this entry »

Best Download manager for Linux

I am using Ubuntu 10.10 Maverick Meerkat and used to have been using the following programs for downloading stuff from the internet:

Firefox Default Download Manager for HTTP/FTP Downloads and Deluge for Torrents.

It was not much convenient because Firefox resume does not always work in case of crashes or in case of power cuts. Also it does not support multi-threaded downloads. So, I decided to try out Fatrat along with Flashgot firefox add-on. Fatrat and Flashgot both can be installed from Ubuntu Software Center. If you are using beta or development version of Firefox, then you need to get it from Firefox Addons Website or Flashgot website.

Fatrat, like Free Download Manager (which is currently only available for Windows), can be used as a torrent client, HTTP/FTP Download Manager, Rapidshare download (it waits for appropriate time automatically and downloads), Youtube Download (at the time of writing this, Youtube download seems not to be working) and much more.
fatrat1 300x174 Best Download manager for Linux
It supports remote control via jabber and web interface.
fatrat2 300x85 Best Download manager for Linux
Since Flashgot does not support Fatrat by default, you will need to add support for Fatrat. When it asks for path, enter /usr/bin/fatrat. After that, you can select and right click a link and Flashgot it. You can also select Flashgot>Fatrat when the download box comes up.

fatrat3 300x247 Best Download manager for Linux
When you click OK, Fatrat should show the add link dialog.

Have fun downloading.

[HOWTO] Cancel a friend request in Facebook

Have you just sent a friend request to someone who you don’t want to be friends with? You can remove the request by going to Account>Edit Friends>All Connections, or simply to this link:

http://www.facebook.com/friends/?filter=ac

Now, use the next button, if you have to, to find the person that you mistakenly sent request to. Then click the cross next to their name as shown below:

facebook remove request 300x209 [HOWTO] Cancel a friend request in Facebook

The person will not see the friend request anymore. But if they have subscribed via emails to Facebook notifications, they will see the email because the email is sent almost immediately when we send a request and there is nothing we can do about it.

[SOLVED] “Indicator Applet Complete” has quit unexpectedly

UPDATE: This has been fixed in yesterday’s update.

I’m using Ubuntu 10.10 Maverick Meerkat Alpha. The indicator-sound applet was recently updated to version 0.3.9 and every time a track changes, the following error shows up:

“Indicator Applet Complete” has quit unexpectedly

If you reload a panel object, it will automatically be added back to the panel.

indicator applet 300x112 [SOLVED] Indicator Applet Complete has quit unexpectedly

A bug report has been filed here and hopefully gets fixed in the next release. However, I have temporarily fixed the issue for now by downgrading to indicator-sound v3.8. I could not find the version online but I could find it in my package cache by the following command:

find /var/cache/apt/archives| grep -i indicator-sound

I just installed the last version by running the following:

sudo dpkg -i /var/cache/apt/archives/indicator-sound_0.3.8-0ubuntu1_amd64.deb

If you don’t have that version, slightly older version should do just fine.

Get Adobe Flash playerPlugin by khattam.info
Get Adobe Flash playerPlugin by wpburn.com wordpress themes