Ubuntu file comparison tool – Bcompare

Beyond Compare for ubuntu

There are some command line tool for compare two files. But i need a gnome application. The command line tools are.

For fcomp you need to install fhist.

apt-get install fhist

Then i tried meld . This is a Gnome based file comparison tool for ubuntu. you can install this using ubuntu software center. This is an opensource one. But its not working as expected [ May be i am not know the power of meld  ]. I just tried some files.

When i was a windows user :) [till using windows in my office] i used beyond compare. That is too good for file compare and merge. Now i searched that software for ubuntu. Yes they provide software for Linux too..

I installed beyond compare in ubuntu 10.04.

steps:

Here some screen shots:

After installing you can open bcompare from Application –> Programming –> Beyond Compare

For file comparison you can Right click in a file and choose scripts –> Select for compare

Now the File difference

Posted in How to, Linux | Tagged , | Leave a comment

How to add Red5 service

How to add Red5 service

In this article you are going to add red5 service in your Linux box.

Please use the Below script.


#!/bin/bash
# Author www.arulraj.net
# red5    This is used to start, stop, restart and status of red5
#

export RED5_HOME=/opt/red5

PID=0
RTMPPORT=1935
prog="red5"

start(){
 status
 if [ $PID -eq 0 ] ; then
 echo $"Starting $prog..."
 nohup $RED5_HOME/red5.sh 1> $RED5_HOME/log/stdout.log 2> $RED5_HOME/log/stderr.log < /dev/null &
 PID=$!
 echo $"$prog started at port $RTMPPORT and PID[$PID]."
 else
 echo
 fi
 return $PID
}

stop(){
 status
 if [ $PID -eq 0 ] ; then
 echo
 else
 echo $"Stopping $prog..."
 $RED5_HOME/red5-shutdown.sh
 echo $"PID[$PID] is killed."
 fi
 return $PID
}

restart(){
 stop
 sleep 2
 start
}

status() {
 RTMPPORT=`cat $RED5_HOME/conf/red5.properties | grep -w "rtmp.port" | awk -F= '{print $2}'`
 #PID=`lsof -i | grep java | grep *:$RTMPPORT | awk '{print $2}'`
 PID=`ps -ef | grep red5 | grep java | awk '{print $2}'`
 if [ x"$PID" == "x" ] ; then
 PID=0
 echo $"$prog is not running."
 else
 echo $"$prog running on port $RTMPPORT and PID[$PID]."
 fi
 return $PID
}

# How its called.
case "$1" in
 start)
 start
 ;;
 stop)
 stop
 ;;
 status)
 status
 ;;
 restart)
 restart
 ;;
 *)
 echo $"Usage: $0 {start|stop|status|restart}"
 PID=1
esac

exit $PID

Steps:

  • Save these shell script lines as a file. For mine i saved as file “red5″
  • Copy this file to /etc/init.d/
  • Then execute the below commands to start red5 when your system starts

I checked with ubuntu 10.04. For chkconfig work on ubuntu you need to install chkconfig

This above script Not working in Ubuntu

apt-get install chkconfig

Usage:
Start : /etc/init.d/red5 start
Stop : /etc/init.d/red5 stop
Status : /etc/init.d/red5 status
Restart : /etc/init.d/red5 restart
Please Let me know if you have any issues or better ideas…
Posted in How to, Linux | Tagged , , , | Leave a comment

Tamil FM radio for ubuntu

How to add Tamil FM radio for ubuntu

Ubuntu having a superb software for playing media files, podcast, online radio and playlist etc., The software is Rhythmbox . Using that software you can add any online radio. This post for add tamil FM radios to ubuntu Rhythmbox.

How to add Tamil FM to ubuntu 10.04 ..?
Goto Application –> Sound & Video –> Rhythmbox Music Player

Then Click the Add Radio button. That button is in Top Right Last button.

Then Enter this URL for Hello FM [Tamil language]

mmsh://bdcast-ind-hellon-enusew3aswepuku.wm.llnwd.net/bdcast_ind_hellon_enusew3aswepuku?MSWMExt=.asf

Then press Add button. Now you can hear Hello FM at any Time. I will update the AAhaa FM and Radio City FM soon…

Posted in How to, Linux | Tagged , | Leave a comment

Mic problem in ubuntu 10.04

Mic Problem in ubuntu 10.04 for Root user

I am using ubuntu 10.04 in my laptop. I created a user when installing ubuntu . The sound and Mic are working fine for that user. I enabled the root by using the following command

To enable root user. Login with existing user then goto Terminal.

sudo passwd root

Now the root user is enabled. I logged in with root user. I seen the sound is not working for me. The volume icon is always in “mute” state

