How to use Font Awesome Animation Library in Applications

April 11, 2017 at 6:10 pm | Posted in Oracle Developement | Leave a comment

A very nice blog post about using Fontawesome animations by :

http://apexfusion.blogspot.com/2017/04/how-to-use-font-awesome-animation.html

 

Advertisements

Expose Yourself with ngrok

April 7, 2017 at 9:01 am | Posted in Oracle Developement | Leave a comment

Need to expose a web application behind your firewall to the web? No problem with ngrok. Simply download ngrok and tell it which local port to listen to, and it will provide you with a publicly accessible URL through which you can reach your application.

I’ve tested it with a simple Node.js Hello World application running on my laptop on port 3000 behind my firewall. I then started ngrok with this simple command:

$ ngrok http 3000

Ngrok responded with my new URL and also logged all requests.

ngrok

This is a great tool for development and testing, but definitely use with caution! 😉

 

Live JavaScript logging with Quokka

April 3, 2017 at 1:38 pm | Posted in Oracle Developement | Leave a comment

If you’re using Visual Studio Code for writing JavaScript, the handy Quokka plugin will allow you to preview values at design time.

Add the Quokka extension via the Extensions Marketplace in VS Code.quokka_ext

Then, from the command palette, either create a new JavaScript file through Quokka, or start Quokka for an existing file.quokka2

Now you can attach the special comment /*?*/ to a variable to preview it’s value. Make sure that the comment touches the variable. The preview values will magically show up in the editor and the output console.

quokka3

Here is a live view:

quokka

 

Compile PL/SQL with VS Code using SSH

March 27, 2017 at 8:04 am | Posted in Oracle Developement | Leave a comment

First of all thanks to Morten Braten’s blog post Using VS Code for PL/SQL development. I had been wanting to try this editor for a while but still felt loyal to Sublime.

Morten described how to use Visual Studio Code for PL/SQL development, and how to use its task runner to compile your code via SQL*Plus. I would like to expand on this aspect and show how I used the task runner to compile code through an SSH tunnel via SQLcl. I’m using a Mac, so you may have to do some adjustments for other operating systems.

Basic requirements:

  • SSH key to your database server
  • SQLcl
  • VS Code

First I created an SQL file (bmc_login.sql) (make sure to place it in your SQLPATH) that will log my SQLcl session into my remote database via SSH:

sshtunnel christoph@bmcdb -i /Users/cruepprich/bmc/bmc_key -L 8888:localhost:1521
connect scott/tiger@localhost:8888/orcl

For more information about how this works see OraOpenSource.

Then I needed a shell script (compile_bmc.sh) that the task runner can execute:

~/oracle/sqlcl/bin/sql -S /nolog @bmc_login <

This file calls the SQLcl executable in silent mode (-S) without logging in (/nolog), and runs the bmc_login.sql to connect to the remote database. Then it executes the first command line argument ($1) which it will get from the task runner. Finally it will display any compilation errors and exit.

The last thing to do is to configure the task runner in VS Code. Edit the tasks.json file and add the following task. Note that I’m showing an example with multiple tasks. The task of interest is the one named Compile in bmc.

{
    "version": "0.1.0",
    "tasks": [
        {
            "taskName": "print hello",
            "command": "echo",
            "args": ["Hello"],
            "isShellCommand": true
        },
        {
            "taskName": "Compile in bmc",
            "command": "/Users/cruepprich/sh/compile_bmc.sh",
            "isShellCommand": true,
            "args": ["${file}"]
        }
    ]
}
 The ${file} argument refers to the file you are currently editing. So you want to make sure that you are editing a PL/SQL program and then you can run this task now from the VS Code Command Pallete:
command Pallette
You can also add a keyboard shortcut (ctrl-c) to run this task.
 {
   "key": "ctrl+c",
   "command": "workbench.action.tasks.runTask",
   "args": "Compile in bmc"
 }

Now I can edit PL/SQL programs in VS Code and compile them directly on my remote database via SSH tunnel.

Bulk Updating Interactive Grid Records

March 23, 2017 at 9:36 am | Posted in Oracle Developement | 2 Comments

After my previous post on Updating Interactive Grid Cells, I wanted to try bulk updating IG records.

In this example I want to bulk update the salaries and commissions for the employees. I created a new button called Double Salaries. When the button is clicked, the salaries of the selected employees get doubled. The employees with no salary get a salary of 1000. Sales people will get their commission updated to 10% of their new salary.

Employees are selected by clicking the row selector checkbox of the interactive grid. The interactive grid’s static ID is emps.

The work is done by the JavaScript action of a dynamic action on the Double Salaries button:

