Photography – Portrait Lighting Patterns

I read an interesting article about common lighting patterns but the example images were lacking some clarity. I took a copy of the images and added some details that would help me remember each technique.

Roll your mouse over the image to see the original without my markups.

lighting-patterns-2

Let me know if you found this post useful or if I got anything wrong.

Windows 7, really?

I took this photo with my cell phone one morning when I turned on my Windows 7 machine.
How many updates per day does that work out to

Really? 84264 software updates? Why do people put up with crap like this.
?

Selecting rows in a paginated data grid

When displaying sets of records on the web it’s a very common thing to include a checkbox on each row to allow users to select rows for things like, deleting multiple records, moving records from one place to another or whatever your case may be. It’s pretty standard and a nice addition to add a single checkbox in the header to allow users to select all the rows with one click – and then you add pagination and the user experience falls apart. I had a user ask me, “When I click the ‘select all’ checkbox, are all the rows selected, or just the ones on this page?”.
Clearly I needed to be a bit more specific. Here’s the solution that was used.

I swapped out the header checkbox with the following set of 3 checkboxes and bits of HTML.
[code]

[/code]
The above HTML leaves one checkbox in the header and two more in a hidden div. The one that’s visible will be used to indicate some kind of selection, and the other two will be shown and hidden with jQuery to allow two choice options.

  • All records on current page
  • All records on all pages

The first part to be handled is the showing and hiding of the checkboxes. Using a timer, I added a delay to the ‘hide’ function so that it’s less jumpy and moving your mouse outside the element by accident won’t hide it and frustrate my users. While it’s not required, notice that I named my anonymous functions with something that helps clarify their purpose, “enterElement” and “exitElement”.
[code]
var moreOptsTimer;
$(“#moreOptsParent”).hover(function enterElement() {
clearTimeout(moreOptsTimer);
$(“#moreOptsPanel”).show().animate({ height: 40 },
{ duration: “slow” });
},
function exitElement() {
moreOptsTimer = setTimeout(function () {
$(“#moreOptsPanel”).animate({ height: 0 },
{ duration: “slow” },
function () {
// Animation complete.
$(“#moreOptsPanel”).hide();
});
}, 500);
}
);
[/code]
Now that the two selection choices hide and show nicely we have to add code to manage the state of the checkboxes to show selections. When we select “all rows current page”, we need to check the header checkbox and the one on each row. When we select “all rows on all pages”, we need to check the header checkbox and uncheck & disable the one on each row. For completeness I’ve mirrored the “All Records current page” function on the original checkbox but because the behaviour is so slightly different, it gets it’s own click function.

