Skip to main content

Posts

Showing posts from 2008

Java Source Code to Change Local IP Address

Hi guys..

Try This code to change your Local IP address.


import java.io.IOException;
import java.lang.Runtime;
public class Chang_Ip {



public static void main(String args[]) throws IOException
{

String str1="192.168.0.201";
String str2="255.255.255.0";
String[] command1 = { "netsh", "interface", "ip", "set", "address",
"name=", "Local Area Connection" ,"source=static", "addr=",str1,
"mask=", str2};
Process pp = java.lang.Runtime.getRuntime().exec(command1);

}


}

How to Add User to Samba Server

There are two steps to creating a user. First we'll run the smbpasswd utility to create a samba password for the user.

sudo smbpasswd -a username

Next, we'll add that username to the smbusers file.

sudo gedit /etc/samba/smbusers

Add in the following line, substituting the username with the one you want to give access to. The format is = "". You can use a different samba user name to map to an ubuntu account, but that's not really necessary right now.

username = "username"

Now you can create samba shares and give access to the users that you listed here

How to change Grub menu background image

Grub is a Linux boot manager that is used to switch between two or more operating systems installed on your machines. By default, Grub's background is plain black with white text. In this article, we will change Grub's default background to any image of your choice.


1 Create the background image

Using your favorite image editing software, create a logo or an image that will look good even with very few colors. Save your image as a PNG with only 14 colors and resize it to 640x480 pixels.


2 Convert the PNG to XPM

If you use GimpShop or The GIMP, you can directly save your image as XPM. But for Photoshop users, you'll have to use ImageMagick's convert utility to convert your image to the format that GRUB uses (make sure the you have ImageMagick installed). To start converting, open your terminal and issue the following command:

$ convert splash.png -resize 640x480 -colors 14 splash.xpm


3 Compress the image file

Now that we have our image ready, we will need to compress it to mak…

SlChart Open source Jsp Tag Library for Creating Data Grids

About SlChart


Author: - Chandima prabath ariyarathna




SlChart is a Jsp Tag Library for creating data tables in different format. SlChart table can use any jsp project. It is very easy to use.
This tag library contains main two attribute.

1. id :- Bean id name
2. viewMode :- Data grid view mode (ex:- html,htmlGrid,xml)





More Details


Download Tag library with Documentation

English Sinhala Dictionary for the Firefox

University of Colombo School of Computing Language research lab lunched the
English-Sinhala dictionary for the Firefox. New release lunch for the firfox3. It is very help full project to all and UCSC language research lab done by other great project for the localize software. It is one of the best language research lab in the Asia. UCSC is the one of the main Foss contributor in the Sri Lanka. There are other lot of open source research are currently doing by the UCSC.
This Firefox plug-in is very easy to install.
For more Information Visit:- UCSC language reseurch lab
Download plug in

Java Source code to print Hello world without semicolon

Try to this code
if(System.out.printf("Hello world")==System.out.printf(""))
{

}

Try to this code
if (System.out.append("hello world ") instanceof Object)
{
}


Try to this code

try {
if (System.out.getClass().getDeclaredMethod("println",

Class.forName("java.lang.String")).invoke(System.out,
"HelloWorld ") ==null) {
}
} catch (Exception e) {
}
}
}



Try to This Code
This code wrote by Asanka Priyanjith

public class MainClass {

public static void main(String[] args) {


if(System.out.printf("%s", "Hello world") != null){

}
}

}


Web Server Load Balancing Survey Paper

Abstract
The popularity of the WWW has made web traffic the fastest growing component of Internet traffic. Cashing and replication is becoming a most popular method to reduce Network traffic. While caching could efficiently reduce the network traffic, only replication could be helpful for reducing web server’s response latency and increasing document availability for most popular web sites, the replication of information across independent or coordinated Mirrored servers is becoming a common choice, and among various solutions, a distributed web server system is the most promising one. The distributed web server system becomes a most famous because user doesn’t need to do anything manually. The concept of load balancing is very simple one:” Spreading the work across the several machines”. Implementation of this idea is quit complex.An intuitive approach for load balancing among web servers is the IP-dispatcher approach. The main idea of this approach is to use a front-end dispatcher to…

Liferay Portal

Liferay Portal is the world's leading open source enterprise portal solution using the latest in Java and Web 2.0 technologies.

* Built in Content Management System (CMS) & Collaboration Suite
* Out-of-the-box usablility—choose from over 60 portlets
* Out-of-the-box development tools
* Out-of-the-box localization to 22 languages!
* Runs on all major application servers, databases and operating systems
* Benchmarked among the most secure portal platforms
* Business-friendly MIT License



Created for the enterprise, Liferay Portal provides a virtual space where you can centralize, share and collaborate.

Built with the end user in mind, Liferay Portal's award winning user interface is easy enough to master by even the least technical of users.

