Tuesday, January 19, 2010

Software Synthesis





Software
Synthesis



Thus far we have concentrated on music
creation using
MIDI and
external sound-creation devices such as synthesizers, but what if you want to
use your computer as a synthesizer? No problem!



What is a software synthesizer? Considering
what a synthesizer does, converting electricity into sound, it stands to reason
that a computer with a soundcard would also be able to convert electricity into
sound. The only hitch is that you need a fairly powerful computer to do this,
which is why MIDI is so nice�it doesn't require a 1-GHz system to achieve
amazing results. Of course, the trade-off is the expense of the synthesizers. However,
if you find yourself with an extra dozen CPU cycles lying around doing nothing,
give a software synthesizer a try. Here's a few from
style='color:#003399'>www.freshmeat.net that might
meet your needs:



style='font-size:10.0pt;font-family:Symbol'>�        
aRts: analog real-time synthesizer



style='font-size:10.0pt;font-family:Symbol'>�        
BacteriuM: virtual analog matrix synthesizer



style='font-size:10.0pt;font-family:Symbol'>�        
Cumulus: asynchronous grain synthesizer



lang=EN-GB style='font-size:10.0pt;font-family:Symbol'>�        
Freebirth: integrated bass synthesizer/step
sequencer/sample player



lang=EN-GB style='font-size:10.0pt;font-family:Symbol'>�        
gAlan: modular synthesizer�drum
machine�sequencer�effects unit for Linux



style='font-size:10.0pt;font-family:Symbol'>�        
SpiralSynth: a software synthesizer



So what do they do? Using your soundcard,
they shape bit patterns into sound. They model old-style analog synthesizers
that had lots of knobs, buttons, and switches and produced very rich sound. If
you like to tinker with stuff, you will probably like analog modeling
synthesizers, as they are known, because they allow you to fiddle with all
aspects of sound, from waveforms to filters and more.



The interesting thing about these tools is
that the sound you create can be stored to a file. So then what? Later in this
chapter you will learn how to use these stored sounds in two other types of
music creation applications for Linux.



 





Chapter 2. Client-side JavaScript








 

 












Chapter 2. Client-side JavaScript





Client-side JavaScript is the name given to JavaScript code that is

embedded within an HTML file and executed by a web browser. In

addition to the core objects described in the previous section,

client-side JavaScript code has access to a number of other objects

that represent the web browser, the document displayed in the

browser, and the contents of that document. Client-side JavaScript

programs are usually event-based, which means that JavaScript

event handlers are executed in response to user

interactions with the browser and the document. The client-side

JavaScript scripting framework is powerful enough to open substantial

security holes in web browsers. For this reason, web browsers

typically restrict the actions of client-side scripts. This section

starts by explaining how JavaScript code is embedded in HTML files,

then goes on to introduce the client-side JavaScript objects,

JavaScript events and event handling, and JavaScript security

