Monday, December 19, 2005

Quick Digital Photo Tip - Fixes, Photo Sizes and Aspect Ratios.

When I first got my digital camera I talked a lot about the Beauty of Mega-Pixels and how more is better. However, as I prepare for upcoming Hanukkah celebrations and pictures, I wanted to share another little digital tip that I have picked up. Typically, with a good ol' film camera, when you go to develop a standard roll of film, you get a set 4"x6" photos. This 'standard' photo size was carried over to the digital age, and you can easily find 4"x6" photo paper, as well as order such sized prints from photo sites like Snapfish, Shutterfly, and Kodak Gallery. Of course the beauty of digital photos is that we only need to print the 'Keepers' (and we can also blow them up and/or put them on a mug, apron, deck of cards, etc.) and we can either discard the others or preserve them in slide shows and on websites for years to come.

What this means is that people tend to take photos indiscriminately with digital cameras. So to all of those who will find a new digital camera under the tree, menora, or whatever else your family sticks their gifts under, here are some quick tips:


  • The more pixels you have in your pictures the more space they take up. In theory, a 6 Mega-Pixel image will take up about twice as much space as 3 MP one. While the 6MP one will give you much greater detail, the 3MP will give you an excellent photo at 4x6 or 5x7 - and even a good photo at 8x10 if you don't edit it much. If you reduce your camera's MP mode for most shots, you will be able to take a lot more pictures. One thing that I have done (incorrectly) in the past, is shoot at the higher resolution until I get short on space. The problem with this is that when you want to take a detailed closeup at the end, you may not have enough space. It's better to pace yourself throughout.

  • A 4x6 photo has an aspect ratio (the ration of width to height) of 1.5 (i.e. it is 50% wider than it is tall), but most digital camera modes have an aspect ratio of 1.33. This means that when you print a digital picture on a 4"x6" print, the picture will need to be cropped. Bear this in mind when taking shots so that you leave a little bit of space between people or items you want in your picture so that they are not flush against the top or bottom of your picture.

  • Some cameras (I know that my camera as well as other sony models) have a great feature that combines the first two tips - A 1.5 aspect ratio mode that shoots at reduced megapixel size. (Sony calls this 3:2 mode. On my camera its 4.5 MP, which gets me about 10-15% more pictures on a 512 MB card).

  • From the professional photographer to the snapshooter. Everyone knows that for every good photo you take there are plenty more that just don't come out right. Fortunately for you, in today's digital age, it is easier than ever to correct a lot of those mistakes in an otherwise good shot (like that great picture of the kids that would otherwise be ruined by little Jane's red eyes). To edit photos, I use Picasa from Google. It has a great set of simple to use tools for editing, organizing and sharing photos and it works well with most of the popular photo sharing services around the globe. One of my favorite features of Picasa is that it keeps your original photo intact and only stores information about edits you make. This way, if you screw up editing, it can easily get you back to the original.



Happy Holidays to one and all, and may all your pictures be good ones.

Thursday, December 15, 2005

Yonah's SQL Tip #5 - Naming Conventions

While there are millions of websites, magazine articles and even books that offer ways to improve your SQL code and make it more efficient, there are far fewer that provide insight on how to make your code more readable. One practice that was taught to me by a colleague several years ago, that I try to practice whever I go is the idea of the column name prefix. Essentially here is how it works - When I create a table, I prefix the field names with a 2-4 character mnemonic of the table name. For all fields that are specific to that table I use the same prefix. When I use fields from a different table (say, as foreign keys) I easily know which fields are local and which belong to other tables. Morover, when I write a query, the field names match exactly.

For example, let's say I have a products table that has a SKU, Size, and Color fields and an Orders table that has an Order ID, but also needs the sku information and QTY. Using this convention, my product table will have these fields:

PROD_SKU,PROD_SIZE,PROD_COLOR


and my Orders table will have these fields:

ORD_ID, PROD_SKU, ORD_QTY


Because the quantity and the ID in the orders table belong to that table, they start with the ORD prefix. But because the PROD_SKU is borrowed from the Products table, the PROD prefix, indicates clearly that this is the SKU from the Products table.

Blogger Tools ... coming soon...

So I have finally found a few minutes to play with software. While my job does allow me to experiment a little bit with new technologies, for the most part, it's about developing business software. However, for the past couple of weeks, after the kids have gone to sleep, I have been experimenting. Since I moved my blogs from MovableType to Blogger, out of necessity, I developed a small tool for exporting my old blog entries to the new one. I am also playing with AJAX a little bit (more precisely it would be just JAX, because there is nothing Asynchronus about the XML files). In my experiements, I have developed a tool that uses the XML file and images generated by Picasa's 'Export to Web Page' feature and uses it to make a web slideshow of your images.

I hope to have these tools ready for prime-time in January and will post em' here for your review.

Tuesday, December 06, 2005

All this talk about AJAX is making me nostalgic.

I just read this following article on Eric Pascarello's blog:Eric's weblog - AJAX..Is It hype?. It seems that every development website you turn to is talking about AJAX. For those not in the know, AJAX is an acronym Asynchronus JavaScript and XML. The phrase was coined by Jesse James Garrett, to refer to a specific type of web application.

AJAX applications essentially minimize 'browser flash' by loading the UI into a single web page and then update the page behind the scenes obtaining XML data from the web. Google has developed a lot of these applications of late like G-Mail and Google Maps.

But while the term AJAX is new, the technologies used to fuel it are almost a decade old. 8 years ago, I was working for a small consulting firm and asked to develop a rich application for Dow Jones / Telerate. Flash was in its infancy, and used for not much more than pretty displays (most of the hooks for data had not come into the picture yet), and JavaScript was being used heavily as a client-side development tool. For dow, we developed a prototype called TAC - Telerate Active Channels. TAC was a very simple project to illustrate how a single web page could be opened, kept open a whole day, and still receive active content as the day wore on. One of our designers developed a single web page to use for the UI. Together we worked on the DHTML and Javascript Elements, and then I needed to do the hard part - get the data there. I basically wrote a small java-based client and server application to handle the data. The server would generate random news stories and stock/fund/index quotes from data in text files. The client, a Java Applet with no UI, was able to log on to the server, subscribe to a news feed, that would automatically update the UI via JavaScript. Sound familiar? While we didn't know it at the time, we were developing technologies very much akin to AJAX and her cousin - RSS. We did it all without any real APIs, tools, or 3rd parties.

While the prototype was far off from a real application, it piqued Dow Jones interest and led to follow-on work developing Offline (yes Offline!) browser-based trading applications (one for Commercial Paper, the other for ForEx). I know what you're thinking - why would anyone need an offline browser-based application? Well back in 1997, many companies didn't have broadband, and wanted to work offline before dialing up and syncing. With some of my colleagues, we developed a local browser app that could save data to an MS access database and then synchronize when connected. I wonder if anyone is doing that with AJAX? :)

