2009/02/25

Japan's boffins: Global warming isn't man-made - The Register

Japan's boffins: Global warming isn't man-made — The Register:

The Register's title is an understatement. The report from The Japan Society of Energy and Resources goes beyond questioning human origins of global warming. It also claims that the pattern of warming since the mid-20th century has ceased.

Excerpts:

One of the five contributors compares computer climate modelling to ancient astrology. Others castigate the paucity of the US ground temperature data set used to support the hypothesis [emph. added], and declare that the unambiguous warming trend from the mid-part of the 20th Century has ceased.


The article includes a translation of parts of the report.
Global mean temperature rose continuously from 1800-1850. The rate of increase was .05 degrees Celsius per 100 years. This was mostly unrelated to CO2 gas (CO2 began to increase suddenly after 1946. Until the sudden increase, the CO2 emissions rate had been almost unchanged for 100 years). However, since 2001, this increase halted. Despite this, CO2 emissions are still increasing.


There is no prediction of this halt in global warming in IPCC simulations.


Hm, I thought there was. Certainly the halt has been discussed online — fun example here — and it has been attributed to a trough in sunspot activity...

But the report addresses this point, too, and goes on to say
...climate change and solar activity's relationship is inconclusive. It is necessary to increase research efforts into the relationship between Earth's climate fluctuations and solar activity.

2009/02/24

ADC - CSS Recipes for WebKit

Safari 4 Beta has some nice features. Some have apparently been around since Safari 3, but I didn't notice. For example:

ADC — CSS Recipes for WebKit:

"Getting columns right on webpages using pure CSS instead of HTML tables has always been tricky. Since the CSS3 properties for multi-column layout are implemented in Safari and WebKit, you can clearly define the number of columns [and] the gap between the columns...

This code defines that the HTML in the columns div tag should be presented in three columns. Each paragraph is its own column."


Wow, that's nice! It means you can define a fluid multi-column layout and have content flow between those columns.
safari_4_columns_1.png

Granted, the layout can do some strange things when images bleed across columns.
safari_4_columns_2.png

Maybe one of the -webkit-column-break-* properties can control this.

[Update: Of course Firefox 3 supports most of these column properties as well, via -moz-column-*. Firefox 3.1 beta 2 extends support to properties such as -moz-column-rule.]

2009/02/18

Canvas for a Text Editor?

Canvas for a Text Editor?:

The HTML 5 specification includes an API to render text on a canvas. Unfortunately, this portion of the canvas API has only been implemented by Firefox, though it's already in WebKit nightly builds (and thus will very likely be in a future version of Safari) and Chromium nightlies (from which Chrome versions are derived). We expect Opera will soon as well.


Support for canvas text in browsers other than Firefox will be a great thing for web applications. I've built 2D chemical structure viewers using Canvas, and the clunkiest aspect has been the overlaid text divs for atom labels. (Thank goodness for TextCanvas. Without it, I wouldn't have made the effort.)

You don't really notice text overlays are being used unless you accidentally click-drag your mouse over a depiction, or you set your browser preferences to disallow text smaller than a set size.

2009/02/17

Flex: Stopping event propagation from itemRenderers | kahunaburger

Flex: Stopping event propagation from itemRenderers | kahunaburger:

"My problem was that whenever I clicked on one of the menu items (the four icons at the bottom of the right tile), the mouse event would not only execute the action associated with the menu-item, no, the event would propagate up the chain and would result in the current tile being selected as well. Not good - this has to stop. "


Kahunaburger just saved me a lot of effort. The posted solution works for DataGrids as well.

macosxhints.com - 10.4: Use Automator to batch add Spotlight comments

Edited lightly:

macosxhints.com - 10.4: Use Automator to batch add Spotlight comments:

10.4: Use Automator to batch add Spotlight comments

By: cafemomo on Wed, May 18 2005 at 6:24AM PDT

In Automator, create the following workflow:

1. Finder > Get Selected Finder Items

2. Spotlight > Add Spotlight Comments to Finder Items

2.1. Keep 'Append to Existing Comments' checked

2.2. Open the Options disclosure area and check 'Show Action When Run' so you can set comments each time

3. In Automator, go to File > Save as Plug-in..., enter 'Add Spotlight Comments' as the 'Save Plug-in As:' name, and make sure 'Plug-in for:' is set to 'Finder'

4. Save and close Automator (if it asks you to save again, do so)

Now in Finder, select some items you want to add comments to and right-click (or control-click) and select 'Add Spotlight Comments' from the 'Automator' submenu.


Handy, e.g. for tagging related travel video clips which have been imported with Final Cut Pro.

Juxtaposition

Op-Ed Columnist - Yes, They Could. So They Did. - NYTimes.com:

It's a plug-in electric car that is also powered by rooftop solar panels -- and the two young women, recent Yale grads, had just driven it all over India in a 'climate caravan' to highlight the solutions to global warming being developed by Indian companies, communities, campuses and innovators, as well as to inspire others to take action.


