This blog has my random thoughts; game-related posts go here.

Future anti-predictions 2

I'm quite optimistic about the future, but I seem to be posting anti-predictions instead of predictions. Perhaps I'll post positive predictions someday, but today I have some more negative ones:

  1. Quantum Computers. Yes, I know that there's a now quantum computer chip but I'm pretty pessimistic anyway. Quantum computers let you explore 2N states with N quantum bits; it would take 2N regular bits to do the same. However, I think the difficulty of maintaining the entangled quantum state will be proportional to 2N — that is, adding one quantum bit entangled with all the existing ones will double the difficulty of preventing decoherence. To explore a large search space, it will be far easier to build more very simple conventional processor than to build one very complex quantum processor.

  2. DNA Computers. Making DNA compute for us seems like a cool idea. We can grow this stuff in vats and have hugely parallel computers. The problems here are that (a) you have to get the problem transmitted to all the DNA in the vat, (b) there's no guarantee of finding the answer, and (c) DNA just isn't a great medium for the kinds of controlled programs we want to write. Here too I think it will be far easier to build a simple massively parallel computer from electronic parts than to build a DNA computer. DNA does have the advantage of easy replication, but conventional computers will also benefit from self-assembly.

  3. Practical Teleportation. There have been experiments showing that teleportation is possible. The basic approach is to entangle two particles at the quantum level, and then destroy the original, leaving you with the “teleported” one. It's pretty cool. But it suffers the same problem as quantum computers: there's a huge amount of complexity involved in teleporting real objects (unlike movie teleportation, I don't think it matters too much whether they're biological or not), and I'm rather pessimistic about being able to entangle a large number of particles simultaneously.

  4. Faster than Light Travel. Physicists seem to think that faster than light travel is possible using wormholes. The idea is that you bend space and time in such a way that where you are and where you want to be are “close” together in another dimension, and then you leap across. I think this is possible in theory. But bending the universe is going to take far too much energy and cause too much collateral damage for this to work in practice. Instead, we'll have to hope for existing wormholes, and there won't be any that are useful.

So there you go. Another fit of negativity from me. I really should start collecting positive thoughts about the future.

Labels:

Fun with user styles

Long ago (1997), Internet Explorer 4 gave us user style sheets, in the accessibility options. You could point the browser at your CSS file, and it would merge the user styles with the author styles. As with many features in IE4, other browsers adopted this feature too (Mozilla in 2002, Opera in 2003, I think).

User styles are quite neat. However, having to edit a file somewhere and then reload the browser is sort of a pain. The Stylish addon for Firefox makes user styles much easier:

  1. You can edit the styles per site instead of globally.
  2. You can organize your CSS into named sections.
  3. You can share these sections with others.
  4. You can browse userstyles.org to find CSS shared by others.
  5. You can install user styles from others with just a few clicks.

I just keep forgetting to write my own styles. Tonight I got fed up with MyWay's 700-pixel fixed width TV listings:

I used Firebug to look at the structure of the site, and after navigating nested tables with no class or id names to hang my CSS onto, I decided to use CSS attribute selectors to address the two tables that I wanted:

@-moz-document domain("tv.myway.com") {
  table[width="700"] {
    width: 100% ! important;
  }

  table[bgcolor="#888888"] {
    background-color: #fff ! important;
    padding: 2px;
  }

  table[bgcolor="#888888"] td {
    border: 1px solid #bbb;
    font-family: tahoma ! important;
    font-size: small ! important;
    -moz-box-shadow: 1px 1px 2px #bbb;
  }

  table[bgcolor="#888888"] td a {
    font-weight: bold;
    color: #000 ! important;
    text-decoration: none ! important;
  }
}

Here's the result:

Try out user styles. If you don't know CSS, you can explore userstyles.org; if you do, you can also try writing your own.

Labels: ,

We need infinite energy

