Wednesday, June 17, 2009

Twitter via Mobile Devices

You're on Twitter and use a mobile device? Here is a list of mobile device applications (obviously not exhaustive) that will hook you up to Twitter:

Windows Mobile:
Twikini
ceTwit
TwitToday

Blackberry:

Twitterberry
Blackbird
Twibble

iPhone (get from iTunes):
TweetDeck for iPhone
Tweetie
Twitterific
Twinkle

You can follow me on Twitter: http://www.twitter.com/setiabud -- read more and comment ...

Monday, June 8, 2009

jQuery UI Sortable with TABLE

Drag and drop sorting on a web application? This thought is so far fetched several years ago - and now everybody is or can do that easily with jQuery. Looking at the tutorials and documentation in jQuery's website, it lays out a simple method to call to make our list to become sortable.

     $(function() {
        $("#sortable").sortable();
        $("#sortable").disableSelection();
    });
With our corresponding HTML:
     <ul id=sortable>
        <li>one</li>
        <li>two</li>
        <li>three</li>
        <li>four</li>
    </ul>
Here is a demo on how that works.
Now what if we are using TABLE instead of UL or OL??Easy - Use TBODY tag. So using the example above, let's convert the list into a table:
     <table id=anothersortable>
        <tbody class=content> 
            <tr><td>one</td></tr>
            <tr><td>two</td></tr>
            <tr><td>three</td></tr>
            <tr><td>four</td></tr>
        </tbody>
    </table>
Then our jQuery to be as such:
     $(function() {
        $("#anothersortable tbody.content").sortable();
        $("#anothersortable tbody.content").disableSelection();
    });
Click for demo for the simple table.You can even make this having sub-sort - or with children sorting. Like this:
     <table id=subsortsortable>
        <tbody class=content>
            <tr><td>one</td></tr>
            <tr><td>two</td></tr>
            <tr><td>
                <table><tbody class=subcontent>
                    <tr><td>three.one</td></tr>
                    <tr><td>three.two</td></tr>
                </tbody></table>
            </td></tr>
            <tr><td>four</td></tr>
        </tbody>
    </table>
Adjust our jQuery to be as such:
     $(function() {
        $("#subsortsortable tbody.content").sortable();
        $("#subsortsortable tbody.content").disableSelection();
        $("tbody.subcontent").sortable();
        $("tbody.subcontent").disableSelection();
    });
Click for demo of this one. UPDATE: Viewer Coolboy in his comment below pointed out that viewing in IE7 may sometimes introduce unexpected behavior in the y axis. I can replicate the problem and have found a solution or a work around for it by using "handler". Using handler, you basically designating a "dragging" point, instead of using the whole row as to drag. So in using handler, our code changes a little bit in both HTML and javascript. Here is the updated HTML:
     <table id=subsortsortable>
        <tbody class=content>
            <tr><td><label class="levelonehandle">X</label></td><td>one</td></tr>
            <tr><td><label class="levelonehandle">X</label></td><td>two</td></tr>
            <tr><td><label class="levelonehandle">X</label></td><td>
                <table><tbody class=subcontent>
                    <tr><td><label class="leveltwohandle">X</label></td><td>three.one</td></tr>
                    <tr><td><label class="leveltwohandle">X</label></td><td>three.two</td></tr>
                </tbody></table>
            </td></tr>
            <tr><td><label class="levelonehandle">X</label></td><td>four</td></tr>        </tbody>
    </table>
Then our javascript as such:
     $(function() {
        $("#subsortsortable tbody.content").sortable({
                handle: ".levelonehandle"
            });
        $("#subsortsortable tbody.content").disableSelection();
        $("tbody.subcontent").sortable({
                handle: ".leveltwohandle"
            });
        $("tbody.subcontent").disableSelection();
    });
-- read more and comment ...

Wednesday, June 3, 2009

How to Do Sharpening in Photoshop

Why do we need "sharpening"? Well, you actually don't. But, given 2 identical photos, you will see that the one that is sharpened will be able to identify that it seems to be better focused and "sharp". This, a lot of times enhance the photographic viewing experience and create a more detailed perception of the picture.

Let's look at an example:
Original photo (cropped)


Here is the same image after sharpening (and color correction)
Pay attention to the pointy tip of the flower and the creases - and you can see a lot more if you view large (by clicking on the images).

The sharpening technique I used is called "edge sharpening". There are a lot of variety and settings that people use for this kind of sharpening (click here for Google search result for "edge sharpening"). There are other types of sharpening, lab-sharpening or just plainly using the unsharp mask. I am not going to discuss those methods in this post, but only going to focus on edge-sharpening.

Here is the step-by-step process that I usually take (you can make this into an action if you want) - I am using Photoshop CS and I am assuming that it will be similar in the newer versions:


  1. Open you image, crop, adjust levels, curve, etc etc.
  2. Create a new channel: Go to channel palette, click the new channel icon on the bottom. Put a name on your channel, call it "Sharp Channel" (or whatever you want). In PS CS, it will create a new channel and focus on this new channel (black screen/image). Still on the channel palette, click on the RGB channel to focus back on your image.
  3. Select the whole image (Ctrl-A or do SELECT - ALL), and then copy the whole image (EDIT - COPY or EDIT - COPY MERGE)
  4. Paste it on the new channel "Sharp Channel": select the "Sharp Channel" and then paste (EDIT - PASTE). It will display as black and white, which is OK.
  5. Find edges: Make sure the "Sharp Channel" is focused/selected, and then click FILTER - STYLIZE - FIND EDGES
  6. Eventually we are going to make this as a mask. So that means that the black part will affect your image and the white area won't. If you are pretty satisfied with the mask (it is hard to say what is a "good" one at this point - you will just have to experiment), you can skip step 7 and go to step 9 directly. I usually (9 out of 10) always do step 7 & 8 ...
  7. Click IMAGE - ADJUSTMENTS - LEVELS. Try to adjust the levels by moving the triangular slide below the histogram. You basically want to make black to be very black and white to be white. Keep in mind that once we convert this channel into a mask, the black area are the one that will be sharpened. Play with this (unfortunately with trial and error) until you get the desired effect.
  8. If there are details, lots of lines, etc, you may want to introduce a nice smoot transition from the sharpened area to the non-sharpened area. Use Gaussian Blur to do this: FILTER - BLUR - GAUSSIAN BLUR (enter between 1-5 px).
  9. Now click SELECT - LOAD SELECTION. A dialog box will show up and make sure the selected channel is correct and "INVERT" checkbox is checked. Hit OK.
  10. Click "Layers" (you were on "Channels"). The mask from our edge will be super-imposed on our image. You can hide this "blinking selection" by doing this: click VIEW - SHOW - and uncheck SHOW SELECTION.
  11. Now we are ready for sharpening. It is usually helpful to view the image in large view/zoomed in. I would go for 100% zoom/view before start sharpening - so I can see/preview the affect of the sharpening. Click FILTER - SHARPEN - UNSHARP MASK. Try out combination of values in the USM window until you get the desired result. I recommend to keep the threshold to 0 and the radius to be less than 1.5.
There you go - good luck!
-- read more and comment ...