Liferay Portal also remains one of the most popular portal technologies within the developer community with an ever-growing list of features that help your IT team deploy business solutions with minimal time and effort.

Java Library to get Folder Content

FolderContentLib is the java library published under GPL license written by Chandima prabath ariyarathna. Using this library, you can check all file and file path inside the folder include the file which are include in the subfolders .

Features:-

File content(String folderPath)
Using this method you can get file names which are inside the folder.This method return String Array.



PathContent(String folderPath)
Using this method you can get file names and path which are inside the folder.This method return String Array.



How to access:-
Example source code to access library.


If you want to get source code Click on the picture

Download LibDownload Source

Open source license

software licensing

Allowing an individual or group to use a piece of software. Nearly all applications are licensed rather than sold. There are a variety of different types of software licenses. Some are based on the number machines on which the licensed program can run whereas others are based on the number of users that can use the program. Most personal computer software licenses allow you to run the program on only one machine and to make copies of the software only for backup purposes. Some licenses also allow you to run the program on different computers as long as you don't use the copies simultaneously

Reference:-webopedia

GNU LESSER GENERAL PUBLIC LICENSE
Copyright (C) 2007 Free Software Foundation, Inc.

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by th…

Get Local Ip address using java

Its very simple ,for the testing you want to import "java.net.InetAddress" package

//Get an instance of InetAddress for the local computer
InetAddress inetAddress = InetAddress.getLocalHost();

//Get a string representation of the ip address
String ipAddress = inetAddress.getHostAddress();

//Print the ip address
System.out.println(ipAddress);

Java Source code to check patition free space in Linux & Windows

this is java code for check free space in partition..


private static final Pattern NON_DIGIT = Pattern.compile("(([^0-9]*))");
private static final Pattern WORDS = Pattern.compile("(\\s*(\\S+)\\s*)");

public static long getFreeSpace(File file) {
final String osName = System.getProperty("os.name");
try {
if (osName.indexOf("Windows") != -1) {
return freeSpaceWindow(file);
} else if (osName.equals("Linux")) {
return freeSpaceUnix(file);
} else {
System.err.println("Unknown os=" + osName);
return freeSpaceUnix(file);
}
} catch (IOException ex) {
ex.printStackTrace(System.err);
return -1;
}
} // end getFreeSpace

