Friday, June 11, 2010

IPhone 4's Great New Camera... What is a backlit sensor?

The new iPhone 4 has a great new backlit camera sensor. Most people don't understand why this is nice so I wrote up this little description for the TII Podcast I listen to. A major factor in my recent camcorder purchase was the backlit camera sensor of the Sony camcorders. This sensor severely reduces graininess in lower light situations making it a must have for me.

Here's how it works. Light sensor pixels are not very reliable at low levels of brightness so the camera turns on the backlight to make sure this doesn't happen. Of course this makes the whole scene uniformly brighter, but the camera uses an algorithm to darken it back down again when the light is on so that you don't notice the difference.

This is a very smart implementation of the technique used in the movies for years to get around the same problems with film cameras. When the crew of a movie films a night scene they don't really film it in the dark. Instead they film it on a well lighted set and darken it in post production avoiding the graininess that comes from low light filming.

Just thought this was interesting.

Monday, April 26, 2010

Simplest JQuery ToolTips

Well I think I may have developed the simplest tooltips possible using JQuery. Everything out there seemed too fancy and took too much space, so I just whipped up something super simple. All you need is the amazing JQuery library, this javascript method:

$(document).ready(function(){enableTooltips(verticalOffset, horizontalOffset)}) // Set these values how you like, I used 35, 0

function enableTooltips(topOffset, leftOffset)
{
$('[tooltipText]').bind(
{
mouseover: function() {
if ($('#tooltip').length == 0)
$('body').append('
')
var o = $(this).offset()
o.top += topOffset;o.left += leftOffset
$('#tooltip').css(o).html($(this).attr('tooltipText'))
.stop(true).animate({n:0},1000).fadeTo(300,1)
.animate({n:0},5000).fadeTo(500,0)
},
mouseout: function() {
$('#tooltip').stop(true).animate({nothing:0},500).fadeTo(500,0)
}
});
}

And some css like this:

#tooltip {
font:normal 12px Verdanna, Arial, Helvetica, sans-serif;
position: absolute;
z-index: 1000;
border: 1px solid #111;
background-color: #eee;
padding: 2px;
opacity: 0;
filter:alpha(opacity=0);
}

On the items you want tooltips just put a tooltipText property like this:

<input type="submit" src="ButtonHome.gif" tooltiptext="Go to home">

and you win! JQuery is amazing!

Friday, April 23, 2010

The Apple Flash battle is similar to the USB and Floppy transition

Just a short note today as an iPhone user.

It is painful that Apple has booted Flash out of their phone, and as a user it causes me to suffer a bit, but I think change has to hurt. This is just Apple's thing. They like to force innovation to happen, which has made a crucial difference in consumer electronics and software over the years.

Intel invented USB, but could not get it implemented in Windows computers. I was very irritated when Apple tossed their PS2 like serial ports on all their machines but... I think it did have the needed effect of accelerating USB adoption.

They did the same thing with the floppy transition, when they dropped the drives from all their stuff. It was a bit painful for a while but thumb drives and writable CDs came along quickly and solved that.

Apple is irritating people with this, BUT it is absolutely having the effect of making HTML 5 a reality just as it did with USB, and the floppy. Even Microsoft has put very good support in IE 9. I don't think this would have happened nearly as quickly without the iPhone thing, and as a web engineer I appreciate the push.

I must keep my iPhone jailbroken thanks to stupid Apple limitations, but on most things I thank Apple for making me suffer for a bit. Without them we might still be using DOS.

Friday, January 8, 2010

JSTL is Old Fashioned But Cool

I am not afraid to say that I really like JSTL. It may be old fashioned, but it gets the job done very nicely. Is it just me, or do many of these new frameworks just seem like they don't buy you all that much. Anyway I created this post to shove my favorite JSTL expressions/hacks, toolkits etc. I'll just keep editing it to add more as I think of them/find new ones.

---

Quickly get the current year from JSTL (and jsp)

<jsp:usebean id="now" class="java.util.Date">
<c:set var="year" scope="page" value="${now.year+1900}">

---

I really like the displaytag library. So simple and powerful (especially for internal crud pages).

http://displaytag.sf.net

---

Why does CSS suck so bad? They forget basic things like allowing URLs to break in a table so the table formatting doesn't get thrown out. Here is a snipped to stick hidden breaks in a url so that it will wrap (oh, and still escape xml).... Argh!

${fn:replace(fn:escapeXml(variablename),"/","/")}