# Jokes

Found these while stumblingupon again……Maybe chaat for some….;)

Q: What does the Little Mermaid wear to math class?
A: An algebra.

Q: What is the shape of a dead parrot?
A: A polygon.

Q: Why did the mathematician-dentist name is son Pi?
A: Because everyone knows pi is transcendental.

Q: What’s the difference between a PhD in Mathematics and a large pizza.
A: The pizza can feed a family of four.

=>  Math problems? Call 1-800-[4-x(2 pi)2]-sin(b)/xy.

Theorem: A cat has nine tails. Proof: No cat has eight tails. A cat has one more tail than no cat. Therefore, a cat has 8+1=9 tails. QED.

The ark lands after the Flood. Noah lets all the animals out, saying, “Go and multiply.” Several months pass. Noah decides to check up on the animals. All are doing fine except a pair of snakes. “What’s the problem?” asks Noah. “Cut down some trees and let us live there,” say the snakes. Noah follows their advice. Several more weeks pass. Noah checks on the snakes again. Lots of little snakes crawl over the earth, and everybody is happy. Perplexed, Noah asks, “Want to tell me how the trees helped?” “Certainly,” say the snakes. “We’re adders, and we need logs to multiply.”

You know you’re a mathematician if you’ve ever wondered how Euler pronounced Euclid.

# The Evolution of a Programmer

## High School/Jr.High

```  10 PRINT "HELLO WORLD"
20 END```

## First year in College

```  program Hello(input, output)
begin
writeln('Hello World')
end.```

## Senior year in College

```  (defun hello
(print
(cons 'Hello (list 'World))))```

## New professional

```  #include <stdio.h>
void main(void)
{
char *message[] = {"Hello ", "World"};
int i;

for(i = 0; i < 2; ++i)
printf("%s", message[i]);
printf("\n");
}```

## Seasoned professional

```  #include <iostream.h>
#include <string.h>

class string
{
private:
int size;
char *ptr;

string() : size(0), ptr(new char[1]) { ptr[0] = 0; }

string(const string &s) : size(s.size)
{
ptr = new char[size + 1];
strcpy(ptr, s.ptr);
}

~string()
{
delete [] ptr;
}

friend ostream &operator <<(ostream &, const string &);
string &operator=(const char *);
};

ostream &operator<<(ostream &stream, const string &s)
{
return(stream << s.ptr);
}

string &string::operator=(const char *chrs)
{
if (this != &chrs)
{
delete [] ptr;
size = strlen(chrs);
ptr = new char[size + 1];
strcpy(ptr, chrs);
}
return(*this);
}

int main()
{
string str;

str = "Hello World";
cout << str << endl;

return(0);
}```

## Master Programmer