What is the Error shown …?
When i click the “Sound Preference” in volume button or System –> Preference –> Sound it always shows a Warning message “Waiting for Sound system to respond”

How to fix mic problem for root user ..?
Goto System –> Preference –> Startup Applications .

Now you need add a new startup application. Add “pulseaudio” as a startup application

Name: pulseaudio
Command : /usr/bin/pulseaudio
Comment: To start pulseaudio deamon

Then logout and login again. For min i restarted my system. Now you can see the Volume control icon in unmute state and you can edit your sound preference now.

Editing sound preference:

Posted in How to, Linux | Tagged , | Leave a comment

Offline dictionary for ubuntu 10.04

Why offline dictionary ..?
Anyway ubuntu 10.04 have dictionary by default. You can find the dictionary from Application –> office –> Dictionary. You can find the meaning of a english word using this. When you search for meaning of a word its communicate with online dictionary server for ex. dict.org then get the result. If you not having the Net connection / poor connection its useless. In this situation offline dictionary will helpful to you. For this you need to install dictionary server in your local ubuntu machine. here is how to do this.
How to install dictionary server in local ..?
Goto terminal and run the following commands
apt-get install dictd
apt-get install dict-gcide
apt-get install dict-moby-thesaurus

dictd – This is the Dictionary server which supports DICT protocol.
dict-gcide – English Dictionary
dict-moby-thesaurus – thesaurus data source in English. This is an optional one

Yes now you are successfully installed a dictionary server. Now you need to add this server with your dictionary client.

How to add local dictionary to dictionary client ..?
Goto Dictionary then Edit –> Preference

Click the “Add” button to add a new dictionary

Enter your local dictionary details.
Dictionary name : Default
Transport : Dictionary Server
Hostname : 127.0.0.1
Port : 2628

Thats all. Now you can search locally.

Posted in How to, Linux | Tagged | 3 Comments

Print screen using java

Is there any api for capure my screen ..?
You no need any api. Java have Is there any api for capure my screen ..?the inbuild functionalities for this. Using the Robot class you can print your screen. Here is the code sample and explanation.

Example code :

import java.awt.image.BufferedImage;
import java.awt.Rectangle;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.Robot;
import java.io.File;
import javax.imageio.ImageIO;

class ScreenRecorder {
public static void main(String args[]) {
   try {
       Toolkit tool = Toolkit.getDefaultToolkit();
       Dimension d = tool.getScreenSize();
       Rectangle rect = new Rectangle(d);
       Robot robot = new Robot();
       Thread.sleep(2000);
       File f = new File("screenshot.jpg");
       BufferedImage img = robot.createScreenCapture(rect);
       ImageIO.write(img,"jpeg",f);
       tool.beep();
       } catch(Exception e){
	    e.printStackTrace();
      }
    }
}
  • Import the classes you need.
  • Using the ToolKit you can get your screensize.
  • Form a Rectangle object with this width and height
  • capture the screen for this full width and height.
  • There is a Thread.sleep for 2 sec for my convenience
  • You can specify your own width and height by

rect = new Rectangle(640,480);

I think this is help you more. Now am working on record the desktop using java. Soon i will come up with good product.

Captured Image:

Posted in Programming | Tagged | Leave a comment

Ubuntu FAQ

Hi i am using ubuntu in my laptop . Previously i am using windows os. i face some problems like how to open my computer in shorcut, show desktop, Run etc., i search in google and resolve here i explain how to do those things. This is not for ubuntu/linux guru’s only for newbies like me :)

How to open My computer (filesystem) in ubuntu ..?

There is a command called “nautilus” . This will help you. Open Terminal then type “nautilus /” this will open your filesystem. Then create Launcher (shortcut) for this.

How to Create a shortcut ..?

Go to your Desktop. Then Right Click –> Select “Create Launcher”. It shows a window Fill up the like the below

In the Create Launcher window Type this Command “nautilus /”. Select your own name and own comment. Then click OK. Now the your “My Computer ” icon is created in the Desktop like the below

Using the nautilus command you can create the shortcut for any folder. For Home folder change the command “nautilus /root” .

There is a another method to do all the things.
Goto terminal then type “gconf-editor” it opens a Configuration Editor. Its like a Registry Editor in windows operating system.

Its like the below

Goto Configuration Editor –> apps –> nautilus –> Desktop
Then Check the checkbox “computer_icon_visible” and “home_icon_visible” . Now the your computer and Home icons are shown in your desktop.

How to create custom keyboard shortcut ..?

In ubuntu you can create your own custom keyboard shortcut. Goto System –> Preference –> keyboard shortcuts.

