3 #+EMAIL: seudut@gmail.com
6 * Programming Languages
10 #+BEGIN_SRC sh :exports both :results output replace
17 Usage: perl [switches] [--] [programfile] [arguments]
18 -0[octal] specify record separator (\0, if no argument)
19 -a autosplit mode with -n or -p (splits $_ into @F)
20 -C[number/list] enables the listed Unicode features
21 -c check syntax only (runs BEGIN and CHECK blocks)
22 -d[:debugger] run program under debugger
23 -D[number/list] set debugging flags (argument is a bit mask or alphabets)
24 -e program one line of program (several -e's allowed, omit programfile)
25 -E program like -e, but enables all optional features
26 -f don't do $sitelib/sitecustomize.pl at startup
27 -F/pattern/ split() pattern for -a switch (//'s are optional)
28 -i[extension] edit <> files in place (makes backup if extension supplied)
29 -Idirectory specify @INC/#include directory (several -I's allowed)
30 -l[octal] enable line ending processing, specifies line terminator
31 -[mM][-]module execute "use/no module..." before executing program
32 -n assume "while (<>) { ... }" loop around program
33 -p assume loop like -n but print line also, like sed
34 -s enable rudimentary parsing for switches after programfile
35 -S look for programfile using PATH environment variable
36 -t enable tainting warnings
37 -T enable tainting checks
38 -u dump core after parsing program
39 -U allow unsafe operations
40 -v print version, patchlevel and license
41 -V[:variable] print configuration summary (or a single Config.pm variable)
42 -w enable many useful warnings
43 -W enable all warnings
44 -x[directory] ignore text before #!perl line (optionally cd to directory)
45 -X disable all warnings
47 Run 'perldoc perl' for more help with Perl.
53 perl -ne 'print if /expression/' xxx.log;
56 #+BEGIN_SRC perl :results output replace
58 ($tt =~ /h(.*)o/ ) and print $1;
66 perl -wnl -e '/keyword/ and print;' xxx.log
71 perl -ne 'print "$1\n" if /aaa=(\d+)\s.*/' xxx.log;
74 #+BEGIN_SRC fundamental :tangle ./temp/aa.txt
81 #+BEGIN_SRC sh :results output replace
82 perl -wnl -e 'print "==$.: $_"' ./temp/aa.txt
93 See special variable in perl [[http://perldoc.perl.org/perlvar.html][perlvar]], or =perldoc perlvar=
94 - =$.= Current line number
99 #+BEGIN_SRC gnuplot :exports code :file ./temp/sin.png
105 [[file:./temp/sin.png]]
107 2. plot with data file
108 #+BEGIN_SRC fundamental :tangle ./temp/plot.dat
121 #+BEGIN_SRC gnuplot :file ./temp/ll.png
125 plot "./temp/plot.dat" using 1:2 with lines
129 [[file:./temp/ll.png]]
133 #+BEGIN_SRC sh :results output replace
134 netstat -atn # For tcp port
135 netstat -aun # For udp port
140 #+BEGIN_SRC sh :results output replace
141 # listening on port 1234 for a connection
144 # connect to the machine and port
149 ** =add-hook= vs =eval-after-load=
150 Ref [[http://stackoverflow.com/questions/2736087/eval-after-load-vs-mode-hook][eval-after-load-vs-mode-hook]]
152 Code wrapped in =eval-after-load= will be executed only once, so it is typically used to perform
153 one-time setup such as setting default global values and behaviour. An example might be setting
154 up a default keymap for a particular mode. In =eval-after-load= code, there's no notion of the
157 Mode hooks exectue once for every buffer in which the mode is enabled, so they're used for per-buffer
158 configuration. Mode hooks are therefore run later than =eval-after-load= code; this lets them take
159 actions baed upon such information as whether other modes are enabled in the current buffer.
163 ** =#import= vs. =#include=
164 [[http://stackoverflow.com/questions/439662/what-is-the-difference-between-import-and-include-in-objective-c][what-is-the-difference-between-import-and-include-in-objective-c]]
165 - =#import= directive as added to Objective-C as an improvied version of =#include=
166 - =#import= ensures that a file is only ever included onces so that you never have a problem with recursive includes
167 - Bacically, use =#import= for Objective-C thins, =#include= for C stufff.
171 ** Intruduction to Algorithms