CoinHive

Thursday, January 5, 2017

Run sql commands from Notepad++

Notepad++ is the standard and favorite text editor for a lot of us, including me. At one time I thought that it would be great if i could run sql statements straight from Notepad++, because it's the default application that opens all my .sql files.
 Lo and behold, the nice guys at Toadworld already found out how and cared enough to post it years ago. Here are the steps copy-pasted from their article:

  1. Launch Notepad++
  2. Main menu → Plugins → Plugin Manager → Show Plugin Manager
  3. Available Tab, Find and check NppExec plugin (see Figure 3 below)
  4. Press Install button to download & install plugin – restarts Notepad++
  5. Open a SQL script
  6. Press F6 key (NppExec’s default execute keyboard mapping)
  7. Enter the following macro script into the Execute pop-up (see Figure 4 below)

    set ORA_USER=bert
    set ORA_PASS=bert1234

    set ORA_SID= ORCL
    npp_save
    cmd /c copy /y "$(CURRENT_DIRECTORY)\$(FILE_NAME)" "$(SYS.TEMP)\$(FILE_NAME)" >nul 2>&1
    cmd /c echo. >> "$(SYS.TEMP)\$(FILE_NAME)"cmd /c echo exit >> "$(SYS.TEMP)\$(FILE_NAME)"sqlplus -l $(ORA_USER)/$(ORA_PASS)@$(ORA_SID) @"$(SYS.TEMP)\$(FILE_NAME)"
     
  8. Change the first three variables for your database, username and password
  9. Press the OK button
 That's all there is to it!

Just replace "bert" with the schema username, "bert1234" is the password and "ORCL" is the SID eg:
set ORA_USER=hr
set ORA_PASS=hr

set ORA_SID=172.19.2.155/XE
Hit enter and see the magic. Don't forget to check the original article. It has a better explanation and also ... pictures!! Yay!

Wednesday, January 4, 2017

Textfield in upper or lower case

In most applications you would like to keep some text fields in upper case. For example: car license plates, ID numbers, passport numbers etc.

We can achieve this with a simple javascript in the custom attributes of the field.
onKeyUp="this.value=this.value.toUpperCase();"
Or similarly for lower case:
 onKeyUp="this.value=this.value.toLowerCase();"
See example here.

EDIT 24-apr-2018:
Alternatively we could also use CSS to display textfields in upper or lower case with:
 u-textUpper u-textLower
Be advised though, this only changes the display.