Monthly Archives: April 2015

ora_te: A simple template engine for Oracle

Just started a new project ora_te at GitHub.
For now it just implements substitution of placeholders so one could write something like

select pk_te.substitute( '$1-$2-$3 $1-$2-$4', pk_te.p( 'Ob', 'la', 'di', 'dah' ) ) p
from dual;
select pk_te.substitute( 
  '{$verb} a {$subject}'
  , pk_te.m( 
    pk_te.p( 'verb', 'Take')
    , pk_te.p( 'subject', 'book' )
  )
) m
from dual;

and get

P
--------------------------------
Ob-la-di Ob-la-dah

1 row selected

M
--------------------------------
Take a book

1 row selected

But more to come. Stay in touch!

AHK: Change mouse speed from command line

Here’s dead simple autohotkey script that enables changing of mouse speed from command line. It comes handy if you are constantly taking your laptop from dock station and switch from mouse to touchpad. Just create a shortcut and you are ready to go. Credits go to SKAN.

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

SPI_GETMOUSESPEED := 0x70
SPI_SETMOUSESPEED := 0x71
SPIF_SENDCHANGE := 0x2 ;Broadcasts the WM_SETTINGCHANGE message after updating the user profile.

Loop, %0%  ; For each parameter:
{
	arg := %A_Index%   ; Fetch the contents of the variable whose name is contained in A_Index.
	if ( arg is number ){
		if ( 0 < arg ) && ( arg <= 20){
			DllCall( "SystemParametersInfo", Int, SPI_SETMOUSESPEED, Int ,0 , UInt, arg, Int, SPIF_SENDCHANGE )	
			ExitApp	
		}
	}
	if ( "get" = arg ){
		DllCall( "SystemParametersInfo", Int, SPI_GETMOUSESPEED, Int, 0, IntP, speed, Int, 0 )	
		MsgBox, Current mouse speed is %speed%. Set it between 1 and 20
		ExitApp
	}
}
MsgBox, Usage:`n`nUse "help" or no arguments to get this message.`nUse "get" parameter to get current mouse speed.`nTo set mouse speed provide a number between 1 and 20 as an argument.
ExitApp