Andrew Que Sites list Photos
Projects Contact
   This is the inside of the switch to my LED bicycle headlight.  Last night (technically, early this morning) I went for a ride and the light wasn't working correctly.  The switch did nothing, and the light was stuck on one setting.  I was able to complete my ride and when I got home I took a closer look.  What appears to have happened is the wiring in the switch pull away due to a loss grommet allowing the wires to cross at will. The soldering job was pretty awful. The wires did not actually go through the holes, but were merely connected at the surface, and they had been stripped back way too far. I knew I could fix this so took this picture so I could remember which wires went to what pads.
   Unfortunately after I fixed the wiring issues, it still didn't work.  My guess is that initial short burned out the circuitry in the switch and all I was getting is the dead results.  I wrote the company I purchased the light from and received an RMA number and an address to ship it.  So hopefully they will be quick and get me a replacement.  The light is only 10 months old.
State Street in HDR

State Street in HDR

   Went out this evening to do some HDR photography on State Street.  While there are a lot of people and some cars about which means there will be movement, I wanted to experiment.  I did brackets of 3 with 2 f-stops of separation between shots (so a full range of 4 stops).  My camera will not allow more than this for automatic bracketing.  But I decided I would give it a try.  I switched between starting at 0 (normal) and +1 f-stops (overexposed) for the start of bracketing, and ISO 800 and 200.  Naturally ISO 200 had slower shutter speeds but less noise.  There was some wind, and a lot of movement.  I found at the lower slower shutter speeds the motion of people tended to blur them out of the frame.  So longer exposures were actually more beneficial for people moving.  However, I also had a breeze, and the the longer exposure just made a mess out of trees.  The street lights on State St. were killers.  They caused so much lens flare that the dark areas of the pictures were washed out.  I did manage to get a couple of stars in the sky.  So I learned something from this trip, and that's more knowledge for the next attempt.
Maggie, Que, and Xiphos

Maggie, Que, and Xiphos

   Record setting heat calls for strange activities.  This afternoon I convinced Maggie and Xiphos to go on a bike ride with me to go and get ice cream.  The ride was probably no more than 2 miles, but we were soaked with sweat by the time we returned home.  And here we all are. 
   The temperature peaked at 104 F (40 C) right about the time we were riding, beating the previous record of 98 F (36.6 C) set in 1911.  Humidity was around 30%, making for completely awful weather.  I understand that the southern states such as Texas and Louisiana have heat of this sort regularly.  But I live in Wisconsin, and we don't usually have weather like this.  I've biked in -24 F (-31 C) and I would rather ride with it that cold than bike with it this hot.
   My yearly ritual of traveling to Tazz's house for his 4th of July gathering.  This year it was inside—no one really wants to deal with the heat.  Madison broke an other record—102 F (39 C) beating out the old record of 98 (36.6 C) that has held since 1955.  The Beloit fireworks display I found more impressive than the Madison display.  While Madison did have 3 mini-finials and lasted longer, the shells were rather boring.  Beloit seemed to do better in this respect.
   Congratulations to the teams at CERN who announced today they are fairly sure they have discovered the Higgs Boson.  To celebrate I finished reading Lawrence Krauss's "A Universe from Nothing."  While there is much about cosmology I do not understand, I find what I do understand gives me a fantastic appreciation of the subject.  It is amazing what we know, and just as interesting is how we know it.  Makes me feel like I need to be doing more with my own skills.
  Apple crisp.  I normally don't like sweet smells, but this incense isn't as sweet as I had expected.  Doesn't quite smell like baking apple crisp, but I do enjoy it.
   I've added 2 additional sizes to my standard image gallery: 3600x3600 and full-size.  This significantly increases the size needed by each photo, but seemed necessary.  My current camera shoots frames at 5184x3456 (18 MP).  With the previous max size of 1800x1800 just didn't deliver the detail my camera can give.  So the additional sizes should take care of that.
   The down side of the additional sizes is the footprint taken by my gallery.  Storage for 18 pictures went from 18 MB to 130 MB.  That isn't really a problem though.  The Micro-Dragon has a 500 GB hard drive with 405 of that space free.
   Our heatwave continues.  Rodney House (our house here in Madison) has central air conditioning, but it is struggling with these temperatures.  The air conditioner runs almost continuously during the day.  To assist, I went around the house and moved items away from heating vents and returns, and then placed fans by them to help pull the air into the rest of the room.  That helped, so it is livable in the house.