Charging ahead with energy independence - SantaFeNewMexican.com:
Zappy is an all-electric vehicle under construction in Dan Baker's garage off Old Santa Fe Trail. Baker -- known around town as an avid cyclist -- also is a big solar-energy and electric-vehicle proponent. He'll run Zappy off the 5-kilowatt solar photovoltaic system he had installed on his roof last September.


Purpose Built Vehicles - Bright Automotive (of Indiana):
[Our vehicle] operates in all electric mode for the first 30 miles, then operates in hybrid mode with a full range of 400 miles. Bright Automotive's smart vehicle architecture is also designed to return stored energy back to the electrical grid - potentially reducing peak energy demand.

2009/02/16

Mozilla Webdev » Blog Archive » Native JSON in Firefox 3.1

Mozilla Webdev » Blog Archive » Native JSON in Firefox 3.1:

"Pretty easy huh? And here’s how to get a JSON string from an object:

var personString = JSON.stringify(person);"


As a long-time fan of Python's pickle and shelve, I hope JSON.stringify properly handles JavaScript object graphs. And I hope jQuery exposes a similar API.

I think jQuery provides only .param, which is designed as a helper for forms serialization and which does not handle nested objects. For example, in jQuery 1.3.1 this:

var graph = {
'item': {
'name': 'bob',
value:42
},
'index': 1};
$('#msg').html("Graph: " + $.param(graph));


produces this:
Graph: item=%5Bobject+Object%5D&index=1

2009/02/15

Change Happens

Change Happens:

"I won't say that this entry has that much spice, but I hope you can take a moment with me to see through time to allow wonder and delight to replace fear of change."


Tim O'Reilly's recent posts make for satisfying reading. He surrounds his ideas in a thick context of personal and family history.

Former astronaut scoffs at global warming - SantaFeNewMexican.com

Former astronaut scoffs at global warming - SantaFeNewMexican.com:

'As a geologist, I love Earth observations,' [Harrison Schmidt] wrote in his Nov. 14 resignation letter. 'But, it is ridiculous to tie this objective to a 'consensus' that humans are causing global warming when human experience, geologic data and history, and current cooling can argue otherwise.'

"We're very skeptical about the crisis that people are proclaiming in global warming," [said Dan Williams, publisher with the Heartland Institute, which is hosting the second International Conference on Climate Change in New York]. "Not that the planet hasn't warmed. We know it has or we'd all still be in the Ice Age. But it has not reached a crisis proportion and, even among us skeptics, there's disagreement about how much man has been responsible for that warming."
[Schmidt] said he is heartened that next month's conference is made up of scientists who haven't been manipulated by politics, possibly because they are not dependent on government funding.


The debate continues about the causes of global climate change. (See also Dr. John Theon's expression of skepticism.)

What interests me most about the debate is its effect on U.S. energy policy. If it spurs us to improved energy efficiency — e.g. in home heating and cooling and reduced contention for foreign oil — it seems beneficial to act as though climate change has some human causes, whatever the uncertainties in our understanding.

On the other hand, if the debate leads us to cover the wilderness with wind turbines, solar farms, and superconducting transmission lines [update: lucky timing - here's an example], then maybe we should start demonizing termite methane emissions :)

2009/02/13

VoodooPad and TextMate

VoodooPad's new HTML-savvy application-specific URLs are a great way to retrace your steps in TextMate.

I keep my worklog in VoodooPad. I do most of my code editing in TextMate. When I'm trying to understand a new chunk of code, I often need to jump around through the code base.

It's hard to keep track of where I've been, so I can back out of a code path once I understand what it does. Until now I've just jotted down pathnames and line numbers in my worklog, so I could manually retrace my steps.

Puzzle Pieces


  • VoodooPad URLs. They let you inject HTML content — including hyperlinks — into an open VoodooPad document.
  • TextMate URLs of the form txmt://open?url=file://pathname&line=lineNum;column=colNum. Open one of these URLs and TextMate will open a window showing the specified line (and column, if specified) of the specified file.
  • Textmate commands and key equivalents.
    TextMate lets you define custom commands and trigger them with keyboard shortcuts that you specify.


Put these all together and what do you get?

Scenario
  • Select some code of interest in TextMate
  • Type your keyboard shortcut
  • A hyperlink pointing to the selected code is inserted into your VoodooPad document

Later, when you want to get back to that chunk of code, just click on the hyperlink in VoodooPad. TextMate will open the document and jump to the line of code referenced by the hyperlink.

Granted, you're probably going to edit that code someday; and then your bookmarks will break. But this is a handy way to leave a trail of breadcrumbs while you're trying to decipher a new body of code.

Code

Here's a Python script which implements this "Bookmark in VoodooPad" capability in TextMate. You can use it by opening TextMate's Bundle Editor (Bundles -> Bundle Editor -> Show Bundle Editor), creating a New Command using the tool menu at the bottom left of the Bundle Editor window, and pasting it into the resulting Command(s) text area:

#!/usr/bin/env python2.6
import os, datetime, urllib, subprocess

escape = urllib.quote

# What Textmate location are we bookmarking?
path = os.environ["TM_FILEPATH"]
lineNum = os.environ["TM_LINE_NUMBER"]
_tmURLTemplate = """txmt://open?url=file://{path}&line={lineNum}"""
tmURL = _tmURLTemplate.format(path=path, lineNum=lineNum)

# Which VoodooPad worklog page should we add it to?
vpPageName = escape(datetime.date.today().strftime("%Y-%m-%d"))

# What text should Voodoopad show for the link?
currLine = os.environ.get("TM_SELECTED_TEXT", os.environ["TM_CURRENT_LINE"])

# How should the HTML be formatted?
_vpHTMLTemplate = '''<a style="font:12px helvetica" href="{tmURL}">{currLine}</a>'''
vpMarkup = _vpHTMLTemplate.format(tmURL=tmURL, currLine=currLine)

# What URL do we open to inject the HTML into VoodooPad?
_vpURLTemplate = """voodoopad:html={vpMarkup}&page={vpPageName}"""
vpURL = _vpURLTemplate.format(vpMarkup=escape(vpMarkup), vpPageName=escape(vpPageName))

subprocess.check_call(["open", vpURL])


Specify a key equivalent such as ⌘-T (Command-T) and you're off to the races.

VoodooPad bookmarklets now support HTML

VoodooPad bookmarklets are very useful. But they let you paste only plaintext from your web browser into your document — until now.

VoodooPad Application URLs

VoodooPad understands application-specific URLs of the form voodoopad:description=encoded_text&page=name_of_VoodooPad_document_page. When you open one of these URLs, VoodooPad inserts the encoded text into the indicated page of the current VP document.

You can open voodoopad: URLs from other applications, such as a web browser. That's what's so cool about VP bookmarklets -- they let you quickly select some text in your web browser and paste it into a VP document, along with other information such as the URL where the text originated.

The only problem is, the description parameter can contain only plain text. So if you've selected part of a web page that contains hyperlinks, those hyperlinks won't come along for the ride.

New Feature

Gus Mueller, VoodooPad's creator, recently released a new build. It adds a new html parameter to VoodooPad URLs. Now you can select part of a web page and transfer it as HTML into your VoodooPad document.

Gus summarized the new feature thus:

The format of the bookmarklet is like so:
voodoopad:page=junk&html=<b>hello</b>%20world!
Here's expanded code for a JavaScript bookmarklet which takes advantage of the new parameter. It works in both Safari and Firefox 3.0.x:

javascript: function pad(v) {
var res=String(v);while(res.length<2) {
res='0'+res;
}
return res;
};
var d=new Date();
var page=(String(d.getFullYear())+'-'+
pad(d.getMonth()+1)+'-'+ pad(d.getDate()));
function selHTML() {
var wr=document.createElement('div');
var c=window.getSelection().getRangeAt(0).cloneContents();
wr.appendChild(c);
return wr.innerHTML;
};
location.href='voodoopad:html='+encodeURIComponent('<div style="font:12px helvetica">'+location.href+'<br/>"""<br/>'+selHTML()+'<br/>"""</div><br/>')+'&page='+page;


Worth noting: in this snippet the html content is wrapped up in a div which has an explicit font specification. The bookmarklet is transferring a chunk of HTML, but that chunk doesn't include any of the CSS from the original web page. So if you don't specify a style for the wrapper div, VoodooPad will use its own default style for the current VP page. (I think that's something like Times Roman 10px.)

2009/02/12

Technology Review: Neanderthal Genome Unraveled

Technology Review: Neanderthal Genome Unraveled:

"Using previously sequenced genomes from other species was also crucial, says John Hawks, a biological anthropologist at the University of Wisconsin. 'Bootstrapping computer information about genomes really made all of this possible,' he says. 'To be able to take snippets of DNA of 50 base pairs or less and have the computer say that it's the same as a bacterial sequence has enabled the reconstruction of genuine Neanderthal sequence.'"


I wonder how this relates to recent findings about horizontal gene transfer? Are all of those 50-base-pair sequences unique to bacteria, or are they just "most likely to occur" in bacteria?

2009/02/11

Call This Progress?

Call This Progress?:

"Five years of ‘action’ and only one country out of five so-called advanced European nations — all of which fought with the USA to get it to sign the Kyoto Protocol — has managed to reduce its emissions by more than 5%."


The article claims that the U.S. increased its emissions by 2.4% in the measured period. That's better than Kyoto signatories France (2.9%) and Spain (12.4%).