new ProgressBar(Shell shell, SWT.HORIZONTAL | SWT.INDETERMINATE)

July 4th, 2009







import org.eclipse.swt.SWT;

import org.eclipse.swt.layout.GridData;

import org.eclipse.swt.layout.GridLayout;

import org.eclipse.swt.widgets.Display;

import org.eclipse.swt.widgets.ProgressBar;

import org.eclipse.swt.widgets.Shell;



public class MainClass {



  public static void main(String[] a) {

    Display display = new Display();

    Shell shell = new Shell(display);

    shell.setLayout(new GridLayout());



    // Create an indeterminate progress bar

    ProgressBar pb2 = new ProgressBar(shell, SWT.HORIZONTAL | SWT.INDETERMINATE);

    pb2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));



    shell.open();

    while (!shell.isDisposed()) {

      if (!display.readAndDispatch()) {

        display.sleep();

      }

    }

  }

}



           

       

To check how the total PGA is being allocated by the instance,query the V$PGASTAT dynamic view.

July 4th, 2009



 

SQL>

SQL> select from v$pgastat

  2  where rownum < 50;

NAME                      VALUE UNIT

——————– ———- ————

aggregate PGA target   94371840 bytes

 parameter



aggregate PGA auto t   68705280 bytes

arget



global memory bound    18874368 bytes

total PGA inuse        18112512 bytes

total PGA allocated    36039680 bytes

maximum PGA allocate   40627200 bytes

d



total freeable PGA m          bytes

emory



process count                26

max processes count          26

PGA memory freed bac          bytes

k to OS



total PGA used for a          bytes

uto workareas



maximum PGA used for    7386112 bytes

 auto workareas



total PGA used for m          bytes

anual workareas



maximum PGA used for     530432 bytes

 manual workareas



over allocation coun          0

t



bytes processed       433881088 bytes

extra bytes read/wri          bytes

tten



cache hit percentage        100 percent

recompute count (tot      13259

al)





19 rows selected.



SQL> –



 

Read all file content

July 4th, 2009





Imports System.IO



Module Module1



    Sub Main()

        Dim TextFile As StreamReader



        Try

            TextFile = New StreamReader("test.txt")

        Catch As Exception

            Console.WriteLine("Error opening the file test.txt")

            Console.WriteLine("Error {0}", E.Message)

        End Try



        Dim Content As String



        Try

            Content = TextFile.ReadToEnd()

            Console.WriteLine(Content)

        Catch As Exception

            Console.WriteLine("Error reading file")

            Console.WriteLine("Error {0}: ", E.Message)

        End Try



        TextFile.Close()



    End Sub



End Module





           

       

JComboBox: getSelectedItem()

July 4th, 2009





import java.awt.BorderLayout;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;



import javax.swing.JComboBox;

import javax.swing.JFrame;



public class MainClass {



  public static void main(final String args[]) {

    final String labels[] "A""B""C""D""E" };

    JFrame frame = new JFrame("Editable JComboBox");

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);



    final JComboBox comboBox = new JComboBox(labels);

    comboBox.setMaximumRowCount(5);

    comboBox.setEditable(true);

    frame.add(comboBox, BorderLayout.NORTH);



    ActionListener actionListener = new ActionListener() {

      public void actionPerformed(ActionEvent actionEvent) {

        System.out.println("Selected: " + comboBox.getSelectedItem());

        System.out.println(", Position: " + comboBox.getSelectedIndex());

      }

    };

    comboBox.addActionListener(actionListener);



    frame.setSize(300200);

    frame.setVisible(true);



  }



}





           

       

utl_raw.cast_from_number

July 4th, 2009



 

SQL>

SQL>  select utl_raw.cast_from_number123.45 from dual;

UTL_RAW.CAST_FROM_NUMBER(123.45)

—————————————————————————————————-

C202182E



row selected.



SQL> –