|
There is a layout I wanted to achieve in HTML that just isn't possible without doing some Javascript work to make it happen—or at least, I haven't found any other method. Here is an example using a set of quotes by Marti n Luther King, Jr. We shall overcome because the arc of the moral universe is long, but it bends towards justice. Darkness cannot drive out darkness, only light can do that. Hate cannot drive out hate, only love can do that. I believe that unarmed truth and unconditional love will have the final word in reality. This is why right, temporarily defeated, is stronger than evil triumphant. Make a career of humanity. Commit yourself to the noble struggle for equal rights. You will make a greater person of yourself, a greater nation of your country, and a finer world to live in. I oppose the war in Vietnam because I love America. I speak out against it not in anger but with anxiety and sorrow in my heart, and above all with a passionate desire to see our beloved country stand as a moral example of the world. If we are to have peace on earth, our loyalties must become ecumenical rather than sectional. Our loyalties must transcend our race, our tribe, our class, and our nation; and this means we must develop a world perspective. Injustice anywhere is a threat to justice everywhere. We are caught in an inescapable network of mutuality, tied in a single garment of destiny. Whatever affects one directly, affects all indirectly. I have the audacity to believe that peoples everywhere can have three meals a day for their bodies, education and culture for their minds, and dignity, equality and freedom for their spirits. It is not enough to say "We must not wage war." It is necessary to love peace and sacrifice for it. We must concentrate not merely on the negative expulsion of war, but on the positive affirmation of peace. The ultimate measure of a man is not where he stands in moments of comfort and convenience, but where he stands at times of challenge and controversy. Every nation must now develop an overriding loyalty to mankind as a whole in order to preserve the best in their individual societies. We are determined here in Montgomery to work and fight until justice runs "down like water, and righteousness like a mighty stream." We must come to see that the end we seek is a society at peace with itself, a society that can live with its conscience. True peace is not merely the absence of tension: it is the presence of justice. Ascetically this looks awful. We can improve the layout by specifying a height. We shall overcome because the arc of the moral universe is long, but it bends towards justice. Darkness cannot drive out darkness, only light can do that. Hate cannot drive out hate, only love can do that. I believe that unarmed truth and unconditional love will have the final word in reality. This is why right, temporarily defeated, is stronger than evil triumphant. Make a career of humanity. Commit yourself to the noble struggle for equal rights. You will make a greater person of yourself, a greater nation of your country, and a finer world to live in. I oppose the war in Vietnam because I love America. I speak out against it not in anger but with anxiety and sorrow in my heart, and above all with a passionate desire to see our beloved country stand as a moral example of the world. If we are to have peace on earth, our loyalties must become ecumenical rather than sectional. Our loyalties must transcend our race, our tribe, our class, and our nation; and this means we must develop a world perspective. Injustice anywhere is a threat to justice everywhere. We are caught in an inescapable network of mutuality, tied in a single garment of destiny. Whatever affects one directly, affects all indirectly. I have the audacity to believe that peoples everywhere can have three meals a day for their bodies, education and culture for their minds, and dignity, equality and freedom for their spirits. It is not enough to say "We must not wage war." It is necessary to love peace and sacrifice for it. We must concentrate not merely on the negative expulsion of war, but on the positive affirmation of peace. The ultimate measure of a man is not where he stands in moments of comfort and convenience, but where he stands at times of challenge and controversy. Every nation must now develop an overriding loyalty to mankind as a whole in order to preserve the best in their individual societies. We are determined here in Montgomery to work and fight until justice runs "down like water, and righteousness like a mighty stream." We must come to see that the end we seek is a society at peace with itself, a society that can live with its conscience. True peace is not merely the absence of tension: it is the presence of justice. The problem with that is the height must be the maximum used by any cell. One may not always know such a value. In addition, the cells are not centered in the encompassing DIV tag, which also doesn't look good. The old method of dealing with this problem is to make a table. | We shall overcome because the arc of the moral universe is long, but it bends towards justice. | Darkness cannot drive out darkness, only light can do that. Hate cannot drive out hate, only love can do that. | I believe that unarmed truth and unconditional love will have the final word in reality. This is why right, temporarily defeated, is stronger than evil triumphant. | Make a career of humanity. Commit yourself to the noble struggle for equal rights. You will make a greater person of yourself, a greater nation of your country, and a finer world to live in. | | I oppose the war in Vietnam because I love America. I speak out against it not in anger but with anxiety and sorrow in my heart, and above all with a passionate desire to see our beloved country stand as a moral example of the world. | If we are to have peace on earth, our loyalties must become ecumenical rather than sectional. Our loyalties must transcend our race, our tribe, our class, and our nation; and this means we must develop a world perspective. | Injustice anywhere is a threat to justice everywhere. We are caught in an inescapable network of mutuality, tied in a single garment of destiny. Whatever affects one directly, affects all indirectly. | I have the audacity to believe that peoples everywhere can have three meals a day for their bodies, education and culture for their minds, and dignity, equality and freedom for their spirits. | | It is not enough to say "We must not wage war." It is necessary to love peace and sacrifice for it. We must concentrate not merely on the negative expulsion of war, but on the positive affirmation of peace. | The ultimate measure of a man is not where he stands in moments of comfort and convenience, but where he stands at times of challenge and controversy. | Every nation must now develop an overriding loyalty to mankind as a whole in order to preserve the best in their individual societies. | We are determined here in Montgomery to work and fight until justice runs "down like water, and righteousness like a mighty stream." | | We must come to see that the end we seek is a society at peace with itself, a society that can live with its conscience. | True peace is not merely the absence of tension: it is the presence of justice. | One thing tables can do on a web site is make rows with each cell having equal height. Ascetically this is very nice. But tables can not have a dynamic number of columns. That is, the number of columns can not be determined by with width of the cells that make each row. So far, I have found no other solution to this problem but to use some Javascript. I call the function “tabilize”. It is passed an array of DIV tags, the width of each cell, how much padding to put between the cells, and the width of the parent object the cells must be arranged into. The script will then arrange the cells into the table I desire. Here are the results. We shall overcome because the arc of the moral universe is long, but it bends towards justice. Darkness cannot drive out darkness, only light can do that. Hate cannot drive out hate, only love can do that. I believe that unarmed truth and unconditional love will have the final word in reality. This is why right, temporarily defeated, is stronger than evil triumphant. Make a career of humanity. Commit yourself to the noble struggle for equal rights. You will make a greater person of yourself, a greater nation of your country, and a finer world to live in. I oppose the war in Vietnam because I love America. I speak out against it not in anger but with anxiety and sorrow in my heart, and above all with a passionate desire to see our beloved country stand as a moral example of the world. If we are to have peace on earth, our loyalties must become ecumenical rather than sectional. Our loyalties must transcend our race, our tribe, our class, and our nation; and this means we must develop a world perspective. Injustice anywhere is a threat to justice everywhere. We are caught in an inescapable network of mutuality, tied in a single garment of destiny. Whatever affects one directly, affects all indirectly. I have the audacity to believe that peoples everywhere can have three meals a day for their bodies, education and culture for their minds, and dignity, equality and freedom for their spirits. It is not enough to say "We must not wage war." It is necessary to love peace and sacrifice for it. We must concentrate not merely on the negative expulsion of war, but on the positive affirmation of peace. The ultimate measure of a man is not where he stands in moments of comfort and convenience, but where he stands at times of challenge and controversy. Every nation must now develop an overriding loyalty to mankind as a whole in order to preserve the best in their individual societies. We are determined here in Montgomery to work and fight until justice runs "down like water, and righteousness like a mighty stream." We must come to see that the end we seek is a society at peace with itself, a society that can live with its conscience. True peace is not merely the absence of tension: it is the presence of justice. Typically, the borders on the encompassing table (red) would be disabled. The tableize function can also takes care of the vertical centering. function tableize ( area, // A DIV area full of DIV elements to be tableized. cellWidth, // Width of each column. padding, // Padding to keep between columns. tableWidth, // Maximum width of the table. verticleCenter // 'true' if cells should be vertically centered. ) { // Alias the first item in the array. var first = $(area).children().first(); // Calculate the horizontal padding. // This includes the margin, border, and cell padding. var cellHorizontalPadding = $(first).outerWidth( true ) - $(first).innerWidth() + parseInt( $(first).css( "padding-left" ), 10 ) + parseInt( $(first).css( "padding-right" ), 10 ) + padding; // Calculate the vertical padding. var cellVerticlePadding = $(first).outerHeight( true ) - $(first).innerHeight() + parseInt( $(first).css( "padding-top" ), 10 ) + parseInt( $(first).css( "padding-bottom" ), 10 ) + padding; // Calculate the number of columns that can fit using the table width. var numberOfColumns; numberOfColumns = tableWidth; // <- Start with the number of pixels in row. numberOfColumns /= cellWidth + cellHorizontalPadding; // <- Divide out images. numberOfColumns = Math.floor( numberOfColumns ); // Calculate the actual width used by the columns. var totalWidth; totalWidth = cellWidth * numberOfColumns; totalWidth += cellHorizontalPadding * numberOfColumns; totalWidth += padding; // Calculate an offset to the right and left of the columns. // This will be used to center the columns. var startingOffset; startingOffset = tableWidth; startingOffset -= totalWidth; startingOffset /= 2; startingOffset = Math.floor( startingOffset ); //--------------------------------- // First loop, place items in correct column and set the width. // Make a list of the heights of the longest cell in each row. //--------------------------------- var lastRow = -1; var height = -1; var rowHeight = []; // <- An array used to keep track of largest cell height in row. $(area).children().each ( function( index ) { // Calculate row and column. var row = Math.floor( index / numberOfColumns ); var column = index % numberOfColumns; // If the row number has changed... if ( row != lastRow ) { // If we had a last row, save the largest cell height. if ( -1 != lastRow ) rowHeight[ lastRow ] = height; // Reset largest height. height = -1; // Last row is now current row. lastRow = row; } // Figure out the location of the left side. var left; left = column; left *= cellWidth + cellHorizontalPadding; left += padding; // Adjust cell's left offset and width. $(this) .css ( { "position": "absolute", "left": left, "width": cellWidth, "height": "", } ); // If also doing vertical centering... if ( verticleCenter ) $(this) // Reset height of child. This is for the vertical center. .children() .css ( { "height": "", "width": "100%", "display": "table-cell", "vertical-align": "middle", } ) // Width of the 2nd child. This is for the vertical center. .children().children() .width( cellWidth ); // Remember height of tallest cell. height = Math.max( $(this).height(), height ); } ); // Save height of last row. rowHeight[ lastRow ] = height; //--------------------------------- // Second loop, set the height of all cells in a row to the cell with the tallest // height in that row. //--------------------------------- var top = padding; // <- Accumulator for where row begins. lastRow = -1; $(area).children().each ( function( index ) { // Calculate row of this cell. var row = Math.floor( index / numberOfColumns ); // Height to use for this row. var height = rowHeight[ row ]; if ( row != lastRow ) { // If row has changed and isn't the first row... if ( -1 != lastRow ) // Accumulate the height to start new row. top += rowHeight[ lastRow ] + cellVerticlePadding; lastRow = row; } // Adjust cell's top location and height. $(this) .css ( { "top": top, "height": height, } ) // If also doing vertical centering... if ( verticleCenter ) $(this) // Height of the 1st child, which will allow vertical centering. .children().height( height ); } ); // Add height of last row to determine height of parent cell. top += rowHeight[ lastRow ] + cellVerticlePadding; // Set height of parent cell. $(first).parent() .css ( { "position": "relative", "margin": "auto", "width": totalWidth, "height": top, } ); } // tableize I went ahead and created a jQuery plug-in to do this function in case some others find it useful. The project page also includes a live demo so the results can be observed when re-sizing the window. My good friend Zen pointed out some similar (but not identical) systems jQuery Masonry and pinterest.com. So I am not the only person who has found that plain HTML with CSS can not produce all the desired layouts.
|
|
|
|
About a month ago I picked up two of these. It is an LED light bulb, and my first such device. This one runs on 8 watts, has the light output of a 40 watt incandescent, is dimmable, and was on sale for $13. Now that I've had them awhile, I thought I'd write about them a bit. The color temperature is 3000 K, which still appears cooler than I would like. Unlike an incandescent, the color temperature stays the same when dimmed. Incandescent bulbs tend to have a warmer glow as they dim, and it's an effect I've come to like. Nonetheless, the bulb dims remarkably well. The reason I bought the first bulb was because I was replacing a dimmable compact fluorescent that died after 2 years. Dimmable compact fluorescent bulbs are terrible. Most are hit-or-miss in terms of the ability to dim. And it turns out the one bulb I found that did dim well I never found again, and it was the one that died far short of the 8,000 hours it claimed to last. The other bulb I have dims poorly and sometimes develops a flicker. So when I saw the LED bulb on sale, I decided it was worth trying. It was about twice the price of a dimmable CFL, but much cheaper than I had ever seen an LED bulb. I was impressed enough by the bulbs performance that I went back and bought a replacement for the other dimmable CFL in my setup. So far both bulbs have preformed well. The front of the bulbs have no noticeable temperature, but the base of the bulbs do generate some heat. They still run cooler than a CFL, and much cooler than an incandescent, but warm enough you don't want to touch it with bare skin.
|
|
|
|
Spent the day in Chicago with Amber at Navy Pier. Pictured is a very nervous Amber near the top the our ride on the 150 foot-high Ferris wheel.
|
|
|
|
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.
|
|
|
|
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.
|
|
|
|
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.
|
|
|
|
|
|