It opens a new window. Click the Add button then Enter your own name and type the command for that. For example if you want to open “System Monitor” its like Task manager in windows type this command “gnome-system-monitor”. Then press Apply. Now its time to select your shortcut keys. Select which one you added then choose your combination of keys.

How to set environmental variables ..?
Lot of ways available to set the environmental variable. But this is the most simple one. You can add your variable in “/etc/environment” file
open this file then add your bin folder in the PATH. You can add HOME variable like “JAVA_HOME” in the next line.

Some Ubuntu shortcuts :

To open Terminal window CTRL+ALT+T
To open Run window ALT+F2
To Choose the Desktop Windows key + E
Show Desktop CTRL+ALT+D

Posted in How to, Linux | Tagged , , | Leave a comment

Install Ubuntu 10.04 in Acer 5740

In this blog post i am going to explain how to install ubuntu 10.04 in Acer 5740 laptop. Recently i bought a new Acer 5740 laptop with DOS Operating System. The total price is Rs.30,000 in chennai. Before buying this laptop i fixed in my mind use only Linux Operating system in my new laptop. I have tried many other distros like Linux mint, Fedora and opensuse in vmware. Apart from that i like ubuntu, because user friendly. ok now let into the topic.

Here is my system Configuration:

How to install ubuntu ..?

Steps:

  • Download the DVD from http://cdimage.ubuntu.com/dvd/current/
  • Just Plug the dvd in your 5740 laptop.
  • Select your Language
  • Then select “Install ubuntu”
  • Select your Time Zone
  • Select your Keyboard layout
  • Select your Partition option- i choose the default one
  • Enter the Login user details
  • Now copying files progress bar. This process only take too much off times for me, approximately it takes more than 45 min.
  • Yes. you done it. you are successfully installed.

How to enable root user in ubuntu ..?

Go to Terminal. keyboard Shortcut for terminal is press CTRL + ALT + T. Then type the below command

root@arul-laptop:~# sudo passwd root
Enter the new password and confirm the password. You can restrict the user privilege by Goto System -> Administration -> User and Groups and click the advanced option.
Photo Slide show:

Thanks to my friend Mr.Ponraj natarajan for helping me installing ubuntu. Without him it does not happen.
Posted in How to, Linux | Tagged , | 1 Comment

Jsp to Servlet converter

Jsp to Servlet converter

Here is the Ant build file to convert jsp file to servlet file.

jspc (JavaServerPages Compiler) tool is helping to convert the jsp. The requirements are you need

  • java sdk
  • apache tomcat
  • ant

The build.xml is

<project name="Test" default="compile" basedir=".">

    <description>

        JSP to Servlet Converter

    </description>

<property name="name" value="JSP to Servlet" />

<property environment="env" />

<property name="ANT_HOME" value="${env.ANT_HOME}" />

<property name="TOMCAT_HOME" value="D:\server\Tomcat 5.5" />

  <target name="init" description="Initialization" >

    <path id="tomcat.classpath">

      <fileset dir="${TOMCAT_HOME}\common\lib">

            <include name="*.jar" />

      </fileset>

    </path>

    <path id="ant.classpath">

      <fileset dir="${ANT_HOME}\lib">

            <include name="*.jar" />

      </fileset>

    </path>

    <path id="webapp.classpath">

      <fileset dir=".\WEB-INF\lib">

            <include name="*.jar" />

      </fileset>

    </path>

  </target>

  <target name="compile" depends="init" description="compile the source" >

    <mkdir dir="./out" />

    <jspc srcdir="."

          destdir="out"

          verbose="9">

      <classpath>

            <path refid="tomcat.classpath" />

            <path refid="ant.classpath" />

            <path refid="webapp.classpath" />

      </classpath>

      <include name="*.jsp" />

    </jspc>

  </target>

  <target name="build" depends="compile"/>

  <target name="clean" description="clean the directories">

      <delete dir="./out" />

  </target>

</project>
Posted in Programming | Tagged | Leave a comment

Java offline Documentation

Java offline Documentation

why it is need ..?

If you not have or limited bandwidth internet connecion in your machine at that time it is very helpfull to solve your java programming problems. The java documentation of your project is help to easily understand the classes and functions used in that project.

How to create a java documentation ..?

It is very easy using the javadoc tool you can create a documentation for any java program. First create a documentation for java

In windows:

Extract that C:\Program Files\Java\jdk1.6.0_10\src.zip to C: then

C:\>cd src

C:\src>dir /s /b *.java > files.txt

C:\src>javadoc -J-Xmx756m @files.txt

In Linux:

[root@localhost ~]# cd /usr/local/java/jdk1.6.10

[root@localhost ~]# find -r *.java > files.txt

[root@localhost ~]# javadoc -J-Xmx756m @files.txt
Posted in Programming | Tagged | Leave a comment