restrictions.
















     

     


    Section A.4. #4 Tools for Creating Web Pages










    A.4. #4 Tools for Creating Web Pages


    Now that you know XHTML and CSS you're in a good position to decide if tools like Dreamweaver, GoLive, and FrontPage are for you. All these applications attempt to provide what-you-see-is-what-you-get (WYSIWYG) tools for creating Web pages. We're sure you know enough about XHTML and browser support to know that this goal, while worthwhile, also comes up short from time to time. But, that said, these tools also provide some very handy features, even if you're writing a lot of the XHTML yourself:


    • A "code" window for entering XHTML and CSS with syntax checking to catch common mistakes and suggest common names and attributes as you type.

    • A preview and publish functionality that allows you to test pages before making them "live" on the Web.

    • A site manager that allows you to organize your site, and also keeps your local changes in synch with your Web site on the server. Note that this usually takes care of all the FTP work for you.


    These tools are also not without their downsides:


    • Often these tools lag behind standards in terms of support, so to keep your XHTML and CSS current you'll need to write the XHTML yourself.

    • Often these tools don't enforce strict standards, and may allow you to get sloppy with your XHTML and CSS, so don't forget to validate (some tools help you validate as well).


    Keep in mind you can use a combination of simple editors along with these more sophisticated tools; one solution doesn't have to fit all your needs. So use a page creation tool when it makes sense.



    A.4.1. Some tools to consider:


    • Macromedia Dreamweaver

    • Adobe GoLive

    • Microsoft FrontPage

    • GNU Emacs (open source)













    Chapter 6. Tackling Large Projects



    [ Team LiB ]






    Chapter 6. Tackling Large Projects



    A Large System, Produced By Expanding The Dimensions of A Smaller System, Does Not Behave Like The Smaller System.

    �John Gall


    Large, multifile projects differ from smaller ones not only in the challenges you will encounter when examining their code but also in the opportunities they provide for understanding them. In this chapter we review some common techniques used in the implementation of large projects and then examine specific elements typically comprising the development process of such projects. We will describe how large projects are organized, their build and configuration process, how different file versions are controlled, the special role of project-specific tools, and typical testing strategies. For these elements we sketch characteristic setups you will encounter and provide some hints on how you can use them to enhance your navigation and comprehension capabilities.






      [ Team LiB ]



      Publicly Available Sources



      [ Team LiB ]









      Publicly Available Sources



      Ahern 01 Ahern, Dennis; Clouse, Aaron; and Turner, Richard. CMMI Distilled: A Practical Introduction to Integrated Process Improvement. Boston: Addison-Wesley, 2001.



      Bate 95 Bate, Roger; et al. Systems Engineering Capability Maturity Model, Version 1.1 (CMU/SEI-95-MM-003). Pittsburgh, PA: Software Engineering Institute, Carnegie Mellon University, November 1995.



      Crosby 79 Crosby, P. B. Quality Is Free. New York: McGraw-Hill, 1979.



      Curtis 01 Curtis, Bill; Hefley, William E.; and Miller, Sally. The People Capability Maturity Model. Boston: Addison-Wesley, 2001.



      Deming 86 Deming, W. Edwards. Out of the Crisis. Cambridge, MA: MIT Center for Advanced Engineering, 1986.



      DoD 91 Department of Defense. DoD Directive 5000.1: Defense Acquisition. Washington, DC, 1991.



      DoD 96a Department of Defense. DoD Regulation 5000.2: Mandatory Procedures for Major Defense Acquisition Programs and Major Automated Information Systems. Washington, DC, 1996.



      DoD 96b Department of Defense. DoD Guide to Integrated Product and Process Development (Version 1.0). Washington, DC: Office of the Under Secretary of Defense (Acquisition and Technology), February 5, 1996. <http://www.acq.osd.mil/te/survey/table_of_contents.html>



      Dunaway 96 Dunaway, D.; and Masters, S. CMM-Based Appraisal for Internal Process Improvement (CBA IPI): Method Description (CMU/SEI-96-TR-007). Pittsburgh, PA: Software Engineering Institute, Carnegie Mellon University, April 1996 <http://www.sei.cmu.edu/publications/documents/96.reports/96.tr.007.html>



      Dymond 95 Dymond, Kenneth M. A Guide to the CMM: Understanding the Capability Maturity Model for Software. Annapolis, MD: Process Inc., 1995.



      EIA 94 Electronic Industries Alliance. EIA Interim Standard: Systems Engineering (EIA/IS-632). Washington, DC, 1994.



      EIA 95 Electronic Industries Alliance. EIA Interim Standard: National Consensus Standard for Configuration Management (EIA/IS-649). Washington, DC, 1995.



      EIA 98 Electronic Industries Alliance. Systems Engineering Capability Model (EIA/IS-731). Washington, DC, 1998. <http://geia.org/sstc/G47/731dwnld.htm>



      FAA 97 Federal Aviation Administration. Integrated Capability Maturity Model, Version 1.0 (FAA-iCMM), November 1997. <http://www.faa.gov/aio/ProcessEngr/iCMM/index.htm>



      Hefner 01 Hefner, Rick. CMMI Risk Management Requirements. Presentation at SEPG Conference, 2001.



      Herbsleb 97 Herbsleb, James; Zubrow, David; Goldenson, Dennis; Hayes, Will; and Paulk, Mark. "Software Quality and the Capability Maturity Model." Communications of the ACM 40, 6 (June 1997): 30�40.



      Humphrey 89 Humphrey, Watts S. Managing the Software Process. Reading, MA: Addison-Wesley, 1989.



      IEEE 90 Institute of Electrical and Electronics Engineers. IEEE Standard Computer Dictionary: A Compilation of IEEE Standard Computer Glossaries. New York: IEEE, 1990.



      INCOSE 96 International Council on Systems Engineering. Systems Engineering Capability Assessment Model, Version 1.50. Seattle, June 1996.



      ISO 87 International Organization for Standardization. ISO 9000: International Standard. New York, 1987. <http://www.iso.ch/>



      ISO 95 International Organization for Standardization and International Electrotechnical Commission. ISO/IEC TR 12207 Information Technology�Software Life Cycle Processes, 1995. <http://www.iso.ch/>



      ISO 98 International Organization for Standardization and International Electrotechnical Commission. ISO/IEC TR 15504 Information Technology�Software Process Assessment, 1998. <http://www.iso.ch/>



      ISO 00 International Organization for Standardization. ISO 9001, Quality Management Systems�Requirements, 2000. <http://www.iso.ch/>



      ISO 02 International Organization for Standardization and International Electro technical Commission. ISO/IEC 15939 Software Engineering�Software Measurement Process, 2002. <http://www.iso.ch/>



      Juran 88 Juran, J. M. Juran on Planning for Quality. New York: Macmillan, 1988.



      Masters 95 Masters, S.; and Bothwell, C. CMM Appraisal Framework (CMU/SEI-95-TR-001). Pittsburgh, PA: Software Engineering Institute, Carnegie Mellon University, February 1995. <http://www.sei.cmu.edu/publications/documents/95.reports/95-tr-001/95-tr-001-abstract.html>



      McGarry 00 McGarry, John; Card, David; Jones, Cheryl; Layman, Beth; Clark, Elizabeth; Dean, Joseph; and Hall, Fred. Practical Software Measurement: Objective Information for Decision Makers. Boston: Addison-Wesley, 2002.



      SEI 95 Software Engineering Institute. The Capability Maturity Model: Guidelines for Improving the Software Process. Reading, MA: Addision-Wesley, 1995.


      SEI 97a Integrated Product Development Capability Maturity Model, Draft Version 0.98. Pittsburgh, PA: Enterprise Process Improvement Collaboration and Software Engineering Institute, Carnegie Mellon University, July 1997. <ftp://ftp.sei.cmu.edu/pub/CMMI/ipd-cmm-draft/>



      SEI 97b Software Engineering Institute. Software CMM, Version 2.0 (Draft C), October 22, 1997. <http://www.sei.cmu.edu/activities/cmm/draft-c/c.html>



      SEI 99 Software Engineering Institute. CMMI A-Specification, Version 1.4, April 1999. <http://www.sei.cmu.edu/cmmi/org-docs/aspec1.4.html>



      SEI 01a CMMI Product Development Team. ARC v1.1, Appraisal Requirements for CMMI, Version 1.1 (CMU/SEI-2001-TR-034, ESC-TR-2001-034). Pittsburgh, PA: Software Engineering Institute, Carnegie Mellon University, December 2001. <http://www.sei.cmu.edu/publications/documents/01.reports/01tr034.html>



      SEI 01b CMMI Product Development Team. SCAMPI v1.1, Standard CMMI Appraisal Method for Process Improvement, Version 1.1: Method Definition Document (CMU/SEI-2001-HB-001). Pittsburgh, PA: Software Engineering Institute, Carnegie Mellon University, December 2001. <http://www.sei.cmu.edu/publications/documents/01.reports/01hb001.html>



      SEI 01c Paulk, Mark; and Chrissis, Mary Beth. The 2001 High Maturity Workshop (CMU/SEI-2001-SR-014). Pittsburgh, PA: Software Engineering Institute, Carnegie Mellon University, January 2002. <http://www.sei.cmu.edu/publications/documents/01.reports/01sr014.html>



      SEI 02a CMMI Product Development Team. CMMI for Systems Engineering/Software Engineering, Version 1.1 Staged Representation (CMU/SEI-2002-TR-002, ESC-TR-2002-002). Pittsburgh, PA: Software Engineering Institute, Carnegie Mellon University, January 2002. <http://www.sei.cmu.edu/publications/documents/02.reports/02tr002.html>



      SEI 02b CMMI Product Development Team. CMMI for Systems Engineering/Software Engineering, Version 1.1 Continuous Representation (CMU/SEI-2002-TR-001, ESC-TR-2002-001). Pittsburgh, PA: Software Engineering Institute, Carnegie Mellon University, January 2002. <http://www.sei.cmu.edu/publications/documents/02.reports/02tr001.html>



      SEI 02c CMMI Product Development Team. CMMI for Systems Engineering/Software Engineering/Integrated Product and Process Development, Version 1.1 Staged Representation (CMU/SEI-2002-TR-004, ESC-TR-2002-004). Pittsburgh, PA: Software Engineering Institute, Carnegie Mellon University, January 2002. <http://www.sei.cmu.edu/publications/documents/02.reports/02tr004.html>



      SEI 02d CMMI Product Development Team. CMMI for Systems Engineering/Software Engineering/Integrated Product and Process Development, Version 1.1 Continuous Representation (CMU/SEI-2002-TR-003, ESC-TR-2002-003). Pittsburgh, PA: Software Engineering Institute, Carnegie Mellon University, January 2002. <http://www.sei.cmu.edu/publications/documents/02.reports/02tr003.html>



      SEI 02e CMMI Product Development Team. CMMI for Systems Engineering/Software Engineering/Integrated Product and Process Development/Supplier Sourcing, Version 1.1 Staged Representation (CMU/SEI-2002-TR-012, ESC-TR-2002-012). Pittsburgh, PA: Software Engineering Institute, Carnegie Mellon University, March 2002. <http://www.sei.cmu.edu/publications/documents/02.reports/02tr012.html>



      SEI 02f CMMI Product Development Team. CMMI for Systems Engineering/Software Engineering/Integrated Product and Process Development/Supplier Sourcing, Version 1.1 Continuous Representation (CMU/SEI-2002-TR-011, ESC-TR-2002-011). Pittsburgh, PA: Software Engineering Institute, Carnegie Mellon University, March 2002. <http://www.sei.cmu.edu/publications/documents/02.reports/02tr011.html>



      SEI 02g Software Engineering Institute. The Measurement and Analysis Process Area in CMMI, 2002. <http://www.sei.cmu.edu/cmmi/publications/meas-anal-cmmi.html>



      SEI 02h Software Engineering Institute. Software Acquisition Capability Maturity Model (SA-CMM) Version 1.03 (CMU/SEI-2002-TR-010, ESC-TR-2002-010). Pittsburgh, PA: Software Engineering Institute, Carnegie Mellon University, March 2002. <http://www.sei.cmu.edu/publications/documents/02.reports/02tr010.html>



      Shewhart 31 Shewhart, Walter A. Economic Control of Quality of Manufactured Product. New York: Van Nostrand, 1931.



      SPMN 97 Software Program Managers Network. Program Managers Guide to Software Acquisition Best Practices, Version 2.31, 1998. <http://www.spmn.com/products_guidebooks.html>









        [ Team LiB ]



        Section 13.29. there are no Dumb Questions










        13.29. there are no Dumb Questions



        Q:

        What about ordered lists? What can I do to change their style?

        A:

        You style ordered and unordered lists in the same way. Of course, an ordered list has a sequence of numbers or letters for markers, not bullets. Using CSS you can control whether an ordered lists' markers are decimal numbers, roman numerals, or alphabetic letters (like a, b, c) with the list-style-type property. Common values are decimal, upper-alpha, lower-alpha, upper-roman, and lower-roman. Consult a CSS reference for more options (there are many).

        Q:

        How can I control the text wrap on lists? In other words, how can I control whether text wraps underneath the marker or just underneath the text?

        A:

        There's a property called list-style-position. If you set this property to "inside" then your text will wrap under the marker. If you set it to "outside" then it will wrap just under the text above it.

        Q:

        Are you sure that's right? That seems backwards.

        A:

        Yes, and here's what inside and outside really mean: if you set your line-style-position to "inside" then the marker is inside your list item and so text will wrap under it. If you set it to "outside", then the marker is outside your list item and so text will just wrap under itself. And, by "inside your item" we mean inside the border of the list item's box.


        Wow, who would have known we could take my site this far when we started?


        We're going to get Tess a Segway of her own so she can go with me on the rest of my Segway'n USA trip. See ya somewhere... and we'll BOTH be updating the Web page. Thanks for everything!



        BULLET POINTS


        • XHTML tables are used to structure tabular data.

        • Use the HTML table elements, <table>, <tr>, <th>, and <td> together to create a table.

        • The <table> element defines and surrounds the entire table.

        • Tables are defined in rows, using the <tr> element.

        • Each row contains one or more data cells, defined with the <td> element.

        • Use the <th> element for data cells that are row or column headings.

        • Tables are laid out in a grid. Each row corresponds to a <tr>...</tr> row in your HTML, and each column corresponds to the <td>...</td> content within the rows.

        • You can provide additional information about your tables with the table summary attribute, and the <caption> element.

        • Table data cells can have padding, borders, and border spacing, which is the space between cells.

        • Just like you can control the padding, borders, and margins of elements, you can control the padding, borders, and border spacing of table cells with CSS.

        • The border-collapse property is a special CSS property for tables that allows you to combine cell borders into one border for a cleaner look.

        • You can change the alignment of the data in your table cells with the text-align and vertical-align CSS properties.

        • You can add color to your tables with the background-color property. Background color can be added to the entire table, to each row, or to a single data cell.

        • If you have no data for a data cell, put no content into the <td> element. You need to use a <td>...</td> element to maintain the alignment of the table, however.

        • If your data cell needs to span multiple rows or columns, you can use the rowspan or colspan attributes of the <td> element.

        • You can nest tables within tables by placing the <table> element and all its content inside a data cell.

        • Tables should be used for tabular data, not for laying out your pages. Use CSS positioning to create multi-column page layouts as we described in Chapter 12.

        • Lists can be styled with CSS just like any other element. There are a few CSS properties specific to lists, such as list-style-type and list-style-image.

        • list-style-type allows you to change the type of the marker used in your list.

        • list-style-image allows you to specify an image for your list marker.














        Other Animation Approaches









        Other Animation Approaches


        This chapter has been concerned with developing a threaded animation loop inside a JPanel. But other ways of implementing animation in Java exist, and I'll briefly consider two of them:


        • Using the Swing timer

        • Using the utility timer from java.util.timer


        Both of them use a timer to trigger method calls at regular intervals. However, I'll present timing figures that show that the Swing timer doesn't have the necessary accuracy for my needs, while the utility timer is a possible alternative.



        Swing Timer Animation


        The Swing timer (in javax.swing.Timer) is used as the basis of animation examples in many Java textbooks.


        The essential coding technique is to set a Timer object to "tick" every few milliseconds. Each tick sends an event to a specified ActionEvent listener, triggering a call to actionPerformed( ). actionPerformed( ) calls repaint( ) to send a repaint request to the JVM. Eventually, repainting reaches the paintComponent( ) method for the JPanel, which redraws the animation canvas. These stages are shown in Figure 2-1, which represents the test code in SwingTimerTest.java.



        Figure 2-1. Swing timer animation



        The SwingTimerTest class uses the Swing timer to draw the current average FPS values repeatedly into a JPanel. The period for the timer is obtained from the requested FPS given on the command line. The average FPS are calculated every second, based on FPS values collected over the previous 10 seconds.


        main( ) reads in the user's required FPS and converts them to a period. It creates a JFrame and puts the SwingTimerPanel inside it.


        The SwingTimerTest( ) constructor creates the timer and sends its "ticks" to itself:



        new Timer(period, this).start( );



        actionPerformed( ) wastes some time by calling a sillyTask( ) method that does a lot of looping and then requests a repaint:



        public void actionPerformed(ActionEvent e)
        { sillyTask( );
        repaint( );
        }



        paintComponent( ) updates the JPanel and records statistics:



        public void paintComponent(Graphics g)
        {
        super.paintComponent(g);

        // clear the background
        g.setColor(Color.white);
        g.fillRect (0, 0, PWIDTH, PHEIGHT);

        // report average FPS
        g.setColor(Color.black);
        g.drawString("Average FPS: " + df.format(averageFPS), 10, 25);

        reportStats( ); // record/report statistics
        } // end of paintComponent( )



        The most complicated part of this example is the statistics gathering done by reportStats( ). It's worth looking at the code since it appears again in Chapters 3 and 4.


        reportStats( ) prints a line of statistics every second:



        D>java SwingTimerTest 50
        fps: 50; period: 20 ms
        1 3.0099s 200.99% 50c 16.61 16.61 afps
        1 2.7573s 175.73% 100c 17.34 16.98 afps
        1 2.7344s 173.44% 150c 17.64 17.2 afps
        1 2.746s 174.6% 200c 17.78 17.34 afps
        1 2.7545s 175.45% 250c 17.85 17.45 afps
        1 2.7522s 175.22% 300c 17.91 17.52 afps
        1 2.7299s 172.99% 350c 17.96 17.59 afps
        1 2.7581s 175.81% 400c 17.98 17.64 afps
        : // more lines until ctrl-C is typed



        The first line of the output lists the requested FPS and the corresponding period used by the timer. It's followed by multiple statistic lines, with a new line generated when the accumulated timer period reaches 1 second since the last line was printed.


        Each statistics line presents six numbers. The first three relate to the execution time. The first number is the accumulated timer period since the last output, which will be close to one second. The second number is the actual elapsed time, measured with the Java 3D timer, and the third value is the percentage error between the two numbers.


        The fourth number is the total number of calls to paintComponent( ) since the program began, which should increase by the requested FPS value each second.


        The fifth number is the current FPS, calculated by dividing the total number of calls by the total elapsed time since the program began. The sixth number is an average of the last 10 FPS numbers (or fewer, if 10 numbers haven't been calculated yet).


        The reportStats( ) method, and its associated global variables, are shown here:



        private static long MAX_STATS_INTERVAL = 1000L;
        // record stats every 1 second (roughly)

        private static int NUM_FPS = 10;
        // number of FPS values stored to get an average

        // used for gathering statistics
        private long statsInterval = 0L; // in ms
        private long prevStatsTime;
        private long totalElapsedTime = 0L;

        private long frameCount = 0;
        private double fpsStore[];
        private long statsCount = 0;
        private double averageFPS = 0.0;

        private DecimalFormat df = new DecimalFormat("0.##"); // 2 dp
        private DecimalFormat timedf = new DecimalFormat("0.####"); //4 dp

        private int period; // period between drawing in ms

        private void reportStats( )
        {
        frameCount++;
        statsInterval += period;

        if (statsInterval >= MAX_STATS_INTERVAL) {
        long timeNow = J3DTimer.getValue( );

        long realElapsedTime = timeNow - prevStatsTime;
        // time since last stats collection
        totalElapsedTime += realElapsedTime;

        long sInterval = (long)statsInterval*1000000L; // ms --> ns
        double timingError =
        ((double)(realElapsedTime - sInterval)) / sInterval * 100.0;

        double actualFPS = 0; // calculate the latest FPS
        if (totalElapsedTime > 0)
        actualFPS = (((double)frameCount / totalElapsedTime) * 1000000000L);
        // store the latest FPS
        fpsStore[ (int)statsCount%NUM_FPS ] = actualFPS;
        statsCount = statsCount+1;

        double totalFPS = 0.0; // total the stored FPSs
        for (int i=0; i < NUM_FPS; i++)
        totalFPS += fpsStore[i];


        if (statsCount < NUM_FPS) // obtain the average FPS
        averageFPS = totalFPS/statsCount;
        else
        averageFPS = totalFPS/NUM_FPS;

        System.out.println(
        timedf.format( (double) statsInterval/1000) + " " +
        timedf.format((double) realElapsedTime/1000000000L) + "s " +
        df.format(timingError) + "% " +
        frameCount + "c " +
        df.format(actualFPS) + " " +
        df.format(averageFPS) + " afps" );

        prevStatsTime = timeNow;
        statsInterval = 0L; // reset
        }
        } // end of reportStats( )



        reportStats( ) is called in paintComponent( ) after the timer has "ticked." This is recognized by incrementing frameCount and adding the period amount to statsInterval.


        The FPS values are stored in the fpsStore[] array. When the array is full, new values overwrite the old ones by cycling around the array. The average FPS smooth over variations in the application's execution time.


        Table 2-1 shows the reported average FPS on different versions of Windows when the requested FPSs were 20, 50, 80, and 100.


        Table 2-1. Reported average FPS for SwingTimerTest

        Requested FPS

        20

        50

        80

        100

        Windows 98

        18

        18

        18

        18

        Windows 2000

        19

        49

        49

        98

        Windows XP

        16

        32

        64

        64



        Each test was run three times on a lightly loaded machine, running for a few minutes. The results show a wide variation in the accuracy of the timer, but the results for the 80 FPS request are poor to downright awful in all cases. The Swing timer can't be recommended for high frame rate games.


        The timer is designed for repeatedly triggering actions after a fixed period. However, the actual action frequency can drift because of extra delays introduced by the garbage collector or long-running game updates and rendering. It may be possible to code round this by dynamically adjusting the timer's period using setDelay( ).


        The timer uses currentTimeMillis( ) internally, with its attendant resolution problems.


        The official Java tutorial contains more information about the Swing timer and animation, located in the Swing trail in "Performing Animations" (http://java.sun.com/docs/books/tutorial/uiswing/painting/animation.html).




        The Utility Timer


        A timer is available in the java.util.Timer class. Instead of scheduling calls to actionPerformed( ), the run( ) method of a TimerTask object is invoked.


        The utility timer provides more flexibility over scheduling than the Swing timer: Tasks can run at a fixed rate or a fixed period after a previous task. The latter approach is similar to the Swing timer and means that the timing of the calls can drift. In fixed-rate scheduling, each task is scheduled relative to the scheduled execution time of the initial task. If a task is delayed for any reason (such as garbage collection), two or more tasks will occur in rapid succession to catch up.


        The most important difference between javax.Swing.Timer and java.util.Timer is that the latter does not run its tasks in the event dispatching thread. Consequently, the test code employs three classes: one for the timer, consisting of little more than a main( ) function, a subclass of TimerTask for the repeated task, and a subclass of JPanel as a canvas.


        These components are shown in Figure 2-2, which represents the test code in UtilTimerTest.java.



        Figure 2-2. Utility timer animation



        The timer schedules the TimerTask at a fixed rate:



        MyTimerTask task = new MyTimerTask(...);
        Timer t = new Timer( );
        t.scheduleAtFixedRate(task, 0, period);



        The TimerTask run( ) method wastes some time looping in sillyTask( ) and then repaints its JPanel:



        class MyTimerTask extends TimerTask
        {
        // global variables and other methods

        public void run( )
        { sillyTask( );
        pp.repaint( );
        }

        private void sillyTask( )
        {...}

        } // end of MyTimerTask



        The JPanel is subclassed to paint the current average FPS values onto the canvas, and to call reportStats( ) to record timing information. Its paintComponent( ) and reportStats( ) are the same as in SwingTimerTest.


        Table 2-2 shows the reported average FPS on different versions of Windows, when the requested FPSs are 20, 50, 80, and 100.


        Table 2-2. Reported average FPSs for UtilTimerTest

        Requested FPS

        20

        50

        80

        100

        Windows 98

        20

        47

        81

        94

        Windows 2000

        20

        50

        83

        99

        Windows XP

        20

        50

        83

        95



        The average FPS are excellent, which is somewhat surprising since currentTimeMillis( ) is employed in the timer's scheduler. The average hides that it takes 1 to 2 minutes for the frame rate to rise towards the average. Also, JVM garbage collection reduces the FPS for a few seconds each time it occurs.


        The average FPS for a requested 80 FPS are often near 83 due to a quirk of my coding. The frame rate is converted to an integer period using (int) 1000/80 == 12 ms. Later, this is converted back to a frame rate of 1000/12, which is 83.333.


        The drawback of the utility timer is that the details of the timer and sleeping operations are mostly out of reach of the programmer and so, are not easily modified, unlike the threaded animation loop.


        The Java tutorial contains information about the utility timer and TimerTasks in the threads trail under the heading "Using the Timer and TimerTask Classes" (http://java.sun.com/docs/books/tutorial/essential/threads/timer.html).










          12.6 Flashback queries











           < Day Day Up > 











          12.6 Flashback queries


          In Oracle 9i, with the introduction of the undo tablespace management feature, that replaces the rollback segment approach, Oracle has also added the feature of retention. With the retention feature, the previous images of data could be retained for a user-specified period of time. The feature that supports the visibility to the previous queries and data from the undo tablespace is called ''flashback.''


          Using the flashback query feature provides visibility to data at a point- in-time in the past, and this data could be used to compare the data in the present. In the case of an UPDATE operation, the flashback query option provides visibility to the data exactly as it appeared before the UPDATE statement was executed.


          How much of the past data is visible depends on the UNDO_RETENTION parameter defined in the init<SID>.ora file. To retrieve these rows, Oracle has provided certain built-in packages such as DBMS_FLASH BACK and a set of standard procedures.


          Benefits of using flashback query





          • Saving SCNs and flashing back to those SCNs, instead of saving data sets and retrieving them later, could gain application performance.




          • Flashback queries are online operations, in the sense that while normal activity against the database is in progress, users could perform flashback query transactions against the UNDO tablespace without affecting the normal activity. This is possible because flashback query normally goes back in time and different sessions can flash back to different flashback times or SCNs on the same object concurrently.




          • Apart from defining an appropriate value for the UNDO_RETENTION parameter, no additional management activity is required to perform flashback queries.




          While flashback queries are good to retrieve and audit certain operations in the past, this feature cannot be used to undo any activity. It only helps identify changes during a period of time or changes performed by a specific SCN.






          Oracle 10g 

          New Feature: There are significant enhancements to the flashback functionality in Oracle 10g,





          1. FLASHBACK DATABASE: will help bring the database to a prior point in time by undoing all the changes that have taken place since that time.





          2. FLASHBACK TRANSACTION HISTORY: using the DBA_TRANSACTION_QUERY view provided, changes to the database can be examined at the transaction level.





          3. FLASHBACK TABLE: this statement helps quickly recover a table to a point in time in the past, eliminating the need to restore from a backup.





          4. FLASHBACK DROP: Provides a way to restore accidentally dropped tables. When tables are dropped Oracle places them in a recycle bin from which they can later be recovered.





          Flashback queries in RAC


          Each instance in a two or more instance configuration such as RAC maintains its undo activity in their respective UNDO tablespaces. Similarly, each instance configures in its respective init<SID>.ora file the UNDO_RETENTION parameter that provides the threshold value on how many days' worth of undo data is retained, and makes the flashback query features specific to every instance.



















           < Day Day Up > 



          Summary



          [ Team LiB ]





          Summary


          Most database administrators are handed an application or a database and instructed to make it go faster. There's no documentation, no SQL activity rates, nothing. The DBA needs to use the monitoring facilities available to discover the tuning opportunities. Learn which tables are most frequently read and assign them to their own tablespaces. Pair synchronously read tablespaces with bufferpools that are intended to have random access, and tablespaces that are heavily asynchronously read with bufferpools that are intended to have prefetch access. Prefetch bufferpools need to be large enough to accommodate the demand, while random bufferpools should seek to minimize physical I/O rates via size increases until either (1) system paging occurs, or (2) the point of diminishing returns is reached.


          In this chapter, bufferpools were introduced and their purpose described. Creating, altering, dropping, and monitoring bufferpools was discussed, in conjunction with monitoring tables and tablespaces. Several important formulas for evaluating tablespace and bufferpool performance were presented, and techniques for tuning tablespaces were discussed.





            [ Team LiB ]



            Recipe 5.4. Creating a Dynamic Variable Name










            Recipe 5.4. Creating a Dynamic Variable Name



            5.4.1. Problem


            You want to construct

            a variable's name dynamically. For example, you want to use variable names that match the field names from a database query.




            5.4.2. Solution


            Use PHP's variable variable syntax by prepending a

            $ to a variable whose value is the variable name you want:


            $animal = 'turtles';
            $turtles = 103;
            print $$animal;


            103





            5.4.3. Discussion


            Placing two dollar signs before a variable name causes PHP to de-reference
            the right variable name to get a value. It then uses that value as the name of your "real" variable. For example:


            $animal = 'turtles';
            $turtles = 103;
            print $$animal;


            103



            This prints 103. Because $animal = 'turtles', $$animal is $turtles, which equals 103.


            Using curly braces

            , you can construct more complicated expressions that indicate variable names:


            $stooges = array('Moe','Larry','Curly');
            $stooge_moe = 'Moses Horwitz';
            $stooge_larry = 'Louis Feinberg';
            $stooge_curly = 'Jerome Horwitz';

            foreach ($stooges as $s) {
            print "$s's real name was ${'stooge_'.strtolower($s)}.\n";
            }
            Moe's real name was Moses Horwitz.
            Larry's real name was Louis Feinberg.
            Curly's real name was Jerome Horwitz.



            PHP evaluates the expression between the curly braces and uses it as a variable name. That expression can even have function calls in it, such as
            strtolower( ).


            Variable variables are also useful when iterating through similarly named variables. Say you are querying a database table that has fields named title_1, title_2, etc. If you want to check if a title matches any of those values, the easiest way is to loop through them like this:


            for ($i = 1; $i <= $n; $i++) {
            $t = "title_$i";
            if ($title == $$t) { /* match */ }
            }



            Of course, it would be more straightforward to store these values in an array, but if you are maintaining old code that uses this technique (and you can't change it), variable variables are helpful.


            The curly brace syntax is also necessary in resolving ambiguity about array elements. The variable variable $$donkeys[12] could have two meanings. The first is "take what's in the 12th element of the $donkeys array and use that as a variable name." Write this as: ${$donkeys[12]}. The second is "use what's in the scalar $donkeys as an array name and look in the 12th element of that array." Write this as: ${$donkeys}[12].


            You are not limited by two dollar signs. You can use three, or more, but in practice it's rare to see greater than two levels of indirection.




            5.4.4. See Also


            http://www.php.net/language.variables.variable for documentation on variable variables.













            Section 9.22. The two minute guide to hex codes










            9.22. The two minute guide to hex codes


            The first thing you need to know about hex codes is that they aren't based on ten digits (0 to 9)7 they're based on 16 digits (0 to F). Here's how hex digits work:


            Using hex, you only need a single digit to count all the way from 0 to 15. When you get above 9, you start using letters.


            So if you see a hex number like B, you know that just means 11. But, what does BB, or E1, or FF mean? Let's disassemble a hex color and see what it actually represents. In fact, here's how you can do that for any hex color you might encounter.



            9.22.1. Step one:


            Separate the hex color into its three components.


            Remember that each hex color is made up of a red, green and blue component. The first thing you want to do is separate those.



            # cc 66 00

            Red Blue Green


            CC 66 00

            Take your hex color and break it up into its red, green, and blue components.





            9.22.2. Step two:


            Convert each hex number into its decimal equivalent.


            Now that you have the components separated you can compute the value for each from 0 to 255. Let's start with the hex number for the red component:


            Now take the left-most number and convert it to its decimal value, and also multiply it by 16.


            Finally, add these two numbers together.



            CC

            12

            12 * 16 = 192

            Take the
            right-most number and write down its decimal value.

            192 + 12 = 204
            So 204
            is the decimal equivalent of CC in hex.






            9.22.3. Step three:


            Now do this for the other two values.


            Repeat the same method on the other two values. Here's what you should get:



            CC 66 00
            204 102 0




            To calculate 66, you have (6 *16)+ 6 = 102


            To calculate 00, you have (0 *16)+ 0 = 0




            9.22.4. Step four:


            There is no step four, you're done!


            That's it. Now you've got the numbers for each component and you know exactly how much red, green, and blue go into the color. You can disassemble any hex color in exactly the same way. Now let's see how you'll usually determine Web colors.




            Putting it all together


            You've now got a few different ways to specify colors. Take our orange color that is made up of 80% red, 40% green, and 0% blue. In CSS we could specify this color in any of these ways:



            body {
            background-color: rgb(80%, 40%, 0%);
            Specify by the percentage of red,
            green and blue.

            }
            body {
            background-color: rgb(204, 102, 0);
            Specify the amount of red, green and
            blue on the scale 0255.

            }
            body {
            background-color: #cc6600;
            Specify using a compact hex code.
            }















            Job scheduling Versus Workflow










            Job scheduling Versus Workflow


            It's important to understand that job scheduling is not workflow. The two are often used as part of the same solution, but they are distinct solutions, and each can stand on its own. A job generally consists of several steps. Consider the password expiration job mentioned earlier. Essentially three distinct steps make up the job:


            1. Get a list of users about to expire

            2. Generate an e-mail for each user in the list

            3. Update the record so we know an e-mail has already been sent for next time


            This job can take advantage of a workflow in which each part of the job is a step in the workflow. This doesn't mean that job scheduling without a workflow component is bad. It's just a very common next step. As long as the jobscheduling framework can integrate with a thirdparty workflow solution as Quartz easily does, all is good. More on Quartz and workflow comes in Chapter 14, "Using Quartz with Workflow."












            Configuring the JobStoreTX JobStore










            Configuring the JobStoreTX JobStore


            You can select the JobStoreTX class by setting the class name like this:


            org.quartz.jobStore.class =
            org.quartz.impl.jdbcjobstore.JobStoreTX


            Table A.4 lists the available properties for configuring a Quartz JobStore. Only a few of the properties are required, and the rest have reasonable defaults.



            Table A.4. The Properties for Configuring the Quartz JobStore

            Name

            Required

            Type

            Default Value

            org.quartz.jobStore.driverDelegateClass

            Yes

            String

            null

            org.quartz.jobStore.dataSource

            Yes

            String

            null

            org.quartz.jobStore.tablePrefix

            No

            String

            QRTZ_

            org.quartz.jobStore.useProperties

            No

            Boolean

            false

            org.quartz.jobStore.misfireThreshold

            No

            Integer

            60000

            org.quartz.jobStore.isClustered

            No

            Boolean

            false

            org.quartz.jobStore.clusterCheckinInterval

            No

            Long

            15000

            org.quartz.jobStore.maxMisfiresToHandleAtATime

            No

            Integer

            20

            org.quartz.jobStore.dontSetAutoCommitFalse

            No

            Boolean

            false

            org.quartz.jobStore.selectWithLockSQL

            No

            String

            "SELECT * FROM {0}LOCKS WHERE LOCK_NAME = ? FOR UPDATE"

            org.quartz.jobStore.txIsolationLevelSerializable

            No

            Boolean

            false




            org.quartz.jobStore.driverDelegateClass


            Quartz can use most of the popular database platforms by using a delegate. These are the allowed values for the org.quartz.jobStore.driverDelegateClass property:


            • org.quartz.impl.jdbcjobstore.StdJDBCDelegate

            • org.quartz.impl.jdbcjobstore.MSSQLDelegate

            • org.quartz.impl.jdbcjobstore.PostgreSQLDelegate

            • org.quartz.impl.jdbcjobstore.WebLogicDelegate (for WebLogic drivers)

            • org.quartz.impl.jdbcjobstore.oracle.OracleDelegate

            • org.quartz.impl.jdbcjobstore.oracle.WebLogicOracleDelegate

            • org.quartz.impl.jdbcjobstore.oracle.weblogic.WebLogicOracleDelegate

            • org.quartz.impl.jdbcjobstore.CloudscapeDelegate

            • org.quartz.impl.jdbcjobstore.DB2v6Delegate

            • org.quartz.impl.jdbcjobstore.DB2v7Delegate

            • org.quartz.impl.jdbcjobstore.HSQLDBDelegate

            • org.quartz.impl.jdbcjobstore.PointbaseDelegate





            org.quartz.jobStore.dataSource


            The value for this property must be the name of one the DataSources defined in the DataSource configuration section later in this appendix.




            org.quartz.jobStore.tablePrefix


            The table prefix property is a string equal to the prefix given to Quartz's tables that were created in your database. You can have multiple sets of Quartz tables within the same database if they use different table prefixes.




            org.quartz.jobStore.useProperties


            The "use properties" setting instructs the JDBC JobStore that all values in JobDataMaps will be Strings and, therefore, can be stored as name-value pairs instead of storing more complex objects in their serialized form in the BLOB column. This can be helpful because you avoid the class-versioning issues that can arise from serializing your non-String classes into a BLOB.




            org.quartz.jobStore.misfireThreshold


            Set this property to the number of milliseconds the Scheduler will tolerate a trigger to pass its next-fire time before it is considered misfired. The default value is 60000 (60 seconds).




            org.quartz.jobStore.isClustered


            Set this to true to turn on clustering features. This property must be set to TRue if you are using multiple instances of Quartz and the same set of database tables.




            org.quartz.jobStore.clusterCheckinInterval


            Set the frequency (in milliseconds) at which this instance checks in with the other instances of the cluster. This value affects the quickness of detecting failed instances.





            org.quartz.jobStore.maxMisfiresToHandleAtATime


            This is the maximum number of misfired triggers the JobStore will handle in a given pass. Handling many (more than a couple dozen) at once can cause the database tables to be locked long enough to hamper the performance of firing other (not yet misfired) triggers.




            org.quartz.jobStore.dontSetAutoCommitFalse


            Setting this parameter to TRue tells Quartz not to call setAutoCommit(false) on connections obtained from the DataSource(s). This can be helpful in a few situations, such as if you have a driver that complains if it is called when it is already off. This property defaults to false because most drivers require setAutoCommit(false) to be called.




            org.quartz.jobStore.selectWithLockSQL


            This must be a SQL string that selects a row in the LOCKS table and places a lock on the row. If it is not set, the default is SELECT * FROM {0}LOCKS WHERE LOCK_NAME = ? FOR UPDATE, which works for most databases. The {0} is replaced during runtime with the TABLE_PREFIX that you configured earlier.




            org.quartz.jobStore.txIsolationLevelSerializable


            A value of TRue tells Quartz (when using JobStoreTX or CMT) to call setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE) on JDBC connections. This can be helpful to prevent lock timeouts with some databases under high load and long-lasting transactions.













            ctype










            Class Name ctype

            Header File <locale>

            Classification abstract data type



            Class Relationship Diagram



            Class Description

            Member Classes


            locale::id

            Methods




            explicit ctype(size_t refs = 0);


            ~ctype();


            virtual bool do_is(mask m, charT c) const;


            virtual const charT* do_is(const charT* low, const charT* high,
            mask* vec) const;


            virtual const charT* do_scan_is(mask m, const charT* low,
            const charT* high) const;


            virtual const charT* do_scan_not(mask m, const charT* low,
            const charT* high) const;


            virtual char do_narrow(charT, char dfault) const;


            virtual const charT* do_narrow(const charT* low, const charT* high,
            char dfault, char* dest) const;


            virtual charT do_tolower(charT c) const;


            virtual const charT* do_tolower(charT* low, const charT* high) const;


            virtual charT do_toupper(charT c) const;


            virtual const charT* do_toupper(charT* low, const charT* high) const;


            virtual charT do_widen(char) const;


            virtual const char* do_widen(const char* low, const char* high,
            charT* dest) const;


            bool is(mask m, charT c) const;


            const charT* is(const charT* low, const charT* high, mask* vec) const;


            char narrow(charT c, char dfault) const;


            const charT* narrow(const charT* low, const charT*, char dfault,
            char* to) const;


            const charT* scan_is(mask m, const charT* low, const charT* high) const;


            const charT* scan_not(mask m, const charT* low, const charT* high) const;


            charT tolower(charT c) const;


            const charT* tolower(charT* low, const charT* high) const;


            charT toupper(charT) const;


            const charT* toupper(charT* low, const charT* high) const;


            charT widen(char c) const;


            const char* widen(const char* low, const char* high, charT* to) const;




            Class Description



            The ctype template class describes a class used to provide character classifications
            and simple conversions.




            locale::id



            locale::id is a class used to provide an identification of a locale facet interfaces used as
            an index for lookup and to encapsulate initialization.







            Method ctype()

            Access Public

            Classification Constructor

            Syntax explicit ctype(size_t refs = 0);

            Parmeters refs, if the refs argument = 0 then the destruction
            of the object is delegated to the locale or locales
            which contain it. If refs = 1 then the object must
            be explicitly deleted. The locale will not delete it.
            The object can then be maintained across the lifetime
            of multiple locales.

            Returns None



            Description



            This constructor constructs a ctype facet object.







            Method ctype()

            Access Protected

            Classification Destructor

            Syntax ~ctype();

            Parmeters None

            Returns None



            Description



            The destructor destroys a ctype facet object.







            Method do_is()

            Access Protected

            Classification Accessor

            Syntax virtual bool do_is(mask m, charT c) const;

            Parameters m is one of the mask available from the ctype_base.

            c is the character to be classified.

            Return This method returns true if the character matches the
            classification indicated by the mask.



            Description



            The do_is() method classifies a character. The method determines if the character
            matches the classification indicated by the mask argument m. It returns
            true if the character matches the classification indicated by the mask.







            Method do_is()

            Access Protected

            Classification Accessor

            Syntax virtual const charT* do_is(const charT* low,
            const charT* high,
            mask* vec) const;

            Parameters low is the beginning of a sequence of characters.

            high is the end of a sequence of characters.

            vec is a vector of masks.

            Return This method returns the high argument.



            Description



            The do_is() method classifies a sequence of characters. The method fills vec with
            every mask from the ctype_base and applies it to the sequence of characters in the
            range [low, high).







            Method do_scan_is()

            Access Protected

            Classification Accessor

            Syntax virtual const charT* do_scan_is(mask m,
            const charT* low,
            const charT* high) const;

            Parameters m is one of the mask available from the ctype_base.


            low is the beginning of a sequence of characters.

            high is the end of a sequence of characters.


            Returns This method returns the first character in the
            range that matches the classification indicated
            by the mask m.



            Description



            The do_scan_is() method locates a character in the range [low, high) that
            conforms to the classification indicated by the mask argument m.
            This method returns the first character in the range that matches the
            classification indicated by the mask m. If the character is not in
            the range high is returned.








            Method do_scan_not()

            Access Protected

            Classification Accessor

            Syntax virtual const charT* do_scan_not(mask m,
            const charT* low,
            const charT* high) const;

            Parameters m is one of the mask available from the ctype_base.


            low is the beginning of a sequence of characters.

            high is the end of a sequence of characters.


            Returns This method returns the first character in the
            range that does not match the classification
            indicated by the mask m.



            Description



            The do_scan_is() method locates a character in the range [low, high) that
            does not conform to the classification indicated by the mask argument m.
            This method returns the first character in the range that does not match the
            classification indicated by the mask m. If the character is not in
            the range high is returned.








            Method do_narrow()

            Access Protected

            Classification Modifier

            Syntax virtual char do_narrow(charT c, char dfault) const;

            Parameters c is the character to be transformed.

            dfault is character that is returned if no
            transformation takes places.

            Returns This method returns the transformed value or
            dfault if no transformation takes place.



            Description



            The do_narrow() method applies the simplest transformation from a charT value
            to the corresponding char value if it exist. The method returns the transformed
            value or returns the dfault argument if no transformation is possible.







            Method do_narrow()

            Access Protected

            Classification Modifier

            Syntax virtual const charT* do_narrow(const charT* low,
            const charT* high,
            char dfault,
            char* dest) const;

            Parameters low is the beginning of a sequence of
            characters.

            high is the end of a sequence of
            characters.

            dfault is used as a default transformation.

            dest is the destination of the results.

            Returns This method returns high.




            Description



            The do_narrow() method applies the simplest transformation from a sequence of charT
            values to the corresponding char values if they exist. If no simple transformation
            is possible then dfault is used. The method returns the transformed
            values in dest argument.







            Method do_tolower()

            Access Protected

            Classification Modifier

            Syntax virtual charT do_tolower(charT c) const;

            Parameters c is the character to be converted.

            Returns This method returns the converted character.



            Description



            The do_tolower() method converts the character argument c to
            lower case. The method returns the converted character. If no conversion is
            possible the argument is returned.







            Method do_tolower()

            Access Protected

            Classification Modifier

            Syntax virtual charT do_tolower(charT* low,
            const charT* high) const;

            Parameters low is the beginning of a sequence of
            characters.

            high is the end of a sequence of
            characters.


            Returns This method returns high.



            Description



            The do_tolower() method converts each character in the character sequence
            [low, high) argument to lower case. Each character in the range is replaced
            with the lower case character. The method returns high.







            Method do_toupper()

            Access Protected

            Classification Modifier

            Syntax virtual charT do_toupper(charT c) const;

            Parameters c is the character to be converted.

            Returns This method returns the converted character.



            Description



            The do_tolower() method converts the character argument c to
            upper case. The method returns the converted character. If no conversion is
            possible the argument is returned.







            Method do_toupper()

            Access Protected

            Classification Modifier

            Syntax virtual charT do_toupper(charT* low,
            const charT* high) const;

            Parameters low is the beginning of a sequence of
            characters.

            high is the end of a sequence of
            characters.


            Returns This method returns high.



            Description



            The do_tolower() method converts each character in the character sequence
            [low, high) argument to upper case. Each character in the range is replaced
            with the upper case character. The method returns high.







            Method do_widen()

            Access Protected

            Classification Modifier

            Syntax virtual charT do_widen(charT c) const;

            Parameters c is the character to be converted.

            Returns This method returns the transformed character.



            Description



            The do_tolower() method applies the simplest transformation from a char value
            to the corresponding charT value.







            Method do_widen()

            Access Protected

            Classification Modifier

            Syntax virtual const charT* do_widen(const char* low,
            const char* high,
            charT* dest) const;

            Parameters low is the beginning of a sequence of
            characters.

            high is the end of a sequence of
            characters.

            dest is the destination of the results.

            Returns This method returns high.




            Description



            The do_narrow() method applies the simplest transformation from a sequence of char
            values to the corresponding charT values if they exist. The method returns the
            transformed values in dest argument. The method returns high.







            Method is()

            Access Public

            Classification Accessor

            Syntax bool is(mask m, charT c) const;

            Parameters m is one of the mask available from the ctype_base.

            c is the character to be classified.

            Return This method returns true if the character matches the
            classification indicated by the mask.



            Description



            The do_is() method returns do_is(m, c).







            Method is()

            Access Public

            Classification Accessor

            Syntax const charT* is(const charT* low,
            const charT* high,
            mask* vec) const;

            Parameters low is the beginning of a sequence of characters.

            high is the end of a sequence of characters.

            vec is a vector of masks.

            Return This method returns the high argument.



            Description



            The do_is() method returns do_is(low, high, vec).







            Method scan_is()

            Access Public

            Classification Accessor

            Syntax const charT* scan_is(mask m,
            const charT* low,
            const charT* high) const;

            Parameters m is one of the mask available from the ctype_base.


            low is the beginning of a sequence of characters.

            high is the end of a sequence of characters.


            Returns This method returns the first character in the
            range that matches the classification indicated
            by the mask m.



            Description



            The scan_is() method returns do_scan_is(m, low, high).







            Method scan_not()

            Access Public

            Classification Accessor

            Syntax const charT* scan_not(mask m,
            const charT* low,
            const charT* high) const;

            Parameters m is one of the mask available from the ctype_base.


            low is the beginning of a sequence of characters.

            high is the end of a sequence of characters.


            Returns This method returns the first character in the
            range that does not match the classification
            indicated by the mask m.



            Description



            The scan_not() method returns scan_not(m, low, high).







            Method narrow()

            Access Public

            Classification Modifier

            Syntax char narrow(charT c, char dfault) const;

            Parameters c is the character to be transformed.

            dfault is character that is returned if no
            transformation takes places.

            Returns This method returns the transformed value or
            dfault if no transformation takes place.



            Description



            The narrow() method returns do_narrow(c, dfault).







            Method narrow()

            Access Public

            Classification Modifier

            Syntax const charT* narrow(const charT* low,
            const charT* high,
            char dfault,
            char* to) const;

            Parameters low is the beginning of a sequence of
            characters.

            high is the end of a sequence of
            characters.

            dfault is used as a default transformation.

            to is the destination of the results.

            Returns This method returns high.




            Description



            The narrow() method returns do_narrow(low, high, dfault,to).







            Method tolower()

            Access Public

            Classification Modifier

            Syntax charT tolower(charT c) const;

            Parameters c is the character to be converted.

            Returns This method returns the converted character.



            Description



            The tolower() method returns do_tolower(c).







            Method tolower()

            Access Public

            Classification Modifier

            Syntax charT tolower(charT* low,
            const charT* high) const;

            Parameters low is the beginning of a sequence of
            characters.

            high is the end of a sequence of
            characters.


            Returns This method returns high.



            Description



            The tolower() method returns do_tolower(low, high).







            Method toupper()

            Access Public

            Classification Modifier

            Syntax charT toupper(charT c) const;

            Parameters c is the character to be converted.

            Returns This method returns the converted character.



            Description



            The toupper() method returns do_toupper(c).







            Method toupper()

            Access Public

            Classification Modifier

            Syntax charT do_toupper(charT* low,
            const charT* high) const;

            Parameters low is the beginning of a sequence of
            characters.

            high is the end of a sequence of
            characters.


            Returns This method returns high.



            Description



            The toupper() method returns do_toupper(low, high).







            Method widen()

            Access Public

            Classification Modifier

            Syntax charT widen(charT c) const;

            Parameters c is the character to be converted.

            Returns This method returns the transformed character.



            Description



            The widen() method returns do_widen(c).







            Method widen()

            Access Public

            Classification Modifier

            Syntax const charT* widen(const char* low,
            const char* high,
            charT* to) const;

            Parameters low is the beginning of a sequence of
            characters.

            high is the end of a sequence of
            characters.

            to is the destination of the results.

            Returns This method returns high.




            Description



            The widen() method returns do_widen(low, high, to).





            The Class Relationship Diagram for ctype