```  [
uuid(2573F8F4-CFEE-101A-9A9F-00AA00342820)
]
library LHello
{
// bring in the master library
importlib("actimp.tlb");
importlib("actexp.tlb");

// bring in my interfaces
#include "pshlo.idl"

[
uuid(2573F8F5-CFEE-101A-9A9F-00AA00342820)
]
cotype THello
{
interface IHello;
interface IPersistFile;
};
};

[
exe,
uuid(2573F890-CFEE-101A-9A9F-00AA00342820)
]
module CHelloLib
{

// some code related header files

// needed typelibs
importlib("actimp.tlb");
importlib("actexp.tlb");
importlib("thlo.tlb");

[
uuid(2573F891-CFEE-101A-9A9F-00AA00342820),
aggregatable
]
coclass CHello
{
cotype THello;
};
};

#include "ipfix.hxx"

extern HANDLE hEvent;

class CHello : public CHelloBase
{
public:
IPFIX(CLSID_CHello);

CHello(IUnknown *pUnk);
~CHello();

HRESULT  __stdcall PrintSz(LPWSTR pwszString);

private:
static int cObjRef;
};

#include <windows.h>
#include <ole2.h>
#include <stdio.h>
#include <stdlib.h>
#include "thlo.h"
#include "pshlo.h"
#include "shlo.hxx"
#include "mycls.hxx"

int CHello::cObjRef = 0;

CHello::CHello(IUnknown *pUnk) : CHelloBase(pUnk)
{
cObjRef++;
return;
}

HRESULT  __stdcall  CHello::PrintSz(LPWSTR pwszString)
{
printf("%ws
", pwszString);
return(ResultFromScode(S_OK));
}

CHello::~CHello(void)
{

// when the object count goes to zero, stop the server
cObjRef--;
if( cObjRef == 0 )
PulseEvent(hEvent);

return;
}

#include <windows.h>
#include <ole2.h>
#include "pshlo.h"
#include "shlo.hxx"
#include "mycls.hxx"

HANDLE hEvent;

int _cdecl main(
int argc,
char * argv[]
) {
ULONG ulRef;
DWORD dwRegistration;
CHelloCF *pCF = new CHelloCF();

hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);

// Initialize the OLE libraries

CoRegisterClassObject(CLSID_CHello, pCF, CLSCTX_LOCAL_SERVER,
REGCLS_MULTIPLEUSE, &dwRegistration);

// wait on an event to stop
WaitForSingleObject(hEvent, INFINITE);

// revoke and release the class object
CoRevokeClassObject(dwRegistration);
ulRef = pCF->Release();

// Tell OLE we are going away.
CoUninitialize();

return(0); }

extern CLSID CLSID_CHello;
extern UUID LIBID_CHelloLib;

CLSID CLSID_CHello = { /* 2573F891-CFEE-101A-9A9F-00AA00342820 */
0x2573F891,
0xCFEE,
0x101A,
{ 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 }
};

UUID LIBID_CHelloLib = { /* 2573F890-CFEE-101A-9A9F-00AA00342820 */
0x2573F890,
0xCFEE,
0x101A,
{ 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 }
};

#include <windows.h>
#include <ole2.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "pshlo.h"
#include "shlo.hxx"
#include "clsid.h"

int _cdecl main(
int argc,
char * argv[]
) {
HRESULT  hRslt;
IHello        *pHello;
ULONG  ulCnt;
IMoniker * pmk;
WCHAR  wcsT[_MAX_PATH];
WCHAR  wcsPath[2 * _MAX_PATH];

// get object path
wcsPath[0] = '';
wcsT[0] = '';
if( argc > 1) {
mbstowcs(wcsPath, argv[1], strlen(argv[1]) + 1);
wcsupr(wcsPath);
}
else {
fprintf(stderr, "Object path must be specified\n");
return(1);
}

// get print string
if(argc > 2)
mbstowcs(wcsT, argv[2], strlen(argv[2]) + 1);
else
wcscpy(wcsT, L"Hello World");

printf("Text String %ws\n", wcsT);

// Initialize the OLE libraries

if(SUCCEEDED(hRslt)) {

hRslt = CreateFileMoniker(wcsPath, &pmk);
if(SUCCEEDED(hRslt))
hRslt = BindMoniker(pmk, 0, IID_IHello, (void **)&pHello);

if(SUCCEEDED(hRslt)) {

// print a string out
pHello->PrintSz(wcsT);

Sleep(2000);
ulCnt = pHello->Release();
}
else
printf("Failure to connect, status: %lx", hRslt);

// Tell OLE we are going away.
CoUninitialize();
}

return(0);
}```

## Apprentice Hacker

```  #!/usr/local/bin/perl
\$msg="Hello, world.\n";
if (\$#ARGV >= 0) {
while(defined(\$arg=shift(@ARGV))) {
\$outfilename = \$arg;
open(FILE, ">" . \$outfilename) || die "Can't write \$arg: \$!\n";
print (FILE \$msg);
close(FILE) || die "Can't close \$arg: \$!\n";
}
} else {
print (\$msg);
}
1;```

## Experienced Hacker

```  #include <stdio.h>
#define S "Hello, World\n"
main(){exit(printf(S) == strlen(S) ? 0 : 1);}```

## Seasoned Hacker

```  % cc -o a.out ~/src/misc/hw/hw.c
% a.out```

## Guru Hacker

`  % echo "Hello, world."`

## New Manager

```  10 PRINT "HELLO WORLD"
20 END```

## Middle Manager

```  mail -s "Hello, world." bob@b12
Bob, could you please write me a program that prints "Hello, world."?
I need it by tomorrow.
^D```

## Senior Manager

```  % zmail jim
I need a "Hello, world." program by this afternoon.```

## Chief Executive

```  % letter
% mail
To: ^X ^F ^C
% help mail
% damn!
!: Event unrecognized
% logout```

# OS bloopers

• Tech Support: “May I ask what operating system you are running today?”
• Customer: “A computer.

—————————————————————————————–

• Me: “Oh, I use Linux.”
• Friend: “What is it?”
• Me: “An operating system.”
• Friend: “Like Firefox?”

—————————————————————————————

