Monday, November 23, 2009

Problem in installing FireBug


I had to change my working environment to a new machine where I had to reinstall all the needed software again. At that time I ran into a great trouble in installing FireBug to firefox. Whenever I installed it it ask me to restart but when it gets restarted there s no FireBug installed.

I tried many variation that was available online spend a long time in figuring out that. Tried with many version of either software, shagging the profiles ect… but nothing worked out or not error messages were given. Finally I tried with disabling the virus scan (mine is kaspersky). Luckily at that time it worked fine.

Wednesday, November 4, 2009

tips on writing efficient javascript code



When writing web application the influence of javascript becomes a must. And it is used to make the application more user-friendly and interactive. So writing it in a effective manner helps to make the javascript code to run fast.

I found a fairly good article on this topic which is a good article even for a beginner. You can find it here

Thursday, October 22, 2009

Tips for the beginners in web development on forms

When it comes to web front end development it seems to a hassle. Many hate... (Including me ;)) coz u have to spend a lot of time in making a small thing happen..
I think it might be coz that we are not knowing the proper fundamentals..

But there are quite a very few tutorials that help you to learn about it...

Fortunately I found a pretty good article on web forms which explains about the best practices to be used. You can find the article here..

hope you will enjoy :)



Saturday, May 23, 2009

GO green with blackle



During these days of the hot topic that is prevailing in the IT industry is that the ‘Go Green ‘ . Where it the initiatives are made to reduce the environmental hazardous those are caused by the IT industry.

One of the main issue under this is that the power consumption. And the studies have been resulted that searching (simple Goggling) is eating a larger amount of energy and that people use it very often. So to reduce the power consumption for this searching a Google powered search engine is created with all black background. That is what “Blackle” is.

This  work same as the Google but the different here is that the background is in black in order to reduce the power consumption in the monitors since it need less power to light up the screen.


If u are really a great environment lover just try 2 shit to ‘Blackle’ from ‘Google’. But both are the same product but under different name ;)

Thursday, May 14, 2009

Notebook vs netbook

Thought now the topic of net book seems bit of an old topic to be spoken about this is a really a good topic to be discussed about. I found a cool vedion on this in youtube. really a good one 

Thursday, October 30, 2008

implementing Dining philosophers problem

it s just an example algorithm that can be use to avoid statvation as well as deadlock....
 

----------------------------------
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package diningphilosopy;

/**
 *
 * @author FARHATH
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
        Chopstick chpk[] = new Chopstick[5];
        Philosophers phil[] = new Philosophers[5];
        Thread[] threads = new Thread[5];
        for(int i =0 ; i<5;>
            chpk[i]= new Chopstick(i);
        }
        for(int i=0; i<5;>
            if(i== 4){
                phil[i] = new Philosophers(i, chpk[0], chpk[i]);
            }
            else{
            phil[i] = new Philosophers(i, chpk[i+1], chpk[i]);
            }
            
        }
        for(int i =0 ; i<5;>
            threads[i] = new Thread(phil[i]);
            threads[i].start();
           
        }
    }

}
----------------------------

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package diningphilosopy;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author FARHATH
 */
public class Philosophers implements Runnable {

    private int PhilId;
    private Chopstick left,  right;

    public Philosophers(int id, Chopstick left, Chopstick right) {
        this.PhilId = id;
        this.left = left;
        this.right = right;
    }

    public int getPhilId() {
        return PhilId;
    }

    public void setPhilId(int PhilId) {
        this.PhilId = PhilId;
    }

    public Chopstick getLeft() {
        return left;
    }

    public void setLeft(Chopstick left) {
        this.left = left;
    }

    public Chopstick getRight() {
        return right;
    }

    public void setRight(Chopstick right) {
        this.right = right;
    }

    public void run() {
        for (int i = 0; i <>
            try {
                Thread.sleep(1);
                boolean hasTakenUp = false;
                boolean hasAte = false;
                int attempt = 1;
                Thread.sleep(10);
                do {
                    
                    synchronized (right) {
                        synchronized (left) {
                            if (!right.isIsUp() && !left.isIsUp()) {
                                right.pickUp();
                                left.pickUp();
                                hasTakenUp = true;
                                System.out.println("Philosoper " + PhilId + " got the sticks in his " + attempt + " attempt "  );
                            }
                        }
                    }
                    
                    if (hasTakenUp) {
                        eat();
                        hasAte = true;
                    }
                    else{
                        System.out.println("Oophs ! philosopher "+ PhilId+ "didn't get the chance to eat in his "+ attempt+ " attempt  " );
                    }
                    
                    Thread.sleep(10);
                    attempt++;
                }while(!hasAte);
            } catch (InterruptedException ex) {
                Logger.getLogger(Philosophers.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }

    public void eat() {
        try {
            Thread.sleep(10);
            System.out.println("----The philosopher " + PhilId + " is eating now------");
            right.keepDown();
            Thread.sleep(10);
            left.keepDown();
            Thread.sleep(10);
            System.out.println("The philosopher " + PhilId + " is back to thinking now");
            Thread.sleep(10);
        } catch (InterruptedException ex) {
            Logger.getLogger(Philosophers.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
------------------

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package diningphilosopy;

/**
 *
 * @author FARHATH
 */
public class Chopstick {
private int stickId;
private boolean isUp;

    public Chopstick(int id){
        this.stickId = id; 
    }
    public int getStickId() {
        return stickId;
    }

    public void setStickId(int stickId) {
        this.stickId = stickId;
    }

    public boolean isIsUp() {
        return isUp;
    }

    public void setIsUp(boolean isUp) {
        this.isUp = isUp;
    }
    public boolean pickUp(){
       System.out.println("The chopstick  "+ stickId + " is picked up");
        isUp = true;
        return true;
    }
    public void keepDown(){
       System.out.println("The chopstick  "+ stickId + " is kept down back");
        isUp = false;
    }
}
-------------