Thursday, June 30, 2005

there is nothing called Free Lunch

there is timorousness in the air, with BSNL finishing its unlimited meals, i am now into "alavuch" saapadu(limited meals), 1gb per month, not sure if it wud be enuf, lets hope it wud be. There is a saying "Free-as in freedom and not free- as in free lunch". It looks like i am gonna miss both.
-Varun
-----------------------
How does a physicist threaten people? I will have to understand rheology by experimenting your face.

The effect on Anniyan ;-)

Dear { America, Russia, China },
If you are in need of { Astronauts, Cosmonauts, taikonauts}, please consider our tamil film heroes. They can already do zero gravity stunts at normal gravity. Hence, you can safely assume that you need not provide them the rigorous training required for a manned space journey.
Thanking You,
Yours truly,
Tamil Film Fan.
PS: you can also substitute James bond instead of Tamil film heroes (thanks Yogesh for enlightening me). Prosaic industry, what elss, hmm..., nothing original, and the ending too is too banal.

Saturday, June 25, 2005

Remote in action

My remote, i am pressing a key, you can see the IR rays! You can use this method to check if your remote is working, or rather if the batteries in your remote has not dried up. (i saw this idea in some forum, tried it out and you are reading it now. This is possible because, webcams also capture IR rays apart from visible spectrum).Posted by Hello

The normal remote (no keys pressed)

My remote, no keys pressed!. Posted by Hello

Thursday, June 09, 2005

Whats gonna happen tomorrow

Something shd happen tomorrow, if u know what i am saying here, decode it and keep it with u, dont let out the secret.

Sunday, June 05, 2005

Miscellaneous C Questions

1. How to find if a stack is progressing in forward or backward
direction using a C program?
//This code relies on the fundamental idea that function calls uses stack.

#include<stdio.h>
int* globalvar;
void myfunc(void);

int main()
{
int i,*x=&i;
myfunc();
if((globalvar-x)>0)
printf("stack progression forward");
else
printf("Stack progression backward");
}

void myfunc(void)
{
int j;
globalvar=&j;
return;
}

2. How exactly are \c and \v used in C. when i give them in a printf
statement, strange characters are printed.

according to K &R, any non standard (ie., the one's for which \(char) form is not defined, the result of printing such a thing is undefined!)
for \c ->test.c:6:16: warning: unknown escape sequence '\c'
for \v -> it prints this character - ♂ !! i read here \v stands for vertical tab and is not working (in windows gcc).

3.typedef struct{
char *;
nodeptr next; //this should be nodeptr* next; (updated from algo-geeks)
} * nodeptr;
what does nodeptr stand for?

the purpose of typedef is to provide a compile time new name.
typedef int* integer_pointer; (will allow u to write integer_pointer a; , "a" now is a pointer to an integer. )
you can understand this as:
typedef (structureinfo)* newname;
this causes nodeptr to be a pointer to the anonymous structure defined above.
Although technically right, this declaration is useless!, since the structure is anonymous.
correct me if i am wrong somewhere.
-வருண்
சௌ . வருண் அங்கு ஜீஅஞ்சல் . வணிகம்
;-)

Saturday, June 04, 2005

Interview

Quoted from interview101.com about stress interview:
I have heard a story about a candidate being asked to jump from a window. The candidate proved he was good enough for the challenge by climbing on the window and jumping inside the room (nobody said jump out of the window!).

really liked this one, that i want to post it!

Learning C

Few things that i learnt from K & R today.
1) (Page 148) quote from="K&R" A union may only be initialized with a value of the type of its first member: thus the union u described above can be initialized with integer value
The truth is that in spite of all these words by K&R, this code works
#include<stdio.h>
int main()
{

union{
int ival;
char cval;
float fval;
} u;
u.cval='a';
printf("%c %d",u.cval,u.ival);
}


2) (Page 150) Bit fields *should* be only integer, i never learnt much about bit fields, but now i understand their importance.
3)sizeof is a compiler directive
4) you cant create pointers for a register variable, although i knew this, i think, its nice to jot it down here
5) Crooked examples of pointers:
char (*(*x[3])())[5]
x: an array of [3] of pointer to function returning pointer to char of array[5] (you cant get worser than this)
6)typedefs when properly used can save a lot of head scratches!!!. I rarely(when did that rare even happen?) use typedefs in my code.
7) (this one from venks)
#include <stdio.h>
#include <unistd.h>
int main()
{ while(1)
{
fprintf(stdout,"hello-out");
fprintf(stderr,"hello-err");
sleep(1);
}
return 0;
}



