Oracle Date to Unix Timestamp Function

create or replace
FUNCTION DATE_TO_UNIX_TS (theDate IN DATE) RETURN NUMBER IS l_unix_ts NUMBER;
BEGIN l_unix_ts := (theDate – DATE ‚1970-01-01‘)*60*60*24;
RETURN l_unix_ts;
END;

Veröffentlicht unter Allgemein

select from comma separated string

FOR a IN (
select regexp_substr(p_to,'[^,]+‘,1,level) recipient
from dual
connect by level <= length(regexp_replace(p_to,'[^,]+‘)) + 1 )
LOOP
utl_smtp.rcpt( l_connection, a.recipient);
end loop;

Veröffentlicht unter Allgemein

using Maven with a Proxy

Configure Maven to use Proxy (if needed)

edit ${user.home}/.m2/settings.xml

<settings>
.
.
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>proxy.somewhere.com</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>www.google.com|*.somewhere.com</nonProxyHosts>
</proxy>
</proxies>
.
.
</settings>

Veröffentlicht unter Allgemein

TDD with Winginx, pear and Yii 1.1

  • Install Winginx and Yii into „Winginx\home\localhost\public_html“
  • Download pear as described in this post, then:
** WARNING! Old version found at C:\Winginx\php5, please remove it or be sure to
 use the new c:\winginx\php5\pear.bat command

The 'pear' command is now at your service at c:\winginx\php5\pear.bat

C:\Winginx\php5>pear upgrade pear
pear/pear is already installed and is the same as the released version 1.9.5
upgrade failed

C:\Winginx\php5>pear channel-discover pear.phpunit.de
Adding Channel "pear.phpunit.de" succeeded
Discovery of channel "pear.phpunit.de" succeeded

C:\Winginx\php5>pear install phpunit/PHPUnit
downloading PHPUnit-4.0.17.tgz ...
Starting to download PHPUnit-4.0.17.tgz (509,430 bytes)
................................................................................
......................done: 509,430 bytes
install ok: channel://pear.phpunit.de/PHPUnit-4.0.17

C:\Winginx\php5>pear install phpunit/PHPUnit_Selenium
downloading PHPUnit_Selenium-1.3.3.tgz ...
Starting to download PHPUnit_Selenium-1.3.3.tgz (44,772 bytes)
............done: 44,772 bytes
install ok: channel://pear.phpunit.de/PHPUnit_Selenium-1.3.3

Very useful information about TDD with Yii can be found in „Agile Web Application Development with Yii 1.1 and PHP5“.

 

Veröffentlicht unter Allgemein

Protocol Handler Launcher

; #########################################################################

; Launches a Program when registered as a Protocol Handler
; The protocol is stripped from the argument (here hardcoded 7 digits "abcdef:")

; #########################################################################

.386
.model flat, stdcall ; 32 bit memory model
option casemap :none ; case sensitive

include \MASM32\INCLUDE\windows.inc
include \MASM32\INCLUDE\kernel32.inc
include \MASM32\INCLUDE\shell32.inc
include \MASM32\INCLUDE\masm32.inc
include \masm32\macros\macros.asm

includelib \MASM32\LIB\kernel32.lib
includelib \MASM32\LIB\shell32.lib
includelib \MASM32\LIB\masm32.lib

Init PROTO
; #########################################################################

.data
open db "open",0
dir db 512 dup (0) ; buffer for command line
file db 1024 dup (0) ; buffer for the file to open
protocol db 64 dup (0) ; buffer for the Protocol Handler part

.code

start:

invoke GetCL,1,ADDR dir
invoke GetCL,2,ADDR file

mov edi, ptr$(protocol) ; put pointer to protocol
invoke ShellExecute,0,ADDR open,ADDR dir,ADDR file+7,NULL,SW_SHOW ; strip calldw:
invoke ExitProcess,eax

end start

; #########################################################################

Veröffentlicht unter Allgemein

lessfilter


#!/bin/sh
case "$1" in
*.e)
enscript --color --language=ansi --highlight=eiffel -o - -q "$1"
;;
*akefile | *akefile.in | *akefile.am)
enscript --color --language=ansi --highlight=makefile -o - -q "$1"
;;
*.cc | *.C | *.hh | *.hxx | *.cpp | *.hpp | *.yy | *.ll)
enscript --color --language=ansi --highlight=cpp -o - -q "$1"
;;
*.c | *.h | *.y | *.l | *.php)
enscript --color --language=ansi --highlight=c -o - -q "$1"
;;
*.sh)
enscript --color --language=ansi --highlight=sh -o - -q "$1"
;;
*.tex)
enscript --color --language=ansi --highlight=tex -o - -q "$1"
;;
*.el)
enscript --color --language=ansi --highlight=elisp -o - -q "$1"
;;
*.pl | *.pm)
enscript --color --language=ansi --highlight=perl -o - -q "$1"
;;
*.ada | *.ads | *.adb)
enscript --color --language=ansi --highlight=ada -o - -q "$1"
;;
*.m | *.mi)
enscript --color --language=ansi --highlight=objc -o - -q "$1"
;;
*.idl)
enscript --color --language=ansi --highlight=idl -o - -q "$1"
;;
*.inf)
enscript --color --language=ansi --highlight=inf -o - -q "$1"
;;
*.awk)
enscript --color --language=ansi --highlight=awk -o - -q "$1"
;;
*.bash)
enscript --color --language=ansi --highlight=bash -o - -q "$1"
;;
*.csh)
enscript --color --language=ansi --highlight=csh -o - -q "$1"
;;
*.ksh)
enscript --color --language=ansi --highlight=ksh -o - -q "$1"
;;
*.sql)
enscript --color --language=ansi --highlight=sql -o - -q "$1"
;;
*.pas | *.dpk | *.pce)
enscript --color --language=ansi --highlight=delphi -o - -q "$1"
;;
*.java)
enscript --color --language=ansi --highlight=java -o - -q "$1"
;;
*.f | *.for | *.FOR | *.F | *.fpp | *.FPP)
enscript --color --language=ansi --highlight=fortran -o - -q "$1"
;;
*.lhs | *.hs)
enscript --color --language=ansi --highlight=haskell -o - -q "$1"
;;
*.m4)
enscript --color --language=ansi --highlight=m4 -o - -q "$1"
;;
*.js)
enscript --color --language=ansi --highlight=javascript -o - -q "$1"
;;
*.vhdl)
enscript --color --language=ansi --highlight=vhdl -o - -q "$1"
;;
*.vrml)
enscript --color --language=ansi --highlight=vrml -o - -q "$1"
;;
Changelog)
enscript --color --language=ansi --highlight=changelog -o - -q "$1"
;;
*.html | *.htm)
html2text "$1"
;;
*.ps | *.pdf)
pstotext "$1"
;;
*.patch.gz | *.diff.gz)
gunzip -c "$1" | enscript --color --language=ansi --highlight=diff -o - -q -
;;
*.patch | *.diff)
enscript --color --language=ansi --highlight=diff -o - -q "$1"
;;
*) # We don't handle this format.
exit 1
;;
esac
# No further processing by lesspipe necessary
exit 0

