Sep 24

If you are having problems getting sound working on with Ubuntu on your Sony Vaio laptop then it may be caused by the External Amplifier being switched on. This was the case for me when I recently installed Jaunty on my VGN-T37GP.

To turn the External Amplifier off do the following.

Open the Volume Control
Goto Edit>Preferences and check External Amplifier
Goto new Switches tab in Volume Control and switch External Amplifier off

With some luck you should now have sound working on your laptop.

written by objects \\ tags: , , , , , , ,

Sep 24

The Connection class has a setReadOnly() that hints to the database that the connection is read only. This will enable any possible database optimisation.

   Connection connection = DriverManager.getConnection(
        connectionString, properties);

written by objects \\ tags: ,

Sep 23

Say you have a class with a number of properties, and you then have a Collection of these beans and you want to find the bean with the largest value of one of the properties.

Instead of using a loop to go through the collection to find the largest element based on our condition we can instead use the Collections.max() method. You just need to pass it the collection to search for the max and a Comparator that defines how two beans should be compared.

MyBean max = Collections.max(collectionOfMyBean, 
   new Comparator< MyBean >() {
      public int compare(MyBean bean1, MyBean beans2) {

           // We'll assume for the sake of this example 
           // that the bean property is Comparable.
           // If its not then you would just need to 
           // adjust how the 2 values are compared

           return bean1.getProperty().compareTo(bean2.getProperty());

written by objects \\ tags: , , , ,