Now i try to compile and execute:
[varun@localhost a]$ gcc test.c
[varun@localhost a]$ ./a.out
hello-errhello-errhello-errhello-err ..... i get this continuously.
[varun@localhost a]$

The question is, why the hell am i getting this? why dont i even get a string of hello-out?
Answers happily invited..

Friday, June 03, 2005

Morse Code-Dash Dots

Hi
I saw a really obfuscated C code, that given the text converts it to dots and dashes

-------------codestart---------------------
#define DIT (
#define DAH )
#define __DAH ++
#define DITDAH *
#define DAHDIT for
#define DIT_DAH malloc
#define DAH_DIT gets
#define _DAHDIT char
_DAHDIT _DAH_[]="ETIANMSURWDKGOHVFaLaPJBXCYZQb54a3d2f16g7c 8a90l?e'b.s;i,d:"
;main DIT DAH{_DAHDIT
DITDAH _DIT,DITDAH DAH_,DITDAH DIT_,
DITDAH _DIT_,DITDAH DIT_DAH DIT
DAH,DITDAH DAH_DIT DIT DAH;DAHDIT
DIT _DIT=DIT_DAH DIT 81 DAH,DIT_=_DIT
__DAH;_DIT==DAH_DIT DIT _DIT DAH;__DIT
DIT'\n'DAH DAH DAHDIT DIT DAH_=_DIT;DITDAH
DAH_;__DIT DIT DITDAH
_DIT_?_DAH DIT DITDAH DIT_ DAH:'?'DAH,__DIT
DIT' 'DAH,DAH_ __DAH DAH DAHDIT DIT
DITDAH DIT_=2,_DIT_=_DAH_; DITDAH _DIT_&&DIT
DITDAH _DIT_!=DIT DITDAH DAH_>='a'? DITDAH
DAH_&223:DITDAH DAH_ DAH DAH; DIT
DITDAH DIT_ DAH __DAH,_DIT_ __DAH DAH
DITDAH DIT_+= DIT DITDAH _DIT_>='a'? DITDAH _DIT_-'a':0
DAH;}_DAH DIT DIT_ DAH{ __DIT DIT
DIT_>3?_DAH DIT DIT_>>1 DAH:'\0'DAH;return
DIT_&1?'-':'.';}__DIT DIT DIT_ DAH _DAHDIT
DIT_;{DIT void DAH write DIT 1,&DIT_,1 DAH;}
==============code end===================
from
-----http://www.ioccc.org/1986/hague.c-------

The nice part of it is that the source itself looks like morse code text ;-) dit dah!!!
-... -.-- . ---.. ? ---.. ...- .- .-. ..- -.
(guess what this is?) Put the answer in comments

Thursday, June 02, 2005

Linspire- Uninspire

Linspire - Un Inspire

Yesterday, i got chance to test the Linspire boot CD, got from Digit DVD ISO. I thought it would be a good one and decided to keep a personal copy. So i wrote in CD-R. To my surprise, it was too bad, i really dint like it!!, 1 hour of my precious time before computer wasted ( u know these days my time before computer has become precious? Ppl who know about me know it!!) . My mandrake /fc3 and ubuntu hoary boot CD are far better, i really dint find anything that sticks to the word that "its the next windows". Really speaking i felt there was nothing in it. It was another theme for KDE. eh!. Anyway, that was my taste, but i really liked the theme of linspire. anyway, i usually dont like i586 OS for my system, since they dont support Cool and Quiet and keep my computer temperature high and run at higher clock cycles (My system has Cool and Quiet technology, by which the clock cycle speed is increased on demand, saving power and keeping the system cool and quiet) :-(

Linspire really needs a lot of improvement if it wants to say that it is replacement for both windows and (other) linux OSes. The only thing they had was Real Player and Flash Player pre-installed!. (you can install them both without hassles from their respective sites ! for x8-64 u have problems installing flash-no 64 bit flash support yet!). I could better get away with helix player and use mplayer or xine whatever for linux and good old windows media player for my parents who listen some bhakti songs. Personally, i wish some better distro come up because i can introduce linux easily for my parents, and then they can learn something new (and) in an interesting way. Lets see which distro maker is lucky;-) (this is the other way of saying, i wish some distro maker does this). You can give some reasons saying it was just a demo live CD, yes! it was a demo CD, so what opinion i have may change if i buy ;-) a copy of Linspire.

Wednesday, June 01, 2005

TOS

TOS - Top of Stack, Test of Strength, Test of Skype.
I tested the video module of skype, and i also tested skype with sridhar, there was some lag (as much as 10 seconds), its good that skype is available for all platforms, and it functions well on all platforms, but has to improve on the lag problem (i guess its coz of bandwidth problems? not sure ).

Search this site

Google