Unfortunately, Bridge Information Systems bought Telerate from Dow Jones while the project was in development, and sadly, it never got launched. Maybe I will develop an AJAX app - if not for anything else, than for old times' sake :)

Sharp TM-150 Review

It is very easy to give a glowing review on a new product. Quite frankly, when you review a product for a week or two, you are reviewing as much of the functionality you've been able to learn, as well as the potential you see for that product in the long run. Reviewing a product after some time however, is a different story because you should know all of the features that you are going to use, and at the same time, the potential is gone - it has either been realized or not.

In this vane, I am reviewing the Sharp TM-150 after about 10 months of use. While it is a decent phone (I do still use it every day), I must say that I am dissapointed in it overall. In general, while the megapixel camera function is decent, I found this phone to be lacking in overall features such as PIM synchronization, battery life and connectivity.

The primary reason I bought this phone, of course, was because it was one of the first Megapixel camera phones on the market. As camera phones go, it is a much better camera than most of its peers. I took the picture on the left in Megapixel mode with the camera (using the external LCD as a viewfinder). On several ocassions where I didn't have my digital or traditional camera with me, I was able to take several photos with the camera phone and print 4x6 prints with them. I have one of them (the pic just to the left of my head in the picture to the left) that I have hanging in my cubicle at work, and people still don't believe I took it with my phone.

