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.

mardi 19 août 2008

Trusted Trio Inbox mastering methodology.

For the past couple of months, I have been adopting the Inbox emptying workflow known as the trusted trio (see the following link) in order to have a more manageable email inbox at work.
In a nutshell, the trusted trio methodology consists of having three separate folders (FollowUp, OnHold and Archive) in which every email that lands into your inbox should go.
Typically I check my inbox once every hour and follow the following process:
  • email does not concern me: delete it immediately.
  • I can answer the email in under two minutes: reply immediately.
  • I need to follow up on that email with an action that takes more than 2 minutes: put it in the FollowUp folder.
  • I'm waiting on someone for that email: put it in OnHold.
  • I may need this email for future reference: stuff it in Archive folder.
Up until now I have been able to follow this process rather successfully, I leave work with an empty inbox, I have a FollowUp folder that contains between 10 and 40 emails.

I highly recommend mastering your email inbox with this methodology.

mercredi 30 juillet 2008

Comic strips with photoshop...



Yesterday I wanted to exercise my creativity through some playing with photoshop. I fell on a tutorial (see this link) on MacMerc.com.
Really Nice: here is what I could obtain from a photo of mine:


  

jeudi 15 mai 2008

Upgrade Your Life book.

I've been reading Gina Trapani's book "Upgrade your life". It's a book full of very useful tips and hacks about how to organize your private and work life. This book constitutes a collection of the best hack that have been published on lifehacker.com. I have been experimenting implementing some of the book's hack in my life and this has helped me keep organized and productive. I really recommend this book.  

mardi 1 avril 2008

I'm a Mac switcher

It's done, I'm an official Mac switcher. I've always been fascinated by Apple computers and Mac OS X but I never had the will and time to switch.
Two weeks ago I decided to buy myself a gift: a brand new 17" MacBook Pro; my old laptop became too noisy and slow anyway. My wallet is still screaming from pain (2500 € / 3900 dollars is a real pain in the ass) but it's worth every single penny; besides I think this box will server me at least for 5 years.
Right now I am exploring the world of Leopard and Mac OS X diverse applications.
I'f you're a fresh switcher like me I advise you to read articles posted on the following websites:
If you're a french speaking person like me, there's a brand new Mac OS X oriented magazine published in France: Competence MAC. Issue 1 is just out and it's all about Leopard. Go ahead and buy it, it's an ideal read in the metro while commuting to work.

Bye bye windows, Linux i'll still use you from time to time :)

mercredi 12 mars 2008

creating a executable wrapper for a java program.

Today I wanted to create a Windows executable wrapper around my java jar files. I find it more handy to create such an executable wrapper for daemon processes I want to add to my Windows "Startup" menu for example.

For that I used an open source program called launch4j (launch4j.sourceforge.net).

Here are the steps needed to create your own executable out of java jar files:

1) Make sure you have your main program jar file, any utility jar and resources files available in the same directory.

2) Make sure that your main program jar file's MANIFEST.MF file contains the following information:
Class-Path: *.jar
where *.jar is the list of jar files your main program needs and that should be in your classpath. For example in my case this was: Class-Path: nsclient4j.jar

Main-Class: PathOfClassContainingMainMethod
where PathOfClassContainingMainMethod is the name of the class that starts your program.
For example in my case this was:
Main-Class: net.sf.rcpperfmon.deamon.HostPerformanceStatsDeamon

3) Start Launch4j and fill these minimally needed information:
- output .exe name.
- main jar file containing the startup class.
- minimum jre version.

Once you press on the build button you should have your .exe correctly create as per the below figure.

Happy coding.....and wrapping.....


dimanche 9 mars 2008

RCP Performance Monitor

During the last couple of months I was intensively reading articles about and learning how to write RCP applications using the Eclipse Rich Client Platform technology.
In the process of learning, I managed to write a simple application (along with its accompanying server side daemon) that can be used to monitor CPU utilization of remote hosts over a network.

The code is hosted on http://code.google.com/p/rcpperfmon/ and is licensed under the LGPL.
Below is a screenshot of my application. I am very excited and happy that I managed to learn how to write Eclipse RCP apps and I am thinking about making a tutorial out of that application.

Keep posted...

Restoring GRUB boot menu from ubuntu live CD.

If windows overwrites your MBR you can boot into any ubuntu live CD and do the following from a terminal window. This happened to me today and the steps below solved my problem.

sudo grub
this will log you into GRUB, you should get a grub> prompt.

find /boot/grub/stage1
This will search for the location where grub is installed and will return a string of the form hd(?,?) which will be used in the next command.

root hd(?,?)
This will tell GRUB the correct location. Do not forget to replace the ? will the values returned frol the previous comand.

setup (hd0)
This will install GRUB on your MBR.

samedi 1 mars 2008

My first steps using the GIMP

Lately, I have been reading some tutorials about the GIMP (GNU Image Manipulation Program). The tool is really powerful and feature rich. One is only limited by their creativity while creating graphics or editing images with the GIMP.

