 |
Recent Blogs |
by haziman on Mon 9th Nov 4am
for all geekos out there...
by echmil on Sat 7th Nov 11pm
jag har tjock med tyngate tråkigt-.-
by bb on Tue 29th Sep 12pm
I always used to use the selfssl tool from the iis resource kit
but since moving to windows 7 (or possibly any operating system using iis6), you don't need to anymore.
open iis console
click the computer name (top of the tree)
select 'server certificates'
and then just choose the option of 'create self-signed certificate'
once the cert is made, you will need to go into the website and pick the certificate using the 'bindings' option.
So.. that's finally one good thing about the new IIS console....
by elasolova on Sat 26th Sep 10am
I have been developing PHP applications for almost a year now. I have developed three projects. One is a simple trivia game. The other is a question-answer based community at http://www.javaist.com/quans . The last one is a programming challenge site just like this site at http://www.javaist.com/rosecode
by MaxMouse on Mon 7th Sep 10am
I was going to write an article on PSP NIDS, but when i started doing it, it felt as if it dropped a little short of what i wanted it to be, and wasn't particularly long (or interesting to people not associated with the PSP Scene).
I did write about it here (First post): http://forums.maxconsole.net/showthread.php?t=123521&page=8 so for those that are interested, have a look :)
by bb on Wed 2nd Sep 12pm
by bb on Tue 21st Jul 10am
http://linux.justinhartman.com/Startup_Script_for_Subversion
I found this a really simple explanation of how to start svn when the server boots
by Thizzordie on Fri 12th Jun 10am
[code]
var total_num_sides;
var current_num_sides = 3;
var x = 4;
var i;
{
total_num_sides = current_num_sides * x;
i++;
total_num_sides = current_num_sides;
}do while (i<=93);
document.write(total_num_sides);
[code]
^^^^
help koch snowflake
im trying to write a loop to calculate the number of sides after 93 minutes... where did i go wrong and i know this is probably easier to write in the form of a for loop but that doesn't want to work with me either..
by goldie on Tue 5th May 6am
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
import java.io.*;
import java.util.Properties;
public class SENDMAIL
{
public void sendMail(String mailServer, String from, String to,
String subject, String messageBody,
String[] attachments) throws
MessagingException, AddressException
{
// Setup mail server
Properties props = System.getProperties();
props.put("mail.smtp.host", mailServer);
// Get a mail session
Session session = Session.getDefaultInstance(props, null);
// Define a new mail message
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
message.setSubject(subject);
// Create a message part to represent the body text
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setText(messageBody);
//use a MimeMultipart as we need to handle the file attachments
Multipart multipart = new MimeMultipart();
//add the message body to the mime message
multipart.addBodyPart(messageBodyPart);
// add any file attachments to the message
addAtachments(attachments, multipart);
// Put all message parts in the message
message.setContent(multipart);
// Send the message
Transport.send(message);
}
protected void addAtachments(String[] attachments, Multipart multipart)
throws MessagingException, AddressException
{
for(int i = 0; i<= attachments.length -1; i++)
{
String filename = attachments[i];
MimeBodyPart attachmentBodyPart = new MimeBodyPart();
//use a JAF FileDataSource as it does MIME type detection
DataSource source = new FileDataSource(filename);
attachmentBodyPart.setDataHandler(new DataHandler(source));
//assume that the filename you want to send is the same as the
//actual file name - could alter this to remove the file path
attachmentBodyPart.setFileName(filename);
//add the attachment
multipart.addBodyPart(attachmentBodyPart);
}
}
public static void main(String[] args)
{
try
{
SENDMAIL MAIL = new SENDMAIL();
String server="pop3.gmail.com";
String from="username@gmail.com";
String to = "other user name@gmail.com";
String subject="Test";
String message="Testing";
String[] filenames =
{"c:/somefile.txt"};
MAIL.sendMail(server,from,to,subject,message,filenames);
}
catch(Exception e)
{
e.printStackTrace(System.out);
}
}
}
i want to send mail using this code but i getting exception like this.
avax.mail.MessagingException: Unknown SMTP host: pop3.gmail.com;
nested exception is:
java.net.UnknownHostException: pop3.gmail.com
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1543)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:453)
at javax.mail.Service.connect(Service.java:291)
at javax.mail.Service.connect(Service.java:172)
at javax.mail.Service.connect(Service.java:121)
at javax.mail.Transport.send0(Transport.java:190)
at javax.mail.Transport.send(Transport.java:120)
at SENDMAIL.sendMail(SENDMAIL.java:46)
at SENDMAIL.main(SENDMAIL.java:85)
Caused by: java.net.UnknownHostException: pop3.gmail.com
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:507)
at java.net.Socket.connect(Socket.java:457)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:267)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:227)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1511)
... 8 more
i have taken code from this siite only plz suggest me how to remove this exception.
thanks in advance.
by goldie on Tue 5th May 6am
avax.mail.MessagingException: Unknown SMTP host: pop3.gmail.com;
nested exception is:
java.net.UnknownHostException: pop3.gmail.com
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1543)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:453)
at javax.mail.Service.connect(Service.java:291)
at javax.mail.Service.connect(Service.java:172)
at javax.mail.Service.connect(Service.java:121)
at javax.mail.Transport.send0(Transport.java:190)
at javax.mail.Transport.send(Transport.java:120)
at SENDMAIL.sendMail(SENDMAIL.java:46)
at SENDMAIL.main(SENDMAIL.java:85)
Caused by: java.net.UnknownHostException: pop3.gmail.com
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:507)
at java.net.Socket.connect(Socket.java:457)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:267)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:227)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1511)
... 8 more
i have taken code from this siite only plz suggest me how to remove this exception.
thanks in advance.
by bb on Wed 11th Mar 12pm
I love this graph
bubble graph