LED strip light

LED strip light

   I've been on an LED lighting kick lately.  I've used dimmable compact fluorescent bulbs in my desk lamps for a couple of years now, and I've never been happy with them.  Most of the bulbs I have tried have a poor range they can be dimmer, or flicker when dimmed.  Then one good bulb I had died.  Compact fluorescent bulbs are suppose to last 10 years, but I've never had one come close.  So I decided to visit my favorite home improvement store and look at some lighting options.  On sale were dimmable LED bulbs.  Although they were still twice the price of dimmable CFL the price was low enough to give them a shot.  I picked up one 8 watt 3000K bulb made by Sylvania.  I was immediately pleased.  The bulb dims the full range without flicker, and the color is fine.  I liked the bulb so much, I went back and bought a second bulb to replace the remaining dimmable CFL I had.  But this got me thinking...
   One item I wanted create with my setup in Madison was the illuminated under-bench lighting system I use to have in my setup at Park Place.  This original setup used four 25 watt tube lamps under the benches connected to a dimmer.  This gave my area a very warm feeling that I've yet to be able to replicate.  At the Garage I tried using halogen under cabinet lighting, but they ran hot and concentrated the light too much.  For my Madison setup, I looked into many options during my initial build: LED, halogen, thin fluorescent tubes, and incandescent.  I settled on incandescent rope light for cost, but even with it's 300 watts of power consumption it didn't produce enough light to be all that useful. 
   A couple weeks ago I tried using a 3100 K LED fixture I bought.  Although it said it wasn't dimmable, it clearly was.  The LEDs were fed from a bridge rectifier--no transformer, and no voltage regulator.  That means there is just a load resister and the LEDs are driven from the 0-170 volts of the rectified voltage.  There isn't even a capacitor to clean up the ripple (therefore, these LEDs flicker at 60 Hz).  I found the "warm" color of 3100 K too cool.  So I would have to find something else.
   Something I have wanted to investigate for awhile has been LED reels.  These are flexible printed circuit-board populated with LEDs.  The price when I first started looking into them was about $50 for 15 feet, which was far more than I wanted to spend.  In addition these reels require 12 volts and I would have to have a power supply and PWM dimmer to do what I wanted.  The other day I was looking again and the price had dropped to $15 for 15 feet.  I don't know the details about why the price is so low (you can still find LED reels listed for $70), but this was now an economical option to investigate. 
   Since the 3100 K LED fixture I bought was too cool, I ordered the warmest color I could, 2700 K.  When the reel arrived I got to break out the soldering iron.  I used some speaker wire and soon had a 36" strip of LEDs mounted above my display shelve.  A single row using this light was brighter than the three rows of rope light.  And this single row draws all of 5 watts.
   The illumination is good, but the color isn't what I had hoped for.  While it is a warmer color it has too much green.  I'm considering adding a row of red or amber LEDs to warm the color up further.  For now, however, I am pleased with the results.

June 30, 2012

jQuery and Firebug

Madison Fireworks

