Recent Notes
Displaying keyword search results 11 - 21
Created by Dr. Xi on December 05, 2009 20:12:16
Last update: December 05, 2009 20:46:45
It's quite easy for Perl to open a pipe and read from it:
$file = "nospace.txt";
open(IN, "cat $file |") ...
But the code breaks when the file name contains a space:
# This does not work!
$file = "yes space.txt";
...
On Windows, these don't work either:
# This does not work!
$file = "yes space.txt";
...
You need to use a technique called Safe Pipe Opens :
$file = "yes space.txt";
$prog = "cat";
...
Created by Dr. Xi on December 04, 2009 04:33:05
Last update: December 04, 2009 04:33:05
Variable Meaning $_ The default or implicit variable. @_ Within a subroutine the array @_ contains the parameters passed to that subroutine. $a, $b Special package variables when using sort() $<digit> Contains the subpattern from the corresponding set of capturing parentheses from the last pattern match, not counting patterns matched in nested blocks that have been exited already. $. Current line number for the last filehandle accessed. $/ The input record separator, newline by default. $| If set to nonzero, forces a flush right away and after every write or print on the currently selected output channel. Default is 0 (regardless of whether the channel is really buffered by the system or not; $| tells you only whether you've asked Perl explicitly to flush after...
Created by Dr. Xi on July 29, 2009 20:58:51
Last update: July 29, 2009 20:58:51
You need to set several system variables in order to run a SQL script to update a column with JavaScript code:
SQLT: set sqlt off
The default SQLT (SQL terminator) is semicolon, which is used in JavaScript as statement terminator.
Blank lines: set sqlblanklines on
Blank lines are abundant in JavaScript. Don't let them terminate your SQL statement
No variable substitution: set define off
The ampersand is a JavaScript operator, which is also used by SQL*Plus for variable substitution. You should turn variable substitution off to preserve the JavaScript code.
Finally, use slash (/) on a blank line to terminate your SQL code. Example:
UPDATE events set JSCODE = 'var a = 1;
var ...
Created by Dr. Xi on December 14, 2008 19:09:19
Last update: December 14, 2008 19:09:19
My mod_python app failed to extract Python eggs with this error:
[Sun Dec 14 09:40:03 2008] [error] [client 127.0...
The error message suggested to set the PYTHON_EGG_CACHE environment variable. While this may help solve the problem, there's no reason why the Python egg can't be installed expanded:
easy_install -Z MySQL-python-1.2.2.tar.gz
Created by Dr. Xi on September 10, 2008 15:51:42
Last update: November 26, 2008 21:14:46
Variable Description SET AUTO [COMMIT] {ON | OFF | IMM [EDIATE] | n} Controls when Oracle Database commits pending changes to the database. SET CMDS [EP] {; | c | ON | OFF} Sets the non-alphanumeric character used to separate multiple SQL*Plus commands entered on one line to c. SET CON [CAT] {. | c | ON | OFF} Sets the character you can use to terminate a substitution variable reference if you wish to immediately follow the variable with a character that SQL*Plus would otherwise interpret as a part of the substitution variable name. SET ECHO {ON | OFF} Controls whether the START (@) command lists each command in a script as the command is executed. SET EDITF [ILE] file_name[.ext] Sets the default filename...
Created by Dr. Xi on November 12, 2008 22:56:00
Last update: November 12, 2008 22:56:00
Set the PAGESIZE system variable to 0 to suppress headings in SELECT results. This is helpful when retrieving source code for packages or stored procedures:
SQL> set pagesize 0
SQL> show pages
pagesize...
Created by Dr. Xi on September 29, 2008 23:05:12
Last update: September 29, 2008 23:06:16
These variables are set or used by the Unix shell to modify its behavior. Variable Description ENV=file Name of script that gets executed at startup; Usually, ENV=$HOME/.kshrc FCEDIT=file Editor used by fc (fix command) command. If $FCEDIT is not defined, use $EDITOR, otherwise use the default (vi or ed). FPATH=dirs Directories to search for function definitions; undefined functions are set via typeset -fu . FPATH is searched when these functions are first referenced. HISTFILE=file File in which to store command history. Default is $HOME/.sh_history for Korn shell, $HOME/.bash_history for Bash. If not set, history is lost after logout. HISTSIZE=n Max number of commands to keep in history. HOME=dir Home directory; set by login from passwd file. IFS='chars' Internal field separators. Default is space, tab, and...
Created by Dr. Xi on September 29, 2008 23:03:40
Last update: September 29, 2008 23:04:08
Variables set automatically by shell: Variable Description $# Number of command-line arguments. $- Options currently in effect (arguments supplied to sh or to set). $? Exit value of last executed command. $$ Process number of current process. $! Process number of last background command. $0 First word; that is, command name. $n Individual arguments on command line (positional parameters). The Bourne shell allows only nine parameters to be referenced directly (n = 1-9); the Korn shell allows n to be greater than 9 if specified as ${n}. $* All arguments on command line ("$1 $2..."). $@ All arguments on command line, individually quoted ("$1" "$2" ...). Variables set automatically by Korn shell: Variable Description ERRNO Error number of last system call that failed. LINENO Current...
Created by Dr. Xi on September 25, 2008 23:43:35
Last update: September 25, 2008 23:43:54
@INC is a list of directories Perl uses to find modules to load. You can add directories to @INC by use lib... , or set the PERLLIB environment variable:
# using default @INC
use Net::Socket::NonBl...
Created by Dr. Xi on September 23, 2008 20:43:58
Last update: September 23, 2008 20:43:58
Variable Description
$0 The name of the ruby script file
$* The command line arguments
$$ Ruby interpreter's process ID
$? Exit status of last executed child process
$_ String last read by gets
$. Line number last read by interpreter
$! Last error message
$@ Location of error
$& String last matched by regexp
$~ The last regexp match, as an array of subexpressions
$n the nth subexpression in the last match (same as $~ )
$= Sase-insensitivity flag
$/ Input record separator
$\ Output record separator
Created by Dr. Xi on April 26, 2007 03:17:14
Last update: May 05, 2007 19:50:26
To loop through an envionment variable:
@echo off
set a=1 2 3
for %%i in (%a%) d...
To loop through the command line arguments:
@echo off
for %%i in (%*) do echo %%i