NP = P?

Computer science is largely concerned with a single question: How long does it take to execute a given algorithm? But computer scientists don’t give the answer in minutes or milliseconds; they give it relative to the number of elements the algorithm has to manipulate.
P denotes set of problems which can be solved in polynomial time i.e. having solution times proportional to O(n raise to k), k is any constant. Whereas, NP is class of problems whose solution can be verified in polynomial time and its solution times for some inputs might go near exponential times or so...
The question “Does NP equal P?” means “If the solution to a problem can be verified in polynomial time, can it be found in polynomial time?”
Click here to read more...

P, NP, and NP-Completeness: The Basics of Computational Complexity

Java Program to illustrate - changing contents within the same JFrame object

This can be helpful when one need to make a GUI based java software. When you need that the contents of the same frame object get replaced by contents of another container/panel when a user clicks on the say, 'NEXT' button. Following program will give you hints about how you could do that..
Program Name: GUItest.java
import javax.swing.*;
public class GUItest extends JFrame
{
    GUItest()
    {
        setSize(300, 200);
        setVisible(true);
//        setLayout(new GridLayout(1,1));
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.add((new JPanel()).add(new JButton("Hello")));
        this.getContentPane().removeAll();
        this.add((new JPanel()).add(new JButton("World!!")));
    }
    public static void main(String args[])
    {
        GUItest frame1 = new GUItest();
    }
}

Dive into the source code of UNIX

Want to observe how OS works at lower level but find source code of linux  and its features bewildering. Get started with the ->
Lions' Commentary on Unix 6th Edition, with Source Code, San Jose, CA: Peer-to-Peer Communications, 1996.
For your reference, here is the source code and here is the commentary.



Here is an another resource for OS implementation text, instead more precisely for Minix3 unix-based operating system :
Operating Systems : Design and Implementation by A.S. Tanenbaum

Create your own C Header file

See the following simple example to learn: (tested in gcc)
File 1: myLib.c
int sum(int a, int b)
{
      return a+b;
}
File 2: myLib.h
int sum(int, int);
File 3: testLib.c
#include<stdio.h>
#include"myLib.h"
int main()
{
      printf("%d\n",sum(10,20));
      return 0;
}
Commands to run:
gcc myLib.h myLib.c testLib.c
./a.out

so fast - Judy Arrays

 Some of the reasons Judy outperforms binary trees, b-trees, and skip-lists:
  • Judy rarely compromises speed/space performance for simplicity (Judy will never be called simple except at the API).
  • Judy is designed to avoid cache-line fills wherever possible. (This is the main design criteria for Judy.)
  • A b-tree requires a search of each node (branch), resulting in more cache-line fills.
  • A binary-tree has many more levels (about 8X), resulting in more cache-line fills.
  • A skip-list is roughly equivalent to a degree-4 (4-ary) tree, resulting in more cache-line fills.
  • An "expanse"-based digital tree (of which Judy is a variation) never needs balancing as it grows.
  • A portion (8 bits) of the key is used to subdivide an expanse into sub-trees. Only the remainder of the key need exist in the sub-trees, if at all, resulting in key compression.

Learn more here.

A puzzle game (with video solution)

All submissions for this problem are available.
Johnny has some difficulty memorizing the small prime numbers. So, his computer science teacher has asked him to play with the following puzzle game frequently.
The puzzle is a 3x3 board consisting of numbers from 1 to 9. The objective of the puzzle is to swap the tiles until the following final state is reached:
1 2 3
4 5 6
7 8 9
At each step, Johnny may swap two adjacent tiles if their sum is a prime number. Two tiles are considered adjacent if they have a common edge.
Help Johnny to find the shortest number of steps needed to reach the goal state.

Input:

Battery charging for Android-phones via wi-fi

Perpetual charging on the go for your Android phone might no longer be a distant dream, courtesy the new AirPower technology developed by RCA which sucks power from WiFi signals and constantly charges your phone’s battery.
Read more.

Mobile Application Development On Symbian

For all those who are not too sure what Symbian is . It is an Operating System for Smartphones used widely by leading mobile phone manufacturers like NOKIA, Samsung, Sony-Ericsson. And hold your breadth, virtually 50% of all smart-phones run on Symbian ( these figures are not cooked up)....
Read more.

The Wonders of the MIT Media Lab

The Media Lab at the Massachusetts Institute of Technology (MIT) is the kind of place that makes you think the future might not be so scary after all. Instead of being a wasteland overrun by machines hell-bent on human destruction, the students here are encouraged to build the kind of future they want to see. And that’s more likely to mean a world full of Star Trek gadgets and friendly robots that want to make you a cup of fair-trade coffee. Read more....

Conversion of C/C++ program to Assembly Language using g++ compiler

Use the following statement :
g++ filename.c -S
or
g++ filename.cpp -S
example 1:
c program: Int.c
#include
int main()
{
    int a =10;
    int *p = (int *)&a;
    *p = *p + 1;
    printf("Value at pointer p = %9d\nValue of a         = %9d\n",*p, a);
    printf("Value of pointer p = %9u\nAddress of a       = %9u\n",(unsigned int)p,(unsigned int)&a);
    return 0;
}
statement executed at the terminal:

Open source for Website Development

Hello Everyone!!
I was looking for softwares which may allow to develop a website by people sitting at different locations. I have come across some softwares (but these may not be what i was looking for..) -
  1. Joomla
  2. Joomlaperformance - for Joomla Extensions
  3. Cakephp- Start Guide.
  4. Moovum - Anti-spam software for Joomla websites
  5. Elxis- Features, System Requirements, Getting started.