Veröffentlicht unter Allgemein

bashrc File

There is a bashrc with some handy config:

copy code from bashrc.txt to ~/.bashrc

– you have to adjust passwords in alias lines – if you want colorful code formatting in less, you need to install enscript during cygwin setup, and copy code from lessfilter.txt to ~/.lessfilter make ~/.lessfilter executable ( chmod 0755 )


# base-files version 3.9-3

# To pick up the latest recommended .bashrc content,
# look in /etc/defaults/etc/skel/.bashrc

# Modifying /etc/skel/.bashrc directly will prevent
# setup from updating it.

# The copy in your home directory (~/.bashrc) is yours, please
# feel free to customise it to create a shell
# environment to your liking. If you feel a change
# would be benificial to all, please feel free to send
# a patch to the cygwin mailing list.

# User dependent .bashrc file

# Environment Variables
# #####################

# TMP and TEMP are defined in the Windows environment. Leaving
# them set to the default Windows temporary directory can have
# unexpected consequences.
unset TMP
unset TEMP

# Alternatively, set them to the Cygwin temporary directory
# or to any other tmp directory of your choice
# export TMP=/tmp
# export TEMP=/tmp

# Or use TMPDIR instead
# export TMPDIR=/tmp

export LESSOPEN='|~/.lessfilter %s 2>&-'