Madison Fireworks

   My gallery rewrite project is the first time I have used jQuery, and now I hardly know how I use to live without it.  I have always found Javascript a tricky language because of what it takes to make projects work the same in different browsers.  jQuery helps with this, although I have found some things that do not work across all browsers).  One item that takes some getting use to is the heavy use of anonymous functions (sometimes called Lambda functions).  Almost everything in jQuery gets a callback function, and a completely legitimate (and useful) way of implementing these functions are by using anonymous functions.  Although these parts of the code are separate function calls, they are coded and look as if they are inline.  This is both good and bad.  It's good because you do not have to break the code into several smaller functions that are all declared by themselves.  So relevant code is located close together.  However, because the callbacks can be asynchronous one must be careful to understand the the linear look to the code may be deceiving.  For example, some of the AJAX functionality of jQuery allows a callback function to be defined after the data has been returned.  Using an anonymous function for the callback makes the code look as though all of that code will run sequentially.  However, the code after the anonymous function will run first, because the AJAX call will not run the callback function until the server has returned data.  This is similar to writing threaded code and one must understand how things can get out of synchronization.  One thing that makes this consideration easier is that Javascript is single-threaded, and test-and-set semaphores are not required.
   Writing the scripts has been greatly aided by a Firefox plug-in called Firebug.  This debugger does a really good job of providing a powerful tool to developers.  The only downfall of this plug-in is that sometimes simple syntax errors, such as missing a coma in function parameters will cause an entire Javascript file not to be included at all.  This may have something to do with how Firefox parses the script, but the complete lack of any feedback can be a pain.  But the benifits of this tool far out weight it's shortcomings.

June 27, 2012

Gallery Rewrites

Monona Bay

Monona Bay

   For the last several days I've been working on rewriting my image gallery interface.  This is work long over due—my current setup is so 200x.  Seriously though, a lot has changed in PHP, Javascript, and HTML since I first wrote those scripts.  Those were also the scripts that taught me PHP and MySQL.  I wanted to go back and do things a little cleaner.
   The first things I started with is was the PHP scripts that query the database.  PHP 5 added a wonderful class interface, and I have long wanted a good project I could implement in it.  The database for an image gallery is laid out into 3 main categories: pictures, galleries, and gallery groups.  Gallery groups contains sets of galleries, and galleries contain sets of pictures.  There are more tables than this, but these categories are perfect demarcations for classes. 
   The first class I implemented is a child of 'mysqli'.  I overloaded the 'query' function to throw an exception when the query fails.  It also has the names of tables found in the gallery.  Table names have a unique name appended to the front so multiple galleries can be assigned to a single database. 
   The next class I call a database field.  It is an abstract class that has two major functions: get attribute and set attribute.  These are driven by two internal function: fetch from database, and push to database.  It needs a database, the name of the table, and an id for the record each instance will represent.  Now when a record is to be read or written, this class handles the database side of life.  In this way, the child class only needs to know basics about the table it works with.  Each of my gallery implementation could have different table layouts for pictures.  In the main gallery on pictures have information about the ISO, lens, f-stop, ext.  Other galleries have other settings.  This I did not want to matter at this level—the classes should be able to represent themselves without knowing all the details about what they will contain.  So the get/set attribute interface allows the class to be mostly ignorant of the table layout—there are just a few key fields required to make the gallery run.  Everything else is optional and handled at a lower-level, such as the scripts that will build HTML from the gallery data.
   The child classes of the database field are then pictures, galleries, and gallery groups.  A gallery group has the ability to retrieve an array of galleries, and a gallery an array of pictures.  But neither class cares if the table has an entry for the name of the gallery group/gallery.  They only need the ID field for the record their instance represents.
   This system allows a lot of flexibility while remaining very simple.  The largest class, the picture class, is currently only 200 lines of code, and several of those lines are comments.  On the implementation side, things have been very smooth.  Although I have a lot of aesthetic work to do yet the gallery view is completely functional requiring no rework to this class system.
   The picture today is one I took in the early morning hours.  I tried some more High Dynamic Range (HDR) work, this time outside under the stars.  There were two problems with this shoot: wind, and the Earth's rotational speed.  Both of these caused my images not to align completely, resulting in strange artifacts when I applied the HDR process.  As for the wind, I can simply try again on a calm day.  But the star field movement because of the Earth's rotation isn't anything I can work around.  So interesting pictures, but not the greatest.