Capture Sound from Sound Card in Mac OS

                                                                                                  
1. Download and install SoundFlower.
2. Configure sound output to Soundflower in Sound configuration panel of System Properties.
3. Open your sound recording software, i.e. Audacity, and choose input device is Soundflower.
4. Start recording. During the recording you will not heard sound coming from your speaker, but the sound will be captured by the software since we re-drect the sound to Soundflower 

A way to install Google Chrome on CentOS 6

Download a install script, written by Richard. For more information, go to http://chrome.richardlloyd.org.uk.
wget http://chrome.richardlloyd.org.uk/install_chrome.sh
chmod u+x install_chrome.sh
sudo ./install_chrome.sh  -d -s
# -s, install stable version
# -d, delete temporary files in install successfully.

Oracle Apex APP:Change Default Page after Logging in

Change Home URL in Shared Components: Shared Components >User Interface Attributes > Click: Desktop link or Mobile -> change value in “Home URL”

Hide Default Homepage for Tomcat

To hide default homepage for Tomcat we could redirect default homepage to other page
 
# Make a backup of the old homepage
cd /CATALINA_HOME/webapps/ROOT
mv index.html index.html.bak
# create a new index.html file and put the following contents in index.html file
touch index.html
vim index.html
and contents are
 
<head>
<meta http-equiv="refresh" content="0;URL=your_new_default_homepage">
</head>
<body>
</body>
</html>

Uncheck All Checkbox on Page Load for Apex Page Using Javascript

1. Put the following javascript function at "Function and Global Variable Declaration" of page attributes.
 function UncheckAll(){ 
      var w = document.getElementsByTagName('input'); 
      for(var i = 0; i < w.length; i++){ 
        if(w[i].type=='checkbox'){ 
          w[i].checked = false; 
        }
      }
  } 
2. Create page dynamics
  Event: Page Load
  Condition: No Condition
  Action: Eecute Javascript Code
  Code: UncheckAll()
  
Locate and open the true event "Execute Javascript Code" of create dynamic action, check "Fire On Page Load"

Display Binary Data in Oracle Apex using Checkbox


We want to use checkbox to display a column in interactive report, which contains binary data 0 and 1.

Solution 1: Not perfect. This will cause problem in exported CSV file

In Region Source for interactive report, using CASE function to format this filed.

select t1.sponsor,
CASE
    WHEN T1.EXPERIENCE = 1 THEN 'checked=checked'
END AS EXPERIENCE_CHECKBOX
from sponsor t1
Then add
<input type="checkbox" disabled readonly #EXPERIENCE_CHECKBOX# />
to HTML Expression of EXPERIENCE_CHECKBOX column formatting.

 

This solution works fine by looking. However, you will notice problem in downloaded file, the content of experience column was replaced by checked="checked" and null, not original values of 0 and 1.

Solution 2: a Better solution

Use a pl/sql function to format filed content based on request type.
CREATE OR REPLACE FUNCTION FORMAT_STRING (P_INT       IN INT,
                                          P_REQUEST   IN VARCHAR2)
   RETURN VARCHAR2
IS
   V_STRING   VARCHAR2 (40);
BEGIN
   IF P_REQUEST NOT IN ('HTMLD', 'XLS', 'CSV') OR P_REQUEST IS NULL
   THEN
      IF P_INT = 1 -- or whatever value used to indicate checked
      THEN
         V_STRING := 'checked=checked';
      END IF;
   ELSE
      V_STRING := P_INT;
   END IF;

   RETURN V_STRING;
EXCEPTION
   WHEN OTHERS
   THEN
      RAISE;
END FORMAT_STRING;

In Region Source for interactive report, use FORMAT_STRING function to format experience field.
select t1.sponsor, format_string(T1.experience, :request) EXPERIENCE_CHECKBOX from sponsor t1
Also add
<input type="checkbox" disabled readonly #EXPERIENCE_CHECKBOX# />
to HTML Expression of EXPERIENCE_CHECKBOX column formatting.

Final Product

Hide/Show Long Column Content in Oracle Apex Report

I used the following method to hide the extra long column contents when loading the page. The contents will then display when mouse hover the content.
Figure 1: Before applying CSS

Figure 2: After applying CSS

1. In the column attributes page, column Formatting section, add the following to HTML Expression text area for the column to modify:
<div>#COLUMN_NAME#</div> 
COLUMN_NAME is the name of the column to which you want to apply these css property.

2. Add the following style sheet to the report page Inline CSS property (replace "COLUMN_NAME" accordingly):
  
td[headers="COLUMN_NAME"] div {
          width: 15EM;
          white-SPACE: nowrap;
          OVERFLOW: hidden;
          text-OVERFLOW: ellipsis;
}

td[headers="COLUMN_NAME"] div:hover {
      width: 15EM;
      white-SPACE: NORMAL;
      OVERFLOW: VISIBLE;
}

