We can check your plugins and stuff

Monday, February 14, 2011

How to pull the latest stable code of DIGIKAM and SHOWFOTO

Digikam and ShowFoto are two great programs that anyone who is into photography whether as an amateur or professional should have. It is one of the best open source software that I use on almost on a daily bases. If photography is your passion and you have a lots of pictures clicked via cellphones, point and shoot cameras, and high end pro kit.
There will come a time when you will need to have a Digital Workflow/Photo management in place. It does not matter if you are just looking for a quick and dirty solution to do some resizing, cropping, color correction or you on the lookout for serious professional features like converting RAW files, RAW to DNG conversion, noise reduction in batch mode. Digikam and ShowFoto fit the bill perfectly. The best part is both of the software are fully Open source and available on multiple platforms like Windows, Mac OS and Linux.

If you have been reading my blog you know I love to tinker with code and compile stuff... No no do not get worried as I said even if you are a amateur shutterbug  you can use Digikam and ShowFoto. The following steps are for the absolute new user on Fedora Linux with the KDE Desktop Environment. Digikam and ShowFoto are part of the KDE graphics core. They are simple to install via yum.

[root@localhost ~]# yum install digikam

This will install both digikam and showfoto and can be  found under the Graphic Menu. Give it a spin, you will love it.

Ok now for readers who are already using digikam and showfoto esp on Fedora Linux, you all know the great developers are constantly working hard to fix any bugs and bring out new features for the users to try out. New version are being rolled out every now and then. As Fedora Linux is not a rolling distro, the default fedora repos will have the older version of the software. Now some would question why do we need the latest and greatest version anyway ???
The answer is some what simple, bug fixes, new features that you may need, speed. The most important of all support for new cameras and RAW file formats that you have or plan to buy soon.

Now we will see how we can have latest stable build in no time without waiting for the repos to be updated ;) In order to compile digikam and showfoto we need to some software per installed. Why compile -- two words speed and stability. Here we go ... Please note photo processing and editing is a very complex process and requires a lot of different type of software and libraries and third party software. It is best of you have the latest stable build of KDE and dev tools install as this will reduce the time taken to download the files required.

[root@localhost ~]# yum-builddep digikam -y

This command will check all the missing software, programs and libaries that are need to compile digikam and showfoto. This can take some time depending how fast internet access you have and what all packages are installed/missing.

No source RPM found for digikam-1.7.0-1.fc14.1.kde46.x86_64
No source RPM found for digikam-1.6.0-1.fc14.x86_64
Getting requirements for digikam-1.7.0-1.fc14.src
 --> Already installed : libgphoto2-devel-2.4.10-2.fc14.x86_64
 --> Already installed : 7:kdegraphics-devel-4.6.0-0.1.fc14.x86_64
 --> Already installed : mysql-devel-5.1.55-1.fc14.x86_64
 --> Already installed : kdepimlibs-devel-4.6.0-0.1.fc14.x86_64
 --> Already installed : desktop-file-utils-0.16-1.fc14.x86_64
 --> Already installed : gettext-
 --> Already installed : lensfun-devel-0.2.5-3.fc14.1.x86_64
 --> Already installed : mysql-server-5.1.55-1.fc14.x86_64
 --> Already installed : kdeedu-devel-4.6.0-0.1.fc14.x86_64
 --> Already installed : 7:kdegraphics-devel-4.6.0-0.1.fc14.x86_64
 --> Already installed : lcms-devel-1.19-2.fc14.x86_64
 --> Already installed : 2:libpng-devel-1.2.44-1.fc14.x86_64
 --> Already installed : 7:kdegraphics-devel-4.6.0-0.1.fc14.x86_64
 --> Already installed : liblqr-1-devel-0.4.1-1.fc12.x86_64
 --> Already installed : sqlite-devel-
 --> Already installed : libtiff-devel-3.9.4-1.fc14.x86_64
 --> Already installed : glib2-devel-2.26.0-2.fc14.x86_64
 --> Already installed : 1:doxygen-1.7.3-1.fc14.x86_64
 --> Already installed : 6:kdelibs-devel-4.6.0-0.2.fc14.x86_64
 --> Already installed : jasper-devel-1.900.1-16.fc14.x86_64
 --> Already installed : soprano-devel-2.6.0-0.1.fc14.x86_64
No uninstalled build requires

On my system as I have already all the required files installed. Once we have all the necessary software installed we will download the latest code of digikam and showfoto.

