Friday, April 30, 2010


"The main objectives of GNU/Linux project should not be influenced by rat race between commercial organization for making profit." So let's use distribution which is completely non profit and should be community driven like Fedora, CentOS, Slackware, Debian and many more.

Friday, April 16, 2010

Nimbus : OpenSolaris GTK2.x theme

I liked openSolaris's GTK2.x theme, so I searched for it and got it.
After installing it on Mandriva 2010.0 , it gives effective look to my desktop

Sunday, April 11, 2010

Use Base for building DataBase application

Here are links which will demonstrate the use of OOo Base to create database applications.

these links will be helpful to you.
Long Live Linux :)

Friday, April 9, 2010

thanks to plug: i got idea to regain browing speed at linux

today only , i thought the problem which i got while browsing on firefox can be overcomed by disabling ipv6 protocol settings. this can be done by setting 'network.dns.disableIpv6' option to true in about:config and this works really now quit happy to get browsing speed back on linux :)

Solaris leaves GPL so chance for Linux to konquer market

as Oracle decided to leave support of GPL for its Solaris OS, this brings great opportunity for Linux to konquer the market of Servers and Desktops.

Long Live Linux

Wednesday, April 7, 2010

Bye Bye Windows xxxxx

finally Windows gone from my room pc.

i want to (...and got the reason) keep only GNU/Linux on my pc :)

this will help to contribute my efforts towards GNU/Linux.

Welcome Mandriva :)

finally Windows gone from my room pc.

i want to (...and got the reason) keep only Mandriva on my pc :)

Tuesday, April 6, 2010


on 4th april 2010, i have brought new quad core pc on my room
(overcoming much difficulties)

i'm thankful to those who made that thing slightly easier for me especially mom
and mama.

continuing multitasking again.

Bellman Ford Algorithm

import java.util.Arrays;
import java.util.Vector;

public class BellmanFord {
public static int INF = Integer.MAX_VALUE;

// this class represents an edge between two nodes
static class Edge {
int source; // source node
int destination; // destination node
int weight; // weight of the edge
public Edge() {}; // default constructor
public Edge(int s, int d, int w) { source = s; destination = d; weight = w; }

public static void main(String[] args) {
Vector edges = new Vector(); // a sample vector of edges of some graph
edges.add(new Edge(0, 1, 5));
edges.add(new Edge(0, 2, 8));
edges.add(new Edge(0, 3, -4));
edges.add(new Edge(1, 0, -2));
edges.add(new Edge(2, 1, -3));
edges.add(new Edge(2, 3, 9));
edges.add(new Edge(3, 1, 7));
edges.add(new Edge(3, 4, 2));
edges.add(new Edge(4, 0, 6));
edges.add(new Edge(4, 2, 7));
bellmanFord(edges, 5, 4);

public static void bellmanFord(Vector edges, int nnodes, int source) {
// the 'distance' array contains the distances from the main source to all other nodes
int[] distance = new int[nnodes];
// at the start - all distances are initiated to infinity
Arrays.fill(distance, INF);
// the distance from the main source to itself is 0
distance[source] = 0;
// in the next loop we run the relaxation 'nnodes' times to ensure that
// we have found new distances for ALL nodes
for (int i = 0; i < nnodes; ++i)
// relax every edge in 'edges'
for (int j = 0; j < edges.size(); ++j) {
// analyze the current edge (SOURCE == edges.get(j).source, DESTINATION == edges.get(j).destination):
// if the distance to the SOURCE node is equal to INF then there's no shorter path from our main source to DESTINATION through SOURCE
if (distance[edges.get(j).source] == INF) continue;
// newDistance represents the distance from our main source to DESTINATION through SOURCE (i.e. using current edge - 'edges.get(j)')
int newDistance = distance[edges.get(j).source] + edges.get(j).weight;
// if the newDistance is less than previous shortest distance from our main source to DESTINATION
// then record that new shortest distance from the main source to DESTINATION
if (newDistance < distance[edges.get(j).destination])
distance[edges.get(j).destination] = newDistance;
// next loop analyzes the graph for cycles
for (int i = 0; i < edges.size(); ++i)
// 'if (distance[edges.get(i).source] != INF)' means:
// "
// if the distance from the main source node to the DESTINATION node is equal to infinity then there's no path between them
// "
// 'if (distance[edges.get(i).destination] > distance[edges.get(i).source] + edges.get(i).weight)' says that there's a negative edge weight cycle in the graph
if (distance[edges.get(i).source] != INF && distance[edges.get(i).destination] > distance[edges.get(i).source] + edges.get(i).weight) {
System.out.println("Negative edge weight cycles detected!");
// this loop outputs the distances from the main source node to all other nodes of the graph
for (int i = 0; i < distance.length; ++i)
if (distance[i] == INF)
System.out.println("There's no path between " + source + " and " + i);
System.out.println("The shortest distance between nodes " + source + " and " + i + " is " + distance[i]);

Dijkstra's Shortest Path Algorithm - Cannot be used if negative edge weight is present.

Dijkstra's Shortest Path Algorithm

Let the node at which we are starting be called the initial node. Let the distance of node Y be the distance from the initial node to Y. Dijkstra's algorithm will assign some initial distance values and will try to improve them step-by-step.

  1. Assign to every node a distance value. Set it to zero for our initial node and to infinity for all other nodes.
  2. Mark all nodes as unvisited. Set initial node as current.
  3. For current node, consider all its unvisited neighbors and calculate their distance (from the initial node). For example, if current node (A) has distance of 6, and an edge connecting it with another node (B) is 2, the distance to B through A will be 6+2=8. If this distance is less than the previously recorded distance (infinity in the beginning, zero for the initial node), overwrite the distance.
  4. When we are done considering all neighbors of the current node, mark it as visited. A visited node will not be checked ever again; its distance recorded now is final and minimal.
  5. Set the unvisited node with the smallest distance (from the initial node) as the next "current node" and continue from step 3.