Upgrade Oracle Apex from 4.2.x to 5.0 on CentOS

Here is a tutorial of how to upgrade APEX from version 4.2.x to version 4.2.5.

1. Download the latest version of Application Express from the Oracle Technology Network and Unzip the downloaded file:
#unzip files to /tmp folder
unzip apex_5.0_en.zip -d /tmp
#change the working directory to unzip folder
cd /tmp/apex
2. Start SQL*Plus and connect to the Oracle XE database:
sqlplus / as sysdba 
3. Install Application Express:
SQL> @apexins SYSAUX SYSAUX TEMP /i/
4. Updating the images directory
@apex_epg_config.sql /tmp
5. If you are using ORDS, copy images to your application server. I am using Tomcat,
sudo cp /tmp/apex/images/* /var/lib/tomcat6/webapps/i/
6. Prepare two new database accounts for ORDS
@apex_rest_config.sql
when prompted enter password for these two accounts:
APEX_LISTENER: APEXLISTENER
APEX_REST_PUBLIC_USER:APEXREST
7. Modify account profiles for APEX_PUBLIC_USER,APEX_LISTENER,APEX_REST_PUBLIC_USER to disable password expire:
# UNLIMITED_PASSWORD_LIFETIMEhas been created
alter USER APEX_PUBLIC_USER PROFILE UNLIMITED_PASSWORD_LIFETIME;
alter USER APEX_LISTENER PROFILE UNLIMITED_PASSWORD_LIFETIME;
alter USER APEX_REST_PUBLIC_USER PROFILE UNLIMITED_PASSWORD_LIFETIME;
8. Modify instance admin password if you wish. Old password is preserved and carried over.
SQL> @apxchpwd
Enter password for Application Express ADMIN account.
9. In a Web browser, navigate to the Oracle Application Express Administration Services application:
http://127.0.0.1:8080/apex/apex_admin
In Username, enter ADMIN
In Password, enter the password entered in (Step 8.)

Problems and Solution:
1. Q.There is a problem with your environment because the Application Exress files have not been loaded....

A. Copy files in /tmp/apex/images/* to your web application folder, see step (5.)

2. Q. There are issues with the configuration of the Static Files in your environment. Please ...

A. Have you run @apex_rest_config.sql to preapre the accounts required for ORDS? Step (6.)

Set Column Data No-Wrap for Oracle Apex Interactive Report

To set column data no wrap for Oracle Apex Interactive report, copy the following line into page css set up inline box:
table.apexir_WORKSHEET_DATA td {white-space:nowrap;}

Left Align Oracle Apex (Sub-)regions

How to left align Oracle sub-regions

Create more than one sub-regions, for example 3 of them, namely query1, query2 and query3. Modify grid layout and region attributes for each of sub-regions.
Query 1:
Start New Grid: NO
Start new Row: NO
Column: 1
Column Span: Automatic
Column Attributes: style="width:420px;"
Region Attributes: style="width:400px;height:150px;background-color:#DEE9E8;"

Query 2:
Start New Grid: NO
Start new Row: NO
Column: 2
Column Span: Automatic
Column Attributes: style="width:420px;"
Region Attributes: style="width:400px;height:150px;background-color:#F9FDD9;"
Query 3:
Start New Grid: NO
Start new Row: NO
Column: 3
Column Span: Automatic
Column Attributes: (left blank)
Region Attributes: style="width:400px;height:150px;background-color:#CEF6CE;"
In this example column width (420px) is larger than the region width (400px), therefore there are spaces between two regions. Column attributes for the last sub-region is left blank, to make the 100% table width.

Add another schema to Oracle Apex application

Case One
The following procedure is good if you have admin account for Internal workspace.
1. Log into Internal workspace with admin account.
2. Go to Manage Workspace

3. Choose "Manage Workspace to Schema Assignments" under "Workspace Actions"
 
4. Add Schema >> Existing >> Select the workspace, to which you are adding schema >> choose the schema you want to add

Case Two
If you have Apex application admin account
1. Go to the application, to which you want to add schema.
2. Click administration
3. Choose manage service

4. Make a service request
 
5. Request Schema >> fill in the content accordingly Wait for Apex administration to approve your request.


Now, we have added the schema to Apex application, there is two more things we need to do:
1) granting select previlege to your application PARSING_SCHEMA. The parsing schema is the schema you defined when creating or importing an Apex application. An internal workspace administrator could find it for you if you do not know.
connect / as sysdba
grant select on schema_name.table_name to PARSING_SCHEMA;
2) make sure you use fully qualified table names, i.e. prefix the object name with the schema name, when querying tables from non-parsing_schema.

Datatable static image not found on the server

When you use ```datatables.min.css``` and ```datatables.min.js``` locally, instead of datatables CDN, you may have encountered that ```sort...