#wget -c http://anongit.kde.org/digikam/digikam-latest.tar.gz
Once the source tree is downloaded extract the tarball and execute the shell script inside. This will build the source tree. Change the directory to digikam 
[root@localhost Downloads]# cd digikam/
[root@localhost digikam]# git pull
remote: Counting objects: 168, done.
remote: Compressing objects: 100% (97/97), done.
remote: Total 97 (delta 90), reused 0 (delta 0)
Unpacking objects: 100% (97/97), done.
From http://anongit.kde.org/digikam
   a699bc9..28a90d6  development/2.0 -> origin/development/2.0
Already up-to-date.

By doing a git pull the code will be sync to the latest stable release. On your system it should pull and update the source tree. My system has been updated against the latest stable tree.

Ok now we come to the final build steps... [yep this is a long post ;)]
[root@localhost digikam]# mkdir build && cd build
[root@localhost build]# export CFLAGS='-O3 -pipe -march=native' && export  CXXFLAGS='-O3 -pipe -march=native'
We did say we were after the fastest build possible ;)
[root@localhost build]#cmake .. -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` -DCMAKE_BUILD_TYPE='release'

After cmake does a lot of checking and writes out the required files..  you should see
-- Adjusting compilation flags for GCC version ( 4.5.1 )
-- Configuring done
-- Generating done
-- Build files have been written to: /root/Downloads/digikam/build

Now just to be sure that we are making the fastest possible build for the given system, open CMakeCache.txt in a editor and make sure it has these lines.
//Flags used by the compiler during all build types.
CMAKE_CXX_FLAGS:STRING='-O3 -pipe -march=native '

[root@localhost build]#make -j6  (start the compilation, can take some time depending on the system) 
Linking CXX executable digikam                                                                                                                                                   
[100%] Built target digikam ( wow we are in business :D )
Play around with the build inside the digikam and showfoto folders and check for any stability issues. (I never had any)
[root@localhost build]#make install (to install the build)

woot woot!!!!!!!! That's it enjoy :D :D

Saturday, February 12, 2011

Quick and easy way to block ad's and spam in Fedora Linux

How many time we all wished that the web site or web page you where visiting would load up faster. Now a days no matter what site you visit blogs, news, forums, portals or generic web sites. They all are littered with all sorts of java scripts,flash animations, java applets, active-x controls and cross feeds via dynamic html/scripting to one or more advertising servers. If you have ever noticed the bottom of the web browser while opening any standard site such as Facebook, Orkut, BBC news etc, you will see the web browser trying to connect to many different sites and many many different sub domains.

Most of big sites pull content from many different sites and sub domains. At times the main site that you are trying to reach would not even load completely. All because of a slow ad server or sub domain from where it is pulling up the info or advertisement. To get out of this rut we have to refresh the page many times in hopes of the entire content being loaded. There are a few ways to get around this, today we will look at one such very easy way. This method has the added advantage that it blocks out known bad/evil domains that server Malware, Spyware and Spam. This also provides an extra layer of defense against all those hackers and script kiddies so eager to steal your data, cookies, web logins and your peace of mind in general.

Under most *nix like system the web address is first check against the HOST file. If a match is not found a DNS lookup is done for the IP address as the web browsers works on IP internally over HTTP/FTP(s). What we will do is use the host file to block unwanted domains and IP addresses.... Aha you say old trick what's so great about it.. well for starters we will use some bash script magic to automate this for us.  The list(s) comes from very well know sources like WOT/mvps.... so lets get to it. You will need the following tools installed (these are pre installed in Fedora) wget unzip dos2unix grep. If for some reason your system does not have any of these do a quick 'yum install' to install the missing tool. Copy and paste the code below and save as hostup.sh

# uphosts - Hosts File Updater
#original script found at http://guide.debianizzati.org/index.php/UpHosts
#Bad hosts are blocked putting them in the hosts file as
# To add other sources script must be manually modified
# Permanent entries must be added to the original file
# Thanks to:
# http://ubuntuedintorni.wordpress.com/2009/06/29/di-script-dns-e-file-host/
# http://hostsfile.mine.nu/downloads/updatehosts.sh.txt
# 20101216 Paolo
# has been modified to work under Fedora/RHE /CentOS

HOSTSPATH="/tmp/hosts-`date +%s`"               # Temp directory
HOSTSFILE="/etc/hosts"                          # Hosts file
ORIGFILE="$HOSTSFILE.original"                  # Backup file

CONFDIR="$(dirname $(readlink -f $0))"  # Parent directory of the script
BLACKLIST="$CONFDIR/uphosts-blacklist"  # Local Blacklist
WHITELIST="$CONFDIR/uphosts-whitelist"  # Whitelist

PROXYUSER="" #PROXYUSER="--proxy-user=user.name"
PROXYPASS="" #PROXYPASS="--proxy-password='password"