private static long freeSpaceUnix(File file) throws IOException {
Process process = Runtime.getRuntime().exec("df");

How to write Port Scaner using Java

This is source code for port scanner.Very easy to implement.If port is available return true.If port is unavailable return false.



public static boolean PortScanner(String host,int port) throws UnknownHostException
{

Socket worker = null; //makes all the connections
int Port =port; //make port
InetAddress hostAddress; //stores the IP address of the target
boolean status=false;
String Host=host;

hostAddress=InetAddress.getByName(Host);

try
{
worker= new Socket(hostAddress,Port);
status=true;
}
catch(java.io.IOException e)
{
status=false;
}

finally
{
try
{
worker.close();
}
catch(java.io.IOException e){}
catch(NullPointerException e){}
}

return status;
}

Best Open Source Reporting Engine

Jasper is open source java base reporting engine.I used jasper for report generated for
my project.wow it's very nice.I,m used ireport visual tool for Report designing.There are lot of features for designing report.It's very easy and can generate very nicely.Ireport tool provide some nice templates.We can use this templates also.
You can try it for the more details click here

Ubuntu Mobile Edition

Ubuntu Mobile is an Ubuntu edition that targets an exciting new class of computers called Mobile Internet Devices.
Ubuntu Mobile, based on the world's most popular Linux distribution, and MID hardware from OEMs and ODMs, are redefining what can be done in mobile computing.

Ubuntu Mobile, a fully open source project, gives full Internet, with no compromise. Custom options may include licensed codecs and popular third-party applications.

* Full Web 2.0/AJAX fidelity, with custom options of Adobe Flash®, Java, and more
* Outstanding media playback so you can enjoy videos, music and photos with superior quality and easy navigation
* A suite of applications that work seamlessly to meet every need of a digital parent, student or anyone who is on-the-go
* Facebook®, MySpace®, YouTube®, Dailymotion®, 3D games, GPS, maps, in short, the full Web 2.0 experience delivered into your hands as a compact and powerful device that's easy and fun to use

The product of Canonical collabor…

Run Windows and Linux without virtualization

Linux does everything that many users want it to, but some people have tasks that require Windows applications. You can dual-boot both operating systems, or run Windows in a virtualized environment on Linux. Alas, virtualization makes the guest OS almost useless for processor- and RAM-intensive tasks like editing videos and playing games. Now, a Ubuntu-based distro called andLinux takes cooperation with Windows to a whole new level.
The miracle ingredient in andLinux is its coLinux kernel. The coLinux project takes a stable release of the Linux kernel and ports it to run on Windows. That means that, unlike virtualization software, andLinux installs on Windows like any other application.
But there's more to andLinux than just sticking the coLinux kernel in a stock Ubuntu. According to Joachim Gehweiler, one of the developers of andLinux, the project also had to roll in the Xming X server and PulseAudio sound server and make sure these components work together.
Read more....…

How to Customize Ubuntu

Reconstructor is an Ubuntu GNU/Linux CD Creator.

It uses the Desktop(Live), Alternate(Install), or Server disc as a base, and then allows for user customization.
For the Ubuntu Desktop base, you can customize the entire environment. For instance, you can add/remove software, change the default look (splash, themes, fonts, wallpaper, etc.), add desktop links, etc.
For the Alternate and Server bases, you can add any additional software to the disc that you would like installed.
Reconstructor is written in python and is licensed under the GNU General Public License (GPL).

My Free and Open Source Project

I desired to start a FOSS project because Sri Lanka is one of the main Foss contributors in the world. But we haven’t enough Foss projects. There are very good project like “Sahana” but it’s not sufficient.

About “ALOKAYA” project
This is neural network framework for Linux. Any AI base software can build on this framework. Very easy to develop software on this framework. This is not traditional framework. This framework provide framework + libries for the development project

Join with this project......

Introduction to Ubuntu 8.04 Beta

The Ubuntu developers are moving very quickly to bring you the absolute latest and greatest software the open source community has to offer. This is the Ubuntu 8.04 beta release, which brings a host of excellent new features.

Note: This is still a beta release. Do not install it on production machines. The final stable version will be released in April 2008.

Download

Get it while it's hot. ISOs and torrents are available at:

http://releases.ubuntu.com/releases/8.04 (Ubuntu)
http://releases.ubuntu.com/releases/edubuntu/8.04 (Edubuntu add-on)
http://releases.ubuntu.com/releases/kubuntu/8.04 (Kubuntu)
http://cdimage.ubuntu.com/kubuntu-kde4/releases/8.04/beta (Kubuntu with KDE4)
http://cdimage.ubuntu.com/jeos/releases/8.04/beta (Ubuntu JeOS)
http://cdimage.ubuntu.com/xubuntu/releases/8.04/beta (Xubuntu)
http://cdimage.ubuntu.com/ubuntustudio/releases/8.04/beta (UbuntuStudio)
http://cdimage.ubuntu.com/mythbuntu/releases/8.04/beta (Mythbuntu)

Ubuntu Networking Configuration Using Command Line

You can configure a network interface from the command line using the networking utilities. You configure your network client hosts with the command line by using commands to change your current settings or by editing a number of system files.

Configuring DHCP(Dynamic Host Configuration Protocol ) address for your network card

If you want to configure DHCP address you need to edit the /etc/network/interfaces and you need to enter the following lines replace eth0 with your network interface card

sudo vi /etc/network/interfaces

# The primary network interface - use DHCP to find our address
auto eth0
iface eth0 inet dhcp

Configuring Static IP address for your network card

If you want to configure Static IP address you need to edit the /etc/network/interfaces and you need to enter the following lines replace eth0 with your network interface card

sudo vi /etc/network/interfaces

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.3.90
gateway 192.168.3.1
netmask 255.255.255.0
n…

How to find File in Linux

For that we can use "find" command.

EXAMPLES

find /home -user joe

Find every file under the directory /home owned by the user joe.

find /usr -name *stat

Find every file under the directory /usr ending in ".stat".

find /var/spool -mtime +60

Find every file under the directory /var/spool that was modified more than 60 days ago.

find /tmp -name core -type f -print | xargs /bin/rm -f

Find files named core in or below the directory /tmp and delete them. Note that this will work incorrectly if there are any filenames containing newlines, single or double quotes, or spaces.

find /tmp -name core -type f -print0 | xargs -0 /bin/rm -f

Find files named core in or below the directory /tmp and delete them, processing filenames in such a way that file or directory names containing single or double quotes, spaces or newlines are correctly handled. The -name test comes before the -type test in order to avoid having to call stat(2) on every file.

find . -type f -exec file '{}' \;

Runs `…

Repo Linux Command for Ubuntu

1. Created /opt/repo directory (could be the home directory)
2. Created the directory /opt/repo/binary (copied from Debian specs)
3. Copied all debs from my update from /var/cache/apt/archives to /opt/repo/binary
4. Executed dpkg-scanpackages like this:
# pwd
/opt/repo
# dpkg-scanpackages binary /dev/null | gzip -9c > binary/Packages.gz
5. Burned a CD with its contents

Madura Dictionary on Linux

I,m try to install ubuntu on the Linux.First i,m instal wine and next install Madura english sinhala Dictionary on the wine.it is very easy.these are the steps you want to follow.

First you want to install wine.
Doble click the madura setup icon



Select the installation path
Following setup instruction.



Then you want to install Madura font to linux.I'm try to this in Ubuntu 7.10.In this OS there is folder call "share" -->usr/share
There are font called "Madura.ttf".this font file move to the "share" folder.

This is the final view of Madura dictionary.
Download Madura

J2ee Architecture

J2ee is a java core architecture.It is a famous technology for the enterprise application.Consider about j2ee there are lot of technology.JspejbServletJmsThese are the main technologies in J2ee.These are introduced by Sun micro system.There are lot of design patterns in j2ee.I,m familiar with MVC design pattern.Lot of application developed using MVC architecture.M-model, V-view, C-control .




jsp
jsp is the main client side component in j2ee. There are two way to design jsp pages

ScripletsTag librariesScriplets
Scriplet mean we can write java code in HTML page using <% %>,<%= %> tags. Using this pattern we can design very easily.But not efficient. Because if we are using scriplet code in jsp page.This code execute on the client side that is the reason.
Tag libraries
Tag Libraries mean we can write jsp page using tags.There are standard tag libraries in j2ee and we can define our own tag libraries.It is efficient war to developing jsp pages

Link:-Java sever page

Java IDE in Linux

There are lot of IDE to develop java in Linux.NetBeans and Eclipse is the most famous.Both of are open source .you can download and test it very easily.You can check enterprise application also in Linux environment.There are lot of open source application server available in internet.i using and testing both normal application and enterprise level application in Linux environment.It's very easy and very fast.I did my project in netbeans in Linux environment.it is very easy. Try
it..................


This is the screen shot of NetBeans , Eclips IDE

Enabling Sinhala in Linux

How to installAdd to /etc/apt/sources.listOn Debian 4.0 (Etch)deb http://sinhala.sourceforge.net/debian/i386/etch/ ./On Debian testing (Lenny)

deb http://sinhala.sourceforge.net/debian/i386/lenny/ ./On Ubuntu 7.10 (Gutsy) i386

deb http://sinhala.sourceforge.net/ubuntu/i386/gutsy/ ./On Ubuntu 7.10 (Gutsy) amd64

deb http://sinhala.sourceforge.net/ubuntu/amd64/gutsy/ ./Update repository metadata:
apt-get updateInstall Sinhala packages:
apt-get install sinhala-gnu-linuxUpgrade relevant packages:
apt-get upgradeLogout and login again. Environment variables need to be set/updated (NO NEED TO REBOOT)
How to testVisit http://si.wikipedia.org/ and see if the Sinhala letters render correctly.Copy and paste some of the content from Sinhala wikipedia to Open Office Writer. Then highlight the Sinhala text and choose the LKLUG font to display them.To test SCIM, press Control-space whilst you are running a GNOME application. Then select one of the Sinhala input methods
Read More

A First Look at the Final Release of KDE 4.0

After five long months of development, the most expected project of 2007, KDE 4, has finally seen the light today! KDE 4 is the next generation of the popular K Desktop Environment, which seeks to fulfill the need for a powerful yet easy-to-use desktop, for both personal and enterprise computing. KDE project's goal for the 4.0 release is to put the foundations in place for future innovations on the FREE desktop.

Screenshot KDE 4.0





How to Change splash in Ubuntu

there's a symbolic link in /usr/share/pixmaps/splash pointing to the ubuntu splash image.

Just recreate it pointing to YOUR png file like this:

Code: cd /usr/share/pixmaps/splash
sudo mv path_to_your_splash.png ./mysplash.png
sudo rm ubuntu-splash.png => we're just deleting a link, not the png
sudo ln -s mysplash.png ubuntu-splash.png Done! Fast and easy!


To cancel changes, just delete the link again and rebuilt it pointing to the original png:

Code: cd /usr/share/pixmaps/splash
sudo rm ubuntu-splash.png
sudo ln -s ubuntu-slick.png ubuntu-splash.png

Setting up Compiz/Fusion 3D Desktop in Ubuntu

Compiz/Fusion is a 3D desktop environment for your Linux system. Its objective is to make the various elements that are visible on your computer look more physical. It aims to make your work less tiring and increase productivity through more natural visual perception. One way to do that is by placing the windows and icons on a three-dimensional looking cube, that can be rotated. Another way is to keep the windows or menus in motion after you move or expand them, sort of like a piece of paper floating on the desk. This makes is easier to track which window or menu has just been activated. Compiz/Fusion provides many settings and parameters to customize these effects, and the results depend each user's preferences and work habits. In my own experience I found that these features pretty much work as intended
The wobbly behavior may seem unsettling at first, but after getting used to it, it does make for a less tiring work experience. In order to be able to use Compiz/Fusion in Ubuntu…