 |
Recent Blogs |
by Nightscript on Fri 19th Dec 5am
Yes i'm crazy but heres what ive been thinking about and it seems more reasonable that a lot of reality. Note that this ties into parapsychology/psychokinesis research.
Mind is not over matter. Thats the wrong state of thinking for sure.
Look, this is how i think i see it now, im enlightened or ignorant but such is the world. Every time.
The thing ive come across is that when we think it is Mind over matter we are convinced that we can directly influence an object or anything else. Thats because we figure that our Mind is stronger than anything we might put it up against. On a previous article i've written, I said that we would need to find out where the Mind interacts with our brain in order to initiate action.
ok gang here comes.
Its true what i said earlier..our Mind is most definitely NOT [over] matter. And since we dont really have any method scientifically to find the Mind itself can we not say that Mind IS matter? Yes we can, because if you will also think back to my discussion of Mind and conciousness, i said that we each exist in Our world and that everything can seemingly be based around us. Though most folks interact to some degree with things that will never have anything to do with them, the world I speak of is the one you live in, walk and talk through each day. So our Mind is everything that our world or our personal universe is made of. Mind is Matter.
With the fact or idea (whichever you prefer) that Mind is Matter, (not the literal sense, like..grey matter...idiot.) um with that idea...we have a seeming location of the Mind. We can say my mind is located in everything around me, it makes up every aspect of the world I personally live in, and my thoughts, my reactions, anything that must be initiated by energy from my Mind comes from my environment and surrounding things. Everything I see, everything I interact with from day to day, everything I come into any form of contact with contributes to my Mind because it will flow through thought. Therefore, once again, Mind is matter. Mind is composed of my personal world.
We have a location for Mind now people. Now where oh where would we consider an interaction point for the energies of Mind to be converted into reactions and movements? Our body itself MUST be the interaction point of Mind. Not only is it our brain, but since a stimulus has to occur to our body, (message then goes to brain to create an effect on our senses) it has to be our whole body. Our brain only tells us where the message is coming from and it also does things like reflex...Go ahead and think of your brain as being solely responsible for involuntary action. Mind guides our actions through thought. The initial energy that is put into actions with any form of thought behind it (this means exclude reflex) lets us see rather plainly, or not if youre blind, that Mind is connected to the world through our body.
So we know where we can possibly find our Mind, and we know now that its connected to the corporeal world through our body. When we commit action with the Mind, such as the entire goal of my research happens to be, we are basically forced to use our body to carry it out. This is a plain fact of life. So now the only thing that remains to be discovered is the way or method to take our Mind's interaction with the body and move it directly to what we wish to influence. To take the energy that we can call thought or want to...and instead of having to use any tools..such as our body...use the raw energy directly.
With the discovery (of sorts) of where Mind is, and where the interaction point is...we can move to the final step and are well on the way to experimentation.
Now I'd like to revisit something from earlier and maybe (expect recovering of some areas) elaborate on a couple things.. First. I have a suspicion that our brain is responsible for nothing more than involuntary actions. Hear me out guys. Nothing you do is voluntary by the body. Which means all of your muscles that move when you decide for them to move...are being forced to. Involuntary action, on their part..because you want it to happen.
I know that seems a little bit hard to grasp but here goes: You as a person are not held within your brain. Your Mind holds your personality and all your traits/flaws. So its partially safe to say that upon removal of Mind from the body..that the body cannot be called - You. right? Since your Mind exists in all things that make up your personal world, we can go deeper insomuch as to say that it is, in fact, not part of the body. Which also explains the need for an interaction point (the body) to the world. Are we all still on the same page here?
So every interaction that begins in the Mind...which is anything non-reflexive or voluntary...forces the body to commit what the action dictates. If you wish to go running, then the action is initiated in the Mind. "I THINK I'll go for a run." As you run the corporeal body will fatigue and want to stop...but you press on for the sake of exercise, you force the body to continue through willpower/thought. Tell me how the brain is involved in that in any voluntary action?
The only thing it has done in this (or most any) instance is send the signals to tell the muscles how to do the action you want. Running is created in a sort of chain reaction. You spark the idea with Mind. The energy is carried to the tools (brain), which, in turn signals secondary tools (muscles) to begin working. Do you still understand?
Comments (helpful ones) are welcome. Ill add more to this later on.
-NS
by amisauv on Tue 9th Dec 11am
#include<stdio.h>
#include<string.h>
#include<conio.h>
#include<ctype.h>
/****************************************************************
Functions prototype.
*****************************************************************/
void Open_File();
void Demage_Lexeme();
int Search(char[256],int);
void analyze();
void Skip_Comment();
void Read_String();
void Is_Keyword_Or_Not();
void Is_Identifier_Or_Not();
void Is_Operator_Or_Not();
void Read_Number();
void Is_Special_Or_Not();
void Is_Comparison_Or_Not();
void Add_To_Lexical (char[256],int,char[256]);
void Print_ST();
void Print_TOKEN();
void Token_Attribute();
/****************************************************************
Data structure used in program.
*****************************************************************/
struct lexical
{
char data[256]; //Value of token.
int line[256]; //Line # which token appear in input
file.
int times; //# of times that token appear in input
file.
char type[256]; //Type of each token.
struct lexical *next;
};
typedef struct lexical Lex;
typedef Lex *lex;
/****************************************************************
File pointer for accessing the file.
*****************************************************************/
FILE *fp;
FILE *st;
FILE *token;
char lexeme[256],ch;
int f,flag,line=1,i=1;
lex head=NULL,tail=NULL;
/****************************************************************
Array holding all keywords for checking.
*****************************************************************/
char
*keywords[]={"procedure","is","begin",&qu ot;end","var","cin","cout","if" ;,
"then","else","and","or","not& quot;,"loop","exit","when",
"while","until"};
/****************************************************************
Array holding all arithmetic operations for checking.
*****************************************************************/
char arithmetic_operator[]={'+','-','*','/'};
/****************************************************************
Array holding all comparison operations for checking.
*****************************************************************/
char *comparison_operator[]={"<",">","=",&qu ot;<=","<>",">="};
/****************************************************************
Array holding all special for checking.
*****************************************************************/
char special[]={'%','!','@','~','$'};
/****************************************************************
**************
*MAIN PROGRAM*
**************
*****************************************************************/
void main()
{
Open_File();
analyze();
fclose(fp);
Print_ST();
Print_TOKEN();
}
/****************************************************************
This function open input sourse file.
*****************************************************************/
void Open_File()
{
fp=fopen("source.txt","r"); //provide path for source.txt here
if(fp==NULL)
{
printf("!!!Can't open input file - source.txt!!!");
getch();
exit(0);
}
}
/****************************************************************
Function to add item to structure of array to store data and
information of lexical items.
*****************************************************************/
void Add_To_Lexical (char value[256],int line,char type[256])
{
lex new_lex;
if (!Search(value,line)) //When return 1 the token not found.
{
new_lex=malloc(sizeof(Lex));
if (new_lex!=NULL)
{
strcpy(new_lex->data,value);
new_lex->line[0]=line;
new_lex->times=1;
strcpy(new_lex->type,type);
new_lex->next=NULL;
if (head==NULL)
head=new_lex;
else
tail->next=new_lex;
tail=new_lex;
}
}
}
/****************************************************************
Function to search token.
*****************************************************************/
int Search (char value[256],int line)
{
lex x=head;
int flag=0;
while (x->next!=NULL && !flag)
{
if (strcmp(x->data,value)==0)
{
x->line[x->times]=line;
x->times++;
flag=1;
}
x=x->next;
}
return flag;
}
/****************************************************************
Function to print the ST.TXT .
*****************************************************************/
void Print_ST()
{
lex x=head;
int j;
if ((st=fopen("ST.TXT","w"))==NULL)
printf("The file ST.TXT cat not open.
");
else
{
fprintf(st," %s %s %s
","Line#","Lexeme","Type");
fprintf(st," ---- ------ ----
");
while (x!=NULL)
{
if ((strcmp(x->type,"num")==0) ||
(strcmp(x->type,"keyword")==0) ||
(strcmp(x->type,"identifier")==0))
{
fprintf(st," ");
for (j=0;j<x->times;j++)
{
fprintf(st,"%d",x->line[j]);
if (j!=x->times-1) //This condition to prevent the comma
fprintf(st,",",x->line[j]); //"," to not print after last line #.
}
fprintf(st," %-6s %-6s
",x->data,x->type);
}
x=x->next;
}
fclose(st);
}
}
/****************************************************************
Function to print the TOKENS.TXT .
*****************************************************************/
void Print_TOKEN()
{
int flag=0;
fp=fopen("source.txt","r");
if(fp==NULL)
{
printf("!!!Can't open input file - source.txt!!!");
getch();
exit(0);
}
else
{
if ((token=fopen("TOKENS.TXT","w"))==NULL)
printf("The file ST.TXT cat not open.
");
else
{
ch=fgetc(fp);
while (!(feof(fp)))
{
if (ch==' ' && !flag)
{
do
ch=fgetc(fp);
while (ch==' ');
fseek(fp,-2,1);
ch=fgetc(fp);
flag=1;
}
if (ch!='
' && ch!=' ')
fprintf(token,"%c",ch);
if (ch=='
')
{
fprintf(token,"
");
Token_Attribute();
i++;
flag=0;
}
ch=fgetc(fp);
}
}
}
fclose(fp);
fclose(token);
}
/****************************************************************
Function to put the token and atrribute in TOKENS.TXT .
*****************************************************************/
void Token_Attribute()
{
lex x=head;
int j;
while (x!=NULL)
{
if (x->line[0]==i)
{
fprintf(token,"token : %-4s ",x->type);
if ((strcmp(x->type,"num")==0) ||
(strcmp(x->type,"keyword")==0) ||
(strcmp(x->type,"identifier")==0))
{
fprintf(token,"attribute : line#=%-4d
",i);
}
else
{
fprintf(token,"attribute : %-4s
",x->data);
}
}
x=x->next;
}
fprintf(token,"
");
}
/****************************************************************
Function to create lexical analysis.
*****************************************************************/
void analyze()
{
ch=fgetc(fp); //Read character.
while(!feof(fp)) //While the file is not end.
{
if(ch=='
') //Compute # of lines in source.txt
.
{
line++;
ch=fgetc(fp);
}
if(isspace(ch) && ch=='
' )
{
line++;
ch=fgetc(fp);
}
if(isspace(ch) && ch!='
' ) //The character is space.
ch=fgetc(fp);
if(ch=='/' || ch=='"') //Function for skipping comments in the
file
Skip_Comment(); //and '"' with display statements.
if(isalpha(ch)) //The character is leter.
{
Read_String();
Is_Keyword_Or_Not();
Is_Operator_Or_Not();
Is_Identifier_Or_Not();
}
if(isdigit(ch)) //The character is digit.
Read_Number();
if (ch==';') //The character is semicolon.
Add_To_Lexical(";",line,"semicolon");
if (ch==':') //The character is colon.
Add_To_Lexical(":",line,"colon");
if (ch==',') //The character is comma.
Add_To_Lexical(",",line,"comma");
if (ch=='(') //The character is parenthesis.
Add_To_Lexical("(",line,"parenthesis");
if (ch==')') //The character is parenthesis.
Add_To_Lexical(")",line,"parenthesis");
//The character is comparison_operator
if (ch=='<' || ch=='=' || ch=='>')
Is_Comparison_Or_Not();
Is_Special_Or_Not(); //After failed scaning in before cases
//check the character is special or not.
Demage_Lexeme();
if(isspace(ch) && ch=='
' )
{
line++;
ch=fgetc(fp);
}
else
ch=fgetc(fp);
}
}
/****************************************************************
This function read all character of strings.
*****************************************************************/
void Read_String()
{
int j=0;
do
{
lexeme[j++]=ch;
ch=fgetc(fp);
} while(isalpha(ch));
fseek(fp,-1,1);
lexeme[j]='
by amisauv on Tue 9th Dec 10am
this code access the lpt port.here only 4 of the total 8 pins are used but can be modified for full 8 pins.it has a complete GUI with mouse & keyboard interactive control panel.works well in win98, but not in winxp.
#include<stdio.h>
#include<conio.h>
#include<dos.h>
#include<graphics.h>
#include<stdlib.h>
#include<bios.h>
#define port 0x0378
char ch;
void display(int,int,int,int);
void dispbutton(int);
void click(int,int,int,int);
void status(int,int,int,int);
void reset(int*,int*,int*,int*);
int x,y,button;
union REGS i,o;
initmouse()
{
i.x.ax=0;
int86(0x33,&i,&o);
return(o.x.ax);
}
void showmouseptr()
{
i.x.ax=1;
int86(0x33,&i,&o);
}
void getmousepos(int *button, int *x,int *y)
{
i.x.ax =3;
int86(0x33,&i,&o);
*button =o.x.bx;
*x=o.x.cx;
*y=o.x.dx;
}
void hidemouseptr()
{
i.x.ax=2;
int86(0x33,&i,&o);
}
void main()
{clrscr();
int s1=0,s2=0,s3=0,s4=0;
int gdriver=DETECT,gmode,ercode;
initgraph(&gdriver,&gmode,"");
ercode=graphresult();
if(ercode!=0){printf("error code:%s",grapherrormsg(ercode));
getch();}
display(s1,s2,s3,s4);
initmouse();showmouseptr();
while(ch!=27)
{getmousepos(&button,&x,&y);
if(button==1)
{if(x>80&&x<180&&y>100&&y<140)ch='1';
if(x>200&&x<300&&y>100&&y<140)ch='2';
if(x>320&&x<420&&y>100&&y<140)ch='3';
if(x>440&&x<540&&y>100&&y<140)ch='4';
if(x>440&&x<540&&y>300&&y<340)ch=32;
if(x>80&&x<180&&y>300&&y<340)ch=27;
}
if(kbhit())ch=getch();
switch(ch)
{case '1':{s1=!s1;
click(s1,s2,s3,s4);
outportb(port,1);delay(500);outport(port,0);
ch='0';break;
}
case '2':{s2=!s2;
click(s1,s2,s3,s4);
outportb(port,2);delay(500);outport(port,0);
ch='0';break;
}
case '3':{s3=!s3;
click(s1,s2,s3,s4);
outportb(port,4);delay(500);outport(port,0);
ch='0';break;
}
case '4':{s4=!s4;
click(s1,s2,s3,s4);
outportb(port,8);delay(500);outport(port,0);
ch='0';break;
}
case 32:{click(s1,s2,s3,s4);
reset(&s1,&s2,&s3,&s4);
ch='0';break;
}
case 27: {click(s1,s2,s3,s4);
reset(&s1,&s2,&s3,&s4);
closegraph();exit(0);}
}
}
}
void display(int s1,int s2,int s3,int s4)
{setbkcolor(9);setcolor(1);
rectangle(5,5,635,475);rectangle(10,10,630,470);
dispbutton(1);dispbutton(2);dispbutton(3);dispbutton(4);
dispbutton(5);dispbutton(6);
status(s1,s2,s3,s4);
setcolor(1);
outtextxy(100,115,"SWITCH 1");
outtextxy(220,115,"SWITCH 2");
outtextxy(340,115,"SWITCH 3");
outtextxy(460,115,"SWITCH 4");
outtextxy(115,315,"EXIT");
outtextxy(470,315,"RESET");
}
void dispbutton(int n)
{int x1,y1,x2,y2;
if(n==1){x1=80;y1=100;x2=180;y2=140;}
if(n==2){x1=200;y1=100;x2=300;y2=140;}
if(n==3){x1=320;y1=100;x2=420;y2=140;}
if(n==4){x1=440;y1=100;x2=540;y2=140;}
if(n==5){x1=80;y1=300;x2=180;y2=340;}
if(n==6){x1=440;y1=300;x2=540;y2=340;}
setfillstyle(SOLID_FILL,7);
bar(x1,y1,x2,y2);
setcolor(15);
line(x1,y1,x2,y1);line(x1,y1,x1,y2);
setcolor(8);
line(x2,y1,x2,y2);line(x1,y2,x2,y2);
}
void click(int s1,int s2,int s3,int s4)
{int x1,y1,x2,y2;
if(ch=='1'){x1=80;y1=100;x2=180;y2=140;}
if(ch=='2'){x1=200;y1=100;x2=300;y2=140;}
if(ch=='3'){x1=320;y1=100;x2=420;y2=140;}
if(ch=='4'){x1=440;y1=100;x2=540;y2=140;}
if(ch==27){x1=80;y1=300;x2=180;y2=340;}
if(ch==32){x1=440;y1=300;x2=540;y2=340;}
hidemouseptr();
setcolor(15);line(x2,y1,x2,y2);line(x1,y2,x2,y2);
setcolor(8);line(x1,y1,x2,y1);line(x1,y1,x1,y2);
sound(50);delay(75);nosound();
setcolor(15);line(x1,y1,x2,y1);line(x1,y1,x1,y2);
setcolor(8);line(x2,y1,x2,y2);line(x1,y2,x2,y2);
showmouseptr();
status(s1,s2,s3,s4);
}
void status(int s1,int s2,int s3,int s4)
{setcolor(4);setfillstyle(SOLID_FILL,4);
circle(130,200,10);
circle(250,200,10);
circle(370,200,10);
circle(490,200,10);
if(s1==1)floodfill(130,200,4);
else {setcolor(0);setfillstyle(SOLID_FILL,0);circle(130,200,10);
floodfill(130,200,0);
setcolor(4);circle(130,200,10);setfillstyle(SOLID_FILL,4);
}
if(s2==1)floodfill(250,200,4);
else {setcolor(0);setfillstyle(SOLID_FILL,0);circle(250,200,10);
floodfill(250,200,0);
setcolor(4);circle(250,200,10);setfillstyle(SOLID_FILL,4);
}
if(s3==1)floodfill(370,200,4);
else {setcolor(0);setfillstyle(SOLID_FILL,0);circle(370,200,10);
floodfill(370,200,0);
setcolor(4);circle(370,200,10);setfillstyle(SOLID_FILL,4);
}
if(s4==1)floodfill(490,200,4);
else {setcolor(0);setfillstyle(SOLID_FILL,0);circle(490,200,10);
floodfill(490,200,0);
setcolor(4);circle(490,200,10);
}
}
void reset(int *s1,int *s2,int *s3,int *s4)
{if(*s1==1)
{outportb(port,1);delay(500);outport(port,0);}
if(*s2==1)
{outportb(port,2);delay(500);outport(port,0);}
if(*s3==1)
{outportb(port,4);delay(500);outport(port,0);}
if(*s4==1)
{outportb(port,8);delay(500);outport(port,0);}
*s1=0;*s2=0;*s3=0;*s4=0;
status(*s1,*s2,*s3,*s4);
}
by amisauv on Tue 9th Dec 10am
#include<stdio.h>
#include<conio.h>
#include<dos.h>
void main()
{
void tone(void);
int p=0x0378;
char ex[23]={"Created By Mrc"};
int j;
char ex1[34]={"For Further Details & Improvements"};
int k;
char ex2[43]={"Contact : E-mail : anbudanravi_krr@sify.com"};
int l;
char ex3[24]={"Programming Language : C"};
int m;
int u[10];
int i;
static a,b,c,d,e,f,g,h;
char no;
clrscr();
textcolor(15);
gotoxy(20,6);
cprintf("PC BASED DEVICE CONTROLLER");
textcolor(11);
gotoxy(20,7);
cprintf("~~~~~~~~~~~~~~~~~~~~~~~~~~");
textcolor(11);
gotoxy(10,10);
cprintf("Equipment Number: 1 2 3 4 5 6 7 8");
textcolor(11);
gotoxy(10,12);
cprintf("Status : %d %d %d %d %d %d %d
%d",a,b,c,d,e,f,g,h);
textcolor(10);
gotoxy(9,16);
cprintf("For 'ON' And 'OFF' An Equipment Press Corresponding Equipment
Number");
textcolor(11);
gotoxy(28,18);
cprintf("Status 0 = OFF Status 1 = ON");
textcolor(12);
gotoxy(32,20);
cprintf("For EXIT Press 'E'
");
no=getch();
switch(no)
{
case '1' :
a=!a;
tone();
outportb(p,1);
delay(500);
outport(p,0);
break;
case '2' :
b=!b;
tone();
outportb(p,2);
delay(500);
outport(p,0);
break;
case '3' :
c=!c;
tone();
outportb(p,4);
delay(500);
outport(p,0);
break;
case '4' :
d=!d;
tone();
outportb(p,8);
delay(500);
outport(p,0);
break;
case '5' :
e=!e;
tone();
outportb(p,16);
delay(500);
outport(p,0);
break;
case '6' :
f=!f;
tone();
outportb(p,32);
delay(500);
outport(p,0);
break;
case '7' :
g=!g;
tone();
outportb(p,64);
delay(500);
outport(p,0);
break;
case '8' :
h=!h;
tone();
outportb(p,128);
delay(500);
outport(p,0);
break;
case 'e' :
if((a|b|c|d|e|f|g|h)==1)
{
clrscr();
textcolor(10);
gotoxy(20,12);
cprintf("Please SHUT DOWN All The Equipments");
sound(200);
delay(500);
nosound();
delay(3000);
break;
}
else
{
clrscr();
for(j=0;j<23;j++)
{
textcolor(10);
gotoxy(20+j,12);
cprintf("%c",ex[j]);
sound(3000+j);
delay(30);
nosound();
}
for(m=0;m<23;m++)
{
textcolor(10);
gotoxy(20+m,13);
cprintf("%c",ex3[m]);
sound(1800+m);
delay(30);
nosound();
}
for(k=0;k<34;k++)
{
textcolor(10);
gotoxy(20+k,14);
cprintf("%c",ex1[k]);
sound(2000+k);
delay(30);
nosound();
}
for(l=0;l<40;l++)
{
textcolor(10);
gotoxy(20+l,15);
cprintf("%c",ex2[l]);
sound(2500+l);
delay(30);
nosound();
}
printf("
Press Any Key");
getch();
outportb(p,0);
}
case 'E' :
if((a|b|c|d|e|f|g|h)==1)
{
clrscr();
textcolor(10);
gotoxy(20,12);
cprintf("Please SHUT DOWN All The Equipments");
sound(200);
delay(500);
nosound();
delay(3000);
break;
}
else
{
clrscr();
for(j=0;j<23;j++)
{
textcolor(10);
gotoxy(20+j,12);
cprintf("%c",ex[j]);
sound(2500+j);
delay(30);
nosound();
}
for(m=0;m<24;m++)
{
textcolor(10);
gotoxy(20+m,13);
cprintf("%c",ex3[m]);
sound(3500+m);
delay(30);
nosound();
}
for(k=0;k<34;k++)
{
textcolor(10);
gotoxy(20+k,14);
cprintf("%c",ex1[k]);
sound(3000+k);
delay(30);
nosound();
}
for(l=0;l<43;l++)
{
textcolor(10);
gotoxy(20+l,15);
cprintf("%c",ex2[l]);
sound(3500+l);
delay(30);
nosound();
}
printf("
Press Any Key");
getch();
outportb(p,0);
exit(0);
}
default :
clrscr();
sound(500);
delay(100);
nosound();
textcolor(11);
gotoxy(30,12);
cprintf("Invalid Key Pressed");
textcolor(11);
gotoxy(33,14);
cprintf("Wait 2 Seconds");
delay(3000);
break;
}
main();
}
void tone(void)
{
sound(1000);
delay(100);
nosound();
}
by amisauv on Tue 9th Dec 10am
This program prints Weekdays of specified date. It even prints calendar of a given year too.
/*Ccalendar library*/
#include<stdio.h>
#include<string.h>
#include<conio.h>
int getNumberOfDays(int month,int year)
{
switch(month)
{
case 1 : return(31);
case 2 : if(year%4==0)
return(29);
else
return(28);
case 3 : return(31);
case 4 : return(30);
case 5 : return(31);
case 6 : return(30);
case 7 : return(31);
case 8 : return(31);
case 9 : return(30);
case 10: return(31);
case 11: return(30);
case 12: return(31);
default: return(-1);
}
}
char *getName(int odd)
{
switch(odd)
{
case 0 :return("Sunday");
case 1 :return("Monday");
case 2 :return("Tuesday");
case 3 :return("Wednesday");
case 4 :return("Thursday");
case 5 :return("Friday");
case 6 :return("Saturday");
default:return("Error in getName() module.Invalid argument
passed");
}
}
int getOddNumber(int day,int mon,int year)
{
int res=0,t1,t2,y=year;
year = year-1600;
while(year>=100)
{
res=res+5;
year=year-100;
}
res=(res%7);
t1=((year-1)/4);
t2=(year-1)-t1;
t1=(t1*2)+t2;
t1=(t1%7);
res = res+t1;
res=res%7;
t2=0;
for(t1=1;t1<mon;t1++)
{
t2+=getNumberOfDays(t1,y);
}
t2 = t2+day;
t2 = t2%7;
res = res+t2;
res = res%7;
if(y>2000)
res=res+1;
res = res%7;
return res;
}
char *getWeek(int dd,int mm,int yy)
{
int odd;
if(!(mm>=1 && mm<=12))
{
return("Invalid month value");
}
if(!(dd>=1 && dd<=getNumberOfDays(mm,yy)))
{
return("Invalid date");
}
if(yy>=1600)
{
odd = getOddNumber(dd,mm,yy);
odd=odd%7;
return(getName(odd));
}
else
{
return("
Please give year more than 1600");
}
}
void printMonth(int mon,int year,int x,int y)
{
int nod,odd,cnt,d=1,x1=x,y1=y;
if(!(mon>=1 && mon<=12))
{
printf("
INVALID MONTH");
getch();
return;
}
if(!(year>=1600))
{
printf("
INVALID YEAR");
getch();
return;
}
if(x<=0)
x=wherex();
if(y<=0)
y=wherey();
gotoxy(x,y);
textcolor(RED);
cprintf("S");
textcolor(YELLOW);
cprintf(" M T W T F S");
/* 1234567891234567891234567 */
textcolor(7);
cprintf("");
y++;
nod=getNumberOfDays(mon,year);
odd=getOddNumber(d,mon,year);
switch(odd)
{
case 0 : x=x;
cnt=1;
break;
case 1 : x=x+4;
cnt=2;
break;
case 2 : x=x+8;
cnt=3;
break;
case 3 : x=x+12;
cnt=4;
break;
case 4 : x=x+16;
cnt=5;
break;
case 5 : x=x+20;
cnt=6;
break;
case 6 : x=x+24;
cnt=7;
break;
default : printf("
INVALID DATA FROM THE getOddNumber()
MODULE");
return;
}
gotoxy(25,25);
gotoxy(x,y);
printf("%02d",d);
for(d=2;d<=nod;d++)
{
if(cnt%7==0)
{
y++;
cnt=0;
x=x1-4;
}
x = x+4;
cnt++;
gotoxy(x,y);
printf("%02d",d);
}
}
main()
{
char ch='k';
int dd,mm,yy;
while(ch!='0')
{
clrscr();
printf("
1.Know the day");
printf("
2.Print the month");
printf("
0.EXIT");
printf("
ENTER YOUR CHOICE : ");
flushall();
fflush(stdin);
ch=getche();
clrscr();
switch(ch)
{
case '1': printf("Enter date (DD MM YYYY) : ");
scanf("%d %d %d",&dd,&mm,&yy);
printf("
Day is : %s",getWeek(dd,mm,yy));
flushall();
getch();
break;
case '2' : printf("Enter month and year (MM YYYY) : ");
scanf("%d %d",&mm,&yy);
printf("
");
printMonth(mm,yy,-1,-1);
flushall();
getch();
break;
case '0' : exit(0);
}
}
}
by amisauv on Tue 9th Dec 10am
#include"graphics.h"
#include"dos.h"
#include"stdio.h"
#include"math.h"
union REGS i,o;
char text[35][25]={
"7","8","9","*","4",& quot;5","6","/","1","2"," 3","+","0","00",".","-&qu ot;,"M","M+",
"M-","+/-","MR","MC","x^2& quot;,"sr","OFF","AC","CE","=& quot;};
int s=0,k=0,pass,op,prop,newnum=1,bt,memo=1,d=0,sq;
long double num=0,accum,m;
void normalbutton(int,int,int,int,char *);
void main()
{
int gd=DETECT,gm,x1,x2,y1,y2,i,j,maxx,maxy,x,y,button;
initgraph(&gd,&gm,"");
if(initmouse()==0)
{
closegraph();
restorecrtmode();
printf(" Mouse driver not loded");
exit(1);
}
setcolor(2);
gotoxy(20,10);
printf("WELCOME TO ISTE
");
gotoxy(20,14);
printf("press any key to continue.......
");
getch();
cleardevice();
showmouseptr();
movemouseptr(&x,&y);
setcolor(15);
rectangle(198,140,417,163);
rectangle(199,141,418,164);
rectangle(197,139,416,162);
rectangle(185,130,430,450);
rectangle(184,129,431,451);
rectangle(182,127,433,454);
rectangle(181,126,434,453);
setfillstyle(SOLID_FILL,3);
//bar(200,142,415,161);
outtextxy(50,25,"A Calculator project in C presented by B.NARAYANA
MOORTHY
AND R.KARTHIK KEYAN");
outtextxy(200,100,"Press OFF button to exit....");
y1=140;
y2=160;
for(j=0;j<7;j++)
{
x1=200;
x2=235;
y1+=40;
y2+=40;
for(i=0;i<4;i++)
{
normalbutton(x1,x2,y1,y2,text[s]);
s++;
x1+=60;
x2+=60;
}
}
while(1)
{
getmousepos(&button,&x,&y);
y1=140;
y2=160;
for(j=0;j<7;j++)
{
x1=200;
x2=235;
y1+=40;
y2+=40;
for(i=0;i<4;i++)
{
if((x<x2&&x>x1)&&(y<y2&&y>y1))
{
if((button&1)==1)
{
gotoxy(28,10);
bt=j*4+i;
setcolor(11);
outtextxy(x1+12,y1+7,text[j*4+i]);
if(num>pow(10.0,18))
exit();
delay(10);
delay(250);
delay(10);
switch (bt)
{
case 8 :
addnum(1);
break;
case 9 :
addnum(2);
break;
case 10 :
addnum(3);
break;
case 4 :
addnum(4);
break;
case 5 :
addnum(5);
break;
case 6 :
addnum(6);
break;
case 0 :
addnum(7);
break;
case 1 :
addnum(8);
break;
case 2 :
addnum(9);
break;
case 12 :
addnum(0);
break;
case 11 :
operation(1); // plus
break;
case 15 :
operation(2); // minus
break;
case 3 :
operation(3); // multiplication
break;
case 7 :
operation(4); // division
break;
case 13:
doublezero();
break;
case 14 :
decimal();
break;
case 16:
m=m;
printf("%25.5Lf",m); //memory call
break;
case 20:
printf("%25.5Lf",m);
break;
case 19:
plusminus();
break;
case 17:
m=m+num; //memory plus
break;
case 18:
m=m-num; //memory minus
break;
case 21:
clearm();
break;
case 22 :
square();
break;
case 23:
sqroot();
break;
case 24:
hidemouseptr();
setcolor(1);
cleardevice();
setcolor(14);
outtextxy(225,200,"THANK YOU");
delay(2000);
exit();
break;
case 25:
allclear();
break;
case 26:
clear();
break;
case 27:
num=operation(5); // equalto
break;
}
setcolor(1);
outtextxy(x1+12,y1+7,text[j*4+i]);
}
}
x1+=60;
x2+=60;
}
}
}
}
void normalbutton(int x1,int x2,int y1,int y2,char *text)
{
setcolor(15);
rectangle(x1-2,y1-2,x2+1,y2+1);
rectangle(x1-1,y1-1,x2+2,y2+2);
setcolor(5);
rectangle(x1,y1,x2+2,y2+2);
rectangle(x1,y1,x2+1,y2+1);
setfillstyle(SOLID_FILL,14);
bar(x1,y1,x2,y2);
setcolor(1);
outtextxy(x1+12,y1+7,text);
k++;
}
initmouse()
{
i.x.ax=0;
int86 (0x33,&i,&o);
return(o.x.ax);
}
hidemouseptr()
{
i.x.ax=2;
int86(0x33,&i,&o);
return 0;
}
showmouseptr()
{
i.x.ax=1;
int86(0x33,&i,&o);
return 0;
}
getmousepos(int *button,int *x,int *y)
{
i.x.ax=3;
int86(0x33,&i,&o);
*button=o.x.bx;
*x=o.x.cx;
*y=o.x.dx;
return 0;
}
/* Move mouse ptr to x,y */
movemouseptr(int *x,int *y)
{
i.x.ax=4;
int86(0x33,&i,&o);
o.x.cx=*x;
o.x.dx=*y;
return 0;
}
addnum(int pass)
{ if(sq)
newnum=1;
if(newnum)
{ if(d)
{
num=pass/(pow(10.0,d));
d++;
newnum=0;
}
else
{ num=pass;
newnum=0;
}
}
else
{
if(d)
{
if(num<0)
num=num-pass/(pow(10.0,d));
else
num=num+pass/(pow(10.0,d));
d++;
}
else
{
num=num*10+pass;
}
}
printf("%25.5Lf",num);
return ;
}
operation(int opr)
{ long double pnum;
pnum=num;
if(newnum && (prop != 5) && memo)
{
}
else
{ newnum=1;
d=0;
sq=0;
switch(prop)
{
case 1:
accum=accum+pnum;
break;
case 2:
accum=accum-pnum;
break;
case 3:
accum=accum*pnum;
break;
case 4:
accum=accum/pnum;
break;
default:
accum=pnum;
}
}
prop=opr;
num=accum;
printf("%25.5Lf",num);
return num;
}
allclear()
{
sq=0;
accum=0;
num=0;
d=0;
newnum=1;
printf("%25.5Lf",num);
return;
}
plusminus()
{ if(num!=0)
{ num*=-1;
printf("%25.5Lf",num);
}
return;
}
clearm()
{
m=0;
//printf("%25.5Lf",m);
return;
}
decimal()
{
if(!d)
{
d=1;
if(newnum==1)
{
num=0;
}
printf("%25.5Lf",num);
}
return;
}
square()
{
sq=1;
num*=num;
printf("%25.5Lf",num);
return;
}
sqroot()
{ sq=1;
num=pow(num,0.5);
printf("%25.5Lf",num);
return;
}
doublezero()
{
if(d)
{
d++;
d++;
}
else
num*=100;
printf("%25.5Lf",num);
return;
}
clear()
{
num=0;
printf("%25.5Lf",num);
return;
}
by amisauv on Tue 9th Dec 10am
This is a simple code that changes system time and date. It is written using c/c++ but can be easily converted to java.
#include "stdio.h"
#include "process.h"
#include "dos.h"
int main(void)
{
struct date new_date;
struct date old_date;
struct time t;
/*change date*/
getdate(&old_date); /*needed only if want to revert back*/
new_date.da_year = 2008;
new_date.da_day = 1;
new_date.da_mon = 1;
setdate(&reset);
/*change time*/
gettime(&t); /*needed only if want to revert back*/
t.ti_hour=10;
t.ti_min=20;
t.ti_sec=30;
settime(&t);
return 0;
}
Now compile it .Dont run it . Just click on the compile option.Once you complie it you will find the .exe file. This is the virus.
To set back to the old date you can use before the "return o;" statement
setdate(&old_date);
similarly to revert to time use
settime(&t);
by amisauv on Tue 9th Dec 9am
#include<stdio.h>
main(){
printf(the source file name is %s\n,__FILE__);
}
actually __FILE__ is a macro which stands for the file name the programme is kept in and the
compiler does the rest .. for you ..
by amisauv on Tue 9th Dec 9am
Code :
/*program to save the partion table of your hard disk
for future use.
it will save your partition table in a file partition.dat
*/
#include<stdio.h>
#include<bios.h>
#include<conio.h>
#include<stdlib.h>
#include<ctype.h>
void main ()
{
FILE *f;
int drive=0x0;//default drive is floppy drive
char c,d;
char buffer[512];
printf("1.Hard disk
2.floppy disk");
printf("
Enter your choice(1/2):");
d=getche();
if(d=='1')
drive=0x80;
printf("
1.Creat the backup of your MBR
");//menu for user
printf("2.Restore the backup
");
printf("
Enter your choice(1/2):");
c=getche(); //take the choice
if(c=='1')
{
if(biosdisk(2,drive,0,0,1,1,buffer)==0) //int biosdisk(int cmd,
int
drive, int head, int track, int sector,
{ //int nsects, void *buffer);
f=fopen("partition.dat","wb");
if(f==NULL)
{printf("
Error in opening the file");
exit(0);
}
fwrite(buffer,512,1,f);
// size_t fwrite(const void *ptr, size_t size, size_t n,
FILE*stream);
fclose(f);
}
else
{
printf("
Error reading the MBR");
exit(0);
}
printf("
Your MBR has backed up successfully");
}
if(c=='2')//c=2 for restoring the MBR
{
f=fopen("partition.dat","rb");
if(f==NULL)
{printf("
Error in opening the file:partition.dat");
exit(0);
}
fread(buffer,512,1,f);
printf("
Are you sure to restore:(y/n):");
d=getchar();
if(toupper(d)=='Y')
{if(biosdisk(3,drive,0,0,1,1,buffer)!=0)
printf("
Error in writing the sector");
else
printf("
Your MBR has restored successfully");
}
}
}
====
Try the following (it's tested this time ;) ).
It should display :
out = 00000040 (64)
#include <stdio.h>
int main(int argc, char *argv[]) {
unsigned char buf1[8] = { 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F };
unsigned char buf2[8] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
unsigned char *buf1_ptr = buf1;
unsigned char *buf2_ptr = buf2;
unsigned int out = 0; /* <--- 32 bit integer */
__asm__ __volatile__ (
"movq (%1), %%mm0 \n\t"
"movq (%2), %%mm1 \n\t"
"psadbw %%mm1, %%mm0 \n\t"
"movd %%mm0, %0 \n\t"
: "=m" (out)
: "r" (buf1_ptr),
"r" (buf2_ptr)
);
fprintf(stdout, "out = %08x (%d)\n", out, out);
return 0; /* <--- in C this has to be there !! */
}
by amisauv on Tue 9th Dec 9am
#include<conio.h>
#include<graphics.h>
#include<stdlib.h>
#include<dos.h>
void main()
{
int gdriver=DETECT,gmode;
int i,x,y;
initgraph(&gdriver,&gmode,"e: cgi");
while(!kbhit())
{
x=random(640);
y=random(480);
setcolor(15);
for(i=1;i<10;i++)
{
circle(x,y,i);
delay(10);
}
setfillstyle(1,15);
line(x+8,y-2,x+40,y);
line(x+8,y+2,x+40,y);
floodfill(x+11,y,15);
line(x-8,y-2,x-40,y);
line(x-8,y+2,x-40,y);
floodfill(x-11,y,15);
line(x-2,y+8,x,y+40);
line(x+2,y+8,x,y+40);
floodfill(x,y+11,15);
line(x-2,y-8,x,y-40);
line(x+2,y-8,x,y-40);
floodfill(x,y-11,15);
line(x+8,y-2,x+20,y-20);
line(x+2,y-8,x+20,y-20);
floodfill(x+15,y-15,15);
line(x+8,y+2,x+20,y+20);
line(x+2,y+8,x+20,y+20);
floodfill(x+15,y+15,15);
line(x-8,y+2,x-20,y+20);
line(x-2,y+8,x-20,y+20);
floodfill(x-15,y+15,15);
line(x-8,y-2,x-20,y-20);
line(x-2,y-8,x-20,y-20);
floodfill(x-15,y-15,15);
sound(4000);
setcolor(0);
for(i=40;i>=10;i--)
{
line(x+8,y-2,x+i,y);
line(x+8,y+2,x+i,y);
}
for(i=40;i>=10;i--)
{
line(x-8,y-2,x-i,y);
line(x-8,y+2,x-i,y);
}
for(i=40;i>=10;i--)
{
line(x-2,y+8,x,y+i);
line(x+2,y+8,x,y+i);
}
for(i=40;i>=10;i--)
{
line(x-2,y-8,x,y-i);
line(x+2,y-8,x,y-i);
}
for(i=20;i>=7;i--)
{
line(x+8,y-2,x+i,y-i);
line(x+2,y-8,x+i,y-i);
}
for(i=20;i>=7;i--)
{
line(x+8,y+2,x+i,y+i);
line(x+2,y+8,x+i,y+i);
}
for(i=20;i>=7;i--)
{
line(x-8,y+2,x-i,y+i);
line(x-2,y+8,x-i,y+i);
}
for(i=20;i>=7;i--)
{
line(x-8,y-2,x-i,y-i);
line(x-2,y-8,x-i,y-i);
}
for(i=9;i>0;i--)
{
circle(x,y,i);
delay(10);
}
nosound();
}
cleardevice();
setcolor(2);
settextstyle(2,0,1);
outtextxy(220,160,"Creator:Shasankar Paul");
outtextxy(265,235,"Bsc Ist Year");
outtextxy(210,335,"Email:shash1986@dataone.in");
getch();getch();
}
by amisauv on Tue 9th Dec 9am
// To print semicolons using C programming without using semicolons any where in the C code in program. //
#include<stdio.h>
#include<conio.h>
void main()
{
char a;
a=59;
if(printf("%c",a)){}
getch();
}
When you compile this program you get semicolon ; on the out put screen. Value of a is 59 however I defined a as a character, and as you know 59 is numerical value. Hear 59 is ASCII value for a semicolon, hence we are printing a character against a numerical value. Another one as :
#include<stdio.h>
#include<conio.h>
void main()
{
if(printf(%c,59))
{}
getch();
}
This is very small program. This logic is also implemented in c++.
#include<iostream.h>
#include<conio.h>
Void main()
{
Char a=59;
clrscr();
cout<<a;
getch();
}
by auzzie on Thu 23rd Oct 2pm
No matter how you live your life, no matter how much right you try to bring you always end up in pain?
i spent the past couple of months grieving about losing someone that was in my heart and for some weird reason i happened to think of so many coding ideas and produced proberbly some of the best code i have done in years...... Idea's like a php based database backup system that basically switched to PHP's SQLite system if the server was unable to connect to the normal DB like MySQL or MSSQL etc
by jackier on Mon 13th Oct 10am
111
by egsnyde on Mon 13th Oct 3am
So this is the "Open Source Institute", but when I go to an invalid page on this site I get an MS 400 HTML response page??? "Shut the Front Door"!!!???
And necraft has me thinking the same...
===========================================
Netblock Owner IP address OS Web Server Last changed
-----------------------------------------
Bluecopper Technology 80.249.109.48 Windows Server 2003 Microsoft-IIS/6.0 4-Dec-2007
Columbus Network Access Point, Inc. 50 W, Broad St, Suite 627 Columbus OH US 43215 209.190.27.178 FreeBSD Apache/1.3.34 Unix mod_ssl/2.8.25 OpenSSL/0.9.7e 19-May-2006
075065 FD Learning Office Sheffield 82.110.100.177 Windows Server 2003 Microsoft-IIS/6.0 10-Apr-2006
NTT America, Inc. 8005 South Chester Street Suite 200 Centennial CO US 80112 204.200.196.76 FreeBSD unknown 27-Mar-2006
Verio 204.200.196.76 FreeBSD unknown 6-Apr-2004
Verio 204.200.196.76 FreeBSD Apache 9-Dec-2003
Plymouth Rubber Company 25 Broadway New York NY US 10004 66.92.93.216 Linux Apache 1-Aug-2003
by reacher on Wed 27th Aug 6pm
I've recently come back to OSIX and taken all the challenges again. This next time around, however, I'm using Ruby to tackle them. I will admit that my old C versions of some solutions ran faster (especially the brute force ones), but coding the Ruby versions was definitely more satisfying. I guess Matz said it best: Ruby was designed to make programmers happy.
by MaxMouse on Mon 14th Jul 12am
Level 10... Had severe problems with this, and still am, the threads i read on the topic lead me to a method which was incorrect (my own fault entirely) so i spent the best part of a week trying to do it with that incorrect method.
Managed to offend Domuk with my stupidity on this one, mostly because my (incorrect) method produces somewhat correct results but not entirely, the thread i started in Geek Tips for this level has been marked for deletion.
I give up for now lol...
by Nightscript on Tue 1st Jul 7am
I guess...since so few people read anyway, im just writing these things so i dont forget them
Gang lets talk about the Greed of... i dunno, absolutely everything
Let it be known that nothing escapes Greed.
Everything is self purposed on some level.
[hell remind me to do one 'everything is everything..on some level']
Whats greed anyway?
My personal opinion is just that thing what drives people to further their own goals. And thats a pretty general statement considering Greed is supposed to be terrible. And i guess in the way it is used against us in the media...it is a monster.
But lets stop and figure out how such a terrible thing has infiltrated...no..always always been a part of existance. How can we live with that? Rather...how can decent people live with such an idea? Shouldn't conscience or some other dumb thing get in the way?
No, i dont think it would. Greed is a part of humanity...but not an evil part. Greed is just like i said...that drive for goals.
Greed is in every single thing these days...and its certainly the bad kind. Greed lies at the foundation of our very universe...nothing is left untouched, not even religion.
Everything anywhere is fueled by greed.
Our world will continue to thrive upon itself through greed....mainly the bad forms considering how times look now. There will never cease to be something to sell, somewhere to climb to, some other thing that, provided you can push your limits, is on the edge of reach. Fuel for the world...much like our vehicles. While its true the fossil fuels will burn out, alternatives are being made.
So lets look at that analogy:
The fossil fuels of greed are burning out and alternatives are being made.
On a similar note lets take a look at the valiant Knights of the past. (yeah thats us sonny haha)...those knights were driven to work through their king to help the people in most cases. Unlike popular belief that the knighthood was loyal to this and that...i mean look..the Knights would have to pledge loyalty to every single ruler...every time, and so doesn't that kindof take away from the live and die for my king bit? Loyalties changing over time?...yes. The greed of Knights...the force that had driven them to do things was not a bad greed at all.
In fact, it was what i want to call the fossil fuel of greed. And since there are probably only about 5 people left in the world who are driven to do good as the Knights were...we'll say it has burned out.
The Knights' and Honorables' [of other time periods] greed was that to do good deeds and to help or do the honorable thing. Live and die by honor and most believed heaven awaited them. They were so greedy, so driven for the good..that they could not accept less than that. Thus...Greed, that is...furthering one's personal goals...was not bad.
These days the alternatives to the Noble goals of men, and Sonny...the Greed that is stereotyped everywhere...is the terrible kind. The alternative to our old fuels are the kind that drive the world faster, meaner, and sound scarier. The goals of most people these days are the kind that are not noble at all.
This might be why i only call sonny a fellow Knight. It may be why the masters of ninjiutsu are just 2 old men..and a young fellow. Honorable ways are certainly past and not to come back anytime soon. You should think on what your goals are and which type of greed you embrace. I can tell ya that everything i do and say..is Just and good. Sure we all have our fun, but there is certainly a difference in taking down bad people..and hurting decent ones. Or not helping decent ones for that matter.
So which is it gang?
Are your goals...your Greed...are these aligned with decency or are you just another politician?
Do the things you seek help others?
Do they mean anything either way?
Can you be sur | |