EDIT_TEXTITEM built-in  Oracle D2k

Description
Invokes the Runform item editor for the current text item and puts the form in Edit mode.
Syntax
PROCEDURE EDIT_TEXTITEM;
PROCEDURE EDIT_TEXTITEM
(x NUMBER,
y NUMBER);
PROCEDURE EDIT_TEXTITEM
(x NUMBER,
y NUMBER,
width, NUMBER
height NUMBER);

You can use the optional EDIT_TEXTITEM parameters to specify the location and dimensions of the
pop-up window with which the item editor is associated. If you do not use these parameters, Form
Builder invokes the item editor with its default location and dimensions.
EDIT_TEXTITEM restrictions
·  The Width must be at least wide enough to display the buttons at the bottom of the editor window.
EDIT_TEXTITEM examples
/*
** Built-in: EDIT_TEXTITEM
** Example: Determine the x-position of the current item
** then bring up the editor either on the left
** side or right side of the screen so as to not
** cover the item on the screen.
*/
DECLARE
itm_x_pos NUMBER;
BEGIN
itm_x_pos := Get_Item_Property(:System.Cursor_Item,X_POS);
IF itm_x_pos > 40 THEN
Edit_TextItem(1,1,20,8);
ELSE
Edit_TextItem(60,1,20,8);
END IF;
END;

Dec. 21, 2012, won't be the end of the world as we know, however, it will be another winter solstice, says NASA.

The world will not end in 2012. Our planet has been getting along just fine for more than 4 billion years, and credible scientists worldwide know of no threat associated with 2012.Actually the story started with claims that Nibiru, a supposed planet discovered by the Sumerians, is headed toward Earth. This catastrophe was initially predicted for May 2003, but when nothing happened the doomsday date was moved forward to December 2012 and linked to the end of one of the cycles in the ancient Mayan calendar at the winter solstice in 2012 -- hence the predicted doomsday date of December 21, 2012.

About Polar Shift

A reversal in the rotation of Earth is impossible. There are slow movements of the continents (for example Antarctica was near the equator hundreds of millions of years ago), but that is irrelevant to claims of reversal of the rotational poles. However, many of the disaster websites pull a bait-and-switch to fool people. They claim a relationship between the rotation and the magnetic polarity of Earth, which does change irregularly, with a magnetic reversal taking place every 400,000 years on average. As far as we know, such a magnetic reversal doesn’t cause any harm to life on Earth. Scientists believe a magnetic reversal is very unlikely to happen in the next few millennia.

So don't worry, keep on preparing to celebrate Christmas with joy and hope. Halleluiah.

 

Pre-Query trigger in Oracle D2k / Oracle Forms

Description
Fires during Execute Query or Count Query processing, just before Form Builder constructs and issues
the SELECT statement to identify rows that match the query criteria.
Definition Level form or block
Legal Commands
SELECT statements, unrestricted built-ins
Enter Query Mode no

See also: Define Custom Filter Using Pre-Query Trigger

Usage Notes
Use a Pre-Query trigger to modify the example record that determines which rows will be identified by
the query.
On Failure
The query is canceled. If the operator or the application had placed the form in Enter Query mode, the
form remains in Enter Query mode.
Fires In
COUNT_QUERY
EXECUTE_QUERY
Open the Query
Prepare the Query
See Process Flowcharts
Pre-Query trigger examples
Example
This example validates or modifies query criteria for a database block query.
BEGIN
/*
** Set the ORDER BY clause for the current block
** being queried, based on a radio group
** called ’Sort_Column’ in a control block named
** ’Switches’. The Radio Group has three buttons
** with character values giving the names of
** three different columns in the table this
** block is based on:
**
** SAL
** MGR,ENAME
** ENAME
*/
Set_Block_Property(’EMP’,ORDER_BY, :Switches.Sort_Column);
/*
** Make sure the user has given one of the two
** Columns which we have indexed in their search
** criteria, otherwise fail the query with a helpful
** message
*/
IF :Employee.Ename IS NULL AND :Employee.Mgr IS NULL THEN
Message(’Supply Employee Name and/or Manager Id ’||
’for Query.’);
RAISE Form_trigger_Failure;
END IF;
/*
** Change the default where clause to either show "Current
** Employees Only" or "Terminated Employees" based on the
** setting of a check box named ’Show_Term’ in a control
** block named ’Switches’.
*/
IF Check box_Checked(’Switches.Show_Term’) THEN
Set_Block_Property(’EMP’,DEFAULT_WHERE,’TERM_DATE IS NOT
NULL’);
ELSE
Set_Block_Property(’EMP’,DEFAULT_WHERE,’TERM_DATE IS NULL’);
END IF;
END;

GET_LOV_PROPERTY built-in Oracle D2k

Description
Returns information about a specified list of values (LOV).
You must issue a call to the built-in once for each property value you want to retrieve.
Syntax
FUNCTION GET_LOV_PROPERTY
(lov_id, property LOV);
FUNCTION GET_LOV_PROPERTY
(lov_name VARCHAR2,
property NUMBER);
Built-in Type unrestricted function
Returns VARCHAR2
Enter Query Mode yes
Parameters
lov_id Specifies the unique ID that Form Builder assigns the object at the time it
creates it. Use the FIND_LOV built-in to return the ID to an appropriately
typed variable. The data type of the ID is LOV.
lov_name Specifies the name that you gave the object when creating it.
property Specifies the property you want to set for the given LOV. The possible
properties are as follows:
AUTO_REFRESH Returns the VARCHAR2 string TRUE if the property
is set to Yes; that is, if Form Builder re-executes the query each time the
LOV is invoked. Returns the VARCHAR2 string FALSE if the property is
set to No.
GROUP_NAME Returns the name of the record group currently
associated with this LOV. The data type of the name is VARCHAR2.
HEIGHT Returns the height of the LOV. The size of the units depends
on the Coordinate System and default font scaling you specified for the
form.
WIDTH Returns the width of the LOV. The size of the units depends on
the Coordinate System and default font scaling you specified for the form.
X_POS Returns the x coordinate that reflects the current placement of the
LOV’s upper left corner relative to the upper left corner of the screen.
Y_POS Returns the y coordinate that reflects the current placement of the
LOV’s upper left corner relative to the upper left corner of the screen.
GET_LOV_PROPERTY examples
/*
** Built-in: GET_LOV_PROPERTY
** Example: Can get the width/height of the LOV.
*/
DECLARE
the_width NUMBER;
the_height NUMBER;
lov_id LOV;
BEGIN
lov_id := Find_LOV(’My_LOV_1’);
the_width := Get_LOV_Property(lov_id, WIDTH);
the_height := Get_LOV_Property(lov_id,HEIGHT);
END;

This is a requirement when columns from multiple tables must be displayed in the block and the conditions for selecting the individual columns vary. Specifying a SELECT instead of a base table has the following advantages:
  • A database view can be eliminated.
  • Multilevel look-up columns and look-ups based on mutually non-related column sets can figure as part of the same record, thus eliminating the use of a POST-QUERY, which would have been costly otherwise.
  • Sorting and ad hoc querying on foreign key look-up columns are easily implemented as a base table operation.
Although an explicit option in Forms 5.x and above, you could indirectly base a block on a FROM clause QUERY in Forms 4.5. In Forms 4.5, you specify a SELECT statement to substitute a table name as a base table (that is, in the FROM clause).
Specify a SELECT statement involving multiple table joins instead of a base table for a block, provided that the SELECT statement is specified within single parentheses. Column ambiguity is not automatically resolved. In Forms 4.5, enclose this SELECT statement within parentheses.
The Query Database Source columns have to be specified in the block's Property Palette. This can be done by using the Data Block Wizard or by using the block Property Palette when creating the block manually.
The WHERE condition has to be specified properly and should be contained as part of the INLINE query instead of the DEFAULT_WHERE for the block, especially when selecting mutually non-related column sets and joining on non–foreign key columns. Consider the SELECT statement:

(SELECT DEPT.DEPTNO, DNAME, EMP.EMPNO, ENAME, JOB, HIREDATE, SAL
FROM   EMP, DEPT
WHERE EMP.DEPTNO = DEPT.DEPTNO)

This SELECT should be specified as it is (in Forms 4.5, also) rather than specifying EMP as the base table with DNAME as a foreign key look-up column. (This is the second method referred to in Chapter 1 for querying by nonbase table items.)
Here is an additional tip that will help as you work with base tables based on a FROM clause query:
  • A FROM clause query specified as a base table for a data block is executed as an inline view and facilitates faster execution. Also, querying and ordering by foreign key look-up items are thus simplified, similar to querying and ordering in an ordinary base table block.

Deleting existing rule sets after removing Oracle Streams Configuration

 DECLARE
  CURSOR VIN Is
    Select RULESET_NAME From DBA_RULESETS Where OWNER = 'STRMADMIN';
     
BEGIN
 For I In VIN LOOP   
 BEGIN
  DBMS_RULE_ADM.DROP_RULE_SET(
    rule_set_name => 'STRMADMIN.'||I.RULESET_NAME,
    delete_rules  => TRUE);
  EXCEPTION
    WHEN OTHERS THEN
      NULL;
  END;
  END LOOP;   
END;
/
Oracle Streams

After capture process creation edit and run below PLSQL block to ignore tables to be captured which are unsupported.

DECLARE
 CURSOR VIN Is
    Select TABLE_NAME
    From DBA_STREAMS_UNSUPPORTED
    Where OWNER = 'URSCHEMA';
BEGIN  
For C In VIN LOOP
 dbms_streams_adm.add_table_rules (
 table_name => 'URSCHEMA.'||C.TABLE_NAME,
 streams_type => 'capture',
 streams_name => 'STREAMS_CAPTURE',
 queue_name => 'STRMADMIN.STREAMS_CAPTURE_Q',
 include_dml => true,
 include_ddl => false,
 inclusion_rule => false,
 source_database => 'STREAM'
 );
END LOOP;
COMMIT;

Oracle Streams

Replicate Oracle database like Oracle GoldenGate. A custom software which can be more customized as per the requirement of the client. The client will get the same database real time replication like GoldenGate. But it is for only Oracle to Oracle Database.

For Order or Inquiry, please e-mail us foxinfotech@yahoo.com

http://foxinfotech.blogspot.com/2012/10/oracle-database-real-time-replication.html


Run this script in stream admin user at target database, to prevent drop for the tables.

Example

conn STRMADMIN/STREAM@TARGET

create or replace procedure
 IGNORE_DROP_TABLE (in_any IN SYS.ANYDATA
 )

 is
 lcr SYS.LCR$_DDL_RECORD;
 rc PLS_INTEGER;

 begin
 rc := in_any.GETOBJECT(lcr);

 if lcr.GET_COMMAND_TYPE != 'DROP TABLE'
 then
     lcr.execute();
 end if;
 END;
 /

 begin
 dbms_apply_adm.alter_apply(
 apply_name => 'STREAMS_APPLY',
 ddl_handler => 'IGNORE_DROP_TABLE');
 end;
 /
Oracle Streams

Problem
In working with data from a subselect, you need to deal with ambiguous situations where in some cases
the subselect will return a single (scalar) value, and in other cases multiple values.
Solution
Oracle supports three expressions that allow a subselect to be compared based on a single column of
results. The operators ANY, SOME, and ALL allow one or more single-column values from a subselect to be
compared to data in an outer SELECT. Using these operators allows you to deal with situations where
you’d like to code your SQL to handle comparisons with flexible set sizes.
Our recipe focuses on using these expressions for a concrete business problem. The order-entry
system tracks product information in the OE.PRODUCT_INFORMATION table, including the LIST_PRICE value.
However, we know discounts are often offered, so we’d like to get an approximate idea of which items
have never sold at full price. To do this, we could do a precise correlated subquery of every sale against
list price. Before doing that, a very quick approximation can be done to see if any LIST_PRICE value is
higher than any known sale price for any item, indicated by the UNIT_PRICE column of the
OE.ORDER_ITEMS table. Our SELECT statement takes this form.

select product_id, product_name
from oe.product_information
where list_price > ALL
(select unit_price
from oe.order_items);


From this query, we see three results:
PRODUCT_ID PRODUCT_NAME
---------- ------------------------
2351 Desk - W/48/R
3003 Laptop 128/12/56/v90/110
2779 Desk - OS/O/F
These results mean at least three items—two desks and a laptop—have never sold a full price.

Problem
In an effort to centralize your domain code management and further normalize the structure of your
database tables, you want to clean up and convert some text-format business attributes to numeric
equivalents. This will enhance reporting capabilities and reduce data entry errors in the future.
Solution
Use the CASE function to translate business keys or other intelligent numeric keys to numeric codes that
are centrally stored in a domain code table. For example, the ORDERS table of the OE schema contains a
column ORDER_MODE that currently has four possible values, identified in Table 4-1.
Table 4-1. Mapping the Text in the ORDER_MODE Column to Numeric Values
Text (source column) Numeric (destination column)
Direct 1
Online 2
Walmart 3
Amazon 4
The second column of Table 4-1 contains the numeric value we want to map to for each of the
possible values in the ORDER_MODE column. Here is the SQL you use to add the new column to the table:

alter table orders add (order_mode_num number);


Oracle versions 9i and later include the CASE statement, which is essentially a way to more easily
execute procedural code within the confines of the typically non-procedural SQL command language.
The CASE statement has two forms: one for simpler scenarios with a single expression that is compared to
a list of constants or expressions, and a second that supports evaluation of any combination of columns
and expressions. In both forms, CASE returns a single result that is assigned to a column in the SELECT
query or DML statement.
The recipe solution using the simpler form of the CASE statement is as follows:

update orders
set order_mode_num =
case order_mode
when 'direct' then 1
when 'online' then 2
when 'walmart' then 3
when 'amazon' then 4
else 0
end
;


Once you run the UPDATE statement, you can drop the ORDER_MODE column after verifying that no
other existing SQL references it.

Selling a software for a person who is not having a company or the establishment is very difficult some times rather than who are the software company owner having sales representatives and support executives etc (that's what I think). The reason may be that the client can not have faith on that person (free-lancer) for the after sales services and many other things.

That is why most of the times I try to think for a concept to develop and sell a software that anybody can buy and can use without worry. I try to think that the what type of software it can be, how it can be develop and after sales support terminology that any client can believe.

But the thing is that some times I am very close to that idea but some times I am unable to get anything.

This post I wrote to share my thinking about selling a software for a free-lancer and I am awaiting to listen from you the ideas, suggestions, comments.

Thank you





FIND_COLUMN built-in Oracle D2k

Description
Searches the list of record group columns and returns a groupcolumn ID when it finds a valid column
with the given name. You must define an appropriately typed variable to accept the return value. Define
the variable with a type of GroupColumn.
Syntax
FUNCTION FIND_COLUMN
(recordgroup.groupcolumn_name VARCHAR2);
Built-in Type unrestricted function
Returns GroupColumn
Enter Query Mode yes
Parameters
recordgroup. groupcolumn_name Specifies the fully qualified VARCHAR2 record group column name.
FIND_COLUMN examples
/*
** Built-in: FIND_COLUMN
** Example: Get column IDs for three columns in a record
** group before performing multiple Get’s or Set’s
** of the record group’s column values
*/
PROCEDURE Record_Machine_Stats( mach_number NUMBER,
pph NUMBER,
temperature NUMBER) IS
rg_id RecordGroup;
col1 GroupColumn;
col2 GroupColumn;
col3 GroupColumn;
row_no NUMBER;
BEGIN
rg_id := Find_Group(’machine’);
col1 := Find_Column(’machine.machine_no’);
col2 := Find_Column(’machine.parts_per_hour’);
col3 := Find_Column(’machine.current_temp’);
/*
** Add a new row at the bottom of the ’machine’ record
** group, and make a note of what row number we just
** added.
*/
Add_Group_Row( rg_id, END_OF_GROUP);
row_no := Get_Group_Row_Count(rg_id);
Set_Group_Number_Cell(col1, row_no, mach_number);
Set_Group_Number_Cell(col2, row_no, pph);
Set_Group_Number_Cell(col3, row_no, temperature);
END;

Google Launches Free Snapseed App On Android And iOS

The awesome Snapseed  application which was recently purchased by Google after it acquired Nik Software, has now been made available for free by Google on both Android and iOS.
Previously the price for the Snapseed photo editing application was $4.99 but Google in their generosity have now made the app free to download for iOS devices, and today launched the app on Android devices as well.

HTC 8X, 8X And J Butterfly Headed To China This Month

HTC has announced that it will be launching its latest smartphones in China this month, one Android device and two Windows Phone 8 smartphones, which include the new HTC J Butterfly and the HTC Windows Phone 8X and HTC Windows Phone 8S.
All three devices will be available in China around the middle of December, with a number of different carriers which include China Unicom, China Telecom and China Mobile.

LG E940 With 1080P Display And Snapdragon S4 Pro Headed To AT&T

It looks like AT&T are about to get another new Android smartphone, the LG E940 which has appeared in some benchmarks, that have revealed that the handset is headed to AT&T.
The LG E940 will come with a full HD display with a resolution of 1920 x 1080 pixels, there are no details on what size the display is as yet, although we would suspect around 5 inches.



YouTube Guide Subscription Features Rolls Out To All Devices

This week YouTube has rolled out a new update to its YouTube Guide feature rolling it out on to all devices. The new update follows on from the updates Google made to their YouTube service last year to make it easier for users to subscribe to channels they were interested in.
The new YouTube Guide homepage now enables you to organise your YouTube channels to match your preferences and your viewing on you Tube, and includes a subscription field guide that flows across both the site and all devices.


Nabi Jr. Toddler Tablet Launches For $99

There are already a number of tablets available on the market which have been designed specifically for children, but a new addition to the range in the form of the Nabi Jr. has been specifically designed for toddlers.
The new Nabi Jr. has been created to provide your baby or very young child with its first taste of tablet technology, allowing you to keep your more expensive Android or iOS based tablet safe out of sticky fingers.


International HTC Butterfly Get Official

HTC announced their J Butterfly Android smartphone back in October, and now they have announced the international version of the device, which will be called the HTC Butterfly, the handset is also available in the US as the HTC Droid DNA.
The HTC Butterfly shares similar specifications to the Droid DNA and the J Butterfly, it comes with Android 4.1 Jelly Bean and features a 5 inch Full HD display with a resolution of 1920 x 1080 pixels.

Baldur’s Gate Enhanced Edition For iPad Out Now

After suffering a minor delay, the Enhanced Edition of Black Isle’s seminal classic Baldur’s Gate is finally hitting the App Store’s imaginary shelves. There is no dearth of RPGs playable on Apple’s devices, a significant amount of which look and play better than this very oldest of school one. But not many of them saved their genre back when they were released.


Twitterrific

Twitterrific is the award-winning Twitter client has rolled out its Twitterrific 5 application to iOS devices supporting Apple’s iPad, iPhone and iPod touch.
The new Twitterrific 5 application has been completely redesigned, and is currently on promotion in the iTunes App Store with a “Special launch price – 50% off for a limited time”.

Amazon Kindle Store Launched In Brazil


Amazon has announced that they are launching their Kindle Store in Brazil, and they are also launching a number of Portugese language reading apps for Android, iOS, the PC and the Mac.
Amazon will also be making their various Kindle devices available in Brazil in the coming weeks, plus there will be over 1.4 million Kindle books available to Brazilian customers in the store.



Dropbox For Android 2.2.2 Update

User of the Android Dropbox application will be pleased to learn that the new update rolled out by Dropbox has brought with it support for moving both files and folders on mobile Android devices.
To move files and folders within your Dropbox Android application simply press and hold on a file or folder, after which a submenu will then appear, where a button labelled “Move” will appear and can be selected to move your documents.
Dropbox

The Seven Wonders of Crysis 3 Teaser (video) Crysis 3 


Crytek, EA and Albert Hughes have teamed up to produce an episodic cinematic video series inspired by the upcoming first person shooter Crysis 3 currently under development by Crytek.
The “Seven Wonders” episodes have been created to set the stage for the world & story of Crysis 3, whetting gamers appetites before the Cyrsis 3 release in February 2013.


iPad Mini


Yesterday we heard that supply of the new iPhone 5 had almost caught up with demand, and now it would appear that supply if Apple’s new iPad Mini is getting better, as the shipping times for the device have now dropped to one week.
This is for the US Apple Store, unfortunately here in the UK shipping times for the iPad Mini are still showing as two weeks, and we suspect this may continue for a while in the UK.

Nintendo Wii Mini lost features to keep cost at $99


Nintendo announced the Wii Mini not very long ago, even though most of us wonder what the point is, since it strips away the Wii’s Internet connectivity, ability to play GameCube games and is without an SD card slot. It looks like all of those lost features were necessary to keep the Wii Mini within its launch price point of $99.99.

DBMS_ERROR_TEXT built-in Oracle D2k

Description
Returns the message number (such as ORA-01438) and message text of the database error.

Syntax
FUNCTION DBMS_ERROR_TEXT;
Built-in Type unrestricted function
Enter Query Mode yes

Parameters
none
Usage Notes
You can use this function to test database error messages during exception handling routines.
DBMS_ERROR_TEXT returns the entire sequence of recursive errors.
DBMS_ERROR_TEXT examples
/*
** Built-in: DBMS_ERROR_CODE,DBMS_ERROR_TEXT
** Example: Reword certain Form Builder error messages by
** evaluating the DBMS error code that caused them
** trigger: On-Error
*/
DECLARE
errcode NUMBER := ERROR_CODE;
dbmserrcode NUMBER;
dbmserrtext VARCHAR2(200);
BEGIN
IF errcode = 40508 THEN
/*
** Form Builder had a problem INSERTing, so
** look at the Database error which
** caused the problem.
*/
dbmserrcode := DBMS_ERROR_CODE;
dbmserrtext := DBMS_ERROR_TEXT;
IF dbmserrcode = -1438 THEN
/*
** ORA-01438 is "value too large for column"
*/
Message(’Your number is too large. Try again.’);
ELSIF dbmserrcode = -1400 THEN
/*
** ORA-01400 is "Mandatory column is NULL"
*/
Message(’You forgot to provide a value. Try again.’);
ELSE
/*
** Printout a generic message with the database
** error string in it.
*/
Message(’Insert failed because of ’||dbmserrtext);
END IF;
END IF;
END;

Gmail For iPhone And iPad Updated


Yesterday we heard that Google had updated their Gmail app for their Android platform, and now Google has released a new version of Gmail for Apple’s iOS platform, and it comes with a range of new features and improvements.
Gmail 2.0 for the iPhone and iPad now comes with a new design, plus new features like profiles pictures in messages, new animations, support for multiple accounts, and improved searching within the app.

Samsung Galaxy Tab 2 10.1 Gets Android 4.1 Jelly Bean Update


Samsung has been pushing out their Android 4.1 Jelly Bean update to a number of different devices recently, and the latest device to get the Android Jelly Bean update is the Galaxy Tab 2 10.1.
It looks like the Android 4.1 Jelly Bean update should now be available for the WiFi version of the Samsung Galaxy Tab 2 10.1 (GT-P5110), as a number of owners in the UK have reported receiving the update.


Google I/O Developer Conference Scheduled For May 15th To 17th 2103


Google has now released details on its Google I/O developer conference for next year, it will take place on the 5th of May 2013 to the 17th of May 2013 and we can expect a number of announcements from Google.
One of the major announcements we will be expecting at Google’s I/O Developer conference in 2013 will be the next major release of Google’s mobile OS, Android 5.0 which is expected to be called Key Lime Pie.

Microsoft Office 2013 Now Available To Businesses Worldwide


Microsoft has rolled out its new Office 2013 suite of software to businesses worldwide this week, allowing companies to now purchase the on-premises versions of the new Office products.
Which include Office 2013, Exchange Server 2013, Lync Server 2013, SharePoint Server 2013, Project 2013 and Visio 2013 all via Microsoft’s Volume Licensing.

Sony Xperia E Android Smartphone Announced


Sony has added another Android smartphone to their Xperia range with the launch of the Sony Xperia E, which will be available with a choice of either a single SIM card slot or a dual SIM card slot.
The Sony Xperia E will come with Android 4.1 Jelly Bean, and the handset will feature a 3.5 inch display with a resolution of 320 x 480 pixels, processing is provided by a 1GHz Qualcomm Snapdragon MSM7227A processor.

Nokia Lumia 920T Announced For China


As well as announcing the new Nokia Lumia 620, Nokia has also announced another new Windows Phone smartphone, the Nokia Lumia 920T which is headed to China before the end of the year.
The Nokia Lumia 920T will be available with China Mobile before the end of 2012, and the device will retail for 4599 RMB which works out at around $739 without a contract.



HTC Windows Phone Store Now Has 120,000 Apps


On Monday we heard from Microsoft that the app downloads and developer revenue in the Windows Phone Store had increase by around one hundred percent, and not it would appear that the Windows Phone Store has reached another milestone.
According to Nokia there are now over 120,000 applications available in the Windows Phone Store, also there are now 46 of the top 50 iOS and Android Apps available in the Windows Phone Store.


International Galaxy S III Gets Android 4.1.2 Update


It looks like Samsung has started rolling out the Android 4.1.2 Jelly Bean update to its international Galaxy S III smartphone, as owners of the handset in Poland have reported receiving the update.
The Android 4.1.2 Jelly Bean update for the Samsung Galaxy S III is being released an an over the air update (OTA) and also through Samsung’s KIES software updating tool.




Nintendo Wii U To Get Google Maps Street View


Nintendo has announced a new app for their Wii U console that will bring Google’s Street View to the Wii U, and you will be able to use the Wii U GamePad to navigate though Google Street View.
You will be able to pan around street view using the touchscreen on the Wii U Gamepad and also via motion controls, plus you will be able to see images in real time with overhead satellite photos displayed on your TV.


LaCie d2 Combines Both Thunderbolt And USB 3.0 Connectivity


LaCie has created a new storage device in the form of the LaCie d2 which has been designed for professionals but will also provide, stunning speed for all, says LaCie.
LaCie has equipped with d2 storage device with both Thunderbolt and USB 3.0 ports providing users to transfer speeds of up to 180MB/s, with the silence of a fan-free design.

Origin EON17-SLX Core i7 32GB RAM Gaming Notebook Launches


Hardware manufacturer Origin has launched a new gaming notebook this week in the form of the highly spec’ed Origin EON17-SLX, which can be equipped with Intel’s latest Core i7 processors and up to 32GB of RAM.
You can also equip the latest Origin EON17-SLX gaming notebook with two NVIDIA GeForce GTX 680M video cards in SLI, a Super Multi Blu-Ray Burner Combo drive and high-definition audio, if your budget will stretch.

Casio G-Shock iPhone Linking Bluetooth Watch Launches (video)


Casio has launched a new rugged G-Shock watch which has been specifically designed to link to your iPhone smartphone, using the low energy Bluetooth 4.0 connectivity technology.
Once you have loaded the Casio iOS application on to your iPhone and linked the Casio G-Shock watch to your smartphone, you can then benefit from alerts for incoming calls and emails, as well as use the handy Find Me function.

Apple Updates iWork For iOS And Mac


Apple has released an update for its range of iWork apps for their iOS platform and Mac platform, and the updates bring iWork for Mac up to version 9.3, with updates to the Pages, Keynote and Numbers apps.
The iOS versions have been updated to version 1.7, and the Keynote, Pages and Numbers apps have all been updated with a number of new features, you can see the changes to both applications below.

Getting column values in single row separated by comma in oracle Sql

Suppose you want to convert the single column result coming in multiple rows to a single row separated by comma, following is an example for your clarifications:

SQL> Select emp_name from emp where dept = 'Accounts';

EMP_NAME
----------------
JOHN,
SMITH,
SCOTT,
ADAM

But you want the result in a single row something like this:

JOHN, SMITH, SCOTT, ADAM

You can do this task with the wm_concat function of WMSYS schema/user.

Below is the example:

Select wm_concat(emp_name) from emp;

It will show the result as below:

JOHN, SMITH, SCOTT, ADAM

Limitations
4000 characters

Toshiba Excite 10 SE Android Jelly Bean Tablets Announced


Toshiba had just announced their latest Android tablet, the Toshiba Excite 10 SE which comes with Android 4.1 Jelly Bean and it is powered by an NVIDIA Tegra 3 quad core processor.
The Toshiba Excite 10 SE features a 10.1 inch touchscreen display, and it features a 3 megapixel rear camera, plus a microSD card slot and 16GB of built in storage.

Developing a Unix Shell Script for RMAN in Oracle

Problem
You want to develop a shell script to be run by an automated process to back up the database
via RMAN.
Solution
The most common platforms for Oracle databases are Unix and its variants, such as Linux,
Solaris, HPUX, and so on. The presence of a shell programming language is extremely handy
when using these variants. In this recipe, you will learn how to develop a complete shell script
to call any RMAN script. Here are some expectations for the script:
• It should be able to be run from some automated utility such as cron.
• It should send an email to a set of email addresses after successful completion.
• It should send an email to another set of email addresses after a failure.
• It should back up to multiple mount points. In this example, we have assumed nine
mount points.
• It should produce a log file whose name follows this format:
<ORACLE_SID>_<BACKUP_TYPE>_<BACKUP_MEDIA>_<TIMESTAMP>.log
• The log file should show the time stamp in mm/dd/yy hh24:mi:ss format, not the
default dd-MON-yy format.
• This log file should be copied over to a central server where all the DBA-related logs are
kept. In addition, the log file should be copied to one of the backup mount points as
well.
• The script should be generic enough to be called for any database. In other words, the
script should not hard-code components that will be different from database to database,
such as Oracle Home, SID, and so on.
• The script should have a built-in locking mechanism; in other words, if the script is
running and is being called again, it shouldn’t start.
With these requirements in mind, you can develop a script similar to the one that follows,
which enables you to back up any database automatically and on a recurring basis by using
cron or some other job-scheduling utility. (Our listing has line numbers to aid explanation; the
actual script does not have those line numbers.) The script has a configurable section in which
you can replace the variable values to suit your environment.

1. # Beginning of Script
2. # Start of Configurable Section
3. export ORACLE_HOME=/opt/oracle/10.2/db_1
4. export ORACLE_SID=PRODB1
5. export TOOLHOME=/opt/oracle/tools
6. export BACKUP_MEDIA=DISK
7. export BACKUP_TYPE=FULL_DB_BKUP
8. export MAXPIECESIZE=16G
9. # End of Configurable Section
10. # Start of site specific parameters
11. export BACKUP_MOUNTPOINT=/oraback
12. export DBAEMAIL="dbas@proligence.com"
13. export DBAPAGER="dba.ops@proligence.com"
14. export LOG_SERVER=prolin2
15. export LOG_USER=oracle
16. export LOG_DIR=/dbalogs
17. export CATALOG_CONN=${ORACLE_SID}/${ORACLE_SID}@catalog
18. # End of site specific parameters
19. export LOC_PREFIX=$BACKUP_MOUNTPOINT/loc
20. export TMPDIR=/tmp
21. export NLS_DATE_FORMAT="MM/DD/YY HH24:MI:SS"
22. export TIMESTAMP=`date +%T-%m-%d-%Y`
23. export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:/lib
24. export LIBPATH=$ORACLE_HOME/lib:/usr/lib:/lib
25. export SHLIB_PATH=$ORACLE_HOME/lib:/usr/lib:/lib
26. export LOG=${TOOLHOME}/log
27. LOG=${LOG}/log/${ORACLE_SID}_${BACKUP_TYPE}_${BACKUP_MEDIA}_${TIMESTAMP}.log
28. export TMPLOG=$TOOLHOME/log/tmplog.$$
29. echo `date` "Starting $BACKUP_TYPE Backup of $ORACLE_SID \
30. to $BACKUP_MEDIA" > $LOG
31. export LOCKFILE=$TOOLHOME/${ORACLE_SID}_${BACKUP_TYPE}_${BACKUP_MEDIA}.lock
32. if [ -f $LOCKFILE ]; then
33. echo `date` "Script running. Exiting ..." >> $LOG
34. else
35. echo "Do NOT delete this file. Used for RMAN locking" > $LOCKFILE
36. $ORACLE_HOME/bin/rman log=$TMPLOG <<EOF
37. connect target /
38. connect catalog $CATALOG_CONN
39. CONFIGURE SNAPSHOT CONTROLFILE NAME TO
40. '${ORACLE_HOME}/dbs/SNAPSHOT_${ORACLE_SID}_${TIMESTAMP}_CTL';
41. run
42. {
43. allocate channel c1 type disk
44. format '${LOC_PREFIX}1/${ORACLE_SID}_${BACKUP_TYPE}_${TIMESTAMP}_%p_%s.rman'
45. maxpiecesize ${MAXPIECESIZE};
46. allocate channel c2 type disk
47. format '${LOC_PREFIX}2/${ORACLE_SID}_${BACKUP_TYPE}_${TIMESTAMP}_%p_%s.rman'
260 CHAPTER 9 ■ SCRIPTING RMAN
48. maxpiecesize ${MAXPIECESIZE};
49. allocate channel c3 type disk
50. format '${LOC_PREFIX}3/${ORACLE_SID}_${BACKUP_TYPE}_${TIMESTAMP}_%p_%s.rman'
51. maxpiecesize ${MAXPIECESIZE};
52. allocate channel c4 type disk
53. format '${LOC_PREFIX}4/${ORACLE_SID}_${BACKUP_TYPE}_${TIMESTAMP}_%p_%s.rman'
54. maxpiecesize ${MAXPIECESIZE};
55. allocate channel c5 type disk
56. format '${LOC_PREFIX}5/${ORACLE_SID}_${BACKUP_TYPE}_${TIMESTAMP}_%p_%s.rman'
57. maxpiecesize ${MAXPIECESIZE};
58. allocate channel c6 type disk
59. format '${LOC_PREFIX}6/${ORACLE_SID}_${BACKUP_TYPE}_${TIMESTAMP}_%p_%s.rman'
60. maxpiecesize ${MAXPIECESIZE};
61. allocate channel c7 type disk
62. format '${LOC_PREFIX}7/${ORACLE_SID}_${BACKUP_TYPE}_${TIMESTAMP}_%p_%s.rman'
63. maxpiecesize ${MAXPIECESIZE};
64. allocate channel c8 type disk
65. format '${LOC_PREFIX}8/${ORACLE_SID}_${BACKUP_TYPE}_${TIMESTAMP}_%p_%s.rman'
66. maxpiecesize ${MAXPIECESIZE};
67. backup
68. incremental level 0
69. tag = 'LVL0_DB_BKP'
70. database
71. include current controlfile;
72. release channel c1;
73. release channel c2;
74. release channel c3;
75. release channel c4;
76. release channel c5;
77. release channel c6;
78. release channel c7;
79. release channel c8;
80. allocate channel d2 type disk format
81. '${LOC_PREFIX}8/CTLBKP_${ORACLE_SID}_${TIMESTAMP}.CTL';
82. backup current controlfile;
83. release channel d2;
84. }
85. exit
86. EOF
87. RC=$?
88. cat $TMPLOG >> $LOG
89. rm $LOCKFILE
90. echo `date` "Script lock file removed" >> $LOG
91. if [ $RC -ne "0" ]; then
92. mailx -s "RMAN $BACKUP_TYPE $ORACLE_SID $BACKUP_MEDIA Failed" \
93. $DBAEMAIL,$DBAPAGER < $LOG
94. else
95. cp $LOG ${LOC_PREFIX}1
96. mailx -s "RMAN $BACKUP_TYPE $ORACLE_SID $BACKUP_MEDIA Successful" \
97. $DBAEMAIL < $LOG
98. fi
99. scp $LOG \
100. ${LOG_USER}@${LOG_SERVER}:${LOG_DIR}/${ORACLE_SID}/.
101. rm $TMPLOG
102. fi
The “How It Works” section describes the mechanics of the script.
Note You don’t need to type this solution script. If you want to use it or adapt it to your own use, you’ll
find the script in the zip file of script examples that you can download for this book from the Apress website.

ERROR_TEXT built-in Oracle D2k

Description
Returns the message text of the Form Builder error.
Syntax
FUNCTION ERROR_TEXT;
Built-in Type unrestricted function
Enter Query Mode yes
Description
Returns the message text of the Form Builder error.
Parameters
none
Usage Notes
You can use this function to test error messages during exception handling subprograms.
ERROR_TEXT examples
/*
** Built-in: ERROR_CODE,ERROR_TEXT,ERROR_TYPE
** Example: Reword certain FRM error messages by checking
** the Error_Code in an ON-ERROR trigger
** trigger: On-Error
*/
DECLARE
errnum NUMBER := ERROR_CODE;
errtxt VARCHAR2(80) := ERROR_TEXT;
errtyp VARCHAR2(3) := ERROR_TYPE;
BEGIN
IF errnum = 40301 THEN
Message(’Your search criteria identified no matches...
Try Again.’);
ELSIF errnum = 40350 THEN
Message(’Your selection does not correspond to an
employee.’);
ELSE
/*
** Print the Normal Message that would have appeared
**
** Default Error Message Text Goes Here
*/
Message(errtyp||’-’||TO_CHAR(errnum)||’: ’||errtxt);
RAISE Form_trigger_Failure;
END IF;
end;

DUPLICATE_RECORD built-in Oracle D2k

Description
Copies the value of each item in the record with the next lower sequence number to the corresponding
items in the current record. The current record must not correspond to a row in the database. If it does,
an error occurs.
Note: The duplicate record does not inherit the record status of the source record; instead, its record
status is INSERT.
Syntax
PROCEDURE DUPLICATE_RECORD;
Built-in Type restricted procedure
Enter Query Mode no
Parameters
none
DUPLICATE_RECORD restrictions
A previous record must exist in your current session.
DUPLICATE_RECORD examples
/*
** Built-in: DUPLICATE_RECORD;
** Example: Make a copy of the current record and increment
** the "line_sequence" item by one.
*/
DECLARE
n NUMBER;
BEGIN
/*
** Remember the value of the ’line_sequence’ from the
** current record
*/
n := :my_block.line_sequence;
/*
** Create a new record, and copy all the values from the
** previous record into it.
*/
Create_Record;
Duplicate_Record;
/*
** Set the new record’s ’line_sequence’ to one more than
** the last record’s.
*/
:my_block.line_sequence := n + 1;
END;

GO_BLOCK built-in Oracle D2k

Description
GO_BLOCK navigates to an indicated block. If the target block is non-enterable, an error occurs.
Syntax
PROCEDURE GO_BLOCK
(block_name VARCHAR2);
Built-in Type restricted procedure
Enter Query Mode no
Parameters
block_name Specifies the name you gave the block when defining it. The data type of
the name is VARCHAR2.
GO_BLOCK examples
/*
** Built-in: GO_BLOCK
** Example: Navigate to a block by name. Make sure to check
** that the Go_Block succeeds by checking
FORM_SUCCESS.
*/
BEGIN
IF :Global.Flag_Indicator = ’NIGHT’ THEN
Go_Block(’Night_Schedule’);
/*
** One method of checking for block navigation success.
*/
IF NOT FORM_SUCCESS THEN
RAISE Form_trigger_Failure;
END IF;
ELSIF :Global.Flag_Indicator = ’DAY’ THEN
Go_Block(’Day_Schedule’);
/*
** Another way of checking that block navigation
** succeeds. If the block the cursor is in hasn’t
** changed after a block navigation, something went
** wrong. This method is more reliable than simply
** checking FORM_SUCCESS.
*/
IF :System.trigger_Block = :System.Cursor_Block THEN
RAISE Form_trigger_Failure;
END IF;
END IF;
Execute_Query;
Go_Block(’Main’);
END;

Finding First and Last Values within a Group in Oracle

Problem
You want to calculate and display aggregate information like minimum and maximum for a group, along
with detail information for each member. You want don’t want to repeat effort to display the aggregate
and detail values.

Solution
Oracle provides the analytic functions FIRST and LAST to calculate the leading and ending values in any
ordered sequence. Importantly, these do not require grouping to be used, unlike explicit aggregate
functions such as MIN and MAX that work without OLAP features.
For our recipe, we’ll assume the problem is a concrete one of displaying an employee’s salary,
alongside the minimum and maximum salaries paid to the employee’s peers in their department. This
SELECT statement does the work.

select department_id, first_name, last_name,
min(salary)
over (partition by department_id) "MinSal",
salary,
max(salary)
over (partition by department_id) "MaxSal"
from hr.employees
order by department_id, salary;


This code outputs all employees and displays their salaries between the lowest and highest within
their own department, as shown in the following partial output.
DEPARTMENT_ID FIRST_NAME LAST_NAME MinSal SALARY MaxSal
------------- ---------- ---------- ---------- ---------- ----------
10 Jennifer Whalen 4400 4400 4400
20 Pat Fay 6000 6000 13000
20 Michael Hartstein 6000 13000 13000
30 Karen Colmenares 2500 2500 11000
30 Guy Himuro 2500 2600 11000
30 Sigal Tobias 2500 2800 11000
30 Shelli Baida 2500 2900 11000
30 Alexander Khoo 2500 3100 11000
30 Den Raphaely 2500 11000 11000
40 Susan Mavris 6500 6500 6500

107 rows selected.

Standard Toolbar Implementation in Oracle D2k

A common application-specific feature is a standard iconic toolbar that provides icons to carry out common form functions such as Save, Undo, Enter Query, Execute Query, Next Block, Previous Block, Next Record, Previous Record, Insert Record, Delete Record, Exit, Clear, List Values, and Close Application. Toolbars also let users invoke functions such as Notepad, Diary, Calculator, and so on. Such a toolbar is useful especially when the application uses a customized menu bar to replace the default menu provided by Oracle Forms runtime. In addition, a toolbar enhances the GUI's look and feel.
In Forms 5.x and above, the default toolbar comes with Forms runtime (by adding the suffix &SMARTBAR to the DEFAULT value of the Menu Module property). However, think of a function like Close Application, mentioned earlier. This function might refer to closing all forms invoked in a multiform application—a task that cannot be achieved with the normal Exit toolbar icon unless it is clicked repeatedly.
In Forms 5.x and above, toolbars can be associated with a form at three levels at runtime:
  • At the menu level—On an MDI platform, this toolbar is similar to the MDI toolbar in Forms 4.5. This toolbar also comes in an SDI platform. Forms supplies it by default with the name SMARTBAR with the DEFAULT menu.
  • At the form level—This toolbar is new to Forms 5.x and above and is available for all windows within that form. It is not equivalent to the MDI toolbar.
  • At the individual window level—This toolbar is specific to a particular window to which it is attached.

Displaying Menu-Level Toolbars

To create a menu-level toolbar, specify &SMARTBAR after the DEFAULT menu module name in the Form Module property palette. Dynamically hiding the menu using REPLACE_MENU('') in the WHEN_NEW_FORM_INSTANCE trigger will also suppress the display of the associated toolbar.
To create a menu-level toolbar for any customized menu, set either the Visible In Horizontal Menu Toolbar or Visible In Vertical Toolbar property to Yes for each menu item that should appear in the menu toolbar.
Figure 1.1 shows a menu-level toolbar.
Figure 1.1. A menu-level toolbar.
graphics/01fig01.gif

Displaying a Form-Level or Window-Level Toolbar

To create a form-level or window-level toolbar, you create a horizontal toolbar canvas view with iconic buttons. Then, specify it as the value for the Form Horizontal Toolbar property or the Window Horizontal Toolbar property. To do so, follow these steps:
  1. Create a canvas view of type horizontal toolbar (that is, CANVAS_TOOLBAR).
  2. Assign to the canvas view a property class specifying the standard canvas characteristics (such as PC_CANVAS). The height of the canvas should be just enough to enclose an iconic button of standard size. Set the Visible property of this canvas to Yes and the Bevel property to None.
  3. Create a property class named PC_ICONIC_BUTTON with the following property values: Iconic set to Yes, Mouse Navigate set to Yes, Keyboard Navigable set to Yes, Width set to 10, Height set to 10, and ToolTip Visual Attribute Group set to DEFAULT.
  4. Construct a block named TOOLBAR with items as iconified push buttons for each of the individual functions. The buttons inherit their properties from the PC_ICONIC_BUTTON property class.
  5. A WHEN-BUTTON-PRESSED trigger for each of the buttons contains the appropriate Forms built in as arguments to the DO_KEY procedure. For example, the Save button can have the following line of code in its WHEN-BUTTON-PRESSED trigger:
    WHEN-BUTTON-PRESSED
    
    DO_KEY('COMMIT_FORM');
    
    
Tip
You can achieve the Close Application functionality described earlier by calling a procedure in the corresponding WHEN-BUTTON-PRESSED trigger. This technique is explained in the sub-section "Simulating a CLOSE ALL Forms" in Chapter 3, "Multi-form Applications."

  1. ToolTips can be specified for each iconic button. This is done by specifying the respective text for the ToolTip Text property for each of the iconic buttons. For example, the ToolTip text for the iconic button corresponding to the Save function can be given in the button property palette by entering Save Changes in the ToolTip Text property.
Note
Specifying ToolTips provides a visual hint feature when the cursor enters the icon. This feature is available from Forms 5.x onwards. In Forms 4.5, this functionality has to be simulated with extra coding, as illustrated later in this section.

  1. Specify this horizontal toolbar canvas CANVAS_TOOLBAR as the value for the Form Horizontal Toolbar property in Forms 5.x and above. In Forms 4.5, specify the Horizontal MDI Toolbar property in the Forms Module property sheet.
A sample toolbar constructed in this way looks like the one shown in Figure 1.2.
Figure 1.2. A form-level toolbar.
graphics/01fig02.gif

Simulating the ToolTip Feature in Forms 4.5

In Forms 4.5, you can display ToolTips by creating a display item, TOOLTIP_ITEM, with the following properties:
  • Char data type
  • The same visual attribute as the ToolTip visual attribute group
  • The Bevel property set to None and Displayed property set to False
  • Specify the ToolTip text as the value for the Label property for each iconic button
In addition, the property class PC_ICONIC_BUTTON discussed earlier can have the following two triggers attached to it: WHEN-MOUSE-ENTER and WHEN-MOUSE-LEAVE. The code for these triggers is explained in the steps that follow.
Dynamically populate this item with text equivalent to the Label in the WHEN-MOUSE-ENTER trigger, as follows:
WHEN-MOUSE-ENTER



DECLARE

  tooltip_x_pos NUMBER;

  tooltip_y_pos NUMBER;

  tooltip_text  VARCHAR2(30);

  item_id ITEM;

BEGIN

  tooltip_x_pos := GET_ITEM_PROPERTY(:SYSTEM.MOUSE_ITEM,X_POS);

  tooltip_y_pos := GET_ITEM_PROPERTY(:SYSTEM.MOUSE_ITEM,Y_POS);

  tooltip_text := GET_ITEM_PROPERTY(:SYSTEM.MOUSE_ITEM,LABEL);

  :toolbar.tooltip_item := tooltip_text;

  item_id := FIND_ITEM('TOOLBAR.TOOLTIP_ITEM');

  IF NOT ID_NULL(item_id) THEN

    SET_ITEM_PROPERTY(item_id, DISPLAYED, PROPERTY_TRUE);

    SET_ITEM_PROPERTY(item_id, POSITION tooltip_x_pos+10, tooltip_y_pos+10);

  ELSE

    MESSAGE('Invalid Tooltip Item');

    RAISE FORM_TRIGGER_FAILURE;

  END IF;

END;

A WHEN-MOUSE-LEAVE trigger will hide the dynamic ToolTip by setting its DISPLAYED property to FALSE as follows:
WHEN-MOUSE-LEAVE



DECLARE

  item_id ITEM;

BEGIN

  item_id := FIND_ITEM('TOOLBAR.TOOLTIP_ITEM');

  IF NOT ID_NULL(item_id) THEN

    :toolbar.tooltip_item := NULL;

    SET_ITEM_PROPERTY(item_id, DISPLAYED, PROPERTY_FALSE);

  END IF;

END;

In Forms 5.x and above, the ToolTip appears below the iconic button, whereas in Forms 4.5 it appears on the side. This has been intentionally done because the ToolTip in Forms 4.5 is attached to the MDI horizontal toolbar; there is no way to display it outside the toolbar canvas without making the canvas height more than the icons'height. This leaves a view space on the MDI toolbar.

Toolbar Tips

The following tips provide the tidbits often ignored while developing form-level and window-level toolbars. Also, the points to remember while associating toolbars with forms in multiform applications are highlighted.
The Toolbar Template Form
Use a source template form in which the toolbar can be constructed. Then, you can base customized forms on this template.
Common Form Toolbars
Toolbars attached at the form level are not available to all forms in an application. In a multiform application, especially when you're using OPEN_FORM, you can subclass the CANVAS_TOOLBAR from the source template form. Then, set the Form Horizontal Toolbar property to CANVAS_TOOLBAR for each form. Doing so creates an application with a common toolbar for each independent form.
To simulate the same functionality while using Forms 4.5, the CANVAS_TOOLBAR can be referenced from the source template form. Then, set the MDI Horizontal Toolbar property to CANVAS_TOOLBAR for each form.
Window-Specific Toolbars for Modal Windows
A modal window should have a window-level toolbar associated with it. Form-level toolbar icons are not accessible from a modal window. The same is true with toolbars associated with menu, SDI, or MDI windows. Figure 1.3 shows a form-specific toolbar with a Personal Info. icon. If you click on this icon, you get the window-specific toolbar for a modal window, shown in Figure 1.4.
Figure 1.3. A form-specific toolbar with a Personal Info. icon.
graphics/01fig03.gif
Figure 1.4. A window-level toolbar.
graphics/01fig04.gif

Floating Toolbars

This section discusses the techniques to implement dynamic toolbars. It starts by looking at the various ways a toolbar can be "dynamic."
Dynamic toolbars can be implemented several ways. You can create toolbars that dynamically shrink or expand, based on the current mouse position or the current item, record, block, canvas, or form; you hide, unhide, and resize proportionately the toolbar's iconic buttons, depending on the current cursor position. Examples are as follows:
  • Hiding (or disabling) the List button when the cursor is in a nonupdateable item or an item that has no LOV attached to it, and showing it otherwise.
  • Hiding (or disabling) the Next Record button when the cursor is in the last record of a Query Only block, and showing it otherwise.
  • Hiding (or disabling) the Enter Query and Execute Query buttons when a control block receives input focus, and showing them otherwise.
  • Generating a new toolbar by selecting a subset of buttons from the original set when a form is being run in Query Only mode.
Other dynamic toolbars are scrollable for forms that require greater functionality to be provided by means of application-specific buttons. Floating toolbars can appear almost anywhere—that is, they "float" in an application or appear where you right-click. You can resize toolbars so that the icons fit proportionately. Finally, you can generate toolbars from a global set of iconic buttons, using point-and-click.
In this section, I will discuss the implementation of a floating toolbar. It has the flexibility of being able to float, or be displayed almost anywhere when initiated by a user action. It can also have dynamic resizing capability. It has the same functionality as a regular toolbar but remains displayed until closed by another user action. For example, the user action initiating the display of the toolbar can be a right mouse click on an empty part of the canvas (that's why it's floating), and the user action closing it can be a left mouse click in an empty area of the can vas.
Tip
The form objects including triggers can be included in an Object Group, which in turn can be included in an Object Library and shared (subclassed) across form modules.
Alternatively, a template form can be created with the described objects, and customized application-specific forms can be based on this template form.

Follow these steps to create the floating toolbar:
  1. Create a new WINDOW_FLOATING_TOOLBAR that is nonmodal and is not part of the normal windows being used in any form. Make this window's width and height the same as the canvas view width and height of the window-specific toolbar created in the last section's example.
  2. Set the window's window style to Dialog, its Modal property to No, its Closeable property to Yes, its Minimizable and Maximizable properties to No, and its Bevel property to None.
  3. Create a canvas named CANVAS_FLOATING_TOOLBAR. This canvas is created in the same manner as the standard toolbar described in the earlier example. The only difference is that the number of icons is less here. This number has been chosen at random and can be application specific. Note that this can also be a stacked canvas.
  4. Specify the canvas view properties: Set the Window property to WINDOW_FLOATING_ TOOLBAR, the Canvas Type to Horizontal Toolbar, the Visible property to No, and the Bevel property to None.
  5. Set the Horizontal Toolbar property of the WINDOW_FLOATING_TOOLBAR window to CANVAS_FLOATING_TOOLBAR.
  6. Initiate the window display by writing a WHEN-MOUSE-CLICK trigger at the form level and capturing the right mouse click event. The code for this trigger has the following logic:
    • Check for the cursor not being positioned inside any item, including non–data-bearing items. This is done using the system variable :SYSTEM.MOUSE_ITEM.
    • Check whether the mouse button pressed is not the left mouse button. This is done by checking that the value of the Forms system variable :SYSTEM.MOUSEBUTTON_PRESSED does not equal the constant 1. This system variable can take values 1, 2, or 3. The value 1 is for left, 2 for middle, and 3 for right mouse buttons. All these values are returned as character values. Checking for a value other than 1 ensures that the user-pressed mouse button is not the left one.
    • Position the window WINDOW_FLOATING_TOOLBAR at the current (X,Y) position of the cursor. This is done by dynamically setting the X_POS and Y_POS properties of the window to the values :SYSTEM.MOUSE_X_POS and :SYSTEM.MOUSE_Y_POS, respectively, using SET_WINDOW_PROPERTY.
      The WHEN-MOUSE-CLICK trigger code is as follows:
      WHEN-MOUSE-CLICK
      
      
      
      IF NAME_IN('SYSTEM.MOUSE_ITEM') IS NULL THEN
      
         IF NAME_IN('SYSTEM.MOUSEBUTTON_PRESSED') != '1'THEN
      
            SET_WINDOW_PROPERTY('WINDOW_FLOATING_TOOLBAR', X_POS,
      
                       TO_NUMBER(NAME_IN('SYSTEM.MOUSE_X_POS')));
      
            SET_WINDOW_PROPERTY('WINDOW_FLOATING_TOOLBAR',Y_POS,
      
                       TO_NUMBER(NAME_IN('SYSTEM.MOUSE_Y_POS')))
      
            SET_WINDOW_PROPERTY('WINDOW_FLOATING_TOOLBAR',
      
                       VISIBLE,PROPERTY_TRUE);
      
         END IF;
      
      END IF;
      
      
The floating toolbar will look like Figure 1.5.
Tip
The actual (X,Y) position of the displayed toolbar is an offset from the actual cursor (X,Y) position because the former is relative to the MDI Window and the latter is relative to the primary canvas of WINDOW0.

Figure 1.5. A floating toolbar.
graphics/01fig05.gif
You can initiate the window close in several ways. First, you can set the Hide On Exit property to Yes for this toolbar window. This is not a standard practice because the user might want to perform multiple functions in the form using this toolbar and would therefore want the toolbar to remain floating until explicitly closed. Applications demanding user-specific requests for such a feature are an exception to this rule.
Second, the window can close when the user clicks the upper-right x. This is the recommended practice, unless a user requirement specifies a different approach. To use this technique, write a WHEN-WINDOW-CLOSED trigger at form level that checks for the currently active window and closes it if it is WINDOW_FLOATING_TOOLBAR:
WHEN-WINDOW-CLOSED



IF NAME_IN('SYSTEM.EVENT_WINDOW') = 'WINDOW_FLOATING_TOOLBAR'THEN

   SET_WINDOW_PEROPERTY('WINDOW_FLOATING_TOOLBAR', VISIBLE, PROPERTY_FALSE);

END IF;

Third, the window can be made to disappear by creating a timer at the time of window initia tion and writing a WHEN-TIMER-EXPIRED trigger to hide it after a certain interval of time. You provide this second way of closing by specifying an appreciably large time interval—a minute, for example. Closing the floating toolbar by means of a timer involves the following steps:
  1. Create a timer in the WHEN-MOUSE-CLICK trigger immediately before displaying the toolbar window. The modified WHEN-MOUSE-CLICK trigger is as follows:
    WHEN-MOUSE-CLICK
    
    
    
    DECLARE
    
        timer_id TIMER;
    
         one_minute NUMBER := 60000;
    
    BEGIN
    
      IF NAME_IN('SYSTEM.MOUSE_ITEM') IS NULL THEN
    
         IF NAME_IN('SYSTEM.MOUSE_BUTTON_PRESSED') != '1'THEN
    
            SET_WINDOW_PROPERTY('WINDOW_FLOATING_TOOLBAR',
    
                        X_POS, NAME_IN('SYSTEM.MOUSE_X_POS'));
    
            SET_WINDOW_PROPERTY('WINDOW_FLOATING_TOOLBAR',
    
                        Y_POS, NAME_IN('SYSTEM.MOUSE_Y_POS'));
    
             BEGIN
    
                timer_id := FIND_TIMER('TIMER_HIDE_FT');
    
                  IF ID_NULL(timer_id) THEN
    
                    timer_id :=
    
                      CREATE_TIMER('TIMER_HIDE_FT',one_minute, NO_REPEAT);
    
                  END IF;
    
             END;
    
           SET_WINDOW_PROPERTY('WINDOW_FLOATING_TOOLBAR',
    
                       VISIBLE, PROPERTY_TRUE);
    
         END IF;
    
      END IF;
    
    
  2. Write a WHEN-TIMER-EXPIRED trigger at the form level to close the window after the time period elapses, in one minute in this case:
    WHEN-TIMER-EXPIRED
    
    
    
    IF GET_APPLICATION_PROPERTY(TIMER_NAME) = 'TIMER_HIDE_FT'THEN
    
       IF GET_WINDOW_PROPERTY('WINDOW_FLOATING_FT', VISIBLE) = 'FALSE'THEN
    
          SET_WINDOW_PROPERTY('WINDOW_FLOATING_TOOLBAR',
    
                      VISIBLE, PROPERTY_FALSE);
    
        END IF;
    
    END IF;
    
    
Floating Toolbar Pop-Up Menus
Another convenient way of displaying a floating toolbar is by providing a pop-up menu on a right mouse button click. This pop-up can have at least two menu options: Show Toolbar and Hide Toolbar. This can be achieved by the following steps:
  1. Create a pop-up menu in the Object Navigator with two items: SHOW_TOOLBAR (labeled Show Toolbar) and HIDE_TOOLBAR (labeled Hide Toolbar).
  2. The WHEN-MOUSE-CLICK trigger is still necessary because the :system.mouse_x_pos for a pop-up menu is 0 when the cursor is in the pop-up. Therefore, you capture the (mouse_x_pos, mouse_y_pos) as soon as the user right-clicks to display the pop-up menu. You can write a WHEN-MOUSE-CLICK trigger , in addition to the menu item code, to capture the current (X,Y) of the cursor on right click before the cursor is positioned on one of the items of the pop-up menu:
    WHEN-MOUSE-CLICK
    
    
    
    IF :SYSTEM.MOUSE_BUTTON_PRESSED != '1'THEN
    
      IF  :SYSTEM.MOUSE_ITEM IS NULL THEN
    
    
    
        COPY(NAME_IN('SYSTEM.MOUSE_X_POS'), 'CTRL_BLK.MOUSEXPOS');
    
        COPY(NAME_IN('SYSTEM.MOUSE_Y_POS'), 'CTRL_BLK.MOUSEYPOS');
    
    
    
      END IF;
    
    END IF;
    
    
    Here, CTRL_BLK.MOUSEXPOS and CTRL_BLK.MOUSEYPOS are two control items to hold the current values of SYSTEM.MOUSE_X_POS and SYSTEM.MOUSE_Y_POS as defined in the preceding code snippet.
  3. The menu item code for the SHOW_TOOLBAR item is as follows:
    IF :SYSTEM.MOUSE_ITEM IS NULL THEN
    
      SET_WINDOW_PROPERTY('window_ft', X_POS,
    
                  TO_NUMBER(:ctrl_blk.mousexpos));
    
       SET_WINDOW_PROPERTY('window_ft', Y_POS,
    
                  TO_NUMBER(:ctrl_blk.mouseypos));
    
       SET_WINDOW_PROPERTY('window_ft', VISIBLE, PROPERTY_TRUE);
    
    END IF;
    
    
  4. The menu item code for the HIDE_TOOLBAR item is as follows:
    SET_WINDOW_PROPERTY('window_ft', VISIBLE, PROPERTY_FALSE);
    
    :ctrl_blk.mousexpos := NULL;
    
    :ctrl_blk.mouseypos := NULL;
    
    
The pop-up menu appears somewhat like the one shown in Figure 1.6.
Figure 1.6. A pop-up menu to display a dynamic floating toolbar.
graphics/01fig06.gif 

More Topics

V. Kapoor

{picture#https://3.bp.blogspot.com/-q3wCssWUHo8/ViDFfCpPEuI/AAAAAAAAD0M/MHPvgnl3T3U/s1600/authpic.JPG} Vinish Kapoor is a Software Consultant, currently working in a reputed IT company in Noida, India and doing blogging on Oracle Forms, SQL and PLSQL topics. He is an author of an eBook Oracle Forms Recipes, which is available on Google play. {facebook#https://www.facebook.com/foxinfotech2014} {twitter#https://twitter.com/foxinfotech} {google#https://plus.google.com/u/0/+VKapoor/posts}
Fox Infotech. Powered by Blogger.