DAYS="2" # Update frequency
# Checks for root privileges
if [ "$(whoami)" != 'root' ] ; then
        echo "You need to be root to execute uphosts. Exiting!"
        exit 1

# Checks required packages
builtin type -P wget     &>/dev/null || { echo -n "wget is missing."; ABORT=1; }
builtin type -P unzip    &>/dev/null || { echo -n "unzip is missing."; ABORT=1; }
builtin type -P dos2unix  &>/dev/null || { echo -n "dos2unix is missing."; ABORT=1; }
builtin type -P grep     &>/dev/null || { echo -n "grep is missing."; ABORT=1; }

if [ $ABORT != 0 ] ; then
        echo " Exiting!"
        exit 2

# Limits updates if uphosts is run often (i.e. at every if-up)
# If there is no original hosts file this is the first run on a fresh system, and update runs anyway
if [ -f "$ORIGFILE" ] && [ `find $HOSTSFILE -mtime -$DAYS` ] ; then
        echo "$HOSTSFILE is less than $DAYS days old. Exiting!"
        exit 3
This script need Root to execute. Make the script executable by doing a #chmod +x ./hostup.sh
now run the script #./hostup.sh [You should see something like this]
Retrieving hphosts from http://support.it-mate.co.uk/downloads ... OK
Retrieving hphosts-partial from http://www.hosts-file.net ... OK
Retrieving mvps from http://www.mvps.org/winhelp2002 ... OK
Merging lists ... OK
Writing hosts file /etc/hosts ... OK
Update process complete - 134929 hosts blocked!

That's it and we are done. Enjoy a safer and fasted web experience.

P.S - In a perfect world I should have unlimited bandwidth and money ;) .... But alas though this method is great and saves a lot of pain and manual effort. It sometimes does block some sites and forums from loading properly.. if that is the case just open the hosts file in vi
#vi /etc/hosts and add a "#" to comment the site to unblock it. Do not forget to save the hosts file. Refresh the page in your browser.

Thursday, February 3, 2011

How to have beautiful fonts under linux??

One of the common complain that I have seen from new users switching over to Linux from Windows
is that they find the default Fonts installed are not that 'great' 'clean' 'crisp' as in windows.

Most  modern Linux distros including Fedora do not enable any type of "anti-aliasing" out of the box. This leads to impression that the Fonts and rendering on Linux is not that good or as good as Windows or a Mac system. This is not true at all, under fedora core 14 (KDE)

Click Fedora Menu >  Computer > System Settings > Application Appearance > Fonts > Use anti-aliasing = Enabled, Now Click Configure; Tick Use Sub-pixel rendering = RGB Hinting style = Full; Ok

Fedora users can also download a patched version of freetype to have better results.

(I have tested this patch on a 15" laptop and 24" wide screen lcd 1920x1080 resolution with good results)

Or you can also download the latest source http://sourceforge.net/projects/freetype/files/freetype2/2.4.4/freetype-2.4.4.tar.bz2/download

and compile them ...

make -j6
make install

You must log off or reboot for the new setting to be in affect. Finally do remember that fonts and amount of "tweaking" aka anti-aliasing is a pure matter of personal taste and aesthetic sense. So do not be afraid to test and experiment with the settings to find your own sweet comfort spot. :D 

Wednesday, February 2, 2011

Build MPlayer the right way and fast on Fedora

We all know Mplayer and love it for the amazing multimedia features it has...
But for a while it has not seen any updates. Today while looking around the web I found the latest RC build of Mplayer and gave it a spin and boy does it rock :D If you are anything like me and love to compile some code to get better results, this post is for you.

Do try the latest build of MPlayer ... it's not a new project/software but the new build rocks....
I got it working with very low cpu usage and good quality with the following tweaks...

Download the latest MPlayer 1.0 RC4  from here


Also download the latest source of Yasm as it is needed.
( you can always do a yum install yasm, but this will install ver 1.0.1 not the latest and greatest ver 1.1.0)


Uncompress the yasm source, use ark or the command line whatever does it for you.

extract and change to the dir..

now export the following

#export CFLAGS='-O3 -pipe -march=native -mtune=native'
#export CXXFLAGS='-O3 -pipe -march=native -mtune=native'

Note if you have a Core 2 Duo use 'core2' for better results.

#make -j6
#make -j6 check

you should get
All 41 tests passed

#make install

Now extract mplayer-checkout-2011-02-01 and change to the dir.. 

(this will check out the latest svn build of ffmpeg first, you must have a working internet connection)

#make -j6
#make install

That's it enjoy much faster and better quality video playback on your Fedora Linux.