CoinHive

Wednesday, April 5, 2017

Recover a deleted Apex page

Sometimes, actually more than sometimes I delete stuff that should not have been deleted. I guess working with SVN and good old windows Ctrl + Z spoiled me.
So when I deleted an important page I initially thought Apex also had an "magically get my page back and save my ass" functionality.
Newsflash: Apex does not have that! ... Or does it? :)
After some googling around I found an article by Peter Raganitsch explaining how to "hack" the export page functionality to do exactly this.
Check the article for a detailed explanation and pictures. It references Apex 4, but the method is still applicable.
In simple steps:
  1. Head over to the export Page functionality
  2. Use Inspect Element on the Page select list, because your deleted page will not be in the list.
  3. Edit the HTML to add your deleted page
  4. Use the "As of xx minutes ago" field to go back in time
  5. Press the export page button and witness the magic
This functionality uses Oracle's FLASHBACK functionality, so how far you can go back is dictated by related settings. Your mileage may vary.




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.