[code]
/* attach event handler to “check all” checkbox */
$(‘#checkAllDisplay’).click(function () {
$(“#MyGridItems tbody input:checkbox”).removeAttr(“disabled”)
.attr(“checked”, this.checked);
$(‘#checkAllRecords’).attr(“checked”, this.checked);
if (!this.checked) {
$(‘#checkAllPages’).attr(“checked”, false);
}
});

/* attach event handler to “check all on current page” checkbox */
$(‘#checkAllRecords’).click(function () {
$(“#MyGridItems tbody input:checkbox”).removeAttr(“disabled”)
.attr(“checked”, this.checked);
$(‘#checkAllDisplay’).attr(“checked”, this.checked);
if (this.checked) {
$(‘#checkAllPages’).attr(“checked”, false);
}
});

/* attach event handler to “check all on all pages” checkbox */
$(‘#checkAllPages’).click(function () {
$(‘#checkAllDisplay’).attr(“checked”, this.checked);
if (this.checked) {
$(‘#checkAllRecords’).attr(“checked”, false);
$(“#MyGridItems tbody input:checkbox”)
.attr(“disabled”, true)
.attr(“checked”, false);
} else {
$(“#MyGridItems tbody input:checkbox”)
.removeAttr(“disabled”);
}
});
[/code]

Try the demo and leave a comment below if you found it useful or had a suggestion.

How thick are your users?

This is an honest-to-God snippet from a published User Guide for some technical documentation I’m reading. This is a user guide for some pretty sophisticated software but apparently they have a low expectation when it comes to their user base.

Navigation through the steps is accomplished by clicking on the Next and Back
buttons found at the bottom of each of the wizard panels. The Next button takes you to the next panel. The Back button takes you to the previously displayed panel. Navigating backward using the Back button will not cause you to loose any entries already made.
A Cancel button is available on all of the wizard panels. Click Cancel to close the wizard discarding any changes.
Click Finish to close the wizard saving any changes that have been made. No changes are saved until the Finish button is pressed.

I’m offended that they feel the need to write for me as if I’m stupid and left feeling a lack of respect for it’s publisher.

Note: I edited slightly to remove any product name references. If you need to know who it was, just ask me.

Hey, Where did my VBA Immediate Window go?

While debugging a grossly complicated Excel 2010 workbook my Immediate window disappeared completely. If it ever happens to you, here’s an easy way to get it back:

  • Open the VBE and select Tools, Options
  • Select the Docking tab and make sure the window in question has no checkmark in that tab
  • Close the options window. If you don’t see it yet, select Window, Cascade.
  • Now open the Options dialog again and check the docking property of the window you just (hopefully) got back.
  • Drag it to where you want it docked.

Done!  Now get back to work!

Easy Monitor calibration

I spend a lot of time in front of my monitor and if it’s too bright my eyes get tired quickly. As a result, I keep my brightness down so low that people have thought I had a broken monitor. However, when viewing pictures I need it to look as accurate as possible. Here’s a quick and dirty way to be sure that my Contrast and Brightness are set to reasonable values.

http://www.photofriday.com/calibrate.php

It won’t be perfect, but the price is right and you have nothing to lose but a few minutes of fiddling.

Installing a 3.0 kernel on Ubuntu 11.04 (natty)

Ok, I saw the warning but didn’t think it applied to me. Don’t assume it doesn’t apply to you!

Remove any proprietary ATI/AMD drivers from your Natty installation. You can put them back on after we install the new kernel.

Now that you’ve checked for anf removed any ATI proprietary drivers, visit this URL and pick out the kernel that you want to try. http://kernel.ubuntu.com/~kernel-ppa/mainline/

In my case, I was running the latest natty kernel on a new (but low-end) Toshiba C650D laptop. It was crashing constantly, never running for more than an hour. As there weren’t any clear indicators in the logs, and the hardware worked fine on Windows, I wanted to try a different kernel. I wanted to the newest kernel possible in the hopes that whatever issue had been resolved.

I opened the above Url and scrolled way down to the bottom of the page. All the way to “v3.0.4-oneiric”. It was dated four days ago – that ought to be new enough! As I’m running 64 bit 11.04, I need the “amd64” binaries. Download the appropriate ones, “headers…all” and the “headers” and “image” file for my architecture.

[code] linux-headers-3.0.4-030004_3.0.4-030004.201108301138_all.deb linux-headers-3.0.4-030004-generic_3.0.4-030004.201108301138_amd64.deb linux-image-3.0.4-030004-generic_3.0.4-030004.201108301138_amd64.deb [/code]

Next, open a terminal window and cd to the folder where your binaries are located. Run the following command to install the new kernel: [code] /sudo dpkg -i /linux-headers-3.0.4-030004_3.0.4-030004.201108301138_all.deb linux-headers-3.0.4-030004-generic_3.0.4-030004.201108301138_amd64.deb linux-image-3.0.4-030004-generic_3.0.4-030004.201108301138_amd64.deb [/code]

Let it run for a minute or two and if there are no errors reboot. If you have errors, fix them, try the install command again and reboot. If Grub doesn’t prompt you to choose a kernel, check it from terminal once you’re logged in. with the following: [code] /uname -r /[/code]

There you have it! Running a 3.0 kernel on Ubuntu 11.04, Natty.

Resize and Rotate

Last week my laptop died so when the new one arrived I started re-installing all those apps that make it work the way I want. This post is about one of those *must-have* applications. I manage all may camera images on my laptop so being able to quickly resize or rotate images is pretty important to me. Luckily a friend showed me an easy way to do bulk rename and resize with a simple right-click.

Installation

To add the new options to the Nautilus context menu we’ll first need to install the package:

[code] sudo apt-get install nautilus-image-converter [/code]

You’ll need to restart Nautilus or simply logout and log back in before you get the new right-click menu options. After you’ve done that you will be able to right-click on any image file and you’ll see the two new menu items: “Resize Images” and “Rotate Images”.

When you choose one of the menu items you will be presented with a simple interface to provide the relevant input parameters. What could be easier?!

Embedding subtitles in an AVI with mencoder on Ubuntu

I should point out that I didn’t write this script, only that I found it useful while trying to put a movie with subtitles in a separate file (*.srt) onto my Android phone.

Here’s where I found the original script: http://ubuntuforums.org/showpost.php?p=7809155&postcount=6

I put the following script into a text file named hardsub.sh and copied it into “~/.gnome2/nautilus-scripts”. Then restarted Nautilus and copied the (movie).avi and (movie).srt files into the same directory and ran it by right-clicking on the video and selecting “scripts -> hardsub.sh”. It ran for a while and spat out a file named (movie).hardsub.avi that included the embedded subtitles.

Here’s the script: [code] #!/bin/bash

# hardsub.sh # a basic script to hardcode subtitles into movie files using mencoder # # uses a two pass – high quality encode by default # fast option invokes a quick one pass encode # # it assumes that you are using an .srt subtitle file with the same #+ name as the movie file # # if you are using a matroska movie (.mkv) and it can’t find the .srt #+ file it uses the embedded english subtitle track # # # NB: this is a preliminary script and doesn’t do much error checking # # Version 0.11 # # Mike Lahey 2009 #####################

# language used for subtitle track embedded in a matroska file # for alternative subtitle (& audio) tracks try “mplayer -v movie.mkv” LANG=eng

# these mencoder options scale down the subtitles and move them #+ up just a bit SUBOPTS=”-subfont-text-scale 3.3 -subpos 96″

if [ -z “$1” ]; then echo usage: $0 movie.avi [fast] echo echo fast – do a fast one pass encode exit 1 fi MOVIE=$1 EXT=${MOVIE##*.} OUTPUT=${MOVIE/%.$EXT/.hardsub.avi}

# first make sure that our movie file is there if [ ! -f “$MOVIE” ]; then echo input file “$MOVIE” does not exit exit 1 fi

# next check if we have the SRT file and create subtitle command for # mencoder SRT=${MOVIE/%$EXT/srt}

if [ -f “$SRT” ]; then

# good we have an SRT file, so create our subtitle command SUBCMD=”-sub “$SRT”” else #no SRT file? well check if we are dealing with a matroska file if [ “$EXT” == “mkv” ]; then echo “################################################” echo couldnt find “$SRT” echo so trying embedded subtitle track “$LANG” echo “################################################” SUBCMD=”-slang $LANG -spualign 2″ # “-spualign 2” ensures proper placement of vobsub tracks else echo could not find subtitle file “$SRT” echo echo maybe its called something else? try renameing it. exit 1 fi fi

# if the input movie is not an avi then transcode the audio to mp3 # this may result in an unnecessary transcode but it will make #+ incompatable audio streams (such as ogg/vorbis) work with an avi

if [ “$EXT” == “avi” ]; then ACODEC=copy else ACODEC=mp3lame fi

# most formats other than avi allow non-square pixels. # by invoking the scale filter we ensure that the video is # displayed with the proper aspect ratio in our avi # since were scaling anyway – scale to a multiple of 16 to make the encoding more effiecient if [ “$EXT” != “avi” ]; then SUBOPTS=”$SUBOPTS -vf-pre scale=-8:-8″ fi

#### if fast option was invoked, do a fast one pass encode if [ “$2” == “fast” ]; then

CMD=”mencoder “$MOVIE” $SUBCMD $SUBOPTS -o “$OUTPUT” -oac $ACODEC -ovc lavc” echo $CMD eval $CMD

if [ $? != 0 ]; then echo “################# mencoder failed ################” exit 1 fi exit fi

#### normal two pass encode

CMD=”mencoder “$MOVIE” $SUBCMD $SUBOPTS -o /dev/null -oac $ACODEC -ovc lavc -lavcopts vcodec=mpeg4:vhq:turbo:vpass=1″ echo $CMD eval $CMD

if [ $? != 0 ]; then echo “################# mencoder failed ################” rm divx2pass.log exit 1 fi

CMD=”mencoder “$MOVIE” $SUBCMD $SUBOPTS -o “$OUTPUT” -oac $ACODEC -ovc lavc -lavcopts vcodec=mpeg4:vhq:vpass=2″ echo $CMD eval $CMD

if [ $? != 0 ]; then echo “################# mencoder failed ################” rm divx2pass.log exit 1 fi

rm divx2pass.log

[/code]

Lorem Ipsum

As a web developer I constantly find myself copy & pasting this text.  What better way to start a new blog, than to  use a few paragraphs of boilerplate text.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec leo nisi, tincidunt quis euismod facilisis, consequat sed est. Curabitur faucibus consequat lacus, at pretium arcu placerat a. Nulla imperdiet nunc eu dui consequat blandit. Aenean sollicitudin tempus posuere. Aliquam nec risus sapien, a lacinia nulla. Pellentesque iaculis, justo non euismod malesuada, tortor turpis ornare quam, ut bibendum sapien neque et lorem. Aliquam erat volutpat. Curabitur id ligula quis augue condimentum lobortis non id massa. Ut nisi nunc, suscipit ac dictum vel, hendrerit ut neque. Sed molestie magna sed felis ullamcorper faucibus a ut metus.

Praesent a nunc vel dolor luctus tristique. Etiam vel elit eget sem ultrices mattis non quis mi. Aliquam eget tristique libero. Etiam faucibus, metus in porta hendrerit, velit nibh posuere justo, vel molestie turpis leo sit amet dui. In et nisl quis enim condimentum vehicula. Aliquam tincidunt mi id justo elementum at laoreet velit tempus. Nulla elementum porta pulvinar. Duis at odio ipsum, ac eleifend sem. Sed elit odio, tincidunt ac convallis eu, auctor semper lorem. Nulla vel urna elit. Ut mi mi, molestie ut accumsan et, blandit ut diam.

Suspendisse quis neque eget orci gravida bibendum. Duis hendrerit, mauris sit amet laoreet semper, mauris odio bibendum neque, ac pharetra justo sapien nec quam. Curabitur volutpat vulputate vehicula. Curabitur eget dui purus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec posuere condimentum mauris, ac fermentum quam tincidunt id. Fusce lobortis blandit elit, iaculis mollis magna euismod sed. Ut tincidunt odio ac ligula viverra et elementum diam feugiat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Praesent interdum venenatis iaculis. Sed elementum neque sit amet mi volutpat pharetra.

In eget orci vel risus pulvinar vehicula. Nunc velit magna, pellentesque at vehicula et, vulputate in quam. Praesent venenatis molestie ornare. Sed quis turpis et urna ultrices auctor a bibendum nulla. Phasellus sem nisl, rhoncus quis placerat ac, rhoncus vitae massa. Donec semper, massa vel commodo elementum, mi quam congue elit, non laoreet tortor est aliquet mi. Nunc ac dolor eros. Vivamus cursus pharetra consectetur. Fusce lectus risus, lobortis at venenatis vitae, ultrices tempus sem. In blandit mollis odio ac porttitor. Vivamus non nulla quis ipsum consectetur rhoncus. Quisque in quam lacus.

Curabitur imperdiet ipsum rutrum velit scelerisque quis molestie arcu facilisis. Fusce faucibus purus nec nulla convallis eu aliquam metus auctor. In commodo urna non enim aliquet faucibus. Mauris ligula sem, gravida vel dapibus eu, vehicula nec magna. Curabitur sit amet nulla vitae libero scelerisque gravida. Maecenas tincidunt facilisis condimentum. Morbi non nisl neque. Donec auctor neque ac justo faucibus ac placerat eros rutrum. Aliquam pulvinar leo non eros ullamcorper ut laoreet ipsum interdum. Quisque aliquam, quam eget sodales varius, orci purus hendrerit mauris, blandit vestibulum sapien velit sed ante. Etiam porta ultrices augue, semper cursus lectus auctor quis. Integer sodales, nunc elementum aliquam auctor, tellus elit convallis justo, sed euismod nibh nisl sed neque. Sed venenatis condimentum ultricies. Nulla facilisi.