Climate Change Segment on Sunday

Channel 9 had a segment about climate change on the Sunday show.

It featured Tim Flannery, author of "The Weather Makers", William Kininmonth, author of "Climate Change: A Natural Hazard", and Jennifer Marohasy from the Institute of Public Affairs.

I actually read "The Weather Makers" about two years ago on recommendation from an environmentally-inclined friend. As I didn't have a good grounding in the science, I was quite disappointed that it glossed over the theories and facts. Instead, it gave some examples of species going extinct, hypothesizing that it was caused by climate change. (Omitting any proof that such change was caused by humans.)

In this show, he stays true to form, and relies on a "consensus", rather than using any facts.

He says that his predictions are like predicting whether January is likely to be warmer than June. This is clearly absurd, as long-term temperature records show that earth's temperature has been rising and falling (e.g. ice ages, rising and falling sea levels), while we know that summer is predictably warmer than winter due to the earth's tilt exposing the respective hemispheres to the sun. He's predicting that January in ten years (or even fifty years) will be so many degrees hotter than this January, which is quite a different thing.

He also makes a ridiculous analogy about seeing a doctor who says he's 99% certain you have terminal cancer. The most well known advocate of man-made climate change is the Intergovernmental Panel on Climate Change. Their latest report says there is a 9 out of 10 certainty that humans are at least partly responsible for global warming. So it's really more like a doctor telling you there's a 90% chance you'll get cancer if you eat meat, without telling you what your chances are of getting cancer if you stop eating meat. And 90% isn't 99%. That's a blatant exaggeration.

Maybe there's some proof out there, but the fact that Tim Flannery gets so much promotion suggests there's some definite bias in the media, and that a little more debate could be a good thing.

Labels: , , , ,

Better Windows Keyboard Shortcuts

I've been using AutoHotkey for a while now. It's made my computer much easier to use.

You can use it to do several things, including:
  • Starting common programs without the mouse
  • Controlling your music and video programs
  • Making Mac shortcuts like Ctrl+Q work everywhere
  • Customizing application keyboard shortcuts


Installation


  1. Download and install AutoHotkey
  2. Create an empty file called shortcuts.ahk
  3. Create a shortcut to that file and put it in the Startup folder


You can then edit the script by right clicking on the green H icon in the corner of the screen and selecting Edit This Script, saving the file, then clicking Reload This Script.

Starting common programs


The Windows key is used for only a few things on a normal computer, such as Win+L to lock the screen. It's easy to add shortcuts for all your favorite programs, for example Win+F for Firefox, Win+I for iTunes, Win+N for Notepad, and so on.

Do this by adding a line like this

#i::Run C:\Program Files\iTunes\iTunes


to your shortcuts.ahk file.

The # means the Windows key (labeled with either a Windows symbol or the word Start), i means the I key, and C:\Program Files\iTunes\iTunes is the command to run when Windows and i are pressed together.

Another trick is to start a program in a maximized window, e.g.

#p::
Run C:\Program Files\PuTTY\PuTTY servername
WinWait, PuTTY
WinMaximize
return


Controlling your music and video programs


I use AutoHotkey to simulate the media buttons that some newer keyboards have, such as back, forward, pause, mute, and so on. I could buy a media keyboard, but I prefer a smaller keyboard that doesn't take up all my desk space.

You can either set it up to control the program in the foreground using something like:

#Left::Send {Media_Prev}
#Right::Send {Media_Next}


or tell it to control iTunes (even if the current window is Windows Media Player) using something like:

#Left::SendMessage, 0x319, 0, 0xC0000, , iTunes
#Right::SendMessage, 0x319, 0, 0xB0000, , iTunes


I also use these to control the volume everywhere:

#Up::Send {Volume_Up}
#Down::Send {Volume_Down}
#NumpadDot::Send {Volume_Mute}
#NumpadDel::Send {Volume_Mute}


Making Mac shortcuts like Ctrl+Q work everywhere


Since using Macs and Linux systems for a while, I find Ctrl+Q a more convenient shortcut to close the current program. A few Windows programs support this, but most of them use Alt+F4.

Adding this rule makes Ctrl+Q equivalent to Alt+F4.

^q::Send !{F4}


Customizing application keyboard shortcuts


I was trying out the Safari web browser, and it wasn't too bad, but the keyboard shortcut to change tabs is Ctrl+Shift+[. Firefox uses Ctrl+PageUp, which is more familiar and easier to press. Unfortunately, Safari doesn't let me change its keyboard shortcuts.

These rules check if the program is Safari then translate Ctrl+PageUp to Ctrl+Shift+[ and similarly for Ctrl+PageDown.

#ifWinActive ahk_class {1C03B488-D53B-4a81-97F8-754559640193}
^PgUp::Send ^+[
#ifWinActive ahk_class {1C03B488-D53B-4a81-97F8-754559640193}
^PgDn::Send ^+]


To find out the class id numbers, right click on the H icon, click on Spy, then click on the window you want to control.

Labels: , , ,

Bold Shell Command like the Rails Books

I've recently been reading some books about Ruby on Rails.

One little thing that I thought was cool was the example commands:

dave> cd work
work> rails demo
create
create app/controllers
create app/helpers
create app/models
: : :


I decided to try to make my shell look the same.

Putting the directory name in the prompt is easy. That can be achieved by setting PS1='$(basename "$PWD")> '

(if you use zsh, you may need to run setopt promptsubst first)

Making everything you type after the prompt bold is the tricky bit. You have to enable bold mode at the end of the prompt, but disable it as soon as the user has pressed Enter, so the command's output isn't bold too.

This can be achieved in zsh by adding %{$(tput bold)%} to the end of your PS1 line, e.g.

PS1='$(basename "$PWD")> %{$(tput bold)%}'


and adding a function called preexec that resets the font to normal.

preexec()
{
tput rmso
}


And to finish up, I like to handle things properly if tput and basename aren't available, so I test if tput is present using command -V tput and use POSIX-style ${parameter##word} to delete everything except the last part of the path.

So the stuff you need to add to ~/.zshrc now looks like this
setopt promptsubst

init_terminal()
{
if command -V tput >/dev/null 2>&1; then
bold="$(tput bold)"
underline="$(tput smul)"
normal="$(tput sgr0)"
fi
}

last_part_of_path()
{
local full_path="$1"
local last_part="${full_path##*/}"

if test -n "$last_part"; then
echo "$last_part"
else
echo "/"
fi
}

preexec()
{
print -n "$normal"
}

init_terminal

PS1='$(last_part_of_path "$PWD")> %{$bold%}'


And the end result looks like this



Unfortunately, you can't do this in bash because it doesn't have an equivalent to the preexec function, so everything including the command's output will be bold. (There is a patch to add something similar, but it causes bash to crash in some situations, so I think it's safer not to use it.)

Labels: , , ,