Monday, October 25, 2010

Oracle FIXED_DATE Parameter

FIXED_DATE enables you to set a constant date that SYSDATE will always return instead of the current date. 

To undo a fixed date setting, specify FIXED_DATE=NONE

This parameter is useful primarily for testing. 

The value can be in the format shown above or in the default Oracle date format, without a time.

Testing against a fixed date in Oracle?
Testing against a fixed date is easy in Oracle. Here is one example demonstrating use of FIXED_DATE parameter.

Assuming you wanted to set a date Jan 1, 2010 in your database.

SQL> Select sysdate from dual ;
This will display the current system date
SQL> Alter System Set Fixed_Date='01-Jan-2010' ;
SQL> Select sysdate from dual ;
This will display the system date as '01-Jan-2010'
The above Alter command can change the current sysdate to the date given.

To change the sysdate to the original date.
SQL> Alter System set fixed_date='none' ;
SQL> Select sysdate from dual ;
This will display the current system date

Wednesday, October 20, 2010

Password strength meter in APEX

Step-1:
On page HTML Header write the following code

<style>
#passwordStrength
{
        height:10px;
        display:block;
        float:left;
}
.strength0
{
        width:250px;
        background:#cccccc;
}
.strength1
{
        width:50px;
        background:#ff0000;
}
.strength2
{
        width:100px;   
        background:#ff5f5f;
}
.strength3
{
        width:150px;
        background:#56e500;
}
.strength4
{
        background:#4dcd00;
        width:200px;
}
.strength5
{
        background:#399800;
        width:250px;
}
</style>
Step-2:
On password item P10_PASSWORD

 HTML Form element attribute: onkeyup="return passwordChanged();"

Step-3:
Create an item  P10_PASSWORD_STRENGTH on right side of password item.

Display As: Display as text(escape special characters, does not save state)
Pre Element Text: 
<script language="javascript">
function passwordChanged(){
var pwd = document.getElementById('P10_PASSWORD_STRENGTH');
var password = document.getElementById("P10_PASSWORD").value;
var desc = new Array();
        desc[0] = "Very Weak";
        desc[1] = "Weak";
        desc[2] = "Better";
        desc[3] = "Medium";
        desc[4] = "Strong";
        desc[5] = "Strongest";
        var score   = 0;
        if (password.length > 6) score++;
        if ( ( password.match(/[a-z]/) ) && ( password.match(/[A-Z]/) ) ) score++;
        if (password.match(/\d+/)) score++;
        if ( password.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/) ) score++;
        if (password.length > 12) score++;
        document.getElementById("passwordDescription").innerHTML = desc[score];
        if (password.length==0) {
             document.getElementById("passwordDescription").innerHTML  = 'Password not entered';
       }
      document.getElementById("passwordStrength").className = "strength" + score;
}
</script>
Post Element Text:
<div id="passwordDescription">Password not entered</div>
<div id="passwordStrength" class="strength0">
</div>

Demo Example:  http://apex.oracle.com/pls/apex/f?p=KP:PSM

Refer http://www.codeassembly.com/How-to-make-a-password-strength-meter-for-your-register-form for more info.

Final output:



Thanks




Saturday, October 16, 2010

Some usefull plugins For Oracle APEX 4.0

Some usefull plugins from http://www.apex-plugin.com/ For Oracle APEX 4.0


Text Field with Masked Input
This is an APEX integration of the jQuery Masked Input Plugin created by Josh Bush (www.digitalbush.com). It allows you to force data input in a fixed format.

SkillBuilders IR Header Float
Interactive Reports are powerful reports in APEX that allow end users to customize reports to meet their needs. However, as with most other reports, viewing many rows at once requires users to scroll down the web page. As users scroll down, the report headers scroll out of site which can cause users to lose the context of the data being viewed – especially if the data involves lots of data and/or numbers.

Google Directions
This plugin provides the Google driving directions, route map, estimated distance and travel time based on two provided locations. This is an adaptation of Botoka's Google Map.

Form Validator
This dynamic action plug-in provides client-side form validation. The validation rules are based on the Apex Dictionary, like required items, number items (min/max values) and date items.

MBNDATA Tabs
Region plugin using jquery tabs.

SkillBuilders Save Before Exit
Have you ever filled out a form and accidentally left the page without saving your work? It is actually quite easy to do. Thankfully, browsers have features to help prevent this from happening. The problem, however, is that taking advantage of those features can be quite difficult - until now.

Sumneva Drag & Drop Report
This plug-in creates an AJAX enabled Drag & Drop Report from a SQL Query (and a few other bits and bobs) supplied by the user.

SkillBuilders Schedule
Event scheduling is a common task that developers repeatedly face when creating applications. The types of events can vary greatly as can their configuration options. Some events are simple, occurring only once while others are more complex and can repeat indefinitely.

Tokenizing-Autocomplete
A facebook style autocomplete text field.