Overheard in a software shop:

• Woman #1: “What this Linux thing?”
• Woman #2: “It’s a program that if you have it on your computer, you can’t turn the computer off.”
• Woman #1: “Oh.”

————————————————————————————–

• Customer: “Well, everything is working fine, but there is one program that is not.”
• Tech Support: “What program is it?”
• Customer: “It’s called ‘MSDOS Prompt’.”
• Tech Support: “What’s wrong with it?”
• Customer: “Well, I click on it, a black screen shows up with NOTHING but a sign that reads: ‘C:\WINDOWS>’, and it just sits there and doesn’t do anything. I have to turn off the system to go back to Windows.”

————————————————————————————–

# Beauty of Numbers

I was stumblingupon sites when i came across something really beautiful . Maybe all of u must be aware of it anyways take a look.

1 x 8 + 1 = 9
12 x 8 + 2 = 98
123 x 8 + 3 = 987
1234 x 8 + 4 = 9876
12345 x 8 + 5 = 98765
123456 x 8 + 6 = 987654
1234567 x 8 + 7 = 9876543
12345678 x 8 + 8 = 98765432
123456789 x 8 + 9 = 987654321

Further….

1 x 9 + 2 = 11
12 x 9 + 3 = 111
123 x 9 + 4 = 1111
1234 x 9 + 5 = 11111
12345 x 9 + 6 = 111111
123456 x 9 + 7 = 1111111
1234567 x 9 + 8 = 11111111
12345678 x 9 + 9 = 111111111
123456789 x 9 +10= 1111111111

Further still…..

9 x 9 + 7 = 88
98 x 9 + 6 = 888
987 x 9 + 5 = 8888
9876 x 9 + 4 = 88888
98765 x 9 + 3 = 888888
987654 x 9 + 2 = 8888888
9876543 x 9 + 1 = 88888888
98765432 x 9 + 0 = 888888888

Finally…

1 x 1 = 1
11 x 11 = 121
111 x 111 = 12321
1111 x 1111 = 1234321
11111 x 11111 = 123454321
111111 x 111111 = 12345654321
1111111 x 1111111 = 1234567654321
11111111 x 11111111 = 123456787654321
111111111 x 111111111=12345678987654321

# Screenlets

Screenlets are screen applets.They look good and provide great functionality.They are small owner drawn applications written in Python.They are a really good alternative to gDesklets too.

Heres how you go about installing them:
For Fedora:
You need gnome-keyring and python devel packages installed. Also you need the rsvg libraries.
Switch to the super user in the terminal.Then
``` yum install python-devel gnome-python2-keyring ```
Also install the rsvg libraries.
``` yum install gnome-python2-rsvg.i386 librsvg2.i386 librsvg2-devel.i386 ```
and extract it to a folder. Navigate to the folder and run
``` python setup.py install ```
Screenlets daemon and manager is installed.
To run the screenlets manager goto Applications=>Accessories=>Screenlets
or
in the terminal
``` screenlets-manager ```
You can customize their startup properties ,etc. from here.

# 21

Hello everybody…..I just finished writing the code for my project and hence have time (??) to write this post.Anyways,yesterday I watched ’21’ with my dad at ESquare(a multiplex near my house).

The aspect of the movie that probably attracted me  was MIT.I assumed that the story would be of J.P.Massar who headed the MIT Blackjack team based on the documentary shown on History Channel some time back.This team used card counting techniques to ‘bring down the house’.But as it turns out the movie is hardly all true (a nice one time watch though).Blackjack as it turns out is a gambling game but also beatable.In most gambling games roulette, dice, slot machines, the lottery the events are independent of each other i.e. events of the past do not determine the future.The probability of every outcome is same on every roll of the dice or spin of wheel.Hence in blackjack if you count correctly you can earn a fortune.Casinos and bookmakers make certain that the probabilities are always stacked slightly in their favor.To know more on the mathematics of blackjack go thorugh The Mathematics of Gambling.

A documentary aired on BBC “Making Millions the easy way” reports the activities of the MIT blackjack team.They comment on the future of card counting in the following way:

“In the early 1990s, however, a new breed of counters emerged. They had a greater level of resources, training and attention to detail than the casinos had ever encountered. Semyon Dukach, Katie Lilienkamp and Andy Bloch were all studying at MIT when they heard of card counting as a way to make extra money. MIT had a history of card counting. Indeed, Ed Thorp himself had developed the original system whilst at MIT, using one of the most powerful computers in the world at that time.

