Welcome to TiddlyWiki created by Jeremy Ruston, Copyright © 2007 UnaMesa Association
!Intro
* In the context of smart cards, an application protocol data unit (APDU) is the communication unit between a smart card reader and a smart card. Defined in the ISO7816.
* Command APDU ( Reader -> Card )
| 4 bytes | 1st byte |CLA |Class |
|~| 2sd byte |INS |Instruction |
|~| 3rd byte |P1 |Parameter 1 |
|~| 4th byte |P2 |Parameter 2 |
| 0-255 bytes | 0,1 or 3 bytes |Lc|Length of command ( # of bytes) |
|~| Nc bytes |Command Data |
|~| 2 bytes |Le | Max length of expected answer ( # of bytes )|
* Response APDU ( Card -> Reader )
| 0-255 bytes |Nr bytes | Response Data |
| 2 bytes |SW |Status Word | 9000 = Good |
> This site is intended to store all my cheat notes.
> Feel free to cut and paste.
> Clip-board ready ?
> Enjoy...
> Contact the author : derivation.bud@gmail.com
| ''Dec'' | ''Oct'' | ''Hex'' | ''Char'' | ''Note'' |
| 000 | 000 | 00 | NUL |Null character|
| 001 | 001 | 01 | SOH |Start of Header|
| 002 | 002 | 02 | STX |Start of Text|
| 003 | 003 | 03 | ETX |End of Text|
| 004 | 004 | 04 | EOT |End of Transmission|
| 005 | 005 | 05 | ENQ |Enquiry|
| 006 | 006 | 06 | ACK |Acknowledgment|
| 007 | 007 | 07 | BEL |Bell|
| 008 | 010 | 08 | BS |Backspace|
| 009 | 011 | 09 | HT |Horizontal Tab|
| 010 | 012 | 0A | LF |Line Feed|
| 011 | 013 | 0B | VT |Vertical Tab|
| 012 | 014 | 0C | FF |Form Feed|
| 013 | 015 | 0D | CR |Carriage Return|
| 014 | 016 | 0E | SO |Shift Out|
| 015 | 017 | 0F | SI |Shift In|
| 016 | 020 | 10 | DLE |Data Link Escape|
| 017 | 021 | 11 | """DC1""" |XON - Device Control 1|
| 018 | 022 | 12 | """DC2""" |Device Control 2|
| 019 | 023 | 13 | """DC3""" |XOFF - Device Control 3|
| 020 | 024 | 14 | """DC4""" |Device Control 4|
| 021 | 025 | 15 | NAK |Negative Acknowledgement|
| 022 | 026 | 16 | SYN |Synchronous Idle|
| 023 | 027 | 17 | ETB |End of Trans. Block|
| 024 | 030 | 18 | CAN |Cancel|
| 025 | 031 | 19 | EM |End of Medium|
| 026 | 032 | 1A | SUB |Substitute|
| 027 | 033 | 1B | ESC |Escape|
| 028 | 034 | 1C | FS |File Separator|
| 029 | 035 | 1D | GS |Group Separator|
| 030 | 036 | 1E | RS |Request to Send - Record Separator|
| 031 | 037 | 1F | US |Unit Separator|
| 032 | 040 | 20 | SP |Space|
| 033 | 041 | 21 | """!""" |exclamation mark|
| 034 | 042 | 22 | " |double quote|
| 035 | 043 | 23 | # |number sign|
| 036 | 044 | 24 | $ |dollar sign|
| 037 | 045 | 25 | % |percent|
| 038 | 046 | 26 | & |ampersand|
| 039 | 047 | 27 | ' |single quote|
| 040 | 050 | 28 | ( |left opening parenthesis|
| 041 | 051 | 29 | ) |right closing parenthesis|
| 042 | 052 | 2A | * |asterisk|
| 043 | 053 | 2B | + |plus|
| 044 | 054 | 2C | , |comma|
| 045 | 055 | 2D | - |minus or dash|
| 046 | 056 | 2E | . |dot|
| 047 | 057 | 2F | / |forward slash|
| 048 | 060 | 30 | 0 | |
| 049 | 061 | 31 | 1 | |
| 050 | 062 | 32 | 2 | |
| 051 | 063 | 33 | 3 | |
| 052 | 064 | 34 | 4 | |
| 053 | 065 | 35 | 5 | |
| 054 | 066 | 36 | 6 | |
| 055 | 067 | 37 | 7 | |
| 056 | 070 | 38 | 8 | |
| 057 | 071 | 39 | 9 | |
| 058 | 072 | 3A | : |colon|
| 059 | 073 | 3B | ; |semi-colon|
| 060 | 074 | 3C | < |less than sign|
| 061 | 075 | 3D | = |equal sign|
| 062 | 076 | 3E | > |greater than sign|
| 063 | 077 | 3F | ? |question mark|
| 064 | 100 | 40 | @ |AT symbol|
| 065 | 101 | 41 | A | |
| 066 | 102 | 42 | B | |
| 067 | 103 | 43 | C | |
| 068 | 104 | 44 | D | |
| 069 | 105 | 45 | E | |
| 070 | 106 | 46 | F | |
| 071 | 107 | 47 | G | |
| 072 | 110 | 48 | H | |
| 073 | 111 | 49 | I | |
| 074 | 112 | 4A | J | |
| 075 | 113 | 4B | K | |
| 076 | 114 | 4C | L | |
| 077 | 115 | 4D | M | |
| 078 | 116 | 4E | N | |
| 079 | 117 | 4F | O | |
| 080 | 120 | 50 | P | |
| 081 | 121 | 51 | Q | |
| 082 | 122 | 52 | R | |
| 083 | 123 | 53 | S | |
| 084 | 124 | 54 | T | |
| 085 | 125 | 55 | U | |
| 086 | 126 | 56 | V | |
| 087 | 127 | 57 | W | |
| 088 | 130 | 58 | X | |
| 089 | 131 | 59 | Y | |
| 090 | 132 | 5A | Z | |
| 091 | 133 | 5B | [ |left opening bracket|
| 092 | 134 | 5C | \ |back slash|
| 093 | 135 | 5D | ] |right closing bracket|
| 094 | 136 | 5E | ^ |caret cirumflex|
| 095 | 137 | 5F | _ |underscore|
| 096 | 140 | 60 | ` | |
| 097 | 141 | 61 | a | |
| 098 | 142 | 62 | b | |
| 099 | 143 | 63 | c | |
| 100 | 144 | 64 | d | |
| 101 | 145 | 65 | e | |
| 102 | 146 | 66 | f | |
| 103 | 147 | 67 | g | |
| 104 | 150 | 68 | h | |
| 105 | 151 | 69 | i | |
| 106 | 152 | 6A | j | |
| 107 | 153 | 6B | k | |
| 108 | 154 | 6C | l | |
| 109 | 155 | 6D | m | |
| 110 | 156 | 6E | n | |
| 111 | 157 | 6F | o | |
| 112 | 160 | 70 | p | |
| 113 | 161 | 71 | q | |
| 114 | 162 | 72 | r | |
| 115 | 163 | 73 | s | |
| 116 | 164 | 74 | t | |
| 117 | 165 | 75 | u | |
| 118 | 166 | 76 | v | |
| 119 | 167 | 77 | w | |
| 120 | 170 | 78 | x | |
| 121 | 171 | 79 | y | |
| 122 | 172 | 7A | z | |
| 123 | 173 | 7B | { |left opening brace|
| 124 | 174 | 7C | """|""" |vertical bar|
| 125 | 175 | 7D | } |right closing brace|
| 126 | 176 | 7E | ~ |tilde|
| 127 | 177 | 7F | DEL |delete|
* Write a file 'my_script.scr'
{{{
filedia 0
_layer E Die_with_scribe
_rectang -40,-40 @3200,3100
_layer E Die_without_scribe
_rectang 0,0 @3120,3020
_layer E PADS
_rectang 30,322 @80,110
_line 30,322 @80,110
_line 30,432 @80,-110
_text 55,377 75 0 GND
_rectang 330,30 @110,80
_line 330,30 @110,80
_line 330,110 @110,-80
_text 385,70 75 90 VCC
_zoom
_e
filedia 1
}}}
* Gotcha
Coordinates are terminated with a blank character, do not forget an extra space at the end of lines ?
Pate:
* 250g de semoule fine
* 50cl d'eau tiède
* 125g de farine
* sel,sucre
* 1 sachet de levure
Laisser la levure travailler une heure.
Faire les crêpes dans la poêle.
|bash |tcsh |
|x=3 |set x = 3 |
|y=$x:4 |set y=($x 4) |
|export z=5 |setenv z 5 |
|export q=$z:6 |setenv q "$z 6" |
|z=7 |set z = 7 |
|export PATH=/a:/b |set path=(/a /b) |
|alias ls="ls -l" |alias ls "ls -l" |
|PS1=abc- |set prompt=abc- |
|prog > ofile 2> efile |(prog > ofile) >& efile |
|. script |source script |
|/etc/profile<br>~/.bash_profile<br>~/.bash_login<br>~/.profile |/etc/csh.cshrc<br>/etc/csh.login<br>~/.tcshrc<br>~/.cshrc<br>~/.login |
!!View binary contents
* xv <file>
* gitview <file>
* bvi <file>
* vim -b <file>
!The sequence
# Power on
# Execution of the BIOS (Basic Input Output System ) from a small ROM
# BIOS performs the POST ( Power On ~Self-Test )
# BIOS looks for the boot sector:
## A list of prioritized devices are scanned
## The devices are checked for MBR ( Main Boot Record ) existence: i.e. a 500-byte piece of code on the sector 0 that ends with the magic value ~AA55
## BIOS jumps to the MBR
## MBR contains the primary partion table and a boot loader (example: grub, bootmgr, lilo, ntldr)
## The bootloader loads the boot sector of the active partition ( example: /boot for linux ). Some bootloaders can give the choice of OS or jump to a chained-bootloader in a partition.
# Control is passed to the loaded OS
!Make a bootable USB stick
* From Windows:
##load an iso image of the distribution. Example: http://www.ubuntu.com/getubuntu/download
##load a small windows utility: unetbootin @ http://unetbootin.sourceforge.net/
##launch unetbootin, plug a fresh USB stick in
##ask unetbootin to put the iso image onto the stick
##at reboot, enter the BIOS to make sure USB boot has high priority
* From ubuntu 8.1+
** System → Administration → Create a USB startup Disk
* From ~MacOS:
** Disk util: copy the iso image onto a mac formatted USB
!Struggling in grub shell
{{{
GRUB loading.
error: no such disk
grub rescue> set
prefix=(UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX)/boot/grub
root=UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
grub rescue> ls
(hd0) (hd0,6) (hd0,5)
grub rescue> ls (hd0,5)/
error: unknown filesystem
grub rescue> ls (hd0,6)/
./ ../ lost+found/ boot/
grub rescue> set prefix=(hd0,6)/boot/grub
grub rescue> insmod sh
...//...
rescue:grub> ls (hd0,6)/boot
./ ../ vmcoreinfo-2.6.31-20-generic System.map-2.6.31-20-generic initrd.img-2.6.31-20-generic
vmlinuz-2.6.31-20-generic config-2.6.31-20-generic grub/ memtest86+.bin abi-2.6.31-20-generic
rescue:grub> set root=hd0,6
rescue:grub> insmod linux
rescue:grub> linux /boot/vmlinuz-2.6.31-20-generic root=/dev/sda6 quiet
[Linux-bzImage, setup=0x3400, size=0x3c400]
rescue:grub> initrd /boot/initrd.img-2.6.31-20-generic
[Initrd, addr=0x177fb000, size=0x83874e]
rescue:grub> boot
...//...
}}}
! Basics
{{{
$ myvar='My Value!'
}}}
*no spaces around {{{=}}}
*single quote → no shell expansion for the bang
{{{
$ export myvar
}}}
*makes it available out of the script
{{{
$ echo $myvar AAA${myvar}BBB
My Value! ~AAAMy Value!BBB
}}}
* Braces help delimiting the variable name
! File name tricks
{{{
$ basename /path/to/my/file.txt
file.txt
$ dirname /path/to/my/file.txt
/path/to/my/
}}}
! Arrays
{{{
$ myArray=(one two three)
$ echo ${myArray[2]}
three
}}}
{{{
$ for ele in $myArray
$ do
$ echo $ele
$ done
}}}
! Command substitution
* 2 possibilities: {{{'...'}}} and {{{$(...)}}}
{{{
$ MYDIR=`dirname /path/to/my/file.txt`
$ echo $MYDIR
/path/to/my
}}}
{{{
$ MYDIR=$(dirname /path/to/my/file.txt)
$ echo $MYDIR
/path/to/my
}}}
! Arithmetic
* Double parenthesis {{{$((...))}}}
{{{
$ echo $(( 100 / 3 ))
33
$ myvar="56"
$ echo $(( $myvar + 12 ))
68
$ myvar=$(( $myvar + 1 ))
$ echo $myvar
57
}}}
! Chopping
{{{
$ myvar=ABCDEF
}}}
* indexing
{{{
$ echo $myvar:0:3
ABC
}}}
* remove shortest({{{#}}})/longest({{{##}}}) matching beginning:
{{{
$ echo ${myvar#AB},${myvar#AB*},${myvar##AB*}
CDEF,CDEF,
}}}
* remove shortest({{{%}}})/longest({{{%%}}}) matching ending:
{{{
$ echo ${myvar%EF},${myvar%%[B-Z]*},${myvar%%ext}
ABCD,A,ABCDEF
}}}
* sustitute
{{{
$ echo "${myvar/My/Your}"
Your Value!
}}}
! Special variables
* Arguments
{{{
#!/bin/bash
echo name of script is $0
echo first argument is $1
echo second argument is $2
echo number of arguments is $#
echo list of all arguments: $@
}}}
! If-then-else
{{{
if [ "${1##*.}" = "tar" ]
then
echo 'Argument is a tarball.'
elif [ "${1##*.}" = "zip" ]
then
echo 'Argument is compressed.'
else
echo 'Argument is something else.'
fi
}}}
! case
{{{
echo -n "Enter the name of an animal: "
read ANIMAL
echo -n "The $ANIMAL has "
case $ANIMAL in
horse | dog | cat) echo -n "four";;
man | kangaroo ) echo -n "two";;
*) echo -n "an unknown number of";;
esac
echo " legs."
}}}
! Condition expression
* flags
{{{
if [ -z "$myvar" ]
then
echo "myvar is not defined"
fi
}}}
* 2 identical possibilies for operators:
{{{
if [ "$myvar" -eq 3 ]
then
echo "myvar equals 3"
fi
}}}
{{{
if [ "$myvar" = "3" ]
then
echo "myvar equals 3"
fi
}}}
! Single or double bracket ?
** [ = test , okay with operators: {{{ ==,=,!=,<,>,-eq, -ne, -lt, -le, -gt, or -ge }}}
** [ [ = extended test , adds regexp operators: {{{ =~ }}}
! for
{{{
for x in one two three four
do
echo number $x
done
}}}
//
number one
number two
number three
number four
//
! while
{{{
myvar=0
while [ $myvar -ne 10 ]
do
echo $myvar
myvar=$(( $myvar + 1 ))
done
}}}
//
0
1
2
...
7
8
9
//
! until
{{{
myvar=0
until [ $myvar -eq 10 ]
do
echo $myvar
myvar=$(( $myvar + 1 ))
done
}}}
//
0
1
2
...
7
8
9
//
! function
{{{
myfunc() {
for x in $myvar
do
echo $x
done
}
myvar="hello world"
myfunc
}}}
//
hello
world
//
{{{
#!/bin/bash -norc
# vi: ts=4:sts=4:sw=4:et
. setup.rc
if [ $# -lt 1 ]
then
echo Usage: `basename $0` task
echo task:
cat $0 | grep -o "^;*[_a-z0-9]*) .*" | tr -d ";)"
labels=`cat $0 | grep -o "^;*[_a-z0-9]*)" | tr -d ";)" | tr "\n" " "`
echo Type this to get autocompletion:
echo complete -W \"$labels\" $0
exit 0
fi
verbose=""
[[ "$@" =~ "-v" ]] && verbose="-v"
echo ___________Launching_task____________ $1
case $1 in
revs) # Prints the system libraries versions
python --version
openssl version
openssl ecparam -list_curves
;;task1) # run
arg1=YOP
arg2=YIP
`dirname $0`/runme $arg1 $arg2
;;task2) # run 2
arg1=YOP
arg2=YIP2
`dirname $0`/runme $arg1 $arg2
;;quine) # La totale
for task in task1 task2
do
. $0 $task $verbose
done
;;doc) # Builds doc/*.html
for module in mod1 mod2 mod3
do
python -m pydoc -w $module
mv $module.html doc/
done
sed '/AUTODOC START/,$D' README.html > tmp.html
echo "<!-- AUTODOC START -->" >> tmp.html
cat $0 | grep -o "^;*[_a-z0-9]*) .*" | tr -d ";)" >> tmp.html
echo "<!-- AUTODOC END -->" >> tmp.html
sed '0,/AUTODOC END/D' README.html >> tmp.html
mv tmp.html README.html
;;*)
echo -e "ZAP \e[00;31mFAILS\e[00m, Unknown task: $1"
esac
echo ___________Done_with_task____________ $1
}}}
{{{
#!/bin/bash
for dirIn in /media/david/attic/Music/*
do
dirOut=${dirIn/Music/Music2}
mkdir -p "$dirOut"
for fileIn in "${dirIn}"/*
do
fileOut=${fileIn/Music/Music2}
fileOut=${fileOut/.m4a/.mp3}
if [ ! -e "$fileOut" ] ; then
case ${fileIn##*.} in
jpg | mp3) cp "$fileIn" "$fileOut";;
m4a ) ffmpeg -i "$fileIn" -acodec libmp3lame -ab 128k "$fileOut";;
*) echo "Skiping: ${fileIn}"
esac
fi
done
done
}}}
! Windows Quick Start:
* Download and install Virtual Serial Port Driver at http://www.ftdichip.com/Drivers/VCP.htm
* Restart Windows
* Plugin buspirate
* Get related portID: Panel -> System -> Device Manager -> Ports -> USB Serial Port ( COM<ID> )
* Setup terminal on COM<ID> ( i.e. putty )
** Speed: 115200
** Data Bits: 8
** Stop Bits: 1
** Parity: None
** Flow Control: None
! Terminal Usage
* connect gnd and adc
* type ? for help
* ~ for autotest
* d for measure
{{{
// my first program in C++
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World!";
return 0;
}
}}}
{{{
#include <iostream>
using namespace std;
class CRectangle {
int width, height;
public:
CRectangle (int,int);
int area () {return (width*height);}
};
CRectangle::CRectangle (int a, int b) {
width = a;
height = b;
}
int main () {
CRectangle rect (3,4);
CRectangle rectb (5,6);
cout << "rect area: " << rect.area() << endl;
cout << "rectb area: " << rectb.area() << endl;
return 0;
}
}}}
rect area: 12
rectb area: 30
!types
|char |signed or unsigned 1-byte integer |
|short int |signed or unsigned 2-byte integer |
|short |signed or unsigned 2-byte integer |
|int |signed or unsigned 4-byte integer |
|long |signed or unsigned 4-byte integer |
|long int |signed or unsigned 4-byte integer |
|bool |true or false 1-byte boolean |
|float |signed 4-byte floating point number |
|double |signed 8-byte floating point number |
|long double |signed 8-byte floating point number |
|wchar_t |2 or 4-byte Wide character |
!Structures
{{{
struct product {
int weight;
float price;
} ;
product apple;
product banana, melon;
}}}
!Culture
''— BCLP — B — C →''
* ''1972'': Dennis Ritchie and Brian Kernighan write an evolution of the B language at Bell Labs known as C K&R.
* ''1989'': ANSI normalization known as C89
* ''1999'': ISO normalization known as C99. Added feature : dynamic arrays ...
! Compile and Run
* Simple
{{{
gcc mysourcecode.c -o myexecutable
myexecutable arg1 arg2
}}}
* Debugger
{{{
gcc mysourcecode.c -Wall -o myexecutable -ggdb
gdb myexecutable
gdb> run arg1 arg2
gdb> step
}}}
* Reverse
{{{
objdump -S myexecutable
...
80491dc: 55 push %ebp
80491dd: 89 e5 mov %esp,%ebp
80491df: 53 push %ebx
80491e0: 52 push %edx
80491e1: a1 70 a4 04 08 mov 0x804a470,%eax
80491e6: 83 f8 ff cmp $0xffffffff,%eax
...
}}}
{{{
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
/*----------------- Usage -------------------*/
if (argc != 3)
{ printf("usage: scriptname <fileIne> <fileOut>\n" );
exit (1);
}
/*----------------- Unpack Arguments --------*/
char fileIn[100];
strcpy(fileIn,argv[1]);
char fileOut[50];
strcpy(fileOut,argv[2]);
/*----------------- File Access --------------*/
FILE *fpi;
fpi = fopen( fileIn, "r") ;
if (fpi == NULL)
{ printf("Cannot read the file %s\n",fileIn);
exit( 1 );
}
FILE *fpo;
fpo = fopen( fileOut, "w") ;
if (fpo == NULL)
{ printf("Cannot write the file %s\n",fileOut);
exit( 1 );
}
/*---------------- Parse Main Loop ------------*/
char line[512];
char newLine[512];
while( ! feof(fpi) )
{ fgets(line,512,fpi);
/* ... Do something Here .. */
strcpy(newLine,line);
fprintf(fpo,"%s",newLine);
}
fclose(fpi);
fclose(fpo);
exit (0);
}
}}}
{{{
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
/*----------------- Usage -------------------*/
if (argc != 3)
{ printf("usage: scriptname <fileIne> <fileOut>\n" );
exit (1);
}
/*----------------- Unpack Arguments --------*/
char fileIn[100];
strcpy(fileIn,argv[1]);
char fileOut[50];
strcpy(fileOut,argv[2]);
/*----------------- File Access --------------*/
FILE *fpi;
fpi = fopen( fileIn, "r") ;
if (fpi == NULL)
{ printf("Cannot read the file %s\n",fileIn);
exit( 1 );
}
FILE *fpo;
fpo = fopen( fileOut, "w") ;
if (fpo == NULL)
{ printf("Cannot write the file %s\n",fileOut);
exit( 1 );
}
/*---------------- Parse Main Loop ------------*/
char line[512];
char newLine[512];
while( ! feof(fpi) )
{ fgets(line,512,fpi);
/* ... Do something Here .. */
strcpy(newLine,line);
fprintf(fpo,"%s",newLine);
}
fclose(fpi);
fclose(fpo);
exit (0);
}
}}}
{{{
#include <stdio.h>
int main ()
{
int var = 20; /* actual variable declaration */
int *ip; /* pointer variable declaration */
ip = &var; /* store address of var in pointer variable*/
printf("Address of var variable: %x\n", &var );
/* address stored in pointer variable */
printf("Address stored in ip variable: %x\n", ip );
/* access the value using the pointer */
printf("Value of *ip variable: %d\n", *ip );
return 0;
}
}}}
//Address of var variable: bffd8b3c
//Address stored in ip variable: bffd8b3c
//Value of *ip variable: 20
{{{
#include <stdio.h>
int main( int argc, char *argv[] )
{
if( argc == 2 )
{
printf("The argument supplied is %s\n", argv[1]);
}
else if( argc > 2 )
{
printf("Too many arguments supplied.\n");
}
else
{
printf("One argument expected.\n");
}
}
}}}
! Wiki
Compared @ http://www.wikimatrix.org
| Engine | source | prog | lang | ldap | acl | pdf |svg | search | xml |
| [[MediaWiki| http://www.mediawiki.org]]| open free | php :(| 140 | y | ?:( | htmldoc | plugin | tags | y |
| [[TikiWiki| http://tikiwiki.org]] |open free | php :(| 34 | y | y | :( | plugin | index :( | y |
| [[DokuWiki| http://www.dokuwiki.org]] |open free | php :(| 51 | y | y | htmldoc | plugin | n :(| n :( |
| [[MoinMoin | http://moinmo.in]] |open free | python | ? | y | y | htmldoc | y | index :(| y |
| [[Daisy | http://www.daisycms.org]] |open free | java | 6 | y | y | y | y | tags | y |
| [[ Confluence | http://www.atlassian.com ]] |prop $ :(| java | 15 | y | y | y | plugin | index :(| y |
! Content Managment System
Top-rated @ http://www.cmsmatrix.org/matrix/cms-matrix
| 1 |[[Joomla! | http://www.joomla.org ]] |open free|any |php |
| 2 |[[Dupral | http://drupal.org ]] |open free|any |php |
| 3 |[[Mambo | http://mambo-foundation.org ]] |open free|any |php |
| 4 |[[TYPO3 | http://typo3.org ]] |open free|any |php |
| 5 |[[WebGUI | http://www.webgui.org ]] |open free|any |perl |
| 6 |[[Plone | http://plone.org ]] |open free|any |python |
| 7 |Xoops |open free|any |php |
| 8 |PHP Nuke |open free|any |php |
| 9 |~WordPress |open free|any |php |
| 10 |~DotNetNuke |open free|win |vb |
| 11 |~PostNuke |open free|any |php |
| 12 |[[eZ Publish | http://ez.no ]] |open 30$+vat|any |php |
| 13 |[[OpenCMS | http://www.opencms.org/en]] |open free|any |java |
| 14 |e107 |open free|any |php |
| 15 |[[Alfresco|http://www.alfresco.com]] |open 15k$|any |java |
| 16 |~TikiWiki |open free|any |php |
| 17 |Xaraya|open free|any |php |
| 18 |phpWebSite |open free |nix |php |
| 19 |Magnolia |open 12k$|any |java |
| 20 |Apache Lenya|open 1k$|any |java |
| 21 |~RedDot CMS|closed 55k$|any |java |
! Single source Publishing
* docbook
* Agile modeling
* doxygen
* SPIRIT 2.0
! Sending a signed document
* Data -> hash -> crypt w/ private key -> signature
* Send Data + signature
! Receiving a signed document
* Receive Data + signature
* signature -> decrypt w/ public key -> expected hashed data
* Data -> hash -> compare with expected -> If equal , Data is from private key owner
! Certificate
A certificate is a signed document with Data = Public key + identity information ( name, address...)
/***
|Name:|CloseOnCancelPlugin|
|Description:|Closes the tiddler if you click new tiddler then cancel. Default behaviour is to leave it open|
|Version:|3.0.1 ($Rev: 3861 $)|
|Date:|$Date: 2008-03-08 10:53:09 +1000 (Sat, 08 Mar 2008) $|
|Source:|http://mptw.tiddlyspot.com/#CloseOnCancelPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
***/
//{{{
merge(config.commands.cancelTiddler,{
handler_mptw_orig_closeUnsaved: config.commands.cancelTiddler.handler,
handler: function(event,src,title) {
this.handler_mptw_orig_closeUnsaved(event,src,title);
if (!store.tiddlerExists(title) && !store.isShadowTiddler(title))
story.closeTiddler(title,true);
return false;
}
});
//}}}
Name: Cotton
Background: #fff8ed
Foreground: #000
PrimaryPale: #e3c7a6
PrimaryLight: #b57a78
PrimaryMid: #995353
PrimaryDark: #410a0a
SecondaryPale: #eee6c5
SecondaryLight: #fe8
SecondaryMid: #ddbf95
SecondaryDark: #5c3426
TertiaryPale: #eee8dd
TertiaryLight: #bbaf7c
TertiaryMid: #786349
TertiaryDark: #705c45
Name: Cotton
Background: #fff8ed
Foreground: #000
PrimaryPale: #e3c7a6
PrimaryLight: #b57a78
PrimaryMid: #995353
PrimaryDark: #410a0a
SecondaryPale: #eee6c5
SecondaryLight: #fe8
SecondaryMid: #ddbf95
SecondaryDark: #5c3426
TertiaryPale: #eee8dd
TertiaryLight: #bbaf7c
TertiaryMid: #786349
TertiaryDark: #705c45
Pour 20-25 pièces :
Pâte : Comme une pâte brisée, mais mouiller avec de l'eau de fleur d'oranger: 250g de farine + 100g de beurre + sel + sucre + eau de f.o.
Farce: Comme un pâte d'amande mais mouiller avec de l'eau de f.o.: 125g de poudre d'amande + sucre + eau de f.o.
Sortir les chaussons du four dès que ça commence à foncer ( ~ 10 min )
!! System of linear equations
*∃?(x,y,z) /
>a1.x+b1.y+c1.z=d1
>a2.x+b2.y+c2.z=d2
>a3.x+b3.y+c3.z=d3
*Determinant
{{{
|a1 b1 c1|
D=|a2 b2 c2|
|a3 b3 c3|
}}}
*If D ≠0:
{{{
|d1 b1 c1| |a1 d1 c1| |a1 b1 d1|
x=1/D.|d2 b2 c2|, y=1/D.|a2 d2 c2|, z=1/D.|a2 b2 d2|
|d3 b3 c3| |a3 d3 c3| |a3 b3 d3|
}}}
* 500g de farine
* 6 œufs
* 300-500g d'amandes
* sucre
* eau ou eau de fleur d'oranger ou amaretto
Le mélange doit être collant, en faire 2 pains sur la plaque du four ( truc: lisser en mouillant )
Après une première cuisson de 25 min , découper les croquants et ré-enfourner 20 min.
!! So many shells
''— sh — csh — ksh — tcsh — bash →''
* ''sh'': known as bourne shell, released by Stephen Bourne at AT&T Bell Labs in ''1977'' and part of V7 Unix in 1979.
* ''csh'': developed in ''1978'' for BSD ( Berkeley unix) by Bill Joy ( author of vi and co-foundator of Sun) with a syntax modeled after the C. Added features: job controls, aliases, ~expansion ...
* ''ksh'': korn shell written by David Korn at AT&T Bell Labs in ''1980''.
* ''tcsh'' : The T comes from Tenex ( another OS) that inspired Ken Greer. Added features: filename completion, history stack ...
* ''bash'' : bourne-again shell written in ''1987'' by Brian Fox including goodies from both ksh and tcsh.
!! Default shell
| solaris | tcsh |
| linux | bash |
| macOS | bash |
* Can be changed in {{{/etc/passwd}}}
!! Script header ( aka shebang line )
"""#!/bin/csh -fe"""
{{indent{
''#!'': Request to start a new child-shell that will execute the remaining lines in the file
''/bin/csh'': Specify an interpreter for the child-shell
''-f'': The child-shell will inherit of a copy of the current environment settings
''-e'': Stop the script if one of the command returns an error code }}}
!!Strings & filenames
{{{
set filename = /path/to/myfile.txt
}}}
///path/to/myfile.txt//
!! Modifiers
{{{
echo $filename:h # head
echo $filename:t # tail
echo $filename:r # radix
echo $filename:e # extension
echo $filename:s/file/newfile/ # substitute
}}}
///path/to
myfile.txt
/path/to/myfile
txt
/path/to/mynewfile.txt//
!! Word lists
{{{
set mylist = (word1 word2 word3)
set mylist = ($mylist word4 )
echo "tot of $#mylist elements"
echo "2sd element is $mylist[2]"
}}}
//tot of 4 elements
2sd element is word2//
!! Numerals
{{{
@ cnt = 12
@ cnt = $cnt + 2
}}}
//14//
!!Arguments
{{{
if ($#argv < 2) then
printf "\tUsage: $argv[0] <file1> <file2> \n"
exit (1)
endif
set file1 = $argv[1]
set file2 = $argv[2]
}}}
!!Advanced
|$?name |'1' if $name is set |
|$#name |the number of words in $name |
|$%name |the number of characters in $name |
|$< |standard input |
|$? |same as $status i.e. errorcode of previous command |
| verbose |when set, every command is echoed before execution |
| noglob |when set, filename matching not done before assignements |
!! File inquiry
{{{
if ( -e myfile.txt ) rm myfile.txt
}}}
* -e : exists
* -r : readable
* -w : writable
* -d : directory
* -l : link
* -f : plain file
* -z : zero size
!! One liner
{{{
if !(($var1 == none) && ( $var2 == "red" )) echo "yop"
}}}
!! Nested
{{{
if ( $color == none ) then
echo "black and white"
else
if ( $color == "blue" ) then
echo "blue"
else
echo "red"
endif
endif
}}}
!! Case
{{{
switch ("$choice")
case "red"
echo "red"
breaksw
case "blue"
echo "blue"
breaksw
default
echo "green"
endsw
}}}
!!Range
{{{
@ cnt = 0
while ( $cnt < 3 )
@ cnt ++
echo $cnt
end
}}}
//1
2
3//
!!List
{{{
set colors = ( red green blue)
foreach color ($colors)
echo $color
end
}}}
//red
green
blue
//
!! Basic
{{{
echo "print me"
goto bypass
echo "dont print me"
bypass:
echo "the end"
}}}
//print me
the end//
!! Event handling
{{{
...
onintr kill
...
kill:
echo "Aouch"
rm -rf tmp*
onintr -
}}}
!!Foreach file
* ''1 :'' create a script //myscript//:
{{{
#!/bin/csh -f
set file = $<
while ( $file != "" )
< action >
set file = $<
end
}}}
* ''2 :'' prepare the list of file to process
{{{
ls -1 *.asm > filelist
}}}
* ''3 :'' launch
{{{
myscript < filelist
}}}
! Asking yes or no
{{{
echo -n "Is it a yes or a no ? "
set answer = $<
echo " You said: $answer"
}}}
//Is it a yes or a no ? blue
You said: blue
//
! Asking password
{{{
echo -n "Password: "
set stty_settings = `stty -g`
stty -echo
set pw = $<
stty "$stty_settings"
echo ""
echo " You secretly typed: $pw"
}}}
//Password:
You secretly typed: blue
//
! Batched multiple interactive inputs
{{{
$ cat myscript.csh
#/bin/csh -f
echo -n "word 1: "; set w1=$<
echo -n "word 2: "; set w2=$<
echo "Words are $w1 and $w2"
$
$ myscript.csh <<EOT
?ABC
?DEF
?EOT
}}}
//word 1: word 2: Words are ABC and DEF//
!!Change Terminal's title
{{{
set myvar = "Hello world"
echo -n "\033]0;${myvar}\007"
}}}
!!Batch jobs
''sched'' is recommanded, do not use ''at'' or ''batch''
{{{
sched 10:41 "echo yop > myfile.txt"
}}}
!!Print text file in landscape
{{{
a2ps -w -ns myfile.txt | lpr -l
}}}
!!List misspelled words
{{{
echo "bon bone bonne" | aspell --language-tag=fr -l
}}}
//bone//
!! XML Style Sheet Processing
{{{
xsltproc <file>.xsl <file>.xml
}}}
!! Merge pdfs
{{{
gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=out.pdf in1.pdf in2.pdf in3.pdf ...
}}}
!! Copy dir including link targets
{{{
rsync -arLgtv /path/to/dir .
}}}
!! Remove matching files
{{{
find . -name .svn | xargs -n 1 rm -rf
}}}
!! Open a file with system default tool
{{{
gnome-open file.ods
gnome-open file.pdf
}}
! Dump all words of a dictionary
{{{
$ aspell dump master -d en
$ aspell dump master -d fr
}}}
! Match pattens:
{{{
aspell dump master -d en | grep '^d.*rf'
}}}
//dwarf
dwarfer
dwarfing
dwarf's
dwarfs
dwarfism
dwarfism's
dwarfest
dwarfed
dwarfish
//
<html>
<table summary="A data table of four columns displaying the CSS generated content properties.">
<tr>
<th scope="col">Property</th>
<th scope="col">Description</th>
<th scope="col">Possible Values</th>
<th scope="col">Examples</th>
</tr>
<tr>
<td class="prop_name">content</td>
<td>
Generates content in the document in conjunction with the
<span class="article_keywords">:before</span> and <span class="article_keywords">:after</span>
pseudo-elements.
</td>
<td>
String values, URL values, and predefined value formats:
<p class="article_code">
counter(name)<br />
counter(name, list-style-type)<br />
counters(name, string)<br />
counters(name, string, list-style-type)<br />
attr(X)<br />
open-quote<br />
close-quote<br />
no-open-quote<br />
no-close-quote
</p>
</td>
<td>
<div class="article_code">
div:before { content:"some text"; }
<p>
div:after { content:url(page2.html); }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">counter-increment</td>
<td>
Declares the counter increment for each instance of a selector.
</td>
<td>
Integers and the predefined value <span class="article_keywords">none</span>.
</td>
<td>
<a href="http://www.w3.org/TR/REC-CSS2/generate.html#propdef-counter-increment">More Information</a>
</td>
</tr>
<tr>
<td class="prop_name">counter-reset</td>
<td>
Declares the value the counter is set to on each instance of a selector.
</td>
<td>
Integers and the predefined value <span class="article_keywords">none</span>.
</td>
<td>
<a href="http://www.w3.org/TR/REC-CSS2/generate.html#propdef-counter-reset">More Information</a>
</td>
</tr>
<tr>
<td class="prop_name">quotes</td>
<td>
Declares the type of quotation marks to use for quotations and embedded quotations.
</td>
<td>
String values and the predefined value <span class="article_keywords">none</span>.
</td>
<td>
<a href="http://www.w3.org/TR/REC-CSS2/generate.html#propdef-quotes">More Information</a>
</td>
</tr>
</table>
</html>
<html>
<table summary="A data table of four columns displaying the CSS background properties.">
<tr>
<th scope="col">Property</th>
<th scope="col">Description</th>
<th scope="col">Possible Values</th>
<th scope="col">Examples</th>
</tr>
<tr>
<td class="prop_name">background-attachment</td>
<td>
Declares the attachment of a background image (to scroll with the page content
or be in a fixed position).
</td>
<td>
<div class="article_code">
fixed<br />
scroll
</div>
</td>
<td>
<div class="article_code">
div { background-attachment:fixed; }
<p>
div { background-attachment:scroll; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">background-color</td>
<td>
Declares the background color.
</td>
<td>
Valid color names, RGB values, hexidecimal notation.
</td>
<td>
<div class="article_code">
div { background-color:green; }
<p>
div { color:#00FF00; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">background-image</td>
<td>
Declares the background image of an element.
</td>
<td>
URL values.
</td>
<td>
<div class="article_code">
div { background-image:url(images/img.jpg); }
<p>
body { background-image:url(img.jpg); }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">background-position</td>
<td>
Declares the position of a background image.
</td>
<td>
Lengths or percentages for the x and y positions, or one of the predefined values:
<p class="article_code">
top left<br />
top center<br />
top right<br />
center left<br />
center center<br />
center right<br />
bottom left<br />
bottom center<br />
bottom right
</p>
</td>
<td>
<div class="article_code">
div { background-position:10px 50px; }
<p>
div { background-position:bottom right; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">background-repeat</td>
<td>
Declares how and/or if a background image repeats.
</td>
<td>
<div class="article_code">
repeat<br />
repeat-x<br />
repeat-y<br />
no-repeat
</div>
</td>
<td>
<div class="article_code">
div { background-repeat:repeat-x; }
<p>
div { background-repeat:no-repeat; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">background</td>
<td>
Used as a shorthand property to set all the background properties at once.
</td>
<td>
Separate values by a space in the following order (those that are not defined will use
inherited or default initial values):
<p class="article_code">
background-color<br />
background-image<br />
background-repeat <br />
background-attachment <br />
background-position<br />
</p>
</td>
<td>
<div class="article_code">
div { background:green url(image.jpg) no-repeat fixed center center; }
<p>
div { background:url(image.jpg) fixed; }
</p>
</div>
</td>
</tr>
</table>
</html>
<html>
<table summary="A data table of four columns displaying the CSS border properties.">
<tr>
<th scope="col">Property</th>
<th scope="col">Description</th>
<th scope="col">Possible Values</th>
<th scope="col">Examples</th>
</tr>
<tr>
<td class="prop_name">border-top-color</td>
<td>
Declares the color of the top border.
</td>
<td>
Valid color names, RGB values, hexidecimal notation, or the predefined value
<span class="article_keywords">transparent</span>.
</td>
<td>
<div class="article_code">
div { border-top-color:green; }
<p>
div { border-top-color:#00FF00; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">border-top-style</td>
<td>
Declares the style of the top border.
</td>
<td>
<div class="article_code">
none<br />
hidden<br />
dotted<br />
dashed<br />
solid<br />
double<br />
groove<br />
ridge<br />
inset<br />
outset
</div>
</td>
<td>
<div class="article_code">
div { border-top-style:solid; }
<p>
div { border-top-style:inset; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">border-top-width</td>
<td>
Declares the width of the top border.
</td>
<td>
Lengths or the following predefined values:
<p class="article_code">
thin<br />
medium<br />
thick
</p>
</td>
<td>
<div class="article_code">
div { border-top-width:2px; }
<p>
div { border-top-width:thin; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">border-top</td>
<td>
Used as a shorthand property to set all the border-top properties at once.
</td>
<td>
Separate values by a space in the following order (those that are not defined will use
inherited or default initial values):
<p class="article_code">
border-top-width<br />
border-top-style<br />
border-top-color
</p>
</td>
<td>
<div class="article_code">
div { border-top:2px solid green; }
<p>
div { border-top:thick double #00FF00; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">border-right-color</td>
<td>
Declares the color of the right border.
</td>
<td>
Valid color names, RGB values, hexidecimal notation, or the predefined value
<span class="article_keywords">transparent</span>.
</td>
<td>
<div class="article_code">
div { border-right-color:green; }
<p>
div { border-right-color:#00FF00; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">border-right-style</td>
<td>
Declares the style of the right border.
</td>
<td>
<div class="article_code">
none<br />
hidden<br />
dotted<br />
dashed<br />
solid<br />
double<br />
groove<br />
ridge<br />
inset<br />
outset
</div>
</td>
<td>
<div class="article_code">
div { border-right-style:solid; }
<p>
div { border-right-style:inset; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">border-right-width</td>
<td>
Declares the width of the right border.
</td>
<td>
Lengths or the following predefined values:
<p class="article_code">
thin<br />
medium<br />
thick
</p>
</td>
<td>
<div class="article_code">
div { border-right-width:2px; }
<p>
div { border-right-width:thin; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">border-right</td>
<td>
Used as a shorthand property to set all the border-right properties at once.
</td>
<td>
Separate values by a space in the following order (those that are not defined will use
inherited or default initial values):
<p class="article_code">
border-right-width<br />
border-right-style<br />
border-right-color
</p>
</td>
<td>
<div class="article_code">
div { border-right:2px solid green; }
<p>
div { border-right:thick double #00FF00; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">border-bottom-color</td>
<td>
Declares the color of the bottom border.
</td>
<td>
Valid color names, RGB values, hexidecimal notation, or the predefined value
<span class="article_keywords">transparent</span>.
</td>
<td>
<div class="article_code">
div { border-bottom-color:green; }
<p>
div { border-bottom-color:#00FF00; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">border-bottom-style</td>
<td>
Declares the style of the bottom border.
</td>
<td>
<div class="article_code">
none<br />
hidden<br />
dotted<br />
dashed<br />
solid<br />
double<br />
groove<br />
ridge<br />
inset<br />
outset
</div>
</td>
<td>
<div class="article_code">
div { border-bottom-style:solid; }
<p>
div { border-bottom-style:inset; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">border-bottom-width</td>
<td>
Declares the width of the bottom border.
</td>
<td>
Lengths or the following predefined values:
<p class="article_code">
thin<br />
medium<br />
thick
</p>
</td>
<td>
<div class="article_code">
div { border-bottom-width:2px; }
<p>
div { border-bottom-width:thin; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">border-bottom</td>
<td>
Used as a shorthand property to set all the border-bottom properties at once.
</td>
<td>
Separate values by a space in the following order (those that are not defined will use
inherited or default initial values):
<p class="article_code">
border-bottom-width<br />
border-bottom-style<br />
border-bottom-color
</p>
</td>
<td>
<div class="article_code">
div { border-bottom:2px solid green; }
<p>
div { border-bottom:thick double #00FF00; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">border-left-color</td>
<td>
Declares the color of the left border.
</td>
<td>
Valid color names, RGB values, hexidecimal notation, or the predefined value
<span class="article_keywords">transparent</span>.
</td>
<td>
<div class="article_code">
div { border-left-color:green; }
<p>
div { border-left-color:#00FF00; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">border-left-style</td>
<td>
Declares the style of the left border.
</td>
<td>
<div class="article_code">
none<br />
hidden<br />
dotted<br />
dashed<br />
solid<br />
double<br />
groove<br />
ridge<br />
inset<br />
outset
</div>
</td>
<td>
<div class="article_code">
div { border-left-style:solid; }
<p>
div { border-left-style:inset; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">border-left-width</td>
<td>
Declares the width of the left border.
</td>
<td>
Lengths or the following predefined values:
<p class="article_code">
thin<br />
medium<br />
thick
</p>
</td>
<td>
<div class="article_code">
div { border-left-width:2px; }
<p>
div { border-left-width:thin; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">border-left</td>
<td>
Used as a shorthand property to set all the border-left properties at once.
</td>
<td>
Separate values by a space in the following order (those that are not defined will use
inherited or default initial values):
<p class="article_code">
border-left-width<br />
border-left-style<br />
border-left-color
</p>
</td>
<td>
<div class="article_code">
div { border-left:2px solid green; }
<p>
div { border-left:thick double #00FF00; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">border-color</td>
<td>
Declares the border color of all four borders at once.
</td>
<td>
Valid color names, RGB values, hexidecimal notation, or the predefined value
<span class="article_keywords">transparent</span>.
<p>
Separate the color for each border by a space, declaring the colors for the borders
in the following order:
</p>
<p class="article-code">
border-top-color<br />
border-right-color<br />
border-bottom-color<br />
border-left-color
</p>
<p>
Undeclared values work as further shorthand notation.
If only one color value is declared, all four
borders will use that color. If two colors are declared, the top and bottom borders will use
the first color while the right and left borders will use the second color. If three colors
are declared, the top border will use the first color, the right and left borders will use the
second color, and the bottom border will use the third color.
</p>
</td>
<td>
<div class="article_code">
div { border-color:green red blue olive; }
<p>
div { border-color:green; }
</p>
<p>
div { border-color:green red; }
</p>
<p>
div { border-color:green red blue; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">border-style</td>
<td>
Declares the border style of all four borders at once.
</td>
<td>
<div class="article_code">
none<br />
hidden<br />
dotted<br />
dashed<br />
solid<br />
double<br />
groove<br />
ridge<br />
inset<br />
outset
</div>
<p>
Undeclared values work as further shorthand notation.
If only one style value is declared, all four
borders will use that style. If two styles are declared, the top and bottom borders will use
the first style while the right and left borders will use the second style. If three styles
are declared, the top border will use the first style, the right and left borders will use the
second style, and the bottom border will use the third style.
</p>
</td>
<td>
<div class="article_code">
div { border-style:solid dotted dashed double; }
<p>
div { border-style:solid; }
</p>
<p>
div { border-style:solid dotted; }
</p>
<p>
div { border-style:solid dotted dashed; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">border-width</td>
<td>
Declares the width of all four borders at once.
</td>
<td>
Lengths or the following predefined values:
<p class="article_code">
thin<br />
medium<br />
thick
</p>
<p>
Undeclared values work as further shorthand notation.
If only one width value is declared, all four
borders will use that width. If two widths are declared, the top and bottom borders will use
the first width while the right and left borders will use the second width. If three widths
are declared, the top border will use the first width, the right and left borders will use the
second width, and the bottom border will use the third width.
</p>
</td>
<td>
<div class="article_code">
div { border-width:1px 3px 5px 2px; }
<p>
div { border-width:thin; }
</p>
<p>
div { border-width:2px 4px; }
</p>
<p>
div { border-width:2px 4px 5px; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">border</td>
<td>
Used as a shorthand to declare the border properties when all four borders
will have the same appearance.
</td>
<td>
Separate values by a space in the following order (those that are not defined will use
inherited or default initial values):
<p class="article_code">
border-width<br />
border-style<br />
border-color
</p>
</td>
<td>
<div class="article_code">
div { border:1px double green; }
<p>
div { border:thin solid #00FF00; }
</p>
</div>
</td>
</tr>
</table>
</html>
<html>
<table summary="A data table of four columns displaying the CSS classification/positioning properties.">
<tr>
<th scope="col">Property</th>
<th scope="col">Description</th>
<th scope="col">Possible Values</th>
<th scope="col">Examples</th>
</tr>
<tr>
<td class="prop_name">clear</td>
<td>
Declares the side(s) of an element where no previous floating elements are allowed to be
adjacent.
</td>
<td>
<div class="article_code">
left<br />
right<br />
both<br />
none
</div>
</td>
<td>
<div class="article_code">
div { clear:right; }
<p>
div { clear:both; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">cursor</td>
<td>
Declares the type of cursor to be displayed.
</td>
<td>
URL values, and the following prefefined values:
<p class="article_code">
auto<br />
crosshair<br />
default<br />
pointer<br />
move<br />
e-resize<br />
ne-resize<br />
nw-resize<br />
n-resize<br />
se-resize<br />
sw-resize<br />
s-resize<br />
w-resize<br />
text<br />
wait<br />
help
</p>
</td>
<td>
<div class="article_code">
div { cursor:crosshair; }
<p>
div { cusrsor:url(image.csr); }
</p>
<p>
div { cusrsor:url(image.csr), pointer; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">display</td>
<td>
Declares if/how the element displays.
</td>
<td>
<div class="article_code">
none<br />
inline<br />
block<br />
list-item<br />
run-in<br />
compact<br />
marker<br />
table<br />
inline-table<br />
table-row-group<br />
table-header-group<br />
table-footer-group<br />
table-row<br />
table-column-group<br />
table-column<br />
table-cell<br />
table-caption
</div>
</td>
<td>
<div class="article_code">
div { display:none; }
<p>
div { display:inline; }
</p>
<p>
div { display:marker; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">float</td>
<td>
Declares whether a box should float to the left or right of other content, or
whether it should not be floated at all.
</td>
<td>
<div class="article_code">
left<br />
right<br />
none
</div>
</td>
<td>
<div class="article_code">
div { float:left; }
<p>
div { float:right; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">visibility</td>
<td>
Declares the visibility of boxes generated by an element.
</td>
<td>
visible<br />
hidden<br />
collapse
</td>
<td>
<div class="article_code">
div { visibility:visible; }
<p>
div { visibility:hidden; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">top</td>
<td>
Declares the distance that the top content edge of the element is offset
below the top edge of its containing block. The
<span class="article_keywords">position</span> property of the element must also
be set to a value other than <span class="article_keywords">static</span>.
</td>
<td>
Lengths, percentages, and the predefined value
<span class="article_keywords">auto</span>.
</td>
<td>
<div class="article_code">
div { top:15px; }
<p>
div { top:2%; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">right</td>
<td>
Declares the distance that the right content edge of the element is offset
to the left of the right edge of its containing block. The
<span class="article_keywords">position</span> property of the element must also
be set to a value other than <span class="article_keywords">static</span>.
</td>
<td>
Lengths, percentages, and the predefined value
<span class="article_keywords">auto</span>.
</td>
<td>
<div class="article_code">
div { right:15px; }
<p>
div { right:2%; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">bottom</td>
<td>
Declares the distance that the bottom content edge of the element is offset
above the bottom edge of its containing block. The
<span class="article_keywords">position</span> property of the element must also
be set to a value other than <span class="article_keywords">static</span>.
</td>
<td>
Lengths, percentages, and the predefined value
<span class="article_keywords">auto</span>.
</td>
<td>
<div class="article_code">
div { bottom:15px; }
<p>
div { bottom:2%; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">left</td>
<td>
Declares the distance that the left content edge of the element is offset
to the right of the left edge of its containing block. The
<span class="article_keywords">position</span> property of the element must also
be set to a value other than <span class="article_keywords">static</span>.
</td>
<td>
Lengths, percentages, and the predefined value
<span class="article_keywords">auto</span>.
</td>
<td>
<div class="article_code">
div { left:15px; }
<p>
div { left:2%; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">position</td>
<td>
Declares the type of positioning of an element.
</td>
<td>
<div class="article_code">
static<br />
relative<br />
absolute<br />
fixed
</div>
</td>
<td>
<div class="article_code">
div { position:absolute; }
<p>
div { position:relative; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">clip</td>
<td>
Declares the shape of a clipped region when the value of the
<span class="article_keywords">overflow</span> property is set to
a value other than <span class="article_keywords">visible</span>.
</td>
<td>
Shapes, or the predefined value <span class="article_keywords">auto</span>.
<p>
In CSS 2, the only valid shape is a rectangle, using the following format to
specify the offset lengths from each side of the box:
</p>
<p class="article_code">
rect(top, right, bottom, left)
</p>
</td>
<td>
<div class="article_code">
div { clip:auto; }
<p>
div { clip:rect(2px, 4px, 7px, 5px); }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">overflow</td>
<td>
Declares how content that overflows the element's box is handled.
</td>
<td>
<div class="article_code">
visible<br />
hidden<br />
scroll<br />
auto
</div>
</td>
<td>
<div class="article_code">
div { overflow:hidden; }
<p>
div { overflow:scroll; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">vertical-align</td>
<td>
Declares the vertical alignment of an inline-level element or a table cell.
</td>
<td>
Lengths, percentages, and the following predefined values:
<p class="article_code">
baseline<br />
sub<br />
super<br />
top<br />
text-top<br />
middle<br />
bottom<br />
text-bottom
</p>
</td>
<td>
<div class="article_code">
span { vertical-align:middle; }
<p>
td { vertical-align:top; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">z-index</td>
<td>
Declares the stack order of the element.
</td>
<td>
Integer values and the predefined value <span class="article_keywords">auto</span>.
</td>
<td>
<div class="article_code">
div { z-index:2; }
<p>
div { z-index:auto; }
</p>
</div>
</td>
</tr>
</table>
</html>
<html>
<table summary="A data table of four columns displaying the CSS dimension properties.">
<tr>
<th scope="col">Property</th>
<th scope="col">Description</th>
<th scope="col">Possible Values</th>
<th scope="col">Examples</th>
</tr>
<tr>
<td class="prop_name">height</td>
<td>
Declares the height of the element.
</td>
<td>
Lengths, percentages, and the predefined value
<span class="article_keywords">auto</span>.
</td>
<td>
<div class="article_code">
div { height:200px; }
<p>
div { height:50%; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">max-height</td>
<td>
Declares the maximum height of the element.
</td>
<td>
Lengths, percentages, and the predefined value
<span class="article_keywords">auto</span>.
</td>
<td>
<div class="article_code">
div { max-height:200px; }
<p>
div { max-height:50%; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">min-height</td>
<td>
Declares the minimum height of the element.
</td>
<td>
Lengths, percentages, and the predefined value
<span class="article_keywords">auto</span>.
</td>
<td>
<div class="article_code">
div { min-height:200px; }
<p>
div { min-height:50%; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">width</td>
<td>
Declares the width of the element.
</td>
<td>
Lengths, percentages, and the predefined value
<span class="article_keywords">auto</span>.
</td>
<td>
<div class="article_code">
div { width:500px; }
<p>
div { width:75%; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">max-width</td>
<td>
Declares the maximum width of the element.
</td>
<td>
Lengths, percentages, and the predefined value
<span class="article_keywords">auto</span>.
</td>
<td>
<div class="article_code">
div { max-width:500px; }
<p>
div { max-width:75%; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">min-width</td>
<td>
Declares the minimum width of the element.
</td>
<td>
Lengths, percentages, and the predefined value
<span class="article_keywords">auto</span>.
</td>
<td>
<div class="article_code">
div { min-width:500px; }
<p>
div { min-width:75%; }
</p>
</div>
</td>
</tr>
</table>
</html>
<html>
<table summary="A data table of four columns displaying the CSS font properties.">
<tr>
<th scope="col">Property</th>
<th scope="col">Description</th>
<th scope="col">Possible Values</th>
<th scope="col">Examples</th>
</tr>
<tr>
<td class="prop_name">font-family</td>
<td>
Declares the name of the font to be used. Previously set in HTML via the
<em>face</em> attribute in a <font> tag.
</td>
<td>
Valid font family names or generic family names, i.e. <em>Arial</em>,
<em>Verdana</em>, <em>sans-serif</em>,
<em>"Times New Roman"</em>, <em>Times</em>, <em>serif</em>, etc.
<p>
Font family names can be separated by a comma in the same declaration to allow
additional and/or generic family names to be used if the prefereed font is unable
to be displayed.
</p>
</td>
<td>
<div class="article_code">
div { font-family:Arial; }
<p>
div { font-family:Arial, Helvetica, sans-serif; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">font-size</td>
<td>
Declares the size of the font. Previously set in HTML via the
<em>size</em> attribute in a <font> tag.
</td>
<td>
Lengths (number and unit type— i.e. <em>1em</em>, <em>12pt</em>,
<em>10px</em>, <em>80%</em>) or one of the following predefined values:
<p class="article_code">
xx-small<br />
x-small<br />
small<br />
medium<br />
large<br />
x-large<br />
xx-large<br />
smaller<br />
larger
</p>
</td>
<td>
<div class="article_code">
div { font-size:70%; }
<p>
div { font-size:0.85em; }
</p>
<p>
div { font-size:medium; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">font-size-adjust</td>
<td>
<strong>
Limited browser support: Was part of CSS 2, but
not in CSS 2.1. This property may return in CSS 3.
</strong>
<p>
Declares the <em>aspect value</em> (font size divided by x-height).
</p>
</td>
<td>Numeric value</td>
<td>
<div class="article_code">
div { font-size-adjust:0.54; }
<p>
div { font-size-adjust:0.46; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">font-stretch</td>
<td>
<strong>
Limited browser support: Was part of CSS 2, but
not in CSS 2.1. This property may return in CSS 3.
</strong>
<p>
Declares the stretch of the font face.
</p>
</td>
<td>
normal<br />
wider<br />
narrower<br />
ultra-condensed<br />
extra-condensed<br />
condensed<br />
semi-condensed<br />
semi-expanded<br />
expanded<br />
extra-expanded<br />
ultra-expanded
</td>
<td>
<div class="article_code">
div { font-stretch:narrower; }
<p>
div { font-stretch:ultra-expanded; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">font-style</td>
<td>Declares the font style.</td>
<td>
<div class="article_code">
normal<br />
italic<br />
oblique
</div>
</td>
<td>
<div class="article_code">
div { font-style:italic; }
<p>
div { font-style:oblique; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">font-variant</td>
<td>Declares the font variant.</td>
<td>
<div class="article_code">
normal<br />
small-caps
</div>
</td>
<td>
<div class="article_code">
div { font-variant:normal; }
<p>
div { font-variant:small-caps; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">font-weight</td>
<td>Declares the font weight (lightness or boldness)</td>
<td>
<div class="article_code">
normal<br />
bold<br />
bolder<br />
lighter<br />
100<br />
200<br />
300<br />
400<br />
500<br />
600<br />
700<br />
800<br />
900
</div>
</td>
<td>
<div class="article_code">
div { font-weight:bolder; }
<p>
div { font-weight:200; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">font</td>
<td>
Used as a shorthand property to declare all of the font
properties at once (except font-size-adjust and font-stretch).
</td>
<td>
Separate values by a space in the following order (those that are not defined will use
inherited or default initial values):
<p class="article_code">
font-style<br />
font-variant<br />
font-weight<br />
font-size<br />
line-height<br />
font-family
</p>
</td>
<td>
<div class="article_code">
div { font:italic small-caps bold 1em 1.2em Arial }
<p>
div { font:bold 0.8em Verdana }
</p>
</div>
</td>
</tr>
</table>
</html>
<html>
<table summary="A data table of four columns displaying the CSS list properties.">
<tr>
<th scope="col">Property</th>
<th scope="col">Description</th>
<th scope="col">Possible Values</th>
<th scope="col">Examples</th>
</tr>
<tr>
<td class="prop_name">list-style-type</td>
<td>
Declares the type of list marker used.
</td>
<td>
<div class="article_code">
disc<br />
circle<br />
square<br />
decimal<br />
decimal-leading-zero<br />
lower-roman<br />
upper-roman<br />
lower-alpha<br />
upper-alpha<br />
lower-greek<br />
lower-latin<br />
upper-latin<br />
hebrew<br />
armenian<br />
georgian<br />
cjk-ideographic<br />
hiragana<br />
katakana<br />
hiragana-iroha<br />
katakana-iroha
</div>
</td>
<td>
<div class="article_code">
ol { list-style-type:upper-roman; }
<p>
ul { list-style-type:square; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">list-style-position</td>
<td>
Declares the position of the list marker.
</td>
<td>
<div class="article_code">
inside<br />
outside
</div>
</td>
<td>
<div class="article_code">
ol { list-style-position:inside; }
<p>
ul { list-style-position:outside; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">list-style-image</td>
<td>
Declares an image to be used as the list marker.
</td>
<td>
URL values.
</td>
<td>
<div class="article_code">
ul { list-style-image:url(image.jpg); }
</div>
</td>
</tr>
<tr>
<td class="prop_name">list-style</td>
<td>
Shorthand property to declare three list properties at once.
</td>
<td>
Separate values by a space in the following order (those that are not defined will use
inherited or default initial values):
<p class="article_code">
list-style-type<br />
list-style-position<br />
list-style-image
</p>
</td>
<td>
<div class="article_code">
ul { list-style:disc inside url(image.gif); }
<p>
ol { list-style:upper-roman outside; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">marker-offset</td>
<td>
Declares the marker offset for elements with a value of
<span class="article_keywords">marker</span> set for the
<span class="article_keywords">display</span> property.
</td>
<td>
Lengths and the predefined value <span class="article_keywords">auto</span>.
</td>
<td>
<div class="article_code">
li:before { display:marker; marker-offset:5px; }
</div>
</td>
</tr>
</table>
</html>
<html>
<table summary="A data table of four columns displaying the CSS margin properties.">
<tr>
<th scope="col">Property</th>
<th scope="col">Description</th>
<th scope="col">Possible Values</th>
<th scope="col">Examples</th>
</tr>
<tr>
<td class="prop_name">margin-top</td>
<td>
Declares the top margin for the element.
</td>
<td>
Lengths, percentages, and the predefined value <span class="article_keywords">auto</span>.
</td>
<td>
<div class="article_code">
div { margin-top:5px; }
<p>
div { margin-top:15%; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">margin-right</td>
<td>
Declares the right margin for the element.
</td>
<td>
Lengths, percentages, and the predefined value <span class="article_keywords">auto</span>.
</td>
<td>
<div class="article_code">
div { margin-right:5px; }
<p>
div { margin-right:15%; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">margin-bottom</td>
<td>
Declares the bottom margin for the element.
</td>
<td>
Lengths, percentages, and the predefined value <span class="article_keywords">auto</span>.
</td>
<td>
<div class="article_code">
div { margin-bottom:5px; }
<p>
div { margin-bottom:15%; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">margin-left</td>
<td>
Declares the left margin for the element.
</td>
<td>
Lengths, percentages, and the predefined value <span class="article_keywords">auto</span>.
</td>
<td>
<div class="article_code">
div { margin-left:5px; }
<p>
div { margin-left:15%; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">margin</td>
<td>
Shorthand property used to declare all the margin properties at once.
</td>
<td>
Separate values by a space in the following order (those that are not defined will use
inherited or default initial values):
<p class="article_code">
margin-top<br />
margin-right<br />
margin-bottom<br />
margin-left<br />
</p>
<p>
Undeclared values work as further shorthand notation.
If only one length value is declared, all four
margins will use that length. If two lengths are declared, the top and bottom margins will use
the first length while the right and left margins will use the second length. If three lengths
are declared, the top margin will use the first length, the right and left margins will use the
second length, and the bottom margin will use the third length.
</p>
</td>
<td>
<div class="article_code">
div { margin:5px 12px 4px 7px; }
<p>
div { margin:5px; }
</p>
<p>
div { margin:5px 10px; }
</p>
<p>
div { margin:5px 7px 4px; }
</p>
</div>
</td>
</tr>
</table>
</html>
<html>
<table summary="A data table of four columns displaying other CSS properties.">
<tr>
<th scope="col">Property</th>
<th scope="col">Description</th>
<th scope="col">Possible Values</th>
<th scope="col">Examples</th>
</tr>
<tr>
<td class="prop_name">azimuth</td>
<td>
Declares the angle that sound travels to the listener.
</td>
<td>
Angle values in degrees (deg), or one of the following predefined values:
<p class="article_code">
left-side<br />
far-left <br />
left <br />
center-left <br/>
center <br />
center-right <br />
right <br />
far-right <br />
right-side <br />
behind <br />
leftwards <br/>
rightwards
</p>
</td>
<td>
<div class="article_code">
div { azimuth:90deg; }
<p>
div { azimuth:behind; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">cue-after</td>
<td>
Declares an audio cue to play after an element.
</td>
<td>
URL values and the predefined value <span class="article_keywords">none</span>.
</td>
<td>
<div class="article_code">
div { cue-after:url(sound.wav); }
<p>
div { cue-after:none; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">cue-before</td>
<td>
Declares an audio cue to play before an element.
</td>
<td>
URL values and the predefined value <span class="article_keywords">none</span>.
</td>
<td>
<div class="article_code">
div { cue-before:url(sound.wav); }
<p>
div { cue-before:none; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">cue</td>
<td>
Shorthand proerty to set both cue values at once.
</td>
<td>
URL values and the predefined value <span class="article_keywords">none</span>. Separate
the values by a space in the following order:
<p class="article_code">
cue-before<br />
cue-after
</p>
<p>
If only one cue value is declared, it is used for both before and after.
</p>
</td>
<td>
<div class="article_code">
div { cue:url(sound.wav) url(sound2.wav); }
<p>
div { cue:url(sound.wav); }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">elevation</td>
<td>
Declares the elevation of a sound.
</td>
<td>
Angle values in degrees (deg), or one of the following predefined values:
<p class="article_code">
below<br />
level<br />
above<br />
higher<br />
lower
</p>
</td>
<td>
<div class="article_code">
div { elevation:30deg; }
<p>
div { elevation:higher; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">pause-after</td>
<td>
Declares the amount of time to pause after an element.
</td>
<td>
Time in milliseconds (ms) or percentages.
</td>
<td>
<div class="article_code">
div { pause-after:100ms; }
<p>
div { pause-after:20%; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">pause-before</td>
<td>
Declares the amount of time to pause before an element.
</td>
<td>
Time in milliseconds (ms) or percentages.
</td>
<td>
<div class="article_code">
div { pause-before:100ms; }
<p>
div { pause-before:20%; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">pause</td>
<td>
Shorthand proerty to set both pause values at once.
</td>
<td>
Separate
the values by a space in the following order:
<p class="article_code">
pause-before<br />
pause-after
</p>
<p>
If only one pause value is declared, it is used for both before and after.
</p>
</td>
<td>
<div class="article_code">
div { pause:200ms 100ms; }
<p>
div { pause:100ms; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">pitch</td>
<td>
Declares the average speaking pitch of a voice.
</td>
<td>
Frequencies in hertz (Hz) or the following predefined values:
<p class="article_code">
x-low<br />
low<br />
medium<br />
high<br />
x-high
</p>
</td>
<td>
<div class="article_code">
div { pitch:120Hz; }
<p>
div { pitch:high; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">pitch-range</td>
<td>
Declares a change in the pitch range of a voice.
</td>
<td>
Number values between 0 and 100 (lower values indicate a flat
voice while higher values indicate an animated voice).
</td>
<td>
<div class="article_code">
div { pitch-range:50; }
<p>
div { pitch-range:99; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">play-during</td>
<td>
Declares a background sound to be played while the current element is spoken.
</td>
<td>
URL value, followed by one or more of the following keywords, separated by spaces:
<p class="article_code">
mix<br />
repeat<br />
</p>
<p>
Alternatley, one of the following keywords:
</p>
<p class="article_code">
auto<br />
none
</p>
</td>
<td>
<div class="article_code">
div { play-during:url(music.wav); }
<p>
div { play-during:url(music.wav) repeat; }
</p>
<p>
div { play-during:none; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">richness</td>
<td>
Declares the richness of the voice in spoken text.
</td>
<td>
Numeric values between 0 and 100 (lower values have less richness and higher values
have more richness).
</td>
<td>
<div class="article_code">
div { richness:50; }
<p>
div { richness:0; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">speak</td>
<td>
Declares if/how text is spoken.
</td>
<td>
<div class="article_code">
normal<br />
none<br />
spell-out
</div>
</td>
<td>
<div class="article_code">
div { speak:none; }
<p>
div { speak:spell-out; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">speak-header</td>
<td>
Declares how often table header cells are spoken.
</td>
<td>
<div class="article_code">
once<br />
always
</div>
</td>
<td>
<div class="article_code">
th { speak-header:once; }
<p>
th { speak-header:always; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">speak-numeral</td>
<td>
Declares how numerals are spoken.
</td>
<td>
<div class="article_code">
digits<br />
continuous
</div>
</td>
<td>
<div class="article_code">
div { speak-numeral:digits; }
<p>
div { speak-numeral:continuous; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">speak-punctuation</td>
<td>
Declares how punctuation is spoken.
</td>
<td>
<div class="article_code">
code<br />
none
</div>
</td>
<td>
<div class="article_code">
div { speak-punctuation:code; }
<p>
div { speak-punctuation:none; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">speech-rate</td>
<td>
Declares the speech rate of spoken text.
</td>
<td>
A number indicating the number of words per minute, or one of the following
predefined values:
<p class="article_code">
x-slow<br />
slow<br />
medium<br />
fast<br />
x-fast<br />
faster<br />
slower
</p>
</td>
<td>
<div class="article_code">
div { speech-rate:50; }
<p>
div { speech-rate:medium; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">stress</td>
<td>
Declares the stress of the voice on spoken text.
</td>
<td>
Numeric values between 0 and 100 (lower values have less stress and higher values
have more stress).
</td>
<td>
<div class="article_code">
div { stress:50; }
<p>
div { stress:0; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">voice-family</td>
<td>
Declares the voice family of spoken text.
</td>
<td>
Generic or specific voice family names.
</td>
<td>
<a href="http://www.w3.org/TR/REC-CSS2/aural.html#propdef-voice-family">More Information</a>
</td>
</tr>
<tr>
<td class="prop_name">volume</td>
<td>
Declares the median volume.
</td>
<td>
Numbers between 0 and 100, percentages, or one of the following predefined values:
<p class="article_code">
silent<br />
x-soft<br />
soft<br />
medium<br />
loud<br />
x-loud
</p>
</td>
<td>
<div class="article_code">
div { volume:50; }
<p>
div { volume:silent; }
</p>
</div>
</td>
</tr>
</table>
</html>
<html>
<table summary="A data table of four columns displaying the CSS outline properties.">
<tr>
<th scope="col">Property</th>
<th scope="col">Description</th>
<th scope="col">Possible Values</th>
<th scope="col">Examples</th>
</tr>
<tr>
<td class="prop_name">outline-color</td>
<td>
Declares the outline color.
</td>
<td>
Valid color names, RGB values, hexidecimal notation.
</td>
<td>
<div class="article_code">
div { outline-color:green; }
<p>
div { outline-color:#00FF00; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">outline-style</td>
<td>
Declares the style of the outline.
</td>
<td>
<div class="article_code">
none<br />
dotted<br />
dashed<br />
solid<br />
double<br />
groove<br />
ridge<br />
inset<br />
outset
</div>
</td>
<td>
<div class="article_code">
div { outline-style:solid; }
<p>
div { outline-style:inset; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">outline-width</td>
<td>
Declares the width of the outline.
</td>
<td>
Lengths or the following predefined values:
<p class="article_code">
thin<br />
medium<br />
thick
</p>
</td>
<td>
<div class="article_code">
div { outline-width:2px; }
<p>
div { outline-width:thin; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">outline</td>
<td>
Used as a shorthand property to set all the background properties at once.
</td>
<td>
Separate values by a space in the following order (those that are not defined will use
inherited or default initial values):
<p class="article_code">
outline-color<br />
outline-style<br />
outline-width
</p>
</td>
<td>
<div class="article_code">
div { outline:green solid 2px; }
<p>
div { outline:#00FF00 double thick; }
</p>
</div>
</td>
</tr>
</table>
</html>
<html>
<table summary="A data table of four columns displaying the CSS padding properties.">
<tr>
<th scope="col">Property</th>
<th scope="col">Description</th>
<th scope="col">Possible Values</th>
<th scope="col">Examples</th>
</tr>
<tr>
<td class="prop_name">padding-top</td>
<td>
Declares the top padding for the element.
</td>
<td>
Lengths, percentages, and the predefined value <span class="article_keywords">auto</span>.
</td>
<td>
<div class="article_code">
div { padding-top:5px; }
<p>
div { padding-top:15%; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">padding-right</td>
<td>
Declares the right padding for the element.
</td>
<td>
Lengths, percentages, and the predefined value <span class="article_keywords">auto</span>.
</td>
<td>
<div class="article_code">
div { padding-right:5px; }
<p>
div { padding-right:15%; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">padding-bottom</td>
<td>
Declares the bottom padding for the element.
</td>
<td>
Lengths, percentages, and the predefined value <span class="article_keywords">auto</span>.
</td>
<td>
<div class="article_code">
div { padding-bottom:5px; }
<p>
div { padding-bottom:15%; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">padding-left</td>
<td>
Declares the left padding for the element.
</td>
<td>
Lengths, percentages, and the predefined value <span class="article_keywords">auto</span>.
</td>
<td>
<div class="article_code">
div { padding-left:5px; }
<p>
div { padding-left:15%; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">padding</td>
<td>
Shorthand property used to declare all the margin properties at once.
</td>
<td>
Separate values by a space in the following order (those that are not defined will use
inherited or default initial values):
<p class="article_code">
padding-top<br />
padding-right<br />
padding-bottom<br />
padding-left<br />
</p>
<p>
Undeclared values work as further shorthand notation.
If only one length value is declared, all four
sides will use that length. If two lengths are declared, the top and bottom sides will use
the first length while the right and left sides will use the second length. If three lengths
are declared, the top side will use the first length, the right and left sides will use the
second length, and the bottom side will use the third length.
</p>
</td>
<td>
<div class="article_code">
div { padding:5px 12px 4px 7px; }
<p>
div { padding:5px; }
</p>
<p>
div { padding:5px 10px; }
</p>
<p>
div { padding:5px 7px 4px; }
</p>
</div>
</td>
</tr>
</table>
</html>
<html>
<table summary="A data table of four columns displaying CSS page properties.">
<tr>
<th scope="col">Property</th>
<th scope="col">Description</th>
<th scope="col">Possible Values</th>
<th scope="col">Examples</th>
</tr>
<tr>
<td class="prop_name">marks</td>
<td>
Declares the type of marks to display outside the page box.
</td>
<td>
<div class="article_code">
crop<br />
cross
</div>
</td>
<td>
<div class="article_code">
@page { marks:crop; }
</div>
</td>
</tr>
<tr>
<td class="prop_name">orphans</td>
<td>
Declares the minimum number of lines of a paragraph that must be left at the bottom of a page.
</td>
<td>
Integers
</td>
<td>
<div class="article_code">
@page { orphans:2; }
</div>
</td>
</tr>
<tr>
<td class="prop_name">page</td>
<td>
Declares the type of page where an element should be displayed.
</td>
<td>
Indentifiers
</td>
<td>
<a href="http://www.w3.org/TR/REC-CSS2/page.html#propdef-page">More Information</a>
</td>
</tr>
<tr>
<td class="prop_name">page-break-after</td>
<td>
Declares a page break.
</td>
<td>
<div class="article_code">
auto<br />
always<br />
avoid<br />
left<br />
right
</div>
</td>
<td>
<a href="http://www.w3.org/TR/REC-CSS2/page.html#propdef-page-break-after">More Information</a>
</td>
</tr>
<tr>
<td class="prop_name">page-break-before</td>
<td>
Declares a page break.
</td>
<td>
<div class="article_code">
auto<br />
always<br />
avoid<br />
left<br />
right
</div>
</td>
<td>
<a href="http://www.w3.org/TR/REC-CSS2/page.html#propdef-page-break-before">More Information</a>
</td>
</tr>
<tr>
<td class="prop_name">page-break-inside</td>
<td>
Declares a page break.
</td>
<td>
<div class="article_code">
auto<br />
avoid<br />
</div>
</td>
<td>
<a href="http://www.w3.org/TR/REC-CSS2/page.html#propdef-page-break-inside">More Information</a>
</td>
</tr>
<tr>
<td class="prop_name">size</td>
<td>
Declares the size and orientation of a page box.
</td>
<td>
Lengths, and the following predefined values:
<p class="article_code">
auto<br />
landscape<br />
potrait
</p>
</td>
<td>
<a href="http://www.w3.org/TR/REC-CSS2/page.html#propdef-size">More Information</a>
</td>
</tr>
<tr>
<td class="prop_name">widows</td>
<td>
Declares the minimum number of lines of a paragraph that must be left at the top of a page.
</td>
<td>
Integers
</td>
<td>
<div class="article_code">
@page { widows:2; }
</div>
</td>
</tr>
</table>
</html>
<html>
<table summary="A data table of four columns displaying the CSS table properties.">
<tr>
<th scope="col">Property</th>
<th scope="col">Description</th>
<th scope="col">Possible Values</th>
<th scope="col">Examples</th>
</tr>
<tr>
<td class="prop_name">border-collapse</td>
<td>
Declares the way borders are displayed.
</td>
<td>
<div class="article_code">
collapse<br />
separate
</div>
</td>
<td>
<div class="article_code">
table { border-collapse:collapse; }
<p>
table { border-collapse:separate; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">border-spacing</td>
<td>
Declares the distance separating borders (if
<span class="article_keywords">border-collapse</span> is
<span class="article_keywords">separate</span>).
</td>
<td>
Lengths for the horizontal and vertical spacing, separated by a space.
<p>
If one length is value is declared, that length is used for both the horizontal and
vertical spacing. If two lengths are declared, the first one is used for horizontal
spacing and the second one is used for vertical spacing.
</p>
</td>
<td>
<div class="article_code">
table { border-spacing:5px; }
<p>
table { border-spacing:5px 10px; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">caption-side</td>
<td>
Declares where the table caption is displayed in relation to the table.
</td>
<td>
<div class="article_code">
top<br />
bottom<br />
left<br />
right
</div>
</td>
<td>
<div class="article_code">
caption { caption-side:top; }
<p>
caption { caption-side:right; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">empty-cells</td>
<td>
Declares the way empty cells are displayed (if
<span class="article_keywords">border-collapse</span> is
<span class="article_keywords">separate</span>).
</td>
<td>
<div class="article_code">
show<br />
hide
</div>
</td>
<td>
<div class="article_code">
table { empty-cells:show; }
<p>
table { empty-cells:hide; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">table-layout</td>
<td>
Declares the type of table layout.
</td>
<td>
<div class="article_code">
auto<br />
fixed
</div>
</td>
<td>
<div class="article_code">
table { table-layout:auto; }
<p>
table { table-layout:fixed; }
</p>
</div>
</td>
</tr>
</table>
</html>
<html>
<table summary="A data table of four columns displaying the CSS text properties.">
<tr>
<th scope="col">Property</th>
<th scope="col">Description</th>
<th scope="col">Possible Values</th>
<th scope="col">Examples</th>
</tr>
<tr>
<td class="prop_name">color</td>
<td>
Declares the color of the text.
</td>
<td>
Valid color names, RGB values, hexidecimal notation.
<p>
The predefined color names are:
</p>
<p class="article_code">
aqua<br />
black<br />
blue <br />
fuchsia<br />
gray<br />
green<br />
lime<br />
maroon<br />
navy<br />
olive<br />
purple<br />
red<br />
silver<br />
teal<br />
white<br />
yellow<br />
</p>
</td>
<td>
<div class="article_code">
div { color:green; }
<p>
div {
<span style="white-space:nowrap">color:rgb(0,255,0);</span>
}
</p>
<p>
div { color:#00FF00; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">direction</td>
<td>
Declares the reading direction of the text.
</td>
<td>
<div class="article_code">
ltr<br />
rtl
</div>
<p>
ltr = left-to-right<br />
rtl = right-to-left
</p>
</td>
<td>
<div class="article_code">
div { direction:ltr; }
<p>
div { direction:rtl; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">line-height</td>
<td>
Declares the distance between lines.
</td>
<td>
Numbers, percentages, lengths, and the predefined value of
<span class="article_code">normal</span>.
</td>
<td>
<div class="article_code">
div { line-height:normal; }
<p>
div { line-height:2em; }
</p>
<p>
div { line-height:125%; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">letter-spacing</td>
<td>
Declares the amount of space between text characters.
</td>
<td>
A length (in addition to the default space) or the predefined value of
<span class="article_code">normal</span>.
</td>
<td>
<div class="article_code">
div { letter-spacing:normal; }
<p>
div { letter-spacing:5px; }
</p>
<p>
div { letter-spacing:-1px; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">text-align</td>
<td>
Declares the horizontal alignment of inline content.
</td>
<td>
<div class="article_code">
left<br />
right<br />
center<br />
justify
</div>
<p>
If used on a set of table cells, this property can be given a string value
to which the text of each row of the column will be aligned.
</p>
</td>
<td>
<div class="article_code">
div { text-align:center; }
<p>
div { text-align:right; }
</p>
<p>
td { text-align:"."; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">text-decoration</td>
<td>
Declares the text decoration.
</td>
<td>
<div class="article_code">
none<br />
underline<br />
overline<br />
line-through<br />
blink
</div>
</td>
<td>
<div class="article_code">
div { text-decoration:none; }
<p>
div { text-decoration:underline; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">text-indent</td>
<td>
Declares the indentation of the first line of text.
</td>
<td>
Lengths and percentages.
</td>
<td>
<div class="article_code">
div { text-indent:12px; }
<p>
div { text-indent:2%; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">text-shadow</td>
<td>
Declares shadow effects on the text.
</td>
<td>
A list containg a color followed by numeric values (separated by spaces) that specify:
<ol>
<li>The color for the shadow effect</li>
<li>Horizontal distance to the right of the text</li>
<li>Vertical distance below the text</li>
<li>Blur radius</li>
</ol>
</td>
<td>
<div class="article_code">
div { text-shadow:green 2px 2px 7px; }
<p>
div { text-shadow:olive -3px -4px 5px; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">text-transform</td>
<td>
Declares the capitalization effects on the letters in the text.
</td>
<td>
<div class="article_code">
none<br />
capitalize<br />
uppercase<br />
lowercase
</div>
</td>
<td>
<div class="article_code">
div { text-transform:uppercase; }
<p>
div { text-transform:lowercase; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">unicode-bidi</td>
<td>
Declares values relating to bidirectional text. May be used in
conjunction with the the <em>direction</em> property.
</td>
<td>
<div class="article_code">
normal<br />
embed<br />
bidi-override
</div>
</td>
<td>
<div class="article_code">
div { unicode-bidi:embed; }
<p>
div { unicode-bidi:bidi-override; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">white-space</td>
<td>
Declares how white space is handled in an element.
</td>
<td>
<div class="article_code">
normal<br />
pre<br />
nowrap
</div>
</td>
<td>
<div class="article_code">
div { white-space:pre; }
<p>
div { white-space:nowrap; }
</p>
</div>
</td>
</tr>
<tr>
<td class="prop_name">word-spacing</td>
<td>
Declares the space between words in the text.
</td>
<td>
A length (in addition to the default space) or the predefined value of
<span class="article_code">normal</span>.
</td>
<td>
<div class="article_code">
div { word-spacing:normal; }
<p>
div { word-spacing:1.5em; }
</p>
</div>
</td>
</tr>
</table>
</html>
* Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g. fonts, colors, spacing) to Web documents.
* These tips are limited to CSS level1 Specifications as published in ''1996'' by ''~W3C'' at http://www.w3.org.
There are four ways to combine style and HTML:
# ''LINK'' element to link an external style sheet.
# ''STYLE'' element inside the 'HEAD' element.
# imported style sheet using the CSS ''@import'' notation.
# ''STYLE'' attribute on an element inside 'BODY'.
{{{
<HTML>
<HEAD>
<TITLE>title</TITLE>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="http://style.com/cool" TITLE="Cool">
<STYLE TYPE="text/css">
@import url(http://style.com/basic);
H1 { color: blue }
</STYLE>
</HEAD>
<BODY>
<H1>Headline is blue</H1>
<P STYLE="color: green">While the paragraph is green.
</BODY>
</HTML>
}}}
!Basics
* Set the text color of 'H1' elements to blue
{{{
H1 { color: blue }
}}}
* EM within 'H1' is red:
{{{
H1 EM { color: red }
}}}
* Comments follow C syntax, but cannot be nested !
{{{
EM { color: red } /* red, really red!! */
}}}
!Syntax tricks
* Grouped selectors:
{{{
H1, H2, H3 { font-family: helvetica }
}}}
* Grouped declarations:
{{{
H1 {
font-weight: bold;
font-size: 12pt;
line-height: 14pt;
font-family: helvetica;
font-variant: normal;
font-style: normal;
}
}}}
* Grouped contextual selectors:
{{{
H1 B, H2 B, H1 EM, H2 EM { color: red }
}}}
is equivalent to:
{{{
H1 B { color: red }
H2 B { color: red }
H1 EM { color: red }
H2 EM { color: red }
}}}
* If no color has been assigned to the 'EM' element, it will inherit the color of the parent element. Other style properties are likewise inherited, e.g. 'font-family' and 'font-size':
{{{
<H1>The headline <EM>is</EM> important!</H1>
}}}
*To set a "default" style property for a document, use the ''BODY'' element:
{{{
BODY {
color: black;
background: url(texture.gif) white;
}
}}}
* All elements inside the ''BODY'' element can be classed. The normal inheritance rules apply to classed elements; they inherit values from their parent in the document structure.
{{{
<HTML>
<HEAD>
<TITLE>Title</TITLE>
<STYLE TYPE="text/css">
H1.pastoral { color: #00FF00 }
</STYLE>
</HEAD>
<BODY>
<H1 CLASS=pastoral>Way too green</H1>
</BODY>
</HTML>
}}}
* All elements of the same class can be addressed by omitting the tag name in the selector:
{{{
.pastoral { color: green } /* all elements with CLASS pastoral */
}}}
* Only one class can be specified per selector.
{{{
P.pastoral.marine /* INVALID SYTAX */
}}}
* Terminology:
{{{
--------------- <-- top
top margin
---------------
top border
---------------
top padding
+-------------+ <-- inner top
| | | | | | | |
|--left--|--left--|--left--|-- content --|--right--|--right--|--right--|
| margin | border | padding| | padding | border | margin |
| | | | | | | |
+-------------+ <-- inner bottom
^ ^ ^ ^
left left inner edge right inner edge right
outer outer
edge bottom padding edge
---------------
bottom border
---------------
bottom margin
--------------- <-- bottom
}}}
* Block-in-a-block layout
{{{
<STYLE TYPE="text/css">
UL {
background: red;
margin: A B C D;
padding: E F G H;
}
LI {
color: white;
background: blue; /* so text is white on blue */
margin: a b c d;
padding: e f g h;
}
</STYLE>
..
<UL>
<LI>1st element of list
<LI>2nd element of list
</UL>
_______________________________________________________
| |
| A UL margin (transparent) |
| _______________________________________________ |
| D | | B |
| | E UL padding (red) | |
| | _______________________________________ | |
| | H | | F | |
| | | a LI margin (transparent, | | |
| | | so red shines through) | | |
| | | _______________________________ | | |
| | | d | | b | | |
| | | | e LI padding (blue) | | | |
| | | | | | | |
| | | | h 1st element of list f | | | |
| | | | | | | |
| | | | g | | | |
| | | |_______________________________| | | |
| | | | | |
| | | max(a, c) | | | <- note the max
| | | _______________________________ | | |
| | | | | | | |
| | | d | e LI padding (blue) | | | |
| | | | | | | |
| | | | h 2nd element of list f | | | |
| | | | | | | |
| | | | g | | | |
| | | |_______________________________| | | |
| | | | | |
| | | c LI margin (transparent, | | |
| | | so red shines through) | | |
| | |_______________________________________| | |
| | | |
| | G | |
| |_______________________________________________| |
| |
| C |
|_______________________________________________________|
}}}
* Transfer rates
|GSM 900/1800MHz | |4kB/s |
|NFC 424kb/s| x0.3 |53kB/s |
|Bluetooth 1Mb/s| x0.8 |125kB/s |
|Adsl 1Mb/s | x0.8 |125kB/s |
|CD rd | ''x1'' |150kB/s |
|Adsl 2Mb/s | x1.6 |250kB/s |
|Wifi 802.11b | x5 |750kB/s |
|Adsl 20Mb/s | x17 |2.5MB/s |
|flash drive rd-wr | x10 - x5 |1.5MB/s - 0.7MB/s |
|flash drive rd-wr (delux)| x200 - x160 |30MB/s - 24MB/s |
|usb2.0 480Mb/s| x320 |48MB/s ( 10 bits per byte ) |
|HDD 5400-7200rpm | x? |100MB/s |
|HDD 10000-15000rpm | x800 |125MB/s |
* B=byte,b=bit
config.options.chkRegExpSearch = true; // default false
config.options.chkCaseSensitiveSearch = false; // default false
config.options.chkAnimate = true; // default true
config.options.txtUserName = "DerivationBud"; // default "YourName"
config.options.chkSaveBackups = true; // default true
config.options.chkAutoSave = false; // default false
config.options.chkGenerateAnRssFeed = false; // default false
config.options.chkSaveEmptyTemplate = false; // default false
config.options.chkOpenInNewWindow = true; // default true
config.options.chkToggleLinks = false; // default false
config.options.chkHttpReadOnly = true; // default true
config.options.chkForceMinorUpdate = false; // default false
config.options.chkConfirmDelete = true; // default true
config.options.chkInsertTabs = false; // default false
config.options.txtBackupFolder = "tiddlyBackUps"; // default ""
config.options.txtMainTab = "tabTimeline"; // default "tabTimeline"
config.options.txtMoreTab = "moreTabAll"; // default "moreTabAll"
config.options.txtMaxEditRows = "30"; // default "30"
config.options.chkShowRightSidebar = false;
| !liquid | !kg/m^^3^^ |
|1,1,2-Trichlorotrifluoroethane [ 25 C ] | 1564.00 |
|1,2,4-Trichlorobenzene [ 20 C ] | 1454.00 |
|1,4-Dioxane [ 20 C ] | 1033.60 |
|2-Methoxyethanol [ 20 C ] | 964.60 |
|Acetic Acid [ 25 C ] | 1049.10 |
|Acetone [ 25 C ] | 784.58 |
|Acetonitrile [ 20 C ] | 782.20 |
|Alcohol, ethyl [ 25 C ] | 785.06 |
|Alcohol, methyl [ 25 C ] | 786.51 |
|Alcohol, propyl [ 25 C ] | 799.96 |
|Ammonia (aqua) [ 25 C ] | 823.35 |
|Automobile oils [ 15 C ] | 880-940 |
|Beer (varies) [ 10 C ] | 1010 |
|Benzene [ 25 C ] | 873.81 |
|Bromine [ 25 C ] | 3120.40 |
|Butane [ 25 C ] | 599.09 |
|Carbolic acid [ 15 C ] | 956.30 |
|Carbon disulfide [ 25 C ] | 1260.97 |
|Carbon tetrachloride [ 25 C ] | 1584.39 |
|Chlorobenzene [ 20 C ] | 1105.80 |
|Chloroform [ 25 C ] | 1464.73 |
|Citric acid [ 25 C ] | 1659.51 |
|Coconut oil [ 15 C ] | 924.27 |
|Cotton seed oil [ 15 C ] | 925.87 |
|Crude oil, 48° API [ 60 F ] | 790 |
|Crude oil, 40° API [ 60 F ] | 825 |
|Crude oil, 35.6° API [ 60 F ] | 847 |
|Crude oil, 32.6° API [ 60 F ] | 862 |
|Diesel fuel oil 20 to 60 [ 15 C ] | 820-950 |
|Diethyl ether [ 20 C ] | 714 |
|Ethane [ -89 C ] | 570.26 |
|Ether [ 25 C ] | 72.72 |
|Ethylamine [ 16 C ] | 680.78 |
|Ethyl Acetate [ 20 C ] | 900.60 |
|Ethyl Alcohol [ 20 C ] | 789.20 |
|Ethyl Ether [ 20 C ] | 713.30 |
|Ethylene Dichloride [ 20 C ] | 1253.00 |
|Ethylene glycol [ 25 C ] | 1096.78 |
|Fluorine refrigerant R-12 [ 25 C ] | 1310.95 |
|Formaldehyde [ 45 C ] | 812.14 |
|Formic acid 10% concentration [ 20 C ] | 1025 |
|Formic acid 80% concentration [ 20 C ] | 1221 |
|Freon - 11 [ 21 C ] | 1490 |
|Freon - 21 [ 21 C ] | 1370 |
|Fuel oil [ 60 F ] | 890.13 |
|Gasoline, natural [ 60 F ] | 711.22 |
|Gasoline, Vehicle [ 60 F ] | 737.22 |
|Gas oils [ 60 F ] | 890 |
|Glucose [ 60 F ] | 1350-1440 |
|Glycerin [ 25 C ] | 1259.37 |
|Glycerol [ 25 C ] | 1126.10 |
|Heptane [ 25 C ] | 679.50 |
|Hexane [ 25 C ] | 654.83 |
|Hexanol [ 25 C ] | 810.53 |
|Hexene [ 25 C ] | 671.17 |
|Hydrazine [ 25 C ] | 794.52 |
|Iodine [ 25 C ] | 4927.28 |
|Isobutyl Alcohol [ 20 C ] | 801.60 |
|Isopropyl Alcohol [ 20 C ] | 785.40 |
|Kerosene [ 60 F ] | 817.15 |
|Methane [ -164 C ] | 464.54 |
|Methanol [ 20 C ] | 791.30 |
|Methyl Isoamyl Ketone [ 20 C ] | 888.00 |
|Methyl Isobutyl Ketone [ 20 C ] | 800.80 |
|Milk [ 15 C ] | 1020-1050 |
|Naphtha [ 15 C ] | 664.77 |
|Naphtha, wood [ 25 C ] | 959.51 |
|Napthalene [ 25 C ] | 820.15 |
|Octane 15 C [ | 917.86 |
|Olive oil [ 20 C ] | 800-920 |
|Oxygen liquid [ -183 C ] | 1140 |
|Palmitic Acid [ 25 C ] | 850.58 |
|Pentane [ 25 C ] | 624.82 |
|Petroleum Ether [ 20 C ] | 640.00 |
|Petrol, natural [ 60 F ] | 711.22 |
|Phenol [ 25 C ] | 1072.28 |
|Propane, R-290 [ 25 C ] | 493.53 |
|Propanol [ 25 C ] | 804.13 |
|Propylene [ 25 C ] | 514.35 |
|Sea water [ 25 C ] | 1025.18 |
|Sodium Hydroxide (caustic soda) [ 15 C ] | 1250 |
|Sulphuric Acid 95% conc. [ 20 C ] | 1839 |
|Sugar solution 68 brix [ 15 C ] | 1338 |
|Sunflower oil [ 20 C ] | 920 |
|Styrene [ 25 C ] | 903.44 |
|Terpinene [ 25 C ] | 847.38 |
|Toluene [ 25 C ] | 862.27 |
|Trifluoroacetic Acid [ 20 C ] | 1489.00 |
|Turpentine [ 25 C ] | 868.20 |
|Water, pure [ 4 C ] | 1000.00 |
|Water, sea [ 77 F ] | 1021.98 |
|Whale oil [ 15 C ] | 925 |
| !Material | !kg/m^^3^^ |
|Aluminum, oxide | 1522 |
|Ammonia gas | 0.77 |
|Apples | 641 |
|Arsenic | 5671 |
|Ashes - wet | 730-890 |
|Ashes - dry | 570-650 |
|Asphalt, crushed | 721 |
|Bakelite, solid | 1362 |
|Basalt, solid | 3011 |
|Bauxite, crushed | 1281 |
|Beans, castor | 577 |
|Beans, cocoa | 593 |
|Beans, navy | 801 |
|Beans, soy | 721 |
|Bicarbonate of soda | 689 |
|Bones, pulverized | 881 |
|Brick, common red | 1922 |
|Brick, fire clay | 2403 |
|Brick, silica | 2050 |
|Brick, chrome | 2803 |
|Brick, magnesia | 2563 |
|Butter | 865 |
|Carbon, solid | 2146 |
|Carbon, powdered | 80 |
|Carbon dioxide | 1.98 |
|Carbon monoxide | 1.25 |
|Cement - clinker | 1290-1540 |
|Cement, Portland | 1506 |
|Cement, mortar | 2162 |
|Cement, slurry | 1442 |
|Chalk, solid | 2499 |
|Chalk, fine | 1121 |
|Charcoal | 208 |
|Chloroform | 1522 |
|Chocolate, powder | 641 |
|Clay, dry excavated | 1089 |
|Clay, wet excavated | 1826 |
|Clay, dry lump | 1073 |
|Clay, fire | 1362 |
|Clay, wet lump | 1602 |
|Clay, compacted | 1746 |
|Coconut, meal | 513 |
|Coconut, shredded | 352 |
|Coffee, fresh beans | 561 |
|Coffee, roast beans | 432 |
|Coke | 570-650 |
|Concrete, Asphalt | 2243 |
|Concrete, Gravel | 2403 |
|Copper ore |1940-2590 |
|Corn, on the cob | 721 |
|Cottonseed, dry, de-linted | 561 |
|Cottonseed, dry, not de-linted | 320 |
|Earth, loam, dry, excavated | 1249 |
|Earth, moist, excavated | 1442 |
|Earth, wet, excavated | 1602 |
|Earth, dense | 2002 |
|Earth, soft loose mud | 1730 |
|Earth, packed | 1522 |
|Earth, Fullers, raw | 673 |
|Ether | 737 |
|Fertilizer, acid phosphate | 961 |
|Fish, scrap | 721 |
|Fish, meal | 593 |
|Flint - silica | 1390 |
|Flour, wheat | 593 |
|Garbage, household rubbish | 481 |
|Glass - broken or cullet |1290-1940 |
|Glass, window | 2579 |
|Glue, animal, flaked | 561 |
|Glue, vegetable, powdered | 641 |
|Gluten, meal | 625 |
|Granite, solid | 2691 |
|Grain - Maize | 760 |
|Grain - Barley | 600 |
|Grain - Millet | 760-800 |
|Grain - Wheat | 780-800 |
|Gravel, loose, dry | 1522 |
|Gravel, with sand, natural | 1922 |
|Gravel, dry 1/4 to 2 inch | 1682 |
|Gravel, wet 1/4 to 2 inch | 2002 |
|Gummite ( uranium ore ) | 3890-6400 |
|Gypsum, solid | 2787 |
|Hydrochloric acid 40% | 1201 |
|Ice, solid | 919 |
|Ice, crushed | 593 |
|Iron ore - crushed - see metals table | 2100-2900 |
|Iron oxide pigment | 400 |
|Iron Pyrites | 2400 |
|Iron sulphate - pickling tank - dry | 1200 |
|Iron sulphate - pickling tank - wet | 1290 |
|Ivory | 1842 |
|Lead, rolled - see metals table | 11389 |
|Lead, red | 3684 |
|Lead, white pigment | 4085 |
|Leather | 945 |
|Lignite, dry | 801 |
|Limestone, solid | 2611 |
|Magnesite, solid | 3011 |
|Magnesium oxide | 1940 |
|Magnetite, solid ( iron ore ) | 5046 |
|Malachite ( copper ore ) | 3750-3960 |
|Malt | 336 |
|Marble, solid | 2563 |
|Marble, broken | 1570 |
|Mica, solid | 2883 |
|Milk, powdered | 449 |
|Mud, packed | 1906 |
|Mud, fluid | 1730 |
|Nickel ore | 1600 |
|Nickel, rolled | 8666 |
|Nickel silver | 8442 |
|Nitric acid, 91% | 1506 |
|Nitrogen | 1.26 |
|Oak, red | 705 |
|Oil, petroleum | 881 |
|Oxygen | 1.43 |
|Paper, standard | 1201 |
|Peanuts, shelled | 641 |
|Peanuts, not shelled | 272 |
|Pecan wood | 753 |
|Phosphorus | 2339 |
|Platinum ore | 2600 |
|Porcelain | 2403 |
|Potassium chloride | 2002 |
|Potatoes, white | 769 |
|Pyrite (fool's gold) | 2400-5015 |
|Quartz, solid | 2643 |
|Resin, synthetic, crushed | 561 |
|Rice, rough | 577 |
|Rock - soft - excavated with shovel | 1600-1780 |
|Rubber, caoutchouc | 945 |
|Rubber, manufactured | 1522 |
|Salt cake | 1442 |
|Salt, course | 801 |
|Salt, fine | 1201 |
|Saltpeter | 1201 |
|Sand, wet | 1922 |
|Sand, wet, packed | 2082 |
|Sand, dry | 1602 |
|Sand, loose | 1442 |
|Sand, water filled | 1922 |
|Sandstone, solid | 2323 |
|Sawdust | 210 |
|Snow, freshly fallen | 160 |
|Snow, compacted | 481 |
|Soap, solid | 801 |
|Soap, powdered | 368 |
|Soda Ash, heavy | 1080 |
|Soda Ash, light | 432 |
|Sodium | 977 |
|Sodium Aluminate, ground | 1153 |
|Sodium Nitrate, ground | 1201 |
|Soy beans, whole | 753 |
|Stone, crushed | 1602 |
|Stone (common, generic) | 2515 |
|Sugar, brown | 721 |
|Sugar, raw cane | 961 |
|Sugarcane | 272 |
|Sulphur, solid | 2002 |
|Taconite | 2803 |
|Talc, solid | 2691 |
|Talc, broken | 1746 |
|Tobacco | 320 |
|Walnut, black, dry | 609 |
|Water, pure ( see liquids table)| 1000 |
|Water, sea | 1026 |
|Wheat | 769 |
|Wheat, cracked | 673 |
|Wood chips (see wood table) | 240-520 |
|Wool | 1314 |
|Zinc oxide | 400 |
| !Metal | !kg/m^^3^^ |
|aluminium - melted | 2560-2640 |
|aluminium bronze (3-10% Al) | 7700-8700 |
|aluminium foil | 2700-2750 |
|antifriction metal | 9130-10600 |
|beryllium | 1840 |
|beryllium copper | 8100-8250 |
|brass - casting | 8400-8700 |
|brass - rolled and drawn | 8430-8730 |
|bronze - lead | 7700-8700 |
|bronze - phosphorous | 8780-8920 |
|bronze (8-14% Sn) | 7400-8900 |
|cast iron | 6800-7800 |
|cobolt | 8746 |
|copper | 8930 |
|delta metal | 8600 |
|electrum | 8400-8900 |
|gold | 19320 |
|iron | 7850 |
|lead | 11340 |
|light alloy based on Al | 2560-2800 |
|light alloy based on Mg | 1760-1870 |
|magnesium | 1738 |
|mercury | 13593 |
|molybdenum | 10188 |
|monel | 8360-8840 |
|nickel | 8800 |
|nickel silver | 8400-8900 |
|platinum | 21400 |
|plutonium | 19800 |
|silver | 10490 |
|steel - rolled | 7850 |
|steel - stainless | 7480-8000 |
|tin | 7280 |
|titanium | 4500 |
|tungsten | 19600 |
|uranium | 18900 |
|vanadium | 5494 |
|white metal | 7100 |
|zinc | 7135 |
| !Wood | !kg/m^^3^^ |
|Afromosia | 705 |
|Apple | 660-830 |
|Ash, black | 540 |
|Ash, white | 670 |
|Aspen | 420 |
|Balsa | 170 |
|Bamboo | 300-400 |
|Birch (British) | 670 |
|Cedar, red | 380 |
|Cypress | 510 |
|Douglas Fir | 530 |
|Ebony | 960-1120 |
|Elm ( English ) | 600 |
|Elm ( Wych ) | 690 |
|Elm ( Rock ) | 815 |
|Iroko | 655 |
|Larch | 590 |
|Lignum Vitae | 1280-1370 |
|Mahogany ( Honduras ) | 545 |
|Mahogany ( African ) | 495-850 |
|Maple | 755 |
|Oak | 590-930 |
|Pine ( Oregon ) | 530 |
|Pine ( Parana ) | 560 |
|Pine ( Canadian ) | 350-560 |
|Pine ( Red ) | 370-660 |
|Redwood ( American ) | 450 |
|Redwood ( European ) | 510 |
|Spruce ( Canadian ) | 450 |
|Spruce ( Sitka ) | 450 |
|Sycamore | 590 |
|Teak | 630-720 |
|Willow | 420 |
!2x2
{{{
| a b |
| c d |
= \ - /
= ad-bc
}}}
!3x3
* Sum of \ diagonals minus sum of / diagonals
{{{
| a00 a01 a02 |
| a10 a11 a12 |
| a20 a21 a22 |
= \ + \'+ .\ - / - /. - '/
= a00.a11.a22+a01.a12.a20+a02.a10.a21-a02.a11.a20-a01.a10.a22-a00.a12.a21
}}}
!nxn
* Pick any column and recurse ( alternate + and - )
{{{
det(M)=+a0j.det(S0j(M))
-a1j.det(S1j(M))
+a2j.det(S2j(M))
-a3j.det(S3j(M))
.... down to n-1
}}}
!Operations
* //Coeff//{{{ x }}}det(M) = det( M with a single column multiplied by //Coeff// )
* det(M) unchanged if Col~~j~~ <- Sum( coeff~~i~~{{{ x }}}Col~~i~~ )
!Culture
* ~DesignSync is an RCS wrapper that integrates with Cadence Design ~FrameWork II
* History:
** 1999: Synchronicity/Cadence agreement over Data Management development & support
** 2004: matrixOne acquires synchronicity for $18M
** 2006: ~DassaultSystem acquires matrixOne for $408M
!Basics:
* vault = repository :
**server-side central database that can be accessed via a dedicated client/server protocol: {{{sync://servername:2647/Modules/foo}}}
* root dir:
**client-side top-level folder which hold the meta-data for a single workarea.
* file :
** initial empty contents starts at //rev1.1//
** most up-to-date tagged //latest//
* module :
** arbitrary set of files and folders that are processed as a whole by ~DesignSync.
** a module is checked-out at a natural path relative to a base directory.
!Command shells:
! Introduction
* Work area is a folder containing a local copy of the data coming from the vault.
* The work area folder must be created and marked as root before any checking-out from the vault.
* A work area cannot contain another work area in its cone of hierarchy.
* ''Gotcha!''
**{{{stclc> setroot $HOME }}} will limit your account to a single work area once and for all.
! Creation
*Initialize the work area before the first populate:
** {{{stclc> cd path/to/workareas}}}
** {{{stclc> mkfolder WA1}}}
** {{{stclc> setroot WA1}}}
** This creates {{{path/to/workareas/WA1/.SYNC}}} , you are now ready for the populate command.
* Do not set a root into the cone of an already defined root
* Use {{{stclc> setroot -unset }}} to fix unwanted roots
!Introduction
* A module is a set of files and folders that can be processed as a whole. i.e. a single revision number or tag name can be given to the set.
* Modules can overlap, i.e. files from different modules can be placed in the same folder.
* A file can only be part of a single module.
!Creation
# Initialize a new module
** {{{stcl> mkmod sync://s:p/Modules/myModule -path ./WA1/myModuleBase}}}
** This creates base directory myModuleBase , and add info to .SYNC
** This command is a short-cut of 2 commands: mkmod + populate
# Module stuffing
** {{{stcl> add -recursive myModule%0 ./WA1/myModuleBase/* }}}
** %0 give the instance id of the module, optional if unique
# Publish module
** {{{stcl> ci myModule%0}}}
** This creates rev1.2 of module into the vault
** All files of the module are processed, no need for -rec
!Check-out:
*{{{stcl> mkfolfer ./WA2}}}
*{{{stcl> setroot ./WA2}}}
*{{{stcl> populate sync://s:p/Modules/myModule -dir ./WA2/myBase}}}
!Operations
* File tree shuffling:
** {{{stcl> mvmember -modulecontext myModule%0 file1 newdir/newfile1 }}}
** This changes the //natural path// of a file within the module, history of the old file is append to the history of the new file.
* Lock
** {{{stcl> pop -lock file1 }}} locks a member of the module
** {{{stcl> lock myModule%0 }}} locks the full module
!Reporting
* Lists the full history of all files within the module:
** {{{stcl> vhistory myModule%0 -report verbose}}}
* Lists all modules instantiated in the work area:
** {{{stcl> showmods ./wa }}}
* Reports vault-side changes since last check-out, doesn't flag local changes:
** {{{stcl> showstatus }}}
* Compares work area status versus latest vault, including local changes.
** {{{stcl> showstatus -object }}}
* Lists all member files of the module:
** {{{stcl> contents myModule%0 }}}
!Intro
*href : hierarchical reference
*A module can contain sub-modules ( href ) to be checked-out in specific pathes relative to the module base directory.
*A sub-module can contain recursively other hrefs
!Creation
#{{{stcl> pop ...}}} check-out the masterModule
#{{{stcl> pop ...}}} check-out a sub-module in the masterModule tree
#{{{stcl> addhref myMasterModule%0 mySubModule%0}}} server-side command
#{{{stcl> pop ... }}} update metadata
!Dynamic vs Static
* An href is a link stored with 2 infos:
** info dynamic: selector at creation time, example: Trunk:Latest
** info static: rev at creation time, example : 1.2
* Check-out exists in 3 flavours: {{{pop -hrefmode <dynamic|static|normal>}}}
** static: {{{populate}}} recursively check-out hrefs following the static infos.
** dynamic: {{{populate}}} recursively check-out hrefs following the dynamic infos.
** normal: {{{populate}}} starts from top in dynamic mode (even if tagged ) and switch to static mode for any cone referenced as a tagged href.
/***
|Name|EditTiddlerPlugin|
|Source|http://www.TiddlyTools.com/#EditTiddlerPlugin|
|Version|1.2.0|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|embed an 'edit' link in tiddler content to invoke edit on any specified tiddler title|
!!!!!Usage:
<<<
{{{<<editTiddler TiddlerName linktext>>}}}
If no tiddler title is specified (or the special keyword "here" is used), the tiddler containing the rendered macro is assumed. You can also specify optional alternative "link text" to be displayed. The default link text is "edit".
<<<
!!!!!Revision History:
<<<
2007.03.22 1.2.0 added support for 'here' keyword and optional 2nd param to specify label text
2007.03.15 1.1.1 fixed 'get tiddler ID' logic so it actually works! D'oh!
2007.03.11 1.1.0 changed 'get tiddler ID' logic so that macro can be used outside a tiddler (i.e., in mainMenu) by specifying the ID
2006.10.04 1.0.1 invoke findContainingTiddler() as fallback when 'tiddler' param is null
2006.04.28 1.0.0 Initial release
<<<
!!!Code:
***/
//{{{
config.macros.editTiddler={
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
var tid=params.shift(); // use specified tiddler ID (or "here")
if (!tid || tid=="here") {
if (tiddler)
tid=tiddler.title; // use current tiddler, fallback to find tiddler if none provided
else {
var here=story.findContainingTiddler(place);
if (!here) return; // not in a tiddler, do nothing
tid=here.getAttribute('tiddler'); // get ID from tiddler element
}
}
var label="edit"; if (params[0]) label=params.shift();
createTiddlyButton(place,label,'edit tiddler: '+tid,this.onclick).setAttribute('which',tid);
},
onclick: function(e) {
story.displayTiddler(null,this.getAttribute('which'),DEFAULT_EDIT_TEMPLATE);
}
}
//}}}
! Base64
* Base64 is used to encode binary in text
* Algo:
** bytes are grouped by 3
*** Example: "ABCDE" => "ABC","~DE0"
** each triplet is cast on 4 6-bit words:
*** Example: "ABC"=>65,66,67=>01000001,01000010,01000011=> 010000,010100,001001,000011 => 16,20,9,3
** each 6-bit words is given a printable character
|0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|
|"A"|"B"|"C"|"D"|"E"|"F"|"G"|"H"|"I"|"J"|"K"|"L"|"M"|"N"|"O"|"P"|
|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|
|"Q"|"R"|"S"|"T"|"U"|"V"|"W"|"X"|"Y"|"Z"|"a"|"b"|"c"|"d"|"e"|"f"|
|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|
|"g"|"h"|"i"|"j"|"k"|"l"|"m"|"n"|"o"|"p"|"q"|"r"|"s"|"t"|"u"|"v"|
|48|49|50|51|52|53|54|55|56|57|58|59|60|61|62|63|
|"w"|"x"|"y"|"z"|"0"|"1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9"|"+"|"/"|
*** Example: 16,20,9,3=>"QUJD"
** if last triplet is incomplete, it is padded with 0 to the next 6-bit word.
** if triplet padding fills 2x6bits, "==" is append
** if triplet padding fills 3x6bits, "=" is append
! ~UTF8
* ~UTF8 is a variable witdh character encoding that maps a unique code ( unicode ) to all exising characters from simple ASCII to complex Kanji
*Algo:
** If byte is < 128
*** This is a single-byte encoded character that matches legacy ASCII table
** If byte is > 127
*** Number of leading 1s give the number of bytes encoding the character.
*** Following contributing bytes are in the form 10bbbbbb, concatenation of the 6-bits packets is the unicode
! ASCII
| ''Dec'' | ''Oct'' | ''Hex'' | ''Char'' | ''Note'' |
| 000 | 000 | 00 | NUL |Null character|
| 001 | 001 | 01 | SOH |Start of Header|
| 002 | 002 | 02 | STX |Start of Text|
| 003 | 003 | 03 | ETX |End of Text|
| 004 | 004 | 04 | EOT |End of Transmission|
| 005 | 005 | 05 | ENQ |Enquiry|
| 006 | 006 | 06 | ACK |Acknowledgment|
| 007 | 007 | 07 | BEL |Bell|
| 008 | 010 | 08 | BS |Backspace|
| 009 | 011 | 09 | HT |Horizontal Tab|
| 010 | 012 | 0A | LF |Line Feed|
| 011 | 013 | 0B | VT |Vertical Tab|
| 012 | 014 | 0C | FF |Form Feed|
| 013 | 015 | 0D | CR |Carriage Return|
| 014 | 016 | 0E | SO |Shift Out|
| 015 | 017 | 0F | SI |Shift In|
| 016 | 020 | 10 | DLE |Data Link Escape|
| 017 | 021 | 11 | """DC1""" |XON - Device Control 1|
| 018 | 022 | 12 | """DC2""" |Device Control 2|
| 019 | 023 | 13 | """DC3""" |XOFF - Device Control 3|
| 020 | 024 | 14 | """DC4""" |Device Control 4|
| 021 | 025 | 15 | NAK |Negative Acknowledgement|
| 022 | 026 | 16 | SYN |Synchronous Idle|
| 023 | 027 | 17 | ETB |End of Trans. Block|
| 024 | 030 | 18 | CAN |Cancel|
| 025 | 031 | 19 | EM |End of Medium|
| 026 | 032 | 1A | SUB |Substitute|
| 027 | 033 | 1B | ESC |Escape|
| 028 | 034 | 1C | FS |File Separator|
| 029 | 035 | 1D | GS |Group Separator|
| 030 | 036 | 1E | RS |Request to Send - Record Separator|
| 031 | 037 | 1F | US |Unit Separator|
| 032 | 040 | 20 | SP |Space|
| 033 | 041 | 21 | """!""" |exclamation mark|
| 034 | 042 | 22 | " |double quote|
| 035 | 043 | 23 | # |number sign|
| 036 | 044 | 24 | $ |dollar sign|
| 037 | 045 | 25 | % |percent|
| 038 | 046 | 26 | & |ampersand|
| 039 | 047 | 27 | ' |single quote|
| 040 | 050 | 28 | ( |left opening parenthesis|
| 041 | 051 | 29 | ) |right closing parenthesis|
| 042 | 052 | 2A | * |asterisk|
| 043 | 053 | 2B | + |plus|
| 044 | 054 | 2C | , |comma|
| 045 | 055 | 2D | - |minus or dash|
| 046 | 056 | 2E | . |dot|
| 047 | 057 | 2F | / |forward slash|
| 048 | 060 | 30 | 0 | |
| 049 | 061 | 31 | 1 | |
| 050 | 062 | 32 | 2 | |
| 051 | 063 | 33 | 3 | |
| 052 | 064 | 34 | 4 | |
| 053 | 065 | 35 | 5 | |
| 054 | 066 | 36 | 6 | |
| 055 | 067 | 37 | 7 | |
| 056 | 070 | 38 | 8 | |
| 057 | 071 | 39 | 9 | |
| 058 | 072 | 3A | : |colon|
| 059 | 073 | 3B | ; |semi-colon|
| 060 | 074 | 3C | < |less than sign|
| 061 | 075 | 3D | = |equal sign|
| 062 | 076 | 3E | > |greater than sign|
| 063 | 077 | 3F | ? |question mark|
| 064 | 100 | 40 | @ |AT symbol|
| 065 | 101 | 41 | A | |
| 066 | 102 | 42 | B | |
| 067 | 103 | 43 | C | |
| 068 | 104 | 44 | D | |
| 069 | 105 | 45 | E | |
| 070 | 106 | 46 | F | |
| 071 | 107 | 47 | G | |
| 072 | 110 | 48 | H | |
| 073 | 111 | 49 | I | |
| 074 | 112 | 4A | J | |
| 075 | 113 | 4B | K | |
| 076 | 114 | 4C | L | |
| 077 | 115 | 4D | M | |
| 078 | 116 | 4E | N | |
| 079 | 117 | 4F | O | |
| 080 | 120 | 50 | P | |
| 081 | 121 | 51 | Q | |
| 082 | 122 | 52 | R | |
| 083 | 123 | 53 | S | |
| 084 | 124 | 54 | T | |
| 085 | 125 | 55 | U | |
| 086 | 126 | 56 | V | |
| 087 | 127 | 57 | W | |
| 088 | 130 | 58 | X | |
| 089 | 131 | 59 | Y | |
| 090 | 132 | 5A | Z | |
| 091 | 133 | 5B | [ |left opening bracket|
| 092 | 134 | 5C | \ |back slash|
| 093 | 135 | 5D | ] |right closing bracket|
| 094 | 136 | 5E | ^ |caret cirumflex|
| 095 | 137 | 5F | _ |underscore|
| 096 | 140 | 60 | ` | |
| 097 | 141 | 61 | a | |
| 098 | 142 | 62 | b | |
| 099 | 143 | 63 | c | |
| 100 | 144 | 64 | d | |
| 101 | 145 | 65 | e | |
| 102 | 146 | 66 | f | |
| 103 | 147 | 67 | g | |
| 104 | 150 | 68 | h | |
| 105 | 151 | 69 | i | |
| 106 | 152 | 6A | j | |
| 107 | 153 | 6B | k | |
| 108 | 154 | 6C | l | |
| 109 | 155 | 6D | m | |
| 110 | 156 | 6E | n | |
| 111 | 157 | 6F | o | |
| 112 | 160 | 70 | p | |
| 113 | 161 | 71 | q | |
| 114 | 162 | 72 | r | |
| 115 | 163 | 73 | s | |
| 116 | 164 | 74 | t | |
| 117 | 165 | 75 | u | |
| 118 | 166 | 76 | v | |
| 119 | 167 | 77 | w | |
| 120 | 170 | 78 | x | |
| 121 | 171 | 79 | y | |
| 122 | 172 | 7A | z | |
| 123 | 173 | 7B | { |left opening brace|
| 124 | 174 | 7C | """|""" |vertical bar|
| 125 | 175 | 7D | } |right closing brace|
| 126 | 176 | 7E | ~ |tilde|
| 127 | 177 | 7F | DEL |delete|
AES
{{{openssl aes-256-cbc -in message.txt -out message.enc}}}
{{{openssl aes-256-cbc -in message.enc -out message.txt -d}}}
!!Euclidian algorithm ( Find gcd )
{{{
#!/bin/env python
def gcd(a, b):
if b==0: return a
else : return gcd(b, a % b)
a,b=7285,10011
print "gcd(%d,%d)=%d"% ( a,b,gcd(a,b) )
}}}
//gcd(7285,10011)=47//
!!Extended Euclidian Algorithm ( Find modular inverse )
* ''Integers''
{{{
#!/bin/env python
p=147 # prime defining the field
a=55 # number to be inverted
r = [ p , a ] # remainders
t = [ 0 , 1 ] # temporary
i = 1
while r[i] > 1:
i += 1
r.append( r[i-2] % r[i-1] )
t.append( -( r[i-2] / r[i-1] ) * t[i-1] + t[i-2] )
print a,"*",t[i],"%",p,"=", a * t[i] % p
}}}
//55 * -8 % 147 = 1//
* ''Polynomials over GF(2^^8^^)''
> p = X^^8^^+X^^4^^+X^^3^^+X+1 = 100011011
> a = X^^6^^+X^^4^^+X+1 = 1010011
| i | r[i] | t[i] |
| 0 |100011011 |0 |
| 1 |1010011 |1 |
| 2 |100 |101 |
| 3 |11 |1000101 |
| 4 |1 |11001010 |
> 1/a = X^^7^^+X^^6^^+X^^3^^+X
* Fast algorithm for {{{x}}}^^p^^ ?
* Square-multiply
** {{{x}}}^^26^^ = {{{x}}}^^2+8+16^^ = {{{x}}}^^2^^.{{{x}}}^^8^^ .{{{x}}}^^16^^ = {{{x}}}^^2^^.((({{{x}}}^^2^^)^^2^^)^^2^^).(((({{{x}}}^^2^^)^^2^^)^^2^^)^^2^^)
** Compute all squares 2^^i^^: {{{x}}}^^1^^,{{{x}}}^^2^^,{{{x}}}^^4^^,{{{x}}}^^8^^...
** And multiply the ones corresponding to the power's binary break-down
* Python:
{{{
def expo(x,p):
m = 1
b = x
while p:
if p%2: m *= b
p >> 1
b *= b
return(m)
}}}
/***
|Name:|ExtentTagButtonPlugin|
|Description:|Adds a New tiddler button in the tag drop down|
|Version:|3.2 ($Rev: 3861 $)|
|Date:|$Date: 2008-03-08 10:53:09 +1000 (Sat, 08 Mar 2008) $|
|Source:|http://mptw.tiddlyspot.com/#ExtendTagButtonPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License|http://mptw.tiddlyspot.com/#TheBSDLicense|
***/
//{{{
window.onClickTag_mptw_orig = window.onClickTag;
window.onClickTag = function(e) {
window.onClickTag_mptw_orig.apply(this,arguments);
var tag = this.getAttribute("tag");
var title = this.getAttribute("tiddler");
// Thanks Saq, you're a genius :)
var popup = Popup.stack[Popup.stack.length-1].popup;
createTiddlyElement(createTiddlyElement(popup,"li",null,"listBreak"),"div");
wikify("<<newTiddler label:'New tiddler' tag:'"+tag+"'>>",createTiddlyElement(popup,"li"));
return false;
}
//}}}
{{{
# Global states
state = {}
# Input data flow, ends the simulation when finish
def stimuli():
yield 1
yield 12
yield 34
yield 45
yield 57
# Registered output behavior
def stage(f,*args):
while True:
vals = [state[arg] for arg in args]
yield f(*vals)
# Wired Network
machine = [
# OUTS -- size -- rst -- FUNCTION -------- INPUTS
["STIM", 1<<8, 0 , stimuli() ],
["DAT1", 1<<16, 1 , stage(lambda x : x+1 ,"STIM" )],
["DAT2", 1<<16, 34, stage(lambda x,y: x*20+y ,"DAT1","RES" )],
["RES" , 1<<16, 0 , stage(lambda x : x-1 ,"DAT2" )],
]
# Intialize
state={ reg : rst%size for reg,size,rst,gen in machine }
print state
# Step by step
while True:
try:
nextState={ reg : gen.next()%size for reg,size,rst,gen in machine }
state = nextState
print state
except StopIteration:
print "Done"
break
}}}
>{'RES': 0, 'STIM': 0, 'DAT1': 1, 'DAT2': 34}
>{'RES': 33, 'STIM': 1, 'DAT1': 1, 'DAT2': 20}
>{'RES': 19, 'STIM': 12, 'DAT1': 2, 'DAT2': 53}
>{RES': 52, 'STIM': 34, 'DAT1': 13, 'DAT2': 59}
>{'RES': 58, 'STIM': 45, 'DAT1': 35, 'DAT2': 312}
>{'RES': 311, 'STIM': 57, 'DAT1': 46, 'DAT2': 758}
>Done
!!Fermat's little theorem
*Theorem:
>If //p// is a prime and //a// is an integer coprime to //p//, then:
> ''a^^p-1^^ = 1 mod ( p )''
* Application to primality test
> If we want to test if //p// is prime, then we can pick random //a// < //p// and see if the equality holds. If the equality does not hold for a value of //a//, then //p// is composite. If the equality does hold for many values of //a//, then we can say that //p// is probably prime, or a pseudoprime.
* Application to scrambling
> data' = data x key mod (p)
> data = data' x key^^p-2^^ mod ( p )
* Example
> 5*x mod (7) is bijective over ''Z''(7): //{ 0,1,2,3,4,5,6 } → 5*x mod (7) → { 0,5,3,1,6,4,2 }//
> modular inverse of 5 in ''Z''(7): //5^^7-2^^ mod(7) = 3//
> reciproc of 5*x mod(7) : //{0,5,3,1,6,4,2 } → 3*x mod (7) → {0,1,2,3,4,5,6 }//
!!Fermat's last theorem
* Theorem:
>If an integer //n// is greater than 2, then the equation //a//^^n^^ + //b//^^n^^ = //c//^^n^^ has no solutions in non-zero integers //a//, //b//, and //c//.
* For n=2, there are infinitely many integer solutions called Pythagorean triples
* Stated by Pierre de Fermat in 1637, proved by Andrew Wiles in 1995.
Assaisonnement:
Sel,Poivre,cannelle, vin doux
La température ne doit pas dépasser 110C!
Pour une cuisson mi-cuit de 1 kg :
Bain-marie de 20 mn au four à 100C + 20 mn dans le four éteint.
200g de chocolat
100g de beurre
100g de sucre
2 œufs
1/2 sachet de levure chimique
Faire fondre le chocolat et le beurre au micro-onde et homogénéiser
Mélanger les autres ingrédients et les incorporer
Cuisson dans des moules individuels remplis aux 2/3, a 180deg pendant 10 mn
200g de chocolat
30cl de lait
30cl de creme faiche
4 jaunes
1 grosse cuillere a soupe de maizena
un peu de sucre
un peu de sel
Faire fondre dans une casserole : lait+crème+chocolat
Mélanger les autres ingrédients , puis les incorporer , laisser épaissir
50cl lait entier
20cl crème fraîche
5 jaunes d’œuf
50g de sucre glace
2 gousses de vanille
Faire infuser la vanille dans le lait jusqu’à ébullition.
Incorporer le mélange sucre-œuf à chaud, puis la crème à froid.
Turbiner.
/***
|Name:|HideWhenPlugin|
|Description:|Allows conditional inclusion/exclusion in templates|
|Version:|3.1 ($Rev: 3919 $)|
|Date:|$Date: 2008-03-13 02:03:12 +1000 (Thu, 13 Mar 2008) $|
|Source:|http://mptw.tiddlyspot.com/#HideWhenPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
For use in ViewTemplate and EditTemplate. Example usage:
{{{<div macro="showWhenTagged Task">[[TaskToolbar]]</div>}}}
{{{<div macro="showWhen tiddler.modifier == 'BartSimpson'"><img src="bart.gif"/></div>}}}
***/
//{{{
window.hideWhenLastTest = false;
window.removeElementWhen = function(test,place) {
window.hideWhenLastTest = test;
if (test) {
removeChildren(place);
place.parentNode.removeChild(place);
}
};
merge(config.macros,{
hideWhen: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( eval(paramString), place);
}},
showWhen: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( !eval(paramString), place);
}},
hideWhenTagged: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( tiddler.tags.containsAll(params), place);
}},
showWhenTagged: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( !tiddler.tags.containsAll(params), place);
}},
hideWhenTaggedAny: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( tiddler.tags.containsAny(params), place);
}},
showWhenTaggedAny: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( !tiddler.tags.containsAny(params), place);
}},
hideWhenTaggedAll: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( tiddler.tags.containsAll(params), place);
}},
showWhenTaggedAll: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( !tiddler.tags.containsAll(params), place);
}},
hideWhenExists: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( store.tiddlerExists(params[0]) || store.isShadowTiddler(params[0]), place);
}},
showWhenExists: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( !(store.tiddlerExists(params[0]) || store.isShadowTiddler(params[0])), place);
}},
hideWhenTitleIs: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( tiddler.title == params[0], place);
}},
showWhenTitleIs: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( tiddler.title != params[0], place);
}},
'else': { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( !window.hideWhenLastTest, place);
}}
});
//}}}
| 195? |regexp ||
| 195? |fortran ||
| 195? |algol60 ||
| 1958 |fortranII ||
| 1958 |lisp ||
| 1964 |basic |← fortranII,algol60 |
| 1967 |logo |← lisp |
| 1970 |pascal |← algol60 |
| 1970 |awk ||
| 1972 |C ||
| 1973 |sed ||
| 1977 |sh ||
| 1978 |csh |← sh |
| 1979 |~M-DOS | |
| 197? |tcsh |← csh |
| 197? |scheme |← lisp |
| 1980 |ksh |← csh |
| 1980 |smalltalk |← lisp,logo,sketchpad,simula |
| 1983 |ada ||
| 1986 |delphi |← Pascal |
| 1987 |bash |← ksh,tcsh |
| 1987 |perl |← lisp,awk,sed,sh |
| 1988 |tcl | |
| 1990 |tcl-tk |← tcl |
| 1990 |skill |← lisp |
| 1990 |haskell ||
| 1989 |C++ ansi |← C |
| 1991 |python |← ABC ←basic,pascal,awk |
| 1993 |ruby |← perl , smalltalk |
| 1993 |html ||
| 1995 |html 2.0 ||
| 1995 |java |←C++ |
| 1995 |javascript |← java |
| 1995 |php |← perl |
| 1995 |erlang ||
| 1997 |html 3.2 ||
| 1999 |C++ iso ||
| 1999 |html 4.0 ||
| 2000 |C# |← C++ |
| 2000 |iso html, xhtml||
| 2001 |processing ||
| 2003 |wiring |← Processing |
| 2008 |html5 ||
| 2009 |coffeescript ||
{{{
<head>
<link rel="SHORTCUT ICON" href="favicon.ico">
</head>
}}}
| !Tag | !Comment |
| {{{<html></html>}}} |Start/end of an html document |
| {{{<head></head>}}} |Invisible portion of the document |
| {{{<boby></body>}}} |Visible portion of the document |
| !Tag | !Comment |
|{{{<body bgcolor=?>}}} |color of back-ground |
|{{{<body text=?>}}} |color of text |
|{{{<body link=?>}}} |color of links |
|{{{<body vlink=?>}}} |color of visited links |
|{{{<body alink=?>}}} |color of active links ( when they are pointed ) |
* example:
{{{
<body bgcolor="#FFFFFF" text="000000" link="#0000CC">
}}}
| !Tag | !Comment |
|{{{<h1></h1> ... <h6></h6>}}}|Headings |
|{{{<b></b>}}} |Bold |
|{{{<i></i>}}} |Italic |
|{{{<tt></tt>}}} |Typewriter or Teletype-like text |
|{{{<em></em>}}} |Emphasis |
|{{{<strong></strong>}}} |Emphasis rendered as bold |
|{{{<font size="3"></font>}}} |Font size : Largest=7, Smallest=1 |
|{{{<font color="#RRGGBB"></font>}}} |Font color |
| !Tag | !Comment |
|{{{<p></p>}}} |Paragraph |
|{{{<br/>}}} |Line break ( html: {{{<br>}}} , xhtml: {{{<br/>}}} ) |
|{{{<blockquote></blockquote>}}} |Indented both sides |
|{{{<ol></ol>}}}|Ordered list |
|{{{<ul></ul>}}}|Unordered list |
|{{{<li></li>}}}|List |
| !Tag | !Comment |
|{{{<table></table>}}} |Table, contains rows |
|{{{<tr></tr>}}} |Table Row, contains cells or header cells |
|{{{<td></td>}}} |Table Cell |
|{{{<th></th>}}} |Table Header Cell |
|{{{<table border=#>}}} |Size of the border line |
|{{{<table cellspacing=#>}}} |Space between the cells |
|{{{<table cellpading=#}}} |Space between the border and the contents of the cell |
|{{{<table width="?">}}} |Width of the table in pixels or in % |
|{{{<tr align=?>}}} |Alignment of contents in a row: left, right or center |
|{{{<td align=?>}}} |Alignment of contents in a cell: left, right or center |
|{{{<tr valign=?>}}} |Verticall alignment of contents in a row: top, bottom or middle |
|{{{<td valign=?>}}} |Verticall alignment of contents in a cell: top, bottom or middle |
|{{{<td colspan=#>}}} |Number of columns merged in the cell |
|{{{<td rowspan=#>}}} |Number of rows merged in the cell |
|{{{<td nowrap>}}} |Stops automatic text line wrapping |
* Example source:
{{{
<html>
<table>
<tr> <th> Y </th> <th> O </th> <th> P </th> </tr>
<tr> <td> A </td> <td> B </td> <td> C </td> </tr>
<tr> <td> D </td> <td colspan=2> E </td> </tr>
</table>
</html>
}}}
* Example display
<html>
<table>
<tr> <th> Y </th> <th> O </th> <th> P </th> </tr>
<tr> <td> A </td> <td> B </td> <td> C </td> </tr>
<tr> <td> D </td> <td colspan=2> E </td> </tr>
</table>
</html>
| !Tag | !Comment |
|{{{<hr/>}}} |Horizontal rule ( html:{{{<hr>}}}, xhtml:{{{<hr/>}}} ) |
|{{{<hr size=? />}}} |Height of rule |
|{{{<hr width=? />}}} |Horizontal width of rule |
|{{{<img src="name" />}}} |Place an image ( html:{{{<img>}}}, xhtml:{{{<img/>}}} ) |
|{{{<img src="name" border=? />}}} |Specify the border arround the image |
|{{{<img src="name" alt="name />}}} |Specify a text to display for non-graphical browsers |
<html>
<p><em>Legend: <b>D</b>eprecated, <b>L</b>oose DTD, <b>F</b>rameset DTD</em></p>
<table summary="Attribute index. Columns are: name, related elements, type of
value, default value, deprecated, which DTD, and comment" align="center" border="1">
<tbody>
<tr align="center">
<th>Name</th>
<th>Related Elements</th>
<th>Type</th>
<th>Default</th>
<th>Depr.</th>
<th>DTD</th>
<th>Comment</th>
</tr>
<tr>
<td title="Name">abbr</td>
<td title="Related Elements" align="center"><span class="noxref">TD</span>, <span class="noxref">TH</span></td>
<td title="Type" align="center">%Text;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">abbreviation for header cell</td>
</tr>
<tr>
<td title="Name">
accept-charset</td>
<td title="Related Elements" align="center"><span class="noxref">FORM</span></td>
<td title="Type" align="center">
%Charsets;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">list of supported charsets</td>
</tr>
<tr>
<td title="Name">accept</td>
<td title="Related Elements" align="center"><span class="noxref">FORM</span>, <span class="noxref">INPUT</span></td>
<td title="Type" align="center">
%ContentTypes;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">list of MIME types for file upload</td>
</tr>
<tr>
<td title="Name">
accesskey</td>
<td title="Related Elements" align="center"><span class="noxref">A</span>, <span class="noxref">AREA</span>, <span class="noxref">BUTTON</span>, <span class="noxref">INPUT</span>, <span class="noxref">LABEL</span>, <span class="noxref">LEGEND</span>, <span class="noxref">TEXTAREA</span></td>
<td title="Type" align="center">
%Character;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">accessibility key character</td>
</tr>
<tr>
<td title="Name">action</td>
<td title="Related Elements" align="center"><span class="noxref">FORM</span></td>
<td title="Type" align="center">%URI;</td>
<td title="Default" align="center">#REQUIRED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">server-side form handler</td>
</tr>
<tr>
<td title="Name">
align</td>
<td title="Related Elements" align="center"><span class="noxref">CAPTION</span></td>
<td title="Type" align="center">
%CAlign;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">relative to table</td>
</tr>
<tr>
<td title="Name">align</td>
<td title="Related Elements" align="center"><span class="noxref">APPLET</span>, <span class="noxref">IFRAME</span>, <span class="noxref">IMG</span>, <span class="noxref">INPUT</span>, <span class="noxref">OBJECT</span></td>
<td title="Type" align="center">
%IAlign;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">vertical or horizontal alignment</td>
</tr>
<tr>
<td title="Name">
align</td>
<td title="Related Elements" align="center"><span class="noxref">LEGEND</span></td>
<td title="Type" align="center">
%LAlign;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">relative to fieldset</td>
</tr>
<tr>
<td title="Name">
align</td>
<td title="Related Elements" align="center"><span class="noxref">TABLE</span></td>
<td title="Type" align="center">
%TAlign;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">table position relative to window</td>
</tr>
<tr>
<td title="Name">
align</td>
<td title="Related Elements" align="center"><span class="noxref">HR</span></td>
<td title="Type" align="center">(left | center | right)</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center"> </td>
</tr>
<tr>
<td title="Name">align</td>
<td title="Related Elements" align="center"><span class="noxref">DIV</span>, <span class="noxref">H1</span>, <span class="noxref">H2</span>, <span class="noxref">H3</span>, <span class="noxref">H4</span>, <span class="noxref">H5</span>, <span class="noxref">H6</span>, <span class="noxref">P</span></td>
<td title="Type" align="center">(left | center | right | justify)</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">align, text alignment</td>
</tr>
<tr>
<td title="Name">align</td>
<td title="Related Elements" align="center"><span class="noxref">COL</span>, <span class="noxref">COLGROUP</span>, <span class="noxref">TBODY</span>, <span class="noxref">TD</span>, <span class="noxref">TFOOT</span>, <span class="noxref">TH</span>, <span class="noxref">THEAD</span>, <span class="noxref">TR</span></td>
<td title="Type" align="center">(left | center | right | justify | char)</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center"> </td>
</tr>
<tr>
<td title="Name">alink</td>
<td title="Related Elements" align="center"><span class="noxref">BODY</span></td>
<td title="Type" align="center">
%Color;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">color of selected links</td>
</tr>
<tr>
<td title="Name">alt</td>
<td title="Related Elements" align="center"><span class="noxref">APPLET</span></td>
<td title="Type" align="center">
%Text;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">short description</td>
</tr>
<tr>
<td title="Name">alt</td>
<td title="Related Elements" align="center"><span class="noxref">AREA</span>, <span class="noxref">IMG</span></td>
<td title="Type" align="center">%Text;</td>
<td title="Default" align="center">#REQUIRED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">short description</td>
</tr>
<tr>
<td title="Name">alt</td>
<td title="Related Elements" align="center"><span class="noxref">INPUT</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">short description</td>
</tr>
<tr>
<td title="Name">
archive</td>
<td title="Related Elements" align="center"><span class="noxref">APPLET</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">comma-separated archive list</td>
</tr>
<tr>
<td title="Name">
archive</td>
<td title="Related Elements" align="center"><span class="noxref">OBJECT</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">space-separated list of URIs</td>
</tr>
<tr>
<td title="Name">axis</td>
<td title="Related Elements" align="center"><span class="noxref">TD</span>, <span class="noxref">TH</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">comma-separated list of related headers</td>
</tr>
<tr>
<td title="Name">
background</td>
<td title="Related Elements" align="center"><span class="noxref">BODY</span></td>
<td title="Type" align="center">
%URI;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">texture tile for document background</td>
</tr>
<tr>
<td title="Name">
bgcolor</td>
<td title="Related Elements" align="center"><span class="noxref">TABLE</span></td>
<td title="Type" align="center">
%Color;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">background color for cells</td>
</tr>
<tr>
<td title="Name">
bgcolor</td>
<td title="Related Elements" align="center"><span class="noxref">TR</span></td>
<td title="Type" align="center">
%Color;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">background color for row</td>
</tr>
<tr>
<td title="Name">
bgcolor</td>
<td title="Related Elements" align="center"><span class="noxref">TD</span>, <span class="noxref">TH</span></td>
<td title="Type" align="center">
%Color;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">cell background color</td>
</tr>
<tr>
<td title="Name">
bgcolor</td>
<td title="Related Elements" align="center"><span class="noxref">BODY</span></td>
<td title="Type" align="center">
%Color;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">document background color</td>
</tr>
<tr>
<td title="Name">
border</td>
<td title="Related Elements" align="center"><span class="noxref">TABLE</span></td>
<td title="Type" align="center">
%Pixels;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">controls frame width around table</td>
</tr>
<tr>
<td title="Name">
border</td>
<td title="Related Elements" align="center"><span class="noxref">IMG</span>, <span class="noxref">OBJECT</span></td>
<td title="Type" align="center">
%Pixels;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">link border width</td>
</tr>
<tr>
<td title="Name">
cellpadding</td>
<td title="Related Elements" align="center"><span class="noxref">TABLE</span></td>
<td title="Type" align="center">
%Length;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">spacing within cells</td>
</tr>
<tr>
<td title="Name">
cellspacing</td>
<td title="Related Elements" align="center"><span class="noxref">TABLE</span></td>
<td title="Type" align="center">
%Length;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">spacing between cells</td>
</tr>
<tr>
<td title="Name">char</td>
<td title="Related Elements" align="center"><span class="noxref">COL</span>, <span class="noxref">COLGROUP</span>, <span class="noxref">TBODY</span>, <span class="noxref">TD</span>, <span class="noxref">TFOOT</span>, <span class="noxref">TH</span>, <span class="noxref">THEAD</span>, <span class="noxref">TR</span></td>
<td title="Type" align="center">
%Character;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">alignment char, e.g. char=':'</td>
</tr>
<tr>
<td title="Name">charoff</td>
<td title="Related Elements" align="center"><span class="noxref">COL</span>, <span class="noxref">COLGROUP</span>, <span class="noxref">TBODY</span>, <span class="noxref">TD</span>, <span class="noxref">TFOOT</span>, <span class="noxref">TH</span>, <span class="noxref">THEAD</span>, <span class="noxref">TR</span></td>
<td title="Type" align="center">
%Length;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">offset for alignment char</td>
</tr>
<tr>
<td title="Name">charset</td>
<td title="Related Elements" align="center"><span class="noxref">A</span>, <span class="noxref">LINK</span>, <span class="noxref">SCRIPT</span></td>
<td title="Type" align="center">
%Charset;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">char encoding of linked resource</td>
</tr>
<tr>
<td title="Name">checked</td>
<td title="Related Elements" align="center"><span class="noxref">INPUT</span></td>
<td title="Type" align="center">(checked)</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">for radio buttons and check boxes</td>
</tr>
<tr>
<td title="Name">cite</td>
<td title="Related Elements" align="center"><span class="noxref">BLOCKQUOTE</span>, <span class="noxref">Q</span></td>
<td title="Type" align="center">%URI;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">URI for source document or msg</td>
</tr>
<tr>
<td title="Name">cite</td>
<td title="Related Elements" align="center"><span class="noxref">DEL</span>, <span class="noxref">INS</span></td>
<td title="Type" align="center">%URI;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">info on reason for change</td>
</tr>
<tr>
<td title="Name">class</td>
<td title="Related Elements" align="center"><span class="noxref">All elements</span> but <span class="noxref">BASE</span>, <span class="noxref">BASEFONT</span>, <span class="noxref">HEAD</span>, <span class="noxref">
HTML</span>, <span class="noxref">META</span>, <span class="noxref">PARAM</span>, <span class="noxref">SCRIPT</span>, <span class="noxref">STYLE</span>, <span class="noxref">TITLE</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">space-separated list of classes</td>
</tr>
<tr>
<td title="Name">classid</td>
<td title="Related Elements" align="center"><span class="noxref">OBJECT</span></td>
<td title="Type" align="center">%URI;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">identifies an implementation</td>
</tr>
<tr>
<td title="Name">clear</td>
<td title="Related Elements" align="center"><span class="noxref">BR</span></td>
<td title="Type" align="center">(left | all | right | none)</td>
<td title="Default" align="center">none</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">control of text flow</td>
</tr>
<tr>
<td title="Name">code</td>
<td title="Related Elements" align="center"><span class="noxref">APPLET</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">applet class file</td>
</tr>
<tr>
<td title="Name">
codebase</td>
<td title="Related Elements" align="center"><span class="noxref">OBJECT</span></td>
<td title="Type" align="center">%URI;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">base URI for classid, data, archive</td>
</tr>
<tr>
<td title="Name">
codebase</td>
<td title="Related Elements" align="center"><span class="noxref">APPLET</span></td>
<td title="Type" align="center">
%URI;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">optional base URI for applet</td>
</tr>
<tr>
<td title="Name">
codetype</td>
<td title="Related Elements" align="center"><span class="noxref">OBJECT</span></td>
<td title="Type" align="center">
%ContentType;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">content type for code</td>
</tr>
<tr>
<td title="Name">
color</td>
<td title="Related Elements" align="center"><span class="noxref">BASEFONT</span>, <span class="noxref">FONT</span></td>
<td title="Type" align="center">
%Color;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">text color</td>
</tr>
<tr>
<td title="Name">
cols</td>
<td title="Related Elements" align="center"><span class="noxref">FRAMESET</span></td>
<td title="Type" align="center">
%MultiLengths;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center">F</td>
<td title="Comment" align="center">list of lengths, default: 100% (1 col)</td>
</tr>
<tr>
<td title="Name">
cols</td>
<td title="Related Elements" align="center"><span class="noxref">TEXTAREA</span></td>
<td title="Type" align="center">
NUMBER</td>
<td title="Default" align="center">#REQUIRED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center"> </td>
</tr>
<tr>
<td title="Name">colspan</td>
<td title="Related Elements" align="center"><span class="noxref">TD</span>, <span class="noxref">TH</span></td>
<td title="Type" align="center">
NUMBER</td>
<td title="Default" align="center">1</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">number of cols spanned by cell</td>
</tr>
<tr>
<td title="Name">compact</td>
<td title="Related Elements" align="center"><span class="noxref">DIR</span>, <span class="noxref">DL</span>, <span class="noxref">MENU</span>, <span class="noxref">OL</span>, <span class="noxref">UL</span></td>
<td title="Type" align="center">(compact)</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">reduced interitem spacing</td>
</tr>
<tr>
<td title="Name">content</td>
<td title="Related Elements" align="center"><span class="noxref">META</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#REQUIRED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">associated information</td>
</tr>
<tr>
<td title="Name">coords</td>
<td title="Related Elements" align="center"><span class="noxref">AREA</span></td>
<td title="Type" align="center">
%Coords;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">comma-separated list of lengths</td>
</tr>
<tr>
<td title="Name">coords</td>
<td title="Related Elements" align="center"><span class="noxref">A</span></td>
<td title="Type" align="center">
%Coords;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">for use with client-side image maps</td>
</tr>
<tr>
<td title="Name">data</td>
<td title="Related Elements" align="center"><span class="noxref">OBJECT</span></td>
<td title="Type" align="center">%URI;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">reference to object's data</td>
</tr>
<tr>
<td title="Name">datetime</td>
<td title="Related Elements" align="center"><span class="noxref">DEL</span>, <span class="noxref">INS</span></td>
<td title="Type" align="center">
%Datetime;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">date and time of change</td>
</tr>
<tr>
<td title="Name">declare</td>
<td title="Related Elements" align="center"><span class="noxref">OBJECT</span></td>
<td title="Type" align="center">(declare)</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">declare but don't instantiate flag</td>
</tr>
<tr>
<td title="Name">defer</td>
<td title="Related Elements" align="center"><span class="noxref">SCRIPT</span></td>
<td title="Type" align="center">(defer)</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">UA may defer execution of script</td>
</tr>
<tr>
<td title="Name">dir</td>
<td title="Related Elements" align="center"><span class="noxref">All elements</span> but <span class="noxref">APPLET</span>, <span class="noxref">BASE</span>, <span class="noxref">BASEFONT</span>, <span class="noxref">BDO</span>, <span class="noxref">BR</span>, <span class="noxref">FRAME</span>, <span class="noxref">FRAMESET</span>, <span class="noxref">IFRAME</span>, <span class="noxref">PARAM</span>, <span class="noxref">SCRIPT</span></td>
<td title="Type" align="center">(ltr | rtl)</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">direction for weak/neutral text</td>
</tr>
<tr>
<td title="Name">dir</td>
<td title="Related Elements" align="center"><span class="noxref">BDO</span></td>
<td title="Type" align="center">(ltr | rtl)</td>
<td title="Default" align="center">#REQUIRED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">directionality</td>
</tr>
<tr>
<td title="Name">
disabled</td>
<td title="Related Elements" align="center"><span class="noxref">BUTTON</span>, <span class="noxref">INPUT</span>, <span class="noxref">OPTGROUP</span>, <span class="noxref">OPTION</span>, <span class="noxref">SELECT</span>, <span class="noxref">TEXTAREA</span></td>
<td title="Type" align="center">(disabled)</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">unavailable in this context</td>
</tr>
<tr>
<td title="Name">enctype</td>
<td title="Related Elements" align="center"><span class="noxref">FORM</span></td>
<td title="Type" align="center">
%ContentType;</td>
<td title="Default" align="center">"application/x-www- form-urlencoded"</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center"> </td>
</tr>
<tr>
<td title="Name">
face</td>
<td title="Related Elements" align="center"><span class="noxref">BASEFONT</span>, <span class="noxref">FONT</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">comma-separated list of font names</td>
</tr>
<tr>
<td title="Name">for</td>
<td title="Related Elements" align="center"><span class="noxref">LABEL</span></td>
<td title="Type" align="center">
IDREF</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">matches field ID value</td>
</tr>
<tr>
<td title="Name">frame</td>
<td title="Related Elements" align="center"><span class="noxref">TABLE</span></td>
<td title="Type" align="center">
%TFrame;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">which parts of frame to render</td>
</tr>
<tr>
<td title="Name">
frameborder</td>
<td title="Related Elements" align="center"><span class="noxref">FRAME</span>, <span class="noxref">IFRAME</span></td>
<td title="Type" align="center">(1 | 0)</td>
<td title="Default" align="center">1</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center">F</td>
<td title="Comment" align="center">request frame borders?</td>
</tr>
<tr>
<td title="Name">headers</td>
<td title="Related Elements" align="center"><span class="noxref">TD</span>, <span class="noxref">TH</span></td>
<td title="Type" align="center">
IDREFS</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">list of id's for header cells</td>
</tr>
<tr>
<td title="Name">
height</td>
<td title="Related Elements" align="center"><span class="noxref">IFRAME</span></td>
<td title="Type" align="center">
%Length;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">frame height</td>
</tr>
<tr>
<td title="Name">height</td>
<td title="Related Elements" align="center"><span class="noxref">TD</span>, <span class="noxref">TH</span></td>
<td title="Type" align="center">
%Length;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">height for cell</td>
</tr>
<tr>
<td title="Name">
height</td>
<td title="Related Elements" align="center"><span class="noxref">IMG</span>, <span class="noxref">OBJECT</span></td>
<td title="Type" align="center">
%Length;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">override height</td>
</tr>
<tr>
<td title="Name">
height</td>
<td title="Related Elements" align="center"><span class="noxref">APPLET</span></td>
<td title="Type" align="center">
%Length;</td>
<td title="Default" align="center">#REQUIRED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">initial height</td>
</tr>
<tr>
<td title="Name">href</td>
<td title="Related Elements" align="center"><span class="noxref">A</span>, <span class="noxref">AREA</span>, <span class="noxref">LINK</span></td>
<td title="Type" align="center">%URI;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">URI for linked resource</td>
</tr>
<tr>
<td title="Name">href</td>
<td title="Related Elements" align="center"><span class="noxref">BASE</span></td>
<td title="Type" align="center">%URI;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">URI that acts as base URI</td>
</tr>
<tr>
<td title="Name">hreflang</td>
<td title="Related Elements" align="center"><span class="noxref">A</span>, <span class="noxref">LINK</span></td>
<td title="Type" align="center">
%LanguageCode;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">language code</td>
</tr>
<tr>
<td title="Name">hspace</td>
<td title="Related Elements" align="center"><span class="noxref">APPLET</span>, <span class="noxref">IMG</span>, <span class="noxref">OBJECT</span></td>
<td title="Type" align="center">
%Pixels;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">horizontal gutter</td>
</tr>
<tr>
<td title="Name">
http-equiv</td>
<td title="Related Elements" align="center"><span class="noxref">META</span></td>
<td title="Type" align="center">NAME</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">HTTP response header name</td>
</tr>
<tr>
<td title="Name">id</td>
<td title="Related Elements" align="center"><span class="noxref">All elements</span> but <span class="noxref">BASE</span>, <span class="noxref">HEAD</span>, <span class="noxref">
HTML</span>, <span class="noxref">META</span>, <span class="noxref">SCRIPT</span>, <span class="noxref">STYLE</span>, <span class="noxref">TITLE</span></td>
<td title="Type" align="center">ID</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">document-wide unique id</td>
</tr>
<tr>
<td title="Name">ismap</td>
<td title="Related Elements" align="center"><span class="noxref">IMG</span>, <span class="noxref">INPUT</span></td>
<td title="Type" align="center">(ismap)</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">use server-side image map</td>
</tr>
<tr>
<td title="Name">
label</td>
<td title="Related Elements" align="center"><span class="noxref">OPTION</span></td>
<td title="Type" align="center">%Text;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">for use in hierarchical menus</td>
</tr>
<tr>
<td title="Name">
label</td>
<td title="Related Elements" align="center"><span class="noxref">OPTGROUP</span></td>
<td title="Type" align="center">%Text;</td>
<td title="Default" align="center">#REQUIRED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">for use in hierarchical menus</td>
</tr>
<tr>
<td title="Name">lang</td>
<td title="Related Elements" align="center"><span class="noxref">All elements</span> but <span class="noxref">APPLET</span>, <span class="noxref">BASE</span>, <span class="noxref">BASEFONT</span>, <span class="noxref">BR</span>, <span class="noxref">FRAME</span>, <span class="noxref">FRAMESET</span>, <span class="noxref">IFRAME</span>, <span class="noxref">PARAM</span>, <span class="noxref">SCRIPT</span></td>
<td title="Type" align="center">
%LanguageCode;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">language code</td>
</tr>
<tr>
<td title="Name">
language</td>
<td title="Related Elements" align="center"><span class="noxref">SCRIPT</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">predefined script language name</td>
</tr>
<tr>
<td title="Name">link</td>
<td title="Related Elements" align="center"><span class="noxref">BODY</span></td>
<td title="Type" align="center">
%Color;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">color of links</td>
</tr>
<tr>
<td title="Name">
longdesc</td>
<td title="Related Elements" align="center"><span class="noxref">IMG</span></td>
<td title="Type" align="center">%URI;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">link to long description (complements
alt)</td>
</tr>
<tr>
<td title="Name">
longdesc</td>
<td title="Related Elements" align="center"><span class="noxref">FRAME</span>, <span class="noxref">IFRAME</span></td>
<td title="Type" align="center">%URI;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center">F</td>
<td title="Comment" align="center">link to long description (complements
title)</td>
</tr>
<tr>
<td title="Name">
marginheight</td>
<td title="Related Elements" align="center"><span class="noxref">FRAME</span>, <span class="noxref">IFRAME</span></td>
<td title="Type" align="center">
%Pixels;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center">F</td>
<td title="Comment" align="center">margin height in pixels</td>
</tr>
<tr>
<td title="Name">
marginwidth</td>
<td title="Related Elements" align="center"><span class="noxref">FRAME</span>, <span class="noxref">IFRAME</span></td>
<td title="Type" align="center">
%Pixels;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center">F</td>
<td title="Comment" align="center">margin widths in pixels</td>
</tr>
<tr>
<td title="Name">
maxlength</td>
<td title="Related Elements" align="center"><span class="noxref">INPUT</span></td>
<td title="Type" align="center">
NUMBER</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">max chars for text fields</td>
</tr>
<tr>
<td title="Name">media</td>
<td title="Related Elements" align="center"><span class="noxref">STYLE</span></td>
<td title="Type" align="center">
%MediaDesc;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">designed for use with these media</td>
</tr>
<tr>
<td title="Name">media</td>
<td title="Related Elements" align="center"><span class="noxref">LINK</span></td>
<td title="Type" align="center">
%MediaDesc;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">for rendering on these media</td>
</tr>
<tr>
<td title="Name">method</td>
<td title="Related Elements" align="center"><span class="noxref">FORM</span></td>
<td title="Type" align="center">(GET | POST)</td>
<td title="Default" align="center">GET</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">HTTP method used to submit the form</td>
</tr>
<tr>
<td title="Name">
multiple</td>
<td title="Related Elements" align="center"><span class="noxref">SELECT</span></td>
<td title="Type" align="center">(multiple)</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">default is single selection</td>
</tr>
<tr>
<td title="Name">
name</td>
<td title="Related Elements" align="center"><span class="noxref">BUTTON</span>, <span class="noxref">TEXTAREA</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center"> </td>
</tr>
<tr>
<td title="Name">
name</td>
<td title="Related Elements" align="center"><span class="noxref">APPLET</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">allows applets to find each other</td>
</tr>
<tr>
<td title="Name">
name</td>
<td title="Related Elements" align="center"><span class="noxref">SELECT</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">field name</td>
</tr>
<tr>
<td title="Name">name</td>
<td title="Related Elements" align="center"><span class="noxref">FORM</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">name of form for scripting</td>
</tr>
<tr>
<td title="Name">name</td>
<td title="Related Elements" align="center"><span class="noxref">FRAME</span>, <span class="noxref">IFRAME</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center">F</td>
<td title="Comment" align="center">name of frame for targetting</td>
</tr>
<tr>
<td title="Name">name</td>
<td title="Related Elements" align="center"><span class="noxref">IMG</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">name of image for scripting</td>
</tr>
<tr>
<td title="Name">name</td>
<td title="Related Elements" align="center"><span class="noxref">A</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">named link end</td>
</tr>
<tr>
<td title="Name">name</td>
<td title="Related Elements" align="center"><span class="noxref">INPUT</span>, <span class="noxref">OBJECT</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">submit as part of form</td>
</tr>
<tr>
<td title="Name">name</td>
<td title="Related Elements" align="center"><span class="noxref">MAP</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#REQUIRED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">for reference by usemap</td>
</tr>
<tr>
<td title="Name">name</td>
<td title="Related Elements" align="center"><span class="noxref">PARAM</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#REQUIRED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">property name</td>
</tr>
<tr>
<td title="Name">name</td>
<td title="Related Elements" align="center"><span class="noxref">META</span></td>
<td title="Type" align="center">NAME</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">metainformation name</td>
</tr>
<tr>
<td title="Name">nohref</td>
<td title="Related Elements" align="center"><span class="noxref">AREA</span></td>
<td title="Type" align="center">(nohref)</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">this region has no action</td>
</tr>
<tr>
<td title="Name">
noresize</td>
<td title="Related Elements" align="center"><span class="noxref">FRAME</span></td>
<td title="Type" align="center">(noresize)</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center">F</td>
<td title="Comment" align="center">allow users to resize frames?</td>
</tr>
<tr>
<td title="Name">
noshade</td>
<td title="Related Elements" align="center"><span class="noxref">HR</span></td>
<td title="Type" align="center">(noshade)</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center"> </td>
</tr>
<tr>
<td title="Name">nowrap</td>
<td title="Related Elements" align="center"><span class="noxref">TD</span>, <span class="noxref">TH</span></td>
<td title="Type" align="center">(nowrap)</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">suppress word wrap</td>
</tr>
<tr>
<td title="Name">object</td>
<td title="Related Elements" align="center"><span class="noxref">APPLET</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">serialized applet file</td>
</tr>
<tr>
<td title="Name">onblur</td>
<td title="Related Elements" align="center"><span class="noxref">A</span>, <span class="noxref">AREA</span>, <span class="noxref">BUTTON</span>, <span class="noxref">INPUT</span>, <span class="noxref">LABEL</span>, <span class="noxref">SELECT</span>, <span class="noxref">TEXTAREA</span></td>
<td title="Type" align="center">
%Script;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">the element lost the focus</td>
</tr>
<tr>
<td title="Name">
onchange</td>
<td title="Related Elements" align="center"><span class="noxref">INPUT</span>, <span class="noxref">SELECT</span>, <span class="noxref">TEXTAREA</span></td>
<td title="Type" align="center">
%Script;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">the element value was changed</td>
</tr>
<tr>
<td title="Name">
onclick</td>
<td title="Related Elements" align="center"><span class="noxref">All elements</span> but <span class="noxref">APPLET</span>, <span class="noxref">BASE</span>, <span class="noxref">BASEFONT</span>, <span class="noxref">BDO</span>, <span class="noxref">BR</span>, <span class="noxref">FONT</span>, <span class="noxref">FRAME</span>, <span class="noxref">FRAMESET</span>, <span class="noxref">HEAD</span>, <span class="noxref">HTML</span>, <span class="noxref">IFRAME</span>, <span class="noxref">ISINDEX</span>, <span class="noxref">META</span>, <span class="noxref">PARAM</span>, <span class="noxref">SCRIPT</span>, <span class="noxref">STYLE</span>, <span class="noxref">TITLE</span></td>
<td title="Type" align="center">
%Script;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">a pointer button was clicked</td>
</tr>
<tr>
<td title="Name">
ondblclick</td>
<td title="Related Elements" align="center"><span class="noxref">All elements</span> but <span class="noxref">APPLET</span>, <span class="noxref">BASE</span>, <span class="noxref">BASEFONT</span>, <span class="noxref">BDO</span>, <span class="noxref">BR</span>, <span class="noxref">FONT</span>, <span class="noxref">FRAME</span>, <span class="noxref">FRAMESET</span>, <span class="noxref">HEAD</span>, <span class="noxref">HTML</span>, <span class="noxref">IFRAME</span>, <span class="noxref">ISINDEX</span>, <span class="noxref">META</span>, <span class="noxref">PARAM</span>, <span class="noxref">SCRIPT</span>, <span class="noxref">STYLE</span>, <span class="noxref">TITLE</span></td>
<td title="Type" align="center">
%Script;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">a pointer button was double clicked</td>
</tr>
<tr>
<td title="Name">
onfocus</td>
<td title="Related Elements" align="center"><span class="noxref">A</span>, <span class="noxref">AREA</span>, <span class="noxref">BUTTON</span>, <span class="noxref">INPUT</span>, <span class="noxref">LABEL</span>, <span class="noxref">SELECT</span>, <span class="noxref">TEXTAREA</span></td>
<td title="Type" align="center">
%Script;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">the element got the focus</td>
</tr>
<tr>
<td title="Name">
onkeydown</td>
<td title="Related Elements" align="center"><span class="noxref">All elements</span> but <span class="noxref">APPLET</span>, <span class="noxref">BASE</span>, <span class="noxref">BASEFONT</span>, <span class="noxref">BDO</span>, <span class="noxref">BR</span>, <span class="noxref">FONT</span>, <span class="noxref">FRAME</span>, <span class="noxref">FRAMESET</span>, <span class="noxref">HEAD</span>, <span class="noxref">HTML</span>, <span class="noxref">IFRAME</span>, <span class="noxref">ISINDEX</span>, <span class="noxref">META</span>, <span class="noxref">PARAM</span>, <span class="noxref">SCRIPT</span>, <span class="noxref">STYLE</span>, <span class="noxref">TITLE</span></td>
<td title="Type" align="center">
%Script;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">a key was pressed down</td>
</tr>
<tr>
<td title="Name">
onkeypress</td>
<td title="Related Elements" align="center"><span class="noxref">All elements</span> but <span class="noxref">APPLET</span>, <span class="noxref">BASE</span>, <span class="noxref">BASEFONT</span>, <span class="noxref">BDO</span>, <span class="noxref">BR</span>, <span class="noxref">FONT</span>, <span class="noxref">FRAME</span>, <span class="noxref">FRAMESET</span>, <span class="noxref">HEAD</span>, <span class="noxref">HTML</span>, <span class="noxref">IFRAME</span>, <span class="noxref">ISINDEX</span>, <span class="noxref">META</span>, <span class="noxref">PARAM</span>, <span class="noxref">SCRIPT</span>, <span class="noxref">STYLE</span>, <span class="noxref">TITLE</span></td>
<td title="Type" align="center">
%Script;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">a key was pressed and released</td>
</tr>
<tr>
<td title="Name">
onkeyup</td>
<td title="Related Elements" align="center"><span class="noxref">All elements</span> but <span class="noxref">APPLET</span>, <span class="noxref">BASE</span>, <span class="noxref">BASEFONT</span>, <span class="noxref">BDO</span>, <span class="noxref">BR</span>, <span class="noxref">FONT</span>, <span class="noxref">FRAME</span>, <span class="noxref">FRAMESET</span>, <span class="noxref">HEAD</span>, <span class="noxref">HTML</span>, <span class="noxref">IFRAME</span>, <span class="noxref">ISINDEX</span>, <span class="noxref">META</span>, <span class="noxref">PARAM</span>, <span class="noxref">SCRIPT</span>, <span class="noxref">STYLE</span>, <span class="noxref">TITLE</span></td>
<td title="Type" align="center">
%Script;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">a key was released</td>
</tr>
<tr>
<td title="Name">onload</td>
<td title="Related Elements" align="center"><span class="noxref">FRAMESET</span></td>
<td title="Type" align="center">
%Script;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center">F</td>
<td title="Comment" align="center">all the frames have been loaded</td>
</tr>
<tr>
<td title="Name">onload</td>
<td title="Related Elements" align="center"><span class="noxref">BODY</span></td>
<td title="Type" align="center">
%Script;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">the document has been loaded</td>
</tr>
<tr>
<td title="Name">
onmousedown</td>
<td title="Related Elements" align="center"><span class="noxref">All elements</span> but <span class="noxref">APPLET</span>, <span class="noxref">BASE</span>, <span class="noxref">BASEFONT</span>, <span class="noxref">BDO</span>, <span class="noxref">BR</span>, <span class="noxref">FONT</span>, <span class="noxref">FRAME</span>, <span class="noxref">FRAMESET</span>, <span class="noxref">HEAD</span>, <span class="noxref">HTML</span>, <span class="noxref">IFRAME</span>, <span class="noxref">ISINDEX</span>, <span class="noxref">META</span>, <span class="noxref">PARAM</span>, <span class="noxref">SCRIPT</span>, <span class="noxref">STYLE</span>, <span class="noxref">TITLE</span></td>
<td title="Type" align="center">
%Script;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">a pointer button was pressed down</td>
</tr>
<tr>
<td title="Name">
onmousemove</td>
<td title="Related Elements" align="center"><span class="noxref">All elements</span> but <span class="noxref">APPLET</span>, <span class="noxref">BASE</span>, <span class="noxref">BASEFONT</span>, <span class="noxref">BDO</span>, <span class="noxref">BR</span>, <span class="noxref">FONT</span>, <span class="noxref">FRAME</span>, <span class="noxref">FRAMESET</span>, <span class="noxref">HEAD</span>, <span class="noxref">HTML</span>, <span class="noxref">IFRAME</span>, <span class="noxref">ISINDEX</span>, <span class="noxref">META</span>, <span class="noxref">PARAM</span>, <span class="noxref">SCRIPT</span>, <span class="noxref">STYLE</span>, <span class="noxref">TITLE</span></td>
<td title="Type" align="center">
%Script;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">a pointer was moved within</td>
</tr>
<tr>
<td title="Name">
onmouseout</td>
<td title="Related Elements" align="center"><span class="noxref">All elements</span> but <span class="noxref">APPLET</span>, <span class="noxref">BASE</span>, <span class="noxref">BASEFONT</span>, <span class="noxref">BDO</span>, <span class="noxref">BR</span>, <span class="noxref">FONT</span>, <span class="noxref">FRAME</span>, <span class="noxref">FRAMESET</span>, <span class="noxref">HEAD</span>, <span class="noxref">HTML</span>, <span class="noxref">IFRAME</span>, <span class="noxref">ISINDEX</span>, <span class="noxref">META</span>, <span class="noxref">PARAM</span>, <span class="noxref">SCRIPT</span>, <span class="noxref">STYLE</span>, <span class="noxref">TITLE</span></td>
<td title="Type" align="center">
%Script;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">a pointer was moved away</td>
</tr>
<tr>
<td title="Name">
onmouseover</td>
<td title="Related Elements" align="center"><span class="noxref">All elements</span> but <span class="noxref">APPLET</span>, <span class="noxref">BASE</span>, <span class="noxref">BASEFONT</span>, <span class="noxref">BDO</span>, <span class="noxref">BR</span>, <span class="noxref">FONT</span>, <span class="noxref">FRAME</span>, <span class="noxref">FRAMESET</span>, <span class="noxref">HEAD</span>, <span class="noxref">HTML</span>, <span class="noxref">IFRAME</span>, <span class="noxref">ISINDEX</span>, <span class="noxref">META</span>, <span class="noxref">PARAM</span>, <span class="noxref">SCRIPT</span>, <span class="noxref">STYLE</span>, <span class="noxref">TITLE</span></td>
<td title="Type" align="center">
%Script;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">a pointer was moved onto</td>
</tr>
<tr>
<td title="Name">
onmouseup</td>
<td title="Related Elements" align="center"><span class="noxref">All elements</span> but <span class="noxref">APPLET</span>, <span class="noxref">BASE</span>, <span class="noxref">BASEFONT</span>, <span class="noxref">BDO</span>, <span class="noxref">BR</span>, <span class="noxref">FONT</span>, <span class="noxref">FRAME</span>, <span class="noxref">FRAMESET</span>, <span class="noxref">HEAD</span>, <span class="noxref">HTML</span>, <span class="noxref">IFRAME</span>, <span class="noxref">ISINDEX</span>, <span class="noxref">META</span>, <span class="noxref">PARAM</span>, <span class="noxref">SCRIPT</span>, <span class="noxref">STYLE</span>, <span class="noxref">TITLE</span></td>
<td title="Type" align="center">
%Script;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">a pointer button was released</td>
</tr>
<tr>
<td title="Name">
onreset</td>
<td title="Related Elements" align="center"><span class="noxref">FORM</span></td>
<td title="Type" align="center">
%Script;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">the form was reset</td>
</tr>
<tr>
<td title="Name">
onselect</td>
<td title="Related Elements" align="center"><span class="noxref">INPUT</span>, <span class="noxref">TEXTAREA</span></td>
<td title="Type" align="center">
%Script;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">some text was selected</td>
</tr>
<tr>
<td title="Name">
onsubmit</td>
<td title="Related Elements" align="center"><span class="noxref">FORM</span></td>
<td title="Type" align="center">
%Script;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">the form was submitted</td>
</tr>
<tr>
<td title="Name">
onunload</td>
<td title="Related Elements" align="center"><span class="noxref">FRAMESET</span></td>
<td title="Type" align="center">
%Script;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center">F</td>
<td title="Comment" align="center">all the frames have been removed</td>
</tr>
<tr>
<td title="Name">
onunload</td>
<td title="Related Elements" align="center"><span class="noxref">BODY</span></td>
<td title="Type" align="center">
%Script;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">the document has been removed</td>
</tr>
<tr>
<td title="Name">profile</td>
<td title="Related Elements" align="center"><span class="noxref">HEAD</span></td>
<td title="Type" align="center">%URI;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">named dictionary of meta info</td>
</tr>
<tr>
<td title="Name">prompt</td>
<td title="Related Elements" align="center"><span class="noxref">ISINDEX</span></td>
<td title="Type" align="center">
%Text;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">prompt message</td>
</tr>
<tr>
<td title="Name">
readonly</td>
<td title="Related Elements" align="center"><span class="noxref">TEXTAREA</span></td>
<td title="Type" align="center">(readonly)</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center"> </td>
</tr>
<tr>
<td title="Name">
readonly</td>
<td title="Related Elements" align="center"><span class="noxref">INPUT</span></td>
<td title="Type" align="center">(readonly)</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">for text and passwd</td>
</tr>
<tr>
<td title="Name">rel</td>
<td title="Related Elements" align="center"><span class="noxref">A</span>, <span class="noxref">LINK</span></td>
<td title="Type" align="center">
%LinkTypes;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">forward link types</td>
</tr>
<tr>
<td title="Name">rev</td>
<td title="Related Elements" align="center"><span class="noxref">A</span>, <span class="noxref">LINK</span></td>
<td title="Type" align="center">
%LinkTypes;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">reverse link types</td>
</tr>
<tr>
<td title="Name">
rows</td>
<td title="Related Elements" align="center"><span class="noxref">FRAMESET</span></td>
<td title="Type" align="center">
%MultiLengths;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center">F</td>
<td title="Comment" align="center">list of lengths, default: 100% (1 row)</td>
</tr>
<tr>
<td title="Name">
rows</td>
<td title="Related Elements" align="center"><span class="noxref">TEXTAREA</span></td>
<td title="Type" align="center">
NUMBER</td>
<td title="Default" align="center">#REQUIRED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center"> </td>
</tr>
<tr>
<td title="Name">rowspan</td>
<td title="Related Elements" align="center"><span class="noxref">TD</span>, <span class="noxref">TH</span></td>
<td title="Type" align="center">
NUMBER</td>
<td title="Default" align="center">1</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">number of rows spanned by cell</td>
</tr>
<tr>
<td title="Name">rules</td>
<td title="Related Elements" align="center"><span class="noxref">TABLE</span></td>
<td title="Type" align="center">
%TRules;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">rulings between rows and cols</td>
</tr>
<tr>
<td title="Name">scheme</td>
<td title="Related Elements" align="center"><span class="noxref">META</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">select form of content</td>
</tr>
<tr>
<td title="Name">scope</td>
<td title="Related Elements" align="center"><span class="noxref">TD</span>, <span class="noxref">TH</span></td>
<td title="Type" align="center">
%Scope;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">scope covered by header cells</td>
</tr>
<tr>
<td title="Name">
scrolling</td>
<td title="Related Elements" align="center"><span class="noxref">FRAME</span>, <span class="noxref">IFRAME</span></td>
<td title="Type" align="center">(yes | no | auto)</td>
<td title="Default" align="center">auto</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center">F</td>
<td title="Comment" align="center">scrollbar or none</td>
</tr>
<tr>
<td title="Name">
selected</td>
<td title="Related Elements" align="center"><span class="noxref">OPTION</span></td>
<td title="Type" align="center">(selected)</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center"> </td>
</tr>
<tr>
<td title="Name">shape</td>
<td title="Related Elements" align="center"><span class="noxref">AREA</span></td>
<td title="Type" align="center">
%Shape;</td>
<td title="Default" align="center">rect</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">controls interpretation of coords</td>
</tr>
<tr>
<td title="Name">shape</td>
<td title="Related Elements" align="center"><span class="noxref">A</span></td>
<td title="Type" align="center">
%Shape;</td>
<td title="Default" align="center">rect</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">for use with client-side image maps</td>
</tr>
<tr>
<td title="Name">size</td>
<td title="Related Elements" align="center"><span class="noxref">HR</span></td>
<td title="Type" align="center">
%Pixels;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center"> </td>
</tr>
<tr>
<td title="Name">
size</td>
<td title="Related Elements" align="center"><span class="noxref">FONT</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">[+|-]nn e.g. size="+1", size="4"</td>
</tr>
<tr>
<td title="Name">size</td>
<td title="Related Elements" align="center"><span class="noxref">INPUT</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">specific to each type of field</td>
</tr>
<tr>
<td title="Name">
size</td>
<td title="Related Elements" align="center"><span class="noxref">BASEFONT</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#REQUIRED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">base font size for FONT elements</td>
</tr>
<tr>
<td title="Name">
size</td>
<td title="Related Elements" align="center"><span class="noxref">SELECT</span></td>
<td title="Type" align="center">
NUMBER</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">rows visible</td>
</tr>
<tr>
<td title="Name">span</td>
<td title="Related Elements" align="center"><span class="noxref">COL</span></td>
<td title="Type" align="center">
NUMBER</td>
<td title="Default" align="center">1</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">COL attributes affect N columns</td>
</tr>
<tr>
<td title="Name">
span</td>
<td title="Related Elements" align="center"><span class="noxref">COLGROUP</span></td>
<td title="Type" align="center">
NUMBER</td>
<td title="Default" align="center">1</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">default number of columns in group</td>
</tr>
<tr>
<td title="Name">
src</td>
<td title="Related Elements" align="center"><span class="noxref">SCRIPT</span></td>
<td title="Type" align="center">%URI;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">URI for an external script</td>
</tr>
<tr>
<td title="Name">src</td>
<td title="Related Elements" align="center"><span class="noxref">INPUT</span></td>
<td title="Type" align="center">%URI;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">for fields with images</td>
</tr>
<tr>
<td title="Name">src</td>
<td title="Related Elements" align="center"><span class="noxref">FRAME</span>, <span class="noxref">IFRAME</span></td>
<td title="Type" align="center">%URI;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center">F</td>
<td title="Comment" align="center">source of frame content</td>
</tr>
<tr>
<td title="Name">src</td>
<td title="Related Elements" align="center"><span class="noxref">IMG</span></td>
<td title="Type" align="center">%URI;</td>
<td title="Default" align="center">#REQUIRED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">URI of image to embed</td>
</tr>
<tr>
<td title="Name">standby</td>
<td title="Related Elements" align="center"><span class="noxref">OBJECT</span></td>
<td title="Type" align="center">%Text;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">message to show while loading</td>
</tr>
<tr>
<td title="Name">start</td>
<td title="Related Elements" align="center"><span class="noxref">OL</span></td>
<td title="Type" align="center">
NUMBER</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">starting sequence number</td>
</tr>
<tr>
<td title="Name">style</td>
<td title="Related Elements" align="center"><span class="noxref">All elements</span> but <span class="noxref">BASE</span>, <span class="noxref">BASEFONT</span>, <span class="noxref">HEAD</span>, <span class="noxref">
HTML</span>, <span class="noxref">META</span>, <span class="noxref">PARAM</span>, <span class="noxref">SCRIPT</span>, <span class="noxref">STYLE</span>, <span class="noxref">TITLE</span></td>
<td title="Type" align="center">
%StyleSheet;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">associated style info</td>
</tr>
<tr>
<td title="Name">summary</td>
<td title="Related Elements" align="center"><span class="noxref">TABLE</span></td>
<td title="Type" align="center">%Text;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">purpose/structure for speech output</td>
</tr>
<tr>
<td title="Name">
tabindex</td>
<td title="Related Elements" align="center"><span class="noxref">A</span>, <span class="noxref">AREA</span>, <span class="noxref">BUTTON</span>, <span class="noxref">INPUT</span>, <span class="noxref">OBJECT</span>, <span class="noxref">SELECT</span>, <span class="noxref">TEXTAREA</span></td>
<td title="Type" align="center">
NUMBER</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">position in tabbing order</td>
</tr>
<tr>
<td title="Name">target</td>
<td title="Related Elements" align="center"><span class="noxref">A</span>, <span class="noxref">AREA</span>, <span class="noxref">BASE</span>, <span class="noxref">FORM</span>, <span class="noxref">LINK</span></td>
<td title="Type" align="center">
%FrameTarget;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">render in this frame</td>
</tr>
<tr>
<td title="Name">text</td>
<td title="Related Elements" align="center"><span class="noxref">BODY</span></td>
<td title="Type" align="center">
%Color;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">document text color</td>
</tr>
<tr>
<td title="Name">title</td>
<td title="Related Elements" align="center"><span class="noxref">All elements</span> but <span class="noxref">BASE</span>, <span class="noxref">BASEFONT</span>, <span class="noxref">HEAD</span>, <span class="noxref">
HTML</span>, <span class="noxref">META</span>, <span class="noxref">PARAM</span>, <span class="noxref">SCRIPT</span>, <span class="noxref">TITLE</span></td>
<td title="Type" align="center">%Text;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">advisory title</td>
</tr>
<tr>
<td title="Name">type</td>
<td title="Related Elements" align="center"><span class="noxref">A</span>, <span class="noxref">LINK</span></td>
<td title="Type" align="center">
%ContentType;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">advisory content type</td>
</tr>
<tr>
<td title="Name">
type</td>
<td title="Related Elements" align="center"><span class="noxref">OBJECT</span></td>
<td title="Type" align="center">
%ContentType;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">content type for data</td>
</tr>
<tr>
<td title="Name">type</td>
<td title="Related Elements" align="center"><span class="noxref">PARAM</span></td>
<td title="Type" align="center">
%ContentType;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">content type for value when
valuetype=ref</td>
</tr>
<tr>
<td title="Name">
type</td>
<td title="Related Elements" align="center"><span class="noxref">SCRIPT</span></td>
<td title="Type" align="center">
%ContentType;</td>
<td title="Default" align="center">#REQUIRED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">content type of script language</td>
</tr>
<tr>
<td title="Name">type</td>
<td title="Related Elements" align="center"><span class="noxref">STYLE</span></td>
<td title="Type" align="center">
%ContentType;</td>
<td title="Default" align="center">#REQUIRED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">content type of style language</td>
</tr>
<tr>
<td title="Name">type</td>
<td title="Related Elements" align="center"><span class="noxref">INPUT</span></td>
<td title="Type" align="center">
%InputType;</td>
<td title="Default" align="center">TEXT</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">what kind of widget is needed</td>
</tr>
<tr>
<td title="Name">type</td>
<td title="Related Elements" align="center"><span class="noxref">LI</span></td>
<td title="Type" align="center">
%LIStyle;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">list item style</td>
</tr>
<tr>
<td title="Name">type</td>
<td title="Related Elements" align="center"><span class="noxref">OL</span></td>
<td title="Type" align="center">
%OLStyle;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">numbering style</td>
</tr>
<tr>
<td title="Name">type</td>
<td title="Related Elements" align="center"><span class="noxref">UL</span></td>
<td title="Type" align="center">
%ULStyle;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">bullet style</td>
</tr>
<tr>
<td title="Name">
type</td>
<td title="Related Elements" align="center"><span class="noxref">BUTTON</span></td>
<td title="Type" align="center">(button | submit | reset)</td>
<td title="Default" align="center">submit</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">for use as form button</td>
</tr>
<tr>
<td title="Name">usemap</td>
<td title="Related Elements" align="center"><span class="noxref">IMG</span>, <span class="noxref">INPUT</span>, <span class="noxref">OBJECT</span></td>
<td title="Type" align="center">%URI;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">use client-side image map</td>
</tr>
<tr>
<td title="Name">valign</td>
<td title="Related Elements" align="center"><span class="noxref">COL</span>, <span class="noxref">COLGROUP</span>, <span class="noxref">TBODY</span>, <span class="noxref">TD</span>, <span class="noxref">TFOOT</span>, <span class="noxref">TH</span>, <span class="noxref">THEAD</span>, <span class="noxref">TR</span></td>
<td title="Type" align="center">(top | middle | bottom | baseline)</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">vertical alignment in cells</td>
</tr>
<tr>
<td title="Name">
value</td>
<td title="Related Elements" align="center"><span class="noxref">INPUT</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">Specify for radio buttons and
checkboxes</td>
</tr>
<tr>
<td title="Name">
value</td>
<td title="Related Elements" align="center"><span class="noxref">OPTION</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">defaults to element content</td>
</tr>
<tr>
<td title="Name">
value</td>
<td title="Related Elements" align="center"><span class="noxref">PARAM</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">property value</td>
</tr>
<tr>
<td title="Name">
value</td>
<td title="Related Elements" align="center"><span class="noxref">BUTTON</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">sent to server when submitted</td>
</tr>
<tr>
<td title="Name">value</td>
<td title="Related Elements" align="center"><span class="noxref">LI</span></td>
<td title="Type" align="center">
NUMBER</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">reset sequence number</td>
</tr>
<tr>
<td title="Name">
valuetype</td>
<td title="Related Elements" align="center"><span class="noxref">PARAM</span></td>
<td title="Type" align="center">(DATA | REF | OBJECT)</td>
<td title="Default" align="center">DATA</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">How to interpret value</td>
</tr>
<tr>
<td title="Name">version</td>
<td title="Related Elements" align="center"><span class="noxref">HTML</span></td>
<td title="Type" align="center">
CDATA</td>
<td title="Default" align="center">%HTML.Version;</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">Constant</td>
</tr>
<tr>
<td title="Name">vlink</td>
<td title="Related Elements" align="center"><span class="noxref">BODY</span></td>
<td title="Type" align="center">
%Color;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">color of visited links</td>
</tr>
<tr>
<td title="Name">vspace</td>
<td title="Related Elements" align="center"><span class="noxref">APPLET</span>, <span class="noxref">IMG</span>, <span class="noxref">OBJECT</span></td>
<td title="Type" align="center">
%Pixels;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">vertical gutter</td>
</tr>
<tr>
<td title="Name">
width</td>
<td title="Related Elements" align="center"><span class="noxref">HR</span></td>
<td title="Type" align="center">
%Length;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center"> </td>
</tr>
<tr>
<td title="Name">
width</td>
<td title="Related Elements" align="center"><span class="noxref">IFRAME</span></td>
<td title="Type" align="center">
%Length;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">frame width</td>
</tr>
<tr>
<td title="Name">width</td>
<td title="Related Elements" align="center"><span class="noxref">IMG</span>, <span class="noxref">OBJECT</span></td>
<td title="Type" align="center">
%Length;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">override width</td>
</tr>
<tr>
<td title="Name">
width</td>
<td title="Related Elements" align="center"><span class="noxref">TABLE</span></td>
<td title="Type" align="center">
%Length;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">table width</td>
</tr>
<tr>
<td title="Name">width</td>
<td title="Related Elements" align="center"><span class="noxref">TD</span>, <span class="noxref">TH</span></td>
<td title="Type" align="center">
%Length;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">width for cell</td>
</tr>
<tr>
<td title="Name">
width</td>
<td title="Related Elements" align="center"><span class="noxref">APPLET</span></td>
<td title="Type" align="center">
%Length;</td>
<td title="Default" align="center">#REQUIRED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center">initial width</td>
</tr>
<tr>
<td title="Name">width</td>
<td title="Related Elements" align="center"><span class="noxref">COL</span></td>
<td title="Type" align="center">
%MultiLength;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">column width specification</td>
</tr>
<tr>
<td title="Name">
width</td>
<td title="Related Elements" align="center"><span class="noxref">COLGROUP</span></td>
<td title="Type" align="center">
%MultiLength;</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center"> </td>
<td title="DTD" align="center"> </td>
<td title="Comment" align="center">default width for enclosed COLs</td>
</tr>
<tr>
<td title="Name">width</td>
<td title="Related Elements" align="center"><span class="noxref">PRE</span></td>
<td title="Type" align="center">
NUMBER</td>
<td title="Default" align="center">#IMPLIED</td>
<td title="Depr." align="center">D</td>
<td title="DTD" align="center">L</td>
<td title="Comment" align="center"> </td>
</tr>
</tbody>
</table>
</html>
!! Ressources
* http://www.imagemagick.org
!! Read
*Eye of gnome: {{{eog <image>}}}
*imagemagick: {{{display <image>}}}
!!Create a bitmap
{{{
atobm -cc 01 image.txt >! image.bmp
}}}
{{{image.txt}}}:
{{{
000000001
000000011
000000111
000001111
000011111
000111111
001111111
011111111
}}}
!! Create a png
{{{
def mtxToPng(mtx=["010","111","010"],filename="cross3x3.png"):
import struct,zlib
def i4(value): return struct.pack("!I", value & 0xffffffff)
transcode = {"0":b"\0","1":b"\xff"}
w,h = len(mtx),len(mtx[0])
chunks = [ b"IHDR"+i4(w)+i4(h)+b"\x08\x00\x00\x00\x00" ]
pixels = b"".join([transcode[col] for row in mtx for col in "0"+row])
chunks.append( b"IDAT"+zlib.compress(pixels,9))
chunks.append( b"IEND")
png = b"\x89PNG\r\n\x1a\n"
for chunk in chunks:
png += i4(len(chunk)-4)+chunk+i4(zlib.crc32(chunk))
print(f"Creating: {filename}")
with open(filename,"wb") as f:
f.write(png)
f.close()
}}}
!!Manipulate
{{{
convert image_in.svg image_out.jpg
convert image_in.jpg -resize 50% image_out.png
convert image_in.jpg -crop 100x50+20+40 image_out.png
}}}
As convert ps to svg is buggy, here is a workaround:
{{{
pstoedit image_in.ps image_out.svg
}}}
!! Vectorized images
sK1 engine wrapped with python ( pdf <-> eps <-> svg ...): {{{ UniConvertor }}}
!! Video format conversion
{{{
ffmpeg -i turtle.avi -sameq turtle.swf
}}}
!! Video + audio merged
{{{
ffmpeg -i mutevideo.avi -i sound.wav -map 0:0 -map 1:0 -acodec copy -vcodec copy video.avi
}}}
{{editbutton{<<editTiddler imageProcessing>>}}}
| select tool | s or F1 |
| node tool | n or F2 |
| pen | b |
| rectangle | r |
| ellipse | e |
| fill | ~Ctrl-Shft-F |
| align | ~Ctrl-Shft-A |
| type in symbol | ~Ctrl-Shft-u xxxx | ~Ctrl-Shft-U 2260 ⇒ ≠ |
/***
|Name|InlineJavascriptPlugin|
|Source|http://www.TiddlyTools.com/#InlineJavascriptPlugin|
|Version|1.7.0|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|Insert Javascript executable code directly into your tiddler content.|
''Call directly into TW core utility routines, define new functions, calculate values, add dynamically-generated TiddlyWiki-formatted output'' into tiddler content, or perform any other programmatic actions each time the tiddler is rendered.
!!!!!Usage
<<<
When installed, this plugin adds new wiki syntax for surrounding tiddler content with {{{<script>}}} and {{{</script>}}} markers, so that it can be treated as embedded javascript and executed each time the tiddler is rendered.
''Deferred execution from an 'onClick' link''
By including a {{{label="..."}}} parameter in the initial {{{<script>}}} marker, the plugin will create a link to an 'onclick' script that will only be executed when that specific link is clicked, rather than running the script each time the tiddler is rendered. You may also include a {{{title="..."}}} parameter to specify the 'tooltip' text that will appear whenever the mouse is moved over the onClick link text
''External script source files:''
You can also load javascript from an external source URL, by including a src="..." parameter in the initial {{{<script>}}} marker (e.g., {{{<script src="demo.js"></script>}}}). This is particularly useful when incorporating third-party javascript libraries for use in custom extensions and plugins. The 'foreign' javascript code remains isolated in a separate file that can be easily replaced whenever an updated library file becomes available.
''Display script source in tiddler output''
By including the keyword parameter "show", in the initial {{{<script>}}} marker, the plugin will include the script source code in the output that it displays in the tiddler.
''Defining javascript functions and libraries:''
Although the external javascript file is loaded while the tiddler content is being rendered, any functions it defines will not be available for use until //after// the rendering has been completed. Thus, you cannot load a library and //immediately// use it's functions within the same tiddler. However, once that tiddler has been loaded, the library functions can be freely used in any tiddler (even the one in which it was initially loaded).
To ensure that your javascript functions are always available when needed, you should load the libraries from a tiddler that will be rendered as soon as your TiddlyWiki document is opened. For example, you could put your {{{<script src="..."></script>}}} syntax into a tiddler called LoadScripts, and then add {{{<<tiddler LoadScripts>>}}} in your MainMenu tiddler.
Since the MainMenu is always rendered immediately upon opening your document, the library will always be loaded before any other tiddlers that rely upon the functions it defines. Loading an external javascript library does not produce any direct output in the tiddler, so these definitions should have no impact on the appearance of your MainMenu.
''Creating dynamic tiddler content''
An important difference between this implementation of embedded scripting and conventional embedded javascript techniques for web pages is the method used to produce output that is dynamically inserted into the document:
* In a typical web document, you use the document.write() function to output text sequences (often containing HTML tags) that are then rendered when the entire document is first loaded into the browser window.
* However, in a ~TiddlyWiki document, tiddlers (and other DOM elements) are created, deleted, and rendered "on-the-fly", so writing directly to the global 'document' object does not produce the results you want (i.e., replacing the embedded script within the tiddler content), and completely replaces the entire ~TiddlyWiki document in your browser window.
* To allow these scripts to work unmodified, the plugin automatically converts all occurences of document.write() so that the output is inserted into the tiddler content instead of replacing the entire ~TiddlyWiki document.
If your script does not use document.write() to create dynamically embedded content within a tiddler, your javascript can, as an alternative, explicitly return a text value that the plugin can then pass through the wikify() rendering engine to insert into the tiddler display. For example, using {{{return "thistext"}}} will produce the same output as {{{document.write("thistext")}}}.
//Note: your script code is automatically 'wrapped' inside a function, {{{_out()}}}, so that any return value you provide can be correctly handled by the plugin and inserted into the tiddler. To avoid unpredictable results (and possibly fatal execution errors), this function should never be redefined or called from ''within'' your script code.//
''Accessing the ~TiddlyWiki DOM''
The plugin provides one pre-defined variable, 'place', that is passed in to your javascript code so that it can have direct access to the containing DOM element into which the tiddler output is currently being rendered.
Access to this DOM element allows you to create scripts that can:
* vary their actions based upon the specific location in which they are embedded
* access 'tiddler-relative' information (use findContainingTiddler(place))
* perform direct DOM manipulations (when returning wikified text is not enough)
<<<
!!!!!Examples
<<<
an "alert" message box:
><script show>
alert('InlineJavascriptPlugin: this is a demonstration message');
</script>
dynamic output:
><script show>
return (new Date()).toString();
</script>
wikified dynamic output:
><script show>
return "link to current user: [["+config.options.txtUserName+"]]";
</script>
dynamic output using 'place' to get size information for current tiddler:
><script show>
if (!window.story) window.story=window;
var title=story.findContainingTiddler(place).id.substr(7);
return title+" is using "+store.getTiddlerText(title).length+" bytes";
</script>
creating an 'onclick' button/link that runs a script:
><script label="click here" title="clicking this link will show an 'alert' box" show>
if (!window.story) window.story=window;
alert("Hello World!\nlinktext='"+place.firstChild.data+"'\ntiddler='"+story.findContainingTiddler(place).id.substr(7)+"'");
return false;
</script>
loading a script from a source url:
>http://www.TiddlyTools.com/demo.js contains:
>>{{{function demo() { alert('this output is from demo(), defined in demo.js') } }}}
>>{{{alert('InlineJavascriptPlugin: demo.js has been loaded'); }}}
><script src="demo.js" show>
return "loading demo.js..."
</script>
><script label="click to execute demo() function" show>
demo();
return false;
</script>
<<<
!!!!!Installation
<<<
import (or copy/paste) the following tiddlers into your document:
''InlineJavascriptPlugin'' (tagged with <<tag systemConfig>>)
<<<
!!!!!Revision History
<<<
''2007.12.15 [1.7.0]'' autogenerate URI encoded HREF on links for onclick scripts. Drag links to browser toolbar to create bookmarklets. IMPORTANT NOTE: ''place'' is NOT defined when scripts are used as bookmarklets. In addition, double-quotes will cause syntax errors. Thanks to PaulReiber for debugging and brainstorming.
''2007.11.26 [1.6.2]'' when converting "document.write()" function calls in inline code, allow whitespace between "write" and "(" so that "document.write ( foobar )" is properly converted.
''2007.11.16 [1.6.1]'' when rendering "onclick scripts", pass label text through wikifyPlainText() to parse any embedded wiki-syntax to enable use of HTML entities or even TW macros to generate dynamic label text.
''2007.02.19 [1.6.0]'' added support for title="..." to specify mouseover tooltip when using an onclick (label="...") script
''2006.10.16 [1.5.2]'' add newline before closing '}' in 'function out_' wrapper. Fixes error caused when last line of script is a comment.
''2006.06.01 [1.5.1]'' when calling wikify() on script return value, pass hightlightRegExp and tiddler params so macros that rely on these values can render properly
''2006.04.19 [1.5.0]'' added 'show' parameter to force display of javascript source code in tiddler output
''2006.01.05 [1.4.0]'' added support 'onclick' scripts. When label="..." param is present, a button/link is created using the indicated label text, and the script is only executed when the button/link is clicked. 'place' value is set to match the clicked button/link element.
''2005.12.13 [1.3.1]'' when catching eval error in IE, e.description contains the error text, instead of e.toString(). Fixed error reporting so IE shows the correct response text. Based on a suggestion by UdoBorkowski
''2005.11.09 [1.3.0]'' for 'inline' scripts (i.e., not scripts loaded with src="..."), automatically replace calls to 'document.write()' with 'place.innerHTML+=' so script output is directed into tiddler content. Based on a suggestion by BradleyMeck
''2005.11.08 [1.2.0]'' handle loading of javascript from an external URL via src="..." syntax
''2005.11.08 [1.1.0]'' pass 'place' param into scripts to provide direct DOM access
''2005.11.08 [1.0.0]'' initial release
<<<
!!!!!Credits
<<<
This feature was developed by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]]
<<<
!!!!!Code
***/
//{{{
version.extensions.inlineJavascript= {major: 1, minor: 7, revision: 0, date: new Date(2007,12,15)};
config.formatters.push( {
name: "inlineJavascript",
match: "\\<script",
lookahead: "\\<script(?: src=\\\"((?:.|\\n)*?)\\\")?(?: label=\\\"((?:.|\\n)*?)\\\")?(?: title=\\\"((?:.|\\n)*?)\\\")?( show)?\\>((?:.|\\n)*?)\\</script\\>",
handler: function(w) {
var lookaheadRegExp = new RegExp(this.lookahead,"mg");
lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = lookaheadRegExp.exec(w.source)
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
var src=lookaheadMatch[1];
var label=lookaheadMatch[2];
var tip=lookaheadMatch[3];
var show=lookaheadMatch[4];
var code=lookaheadMatch[5];
if (src) { // load a script library
// make script tag, set src, add to body to execute, then remove for cleanup
var script = document.createElement("script"); script.src = src;
document.body.appendChild(script); document.body.removeChild(script);
}
if (code) { // there is script code
if (show) // show inline script code in tiddler output
wikify("{{{\n"+lookaheadMatch[0]+"\n}}}\n",w.output);
if (label) { // create a link to an 'onclick' script
// add a link, define click handler, save code in link (pass 'place'), set link attributes
var link=createTiddlyElement(w.output,"a",null,"tiddlyLinkExisting",wikifyPlainText(label));
link.onclick=function(){try{return(eval(this.code))}catch(e){alert(e.description?e.description:e.toString())}}
var fixup=code.replace(/document.write\s*\(/gi,'place.innerHTML+=(');
link.code="function _out(place){"+fixup+"\n};_out(this);"
link.setAttribute("title",tip?tip:"");
var URIcode='javascript:void(eval(decodeURIComponent(%22(function(){try{';
URIcode+=encodeURIComponent(encodeURIComponent(code.replace(/\n/g,' ')));
URIcode+='}catch(e){alert(e.description?e.description:e.toString())}})()%22)))';
link.setAttribute("href",URIcode);
link.style.cursor="pointer";
}
else { // run inline script code
var code="function _out(place){"+code.replace(/document.write\s*\(/gi,'place.innerHTML+=(')+"\n};_out(w.output);"
try { var out = eval(code); } catch(e) { out = e.description?e.description:e.toString(); }
if (out && out.length) wikify(out,w.output,w.highlightRegExp,w.tiddler);
}
}
w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
}
}
} )
//}}}
/***
|Name:|InstantTimestampPlugin|
|Description:|A handy way to insert timestamps in your tiddler content|
|Version:|1.0.10 ($Rev: 3646 $)|
|Date:|$Date: 2008-02-27 02:34:38 +1000 (Wed, 27 Feb 2008) $|
|Source:|http://mptw.tiddlyspot.com/#InstantTimestampPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!!Usage
If you enter {ts} in your tiddler content (without the spaces) it will be replaced with a timestamp when you save the tiddler. Full list of formats:
* {ts} or {t} -> timestamp
* {ds} or {d} -> datestamp
* !ts or !t at start of line -> !!timestamp
* !ds or !d at start of line -> !!datestamp
(I added the extra ! since that's how I like it. Remove it from translations below if required)
!!Notes
* Change the timeFormat and dateFormat below to suit your preference.
* See also http://mptw2.tiddlyspot.com/#AutoCorrectPlugin
* You could invent other translations and add them to the translations array below.
***/
//{{{
config.InstantTimestamp = {
// adjust to suit
timeFormat: 'DD/0MM/YY 0hh:0mm',
dateFormat: 'DD/0MM/YY',
translations: [
[/^!ts?$/img, "'!!{{ts{'+now.formatString(config.InstantTimestamp.timeFormat)+'}}}'"],
[/^!ds?$/img, "'!!{{ds{'+now.formatString(config.InstantTimestamp.dateFormat)+'}}}'"],
// thanks Adapted Cat
[/\{ts?\}(?!\}\})/ig,"'{{ts{'+now.formatString(config.InstantTimestamp.timeFormat)+'}}}'"],
[/\{ds?\}(?!\}\})/ig,"'{{ds{'+now.formatString(config.InstantTimestamp.dateFormat)+'}}}'"]
],
excludeTags: [
"noAutoCorrect",
"noTimestamp",
"html",
"CSS",
"css",
"systemConfig",
"systemConfigDisabled",
"zsystemConfig",
"Plugins",
"Plugin",
"plugins",
"plugin",
"javascript",
"code",
"systemTheme",
"systemPalette"
],
excludeTiddlers: [
"StyleSheet",
"StyleSheetLayout",
"StyleSheetColors",
"StyleSheetPrint"
// more?
]
};
TiddlyWiki.prototype.saveTiddler_mptw_instanttimestamp = TiddlyWiki.prototype.saveTiddler;
TiddlyWiki.prototype.saveTiddler = function(title,newTitle,newBody,modifier,modified,tags,fields,clearChangeCount,created) {
tags = tags ? tags : []; // just in case tags is null
tags = (typeof(tags) == "string") ? tags.readBracketedList() : tags;
var conf = config.InstantTimestamp;
if ( !tags.containsAny(conf.excludeTags) && !conf.excludeTiddlers.contains(newTitle) ) {
var now = new Date();
var trans = conf.translations;
for (var i=0;i<trans.length;i++) {
newBody = newBody.replace(trans[i][0], eval(trans[i][1]));
}
}
// TODO: use apply() instead of naming all args?
return this.saveTiddler_mptw_instanttimestamp(title,newTitle,newBody,modifier,modified,tags,fields,clearChangeCount,created);
}
// you can override these in StyleSheet
setStylesheet(".ts,.ds { font-style:italic; }","instantTimestampStyles");
//}}}
* {{{myArgs.java}}}
{{{
public class myArgs {
public static void main (String[] args) {
for (String arg: args) {
System.out.println(arg);
}
}
}
}}}
{{{$ java myArgs Hello World !}}}
> Hello
> World
> !
{{{
import java.io.*;
public class myParser {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new FileReader("myfile.txt"));
String line = "";
while ((line = reader.readLine()) != null) {
String[] words = line.split(" ");
System.out.println("[" + words[0]+" and " + words[2] + "]");
}
reader.close();
}
}
}}}
{{{ java myParser }}}
> [Col0 and Col2]
> [A and C]
!Source
{{{
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World");
}
}
}}}
!Compile
{{{ $ javac helloWorld.java }}}
This should create {{{helloWorld.class}}}
!Execute
{{{ $ java helloWorld }}}
! Variables
Are declared and typed
!! Primitive types
Don't need constructors...
{{{
int myInts[] = {26, 0x1a, 0b11010};
byte myByte = 100; // 8-bits signed [-2^7 ,2^7-1 ]
short myshorts[] = {102, 34}; // 16-bits signed [-2^15,2^15-1]
int myInteger = 112; // 32-bits signed [-2^31,2^31-1]
long myLongs[] = { 0l, 2L, 324L}; // 64-bits signed [-2^63,2^63-1]
float myFloats[] = {123.4f, 345.6F};
double myDoubles[] = {12.3, 12.3d, 12.3D, 123.4e2 , 123.4E2};
char myChar[] = {'C' , '\u0000'}; // 16-bits unicode ['\u0000','\uffff]
boolean myFlags[] = {true , false};
}}}
!! String class
{{{
String myString = "Hello";
char myChar = 'a';
char myChars[] = {'H','e','l','l','o'};
}}}
{{{
System.out.println("Con"+"cat us");
System.out.println("Sliceme".subtring(2,5));
}}}
> Concat us
> ice
!! Integer class
|Feature | int | Integer |
|Calculate with it, + - * / % ^ etc. | y | n |
|Pass it as a parameter | y | y |
|return it as a value | y | y |
|Use methods on it from java.lang.Integer | n | y |
|Store it in a Vector or other Collection | n | y |
|Use it as a ~HashMap key | n | y |
|serialize it | n | y |
|send it by itself over RMI (Remote Method Invocation) | n | y |
|send it as part of another Object over RMI | y | y |
|pass it as a generic object to a ~TableCellRenderer. You may pass a variety of different types via the same parameter. | n | y |
|Allow for a null value that means there is no value.| n | y |
{{{
import java.io.*;
public class myFlusher {
public static void main(String[] args) throws IOException {
File fileOut = new File("myfile.txt");
fileOut.createNewFile();
FileWriter writer = new FileWriter(fileOut);
writer.write("Col0 Col1 Col2 Col3\n");
writer.write("A B C D\n");
writer.flush();
writer.close();
}
}
}}}
{{{$ cat myfile.txt }}}
> Col0 Col1 Col2 Col3
> A B C D
{{{
(function(console){
console.save = function(data, filename){
if(!data) {
console.error('Console.save: No data')
return;
}
if(!filename) filename = 'console.json'
if(typeof data === "object"){
data = JSON.stringify(data, undefined, 4)
}
var blob = new Blob([data], {type: 'text/json'}),
e = document.createEvent('MouseEvents'),
a = document.createElement('a')
a.download = filename
a.href = window.URL.createObjectURL(blob)
a.dataset.downloadurl = ['text/json', a.download, a.href].join(':')
e.initMouseEvent('click', true, false,
window, 0, 0, 0, 0, 0,
false, false, false, false, 0, null)
a.dispatchEvent(e)
}
})(console)
}}}
!Culture
* Interpreted language for client-side web scripting.
* First introduced and deployed on Netscape in 1995.
* Engines: ~SpiderMonkey ( FF ) , V8 ( Chrome ) , ~WebKit ( Safari )
!Usage
*file.html
{{{
<BODY>
<SCRIPT language=javascript>
document.write("Hello World");
</SCRIPT>
</BODY>
}}}
//Hello World
!Semicolons
* Statements are terminated by a {{{;}}}
* Terminal {{{;}}} is optional where it doesn't "bother" the parser, that is before:
** line break
** }
** end of program
!Booleans
* Evaluates to True:
{{{
'0';
'any string';
[]; // an empty array
{}; // an empty object
1; // any non-zero number
}}}
* Evaluates to False:
{{{
0;
''; // an empty string
NaN; // JavaScript's "not-a-number" variable
null;
undefined; // be careful -- undefined can be redefined!
}}}
!Strings
{{{
<BODY>
<SCRIPT language=javascript>
var mystr1=new String("Hello");
var mystr2="World";
document.write(mystr1+" "+mystr2);
</SCRIPT>
</BODY>
}}}
!Arrays
{{{
<SCRIPT language=javascript>
var basket=new Array("strawberry", "blackberry", "apricot", "banana");
document.write("There are "+basket.length+" fruits in the basket");
</SCRIPT>
}}}
!Numbers
{{{
<SCRIPT TYPE="text/javascript">
document.write('2^3 = '+Math.pow(2, 3)+'<BR>');
document.write('2^(1/2) = '+Math.round(Math.pow(2, 0.5)*100)/100+' = sqrt(2) <BR>');
document.write('4^(-1) = '+Math.pow(4, -1)+' = 1/4 <BR>');
</SCRIPT>
}}}
!Date
{{{
<SCRIPT language=javascript>
var zdate=new Date()
document.write("Now is ");
document.write(zdate.getDate()+"/"+(zdate.getMonth()+1)+"/"+zdate.getFullYear())
</SCRIPT>
}}}
!Object
{{{
var myObject = {
sayHello : function() {
console.log('hello');
},
myName : 'Rebecca'
};
myObject.sayHello(); // logs 'hello'
console.log(myObject.myName); // logs 'Rebecca'
}}}
*Gotcha! Key entry can be strings,numbers, or valid identifiers
! If - then - else
{{{
<SCRIPT language=javascript>
var zdate = new Date();
var ztime = zdate.getHours();
if (ztime<12) {
document.write("AM");
} else {
document.write("PM");
}
</SCRIPT>
}}}
! Boolean Operators
| NOT|{{{!}}} |
| OR|{{{||}}} |
| AND|{{{&&}}} |
! Case
{{{
<SCRIPT language=javascript>
var zdate=new Date();
var zday=zdate.getDay();
switch(zday) {
case 0:
document.write("Sunday !");
break;
case 6:
document.write("Saturday !");
break;
default:
document.write("Work");
break;
}
document.write("<BR>");
</SCRIPT>
}}}
{{editbutton{<<editTiddler JsConditional>>}}}
!For
{{{
<SCRIPT language=javascript>
for (i=0; i<10; i++) {
document.write(i + " ; ");
}
document.write("<BR>");
</SCRIPT>
}}}
!While
{{{
<SCRIPT language=javascript>
var i = 500;
while (i>5) {
document.write(i + ";");
i = i / 2;
}
</SCRIPT>
}}}
!!Function
* Declaration possibilities
{{{
function foo() { /* do something */ }
}}}
or
{{{
var foo = function() { /* do something */ }
}}}
* Simple function
{{{
var greet = function(person, greeting) {
var text = greeting + ', ' + person;
console.log(text);
};
greet('Rebecca', 'Hello');
}}}
* Function that returns a value
{{{
var greet = function(person, greeting) {
var text = greeting + ', ' + person;
return text;
};
console.log(greet('Rebecca','hello'));
}}}
* Function that returns a function
{{{
var greet = function(person, greeting) {
var text = greeting + ', ' + person;
return function() { console.log(text); };
};
var greeting = greet('Rebecca', 'Hello');
greeting();
}}}
* Self-executing function ( immediately executed and preserves global space)
{{{
(function(){
var foo = 'Hello world';
})();
console.log(foo); // undefined!
}}}
* Anonymous function as argument
{{{
var myFn = function(fn) {
var result = fn();
console.log(result);
};
myFn(function() { return 'hello world'; }); // logs 'hello world'
}}}
* Named function as argument
{{{
var myFn = function(fn) {
var result = fn();
console.log(result);
};
var myOtherFn = function() {
return 'hello world';
};
myFn(myOtherFn); // logs 'hello world'
}}}
{{{
<html>
<head>
<script type="text/javascript" src="jquery-1.6.4.min.js"></script>
</head>
<body>
<canvas id="canvas" width="300" height="300"></canvas>
<script type="text/javascript">
var x = 25;
var y = 250;
var dx = 1.5;
var dy = -4;
var ctx;
var WIDTH;
var HEIGHT;
var paddlex;
var paddleh = 10;
var paddlew = 75;
var rightDown = false;
var leftDown = false;
var canvasMinX = 0;
var canvasMaxX = 0;
var intervalId = 0;
var bricks;
var NROWS = 5;
var NCOLS = 5;
var BRICKWIDTH;
var BRICKHEIGHT = 15;
var PADDING = 1;
function init() {
ctx = $('#canvas')[0].getContext("2d");
WIDTH = $("#canvas").width();
HEIGHT = $("#canvas").height();
paddlex = WIDTH / 2;
BRICKWIDTH = (WIDTH/NCOLS) - 1;
canvasMinX = $("#canvas").offset().left;
canvasMaxX = canvasMinX + WIDTH;
intervalId = setInterval(draw, 10);
return intervalId;
}
function circle(x,y,r) {
ctx.beginPath();
ctx.arc(x, y, r, 0, Math.PI*2, true);
ctx.closePath();
ctx.fill();
}
function rect(x,y,w,h) {
ctx.beginPath();
ctx.rect(x,y,w,h);
ctx.closePath();
ctx.fill();
}
function clear() {
ctx.clearRect(0, 0, WIDTH, HEIGHT);
rect(0,0,WIDTH,HEIGHT);
}
function onKeyDown(evt) {
if (evt.keyCode == 39) rightDown = true;
else if (evt.keyCode == 37) leftDown = true;
}
function onKeyUp(evt) {
if (evt.keyCode == 39) rightDown = false;
else if (evt.keyCode == 37) leftDown = false;
}
$(document).keydown(onKeyDown);
$(document).keyup(onKeyUp);
function onMouseMove(evt) {
if (evt.pageX > canvasMinX && evt.pageX < canvasMaxX) {
paddlex = Math.max(evt.pageX - canvasMinX - (paddlew/2), 0);
paddlex = Math.min(WIDTH - paddlew, paddlex);
}
}
$(document).mousemove(onMouseMove);
function initbricks() {
bricks = new Array(NROWS);
for (i=0; i < NROWS; i++) {
bricks[i] = new Array(NCOLS);
for (j=0; j < NCOLS; j++) {
bricks[i][j] = 1;
}
}
}
function drawbricks() {
for (i=0; i < NROWS; i++) {
ctx.fillStyle = rowcolors[i];
for (j=0; j < NCOLS; j++) {
if (bricks[i][j] == 1) {
rect((j * (BRICKWIDTH + PADDING)) + PADDING,
(i * (BRICKHEIGHT + PADDING)) + PADDING,
BRICKWIDTH, BRICKHEIGHT);
}
}
}
}
var ballr = 10;
var rowcolors = ["#FF1C0A", "#FFFD0A", "#00A308", "#0008DB", "#EB0093"];
var paddlecolor = "#FFFFFF";
var ballcolor = "#FFFFFF";
var backcolor = "#000000";
function draw() {
ctx.fillStyle = backcolor;
clear();
ctx.fillStyle = ballcolor;
circle(x, y, ballr);
if (rightDown) paddlex += 5;
else if (leftDown) paddlex -= 5;
ctx.fillStyle = paddlecolor;
rect(paddlex, HEIGHT-paddleh, paddlew, paddleh);
drawbricks();
//want to learn about real collision detection? go read
// http://www.metanetsoftware.com/technique/tutorialA.html
rowheight = BRICKHEIGHT + PADDING;
colwidth = BRICKWIDTH + PADDING;
row = Math.floor(y/rowheight);
col = Math.floor(x/colwidth);
//reverse the ball and mark the brick as broken
if (y < NROWS * rowheight && row >= 0 && col >= 0 && bricks[row][col] == 1) {
dy = -dy;
bricks[row][col] = 0;
}
if (x + dx + ballr > WIDTH || x + dx - ballr < 0)
dx = -dx;
if (y + dy - ballr < 0)
dy = -dy;
else if (y + dy + ballr > HEIGHT - paddleh) {
if (x > paddlex && x < paddlex + paddlew) {
//move the ball differently based on where it hit the paddle
dx = 8 * ((x-(paddlex+paddlew/2))/paddlew);
dy = -dy;
}
else if (y + dy + ballr > HEIGHT)
clearInterval(intervalId);
}
x += dx;
y += dy;
}
init();
initbricks();
</script>
</body>
</html>
}}}
{{{
// content is the data you'll write to file<br/>
// filename is the filename<br/>
// what I did is use iFrame as a buffer, fill it up with text
function save_content_to_file(content, filename)
{
var dlg = false;
with(document){
ir=createElement('iframe');
ir.id='ifr';
ir.location='about.blank';
ir.style.display='none';
body.appendChild(ir);
with(getElementById('ifr').contentWindow.document){
open("text/plain", "replace");
charset = "utf-8";
write(content);
close();
document.charset = "utf-8";
dlg = execCommand('SaveAs', false, filename+'.txt');
}
body.removeChild(ir);
}
return dlg;
}
}}}
{{{
save_content_to_file("Hello", "C:\\test");
}}}
{{{
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Slider controlled graph</title>
<style>
#bundle span {height:300px; float:left; margin:15px; }
#valueBox {width:100px; }
.value {border: 0; color: #f6931f; font-weight: bold;}
.face {fill: #ccc; stroke: #555; }
.frame {fill: #eee; stroke: #888; }
svg {stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
}
</style>
<!-- jquery -->
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
<!-- Populate Control Box -->
<script>
$(function() {
$( "#controlBox > span" ).each(function() {
// read initial values from markup and remove that
var paramId = $( this ).attr('paramId')
var defVal = parseFloat( $( this ).attr('defVal'))
var minVal = parseFloat( $( this ).attr('minVal'))
var maxVal = parseFloat( $( this ).attr('maxVal'))
var stepVal = parseFloat( $( this ).attr('stepVal'))
// Create display for values
var viewVal = "<li> <label for=\""+paramId+"\">"+paramId+":</label>"
viewVal += "<input size=\"5\" type=\"text\" id="+paramId+" class=\"value\" /></li>"
$("#valueBox").append(viewVal)
// Initialize display
$('#' + paramId).val( defVal )
// Inject slider
$( this ).empty().slider({ value: defVal, min: minVal, max: maxVal, step: stepVal,
animate: true,
orientation: "vertical",
slide: function( event, ui ) {
// Refresh displayed value on change
var paramId = $(event.target).attr("paramId")
$('#' + paramId).val( ui.value )
updateRender()
}
})
})
})
function updateRender() {
// replace pathes with executed expressions
$("[d_exp]").each(function(){
$(this).attr("d",eval($(this).attr("d_exp")))
})
}
// shortcut for d_exp
function p(x) { return( $('#'+x).val() ) }
$(document).ready(updateRender)
</script>
</head>
<body>
<p class="ui-state-default ui-corner-all" style="padding: 4px; margin-top: 4em;">
Shape it
</p>
<div id="bundle">
<span>
<div id="controlBox">
<!-- Duplicate and tune lines to get more parameters -->
<span paramId="W" stepVal="0.1" minVal="10" maxVal="50" defVal="40"/> PlaceHolder </span>
<span paramId="H" stepVal="0.1" minVal="10" maxVal="50" defVal="30"/> PlaceHolder </span>
<span paramId="D" stepVal="0.1" minVal="5" maxVal="15" defVal="15"/> PlaceHolder </span>
</div>
</span>
<span> <div id="valueBox"> </div> </span>
<span>
<div id="viewBox" >
<svg id="frame" width="300" height="300">
<path class="frame" d="M 0 0 L 0 300 300 300 300 0 Z"/>
<!-- Set origin with lower-left corner margin, and flip to math-like coordinates -->
<g id="obj" width="300" height="300" transform="translate(30,270) scale(2,-2)">
<!-- Parametric drawing comes here -->
<path class="face" d_exp="['M 0 0 l',0,p('H'),p('W'),0,0,0-p('H'),'z'].join(' ')"/>
<path class="face" d_exp="['M',0,p('H'),'l',p('D'),p('D'),p('W'),0,0-p('D'),0-p('D'),0-p('W'),0,'z'].join(' ')"/>
<path class="face" d_exp="['M',p('W'),0,'l',p('D'),p('D'),0,p('H'),0-p('D'),0-p('D'),0,0-p('H'),'z'].join(' ')"/>
</g>
</svg>
</div>
</span>
</div>
</body>
</html>
}}}
* Pronounced as the name jason
* in-script
{{{
var myjson = JSON.parse('{"key1":"val1","key2":12,"key3":["A","B","3"]}')
myjson["key1"] => "val1"
myjson["key2"]+1 => 13
myjson["key3"][1] => "B"
}}}
/***
|Name:|LessBackupsPlugin|
|Description:|Intelligently limit the number of backup files you create|
|Version:|3.0.1 ($Rev: 2320 $)|
|Date:|$Date: 2007-06-18 22:37:46 +1000 (Mon, 18 Jun 2007) $|
|Source:|http://mptw.tiddlyspot.com/#LessBackupsPlugin|
|Author:|Simon Baird|
|Email:|simon.baird@gmail.com|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!!Description
You end up with just backup one per year, per month, per weekday, per hour, minute, and second. So total number won't exceed about 200 or so. Can be reduced by commenting out the seconds/minutes/hours line from modes array
!!Notes
Works in IE and Firefox only. Algorithm by Daniel Baird. IE specific code by by Saq Imtiaz.
***/
//{{{
var MINS = 60 * 1000;
var HOURS = 60 * MINS;
var DAYS = 24 * HOURS;
if (!config.lessBackups) {
config.lessBackups = {
// comment out the ones you don't want or set config.lessBackups.modes in your 'tweaks' plugin
modes: [
["YYYY", 365*DAYS], // one per year for ever
["MMM", 31*DAYS], // one per month
["ddd", 7*DAYS], // one per weekday
//["d0DD", 1*DAYS], // one per day of month
["h0hh", 24*HOURS], // one per hour
["m0mm", 1*HOURS], // one per minute
["s0ss", 1*MINS], // one per second
["latest",0] // always keep last version. (leave this).
]
};
}
window.getSpecialBackupPath = function(backupPath) {
var now = new Date();
var modes = config.lessBackups.modes;
for (var i=0;i<modes.length;i++) {
// the filename we will try
var specialBackupPath = backupPath.replace(/(\.)([0-9]+\.[0-9]+)(\.html)$/,
'$1'+now.formatString(modes[i][0]).toLowerCase()+'$3')
// open the file
try {
if (config.browser.isIE) {
var fsobject = new ActiveXObject("Scripting.FileSystemObject")
var fileExists = fsobject.FileExists(specialBackupPath);
if (fileExists) {
var fileObject = fsobject.GetFile(specialBackupPath);
var modDate = new Date(fileObject.DateLastModified).valueOf();
}
}
else {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(specialBackupPath);
var fileExists = file.exists();
if (fileExists) {
var modDate = file.lastModifiedTime;
}
}
}
catch(e) {
// give up
return backupPath;
}
// expiry is used to tell if it's an 'old' one. Eg, if the month is June and there is a
// June file on disk that's more than an month old then it must be stale so overwrite
// note that "latest" should be always written because the expiration period is zero (see above)
var expiry = new Date(modDate + modes[i][1]);
if (!fileExists || now > expiry)
return specialBackupPath;
}
}
// hijack the core function
window.getBackupPath_mptw_orig = window.getBackupPath;
window.getBackupPath = function(localPath) {
return getSpecialBackupPath(getBackupPath_mptw_orig(localPath));
}
//}}}
/***
|''Name:''|LoadRemoteFileThroughProxy (previous LoadRemoteFileHijack)|
|''Description:''|When the TiddlyWiki file is located on the web (view over http) the content of [[SiteProxy]] tiddler is added in front of the file url. If [[SiteProxy]] does not exist "/proxy/" is added. |
|''Version:''|1.1.0|
|''Date:''|mar 17, 2007|
|''Source:''|http://tiddlywiki.bidix.info/#LoadRemoteFileHijack|
|''Author:''|BidiX (BidiX (at) bidix (dot) info)|
|''License:''|[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D ]]|
|''~CoreVersion:''|2.2.0|
***/
//{{{
version.extensions.LoadRemoteFileThroughProxy = {
major: 1, minor: 1, revision: 0,
date: new Date("mar 17, 2007"),
source: "http://tiddlywiki.bidix.info/#LoadRemoteFileThroughProxy"};
if (!window.bidix) window.bidix = {}; // bidix namespace
if (!bidix.core) bidix.core = {};
bidix.core.loadRemoteFile = loadRemoteFile;
loadRemoteFile = function(url,callback,params)
{
if ((document.location.toString().substr(0,4) == "http") && (url.substr(0,4) == "http")){
url = store.getTiddlerText("SiteProxy", "/proxy/") + url;
}
return bidix.core.loadRemoteFile(url,callback,params);
}
//}}}
python 2
{{{python -m SimpleHTTPServer 8888 }}}
python 3
{{{python -m http.server 8888 }}}
php
{{{php -S localhost:8888 }}}
ruby
{{{ruby -run -e httpd . -p 8888}}}
node
{{{npm install http-server -g }}}
{{{http-server}}}
java+jetty
{{{java -jar jetty-runner-9.3.0.M0.jar --port 8080 .}}}
MPTW is a distribution or edition of TiddlyWiki that includes a standard TiddlyWiki core packaged with some plugins designed to improve usability and provide a better way to organise your information. For more information see http://mptw.tiddlyspot.com/.
[[Programming]] [[Mathematics]] [[Engineering]] [[Cooking]] [[About]] <<tiddler ToggleRightSidebar>>
300g de riz + 4 plaques d'algue => 32 Maki
!!Definitions
*__GF(2):__ For GF(2), the coefficients are either 0 or 1 and the rules for multiplication and addition are 0 = 0+0 = 1+1 = 0*0 = 0*1 = 1*0 and 1 = 0+1 = 1+0 = 1*1.
*__irreducible:__ A polynomial over GF(2) is irreducible if it cannot be factored into non-trivial polynomials. For example, x^^2^^+x+1 is irreducible, but x^^2^^+1 is not, since x^^2^^+1 = (x+1)(x+1).
*__irreducible (bis):__ If deg(p)=m and p(x)=(x^^2^(m-1)^^-1)*r(x), then p(x) is irreducible.
*__minimal:__ If p(x) is the polynomial of lowest possible degree such as p(a)=0, then p(x) is the minimal polynomial for a. Any other polynomial such as q(a)=0 is a multiple of p(x).
*__order:__ The order of a polynomial f(x) for which f(0) is not 0 is the smallest integer e for which f(x) divides x^^e^^+1.
*__primitive:__ A polynomial over GF(2) is primitive if it has order 2^^n^^-1. For example, x^^2^^+x+1 has order 3 = 2^^2^^-1 since (x^^2^^+x+1)(x+1) = x^^3^^+1. Thus x^^2^^+x+1 is primitive.
*__tolient function:__ Euler's totient function ∅(m) is the number of numbers less than m and relatively prime to m.
*__primitive density:__ The number of primitive polynomials over GF(2) is ∅(2^^n^^-1)/n. For n=1,2,...,15 is 1, 1, 2, 2, 6, 6, 18, 16, 48, 60, 176, 144, 630, 756, 1800.
*__classification:__ polynomials ⊃ irreducibles ⊃ minimals ⊃ primitives ( ? ⊃ Maximum sequence length )
!!Irreducibles Introduction
From the following tables all irreducible polynomials of degree 16 or less over GF(2) can be found, and certain of their properties and relations among them are given. A primitive polynomial with a minimum number of nonzero coefficients and polynomials be-longing to all possible exponents is given for each degree 17 through 34.
Polynomials are given in an octal representation. The binary digits then are the coefficients of the polynomial, with the high-order coefficients at the left.
//__Example:__// in the 10th-degree list {{{3525}}} = {{{011 101 010 101}}} = X^^10^^+X^^9^^+X^^8^^+X^^6^^+X^^4^^+X^^2^^+1.
----
The reciprocal polynomial of an irreducible polynomial is also irreducible, and the reciprocal polynomial of a primitive polynomial is primitive. Of any pair consisting of a polynomial and its reciprocal polynomial, only one is listed in the table. Each entry that is followed by a letter in the table is an irreducible polynomial of the indicated degree. For degree 2 through 16, these polynomials along with their reciprocal polynomials comprise all irreducible polynomials of that degree. The letters following the octal representation give the following information:
| A, B, C, D |Not primitive |
| E, F, G, H |Primitive |
| A, B, E, F |The roots are linearly dependent |
| C, D, G, H |The roots are linearly independent |
| A, C, E, G |The roots of the reciprocal polynomial are linearly dependent |
| B, D, F, H |The roots of the reciprocal polynomial are linearly independent |
The other numbers in the table tell the relation between the polynomials. For each degree, a primitive polynomial with a minimum number of nonzero coefficients was chosen, and this polynomial is the first in the table of polynomials of this degree. Let //a// denote one of its roots. Then the entry following j in the table is the minimum polynomial of //a//^^j^^. The polynomials are included for each j unless for some i < j either //a//^^i^^ and //a//^^j^^ are roots of the same irreducible polynomial or //a//^^i^^ and //a//^^-j^^ are roots of the same polynomial. The minimum polynomial of //a//^^j^^ is included even if it has smaller degree than is indicated for that section of the table; such polynomials are not followed by a letter in the table.
//__Example:__// The primitive polynomial {{{103}}} = X^^6^^+X+1 = p(X) is the first entry in the table of 6th-degree irreducible polynomials. If //a// designates a root of p(X), then //a//^^3^^ is a root of {{{127}}} and //a//^^5^^ is a root of {{{147}}}. The minimum polynomial of //a//^^9^^ is {{{015}}} = X^^3^^+X^^2^^+1, and is of degree 3 rather than 6.
//__Example:__// There is no entry corresponding to //a//^^17^^. The other roots of the minimum polynomial of //a//^^17^^ are //a//^^34^^, //a//^^68^^ = //a//^^5^^, //a//^^10^^, //a//^^20^^, and //a//^^40^^. Thus the minimum polynomial of //a//^^17^^ is the same as the minimum polynomial of //a//^^5^^, or {{{147}}}.
//__Example:__// There is no entry corresponding to //a//^^13^^. The other roots of the minimum polynomial p~~13~~(X) of //a//^^13^^ are //a//^^26^^, //a//^^52^^, //a//^^104^^ = //a//^^41^^, //a//^^82^^ = //a//^^19^^ , and //a//^^38^^. None of these is listed. The roots of the reciprocal polynomial P~~13~~*(X) of P~~13~~(X) are //a//^^-13^^ = //a//^^50^^, //a//^^-26^^ = //a//^^37^^, //a//^^-52^^ = //a//^^11^^, //a//^^-41^^ = //a//^^22^^, //a//^^-19^^ = //a//^^44^^ and //a//^^-38^^ = //a//^^25^^. The minimum polynomial of //a//^^11^^ is listed as {{{155}}} or X^^6^^+X^^5^^+ X^^3^^+X^^2^^+1. The minimum polynomial of //a//^^13^^ is the reciprocal polynomial of this, or p~~13~~(X) = X^^6^^+X^^4^^+X^^3^^+X+1.
----
The exponent to which a polynomial belongs can be found as follows: If a is a primitive element of GF(2^^m^^), then the order e of //a//^^j^^ is e = (2^^m^^-1)/GCD(2^^m^^-1, j) and e is also the exponent to which the minimum function of //a//^^j^^ belongs. Thus, for example, in GF(2^^10^^), //a//^^55^^ has order 93, since 93 = 1023/GCD(1023, 55) = 1023/11. Thus the polynomial {{{3453}}} belongs to 93.
----
Marsh has published a table of all irreducible polynomials of degree 19 or less over GF(2). In this table the polynomials are arranged in lexicographical order; this is the most convenient form for determining whether or not a given polynomial is irreducible.
For degree 19 or less, the minimum-weight polynomials given in this table were found in Marsh's tables. For degree 19 through 34, the minimum-weight polynomial was found by a trial-and-error process in which each polynomial of weight 3, then 5, was tested.
The following procedure was used to test whether a polynomial f(X) of degree m is primitive:
*''1'' The residues of 1, X, X^^2^^, X^^4^^, ... , X^^2m-1^^ are formed modulo f(X).
*''2'' These are multiplied and reduced modulo f(X) to form the residue of X^^2^m-1^^. If the result is not 1, the polynomial is rejected. If the result is 1, the test is continued.
*''3'' For each factor //r// of 2^^m^^-1, the residue of X^^r^^ is formed by multiplying together an appropriate combination of the residues formed in Step 1. If none of these is 1, the polynomial is primitive.
Each other polynomial in the table was found by solving for the dependence relations among its roots by the method illustrated at the end of Section 8.1 in Peterson.
----
|Table Factorization of 2^^m^^-1 into Primes|c
|2^^3^^ - 1 = 7 |2^^19^^ - 1 = 524287 |
|2^^4^^ - 1 = 3x5 |2^^20^^ - 1 = 3x5x5x11x31x41|
|2^^5^^ - 1 = 31 |2^^21^^ - 1 = 7X7X127x337 |
|2^^6^^ - 1 = 3x3x7 |2^^22^^ - 1 = 3x23x89x683 |
|2^^7^^ - 1 = 127 |2^^23^^ - 1 = 47x178481 |
|2^^8^^ - 1 = 3x5x17 |2^^24^^ - 1 = 3x3x5x7x13x17x241|
|2^^9^^ - 1 = 7x73 |2^^25^^ - 1 = 31x601x1801 |
|2^^10^^ - 1 = 3x11x3 |2^^26^^ - 1 = 3x2731x8191 |
|2^^11^^ - 1 = 23x89 |2^^27^^ - 1 = 7x73x262657 |
|2^^12^^ - 1 = 3x3x5x7x13 |2^^28^^ - 1 = 3x5x29x43x113x127 |
|2^^13^^ - 1 = 8191 |2^^29^^ - 1 = 233x1103x2089 |
|2^^14^^ - 1 = 3x43x127 |2^^30^^ - 1 = 3x3x7x11x31x151x331 |
|2^^15^^ - 1 = 7x31x15 |2^^31^^ - 1 = 2147483647 |
|2^^16^^ - 1 = 3x5x17x257 |2^^32^^ - 1 = 3x5x17x257x65537 |
|2^^17^^ - 1 = 131071 |2^^33^^ - 1 = 7x23x89x599479 |
|2^^18^^ - 1 = 3x3x3x7x19x73 |2^^34^^ - 1 = 3x43691x131071 |
!! Irreducible Table
{{{
DEGREE 2 1 7H
DEGREE 3 1 13F
DEGREE 4 1 23F 3 37D 5 07
DEGREE 5 1 45E 3 75G 5 67H
DEGREE 6 1 103F 3 1278 5 147H 7 111A 9 015
11 155E 21 007
DEGREE 7 1 211E 3 217E 5 235E 7 367H 9 277E
11 325G 13 203F 19 313H 21 345G
DEGREE 8 1 435E 3 567B 5 763D 7 551E 9 675C
11 747H 13 453F 15 727D 17 023 19 545E 21 613D
23 543F 25 433B 27 477B 37 537F 43 703H 45 471A
51 037 85 007
DEGREE 9 1 1021E 3 1131E 5 1461G 7 1231A 9 1423G
11 1055E 13 1167F 15 1541E 17 1333F 19 1605G 21 1027A
23 1751E 25 1743H 27 1617H 29 1553H 35 1401C 37 1157F
39 1715E 41 1563H 43 1713H 45 1175E 51 1725G 53 1225E
55 1275E 73 0013 75 1773G 77 1511C 83 1425G 85 1267E
DEGREE 10 1 2011E 3 2017B 5 2415E 7 3771G 9 2257B
11 2065A 13 2157F 15 2653B 17 3515G 19 2773F 21 3753D
23 2033F 25 2443F 27 3573D 29 2461E 31 3043D 33 0075C
35 3023H 37 3543F 39 21078 41 2745E 43 2431E 45 3061C
47 3177H 49 3525G 51 2547B 53 2617F 55 3453D 57 3121C
59 3471G 69 2701A 71 3323H 73 3507H 75 2437B 77 2413B
83 3623H 85 2707E 87 2311A 89 2327F 91 3265G 93 3777D
99 0067 101 2055E 103 3575G 105 3607C 107 3171G 109 2047F
147 2355A 149 3025G 155 2251A 165 0051 171 3315C 173 3337H
179 3211G 341 0007
DEGREE 11 1 4005E 3 4445E 5 4215E 7 4055E 9 6015G
11 7413H 13 4143F 15 4563F 17 4053F 19 5023F 21 5623F
23 4757B 25 4577F 27 6233H 29 6673H 31 7237H 33 7335G
35 4505E 37 5337F 39 5263F 41 5361E 43 5171E 45 6637H
47 7173H 49 5711E 51 5221E 53 6307H 55 6211G 57 5747F
59 4533F 61 4341E 67 6711G 69 6777D 71 7715G 73 6343H
75 6227H 77 6263H 79 5235E 81 7431G 83 6455G 85 5247F
87 5265E 89 5343B 91 4767F 93 5607F 99 4603F 101 6561G
103 7107H 105 704IG 107 4251E 109 5675E 111 4173F 113 4707F
115 7311C 117 5463F 119 5755E 137 6675G 139 7655G 141 5531E
147 7243H 149 762IG 151 7161G 153 4731E 155 4451E 157 6557H
163 7745G 165 7317H 167 5205E 169 4565E 171 6765G 173 7535G
179 4653F 181 5411E 183 5545E 185 7565G 199 6543H 201 5613F
203 6013H 205 7647H 211 6507H 213 6037H 215 7363H 217 7201G
219 7273H 293 7723H 299 4303B 301 5007F 307 7555G 309 4261E
331 6447H 333 5141E 339 7461G 341 5253F
DEGREE 12 1 10123F 3 12133B 5 10115A 7 121538 9 11765A
11 15647E 13 12513B 15 13077B 17 16533H 19 16047H 21 10065A
23 11015E 25 13377B 27 14405A 29 14127H 31 17673H 33 13311A
35 10377B 37 13565E 39 13321A 41 15341G 43 15053H 45 15173C
47 15621E 49 17703C 51 10355A 53 15321G 55 10201A 57 12331A
59 11417E 61 13505E 63 10761A 65 00141 67 13275E 69 16663C
71 11471E 73 16237E 75 16267D 77 15115C 79 12515E 81 17545C
83 12255E 85 11673B 87 17361A 89 11271E 91 10011A 93 14755C
95 17705A 97 1712IG 99 17323D 101 14227H 103 12117E 105 13617A
107 14135G 109 14711G Ill 15415C 113 13131E 115 13223A 117 16475C
119 14315C 121 16521E 123 13475A 133 114338 135 10571A 137 15437G
139 12067F 141 13571A 143 12111A 145 16535C 147 17657D 149 12147F
151 14717F 153 13517B 155 14241C 157 14675G 163 10663F 165 10621A
167 16115G 169 16547C 171 10213B 173 12247E 175 16757D 177 16017C
179 17675E 181 10151E 183 14111A 185 14037A 187 14613H 189 13535A
195 00165 197 11441E 199 10321E 201 14067D 203 13157B 205 14513D
207 10603A 209 11067F 211 14433F 213 16457D 215 10653B 217 13563B
219 116578 221 17513C 227 12753F 229 13431E 231 10167B 233 11313F
235 11411A 237 13737B 239 13425E 273 00023 275 14601C 277 16021G
279 16137D 281 17025G 283 15723F 285 17141A 291 15775A 293 11477F
295 11463B 297 17073C 299 16401C 301 12315A 307 14221E 309 11763B
311 12705E 313 14357F 315 17777D 325 00163 327 17233D 329 11637B
331 16407F 333 11703A 339 16003C 341 11561E 343 12673B 345 14537D
347 1771IG 349 13701E 355 10467B 357 15347C 359 11075E 361 16363F
363 11045A 365 11265A 371 14043D 397 12727F 403 14373D 405 13003B
407 17057G 409 10437F 411 10077B 421 14271G 423 14313D 425 14155C
427 10245A 429 11073B 435 10743B 437 12623F 439 12007F 441 15353D
455 00111 585 00013 587 14545G 589 1631IG 595 13413A 597 12265A
603 14411C 613 15413H 619 17147F 661 10605E 683 10737F 685 16355C
691 15701G 693 12345A 715 00133 717 16571C 819 00037 1365 00007
DEGREE 13 1 20033F 3 23261E 5 24623F 7 23517F 9 30741G
11 21643F 13 3017IG 15 21277F 17 27777F 19 35051G 21 34723H
23 34047H 25 32535G 27 31425G 29 37505G 31 36515G 33 26077F
35 35673H 37 20635E 39 33763H 41 25745E 43 36575G 45 26653F
47 21133F 49 22441E 51 30417H 53 32517H 55 37335G 57 25327F
59 23231E 61 25511E 63 26533F 65 33343H 67 33727H 69 27271E
71 25017F 73 26041E 75 21103F 77 27263F 79 24513F 81 32311G
83 31743H 85 24037F 87 30711G 89 32641G 91 24657F 93 32437H
95 20213F 97 25633F 99 31303H 101 22525E 103 34627H 105 25775E
107 21607F 109 25363F Ill 27217F 113 33741G 115 37611G 117 23077F
119 21263F 121 31011G 123 27051E 125 35477H 131 3415IG 133 27405E
135 34641G 137 32445G 139 36375G 141 22675E 143 36073H 145 35121G
147 3650IG 149 33057H 151 36403H 153 35567H 155 23167F 157 36217H
159 22233F 161 32333H 163 24703F 165 33163H 167 32757H 169 23761E
171 24031E 173 30025G 175 37145G 177 31327H 179 27221E 181 25577F
183 22203F 185 37437H 187 27537F 189 31035G 195 24763F 197 20245E
199 20503F 201 20761E 203 25555E 205 30357H 207 33037H 209 34401G
211 32715G 213 21447F 215 27421E 217 20363F 219 3350IG 221 20425E
223 32347H 225 20677F 227 22307F 229 33441G 231 33643H 233 24165E
235 27427F 237 24601E 239 36721G 241 34363H 243 21673F 245 32167H
247 21661E 265 33357H 267 26341E 269 31653H 271 37511G 273 23003F
275 22657F 277 25035E 279 23267F 281 34005G 283 34555G 285 24205E
291 26611E 293 3267IG 295 25245E 297 31407H 299 33471G 301 22613F
303 35645G 305 3237IG 307 34517H 309 26225E 311 35561G 313 25663F
315 24043F 317 30643H 323 20157F 325 37151G 327 24667F 329 33325G
331 32467H 333 30667H 335 22631E 337 26617F 339 20275E 341 36625G
343 20341E 345 37527H 347 31333H 349 31071G 355 23353F 357 26243F
359 21453F 361 36015G 363 36667H 365 34767H 367 34341G 369 34547H
371 35465G 373 24421E 375 23563F 377 36037H 391 31267H 393 27133F
395 30705G 397 30465G 399 35315G 401 3223IG 403 32207H 405 26101E
407 22567F 409 21755E 411 22455E 413 33705G 419 37621G 421 21405E
423 30117H 425 23021E 427 21525E 429 36465G 431 33013H 433 27531E
435 24675E 437 33133H 439 34261G 441 33405G 443 34655G 453 32173H
455 33455G 457 35165G 459 22705E 461 37123H 463 27111E 465 35455G
467 31457H 469 23055E 471 30777H 473 37653H 475 24325E 477 31251G
547 35163H 549 33433H 551 37243H 553 27515E 555 32137H 557 26743F
563 30277H 565 20627F 567 35057H 569 24315E 571 24727F 581 30331G
583 34273H 585 23207F 587 31113H 589 36023H 595 27373F 597 20737F
599 36235G 601 21575E 603 26215E 605 21211E 611 20311E 613 34003H
615 34027H 617 20065E 619 22051E 621 22127F 627 23621E 629 24465E
651 26457F 653 31201G 659 34035G 661 27227F 663 22561E 665 21615E
667 22013F 669 23365E 675 26213F 677 26775E 679 32635G 681 33631G
683 32743H 685 31767H 691 34413H 693 22037F 695 30651G 697 26565E
711 22141E 713 22471E 715 35271G 717 37445G 723 22717F 725 26505E
727 24411E 729 24575E 731 23707F 733 25173F 739 21367F 741 25161E
743 24147F 793 36307H 795 24417F 805 20237F 807 36771G 809 37327H
811 27735E 813 31223H 819 36373H 821 33121G 823 32751G 825 33523H
}}}
* source: //W. Wesley Peterson, MIT Press (1970)//
!!Definitions
*__GF(2):__ For GF(2), the coefficients are either 0 or 1 and the rules for multiplication and addition are 0 = 0+0 = 1+1 = 0*0 = 0*1 = 1*0 and 1 = 0+1 = 1+0 = 1*1.
*__irreducible:__ A polynomial over GF(2) is irreducible if it cannot be factored into non-trivial polynomials. For example, x^^2^^+x+1 is irreducible, but x^^2^^+1 is not, since x^^2^^+1 = (x+1)(x+1).
*__irreducible (bis):__ If deg(p)=m and p(x)=(x^^2^(m-1)^^-1)*r(x), then p(x) is irreducible.
*__minimal:__ If p(x) is the polynomial of lowest possible degree such as p(a)=0, then p(x) is the minimal polynomial for a. Any other polynomial such as q(a)=0 is a multiple of p(x).
*__order:__ The order of a polynomial f(x) for which f(0) is not 0 is the smallest integer e for which f(x) divides x^^e^^+1.
*__primitive:__ A polynomial over GF(2) is primitive if it has order 2^^n^^-1. For example, x^^2^^+x+1 has order 3 = 2^^2^^-1 since (x^^2^^+x+1)(x+1) = x^^3^^+1. Thus x^^2^^+x+1 is primitive.
*__tolient function:__ Euler's totient function ∅(m) is the number of numbers less than m and relatively prime to m.
*__primitive density:__ The number of primitive polynomials over GF(2) is ∅(2^^n^^-1)/n. For n=1,2,...,15 is 1, 1, 2, 2, 6, 6, 18, 16, 48, 60, 176, 144, 630, 756, 1800.
*__classification:__ polynomials ⊃ irreducibles ⊃ minimals ⊃ primitives ( ? ⊃ Maximum sequence length )
!!Irreducibles Introduction
From the following tables all irreducible polynomials of degree 16 or less over GF(2) can be found, and certain of their properties and relations among them are given. A primitive polynomial with a minimum number of nonzero coefficients and polynomials be-longing to all possible exponents is given for each degree 17 through 34.
Polynomials are given in an octal representation. The binary digits then are the coefficients of the polynomial, with the high-order coefficients at the left.
//__Example:__// in the 10th-degree list {{{3525}}} = {{{011 101 010 101}}} = X^^10^^+X^^9^^+X^^8^^+X^^6^^+X^^4^^+X^^2^^+1.
----
The reciprocal polynomial of an irreducible polynomial is also irreducible, and the reciprocal polynomial of a primitive polynomial is primitive. Of any pair consisting of a polynomial and its reciprocal polynomial, only one is listed in the table. Each entry that is followed by a letter in the table is an irreducible polynomial of the indicated degree. For degree 2 through 16, these polynomials along with their reciprocal polynomials comprise all irreducible polynomials of that degree. The letters following the octal representation give the following information:
| A, B, C, D |Not primitive |
| E, F, G, H |Primitive |
| A, B, E, F |The roots are linearly dependent |
| C, D, G, H |The roots are linearly independent |
| A, C, E, G |The roots of the reciprocal polynomial are linearly dependent |
| B, D, F, H |The roots of the reciprocal polynomial are linearly independent |
The other numbers in the table tell the relation between the polynomials. For each degree, a primitive polynomial with a minimum number of nonzero coefficients was chosen, and this polynomial is the first in the table of polynomials of this degree. Let //a// denote one of its roots. Then the entry following j in the table is the minimum polynomial of //a//^^j^^. The polynomials are included for each j unless for some i < j either //a//^^i^^ and //a//^^j^^ are roots of the same irreducible polynomial or //a//^^i^^ and //a//^^-j^^ are roots of the same polynomial. The minimum polynomial of //a//^^j^^ is included even if it has smaller degree than is indicated for that section of the table; such polynomials are not followed by a letter in the table.
//__Example:__// The primitive polynomial {{{103}}} = X^^6^^+X+1 = p(X) is the first entry in the table of 6th-degree irreducible polynomials. If //a// designates a root of p(X), then //a//^^3^^ is a root of {{{127}}} and //a//^^5^^ is a root of {{{147}}}. The minimum polynomial of //a//^^9^^ is {{{015}}} = X^^3^^+X^^2^^+1, and is of degree 3 rather than 6.
//__Example:__// There is no entry corresponding to //a//^^17^^. The other roots of the minimum polynomial of //a//^^17^^ are //a//^^34^^, //a//^^68^^ = //a//^^5^^, //a//^^10^^, //a//^^20^^, and //a//^^40^^. Thus the minimum polynomial of //a//^^17^^ is the same as the minimum polynomial of //a//^^5^^, or {{{147}}}.
//__Example:__// There is no entry corresponding to //a//^^13^^. The other roots of the minimum polynomial p~~13~~(X) of //a//^^13^^ are //a//^^26^^, //a//^^52^^, //a//^^104^^ = //a//^^41^^, //a//^^82^^ = //a//^^19^^ , and //a//^^38^^. None of these is listed. The roots of the reciprocal polynomial P~~13~~*(X) of P~~13~~(X) are //a//^^-13^^ = //a//^^50^^, //a//^^-26^^ = //a//^^37^^, //a//^^-52^^ = //a//^^11^^, //a//^^-41^^ = //a//^^22^^, //a//^^-19^^ = //a//^^44^^ and //a//^^-38^^ = //a//^^25^^. The minimum polynomial of //a//^^11^^ is listed as {{{155}}} or X^^6^^+X^^5^^+ X^^3^^+X^^2^^+1. The minimum polynomial of //a//^^13^^ is the reciprocal polynomial of this, or p~~13~~(X) = X^^6^^+X^^4^^+X^^3^^+X+1.
----
The exponent to which a polynomial belongs can be found as follows: If a is a primitive element of GF(2^^m^^), then the order e of //a//^^j^^ is e = (2^^m^^-1)/GCD(2^^m^^-1, j) and e is also the exponent to which the minimum function of //a//^^j^^ belongs. Thus, for example, in GF(2^^10^^), //a//^^55^^ has order 93, since 93 = 1023/GCD(1023, 55) = 1023/11. Thus the polynomial {{{3453}}} belongs to 93.
----
Marsh has published a table of all irreducible polynomials of degree 19 or less over GF(2). In this table the polynomials are arranged in lexicographical order; this is the most convenient form for determining whether or not a given polynomial is irreducible.
For degree 19 or less, the minimum-weight polynomials given in this table were found in Marsh's tables. For degree 19 through 34, the minimum-weight polynomial was found by a trial-and-error process in which each polynomial of weight 3, then 5, was tested.
The following procedure was used to test whether a polynomial f(X) of degree m is primitive:
*''1'' The residues of 1, X, X^^2^^, X^^4^^, ... , X^^2m-1^^ are formed modulo f(X).
*''2'' These are multiplied and reduced modulo f(X) to form the residue of X^^2^m-1^^. If the result is not 1, the polynomial is rejected. If the result is 1, the test is continued.
*''3'' For each factor //r// of 2^^m^^-1, the residue of X^^r^^ is formed by multiplying together an appropriate combination of the residues formed in Step 1. If none of these is 1, the polynomial is primitive.
Each other polynomial in the table was found by solving for the dependence relations among its roots by the method illustrated at the end of Section 8.1 in Peterson.
----
|Table Factorization of 2^^m^^-1 into Primes|c
|2^^3^^ - 1 = 7 |2^^19^^ - 1 = 524287 |
|2^^4^^ - 1 = 3x5 |2^^20^^ - 1 = 3x5x5x11x31x41|
|2^^5^^ - 1 = 31 |2^^21^^ - 1 = 7X7X127x337 |
|2^^6^^ - 1 = 3x3x7 |2^^22^^ - 1 = 3x23x89x683 |
|2^^7^^ - 1 = 127 |2^^23^^ - 1 = 47x178481 |
|2^^8^^ - 1 = 3x5x17 |2^^24^^ - 1 = 3x3x5x7x13x17x241|
|2^^9^^ - 1 = 7x73 |2^^25^^ - 1 = 31x601x1801 |
|2^^10^^ - 1 = 3x11x3 |2^^26^^ - 1 = 3x2731x8191 |
|2^^11^^ - 1 = 23x89 |2^^27^^ - 1 = 7x73x262657 |
|2^^12^^ - 1 = 3x3x5x7x13 |2^^28^^ - 1 = 3x5x29x43x113x127 |
|2^^13^^ - 1 = 8191 |2^^29^^ - 1 = 233x1103x2089 |
|2^^14^^ - 1 = 3x43x127 |2^^30^^ - 1 = 3x3x7x11x31x151x331 |
|2^^15^^ - 1 = 7x31x15 |2^^31^^ - 1 = 2147483647 |
|2^^16^^ - 1 = 3x5x17x257 |2^^32^^ - 1 = 3x5x17x257x65537 |
|2^^17^^ - 1 = 131071 |2^^33^^ - 1 = 7x23x89x599479 |
|2^^18^^ - 1 = 3x3x3x7x19x73 |2^^34^^ - 1 = 3x43691x131071 |
!! Irreducible Table
{{{
DEGREE 2 1 7H
DEGREE 3 1 13F
DEGREE 4 1 23F 3 37D 5 07
DEGREE 5 1 45E 3 75G 5 67H
DEGREE 6 1 103F 3 1278 5 147H 7 111A 9 015
11 155E 21 007
DEGREE 7 1 211E 3 217E 5 235E 7 367H 9 277E
11 325G 13 203F 19 313H 21 345G
DEGREE 8 1 435E 3 567B 5 763D 7 551E 9 675C
11 747H 13 453F 15 727D 17 023 19 545E 21 613D
23 543F 25 433B 27 477B 37 537F 43 703H 45 471A
51 037 85 007
DEGREE 9 1 1021E 3 1131E 5 1461G 7 1231A 9 1423G
11 1055E 13 1167F 15 1541E 17 1333F 19 1605G 21 1027A
23 1751E 25 1743H 27 1617H 29 1553H 35 1401C 37 1157F
39 1715E 41 1563H 43 1713H 45 1175E 51 1725G 53 1225E
55 1275E 73 0013 75 1773G 77 1511C 83 1425G 85 1267E
DEGREE 10 1 2011E 3 2017B 5 2415E 7 3771G 9 2257B
11 2065A 13 2157F 15 2653B 17 3515G 19 2773F 21 3753D
23 2033F 25 2443F 27 3573D 29 2461E 31 3043D 33 0075C
35 3023H 37 3543F 39 21078 41 2745E 43 2431E 45 3061C
47 3177H 49 3525G 51 2547B 53 2617F 55 3453D 57 3121C
59 3471G 69 2701A 71 3323H 73 3507H 75 2437B 77 2413B
83 3623H 85 2707E 87 2311A 89 2327F 91 3265G 93 3777D
99 0067 101 2055E 103 3575G 105 3607C 107 3171G 109 2047F
147 2355A 149 3025G 155 2251A 165 0051 171 3315C 173 3337H
179 3211G 341 0007
DEGREE 11 1 4005E 3 4445E 5 4215E 7 4055E 9 6015G
11 7413H 13 4143F 15 4563F 17 4053F 19 5023F 21 5623F
23 4757B 25 4577F 27 6233H 29 6673H 31 7237H 33 7335G
35 4505E 37 5337F 39 5263F 41 5361E 43 5171E 45 6637H
47 7173H 49 5711E 51 5221E 53 6307H 55 6211G 57 5747F
59 4533F 61 4341E 67 6711G 69 6777D 71 7715G 73 6343H
75 6227H 77 6263H 79 5235E 81 7431G 83 6455G 85 5247F
87 5265E 89 5343B 91 4767F 93 5607F 99 4603F 101 6561G
103 7107H 105 704IG 107 4251E 109 5675E 111 4173F 113 4707F
115 7311C 117 5463F 119 5755E 137 6675G 139 7655G 141 5531E
147 7243H 149 762IG 151 7161G 153 4731E 155 4451E 157 6557H
163 7745G 165 7317H 167 5205E 169 4565E 171 6765G 173 7535G
179 4653F 181 5411E 183 5545E 185 7565G 199 6543H 201 5613F
203 6013H 205 7647H 211 6507H 213 6037H 215 7363H 217 7201G
219 7273H 293 7723H 299 4303B 301 5007F 307 7555G 309 4261E
331 6447H 333 5141E 339 7461G 341 5253F
DEGREE 12 1 10123F 3 12133B 5 10115A 7 121538 9 11765A
11 15647E 13 12513B 15 13077B 17 16533H 19 16047H 21 10065A
23 11015E 25 13377B 27 14405A 29 14127H 31 17673H 33 13311A
35 10377B 37 13565E 39 13321A 41 15341G 43 15053H 45 15173C
47 15621E 49 17703C 51 10355A 53 15321G 55 10201A 57 12331A
59 11417E 61 13505E 63 10761A 65 00141 67 13275E 69 16663C
71 11471E 73 16237E 75 16267D 77 15115C 79 12515E 81 17545C
83 12255E 85 11673B 87 17361A 89 11271E 91 10011A 93 14755C
95 17705A 97 1712IG 99 17323D 101 14227H 103 12117E 105 13617A
107 14135G 109 14711G Ill 15415C 113 13131E 115 13223A 117 16475C
119 14315C 121 16521E 123 13475A 133 114338 135 10571A 137 15437G
139 12067F 141 13571A 143 12111A 145 16535C 147 17657D 149 12147F
151 14717F 153 13517B 155 14241C 157 14675G 163 10663F 165 10621A
167 16115G 169 16547C 171 10213B 173 12247E 175 16757D 177 16017C
179 17675E 181 10151E 183 14111A 185 14037A 187 14613H 189 13535A
195 00165 197 11441E 199 10321E 201 14067D 203 13157B 205 14513D
207 10603A 209 11067F 211 14433F 213 16457D 215 10653B 217 13563B
219 116578 221 17513C 227 12753F 229 13431E 231 10167B 233 11313F
235 11411A 237 13737B 239 13425E 273 00023 275 14601C 277 16021G
279 16137D 281 17025G 283 15723F 285 17141A 291 15775A 293 11477F
295 11463B 297 17073C 299 16401C 301 12315A 307 14221E 309 11763B
311 12705E 313 14357F 315 17777D 325 00163 327 17233D 329 11637B
331 16407F 333 11703A 339 16003C 341 11561E 343 12673B 345 14537D
347 1771IG 349 13701E 355 10467B 357 15347C 359 11075E 361 16363F
363 11045A 365 11265A 371 14043D 397 12727F 403 14373D 405 13003B
407 17057G 409 10437F 411 10077B 421 14271G 423 14313D 425 14155C
427 10245A 429 11073B 435 10743B 437 12623F 439 12007F 441 15353D
455 00111 585 00013 587 14545G 589 1631IG 595 13413A 597 12265A
603 14411C 613 15413H 619 17147F 661 10605E 683 10737F 685 16355C
691 15701G 693 12345A 715 00133 717 16571C 819 00037 1365 00007
DEGREE 13 1 20033F 3 23261E 5 24623F 7 23517F 9 30741G
11 21643F 13 3017IG 15 21277F 17 27777F 19 35051G 21 34723H
23 34047H 25 32535G 27 31425G 29 37505G 31 36515G 33 26077F
35 35673H 37 20635E 39 33763H 41 25745E 43 36575G 45 26653F
47 21133F 49 22441E 51 30417H 53 32517H 55 37335G 57 25327F
59 23231E 61 25511E 63 26533F 65 33343H 67 33727H 69 27271E
71 25017F 73 26041E 75 21103F 77 27263F 79 24513F 81 32311G
83 31743H 85 24037F 87 30711G 89 32641G 91 24657F 93 32437H
95 20213F 97 25633F 99 31303H 101 22525E 103 34627H 105 25775E
107 21607F 109 25363F Ill 27217F 113 33741G 115 37611G 117 23077F
119 21263F 121 31011G 123 27051E 125 35477H 131 3415IG 133 27405E
135 34641G 137 32445G 139 36375G 141 22675E 143 36073H 145 35121G
147 3650IG 149 33057H 151 36403H 153 35567H 155 23167F 157 36217H
159 22233F 161 32333H 163 24703F 165 33163H 167 32757H 169 23761E
171 24031E 173 30025G 175 37145G 177 31327H 179 27221E 181 25577F
183 22203F 185 37437H 187 27537F 189 31035G 195 24763F 197 20245E
199 20503F 201 20761E 203 25555E 205 30357H 207 33037H 209 34401G
211 32715G 213 21447F 215 27421E 217 20363F 219 3350IG 221 20425E
223 32347H 225 20677F 227 22307F 229 33441G 231 33643H 233 24165E
235 27427F 237 24601E 239 36721G 241 34363H 243 21673F 245 32167H
247 21661E 265 33357H 267 26341E 269 31653H 271 37511G 273 23003F
275 22657F 277 25035E 279 23267F 281 34005G 283 34555G 285 24205E
291 26611E 293 3267IG 295 25245E 297 31407H 299 33471G 301 22613F
303 35645G 305 3237IG 307 34517H 309 26225E 311 35561G 313 25663F
315 24043F 317 30643H 323 20157F 325 37151G 327 24667F 329 33325G
331 32467H 333 30667H 335 22631E 337 26617F 339 20275E 341 36625G
343 20341E 345 37527H 347 31333H 349 31071G 355 23353F 357 26243F
359 21453F 361 36015G 363 36667H 365 34767H 367 34341G 369 34547H
371 35465G 373 24421E 375 23563F 377 36037H 391 31267H 393 27133F
395 30705G 397 30465G 399 35315G 401 3223IG 403 32207H 405 26101E
407 22567F 409 21755E 411 22455E 413 33705G 419 37621G 421 21405E
423 30117H 425 23021E 427 21525E 429 36465G 431 33013H 433 27531E
435 24675E 437 33133H 439 34261G 441 33405G 443 34655G 453 32173H
455 33455G 457 35165G 459 22705E 461 37123H 463 27111E 465 35455G
467 31457H 469 23055E 471 30777H 473 37653H 475 24325E 477 31251G
547 35163H 549 33433H 551 37243H 553 27515E 555 32137H 557 26743F
563 30277H 565 20627F 567 35057H 569 24315E 571 24727F 581 30331G
583 34273H 585 23207F 587 31113H 589 36023H 595 27373F 597 20737F
599 36235G 601 21575E 603 26215E 605 21211E 611 20311E 613 34003H
615 34027H 617 20065E 619 22051E 621 22127F 627 23621E 629 24465E
651 26457F 653 31201G 659 34035G 661 27227F 663 22561E 665 21615E
667 22013F 669 23365E 675 26213F 677 26775E 679 32635G 681 33631G
683 32743H 685 31767H 691 34413H 693 22037F 695 30651G 697 26565E
711 22141E 713 22471E 715 35271G 717 37445G 723 22717F 725 26505E
727 24411E 729 24575E 731 23707F 733 25173F 739 21367F 741 25161E
743 24147F 793 36307H 795 24417F 805 20237F 807 36771G 809 37327H
811 27735E 813 31223H 819 36373H 821 33121G 823 32751G 825 33523H
}}}
* source: //W. Wesley Peterson, MIT Press (1970)//
{{editbutton{<<editTiddler MathPolynomialTable>>}}}
!!Matrix
* Let matrix A
{{{
/ a00 a01 ... a0n \
A=| ... |
\ an0 an1 ... ann /
}}}
*Transpose
{{{
/ a00 a10 ... an0 \
t(A)=| ... |
\ a0n a1n ... ann /
}}}
* Submatrix Sij(A), remains after removing row(i) and col(j)
* Cofactor dij is the determinant of the submatrix dij=det( Sij(A) )
* Comatrix co(A) is the matrix of cofactors
{{{
/ d00 d01 ... d0n \
co(A)=| ... |
\ dn0 dn1 ... dnn /
}}}
* Inverse if det(A)≠0 :
{{{
1/A = 1/det(A). t( co( A ) )
}}}
Name: MptwBlack
Background: #000
Foreground: #fff
PrimaryPale: #333
PrimaryLight: #555
PrimaryMid: #888
PrimaryDark: #aaa
SecondaryPale: #111
SecondaryLight: #222
SecondaryMid: #555
SecondaryDark: #888
TertiaryPale: #222
TertiaryLight: #666
TertiaryMid: #888
TertiaryDark: #aaa
Error: #300
This is in progress. Help appreciated.
Name: MptwBlue
Background: #fff
Foreground: #000
PrimaryPale: #cdf
PrimaryLight: #57c
PrimaryMid: #114
PrimaryDark: #012
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
/***
|Name:|MptwConfigPlugin|
|Description:|Miscellaneous tweaks used by MPTW|
|Version:|1.0 ($Rev: 3646 $)|
|Date:|$Date: 2008-02-27 02:34:38 +1000 (Wed, 27 Feb 2008) $|
|Source:|http://mptw.tiddlyspot.com/#MptwConfigPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#MptwConfigPlugin|
!!Note: instead of editing this you should put overrides in MptwUserConfigPlugin
***/
//{{{
var originalReadOnly = readOnly;
var originalShowBackstage = showBackstage;
config.options.chkHttpReadOnly = false; // means web visitors can experiment with your site by clicking edit
readOnly = false; // needed because the above doesn't work any more post 2.1 (??)
showBackstage = true; // show backstage for same reason
config.options.chkInsertTabs = true; // tab inserts a tab when editing a tiddler
config.views.wikified.defaultText = ""; // don't need message when a tiddler doesn't exist
config.views.editor.defaultText = ""; // don't need message when creating a new tiddler
config.options.chkSaveBackups = true; // do save backups
config.options.txtBackupFolder = 'twbackup'; // put backups in a backups folder
config.options.chkAutoSave = (window.location.protocol == "file:"); // do autosave if we're in local file
config.mptwVersion = "2.5.1";
config.macros.mptwVersion={handler:function(place){wikify(config.mptwVersion,place);}};
if (config.options.txtTheme == '')
config.options.txtTheme = 'MptwTheme';
// add to default GettingStarted
config.shadowTiddlers.GettingStarted += "\n\nSee also [[MPTW]].";
// add select theme and palette controls in default OptionsPanel
config.shadowTiddlers.OptionsPanel = config.shadowTiddlers.OptionsPanel.replace(/(\n\-\-\-\-\nAlso see AdvancedOptions)/, "{{select{<<selectTheme>>\n<<selectPalette>>}}}$1");
// these are used by ViewTemplate
config.mptwDateFormat = 'DD/MM/YY';
config.mptwJournalFormat = 'Journal DD/MM/YY';
//}}}
Name: MptwGreen
Background: #fff
Foreground: #000
PrimaryPale: #9b9
PrimaryLight: #385
PrimaryMid: #031
PrimaryDark: #020
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
Name: MptwRed
Background: #fff
Foreground: #000
PrimaryPale: #eaa
PrimaryLight: #c55
PrimaryMid: #711
PrimaryDark: #500
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
|Name|MptwRounded|
|Description|Mptw Theme with some rounded corners (Firefox only)|
|ViewTemplate|MptwTheme##ViewTemplate|
|EditTemplate|MptwTheme##EditTemplate|
|PageTemplate|MptwTheme##PageTemplate|
|StyleSheet|##StyleSheet|
!StyleSheet
/*{{{*/
[[MptwTheme##StyleSheet]]
.tiddler,
.sliderPanel,
.button,
.tiddlyLink,
.tabContents
{ -moz-border-radius: 1em; }
.tab {
-moz-border-radius-topleft: 0.5em;
-moz-border-radius-topright: 0.5em;
}
#topMenu {
-moz-border-radius-bottomleft: 2em;
-moz-border-radius-bottomright: 2em;
}
/*}}}*/
Name: MptwSmoke
Background: #fff
Foreground: #000
PrimaryPale: #aaa
PrimaryLight: #777
PrimaryMid: #111
PrimaryDark: #000
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
Name: MptwTeal
Background: #fff
Foreground: #000
PrimaryPale: #B5D1DF
PrimaryLight: #618FA9
PrimaryMid: #1a3844
PrimaryDark: #000
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #f8f8f8
TertiaryLight: #bbb
TertiaryMid: #999
TertiaryDark: #888
Error: #f88
|Name|MptwTheme|
|Description|Mptw Theme including custom PageLayout|
|PageTemplate|##PageTemplate|
|ViewTemplate|##ViewTemplate|
|EditTemplate|##EditTemplate|
|StyleSheet|##StyleSheet|
http://mptw.tiddlyspot.com/#MptwTheme ($Rev: 1829 $)
!PageTemplate
<!--{{{-->
<div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
<!-- horizontal MainMenu -->
<div id='topMenu' refresh='content' tiddler='MainMenu'></div>
<!-- original MainMenu menu -->
<!-- <div id='mainMenu' refresh='content' tiddler='MainMenu'></div> -->
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<!--
<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
-->
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->
!ViewTemplate
<!--{{{-->
<!-- DrPatch -->
<span macro="tiddler ReplaceDoubleClick"></span>
<!-- DrPatch -->
[[MptwTheme##ViewTemplateToolbar]]
<div class="tagglyTagged" macro="tags"></div>
<div class='titleContainer'>
<span class='title' macro='view title'></span>
<span macro="miniTag"></span>
</div>
<div class='subtitle'>
(updated <span macro='view modified date {{config.mptwDateFormat?config.mptwDateFormat:"MM/0DD/YY"}}'></span>
by <span macro='view modifier link'></span>)
<!--
(<span macro='message views.wikified.createdPrompt'></span>
<span macro='view created date {{config.mptwDateFormat?config.mptwDateFormat:"MM/0DD/YY"}}'></span>)
-->
</div>
<div macro="showWhen tiddler.tags.containsAny(['css','html','pre','systemConfig']) && !tiddler.text.match('{{'+'{')">
<div class='viewer'><pre macro='view text'></pre></div>
</div>
<div macro="else">
<div class='viewer' macro='view text wikified'></div>
</div>
<div class="tagglyTagging" macro="tagglyTagging"></div>
<!--}}}-->
!ViewTemplateToolbar
<!--{{{-->
<div class='toolbar'>
<span macro="showWhenTagged systemConfig">
<span macro="toggleTag systemConfigDisable . '[[disable|systemConfigDisable]]'"></span>
</span>
<span macro="showWhenTagged systemTheme"><span macro="applyTheme"></span></span>
<span macro="showWhenTagged systemPalette"><span macro="applyPalette"></span></span>
<span macro="showWhen tiddler.tags.contains('css') || tiddler.title == 'StyleSheet'"><span macro="refreshAll"></span></span>
<span style="padding:1em;"></span>
<span macro='toolbar closeTiddler closeOthers +editTiddler deleteTiddler > fields syncing permalink references jump'></span> <span macro='newHere label:"new here"'></span>
<span macro='newJournalHere {{config.mptwJournalFormat?config.mptwJournalFormat:"MM/0DD/YY"}}'></span>
</div>
<!--}}}-->
!EditTemplate
<!--{{{-->
<div class="toolbar" macro="toolbar +saveTiddler saveCloseTiddler closeOthers -cancelTiddler cancelCloseTiddler deleteTiddler"></div>
<div class="title" macro="view title"></div>
<div class="editLabel">Title</div><div class="editor" macro="edit title"></div>
<div macro='annotations'></div>
<div class="editLabel">Content</div><div class="editor" macro="edit text"></div>
<div class="editLabel">Tags</div><div class="editor" macro="edit tags"></div>
<div class="editorFooter"><span macro="message views.editor.tagPrompt"></span><span macro="tagChooser"></span></div>
<!--}}}-->
!StyleSheet
/*{{{*/
/* a contrasting background so I can see where one tiddler ends and the other begins */
body {
background: [[ColorPalette::TertiaryLight]];
}
/* sexy colours and font for the header */
.headerForeground {
color: [[ColorPalette::PrimaryPale]];
}
.headerShadow, .headerShadow a {
color: [[ColorPalette::PrimaryMid]];
}
/* separate the top menu parts */
.headerForeground, .headerShadow {
padding: 1em 1em 0;
}
.headerForeground, .headerShadow {
font-family: 'Trebuchet MS' sans-serif;
font-weight:bold;
}
.headerForeground .siteSubtitle {
color: [[ColorPalette::PrimaryLight]];
}
.headerShadow .siteSubtitle {
color: [[ColorPalette::PrimaryMid]];
}
/* make shadow go and down right instead of up and left */
.headerShadow {
left: 1px;
top: 1px;
}
/* prefer monospace for editing */
.editor textarea, .editor input {
font-family: 'Consolas' monospace;
background-color:[[ColorPalette::TertiaryPale]];
}
/* sexy tiddler titles */
.title {
font-size: 250%;
color: [[ColorPalette::PrimaryLight]];
font-family: 'Trebuchet MS' sans-serif;
}
/* more subtle tiddler subtitle */
.subtitle {
padding:0px;
margin:0px;
padding-left:1em;
font-size: 90%;
color: [[ColorPalette::TertiaryMid]];
}
.subtitle .tiddlyLink {
color: [[ColorPalette::TertiaryMid]];
}
/* a little bit of extra whitespace */
.viewer {
padding-bottom:3px;
}
/* don't want any background color for headings */
h1,h2,h3,h4,h5,h6 {
background-color: transparent;
color: [[ColorPalette::Foreground]];
}
/* give tiddlers 3d style border and explicit background */
.tiddler {
background: [[ColorPalette::Background]];
border-right: 2px [[ColorPalette::TertiaryMid]] solid;
border-bottom: 2px [[ColorPalette::TertiaryMid]] solid;
margin-bottom: 1em;
padding:1em 2em 2em 1.5em;
}
/* make options slider look nicer */
#sidebarOptions .sliderPanel {
border:solid 1px [[ColorPalette::PrimaryLight]];
}
/* the borders look wrong with the body background */
#sidebar .button {
border-style: none;
}
/* this means you can put line breaks in SidebarOptions for readability */
#sidebarOptions br {
display:none;
}
/* undo the above in OptionsPanel */
#sidebarOptions .sliderPanel br {
display:inline;
}
/* horizontal main menu stuff */
#displayArea {
margin: 1em 15.7em 0em 1em; /* use the freed up space */
}
#topMenu br {
display: none;
}
#topMenu {
background: [[ColorPalette::PrimaryMid]];
color:[[ColorPalette::PrimaryPale]];
}
#topMenu {
padding:2px;
}
#topMenu .button, #topMenu .tiddlyLink, #topMenu a {
margin-left: 0.5em;
margin-right: 0.5em;
padding-left: 3px;
padding-right: 3px;
color: [[ColorPalette::PrimaryPale]];
font-size: 115%;
}
#topMenu .button:hover, #topMenu .tiddlyLink:hover {
background: [[ColorPalette::PrimaryDark]];
}
/* make 2.2 act like 2.1 with the invisible buttons */
.toolbar {
visibility:hidden;
}
.selected .toolbar {
visibility:visible;
}
/* experimental. this is a little borked in IE7 with the button
* borders but worth it I think for the extra screen realestate */
.toolbar { float:right; }
/* fix for TaggerPlugin. from sb56637. improved by FND */
.popup li .tagger a {
display:inline;
}
/* makes theme selector look a little better */
#sidebarOptions .sliderPanel .select .button {
padding:0.5em;
display:block;
}
#sidebarOptions .sliderPanel .select br {
display:none;
}
/* make it print a little cleaner */
@media print {
#topMenu {
display: none ! important;
}
/* not sure if we need all the importants */
.tiddler {
border-style: none ! important;
margin:0px ! important;
padding:0px ! important;
padding-bottom:2em ! important;
}
.tagglyTagging .button, .tagglyTagging .hidebutton {
display: none ! important;
}
.headerShadow {
visibility: hidden ! important;
}
.tagglyTagged .quickopentag, .tagged .quickopentag {
border-style: none ! important;
}
.quickopentag a.button, .miniTag {
display: none ! important;
}
}
/* get user styles specified in StyleSheet */
[[StyleSheet]]
/*}}}*/
|Name|MptwTrim|
|Description|Mptw Theme with a reduced header to increase useful space|
|ViewTemplate|MptwTheme##ViewTemplate|
|EditTemplate|MptwTheme##EditTemplate|
|StyleSheet|MptwTheme##StyleSheet|
|PageTemplate|##PageTemplate|
!PageTemplate
<!--{{{-->
<!-- horizontal MainMenu -->
<div id='topMenu' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<span refresh='content' tiddler='SiteTitle' style="padding-left:1em;font-weight:bold;"></span>:
<span refresh='content' tiddler='MainMenu'></span>
</div>
<div id='sidebar'>
<div id='sidebarOptions'>
<div refresh='content' tiddler='SideBarOptions'></div>
<!--
<div style="margin-left:0.1em;"
macro='slider chkTabSliderPanel SideBarTabs {{"tabs \u00bb"}} "Show Timeline, All, Tags, etc"'></div>
-->
</div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->
For upgrading. See [[ImportTiddlers]].
URL: http://mptw.tiddlyspot.com/upgrade.html
/***
|Description:|A place to put your config tweaks so they aren't overwritten when you upgrade MPTW|
See http://www.tiddlywiki.org/wiki/Configuration_Options for other options you can set. In some cases where there are clashes with other plugins it might help to rename this to zzMptwUserConfigPlugin so it gets executed last.
***/
//{{{
// example: set your preferred date format
//config.mptwDateFormat = 'MM/0DD/YY';
//config.mptwJournalFormat = 'Journal MM/0DD/YY';
// example: set the theme you want to start with
//config.options.txtTheme = 'MptwRoundTheme';
config.options.txtTheme = 'MptwRoundTheme';
// example: switch off autosave, switch on backups and set a backup folder
//config.options.chkSaveBackups = true;
//config.options.chkAutoSave = false;
//config.options.txtBackupFolder = 'backups';
//}}}
6 pieces:
* Melanger:
** 300g farine
** 2 p'tits suisse ou 1 yahourt
** Gloups d'huile d'olive
** sachet de levure chimique
** sel
** eau tiede
* Laisser reposer 10 minutes
* Former les 6 pieces en integrant le fromage rape
* Cuire a la poele 3 minutes
/***
|Name:|NewHerePlugin|
|Description:|Creates the new here and new journal macros|
|Version:|3.0 ($Rev: 3861 $)|
|Date:|$Date: 2008-03-08 10:53:09 +1000 (Sat, 08 Mar 2008) $|
|Source:|http://mptw.tiddlyspot.com/#NewHerePlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License|http://mptw.tiddlyspot.com/#TheBSDLicense|
***/
//{{{
merge(config.macros, {
newHere: {
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
wikify("<<newTiddler "+paramString+" tag:[["+tiddler.title+"]]>>",place,null,tiddler);
}
},
newJournalHere: {
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
wikify("<<newJournal "+paramString+" tag:[["+tiddler.title+"]]>>",place,null,tiddler);
}
}
});
//}}}
/***
|Name:|NewMeansNewPlugin|
|Description:|If 'New Tiddler' already exists then create 'New Tiddler (1)' and so on|
|Version:|1.1 ($Rev: 2263 $)|
|Date:|$Date: 2007-06-13 04:22:32 +1000 (Wed, 13 Jun 2007) $|
|Source:|http://mptw.tiddlyspot.com/empty.html#NewMeansNewPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License|http://mptw.tiddlyspot.com/#TheBSDLicense|
!!Note: I think this should be in the core
***/
//{{{
String.prototype.getNextFreeName = function() {
var numberRegExp = / \(([0-9]+)\)$/;
var match = numberRegExp.exec(this);
if (match) {
var num = parseInt(match[1]) + 1;
return this.replace(numberRegExp," ("+num+")");
}
else {
return this + " (1)";
}
}
config.macros.newTiddler.checkForUnsaved = function(newName) {
var r = false;
story.forEachTiddler(function(title,element) {
if (title == newName)
r = true;
});
return r;
}
config.macros.newTiddler.getName = function(newName) {
while (store.getTiddler(newName) || config.macros.newTiddler.checkForUnsaved(newName))
newName = newName.getNextFreeName();
return newName;
}
config.macros.newTiddler.onClickNewTiddler = function()
{
var title = this.getAttribute("newTitle");
if(this.getAttribute("isJournal") == "true") {
var now = new Date();
title = now.formatString(title.trim());
}
title = config.macros.newTiddler.getName(title); // <--- only changed bit
var params = this.getAttribute("params");
var tags = params ? params.split("|") : [];
var focus = this.getAttribute("newFocus");
var template = this.getAttribute("newTemplate");
var customFields = this.getAttribute("customFields");
story.displayTiddler(null,title,template,false,null,null);
var tiddlerElem = document.getElementById(story.idPrefix + title);
if(customFields)
story.addCustomFields(tiddlerElem,customFields);
var text = this.getAttribute("newText");
if(typeof text == "string")
story.getTiddlerField(title,"text").value = text.format([title]);
for(var t=0;t<tags.length;t++)
story.setTiddlerTag(title,tags[t],+1);
story.focusTiddler(title,focus);
return false;
};
//}}}
! Input text file
{{{
fs = require("fs")
var buf = fs.readFileSync("myinput.txt")
var lines = buf.toString().split("\\n")
line.forEach(function(line){
console.log(line)
})
}}}
! Input json file
{{{
fs = require("fs")
var buf = fs.readFileSync("myinput.json")
var db = JSON.parse(buf)
}}}
or
{{{
var db = require("myinput.json")
}}}
! Output text file
{{{
fs.writeFileSync("./output.txt","Hello",console.log("Saved"))
}}}
|Electrical circuit editor & simulator |https://www.circuitlab.com |
|Math solvers |http://www.sagenb.org |
Proportion pour 12 personnes:
* 3 verres de riz
* 1.5 l de liquide
* 0.26g de safran
Ingrédients:
* 250g farine
* 3 œufs
* 500g fromage blanc battu
* pincée de sel
* pincée de bicarbonate
* poil de sucre ( pas trop sinon la pâte accroche )
Mélanger et réserver une heure. Faire revenir dans du beurre , 3 par 3 dans la poêle.
/***
|''Name:''|PasswordOptionPlugin|
|''Description:''|Extends TiddlyWiki options with non encrypted password option.|
|''Version:''|1.0.2|
|''Date:''|Apr 19, 2007|
|''Source:''|http://tiddlywiki.bidix.info/#PasswordOptionPlugin|
|''Author:''|BidiX (BidiX (at) bidix (dot) info)|
|''License:''|[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D ]]|
|''~CoreVersion:''|2.2.0 (Beta 5)|
***/
//{{{
version.extensions.PasswordOptionPlugin = {
major: 1, minor: 0, revision: 2,
date: new Date("Apr 19, 2007"),
source: 'http://tiddlywiki.bidix.info/#PasswordOptionPlugin',
author: 'BidiX (BidiX (at) bidix (dot) info',
license: '[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D]]',
coreVersion: '2.2.0 (Beta 5)'
};
config.macros.option.passwordCheckboxLabel = "Save this password on this computer";
config.macros.option.passwordInputType = "password"; // password | text
setStylesheet(".pasOptionInput {width: 11em;}\n","passwordInputTypeStyle");
merge(config.macros.option.types, {
'pas': {
elementType: "input",
valueField: "value",
eventName: "onkeyup",
className: "pasOptionInput",
typeValue: config.macros.option.passwordInputType,
create: function(place,type,opt,className,desc) {
// password field
config.macros.option.genericCreate(place,'pas',opt,className,desc);
// checkbox linked with this password "save this password on this computer"
config.macros.option.genericCreate(place,'chk','chk'+opt,className,desc);
// text savePasswordCheckboxLabel
place.appendChild(document.createTextNode(config.macros.option.passwordCheckboxLabel));
},
onChange: config.macros.option.genericOnChange
}
});
merge(config.optionHandlers['chk'], {
get: function(name) {
// is there an option linked with this chk ?
var opt = name.substr(3);
if (config.options[opt])
saveOptionCookie(opt);
return config.options[name] ? "true" : "false";
}
});
merge(config.optionHandlers, {
'pas': {
get: function(name) {
if (config.options["chk"+name]) {
return encodeCookie(config.options[name].toString());
} else {
return "";
}
},
set: function(name,value) {config.options[name] = decodeCookie(value);}
}
});
// need to reload options to load passwordOptions
loadOptionsCookie();
/*
if (!config.options['pasPassword'])
config.options['pasPassword'] = '';
merge(config.optionsDesc,{
pasPassword: "Test password"
});
*/
//}}}
|Standard Periodic Table |c
|| !1 | !2 |!| !3 | !4 | !5 | !6 | !7 | !8 | !9 | !10 | !11 | !12 | !13 | !14 | !15 | !16 | !17 | !18 |
|!1|bgcolor(#a0ffa0): @@color(red):H@@ |>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>||bgcolor(#c0ffff): @@color(red):He@@ |
|!2|bgcolor(#ff6666): Li |bgcolor(#ffdead): Be |>|>|>|>|>|>|>|>|>|>||bgcolor(#cccc99): B |bgcolor(#a0ffa0): C |bgcolor(#a0ffa0): @@color(red):N@@ |bgcolor(#a0ffa0): @@color(red):O@@ |bgcolor(#ffff99): @@color(red):F@@ |bgcolor(#c0ffff): @@color(red):Ne@@ |
|!3|bgcolor(#ff6666): Na |bgcolor(#ffdead): Mg |>|>|>|>|>|>|>|>|>|>||bgcolor(#cccccc): Al |bgcolor(#cccc99): Si |bgcolor(#a0ffa0): P |bgcolor(#a0ffa0): S |bgcolor(#ffff99): @@color(red):Cl@@ |bgcolor(#c0ffff): @@color(red):Ar@@ |
|!4|bgcolor(#ff6666): K |bgcolor(#ffdead): Ca ||bgcolor(#ffc0c0): Sc |bgcolor(#ffc0c0): Ti |bgcolor(#ffc0c0): V |bgcolor(#ffc0c0): Cr |bgcolor(#ffc0c0): Mn |bgcolor(#ffc0c0): Fe |bgcolor(#ffc0c0): Co |bgcolor(#ffc0c0): Ni |bgcolor(#ffc0c0): Cu |bgcolor(#ffc0c0): Zn |bgcolor(#cccccc): Ga |bgcolor(#cccc99): Ge |bgcolor(#cccc99): As |bgcolor(#a0ffa0): Se |bgcolor(#ffff99): @@color(green):Br@@ |bgcolor(#c0ffff): @@color(red):Kr@@ |
|!5|bgcolor(#ff6666): Rb |bgcolor(#ffdead): Sr ||bgcolor(#ffc0c0): Y |bgcolor(#ffc0c0): Zr |bgcolor(#ffc0c0): Nb |bgcolor(#ffc0c0): Mo |bgcolor(#ffc0c0): Tc |bgcolor(#ffc0c0): Ru |bgcolor(#ffc0c0): Rh |bgcolor(#ffc0c0): Pd |bgcolor(#ffc0c0): Ag |bgcolor(#ffc0c0): Cd |bgcolor(#cccccc): In |bgcolor(#cccccc): Sn |bgcolor(#cccc99): Sb |bgcolor(#cccc99): Te |bgcolor(#ffff99): I |bgcolor(#c0ffff): @@color(red):Xe@@ |
|!6|bgcolor(#ff6666): Cs |bgcolor(#ffdead): Ba |bgcolor(#ffbfff):^^*1^^|bgcolor(#ffc0c0): Lu |bgcolor(#ffc0c0): Hf |bgcolor(#ffc0c0): Ta |bgcolor(#ffc0c0): W |bgcolor(#ffc0c0): Re |bgcolor(#ffc0c0): Os |bgcolor(#ffc0c0): Ir |bgcolor(#ffc0c0): Pt |bgcolor(#ffc0c0): Au |bgcolor(#ffc0c0): @@color(green):Hg@@ |bgcolor(#cccccc): Tl |bgcolor(#cccccc): Pb |bgcolor(#cccccc): Bi |bgcolor(#cccc99): Po |bgcolor(#ffff99): At |bgcolor(#c0ffff): @@color(red):Rn@@ |
|!7|bgcolor(#ff6666): Fr |bgcolor(#ffdead): Ra |bgcolor(#ff99cc):^^*2^^|bgcolor(#ffc0c0): Lr |bgcolor(#ffc0c0): Rf |bgcolor(#ffc0c0): Db |bgcolor(#ffc0c0): Sq |bgcolor(#ffc0c0): Bh |bgcolor(#ffc0c0): Hs |bgcolor(#ffc0c0): Mt |bgcolor(#ffc0c0): Ds |bgcolor(#ffc0c0): Rg |bgcolor(#ffc0c0): @@color(green):Uub@@ |bgcolor(#cccccc): Uut |bgcolor(#cccccc): Uuq |bgcolor(#cccccc): Uup |bgcolor(#cccccc): Uuh |bgcolor(#fcfecc): @@color(#cccccc):Uus@@ |bgcolor(#ecfefc): @@color(#cccccc):Uuo@@ |
| !Lanthanides^^*1^^|bgcolor(#ffbfff): La |bgcolor(#ffbfff): Ce |bgcolor(#ffbfff): Pr |bgcolor(#ffbfff): Nd |bgcolor(#ffbfff): Pm |bgcolor(#ffbfff): Sm |bgcolor(#ffbfff): Eu |bgcolor(#ffbfff): Gd |bgcolor(#ffbfff): Tb |bgcolor(#ffbfff): Dy |bgcolor(#ffbfff): Ho |bgcolor(#ffbfff): Er |bgcolor(#ffbfff): Tm |bgcolor(#ffbfff): Yb |
| !Actinides^^*2^^|bgcolor(#ff99cc): Ac |bgcolor(#ff99cc): Th |bgcolor(#ff99cc): Pa |bgcolor(#ff99cc): U |bgcolor(#ff99cc): Np |bgcolor(#ff99cc): Pu |bgcolor(#ff99cc): Am |bgcolor(#ff99cc): Cm |bgcolor(#ff99cc): Bk |bgcolor(#ff99cc): Cf |bgcolor(#ff99cc): Es |bgcolor(#ff99cc): Fm |bgcolor(#ff99cc): Md |bgcolor(#ff99cc): No |
*Chemical Series of the Periodic Table
**@@bgcolor(#ff6666): Alkali metals@@
**@@bgcolor(#ffdead): Alkaline earth metals@@
**@@bgcolor(#ffbfff): Lanthanides@@
**@@bgcolor(#ff99cc): Actinides@@
**@@bgcolor(#ffc0c0): Transition metals@@
**@@bgcolor(#cccccc): Poor metals@@
**@@bgcolor(#cccc99): Metalloids@@
**@@bgcolor(#a0ffa0): Nonmetals@@
**@@bgcolor(#ffff99): Halogens@@
**@@bgcolor(#c0ffff): Noble gases@@
*State at standard temperature and pressure
**those in @@color(red):red@@ are gases
**those in @@color(green):green@@ are liquids
**those in black are solids
* metadata comes in diffferent formats, mainly:
** EXIF : writen by the camera
** XMP ( formerly IPTC) : Writen by user
* XMP can be
** embedded in most image formats
** a separate xml file ( side-car )
!!Culture
* PHP is a recursive acronym for PHP: Hypertext Preprocessor
* Server-side CGI scripting written by Rasmus Lerdorf and released in 1995 to superseed perl
!!Usage
* {{{ php index.php}}}
// <head>
<title>My Title</title>
</head>
<body>
<a href="http://my_server.yop/my_site//path/to/page"> My Link </a>
</body>
</html> //
{{editbutton{<<editTiddler PhpIntro>>}}}
!! HTML Template
{{{
<html>
<?php
header( 'Expires: Mon, 26 Jul 1997 05:00:00 GMT' );
header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
header( 'Cache-Control: no-store, no-cache, must-revalidate' );
header( 'Cache-Control: post-check=0, pre-check=0', false );
header( 'Pragma: no-cache' );
?>
<head>
<?php
$my_var = 'http://my_server.yop/my_site/';
?>
<title>MyTitle</title>
<link rel="SHORTCUT ICON" href="favicon.ico">
<link rel="stylesheet" type="text/css" charset="utf-8" media="all"
href="theme/thermic/css/common.css">
<link rel="stylesheet" type="text/css" charset="utf-8" media="screen"
href="theme/thermic/css/screen.css">
</head>
<body>
<a href="<?php echo $my_var ?>/path/to/page"> My Link </a>
</body>
</html>
}}}
!! Forms
* {{{ generatorForm.php }}}
{{{
<html>
<head> <title> my Form </title> </head>
<body>
<form action="generator.php" method="post">
<input type="radio" name="myType" value="YOP" checked> Yop <BR>
<input type="radio" name="myType" value="YAP"> Yap <BR>
<input type="radio" name="myType" value="YUP"> Yup <BR>
<input name="myName" type="text"> <BR>
<input type="submit" value="Go">
</form>
</body>
</html>
}}}
* {{{ generator.php }}}
{{{
<html>
<head> <title> my Generator </title> </head>
<body>
<h1> Generator</h1>
Generating <?php echo $_POST['myName'] ; ?> ...
</br>
<?php
$cmd = "python ./generator.py ".$_POST['myName']." ".$_POST['myType'];
echo "<b> ${cmd} :</b>";
exec($cmd,$cmd_stdout,$cmd_status);
foreach ( $cmd_stdout as $line ) {
echo "<li> [script] $line </li>";
}
if ($cmd_status) { echo "<b> Done, NOK :(</b> "; }
else { echo "<b> Done, OK :)</b> "; }
?>
</body>
</html>
}}}
{{{
#!/usr/bin/env php
<?php
$myflag=False;
if (count($argv)>1 { if ($argv[1]=="-myflag") { $myflag=True;}}
?>
This part of the document remains unchanged
<?php
if ($myflag) { print "This can be in final text file if -myflag swith is used\n" }
?>
This part of the document remains unchanged
}}}
!!Culture
* Language created in ''1987'' by Larry Wall to superseed ''sed'',''awk'' and ''sh''.
* Larry gives 2 meanings for PERL:
** Practical Extraction and Report Language
** Pathetically Eclectic Rubbish Lister
* One of the core philosophies of Perl is //There Is More Than One Way To Do It//.
!Recommended header
{{{
#!/bin/env perl
use strict;
...
}}}
* It catches many stupid mistakes such as typos in variable names that take a while to debug otherwise.
!!Debug help
{{{
use Data::Dumper;
my $foo = somefunction(); # what format is the result in?
print $foo; # useless
print Dumper $foo; # now you understand what's in $foo
}}}
* Your are not a machine, you are a developper :)
!!Interactive
{{{
perl -e 1 -d
main::(-e:1): 1
DB<1> print 2+2
DB<2> 4
DB<2> print log(10)
DB<3> 2.30258509299405
}}}
!!Gotcha
* Advanced programmers often omit variable names, this makes their code compact but quite confusing to perl beginners. Here is the trick: if the variable name is unspecified, perl always defaults to $_ or @_ ( scalar or array ). This variable is usually modifed in place by functions such as split, search and replace ...
{{editbutton{<<editTiddler PerlIntro>>}}}
!!Named according to types
* ''$'' : scalar
{{{
my $scalar = "Hello! ";
print $scalar;
}}}
*''@'' : array
{{{
my @list = ( "You ","2", "3","5","7","are " );
print $list[ 0]; # First
print $list[-1]; # Last
print $#list ; # Length
}}}
*''%'' : hash table
{{{
my %table = ("red","f00","green"," years old");
print $table{"green"};
print "\n";
}}}
//Hello! You are 5 years old//
*Slicing
{{{
print "Magic number : ";
print @list[1...3];
print @list[2,4,3];
print "\n";
}}}
//Magic number : 235375//
!!Values
*Numeric:
** decimal: {{{ 123 5E-10 }}}
** hexa: {{{ 0xff }}}
** octal: {{{ 0377 }}}
*String:
** differd substitution : {{{'no substitution' }}}
** imediate substitution: {{{"$variable substitution" }}}
*Boolean:
** false: {{{ "", 0 }}}
** true : {{{anything else }}}
!!Special Variables
| !$_|Default input and pattern-searching space |
| !@_|Parameter array for subroutines. Also used by split |
| !@ARGV|Command line arguments |
| !@INC|Search path for statments: ''do'',''use'',''require'' |
| !%ENV|Shell environment |
| !$?|Status of last `system call` |
| !$0|Script name|
| !$ARGV|Name of the current file when reading from < > |
!!Array
{{{
my @array = qw/element1 element2 element3/;
}}}
!!Strings
{{{
$name = "Sean";
$test1 = qq/Hello $name/; #Interpolated
$test2 = q/Hello $name/; #Non interpolated
print "$test1\n$test2\n";
}}}
//Hello Sean
Hello $name//
!!System call
{{{
print `uname -s`;
print qx/date/;
}}}
//Linux
Wed Jan 9 10:56:40 CET 2008//
!grep
{{{
foreach my $i (@array) {
push @foo, $i if ($i =~ /foo/);
}
}}}
is equivalent to the ''grep'' function:
{{{
@foo = grep /foo/, @array;
}}}
!map
{{{
foreach my $i (@array) {
$i =~ s/foo/bar/;
push @out, $i;
}
}}}
is equivalent to the ''map'' function:
{{{
@out = map { s/foo/bar/; $_ } @array;
}}}
{{{
...
myparser($_[0], $_[1]);
...
sub myparser {
#--- Unpack Args
my $infilename = $_[0];
my $outfilename = $_[1];
#--- Action
...
return 0;
}
}}}
!Parser
{{{
#!/bin/env perl
use strict;
use Data::Dumper;
# unpack args
my $filein = $ARGV[0];
my $fileout = "${filein}_numbered";
# open file for reading
open(my $input_fh, "<", $filein ) or die $!;
# open file for writing
open(my $output_fh, ">", $fileout) or die $!;
# numbered lines
my $line_no = 1;
while(<$input_fh>) {
print $output_fh "$line_no: $_";
$line_no++;
}
}}}
!Unpack lines:
{{{
while (<>) {
chomp; # avoid \n on last field
@array = split; # list of white-space delimited words
# ...
}
}}}
!Syntax
You can enclose the argument list in parentheses, or leave the parentheses off.
{{{
print("Yop La");
print "Yop La";
print "Yop ","La";
}}}
!Usual built-ins
| abs |absolute value|
| chdir |change current directory|
| chmod |change permissions of file/directory|
| chomp |remove terminal newline from string variable|
| chop |remove last character from string variable|
| chown |change ownership of file/directory|
| close |close a file handle|
| closedir |close a directory handle|
| cos |cosine|
| defined |test whether variable is defined|
| delete |delete a key from a hash|
| die |exit with an error message|
| each |iterate through keys & values of a hash|
| eof |test a filehandle for end of file|
| eval |evaluate a string as a perl expression|
| exec |quit Perl and execute a system command|
| exists |test that a hash key exists|
| exit |exit from the Perl script|
| glob |expand a directory listing using shell wildcards|
| gmtime |current time in GMT|
| grep |filter an array for entries that meet a criterion|
| index |find location of a substring inside a larger string|
| int |throw away the fractional part of a floating point number|
| join |join an array together into a string|
| keys |return the keys of a hash|
| kill |send a signal to one or more processes|
| last |exit enclosing loop|
| lc |convert string to lowercase|
| lcfirst |lowercase first character of string|
| length |find length of string|
| local |temporarily replace the value of a global variable|
| localtime |return time in local timezone|
| log |natural logarithm|
| m{{{//}}} |pattern match operation|
| map |perform on operation on each member of array or list|
| mkdir |make a new directory|
| my |create a local variable|
| next |jump to the top of enclosing loop|
| open |open a file for reading or writing|
| opendir |open a directory for listing|
| pack |pack a list into a compact binary representation|
| package |create a new namespace for a module|
| pop |pop the last item off the end of an array|
| print |print to terminal or a file|
| printf |formatted print to a terminal or file|
| push |push a value onto the end of an array|
| q/STRING/ |generalized single-quote operation|
| qq/STRING/ |generalized double-quote operation|
| qx/STRING/ |generalized backtick operation|
| qw/STRING/ |turn a space-delimited string of words into a list|
| rand |random number generator|
| read |read binary data from a file|
| readdir |read the contents of a directory|
| readline |read a line from a text file|
| readlink |determine the target of a symbolic link|
| redo |restart a loop from the top|
| ref |return the type of a variable reference|
| rename |rename or move a file|
| require |load functions defined in a library file|
| return |return a value from a user-defined subroutine|
| reverse |reverse a string or list|
| rewinddir |rewind a directory handle to the beginning|
| rindex |find a substring in a larger string, from right to left|
| rmdir |remove a directory|
| s{{{///}}} |pattern substitution operation|
| scalar |force an expression to be treated as a scalar|
| seek |reposition a filehandle to an arbitrary point in a file|
| select |make a filehandle the default for output|
| shift |shift a value off the beginning of an array|
| sin |sine|
| sleep |put the script to sleep for a while|
| sort |sort an array or list by user-specified criteria|
| splice |insert/delete array items|
| split |split a string into pieces according to a pattern|
| sprintf |formatted string creation|
| sqrt |square root|
| stat |get information about a file|
| sub |define a subroutine|
| substr |extract a substring from a string|
| symlink |create a symbolic link|
| system |execute an operating system command, then return to Perl|
| tell |return the position of a filehandle within a file|
| tie |associate a variable with a database|
| time |return number of seconds since January 1, 1970|
| tr{{{///}}} |replace characters in a string|
| truncate |truncate a file (make it smaller)|
| uc |uppercase a string|
| ucfirst |uppercase first character of a string|
| umask |change file creation mask|
| undef |undefine (remove) a variable|
| unlink |delete a file|
| unpack |the reverse of pack|
| untie |the reverse of tie|
| unshift |move a value onto the beginning of an array|
| use |import variables and functions from a library module|
| values |return the values of a hash variable|
| wantarray |return true in an array context|
| warn |print a warning to standard error|
| write |formatted report generation|
!!Simple code inclusion
{{{
unshift(@INC,"/my/path/to/modules");
require "my_module.pl";
func_in_my_module();
}}}
!!Packages
*Declaration
{{{
package mypkg; # Will look for mypkg.pm
use Exporter; # local/global manager
@ISA=('Exporter');
@EXPORT_OK=('Func1,'Func2','$Var');
$Var = "ABC"; #Visible
$I = 10; # Not Visible
sub Func1 { ... } # Visible
sub Func2 { ... } # Visible
sub Func3 { ... } # Not Visible
sub Func4 { ... } # Not Visible
}}}
*Clean Call
{{{
use mypkg ('Func1','Func2','$Var');
Func1();
Func2();
Func3(); # Error
print ("$Var \n");
}}}
*Dirty Call
{{{
use mypkg;
$I = 20;
mypkg::Fonc1();
mypkg::Fonc2();
mypkg::Fonc3(); # Works
}}}
* Source: Very old post from Tom Christianson
* run contents of "my_file" as a program
{{{ perl my_file}}}
* run debugger "stand-alone"
{{{ perl -d -e 42 }}}
* run program, but with warnings
{{{ perl -w my_file}}}
* run program under debugger
{{{ perl -d my_file}}}
* just check syntax, with warnings
{{{ perl -wc my_file}}}
* useful at end of "find foo -print"
{{{ perl -nle unlink}}}
* simplest one-liner program
{{{ perl -e 'print "hello world!\n"'}}}
* add first and penultimate columns
{{{ perl -lane 'print $F[0] + $F[-2]'}}}
* just lines 15 to 17
{{{ perl -ne 'print if 15 .. 17' *.pod}}}
* in-place edit of *.c files changing all foo to bar
{{{ perl -p -i.bak -e 's/\bfoo\b/bar/g' *.c}}}
* command-line that prints the first 50 lines (cheaply)
{{{ perl -pe 'exit if $. > 50' f1 f2 f3 ...}}}
* delete first 10 lines
{{{ perl -i.old -ne 'print unless 1 .. 10' foo.txt}}}
* change all the isolated oldvar occurrences to newvar
{{{ perl -i.old -pe 's{\boldvar\b}{newvar}g' *.[chy]}}}
* command-line that reverses the whole file by lines
{{{ perl -e 'print reverse <>' file1 file2 file3 ....}}}
* find palindromes
{{{ perl -lne 'print if $_ eq reverse' /usr/dict/words}}}
* command-line that reverse all the bytes in a file
{{{ perl -0777e 'print scalar reverse <>' f1 f2 f3 ...}}}
* command-line that reverses the whole file by paragraphs
{{{ perl -00 -e 'print reverse <>' file1 file2 file3 ....}}}
* increment all numbers found in these files
{{{ perl i.tiny -pe 's/(\d+)/ 1 + $1 /ge' file1 file2 ....}}}
* command-line that shows each line with its characters backwards
{{{ perl -nle 'print scalar reverse $_' file1 file2 file3 ....}}}
* delete all but lines beween START and END
{{{ perl -i.old -ne 'print unless /^START$/ .. /^END$/' foo.txt}}}
* binary edit (careful!)
{{{ perl -i.bak -pe 's/Mozilla/Slopoke/g' /usr/local/bin/netscape}}}
* look for dup words
{{{ perl -0777 -ne 'print "$.: doubled $_\n" while /\b(\w+)\b\s+\b\1\b/gi'}}}
* command-line that prints the last 50 lines (expensively)
{{{ perl -e 'lines = <>; print @@lines[ $#lines .. $#lines-50' f1 f2 f3 ... }}}
!!Definitions
*__GF(2):__ For GF(2), the coefficients are either 0 or 1 and the rules for multiplication and addition are 0 = 0+0 = 1+1 = 0*0 = 0*1 = 1*0 and 1 = 0+1 = 1+0 = 1*1.
*__irreducible:__ A polynomial over GF(2) is irreducible if it cannot be factored into non-trivial polynomials. For example, x^^2^^+x+1 is irreducible, but x^^2^^+1 is not, since x^^2^^+1 = (x+1)(x+1).
*__irreducible (bis):__ If deg(p)=m and p(x)=(x^^2^(m-1)^^-1)*r(x), then p(x) is irreducible.
*__minimal:__ If p(x) is the polynomial of lowest possible degree such as p(a)=0, then p(x) is the minimal polynomial for a. Any other polynomial such as q(a)=0 is a multiple of p(x).
*__order:__ The order of a polynomial f(x) for which f(0) is not 0 is the smallest integer e for which f(x) divides x^^e^^+1.
*__primitive:__ A polynomial over GF(2) is primitive if it has order 2^^n^^-1. For example, x^^2^^+x+1 has order 3 = 2^^2^^-1 since (x^^2^^+x+1)(x+1) = x^^3^^+1. Thus x^^2^^+x+1 is primitive.
*__tolient function:__ Euler's totient function ∅(m) is the number of numbers less than m and relatively prime to m.
*__primitive density:__ The number of primitive polynomials over GF(2) is ∅(2^^n^^-1)/n. For n=1,2,...,15 is 1, 1, 2, 2, 6, 6, 18, 16, 48, 60, 176, 144, 630, 756, 1800.
*__classification:__ polynomials ⊃ irreducibles ⊃ minimals ⊃ primitives ( ? ⊃ Maximum sequence length )
!!Irreducibles Introduction
From the following tables all irreducible polynomials of degree 16 or less over GF(2) can be found, and certain of their properties and relations among them are given. A primitive polynomial with a minimum number of nonzero coefficients and polynomials be-longing to all possible exponents is given for each degree 17 through 34.
Polynomials are given in an octal representation. The binary digits then are the coefficients of the polynomial, with the high-order coefficients at the left.
//__Example:__// in the 10th-degree list {{{3525}}} = {{{011 101 010 101}}} = X^^10^^+X^^9^^+X^^8^^+X^^6^^+X^^4^^+X^^2^^+1.
----
The reciprocal polynomial of an irreducible polynomial is also irreducible, and the reciprocal polynomial of a primitive polynomial is primitive. Of any pair consisting of a polynomial and its reciprocal polynomial, only one is listed in the table. Each entry that is followed by a letter in the table is an irreducible polynomial of the indicated degree. For degree 2 through 16, these polynomials along with their reciprocal polynomials comprise all irreducible polynomials of that degree. The letters following the octal representation give the following information:
| A, B, C, D |Not primitive |
| E, F, G, H |Primitive |
| A, B, E, F |The roots are linearly dependent |
| C, D, G, H |The roots are linearly independent |
| A, C, E, G |The roots of the reciprocal polynomial are linearly dependent |
| B, D, F, H |The roots of the reciprocal polynomial are linearly independent |
The other numbers in the table tell the relation between the polynomials. For each degree, a primitive polynomial with a minimum number of nonzero coefficients was chosen, and this polynomial is the first in the table of polynomials of this degree. Let //a// denote one of its roots. Then the entry following j in the table is the minimum polynomial of //a//^^j^^. The polynomials are included for each j unless for some i < j either //a//^^i^^ and //a//^^j^^ are roots of the same irreducible polynomial or //a//^^i^^ and //a//^^-j^^ are roots of the same polynomial. The minimum polynomial of //a//^^j^^ is included even if it has smaller degree than is indicated for that section of the table; such polynomials are not followed by a letter in the table.
//__Example:__// The primitive polynomial {{{103}}} = X^^6^^+X+1 = p(X) is the first entry in the table of 6th-degree irreducible polynomials. If //a// designates a root of p(X), then //a//^^3^^ is a root of {{{127}}} and //a//^^5^^ is a root of {{{147}}}. The minimum polynomial of //a//^^9^^ is {{{015}}} = X^^3^^+X^^2^^+1, and is of degree 3 rather than 6.
//__Example:__// There is no entry corresponding to //a//^^17^^. The other roots of the minimum polynomial of //a//^^17^^ are //a//^^34^^, //a//^^68^^ = //a//^^5^^, //a//^^10^^, //a//^^20^^, and //a//^^40^^. Thus the minimum polynomial of //a//^^17^^ is the same as the minimum polynomial of //a//^^5^^, or {{{147}}}.
//__Example:__// There is no entry corresponding to //a//^^13^^. The other roots of the minimum polynomial p~~13~~(X) of //a//^^13^^ are //a//^^26^^, //a//^^52^^, //a//^^104^^ = //a//^^41^^, //a//^^82^^ = //a//^^19^^ , and //a//^^38^^. None of these is listed. The roots of the reciprocal polynomial P~~13~~*(X) of P~~13~~(X) are //a//^^-13^^ = //a//^^50^^, //a//^^-26^^ = //a//^^37^^, //a//^^-52^^ = //a//^^11^^, //a//^^-41^^ = //a//^^22^^, //a//^^-19^^ = //a//^^44^^ and //a//^^-38^^ = //a//^^25^^. The minimum polynomial of //a//^^11^^ is listed as {{{155}}} or X^^6^^+X^^5^^+ X^^3^^+X^^2^^+1. The minimum polynomial of //a//^^13^^ is the reciprocal polynomial of this, or p~~13~~(X) = X^^6^^+X^^4^^+X^^3^^+X+1.
----
The exponent to which a polynomial belongs can be found as follows: If a is a primitive element of GF(2^^m^^), then the order e of //a//^^j^^ is e = (2^^m^^-1)/GCD(2^^m^^-1, j) and e is also the exponent to which the minimum function of //a//^^j^^ belongs. Thus, for example, in GF(2^^10^^), //a//^^55^^ has order 93, since 93 = 1023/GCD(1023, 55) = 1023/11. Thus the polynomial {{{3453}}} belongs to 93.
----
Marsh has published a table of all irreducible polynomials of degree 19 or less over GF(2). In this table the polynomials are arranged in lexicographical order; this is the most convenient form for determining whether or not a given polynomial is irreducible.
For degree 19 or less, the minimum-weight polynomials given in this table were found in Marsh's tables. For degree 19 through 34, the minimum-weight polynomial was found by a trial-and-error process in which each polynomial of weight 3, then 5, was tested.
The following procedure was used to test whether a polynomial f(X) of degree m is primitive:
*''1'' The residues of 1, X, X^^2^^, X^^4^^, ... , X^^2m-1^^ are formed modulo f(X).
*''2'' These are multiplied and reduced modulo f(X) to form the residue of X^^2^m-1^^. If the result is not 1, the polynomial is rejected. If the result is 1, the test is continued.
*''3'' For each factor //r// of 2^^m^^-1, the residue of X^^r^^ is formed by multiplying together an appropriate combination of the residues formed in Step 1. If none of these is 1, the polynomial is primitive.
Each other polynomial in the table was found by solving for the dependence relations among its roots by the method illustrated at the end of Section 8.1 in Peterson.
----
|Table Factorization of 2^^m^^-1 into Primes|c
|2^^3^^ - 1 = 7 |2^^19^^ - 1 = 524287 |
|2^^4^^ - 1 = 3x5 |2^^20^^ - 1 = 3x5x5x11x31x41|
|2^^5^^ - 1 = 31 |2^^21^^ - 1 = 7X7X127x337 |
|2^^6^^ - 1 = 3x3x7 |2^^22^^ - 1 = 3x23x89x683 |
|2^^7^^ - 1 = 127 |2^^23^^ - 1 = 47x178481 |
|2^^8^^ - 1 = 3x5x17 |2^^24^^ - 1 = 3x3x5x7x13x17x241|
|2^^9^^ - 1 = 7x73 |2^^25^^ - 1 = 31x601x1801 |
|2^^10^^ - 1 = 3x11x3 |2^^26^^ - 1 = 3x2731x8191 |
|2^^11^^ - 1 = 23x89 |2^^27^^ - 1 = 7x73x262657 |
|2^^12^^ - 1 = 3x3x5x7x13 |2^^28^^ - 1 = 3x5x29x43x113x127 |
|2^^13^^ - 1 = 8191 |2^^29^^ - 1 = 233x1103x2089 |
|2^^14^^ - 1 = 3x43x127 |2^^30^^ - 1 = 3x3x7x11x31x151x331 |
|2^^15^^ - 1 = 7x31x15 |2^^31^^ - 1 = 2147483647 |
|2^^16^^ - 1 = 3x5x17x257 |2^^32^^ - 1 = 3x5x17x257x65537 |
|2^^17^^ - 1 = 131071 |2^^33^^ - 1 = 7x23x89x599479 |
|2^^18^^ - 1 = 3x3x3x7x19x73 |2^^34^^ - 1 = 3x43691x131071 |
!! Irreducible Table
{{{
DEGREE 2 1 7H
DEGREE 3 1 13F
DEGREE 4 1 23F 3 37D 5 07
DEGREE 5 1 45E 3 75G 5 67H
DEGREE 6 1 103F 3 1278 5 147H 7 111A 9 015
11 155E 21 007
DEGREE 7 1 211E 3 217E 5 235E 7 367H 9 277E
11 325G 13 203F 19 313H 21 345G
DEGREE 8 1 435E 3 567B 5 763D 7 551E 9 675C
11 747H 13 453F 15 727D 17 023 19 545E 21 613D
23 543F 25 433B 27 477B 37 537F 43 703H 45 471A
51 037 85 007
DEGREE 9 1 1021E 3 1131E 5 1461G 7 1231A 9 1423G
11 1055E 13 1167F 15 1541E 17 1333F 19 1605G 21 1027A
23 1751E 25 1743H 27 1617H 29 1553H 35 1401C 37 1157F
39 1715E 41 1563H 43 1713H 45 1175E 51 1725G 53 1225E
55 1275E 73 0013 75 1773G 77 1511C 83 1425G 85 1267E
DEGREE 10 1 2011E 3 2017B 5 2415E 7 3771G 9 2257B
11 2065A 13 2157F 15 2653B 17 3515G 19 2773F 21 3753D
23 2033F 25 2443F 27 3573D 29 2461E 31 3043D 33 0075C
35 3023H 37 3543F 39 21078 41 2745E 43 2431E 45 3061C
47 3177H 49 3525G 51 2547B 53 2617F 55 3453D 57 3121C
59 3471G 69 2701A 71 3323H 73 3507H 75 2437B 77 2413B
83 3623H 85 2707E 87 2311A 89 2327F 91 3265G 93 3777D
99 0067 101 2055E 103 3575G 105 3607C 107 3171G 109 2047F
147 2355A 149 3025G 155 2251A 165 0051 171 3315C 173 3337H
179 3211G 341 0007
DEGREE 11 1 4005E 3 4445E 5 4215E 7 4055E 9 6015G
11 7413H 13 4143F 15 4563F 17 4053F 19 5023F 21 5623F
23 4757B 25 4577F 27 6233H 29 6673H 31 7237H 33 7335G
35 4505E 37 5337F 39 5263F 41 5361E 43 5171E 45 6637H
47 7173H 49 5711E 51 5221E 53 6307H 55 6211G 57 5747F
59 4533F 61 4341E 67 6711G 69 6777D 71 7715G 73 6343H
75 6227H 77 6263H 79 5235E 81 7431G 83 6455G 85 5247F
87 5265E 89 5343B 91 4767F 93 5607F 99 4603F 101 6561G
103 7107H 105 704IG 107 4251E 109 5675E 111 4173F 113 4707F
115 7311C 117 5463F 119 5755E 137 6675G 139 7655G 141 5531E
147 7243H 149 762IG 151 7161G 153 4731E 155 4451E 157 6557H
163 7745G 165 7317H 167 5205E 169 4565E 171 6765G 173 7535G
179 4653F 181 5411E 183 5545E 185 7565G 199 6543H 201 5613F
203 6013H 205 7647H 211 6507H 213 6037H 215 7363H 217 7201G
219 7273H 293 7723H 299 4303B 301 5007F 307 7555G 309 4261E
331 6447H 333 5141E 339 7461G 341 5253F
DEGREE 12 1 10123F 3 12133B 5 10115A 7 121538 9 11765A
11 15647E 13 12513B 15 13077B 17 16533H 19 16047H 21 10065A
23 11015E 25 13377B 27 14405A 29 14127H 31 17673H 33 13311A
35 10377B 37 13565E 39 13321A 41 15341G 43 15053H 45 15173C
47 15621E 49 17703C 51 10355A 53 15321G 55 10201A 57 12331A
59 11417E 61 13505E 63 10761A 65 00141 67 13275E 69 16663C
71 11471E 73 16237E 75 16267D 77 15115C 79 12515E 81 17545C
83 12255E 85 11673B 87 17361A 89 11271E 91 10011A 93 14755C
95 17705A 97 1712IG 99 17323D 101 14227H 103 12117E 105 13617A
107 14135G 109 14711G Ill 15415C 113 13131E 115 13223A 117 16475C
119 14315C 121 16521E 123 13475A 133 114338 135 10571A 137 15437G
139 12067F 141 13571A 143 12111A 145 16535C 147 17657D 149 12147F
151 14717F 153 13517B 155 14241C 157 14675G 163 10663F 165 10621A
167 16115G 169 16547C 171 10213B 173 12247E 175 16757D 177 16017C
179 17675E 181 10151E 183 14111A 185 14037A 187 14613H 189 13535A
195 00165 197 11441E 199 10321E 201 14067D 203 13157B 205 14513D
207 10603A 209 11067F 211 14433F 213 16457D 215 10653B 217 13563B
219 116578 221 17513C 227 12753F 229 13431E 231 10167B 233 11313F
235 11411A 237 13737B 239 13425E 273 00023 275 14601C 277 16021G
279 16137D 281 17025G 283 15723F 285 17141A 291 15775A 293 11477F
295 11463B 297 17073C 299 16401C 301 12315A 307 14221E 309 11763B
311 12705E 313 14357F 315 17777D 325 00163 327 17233D 329 11637B
331 16407F 333 11703A 339 16003C 341 11561E 343 12673B 345 14537D
347 1771IG 349 13701E 355 10467B 357 15347C 359 11075E 361 16363F
363 11045A 365 11265A 371 14043D 397 12727F 403 14373D 405 13003B
407 17057G 409 10437F 411 10077B 421 14271G 423 14313D 425 14155C
427 10245A 429 11073B 435 10743B 437 12623F 439 12007F 441 15353D
455 00111 585 00013 587 14545G 589 1631IG 595 13413A 597 12265A
603 14411C 613 15413H 619 17147F 661 10605E 683 10737F 685 16355C
691 15701G 693 12345A 715 00133 717 16571C 819 00037 1365 00007
DEGREE 13 1 20033F 3 23261E 5 24623F 7 23517F 9 30741G
11 21643F 13 3017IG 15 21277F 17 27777F 19 35051G 21 34723H
23 34047H 25 32535G 27 31425G 29 37505G 31 36515G 33 26077F
35 35673H 37 20635E 39 33763H 41 25745E 43 36575G 45 26653F
47 21133F 49 22441E 51 30417H 53 32517H 55 37335G 57 25327F
59 23231E 61 25511E 63 26533F 65 33343H 67 33727H 69 27271E
71 25017F 73 26041E 75 21103F 77 27263F 79 24513F 81 32311G
83 31743H 85 24037F 87 30711G 89 32641G 91 24657F 93 32437H
95 20213F 97 25633F 99 31303H 101 22525E 103 34627H 105 25775E
107 21607F 109 25363F Ill 27217F 113 33741G 115 37611G 117 23077F
119 21263F 121 31011G 123 27051E 125 35477H 131 3415IG 133 27405E
135 34641G 137 32445G 139 36375G 141 22675E 143 36073H 145 35121G
147 3650IG 149 33057H 151 36403H 153 35567H 155 23167F 157 36217H
159 22233F 161 32333H 163 24703F 165 33163H 167 32757H 169 23761E
171 24031E 173 30025G 175 37145G 177 31327H 179 27221E 181 25577F
183 22203F 185 37437H 187 27537F 189 31035G 195 24763F 197 20245E
199 20503F 201 20761E 203 25555E 205 30357H 207 33037H 209 34401G
211 32715G 213 21447F 215 27421E 217 20363F 219 3350IG 221 20425E
223 32347H 225 20677F 227 22307F 229 33441G 231 33643H 233 24165E
235 27427F 237 24601E 239 36721G 241 34363H 243 21673F 245 32167H
247 21661E 265 33357H 267 26341E 269 31653H 271 37511G 273 23003F
275 22657F 277 25035E 279 23267F 281 34005G 283 34555G 285 24205E
291 26611E 293 3267IG 295 25245E 297 31407H 299 33471G 301 22613F
303 35645G 305 3237IG 307 34517H 309 26225E 311 35561G 313 25663F
315 24043F 317 30643H 323 20157F 325 37151G 327 24667F 329 33325G
331 32467H 333 30667H 335 22631E 337 26617F 339 20275E 341 36625G
343 20341E 345 37527H 347 31333H 349 31071G 355 23353F 357 26243F
359 21453F 361 36015G 363 36667H 365 34767H 367 34341G 369 34547H
371 35465G 373 24421E 375 23563F 377 36037H 391 31267H 393 27133F
395 30705G 397 30465G 399 35315G 401 3223IG 403 32207H 405 26101E
407 22567F 409 21755E 411 22455E 413 33705G 419 37621G 421 21405E
423 30117H 425 23021E 427 21525E 429 36465G 431 33013H 433 27531E
435 24675E 437 33133H 439 34261G 441 33405G 443 34655G 453 32173H
455 33455G 457 35165G 459 22705E 461 37123H 463 27111E 465 35455G
467 31457H 469 23055E 471 30777H 473 37653H 475 24325E 477 31251G
547 35163H 549 33433H 551 37243H 553 27515E 555 32137H 557 26743F
563 30277H 565 20627F 567 35057H 569 24315E 571 24727F 581 30331G
583 34273H 585 23207F 587 31113H 589 36023H 595 27373F 597 20737F
599 36235G 601 21575E 603 26215E 605 21211E 611 20311E 613 34003H
615 34027H 617 20065E 619 22051E 621 22127F 627 23621E 629 24465E
651 26457F 653 31201G 659 34035G 661 27227F 663 22561E 665 21615E
667 22013F 669 23365E 675 26213F 677 26775E 679 32635G 681 33631G
683 32743H 685 31767H 691 34413H 693 22037F 695 30651G 697 26565E
711 22141E 713 22471E 715 35271G 717 37445G 723 22717F 725 26505E
727 24411E 729 24575E 731 23707F 733 25173F 739 21367F 741 25161E
743 24147F 793 36307H 795 24417F 805 20237F 807 36771G 809 37327H
811 27735E 813 31223H 819 36373H 821 33121G 823 32751G 825 33523H
}}}
* source: //W. Wesley Peterson, MIT Press (1970)//
/***
|Name:|PrettyDatesPlugin|
|Description:|Provides a new date format ('pppp') that displays times such as '2 days ago'|
|Version:|1.0 ($Rev: 3646 $)|
|Date:|$Date: 2008-02-27 02:34:38 +1000 (Wed, 27 Feb 2008) $|
|Source:|http://mptw.tiddlyspot.com/#PrettyDatesPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!!Notes
* If you want to you can rename this plugin. :) Some suggestions: LastUpdatedPlugin, RelativeDatesPlugin, SmartDatesPlugin, SexyDatesPlugin.
* Inspired by http://ejohn.org/files/pretty.js
***/
//{{{
Date.prototype.prettyDate = function() {
var diff = (((new Date()).getTime() - this.getTime()) / 1000);
var day_diff = Math.floor(diff / 86400);
if (isNaN(day_diff)) return "";
else if (diff < 0) return "in the future";
else if (diff < 60) return "just now";
else if (diff < 120) return "1 minute ago";
else if (diff < 3600) return Math.floor(diff/60) + " minutes ago";
else if (diff < 7200) return "1 hour ago";
else if (diff < 86400) return Math.floor(diff/3600) + " hours ago";
else if (day_diff == 1) return "Yesterday";
else if (day_diff < 7) return day_diff + " days ago";
else if (day_diff < 14) return "a week ago";
else if (day_diff < 31) return Math.ceil(day_diff/7) + " weeks ago";
else if (day_diff < 62) return "a month ago";
else if (day_diff < 365) return "about " + Math.ceil(day_diff/31) + " months ago";
else if (day_diff < 730) return "a year ago";
else return Math.ceil(day_diff/365) + " years ago";
}
Date.prototype.formatString_orig_mptw = Date.prototype.formatString;
Date.prototype.formatString = function(template) {
return this.formatString_orig_mptw(template).replace(/pppp/,this.prettyDate());
}
// for MPTW. otherwise edit your ViewTemplate as required.
// config.mptwDateFormat = 'pppp (DD/MM/YY)';
config.mptwDateFormat = 'pppp';
//}}}
!The First 1,000 Primes
2 3 5 7 11 13 17 19 23 29
31 37 41 43 47 53 59 61 67 71
73 79 83 89 97 101 103 107 109 113
127 131 137 139 149 151 157 163 167 173
179 181 191 193 197 199 211 223 227 229
233 239 241 251 257 263 269 271 277 281
283 293 307 311 313 317 331 337 347 349
353 359 367 373 379 383 389 397 401 409
419 421 431 433 439 443 449 457 461 463
467 479 487 491 499 503 509 521 523 541
547 557 563 569 571 577 587 593 599 601
607 613 617 619 631 641 643 647 653 659
661 673 677 683 691 701 709 719 727 733
739 743 751 757 761 769 773 787 797 809
811 821 823 827 829 839 853 857 859 863
877 881 883 887 907 911 919 929 937 941
947 953 967 971 977 983 991 997 1009 1013
1019 1021 1031 1033 1039 1049 1051 1061 1063 1069
1087 1091 1093 1097 1103 1109 1117 1123 1129 1151
1153 1163 1171 1181 1187 1193 1201 1213 1217 1223
1229 1231 1237 1249 1259 1277 1279 1283 1289 1291
1297 1301 1303 1307 1319 1321 1327 1361 1367 1373
1381 1399 1409 1423 1427 1429 1433 1439 1447 1451
1453 1459 1471 1481 1483 1487 1489 1493 1499 1511
1523 1531 1543 1549 1553 1559 1567 1571 1579 1583
1597 1601 1607 1609 1613 1619 1621 1627 1637 1657
1663 1667 1669 1693 1697 1699 1709 1721 1723 1733
1741 1747 1753 1759 1777 1783 1787 1789 1801 1811
1823 1831 1847 1861 1867 1871 1873 1877 1879 1889
1901 1907 1913 1931 1933 1949 1951 1973 1979 1987
1993 1997 1999 2003 2011 2017 2027 2029 2039 2053
2063 2069 2081 2083 2087 2089 2099 2111 2113 2129
2131 2137 2141 2143 2153 2161 2179 2203 2207 2213
2221 2237 2239 2243 2251 2267 2269 2273 2281 2287
2293 2297 2309 2311 2333 2339 2341 2347 2351 2357
2371 2377 2381 2383 2389 2393 2399 2411 2417 2423
2437 2441 2447 2459 2467 2473 2477 2503 2521 2531
2539 2543 2549 2551 2557 2579 2591 2593 2609 2617
2621 2633 2647 2657 2659 2663 2671 2677 2683 2687
2689 2693 2699 2707 2711 2713 2719 2729 2731 2741
2749 2753 2767 2777 2789 2791 2797 2801 2803 2819
2833 2837 2843 2851 2857 2861 2879 2887 2897 2903
2909 2917 2927 2939 2953 2957 2963 2969 2971 2999
3001 3011 3019 3023 3037 3041 3049 3061 3067 3079
3083 3089 3109 3119 3121 3137 3163 3167 3169 3181
3187 3191 3203 3209 3217 3221 3229 3251 3253 3257
3259 3271 3299 3301 3307 3313 3319 3323 3329 3331
3343 3347 3359 3361 3371 3373 3389 3391 3407 3413
3433 3449 3457 3461 3463 3467 3469 3491 3499 3511
3517 3527 3529 3533 3539 3541 3547 3557 3559 3571
3581 3583 3593 3607 3613 3617 3623 3631 3637 3643
3659 3671 3673 3677 3691 3697 3701 3709 3719 3727
3733 3739 3761 3767 3769 3779 3793 3797 3803 3821
3823 3833 3847 3851 3853 3863 3877 3881 3889 3907
3911 3917 3919 3923 3929 3931 3943 3947 3967 3989
4001 4003 4007 4013 4019 4021 4027 4049 4051 4057
4073 4079 4091 4093 4099 4111 4127 4129 4133 4139
4153 4157 4159 4177 4201 4211 4217 4219 4229 4231
4241 4243 4253 4259 4261 4271 4273 4283 4289 4297
4327 4337 4339 4349 4357 4363 4373 4391 4397 4409
4421 4423 4441 4447 4451 4457 4463 4481 4483 4493
4507 4513 4517 4519 4523 4547 4549 4561 4567 4583
4591 4597 4603 4621 4637 4639 4643 4649 4651 4657
4663 4673 4679 4691 4703 4721 4723 4729 4733 4751
4759 4783 4787 4789 4793 4799 4801 4813 4817 4831
4861 4871 4877 4889 4903 4909 4919 4931 4933 4937
4943 4951 4957 4967 4969 4973 4987 4993 4999 5003
5009 5011 5021 5023 5039 5051 5059 5077 5081 5087
5099 5101 5107 5113 5119 5147 5153 5167 5171 5179
5189 5197 5209 5227 5231 5233 5237 5261 5273 5279
5281 5297 5303 5309 5323 5333 5347 5351 5381 5387
5393 5399 5407 5413 5417 5419 5431 5437 5441 5443
5449 5471 5477 5479 5483 5501 5503 5507 5519 5521
5527 5531 5557 5563 5569 5573 5581 5591 5623 5639
5641 5647 5651 5653 5657 5659 5669 5683 5689 5693
5701 5711 5717 5737 5741 5743 5749 5779 5783 5791
5801 5807 5813 5821 5827 5839 5843 5849 5851 5857
5861 5867 5869 5879 5881 5897 5903 5923 5927 5939
5953 5981 5987 6007 6011 6029 6037 6043 6047 6053
6067 6073 6079 6089 6091 6101 6113 6121 6131 6133
6143 6151 6163 6173 6197 6199 6203 6211 6217 6221
6229 6247 6257 6263 6269 6271 6277 6287 6299 6301
6311 6317 6323 6329 6337 6343 6353 6359 6361 6367
6373 6379 6389 6397 6421 6427 6449 6451 6469 6473
6481 6491 6521 6529 6547 6551 6553 6563 6569 6571
6577 6581 6599 6607 6619 6637 6653 6659 6661 6673
6679 6689 6691 6701 6703 6709 6719 6733 6737 6761
6763 6779 6781 6791 6793 6803 6823 6827 6829 6833
6841 6857 6863 6869 6871 6883 6899 6907 6911 6917
6947 6949 6959 6961 6967 6971 6977 6983 6991 6997
7001 7013 7019 7027 7039 7043 7057 7069 7079 7103
7109 7121 7127 7129 7151 7159 7177 7187 7193 7207
7211 7213 7219 7229 7237 7243 7247 7253 7283 7297
7307 7309 7321 7331 7333 7349 7351 7369 7393 7411
7417 7433 7451 7457 7459 7477 7481 7487 7489 7499
7507 7517 7523 7529 7537 7541 7547 7549 7559 7561
7573 7577 7583 7589 7591 7603 7607 7621 7639 7643
7649 7669 7673 7681 7687 7691 7699 7703 7717 7723
7727 7741 7753 7757 7759 7789 7793 7817 7823 7829
7841 7853 7867 7873 7877 7879 7883 7901 7907 7919
Processing is an open-source java-based application that enables scripting of 2d graphics.
The same source code {{{*.pde}}} can be interpreted into "processing" IDE, or rendered into a web page by the processing.js library.
* {{{mouseCurve.pde}}}
{{{
// Declare variables that need to be seen both in setup and draw here
int nb = 15; // nb points on curve
int radius = 10; // size of dots in curve
int margin = 10; // border width
int[] vals; // array of values to be plotteds
int step; // x-dimension grid
// Setup is the function that is called once at t0 run time
void setup() {
size(400,200);
background(100);
noStroke();
fill(150);
rect(margin,margin,width-2*margin,height-2*margin);
vals = new int [nb];
for (int i=0; i< vals.length; i++) { vals[i] = 0;}
step = (width-2*margin)/nb;
}
// draw is the function that is called endlessly at 60 fps
void draw() {
// Clear previous plot
noStroke();
fill(150);
rect(margin,margin,width-2*margin,height-2*margin);
// Compute curve : shift points and get a new one
for (int i=0; i< vals.length; i++) {
if (i==vals.length-1) { vals[i]=mouseY;}
else { vals[i] = vals[i+1];}
}
// Plot curve
stroke(0);
for (int i=0; i< vals.length; i++) {
fill(i*10);
float x = margin+step*(i+0.5);
float y = margin+radius+(height-2*(margin+radius))*vals[i]/height;
ellipse(x,y,radius,radius);
}
}
}}}
* {{{mypage.html}}}
{{{
<!DOCTYPE html>
<html>
<head>
<title>Hello Web - Processing.js Test</title>
<script src="processing-1.4.1.min.js"></script>
</head>
<body>
<h1>Processing.js Test</h1>
<p>This is my first Processing.js web-based sketch:</p>
<canvas data-processing-sources="mouseCurve.pde"></canvas>
</body>
</html>
}}}
{{{
def pid():
id = 0
while True:
id += 1
yield "p%r"%(id)
pids = pid() # Process id generator
log = {} # Process life lines
def sched(delay,timeout,action,args,pid=None,trig=None):
if not pid: pid = pids.next()
log[pid]=[(time,"born")]
if trig:
log[pid]+=[(time,"triggable")]
while log[trig][-1][1] != "finished": yield # Wait for trigger
if delay:
log[pid]+=[(time,"delayed")]
for _ in range(delay): yield # Initial Delay
supervised = action(*args)
timebomb = timeout
result = None
log[pid]+=[(time,"running")]
while timebomb:
timebomb-=1
result=supervised.next()
if result:
log[pid]+=[(time,"finished")]
yield result # Job done
else: yield # Wait some more
log[pid]+=[(time,"lost")]
yield "timeout on %r"%(pid) # Too long
def myaction(data):
for _ in range(3): yield # Delay
yield ( data*2 ) # Result
def myaction2():
for _ in range(4): yield # Delay
yield ( "Hi there" ) # Result
story = [
[ # Delay TimeOut Task ID Trigger
sched(10 ,10 ,myaction,["yop"],pid ="me" ),
sched(2 ,10 ,myaction,["yap"] ,trig="me" ),
sched(0 ,2 ,myaction,["yip"] ,trig="me" ),
sched(6 ,10 ,myaction,["yup"],pid="bob" ),
sched(8 ,10 ,myaction,["yyp"] ,trig="bob"),
sched(4 ,10 ,myaction2,[] ,trig="bob"),
],[
sched(6 ,10 ,myaction,["AAA"]),
sched(8 ,10 ,myaction,["BBB"]),
]
]
time = 0
for chapter in story:
alive = chapter
while alive:
survivors = []
print "time:",time
for process in alive:
result=process.next()
if result: print result
else: survivors.append(process)
alive = survivors
time += 1
for pid in log:
row = " "*80
start = int(log[pid][ 0][0])
span = int(log[pid][-1][0])-start+1
row = [" "]*start+["."]*span
for time,state in log[pid]:
row[int(time)] = state[0]
print "%10s : %s"%(pid,"".join(row))
}}}
{{{
me : d.........r..f
p2 : t............r.l
p1 : t............d.r..f
p6 : d.......r..f
p4 : t........d...r...f
p3 : t........d.......r..f
p5 : d.....r..f
bob : d.....r..f
}}}
!!Culture
''— Basic & Pascal — ABC — Python →''
* In ''1991'', Guido van Rossum published Python as a successor of the ABC programming language.
* Python is designed around a philosophy which emphasizes readability and the importance of programmer effort over computer effort.
* Python was nammed after the television series //Monty Python's Flying Circus//. There is a common practice of using Monty Python references in example code.
!! vi-Friendly header
{{{
#!/usr/bin/env python
# vi: ts=4:sts=4:sw=4:et
}}}
!!Interactive start
{{{
python
>>> print "A"*2+"B"*3
}}}
//AABBB//
!!Debugger
To enter interactive post-mortem debugging analysis on abnormal exit:
{{{
python -m pdb myscript.py
}}}
!!Indentation matters
* Indentation is used as block delimiters
* Any indentation rule can be used, but it must be consistent within a block
{{{
#!/bin/env python
for i in [10,20,30]:
print "I'm in"
print "Me too:",i
print "I'm out"
}}}
//I'm in
Me too: 10
I'm in
Me too: 20
I'm in
Me too: 30
I'm out
//
!!Variables
* First assignment serves as declaration
* From the context , python understands if the variable's name or the value is needed:
** Bad: --print $myvar--
** Good: print myvar
{{{
myInteger = 1
myFloat = 3.4
mylist = ["A","B",6,3.4]
print len(mylist), mylist[0], mylist[-1], mylist[2:]
mydict = { "key1" : 3 , "key2" : "blue" }
print mydict["key2"], mydict.keys()
}}}
//4 A 3.4 [6, 3.3999999999999999]
blue ['key2', 'key1']
//
!System variables
{{{
import sys
print sys.argv
}}}
//['script_name','first_arg']
//
{{{
import os
print os.environ['OSTYPE']
}}}
//linux
//
!!Slicing
{{{
myvar = [ "a", "b", "c", "d", "e", "f" ]
print myvar[0],myvar[1],myvar[-2],myvar[-1]
print myvar[:3],myvar[3:]
}}}
//a b e f
['a', 'b', 'c'] ['d', 'e', 'f']
//
!!Quoting
{{{
mystring = "ABC" # can contain '
mystring = 'ABC' # can contain "
mystring = """ABC
DEF""" # Can contain anything including new lines
}}}
!! If-then-else
{{{
if 'a' in ['a','b','c']:
print "yes"
elif not val==12:
print "no"
else:
print "unknown"
}}}
!! "and" trick
{{{
if os.path.exists("myfile") and os.path.getsize("myfile")>0:
print "Not empty"
else:
print "Does'nt exist ( getsize not evaluated)"
}}}
//Does'nt exist ( getsize not evaluated)
//
!! Listed
* Basic
{{{
for v in ["A","B","C"]:
print v
}}}
//A
B
C//
* Multiple
{{{
mylist1 = ["A","B","C"]
mylist2 = [ 0 , 1 , 2 ]
for l,n in zip(mylist1,mylist2):
print l,n
}}}
//A 0
B 1
C 2
//
!! Range
* Basic
{{{
for i in range(3):
print i
}}}
//0
1
2//
* More about range
{{{
print range(4,9)
print range(4,9,2)
}}}
//[4, 5, 6, 7, 8]
[4, 6, 8]
//
!! Do-while substitue
{{{
while True:
do_something()
if condition():
break
}}}
!! Backward
{{{
for el in reverseIteraction(somelist):
do_something(el)
def reverseIteration(x):
if hasattr(x, 'keys'):
raise ValueError("mappings do not support reverse iteration")
i = len(x)
while i > 0:
i -= 1
yield x[i]
}}}
!! Function
* Declare anywhere in code:
{{{
def func(x):
y = x**2
z = x**3
return([y,z]) # A single object can be returned, i.e. pack it first
}}}
* Call
{{{
myY,myZ = func(5)
}}}
!! Methods
* Declare within a class bock:
{{{
class myObj:
def __init__(self,a,b):
self.a = a
self.b = b
def vol(self,h):
return( self.a*self.b*h)
}}}
*Call from instance
{{{
myinst = myObj(3,4)
myinst.vol(10) # self <- the instance pointer, h <- 10
}}}
//120
//
*Find methods of builtin types:
{{{
python> mylist = [1,2,3]
python> dir(mylist)
['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__delslice__', '__doc__', '__eq__', '__ge__', '__getattribute__', '__getitem__', '__getslice__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__repr__', '__rmul__', '__setattr__', '__setitem__', '__setslice__', '__str__', 'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']
python> mylist.reverse()
python> mylist
}}}
//3 2 1
//
!! Decorators
* def statements are executed at call
* Decorator statements are executed at def time
!! Shell
|!csh |!python |
|{{{if (-e myfile)}}} |{{{if os.path.exists("myfile"):}}} |
|{{{if (-d mydir)}}} |{{{if os.path.isdir("mydir"):}}} |
|{{{mkdir mydir}}} |{{{os.mkdir("mydir")}}} |
|{{{cd mydir}}} |{{{os.chdir("mydir")}}} |
|{{{rm myfile}}} |{{{os.remove("myfile")}}} |
|{{{cp src dst}}} |{{{shutil.copyfile(src,dst)}}} |
|{{{ln -s src dst}}} |{{{os.symlink(src,dst)}}} |
|{{{rm -rf mydir}}} |{{{shutil.rmtree("mydir")}}} |
|{{{$mypath:t}}} |{{{os.path.basename(mypath)}}} |
|{{{$mypath:r}}} |{{{os.path.dirname(mypath)}}} |
|{{{ls mydir}}} |{{{os.listdir(mydir)}}} |
|{{{pwd}}} |{{{os.getcwd() }}} |
!! Parser
{{{
fi = file('my_input' ,'r')
fo = file('my_output','w')
cnt = 0
for line in fi.readlines():
line.strip()
print >>fo,"%d %s"%(cnt,line),
cnt += 1
fi.close()
fo.close()
}}}
//0 A
1 B
2 C
//
!!os
* Launch child shell and get the exit code.
{{{
import os
status = os.system("date")
print status
status = os.system("ls file_that_doesnt_exist")
print status
}}}
//Thu May 22 14:01:57 CEST 2008
0
ls: file_that_doesnt_exist: No such file or directory
256//
!! popen2
* Capture stdout and exit code
{{{
import popen2
cmd = "cat big_file"
child = popen2.Popen4(cmd,1)
while child.poll()==-1: pass
for line in child.fromchild.readlines(): print line,
status = child.poll()
print status
}}}
* Capture stdout, on the fly for a big job
{{{
import popen2
import time
cmd = "cat very_long_file"
child = popen2.Popen4(cmd,1)
while child.poll()==-1:
line = child.fromchild.readline()
while line:
print line,
line = child.fromchild.readline()
time.sleep(0.2)
#--- Flush pipe in case of race poll/readline
for line in child.fromchild.readlines() :
print line,
status = child.poll()
}}}
!! subprocess ( python > 2.3 )
{{{
from subprocess import Popen, PIPE, STDOUT
cmd = "svn cat "+url
cat = Popen(cmd.split(), shell=False, stdout=PIPE, stderr=STDOUT)
for line in cat.stdout.readlines():
print line
}}}
| Statment | Py Rev | Example |
|abs(//x//)| |abs(47)==abs(-47) ⇒ True |
|all(//iterable//) | ≥2.5 |all([True,True,False,True)] ⇒ False |
|any(//iterable//) | ≥2.5 |all([False,False,True,False)] ⇒ True|
|basestring | ≥2.3 |isinstance('mystring', basestring) ⇒ True |
|bool([//x//]) | ≥2.2.1-2.3 |bool(""),bool(-4) ⇒ (False,True) |
|callable(//object//)| |callable(abs) ⇒ True |
|chr(//i//) ||ord('a'),chr(97) ⇒ (97,'a') |
|classmethod(//function//) | ≥2.2-2.4 | |
|cmp(//x,y//) ||[cmp(6,7),cmp(6,6),cmp(7,5)] ⇒ [-1,0,1] |
|compile(//string, filename,kind//[//,flags//[//,dont_inherit//]]) ||obj=compile("print('Hi')",'<string>','exec'); exec(obj) ⇒ 'Hi' |
|complex([//real//[,//imag//]])||complex(1,2) ⇒ (1+2j) |
|delattr(//object,name//) ⇔ del //object.name//|| |
|dict([//arg//])| ≥2.2-2.3 |dict({'one':2,'two':3}) ⇒ {'one':2,'two':3} |
|dict([//arg//])| ≥2.2-2.3 |dict({'one':2,'two':3}.items()) ⇒ {'one':2,'two':3} |
|dict([//arg//])| ≥2.2-2.3 |dict({'one':2,'two':3}.iteritems() ⇒ {'one':2,'two':3} |
|dict([//arg//])| ≥2.2-2.3 ≥2.2-2.3 |dict(zip(('one','two'), (2, 3))) ⇒ {'one':2,'two':3} |
|dict([//arg//])| ≥2.2-2.3 |dict([ ['two',3],['one', 2] ]) ⇒ {'one':2,'two':3} |
|dict([//arg//])| ≥2.2-2.3 |dict(one=2,two=3)}}} ⇒ {'one':2,'two':3} |
|dict([//arg//])| ≥2.2-2.3 |dict([(['one','two'][i-2], i) for i in (2,3)]) ⇒ {'one':2,'two':3} |
|dir(//[object]//)| |dir("mystring") ⇒ [...,'strip','split',..]|
|divmod(//a//,//b//) | ≥-2.3 |divmod(26,7) ⇒ (3,5) |
|enumerate(//iterable//) | ≥2.3 |obj=enumerate(['a','b']) ; obj.next(),obj.next() ⇒ ((0,'a'),(1,'b)) |
|eval(//expression//[,//globals//[,//locals//]]) | ≥-2.4 |eval('1+2') ⇒ 3 |
|execfile(//filename//[,//globals//[,//locals//]]) | ≥-2.4 | |
|file(//filename//[,//mode//[,//bufsize//]]) | ≥2.2 | |
|filter(None,//iterable//)||filter(None,(1,2,None,4,0,5)) ⇒ (1,2,4,5) |
|filter(//function//,//iterable//)|| |
|float([//x//])||float(" 4.5 ") ⇒ 4.5 |
|frozenset([//iterable//]) | ≥2.4 |frozenset(['a','b']) ⇒ frozenset(['a','b']) |
|getattr(//object//,//name//[,//default//]) | |
|globals()||myvar=5 ; 'myvar' in globals() ⇒ True |
|hasattr(//object//,//name//)| |hasattr(complex(2,3),'imag') ⇒ True |
|hash(//object//)| |hash('a') ⇒ 12416037344 |
|help([//object//]) | ≥2.2 |help("modules") ⇒ List available modules... |
|hex(//x//) | ≥-2.4 |hex(17) ⇒ '0x11' |
|id(object) | |o=object(); print(o) ; print("%x"%(id(o))) ⇒ <object object at 0xAEF47> "~AEF47" |
|input([prompt]) ⇔ eval(raw_input(prompt))||input("expr ? ") ⇒ expr ? 3+4 ⇒ 7 |
|int([//x//[,//radix//]])| |int("0101",2) ⇒ 5 |
|isinstance(//object,classinfo//) | ≥-2.2 |isinstance("a",int) ⇒ False |
|issubclass(//class,classinfo//) | ≥-2.3 | |
|iter(//o//[,//sentinel//]) | ≥2.2 | |
|len(//s//) ||len("abc")==len([1,2,3]) ⇒ True |
|lambda(x) : //code//||{{{map(lambda(x): x*2,[2,3])}}} ⇒ [4,6]|
|list([//iterable]//)| |list("abc")⇒["a","b","c"] |
|locals() || |
|long([//x//[,//radix//]])| |long(12) ⇒ 12L |
|map(//function//,//iterable//, ...)||map(abs,[1,-2,3,-4]) ⇒ [1,2,3,4] |
|~||map(cmp,[1,2,3],[3,2,1]) ⇒ [-1,0,1] |
|~||{{{map(operator.__add__,[1,2,3],[3,2,1])}}} ⇒ [4,4,4] |
|max(//iterable//[,//args...//][//key//]) | ≥-2.5 |max([1,2,3]) ⇒ 3 |
|min(//iterable//[,//args...//][//key//]) | ≥-2.5 |min([1,2,3]) ⇒ 1 |
|object() | ≥2.2-2.3 | |
|oct(//x//)| ≥-2.4 |oct(34) ⇒ '042' |
|open(//filename//[,//mode//[,//bufsize//]]) | ≥-2.5 | |
|ord(//c//) ||ord('a'),chr(97) ⇒ (97,'a') |
|pow(//x,y//[,//z//]) | ≥-2.2 |pow(2,3,7) ⇒ 1 |
|property([//fget//[,//fset//[,//fdel//[,//doc//]]]]) | ≥2.2-2.5 | |
|range([//start//,]//stop//[,//step//]) ||range(3) ⇒ [0,1,2] |
|range([//start//,]//stop//[,//step//]) ||range(1,4) ⇒ [1,2,3] |
|range([//start//,]//stop//[,//step//]) ||range(5,-3,-2) ⇒ [5,3,1,-1] |
|raw_input([prompt]) ||ans=raw_input("y or n ? "); print(ans) ⇒y⇒'y' |
|reduce(//function,iterable//[,//initializer//])| |reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) ⇒ ((((1+2)+3)+4)+5) ⇒ 15 |
|reload(//module//)| |import sys; reload(sys) ⇒<module 'sys' (built-in)> |
|repr(//object//) || |
|reversed(//seq//) | ≥2.4 |obj=reversed([1,2,3]); obj.next(),obj.next() ⇒(3,2) |
|round(//x//[,//n//]) ||round(4.5555555,3)⇒4.556 |
|set([//iterable//]) | ≥2.4 | |
|setattr(//object//,//name//,//value//) ⇔ //object.name//=//value// | |
|slice([//start//,]//stop//[,//step//])|| |
|sorted(//iterable//[,//cmp//[,//key//[,//reverse//]]]) | ≥2.4 | |
|staticmethod(//function//) | ≥2.2-2.4 | |
|str([//object//])| | |
|sum(//iterable//[,//start//]) | ≥2.3 |sum([1,2,3]) ⇒ 6 |
|super(//type//[,//object-or-type//]) | ≥2.2 | |
|tuple([//iterable//])| | |
|type(//object//) | ≥2.2 |isinstance('abc',type('a')) ⇒ True |
|type(//name//,//bases//,//dict//)| | |
|unichr(//i//) | ≥2.0 |unichr(97) ⇒ u'a' |
|unicode([//object//[,//encoding//[,//errors//]]]) | ≥2.0-2.2 | |
|vars([//object//]) || |
|xrange([//start//,]//stop//[,//step//]) ||same as range() but does'nt generate and store the full list |
|zip([//iterable//, ...]) | ≥2.2-2.4 |zip(['a','b'],[1,2])⇒[('a',1),('b',2)] |
|!Operation |!Syntax |!Function |
|Addition |a + b |add(a, b) |
|Concatenation |seq1 + seq2 |concat(seq1, seq2) |
|Containment Test |obj in seq |contains(seq, obj)|
|Division |a / b |div(a, b) (without {{{__future__}}}.division) |
|Division |a / b |truediv(a, b) (with {{{__future__}}}.division)|
|Division |{{{a // b}}} |floordiv(a, b) |
|Bitwise And |a & b |and_(a, b) |
|Bitwise Exclusive Or |a ^ b |xor(a, b) |
|Bitwise Inversion |~ a |invert(a) |
|Bitwise Or |a | b or_(a, b) |
|Exponentiation |a ** b |pow(a, b) |
|Identity |a is b |is_(a, b) |
|Identity |a is not b |is_not(a, b) |
|Indexed Assignment |obj[k] = v |setitem(obj, k, v) |
|Indexed Deletion |del obj[k] |delitem(obj, k) |
|Indexing |obj[k] |getitem(obj, k) |
|Left Shift |a << b |lshift(a, b) |
|Modulo |a % b |mod(a, b) |
|Multiplication |a * b |mul(a, b) |
|Negation (Arithmetic) |- a |neg(a) |
|Negation (Logical) |not a |not_(a) |
|Right Shift |a >> b |rshift(a, b) |
|Sequence Repetition |seq * i |repeat(seq, i) |
|Slice Assignment |seq[i:j] = values |setslice(seq, i, j, values) |
|Slice Deletion |del seq[i:j] |delslice(seq, i, j) |
|Slicing |seq[i:j] |getslice(seq, i, j) |
|String Formatting |s % obj |mod(s, obj) |
|Subtraction |a - b |sub(a, b) |
|Truth Test |obj |truth(obj) |
|Ordering |a < b |lt(a, b) |
|Ordering |a <= b |le(a, b) |
|Equality |a == b |eq(a, b) |
|Difference |a != b |ne(a, b) |
|Ordering |a >= b |ge(a, b) |
|Ordering |a > b |gt(a, b) |
* Pure python math
|>|>| ipython ( Interactive ) | vpython ( Visual ) |
|>| scipy (~SCIentific) | pylab (plotter) | numeric or numarray (former numpy) |
| numpy | numpy |~|~|
|Altas| python≥2.3 |>|>|
|Lapack|~|
|Blas |~|
* Other math projects
| sage |
| isympy ( interactive ) |
| sympy ( ~SYMbolic ) |
| python≥2.4 |
* Basic Web Server
| ~CGIHTTPServer |
| ~SimpleHTTPServer |
| ~BaseHTTPServer |
* Basic Web Server
|>|>| divmod.mantissa ( Application server ) | |>|>|
| divmod.axiom ( oo ↔ sql ) |>| divmod.nevow ( ajax, templating ) |~|
| sql | twisted.web (http) | twisted.cred (ssl) | twisted.dns | twisted.ldap | other protocols ... |
|~|>|>|>|>|>| twisted.core ( event-driven asynchronous socket server) |
|~|>|>|>|>|>| zope3 interface ( cgi ) |
* Frameworks
| Pythonic web Frameworks/servers | cherryPy | pylon | zope3 | Django |
| Pythonic cgi standards |>|>|>| wsgi( wiskey) |
| wsgi-compliant Apps |>| moinmoin ( wiki ) |>| pyAMF ( Flash Player ) |
!Meta Characters
| {{{.}}} |Any single character |
| {{{^}}} |Start of line ( change definition when in [] |
| {{{$}}} |End of line |
| {{{*}}} |0 or more repetition of the preceding character|
| {{{+}}} |1 or more repetition of the preceding character|
| {{{?}}} |0 or 1 of the preceding character|
| {{{*?}}} |Same as *, but non-gridy |
| {{{+?}}} |Same as +, but non-gridy |
| {{{??}}} |Same as ?, but non-gridy |
| {{{[abc]}}} |A single character in the set a, b or c |
| {{{[a-d]}}} |A single character in the set a,b,c or d|
| {{{[-bc]}}} |A single character in the set -,b, or c|
| {{{[^abc]}}} |Any character, but not a,b nor c |
| {{{[a^bc]}}} |Any character equal to a, ^, b or c |
| {{{\d}}} |A digit i.e. [0-9] |
| {{{\D}}} |Not a digit i.e. [^0-9] |
| {{{\s}}} |A whitespace i.e [ \t\n\r\f\v] |
| {{{\S}}} |Not a white space i.e. [^ \t\n\r\f\v] |
| {{{\w}}} |An alphanumeric character [a-zA-Z0-9_] |
| {{{\W}}} |Not an alphanumeric character i.e. [^a-zA-Z0-9] |
| {{{\A}}} |Start of string i.e. ^ in non multi-line mode |
| {{{\Z}}} |End of string i.e. $ in non multi-line mode |
| {{{\b}}} |0-width character at border of word i.e. transition \w ↔ \W|
| {{{\B}}} |0-width character not on the border of a word |
| {{{ABC|DEF}}} |ABC or DEF i.e. low priority or |
!Basic examples
* search vs match
{{{
import re
pattern = re.compile("BC")
pattern.search("ABCDEF") # true, contains BC
pattern.match("ABCDEFA") # false, not starting w/ BC
pattern.match("BCDEFA") # true, starting w/ BC
}}}
* method or function
{{{
import re
re.compile('A').search('abcAbc') # Same as below
re.search(re.compile('A'),'abcAbc') # Same as above
re.search('A','abcAbc') # Same as above
}}}
* grouping
{{{
pattern = re.compile("ab(..)ef(...)jk")
res=pattern.match("abcdefGHIjk")
print res.groups()[0]
print res.groups()[1]
}}}
//...
cd
GHI
//
!More about
* Visit [[Str01 RegExpr]] ...
!Parot example
{{{Client.py}}}
{{{
#!/bin/env python
import socket
HOST = 'remote.machine.com'
PORT = 50007
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST,PORT))
msg='Hello World'
print 'Sending',msg,'...'
s.send(msg)
data = s.recv(1024)
s.close()
print 'Received',repr(data)
}}}
{{{Server.py}}}
{{{
#!/bin/env python
import socket
HOST = ''
PORT = 50007
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST,PORT))
s.listen(1)
conn,addr = s.accept()
print 'Connected by',addr
while 1:
data = conn.recv(1024)
if not data: break
conn.send(data)
print "Looping back:",repr(data)
conn.close()
}}}
* retrieve data from xml with ''xpath''
{{{
#!/bin/env python
from xml.dom import minidom
from xml import xpath
myXml = """<?xml version="1.0" ?>
<data>
<cat id="hardware">
<item id="printer">
<info> inkjet 345 </info> <color id="red"/> <ref id="REF0001" />
</item>
<item id="screen">
<info> 22" </info> <color id="black"/> <ref id="REF0002" />
</item>
</cat>
<cat id="software">
<item id="calculator">
<info> scientific </info> <rev id="1.2"/> <ref id="REF0003" />
</item>
<item id="game">
<info> tetris </info> <rev id="3.4"/> <ref id="REF0004" />
</item>
</cat>
</data>
"""
#tree = minidom.parse('file.xml').documentElement
tree = minidom.parseString(myXml).documentElement
print "-> List of categories:"
for node in xpath.Evaluate('/data/cat',tree):
print node.getAttribute("id")
print "-> List of items in software category only:"
for node in xpath.Evaluate('/data/cat[@id="software"]/item',tree):
print node.parentNode.getAttribute("id"),
print node.tagName,
print node.getAttribute("id")
#print "-> Explore node object:"
#print dir(node)
}}}
//
-> List of categories:
hardware
software
-> List of items in software category only:
software item calculator
software item game
//
* Conversions bin/oct/hex/dec:
{{{
042
oct(34)
0xAA
int('0101',2)
int('FE',16)
"%X"%(126)
}}}
//34
'042'
170
5
254
'FE'//
* Conversion int→bin:
{{{
def dec2bin(n):
res = ''
if n == 0: return '0'
while n > 0:
res = str(n % 2) + res
n = n >> 1
return res
dec2bin(5)
}}}
//'101'//
!Characters
{{{ord('a')}}}
//97//
{{{chr(97)}}}
//'a'//
!Pattern building
{{{ 'ABC'+3*'W'}}}
//'ABCWWW'//
!List concatenation
{{{' '.join(['word1','word2','word3']) }}}
//'word1 word2 word3'//
!Character mapping
{{{import string;print 'yoplaBoom'.translate(string.maketrans('oaB','uAb'))
}}}
//'yuplAbuum'//
! Simple service
* Server side
{{{
#!/bin/env python
from SimpleXMLRPCServer import *
class My_Web_Service:
def __init__(self):
pass
# not callable through XML RPC because starts with '_'
def _private(self):
pass
def add(self, x, y):
return x + y
def mul(self, x, y):
return x * y
if __name__ == "__main__":
server = SimpleXMLRPCServer(("localhost", 8080))
server.register_instance(My_Web_Service())
server.serve_forever()
}}}
* Client side
{{{
#!/bin/env python
import xmlrpclib
server = xmlrpclib.Server('http://localhost:8080')
print server.add(3, 4)
print server.mul(3, 4)
}}}
! Remote File Parser
* server
{{{
#!/usr/bin/env python
from SimpleXMLRPCServer import SimpleXMLRPCServer
import xmlrpclib
def parser(dataIn):
inLines = dataIn.data.strip().split("\n")
outLines = []
for inLine in inLines:
# Do the line job here...
myLine = "Loopback:"+inLine
outLines.append( myLine )
return xmlrpclib.Binary("\n".join(outLines))
server = SimpleXMLRPCServer(("localhost", 8000))
print "Listening on port 8000..."
server.register_function(parser)
server.serve_forever()
}}}
* client
{{{
#!/usr/bin/env python
import xmlrpclib
server=xmlrpclib.ServerProxy("http://localhost:8000/")
fileIn = "data.txt"
fileOut = "parsed.txt"
fi=open(fileIn, "r")
fo=open(fileOut, "w")
fo.write(server.parser(xmlrpclib.Binary(fi.read())).data)
fi.close()
fo.close()
}}}
* A .pyc is created at first import of a module, to accelerate future imports.
* Execution of top level script is not considered as a module and doesn't trigger pyc creation
* A .pyc creation can be forced:
{{{
$ python -mcompileall .
}}}
{{{
$ python compileall.py .
}}}
{{{
$ python
>>> import py_compile
>>> py_compile.compile('abc.py')
}}}
* A .pyc can be //disassembled//
{{{
import marshal,dis
f=open('myfile.pyc','rb') # Read binary
magic=f.read(4) # Skip 4-byte magic number ( means python 2.1,2.2... )
stamp=f.read(4) # Skip 4-byte time stamp
code=marshal.load(f)
dis.dis(code)
}}}
* A .pyc can be converted back to py with {{{decompyle}}} ( old is free <2.3, recent is for $ )
* The magic number can tell which python has been used:
| 994e0d0a | 1.5 |
| fcc40d0a | 1.6 |
| 87c60d0a | 2.0 |
| 2aeb0d0a | 2.1 |
| 2ded0d0a | 2.2 |
| 3bf20d0a | 2.3 |
| 6df20d0a | 2.4 |
| d1f20d0a | 2.6 |
| | |
{{{>>> import this}}}
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one - - and preferably only one - - obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea - - let's do more
Simple Password query
{{{
import Tkinter as tk
def dialog(gui) :
#---
gui.geometry('300x160')
gui.title('Credentials?')
gui.zone = tk.Frame(gui, padx=10, pady=10)
gui.zone.pack(fill=tk.BOTH, expand=True)
#---
tk.Label(gui.zone, text="User name:").pack(side=tk.TOP)
gui.User = tk.Entry(gui.zone, width=16)
gui.User.pack(side=tk.TOP, padx=10, fill=tk.BOTH)
#---
tk.Label(gui.zone, text="Password :").pack(side=tk.TOP)
gui.Pass = tk.Entry(gui.zone, width=16,show="*")
gui.Pass.pack(side=tk.TOP, padx=10, fill=tk.BOTH)
gui.Pass.bind('<Return>', lambda event: gui.quit() )
#---
ok = tk.Button(gui.zone, borderwidth=4, text="OK", width=10, pady=8)
ok["command"]= lambda : gui.quit()
ok.pack(side=tk.BOTTOM)
#---
gui.User.focus_set()
gui.mainloop()
gui=tk.Tk()
dialog(gui)
print gui.User.get()
print gui.Pass.get()
}}}
More widgets
{{{
python -x %~f0 %* &goto :eof
#----------------- Frame
import Tix
app = Tix.Tk()
app.title("GUI Example")
app.geometry("450x300+200+200")
#----------------- Text Display
labelVal = Tix.StringVar()
labelBox = Tix.Label(app,textvariable=labelVal,height=4)
labelVal.set("Hello World")
labelBox.pack()
#----------------- Check Box
checkBoxVal = Tix.IntVar()
checkBox = Tix.Checkbutton(app,variable=checkBoxVal,text="Happy?")
checkBox.pack()
#----------------- String Entry
nameVal = Tix.StringVar(None)
nameBox = Tix.Entry(app,textvariable=nameVal)
nameBox.pack()
#----------------- Exclusive Choice
def statusClicked():
import tkMessageBox
radioValue=statusVal.get()
tkMessageBox.showinfo("You clicked",radioValue)
return
statusVal=Tix.StringVar()
statusVal.set(None)
radio1 = Tix.Radiobutton(app,text="Single" ,value="Single" ,variable=statusVal,command=statusClicked).pack()
radio2 = Tix.Radiobutton(app,text="Married",value="Married",variable=statusVal,command=statusClicked).pack()
#----------------- Button and action
def changeLabel():
name = "Thanks "+nameVal.get()
labelVal.set(name)
nameBox.delete(0,Tix.END)
nameBox.insert(0,"My name is Dereck")
return
button = Tix.Button(app, text="Click here",width=20,command=changeLabel)
button.pack(side='bottom',padx=15,pady=15)
app.mainloop()
}}}
{{{
def encode(msg,key,sign):
x = ""
o = lambda x: ord("x")-ord(" ")
for m,k in zip(msg,key*100):
x += chr( (o(m)+sign*o(k))%(o("~")+1)+o("@") )
return x
}}}
{{{
#!/usr/bin/env python
# vi: ts=4:sts=4:sw=4:et
# Author : Derivation Bud
# Credits: Christopher Craig
#
# This module is inspired by pyhp, the preprocessing syntax is
# the same but all CGI-related code has been discarded
#
import sys,re
import code
import StringIO
class myInterpreter(code.InteractiveInterpreter):
def pushcode(self,codeobj):
try:
c=code.compile_command(codeobj,self.srcFile,'exec')
except:
self.showsyntaxerror()
raise SyntaxError, 'Bad in-line script'
if c:
self.runcode(c)
else:
print >>sys.stderr,"File: "+self.srcFile
print >>sys.stderr,"Code: "+codeobj
raise SyntaxError, 'Incomplete in-line script'
def pushvar(self,var):
try: garbage=eval(var,self.locals)
except:
print >>sys.stderr,"Sorry, can't preprocess:",var
return(1)
cmd='sys.stdout.write(str(%s))'%(var)
self.runsource(cmd)
return(0)
def pushtext(self,text):
sys.stdout.write(text)
def run(srcFile,dstFile,pars={}):
pattern = re.compile('(<%.*?%>)',re.S)
engine = myInterpreter({'pars':pars,'sys':sys})
engine.__dict__['srcFile']=srcFile
sourceData = open(srcFile).read()
fields = pattern.split(sourceData)
fields = filter(lambda x: len(x)!=0,fields)
if len(fields)>1:
buffer = StringIO.StringIO()
memorized = sys.stdout
sys.stdout = buffer
badVars = 0
for f in fields:
if f[:3]=="<%=" : badVars+=engine.pushvar(f[4:-2])
elif f[:3]=="<%-" : pass
elif f[:2]=="<%" :
engine.pushcode(f[3:-2])
buffer.seek(-1,2) # Get rid of final \n
else : engine.pushtext(f)
fo=file(dstFile,'w')
fo.write(buffer.getvalue())
fo.close()
buffer.close()
sys.stdout = memorized
if badVars: return(None)
else: return(dstFile)
else:
return(srcFile)
if __name__=="__main__":
run(sys.argv[1],"preprocessor.out")
}}}
{{{
#!/usr/bin/env python
# vi: ts=4:sts=4:sw=4:et
# Author : Derivation Bud
# Credits: Christopher Craig
#
# This module is inspired by pyhp, the preprocessing syntax is
# the same but all CGI-related code has been discarded
#
import sys,re
import code
import io
class myInterpreter(code.InteractiveInterpreter):
def pushcode(self,codeobj):
compiled=code.compile_command(codeobj,self.srcFile,'exec')
self.runcode(compiled)
def pushvar(self,var):
self.pushcode('sys.stdout.write(%s)'%(var))
def pushtext(self,text):
sys.stdout.write(text)
def run(srcFile,dstFile):
engine = myInterpreter({'sys':sys})
engine.__dict__["srcFile"]=srcFile
# Redirect screen to buffer
screen = sys.stdout
buffered = io.StringIO()
sys.stdout = buffered
# Iterate and dispatch tokens
sourceData = open(srcFile).read()
chunks = re.split(r'(<%.*?%>)',sourceData,flags=re.S)
for chunk in chunks:
stripped=chunk.split("%>")[0]
if stripped[:3]=="<%-" : pass
elif stripped[:3]=="<%=" : engine.pushvar( stripped[4:])
elif stripped[:2]=="<%" : engine.pushcode(stripped[3:])
else : engine.pushtext(chunk)
# Flush buffer to file
fo=open(dstFile,'w')
fo.write(buffered.getvalue())
fo.close()
buffered.close()
sys.stdout = screen
if __name__=="__main__":
run(sys.argv[1],"preprocessor.out")
}}}
* Rule: a decorator must be defined and callable ( i.e. a function or an object with a __call__ method )
* Why: It can be use to do stuff before/after a function call, what ever the function beeing decorated and passed as argument.
{{{
class entryExit(object):
def __init__(self, f):
self.f = f
def __call__(self):
print "Entering", self.f.__name__
self.f()
print "Exited", self.f.__name__
@entryExit
def func1():
print "inside func1()"
@entryExit
def func2():
print "inside func2()"
func1()
func2()
}}}
The output is:
{{{
Entering func1
inside func1()
Exited func1
Entering func2
inside func2()
Exited func2
}}}
* wsgi is a server/application interface standard.
* a wsgi-compliant app must:
** be a callable returning answer's body as a list of strings
** accept 2 args:
*** a dictionnary of ~CGI-like environement variables
*** a callback function provided by the server, that must be used to return status and header
application skeleton:
{{{
# This is our application object. It could have any name,
# except when using mod_wsgi where it must be "application"
def application( # It accepts two arguments:
# environ points to a dictionary containing CGI like environment variables
# which is filled by the server for each received request from the client
environ,
# start_response is a callback function supplied by the server
# which will be used to send the HTTP status and headers to the server
start_response):
# build the response body possibly using the environ dictionary
response_body = 'The request method was %s' % environ['REQUEST_METHOD']
# HTTP response code and message
status = '200 OK'
# These are HTTP headers expected by the client.
# They must be wrapped as a list of tupled pairs:
# [(Header name, Header value)].
response_headers = [('Content-Type', 'text/plain'),
('Content-Length', str(len(response_body)))]
# Send them to the server using the supplied function
start_response(status, response_headers)
# Return the response body.
# Notice it is wrapped in a list although it could be any iterable.
return [response_body]
}}}
{{{
#!/usr/bin/python
from pylab import *
data = [
[1,2,3,4,5],
[2,3,4,5,6],
[3,4,5,6,7],
]
figure()
boxplot(data)
#savefig('box7')
show()
}}}
{{{
#!/usr/local/bin/sage -python
import sys
from sage.all import *
if len(sys.argv) != 2:
print "Usage: %s <n>"%sys.argv[0]
print "Outputs the prime factorization of n."
sys.exit(1)
print factor(sage_eval(sys.argv[1]))
}}}
!open-ldap client
{{{
ldapsearch -x -H ldap://myldapserver.mycompany.com -b "dc=mycompany,dc=com" 'uid=*' mail cn uid
}}}
!pythonic
{{{
import ldap
ldapCon = ldap.initialize("ldap://myldapserver.mycompany.com")
ldapCon.protocol_version = ldap.VERSION3
ldapDump = ldapCon.search_s(
base = "dc=mycompany,dc=com",
scope = ldap.SCOPE_SUBTREE,
filterstr = "uid=*",
attrlist = ["uid","cn","mail"]
)
}}}
{{{
username = "thelogin"
password = "thepass"
loginUrl = "https://www.thesite.net/login"
jsonUrl = "https://www.thesite.net/the/request?givemeajson=db"
import urllib2
import urllib
from cookielib import CookieJar
cj = CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
# First request is a post because there is a data field
request = opener.open(loginUrl, urllib.urlencode( {
"Login" : username,
"Password" : password }
))
content = request.read()
# Second request will forward the sessions coockies
request = opener.open(jsonUrl)
theJson = request.read()
import json
theDict = json.loads(theJson)
}}}
!Find path to shared lib
{{{
$ ldd `which openssl`
...
libcrypto.so.10 => /usr/lib64/libcrypto.so.10
...
}}}
!Find symbols in shared lib
{{{
$ readelf -Ws /usr/lib64/libcrypto.so.10
...
243: 0000003c04283ea0 1769 FUNC GLOBAL DEFAULT 12 DES_ede3_cbcm_encrypt@@libcrypto.so.10
...
}}}
!Wrap
{{{
import ctypes
from ctypes.util import find_library
ssllib=ctypes.CDLL(find_library('ssl'))
key=ctypes.create_strig_buffer(255)
sslib.DES_string_to_key("abcdefgh",ctypes.byref(key))
}}}
{{{
rooturl = 'https://myserver/mysite'
username = 'myname'
password = '******'
fullurl = rooturl+'/this/page.html'
import urllib2
passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
passman.add_password(None, rooturl, username, password)
authhandler = urllib2.HTTPBasicAuthHandler(passman)
opener = urllib2.build_opener(authhandler)
urllib2.install_opener(opener)
page = urllib2.urlopen(fullurl)
}}}
* 450 g farine
* 6 oeufs
* 1 l de lait
* sel
* pas de sucre
* beurre noisette ( beurre qui arrete de chanter )
* Rhum ou eau de fleur d'oranger
=> 22 crêpes
Tarte salee:
* 250g de farine
* 100g de beurre
* pincée de sel
* un fond de verre d'eau tiède. Peu d'eau : pâte rustique, Plus d'eau : pâte fine.
Tarte sucree ( Tante Sisi )
* 200g farine
* 60g de beurre
* 60g sucre
* un peu d'eau
The bottom-up stack is:
# SDK : to be installed first
# platform ( or target ) i.e android 1.6 or 2.0 : to be installed from the SDK
# device ( virtual or phone set model ) : to be declared or installed
# project ( to be developped )
How-to install the stack:
# download and unpack: android-sdk-***.zip
# launch the sdk
## {{{ .../tools/android }}}
# In the gui:
## setups -> Enable http instead of https
## available packages -> Refresh
## available packages -> Select at least 1 platform ( android 2.0 for example ) and install
# available platforms can be listed from the shell:
## {{{ android list targets }}}
# an Android Virtual Device must be created:
## {{{ android create avd --name my_avd --target 2}}}
# A project can be stubbed:
## {{{android create project --target 2
--name MyAndroidApp
--path ./MyAndroidAppProject
--activity MyAndroidAppActivity
--path ./MyAndroidAppProject
--activity MyAndroidAppActivity
--package com.example.myandroid
}}}
# Work on the source code now
# Build the project
## {{{ cd MyAndroidAppProject}}}
## {{{ ant debug }}}
# Launch the emulator:
## {{{ emulator -avd my_avd }}}
# Install app onto the emulator
## {{{adb install ./MyAndroidAppProject/bin/MyAndroidApp-debug.apk}}}
# Reinstall app onto the emulator
## {{{adb install -r ./MyAndroidAppProject/bin/MyAndroidApp-debug.apk}}}
/***
|Name:|QuickOpenTagPlugin|
|Description:|Changes tag links to make it easier to open tags as tiddlers|
|Version:|3.0.1 ($Rev: 3861 $)|
|Date:|$Date: 2008-03-08 10:53:09 +1000 (Sat, 08 Mar 2008) $|
|Source:|http://mptw.tiddlyspot.com/#QuickOpenTagPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
***/
//{{{
config.quickOpenTag = {
dropdownChar: (document.all ? "\u25bc" : "\u25be"), // the little one doesn't work in IE?
createTagButton: function(place,tag,excludeTiddler) {
// little hack so we can do this: <<tag PrettyTagName|RealTagName>>
var splitTag = tag.split("|");
var pretty = tag;
if (splitTag.length == 2) {
tag = splitTag[1];
pretty = splitTag[0];
}
var sp = createTiddlyElement(place,"span",null,"quickopentag");
createTiddlyText(createTiddlyLink(sp,tag,false),pretty);
var theTag = createTiddlyButton(sp,config.quickOpenTag.dropdownChar,
config.views.wikified.tag.tooltip.format([tag]),onClickTag);
theTag.setAttribute("tag",tag);
if (excludeTiddler)
theTag.setAttribute("tiddler",excludeTiddler);
return(theTag);
},
miniTagHandler: function(place,macroName,params,wikifier,paramString,tiddler) {
var tagged = store.getTaggedTiddlers(tiddler.title);
if (tagged.length > 0) {
var theTag = createTiddlyButton(place,config.quickOpenTag.dropdownChar,
config.views.wikified.tag.tooltip.format([tiddler.title]),onClickTag);
theTag.setAttribute("tag",tiddler.title);
theTag.className = "miniTag";
}
},
allTagsHandler: function(place,macroName,params) {
var tags = store.getTags(params[0]);
var filter = params[1]; // new feature
var ul = createTiddlyElement(place,"ul");
if(tags.length == 0)
createTiddlyElement(ul,"li",null,"listTitle",this.noTags);
for(var t=0; t<tags.length; t++) {
var title = tags[t][0];
if (!filter || (title.match(new RegExp('^'+filter)))) {
var info = getTiddlyLinkInfo(title);
var theListItem =createTiddlyElement(ul,"li");
var theLink = createTiddlyLink(theListItem,tags[t][0],true);
var theCount = " (" + tags[t][1] + ")";
theLink.appendChild(document.createTextNode(theCount));
var theDropDownBtn = createTiddlyButton(theListItem," " +
config.quickOpenTag.dropdownChar,this.tooltip.format([tags[t][0]]),onClickTag);
theDropDownBtn.setAttribute("tag",tags[t][0]);
}
}
},
// todo fix these up a bit
styles: [
"/*{{{*/",
"/* created by QuickOpenTagPlugin */",
".tagglyTagged .quickopentag, .tagged .quickopentag ",
" { margin-right:1.2em; border:1px solid #eee; padding:2px; padding-right:0px; padding-left:1px; }",
".quickopentag .tiddlyLink { padding:2px; padding-left:3px; }",
".quickopentag a.button { padding:1px; padding-left:2px; padding-right:2px;}",
"/* extra specificity to make it work right */",
"#displayArea .viewer .quickopentag a.button, ",
"#displayArea .viewer .quickopentag a.tiddyLink, ",
"#mainMenu .quickopentag a.tiddyLink, ",
"#mainMenu .quickopentag a.tiddyLink ",
" { border:0px solid black; }",
"#displayArea .viewer .quickopentag a.button, ",
"#mainMenu .quickopentag a.button ",
" { margin-left:0px; padding-left:2px; }",
"#displayArea .viewer .quickopentag a.tiddlyLink, ",
"#mainMenu .quickopentag a.tiddlyLink ",
" { margin-right:0px; padding-right:0px; padding-left:0px; margin-left:0px; }",
"a.miniTag {font-size:150%;} ",
"#mainMenu .quickopentag a.button ",
" /* looks better in right justified main menus */",
" { margin-left:0px; padding-left:2px; margin-right:0px; padding-right:0px; }",
"#topMenu .quickopentag { padding:0px; margin:0px; border:0px; }",
"#topMenu .quickopentag .tiddlyLink { padding-right:1px; margin-right:0px; }",
"#topMenu .quickopentag .button { padding-left:1px; margin-left:0px; border:0px; }",
"/*}}}*/",
""].join("\n"),
init: function() {
// we fully replace these builtins. can't hijack them easily
window.createTagButton = this.createTagButton;
config.macros.allTags.handler = this.allTagsHandler;
config.macros.miniTag = { handler: this.miniTagHandler };
config.shadowTiddlers["QuickOpenTagStyles"] = this.styles;
store.addNotification("QuickOpenTagStyles",refreshStyles);
}
}
config.quickOpenTag.init();
//}}}
!!Culture
Ruby was conceived in 1993 by Yukihiro Matsumoto who wished to create a new language that balanced functional programming with imperative programming. According to Matsumoto he "wanted a scripting language that was more powerful than Perl, and more object-oriented than Python. That's why I decided to design my own language".
!!Quick start
* Interpreter is '''ruby''', but interactive shell is '''irb'''
{{{
irb
irb(main):001:0> puts "Hi"
Hi
=> nil
irb(main):002:0> "abcdEFghiJKlm".scan(/[A-Z]./)
=> ["EF","JK"]
}}}
* Comments
{{{
# This is a comment
print "Hello"
=begin
This is a comment
This is a comment
This is a comment
=end
print "Bye"
}}}
* Methods
All subroutines are methods.
{{{
"AAA".methods
=> ["upcase!", "zip", "find_index", "between?", "to_f", ...by", "squeeze", "crypt", "gsub!", "taint", "to_enum", "instance_variable_defined?", "match", "downcase!"
}}}
Methods suffixed with a bang, modify the self.
!Naming
|Local variables are not prefixed |{{{myLocalVar}}} |
|Global Variables start with {{{$}}} |{{{$myGlobalVar}}} |
|Instance Variables start with {{{@}}} |{{{@myInstVar}}} |
|Class Variables start with {{{@@}}} | {{{@@myClassVar}}} |
|Class Names are ~TitleCase | {{{MyClassName}}} |
{{{
counter = 1
file = File.new("readfile.rb", "r")
while (line = file.gets)
puts "#{counter}: #{line}"
counter = counter + 1
end
file.close
}}}
! Simple example
* Launch Sketchup
* Menu -> Window -> Ruby console
* Line field: {{{load "/path/to/file/create_rectangle.rb"}}}
* With: {{{create_rectangle.rb}}}
{{{
require 'sketchup'
model = Sketchup.active_model
entities = model.entities
points = []
points[0] = Geom::Point3d.new(0 ,0 ,0 )
points[1] = Geom::Point3d.new(0 ,100,0 )
points[2] = Geom::Point3d.new(100,100,0 )
points[3] = Geom::Point3d.new(100,0 ,0 )
edges = []
edges[0] = entities.add_line( points[0],points[1] )
edges[1] = entities.add_line( points[1],points[2] )
edges[2] = entities.add_line( points[2],points[3] )
edges[3] = entities.add_line( points[3],points[0] )
entities.add_face edges
model.commit_operation
}}}
!Booleans
TBD
!Strings = "...",'...',"""...""""
{{{"yop".length}}}
//3
{{{yop".reverse}}}
//"poy"
{{{"yop"*5}}}
//"yopyopyopyopyop"
{{{"ABC DEF GHI".include? "AB"}}}
//true
!Arrays = [ ... ]
{{{[ "A" , 3 ] +["B","C"]}}}
//["A", 3, "B", "C"]
{{{[2,4,6,2].max}}}
//6
{{{[2,4,6,2].sort! # bang means the variable is altered}}}
//[2,2,4,6]
!Hash = { ... }
{{{dic={} }}}
//{}
{{{dic["A"]="yop"}}}
//"yop"
{{{dic["B"]="yap"}}}
//"yap"
{{{dic}}}
//{"A"=>"yop", "B"=>"yap"}
{{{dic.length}}}
//2
{{{dic.keys}}}
//["A", "B"]
{{{dic.values}}}
//["yap", "yop"]
!Conversion
{{{ 40.to_s # to string}}}
// "40"
{{{ "35".to_i # to integer}}}
// 35
{{{ 40.to_a # to array}}}
// [40]
! symbols = :
Cheap strings
{{{
:good
:evil
}}}
{{{
5.times { print "Yop" }
}}}
// ~YopYopYopYopYop
{{{
["A","B","C"].each { print "Yop"}
}}}
// ~YopYopYop
{{{
["A","B","C"].each { |x| print x }
}}}
// ABC
!All procedures are methods
{{{
def myNewMethod(arg1, arg2, arg3) # 3 arguments
# Code for the method would go here
end
}}}
{{{
def myOtherNewMethod # No arguments
# Code for the method would go here
end
}}}
/***
|Name:|RenameTagsPlugin|
|Description:|Allows you to easily rename or delete tags across multiple tiddlers|
|Version:|3.0 ($Rev: 5501 $)|
|Date:|$Date: 2008-06-10 23:11:55 +1000 (Tue, 10 Jun 2008) $|
|Source:|http://mptw.tiddlyspot.com/#RenameTagsPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License|http://mptw.tiddlyspot.com/#TheBSDLicense|
Rename a tag and you will be prompted to rename it in all its tagged tiddlers.
***/
//{{{
config.renameTags = {
prompts: {
rename: "Rename the tag '%0' to '%1' in %2 tidder%3?",
remove: "Remove the tag '%0' from %1 tidder%2?"
},
removeTag: function(tag,tiddlers) {
store.suspendNotifications();
for (var i=0;i<tiddlers.length;i++) {
store.setTiddlerTag(tiddlers[i].title,false,tag);
}
store.resumeNotifications();
store.notifyAll();
},
renameTag: function(oldTag,newTag,tiddlers) {
store.suspendNotifications();
for (var i=0;i<tiddlers.length;i++) {
store.setTiddlerTag(tiddlers[i].title,false,oldTag); // remove old
store.setTiddlerTag(tiddlers[i].title,true,newTag); // add new
}
store.resumeNotifications();
store.notifyAll();
},
storeMethods: {
saveTiddler_orig_renameTags: TiddlyWiki.prototype.saveTiddler,
saveTiddler: function(title,newTitle,newBody,modifier,modified,tags,fields,clearChangeCount,created) {
if (title != newTitle) {
var tagged = this.getTaggedTiddlers(title);
if (tagged.length > 0) {
// then we are renaming a tag
if (confirm(config.renameTags.prompts.rename.format([title,newTitle,tagged.length,tagged.length>1?"s":""])))
config.renameTags.renameTag(title,newTitle,tagged);
if (!this.tiddlerExists(title) && newBody == "")
// dont create unwanted tiddler
return null;
}
}
return this.saveTiddler_orig_renameTags(title,newTitle,newBody,modifier,modified,tags,fields,clearChangeCount,created);
},
removeTiddler_orig_renameTags: TiddlyWiki.prototype.removeTiddler,
removeTiddler: function(title) {
var tagged = this.getTaggedTiddlers(title);
if (tagged.length > 0)
if (confirm(config.renameTags.prompts.remove.format([title,tagged.length,tagged.length>1?"s":""])))
config.renameTags.removeTag(title,tagged);
return this.removeTiddler_orig_renameTags(title);
}
},
init: function() {
merge(TiddlyWiki.prototype,this.storeMethods);
}
}
config.renameTags.init();
//}}}
/%
|Name|ReplaceDoubleClick|
|Source|http://www.TiddlyTools.com/#ReplaceDoubleClick|
|Version|2.0.0|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|script|
|Requires|InlineJavascriptPlugin|
|Overrides|tiddler background click and doubleclick handlers|
|Description|disable doubleclick-to-edit-tiddler or replace doubleclick with shift/ctrl/alt+singleclick|
Usage:
in tiddler content:
<<tiddler ReplaceDoubleClick>> or
<<tiddler ReplaceDoubleClick with: key trigger>>
in ViewTemplate:
<span macro="tiddler ReplaceDoubleClick"></span> or
<span macro="tiddler ReplaceDoubleClick with: key trigger"></span>
where:
'key' (optional) is one of: none (default), ctrl, shift, or alt
'trigger' (optional) is one of: click, doubleclick (default)
* if no key parameter (or "none") is specified, then the double-click action is **disabled** for that tiddler.
* if a key (other than none) is specified, the doubleclick action for the tiddler will only be invoked
when the key+trigger combination is used.
* note: double-clicking will also trigger the single-click handler. As a result, when 'click' option is specified,
either click OR double-click (plus the specified key) will trigger the action.
Revisions:
2.0.0 renamed from ShiftClickToEdit and merged with DoubleClickDisable and added support specifying alternative key+click combination
%/<script>
var here=story.findContainingTiddler(place); if (!here) return;
if (here.ondblclick) {
here.setAttribute("editKey","none");
if ("$1"=="shift" || "$1"=="ctrl" || "$1"=="alt")
here.setAttribute("editKey","$1"+"Key");
var trigger=("$2"=="click")?"onclick":"ondblclick";
here.save_dblclick=here.ondblclick;
here.ondblclick=null;
if (here.getAttribute("editKey")!="none")
here[trigger]=function(e) {
var ev=e?e:window.event;
if (ev[this.getAttribute("editKey")])
this.save_dblclick.apply(this,arguments);
}
}
</script>
* Serverless implementation of an SQL database
* The database is a single binary file that can be directly processed via the sqlite3 command
* Interactive mode
{{{
$ sqlite3 test.db
SQLite version 3.0.8
Enter ".help" for instructions
sqlite> .quit
$
}}}
* Initialize a {{{test.db}}} file
{{{
$ sqlite3 test.db "create table t1 (t1key INTEGER PRIMARY KEY,data TEXT,num double,timeEnter DATE);"
}}}
* Stuff it
{{{
$ sqlite3 test.db "insert into t1 (data,num) values ('This is sample data',3);"
$ sqlite3 test.db "insert into t1 (data,num) values ('More sample data',6);"
$ sqlite3 test.db "insert into t1 (data,num) values ('And a little more',9);"
}}}
* Fetch it
{{{
$ sqlite3 test.db "select * from t1 order by t1key limit 1 offset 2";
3|And a little more|9|
}}}
* Dump it
{{{
$ sqlite3 test.db ".dump"
BEGIN TRANSACTION;
CREATE TABLE t1 (t1key INTEGER PRIMARY KEY,data TEXT,num double,timeEnter DATE);
INSERT INTO "t1" VALUES(1, 'This is sample data', 3, NULL);
INSERT INTO "t1" VALUES(2, 'More sample data', 6, NULL);
INSERT INTO "t1" VALUES(3, 'And a little more', 9, NULL);
COMMIT;
}}}
* Trigger
** If you want something more than a primary key increment such as a date stamp... you need a trigger
{{{
$ cat trigger1
-- ********************************************************************
-- Creating a trigger for timeEnter
-- Run as follows:
-- $ sqlite3 test.db < trigger1
-- ********************************************************************
CREATE TRIGGER insert_t1_timeEnter AFTER INSERT ON t1
BEGIN
UPDATE t1 SET timeEnter = DATETIME('NOW') WHERE rowid = new.rowid;
END;
-- ********************************************************************
}}}
{{{
$ sqlite3 test.db < trigger1
}}}
* Try the time stamp
{{{
$ sqlite3 test.db "insert into t1 (data,num) values ('First entry with timeEnter',19);"
$ sqlite3 test.db "select * from t1";
1|This is sample data|3|
2|More sample data|6|
3|And a little more|9|
4|First entry with timeEnter|19|2004-10-02 15:12:19
}}}
/***
|Name:|SaveCloseTiddlerPlugin|
|Description:|Provides two extra toolbar commands, saveCloseTiddler and cancelCloseTiddler|
|Version:|3.0 ($Rev: 5502 $)|
|Date:|$Date: 2008-06-10 23:31:39 +1000 (Tue, 10 Jun 2008) $|
|Source:|http://mptw.tiddlyspot.com/#SaveCloseTiddlerPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
To use these you must add them to the tool bar in your EditTemplate
***/
//{{{
merge(config.commands,{
saveCloseTiddler: {
text: 'done/close',
tooltip: 'Save changes to this tiddler and close it',
handler: function(ev,src,title) {
var closeTitle = title;
var newTitle = story.saveTiddler(title,ev.shiftKey);
if (newTitle)
closeTitle = newTitle;
return config.commands.closeTiddler.handler(ev,src,closeTitle);
}
},
cancelCloseTiddler: {
text: 'cancel/close',
tooltip: 'Undo changes to this tiddler and close it',
handler: function(ev,src,title) {
// the same as closeTiddler now actually
return config.commands.closeTiddler.handler(ev,src,title);
}
}
});
//}}}
/***
|Name:|SelectThemePlugin|
|Description:|Lets you easily switch theme and palette|
|Version:|1.0 ($Rev: 3646 $)|
|Date:|$Date: 2008-02-27 02:34:38 +1000 (Wed, 27 Feb 2008) $|
|Source:|http://mptw.tiddlyspot.com/#SelectThemePlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!Notes
* Borrows largely from ThemeSwitcherPlugin by Martin Budden http://www.martinswiki.com/#ThemeSwitcherPlugin
* Theme is cookie based. But set a default by setting config.options.txtTheme in MptwConfigPlugin (for example)
* Palette is not cookie based. It actually overwrites your ColorPalette tiddler when you select a palette, so beware.
!Usage
* {{{<<selectTheme>>}}} makes a dropdown selector
* {{{<<selectPalette>>}}} makes a dropdown selector
* {{{<<applyTheme>>}}} applies the current tiddler as a theme
* {{{<<applyPalette>>}}} applies the current tiddler as a palette
* {{{<<applyTheme TiddlerName>>}}} applies TiddlerName as a theme
* {{{<<applyPalette TiddlerName>>}}} applies TiddlerName as a palette
***/
//{{{
config.macros.selectTheme = {
label: {
selectTheme:"select theme",
selectPalette:"select palette"
},
prompt: {
selectTheme:"Select the current theme",
selectPalette:"Select the current palette"
},
tags: {
selectTheme:'systemTheme',
selectPalette:'systemPalette'
}
};
config.macros.selectTheme.handler = function(place,macroName)
{
var btn = createTiddlyButton(place,this.label[macroName],this.prompt[macroName],this.onClick);
// want to handle palettes and themes with same code. use mode attribute to distinguish
btn.setAttribute('mode',macroName);
};
config.macros.selectTheme.onClick = function(ev)
{
var e = ev ? ev : window.event;
var popup = Popup.create(this);
var mode = this.getAttribute('mode');
var tiddlers = store.getTaggedTiddlers(config.macros.selectTheme.tags[mode]);
// for default
if (mode == "selectPalette") {
var btn = createTiddlyButton(createTiddlyElement(popup,'li'),"(default)","default color palette",config.macros.selectTheme.onClickTheme);
btn.setAttribute('theme',"(default)");
btn.setAttribute('mode',mode);
}
for(var i=0; i<tiddlers.length; i++) {
var t = tiddlers[i].title;
var name = store.getTiddlerSlice(t,'Name');
var desc = store.getTiddlerSlice(t,'Description');
var btn = createTiddlyButton(createTiddlyElement(popup,'li'),name ? name : title,desc ? desc : config.macros.selectTheme.label['mode'],config.macros.selectTheme.onClickTheme);
btn.setAttribute('theme',t);
btn.setAttribute('mode',mode);
}
Popup.show();
return stopEvent(e);
};
config.macros.selectTheme.onClickTheme = function(ev)
{
var mode = this.getAttribute('mode');
var theme = this.getAttribute('theme');
if (mode == 'selectTheme')
story.switchTheme(theme);
else // selectPalette
config.macros.selectTheme.updatePalette(theme);
return false;
};
config.macros.selectTheme.updatePalette = function(title)
{
if (title != "") {
store.deleteTiddler("ColorPalette");
if (title != "(default)")
store.saveTiddler("ColorPalette","ColorPalette",store.getTiddlerText(title),
config.options.txtUserName,undefined,"");
refreshAll();
if(config.options.chkAutoSave)
saveChanges(true);
}
};
config.macros.applyTheme = {
label: "apply",
prompt: "apply this theme or palette" // i'm lazy
};
config.macros.applyTheme.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
var useTiddler = params[0] ? params[0] : tiddler.title;
var btn = createTiddlyButton(place,this.label,this.prompt,config.macros.selectTheme.onClickTheme);
btn.setAttribute('theme',useTiddler);
btn.setAttribute('mode',macroName=="applyTheme"?"selectTheme":"selectPalette"); // a bit untidy here
}
config.macros.selectPalette = config.macros.selectTheme;
config.macros.applyPalette = config.macros.applyTheme;
config.macros.refreshAll = { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
createTiddlyButton(place,"refresh","refresh layout and styles",function() { refreshAll(); });
}};
//}}}
* ''NIS''
** Network Information Service ( former yellow pages )
** Distribute hosts and user names on the network
** client-side setup root command {{{ authconfig}}}: defines ldap or nis, server name ...
** client-side setup file {{{ /etc/nsswitch.conf }}}:
{{{
passwd: files nis
shadow: files nis
group: files nis
}}}
** In the example above, local files {{{/etc/password }}} and {{{/etc/hosts}}} are looked at before tables on the nis server.
** client-side commands:
***{{{ ypwhich }}} returns the nis server's name
***{{{ hostname --yp }}} : returns the system’s NIS/YP domain name
* ''DNS''
** Domain Name System
** Server that can associate an IP address 45.57.102.255 to a name such as www.mysite.org.
** client-side setup: {{{/etc/resolv.conf }}} : give the IP of the DNS server.
** client-side command: {{{ hostname -d }}} : returns the system’s DNS domain name
** basic dns request : {{{dig www.google.com A}}}
* ''LDAP''
** Lightweight Directory Access Protocol
** Centralized Authentification method
** Client ask a question - server answers or gives pointer to another ldap server
** LDIF files: LDAP Data Interchange Format
** server deamon : {{{ slapd }}}
** server launch: {{{ /etc/rc.d/init.d/ldap start }}}
** client-side setup : {{{/etc/ldap.conf}}}
** client-side commands :
***{{{ldapsearch -h <servername> -x }}} : fetch in db
***{{{ldapadd}}} : add & modify
* ''MAC''
** Media Access Control
** Hardcoded address of a device connected to a network
* ''TCP/IP''
** Transmission Control Protocol/Internet Protocol
* ''CGI''
** Common Gateway Interface
** Standard method to plug dynamic Web pages generators onto a server. Generators can be written in perl, python, php but all must comply to cgi.
!!Servers
* Application Server
** python: django.py twisted.py web.py cherry.py bottle.py flask.py
** java: tomcat, jetty
** C: httpd ( apache ) , lighttypd
!!Apache
*Restart
{{{
/etc/init.d/httpd restart
}}}
*Setup {{{/etc/httpd/conf/httpd.conf}}}:
** Add a site
{{{
...
<Directory "/var/www/html/bugzilla">
Options Indexes FollowSymLinks
Options ExecCGI
DirectoryIndex index.cgi
AllowOverride limit
Order allow,deny
Allow from all
</Directory>
...
}}}
** Add a module
{{{
LoadModule auth_module modules/mod_auth.so
}}}
!!Zope
!!! Admin
*Restart
{{{
/usr/local/zeocluster/bin/restartcluster.sh
}}}
*Restart from scratch:
{{{
rm -rf /usr/local/zeocluster
cp -r /usr/local/zeocluster.bck /usr/local/zeocluster
/usr/local/zeocluster/bin/restartcluster.sh
}}}
!!!Install
* Install and launch Zope Server
{{{
mkdir plone
cd plone
setenv HOME $PWD
gzip -d Plone-3.0.6-UnifiedInstaller.tar.gz
tar xvf Plone-3.0.6-UnifiedInstaller.tar
cd Plone-3.0.6-UnifiedInstaller
./install.sh standalone
./Plone-3.0.6/zinstance/bin/zopectl start
}}}
* Enter ZMI ( Zope Managment Interface )
{{{
firefox http://localhost:8080/manage
login : admin
password: can be found in ./Plone-3.0.6/zinstance/adminPassword.txt
Change password : ZMI > acl_users > users > Password
}}}
* Create plone site
> Select {{{Root Folder}}} in the Right Column
> Select {{{Plone Site}}} in the drop-down menu of the main fraime
> Click on {{{Add}}}
> Fill in the form : ID:... Title:... Description:...
> Click on {{{Add Plone Site}}}
> Surf at {{{http://localhost:8080/<sitename>}}}
> Follow {{{Get Started}}}, mail settings ...
* Change site's logo
> {{{ZMI > sitename > portal_skins > plone_images > logo.jpg}}} : Click //Customize//
> Overriding picture will be located at {{{ZMI > <sitename> > portal_skins > custom > logo.jpg}}}
* Change site's style
> {{{ZMI > portal_CSS}}} : click //Debug// + click //Save//
> {{{ZMI > portal_skins > plone_styles > base_properties}}} : click //Customize//
> Overriding values will be located at {{{ZMI > sitename > portal_skins > custom > base_properties }}} : Tab {{{Properties}}}
!!!Add Product ( old-tarball style )
{{{
sh> cd ./Plone-3.0.6/zinstance/Products
sh> wget http://plone.org/products/.../releases/0.5.3/SomeProduct-0.5.3.tgz
sh> tar -zxvf SomeProduct-0.5.3.tgz
}}}
> {{{ZMI > Control_Panel }}} : Restart
> {{{ plone site > setup site > Add-on products }}} : Check //~SomeProduct// and Click //Install//
!!!Add Product ( python egg style )
{{{
sh> ./Plone-3.0.6/Python-2.4.4/bin/easy_install ./my_downloads/OtherPackage-3.2.1-py2.3.egg
}}}
!Download / mirror / spiders
* wget
* curl
* lynx -source
* lwp-base ( perl library ) : lwp-request, lwp-rget , GET
!! HTML Directives
* Directives can be enabled in the server setup
** {{{/etc/httpd/conf/httpd.conf}}} :
{{{
<Directory "/var/www/html/mysite">
Options ... ... Includes
XbitHack on
...
}}}
* Or directive can be enabled in the site
** {{{/etc/httpd/conf/httpd.conf}}} :
{{{
<Directory "/var/www/html/mysite">
...
AllowOverride All
...
}}}
** {{{/var/www/html/mysite/.htaccess}}}:
{{{
Options +Includes
XBitHack on
}}}
* Directives can be used to launch a command or include a file
{{{
</div>
<div style="padding-left: 30pt; color: #7F2A00;" >
<!--ServerSideIncludes should be ON -->
<!--#exec cmd="./updateAvailableChart" -->
<!--#include virtual="availableChart.html"-->
</div>
}}}
!!Setup
* apache settings in : {{{/etc/httpd/conf.d/python.conf}}}
{{{
<Location /smarties>
SetHandler python-program
# Add the path of your wiki directory
PythonPath "['/var/www/html/CoinCoin'] + sys.path"
PythonHandler MoinMoin.request::RequestModPy.run
PythonInterpreter smarties
</Location>
}}}
* Build instance:
{{{
build /var/www/html/CoinCoin
vi /var/www/html/CoinCoin/wikiconfig.py
}}}
!!Customize
*''theme''
{{{
cd /var/www/html/CoinCoin
cp /opt/MoinMoin/moin-1.5.6/MoinMoin/theme/modern.py data/plugin/theme/thermic.py
mkdir htdocs
cp -r /usr/share/moin/htdocs/modern/ /usr/share/moin/htdocs/thermic
vi /var/www/html/CoinCoin/wikiconfig.py
}}}
*''macros''
{{{
/usr/lib/python2.4/site-packages/MoinMoin/action/SubscribeUser.py
/var/www/html/WikiCde/data/plugin/action/MyNewAction.py
/var/www/html/WikiCde/data/plugin/macro/MyNewMacro.py
}}}
!!Subversion
*Setup {{{/etc/httpd/conf/httpd.conf}}}:
{{{
Include conf.d/*.conf
}}}
*Setup {{{/etc/httpd/conf.d/subversion.conf}}}:
{{{
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /projects>
DAV svn
SVNParentPath /svnroot/projects
AuthType Basic
AuthName " Bienvenue - Welcome "
AuthLDAPURL ldap://10.159.246.185:389/dc=ekbrfo2,dc=rfo,dc=atmel,dc=com
Require valid-user
# Limit write permission to list of valid users.
<LimitExcept GET PROPFIND OPTIONS REPORT>
</LimitExcept>
</Location>
}}}
*Repository
{{{
set rep = myrep
#---- create repository
svnadmin create --fs-type fsfs /svnroot/projects/$rep
vi /svnroot/admin/cfg/$rep.cfg
#---- set the hooks
ln -s /svnroot/admin/hooks/* /svnroot/projects/$rep/hooks/
vi /svnroot/admin/repo.yp
mkdir /svnroot/admin/patch/$rep
#---- set repository structure
cd /svnroot/WC
svn co file:///svnroot/projects/$rep
cd $rep
svn mkdir trunk tags branches admin admin/patches
cp ../control.plst admin/
vi admin/control.plst
svn add admin/control.plst
svn commit -m "Repository structure"
}}}
!!~WebSVN
* Server setup {{{/etc/httpd/conf/httpd.conf}}}:
{{{
<Directory "/var/www/html/WebSVN">
Options Indexes FollowSymLinks
AllowOverride AuthConfig
# Controls who can get stuff from this server.
order allow,deny
allow from 10.159.246 10.159.247 10.143
AuthType Basic
AuthName "Bienvenue - Welcome"
AuthLDAPURL ldap://10.159.246.185:389/dc=ekbrfo2,dc=rfo,dc=atmel,dc=com?uid
require valid-user
</Directory>
}}}
*Look and Feel:
**{{{/var/www/html/WebSVN/templates/*}}}
**{{{/var/www/html/WebSVN/index.php}}}
Ubuntu behind a proxy with password is a pita:
* Create a tunnel between corporateproxy:3128 <-> localhost:31280, and rely on localhost:31280
** Get cntlm package
** vi /etc/cntlm.conf
{{{
Username username
Domain DOMAIN.COM
Password *****
Proxy 192.168.xxx.xxx:3128
Proxy 192.168.xxx.xxx:3128
Listen 31280
}}}
** Launch deamon
{{{
cntlm -v -g -c /etc/cntlm.conf
}}}
* Setup system proxy
** System Settings=>Network->Network Proxy
** Automatic
** localhost:31280
** Apply system wide
* Setup a few apps ( including wget)...
{{{
setenv http_proxy http://localhost:31280/
setenv https_proxy ${http_proxy}
setenv ftp_proxy ${http_proxy}
}}}
* Setup apt-get:
** vi /etc/apt/apt.conf.d/80proxy
{{{
Acquire::http::Proxy "http://localhost:31280";
Acquire::ftp::Proxy "ftp://localhost:31280";
Acquire::https::Proxy "https://localhost:31280";
}}}
* setup synaptic:
** Settings=>Preferences=>Network
** Manual proxy : localhost Port: 31280
* Setup firefox
** Edit=>Preferences=>Advanced=>Network=>Connections...Settings
** Manual proxy : localhost port: 31280
<<search>><<closeAll>><<permaview>><<newTiddler>><<newJournal "DD MMM YYYY" "journal">><<saveChanges>><<tiddler TspotSidebar>><<slider chkSliderOptionsPanel OptionsPanel "options »" "Change TiddlyWiki advanced options">><<tiddler SideBarTabsInSlider>>
<<tabs txtMainTab "Timeline" "Timeline" TabTimeline "All" "All tiddlers" TabAll "Tags" "All tags" TabTags "More" "More lists" TabMore>>
<<slider sideTabs SideBarTabs "tabs »">>
!Jump start
* Open the ruby console
{{{
>>m=Sketchup::active_model
>>m.entities.count
0
>>f=m.entities.add_face [[0,0,0],[10,10,10],[0,10,20]]
...
}}}
!Scripting
* Create a file 'create_rectangle.rb'
{{{
require 'sketchup'
model = Sketchup.active_model
entities = model.entities
points = []
points[0] = Geom::Point3d.new(0 ,0 ,0 )
points[1] = Geom::Point3d.new(0 ,100,0 )
points[2] = Geom::Point3d.new(100,100,0 )
points[3] = Geom::Point3d.new(100,0 ,0 )
edges = []
edges[0] = entities.add_line( points[0],points[1] )
edges[1] = entities.add_line( points[1],points[2] )
edges[2] = entities.add_line( points[2],points[3] )
edges[3] = entities.add_line( points[3],points[0] )
entities.add_face edges
model.commit_operation
}}}
* From sketch up open the ruby console
{{{
load '/path/to/.../create_rectangle.rb'
}}}
{{{
printf("\tMeasure Area : ctrl-m in layout view \n")
hiSetBindKey("Layout" "Ctrl<key>m" "DRpolygonArea()")
}}}
{{{
netId=dbFindNetByName(cv "net47")
if(!netId then netId=dbCreateNet(cv "net47"))
obj=dbCreateLine(cv "wire" list(`(x1 y1) `(x2 y2)))
obj~>net = netId
obj=dbCreateLabel(cv
'("wire" "label")
list(x2 y2)
"net47" "centerLeft" "180" "stick" 0.05
)
obj~>net = netId
}}}
{{{
loadContext(which("mycont.cxt"))
}}}
{{{
procedure( SkillFileDecrypt( inputFile )
fhi = infile( inputFile )
fho = outfile(strcat(inputFile ".clr") "w")
while( line = lineread(fhi)
when( line != t
pprint(line fho)
)
)
close(fhi)
close(fho)
)
}}}
{{{
cv = deGetCellView()
foreach(inst cv~>instances
if(inst~>name=="i457" then
foreach(instTerm inst~>instTerm
if(instTerm~>name=="a1" then
print( instTerm~>net~>name )
)
)
)
)
}}}
{{{
ptList = obj~>points
areaAcc = 0.0
pt1 = car(ptList)
while( length(ptList)>1
ptList = cdr(ptList)
pt2 = car(ptList)
if( cadr(pt1) == cadr(pt2) then
rect = abs((car(pt2)-car(pt1))*cadr(pt1))
if( car(pt2) > car(pt1) then
areaAcc = areaAcc - rect
else
areaAcc = areaAcc + rect
)
)
pt1 = pt2
)
if(areaAcc < 10000 then
printf(" Polygon area = %2.2f um2\n" areaAcc)
else
printf(" Polygon area = %2.2f mm2\n" areaAcc*1.e-6)
)
}}}
{{{
myString = "Big string containing tobereplaced "
rexCompile("tob.replaced")
rexReplace(myString "withme" 0)
print(mystring)
}}}
//
Big string containing withme
//
* More at [[Str01 RegExpr]] ...
* Existence:
{{{ boundp('myvar) }}}
//nil//
{{{ myvar = 1 ; boundp('myvar) }}}
//t//
* List them all
{{{printVariables()}}}
* ASAP : As Soon As Possible
* BTW : By The Way
* WRT : With Respect To
* FYI : For Your Information
* BFN : Bye For Now
* LOL : Laughing Out Loud
* ROFL : Rolling On the Floor Laughing
* BWL : Bursting With Laughter
* IMHO : In My Humble Opinion
* MILF : Mother I'd Like to Fuck
* AKA : As known as
* AFAIK : As far as I know
! Analysis of a few measures
* Apply if N=5..10
* Best guess is average: @@text-decoration:overline;x@@ = Σ(x~~i~~)/N
* Spread : x~~max~~-x~~min~~
* Uncertainty of a single measure : Δx = ( x~~max~~-x~~min~~) /2
* Uncertainty on the mean: Δx/√@@text-decoration:overline;N@@
* Final result: x = @@text-decoration:overline;x@@ ± (x~~max~~-x~~min~~)/2√@@text-decoration:overline;N@@
! Analysis of a bigger population
* Best guess is average: @@text-decoration:overline;x@@ = Σ(x~~i~~)/N
* Uncertainty of a single measure = Standard deviation = Δx = σ = √(Σ(x~~i~~-@@text-decoration:overline;x@@)^^2^^/N)
* Note: To avoid underestimations of σ at low N; this formula can also be used: σ = √(Σ(x~~i~~-@@text-decoration:overline;x@@)^^2^^/(N-1))
* Uncertainty on the mean: σ/√@@text-decoration:overline;N@@
* Final result: x = @@text-decoration:overline;x@@ ± σ/√@@text-decoration:overline;N@@
!!Basic
| !Expression | !Meanning |
| {{{.}}} |Any Character except new line |
| {{{^}}} |Empty string at start of line |
| {{{$}}} |Empty string at end of line |
| {{{\<}}} |Empty string at start of word |
| {{{\>}}} |Empty string at end of word |
| {{{\b}}} |Empty string at edge of word |
| {{{\B}}} |Empty string not at the edge of a word |
| \n |New line |
| {{{[abcd]}}} |Single character in the list |
| {{{[a-d]}}} |Same as above, if - is first of the list, then it matches itself |
| {{{[a-zA-Z0-9]}}} |Single alphanum character |
| {{{\w}}} |{{{[a-zA-Z0-9_]}}} word |
| {{{\W}}} |{{{[^a-zA-Z0-9_]}}} not a word |
| {{{\s}}} |{{{[ \t\r\n\v\f]}}} a space |
| {{{\S}}} |{{{[^ \t\r\n\v\f]}}} not a space |
| {{{\u}}} |{{{[A-Z]}}} an upercase character |
| {{{\d}}} |{{{[0-9]}}} a decimal digit |
| {{{\x}}} |{{{[0-9a-fA-F]}}} an hexadecimal digit |
| __R__{{{?}}} |__R__ is optional and matched ''at most once'' |
| __R__{{{??}}} |Same as above but not greedy |
| __R__{{{*}}} |__R__ will be matched ''zero or more'' times |
| __R__{{{*?}}} |Same as above but not greedy |
| __R__{{{+}}} |__R__ will be matched ''one or more'' times, greedy |
| __R__{{{+?}}} |Same as above but not greedy |
| __R__{{{{n} }}} |__R__ is matched exactly ''n'' times |
| __R__{{{{n}?}}} |Same as above but not greedy |
| __R__{{{{n,} }}} |__R__ is matched ''n or more'' times, greedy |
| __R__{{{{n,}? }}} |Same as above but not greedy |
| __R__{{{{n,m} }}} |__R__ is matched ''at least n'' times, but ''not more than m'' times |
| __R__{{{{n,m}?}}} |Same as above but not greedy |
| {{{\(}}}__R__{{{\)}}} |Defines a subexpression, back referenced as {{{\n}}} |
| __R1____R2__ |__R1__ and then __R2__ |
| __R1__{{{|}}}__R2__ |__R1__ or __R2__ |
| {{{ & }}} |Previous match |
!!Extended
| !Expression | !Meaning |
| {{{(?=}}}__R__{{{)}}} |Followed by __R__, but __R__ not included ( positive look-ahead) |
| {{{(?!}}}__R__{{{)}}} |Not followed by __R__, but __R__ not included ( negative look-ahead) |
| {{{(?<=}}}__R__{{{)}}} |Preceded by __R__, but __R__ not included ( positive look-behind ) |
| {{{(?<!}}}__R__{{{)}}} |Not preceeded by __R__, but __R__ not included ( negative look-behind ) |
* Examples:
** {{{ /\w+(?=\t)/}}} matches a word followed by a tab, without including the tab in &.
** {{{ /(?<=\t)\w+/ }}} matches a word that follows a tab, without including the tab in &
** {{{ /(?<!bar)foo/ }}} matches any occurrence of "foo" that does not follow "bar", w/o including bar in &
*Delete blank lines
{{{
:g/^ *$/d
}}}
*Duplicate in columns
{{{
:g/^.*$/s//& &/
}}}
*Duplicate each lines
{{{
:g/^.*$/s//&zap&/
:g/zap/s//\<ctl-m>/<enter>
}}}
*Swap 2 columns of 2 characters
{{{
:g/^\(..\)\(..\)/s//\2\1/
}}}
*Replace brackets around numbers (nnn)-> [nnn]
{{{
:g/(\([0-9]*\))/s//[\1]/g
}}}
*Replace comma with returns
{{{
:g/s/,/\r/g
}}}
*Better address control
{{{
:%s/foo/bar/ # replace on all line, i.e. same as :g/./s
:.,$s/foo/bar/ # replace on current line to last line
:.,+2s/foo/bar/ # replace on curent line qnd next two
}}}
!!Culture
* — ed — sed — awk (unix) — gawk,nawk — awk (linux) →
* Named after the 3 authors: Alfred V. ''A''ho, Peter J. ''W''einberger and Brian W. ''K''ernighan to superseed sed
!!Examples
* Filter sdf
{{{
set instList = ( \
i_card_top.i_test_control.i_activebar \
i_card_top.i_test_control.i__activebar \
i_card_top.i_starfish.vect \
)
foreach inst ($instList)
echo Looking for instance $inst ...
nawk ' \
{ if ($0~"CELL"){ t1=$0 \
getline \
t2=$0 \
getline \
f=0 \
if ($0 ~/'$inst'/) {f=1} \
if (f!=1) {print t1 ; print t2} \
} \
if (f!=1) { print $0 \
} \
} \
' file.sdf > tmp
nawk '( $1 !~ /INTERCONNECT/ || $0 !~ /'$inst'/ )' tmp > file.sdf
end
}}}
* Convert s19 to (@add,data)
{{{
nawk ' \
function h(x) { dec=0;b=1;for(i=length( x );i>0;i--) \
{ch=substr( x , i , 1) \
cd=index("0123456789abcdef",tolower(ch))-1 \
dec=dec+(cd*b); b=16*b; } \
} \
{ if(substr($1,1,2)=="S1") { \
h(substr($1,3,2)); nd=dec-3 \
h(substr($1,5,4)); ad=dec \
da=substr($1,9,nd*2); \
} \
if(substr($1,1,2)=="S2") { \
h(substr($1,3,2)); nd=dec-4 \
h(substr($1,5,6)); ad=dec \
da=substr($1,11,nd*2); \
} \
if(substr($1,1,2)=="S0") { nd=0 } \
if(substr($1,1,2)=="S9") { nd=0 } \
for(j=0;j<nd;j++) { \
printf "@%0.6X %s\n",ad,substr(da,2*j+1,2) \
ad=ad+1 \
} \
}' file.s19 | sort > prog.lst
}}}
* Extract Area Info from tlf
{{{
nawk '$1~/CELL\(/ { getline ; printf "%s ",$1}; \
$1~/AREA/{print $1}' kit.tlf > kit.area
}}}
{{{
nawk '$1~/CELL\(/ {printf "%s ",$2 ; getline }; \
$1~/AREA/{print $6} ; \
getline ; \
$1~/AREA/{print $6' kit.tlf > kit.area
}}}
* Extract Average Load on clock nets
{{{
egrep "|NET.*_L.*_I" pearl_in.spf | cut -d" " -f3 | cut -c1-6 | nawk 'c=c+$1 ; END {printf "\ntotal = %f\n",c }'
egrep "|NET.*_L.*_I" pearl_in.spf | wc -l
}}}
!!Culture
* sed = Stream Editor
* Written by Lee E. Mc Mahon for unix in 1973/1974 (Bell Labs)
!!Examples
* Remove negative delays
{{{
sed '/-[0-9\.]*/s//0.0/g' tmp1 > tmp2
}}}
/*{{{*/
.header {font-size:0.6em;}
.title {font-size:1.4em;}
body {background: [[ColorPalette::SecondaryPale]];}
/* Oldies...
/* Bigger fonts & minor tunnings */
body {font-size: 12pt;}
.viewer pre {font-size:0.9em;}
.viewer code {font-size:0.9em;}
.signature {font-size:0.8em;text-align:right;}
.viewer th, .viewer thead td, .twtable th, .twtable thead td {color:[[ColorPalette::SecondaryDark]]}
.editor * {background-color:[[ColorPalette::PrimaryPale]];}
/* Smaller header */
.headerShadow {position:relative; padding:1.5em 0em 1em 1em; left:-1px; top:-1px;}
.headerForeground {position:absolute; padding:1.5em 0em 1em 1em; left:0px; top:0px;}
.siteTitle {font-size:2.5em;}
.siteSubtitle {font-size:1.2em;}
*/
/* paragraph layout goodies */
.twocolumns { display:block; -moz-column-count:2;-moz-column-gap:1em; -moz-column-width:50%;}
.threecolumns { display:block; -moz-column-count:3;-moz-column-gap:1em; -moz-column-width:33%}
.fourcolumns { display:block; -moz-column-count:4;-moz-column-gap:1em; -moz-column-width:25%}
.editbutton {display:block; text-align:right;}
/* Bugged
.textright {text-align:right;}
.textcenter {text-align:center;}
.textjustify {text-align:justify;}
*/
.textindent25 {text-indent:25px;}
/* Alternate colors for rows in tables */
.viewer tr.oddRow { background-color: [[ColorPalette::TertiaryPale]]; }
.viewer tr.evenRow { background-color: [[ColorPalette::Background]]; }
/* Visual Color palette */
.visualcolorpaletteBG { background-color : [[ColorPalette::Background]];}
.visualcolorpaletteFG { background-color : [[ColorPalette::Foreground]];}
.visualcolorpalettePP { background-color : [[ColorPalette::PrimaryPale]];}
.visualcolorpalettePL { background-color : [[ColorPalette::PrimaryLight]];}
.visualcolorpalettePM { background-color : [[ColorPalette::PrimaryMid]];}
.visualcolorpalettePD { background-color : [[ColorPalette::PrimaryDark]];}
.visualcolorpaletteSP { background-color : [[ColorPalette::SecondaryPale]];}
.visualcolorpaletteSL { background-color : [[ColorPalette::SecondaryLight]];}
.visualcolorpaletteSM { background-color : [[ColorPalette::SecondaryMid]];}
.visualcolorpaletteSD { background-color : [[ColorPalette::SecondaryDark]];}
.visualcolorpaletteTP { background-color : [[ColorPalette::TertiaryPale]];}
.visualcolorpaletteTL { background-color : [[ColorPalette::TertiaryLight]];}
.visualcolorpaletteTM { background-color : [[ColorPalette::TertiaryMid]];}
.visualcolorpaletteTD { background-color : [[ColorPalette::TertiaryDark]];}
.visualcolorpaletteER { background-color : [[ColorPalette::Error]];}
/*}}}*/
<<tabs txtMoreTab "Tags" "All Tags" TabAllTags "Miss" "Missing tiddlers" TabMoreMissing "Orph" "Orphaned tiddlers" TabMoreOrphans "Shad" "Shadowed tiddlers" TabMoreShadowed>>
<<allTags excludeLists [a-z]>>
/***
|''Name:''|TableSortingPlugin|
|''Description:''|Dynamically sort tables by clicking on column headers|
|''Author:''|Saq Imtiaz ( lewcid@gmail.com )|
|''Source:''|http://tw.lewcid.org/#TableSortingPlugin|
|''Code Repository:''|http://tw.lewcid.org/svn/plugins|
|''Version:''|2.02|
|''Date:''|25-01-2008|
|''License:''|[[Creative Commons Attribution-ShareAlike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]]|
|''~CoreVersion:''|2.2.3|
!!Usage:
* Make sure your table has a header row
** {{{|Name|Phone Number|Address|h}}}<br> Note the /h/ that denote a header row
* Give the table a class of 'sortable'
** {{{
|sortable|k
|Name|Phone Number|Address|h
}}}<br>Note the /k/ that denotes a class name being assigned to the table.
* To disallow sorting by a column, place {{{<<nosort>>}}} in it's header
* To automatically sort a table by a column, place {{{<<autosort>>}}} in the header for that column
** Or to sort automatically but in reverse order, use {{{<<autosort reverse>>}}}
!!Example:
|sortable|k
|Name |Salary |Extension |Performance |File Size |Start date |h
|ZBloggs, Fred |$12000.00 |1353 |+1.2 |74.2Kb |Aug 19, 2003 21:34:00 |
|ABloggs, Fred |$12000.00 |1353 |1.2 |3350b |09/18/2003 |
|CBloggs, Fred |$12000 |1353 |1.200 |55.2Kb |August 18, 2003 |
|DBloggs, Fred |$12000.00 |1353 |1.2 |2100b |07/18/2003 |
|Bloggs, Fred |$12000.00 |1353 |01.20 |6.156Mb |08/17/2003 05:43 |
|Turvey, Kevin |$191200.00 |2342 |-33 |1b |02/05/1979 |
|Mbogo, Arnold |$32010.12 |2755 |-21.673 |1.2Gb |09/08/1998 |
|Shakespeare, Bill |£122000.00|3211 |6 |33.22Gb |12/11/1961 |
|Shakespeare, Hamlet |£9000 |9005 |-8 |3Gb |01/01/2002 |
|Fitz, Marvin |€3300.30 |5554 |+5 |4Kb |05/22/1995 |
***/
// /%
//!BEGIN-PLUGIN-CODE
config.tableSorting = {
darrow: "\u2193",
uarrow: "\u2191",
getText : function (o) {
var p = o.cells[SORT_INDEX];
return p.innerText || p.textContent || '';
},
sortTable : function (o,rev) {
SORT_INDEX = o.getAttribute("index");
var c = config.tableSorting;
var T = findRelated(o.parentNode,"TABLE");
if(T.tBodies[0].rows.length<=1)
return;
var itm = "";
var i = 0;
while (itm == "" && i < T.tBodies[0].rows.length) {
itm = c.getText(T.tBodies[0].rows[i]).trim();
i++;
}
if (itm == "")
return;
var r = [];
var S = o.getElementsByTagName("span")[0];
c.fn = c.sortAlpha;
if(!isNaN(Date.parse(itm)))
c.fn = c.sortDate;
else if(itm.match(/^[$|£|€|\+|\-]{0,1}\d*\.{0,1}\d+$/))
c.fn = c.sortNumber;
else if(itm.match(/^\d*\.{0,1}\d+[K|M|G]{0,1}b$/))
c.fn = c.sortFile;
for(i=0; i<T.tBodies[0].rows.length; i++) {
r[i]=T.tBodies[0].rows[i];
}
r.sort(c.reSort);
if(S.firstChild.nodeValue==c.darrow || rev) {
r.reverse();
S.firstChild.nodeValue=c.uarrow;
}
else
S.firstChild.nodeValue=c.darrow;
var thead = T.getElementsByTagName('thead')[0];
var headers = thead.rows[thead.rows.length-1].cells;
for(var k=0; k<headers.length; k++) {
if(!hasClass(headers[k],"nosort"))
addClass(headers[k].getElementsByTagName("span")[0],"hidden");
}
removeClass(S,"hidden");
for(i=0; i<r.length; i++) {
T.tBodies[0].appendChild(r[i]);
c.stripe(r[i],i);
for(var j=0; j<r[i].cells.length;j++){
removeClass(r[i].cells[j],"sortedCol");
}
addClass(r[i].cells[SORT_INDEX],"sortedCol");
}
},
stripe : function (e,i){
var cl = ["oddRow","evenRow"];
i&1? cl.reverse() : cl;
removeClass(e,cl[1]);
addClass(e,cl[0]);
},
sortNumber : function(v) {
var x = parseFloat(this.getText(v).replace(/[^0-9.-]/g,''));
return isNaN(x)? 0: x;
},
sortDate : function(v) {
return Date.parse(this.getText(v));
},
sortAlpha : function(v) {
return this.getText(v).toLowerCase();
},
sortFile : function(v) {
var j, q = config.messages.sizeTemplates, s = this.getText(v);
for (var i=0; i<q.length; i++) {
if ((j = s.toLowerCase().indexOf(q[i].template.replace("%0\u00a0","").toLowerCase())) != -1)
return q[i].unit * s.substr(0,j);
}
return parseFloat(s);
},
reSort : function(a,b){
var c = config.tableSorting;
var aa = c.fn(a);
var bb = c.fn(b);
return ((aa==bb)? 0 : ((aa<bb)? -1:1));
}
};
Story.prototype.tSort_refreshTiddler = Story.prototype.refreshTiddler;
Story.prototype.refreshTiddler = function(title,template,force,customFields,defaultText){
var elem = this.tSort_refreshTiddler.apply(this,arguments);
if(elem){
var tables = elem.getElementsByTagName("TABLE");
var c = config.tableSorting;
for(var i=0; i<tables.length; i++){
if(hasClass(tables[i],"sortable")){
var x = null, rev, table = tables[i], thead = table.getElementsByTagName('thead')[0], headers = thead.rows[thead.rows.length-1].cells;
for (var j=0; j<headers.length; j++){
var h = headers[j];
if (hasClass(h,"nosort"))
continue;
h.setAttribute("index",j);
h.onclick = function(){c.sortTable(this); return false;};
h.ondblclick = stopEvent;
if(h.getElementsByTagName("span").length == 0)
createTiddlyElement(h,"span",null,"hidden",c.uarrow);
if(!x && hasClass(h,"autosort")) {
x = j;
rev = hasClass(h,"reverse");
}
}
if(x)
c.sortTable(headers[x],rev);
}
}
}
return elem;
};
setStylesheet("table.sortable span.hidden {visibility:hidden;}\n"+
"table.sortable thead {cursor:pointer;}\n"+
"table.sortable .nosort {cursor:default;}\n"+
"table.sortable td.sortedCol {background:#ffc;}","TableSortingPluginStyles");
function stopEvent(e){
var ev = e? e : window.event;
ev.cancelBubble = true;
if (ev.stopPropagation) ev.stopPropagation();
return false;
}
config.macros.nosort={
handler : function(place){
addClass(place,"nosort");
}
};
config.macros.autosort={
handler : function(place,m,p,w,pS){
addClass(place,"autosort"+" "+pS);
}
};
//!END-PLUGIN-CODE
// %/
| Lenovo | ~ThinkPad Tablet 2 |670E (lenovoShop)| 10.1" |1366x768 |26x16x1.0 | 10h | 32b |1.8GHzAtomZ2760 |
| Lenovo | ~ThinkPad X230t |1200E (lenovoShop)| 12.5" |1366x768 |30x23x3.0 | 8h | 64b |
| Lenovo | Helix |1500E (Annonced)| 11.6" |1920x1080|30x19x1.2 | 6+4h | 64b |
| Samsung | ~SmartPC 500T |800E (Darty)| 11.6"|1366x768 |29x18x1.0 | 9h | 32b |1.8GHzAtomZ2760| Silent but sluggish |
| Samsung | ATIV Smart PC Pro 700T |1300E (Darty)| 11.6" |1920x1080 |30x19x1.2 | 4h |64b | Heat and Fans |
| Samsung | ~GalaxyNote 10.1 |420E ( ~CDiscount) | 10.1" |1280x800|26x18x0.9 | 10h | ? |
| Asus | Eee Slate ~EP121 |700E (Darty) | 12.1" |1280x800 |31x21x1.7 | 4h |64b |
| Asus | Eee Slate B121 |1000E (not available)| 12.1" |1280x800 |31x21x1.7 | 4h |64b |
| Asus | ~VivoTAb ~TF810 |870E (pixmania)| 11.6" |1366x768 |33x19x0.9 | 10+9h |32b | No USB, No stylus hoslter |
/***
|Name:|TagglyTaggingPlugin|
|Description:|tagglyTagging macro is a replacement for the builtin tagging macro in your ViewTemplate|
|Version:|3.3.1 ($Rev: 6100 $)|
|Date:|$Date: 2008-07-27 01:42:07 +1000 (Sun, 27 Jul 2008) $|
|Source:|http://mptw.tiddlyspot.com/#TagglyTaggingPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!Notes
See http://mptw.tiddlyspot.com/#TagglyTagging
***/
//{{{
merge(String.prototype,{
parseTagExpr: function(debug) {
if (this.trim() == "")
return "(true)";
var anyLogicOp = /(!|&&|\|\||\(|\))/g;
var singleLogicOp = /^(!|&&|\|\||\(|\))$/;
var spaced = this.
// because square brackets in templates are no good
// this means you can use [(With Spaces)] instead of [[With Spaces]]
replace(/\[\(/g," [[").
replace(/\)\]/g,"]] ").
// space things out so we can use readBracketedList. tricky eh?
replace(anyLogicOp," $1 ");
var expr = "";
var tokens = spaced.readBracketedList(false); // false means don't uniq the list. nice one JR!
for (var i=0;i<tokens.length;i++)
if (tokens[i].match(singleLogicOp))
expr += tokens[i];
else
expr += "tiddler.tags.contains('%0')".format([tokens[i].replace(/'/,"\\'")]); // fix single quote bug. still have round bracket bug i think
if (debug)
alert(expr);
return '('+expr+')';
}
});
merge(TiddlyWiki.prototype,{
getTiddlersByTagExpr: function(tagExpr,sortField) {
var result = [];
var expr = tagExpr.parseTagExpr();
store.forEachTiddler(function(title,tiddler) {
if (eval(expr))
result.push(tiddler);
});
if(!sortField)
sortField = "title";
result.sort(function(a,b) {return a[sortField] < b[sortField] ? -1 : (a[sortField] == b[sortField] ? 0 : +1);});
return result;
}
});
config.taggly = {
// for translations
lingo: {
labels: {
asc: "\u2191", // down arrow
desc: "\u2193", // up arrow
title: "title",
modified: "modified",
created: "created",
show: "+",
hide: "-",
normal: "normal",
group: "group",
commas: "commas",
sitemap: "sitemap",
numCols: "cols\u00b1", // plus minus sign
label: "Tagged as '%0':",
exprLabel: "Matching tag expression '%0':",
excerpts: "excerpts",
descr: "descr",
slices: "slices",
contents: "contents",
sliders: "sliders",
noexcerpts: "title only",
noneFound: "(none)"
},
tooltips: {
title: "Click to sort by title",
modified: "Click to sort by modified date",
created: "Click to sort by created date",
show: "Click to show tagging list",
hide: "Click to hide tagging list",
normal: "Click to show a normal ungrouped list",
group: "Click to show list grouped by tag",
sitemap: "Click to show a sitemap style list",
commas: "Click to show a comma separated list",
numCols: "Click to change number of columns",
excerpts: "Click to show excerpts",
descr: "Click to show the description slice",
slices: "Click to show all slices",
contents: "Click to show entire tiddler contents",
sliders: "Click to show tiddler contents in sliders",
noexcerpts: "Click to show entire title only"
},
tooDeepMessage: "* //sitemap too deep...//"
},
config: {
showTaggingCounts: true,
listOpts: {
// the first one will be the default
sortBy: ["title","modified","created"],
sortOrder: ["asc","desc"],
hideState: ["show","hide"],
listMode: ["normal","group","sitemap","commas"],
numCols: ["1","2","3","4","5","6"],
excerpts: ["noexcerpts","excerpts","descr","slices","contents","sliders"]
},
valuePrefix: "taggly.",
excludeTags: ["excludeLists","excludeTagging"],
excerptSize: 50,
excerptMarker: "/%"+"%/",
siteMapDepthLimit: 25
},
getTagglyOpt: function(title,opt) {
var val = store.getValue(title,this.config.valuePrefix+opt);
return val ? val : this.config.listOpts[opt][0];
},
setTagglyOpt: function(title,opt,value) {
if (!store.tiddlerExists(title))
// create it silently
store.saveTiddler(title,title,config.views.editor.defaultText.format([title]),config.options.txtUserName,new Date(),"");
// if value is default then remove it to save space
return store.setValue(title,
this.config.valuePrefix+opt,
value == this.config.listOpts[opt][0] ? null : value);
},
getNextValue: function(title,opt) {
var current = this.getTagglyOpt(title,opt);
var pos = this.config.listOpts[opt].indexOf(current);
// a little usability enhancement. actually it doesn't work right for grouped or sitemap
var limit = (opt == "numCols" ? store.getTiddlersByTagExpr(title).length : this.config.listOpts[opt].length);
var newPos = (pos + 1) % limit;
return this.config.listOpts[opt][newPos];
},
toggleTagglyOpt: function(title,opt) {
var newVal = this.getNextValue(title,opt);
this.setTagglyOpt(title,opt,newVal);
},
createListControl: function(place,title,type) {
var lingo = config.taggly.lingo;
var label;
var tooltip;
var onclick;
if ((type == "title" || type == "modified" || type == "created")) {
// "special" controls. a little tricky. derived from sortOrder and sortBy
label = lingo.labels[type];
tooltip = lingo.tooltips[type];
if (this.getTagglyOpt(title,"sortBy") == type) {
label += lingo.labels[this.getTagglyOpt(title,"sortOrder")];
onclick = function() {
config.taggly.toggleTagglyOpt(title,"sortOrder");
return false;
}
}
else {
onclick = function() {
config.taggly.setTagglyOpt(title,"sortBy",type);
config.taggly.setTagglyOpt(title,"sortOrder",config.taggly.config.listOpts.sortOrder[0]);
return false;
}
}
}
else {
// "regular" controls, nice and simple
label = lingo.labels[type == "numCols" ? type : this.getNextValue(title,type)];
tooltip = lingo.tooltips[type == "numCols" ? type : this.getNextValue(title,type)];
onclick = function() {
config.taggly.toggleTagglyOpt(title,type);
return false;
}
}
// hide button because commas don't have columns
if (!(this.getTagglyOpt(title,"listMode") == "commas" && type == "numCols"))
createTiddlyButton(place,label,tooltip,onclick,type == "hideState" ? "hidebutton" : "button");
},
makeColumns: function(orig,numCols) {
var listSize = orig.length;
var colSize = listSize/numCols;
var remainder = listSize % numCols;
var upperColsize = colSize;
var lowerColsize = colSize;
if (colSize != Math.floor(colSize)) {
// it's not an exact fit so..
upperColsize = Math.floor(colSize) + 1;
lowerColsize = Math.floor(colSize);
}
var output = [];
var c = 0;
for (var j=0;j<numCols;j++) {
var singleCol = [];
var thisSize = j < remainder ? upperColsize : lowerColsize;
for (var i=0;i<thisSize;i++)
singleCol.push(orig[c++]);
output.push(singleCol);
}
return output;
},
drawTable: function(place,columns,theClass) {
var newTable = createTiddlyElement(place,"table",null,theClass);
var newTbody = createTiddlyElement(newTable,"tbody");
var newTr = createTiddlyElement(newTbody,"tr");
for (var j=0;j<columns.length;j++) {
var colOutput = "";
for (var i=0;i<columns[j].length;i++)
colOutput += columns[j][i];
var newTd = createTiddlyElement(newTr,"td",null,"tagglyTagging"); // todo should not need this class
wikify(colOutput,newTd);
}
return newTable;
},
createTagglyList: function(place,title,isTagExpr) {
switch(this.getTagglyOpt(title,"listMode")) {
case "group": return this.createTagglyListGrouped(place,title,isTagExpr); break;
case "normal": return this.createTagglyListNormal(place,title,false,isTagExpr); break;
case "commas": return this.createTagglyListNormal(place,title,true,isTagExpr); break;
case "sitemap":return this.createTagglyListSiteMap(place,title,isTagExpr); break;
}
},
getTaggingCount: function(title,isTagExpr) {
// thanks to Doug Edmunds
if (this.config.showTaggingCounts) {
var tagCount = config.taggly.getTiddlers(title,'title',isTagExpr).length;
if (tagCount > 0)
return " ("+tagCount+")";
}
return "";
},
getTiddlers: function(titleOrExpr,sortBy,isTagExpr) {
return isTagExpr ? store.getTiddlersByTagExpr(titleOrExpr,sortBy) : store.getTaggedTiddlers(titleOrExpr,sortBy);
},
getExcerpt: function(inTiddlerTitle,title,indent) {
if (!indent)
indent = 1;
var displayMode = this.getTagglyOpt(inTiddlerTitle,"excerpts");
var t = store.getTiddler(title);
if (t && displayMode == "excerpts") {
var text = t.text.replace(/\n/," ");
var marker = text.indexOf(this.config.excerptMarker);
if (marker != -1) {
return " {{excerpt{<nowiki>" + text.substr(0,marker) + "</nowiki>}}}";
}
else if (text.length < this.config.excerptSize) {
return " {{excerpt{<nowiki>" + t.text + "</nowiki>}}}";
}
else {
return " {{excerpt{<nowiki>" + t.text.substr(0,this.config.excerptSize) + "..." + "</nowiki>}}}";
}
}
else if (t && displayMode == "contents") {
return "\n{{contents indent"+indent+"{\n" + t.text + "\n}}}";
}
else if (t && displayMode == "sliders") {
return "<slider slide>\n{{contents{\n" + t.text + "\n}}}\n</slider>";
}
else if (t && displayMode == "descr") {
var descr = store.getTiddlerSlice(title,'Description');
return descr ? " {{excerpt{" + descr + "}}}" : "";
}
else if (t && displayMode == "slices") {
var result = "";
var slices = store.calcAllSlices(title);
for (var s in slices)
result += "|%0|<nowiki>%1</nowiki>|\n".format([s,slices[s]]);
return result ? "\n{{excerpt excerptIndent{\n" + result + "}}}" : "";
}
return "";
},
notHidden: function(t,inTiddler) {
if (typeof t == "string")
t = store.getTiddler(t);
return (!t || !t.tags.containsAny(this.config.excludeTags) ||
(inTiddler && this.config.excludeTags.contains(inTiddler)));
},
// this is for normal and commas mode
createTagglyListNormal: function(place,title,useCommas,isTagExpr) {
var list = config.taggly.getTiddlers(title,this.getTagglyOpt(title,"sortBy"),isTagExpr);
if (this.getTagglyOpt(title,"sortOrder") == "desc")
list = list.reverse();
var output = [];
var first = true;
for (var i=0;i<list.length;i++) {
if (this.notHidden(list[i],title)) {
var countString = this.getTaggingCount(list[i].title);
var excerpt = this.getExcerpt(title,list[i].title);
if (useCommas)
output.push((first ? "" : ", ") + "[[" + list[i].title + "]]" + countString + excerpt);
else
output.push("*[[" + list[i].title + "]]" + countString + excerpt + "\n");
first = false;
}
}
return this.drawTable(place,
this.makeColumns(output,useCommas ? 1 : parseInt(this.getTagglyOpt(title,"numCols"))),
useCommas ? "commas" : "normal");
},
// this is for the "grouped" mode
createTagglyListGrouped: function(place,title,isTagExpr) {
var sortBy = this.getTagglyOpt(title,"sortBy");
var sortOrder = this.getTagglyOpt(title,"sortOrder");
var list = config.taggly.getTiddlers(title,sortBy,isTagExpr);
if (sortOrder == "desc")
list = list.reverse();
var leftOvers = []
for (var i=0;i<list.length;i++)
leftOvers.push(list[i].title);
var allTagsHolder = {};
for (var i=0;i<list.length;i++) {
for (var j=0;j<list[i].tags.length;j++) {
if (list[i].tags[j] != title) { // not this tiddler
if (this.notHidden(list[i].tags[j],title)) {
if (!allTagsHolder[list[i].tags[j]])
allTagsHolder[list[i].tags[j]] = "";
if (this.notHidden(list[i],title)) {
allTagsHolder[list[i].tags[j]] += "**[["+list[i].title+"]]"
+ this.getTaggingCount(list[i].title) + this.getExcerpt(title,list[i].title) + "\n";
leftOvers.setItem(list[i].title,-1); // remove from leftovers. at the end it will contain the leftovers
}
}
}
}
}
var allTags = [];
for (var t in allTagsHolder)
allTags.push(t);
var sortHelper = function(a,b) {
if (a == b) return 0;
if (a < b) return -1;
return 1;
};
allTags.sort(function(a,b) {
var tidA = store.getTiddler(a);
var tidB = store.getTiddler(b);
if (sortBy == "title") return sortHelper(a,b);
else if (!tidA && !tidB) return 0;
else if (!tidA) return -1;
else if (!tidB) return +1;
else return sortHelper(tidA[sortBy],tidB[sortBy]);
});
var leftOverOutput = "";
for (var i=0;i<leftOvers.length;i++)
if (this.notHidden(leftOvers[i],title))
leftOverOutput += "*[["+leftOvers[i]+"]]" + this.getTaggingCount(leftOvers[i]) + this.getExcerpt(title,leftOvers[i]) + "\n";
var output = [];
if (sortOrder == "desc")
allTags.reverse();
else if (leftOverOutput != "")
// leftovers first...
output.push(leftOverOutput);
for (var i=0;i<allTags.length;i++)
if (allTagsHolder[allTags[i]] != "")
output.push("*[["+allTags[i]+"]]" + this.getTaggingCount(allTags[i]) + this.getExcerpt(title,allTags[i]) + "\n" + allTagsHolder[allTags[i]]);
if (sortOrder == "desc" && leftOverOutput != "")
// leftovers last...
output.push(leftOverOutput);
return this.drawTable(place,
this.makeColumns(output,parseInt(this.getTagglyOpt(title,"numCols"))),
"grouped");
},
// used to build site map
treeTraverse: function(title,depth,sortBy,sortOrder,isTagExpr) {
var list = config.taggly.getTiddlers(title,sortBy,isTagExpr);
if (sortOrder == "desc")
list.reverse();
var indent = "";
for (var j=0;j<depth;j++)
indent += "*"
var childOutput = "";
if (depth > this.config.siteMapDepthLimit)
childOutput += indent + this.lingo.tooDeepMessage;
else
for (var i=0;i<list.length;i++)
if (list[i].title != title)
if (this.notHidden(list[i].title,this.config.inTiddler))
childOutput += this.treeTraverse(list[i].title,depth+1,sortBy,sortOrder,false);
if (depth == 0)
return childOutput;
else
return indent + "[["+title+"]]" + this.getTaggingCount(title) + this.getExcerpt(this.config.inTiddler,title,depth) + "\n" + childOutput;
},
// this if for the site map mode
createTagglyListSiteMap: function(place,title,isTagExpr) {
this.config.inTiddler = title; // nasty. should pass it in to traverse probably
var output = this.treeTraverse(title,0,this.getTagglyOpt(title,"sortBy"),this.getTagglyOpt(title,"sortOrder"),isTagExpr);
return this.drawTable(place,
this.makeColumns(output.split(/(?=^\*\[)/m),parseInt(this.getTagglyOpt(title,"numCols"))), // regexp magic
"sitemap"
);
},
macros: {
tagglyTagging: {
handler: function (place,macroName,params,wikifier,paramString,tiddler) {
var parsedParams = paramString.parseParams("tag",null,true);
var refreshContainer = createTiddlyElement(place,"div");
// do some refresh magic to make it keep the list fresh - thanks Saq
refreshContainer.setAttribute("refresh","macro");
refreshContainer.setAttribute("macroName",macroName);
var tag = getParam(parsedParams,"tag");
var expr = getParam(parsedParams,"expr");
if (expr) {
refreshContainer.setAttribute("isTagExpr","true");
refreshContainer.setAttribute("title",expr);
refreshContainer.setAttribute("showEmpty","true");
}
else {
refreshContainer.setAttribute("isTagExpr","false");
if (tag) {
refreshContainer.setAttribute("title",tag);
refreshContainer.setAttribute("showEmpty","true");
}
else {
refreshContainer.setAttribute("title",tiddler.title);
refreshContainer.setAttribute("showEmpty","false");
}
}
this.refresh(refreshContainer);
},
refresh: function(place) {
var title = place.getAttribute("title");
var isTagExpr = place.getAttribute("isTagExpr") == "true";
var showEmpty = place.getAttribute("showEmpty") == "true";
removeChildren(place);
addClass(place,"tagglyTagging");
var countFound = config.taggly.getTiddlers(title,'title',isTagExpr).length
if (countFound > 0 || showEmpty) {
var lingo = config.taggly.lingo;
config.taggly.createListControl(place,title,"hideState");
if (config.taggly.getTagglyOpt(title,"hideState") == "show") {
createTiddlyElement(place,"span",null,"tagglyLabel",
isTagExpr ? lingo.labels.exprLabel.format([title]) : lingo.labels.label.format([title]));
config.taggly.createListControl(place,title,"title");
config.taggly.createListControl(place,title,"modified");
config.taggly.createListControl(place,title,"created");
config.taggly.createListControl(place,title,"listMode");
config.taggly.createListControl(place,title,"excerpts");
config.taggly.createListControl(place,title,"numCols");
config.taggly.createTagglyList(place,title,isTagExpr);
if (countFound == 0 && showEmpty)
createTiddlyElement(place,"div",null,"tagglyNoneFound",lingo.labels.noneFound);
}
}
}
}
},
// todo fix these up a bit
styles: [
"/*{{{*/",
"/* created by TagglyTaggingPlugin */",
".tagglyTagging { padding-top:0.5em; }",
".tagglyTagging li.listTitle { display:none; }",
".tagglyTagging ul {",
" margin-top:0px; padding-top:0.5em; padding-left:2em;",
" margin-bottom:0px; padding-bottom:0px;",
"}",
".tagglyTagging { vertical-align: top; margin:0px; padding:0px; }",
".tagglyTagging table { margin:0px; padding:0px; }",
".tagglyTagging .button { visibility:hidden; margin-left:3px; margin-right:3px; }",
".tagglyTagging .button, .tagglyTagging .hidebutton {",
" color:[[ColorPalette::TertiaryLight]]; font-size:90%;",
" border:0px; padding-left:0.3em;padding-right:0.3em;",
"}",
".tagglyTagging .button:hover, .hidebutton:hover, ",
".tagglyTagging .button:active, .hidebutton:active {",
" border:0px; background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]];",
"}",
".selected .tagglyTagging .button { visibility:visible; }",
".tagglyTagging .hidebutton { color:[[ColorPalette::Background]]; }",
".selected .tagglyTagging .hidebutton { color:[[ColorPalette::TertiaryLight]] }",
".tagglyLabel { color:[[ColorPalette::TertiaryMid]]; font-size:90%; }",
".tagglyTagging ul {padding-top:0px; padding-bottom:0.5em; margin-left:1em; }",
".tagglyTagging ul ul {list-style-type:disc; margin-left:-1em;}",
".tagglyTagging ul ul li {margin-left:0.5em; }",
".editLabel { font-size:90%; padding-top:0.5em; }",
".tagglyTagging .commas { padding-left:1.8em; }",
"/* not technically tagglytagging but will put them here anyway */",
".tagglyTagged li.listTitle { display:none; }",
".tagglyTagged li { display: inline; font-size:90%; }",
".tagglyTagged ul { margin:0px; padding:0px; }",
".excerpt { color:[[ColorPalette::TertiaryDark]]; }",
".excerptIndent { margin-left:4em; }",
"div.tagglyTagging table,",
"div.tagglyTagging table tr,",
"td.tagglyTagging",
" {border-style:none!important; }",
".tagglyTagging .contents { border-bottom:2px solid [[ColorPalette::TertiaryPale]]; padding:0 1em 1em 0.5em;",
" margin-bottom:0.5em; }",
".tagglyTagging .indent1 { margin-left:3em; }",
".tagglyTagging .indent2 { margin-left:4em; }",
".tagglyTagging .indent3 { margin-left:5em; }",
".tagglyTagging .indent4 { margin-left:6em; }",
".tagglyTagging .indent5 { margin-left:7em; }",
".tagglyTagging .indent6 { margin-left:8em; }",
".tagglyTagging .indent7 { margin-left:9em; }",
".tagglyTagging .indent8 { margin-left:10em; }",
".tagglyTagging .indent9 { margin-left:11em; }",
".tagglyTagging .indent10 { margin-left:12em; }",
".tagglyNoneFound { margin-left:2em; color:[[ColorPalette::TertiaryMid]]; font-size:90%; font-style:italic; }",
"/*}}}*/",
""].join("\n"),
init: function() {
merge(config.macros,this.macros);
config.shadowTiddlers["TagglyTaggingStyles"] = this.styles;
store.addNotification("TagglyTaggingStyles",refreshStyles);
}
};
config.taggly.init();
//}}}
/***
InlineSlidersPlugin
By Saq Imtiaz
http://tw.lewcid.org/sandbox/#InlineSlidersPlugin
// syntax adjusted to not clash with NestedSlidersPlugin
// added + syntax to start open instead of closed
***/
//{{{
config.formatters.unshift( {
name: "inlinesliders",
// match: "\\+\\+\\+\\+|\\<slider",
match: "\\<slider",
// lookaheadRegExp: /(?:\+\+\+\+|<slider) (.*?)(?:>?)\n((?:.|\n)*?)\n(?:====|<\/slider>)/mg,
lookaheadRegExp: /(?:<slider)(\+?) (.*?)(?:>)\n((?:.|\n)*?)\n(?:<\/slider>)/mg,
handler: function(w) {
this.lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = this.lookaheadRegExp.exec(w.source)
if(lookaheadMatch && lookaheadMatch.index == w.matchStart ) {
var btn = createTiddlyButton(w.output,lookaheadMatch[2] + " "+"\u00BB",lookaheadMatch[2],this.onClickSlider,"button sliderButton");
var panel = createTiddlyElement(w.output,"div",null,"sliderPanel");
panel.style.display = (lookaheadMatch[1] == '+' ? "block" : "none");
wikify(lookaheadMatch[3],panel);
w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
}
},
onClickSlider : function(e) {
if(!e) var e = window.event;
var n = this.nextSibling;
n.style.display = (n.style.display=="none") ? "block" : "none";
return false;
}
});
//}}}
!!Culture
Scripting language written in 1988 by John Ousterhout, also author of the Tk extension ( Tool Kit = Gui builder ) two years later. The Tk part was such a success that it has been ported to many other languages: perl-tk , python-Tkinter
Pronounciation for french readers:
* tcl : tiqueulle
* tcl-tk : tiqueulle-tiquet
!!Basics
''Everything in tcl is a string.'' Variable Substitution can be imediate/differed if delimited with quotes/braces:
{{{
set myvar "Hello"; puts "Message: $myvar !!"
set myvar "Hello"; puts {Message: $myvar !!}
}}}
//Message: Hello !!
Message: $myvar !!//
If the string needs to be evaluated, use the string interpreter ''expr''
{{{
set a 1; set b 3; set tot [ expr $a+$b]
}}}
//4//
!!Interactive start
{{{
csh> tclsh
% puts Hello
Hello
% exit
}}}
!!Strings
{{{
set myvar "Hello world"
puts "Message with imediate substitution: $myvar !!"
puts {Message with differed substitution: $myvar !!}
}}}
//...
Message with imediate substitution: Hello world !!
Message with differed substitution: $myvar !!
//
!!Numerals
{{{
set mycnt 12
incr mycnt
set mycnt [expr ($mycnt+4)*0x0a ]
puts "Result = $mycnt"
}}}
//...
Result = 170
//
!!Arguments
* Predefined variables:
** ''argc'' number of arguments
** ''argv'' list of arguments
** ''argv0'' name of the script
** ''tcl_interactive'' 0 if script is running, else 1
{{{
if {$argc != 2} {
puts "usage: $argv0 word1 word2"
exit 1
}
set first_arg [lindex $argv 0]
puts "First arg = $first_arg"
puts "Next arg = [lindex $argv 1]"
}}}
!!Environement
* Predefined variables:
** ''$env'' is an array, indexed with names of the variables
{{{
puts "HOST = $env(HOST)"
}}}
//HOST = napoli.rfo.atmel.com//
!!Lazy if-then-else
{{{
set flag 1
set choice [ expr $flag ? 34 : 45]
}}}
//34//
!!Nested
{{{
set myswitch "B"
if {$myswitch == "A"} then {
puts "A is a good choice !"
} elseif { $myswitch == "B"} then {
puts "B is a good choice !"
} else {
puts "Very Bad choice !"
}
}}}
//B is a good choice !//
!!Case
{{{
set cond typ
switch $cond {
"min" {puts "MIN"}
"typ" {puts "TYP"}
"max" {puts "MAX"}
}
}}}
//TYP//
!!procedure
{{{
proc myproc {in1 in2} {
set result [expr $in1+$in2]
return $result
}
set mycall [myproc 12 45]
puts "My call give the result $mycall"
}}}
//...
My call give the result 57
//
!!name space
By default variables are local to the procedure. If a variable from the main is to be used, this must be specified ''within'' the ''proc'' statement:
{{{
proc myproc2 {y} {
global x
set result [expr $x+$y]
return $result
}
set x 2
set mycall [myproc2 5]
puts "My call give the result $mycall"
}}}
//...
My call give the result 7
//
!!Range
{{{
for {set i 0} {$i<4} {incr i} {
puts "i : $i"
}
}}}
!!List
{{{
foreach letter {A B C} {
puts "letter : $letter"
}
}}}
or
{{{
set list_of_letters {A B C}
foreach letter $list_of_letters {
puts "letter : $letter"
}
}}}
!!Basic
{{{
set myvar [exec date -u]
}}}
//Wed Jan 2 11:36:15 UTC 2008//
!!Capture errorcode
{{{
set cmd "date"
#set cmd "rm file_that_doesnt_exist"
set status [ catch {exec $cmd} ]
if { $status } then {
puts " Execution NOK"
exit
} else {
puts " Execution OK"
}
}}}
!!Capture errorcode & stdout
{{{
set cmd "date"
#set cmd "rm file_that_doesnt_exist"
set status [ catch {exec $cmd} result ]
if { $status } then {
puts " Execution NOK"
exit
} else {
puts " Execution OK"
puts $result
}
}}}
!!Capture errorcode & stdout & stderr
{{{
set cmd "date"
#set cmd "rm file_that_doesnt_exist"
set exit_code [ catch { exec $cmd > stdout_dump } error_message]
puts "error_message = $error_message"
puts "exit_code = $exit_code"
puts "stdout_dump:"
set fid [ open stdout_dump r ]
while { [gets $fid line] >= 0 } { puts $line }
close $fid
}}}
!!Globbing
{{{
set filename [glob ~/.cshrc ]
}}}
!!Existence
{{{
set filename "/tmp/myfile"
set flag1 [file exists $filename]
puts "$filename exist ? : $flag1"
}}}
!!Clean up
{{{
file -force myFolder
}}}
//i.e. rm -rf//
!!Write to
{{{
set fileid [ open "./myfile" w+]
puts $fileid "yop"
close $fileid
}}}
!!Read from
{{{
set fileid [ open "./myfile" r]
gets $fileid myvar
puts "Read from the file ....$myvar"
close $fileid
}}}
!!Parse
{{{
set fileid [ open "./myfile" r]
while { [gets $infile line] >= 0 } {
puts $line
}
close $fileid
}}}
!!diff
{{{
proc compare2files { file1 file2 } {
set fid1 [open $file1 r]
set fid2 [open $file2 r]
set comp_error 0
while {(![eof $fid1] | ![eof $fid2]) & $comp_error == 0} {
gets $fid1 line1
gets $fid2 line2
if {[string compare $line1 $line2] != 0} {
set comp_error 1
}
}
close $fid1
close $fid2
return [expr {1-$comp_error}]
}
}}}
!Parot Example
{{{client.tcl}}}
{{{
#!/bin/env tclsh
#set server remote.machine.com
set server localhost
set mySocket [ socket $server 9900 ]
set dataOut "Hello World"
puts ">Sending to Server: $dataOut"
puts $mySocket $dataOut
flush $mySocket
gets $mySocket dataIn
puts ">Received fro, server: $dataIn"
}}}
{{{server.tcl}}}
{{{
#!/bin/env tclsh
proc readClient { mySocket } {
gets $mySocket dataIn
puts "Received from client : $dataIn"
set dataOut $dataIn
puts "Sending to client : $dataOut"
puts $mySocket $dataOut
}
proc myServerCallBack { mySocket clientAddr clientPort } {
puts "Connection from $clientAddr"
fileevent $mySocket readable [ readClient $mySocket ]
close $mySocket
}
socket -server myServerCallBack 9900
vwait forever
}}}
/%
|Name|ToggleRightSidebar|
|Source|http://www.TiddlyTools.com/#ToggleRightSidebar|
|Version|1.0.0|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|script|
|Requires|InlineJavascriptPlugin|
|Overrides||
|Description|show/hide right sidebar (SideBarOptions)|
Usage: <<tiddler ToggleRightSidebar>>
Config settings:
config.options.txtToggleRightSideBarLabelShow (?)
config.options.txtToggleRightSideBarLabelHide (?)
config.options.txtToggleRightSideBarTipShow ("show right sidebar")
config.options.txtToggleRightSideBarTipHide ("hide right sidebar")
%/<script label="show/hide right sidebar">
var sb=document.getElementById('sidebar'); if (!sb) return;
var show=sb.style.display=='none';
if (!show) { sb.style.display='none'; var margin='1em'; }
else { sb.style.display='block'; var margin=config.options.txtDisplayAreaRightMargin||''; }
if (typeof(place)!='undefined') {
place.innerHTML=show?
config.options.txtToggleRightSideBarLabelHide:config.options.txtToggleRightSideBarLabelShow;
place.title=show?
config.options.txtToggleRightSideBarTipHide:config.options.txtToggleRightSideBarTipShow;
}
document.getElementById('displayArea').style.marginRight=margin;
config.options.chkShowRightSidebar=show;
saveOptionCookie('chkShowRightSidebar');
var sm=document.getElementById('storyMenu'); if (sm) config.refreshers.content(sm);
return false;
</script><script>
if (config.options.chkShowRightSidebar==undefined)
config.options.chkShowRightSidebar=true;
if (!config.options.txtDisplayAreaRightMargin||!config.options.txtDisplayAreaRightMargin.length)
config.options.txtDisplayAreaRightMargin="18em";
if (config.options.txtToggleRightSideBarLabelShow==undefined)
config.options.txtToggleRightSideBarLabelShow="SideBar →";
if (config.options.txtToggleRightSideBarLabelHide==undefined)
config.options.txtToggleRightSideBarLabelHide="SideBar ←";
if (config.options.txtToggleRightSideBarTipShow==undefined)
config.options.txtToggleRightSideBarTipShow="show right sidebar";
if (config.options.txtToggleRightSideBarTipHide==undefined)
config.options.txtToggleRightSideBarTipHide="hide right sidebar";
var show=config.options.chkShowRightSidebar;
document.getElementById('sidebar').style.display=show?"block":"none";
document.getElementById('displayArea').style.marginRight=show?
config.options.txtDisplayAreaRightMargin:"1em";
place.lastChild.innerHTML=show?
config.options.txtToggleRightSideBarLabelHide:config.options.txtToggleRightSideBarLabelShow;
place.lastChild.title=show?
config.options.txtToggleRightSideBarTipHide:config.options.txtToggleRightSideBarTipShow;
place.lastChild.style.fontWeight="normal";
</script>
/***
|Name:|ToggleTagPlugin|
|Description:|Makes a checkbox which toggles a tag in a tiddler|
|Version:|3.1.0 ($Rev: 4907 $)|
|Date:|$Date: 2008-05-13 03:15:46 +1000 (Tue, 13 May 2008) $|
|Source:|http://mptw.tiddlyspot.com/#ToggleTagPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!!Usage
{{{<<toggleTag }}}//{{{TagName TiddlerName LabelText}}}//{{{>>}}}
* TagName - the tag to be toggled, default value "checked"
* TiddlerName - the tiddler to toggle the tag in, default value the current tiddler
* LabelText - the text (gets wikified) to put next to the check box, default value is '{{{[[TagName]]}}}' or '{{{[[TagName]] [[TiddlerName]]}}}'
(If a parameter is '.' then the default will be used)
* TouchMod flag - if non empty then touch the tiddlers mod date. Note, can set config.toggleTagAlwaysTouchModDate to always touch mod date
!!Examples
|Code|Description|Example|h
|{{{<<toggleTag>>}}}|Toggles the default tag (checked) in this tiddler|<<toggleTag>>|
|{{{<<toggleTag TagName>>}}}|Toggles the TagName tag in this tiddler|<<toggleTag TagName>>|
|{{{<<toggleTag TagName TiddlerName>>}}}|Toggles the TagName tag in the TiddlerName tiddler|<<toggleTag TagName TiddlerName>>|
|{{{<<toggleTag TagName TiddlerName 'click me'>>}}}|Same but with custom label|<<toggleTag TagName TiddlerName 'click me'>>|
|{{{<<toggleTag . . 'click me'>>}}}|dot means use default value|<<toggleTag . . 'click me'>>|
!!Notes
* If TiddlerName doesn't exist it will be silently created
* Set label to '-' to specify no label
* See also http://mgtd-alpha.tiddlyspot.com/#ToggleTag2
!!Known issues
* Doesn't smoothly handle the case where you toggle a tag in a tiddler that is current open for editing
* Should convert to use named params
***/
//{{{
if (config.toggleTagAlwaysTouchModDate == undefined) config.toggleTagAlwaysTouchModDate = false;
merge(config.macros,{
toggleTag: {
createIfRequired: true,
shortLabel: "[[%0]]",
longLabel: "[[%0]] [[%1]]",
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
var tiddlerTitle = tiddler ? tiddler.title : '';
var tag = (params[0] && params[0] != '.') ? params[0] : "checked";
var title = (params[1] && params[1] != '.') ? params[1] : tiddlerTitle;
var defaultLabel = (title == tiddlerTitle ? this.shortLabel : this.longLabel);
var label = (params[2] && params[2] != '.') ? params[2] : defaultLabel;
var touchMod = (params[3] && params[3] != '.') ? params[3] : "";
label = (label == '-' ? '' : label); // dash means no label
var theTiddler = (title == tiddlerTitle ? tiddler : store.getTiddler(title));
var cb = createTiddlyCheckbox(place, label.format([tag,title]), theTiddler && theTiddler.isTagged(tag), function(e) {
if (!store.tiddlerExists(title)) {
if (config.macros.toggleTag.createIfRequired) {
var content = store.getTiddlerText(title); // just in case it's a shadow
store.saveTiddler(title,title,content?content:"",config.options.txtUserName,new Date(),null);
}
else
return false;
}
if ((touchMod != "" || config.toggleTagAlwaysTouchModDate) && theTiddler)
theTiddler.modified = new Date();
store.setTiddlerTag(title,this.checked,tag);
return true;
});
}
}
});
//}}}
/***
Description: Contains the stuff you need to use Tiddlyspot
Note, you also need UploadPlugin, PasswordOptionPlugin and LoadRemoteFileThroughProxy
from http://tiddlywiki.bidix.info for a complete working Tiddlyspot site.
***/
//{{{
// edit this if you are migrating sites or retrofitting an existing TW
config.tiddlyspotSiteId = 'drtips';
// make it so you can by default see edit controls via http
config.options.chkHttpReadOnly = false;
window.readOnly = false; // make sure of it (for tw 2.2)
window.showBackstage = true; // show backstage too
// disable autosave in d3
if (window.location.protocol != "file:")
config.options.chkGTDLazyAutoSave = false;
// tweak shadow tiddlers to add upload button, password entry box etc
with (config.shadowTiddlers) {
SiteUrl = 'http://'+config.tiddlyspotSiteId+'.tiddlyspot.com';
SideBarOptions = SideBarOptions.replace(/(<<saveChanges>>)/,"$1<<tiddler TspotSidebar>>");
OptionsPanel = OptionsPanel.replace(/^/,"<<tiddler TspotOptions>>");
DefaultTiddlers = DefaultTiddlers.replace(/^/,"[[WelcomeToTiddlyspot]] ");
MainMenu = MainMenu.replace(/^/,"[[WelcomeToTiddlyspot]] ");
}
// create some shadow tiddler content
merge(config.shadowTiddlers,{
'WelcomeToTiddlyspot':[
"This document is a ~TiddlyWiki from tiddlyspot.com. A ~TiddlyWiki is an electronic notebook that is great for managing todo lists, personal information, and all sorts of things.",
"",
"@@font-weight:bold;font-size:1.3em;color:#444; //What now?// @@ Before you can save any changes, you need to enter your password in the form below. Then configure privacy and other site settings at your [[control panel|http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/controlpanel]] (your control panel username is //" + config.tiddlyspotSiteId + "//).",
"<<tiddler TspotControls>>",
"See also GettingStarted.",
"",
"@@font-weight:bold;font-size:1.3em;color:#444; //Working online// @@ You can edit this ~TiddlyWiki right now, and save your changes using the \"save to web\" button in the column on the right.",
"",
"@@font-weight:bold;font-size:1.3em;color:#444; //Working offline// @@ A fully functioning copy of this ~TiddlyWiki can be saved onto your hard drive or USB stick. You can make changes and save them locally without being connected to the Internet. When you're ready to sync up again, just click \"upload\" and your ~TiddlyWiki will be saved back to tiddlyspot.com.",
"",
"@@font-weight:bold;font-size:1.3em;color:#444; //Help!// @@ Find out more about ~TiddlyWiki at [[TiddlyWiki.com|http://tiddlywiki.com]]. Also visit [[TiddlyWiki.org|http://tiddlywiki.org]] for documentation on learning and using ~TiddlyWiki. New users are especially welcome on the [[TiddlyWiki mailing list|http://groups.google.com/group/TiddlyWiki]], which is an excellent place to ask questions and get help. If you have a tiddlyspot related problem email [[tiddlyspot support|mailto:support@tiddlyspot.com]].",
"",
"@@font-weight:bold;font-size:1.3em;color:#444; //Enjoy :)// @@ We hope you like using your tiddlyspot.com site. Please email [[feedback@tiddlyspot.com|mailto:feedback@tiddlyspot.com]] with any comments or suggestions."
].join("\n"),
'TspotControls':[
"| tiddlyspot password:|<<option pasUploadPassword>>|",
"| site management:|<<upload http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/store.cgi index.html . . " + config.tiddlyspotSiteId + ">>//(requires tiddlyspot password)//<br>[[control panel|http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/controlpanel]], [[download (go offline)|http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/download]]|",
"| links:|[[tiddlyspot.com|http://tiddlyspot.com/]], [[FAQs|http://faq.tiddlyspot.com/]], [[blog|http://tiddlyspot.blogspot.com/]], email [[support|mailto:support@tiddlyspot.com]] & [[feedback|mailto:feedback@tiddlyspot.com]], [[donate|http://tiddlyspot.com/?page=donate]]|"
].join("\n"),
'TspotSidebar':[
"<<upload http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/store.cgi index.html . . " + config.tiddlyspotSiteId + ">><html><a href='http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/download' class='button'>download</a></html>"
].join("\n"),
'TspotOptions':[
"tiddlyspot password:",
"<<option pasUploadPassword>>",
""
].join("\n")
});
//}}}
* Tiddly Wiki is the technology developed by Jeremy Ruston in 2005 that has been used to build this document. It comes as a single self-contained html file that has the power of overwriting itself. Chunks of data that can be added or removed are known as tiddlers. Edition of tiddlers is based on a wiki approach.
* Source: http://www.tiddlywiki.com/
* Current Version: <<version>>
''text'' {{indent{{{{''text''}}} }}}
//text// {{indent{{{{//text//}}} }}}
__text__ {{indent{{{{__text__}}} }}}
--text-- {{indent{{{{--text--}}} }}}
@@color(green):text@@ {{indent{{{{@@color(green):text@@}}} }}}
@@bgcolor(#ff0000):color(#ffffff):text@@ {{indent{{{{@@bgcolor(#ff0000):color(#ffffff):text@@}}} }}}
@@text@@ {{indent{{{{@@text@@}}} }}}
@@letter-spacing: -1px;text@@ {{indent{{{{@@letter-spacing: -1px;text@@}}} }}}
@@letter-spacing: 0.3em;text@@ {{indent{ {{{@@letter-spacing:0.3em;text@@}}} }}}
----
a^^text^^{{indent{{{{a^^text^^}}} }}}
a~~text~~{{indent{{{{a~~text~~}}} }}}
!{{{!text}}}
!!{{{!!text}}}
!!!{{{!!!text}}}
{{{ {{indent text ...text }}}
{{indent{text text text
----
text /%invisible comment %/ text {{indent { {{{text /%invisible comment%/ text }}}
{{{ text }}} {{indent { """{{{ text }}}"""
"""textText""" {{indent { {{{ """textText""" }}}
----
text {{{text}}}
#{{{#text}}}
#{{{#text}}}
##{{{##text}}}
###{{{###text}}}
>{{{>text}}}
>>{{{>>text}}}
*{{{*text}}}
**{{{**text}}}
***{{{***text}}}
Following tips rely on some extras in the StyleSheet. Search for ''twocolumn'' in StyleSheet for example to get the idea...
!!!
{{{ {{twocolumns{text ... text }}}
{{twocolumns{ text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text }}}
{{{ {{threecolumns{text ... text }}}
{{threecolumns{ text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text }}}
{{{ {{textleft{ text ... text }}}
{{{ {{textcenter{ text ... text }}}
{{{ {{textright{ text ... text }}}
|!Table header|!Column Two|
|>| colspan |
| rowspan |left aligned|
|~| right aligned|
|bgcolor(#DC1A1A):colored| centered |
||*lists<br>*within<br>*tables<br><br>and double-spaced too|
|caption|c
----
{{{ |!Table header|!Column Two| }}}
{{{ |>| colspan | }}}
{{{ | rowspan |left aligned| }}}
{{{ |~| right aligned| }}}
{{{ |bgcolor(#AADDFF):colored| centered | }}}
{{{ ||*lists<br>*within<br>*tables<br><br>and double-spaced too| }}}
{{{ |caption|c }}}
----
*''Gotcha!'' There must be no space after last ''|'' of the row
!!! hyperlinks
|MyTiddlerName |{{{MyTiddlerName}}}|
|~UnlinkedTiddlerName |{{{~UnlinkedTiddlerName}}}|
|[[Tiddler Named With Spaces ]] |{{{[[Tiddler Named With Spaces]]}}}|
|[[text|MyTiddlerName]] |{{{[[text|MyTiddlerName]]}}}|
|[[text|http://www.google.com]] | {{{[[text|http://www.google.com]]}}}|
!!! images
| insert a picture | {{{[img[file.jpg]] }}} |
|floating right | {{{[>img[text|file.jpg]] }}} |
|floating left | {{{[<img[text|file.jpg]] }}} |
''Source:'' Julian Knight's @ [[http://knighjm.googlepages.com/knightnet-default-tw.html]]
|!Macro|!Description|!Syntax|
|allTags|List all the tags used in the current ~TiddlyWiki file<<br>>Each entry is a button that pops up the list of tiddlers for that tag<<br>><<slider sliderID [[Internal Macros/tags]] 'Click to show example output'>>|{{{<<allTags>>}}}|
|br|Force a line break|{{{<<br>>}}}|
|closeAll|Displays a button to close all displayed Tiddlers<<br>><<closeAll>>|{{{<<closeAll>>}}}|
|gradient|<<gradient [horiz|vert] #bbbbbb #eeeeee #ffffff>>Produces a horizontal or vertical background gradient fill>><<br>>There can be 2 or more colours in the format: #rrggbb (hex), or RGB(r,g,b) (CSS)<<br>>Other CSS formatting can also be added, e.g. {{{<<gradient vert #000000 #660000 #aa2222>>color:#ffffff;font-size:12pt;Darkness>>}}}|{{{<<gradient [horiz|vert] #bbbbbb #eeeeee #ffffff>>Some text here>>}}}|
|list all|List all Tiddlers in a Tiddler|{{{<<list all>>}}}|
|list missing|List all missing tiddlers|{{{<<list missing>>}}}|
|list orphans|List all orphaned tiddlers|{{{<<list orphans>>}}}|
|newJournal|Displays a button to create new date & Time stamped Tiddler (Date/time format optional)<<br>><<newJournal "DD MMM YYYY, hh:mm">> <<br>>You can also add optional tag names after the date format: <<newJournal "DD MMM YYYY, hh:mm" tag1 TagTwo>> |{{{<<newJournal [DateFormatString]>>}}} <<br>> {{{<<newJournal "DD MMM YYYY, hh:mm" tag1 TagTwo>>}}} |
|newTiddler|Displays a button to create new Tiddler<<br>><<newTiddler>>|{{{<<newTiddler>>}}}|
|permaview|Displays a button to change the URL link for all open Tiddlers - or the containing tiddler if used in the command bar (See the ViewTemplate)<<br>><<permaview>>|{{{<<permaview>>}}}|
|saveChanges |Button to save all ~TiddlyWiki changes (or the current tiddler if used in the command bar (see EditTemplate)<<br>><<saveChanges>>|{{{<<saveChanges>>}}}|
|search|Display a Search box<<br>><<search>>|{{{<<search>>}}}|
|slider|Display a Slider (a collapsable display of another tiddler)<<br>>See the allTags entry for an example. Note: Put quotes around the label if needing spaces<<br>>where: ''ID''=cookie name to be used to save the state of the slider, ''Tiddler''=name of the tiddler to include in the slider, ''Label''=label text of the slider button, ''tooltip''=text of the buttons tooltip|{{{<<slider ID Tiddler [Label] [toolTip]>>}}}|
|sparkline|Produces a sparkline graphic<<br>>e.g. <<sparkline 163 218 231 236 232 266 176 249 289 1041 1835 2285 3098 2101 1755 3283 3353 3335 2898 2224 1404 1354 1825 1839 2142 1942 1784 1145 979 1328 1611>>|{{{<<sparkline num1 num2 ... numN>>}}}|
|tabs|Display Tabbed content (contents of tab provided by another tiddler)|{{{<<tabs identifier tabLabel tabName Tiddlername>>}}}|
|tag|Display a Tag ~PopUp<<br>><<tag _Config>>|{{{<<tag tagName>>}}}|
|tagChooser|Used in EditTemplate to add tags to the tags field. Doesn't actually add anything unless in edit mode (though it does show the list)<<br>><<tagChooser>>|{{{<<tagChooser>>}}}|
|tagging|<<tiddler [[Internal Macros/tagging]]>>|{{{<<tagging [TiddlerTitle]>>}}}|
|tiddler|Display contents of another tiddler inline|{{{<<tiddler Tiddler>>}}}|
|timeline|Display a timeline list of tiddlers<<br>>where the sortfield is the sort order ("modified" or "created") and maxentries is the maximum number of entries|{{{<<timeline [sortfield] [maxentries]>>}}}|
|today|Display Today's Date<<br>>e.g. <<today>>|{{{<<today [DateFormatString]>>}}}|
|version|Display ~TiddlyWiki's version<<br>>e.g. <<version>>|{{{<<version>>}}}|
!DateFormatString
Several Macros including the today macro take a DateFormatString as an optional argument. This string can be a combination of ordinary text, with some special characters that get substituted by parts of the date:
* DDD - day of week in full (eg, "Monday")
* DD - day of month, 0DD - adds a leading zero
* MMM - month in full (eg, "July")
* MM - month number, 0MM - adds leading zero
* YYYY - full year, YY - two digit year
* hh - hours
* mm - minutes
* ss - seconds
!Notes
If you need to supply a parameter that should be evaluated (e.g. a JavaScript variable), enclose the parameter in {{{{{}}} and {{{}}}}} rather than quotes. Note however, that the scope used in the evaluation is {{{global}}} rather than {{{local}}}. In other words, the evaluation is done ''before'' the parameter is passed to the macro/plugin so it cannot access any of the variables or functions defined within the macro/plugin.
!Commands supported by the toolbar macro
{{{
config.commands = {
closeTiddler: {text: "close", tooltip: "Close this tiddler"},
closeOthers: {text: "close others", tooltip: "Close all other tiddlers"},
editTiddler: {text: "edit", tooltip: "Edit this tiddler", readOnlyText: "view", readOnlyTooltip: "View the source of this tiddler"},
saveTiddler: {text: "done", tooltip: "Save changes to this tiddler", readOnlyText: "done", readOnlyTooltip: "View this tiddler normally"},
cancelTiddler: {text: "cancel", tooltip: "Undo changes to this tiddler", hideReadOnly: true},
deleteTiddler: {text: "delete", tooltip: "Delete this tiddler", warning: "Are you sure you want to delete '%0'?", hideReadOnly: true},
permalink: {text: "permalink", tooltip: "Permalink for this tiddler"},
references: {text: "references", tooltip: "Show tiddlers that link to this one", popupNone: "No references"},
jump: {text: "jump", tooltip: "Jump to another open tiddler"}
};
}}}
(Julian Knight, 2006-04-06)
<part tagging hidden>
Produces a list (NB: <ul> ''not'' a popup) of links to tiddlers that carry the specified tag. If no tag is specified, it looks for tiddlers tagged with the name of the current tiddler.
In HTML, the list is formatted like so:
{{{
<ul>
<li class="listTitle">List title label</li>
<li><a class="tiddlyLink ..." href="javascript:;" onclick="..."
refresh="link" tiddlyLink="ExampleOne">ExampleOne</a></li>
</ul>
}}}
</part>
<part tags hidden>
<<allTags>>
</part>
{{editbutton{<<editTiddler TwMacros>>}}}
Enclose a piece of html with {{{ <html>... </html> }}}
{{{
<html>
<li> hello </li>
</html>
}}}
<html>
<li> hello </li>
</html>
*''Gotcha!'' It's not working when the tiddler is embedded in a slider.
!!! Style
The overall look and feel is completly under the control of a few tiddlers:
* PageTemplate : Controls page layout : header, menu location, ....
* ViewTemplate : Controls tiddler layout.
* ColorPalette : All stylesheet colors are redirected to this tiddler.
* StyleSheet: Piece of CSS that can be used to override defaults from StyleSheetColors & StyleSheetLayout:
!!!Plugins
Plugins are tiddlers that can add functions to your tiddlywiki. Plugins can be imported throught the plugin manager ( look-at backstage ) , or manually:
# Open the tiddler you want to import in view or edit mode.
# Copy the code to your clip-board ( """Ctrl-A""", """Ctrl-C""" ).
# Create a tiddler with the same name in your tiddlywiki.
# Paste the code ( """Ctrl-V""" )
# ''Add a tag named: systemConfig'' ( This will trigger code upgrade on next restart )
# save your tiddlywiki and refresh
# Look out for warnings... sometimes a plugin requires another plugin....
!!! Macros
Some tiddlers contain special functions that do not need to be processed at start up. But a special plugin: InlineJavascriptPlugin must to be installed first.
!Plugins added to this tiddlyWiki
|InlineJavascriptPlugin |Mandatory for many other plugins |
|EditTiddlerPlugin |Enable access to edit mode within a displayed slider. Example at the bottom ''this'' tiddler |
|TableSortingPlugin |Column sorting by clicking in the header |
|DefaultOptionsPlugin |Just a piece of js to be executed at refresh, can overide options stored as cookies such as YourName ....|
|ReplaceDoubleClick|A macro to avoid edit-mode on double-click. See usage in ViewTemplate or MptwTheme |
| Symbol | Upper-case |Lower-case |
| {{{Α}}} | Α | α |
| {{{Β}}} | Β | β |
| {{{Γ}}} | Γ | γ |
| {{{Δ}}} | Δ | δ |
| {{{Ε}}} | Ε | ε |
| {{{Ζ}}} | Ζ | ζ |
| {{{Η}}} | Η | η |
| {{{Θ}}} | Θ | θ |
| {{{&Thetasym;}}} | ϑ | |
| {{{Ι}}} | Ι | ι |
| {{{Κ}}} | Κ | κ |
| {{{Λ}}} | Λ | λ |
| {{{Μ}}} | Μ | μ |
| {{{Ν}}} | Ν | ν |
| {{{Ξ}}} | Ξ | ξ |
| {{{Ο}}} | Ο | ο |
| {{{Π}}} | Π | π |
| {{{Π}}} | π | |
| {{{Ρ}}} | Ρ | ρ |
| {{{Σ}}} | Σ | σ |
| {{{Τ}}} | Τ | τ |
| {{{Υ}}} | Υ | υ |
| {{{Υ}}} | ϒ | |
| {{{Φ}}} | Φ | φ |
| {{{Χ}}} | Χ | χ |
| {{{Ψ}}} | Ψ | ψ |
| {{{Ω}}} | Ω | ω |
| {{{°}}} | ° |degree sign |
| {{{±}}} | ± |plus or minus sign |
| {{{×}}} | × |multiplication sign |
| {{{÷}}} | ÷ |division sign |
| {{{<}}} | < |less-than sign |
| {{{>}}} | > |greater-than sign |
| {{{⟨}}} | ⟨ |left angle bracket |
| {{{⟩}}} | ⟩ |right angle bracket |
| {{{¬}}} | ¬ |not sign |
| {{{¹}}} | ¹ |superscript one |
| {{{²}}} | ² |superscript two |
| {{{³}}} | ³ |superscript three |
| {{{·}}} | · |middle dot |
| {{{&afrac14;}}} | ¼ |one quarter |
| {{{½}}} | ½ |one half |
| {{{¾}}} | ¾ |three quarters |
| {{{‰}}} | ‰ |per mille sign |
| {{{ƒ}}} | ƒ |latin small f with hook (function) |
| {{{′}}} | ′ |prime / minutes / feet |
| {{{″}}} | ″ |double prime / seconds / inches |
| {{{⁄}}} | ⁄ |fraction slash |
| {{{℘}}} | ℘ |script capital P |
| {{{ℑ}}} | ℑ |bold I / imaginary part |
| {{{ℜ}}} | ℜ |bold R / real part |
| {{{ℵ}}} | ℵ |first transfinite cardinal |
| {{{µ}}} | µ |micro sign |
| {{{∀}}} | ∀ |for all |
| {{{∂}}} | ∂ |partial differential |
| {{{∃}}} | ∃ |there exists |
| {{{∅}}} | ∅ |empty set / diameter |
| {{{∇}}} | ∇ |backward difference |
| {{{∈}}} | ∈ |element of |
| {{{∉}}} | ∉ |not an element of |
| {{{∋}}} | ∋ |contains as member |
| {{{∏}}} | ∏ |product sign |
| {{{∑}}} | ∑ |n-ary sumation |
| {{{−}}} | − |minus sign |
| {{{∗}}} | ∗ |asterisk operator |
| {{{√}}} | √ |square root / radical |
| {{{∝}}} | ∝ |proportional to |
| {{{∞}}} | ∞ |infinity |
| {{{∠}}} | ∠ |angle |
| {{{∧}}} | ∧ |logical and |
| {{{∨}}} | ∨ |logical or |
| {{{∩}}} | ∩ |intersection |
| {{{∪}}} | ∪ |union |
| {{{∫}}} | ∫ |integral |
| {{{∴}}} | ∴ |therefore |
| {{{∼}}} | ∼ |similar to |
| {{{≅}}} | ≅ |approximately equal to |
| {{{≈}}} | ≈ |almost equal to |
| {{{≠}}} | ≠ |not equal to |
| {{{≡}}} | ≡ |identical to |
| {{{≤}}} | ≤ |less-than or equal to |
| {{{≥}}} | ≥ |greater-than or equal to |
| {{{⊂}}} | ⊂ |subset of |
| {{{⊃}}} | ⊃ |superset of |
| {{{⊄}}} | ⊄ |not a subset of |
| {{{⊆}}} | ⊆ |subset of or equal to |
| {{{⊇}}} | ⊇ |superset of or equal to |
| {{{⊕}}} | ⊕ |direct sum |
| {{{⊗}}} | ⊗ |vector product |
| {{{⊥}}} | ⊥ |orthogonal to / perpendicular |
| {{{⋅}}} | ⋅ |dot operator |
| {{{¢}}} | ¢ |cent sign |
| {{{£}}} | £ |pound sign |
| {{{¤}}} | ¤ |currency sign |
| {{{¥}}} | ¥ |yen sign |
| {{{€}}} | € |euro sign |
| {{{©}}} | © |copyright sign |
| {{{®}}} | ® |registered trade mark |
| {{{™}}} | ™ |trade mark sign |
| {{{º}}} | º |masculine ordinal indicator |
| {{{ª}}} | ª |feminine ordinal indicator |
| {{{†}}} | † |dagger |
| {{{‡}}} | ‡ |double dagger |
| {{{•}}} | • |bullet |
| {{{♠}}} | ♠ |spade |
| {{{♣}}} | ♣ |club |
| {{{♥}}} | ♥ |heart |
| {{{♦}}} | ♦ |diamond |
| {{{¯}}} | ¯ |overline |
| {{{¦}}} | ¦ |broken vertical bar |
| {{{–}}} | – |en dash |
| {{{—}}} | — |em dash |
| {{{‾}}} | ‾ |overline |
| {{{⌈}}} | ⌈ |left ceiling |
| {{{⌉}}} | ⌉ |right ceiling |
| {{{⌊}}} | ⌊ |left floor |
| {{{⌋}}} | ⌋ |right floor |
| {{{←}}} | ← |left arrow |
| {{{↑}}} | ↑ |up arrow |
| {{{→}}} | → |right arrow |
| {{{↓}}} | ↓ |down arrow |
| {{{↔}}} | ↔ |left right arrow |
| {{{↵}}} | ↵ |down arrow with corner leftwards / carriage return |
| {{{⇐}}} | ⇐ |left double arrow |
| {{{⇑}}} | ⇑ |up double arrow |
| {{{⇒}}} | ⇒ |right double arrow |
| {{{⇓}}} | ⇓ |down double arrow |
| {{{⇔}}} | ⇔ |left right double arrow |
| {{{¡}}} | ¡ |inverted exclamation mark |
| {{{¿}}} | ¿ |inverted question mark |
| {{{¨}}} | ¨ |diaeresis |
| {{{´}}} | ´ |acute accent |
| {{{¶}}} | ¶ |paragraph sign |
| {{{§}}} | § |section sign |
| {{{¸}}} | ¸ |cedilla |
| {{{&}}} | & |ampersand |
| {{{'}}} | ' |apostrophe mark |
| {{{ˆ}}} | ˆ |circumflex accent |
| {{{˜}}} | ˜ |small tilde |
| {{{…}}} | … |horizontal ellipsis |
| {{{"}}} | " |quotation mark |
| {{{»}}} | » |right double angle quotation mark |
| {{{«}}} | « |left double angle quotation mark |
| {{{‘}}} | ‘ |left single quotation mark|
| {{{’}}} | ’ |right single quotation mark |
| {{{‚}}} | ‚ |single low-9 quotation mark |
| {{{“}}} | “ |left double quotation mark |
| {{{”}}} | ” |right double quotation mark |
| {{{„}}} | „ |double low-9 quotation mark |
| {{{‹}}} | ‹ |single left-pointing angle quotation mark |
| {{{›}}} | › |single right-pointing angle quotation mark |
!!!Greeks
| """Background""" |bgcolor(#fff): {{visualcolorpaletteBG{ }}} |Main background and the text in the title and subtitle |
| """Foreground""" |bgcolor(#fff): {{visualcolorpaletteFG{ }}} |Text color |
| """PrimaryPale""" |bgcolor(#fff): {{visualcolorpalettePP{ }}} |Interface Options box , ~MainMenu text|
| """PrimaryLight""" |bgcolor(#fff): {{visualcolorpalettePL{ }}} |Top of the Header gradient |
| """PrimaryMid""" |bgcolor(#fff): {{visualcolorpalettePM{ }}} |Bottom of the header gradient, links, tags |
| """PrimaryDark""" |bgcolor(#fff): {{visualcolorpalettePD{ }}} |Text in sidebar and tiddler buttons |
| """SecondaryPale""" |bgcolor(#fff): {{visualcolorpaletteSP{ }}} |Background for code example boxes |
| """SecondaryLight""" |bgcolor(#fff): {{visualcolorpaletteSL{ }}} |Sidebar and tiddlers buttons highlight |
| """SecondaryMid""" |bgcolor(#fff): {{visualcolorpaletteSM{ }}} |Heading Cell , selected buttons, saving message box |
| """SecondaryDark""" |bgcolor(#fff): {{visualcolorpaletteSD{ }}} |Titles of the tiddlers |
| """TertiaryPale""" |bgcolor(#fff): {{visualcolorpaletteTP{ }}} |Tabbed zone of sidebar, tag button of tiddlers|
| """TertiaryLight""" |bgcolor(#fff): {{visualcolorpaletteTL{ }}} |Borders of sidebar buttons |
| """TertiaryMid""" |bgcolor(#fff): {{visualcolorpaletteTM{ }}} |Unselected tabs |
| """TertiaryDark""" |bgcolor(#fff): {{visualcolorpaletteTD{ }}} |Subtitle of tiddlers ( author,date...). boders of tables|
| """Error""" |bgcolor(#fff): {{visualcolorpaletteER{ }}} | ? |
{{editbutton{<<editTiddler TwVisualColorPalette>>}}}
| !date | !user | !location | !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |
| 19/02/2020 10:41:47 | DerivationBud | [[/|http://drtips.tiddlyspot.com/]] | [[store.cgi|http://drtips.tiddlyspot.com/store.cgi]] | . | [[index.html | http://drtips.tiddlyspot.com/index.html]] | . | failed |
| 19/02/2020 10:42:33 | DerivationBud | [[/|http://drtips.tiddlyspot.com/]] | [[store.cgi|http://drtips.tiddlyspot.com/store.cgi]] | . | [[index.html | http://drtips.tiddlyspot.com/index.html]] | . |
| 01/03/2020 12:27:29 | DerivationBud | [[/|http://drtips.tiddlyspot.com/]] | [[store.cgi|http://drtips.tiddlyspot.com/store.cgi]] | . | [[index.html | http://drtips.tiddlyspot.com/index.html]] | . |
| 25/03/2020 20:24:19 | DerivationBud | [[/|http://drtips.tiddlyspot.com/]] | [[store.cgi|http://drtips.tiddlyspot.com/store.cgi]] | . | [[index.html | http://drtips.tiddlyspot.com/index.html]] | . |
| 11/09/2020 11:40:57 | DerivationBud | [[/|http://drtips.tiddlyspot.com/]] | [[store.cgi|http://drtips.tiddlyspot.com/store.cgi]] | . | [[index.html | http://drtips.tiddlyspot.com/index.html]] | . |
| 25/06/2021 16:25:22 | DerivationBud | [[/|http://drtips.tiddlyspot.com/]] | [[store.cgi|http://drtips.tiddlyspot.com/store.cgi]] | . | [[index.html | http://drtips.tiddlyspot.com/index.html]] | . | failed |
| 25/06/2021 16:25:44 | DerivationBud | [[/|http://drtips.tiddlyspot.com/]] | [[store.cgi|http://drtips.tiddlyspot.com/store.cgi]] | . | [[index.html | http://drtips.tiddlyspot.com/index.html]] | . |
| 08/11/2021 12:28:22 | DerivationBud | [[/|http://drtips.tiddlyspot.com/]] | [[store.cgi|http://drtips.tiddlyspot.com/store.cgi]] | . | [[index.html | http://drtips.tiddlyspot.com/index.html]] | . | ok |
| 08/11/2021 12:30:54 | DerivationBud | [[/|http://drtips.tiddlyspot.com/]] | [[store.cgi|http://drtips.tiddlyspot.com/store.cgi]] | . | [[index.html | http://drtips.tiddlyspot.com/index.html]] | . |
| 24/07/2022 13:48:20 | DerivationBud | [[/|http://drtips.tiddlyspot.com/]] | [[store.cgi|http://drtips.tiddlyspot.com/store.cgi]] | . | [[index.html | http://drtips.tiddlyspot.com/index.html]] | . |
/***
|''Name:''|UploadPlugin|
|''Description:''|Save to web a TiddlyWiki|
|''Version:''|4.1.3|
|''Date:''|Feb 24, 2008|
|''Source:''|http://tiddlywiki.bidix.info/#UploadPlugin|
|''Documentation:''|http://tiddlywiki.bidix.info/#UploadPluginDoc|
|''Author:''|BidiX (BidiX (at) bidix (dot) info)|
|''License:''|[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D ]]|
|''~CoreVersion:''|2.2.0|
|''Requires:''|PasswordOptionPlugin|
***/
//{{{
version.extensions.UploadPlugin = {
major: 4, minor: 1, revision: 3,
date: new Date("Feb 24, 2008"),
source: 'http://tiddlywiki.bidix.info/#UploadPlugin',
author: 'BidiX (BidiX (at) bidix (dot) info',
coreVersion: '2.2.0'
};
//
// Environment
//
if (!window.bidix) window.bidix = {}; // bidix namespace
bidix.debugMode = false; // true to activate both in Plugin and UploadService
//
// Upload Macro
//
config.macros.upload = {
// default values
defaultBackupDir: '', //no backup
defaultStoreScript: "store.php",
defaultToFilename: "index.html",
defaultUploadDir: ".",
authenticateUser: true // UploadService Authenticate User
};
config.macros.upload.label = {
promptOption: "Save and Upload this TiddlyWiki with UploadOptions",
promptParamMacro: "Save and Upload this TiddlyWiki in %0",
saveLabel: "save to web",
saveToDisk: "save to disk",
uploadLabel: "upload"
};
config.macros.upload.messages = {
noStoreUrl: "No store URL in parmeters or options",
usernameOrPasswordMissing: "Username or password missing"
};
config.macros.upload.handler = function(place,macroName,params) {
if (readOnly)
return;
var label;
if (document.location.toString().substr(0,4) == "http")
label = this.label.saveLabel;
else
label = this.label.uploadLabel;
var prompt;
if (params[0]) {
prompt = this.label.promptParamMacro.toString().format([this.destFile(params[0],
(params[1] ? params[1]:bidix.basename(window.location.toString())), params[3])]);
} else {
prompt = this.label.promptOption;
}
createTiddlyButton(place, label, prompt, function() {config.macros.upload.action(params);}, null, null, this.accessKey);
};
config.macros.upload.action = function(params)
{
// for missing macro parameter set value from options
if (!params) params = {};
var storeUrl = params[0] ? params[0] : config.options.txtUploadStoreUrl;
var toFilename = params[1] ? params[1] : config.options.txtUploadFilename;
var backupDir = params[2] ? params[2] : config.options.txtUploadBackupDir;
var uploadDir = params[3] ? params[3] : config.options.txtUploadDir;
var username = params[4] ? params[4] : config.options.txtUploadUserName;
var password = config.options.pasUploadPassword; // for security reason no password as macro parameter
// for still missing parameter set default value
if ((!storeUrl) && (document.location.toString().substr(0,4) == "http"))
storeUrl = bidix.dirname(document.location.toString())+'/'+config.macros.upload.defaultStoreScript;
if (storeUrl.substr(0,4) != "http")
storeUrl = bidix.dirname(document.location.toString()) +'/'+ storeUrl;
if (!toFilename)
toFilename = bidix.basename(window.location.toString());
if (!toFilename)
toFilename = config.macros.upload.defaultToFilename;
if (!uploadDir)
uploadDir = config.macros.upload.defaultUploadDir;
if (!backupDir)
backupDir = config.macros.upload.defaultBackupDir;
// report error if still missing
if (!storeUrl) {
alert(config.macros.upload.messages.noStoreUrl);
clearMessage();
return false;
}
if (config.macros.upload.authenticateUser && (!username || !password)) {
alert(config.macros.upload.messages.usernameOrPasswordMissing);
clearMessage();
return false;
}
bidix.upload.uploadChanges(false,null,storeUrl, toFilename, uploadDir, backupDir, username, password);
return false;
};
config.macros.upload.destFile = function(storeUrl, toFilename, uploadDir)
{
if (!storeUrl)
return null;
var dest = bidix.dirname(storeUrl);
if (uploadDir && uploadDir != '.')
dest = dest + '/' + uploadDir;
dest = dest + '/' + toFilename;
return dest;
};
//
// uploadOptions Macro
//
config.macros.uploadOptions = {
handler: function(place,macroName,params) {
var wizard = new Wizard();
wizard.createWizard(place,this.wizardTitle);
wizard.addStep(this.step1Title,this.step1Html);
var markList = wizard.getElement("markList");
var listWrapper = document.createElement("div");
markList.parentNode.insertBefore(listWrapper,markList);
wizard.setValue("listWrapper",listWrapper);
this.refreshOptions(listWrapper,false);
var uploadCaption;
if (document.location.toString().substr(0,4) == "http")
uploadCaption = config.macros.upload.label.saveLabel;
else
uploadCaption = config.macros.upload.label.uploadLabel;
wizard.setButtons([
{caption: uploadCaption, tooltip: config.macros.upload.label.promptOption,
onClick: config.macros.upload.action},
{caption: this.cancelButton, tooltip: this.cancelButtonPrompt, onClick: this.onCancel}
]);
},
options: [
"txtUploadUserName",
"pasUploadPassword",
"txtUploadStoreUrl",
"txtUploadDir",
"txtUploadFilename",
"txtUploadBackupDir",
"chkUploadLog",
"txtUploadLogMaxLine"
],
refreshOptions: function(listWrapper) {
var opts = [];
for(i=0; i<this.options.length; i++) {
var opt = {};
opts.push();
opt.option = "";
n = this.options[i];
opt.name = n;
opt.lowlight = !config.optionsDesc[n];
opt.description = opt.lowlight ? this.unknownDescription : config.optionsDesc[n];
opts.push(opt);
}
var listview = ListView.create(listWrapper,opts,this.listViewTemplate);
for(n=0; n<opts.length; n++) {
var type = opts[n].name.substr(0,3);
var h = config.macros.option.types[type];
if (h && h.create) {
h.create(opts[n].colElements['option'],type,opts[n].name,opts[n].name,"no");
}
}
},
onCancel: function(e)
{
backstage.switchTab(null);
return false;
},
wizardTitle: "Upload with options",
step1Title: "These options are saved in cookies in your browser",
step1Html: "<input type='hidden' name='markList'></input><br>",
cancelButton: "Cancel",
cancelButtonPrompt: "Cancel prompt",
listViewTemplate: {
columns: [
{name: 'Description', field: 'description', title: "Description", type: 'WikiText'},
{name: 'Option', field: 'option', title: "Option", type: 'String'},
{name: 'Name', field: 'name', title: "Name", type: 'String'}
],
rowClasses: [
{className: 'lowlight', field: 'lowlight'}
]}
};
//
// upload functions
//
if (!bidix.upload) bidix.upload = {};
if (!bidix.upload.messages) bidix.upload.messages = {
//from saving
invalidFileError: "The original file '%0' does not appear to be a valid TiddlyWiki",
backupSaved: "Backup saved",
backupFailed: "Failed to upload backup file",
rssSaved: "RSS feed uploaded",
rssFailed: "Failed to upload RSS feed file",
emptySaved: "Empty template uploaded",
emptyFailed: "Failed to upload empty template file",
mainSaved: "Main TiddlyWiki file uploaded",
mainFailed: "Failed to upload main TiddlyWiki file. Your changes have not been saved",
//specific upload
loadOriginalHttpPostError: "Can't get original file",
aboutToSaveOnHttpPost: 'About to upload on %0 ...',
storePhpNotFound: "The store script '%0' was not found."
};
bidix.upload.uploadChanges = function(onlyIfDirty,tiddlers,storeUrl,toFilename,uploadDir,backupDir,username,password)
{
var callback = function(status,uploadParams,original,url,xhr) {
if (!status) {
displayMessage(bidix.upload.messages.loadOriginalHttpPostError);
return;
}
if (bidix.debugMode)
alert(original.substr(0,500)+"\n...");
// Locate the storeArea div's
var posDiv = locateStoreArea(original);
if((posDiv[0] == -1) || (posDiv[1] == -1)) {
alert(config.messages.invalidFileError.format([localPath]));
return;
}
bidix.upload.uploadRss(uploadParams,original,posDiv);
};
if(onlyIfDirty && !store.isDirty())
return;
clearMessage();
// save on localdisk ?
if (document.location.toString().substr(0,4) == "file") {
var path = document.location.toString();
var localPath = getLocalPath(path);
saveChanges();
}
// get original
var uploadParams = new Array(storeUrl,toFilename,uploadDir,backupDir,username,password);
var originalPath = document.location.toString();
// If url is a directory : add index.html
if (originalPath.charAt(originalPath.length-1) == "/")
originalPath = originalPath + "index.html";
var dest = config.macros.upload.destFile(storeUrl,toFilename,uploadDir);
var log = new bidix.UploadLog();
log.startUpload(storeUrl, dest, uploadDir, backupDir);
displayMessage(bidix.upload.messages.aboutToSaveOnHttpPost.format([dest]));
if (bidix.debugMode)
alert("about to execute Http - GET on "+originalPath);
var r = doHttp("GET",originalPath,null,null,username,password,callback,uploadParams,null);
if (typeof r == "string")
displayMessage(r);
return r;
};
bidix.upload.uploadRss = function(uploadParams,original,posDiv)
{
var callback = function(status,params,responseText,url,xhr) {
if(status) {
var destfile = responseText.substring(responseText.indexOf("destfile:")+9,responseText.indexOf("\n", responseText.indexOf("destfile:")));
displayMessage(bidix.upload.messages.rssSaved,bidix.dirname(url)+'/'+destfile);
bidix.upload.uploadMain(params[0],params[1],params[2]);
} else {
displayMessage(bidix.upload.messages.rssFailed);
}
};
// do uploadRss
if(config.options.chkGenerateAnRssFeed) {
var rssPath = uploadParams[1].substr(0,uploadParams[1].lastIndexOf(".")) + ".xml";
var rssUploadParams = new Array(uploadParams[0],rssPath,uploadParams[2],'',uploadParams[4],uploadParams[5]);
var rssString = generateRss();
// no UnicodeToUTF8 conversion needed when location is "file" !!!
if (document.location.toString().substr(0,4) != "file")
rssString = convertUnicodeToUTF8(rssString);
bidix.upload.httpUpload(rssUploadParams,rssString,callback,Array(uploadParams,original,posDiv));
} else {
bidix.upload.uploadMain(uploadParams,original,posDiv);
}
};
bidix.upload.uploadMain = function(uploadParams,original,posDiv)
{
var callback = function(status,params,responseText,url,xhr) {
var log = new bidix.UploadLog();
if(status) {
// if backupDir specified
if ((params[3]) && (responseText.indexOf("backupfile:") > -1)) {
var backupfile = responseText.substring(responseText.indexOf("backupfile:")+11,responseText.indexOf("\n", responseText.indexOf("backupfile:")));
displayMessage(bidix.upload.messages.backupSaved,bidix.dirname(url)+'/'+backupfile);
}
var destfile = responseText.substring(responseText.indexOf("destfile:")+9,responseText.indexOf("\n", responseText.indexOf("destfile:")));
displayMessage(bidix.upload.messages.mainSaved,bidix.dirname(url)+'/'+destfile);
store.setDirty(false);
log.endUpload("ok");
} else {
alert(bidix.upload.messages.mainFailed);
displayMessage(bidix.upload.messages.mainFailed);
log.endUpload("failed");
}
};
// do uploadMain
var revised = bidix.upload.updateOriginal(original,posDiv);
bidix.upload.httpUpload(uploadParams,revised,callback,uploadParams);
};
bidix.upload.httpUpload = function(uploadParams,data,callback,params)
{
var localCallback = function(status,params,responseText,url,xhr) {
url = (url.indexOf("nocache=") < 0 ? url : url.substring(0,url.indexOf("nocache=")-1));
if (xhr.status == 404)
alert(bidix.upload.messages.storePhpNotFound.format([url]));
if ((bidix.debugMode) || (responseText.indexOf("Debug mode") >= 0 )) {
alert(responseText);
if (responseText.indexOf("Debug mode") >= 0 )
responseText = responseText.substring(responseText.indexOf("\n\n")+2);
} else if (responseText.charAt(0) != '0')
alert(responseText);
if (responseText.charAt(0) != '0')
status = null;
callback(status,params,responseText,url,xhr);
};
// do httpUpload
var boundary = "---------------------------"+"AaB03x";
var uploadFormName = "UploadPlugin";
// compose headers data
var sheader = "";
sheader += "--" + boundary + "\r\nContent-disposition: form-data; name=\"";
sheader += uploadFormName +"\"\r\n\r\n";
sheader += "backupDir="+uploadParams[3] +
";user=" + uploadParams[4] +
";password=" + uploadParams[5] +
";uploaddir=" + uploadParams[2];
if (bidix.debugMode)
sheader += ";debug=1";
sheader += ";;\r\n";
sheader += "\r\n" + "--" + boundary + "\r\n";
sheader += "Content-disposition: form-data; name=\"userfile\"; filename=\""+uploadParams[1]+"\"\r\n";
sheader += "Content-Type: text/html;charset=UTF-8" + "\r\n";
sheader += "Content-Length: " + data.length + "\r\n\r\n";
// compose trailer data
var strailer = new String();
strailer = "\r\n--" + boundary + "--\r\n";
data = sheader + data + strailer;
if (bidix.debugMode) alert("about to execute Http - POST on "+uploadParams[0]+"\n with \n"+data.substr(0,500)+ " ... ");
var r = doHttp("POST",uploadParams[0],data,"multipart/form-data; ;charset=UTF-8; boundary="+boundary,uploadParams[4],uploadParams[5],localCallback,params,null);
if (typeof r == "string")
displayMessage(r);
return r;
};
// same as Saving's updateOriginal but without convertUnicodeToUTF8 calls
bidix.upload.updateOriginal = function(original, posDiv)
{
if (!posDiv)
posDiv = locateStoreArea(original);
if((posDiv[0] == -1) || (posDiv[1] == -1)) {
alert(config.messages.invalidFileError.format([localPath]));
return;
}
var revised = original.substr(0,posDiv[0] + startSaveArea.length) + "\n" +
store.allTiddlersAsHtml() + "\n" +
original.substr(posDiv[1]);
var newSiteTitle = getPageTitle().htmlEncode();
revised = revised.replaceChunk("<title"+">","</title"+">"," " + newSiteTitle + " ");
revised = updateMarkupBlock(revised,"PRE-HEAD","MarkupPreHead");
revised = updateMarkupBlock(revised,"POST-HEAD","MarkupPostHead");
revised = updateMarkupBlock(revised,"PRE-BODY","MarkupPreBody");
revised = updateMarkupBlock(revised,"POST-SCRIPT","MarkupPostBody");
return revised;
};
//
// UploadLog
//
// config.options.chkUploadLog :
// false : no logging
// true : logging
// config.options.txtUploadLogMaxLine :
// -1 : no limit
// 0 : no Log lines but UploadLog is still in place
// n : the last n lines are only kept
// NaN : no limit (-1)
bidix.UploadLog = function() {
if (!config.options.chkUploadLog)
return; // this.tiddler = null
this.tiddler = store.getTiddler("UploadLog");
if (!this.tiddler) {
this.tiddler = new Tiddler();
this.tiddler.title = "UploadLog";
this.tiddler.text = "| !date | !user | !location | !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |";
this.tiddler.created = new Date();
this.tiddler.modifier = config.options.txtUserName;
this.tiddler.modified = new Date();
store.addTiddler(this.tiddler);
}
return this;
};
bidix.UploadLog.prototype.addText = function(text) {
if (!this.tiddler)
return;
// retrieve maxLine when we need it
var maxLine = parseInt(config.options.txtUploadLogMaxLine,10);
if (isNaN(maxLine))
maxLine = -1;
// add text
if (maxLine != 0)
this.tiddler.text = this.tiddler.text + text;
// Trunck to maxLine
if (maxLine >= 0) {
var textArray = this.tiddler.text.split('\n');
if (textArray.length > maxLine + 1)
textArray.splice(1,textArray.length-1-maxLine);
this.tiddler.text = textArray.join('\n');
}
// update tiddler fields
this.tiddler.modifier = config.options.txtUserName;
this.tiddler.modified = new Date();
store.addTiddler(this.tiddler);
// refresh and notifiy for immediate update
story.refreshTiddler(this.tiddler.title);
store.notify(this.tiddler.title, true);
};
bidix.UploadLog.prototype.startUpload = function(storeUrl, toFilename, uploadDir, backupDir) {
if (!this.tiddler)
return;
var now = new Date();
var text = "\n| ";
var filename = bidix.basename(document.location.toString());
if (!filename) filename = '/';
text += now.formatString("0DD/0MM/YYYY 0hh:0mm:0ss") +" | ";
text += config.options.txtUserName + " | ";
text += "[["+filename+"|"+location + "]] |";
text += " [[" + bidix.basename(storeUrl) + "|" + storeUrl + "]] | ";
text += uploadDir + " | ";
text += "[[" + bidix.basename(toFilename) + " | " +toFilename + "]] | ";
text += backupDir + " |";
this.addText(text);
};
bidix.UploadLog.prototype.endUpload = function(status) {
if (!this.tiddler)
return;
this.addText(" "+status+" |");
};
//
// Utilities
//
bidix.checkPlugin = function(plugin, major, minor, revision) {
var ext = version.extensions[plugin];
if (!
(ext &&
((ext.major > major) ||
((ext.major == major) && (ext.minor > minor)) ||
((ext.major == major) && (ext.minor == minor) && (ext.revision >= revision))))) {
// write error in PluginManager
if (pluginInfo)
pluginInfo.log.push("Requires " + plugin + " " + major + "." + minor + "." + revision);
eval(plugin); // generate an error : "Error: ReferenceError: xxxx is not defined"
}
};
bidix.dirname = function(filePath) {
if (!filePath)
return;
var lastpos;
if ((lastpos = filePath.lastIndexOf("/")) != -1) {
return filePath.substring(0, lastpos);
} else {
return filePath.substring(0, filePath.lastIndexOf("\\"));
}
};
bidix.basename = function(filePath) {
if (!filePath)
return;
var lastpos;
if ((lastpos = filePath.lastIndexOf("#")) != -1)
filePath = filePath.substring(0, lastpos);
if ((lastpos = filePath.lastIndexOf("/")) != -1) {
return filePath.substring(lastpos + 1);
} else
return filePath.substring(filePath.lastIndexOf("\\")+1);
};
bidix.initOption = function(name,value) {
if (!config.options[name])
config.options[name] = value;
};
//
// Initializations
//
// require PasswordOptionPlugin 1.0.1 or better
bidix.checkPlugin("PasswordOptionPlugin", 1, 0, 1);
// styleSheet
setStylesheet('.txtUploadStoreUrl, .txtUploadBackupDir, .txtUploadDir {width: 22em;}',"uploadPluginStyles");
//optionsDesc
merge(config.optionsDesc,{
txtUploadStoreUrl: "Url of the UploadService script (default: store.php)",
txtUploadFilename: "Filename of the uploaded file (default: in index.html)",
txtUploadDir: "Relative Directory where to store the file (default: . (downloadService directory))",
txtUploadBackupDir: "Relative Directory where to backup the file. If empty no backup. (default: ''(empty))",
txtUploadUserName: "Upload Username",
pasUploadPassword: "Upload Password",
chkUploadLog: "do Logging in UploadLog (default: true)",
txtUploadLogMaxLine: "Maximum of lines in UploadLog (default: 10)"
});
// Options Initializations
bidix.initOption('txtUploadStoreUrl','');
bidix.initOption('txtUploadFilename','');
bidix.initOption('txtUploadDir','');
bidix.initOption('txtUploadBackupDir','');
bidix.initOption('txtUploadUserName','');
bidix.initOption('pasUploadPassword','');
bidix.initOption('chkUploadLog',true);
bidix.initOption('txtUploadLogMaxLine','10');
// Backstage
merge(config.tasks,{
uploadOptions: {text: "upload", tooltip: "Change UploadOptions and Upload", content: '<<uploadOptions>>'}
});
config.backstageTasks.push("uploadOptions");
//}}}
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date'></span>)</div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
{{{
vunit checker (dut) {
property A1 = never (cnt[5] & lfsr[6]) @(posedge clk);
assert A1;
}
}}}
{{{
module checker( input clk,a,b);
property my_prop(a,b);
@clk a==b;
endproperty
a_my_prop: assert property(my_prop(a,b)) else $display( "Aoutch!");
//a_my_prop: assert property(my_prop(a,b)) else $fatal;
endmodule
module my_binder();
bind dut checker i_checker1 (clk,cnt[5],lfsr[6]);
bind dut checker i_checker2 (clk,cnt[3],lfsr[1]);
endmodule
}}}
{{{
module dut();
reg [7:0] cnt;
reg [7:0] lfsr;
reg clk;
reg rst;
integer i;
initial
begin
rst <= 1;
clk <= 0;
#100
rst <= 0;
forever
#100 clk <= ~clk;
end
always @(posedge clk or posedge rst)
cnt <= rst ? 1 : cnt + 1;
always @(posedge clk or posedge rst)
lfsr <= rst ? 1 : {lfsr[6:0],1'b0}^({8{lfsr[7]}}|8'b10100011);
initial
begin
for (i=1;i<50;i=i+1) @(posedge clk) $display ("%x %x",cnt,lfsr);
$finish;
end
endmodule
}}}
{{{
module dut();
reg [7:0] cnt;
reg [7:0] lfsr;
reg clk;
reg rst;
integer i;
initial
begin
rst <= 1;
clk <= 0;
#100
rst <= 0;
forever
#100 clk <= ~clk;
end
always @(posedge clk or posedge rst)
cnt <= rst ? 1 : cnt + 1;
always @(posedge clk or posedge rst)
lfsr <= rst ? 1 : {lfsr[6:0],1'b0}^({8{lfsr[7]}}|8'b10100011);
initial
begin
for (i=1;i<50;i=i+1) @(posedge clk) $display ("%x %x",cnt,lfsr);
$finish;
end
// psl cond1: assert always(cnt[5] && lfsr[3]) @ (negedge clk);
// psl default clock = (posedge clk);
// psl cond2: assert
// never(cnt[1] && lfsr[4]);
// psl bad__seq: assert always (cnt==12 -> next cnt==14);
// psl good_seq: assert always (cnt==12 -> cnt==14);
endmodule
}}}
!! Culture
Verilog is an ''H''ardware ''D''escription ''L''anguage originally transferred into the public domain by cadence in 1995. The language has since been standardized and extented twice...
| verilog-95|IEEE Standard 1364-1995 |
| verilog-2k|IEEE Standard 1364-2001 |
| systemVerilog|IEEE Standard 1364-2005 |
!! blocking vs non-blocking
* blocking assignments ( ''='' ) are fully executed before the following statement.
* Non-blocking assignments ( ''<='' ) in the same begin-end structure are scheduled to be executed all simultaneously before next simulation step.
{{{
reg a,b;
initial
begin
a=0; // a assigned to 0
b=0; // b assigned to 0
$display(a,b); // 00
a=1; // a assigned to 1
b=a; // b assigned to 1
$display(a,b); // 11
a<=0; // a scheduled
b<=a; // a sampled at 1, b scheduled
$display(a,b); // 11
#1 // forcing out of simulation step
$display(a,b); // 01
end
}}}
//00
11
11
01//
!! reg vs wire
* Simulator point of view:
** Once a //reg// has been assigned, the value is stored until it gets reassigned.
** Once a //wire// is no more driven, the value changes to high-impedence.
* Designer point of view:
** Declare as //reg// :
***outputs of //initial// statements
***outputs of //always// statements
***primary //output// ports
** Declare as //wire// :
***outputs of //assign// statement
***primary //input// ports
***primary //inout// ports
!!Lazy if-then-else
{{{
assign my_out = ( result_ready ) ? my_result : 0 ;
}}}
!!Lazy case
{{{
assign result = ( state == 0 ) ? 8'h00 :
( state == 1 ) ? 8'hFF :
( state == 2 ) ? buffer:
8'hFF ;
}}}
!!Nested
{{{
@(posedge clock);
if (reset)
begin
a = 0;
b = 0;
end
else
if (data_ready)
begin
a = data_a;
b = data_b;
end
}}}
!!Case
{{{
module test();
reg [3:0] result;
reg [3:0] a,b;
always @ (a or b )
case ({a,b})
8'hF0 : result <= 4'hA;
8'h0F : result <= 4'hB;
8'hFF : result <= 4'hC;
8'h00 : result <= 4'hD;
default : result <= 4'hE;
endcase
initial
begin
a = 4'h0;
b = 4'hF;
#1 $display( "%h,%h=>%h",a,b,result);
end
endmodule
}}}
//0,f=>b//
!!Range
{{{
module test();
integer i;
initial
begin
for (i=0;i<3;i=i+1)
begin
$display(i,i*2);
end
end
endmodule
}}}
//0 0
1 2
2 4//
!!List
{{{
module test();
reg [8*5-1:0] mylist;
reg [ 7:0] mybyte;
integer index;
initial
begin
index = 0;
mylist = { 8'hXX, 8'hD4, 8'hC3, 8'hB2, 8'hA1 }; // last to first
while ((mylist >>(8*index)) !== 8'hXX)
begin
mybyte = mylist >> (8*index);
index = index + 1;
$display( "%h",mybyte );
end
end
endmodule
}}}
//a1
b2
c3
d4//
* A Function is synthetizable and is limited to combinatorial logic.
* ''Warning!'' Nested functions can be simulated, but dc-shell usually complains at synthesys.
{{{
module test();
function [15:0] myfunc;
input [ 7:0] x1;
input [ 7:0] x2;
reg [ 7:0] r1,r2;
begin
r1 = x1^8'h55;
r2 = x2^8'hAA;
myfunc = { r1,r2 };
end
endfunction
reg [15:0] result;
reg [ 7:0] a,b;
initial
begin
a = 8'h12;
b = 8'h34;
result = myfunc(a,b);
$display( "myfunc(%h,%h)=%h",a,b,result);
end
endmodule
}}}
//myfunc(12,34)=479e//
{{{
task write;
input [6:0] addr;
input [7:0] data;
begin
@(posedge clock);
reg_dat = data;
reg_adr = addr;
reg_w = 1'b1;
@(posedge clock);
reg_adr = 6'b0;
reg_w = 1'b0;
end
endtask
initial
begin
#100 write(7'h3B, 8'h5A);
#100 write(7'h2F, 8'h01);
end
}}}
!!psl
> ncverilog [[dut.v|Vlog dut.v]] +assert +propfile+[[checker.psl|Vlog checker.psl]]
>ncverilog [[dut_and_psl.v|Vlog dut_and_psl.v]]+assert
!!sva
>ncverilog [[dut.v|Vlog dut.v]] [[checker.sva|Vlog checker.sva]] +sv31a
!! GF(2^^n^^)
* GF: Gallois' Field
* Operators: ''+'' is bit-wise xor, ''x'' is bit-wise and
!!LFSR
* LFSR: Linear Feedback Shift Register
* Math: ''d ← d x 2 % [polynomial]''
* Behavior: if polynomial is prime, d takes all possible values in a speudo-random sequence.
{{{
reg [7:0] lfsr;
always @(posedge clk or posedge rst)
lfsr <= rst?1:{lfsr[6:0],1'b0}^({8{lfsr[7]}}|8'b10100011);
}}}
!!CRC
* CRC: Cyclic Redundancy Check
* Math: ''crc ← ( crc + newdata ) x bigvalue % [polynomial]''
* Behavior : interation over a faulty memory is very unlikely to give expected result, whatever the fault patterns.
{{{
// crc <- ( crc+dat )* X17 %( X16+X12+X5+1 )
assign sum = crc_prv ^ dat;
assign crc = {
^( sum & 16'b0000110010001000 ),
^( sum & 16'b0000011001000100 ),
^( sum & 16'b0000001100100010 ),
^( sum & 16'b1000000110010001 ),
^( sum & 16'b1100110001000000 ),
^( sum & 16'b0110011000100000 ),
^( sum & 16'b1011001100010000 ),
^( sum & 16'b1101100110001000 ),
^( sum & 16'b1110110011000100 ),
^( sum & 16'b0111011001100010 ),
^( sum & 16'b0011101100110001 ),
^( sum & 16'b1001000100010000 ),
^( sum & 16'b1100100010001000 ),
^( sum & 16'b0110010001000100 ),
^( sum & 16'b0011001000100010 ),
^( sum & 16'b0001100100010001 ) };
}}}
!!Port declaration
{{{
module myModule #(parameter p1,p2) (
input control1,control2,
input [3:0] datain1,datain2,
output [3:0] dataout;
)
..
endmodule
}}}
!!Text substitution
*Substitute with Arguments
{{{
`define my_macro(x,y) x*y+10
v1=`my_macro(34,12)
v2=`my_macro(2,4)
}}}
*Extra directives:
**{{{`elsif, `ifndef}}}
!!File includes
{{{
`include "relative/path/to/filename" // searched in path
`include "/absolute/path/to/filename"
}}}
!!Parameters
*explicite mapping
{{{
module_name #(.par1(val),...) inst_name (.port1(net)1,..);
}}}
!!Text substitution
* Special Characters: {{{`", `\` , ``}}}
{{{
`define msg `"Quotes before, `\` backslash , Quotes at the end `"
$display(`msg);
}}}
!!File includes
* Double quoted filename is v2k backward compliant
* Extra possibilities:
{{{
`include <relative/path/to/filename> // searched in path
`define home(filename) `"/home/user/toto/filename`"
`include `home(filename)
}}}
!!Parameters
* ''defparam'' is discouraged! :(
* rtl.v
{{{
module latch(ena, din, dout);
input ena;
input din;
output dout;
reg dout;
always @(ena or din)
if (ena) dout <= din;
endmodule
module not_a_latch (ena, din, dout);
input ena;
input din;
output dout;
reg dout;
always @(ena or din)
if (ena) dout <= din;
else dout <= 1'b0;
endmodule
module flop (clk, rst_n, din, dout);
input clk;
input din;
input rst_n;
output dout;
reg dout;
always @(posedge clk or negedge rst_n)
if (!rst_n) dout <= 1'b0;
else dout <= din;
endmodule
module dut(clk, din, rst_n, dout1, dout2, dout3);
input clk;
input din;
input rst_n;
output dout1;
output dout2;
output dout3;
flop i_flop (.clk(clk),.din(din),.dout(dout1),.rst_n(rst_n));
latch i_latch (.ena(clk),.din(din),.dout(dout2));
not_a_latch i_not_a_latch (.ena(clk),.din(din),.dout(dout3));
endmodule
module test();
reg clk;
reg din;
reg rst_n;
wire dout1;
wire dout2;
wire dout3;
initial begin
clk=0;
#10;
forever #(10/2) clk= ~clk;
end
initial begin
rst_n=0;
din=0;
#10;
forever #(3) din = ~din;
end
initial #1000 $finish;
dut my_dut (.clk(clk),.rst_n(rst_n),.din(din),
.dout1(dout1),.dout2(dout2),.dout3(dout3));
initial
begin
$shm_open("wave.shm");
$shm_probe(test,"ACMTF");
end
endmodule
}}}
* synth.tcl
{{{
#!/bin/csh -fe
#restart \
exec dc_shell-xg-t -f $0
set target_library $env(CDE_HOME)/mirror/stdcell/at58800/SCLIB_3.2.0_D+/db/at58800/SClib-typ+ind.db
set link_library "* $target_library"
read_verilog rtl.v
current_design dut
link
check_design
compile
write -format verilog -hier -out netlist.v
quit
}}}
* netlist.v
{{{
module not_a_latch ( ena, din, dout );
input ena, din;
output dout;
an02d0 U2 ( .a1(ena), .a2(din), .z(dout) );
endmodule
module latch ( ena, din, dout );
input ena, din;
output dout;
lanhq1 dout_reg ( .e(ena), .d(din), .q(dout) );
endmodule
module flop ( clk, rst_n, din, dout );
input clk, rst_n, din;
output dout;
dfcrq1 dout_reg ( .d(din), .cp(clk), .cdn(rst_n), .q(dout) );
endmodule
module dut ( clk, din, rst_n, dout1, dout2, dout3 );
input clk, din, rst_n;
output dout1, dout2, dout3;
flop i_flop ( .clk(clk), .rst_n(rst_n), .din(din), .dout(dout1) );
latch i_latch ( .ena(clk), .din(din), .dout(dout2) );
not_a_latch i_not_a_latch ( .ena(clk), .din(din), .dout(dout3) );
endmodule
}}}
!Write
{{{
integer channel;
initial
begin
channel = $fopen("myfile.txt");
$fwrite(channel,"Hello World!");
$fclose(channel);
end
}}}
!Multiple channels
{{{
integer fd1,fd2;
initial
begin
fd1 = $fopen("myfile1.txt");
fd2 = $fopen("myfile2.txt");
$fwrite( fd1|fd2,"Hello World!"); // writes in both files
$fwrite(1|fd1|fd2,"Hello World!"); // writes in stdout as well
$fclose(fd1);
$fclose(fd2);
end
}}}
!! Gotcha
* {{{ $fopen("myfile.txt") }}} returns a MCD ( Multiple File Descriptor )
* {{{ $fopen("myfile.txt","w")}}} returns a FD ( File Descriptor )
* ~MCDs can be ored together and with 0,1,2 ( stdin,stdour,stderr) but not ~FDs
* test.v
{{{
module test();
initial $display("Hello World");
endmodule
}}}
* run.me ala icarus
{{{
#!/bin/bash -x
iverilog test.v
vvp a.out
}}}
{{{
module test();
integer x;
initial begin
$dumpfile("wave.vcd");
$dumpvars(1,x);
x=1; x=2;
#10 x=3; x=4;
#10 x=3; x=4;
#10 x=5; x=6;
#10 x=7;
#0 x=8;
#10 x=9;
$finish();
end
endmodule
}}}
resulting `waves.vcd`
{{{
#0 2
#10 4
#20 4
#30 6
#40 8
#50 9
}}}
* A change to the same value is reported.
* Only last change on the delta-time axis is reported.
* Change on the finish line is reported.
!win7 Settup
!! Basics: cd,ls,grep,git...
* install chocolatey
* {{{$ choco install cmder}}}
* cmder -> Settings -> Startup -> Environement # Aliases/path/proxy
* {{{$ choco install atom}}}
* {{{$ atm install asciidoc-assistant}}}
!! python
* {{{$ choco install miniconda3}}}
!! ruby
* {{{$ choco install ruby}}}
* {{{$ more ~/.gemrc }}}
> {{{:ssl_verify_mode: 0}}}
* {{{$ gem install asciidoctor}}}
Using {{{js}}} instead fo {{{json}}} makes the web-site functional even if not served, and import to python "almost" native.
{{{db.js}}}
{{{
var db={ "Alice" : [ 12 , "female" ] , "Bob" : [ 47, "male"] }
}}}
{{{ engine.py }}}
{{{
import StringIO
vfile = StringIO.StringIO()
vfile.write(file("docs.js").read().split("=")[-1])
vfile.seek(0)
#db = json.load(file("db.json"))
db = json.load(vfile)
}}}
{{{ doc.html}}}
{{{
<script src="docs.js"></script>
<script>
console.log(db["Alice"])
</script>
}}}
!!Culture
* ''1969'': GML (Generalized Markup Language ) created by Charles Goldfarb at IBM to wrap older scripts.
* ''1986'': SGML is an ISO Standardization of GML.
* ''1998'': XML ( eXtensible Markup Language ) is a simplification of SGML for the Web promotted by ~W3C.
* XML derivatives:
**SVG for drawings
**Docbook for documents
**XSLT for xml transformations
**XSD for data rules check: types, values ...
!!Rules
*There are 3 rules for the structure:
** There must be a prologue ( giving the version, optionally the character set if not ASCII )
** There must be a single root node that contains all the others
** All opened Nodes must be closed
*The data can be stored as:
** node contents
** attributes
*~HTML-like Comments:
** {{{ <!-- This is a comment --> }}}
* Syntax trick:
** {{{<tag></tag>}}} can be reduced to {{{<tag/>}}}
{{{
<?xml version="1.0" ?>
<main>
<element my_attribute1="red" my_attribute2="blue">
<sub_element>
my contents
</sub_element>
<element_closed_right_away my_attribute3="A" />
my main contents
</element>
</main>
}}}
!! Options
*Processing directives can be added after prologue
{{{
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
...
</html>
</xsl:template>
</xsl:stylesheet>
}}}
!!Tools
*Firefox reads directly XML. If the file is not valid, the first bad line encountered is displayed.
*Firefox applies xslt on the fly if specified in the processing directive line.
*~XMLStarlet Toolkit
{{{
xml val file.xml
}}}
// file.xml - valid//
{{{
xml tr file.xsl file.xml # ! Fails on some xslt statements :(
}}}
*Preferred to xmlStarlet for xslt transforms:
{{{
xsltproc file.xsl file.xml
}}}
{{{
<?xml version="1.0"?>
<svg height="500" width="500" >
<g style="fill-opacity:1.0; stroke:black; stroke-width:1;">
<rect x="115" y="385" height="-90"
width="90" style="fill:#FF0000;"/>
<line x1="205" y1="295" x2="205" y2="205"/>
<line x1="205" y1="295" x2="295" y2="295"/>
<circle cx="205" cy="295" r="27" style="fill:#00FF00;"/>
<circle cx="205" cy="205" r="27" style="fill:#0000FF;"/>
<text x="70" y="430" font-size="24"> Text </text>
</g>
</svg>
}}}
!!Principle:
{{{data.xml}}} & {{{data_to_html.xslt}}} → {{{data.html }}}
!!How to 1:
{{{
xsltproc $xmlFile fileName.xsl > $xmlFile:t.html
}}}
!!How to 2:
#Create {{{data.xml}}} and {{{data_to_html.xslt}}} in the same folder
#Read {{{data.xml}}} through Firefox
!!Files:
{{{data.xml}}}:
{{{
<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="data_to_html.xsl"?>
<data>
<cat id="hardware">
<item id="printer">
<info> inkjet 345 </info>
<color id="red"/>
<ref id="REF0001" />
</item>
<item id="screen">
<info> 22" </info>
<color id="black"/>
<ref id="REF0002" />
</item>
</cat>
<cat id="software">
<item id="calculator">
<info> scientific </info>
<rev id="1.2"/>
<ref id="REF0003" />
</item>
<item id="game">
<info> tetris </info>
<rev id="3.4"/>
<ref id="REF0004" />
</item>
</cat>
</data>
}}}
{{{data_to_html.xslt}}}:
{{{
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<h3>my data:</h3>
<ul>
<xsl:for-each select="data/cat/item">
<li>
<b> <xsl:value-of select="../attribute::id"/></b>
<xsl:text> : </xsl:text> <xsl:value-of select="./attribute::id"/>
<xsl:text> ( </xsl:text> <xsl:value-of select="./info"/> <xsl:text> ) </xsl:text>
</li>
</xsl:for-each>
</ul>
</html>
</xsl:template>
</xsl:stylesheet>
}}}
{{{data.html}}}:
<html>
<h3>my data:</h3>
<ul>
<li>
<b>hardware</b> : printer ( inkjet 345 ) </li>
<li>
<b>hardware</b> : screen ( 22" ) </li>
<li>
<b>software</b> : calculator ( scientific ) </li>
<li>
<b>software</b> : game ( tetris ) </li>
</ul>
</html>
! watermarking via svg to pdf
{{{
#/bin/bash
echo '<?xml version="1.0"?>
<svg height="1000" width="700" >
<g style="fill-opacity:1.0; stroke:black; stroke-width:1;">
<text x="0" y="0" font-size="'$fontsize'"
style="fill:#ffcccc;stroke:none;text-anchor:middle;text-align:center"
transform="translate(350 500) rotate(-54)"
> Confidential </text>
</g>
</svg> ' > watermark.svg
inkscape watermark.svg --export-pdf watermark.pdf
pdftk in.pdf background watermark.pdf output out.pdf
}}}
! watermarking via fo to pdf
{{{
#/bin/bash
echo '<?xml version="1.0" encoding="ISO-8859-1"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master
page-width="21cm"
page-height="29.7cm"
margin-right="1.5cm"
margin-left="1.5cm"
margin-bottom="1.5cm"
margin-top="1.5cm"
master-name="first">
<fo:region-body margin-top="1cm"/>
<fo:region-before extent="1cm"/>
<fo:region-after extent="1.5cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="first">
<fo:flow flow-name="xsl-region-body">
<fo:block>
<fo:instream-foreign-object>
<svg:svg xmlns:svg="http://www.w3.org/2000/svg" width="17cm" height="24cm">
<svg:g style="fill-opacity:1.0; stroke:black; stroke-width:1;">
<svg:text x="0" y="0" font-size="12"
style="fill:#ffcccc;stroke:none;text-anchor:middle;text-align:center"
transform="translate(210 340) rotate(-54) scale(4)"
>
<svg:tspan x="0" dy="1em">Confidential</svg:tspan>
<svg:tspan x="0" dy="1em">Delivered to John Mc Lane</svg:tspan>
</svg:text>
</svg:g>
</svg:svg>
</fo:instream-foreign-object>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root> ' > watermark.fo
fop -fo watermark.fo -pdf watermark.pdf
pdftk in.pdf background watermark.pdf output out.pdf
}}}
With element tree
{{{
#!/usr/bin/env python
from lxml import etree
schema_root = etree.parse("file.xsd")
schema = etree.XMLSchema(schema_root)
parser = etree.XMLParser(schema = schema)
root = etree.parse("file.xml", parser)
}}}
Ingredients:
* 400g+100g de farine
* 1 cac de levure chimique
* 1 gousse de vanille ou cannelle
* 200ml d'huile d'olive
* 150g de sucre
* 200ml de muscat ou vin blanc
* cassonade
1. Melanger huile + muscat + suce
2. Ajouter Vanille/Cannelle + 400g de farine + levure
3. Ajouter 100g de farine pour obtenir une pate lisse
4. Former les boudins de 10cm entre les mains, puis en les roulant dans la cassonade
5. 180C pendant 20min
! Intro
* {{{ant}}} is an opensource {{{make}}} alternative
* xml driven ( Makefile = build.xml )
* Very good integration with java and junit
! Sample {{{build.xml}}}
{{{
<project name="HelloWorld" basedir="." default="main">
<property name="src.dir" value="src"/>
<property name="build.dir" value="build"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="main-class" value="oata.HelloWorld"/>
<path id="project.classpath">
<pathelement location="${classes.dir}"/> <!--classpath def-->
</path>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<target name="compile">
<mkdir dir="${classes.dir}"/>
<javac srcdir="${src.dir}" destdir="${classes.dir}"/>
</target>
<target name="run" depends="compile">
<java classname="${main-class}" fork="true">
<classpath refid="project.classpath"/> <!--classpath ref-->
</java>
</target>
<target name="clean-build" depends="clean,compile"/>
<target name="main" depends="clean,run"/>
</project>
}}}
!Usage
{{{
ant compile
ant run
}}}
or
{{{
ant clean compile
}}}
or
{{{
ant # because runs the default target
}}}
{{{
from argparse import ArgumentParser
ap = ArgumentParser()
ap.add_argument('name','nargs'='?')
ap.add_argument('-v','--verbose',default=False,action='store_true', help='Increase verbosity')
ap.add_argument('-n','--number',default=1,type=int,help='quantity')
args = ap.parse_args()
name = (args.name or "You")
}}}
Pour une plaque ( 30-40 unités ) :
* 150g de farine
* 75g de sucre roux
* 75g de beurre
* 1 œuf
* 1 pincée de sel
* épices
Faire la pâte sablée: mélanger et égrainer farine+beurre (pas trop dur, pas trop mou)+sucre
Épicer: cannelle + gingembre en poudre.
Lier avec l’œuf et former une boule `a laisser durcir au frigo 30 minutes.
Étaler et détailler la boule sur une plaque a` pâtisserie et papier sulfurisé.
Cuisson: 10minutes @ 200C
!Output file
{{{
// writing on a text file
#include <iostream>
#include <fstream>
using namespace std;
int main () {
ofstream myfile ("example.txt");
if (myfile.is_open())
{
myfile << "This is a line.\n";
myfile << "This is another line.\n";
myfile.close();
}
else cout << "Unable to open file";
return 0;
}
}}}
!Input file
{{{
// reading a text file
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main () {
string line;
ifstream myfile ("example.txt");
if (myfile.is_open())
{
while ( myfile.good() )
{
getline (myfile,line);
cout << line << endl;
}
myfile.close();
}
else cout << "Unable to open file";
return 0;
}
}}}
1kg de Haricots blancs secs:
* 24h de trempage
* 40mn de pré-cuisson a l'auto-cuiseur
* 1h a 200C dans le plat avec les autre ingredients:
** tomate
** oignons
** ail
** clous
** viande: saucisse de canard, jarret de porc
** sel
** poivre
Sending 40 lines to the clipboard ( i.e. buffer named * )
{{{
"*40yy
}}}
{{{
cp = require "child_process"
stdout = cp.execFileSync "executable" ,[arg1,arg2,arg3]
console.log stdout
}}}
{{{
fs = require "fs"
lines = fs.readFileSync("myinput.txt").toString()
for line in lines.split(/\r?\n/)
console.log line
}}}
The 216 cross-platform web-safe color palette was created to ensure that all computers would display the colors correctly when running a 256 color palette:
<html>
<table border="1" width="80%">
<tbody><tr>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#000000">000000</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#000033">000033</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#000066">000066</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#000099">000099</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#0000cc">0000CC</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#0000ff">0000FF</td>
</tr>
<tr>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#003300">003300</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#003333">003333</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#003366">003366</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#003399">003399</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#0033cc">0033CC</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#0033ff">0033FF</td>
</tr>
<tr>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#006600">006600</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#006633">006633</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#006666">006666</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#006699">006699</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#0066cc">0066CC</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#0066ff">0066FF</td>
</tr>
<tr>
<td align="center" bgcolor="#009900">009900</td>
<td align="center" bgcolor="#009933">009933</td>
<td align="center" bgcolor="#009966">009966</td>
<td align="center" bgcolor="#009999">009999</td>
<td align="center" bgcolor="#0099cc">0099CC</td>
<td align="center" bgcolor="#0099ff">0099FF</td>
</tr>
<tr>
<td align="center" bgcolor="#00cc00">00CC00</td>
<td align="center" bgcolor="#00cc33">00CC33</td>
<td align="center" bgcolor="#00cc66">00CC66</td>
<td align="center" bgcolor="#00cc99">00CC99</td>
<td align="center" bgcolor="#00cccc">00CCCC</td>
<td align="center" bgcolor="#00ccff">00CCFF</td>
</tr>
<tr>
<td align="center" bgcolor="#00ff00">00FF00</td>
<td align="center" bgcolor="#00ff33">00FF33</td>
<td align="center" bgcolor="#00ff66">00FF66</td>
<td align="center" bgcolor="#00ff99">00FF99</td>
<td align="center" bgcolor="#00ffcc">00FFCC</td>
<td align="center" bgcolor="#00ffff">00FFFF</td>
</tr>
<tr>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#330000">330000</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#330033">330033</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#330066">330066</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#330099">330099</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#3300cc">3300CC</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#3300ff">3300FF</td>
</tr>
<tr>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#333300">333300</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#333333">333333</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#333366">333366</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#333399">333399</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#3333cc">3333CC</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#3333ff">3333FF</td>
</tr>
<tr>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#336600">336600</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#336633">336633</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#336666">336666</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#336699">336699</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#3366cc">3366CC</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#3366ff">3366FF</td>
</tr>
<tr>
<td align="center" bgcolor="#339900">339900</td>
<td align="center" bgcolor="#339933">339933</td>
<td align="center" bgcolor="#339966">339966</td>
<td align="center" bgcolor="#339999">339999</td>
<td align="center" bgcolor="#3399cc">3399CC</td>
<td align="center" bgcolor="#3399ff">3399FF</td>
</tr>
<tr>
<td align="center" bgcolor="#33cc00">33CC00</td>
<td align="center" bgcolor="#33cc33">33CC33</td>
<td align="center" bgcolor="#33cc66">33CC66</td>
<td align="center" bgcolor="#33cc99">33CC99</td>
<td align="center" bgcolor="#33cccc">33CCCC</td>
<td align="center" bgcolor="#33ccff">33CCFF</td>
</tr>
<tr>
<td align="center" bgcolor="#33ff00">33FF00</td>
<td align="center" bgcolor="#33ff33">33FF33</td>
<td align="center" bgcolor="#33ff66">33FF66</td>
<td align="center" bgcolor="#33ff99">33FF99</td>
<td align="center" bgcolor="#33ffcc">33FFCC</td>
<td align="center" bgcolor="#33ffff">33FFFF</td>
</tr>
<tr>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#660000">660000</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#660033">660033</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#660066">660066</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#660099">660099</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#6600cc">6600CC</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#6600ff">6600FF</td>
</tr>
<tr>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#663300">663300</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#663333">663333</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#663366">663366</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#663399">663399</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#6633cc">6633CC</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#6633ff">6633FF</td>
</tr>
<tr>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#666600">666600</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#666633">666633</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#666666">666666</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#666699">666699</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#6666cc">6666CC</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#6666ff">6666FF</td>
</tr>
<tr>
<td align="center" bgcolor="#669900">669900</td>
<td align="center" bgcolor="#669933">669933</td>
<td align="center" bgcolor="#669966">669966</td>
<td align="center" bgcolor="#669999">669999</td>
<td align="center" bgcolor="#6699cc">6699CC</td>
<td align="center" bgcolor="#6699ff">6699FF</td>
</tr>
<tr>
<td align="center" bgcolor="#66cc00">66CC00</td>
<td align="center" bgcolor="#66cc33">66CC33</td>
<td align="center" bgcolor="#66cc66">66CC66</td>
<td align="center" bgcolor="#66cc99">66CC99</td>
<td align="center" bgcolor="#66cccc">66CCCC</td>
<td align="center" bgcolor="#66ccff">66CCFF</td>
</tr>
<tr>
<td align="center" bgcolor="#66ff00">66FF00</td>
<td align="center" bgcolor="#66ff33">66FF33</td>
<td align="center" bgcolor="#66ff66">66FF66</td>
<td align="center" bgcolor="#66ff99">66FF99</td>
<td align="center" bgcolor="#66ffcc">66FFCC</td>
<td align="center" bgcolor="#66ffff">66FFFF</td>
</tr>
<tr>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#990000">990000</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#990033">990033</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#990066">990066</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#990099">990099</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#9900cc">9900CC</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#9900ff">9900FF</td>
</tr>
<tr>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#993300">993300</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#993333">993333</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#993366">993366</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#993399">993399</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#9933cc">9933CC</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#9933ff">9933FF</td>
</tr>
<tr>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#996600">996600</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#996633">996633</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#996666">996666</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#996699">996699</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#9966cc">9966CC</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#9966ff">9966FF</td>
</tr>
<tr>
<td align="center" bgcolor="#999900">999900</td>
<td align="center" bgcolor="#999933">999933</td>
<td align="center" bgcolor="#999966">999966</td>
<td align="center" bgcolor="#999999">999999</td>
<td align="center" bgcolor="#9999cc">9999CC</td>
<td align="center" bgcolor="#9999ff">9999FF</td>
</tr>
<tr>
<td align="center" bgcolor="#99cc00">99CC00</td>
<td align="center" bgcolor="#99cc33">99CC33</td>
<td align="center" bgcolor="#99cc66">99CC66</td>
<td align="center" bgcolor="#99cc99">99CC99</td>
<td align="center" bgcolor="#99cccc">99CCCC</td>
<td align="center" bgcolor="#99ccff">99CCFF</td>
</tr>
<tr>
<td align="center" bgcolor="#99ff00">99FF00</td>
<td align="center" bgcolor="#99ff33">99FF33</td>
<td align="center" bgcolor="#99ff66">99FF66</td>
<td align="center" bgcolor="#99ff99">99FF99</td>
<td align="center" bgcolor="#99ffcc">99FFCC</td>
<td align="center" bgcolor="#99ffff">99FFFF</td>
</tr>
<tr>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#cc0000">CC0000</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#cc0033">CC0033</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#cc0066">CC0066</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#cc0099">CC0099</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#cc00cc">CC00CC</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#cc00ff">CC00FF</td>
</tr>
<tr>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#cc3300">CC3300</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#cc3333">CC3333</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#cc3366">CC3366</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#cc3399">CC3399</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#cc33cc">CC33CC</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#cc33ff">CC33FF</td>
</tr>
<tr>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#cc6600">CC6600</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#cc6633">CC6633</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#cc6666">CC6666</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#cc6699">CC6699</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#cc66cc">CC66CC</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#cc66ff">CC66FF</td>
</tr>
<tr>
<td align="center" bgcolor="#cc9900">CC9900</td>
<td align="center" bgcolor="#cc9933">CC9933</td>
<td align="center" bgcolor="#cc9966">CC9966</td>
<td align="center" bgcolor="#cc9999">CC9999</td>
<td align="center" bgcolor="#cc99cc">CC99CC</td>
<td align="center" bgcolor="#cc99ff">CC99FF</td>
</tr>
<tr>
<td align="center" bgcolor="#cccc00">CCCC00</td>
<td align="center" bgcolor="#cccc33">CCCC33</td>
<td align="center" bgcolor="#cccc66">CCCC66</td>
<td align="center" bgcolor="#cccc99">CCCC99</td>
<td align="center" bgcolor="#cccccc">CCCCCC</td>
<td align="center" bgcolor="#ccccff">CCCCFF</td>
</tr>
<tr>
<td align="center" bgcolor="#ccff00">CCFF00</td>
<td align="center" bgcolor="#ccff33">CCFF33</td>
<td align="center" bgcolor="#ccff66">CCFF66</td>
<td align="center" bgcolor="#ccff99">CCFF99</td>
<td align="center" bgcolor="#ccffcc">CCFFCC</td>
<td align="center" bgcolor="#ccffff">CCFFFF</td>
</tr>
<tr>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#ff0000">FF0000</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#ff0033">FF0033</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#ff0066">FF0066</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#ff0099">FF0099</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#ff00cc">FF00CC</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#ff00ff">FF00FF</td>
</tr>
<tr>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#ff3300">FF3300</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#ff3333">FF3333</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#ff3366">FF3366</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#ff3399">FF3399</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#ff33cc">FF33CC</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#ff33ff">FF33FF</td>
</tr>
<tr>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#ff6600">FF6600</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#ff6633">FF6633</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#ff6666">FF6666</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#ff6699">FF6699</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#ff66cc">FF66CC</td>
<td style="color: rgb(255, 255, 255);" align="center" bgcolor="#ff66ff">FF66FF</td>
</tr>
<tr>
<td align="center" bgcolor="#ff9900">FF9900</td>
<td align="center" bgcolor="#ff9933">FF9933</td>
<td align="center" bgcolor="#ff9966">FF9966</td>
<td align="center" bgcolor="#ff9999">FF9999</td>
<td align="center" bgcolor="#ff99cc">FF99CC</td>
<td align="center" bgcolor="#ff99ff">FF99FF</td>
</tr>
<tr>
<td align="center" bgcolor="#ffcc00">FFCC00</td>
<td align="center" bgcolor="#ffcc33">FFCC33</td>
<td align="center" bgcolor="#ffcc66">FFCC66</td>
<td align="center" bgcolor="#ffcc99">FFCC99</td>
<td align="center" bgcolor="#ffcccc">FFCCCC</td>
<td align="center" bgcolor="#ffccff">FFCCFF</td>
</tr>
<tr>
<td align="center" bgcolor="#ffff00">FFFF00</td>
<td align="center" bgcolor="#ffff33">FFFF33</td>
<td align="center" bgcolor="#ffff66">FFFF66</td>
<td align="center" bgcolor="#ffff99">FFFF99</td>
<td align="center" bgcolor="#ffffcc">FFFFCC</td>
<td align="center" bgcolor="#ffffff">FFFFFF</td>
</tr>
</tbody></table>
</html>
!Intro
!Basics
* Commands are not case sensitive
* Comments
{{{
REM this is a comment
rem this is also the comment
:: This is a label turned into a comment
}}}
* The @ trick
By default batch displays the command and then the result. The display of the command can be escaped with @.
{{{
echo off
cmd
echo on
}}}
is equivalent to
{{{
@cmd
}}}
! Variables
!!Set the variable
{{{
@echo off
set var=testing 1 2 3
echo The variable is "%var%"
}}}
// The variable is "testing 1 2 3" //
!!Unset the variable
{{{
set var=
echo The variable is "%var%"
}}}
// The variable is "" //
!!Numeric Computation
{{{
set /A var=45+78
echo The variable is %var%
}}}
// The variable is 123 //
!!Trim the content
{{{set myvar=ABCDEF.bat}}}
* Search and replace {{{echo %myvar:.bat=.py%}}} => {{{ABCDEF.py}}}
* Substring {{{%myvar:~2,-3%}}} => {{{CDEF.}}}
!! Argument parameters
%0 is the executed script
%1 %2 %3 .... are the arguments
! Modifiers
{{{
%~1 = c:\windows\notepad.exe
%~f1 = c:\WINDOWS\NOTEPAD.EXE
%~d1 = c:
%~p1 = \WINDOWS\
%~n1 = NOTEPAD
%~x1 = .EXE
%~s1 = c:\WINDOWS\NOTEPAD.EXE
%~a1 = --a------
%~t1 = 08/25/2005 01:50 AM
%~z1 = 17920
%~$PATHATH:1 =
%~dp1 = c:\WINDOWS\
%~nx1 = NOTEPAD.EXE
%~dp$PATH:1 = c:\WINDOWS\
%~ftza1 = --a------ 08/25/2005 01:50 AM 17920 c:\WINDOWS\NOTEPAD.EXE
}}}
! Path
{{{
set XTRAPATH=c:\iverilog\bin
echo ;%PATH%; | findstr /I ";%XTRAPATH%;" > NUL && goto skip
set path=%XTRAPATH%;%path%
:skip
}}}
! Environment variables
!! Read them all
{{{reg query HKCU\environment }}}
!! Read one
{{{reg query HKCU\environment /v newvar}}}
!! Set for future batch
{{{ setx newvar ABC }}}
or
{{{ reg add HKEY_CURRENT_USER\Environment /v newvar /d "ABC" /f }}}
!! Set after setx for current batch
{{{
for /f "skip=2 tokens=1,2,3" %A in ('reg query HKCU\environment /v newvar') Do set newvar=%C
}}}
! Syntax
{{{ FOR %variable IN (set) DO command [command-parameters] }}}
* {{{%variable}}} Specifies a single letter replaceable parameter.
* {{{(set)}}} Specifies a set of one or more files. Wildcards may be used.
* {{{command}}} Specifies the command to carry out for each file.
* {{{command-parameters}}} Specifies parameters or switches for the specified command.
! Examples
{{{ FOR /f %%a IN ('dir /b *.txt') DO call runner.bat %%a }}}
* {{{/f}}} flag to only return filenames
{{{ FOR /f %%a IN ('dir /b *.txt') DO call runner.bat %%~na %%~xa}}}
*{{{ %%~na}}} returns the base name
*{{{%%~xa}}} returns the extension
! install
{{{msiexec.exe /i myprog.msi /qb /l* msi.log}}}
!uninstall
{{{msiexec.exe /x myprog.msi /qb /l* msi.log}}}
!Unarchive into ./out
{{{7z.exe x myarch.7z -oout}}}
* myscript.bat
{{{
python -x "%~df0" %* &goto :eof
# vim: syntax=python
import sys
print "this is a batch file"
sys.exit()
}}}
export the base
{{{
regedit -e toto.reg
}}}
view the base with vim
{{{
vim toto.reg
:e! ++enc=utf-16le
}}}
The command {{{pwd}}} is executed and pasted into myVar
{{{
FOR /F "tokens=1 delims=" %%A in ('pwd') do SET myVar=%%A
}}}
{{{
javac -d bin -sourcepath src src\test\FooTest.java || @goto :error
java org.junit.runner.JUnitCore test.FooTest
@echo "Done"
@goto :EOF
:error
@echo "Sorry"
}}}
!basic operators
| ''batch'' | ''bash'' | ''comment'' |
|{{{%}}} |{{{$}}} |command-line parameter prefix|
|{{{/}}} |{{{-}}}|command option flag|
|{{{\}}} |{{{/}}}|directory path separator|
|{{{==}}} |{{{=}}}|(equal-to) string comparison test|
|{{{!==!}}} |{{{!= }}}|(not equal-to) string comparison test|
|{{{|}}} |{{{|}}}| pipe|
|{{{@}}}|{{{set +v}}}|do not echo current command|
|{{{*}}}|{{{*}}}|filename "wild card"|
|{{{>}}} |{{{>}}} |file redirection (overwrite)|
|{{{>>}}}|{{{>>}}} |file redirection (append)|
|{{{<}}}|{{{<}}}|redirect stdin|
|{{{%VAR%}}}|{{{$VAR}}}|environmental variable|
|{{{REM}}}|{{{#}}}|comment|
|{{{NOT}}}|{{{!}}}|negate following test|
|{{{NUL}}}|{{{/dev/null}}}|"black hole" for burying command output|
|{{{ECHO}}}|{{{echo}}}|echo (many more option in Bash)|
|{{{ECHO.}}}|{{{echo}}}|echo blank line|
|{{{ECHO OFF}}}|{{{set +v}}}|do not echo command(s) following|
|{{{FOR %%VAR IN (LIST) DO}}}|{{{for var in [list]; do }}}|"for" loop|
|{{{:LABEL}}}|{{{none (unnecessary)}}}|label|
|{{{GOTO}}}|{{{none (use a function)}}}| jump to another location in the script|
|{{{PAUSE}}}|{{{sleep}}}| pause or wait an interval|
|{{{CHOICE}}}|{{{case or select}}}|menu choice|
|{{{IF}}}|{{{if}}}| if-test|
|{{{IF EXIST FILENAME}}}|{{{if [ -e filename ]}}}| test if file exists|
|{{{IF !%N==!}}}|{{{if [ -z "$N" ]}}}| if replaceable parameter "N" not present|
|{{{CALL}}}|{{{source or .}}}| "include" another script|
|{{{COMMAND /C}}}|{{{source or . }}}| "include" another script (same as CALL)|
|{{{SET}}}|{{{export}}}|set an environmental variable|
|{{{SHIFT}}}|{{{shift}}}|left shift command-line argument list|
|{{{SGN}}}|{{{-lt or -gt}}}|sign (of integer)|
|{{{ERRORLEVEL}}}|{{{$?}}}|exit status|
|{{{CON}}}|{{{stdin}}}|console (stdin)|
|{{{PRN}}}|{{{/dev/lp0}}}|generic printer device|
|{{{LPT1}}}|{{{/dev/lp0}}}|first printer device|
|{{{COM1}}}|{{{/dev/ttyS0}}}|first serial port|
! commands
|''DOS Command'' |''UNIX Equivalent'' |''Effect'' |
|{{{ASSIGN }}}|{{{ln}}}|link file or directory|
|{{{ATTRIB }}}|{{{chmod}}}|change file permissions|
|{{{CD }}}|{{{cd}}}|change directory|
|{{{CHDIR }}}|{{{cd}}}|change directory|
|{{{CLS }}}|{{{clear}}}|clear screen|
|{{{COMP }}}|{{{diff, comm, cmp}}}|file compare|
|{{{COPY }}}|{{{cp}}}|file copy|
|{{{Ctl-C }}}|{{{Ctl-C}}}|break (signal)|
|{{{Ctl-Z }}}|{{{Ctl-D}}}|EOF (end-of-file)|
|{{{DEL }}}|{{{rm}}}|delete file(s)|
|{{{DELTREE }}}|{{{rm -rf}}}|delete directory recursively|
|{{{DIR }}}|{{{ls -l}}}|directory listing|
|{{{ERASE }}}|{{{rm}}}|delete file(s)|
|{{{EXIT }}}|{{{exit}}}|exit current process|
|{{{FC }}}|{{{comm, cmp}}}|file compare|
|{{{FIND }}}|{{{grep}}}|find strings in files|
|{{{MD }}}|{{{mkdir}}}|make directory|
|{{{MKDIR }}}|{{{mkdir}}}|make directory|
|{{{MORE }}}|{{{more}}}|text file paging filter|
|{{{MOVE }}}|{{{mv}}}|move|
|{{{PATH }}}|{{{$PATH}}}|path to executables|
|{{{REN }}}|{{{mv}}}|rename (move)|
|{{{RENAME }}}|{{{mv}}}|rename (move)|
|{{{RD }}}|{{{rmdir}}}| remove directory|
|{{{RMDIR }}}|{{{rmdir}}}|remove directory|
|{{{SORT }}}|{{{ sort}}}|sort file|
|{{{TIME }}}|{{{date}}}|display system time|
|{{{TYPE }}}|{{{cat}}}|output file to stdout|
|{{{XCOPY }}}|{{{cp}}}|(extended) file copy|
!Interesting post from deepchip
...
# Functional Verification
** Duopoly - Synopsys Vera and Cadence ~SpecMan "e"
# Formal Verification
** Alternatives - Jasper, Mentor 0-In, Synopsys Magellan,Cadence IFV, Real Intent
# RTL Simulation
**Triopoloy - Mentor ~ModelSim, Cadence ~NC-Sim, Synopsys VCS
# RTL Synthesis
**Monopoly - Synopsys Design Compiler
**Alternatives - Cadence RTL Compiler, Magma ~BlastRTL, ~OAsys
#Equivalence Checking
**Duopoly - Cadence Verplex and Synopsys Formality
#Test/ATPG/Scan/BIST
**Duopoly - Mentor ~FastScan/DFT Advisor and Synopsys ~TetraMax
#Floorplanning
**Semi-monopoly - Cadence First Encounter
** Alternatives: Magma Hydra, Synopsys Jupiter, Atoptech Apogee
#Place and Route
**Triopoloy - Synopsys ICC, Magma Talus, Cadence Encounter
**Alternatives - Atoptech, Mentor Sierra
#RC Extraction
**Duopoly - Synopsys ~Star-RCXT and Cadence ~ Fire&Ice
**Alternatives - Mentor ~Calibre-xRC, Magma ~QuartzRC, Sequence Columbus
#Static Timing
**Monopoly - Synopsys ~PrimeTime
**Alternatives - Cadence ETS, Extreme ~GoldTime, Incentia ~TimeCraft, ~CLK-DA Amber, Magma ~QuartzTime
#Signal Integrity
**Duopoly - Synopsys ~PT-SI and Cadence ~CeltIC
**Alternatives - Extreme ~GoldTime, Incentia ~TimeCraft, ~CLK-DA Amber
#IR Analysis
**Semi-monopoly - Apache Redhawk
**Alternatives - Cadence ~VoltageStorm
#DRC/LVS
**Monopoly - Mentor Calibre
**Alternatives - Synopsys Hercules, Magma Quartz
#SPICE
**Alternatives - Synopsys HSIM/HSPICE, Cadence Spectre, Magma, ~FineSim, Mentor, Nascentric, Berkeley
#Full Custom
**Monopoly - Cadence Virtuoso
**Alternatives - ~SpringSoft Laker, Magma Titan, Synopsys Orion
#FPGA
**Duopoly - Mentor Exemplar and Synopsys Synplicity
**Alternatives - tools from Xilinx and Altera
# Emulators/Acceletors
**Monopoly - Cadence Palladium
**Alternatives - Mentor Veloce, EVE, Dini, Synopsys HAPS
OK, so if I go "all Synopsys"... this typically means I'm still an Apache,
Mentor Calibre, and Cadence Verplex customer. Not to mention MENT or SNPS
for FPGA and Cadence for Palladium and Virtuoso.
If I go "all Cadence"... typically means I'm still use Synopsys ~PrimeTime
and DC, Mentor Calibre & ~FastScan. Not to mention MENT or SNPS for FPGA.
If I go "all Magma"... typically means I use SNPS, CDNS, MENT, and Apache,
for the tools LAVA doesn't have or for what it's not best-in-class in.
I'd be curious to hear if any large semi company is honestly using either
an all-Cadence or an all-Synopsys flow just for SOC implementation. They
might have an official all-you-can-eat deal, but just because they can eat
it, doesn't mean they won't choose something more tasty.
I'm guessing a 3-4 company "mix and match" flow is much more common than
not, given Calibre and Redhawk's marketshare.
- Jeff Echtenkamp
Broadcom Corporation Irvine, CA
* How to set backspace = go to previous page ?
** goto URL: about:config
** Set variable browser.backspace_action to 0
| python | coffee |
|{{{int("34")}}} |{{{Number("34")}}} |
|{{{str(72)}}} |{{{''+72}}} |
|{{{"AB CD".split()}}} |{{{"AB CD".replace(/\s+$/,'').split(/(\s+)/) }}} |
|{{{[1,2,3][0]}}} |{{{i.e.}}} |
|{{{[1,2,3][-1]}}} |{{{[1,2,3][-1..][0]}}} or {{{[...,last]=[1,2,3]}}} |
|{{{1 in [1,2,3]}}} |{{{i.e.}}} |
|{{{len([1,2,3])}}} |{{{[1,2,3].length}}} |
|{{{len({"A":7,"B":4})}}} |{{{Object.keys({"A":7,"B":4}).length}}} |
|{{{[1,2,3].append(4)}}} |{{{[1,2,3].push(4)}}} |
|{{{mylist.extend([4,5])}}} |{{{mylist=mylist.concat([4,5])}}} |
|{{{for line in stream:}}} |{{{for line in txt.split('\n')}}} |
|{{{def myfunc(x):}}} |{{{myfunc = (x) ->}}} |
|{{{myfunc()}}} |{{{myfunc()}}} /!\ can't spare the ''()'' |
|{{{myfunc(arg)}}} |{{{myfunc arg}}} |
|{{{myfunc(myfunc2((x))}}} |{{{myfunc myfunc2 x}}} |
|{{{re.match(r'a.c','abc')}}} |{{{/a.c/.exec('abc')}}} /!\ groups are offset |
|{{{for x in [1,2,3]:}}} |{{{for x in [1,2,3]}}} |
|{{{for k,v in {'a':1,'b':2}.items():}}} |{{{for k,v of {'a':1,'b':2} }}} /!\ ''of'' ...not ''in'' |
|{{{if 'key' in dict:}}} |{{{if mydict['key']}}} |
|{{{[x for x in mylist]}}} |{{{(x for x in mylist)}}} /!\ "()" ...not "[]" |
|{{{[x for x in mylist if x>3]}}} |{{{(x for x in mylist when x>3 )}}} |
|{{{range(10)}}}|{{{[0..9]}}} or {{{[0...10]}}}|
|{{{max(mylist)}}}|{{{Math.max mylist...}}}|
|{{{ord("A")}}}|{{{"A".charCodeAt(0)}}}|
|{{{chr(65)}}}|{{{String.fromCharCode(65)}}}|
!!~DataBase Layout:
1. ''Working Copy'': Files that can be edited
2. ''Staging Area'': Files scheduled for next commit
3. ''Local repository'': Merged area ready to be checked against remote repository
4. ''Remote repository'': Shared Cloud, usual names for rep/branch="origin"/"master"
5. ''Stash'': Temporary storage to hide current edits
!!~DataBase transfers:
| | → | ← |
| 1-2 |git add <files> |git rm <files>|
| 2-3 |git commit |git checkout ''or'' git merge |
| 3-4 |git push |git fetch ''or'' git pull=git fetch + git merge |
| 1-5 |git stash |git stash apply |
!!Local Rep Creation from scratch:
{{{
mkdir wc
cd !$
git init
git remote add origin <url>
}}}
!!Local Rep Creation from cloud:
{{{
git clone --recursive <url>
}}}
!! Hierarchical reference
{{{
git submodule add <url> <dir>
}}}
! Tiger Only, no more possible on Snow Leopard
* Change ~UserMask:
**{{{ defaults write -g NSUmask 2}}} ( Data value in decimal!)
* Create Groups:
** Applications/Utilities/~NetInfo.app → groups
** unlock & duplicate a user personal group
** modify the group:
*** change name: {{{mygroup}}}
*** add property {{{users}}}
*** populate the property with user names, one at a time with menu→add new value
*** use {{{uuidgen}}} and paste results to override the value of generateduid
*** logout, login, try {{{id}}} , new groups must be there
* Create a group-owned folder:
** {{{sudo chown -R myuser:mygroup /Users/Shared}}}
** {{{sudo find /Users/Shared -type d -exec chmod g+s \{} \;}}}
* Tabstops set to 4 characters, emulated with spaces
{{{
#!/usr/bin/env python
# vi: ts=4:sts=4:sw=4:et
}}}
! Shortcuts
| Tab|Mode Edit ( reshape details ) ↔ Mode Object ( replace as a whole) |
| 1|View Front |
| 3|View Side |
| 7|View Top |
| Ctrl-1|View Rear |
| Ctrl-3|View Other side |
| Ctrl-7|View Bottom |
| Wheel|View Intuitive |
| 0|View Camera |
| Point + c|New Origin for View |
| ~Ctrl-Shift-up|Full screen |
| z|Object Solid ↔ Wires |
| a|Select all |
| b|Selection box |
| bb|Selection Circle |
| ~Ctrl-LMB|Lasso Select |
| RMB|Select |
| ~Shift-RMB|Add select |
| Ctrl-mouse|Move on grid |
| u|Undo |
| ~Ctrl-Space|Manipulator widget On ↔ Off |
| ~Ctrl-Alt-r|Rotate with widget |
| Alt-r|Clear rotation |
| ~Ctrl-Alt-g|Move with widget |
| Alt-g|Clear position |
| ~Ctrl-Alt-s|Scale with widget |
| Alt-s|Clear scale |
| A or Space|Add Object |
| X or x|Erase |
| f|Add face |
| e|Extrude |
| ~Alt-C|Convert a subsurf into a mesh |
| k|Cut loop → Wheel selectes # of slices |
| M|Move to drawing box |
| ~Shift-MR|Add/Remove to/from Selection |
| F12|Render |
| ~Ctrl-Tab|Vertex/Edge/Face modes |
| ~Alt-Click|Edge loop select |
* Skeleton
{{{
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="author" content="Derivation Bud">
<title>RTL sources</title>
<body>
The content of the document......
</body>
</html>
}}}
* Comments
{{{
<!-- This is a
multiline comment -->
}}}
|{{{html code}}} |Render |
|{{{<a href="http://www.w3schools.com">link</a>}}}|<html><a href="http://www.w3schools.com">link</a></html>|
|{{{The <abbr title="World Health Organization">WHO</abbr> was founded in 1948.}}} |<html>The <abbr title="World Health Organization">WHO</abbr> was founded in 1948.</html> |
|{{{Can I get this <acronym title="as soon as possible">ASAP</acronym>?}}} |<html>Can I get this <acronym title="as soon as possible">ASAP</acronym>?</html> |
|{{{<em>Emphasized text</em>}}} |<html><em>Emphasized text</em></html> |
|{{{<strong>Strong text</strong>}}} |<html><strong>Strong text</strong></html> |
|{{{<dfn>Definition term</dfn>}}} |<html><dfn>Definition term</dfn></html> |
|{{{<code>A piece of computer code</code>}}} |<html><code>A piece of computer code</code></html> |
|{{{<samp>Sample output from a computer program</samp>}}} |<html> <samp>Sample output from a computer program</samp></html> |
|{{{<kbd>Keyboard input</kbd>}}} |<html><kbd>Keyboard input</kbd></html> |
|{{{<var>Variable</var>}}} |<html><var>Variable</var></html> |
...
/***
| ''Name:'' | inlineSVG |
| ''Description:'' | A simple macro {{{<<SVG "<svg code>">>}}} to display SVG inline in TiddlyWiki. <br> I.E with all svg code self contained in the wiki |
| ''Author:'' | [[Pugugly|mailto:pugugly001@gmail.com]] |
| ''Source:'' | http://storywiki.tiddlyspot.com/#inlineSVG |
| ''Version:'' | 1.1 |
| ''Status:'' | Works. The original source for this code had comments regarding some SVG features not working, <br> so I'm uncertain as to the limits of this Macro. IVÁN, Tamás has expanded my original code to handle option width and height parameters |
| ''Date:'' | July 29th 2009 |
| ''Comments:'' | Please make comments at http://groups.google.co.uk/group/TiddlyWiki <br> Original code --stolen-- --borrowed-- . . . //gleaned// from http://softwareas.com/inline-svg |
| ''License:'' | [[Creative Commons Attribution-ShareAlike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]] |
| ''Bugs:'' | Although xlink references no longer crash the xml parser, they also do not currently resolve properly <br> This breaks everything the relies upon them such as 'use', 'gradient', 'defs', et al. <br> internal scripting does not work at this time, but this may be related to the xlink issue |
| ''To Do:'' | There's no reason this can't be generalized to generic XML <br> Larger images are cutoff - I suspect there is a default height/width/viewbox <br> and I need to implement an easy way to insert x/y info |
***/
//{{{
config.macros.SVG =
{
handler: function (place, macroName, params, wikifier, paramString, tiddler)
{
var prms = paramString.parseParams('svg', null, true, false);
var svg = getParam(prms,'svg') || '';
var width = getParam(prms,'width') || '100%';
var height = getParam(prms,'height') || '100%';
var svgObject = document.createElement('object');
svgObject.setAttribute('type', 'image/svg+xml');
svgObject.setAttribute('data', 'data:image/svg+xml,'+ '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" width="' + width + '" height="' + height + '" >'+svg+'</svg>');
jQuery(place).append(svgObject);
}
};
//}}}
{{{db.json}}}
{{{
{ "Alice" : [ 12 , "female" ] , "Bob" : [ 47, "male"] }
}}}
{{{ engine.py }}}
{{{
import json
db = json.load(file("db.json"))
print db["Alice"]
}}}
{{{ doc.html }}} # Fails on cross-origine if not served
{{{
<script>
req = new XMLHttpRequest()
req.open("GET","db.json",true)
req.onreadystatechange = function() {
if ( req.readyState == 4 ) {
if ( req.status == 200 ) {
db=JSON.parse(req.responseText)
console.log(db["Alice"])
}
}
}
req.send()
</script>
}}}
!!X Windows keyboard managment
!!!Get the key codes:
*{{{linux> xmodmap -pke}}}
{{{... keycode 9 = Escape ... keycode 10 = 1 exclam ...}}}
* {{{shell> xev}}}
& play with mouse and keyboard
!!!Modify mapping
*{{{/etc/X11/xorg.conf}}} and {{{/etc/X11/Xmodmap}}} contain system settings
*{{{~/.Xmodmap}}} can contain customizations
*{{{~/.Xmodmap}}} example to add 'compose' key:
{{{
keycode 117 = Multi_key
}}}
*{{{~/.xsession}}} or {{{~/.xinitrc}}} : can be use to force {{{~/.Xmodmap}}} sourcing if not done by default:
{{{
xmodmap /home/<joe>/.Xmodmap
}}}
{{{
logging.basicConfig(level=logging.WARNING,format="%(msg)s")
if options.verbose:
logging.getLogger().setLevel(logging.DEBUG)
LOG = logging.getLogger("logtest")
LOG.debug("runnng main")
LOG.info("Everything is OK")
LOG.warning("Oh Oh")
}}}
! How to manage cover art
!! Method 1. Most simple method.
Cover Art in \ALBUMS folder in format aaaaaa.jpg, then Abbey Road.jpg
Folders structure is
{{{
\ALBUMS
Abbey Road.jpg
}}}
Cover Art in this \ALBUMS folder apply to all matching files located anywhere in the player, in other words: it doesn't matter what folders structure are followed.
This method can be confusing when album name is too common, ie: ”Greatest Hits” then must be used Method 2 or 3.
!! Method 2. Most known method.
Cover Art in \ALBUMS folder in format aaaaaaAAAAAAA.jpg, then Abbey RoadThe Beatles.jpg
This is automatically generated by WMP10 and above with USB MTP mode of Meizu players.
Folders structure is
{{{
\ALBUMS
Abbey RoadThe Beatles.jpg
\MUSIC
_____\The Beatles
__________\Abbey Road
_____________ track 1
_____________ ...
}}}
!! Method 3. Most sophisticated method
This is used by some media managers like J. River Media Center.
Cover Art in albums folder with format aaaaaa.jpg
Important: aaaaaa.jpg has to be different than the name of the folder.
For instance, as a personal rule I put year of release before the name of the Album. Then folder "1969 Abbey Road",
Folders structure is
{{{
\MUSIC
_____\The Beatles
__________\1969 Abbey Road
_____________ track 1
_____________ ...
_____________ Abbey Road.jpg. <--- cover art
}}}
Name of the folders is free in this method.
!! Generalities
a. AFAIK Cover Art can be any size. I suppose it follows sizes of photos in menu function PICTURES.
c. The names must fit exactly ID3 tag fields "artist" and "album".
Folder, when mentioned, must fit exactly names in ID3
Then this won't work
AAAAAA = "The beatles" "the Beatles" "the beatles"
aaaaaa = "Abbey road" "abbey Road" "abbey road"
Hope it helps
Maceration ( 3 jours au frigo + 1 nuit hors frigo ) avec:
* 80g de graines
* 20cl de vinaigre de cidre
* 20cl d'eau
* 15g de sel
Puis égoutter pas trop sec + écraser/broyer
{{{
vi *.xml
:bufdo %s/replaceme/withthat/g | update
}}}
* telnet 192.168.0.3
//login: root
password: same as admin//
* mac address : 00:11:32:06:FC:C6
Ingrédients pour 45 pièces:
* Farine: 500g
* Sucre: 150g
* Huile d'olive: 6 cas
* Eau de fleur d'oranger: 6 cas
* Oeufs: 2
* Sel: 1/2 cac
Préparation:
* Mélanger et former une boule.
* Laisser reposer 1h au frigo.
* Former les portions , fendre au couteau, badigeonner de lait
Cuisson: 20 min a 180C
! Des encryption
{{{
$ echo 'this is the plain text' > plaintext.txt
$ openssl enc -e -des3 -salt -in plaintext.txt -out ciphertext.bin -pass pass:cryptme
$ hd ciphertext.bin
00000000 53 61 6c 74 65 64 5f 5f bf bc ab 49 6d 6d ae 3a |Salted__...Imm.:|
00000010 1f 19 ec f5 cf b2 e2 0a 30 33 37 51 42 5b 57 19 |........037QB[W.|
00000020 0a 67 21 71 59 f7 4d cc |.g!qY.M.|
00000028
}}}
! Des decryption
{{{
$ openssl enc -d -des3 -in ciphertext.bin -out plaintext2.txt -pass pass:cryptme
$ cat plaintext2.txt
this is the plain text
}}}
! Create an RSA key pair:
{{{
openssl genrsa -out private.key 4096
openssl rsa -in private.key -pubout > public.key
}}}
! Python wrapping
{{{
def aes(K="\x01\x09\0x07\0x01"*8,plain="\x00"*16):
cmd="openssl enc -e -aes-256-ecb -K %s"%(K)
p=Popen(cmd.split(),stdin=PIPE,stdout=PIPE)
cipher=p.communicate(input=plain)[0]
return( "".join(["%0.2X"%(ord(x)) for x in cipher]))
}}}
1. Upload hacker kit to PCH
{{{
PCH: Open ftp service
PC: wget .../NMTCommunityInstallerPortable.zip
PC: unzip NMTCommunityInstallerPortable.zip
PC: cd NMTCommunityInstallerPortable
PC: chmod +x "Linux Start.sh"
PC: !$
PC-GUI: Select BusyBox , c200remote...
}}}
2. Remote control:
{{{
http://popy:9999/c200remote_web/webrc200.html
}}}
3. Remote console on PCH:
{{{ more /etc/hosts }}}
//127.0.0.1 localhost
//127.0.1.1 micmac
//192.168.0.3 nasty
//192.168.0.5 popy
{{{ telnet popy }}}
{{{ cd /share }}}
{{{ busybox }}}
surf at http://lps-eu.st.com
Download the .pac file
Use contained IPs as proxy without authentification.
! pylab
{{{
#!/usr/bin/env python
from pylab import *
ylabel('Y')
xlabel('X')
plot([1,3,5,3,8], color="blue")
plot([2,1,6,4,1], color="red")
draw()
show()
}}}
!Strings
String to Bytes:
Risky! {{{bytes("myString","utf-8")}}} # python 2/3 return string/bytes :(
Good: {{{bytearray("myString","utf-8")}}} # python 2/3 return bytes :)
Bytes to unicode String:
{{{bytearray("ABCD").decode('utf-8')}}}
{{{bytes("ABCD").decode('utf-8')}}}
{{{b"ABCD".decode('utf-8')}}}
! Text files
Create...
{{{
fo = open(myFile,"w",encoding='utf-8')
fo.write(myString)
}}}
Parse...
{{{
myString = open(myFile,encoding="utf-8").read()
}}}
<?xml version="1.0"?>
<svg height="500" width="500" >
<g style="fill-opacity:1.0; stroke:black; stroke-width:1;">
<rect x="115" y="385" height="-90"
width="90" style="fill:#FF0000;"/>
<line x1="205" y1="295" x2="205" y2="205"/>
<line x1="205" y1="295" x2="295" y2="295"/>
<circle cx="205" cy="295" r="27" style="fill:#00FF00;"/>
<circle cx="205" cy="205" r="27" style="fill:#0000FF;"/>
<text x="70" y="430" font-size="24"> Text </text>
</g>
</svg>
{{{
import bpy
bpy.ops.mesh.primitive_cube_add(location=(1,1,1))
}}}
{{{
import bpy
import mathutils
from mathutils import Vector
def createMeshFromData(name, origin, verts, faces):
# Create mesh and object
me = bpy.data.meshes.new(name+'Mesh')
ob = bpy.data.objects.new(name, me)
ob.location = origin
ob.show_name = True
# Link object to scene and make active
scn = bpy.context.scene
scn.objects.link(ob)
scn.objects.active = ob
ob.select = True
# Create mesh from given verts, faces.
me.from_pydata(verts, [], faces)
# Update mesh with new data
me.update()
return ob
def run(origo):
origin = Vector(origo)
(x,y,z) = (0.707107, 0.258819, 0.965926)
verts = ((x,x,-1), (x,-x,-1), (-x,-x,-1), (-x,x,-1), (0,0,1))
faces = ((1,0,4), (4,2,1), (4,3,2), (4,0,3), (0,1,2,3))
cone1 = createMeshFromData('DataCone', origin, verts, faces)
cone2 = createMeshFromOperator('OpsCone', origin+Vector((0,2,0)), verts, faces)
cone3 = createMeshFromPrimitive('PrimCone', origin+Vector((0,4,0)))
}}}
! Create a ref
* A ref is a number
* Tools-> Ref Mngt -> Date -> Scroll -> Create
! Create a doc
* Tools -> Admin -> File -> ... -> Create
! Update a doc
* Tools -> Admin -> ... Create from -> 1) File Name 2) Rev++
* The filename on smartdoc should be revisionless
* Create a batch script:
{{{
> cat /usr/local/bin/mute.sh
#!/bin/tcsh -f
osascript -e 'set volume 1'
> chmod +x /usr/local/bin/mute.sh
}}}
* Hook-it
{{{
sudo defaults write com.apple.loginwindow LogoutHook /usr/local/bin/mute.sh
}}}
* Big fonts
** install unity tweak tool
** tweak -> Appearance -> Fonts -> Text scaling factor
* Low contrast
{{{
mkdir ~/.themes
cp -R /usr/share/themes/Ambiance ~/.themes/
vi ~/.themes/Ambiance/gtk-3.0/gtk-main.css
}}}
{{{
/*@define-color base_color #ffffff;*/
@define-color base_color #d8d8d8;
}}}
* Better Editor
Sublime text3 + package manager + vintagous
Intro:
1. To control final aspect of a object, it is associated with a material.
The material holds behaviour of the light: the colour, how much is reflected, how much flows through transparency, how much is emitted in case of a lamp....
2. A material can be altered by an image used as a filter, this is a textured material. The image can be used as painting on the faces , or as shadows on top of materials own colour.
3. If the image needs a precise placement with respect to the object, a mapping function is used: an UV map.
Prepare an UV map:
1. 3DEditMode: Select edges to be cut, Menu→Mesh→Edges→mark as seam
2. 3DEditMode: Select all faces to unwrap, Menu→Mesh→UV unwrap...
3. UV/imageEditor: Open an external image
4. UV/imageEditor: Use r,g,s to better position
Prepare a texture:
1: 3DEditMode: Select the object
2: Propertypanel: Texture tab : Create a texture of type "Image or Movie"
3: Propertypanel: Texture tab : Set image to single image and set source file
4: Propertypanel: Texture tab : Set mapping: type UV, map name should match the name of prep.
Render
{{{
set guifont=Consolas:h12:cANSI
set guioptions-=T "remove toolbar
set mouse=
set nobackup
set nowritebackup
set noswapfile
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab
let g:xml_syntax_folding=1
au FileType xml setlocal foldmethod=syntax
syntax on
set hlsearch
}}}
! Softwares
qemu, xen, virtualbox
! qemu-kvm
sudo apt-get install qemu-kvm
qemu-img create machine1.img 25G
qemu-system-x86_64 -m 1024 -cdrom $HOME/Downloads/<myosdistro>.iso -hda machine1.img -boot d
qemu-kvm -m 1024 -hda machine1.img -k en
!Setup
* Find a command : {{{SET PATH=E:\PortableApps\CommonFiles\bin;%PATH%}}}
* Aliases: {{{doskey /macrofile=path\to\aliases.txt}}}
* With {{{aliases.txt}}}:
{{{
ls=dir
ps=tasklist $*
}}}
!Shared libraries
* Register a dll: {{{REGSVR32 c:\...\zipfldr.dll}}}
* Browse the GAC ( Global Assembly Cache): {{{exporer %windir%\assembly }}}
! Enable .py preview
{{{reg add HKLM\SOFTWARE\Classes\.py /v PerceivedType /t REG_SZ /d text}}}
{{{ db.xml }}}
{{{
<?xml version="1.0" ?>
<db>
<Alice age="12" sex="female"/>
<Bob age="47" sex="male" />
</db>
}}}
{{{ engine.py }}}
{{{
import xml.ElementTree as ET
tree = ET.parse('db.xml')
root = tree.getroot()
for child in root:
print child.tag, child.attrib
}}}
{{{ doc.html}}} # Fails if not served
{{{
<script>
req = new XMLHttpRequest()
req.open("GET","db.json",true)
req.onreadystatechange = function() {
if ( req.readyState == 4 ) {
if ( req.status == 200 ) {
db=req.responseXML)
console.log(db.getElementsByTagName("Alice")[0].getAttribute("age"))
}
}
}
req.send()
</script>
}}}
{{{
import yaml
var=[{"A":1,"B":3},["C","D"]]
fd=file("db.yaml")
print >>fd,yaml.dump(var)
fd.close')
var_back=yaml.load(file("db.yaml"))
assert var_back[0]["A"]==var[0]["A"]
}}}
{{{db.yaml}}}
{{{
Alice:
- 12
- female
Bob:
- 47
- male
}}}
{{{ doc.html }}} # Fails if not served !
{{{
<script src="js-yaml.min.js"></script>
<script>
req = new XMLHttpRequest()
req.open("GET","db.yaml",true)
req.onreadystatechange = function() {
if ( req.readyState == 4 ) {
if ( req.status == 200 ) {
db=jsyaml.load(req.responseText)
console.log(db["Alice"])
}
}
}
req.send()
</script>
}}}
{{{engine.py}}} # yaml is not a native library!
{{{
import yaml
db=yaml.load(file("db.yaml").read())
print db["Alice"]
}}}