var record, sal;
//Identify the particular interactive grid
var ig$     = apex.region("emps").widget();

//Fetch the model for the interactive grid
var grid    = ig$.interactiveGrid("getViews","grid");

//Fetch the model for the interactive grid
var model   = ig$.interactiveGrid("getViews","grid").model;

//Fetch selected records
var selectedRecords = apex.region("emps").widget().interactiveGrid("getViews","grid").view$.grid("getSelectedRecords");

//Loop through selected records and update value of the salary column
for (idx=0; idx &lt; selectedRecords.length; idx++) {
    //Get the record
    record = model.getRecord(selectedRecords[idx][0]);

    //Get the current salary and commision values
    sal  = model.getValue(record,"SAL");
    job  = model.getValue(record,"JOB");
    comm = model.getValue(record,"COMM");

    //If there is no salary, set it to 1000, else double it
    if (sal === '') {
        sal = 1000;
    } else {
        sal = sal * 2;
    }

    //Update the record with doubled salary and new commission
    model.setValue(record,"SAL", sal);


    //Set commission to 10% of salary for sales people
    if (job = 'SALESMAN') {
        comm = sal *.1;
        model.setValue(record,"COMM", comm);
    }

}

emps_bulk

Node Newbie Error – NPM Refusing to Install Package as a Dependency of Itself

March 22, 2017 at 10:36 am | Posted in Oracle Developement | Leave a comment

Source: Node Newbie Error – NPM Refusing to Install Package as a Dependency of Itself

APEX: Updating Interactive Grid Cells

March 9, 2017 at 5:34 pm | Posted in Oracle Developement | 12 Comments

Moving from the old tabular form to the interactive grid takes some getting used to. Especially when trying to manually update cells with JavaScript.

Here is an example of how to access and modify particular cells in an interactive grid with JavaScript. The example promotes an employee when the Promote link is clicked, which doubles the employee’s salary, and assigns him a new job.

First I built an interactive grid on the EMP table. I’ve used all the defaults except:
Enable editing with Update Row.
Set the region’s static ID to emps.
Added a link column with target type: URL, URL: #

ir-link

The link text is set to Promote, and I added class (ig-link) so that I can connect a dynamic action to it:

ig-link2

Next I created a dynamic action that fires when the Promote link is clicked.

ig-da1

The true action is a Execute JavaScript Code action, with the following code:

//Get the link element that was clicked
var $te = $(this.triggeringElement);

//Get the ID of the row
var rowId = $te.closest('tr').data('id');

//Identify the particular interactive grid
var ig$ = apex.region("emps").widget();

//Fetch the model for the interactive grid
var model = ig$.interactiveGrid("getViews","grid").model;

//Fetch the record for the particular rowId
var record = model.getRecord(rowId);

//Access the cell value via the column name
var sal = model.getValue(record,"SAL");

//Set the values for the JOB and SAL cells
model.setValue(record,"JOB",'MANAGER');
model.setValue(record,"SAL",sal*2);

Here is the working example:

emps

It is worth noting that the <tr> element of the interactive grid row contains the row’s unique identifier. This could be a row ID or a primary key value, depending on how you configured the grid.

 

Tuning Tomcat for APEX/ORDS in Production

January 16, 2017 at 10:44 am | Posted in Oracle Developement | Leave a comment

Excellent blog post by Johnathan Dixon about configuring Tomcat for use with ORDS.

http://www.cloudnueva.com/blog/tuning-tomcat-for-apexords-in-production

 

Creating ORDS REST Services with PL/SQL

December 30, 2016 at 11:31 am | Posted in Oracle Developement | Leave a comment

Here is an excellent writeup for creating REST services with PL/SQL:

https://oracle-base.com/articles/misc/oracle-rest-data-services-ords-create-basic-rest-web-services-using-plsql

 

SQL*Plus Error OID generation failed

November 21, 2016 at 9:40 am | Posted in Oracle Developement | Leave a comment

I received this error on a MacBook, when trying to connect with SQL*Plus to my database:

SQL*Plus: Release 12.1.0.2.0 Production on Mon Nov 21 08:27:22 2016

Copyright (c) 1982, 2016, Oracle. All rights reserved.

ERROR:
ORA-21561: OID generation failed

The issue comes from not having the MacBook’s hostname associated with the home IP address. To fix this, simply find your hostname:

~$ hostname
MY_MACBOOK

Then edit your /etc/hosts file and add the home name to the home IP address:

127.0.0.1       localhost MY_MACBOOK

Also make sure that when you edit the hosts file, that you are not connected to a VPN. Some VPN clients may overwrite the hosts file.

 

« Previous PageNext Page »


Entries and comments feeds.