Today, I stumbled across the following short tutorial

Using Gimp to make Web 2.0 Buttons and Graphics

And I managed to create a simple but really cool buttons for my web page. Below is a sample HTML page I crafted in 2 minutes.







mardi 26 février 2008

Compiz brings dynamic desktop effects to my Unbuntu desktop

Lately I've been messing with Ubuntu 8.04 on my desktop PC. I have to say I am really impressed by the usability and feature set of this thing. I has nothing to envy to Mac OS X or Windows Vista.
Today I just installed Compiz and Emerald theme manager on my Ubuntu desktop.
For those who may one day fall on my blog, here are the step I followed in order to install, configure and use Compiz+Emerald:

1) step by step guide to installing Compiz

2) Installing a nice OS X like theme for Compiz

3) Compiz useful shortcuts

Finally some screenshots of my Ubuntu/Compiz desktop and I strongly advise you to try it for yourself.
Thumbs up of the developers of this great piece of software.

Mac OS X like theme:



Example of a special effect:



Compiz Desktop Cube feature:



Compiz Expo feature:

mercredi 13 février 2008

Skype call quality better on (K)Ubuntu

Recently, I've been using Skype a lot to talk to my parents and friends abroad. I've used Skype on Windows XP for a while and most of the time my phone call quality used to degrade. I thought it was because my laptop was not a bleeding edge model and that it's CPU was not powerful enough. Until I installed Kubuntu on my laptop and started to use the beta version of Skype on it. To my surprise call quality was much better.
It is either because the sound subsystem of Linux is better than Windows' one or Skype is better compiled and optimized on Linux than on Windows.
Dual booters, if you use Skype and witness poor quality on Windows consider giving Skype on Linux a try.

mercredi 30 janvier 2008

VIM editor advanced tips n' tricks.

Vi IMproved is a powerful text based text editor in the UNIX world. Below are some of the most important tips I rely upon when using this text editor in my everyday work.
These tips are completely uncategorized and appear in the order I added them to this post.
  • Finding opening and closing curly brackets in a code block: [{ and ]} useful if we want to locate the beginning of a long if block.

  • Converting a pattern to uppercase. Suppose we want to convert the word "pattern" (without the double quotes) to uppercase. Here is how to do it in vim: :%s/\(pattern\)/\U\1/g

  • Auto-completion magic: pressing Ctrl+P after typing the first letter of a word will auto-complete the word in vim.

  • Basic indentation support for Java.
    In .vimrc file put the following:

    set autoindent

    set si

    set shiftwidth=4

    set smarttab

    inoremap { {<cr>}<left><cr><up><tab>

    inoremap ( ()<left>

    inoremap " ""<left>

  • useful links:
    http://www.vim.org/tips
    http://vim.wikia.com/wiki


dimanche 20 janvier 2008

DTrace is cool

Recently, I was faced with a peculiar application performance problem on Linux due to memory allocator inefficiencies. Part of the investigation mandated that I had to figure out what was the application's memory allocation pattern.
Using DTrace on Solaris 10 was the quickest and best choice possible. Within a few minutes, I was able to write a simple script that allowed me to monitor calls to memory allocation functions malloc, calloc, realloc and free.
Below is the script. Simple function entry and return probes along with aggregation functions and timer probes assembled in less than 50 lines of code did the trick.
Just imagine having to write this in C ... besides the code is meant to be disposed after the investigation, so it's the kind of situation where DTrace comes to the rescue.
I am impatiently waiting for SystemTAP (DTrace's equivalent on Linux) to support userland probes because it would allow me to do this kind of observations and investigations natively on Linux without having to resort to using Solaris 10/DTrace.

Till then, I consider DTrace to be the coolest technology Sun has introduced in Solaris 10.


#!/usr/sbin/dtrace -s
BEGIN
{
malloc = 0;
calloc = 0;
realloc = 0;
free = 0;
malloctime = 0;
printf("| timestamp | malloc | calloc | realloc | free | avg malloc duration |");
}
pid$target::malloc:entry
{
@["malloc"] = quantize(arg0);
malloc += 1;
last = timestamp;
}
pid$target::malloc:return
{
malloctime += (timestamp - last);
}
pid$target::calloc:entry
{
@["calloc"] = quantize(arg0*arg1);
calloc +=1;
}
pid$target::realloc:entry
{
@["realloc"] = quantize(arg1);
realloc += 1;
}
pid$target::free:entry
{
free += 1;
}
tick-60sec
{
avgmalloctime = malloctime/malloc;
printf("| %Y | %12d | %12d | %12d | %12d | %12d |", walltimestamp, malloc, calloc, realloc, free, avgmalloctime);
malloc = 0;
calloc = 0;
realloc = 0;
free = 0;
malloctime = 0;
}


samedi 5 janvier 2008

Welcome to my eclipse blog.

Hello and welcome to my eclipse blog.
In this blog, I will try to post quick notes about eclipse as I learn how to code RCP applications in this superb and rich platform.