Mar 09

Quick CSS-based grids with Blueprint CSS

Blueprint CSS is a pretty quick way to design complex grids with CSS. The idea is basic – include the necessary styles, and you get a container for your site with fixed with of 960 px. So it’s not a universal solution, but at least if you’re comfortable with the width of 960, Blueprint will prevent you from giving up and using tables.

There are just 3 compressed CSS files to include, the third one is only for IE support.

<link rel=“stylesheet” href=“css/blueprint/screen.css” type=“text/css” media=“screen, projection”>
<link rel=“stylesheet” href=“css/blueprint/print.css” type=“text/css” media=“print”>
<!–[if IE]>
  <link rel=“stylesheet” href=“css/blueprint/ie.css” type=“text/css” media=“screen, projection”>

Then a simple container div will give you a centered area 960 pixels wide:

  1. <div class=“container”>
  2.   I am a container.
  3. </div>

You can attach any of your own styles to that container div, so I had an extra class that painted the container silver for better visualization.Blueprint CSS example - a single container

Let’s say we are going to need a header, a footer, a narrow right sidebar, a narrow left sidebar, and wide area in the center for content. Blueprint provides you with a bunch of classes ranging from span-1 for 1 column to span-24 for full 100% width. So for a full-width header and footer we create the following markup:

<div class=“container”>
   <!– header –>
   <div class=“span-24 header”>
   <!– footer –>
   <div class=“span-24 footer”>

What about the content area with 2 sidebars? With Blueprint CSS, your spans on one row have to equal to 24, so we can either do 1-22-1, or 2-20-2, or 3-18-3, and so on. 8-8-8 would get us a page equally divided into three divs. Let’s go the 2-20-2 route:

<div class=“container”>  <!– header –> 

  <div class=“span-24 header”>Header </div>

  <!– content>

  <div class=“span-2″>I am the left column</div>

  <div class=“span-20″>I am the main content area</div>

  <div class=“span-2 last”>I am the right column</div>

  <!– footer –>

  <div class=“span-24 footer”>Footer</div>


There’s another nuance to the markup above – the right sidebar has to have the last class. If I add some additional coloring to those divs, here’s a sample layout I’ve built with the code above:

Three - column layout with Blueprint CSSBut wait, there’s more. You can host divs inside divs without worrying about them overflowing. Let’s say we wanted to make the right column wider, up to 10 columns, which would make the central column become a span-12. And inside that right sidebar that’s a span-10 we wanted to host 2 divs per line, span-5 each, perhaps displaying an image, or a square ad. You can host two span-5 divs inside a span-10, or even a span-10 ad inside a span-10:

<div class=“container”>
   <!– header –>
   <div class=“span-24 header”>Header</div>
  <!– content>
   <div class=“span-2″>I am the left column</div>
   <div class=“span-12″>I am the main content area</div>
   <div class=“span-10 last”>
     <div class=“span-10 last”>Ads</div>
     <div class=“span-5″>I am some kind of ad</div>
     <div class=“span-5 last”>I am some kind of ad</div>
     <div class=“span-5″>I am some kind of ad</div>
     <div class=“span-5 last”>I am some kind of ad</div>
     <div class=“span-5″>I am some kind of ad</div>
     <div class=“span-5 last”>I am some kind of ad</div>
     <div class=“span-5″>I am some kind of ad</div>
     <div class=“span-5 last”>I am some kind of ad</div>

  <!– footer –>
   <div class=“span-24 footer”>Footer</div>

With some colorful background we get this grid:
Alternating ads in a sidebar with Blueprint CSS

There’s a pretty good quickstart tutorial on Blueprint github Wiki page. There’s also an example page that implements a somewhat complicated grid:

A sample page grid with Blueprint CSS

Sep 08

Startup2Startup dinner with Automattic

