Recent Notes
Displaying keyword search results 1 - 10
Created by Dr. Xi on February 06, 2012 12:14:11
Last update: February 07, 2012 15:39:35
Oracle sqlplus command line tools does not support command line editing out-of-the-box. But on Linux there's a handy utility that enables command line editing with any command line tool: rlwrap - readline wrapper.
Install rlwrap:
$ sudo apt-get install rlwrap
Create a keywords file .sql.dict (optional, but convenient):
false null true
access add as asc begin by chec...
It would be nice to add the tables names also.
Create an alias for sqlplus (put it in .bashrc ):
alias sqlplus='rlwrap -f $HOME/.sql.dict sqlplus'
Created by James on January 10, 2011 12:35:53
Last update: November 04, 2011 19:28:03
The events mouseover and mouseout are fired when the mouse enters/leaves the element where the event handlers are registered, and any nested elements which do not handle these events (because of event bubbling ). The events mouseenter and mouseleave are fired only when the mouse enters/leaves the specified element. Nested elements do not come into play. This following is a test page. You need Firebug to view the console output. Or use the JavaScript Executor bookmarklet. If none of these are available, an alert will popup (but you won't be able to fully test with alert.).
<!DOCTYPE HTML> <html> <head> <title>jQu... For the above test page, when you move the mouse through both the outer and inner areas of the mouseover/mouseout rectangle, the output is...
Created by magnum on October 06, 2011 14:35:20
Last update: October 06, 2011 14:35:20
The longjmp function jumps to the line where setjmp was last called. In return, setjmp returns the value passed in as the second parameter to longjmp .
#include <stdio.h>
#include <stdlib.h>
#incl...
Result:
$ ./longjmp
val is 0
val is 1
--> val is ...
Created by jinx on May 18, 2011 20:09:05
Last update: May 18, 2011 20:09:05
The PHP function file_get_contents reads the entire contents of a file into a string, while the function file reads a file into an array.
file_get_contents('filename') is equivalent to implode('', file('filename')) :
<?php
// reads entire file into array, one elem...
Created by jinx on May 04, 2011 19:39:44
Last update: May 04, 2011 19:42:51
The function include includes the specified file multiple times, while include_once only includes the file once.
This is a test:
Create file test.php with contents:
<?php
for ($i = 0; $i < 5; $i++) {
inclu...
Create file test.inc with contents:
<?php
echo __FILE__, " included: $i\n";
?>
...
Run test.php , the output is:
E:\phpwork\test.inc included: 0
E:\phpwork\test...
Change include to include_once , only one line is printed:
E:\phpwork\test.inc included: 0
You must use include_once to avoid duplicate includes in the case A includes B and C , but B and C both includes D .
The relationship between require and require_once is the same.
Created by jinx on May 02, 2011 20:48:49
Last update: May 02, 2011 20:58:01
A PHP try catch block looks like this:
<?php
try {
throw new MyException('foo!'...
Normally, no exceptions are thrown from internal function errors. For example:
<?php
$a = 1;
$b = 0;
try {
$v = $...
The division by zero error is never caught as an exception.
However , you can translate errors into exceptions with an error handler and ErrorException :
<?php
function exception_error_handler($errno, ...
which prints:
Exception: exception 'ErrorException' with message...
PHP does not support finally clause.
Created by jinx on April 28, 2011 20:52:45
Last update: April 29, 2011 13:27:31
This is normally a syntax error just before some variable. Try some of these:
Missing operator before a variable:
<?php
$a = 'ab';
echo('Missing conca...
Missing semicolon at end of line:
<?php
echo('Missing semicolon at end of lin...
Missing ( and ) in for loop:
<?php
foreach $a as $i {
echo "$i\n";
...
Missing keyword before class variable:
<?php
class A {
// should be var $a;
...
Created by jinx on April 28, 2011 21:09:08
Last update: April 28, 2011 21:09:08
PHP global variables are defined outside of functions and classes. They are visible both in the current file and in any included/required files. Also, any global variables defined in required/included files are visible in the current file. But they are not visible in any functions or classes, unless specifically declared global .
Test:
Create file test.php :
<?php
ini_set('display_errors', 'stderr');
i...
Create file test.inc :
<?php
echo '[', __FILE__, '] $a . $b = ', $...
Run the PHP script in command line:
php test.php 2>C:\tmp\stderr.out
The result is:
[C:\work\test.inc] $a . $b = ab
[C:\work\test.p...
stderr messages:
PHP Notice: Undefined variable: b in C:\work\scra...
Created by jinx on April 20, 2011 08:59:07
Last update: April 20, 2011 08:59:30
You get this warning when timezone is not set (which is the default):
PHP Warning: mktime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead in test.php on line 8
To get rid of the warning message, set timezone in php.ini :
;;;;;;;;;;;;;;;;;;;
; Module Settings ;
;;;;...
Created by James on March 02, 2011 12:29:38
Last update: March 11, 2011 08:42:50
jQuery event delegation allows you to bind event handlers to elements not yet created, under these conditions:
The DOM element must nest inside the element to which the event is delegated to
The inner element must not stop event bubbling
The opposite of delegate is undelegate .
<!DOCTYPE HTML>
<html>
<head>
<title>jQu...