Notes by voodoo
Displaying keyword search results 1 - 9
Created by voodoo on February 16, 2012 14:56:44
Last update: February 16, 2012 15:52:56
Shell functions are declared using this syntax:
[ function ] name () compound-command [ redirectio...
Example:
function ll {
ls -alF $*
}
Example 2:
ll() {
ls -alF $*
}
Shell functions can be exported to subshells with the -f switch:
$ export -f ll
However , I had problems logging in Ubuntu 11.10 after I added this to .profile :
export -f ll
Created by voodoo on February 16, 2012 14:57:35
Last update: February 16, 2012 14:57:35
You can use either declare or typeset to list function definitions :
To list all function names:
declare -F
To display a function definition:
$ declare -f quote
quote ()
{
echo ...
If you see a lot of functions with names starting with the underscore ( _ ) and wonder where they come from, they are created by the scripts in /etc/bash_completion.d/ .
Created by voodoo on February 16, 2012 13:35:38
Last update: February 16, 2012 13:35:57
The C shell allows you to define aliases with arguments: \!^ passes the first argument, \!* passes all arguments. Examples from http://unixhelp.ed.ac.uk :
alias print 'lpr \!^ -Pps5'
alias print 'lp...
In ksh or bash you cannot define alias with arguments. Use function instead.
Created by voodoo on August 30, 2011 12:30:59
Last update: August 30, 2011 12:32:33
Summarized from The C Book : There are essentially two types of object in C: the internal and external objects. Anything declared outside a function is external; anything inside one, including its formal parameters, is internal. Since no function can be defined inside another, functions are always external. All function declarations implicitly have the extern keyword stuck in front of them, whether or not you put it there. These two declaearions are equivalent:
void some_function(void); extern void some_func... The term linkage is used to describe the accessibility of objects from one file to another. There are three types of linkage: external , internal , and no linkage . Type of linkage Type of object Accessibility external external Across files, througout the program internal external Within...
Created by voodoo on August 12, 2011 13:32:13
Last update: August 12, 2011 13:32:13
To get rid of this compilation warning, add:
#include <stdlib.h>
Created by voodoo on November 25, 2010 00:15:37
Last update: November 25, 2010 00:15:37
PostgreSQL JDBC doc says:
Specifically deleting a row that contains a Large Object reference does not delete the Large Object. Deleting the Large Object is a separate operation that needs to be performed. .
In JDBC this can be done in two steps:
Delete the large object (call PostgreSQL function lo_unlink )
long oid = jdbcTemplate.queryForObject("select...
Delete the row in the referring table:
jdbcTemplate.update("delete from InventoryItem whe...
Created by voodoo on November 25, 2010 00:03:53
Last update: November 25, 2010 00:03:53
It seems that the JDBC standard way to create a BLOB is to call Connection.createBlob . However, this does not work for PostgreSQL (as of version 9.0-801 jdbc4):
Exception in thread "main" org.postgresql.util.PSQ...
The workaround is to call a PostgreSQL function to create the Blob, then use JDBC to update it:
Connection conn = jdbcTemplate.getDataSource().get...
Oracle Note: the Oracle way function to create an empty BLOB is EMPTY_BLOB() .
stmt.execute ("INSERT INTO my_blob_table VALUES ('...
Created by voodoo on August 12, 2010 22:50:41
Last update: August 12, 2010 22:50:41
To see if the current user has execute permission on crypt :
select has_function_privilege('crypt(text, tex...
Created by voodoo on August 12, 2010 22:46:28
Last update: August 12, 2010 22:46:28
To display information about the function crypt :
select * from pg_proc where proname = 'crypt';
...