[Warning: my thoughts on this topic are still not entirely clear. I sat on this post for a week but I couldn't find better words, so I decided to post anyway.]

When I think about being “green”, I think of three things:

  1. Clean: solar, wind, wave energy instead of coal, oil, and sometimes nuclear. Part of this is to reduce pollution, but lately it's about reducing CO2 released into the atmosphere.
  2. Sustainability: renewable energy, better agricultural practices, and sometimes population reduction/stability. This is to avoid depleting resources.
  3. Conservation (mostly of energy): less driving, less air travel, less lighting, less water, less energy. This is to reduce the impact of our activities on the planet.

I think all of these could use refinement.

I'm a big fan of Clean. Pollution in general is getting too little attention these days, and CO2 gets too much. CO2 is not a poison; it's a good gas to have. Our problem is that we're way out of balance. We're producing far more than we use, so it's building up in the atmosphere. We need to get back into balance, but that doesn't mean zero. Pollution on the other hand we should be at zero. But it doesn't need to be zero production; it's okay to produce if you can clean it up. For example, algae, fungi, and bacteria can be used to clean up some types of pollution, and titanium dioxide can do wonders. Here again balance is the key. Produce as much as is used, and we're good. That's different from saying produce zero.

I'm a fan of Sustainability but I think it's secondary to, and a consequence of, balance. I think depleting non-renewable resources is fine, as long as we do it knowing we're using it up, and we start coming up with a sustainable solution. We might decide to use oil, but deciding not to use it because we're going to use it up is not a compelling reason. Not having any oil and not using any oil are essentially the same. I think for now we should continue using oil, especially for waxes, lubricants, and biodegradable plastics.

I'm less of a fan of energy Conservation, in part because I think it addresses the wrong issue. (Raw material conservation is a separate issue.) The problem isn't turning the lights on. The problem is the impact that causes, because the electricity is generated in ways that pollute or produce CO2. Do you turn off your solar-powered yard lights when you don't need them? Doesn't it sound silly? Turning off your incandescent bulb powered by a wind farm seems almost as silly. Solar, wind, and wave energy are abundant—in fact, literally tons of photons fall on the Earth every hour. And if we don't use that energy, it's lost. If we had abundant clean, cheap energy, would we still feel bad about using incandescent lights? I think we would, because we're trained to, but we shouldn't. There are still good reasons to use less energy, but they're about cost rather than environment.

Historically, asking people to switch to a worse lifestyle at lower cost (public transit in suburbs, abstaining from sex, eating boring food, not going on vacations, using unpleasant lighting, etc.) doesn't seem to be as effective as asking people to switch to a better lifestyle at higher cost. The EV1 and original Insight were “sacrifice” cars. You had to give something up (range, comfort, size), but you could feel good about sacrificing for the sake of the environment. The Prius is quite different. It is comfortable, is roomy, has nice features, and has good range. You're not sacrificing lifestyle when going from a $16k car to a $20k Prius, but it does cost more. And the Prius is far more successful than the EV1 or original Insight. We should focus on abdundant clean, somewhat sustainable energy. I think we'll improve the environment much quicker by giving people lots of clean energy than to tell them to sacrifice. In addition, lots of other problems, like cleaning water and reducing pollution, become much easier to solve when we have lots of energy.

Labels: ,

Firefox cookie management with sqlite

I try to keep my Firefox cookie file clean. I used to run a script on cookies.txt to remove most cookies and keep only the ones for sites I visit often and trust. This was simple when the cookie file format was plain text. However, Firefox has been moving files to the sqlite format, and my script no longer works.

Sqlite seems to be pretty nice. The first thing I needed to do was figure out what format cookies.sqlite used. I ran select * from sqlite_master using the command line interface and it told me there was a table named moz_cookies with (id INTEGER PRIMARY KEY, name TEXT, value TEXT, host TEXT, path TEXT,expiry INTEGER, lastAccessed INTEGER, isSecure INTEGER, isHttpOnly INTEGER) as columns. Pretty straightforward. I used this information, plus the Python sqlite3 module (standard with Python 2.5) to write a script to clean up my Firefox cookies:

#!/usr/bin/python
# Change this to where your cookies file is
COOKIE_FILE = ('/Users/amitp/Library/Application Support'
    '/Firefox/Profiles/foobar/cookies.sqlite')
HOSTS = [  # keep only cookies from these hosts
    u'.blogger.com',
    u'www.blogger.com',
    u'.delicious.com',
    u'.discus.com',
    u'discus.com',
    u'blobs.discus.com',
    u'.github.com',
    # … other hosts omitted in this example code
    ]

# Connect and then issue commands through the “cursor” object
import sqlite3
connection = sqlite3.connect(COOKIE_FILE)
cursor = connection.cursor()

# Remove Google Analytics cookies from all sites
cursor.execute('DELETE FROM moz_cookies WHERE name IN'
               ' ("__utma", "__utmb", "__utmc", "__utmz")')

# Remove any cookies from non-approved hosts
cursor.execute('DELETE FROM moz_cookies WHERE host NOT IN (%s)'
               % (','.join(len(HOSTS) * ['?'])),
               HOSTS)

# Commit changes to disk, locking the file during the process
connection.commit()

# Print the cookies we have left
print 'After:'
rows = list(cursor.execute('SELECT host, name FROM moz_cookies'))
for row in rows:
    print '%30s : %s' % row

The script opens the cookies.sqlite file (unlike cookies.txt, it appears to be safe to open and edit this file while Firefox is running!), removes most cookies, commits the changes, and prints out the remaining cookies.

Lots of the Firefox profile information has been moved into the sqlite format (instead of the mess we had before), so I should explore some of the other files to see what might be fun to play with.

Labels:

Future anti-predictions

Perhaps I'm just tired of waiting for my flying car or hoverboard, but I'm not so optimistic that we'll see certain technologies become popular.

  • Cars that drive themselves. There's lots of research and good arguments about safety and efficiency and congestion. There are already commercial products for parallel parking, distance-controlled cruise control, and lane detection. But I think the real problem is liability. If there's an accident with a car you drive, it's a local problem (you). If a big company's car crashes while driving automatically, there's the potential for a very large lawsuit. Society benefits from automated driving but these companies pay for it. Early adopter individuals don't benefit enough that the companies can charge more. Such an arrangement makes it much less likely that these systems will leave the research phase. I also think congestion is much more likely to be addressed by variable pricing and better information than by automated driving.
  • 3D displays. There's been a recent increase in 3D TV, movies, and video games, but most of the technology doesn't seem any better than the last time 3D flared up in popularity. The image in your eye is inherently 2 dimensional. If it were 3 dimensional you'd be able to see behind and inside things (Flatland is an interesting read if you want to understand this better). To see 3D in your brain you need to have separate images in the left and right eye. You can do this with glasses: color filters (red/blue, used for TV), circular polarized light filters (used in movie theaters), or timed shutters (used in video games). Or you can do this without glasses, by using the difference in viewing angle between the eyes (Philips WowVX for example), but this requires either a single viewer or all viewers to be roughly the same distance from the display. You can also produce 3D effects at a different level of the brain, by viewing different angles (either statically with animation or dynamically with head tracking). The problem is that all of these systems have limitations that exceed the marginal benefit of 3D, once the novelty wears off. So they'll all be used in specialized situations like medical imagery, advertising in malls, and a small number of TV/movie/game applications. But I think 3D displays are not going to be widespread.
  • Humanoid robots. Humans are better than computers at some things: creativity, language, pattern recognition, art, design, reasoning. Computers are better than humans at some things: calculations, memorization, repetitive motion, fast sensors. People seem to think that the future is about making robots that look and work like us, but there's no point. We have plenty of humans. We will build robots that do the things we're not good at. And that means there's no particular reason to use a humanoid form. The future of robots is not humanoid. I think humans with machine parts will become commonplace, but they won't be robots replacing or competing with us; they'll be enhancing us.

In general though I'm quite optimistic about the future. I just think the things that actually succeed won't be the commonplace predictions you see in movies and TV.

Labels:

Time loops: The Terminator

In the Terminator series (movies and TV show), there are some odd time loops.

  • John Connor sends Kyle Reese back in time. Kyle and Sarah have a son, John Connor. But John sent Kyle back in time only because of Skynet. Without Skynet, John wouldn't exist. The timeline protection hypothesis suggests John can't kill Skynet.
  • Skynet sends a Terminator back in time. The Terminator's arm and CPU are left behind. The technology in that CPU is what Dyson uses to build the beginnings of Skynet. But Skynet sent the Terminator back in time only because of John Connor. Without John, Skynet wouldn't exist. The timeline protection hypothesis suggests that Skynet cannot destroy John.

How did we get into this circular timeline in the first place? I think it's reasonable for the initial timeline to exist without the loop. John could be someone else's son. Skynet could be developed without the Terminator's CPU. But once they start messing with time, they got into this circular dependency, where they only exist because of each other. I'm not sure they can get out of it though. It's similar to the grandfather paradox, except there are two parties trying to kill each other.

The Matrix series, which coincidentally also was about war between machines and humans, might give us a way out of the Terminator paradox. Agent Smith was trying to destroy Neo, and to do so he was willing to destroy the world. Neo sacrificed himself, which meant Smith no longer had a purpose, and Smith was destroyed at the same time as Neo. So perhaps John and Skynet have to destroy each other simultaneously. Or perhaps, as in The Matrix, the humans and machines call a truce, and both John and Skynet stop fighting far in the future, but only after the war that leads to both of them being created.

Emacs: full screen on Mac OS X

If you have a recent version of Carbon Emacs, you can run M-x mac-toggle-max-window to toggle full screen mode, with no menubar. This is handy enough that I've bound it to ⌘ Return, which is similar to what some Linux and Windows apps use to toggle full screen mode.

(define-key global-map [(alt return)] 'mac-toggle-max-window)

I also keep the tool bar off with (tool-bar-mode -1), scroll bars disabled with (scroll-bar-mode -1), and menu bars off with (menu-bar-mode -1). Enjoy an Emacs without distractions!

Update [2008-08-10] They seem to have removed the function, but you can get it back with this code, Vebjorn Lsoja:

(defun mac-toggle-max-window ()
  (interactive)
  (set-frame-parameter nil 'fullscreen (if (frame-parameter nil 'fullscreen)
                                           nil
                                           'fullboth))) 

Labels: , ,

Setting the Carbon Tax

The carbon tax is a tax on CO2 emissions. It aligns incentives of business (profit) and society (stable climate) by giving businesses an opportunity to make more money if they find ways to reduce their CO2 emissions.

One open question with the carbon tax is how to choose the tax rate. Several countries already have a carbon tax, but they seem to set it at a fixed rate, or increase it by a fixed amount each year. Even the Carbon Tax Center says, “There is no magic formula or right number”. I think they're approaching it wrong. Carbon taxes are essentially prices on carbon emissions. Governments shouldn't set prices, and they shouldn't set carbon tax rates either. The market should do it, with a little help from the government.

First, we should decide what level of CO2 emissions are “sustainable”. You can think of this as the “supply” of available emissions. There is no need to go below this level, although doing so will not be harmful. We should be able to continue emitting at the sustainable level for thousands of years. This level is then set as the eventual sustainable target.

Our current emissions are rather high. We can think of this as “demand”. Since demand is higher than supply, we need to raise prices (the carbon tax rate, currently 0% in the U.S.). We need to decide when we want to reach the sustainable level, and then interpolate target levels from the current level to the sustainable target. This might be a straight line for simplicity, but could also be an S-curve or exponential decay.

For example, let's say that the current CO2 emissions are 6 billion metric tons, and we decide that 1 billion metric tons, combined with more forests, is sustainable. Let's further suppose that we want to reach this target in 10 years. That means we need to reduce emissions by 0.5 billion metric tons each year, so we set our target for 2009 to 5.5, 2010 to 5.0, 2011 to 4.5, etc., until 2018, at 1.0 billion metric tons.

Each year (or perhaps every month), we look at the current level of emissions and the target level, and increase or decrease the carbon tax rate. If we're emitting more than the target, we'll increase the tax rate. If we're emitting less (which may happen in a few years, if all the businesses are competing to increase profits by reducing emissions), then we decrease the tax rate. By altering the tax rate in this way, we can stay close to the target.

The problem on the business side is that if the tax rates change every month, there's a lot of uncertainty (just as for any prices that change suddenly every month), and it's hard to change plans that quickly. What will likely develop is an insurance market. Insurers will sell insurance that the tax rate won't go up much, and businesses will buy the insurance to hedge against sudden increases. Does this eliminate the incentives for businesses? No! They're now paying insurance and taxes. The cost of insurance is set by the likelihood at the tax rates will go up. The insurance industry is in the best position to guess this, because they'll be visiting the businesses to determine how quickly emission reductions are going into place. The insurance companies will then be able to predict the future emissions, and set insurance rates based on that. Since they're the ones making payouts when businesses (collectively) don't reduce emissions, the insurance companies will then have an incentive to push businesses to act sooner. They also have the incentive to share techniques across businesses. They make more money when businesses collectively reduce emissions.

Most carbon tax proposals use a fixed price and hope that the output will decline. Most cap-and-trade proposals use a hard limit on emissions, and a variable, potentially volatile price. The variable carbon tax rate proposal combines aspects of both approaches. It uses variable prices, but they're varying less often; it uses a target instead of a hard cap, which allows businesses to buy more time; and it generates revenue for society. With a market based scheme, incentive are aligned. Society will want reduced emissions, businesses will want to reduce tax rates (by reducing emissions), and insurance companies will want to reduce payouts (by convincing businesses to reduce emissions). If businesses fail to reduce emissions, they pay an ever increasing compensation to society for the delay. Furthermore, the open question of what to set the tax to, which is open to lobbying, is replaced by the question of how much to change the tax, which I think is harder to game. This scheme also tells you when we've achieved our goal: emissions are at the sustainable target level. Even at this level, we continue the carbon tax to prevent emissions from going up, and we continue to take in revenue from those businesses that produce emissions. This will keep our emissions near the sustainable level.

Labels: , ,

Why I got a MacBook Air

Carrying case for the MacBook Air
My Air in its carrying case

I bought a MacBook Air. You know, that small puny computer that's been called a toy. The one that's overpriced. The one that fits in a manila envelope. Ha ha. I'm not going to review the product, but instead I wanted to explain why I ended up getting one. I wouldn't have gotten one if my MacBook hadn't deteriorated (due to my abuse), but since it was time to buy a computer, I spent a month evaluating how I use the computer, and ended up choosing the Air.

I've always been someone who enjoys the biggest, fastest, most powerful computer he can get. Until a few years ago, that's what I got. Back when people used CRTs, I got a 21" Sony that could display 2048x1536. I love high resolution (and still do) and love big screens (still do). Dual core? 64 bit? Lots of RAM? Love it! However…

Four years ago at work, I was assigned to a project in which I had to work in several different offices. They gave me a laptop for this. Eww. Tiny keyboard, slow processor, tiny screen, only 1400x1050 resolution. At the time Linux wasn't suitable for laptops so I got Windows on a Thinkpad. When I was in my main office I used my Linux workstation with a nice 20" LCD running at 1600x1200. But when I was away from there, I used the laptop with Cygwin + ssh + X to run things on my desktop, but display them on the laptop. It was less productive than having the big screen and full keyboard, but it was more productive than having nothing.

Then I discovered something. Portability is nice. Really nice. Really, really nice. I wasn't just working on that laptop in a few offices. I could work on the couch with the laptop in my lap. I could take it to meetings and show people the UI design on a projector. I could take it home and work from home. I could sit outside (if the lighting was right). The ability to move around was worth a lot to me. I found that although at my desk, the laptop is less productive than my desktop machine, the ability to move around (for example, find a quiet space away from distractions) made me more productive overall.

About two years ago I realized that even when I was back at my desk, I was still using my laptop. I almost never used the desktop machine directly. I did use it all the time for running programs. The laptop was a “dumb terminal” (X11 plus browser) for my desktop machine, and I could take it anywhere.

Once I realized how nice portability was, I decided to get a laptop at home. I wasn't thrilled with the idea of getting Windows, especially given that they'd be transitioning everyone from XP (which was reasonable) to Vista (which I'd heard horror stories about). So I decided to switch to Mac. I would've never switched when they had Mac OS 9 on PowerPC chips, but once they had a Unix base and on Intel chips, it became a reasonable option for me. I got a MacBook Pro. I've been reasonably happy with it.

Just as I transitioned from desktop to laptop at work, I found that I use the laptop for everything at home. Everything except games. For games I want Windows XP, a full sized trackball, a full sized keyboard, a big screen, a fast CPU, a fast graphics card, and nice speakers. I got none of this on the laptop. But for browsing, email, programming, editing, photos, music, and just about everything else, the laptop is great. So I now have a gaming desktop machine for games (and photos — I love Picasa on Windows and find iPhoto on Mac to be unpleasant) and a laptop for everything else.

At this point, a faster laptop wouldn't be any better, because I already have all the speed I need. I want: more battery life, lower weight, a screen that can be used outdoors, and higher reliability. Unfortunately none of the laptops I looked at were great. I'm sticking with Mac for now, but unfortunately the lightweight Mac laptops don't have great battery life (my Thinkpad got 7 hours, and newer ones can get 11). The Air does have a lower weight than my current laptop. With the flash drive I'm hoping for higher reliability, especially since I move around a lot when using the computer, and a majority of my crashes have been while moving the machine around. I generally prefer matte screens to glossy, but I've talked to several people who use glossy and say that it's much nicer than it initially seems. 64 GB is slightly small (100 GB is more than I need), but after going through my data and removing all the waste (like Apple's Mail app keeping two copies of all my emails, and the iPod sync program keeping a second, bloated copy of all of my photos), I think it'll be fine.

The Air seems like a reasonable upgrade for me, not for the usual things people want (CPU, graphics, RAM, disk, etc.), but for the things that matter to me (weight, size, reliability, portability). The standard complaints about the Air don't bother me: slow (it's as fast as my computer was two years ago, and somehow that didn't seem slow to me), battery isn't swappable (In 4 years I've never taken the battery out of my laptops), it's expensive (it does seem a little high, but that's always how it goes with early adopters, so if you're price sensitive, wait a few years), no DVD player or ethernet or firewire (I already don't use these).

My priorities have changed over the years. I used to want big: high speed, big storage, big screen, big computer, big keyboard, big mouse, high pixel count. Now I want small: low power consumption, low weight, easy to move around, ability to use anywhere. I can put the big stuff on servers; all I really want to carry around is a terminal — I can access my data remotely. The Air seems to be a good step in that direction.

Labels:

The future of food

Imagine a world in which the way food tastes and the nutrition are independent. You could eat vitamin-fortified soylent green and make it taste like pizza or bacon or ice cream or chocolate cake. It's just like those dreams programming language people have of having surface syntax independent of the parse tree, so that you can have many different syntaxes on the same program. It's like those movies where the evil villain wears pink.

In the future, what you see, smell, taste, feel, and hear doesn't have to match what's on the inside.

Bacon Salt is one of the early pioneers in this future of food. I hope to see many more.

Labels: