There’s a new report from Consumer Reports on best and worst vacuum cleaners. Their choices for upright vacuum cleaners:

Consumer Reports found that the Kenmore (Sears) Progressive 35922, $350, which is quiet and excellent on carpets, the Kenmore (Sears) Progressive 36932, $350, which is a bagless option, and the Eureka Boss Smart Vac 4870, $150, which is inexpensive and impressive on bare floors, are the best choices.

Posted in Gadgets, General at September 2nd, 2008. No Comments.

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.
Posted in Review, Science at August 27th, 2008. No Comments.
Posted in Money at August 23rd, 2008. 1 Comment.

Due to Netflix outage this week I was thinking about getting their Vudu appliance for instant on-demand streaming to a TV set. But then, it seems that those appliances are just interim products, till we move to something better, sort of like CD-ROMs.

The better in this case is wireless HDMI. Since Netflix already supports streaming part of their catalogue to your PC, it’s just the matter of time till you can get that stream in high-def, and then plug in a wireless HDMI adapter to stream it directly to the television, bypassing a settop box entirely.

A limited selection of wireless HDMI products on the market is pretty pricey nowadays compared to a box from Vudu sold through Netflix. A set of extenders from Gefen is currently $700. Belkin Flyware HDMI transmitter is also $700. Hopefully the pricing would follow the DVD player timeline close enough.

Posted in Entertainment, Gadgets, General, Money, Technology, Wireless at August 15th, 2008. No Comments.

Anthony Dovgal reported on adding open source SQL full-text search engine sphinx to PECL. The documentation is available on the PHP site, the engine is available upon including sphinxapi.php in your application. You know the usual InnoDB vs. the MyISAM trade-offs, where the former is faster, but the latter has the full-text search? Sphinx is a free open-source full-text search engine that works with many RDMBS, and now is pretty easy to incorporate into PHP. A simple example of calling Sphinx is available here:

$s = new SphinxClient;
$s->setServer("localhost", 6712);
$s->setMatchMode(SPH_MATCH_ANY);
$s->setMaxQueryTime(3);
$result = $s->query("test");

Posted in New software releases, PHP, Programming at July 31st, 2008. No Comments.