by ketan404 on Mon 9th Mar 8am
It is here
http://www.listoffreelancers.com/profiles/ketankulkarni
Simple and clean design. I like this website.
Ketan
by macrocat on Sun 8th Mar 3pm
Another site with some challenges. Basically, I'm linking this to get a measly five points ;O.
Hellbound Hackers
by bb on Wed 18th Feb 1pm
This was really useful, and worked great to communicate between servers.
http://www.linuxjournal.com/article/8904
Thanks to gabbs
by MaxMouse on Wed 7th Jan 9pm
Well thats me up to Level 12, nice little level i really enjoyed it and learned a LOT from it.
I did my usual annoy Domuk about level 11 for a couple of days and generally moan about the fact i couldn't do it... heh.
And so, on to level 13, this is where it ends for the vast majority of OSIX Geeks, i feel proud to be amoung the privilaged few lol.
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 sure you play on the right side every time?
[crap...also remind me to talk about pros and cons of Good and Bad..and Grey]
Think Hard.
NS
by Camro on Mon 30th Jun 5pm
Hello World!
by Nightscript on Sat 24th May 6am
Yeah seariously (as in sear the hair from your mind lol!)..its one of the things ive thought about for a very long time..so if you laugh then fuck you. If you read on then thats cool maybe you can add a means to the method.
First off, i'm not a crackpot..im not crazy...an aylum would be cool but i dont need it. I think..and i think well. So here we go..down the magic creature hole to see how shallow it may or may not be...and yes i did just do that, totally changed the things.
Like i said, here we go..
Time is certainly not circular or cylindrical or whatever they say that it is. Time does not repeat itself at all...no matter how much you think it does. But why sir, do we think that it is a circular thing? i know that just went through your head..either that or nothingness....hm, probably the latter..anyways we think it is circular and thus repetitive because we look for it to be and call it every time something might be similar. The movie 'The Number 23' is a perfect example...this movie is about coincidence with a number and a fictional tale about a man who sees the number and is wrapped up in his own life's book's story. if that makes sense we will continue, if not stop reading and go outside to play. People who have watched that movie find themselves seeing the number 23 a little more often and some freak out...but why? its because they are subconciously on the lookout for that one single number. This is why we think history repeats itself...because we constantly watch and record things that are similar to previous events...the world wars are a good example here..we think that because someone started wwI, and then another person started wwII that there will be another one...why? Because of the similarities within each of the first two..so let look from a different angle...in fact a more simple angle...wars happen. people ask for help...countries get involved. Nothing more.
Now we have established that time is singular and straighforward..but what in the name of your gods does that have to do with shifting time? changing your location in the fourth dimension? Well, had time been circular then it wouldnt be possible to travel in days or years, but more likely to the most recent occurrence of the repetitive event. Circularity refers to forgetting the point a once we pass over it a second time and call it point b...basically we erase the past event with the last thing that was similar to it. like this: dynasty wars of asia have been forgotten because there have been other wars like WW1 in its place.
So there is why again that time is straight. if we had a method of controlling the fourth dimension..which for people who dont really know, its time...but a way to control it is beyond me..thats not why im here writing, im going to tell you now, the method to do so.
Here comes the crazy part.
Time is flowing. Every part of it flows forward, kindof like a waterfall, its always going to run, no matter what it will run, never stopping because, i dunno lets say maybe a small amount of pressure would build up behind if it didnt...enough pressure, mind you, to make it go eventually. So the present flows forward, the now...it continues forward and presses against what is the future...thus forcing the future forward as well. The past does the same thing, it too flows forward, only it presses against the present...the system is kindof perpetual you see? We continue to exist because of the past essentially. without the past's pressure, the persent wouldn't press against the future and there wouldnt be a future...theoretically. And though there is a minor detail of when time had to have started that all three would have been in the same location at the same time..haha. So yes something had to set them in motion..but forget that, it isnt the point. Now we have established that Time is not cylindrical but straight on, and also that it flows...all three aspects of it flow.
So how could we manage to somehow alter where we are in all of this? No matter where YOU are, its going to be the present. keep that in Mind. The present is what we see, experience, and all of that. To us, it dictates the future and creates the past. So let's form something that will take us into one of the other aspects. If we wanted to visit the future, supposing that our future might be predetermined based on our actions or 'path' in the present, we would have to have a method of shifting ourselves. I'm not providing that, im only giving my thoery of how to go about doing it.
So lets take a trip...right?
In order to make ourselves be in another part of the fourth dimension...theoretically, we wouldnt actually travel there. We would have to make that aspect the present...because we are always in the present right? So forget all ideas of machines sending people and stuff back in time or forward...Forget it. Think instead of something that alters time in a way to make it come to us. Humans are a stubborn sort right? so why dare to chase after something? exactly..
So the point of this big long thing you might have read.
We change time itself, not ourselves in time. In order to see the past we would have to commit something like this: Slowing our own present time in order to allow the flow of the past to catch up and wash over the present. We would stay at our seemingly slowed pace until the time desired was reached. this way people can coordinate themselves better, they would know their exact location upon 'arrival' and be able to work more efficiently. Of course this sort of thing would have to be controlled somehow, it wouldnt be humane to create something that would affect the entire fourth dimension...just something localized and semi small...
We change time itself, not ourselves in time. If we wanted to go ahead in time, which would follow the future of the path we were on at the normal present, and yes that means we wouldnt make any choices that could chage it while 'in transit'..we would be in a future that might possibly be the exact same as the normal present...with some time added. But the theoretical methodology is the same for the past. Only this time we would want to speed up the normal present a little...so that the normal present would overcome the future and wash over it like the past would have, going the other direction. Then once the desired time was reached we would return to normal and thus the future we desired becomes the new present...just like the past trip we took a moment ago yea?
so thats all there is.
We wanna slow the present so the past can catch up.
We wanna speed the present so that is can catch the future.
Thats all there is to my theory of time travel, maybe next time we will have a means to the method...
Adieu,
by venkatvasa on Thu 3rd Apr 11am
can anyone explain me the statement "pid=wait(&status)" in the example(father, son) for fork(), given in the articles of C.
by arhant on Wed 2nd Apr 12pm
Hi all,
Pl. tell me the good resources for learning C++ from scratch to advance.
Regards
by mcroteau on Fri 8th Feb 7am
I don't have time for a blog
by Tsukeinen on Wed 16th Jan 8am
Hello World
by quangntenemy on Mon 14th Jan 3pm
I don't feel comfortable writing a blog here, but if you are interested in reading about me, have a look at my other blogs:
Everlasting Wanderer
WeChall
quangntenemy teaches Java
Penguin Tamer
by halsten on Mon 7th Jan 3am
A long time has passed since my first analysis paper, but here is another one. This time its short and small. The package contain all the necessary files to get you started on understanding the malware. I hope its better than my last paper. You can check my blog for more details (http://iamhalsten.thecoderblogs.com/2008/01/06/backdoorw32smallpf-analysis /) and to download the analysis package.
by greengrub22 on Mon 24th Dec 11pm
I am trying to make a batch file that will open the run menu. My problem is that I do not know the source for the run menu. I know this is probly something simple. Here is what I got...
...............................................
@echo off
start (i need the source here)
call command
...............................................
by chiapaneko on Thu 20th Dec 12am
I've been trying to mount this service but I'm having some problems with it...
Comme back later, thank you! ;)
by bb on Wed 19th Dec 1pm
As any script you put inside post-commit.bat seems to be called synchronously, and doesnt inform the svn client that the commit has finished until the script has finished. I had to write a calling application which just starts the script in a new thread.
In unix i guess this would have been simply performed by appending a & to the end of the line or using fork!
Here is the c# class which calls the batch file
using System;
using System.Collections.Generic;
using System.Text;
namespace BatchLauncher
{
class Program
{
static void Main(string[] args)
{
  ;if (args.Length > 0)
  ;{
  ; StringBuilder sb = new StringBuilder();
  ; for (int i = 1; i < args.Length; i++)
  ; sb.AppendFormat("{0} ", args[i]);
  ; System.Diagnostics.Process.Start(args[0], sb.ToString());
  ;}
}
}
}
My post-commit file just looks like this
c:\svnrepos\hooks\BatchLauncher.exe c:\svnrepos\hooks\notify.bat
And obviously my notify script has a whole bunch of copy and email operations that we like to perform when a commit occurs.
nb, I guess you may need to consider whether block waiting for post commits is a good or bad thing in your circumstances, as obviously if two ppl commit and your scripts are running at the same time, carnage may ensue.
by countll on Thu 25th Oct 7am
soo nu on this wicked world of NET.
just decided to dive in today..hope friend aroun here can help
by sydnie121 on Mon 15th Oct 6pm
The internet at my school sucks ass everything is blocked
by maddhatter on Mon 1st Oct 3pm
my schools internet blocker uses a program called saint bernard. if anyone knows how to get passed it e-mail me at lilpeacekeeper@yahoo.com please!!!!
by eXanock on Thu 27th Sep 8am
I'm not going to use my OSIX blog. Instead, visit my blogger site: eXanock - Another blog on ethical hacking, coding and (legal) reverse engineering
by ketan404 on Mon 13th Aug 7am
I have launched my own website !
http://www.carvingIT.com.
Your feedback is welcome.
Ketan
by halsten on Sun 5th Aug 3am
Hello all, in here (http://iamhalsten.thecoderblogs.com/2007/07/23/malware-analysis/) you can find my latest analysis paper for a malware I've analyzed. The paper is extensively and comprehensively documented. Have fun reading it.
--
halsten
http://iamhalsten.thecoderblogs.com/
by prelude-pianosax on Tue 24th Jul 4pm
I saw a blog for someone using the name "pianosax" here on "osix.net". I have been using the name "pianosax" for ten years. I am suprised to see someone else using it now. See: http://prelude-pianosax.50megs.com
by bb on Sun 10th Jun 8am
I was thankful on finding this nugget of code, which makes the groupname work out when slamming in radiobuttons in an asp.net repeater.
http://www.codeguru.com/csharp/csharp/cs_controls/custom/article.php/c12371/
by bb on Tue 22nd May 7pm
Someone introduced me to the joyful NZB file recently.
Its truly a wonderful invention, and allows my to explore usenet binary grabbing using my NSLU2. as previous nntp readers id tried made the process too painful.
So simply ....
1) apt-get install hellanzb
2) setup the /etc/hellanzb.conf file to point to your usenet server of choice.
3) screen hellanzb
then goto your favourite nzb announcing website - i liked http://www.nzbs4u.net/. download an nzb file and drop it into your hellanzb/queue directory.
then sit back and enjoy your binaries dropped off onto your NSLU2 when they are ready.
happy slugging!
by bb on Wed 9th May 11am
I've been streaming music from my home NSLU2 server for a while now using mt-daapd (firefly) which is an ITunes server for linux. I can connect to my home network from work using ITunes and a little daap proxy app called rendevous.
My friend was doing the same thing, however the local IT guy at his work said he didnt like rendevous running on their PCs, so I looked around for an alternative solution which didn't require any client software.
I've played with shoutcast and mod_mp3 before, however i didnt fancy running it on the NSLU2, and i wanted him to be able to browse files and stream them .. not create a radio type cycle list.
Enter edna. Its a really nice lightweight python script which creates a mini webserver on a specified port, and dishes up your tunes. The cunning thing is that once you have navigated to the tunes or directory you want to play, it spits out a .m3u file back to your browser, which you can then launch in your music player of choice.
Its a great solution for an NSLU2 as its fast (much faster than the initial connect to mt-daapd with 10,000 tunes) and requires little or no installation requirements.
by moirants on Fri 27th Apr 12pm
so i have been trying countless times to try and get a few things up and going on my school computer but there are many restrictions and was just wondering if anyone knows how to get into the system/program ..whatever. the program is called "Blue Coat" and its run by the school board administration. If anyone has any suggestions or ideas, they are most certianly welcome.
by kdemetter on Wed 11th Apr 1pm
lately i've been playing with Java a little .
I'm working on a application that can create a list of meals for one week from a large list of meals .
well , it works . just some problems with Swing not doing what i want it to do :-)
http://www.osix.net/modules/folder/index.php?tid=16217&action=df
it's in dutch though ( my native language ) . I might make an english version too .
by aatrish2001 on Wed 11th Apr 6am
Dear friends
can any one of you tell me how to retrive MAC addrese in linux machine....using c++
by shmad123 on Thu 1st Mar 6am
Hi my name is adam LOL
E-Snips is a great site for allowing you upload and share files www.esnips.com . The interface is slick, and the client tool makes life easier. It really is one of the better 'free file upload' sites out there.
by necr0six on Tue 20th Feb 3pm
we develop, watch
by bb on Tue 20th Feb 2pm
I enjoyed this beautifully edited video about the web and its progression.
John Battelle's Blog Video
by mrhappyhack on Sat 17th Feb 5pm
If anyone needs help with something dealing with electronics i.e (your vcr,dvd,cd,tv,game system, or anything dealing with electronics). I would like to help you if I can. It would be cheaper for you to get some advice thats free, rather than taking it to a shop and paying alot of money for something that is minor to fix, or get advice on how to fix it yourself eh?
by helpmeplease on Tue 13th Feb 8pm
can anyone help me with msn pass?
please! would greatly appreciate it.
thanks
by atreyu on Fri 2nd Feb 1am
The JPEG committee was created in 1986 as a join of several groups that were working on presentation of photo quality graphics. Media storage and communication speed were big concerns at that time, and naturally JPEG put his focus on data compression. Six years later the committee published his most well known paper, the ISO standard 10918-1 / ITU-T recommendation T.81.
With a two years lag period the MPEG workgroup was producing MPEG-1, the standard on which Video CD and MP3 are based. JPEG and MPEG share more than the final three letters: they defined methods to apply the basic idea that allows digital media diffusion with today's hardware -- lossy compression.
These are the compressions achieved by popular formats with some photos; without lossy compression things would go slower (or smaller or uglier) on the net:
zip (full color) ############################# 72%
png full color ######################### 63%
gif (256 colors) ######### 23%
png 256 colors ######## 21%
jpeg quality 80 ### 8%
Great, I will use nothing but JPEG from now on
Lossy compression is not adequate to all images. Drawings with crisp lines have noticeable artifacts when JPEG compressed, indexed PNG is better in this case. Also JPEG does not allow transparency or animation, and is a final format -- never save your work in progress as JPEG. But if you want to put photos in html or send them by email, JPEG is the way.
How the thing works
The JPEG specification defines two ways to compress data without affecting the perception that we, humans, have about the image: drop color information, drop detail information.
The second method is easy to understand: the "big picture" is enough to get the meaning of the image, most details are never noticed; in JPEG all details are still present but encoded with less data. This is easy to say but hard to solve and even harder to do it quickly; the JPEG specification does it in a very elegant way and allows user control over detail information loss, that's what the "jpeg quality" is about.
The "drop colors" method is not that straight. JPEG specification does not define it completely, it only allows to encode images in any color space with specific wheight for each component. Even before JPEG was approved Mr. Eric Hamilton published the JFIF specification, that defines a file interchange format for JPEG images using the YCbCr color space. The image/jpeg mime type refers actually to JFIF files; JPEG images are bitstreams that can be included in other media, like keyframes in MPEG movies.
After the "drop details" step, data is very adequate to entropy encoding, a very common way to losslessly compress data -- it is part of the basic method used in zip files. A final "bit crunching" method is defined in JPEG specification.
It's Open Source, dude!
One option of the JPEG committee was to keep part of his specification free of known patents. To drop details a discrete cosine transform was used. The entropy encoder is partially based on a patent-free algorithm, the huffman coding.
At the same time that JPEG was being approved and JFIF written, the Independent JPEG Group begin to write a portable and free C library for JPEG image compression and decompression. This library allowed a fast adoption of the upcoming standard and is currently used as JPEG support by many applications.
To follow: * drop colors
* drop details
* bit crunching
by asdf on Thu 1st Feb 11pm
Well I almost forgot that I made this blog account;
So I should write something
by everyMan on Thu 1st Feb 2am
I need to write "run.pl" that calls expect script. the expect will the take the user and pass given in run.pl and telnet to another device.
by atreyu on Sun 21st Jan 12pm
Back-posts: Split the image, shuffle the pieces, show all but one
Goal: Split an image in n*n pieces, shuffle the pieces, show all but one, and let the user play with it until all are in place.
Let the user play...
To put it moving is easy -- when clicked, the piece exchanges layout position with hole:
function movePiece() { //image[].onRelease
var hole = image[HOLE].getDepth();
var piece = this.getDepth();
this.swapDepths(image[HOLE]);
layout[hole] = layout[piece];
layout[piece] = HOLE;
placePiece(hole); //piece atm
}
Yeah, this must be restricted to valid moves... boring stuff, link below.
...until puzzle solved
The big question around "puzzle solved" is not how to detected it, is more "what to do after". I hate the empty hole at end, so this puzzle will show the whole image:
checkPuzzle(); //born solved?
function checkPuzzle() { //is puzzle solved?
for (var p=0; p<size; p++) if (layout[p] != p) return false;
//show whole picture; next click will jump to next frame
image[HOLE]._visible = border[HOLE]._visible = true;
placePiece(HOLE); return true;
}
Check is done after each move; 'solved' is a new keyframe and action must be stopped in current frame:
stop();
function movePiece() { //image[].onRelease
if (image[HOLE]._visible) { gotoAndPlay('solved'); return; }
...
placePiece(hole); //piece atm
checkPuzzle();
}
Pack the puzzle
To transform this thing into something that can be put inside a frame with other stuff around, give the actors a scenario: put a square on stage and convert it to symbol. This time do not remove it, and give it a name IN PROPERTIES (you can still name the symbol and export to action script -- but the name used in scripts is the instance name, not the symbol name).
With the scenario beeing 'puzzle', change the 320x320 default and attach clips to 'puzzle' in loadPiece:
var puzzle_h:Number = puzzle._height /puzzle._yscale *100;
var puzzle_w:Number = puzzle._width /puzzle._xscale *100;
function loadPiece(p:Number) { //p = position in puzzle
...
image[i] = puzzle.attachMovie('default', 'image'+i, p);
border[i] = puzzle.attachMovie('border', 'border'+i, size +p);
mask[i] = puzzle.attachMovie('mask', 'mask'+i, 2*size +p);
...
Size of the puzzle is controlled in design mode via 'puzzle' dimensions, as with background.
The 'solved' frame
As it is you get a new game after last click. Put n++; in 'solved' action script and the number of pieces will increase. Or a stop(); some sort of interface to new_game/ increse/ decrease with gotoAndPlay(' first frame'); But that's another story.
Links: the source and the movie
To do: dynamic image
by atreyu on Sat 20th Jan 9pm
Back-posts: Split the image, shuffle the pieces
Goal: Split an image in n*n pieces, shuffle the pieces, show all but one, and let the user play with it until all are in place.
Classes may only be defined in external ActionScript. I want to keep the project tight, one file only, so no classes for now. Good -- I'm not a big oop fan. Instead of a "piece collection" I will have some arrays:
var layout:Array; //puzzle order
var image:Array; //image order
var border:Array; // ""
var mask:Array; // ""
The layout array will have elements swapped as the puzzle evolves. There is no need to swap clips, other arrays will be in picture order.
As tested in " Split the image", we can have a function called each time the masked part of the image is clicked. To locate the piece in the puzzle we need to identify each image through some MovieClip property, like the name. But there is a better deal: z-order.
Each movie clip (inside a container?) has unique z-order or depth as flash calls it. Depth can be used as identifier, working as index to the layout array with getDepth(). Depth is set when the movie is attached:
function loadPiece(p:Number) { //p = position in puzzle
var i:Number = layout[p]; //i = position in image
image[i] = attachMovie('default', 'image'+i, p);
border[i] = attachMovie('border', 'border'+i, size +p);
mask[i] = attachMovie('mask', 'mask'+i, 2*size +p);
image[i].onRelease = movePiece;
image[i].setMask(mask[i]);
...
}
Put the pieces in place is not fun, so I skip that part; a solution will be post.
Passing values to flash
The puzzle will have two parameters, size and image. Passing values to flash is easy, it works like php with register_globals on: you GET some.swf?n=5 and action script starts with one var with name 'n' and value '5'. Inside html <embed src="some.swf" flashVars="n=5"> can be used.
Here is the main part of the action script, ready for action:
////////////////////////////// from flashVars param or url:
var n; if (isNaN(n) || n<1 || n>20) n = 4; else n = Math.floor(n);
var img; //to do
//classes not allowed in internal ActionScript (with v7=MX)
var layout:Array; layout = randPuzzle(n); //puzzle order
var size:Number = layout.length;
var image:Array = new Array(size); //picture order
var border:Array = new Array(size); // ""
var mask:Array = new Array(size); // ""
var puzzle_h:Number = 320; //for now
var puzzle_w:Number = 320; // ""
var piece_h:Number = puzzle_h /n;
var piece_w:Number = puzzle_w /n;
for (var p=0; p<size; p++) loadPiece(p);
///////////////////////////////////////
function movePiece() { //image[].onRelease
//"this" is image[]:MovieClip
}
Ah, show all but one:
var HOLE:Number = size -1;
image[HOLE]._visible = border[HOLE]._visible = false
Links: the source and the movie
by marissa on Fri 19th Jan 12pm
Hey does anyone know a really good proxy for myspace my school has blocked like 150 proxy sites!!it's so irritating once we (close friends) find a good site someone tells and then everyone knows and pretty soon it's BLOCKED! please help!?
by atreyu on Mon 15th Jan 12pm
Back-post: Split the image
Goal: Split an image in n*n pieces, shuffle the pieces, show all but one, and let the user play with it until all are in place.
More than a hundred years ago Sam Loyd published a puzzle that became a success like Rubik's cube 100 years later. He offered a prize, but the puzzle was cheated so no one could complete it.
If pieces are placed random, it can end as insolvable puzzle half of the time. Most programs I've seen do not put the pieces random, they play back randomly from the final position -- how many movements are needed to get a "well randomized" puzzle? Other solution goes like this:
Shuffle the pieces
* Use a vector to create a random puzzle, saving the positions of last two pieces and hole.
* Compute the number of permutations that would be needed to put the vector in order.
* Add manhattan distance from hole position to bottom-right.
* If number of permutations is odd the puzzle is not solvable, swap last two pieces to get a good one.
This runs in JavaScript and ActionScript:
function randPuzzle(n) { //returns array with random n*n valid puzzle
var nn = n*n, stack = new Array(nn), shuff = new Array(nn), i, j;
var HOLE = nn-1, LAST1 = nn-2, LAST2 = nn-3, p1, p2, xy;
for (i=0; i<nn; i++) stack[i] = i;
for (i=0; i<nn; i++) { //pick random from stack
var r = Math.floor(Math.random() *(nn-i));
switch (stack[r]) { //need these later:
case LAST1: p1 = i; break;
case LAST2: p2 = i; break;
case HOLE: xy = i; break;
}
shuff[i] = stack[r]; //append to solution
stack[r] = stack[nn-1-i]; //fuzzy remove in place
}
//not all puzzles are solvable, see Sam Loyd's 15 puzzle
var par = 0; //permutation parity must be even to have solution
for (i=1; i<nn; i++) for (j=0; j<i; j++) if (shuff[j] > shuff[i]) par++;
//add manhattan distance from hole position to bottom-right
par += (n-1)-(xy%n) + (n-1)-(Math.floor(xy/n));
if (par&1) { //swap last pieces if odd parity
shuff[p1] = LAST2;
shuff[p2] = LAST1;
}
return shuff;
}
by atreyu on Mon 15th Jan 4am
For years I had 2 monitors atached to my computer. It's easy: pick a pci video card & old monitor, fix the card into a slot and you have it.
Multiple monitors are available in Mac "since ever", in Win since 98SE. It is a misjudged feature from my experience. Unfort/ my hardware is falling apart, agp card failed and the replacer is incompat/ with his pci relative... so I miss my 2nd monitor.
Noticed that while working with Flash. I need help while writing actions, and need debug while testing movies. Two monitors are better than one big monitor: if I keep the windows docked it ends with Flash trying to please me, but no thanks; with undocked windows they end up overlaped, no matter how big is the monitor.
Take the "copy help paste code and run" situation. With overlaped windows (or tabs) you loose the help text to paste code -- to continue reading the help you have to found it among 27 windows. With two monitors is easy to step code while reading help.
Internet searches aren't the same since I lost my 2nd monitor. Before, I had something to help me focus on the problem: the goal in one maximized window, the search in other, nothing more. Now, with no anchora, is easy to lost myself around the problem I want to solve. How I miss my 2nd monitor!
As my hardware is falling apart, it's time to think about the new configuration. There are no more bulk PCI cards. A motherboard with integrated video and AGP slot will do it?
by atreyu on Sun 14th Jan 2pm
I'm developing a "wish be" bonus chall to Osix using a tool for first time, need a n-puzzle and choose flash to make it.
I know that flash is not open source; but since Sun/Microsoft java war applets lost their role to flash movies (do you remember any applet in big public sites?) and flash is now the standard for web animation. You can download a 30 days trial from Macromedia, I'm using MX 2004 because v8 is too heavy for my hardware.
Goal: Split an image in n*n pieces, shuffle the pieces, show all but one, and let the user play with it until all are in place.
Split the image
The best way I found is using masks, let's see how it works:
* create a new flash document
Split the image - create mask
* Select (Window ») Tools » Rectangle, stroke color none and fill color any
* Draw like a square and right click » Convert to Symbol... we will use the mask in ActionScript like a movie so select 'Behaviour: Movie clip' and 'Linkage: Export for ActionScript, in first frame'. Put "mask" in Name and Identifier.
* Delete mask from stage (NOT from library).
Split the image - create border for good looking
* With rectangle tool selected, choose stroke color black and fill color none
* Draw like a square, select (Window ») Tools » Selection, shift click top and left edges of the rect. Change stroke to white, shift click to select the other edges.
* You can change the stroke style in (Window ») Properties; I used default ragged style and love it.
* Create a group with Modify » Group, convert to symbol (like mask) with name/id "border", delete from stage.
Split the image - import the image
* File » Import » to Stage... a medium/large image, convert to symbol with name/id "default" (later this will be dynamic), delete from stage.
Test the mask
One good thing in ActionScript is that it accepts almost all JavaScript. If you are comfortable with the later, no problems with language sintax -- you "only" need to worry with flash objects like MovieClip. One difference is strict declaration of vars: var image:MovieClip; //declares image to be used as MovieClip
Besides giving compile error for things like image='foo', the main advantage is that image(dot) gives code hints, you dont have it with var image; only.
* Open (Window » Development Panels ») Actions (F9) and enter:var image:MovieClip = attachMovie('default', 'image0', 0);
var border:MovieClip = attachMovie('border', 'border0', 1);
var mask:MovieClip = attachMovie('mask', 'mask0', 2);
* Use Control » Test Movie (Ctrl+Enter) to check that all is ok for now. You should see image, mask and border; if not, review previous steps.
* Now test the mask:(after var mask:MovieClip ... add)
image.setMask(mask);
mask._height = border._height = 80;
mask._width = border._width = 80;
* Movie test should show masked picture
* And play wit it:(after ..._width = 80; add)
image.onRelease = test;
function test() {
image._y = mask._y = border._y += 80;
image._x = mask._x = border._x += 80;
}
* Masked picture should move when clicked
* To use other pieces (not top-left) image._x,_y must be different from mask._x,_y:(after image.onRelease = test; replace with)
image._x = -80;
function test() {
image._y += 80;
image._x += 80;
mask._x = border._x += 80;
mask._y = border._y += 80;
}
That's all for now.
by bb on Thu 11th Jan 3am
Im enjoying using this really handy tool for picking a good palette for your website.
http://www.colormatch.dk/.
Im also really enjoying the following free website design template sites ..
http://www.oswd.org
and
http://www.openwebdesign.org/
by adamantium on Sun 24th Dec 10am
by bb on Mon 18th Dec 9am
I found these pictures of the man arrested today for the murder of 5 (maybe 6) girls in Ipswich, UK.
Turns out he fits the profile of most lunatics - he owns a myspace.com account!
I've recently got into watching mixed martial arts videos such as UFC and Pride.
Anyone else interested? Anyone got any recommended videos or fighters?
by bb on Mon 27th Nov 9am
i recently started using this ' screen_away' script to mark me as away in irc when i detach my screen. works nicely!
there is a bunch of other scripts available at the irssi site.
and for the record ... irssi on my nslu2 (slug) using debianslug is such a winning combination!
by bb on Fri 24th Nov 10am
I've just got into Google Reader.
I find it a bit buggy in IE7, but im really liking having feeds from all my favourite sites (this one included) integrated into the one place.
Ok, so I know its only day one ... and shit on the web has the habit of seeming really useful one day, and then me never bothering to visit it again .. but hey I'm going to give this one a go.
One thing that frustrates me a bit about the whole rss thing, is how you can get syndication of content from sites where you need to login. I'm considering writing my own scraping routine in php with my passwords/captured cookies in, and then just exposing that as an rss feed, but im sure im not the first person to be thinking of this ....
by sefo on Fri 17th Nov 12pm
I'm developing the win32 version of sneak:
http://snarkles.net/scripts/sneak/sneak.php
The ASM source code is available on cyberarmy svn (for members only - free)
Check the forum for details:
http://www.cyberarmy.net/forum/sneak/messages/295244.html

by sefo on Mon 13th Nov 8am
This a very simple and small toolbar I wrote in my spare time.
I use the same set of tools very often and I find it very annoying to look for them in the start menu, on the desktop or in explorer.
I put this toolbar in the /run folder and don't use the start menu anymore. (it was also a way to try the excellent PNG lib by Thomas Bleeker)
You can find the file and the sources here
PS: respect the config file format or expect some funky behaviour :p
by Adnurak on Thu 9th Nov 7pm
This is mainly for new users who want to try out Linux for the first time, but try it out if you're experienced in Linux anyway, it's kinda fun.
What with all these different distributions of Linux that you hear about all the time, it's hard to choose what distro is the right one for you. This simple, web based, step-by-step wizard hardly takes a few minutes and usually comes up quite accurate to what you're looking for:
http://www.zegeniestudios.net/ldc/index.php?firsttime=true
I, however, have personally tried Fedora, Red Hat, Mandrake, Ubuntu, Knoppix, and SLYNUX, and for me Ubuntu comes out best, and I found this wizard AFTER I knew Ubuntu was the distro for me. It's quite user-friendly, it's easy to install, and heck, it just works. Great distro to start learning from, with great IRC and forum-based support.
Get Ubuntu and get free Ubuntu CDs shipped to you below:
http://www.ubuntu.com
https://shipit.ubuntu.com
by ketan404 on Thu 9th Nov 6am
my friends company storm training has a really nice looking web site and provides great offers on microsoft office training in south yorkshire, england .
by anilg on Thu 2nd Nov 10am
http://www.futuremark.com/forum/showthread.php?t=23914
PS: Another call for the "humour" catagory.. (cut out the 'u' if you dont like it)
by bb on Fri 20th Oct 11am
i implemented this to tweak my apache/mysql for better performance on my NSLU2. Hard to tell if its helping much though ;-) Mysql really doesnt run too well with apache on NSLU2 so I dont use it for much.
http://www.unixshell.com/wiki/index.php/Optimizing_Apache/PHP/MySQL_for_low_memory_use
by Adnurak on Fri 20th Oct 6am
Fate is a simulation of a Linux system written in C++ and meant for DOS (runs fine in winxp and winme by just doubleclicking) that according to the creator, m101, shows you the basics of security in different Linux systems, including but not limited to, Mandrake, Slackware, and Red Hat. The whole thing is text based (Sorry, GNOME lovers :P ) and kinda has a storyline. You're supposed to break into these systems in order by using programs and security exploits that you'll discover and find on the way, with the general objective being "gain access to any one account on system, telnet in, remove logs, use security exploit or go hacking or whatever, gain root, then finally telnet to a particular IRC chat channel to get your new assignment and a selection of programs at your disposal. Rinse and repeat"
Of course, all the stuff is really outdated and all, but it's still kinda fun to pretend 'zomg i haked a red hat box lol i r 1337'
If you run Linux, this thing runs perfectly in Dosbox. If you don't have Dosbox and you're on Ubuntu, type this command in a terminal window to get it easily:
sudo apt-get install dosbox
But I'm sure you knew that already :P
The website link for Fate is below, but it's not really taken care of anymore. The shoutbox is spammed like heck.
http://www.fatetek.net/
So give it a shot, and comment here if you're stuck anywhere in Fate, and I'll help you out! :D
At the time of writing I'm stuck on trying to get to the system after the Red Hat one.
by Adnurak on Fri 20th Oct 6am
Hey people, I haven't posted for a while and for a good reason.
This video will explain all:
http://www.youtube.com/watch?v=-vLe1cucMPM
And if by any freak chance YouTube is blocked by your retard ISP, obtain Tor and Privoxy by any means necessary! Or you could just rack up reward points here and use our anonymous, high-speed proxy! (can't wait to try that out myself)
Anyway, in case you STILL have dial-up or are too lazy to click on the above URL, that is a video of my laptop having absolutely no monitor at all. Yes, it got ripped off (long story) but in either case, now my laptop is connected to this 15" TV on my desk via a video out cable. I called the Compaq Guy and he said that I should just give up on this piece of junk and get myself a new laptop. Well, I would, but the problem is my parents will never buy me a second hand or a brand new computer or laptop, just cause I'm still in high school and my sister's doing her MBA. Sheesh.
And stop sniggering, you evil freckled faces! I'm really 17! (Well, turning 17 in less than a month) but I'm still 17, even though it looks like I'm a 12 or 13 year old dork in that vid. Oh well. Gotta live with crappy shit webcams and microphones.
I swear, if there ever is a competition to see how long can you make a laptop last so it's still operable, I'd enter. I mean, sure, it's missing a monitor and is clinically dead, and only by the power of voodoo resurrection it's still working, but still, it's a valid entry, being a dual boot laptop with Lucasarts games and all four Monkey Island games on it and winme and Ubuntu 6.06. The software works just fine. It's kind of like a saintly soul inside a villain's body. Talk about an identity crisis :S
by bb on Thu 19th Oct 7am
I wrote an article today on my efforts at compiling rtorrent for debianslug. its here ...
Article on building rtorrent/libtorrent for arm5vtel NSLU2 with littleendian debianslug
by bb on Tue 10th Oct 9am
I installed ruby and wrote my first ruby on rails web application.
It was quite an enjoyable experience. Certainly more fun than asp.net (which is bloody unproductive)
I suggested we knock some internal application up in it for my company to have aplay around and see if it ends up being help or hinderance!
Heres a few links to stuff i used while playing with it
http://www.blainekendall.com/index.php/rubyonrailscheatsheet/
http://slash7.com/cheats/rails_files_cheatsheet.pdf
http://slash7.com/cheats/form_helpers.pdf
http://slash7.com/cheats/activerecord_cheatsheet.pdf
http://www.railsmanual.org
http://www.onlamp.com/pub/a/onlamp/2005/06/09/rails_ajax.html
http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html?page=5
by anilg on Sat 7th Oct 12pm
Email harvesting on google made easy :)
http://raphael.slinckx.net/blog/2006-10-06/google-valid-email-search
Its scary..
by think12 on Wed 4th Oct 2pm
So everything is working nicely now. I have all the account setup (all of those who donated this year) with passwords generated. I'm just waiting to rebuild the kernel (mainly with quotas) and reboot the box. With any luck I can do it tonight. I'll send a round of emails with all the info aswell. From now it'll be done (almost) automagically when a user (is kind enough) to donate.
Anyways, that's all for now.
by anilg on Mon 2nd Oct 8am
If you havnt yet checked out the legendary frog site.. ur missing a lot. Great flash toons.. I loved the "Matrix has you"..
http://www.legendaryfrog.com/movies_released.php
by bb on Sat 30th Sep 9am
I watched Crank last night, and it is without doubt the best film I have seen this year.
by bb on Fri 29th Sep 11am
I needed to get the number of files in a directory and recurse through all subdirectories doing the same. I nedded it so i could compare two sets of directory trees for something I was working on.
My Irish chum Enstyne came up with this Perl solution which seems to do the trick nicely!
perl -e 'sub z{my(@l)=glob(($p=$_[0])."/*");my(@x,$c);foreach $f(@l){$c++;push(@x,$f) if -d $f} print"$p: $c\n";foreach $f (@x){z($f)}}z(".");'
NSUL2:~# perl -e 'sub z{my(@l)=glob(($p=$_[0])."/*");my(@x,$c);foreach $f(@l){$c++;push(@x,$f) if -d $f} print"$p: $c\n";foreach $f (@x){z($f)}}z(".");'
.: 5
./dan: 4
./Mail:
./Public: 5
./Public/Apps: 3
by harry on Thu 28th Sep 12pm
Hi
In school i want to net send my mates but hide who its coming off any ideas. no programs though as the machine in school sets off an alarm if it detects any batch files etc...
thanks
Harry
by think12 on Wed 27th Sep 8am
Lately I've been struggling to get an email solution working for OSIX. We'd love to offer mail accounts that are properly tied into the rewards system. Just as a "thank you" to those who have helped out/donated over the time. Plus, we have a big beefy box that is hardly used. OSIX is popular, but not popular enough to bring this box to its knees (unlike the previous box :)
It's been a struggle trying to get *insert POP daemon here* to work with pam_mysql (using MD5). I've been ripping my hair out lately. If I keep it up, I'll look like bb soon. qpopper wasn't my first choice, but none the less I decided to try it. Now it's core dumping *rips out more hair*
pid 42104 (qpopper), uid 0: exited on signal 6 (core dumped)
Progress is slowly being made though. Anytime now I'll have a breakthrough.
I am sorry to those who are waiting for an account. Just a little longer!
That's all for me. I'm off for a relaxing weekend doing volunteer work. Yes, volunteer work, which is NOT my bag. My excuse? If I dedicate 4 days a year to helping someone other than myself, maybe, just maybe... I won't go to hell.
by bb on Tue 19th Sep 12pm
If like me your running debianslug on an NSLU2 and you'd like to mount an iso file so it can be directly streamed to Xbox Media Centre (its a beautiful solution isnt it!) then simply do the following.
Ensure you have loop support in your debianslug kernel. This requires your running debianslug 3.10 bin
NSUL2:~# uname -a
Linux NSUL2 2.6.16 #1 PREEMPT Thu Jun 8 23:38:13 PDT 2006 armv5tel GNU/Linux
Get the ipk file for loop
Install the ipk file (dont worry about any reported errors)
NSUL2:~# dpkg -i --force-architecture kernel-module-loop*.ipk
NSUL2:~# depmod -a; modprobe -v loop
Now mount your .iso file
NSUL2:~# mount -o loop -t iso9660 /path/to/iso /mnt/mountpoint
Easy huh!
ps thanks to Int16h and EvilDevil on the #nslu2-general channel for answering a few questions on this subject!
by bb on Mon 18th Sep 7am
That I've fixed that apostrophe issue when previewing your blog entry. As it was really annoying.
by bb on Sat 16th Sep 2pm
I found it amusing that the Nigerians 419er scam has turned Iraqi
Dear Sir/Madam
I am Mr HASSAN ANIE based in bagdad in iraq.I am the son of late major general in charge of purchase and maintainace in the past sadam hussain regime.Due to the situation here in in iraq,those of us in the business circle are finding it very difficult to cope with the situation here,no stable goverment,bomb explotion at strategic places every now and then,sometimes people find it very difficult to go about their normal businesses due to fear of being victim of terrorist attack,above all.the crisis in iraq now has made business activities totaly parallised for quite sometime now.for instance,no good telephone facilities,no adiquate security,infact,all most all the basic infrastructure were destroyed during the recent war in iraq,ever since then .the enviroment in iraq has never been condusive business wise.
I have about $40million dollars which i inherited from my late father and i will explain to you further on how i intend investing the money if you reply to my personal email below for security reasons.
(hassananie@netscape.net).
I awaite your immidiate reply
Hassan Anie
by bb on Wed 13th Sep 12pm
A while back I blogged about a concert ticket generator that I thought was hilarious ..
Someone showed me a collection of these generator things here ... http://www.says-it.com/
cool huh
|
|