MIT counters played in teams, usually of three or more. Each individual was given a specific role. Some would simply watch tables, and wait for favourable situations to appear (the ‘spotters’). They would call in the expert strategist (the ‘controller’) who would fine-tune exactly when was the optimum moment to play, and how much to bet according to the cards being played. The controller would secretly signal to a ‘big player’ who would then join a table and place a massive bet at exactly the right moment.

The key was that by only betting when the odds were well in the big player’s favour, the big player could maximise potential profit, and also avoid being spotted as a counter. By watching a number of tables at any time, the team could select only those with the greatest promise of a good return. The big player simply looked like a rich, arrogant young gambler who got lucky on a single bet.

The MIT players went to great lengths to conceal both their own identities and their team play. They would work relentlessly to exploit any edge they could find – inexperienced dealers, poor shuffling or lax security. They also recorded exactly how much profit they managed to make from each situation, and honed their skills to be incredibly close to optimum play.

The trio played blackjack all over the world on and off throughout most of the 1990s, making money wherever they played. Their exploits only came to an end when Griffin Investigations, a private agency hired by casinos, identified the members of the MIT teams after months of surveillance. From that point on a team player even entering a casino would be swiftly ejected.

Card counting still occurs wherever blackjack is played, though as casino technology advances it becomes harder and harder to make anything but a small profit. Facial recognition technology, computerised blackjack tables and rule changes are slowly eating away at the small advantage possible through counting. But the lure of easy money makes it unlikely the casinos have seen the last of the counters. For 40 years they have found ways to make profit, and their ingenuity is bound to succeed again.”

So is Winner, winner, chicken(veg for all AOL guys) dinner! enough for you ….

# Breaking spaghetti in two pieces.

Try this out.Take uncooked spaghetti and bend it until it cracks.How many pieces do you expect? 2. Richard Feynman showed by breaking a lot pasta that uncooked spaghetti will rarely break into two pieces.It can break into three , seven or ten pieces.

French physicists Dr Basile Audoly and Dr Sébastien Neukirch say the answer is related to waves of vibration that pass through the pasta when dry spaghetti is bent and suddenly released at one end.

And don’t think this is a minor discovery: the researchers think their findings can be applied to civil engineering to make structures like buildings and bridges more stable.

After taking high-speed images of the broken spaghetti, they applied the Kirchhoff equation, an equation that relates to how waves travel through an object that’s put under stress. The researchers conclude that spaghetti fragmentation is caused by a burst of flexural, or elastic, waves that travel along the spaghetti after the initial break.

And they added that this “physical process of fragmentation is relevant to many areas of science and technology,” a fact confirmed by Rod Cross, a professor of physics at the University of Sydney, Australia.

“If you can understand how spaghetti breaks you can understand how anything else breaks including a building an aeroplane or a car,” he says. “Under impact they’ll all vibrate and break. More to the point it can be a human leg, because if you whack a human leg it’ll probably break in three or four bits as well for the same reason.”

# Louis Posa

This is from a book Mathematical Gems – Ross Honsberger .Its a very famous story of the child prodigy Louis Posa.He was born sometime in the 1940’s and very young attracted the attention of the eminent Hungarian mathematician Paul Erdos.

This is the story of Louis Posa as told by Paul Erdos:

” I will talk about Posa who is now 22 years old and is an author of 8 papers.I met him before he was 12 years old.When I returned from the United States in the summer of 1959 I was told a little oy whose mother was a mathematician and knew quite a bit about high school mathematics.I was very interested a the next day I had lunch with him.While Posa was eating soup I asked him the following question:Prove that if you n+1 integers <= 2n , some pair of them are relatively prime. It is quite easy to see that its not valid for n integers as because no 2 of the n even numbers upto 2n are relatively prime.Actually I discovered this proof some years ago and took about 10 minutes to find a really simple solution.Posa sat there eating his soup and said half a minute later “If you have n+1 integers <= 2n two of them must be consecutive and hence relatively prime.” Needless to say , I was very much impressed, and I venture to class this on the same level as Gauss’ summation of the positive integers upto 100 when he was only 7 years old.From that time onward I worked systematically with Posa.I wrote to him of problems many times during my travels.While still 11 he proved the following theorem which I proposed to him:A graph with 2n vertices and n^2+1 edges must contain a triangle. which he proved at 12 ….” The story goes on…..

Edit : Sorry for the terrible mistake . Thanks to kundor for pointing out the error .