John Coggeshall, CTO of Automotive Computer Services, and author of Zend PHP Certification Practice Book and PHP5 Unleashed, gave a talk at OSCON 2008 on top 10 scalability mistakes. I wasn’t there, but he posted the slides for everybody to follow. Here’re some lessons learned.

  1. Define the scalability goals for your application. If you don’t know how many requests you’re shooting for, you don’t know whether you’ve built something that works, and how long it’s going to last you.
  2. Measure everything. CPU usage, memory usage, disk I/O, network I/O, requests per second, with the last one being the most important. If you don’t know the baseline, you don’t know whether you’ve improved.
  3. Design your database with scalability in mind. Assume you’ll have to implement replication.
  4. Do not rely on NFS for code sharing on a server farm. It’s slow and it’s got locking issues. While the idea of keeping one copy of code, and letting the rest of the servers load them via NFS might seem very convenient, it doesn’t work in practice. Stick to some tried practices like rsync. Keep the code local to the machine serving it, even if it means a longer push process.
  5. Play around with I/O buffers. If you’ve got tons of memory, play with TCP buffer size - your defaults are likely to be set conservatively. See your tax dollars at work and use this Linux TCP Tuning guide. If your site is written in PHP, use output buffering functions.
  6. Use Ram Disks for any data that’s disposable. But you do need a lot of available RAM lying around.
  7. Optimize bandwidth consumption by enabling compression via mod_deflate, setting zlib.put_compression value to true for PHP sites, or Tidy content reduction for PHP+Tidy sites.
  8. Confugure PHP for speed. Turn off the following: register_globals, auto_globals_jit, magic_quotes_gpc, expose_php, register_argc_argv, always_populate_raw_post_data, session.use_trans_sid, session.auto_start. Set session.gc_divisor to 10,000, output_buffering to 4096, in John’s example.
  9. Do not use blocking I/O, such as reading another remote page via curl. Make all the calls non-blocking, otherwise the wait is something you can’t really optimize against. Rely on background scripts to pull down the data necessary for processing the request.
  10. Don’t underestimate caching. If a page is cached for 5 minutes, and you get even 10 requests per second for a given page, that’s 3,000 requests your database doesn’t have to process.
  11. Consider PHP op-code cache. This will be available to you off-the-shelf with PHP6.
  12. For content sites consider taking static stuff out of dynamic context. Let’s say you run a content site, where the article content remains the same, while the rest of the page is personalized for each user, as it has My Articles section, and so on. Instead of getting everything dynamically from the DB, consider generating yet another PHP file on the first request, where the article text would be stored in raw HTML, and dynamic data pulled for logged-in users. This way the generated PHP file will only pull out the data that’s actually dynamic.
  13. Pay great attention to database design. Learn indexes and know how to use them properly. InnoDB outperforms MyISAM in almost all contexts, but doesn’t do full-text searching. (Use sphinx if your search needs get out of control.)
  14. Design PHP applications in an abstract way, so that the app never needs to know the IP address of the MySQL server. Something like ‘mysql-writer-db’, and ‘mysql-reader-db’ will be perfectly ok for a PHP app.
  15. Run external scripts monitoring the system health. Have the scripts change the HOSTS if things get out of control.
  16. Do not do database connectivity decision-making in PHP. Don’t spend time doing fallbacks if your primary DB is down. Consider running MySQL Proxy for simplifying DB connectivity issues.
  17. For super-fast reads consider SQLite.  But don’t forget that it’s horrible with writes.
  18. Use Keepalive properly. Use it when both static and dynamic files are served off the same server, and you can control the timeouts, so that a bunch of Keep-alive requests don’t overwhelm your system. John’s rule? No Keep-alive request should last more than 10 seconds.
  19. Monitor via familiar Linux commands. Such as iostat and vmstat. The iostat command is used for monitoring system input/output device loading by observing the time the devices are active in relation to their average transfer rates. The iostat command generates reports that can be used to change system configuration to better balance the input/output load between physical disks. vmstat  reports  information about processes, memory, paging, block IO, traps, and cpu activity.
  20. Make sure you’re logging relevant information right away. Otherwise debugging issues is going to get tricky.
  21. Prioritize your optimizations. Optimization by 50% of the code that runs on 2% of the pages will result in 1% total improvement. Optimizing 10% of the code that runs on 80% of the pages results in 8% overall improvement.
  22. Use profilers. They draw pretty graphs, they’re generally easy to use.
  23. Keep track of your system performance. Keep a spreadsheet of some common stats you’re tracking, so that you can authoritatively say how much of performance gain you got by getting a faster CPU, installing extra RAM, or upgrading your Linux kernel.

Complete presentation is down below:

Posted in MySQL, Optimization, PHP, Programming, Security at July 28th, 2008. 3 Comments.

This submission to Current.TV is pretty funny - Facebook News Flash - what News Feed would like if it were read by a TV news anchor.

Posted in News at July 27th, 2008. No Comments.

This is a response to A Programming Job Interview Challenge #13 - Brackets. The solution is in PHP, which hopefully is not an issue. Read More…

Posted in Programming at July 21st, 2008. 1 Comment.

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.
Posted in General, Health, Money at July 16th, 2008. 4 Comments.

Back in 2007 HitWise published the findings that 1% of searchers conduct 13% of searches, and hence these power searchers became the coveted audience among the search startups. Most of them try to get to the 1% through some sort of rewards club. Live Search Club promises prizes in exchange for the searches conducted on Live.com.

Scour now combines Google, Yahoo! and Live results into a single interface, and pays out 1 point for searching, 2 points for rating a search result in a Digg-style manner, and 3 points for commenting on a search result, hinting at some attempt at social search. What do points get you? 25k points equal a $100 gift card, half of that is a $50 gift card, and 6,500 points equal a $25 gift card.

I was always happy to sell my Firefox searchbox to a highest bidder, and used to use Blingo, where I even won some movie tickets occasionally. Lately Blingo dropped Google search results, and substituted them with a combo of paid ads and organic results from Yahoo! and Live (bad idea because of paid links appearing in top 3 results for anything), so Scour looks like the next best thing to come after that. Currently 34,000ish rank on Alexa, but climbing quite fast.

Sign up through my referral, if you’re interested. The results pages seem to be clean, although navigating to the results page is always accompanied by a frame that has the ratings widget.

Posted in Money, Technology at July 13th, 2008. 3 Comments.