However, it is still not a substitute for a real camera. Your arm and the subject need to be perfectly still while shooting, or else there is a considerable amount of blur. But as for the other features, this phone falls short - I can't go more than a day or two without needing a charge. But worst of all, as someone who needs a PDA, but doesn't want to carry one, this phone was useless. I bought the data kit for it - thinking that it would sync outlook and charge my phone at the same time, but all it did was enable me to load contacts onto my phone. It seems that the only way to load calendar data is by entering it using the phone's keypad, rendering it totally useless. Because the phone is only tri-band and not quad band, it suffers to get service in some areas.

In any case, this review is moot, because TMO, for the most part, doesn't even sell this phone anymore. I hope that even if I do stay with T-Mobile, that I will be able to replace this with a phone that has bluetooth outloook sync, and a much better battery life - oh, and a camera. I guess that's the only good thing to come out of this phone - I'm Jaded.
Posted by Picasa

Monday, December 05, 2005

XBox bait and Switch

So apparently, there are a lot of folks out there that are trying to make a profit on the new XBOX 360. While the fact that 10% of all XBOXes sold in the first few weeks were somehow resold on eBay for a profit, I was surprised to see the linked article (click the title) that accused a local portland oregon store of a major retailer of playing bait and switch tactics.

The new XBOX seems so popular that even one of my favorite 'deals' sites - Ben's Bargains has opened his own site just to track XBOX inventory. Check it out at XBOX 360 Tracker.

Personally, I just don't understand the allure. Maybe because I am not a gamer. If I do indeed buy one (which, unless it is given to me, I won't), I would wait a few months to the point at least which it could be had for the sticker price - surely not a 150% premium!

Yonah's SQL Tip #4 - SOUNDEX and DIFFERENCE

What if your boss turned to you this week and asked you to write a simple search that looked up a contact in a database table by first or last name. On the surface it sounds easy. If your last name field was called LAST_NAME your query might look like this


SELECT *
FROM CONTACTS
WHERE LAST_NAME='theName'



Seems simple enough, but not without problems. Take my last name - Wolf - for example. Let's say you knew what my last name was, but you didn't know how it was spelled - so it could be Wolf, Wolfe, Wolff, Woolf, etc. The above query would require me to try every possible spelling to find a result. So maybe as a precaution, you would try to match the beginning of the word using like:


SELECT *
FROM CONTACTS
WHERE LAST_NAME like 'wolf%'


This would do a little better, but it has two major shortcomings - It will exclude names that should be included like Woolf, for example, and will include names that shouldn't like Wolfish or Wolfson. Of course, my last name is a limited example. If we were searching for, say, Smith, searching under
Smith will also return Smithson but not alternative spellings of Smith, such as Smythe.
Fortunately, there are two SQL functions that can help in this endeavour: SOUNDEX and DIFFERENCE.

SOUNDEX takes a string as an argument and returns a value that is based on the way that the string sounds (I am not 100% how this is caluculated, but it still seems to work). So re-writing our earlier query:


SELECT *
FROM CONTACTS
WHERE SOUNDEX(LAST_NAME)=SOUNDEX('WOLF')


This query will give us the desired effect of matching similarly sounding names with different spellings without excluding most spellings and without including different names. DIFFERENCE takes this one step further. It essentially takes two strings as arguments and then returns the difference of their SOUNDEX values. The difference is between 0-4, with 4 being the closest match. Using difference we can re-write the query one more time, expanding our horizons to include not-so-exact matches, but also ranking them by closeness:



SELECT *,DIFFERENCE(LAST_NAME) as RANK
FROM CONTACTS
WHERE DIFFERENCE(LAST_NAME,'WOLF')>=3
ORDER BY DIFFERENCE(LAST_NAME) DESC


What this query does is it will find names that are not quite 'Wolf', but closely related and then rank them in order of closeness (i.e. it will match, Wolf, Wolfe, and Wolfson and they will be ranked in that order respectively).

So the next time you're in a matching bind, give DIFFERENCE and SOUNDEXa try.