Matt Mullenweg and Toni Schneider of Automattic spoke today at Startup2Startup dinner in Palo Alto. Automattic runs this interesting model, where WordPress as software is distributed for free under GPL, but WordPress as hosting service is a freemium product. They charge users of the hosted service for some optional extra features, but do not insist on it. They also display occasional ads on hosted free blogs, as Toni Schneider put it, to the users who are likely to click on them – IE readers arriving from search engines.

Some takeaways:

  1. Matt is a great supporter of GPL. Not only from philosophical standpoint, but from practical – it requires people to contribute back, and hence build community.
  2. Don’t hire all the contributors, once you have the company started. This will ruin the community effect, as evidenced by MySQL. You also gain outside perspecives by having contributors working for different companies.
  3. By open-sourcing the founders effectively lose the iron grip. Even people who have commit access now have to go through a discussion in bug system.
  4. WordPress benefits greatly fro having all the developers work from home. More time spent with families, more efficient developers, who can take an after-lunch nap. The company is run via IRC channel.
  5. Automattic will even help you with scaling, if you’re a large organization adopting WordPress. You’re unlikely to surpass their scale, and they’ve been where you’re now, so they know what works for scaling out.
  6. Personal relationships matter a lot. So Automattic still has twice-a-year meetings of the entire team. Early developers were all people Matt knew personally – personal connections help out a great bit in a virtual organization.
  7. WordPress really started taking off as open source project with introduction of plugins and themes. It’s easy to develop both, and most of the WordPress installations run roughly 5 plugins, and it’s long-tailish.
  8. WordPress as a project did not do a good job early on maintaining the directlory of plugins and themes. After opening up SVN for plugin developers, the plugin directory got traction. Designers did not quite catch on to SVN, so Automattic had to provide a way to drop a zip file onto the site.

Thanks to Dave for organizing all this, and I specifically liked the after-dinner table discussion. It’s very structured – 8-10 people at a dinner table, a few VCs, a few entrepreneurs, a few random people, and a moderator. Moderator comes to the dinner with discussion points prepared, and ensures each guest has a chance to speak. After all the structured discussion is out of the way, it’s time for anybody at the table to ask any question, which some entrepreneurs used to gauge interest in their startups and gain feedback on business models.

The dinner table discussions are off the record, so can’t blog about those, but there were some pretty interesting companies – mjam, Get Satisfaction, and others.

Aug 08

Book review: 13 things that don’t make sense by Michael Brooks

13 things that dont make sense 13 things that don’t make sense by Michael Brooks is a pretty interesting look into the world of scientific discoveries, or lack thereof. Because, you see, there are quite a few commonplace things that we take for granted, but cannot quite explain from the scientific point of view. Sure, you’ll say, it must be some extra-hard scientific stuff, a formula understandable only by an army of advanced PhDs who spend their lives figuring out these ultra-complicated tasks.

