User:DavidCary

From Wikibooks, open books for an open world
Jump to navigation Jump to search

I'm interested in medical electronics and robots, so naturally I'm interested in Electronics and Robotics and Programming:Serial Data Communications.

That led to me becoming sysop on the Open Circuits wiki http://opencircuits.com/ .

I'm also fascinated by Data Compression.

I help maintain the WikiIndex at http://wikiindex.org/ so naturally I'm interested in Wiki Science.

Feel free to leave notes on my discussion page here or at Wikipedia:User_talk:DavidCary .

When the comments I've made on some Talk: page become obsolete/irrelevant, please don't *leave* them there. Reduce clutter. Move it to User talk:DavidCary.

I try to eliminate notes as soon as they become obsolete/irrelevant. (I delete my own, and move others to the Talk: page of the person who signed it.).

I think the ideas around quine programs are fascinating ( Wiki: QuineProgram ).

I've been working in Python recently. Here's a quine I've written recently:

#!/usr/bin/python
# quine.py
# 2012-02-29: DAV: started by David Cary

def quine(dna):
    print ( dna.decode('string_escape') + dna + '"""\n' + 'quine(dna)' )

dna=r"""#!/usr/bin/python
# quine.py
# 2012-02-29: DAV: started by David Cary

def quine(dna):
    print ( dna.decode('string_escape') + dna + '\"\"\"\\n' + 'quine(dna)' )

dna=r\"\"\""""
quine(dna)

I've been editing C Programming and some Category:Subject:C++ programming language wikibooks recently. Here's a quine I've written recently:

#include <stdio.h>
int main(void){char d[]=
"\n\\\"#include <stdio.h> /* ANSI C quine by David Cary 2009 */%c"
"int main(void){char d[]=%c%c%cn%c%c%s%c;%c  printf"
"(d+3,*d,*d,d[2],d[1],d[1],d[1],d+1,d[2],*d,*d,*d,*d,*d);%c  return(0);%c}%c%c";
  printf(d+3,*d,*d,d[2],d[1],d[1],d[1],d+1,d[2],*d,*d,*d,*d,*d);
  return(0);
}

Another quine I've written recently: (with some inspiration from another ANSI C quine I saw at http://c2.com/cgi/wiki?QuineProgram ):

#include <stdio.h>
extern char*d;
int main(){
  fputs(d+37,stdout);
  while(*d!=0){
    char c=*d++;
    if(('\\'==c)||('"'==c)){putchar('\\');};
    if('\n'==c){puts("\\n\"");c='"';};
    putchar(c);
  };
  puts("\";"); return 0;
}
char*d="ANSI C quine by David Cary 2010-01-26#include <stdio.h>\n"
"extern char*d;\n"
"int main(){\n"
"  fputs(d+37,stdout);\n"
"  while(*d!=0){\n"
"    char c=*d++;\n"
"    if(('\\\\'==c)||('\"'==c)){putchar('\\\\');};\n"
"    if('\\n'==c){puts(\"\\\\n\\\"\");c='\"';};\n"
"    putchar(c);\n"
"  };\n"
"  puts(\"\\\";\"); return 0;\n"
"}\n"
"char*d=\"";
by This user does not like the passive voice.