Windows: Edit the list of users at the Welcome Screen(Tetsed on XP SP2)

Run regedit
Goto the following from the left navigation windows:
Microsft > Windows NT > Winlogon > SpecialAccounts > UserList
If 'Name123' is the username of the account you don't want at windows welcome screen then:
Edit > New > DWORD Value
Name it Name123.


But still one can access the hidden user account by pressing Ctrl+Alt+Delete and manually filling up username and password.


Deleting the above created entry later will bring back the username at the welcome screen at all times.

Want to check which port is being used by which process in Windows?

Execute the following in cmd.exe:
netstat -aon
for the list of all open ports and corresponding process Ids (pid).


Name of the application for a particular pid can be retrieved by:
tasklist

Filters can be applied in the above commands in case the output is verbose using pipeline ( | ) :
Example:
netstat -aon | findstr 3306
It will show only those line which has 3306.


Learn MS DOS commands

Learn MS DOS commands:
Try this.
Example:
MORE Display output, one screen at a time


Learn Prolog (for Ubuntu users)

Newbie in Prolog? Want to know how to compile programs in this 'Logic based' or 'Rule based' Programming Language?
If yes, then read on..

Assuming you have installed the packages 3 or 1 and 2:
1. gprolog
2. gprolog-doc
3. swi-prolog

where gprolog and swi-prolog are compilers of prolog.

Example to run:
1. Make a file append.pl with your favourite editor say vim or pico.
2. Following are its contents:
%append.pl
append([],Y,Y).
append([A|B],Y,[A|W]) :- append(B, Y,W).
3. Run the following command in the terminal form the directory of your program.
prolog
4. Now run the following command to consult your axioms:
['append.pl'].
5. Following are some queries which I tried:
append(A,B,[1,2]).
A = [],
B = [1,2] ;
A = [1],
B = [2] ;
A = [1,2],
B = [];
false.
6. Remember the following keyword to exit the prolog interface:
halt.

Post comment in case any suggestion or to request to get more information (backtracing using fail. and prunning using cut,! ) on the topic.

Webpage to pdf

Want to save webpage to read later?
Want to save it in pdf format?

Try this:
http://www.web2pdfconvert.com/

Kindle Wireless Reading Device, Free 3G + Wi-Fi, 6" Display, Graphite, 3G Works Globally - Latest Generation

Installing LAMP (tested for Ubuntu)

1.) Open the Terminal(command prompt).
2.) run the following:
sudo apt-get install lamp-server^
(Sources: 1.)

Can anyone tell me how can i use lamp after installing it?

Google Codejam 2010 :(

Qualification Round:
Problems  can be viewed here.
My result rank: 8555 =( Not Qualified.

Recover dual-boot Ubuntu - Making Windows Load GRUB (and then Linux)

Problem Situation: Let me call the 2 patitions A and B. A contains Windows xp sp2 and B contains Ubuntu 9.04. Windows got corrupt. I reinstalled windows in Partition A. Finally when i rebooted my computer, there was no option to access Ubuntu(partition B). Now i can work only from Windows. How could I recover Ubuntu?

Solution: 
This is taken from Dual-Boot Linux and Windows 2000/Windows XP with GRUB HOWTO.

Boot through Windows to insert Ubuntu Live CD and then restart your computer. Now automatically Ubuntu Live CD will bootup.

1. In Linux Live CD Interface open a command window.

10 tips to improve the way you speak English

Many deserving candidates lose out on job opportunities because of their vernacular accent.
Can I 'neutralise' my accent?
Yes, you can. All you need to do is train yourself to speak English as comfortably and perfectly as you speak your mother tongue.
How do you train yourself? By inculcating certain practices in your daily lifestyle. These will get you closer to sounding like a native English speaker and equip you with a global accent -- and you will speak not American or British English, but correct English.
This is the first step to learn any other accent, be it American or British or Australian.
Lisa Mojsin, head trainer, director and founder of the Accurate English Training Company in Los Angeles, offers these tips to help 'neutralise' your accent or rather do away with the local twang, as you speak.
i. Observe the mouth movements of those who speak English well and try to imitate them.
When you are watching television, observe the mouth movements of the speakers. Repeat what they are saying, while imitating the intonation and rhythm of their speech.
ii. Until you learn the correct intonation and rhythm of English, slow your speech down.
If you speak too quickly, and with the wrong intonation and rhythm, native speakers will have a hard time understanding you.
Don't worry about your listener getting impatient with your slow speech -- it is more important that everything you say be understood.

My 'IPL Match' Trip

14 March 2010
It was Feb end. A group of 10-11 friends, including me, were enjoying lunch in one of the college corridors. Discussions were going on as usual. We started discussing IPL matches. There was a match on 13th of march between Punjab and Delhi, the day I had my last mid-semester exam. The match was at 8pm in Mohali. So, We friends thought it a great trip rejuvenate ourselves after the exams.

We all bought tickets. We were around 10 - Myself, Sahil, Punil, Chitvan, Vikas, Anshul, Deevanshu... Exams went slowly taking every drop of us. Finally after the last exam, we met at the bus stand at around 4pm to depart from Patiala as planned. We took a bus to Chandigarh. After getting the bus, everyone was eager to reach to the destination at the earliest. Meanwhile we gossiped, read SMSes, talked and laughed together in the cool breeze coming in from windows.