export LESS='-M -i -N -w -z-4 -g -e -M -X -F -R -P%t?f%f \
:stdin .?pb%pb\%:?lbLine %lb:?bbByte %bb:-...'

# Shell Options
# #############

# See man bash for more options...

# Don't wait for job termination notification
# set -o notify

# Don't use ^D to exit
# set -o ignoreeof

# Use case-insensitive filename globbing
# shopt -s nocaseglob

# Make bash append rather than overwrite the history on disk
# shopt -s histappend

# When changing directory small typos can be ignored by bash
# for example, cd /vr/lgo/apaache would find /var/log/apache
# shopt -s cdspell

# Completion options
# ##################

# These completion tuning parameters change the default behavior of bash_completion:

# Define to access remotely checked-out files over passwordless ssh for CVS
# COMP_CVS_REMOTE=1

# Define to avoid stripping description in --option=description of './configure --help'
# COMP_CONFIGURE_HINTS=1

# Define to avoid flattening internal contents of tar files
# COMP_TAR_INTERNAL_PATHS=1

# If this shell is interactive, turn on programmable completion enhancements.
# Any completions you add in ~/.bash_completion are sourced last.
# case $- in
# *i*) [[ -f /etc/bash_completion ]] && . /etc/bash_completion ;;
# esac

# History Options
# ###############

# Don't put duplicate lines in the history.
# export HISTCONTROL="ignoredups"

# Ignore some controlling instructions
# HISTIGNORE is a colon-delimited list of patterns which should be excluded.
# The '&' is a special pattern which suppresses duplicate entries.
# export HISTIGNORE=$'[ \t]*:&:[fb]g:exit'
# export HISTIGNORE=$'[ \t]*:&:[fb]g:exit:ls' # Ignore the ls command as well

# Whenever displaying the prompt, write the previous line to disk
# export PROMPT_COMMAND="history -a"

# Aliases
# #######

# Some example alias instructions
# If these are enabled they will be used instead of any instructions
# they may mask. For example, alias rm='rm -i' will mask the rm
# application. To override the alias instruction use a \ before, ie
# \rm will call the real rm not the alias.

# Interactive operation...
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'

# Default to human readable figures
# alias df='df -h'
# alias du='du -h'

# Misc :)
# alias less='less -r' # raw control characters
# alias whence='type -a' # where, of a sort
# alias grep='grep --color' # show differences in colour

# Some shortcuts for different directory listings
# alias ls='ls -hF --color=tty' # classify files in colour
# alias dir='ls --color=auto --format=vertical'
# alias vdir='ls --color=auto --format=long'
# alias ll='ls -l' # long list
# alias la='ls -A' # all but . and ..
# alias l='ls -CF' #

###########################################
# my aliases
###########################################
alias s="cd /cygdrive/d/RolloutToolSVN75/Shipments"
alias l="ls -ltr";
alias t1="sqlplus sa/ @tcrm01"
alias t2="sqlplus sa/ @tcrm02"
alias d4="sqlplus sa/ @dcrm04"
alias d5="sqlplus sa/ @dcrm05"

alias less='/bin/less -r'
alias ls='/bin/ls -F --color=auto --show-control-chars'
alias grep='grep --color=auto'

# Functions
# #########

# Some example functions
# function settitle() { echo -ne "\e]2;$@\a\e]1;$@\a"; }

Veröffentlicht unter Allgemein