Well, not quite. It turns out that life itself is quite a mystery from the scientific point of view.

  1. Life. In theory life in the universe appeared when electric currents went through the masses of hydrogen, ammonia, water and methane, therefore creating something animate out of a set of inanimate chemicals. In practice, for a few decades the scientists have been trying to achieve a similar effect on a smaller scale, but so far no one has been able to produce the Holy Grail – turning something lifeless into something that is actually live, such as a single-cell organism. The life itself, it seems, is a scientific anomaly that should not happen in this Universe according to the existing laws of chemistry.
  2. Death. You’ve heard it before: two things you cannot avoid in life are death and taxes. Well, this is a very human-centric view of things, as it turns out there’s a variety of species (most of them vertebrates) that only get better with age. Some turtles, it seems, only get healthier and produce more children with age. Moreover, scientists are aware only of non-natural causes of their deaths – being run over by a truck or attacked by a bird. Are those turtles immortal, or are we observing just a small stage of their lifecycles (which could eclipse ours by generations)?
  3. Dark matter. It’s not embarrassing for scientists to admit they don’t know something. After all, there are plenty of little details that remain unknown in many branches of science. So not knowing what constitutes dark matter would be an acceptable excuse, if it weren’t for the fact that dark matter comprises 96% of the Universe. We know that the Universe keeps expanding, but we cannot quite describe how and what happens to the space that used to be compacted previously. Dark matter is the giant elephant in the room in discussions related to astronomy or physics – we don’t know what it is, we’ve never seen it, and only infer its existence, yet roughly speaking it’s a major ingredient in the Universe we live in.
  4. Varying constants. Physical constants are warm and fuzzy. We don’t know why they have the value they have, but we always substitute them into our equations and formulas, relying on decades of scientific research behind us, and the fact that they are, well, constants. However, there’s a fairly determined group of scientists that is looking into certain scientific constants and finding that their values have changed as the Universe aged. Determined might be an understatement, as anyone willing to travel to Gabon and mess with uranium there is certainly dedicated. What they’re finding is that the constants describing nuclear reactions were different two billion years ago compared to current constants.
  5. Newton’s inverse square law. In 1994 scientists at Los Alamos National Laboratory figured out they had a bug with Pioneer probes. Contrary to the Newton’s inverse square law, the Pioneers were drifting off course. They hired Slava Turyshev out of Jet Propulsion Lab to investigate the small bug, which was most likely to blame on some contamination or error in Pioneer design. 14 years later the bug still stands unresolved. Together with NASA the scientists have gone through heaps of papers figuring out what could go wrong, and the answer is still up in the air. If unresolved, the Pioneer trajectory might become the first evidence that it’s time to rethink Newton’s inverse square law.
  6. Homeopathy. When it works, you hear all about it. Homeopathy is almost like religion, in the sense that it attracts either staunch believers, or extreme sceptics. The idea of diluting a certain ingredient with copious amounts of water doesn’t sit well with the majority of chemists, who point out that such small proportions call for a chance of the entire solution being water. Nevertheless, in Brooks’ book there’s an attempt at the explanation of what might be causing homeopathic effect – changes in molecular structure of water depending on the chemicals that it’s been in contact with, even if the chemicals have been filtered out. However, it’s still an attempt at best, since the scientific experiments that do achieve positive results are generally not reproducible.
  7. Placebo effect. Perhaps related to the previous thing we don’t understand, placebo effect has some interesting features. The patient knowing or suspecting that they might be receiving a placebo behaves differently than those without any knowledge. Are we comforted by the sight of people in white robes and our local pharmacist dealing out the regular dose of medication? Or does body start producing entirely different set of hormones with mind suspecting that the recovery process is near. Placebo, if figured out, might become a huge money saver with the current drug prices, and hence attracts scientific research. The only thing missing? A definitive conclusion on the placebo effect.
  8. Free will. A certain amount of human ideology rests on the idea of free will. So the idea of the body just reacting to some responses outside of the brain is uncomfortable. But picture this. You’re in bed, it’s time to get up, yet you want to spend a few more minutes in bed. Your conscious mind is sending the signals for the body to get vertical, and yet at some point, probably between the thoughts of pending shower and commute to work, you get up. The final decision done by something unconscious, something you don’t really have control over. While your conscious mind can submit an application to this unknown organ and request something happening, the body movements and behavior are triggered by something that is still largely unknown for science.
  9. Cold fusion. It became one of the most ridiculous scientific ideas to get associated with, and no scientist would touch it nowadays with a 40-foot pole, since it brings the stigma. However, as some point out, peer pressure is pathway to missing out on some potential innovations in the field. What’s currently reproducible is the effect of cold fusion on a plastic called CR39. Placed by a piece of depleted uranium, CR39 shows similar patterns of radiation as placed into a cold fusion experiment.
  10. Life on Mars. The Viking probes were declared to contain no evidence of life on Mars. The only person in the room who disagreed with the announcement was a bacteriological researcher, who came up with a clever idea of detecting life (fart reference coming soon). By adding radioactive isotopes to the nutrients fed into the foreign soil, the researchers would get any evidence of carbon-based life to produce gas (there it is), and by the virtue of having the food injected with isotopes, the Geiger counter would go ballistic, and hence you could validate existence of life in the soil, even if other tests came negative.
  11. WOW signal. One would argue that scientists at SETI (Search for Extra-Terrestrial Intelligence) have a pretty monotonous job. They’re waiting for a signal on 1420 MHz frequency. Why 1420? That’s the frequency of hydrogen, the most prevalent element in the Universe, so hopefully those extra-terrestrials will arrive at the same idea when sending the signal. So far no signal has arrived. Except on August 15th, 1977, when the signal came. It was very distinct, and caused Jerry Ehman to write "Wow!" on the margin of the printout. The signal never repeated, and the SETI folks have not heard anything similar since then.
  12. Mimivirus is an interesting virus that does not seem to affect humans, except for the unique cases, when it actually does. It’s the virus that fight cancer cells among others, and hence draws a great deal of research attention.
  13. Sex. If you’ve read this far, here’s a bonus entry. Yes, sex is one of those things that scientists do not quite understand (insert a proper nerd joke here). Looking at overall picture, the animal kingdom provides a great variety of alternative means of reproduction, that are much more efficient as far as number of offspring and the quality of gene preservation. A number of reptiles and fish are all-female or all-unisex species, copying themselves for the purposes of reproduction. Moreover, a number of species, like water fleas, can reproduce either sexually or asexually. You’d think that the species produced through asexual reproduction would be somehow inferior to the ones that appeared as a result of a sexual act, but there’s no solid scientific data to prove that or the opposite. What remains enigmatic is that if asexual reproduction would provide you with 2x the population compared to sexual (and that leaves out the time and energy spent on finding a mate, taking her to dinners and consequent ring shopping), why didn’t the entire animal world switch to asexual, as it’s obviously a more efficient process.

