iPhone vs. gPhone navigation model #
I've had an iPhone for a long time. I tried a G1 “gPhone” and thought it was slow and unpolished (I've heard Cyanogen's mod helps a lot with the speed), so I went back to my iPhone. But after trying out the G1 for a bit longer, I've discovered the model is quite different, and possibly better, than the iPhone's model. Here are some scenarios:
Labels: structure
Experiences with my Macbook Air #
Nearly two years ago, I got a Macbook Air. It's been nearly two years, and here are my thoughts:
Bash Prompts on the Mac #
For a while now I've used colored prompts in bash. I typically make the machine name one color, the path another color, and the username bright red if I'm root. On some systems I show the date and time, the exit code of the previous command, whether I'm inside screen, or the ssh status. Other people have put the git branch, number of processes, job count, tty, system load, disk space, working files, or mailbox status into their prompts.
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:
Labels: future, speculation
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:
- You can edit the styles per site instead of globally.
- You can organize your CSS into named sections.
- You can share these sections with others.
- You can browse userstyles.org to find CSS shared by others.
- 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.
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:
- 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.
- Sustainability: renewable energy, better agricultural practices, and sometimes population reduction/stability. This is to avoid depleting resources.
- 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.
[2019] The Tesla is an even better example of "don't have to give up anything" car than the Prius.
Labels: environment, future
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: howto
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: future, speculation