.NET/Java PDF, Tiff, Barcode SDK Library
n occasion, the need for date math arises, such as when you re trying to calculate a time interval between events. The calculations seem easy enough because there are precise numbers of seconds, minutes, and hours in a day. It gets tricky, though, when you consider the fact that values have to roll over when, for example, Monday turns into Tuesday or June becomes July. For instance, calculating the difference in minutes between 6:53 am and 7:04 am is easy enough: you can multiply the hours (6 and 7) by 60 for each value, add the minutes that do not make up the next full hour, then subtract to find the difference. But what if you want the difference in minutes between 11:57 pm and 1:13 am This calculation is more complex because it involves a change in day. And the complexity only increases when the date interval spans months or years.barcode font in excel 2003, barcode generator excel 2003 free, barcode excel 2007, barcode in excel 2003 free, using barcode in excel 2007, free excel barcode generator download, barcode generator excel free download, barcode font for excel 2007, barcode add-in for excel freeware, microsoft excel barcode generator,
Suppose you want to create an index on a database table that s already in use. You issue the CREATE INDEX command and get the following message: SQL> CREATE INDEX neims_history_idx ON neims_history(nsaorg_id); NEIMS_HISTORY (NSAORG_ID) * ERROR at line 2: ORA-00054: resource busy and acquire with NOWAIT specified SQL> You can t begin to create the index until you find out which session is locking the neims_history table, and either ask the user to log off or kill the session as a last resort. You can use the V$LOCKED_ OBJECT view to help you get rid of the session locking up the table. First, go to the DBA_OBJECTS data dictionary view and get the object_id of the neims_history table. Once you have the object_id column value for the locked table, you can query the V$LOCKED_OBJECT view, as shown in the following code. Once you have the username and session id (SID), you can use the V$SESSION view to get the corresponding serial number (SERIAL#) and kill the session, thus releasing the lock that s preventing you from creating the index. SQL> SELECT object_id, session_id, oracle_username FROM V$LOCKED_OBJECT;
The V$LATCH view shows latch statistics since the beginning of the instance. The statistics are grouped by latch name. This view is usually joined with the V$LATCHNAME view to give you the statistics associated with each latch request that occurs in the current instance.
The V$LATCHNAME and V$LATCH views have an intimate relationship. The V$LATCHNAME view gives you the name of each type of latch requested since the instance began, and the V$LATCH view provides the statistics for each of those latches. Every row in the V$LATCHNAME view corresponds to a row in the V$LATCH view, and usually you join these two views to get information on the latches being held in the instance.
The V$PROCESS view shows all the active processes in the instance. The LATCHWAIT column indicates the latches the process is waiting for. If there are latch waits, the LATCHWAIT column will be NULL. The following is a simple example using the view: SQL> SELECT username, serial#, latchwait, 2* program FROM V$PROCESS;
The following script shows one way to make date and time calculations much easier. Because UNIX and Linux calculate time based on a starting point of January 1, 1970, the script measures time in seconds since that date. Although the use of seconds may seem cumbersome, the math is simple, as you ll see in the bit of code in the Days Since Epoch section of this chapter. You reduce the date and time values to numbers of seconds elapsed since the base date then manipulate these values. All of the issues that arise when spanning across calendar increments, such as days or months, simply disappear. You might use this type of calculation when determining the age of a user s password. The third field of an account entry in a system /etc/shadow file contains the day value on which the password was changed for a particular account, as counted from 1/1/1970 (the epoch). This number can be used for various purposes for example, to determine when passwords are about to expire so as to facilitate user notifications. You can find an example of this in 36 in connection with password aging. Converting all temporal quantities to elapsed time also reduces the complexity of making time comparisons. Suppose, for example, that you would like to monitor time synchronization between multiple network nodes. When you convert the time on a