Aug 08

Daily deal sites like Woot

Jul 08

A few things about fair trade coffee

image I am reading Starbucked by Taylor Clark, and the book is quite enjoyable, both as a look inside the coffee industry, and as a business case study of Starbucks. Clark dedicates an entire chapter to fair trade coffee practices, that I wasn’t too familiar with, but as anybody else, assumed it was a Good Thing. Fair trade coffee practices, controlled by a non-profit TransFair USA, pay farmers participating in the program $1.26 a pound for regular coffee, and $1.31 for certified organic. Under the fair trade label it’s resold to you at $12-15 a pound, making the retailer quite a winner in this transaction (originally fair trade was supposed to eliminate the middleman, and thereby lower the final cost of coffee).

When the price of coffee beans can occasionally go under 40c, this seems like a good deal, if you’re a coffee farmer, so what’s the catch?

  1. Fair trade contracts are binding, and requiring the coffee bean farmers to commit to $1.26-$1.31 even if market surges (as it does when there’s a cold summer in Brazil). Ok, this is a bit hypothetical, but coffee markets have been known to swing wildly nevertheless. In 2006 Starbucks (the largest seller of fair trade coffee in the US) has actually paid its non-fair-trade growers an average of $1.42 per pound. Oops.
  2. TransFair requires that each coffee farm participating in the program be coop-owned and employ no outside seasonal labor. This rules out private farms, family-owned farms, and corporation-owned farms. A family of coffee bean growers starts out a farm, hires seasonal labor to pick the beans, and wants to sell it as fair trade coffee? TransFair doesn’t let those capitalist pigs get anywhere near the application form.
  3. Roasters admit that fair trade coffee is of inferior quality. While the rest of the coffee farms have to compete in lower-priced open market, they frequently do it by quality of their product. When a fair trade farm is guaranteed $1.26-$1.31 a pound, the economic rationales start to take over, and growers always try to cut their costs to enjoy higher profit margins.
  4. TransFair requires every participant in the fair trade program – retailer or coffee grower – to sign a release form promising never to criticize the program in public.