dimanche 15 mars 2009

Photography technique: flash compensation.

Flash compensation is a feature that can be found on some digital cameras that allows you to control the power of the camera's flash unit (check here for more details).
When using a fill flash (check this) to lighten up a dark foreground subject compared to a bright background, flash compensation may be of utter importance.

Below are two photos I have taken of a subject placed in a relatively bright background.
I was using a Nikon D60 with the following settings kept the same across the two shots:

  • focal length: 135 mm
  • f-stop: 6
  • shutter speed: 1/80 sec
  • 400 ISO, Matrix metering, auto WB
I also used fill flash. Should I have not used fill flash, the foreground subject would have come out way too dark.
In figure 1 I did not use any flash compensation. Notice how some areas of the subject are washed out (overexposed): bottom right corner of each box and the center spot of the blue box.
Figure 2 was taken with a flash compensation of -1.3 EV. Notice how the washed out areas have diminished.

I hope this proves useful.


figure 1: fill flash with 0.0 flash compensation.

figure 2: fill flash with -1.3 flash compensation.

jeudi 12 février 2009

Third Normal Form refresher

Database normalization refresher for myself:

First Normal Form (1NF): no repeating groups of elements.

Second Normal Form (2NF): each column must depend on the entire key (in other words, no partial dependencies on a concatenated key).

Third Normal Form (3NF): each column must depend directly on the key (in other words, no dependencies on non-key attributes).

samedi 17 janvier 2009

Website design and logo video tutorials.

While in my day to day work my window to the computer world is the unix shell, I decided to tackle during some of my free time a more creative aspect of computer usage: websites design and development.
Technologies, tools and approaches in this field are numerous; Therefore the uninitiated soul like mine could easily get lost in this sea of information.
However, I quickly came to the conclusion that the best workflow to follow in designing a website is through the Adobe Creative Suite set of tools i.e. Photoshop, Flash, Dreamweaver.
After extensively searching through the net, I fell on the following website how.todesginyour.com.
The guy has a set of video tutorials that go through each of every step of:
  - designing a website in Photoshop.
  - Slicing the design for the Web.
  - Importing in Dreamweaver and coding it in HTML and CSS.

The videos cost around 50$/30€ but they are worth it. I am currently going through these videos and I have come a long way in understanding how to design an build a website.

Who knows maybe I will, one day, use this knowledge to earn money :)

mercredi 19 novembre 2008

Developing in Eclipse, modelling, reverse engineering and profiling in Netbeans.

As the old saying goes, "no size fits all"; even in the Java IDE world. I am a big fan of Eclipse as a development platform especially all the technologies that constitute the platform from SWT/JFace to GMF/EMF and RCP.
But not everything in Eclipse is as great as the above technologies and projects. 
Lately I had developed an application in Java/SWT/JFace as a tool to analyze performance metrics that are output by the software application that the company I currently work for sells and supports.
As the tool grew more complex and powerful, I had to reverse engineer and profile that application. Naturally in Eclipse one would use UML2Tools for modelling and TPTP for profiling. Problem is that I found UML2Tools to be a not so intuitive and ergonomic tool and that TPTP was a big pain in the neck to make it work once every ten attempts.
While looking at all possible alternatives (mainly free to use) I evaluated the Netbeans modeling and profiling modules. 
After some pain in making an SWT application compile and run from within Netbeans, I was impressed by the intuitiveness and easy of use of these two modules.
I think from now both Eclipse and Netbeans will be part of my Java development toolset.

Cheers,

mardi 11 novembre 2008

Making my first JFace application work.


I spent a few hours trying to make the simple HelloWorld JFace application from the book "The Definitive Guide to SWT and JFace" work. Had to go through a bunch of Internet forums and trial and error in order to make it work. The secret lies in the external jars that should be added to the build path of the project in Eclipse. Without these jars I kept getting the following error when trying to launch the application:

java.lang.NoClassDefFoundError: org/eclipse/core/runtime/IProgressMonitor

The minimum set I had to include to make the application work is the following:
  • org.eclipse.swt.xxx.jar
  • org.eclipse.jface.xxx.jar
  • org.eclipse.core.runtime.xxx.jar
  • org.eclipse.equinox.common.xxx.jar
  • org.eclipse.core.commands.xxx.jar
Hoping this will prove helpful to you...

dimanche 26 octobre 2008

Great, neat and simple Photoshop tutorial.

Those wanting to learn Photoshop in an interactive manner can read the tutorial hosted on the following website www.karbosguide.com/books/ap70.
The author of this website has posted an english translation (not perfect english though) of a booklet about Photoshop.
The booklet was targeted at Photoshop 7 but it is still valid for Photoshop CS3.
It contains a set of chapters and practical exercises dealing with all facets of Photoshop wether it's the toolset, layers, filters etc.
I highly recommend you completely read this booklet and do all the exercises in order to grasp the concepts behind Photoshop, concepts necessary in order to master more advanced uses of Photoshop like digital art and digital photography retouching.

SWT asyncExec adventures.

Lately, I have been writing a SWT GUI application that parses a (relatively large in size) log file and displays the data in a UI Tree.
Since parsing the log file could take up to ten or more seconds, I wanted to add a ProgressBar element to my UI.
I also had to make my long running operation run in its own thread so as to not block the UI. After a few trial and error attempts
and some googling, I figured how things should happen (see below code - with comments).

Basically, what needs to be kept in mind:

✓ the long running operation should run in its own thread concurrently to the UI thread.
✓ when the non UI thread needs to access UI elements in needs to do so by invoking the asyncExec method of the shell.
Otherwise, SWT illegal thread access exceptions will be thrown.

public void widgetSelected(SelectionEvent event) {
  FileDialog fd = new FileDialog(gui.getShell(), SWT.OPEN);
  ...
  final String filename = fd.open();
  
//My long running operation (parsing a log file in this case) should execute in its own thread.
  Thread th = new Thread("log file parser") {
    public void run() {
 
   //Before parsing the log file we want to enable a visual indicator in the GUI
    //for instance in our case a (indeterminate) progress bar.
    //since SWT won't let us access UI elements from a non-UI thread we have to
    //use asyncExec.

    gui.getDisplay().asyncExec(new Runnable() {
      public void run() {
        gui.enableProgressBar(true);
      }
    });

 
   //we parse the log file. Remember we are still in our new non-UI thread.
    parser.parseFile(filename);

    //After parsing the log file, we want to disable the visual indicator (i.e.
    //the progress bar and update other UI elements.

    gui.getDisplay().asyncExec(new Runnable() {
      public void run() {
        gui.enableProgressBar(false);
 
       //post-parsing work like populating a Tree or a Table.
        tree.removeAll();
        TreeItem rootTreeItem = new TreeItem(tree, 0);
        rootTreeItem.setText(parser.getRootNode().getName());
        rootTreeItem.setData(parser.getRootNode());
        new TreeItem(rootTreeItem, 0);
      }
      });
    }
  };

 
 //we kickoff our thread. Remember that the current thread (the one
  //in which our widgetSelected method is executing) is the main UI thread.

  th.start();
}
//end widgetSelected

I hope this proves helpful to you when coding SWT apps.