English
If people reject religion, are they bound to reinvent it but poorly?
In The Guardian, author John Gray argues against atheism in the best way I have seen so far from that "camp". But there are still places in his text where I think he misses the point. Gray's main point is basically, that when people free themselves from religion they are bound to reinvent it, but poorly. He argues for that a lot of the world's more recent woes have sprung from ideologies that have called themselves scientific. He admits that they were in fact pseudo scientific, but seems to argue that humans in general can never hope in the long run to do anything else than pseudo science from science in a religion rejecting society.
First, his argument that rejection of religion can lead to dangerous pseudo scientific beliefs I think is well founded. The communist societies that declared themselves atheist indeed had lots of religious patterns, that they seem to have been too blind to see. So he has a point there.
Secondly he seems to believe that humans cannot hope to develop into science-trusting rational beings, but that religion is needed to fill the "hole in our souls". Here he is on shaky ground indeed. Science can be seen as two things: facts and the scientific process.
- When adhering to a religion it is very easy to discard facts that are not in tune with the religion. If the facts have been well tested (scientifically) they would do people a lot of good, since accurate information tends to lead both to a better life for that individual and a better behaviour against other people. This is true for all people, regardless of the potential size of their "hole in the soul" and indeed it does not matter that the facts came from science. The quality of information is of crucial value.
- The scientific process is important since pseudo science can be discarded quite easily with it, since pseudo science does not follow the scientific process. Knowledge of the scientific process is therefore an insurance against it.
There is however another problem with science that Gray barely touches upon, and where I think he could find fertile ground. Science and scientific facts are often narrow in scope. What you choose to study and what problems you are formulating will therefore have a large impact. Science does not have a built in ability to balance itself in that regard. We have seen this with big pharmaceuticals only publishing the results in favour of their drug. In this way we will not know the conditions that would show something else. For more honest scientific studies the scientists will be blind to some of the assumptions that set them into a certain direction of inquiry. For science as a whole, we do not know what implicit conditions we start with. Gray does cover one assumption he believes atheist are blind to that hey have: The underlying assumption that society is ever improving.
One interesting part of the text is where he notes that suicide bombers happened in communist movements before islamic ones. But I see commuism as religion so that is for me not all that strange. His tracking of where the rituals actually came from is nevertheless elucidating:
But Islamists owe as much, if not more, to the far left, and it would be more accurate to describe many of them as Islamo-Leninists. Islamist techniques of terror also have a pedigree in secular revolutionary movements. The executions of hostages in Iraq are copied in exact theatrical detail from European "revolutionary tribunals" in the 1970s, such as that staged by the Red Brigades when they murdered the former Italian prime minister Aldo Moro in 1978.
Läs mer: The atheist delusion | By genre | guardian.co.uk Books
How to enable "switch user" in Gnome on CentOS 5
At my work I have reasonably fast Linux workstation running CentOS 5. It also has a good 24" screen. I prefer not to switch it off between work sessions and sometimes one of the other guys would like to run their stuff on my machine.
Problem is I am logged in and the screen is locked with my password. My colleague is running Ubuntu and he has a nifty "switch user" option on the menu.
Now I have figured out how to get the same functionality in CentOS 5. You need to follow these steps.
Install the Gnome configuration editor. Start "Add/Remove Software" from the "Applications" menu
and search for "gconf".
Select gconf-editor and apply.
Then start gconf-editor from the command line:
gconf-editor&
Select "Find" from the "edit" menu:

Search for "user_switch" and rember to also search in keys:

find the key user_switch_enabled in the top right pane and tick its value:

Close the editor (there is no save button or command).
Now select Lock Screen" from the "System" menu.
The password box will now have a "Switch User" button! remember that the user you're switching to must also have his settings changed as above to get a "Switch User" button from his or her account.
Review of the Lenovo/IBM X60 ultralight laptop
Earlier this year I purchased a Lenovo/IBM Thinkpad X60. I resold it within a few days. And here is the reason why:
I had circled a particularly good offer at the local Mediamarkt on a Thinkpad X60 for a while. On paper it seemed like a really good deal, I liked the specs, especially the form factor and the low weight. The screen did not seem to be on par with the rest of the machine, but it was hard to tell in the ghastly (or should I say ghostlike) lihghting in the Mediamarkt stores.
Eventually I bought it, but two days later I returned it, or that is, I tried to return it, but Mediamarkt refused on the grounds that I had opened the packaging and started the Computer. If I had bought it at any other chain here in Stockholm I think I could have returned it. Instead I sold it at a 20% discount on the Internet, which worked like a charm.
I really wanted to keep it, but the fact was that the screen was just of a too poor quality. Perusing the net even more after I bought it I found that the maximum screen brightness was just around 115 candela per square meter, but the real disappointment was the contrast ratio was measured to a measly 156:1. Compare that to the 500:1 you saw on LCD monitors some years ago and the 1000+:1 you see today and it is clear that this component is sub par, especially for me who is used to Sony screens. Even my stop gap laptop, the cheapest Toshiba (~$600) I could find back in March , has a far superior screen.
If you are in the market for one of the X Thinkpads, do take time to check out the screen for a prolonged period before you decide to buy. Hopefully the X series will get a screen upgrade soon, and on some models it seems to be there: A review of the X61T tablet PC at notebookcheck.net shows the brightness of that screen to be almost exactly the same as for the X60, but the contrast is about 400:1, making it immensly better.
The other gripe I had with the X60 was the mysteriously long time it took to wake up and fall asleep, but this can probably be blamed on Vista. Lenovo will supply a downgrade CD for a fee.
Update 01:24
To compare the screen of the X60 with the Sony TZ series check out this review of the TZ:
| Model | Brightness: | Contrast |
| X60 | 155 | 156:1 |
| Sony TZ11XN | 308 | 576:1 |
Stockholm should be on The Indepedent's World cities list
...at least if Copenhagen is there, and it is. Now I may sound like a whining Swede, and, ehrm, yes that is true. Come to think of it maybe I prefer Copenhagen before Stockholm...
Such thoughts aside, there is of course a long rivalry between these two Nordic cities, being roughly equal in population, and easily the largest cities in the region.
The Independent has made a reasonably thorough ranking of World Cities, but they left out Stockholm. However since the Independent kindly explained all their criteria it is easy to fill Stockholm in.
The ranking table in Excel format may be downloaded here. I inserted Stockholm below Copenhagen for a comparison:
The Independent has a list of criteria and how to normalise them.
Population: Copied Copenhagens figure
Flights per week. Found passengers per year and factored in (through introspection) the flights from Skavsta (Ryanair) and Bromma (City Airport). Then entered same number as for CPH.
Market Capitalization World Exchanges Annual report (pdf),
Time out - Don't have access to the source. Put in a question mark.
3M stars Don't have access to the source. Put in a question mark.
Capitals 2 points.
Forbes - Zero.
SOs i think there's two?
Olympics- Stockholm 1912
Antal google-träffar - 95 millions, twice that of Copenhagen
Metro - Source Wikipedia, multiplied by percentage of stations underground.
Guides - Don't have access to the source. Put in a question mark.
48 hrs - Don't have access to the source. Put in a question mark.
Unesco - Included Birka, Skogskyrkogården and Drottningholm
Maybe Birka and Drottningholm are too far out. Source.
As long as Stockholm scores at least 4 points in the categories wher i put in question marks, Stockholm will be ahead.
How to split a string on whitespace when there is quoted stuff in it
When you are dealing with strings like e.g. the log lines from an apache or other web server log, it is common to find stuff that is inside quotes.
Let's say you want to split that line into its items, e.g. referrer, user agent and other stuff. Since some of that stuff is inside quotes, splitting on whitespace won't work. The trick is to first split on the quotes!
In that way you get an array/list where every odd element is guaranteed to be outside of any quotes, and any even element guaranteed to be inside a pair of quotes. Just iterate through the list: When you are at an odd item, split it on whitespace and store it, when you're on an even item store it away as it is, it's quoted.
How to embed a PloneFormGen form into a page in Plone
This describes how to embed a Ploneformgen form into another page. It was was done on Plone 2.5 with PloneFormGen 1.1.3, so these tricks may not work for other versions. If there is a simpler way of doing this, please enlighten me.
- The first scenario is this: to embed a Ploneformgen form directly into a page template
- The second scenario is: I have created a content type that is folderish, that simply collects all objects inside and renders them. One of these objects inside is a form folder. I wanted this to be rendered and shown inside my content type's page template.
The solution is the same to both problems.
The first problem was to make it render some HTML to be included in my page.
If you just want to embed the form directly into a template, this code is enough, you do it in one step:
<div tal:content="structure python: context.main_form_for_sending_mail.ww_pfgwrapper()"/>
The Ploneformgen object used above has the id "main_form_for_sending_mail".
Below is a simplified piece of code from the folderish content type. It simply collects all Form folders it can find inside of itself and renders them by calling a template on each of them
def itemContents(self):My folderish content type has a page template that calls itemContents:
items = self.contentValues(['FormFolder',])
output = []
for item in items:
output.append(item.ww_pfgwrapper())
return output
<div tal:repeat="item python:here.itemContents()">
<span tal:content="structure item"/>
</div>
So what is that ww_pfgwrapper thing there in the python code? It is a page template that renders the form folder object for inclusion. There is already a page template coming with PloneFormgen that renders the form. It is called fg_base_view. It renders the whole web page with plone headers and footers, and that is not suitable inside a page. There is a macro in fg_base_view, but unfortunately for some reason this macro is defined as the whole template contents, and would still give the whole plone layout.
The solution turned out to be to make a copy of fg_base_view and call it something else, in this case ww_pfgwrapper.
ww_pfgwrapper is the same as fg_base_view with five major changes (the contents of the ww_pfgwrapper template is posted at the end of this article):
- It does not call the main macro
- It defines a portal variable (that got undefined by not calling main macro)
- It has none of the fill-slot stuff
- It has tal:omit-tag="" for the html and body tags
- It redefines the name of the edit_macro that is going to be used
Let's go through the reasons for these changes:
It does not call the main macro
Obvious. If that was called we'd get the plone layout once again embedded in the middle of a document.
It has none of the fill-slot stuff
The fill-slot attribute is also deleted, and all the stuff outside of the body element (save the html tag and the defines).
It defines a portal variable
Once the main macro is deleted there is no definition left for the portal variable. One needs to be put in:
portal python:here.portal_url.getPortalObject();
It redefines the name of the edit_macro that is going to be used
The macro responsible for setting the action attribute of the form, will set this attribute to the url + the name of the template. This does not work, even if we make ww_pfgwrapper into a .cpt file with an accompanying .metadata file, just like fg_base_view. Go figure.
Instead we want the form to call the url + "/fg_base_view", because then it works. The template object responsible for defining the action attribute is called fg_edit_macros. That is the culprit that tacks on the template name last to the action attribute of the form. Make a copy of fg_edit_macros, call it ww_fg_edit_macros, and make a change in the ww_pfg_wrapper template near the top to use that template instead:
base_macros here/fg_edit_macros/macros;
is changed to:
base_macros here/ww_fg_edit_macros/macros;We then make one small change in the new ww_fg_edit_macros template
tal:attributes="action python:getattr(here,'formActionOverride','') or here.absolute_url()+'/'+template.id"
is changed to:
tal:attributes="action python:getattr(here,'formActionOverride','') or here.absolute_url()+'/'+'fg_base_view'
That is, hard code "fg_base_view" in there, at the end.
After these changes the template ww_pfg_wrapper looks like this:
And now it works. The form folder can reside inside your folderish object, but it can also be at e.g. the Plone root, and be called by acquisition:
<tal:block
define="errors options/state/getErrors | nothing;
Iterator python:modules['Products.Archetypes'].IndexIterator;
schematas nothing;
fieldsets python:['default'];
default_fieldset string:default;
fieldset default_fieldset;
fields python:here.fgFields(request);
portal_type python:here.getPortalTypeName().lower().replace(' ', '_');
type_name here/getPortalTypeName|here/archetype_name;
base_macros here/ww_fg_edit_macros/macros;
edit_template python:'%s_edit' % portal_type;
edit_macros python:path('here/%s/macros | nothing' % edit_template);
header_macro edit_macros/header | header_macro | base_macros/header;
typedescription_macro edit_macros/typedescription | typedescription_macro | base_macros/typedescription;
body_macro edit_macros/body | body_macro | base_macros/body;
footer_macro edit_macros/footer | footer_macro | base_macros/footer;
lockable python:hasattr(here, 'wl_isLocked');
isLocked python:lockable and here.wl_isLocked();
tabindex tabindex|python:Iterator(pos=7000);
css python:here.getUniqueWidgetAttr(fields, 'helper_css');
js python:here.getUniqueWidgetAttr(fields, 'helper_js');
portal python:here.portal_url.getPortalObject();
">
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en"
lang="en"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
i18n:domain="plone" tal:omit-tag="">
<body tal:omit-tag="">
<br/>
<br/>
<b tal:content="here/Title" class="documentFirstHeading">
Title or id
</b>:
<p tal:replace="structure here/getFormPrologue | nothing" />
<metal:use_body use-macro="body_macro" />
<metal:use_footer use-macro="footer_macro" />
<p tal:replace="structure here/getFormEpilogue | nothing" />
</body>
</html>
</tal:block>
output.append(self.main_form_for_sending_mail.ww_pfgwrapper())
In this way, one can have one central form to embed in all, or some pages. And with acquisition it is of course possible to have different form for different parts of the site by placing Form folders by the same name (id) in different places.
What to do when your external monitor pans around what should be its native resolution (ATI)
On my Toshiba Laptop, I had a weird problem this morning. My usual external monitor, a very bright Sony 1280 x 1024 LCD, did display at 1024 x 768 or so, but allowed me to pan around to see the entire 1280 x 1024 desktop. How to get it right? I apparently have an ATI Radeon Xpress 200M card in it. I tried to change the resolution, but all in vain, the display settings already reported the 1280 x 1024 resolution.
The trick turned out to be to right click on the desktop, select Properties->Settings->Advanced, and go to this tab:

Uncheck the "Preserve wide aspect ratio.." box (which was checked) and then click "Apply" You need to click "Apply" or you cannot make any changes to the monitor at the left.
Once you'ce clicked apply you can click at the "Monitor" text.

In the dialog that pops up, adjust the maximum resolution to in my case 1280 x 1024. It seems this setting applies to what you might call the physical size of your display, while the standard resoltion controls applies to a virtual size. As I am doing screen captures now, I notice that the settings is now 2560 x 1024 !

I did not set that, go figure... Anyways, tweaking the settings here got my display finally back to normal.
How to get Bluetooth to work with Billionton Class1 USB and a BT headset on Win XP
Summary
To get a Billionton Bluetooth Class 1 USB dongle (probably this one) with the Broadcom BCM2035 chip, to work on Windows XP, download the 1.2 driver from here, and install it on your computer
--
Yesterday I bought a cheap, really cheap (~$27 + VAT) headset for Bluetooth, a Hama BTH-150, and decided to hook it up to my Windows XP laptop so I can use the headset with Skype. This turned out to be a bit more difficult than I thought.
About a year ago I bought a USB Bluetooth dongle from Billionton. It is a class 1 device, which as far as I can tell gives it a longer reach than personal Bluetooth equipment. I do not know if it helped with the headset I was going to use though. Maybe they both need to be class1 devices. However in the end I got very good range.
A couple of years ago I tried connecting a Jabra BT headset to my computer, and I could not walk around my entire apartment without losing connection. I hoped this time around that would not be a problem.
Back then I also had problems getting Bluetooth to work at all with the Jabra device. I found a web page that said that Microsofts Bluetooth stuff does not work and that you have to install some third party stuff to get connectivity. That turned out to be correct. I got it to work, but gave up on using it due to the limited range I could move in.
This time around I thought the Bluetooth incompatibilities would surely have been ironed out by Microsoft. That turned out to not not be the case. Pairing worked out fine, but there were no profiles presented (I needed the headset profile) so it was meaningless.
Incidentally, if you have a BTH-150, you may be confused by the instructions for how to set it in pairing mode. It says in the manual that you should keep the s1 button depressed for a couple of seconds to put it into pairing mode. These are virtually the same instructions as for how to switch it off, keep s1 depressed for a couple of seconds. The trick is to realize that they mean that you should start with headset switched off to get into pairing mode.
The Billionton site sucks. they do not have a support or downloads section. Still the stuff is there, if you resort to a bit of googling. I found two dongles that looked like mine, that were class 1 devices. I'll be damned if I could make out the difference between them but then I realised they had the same chipset, and that is often what matters. At another part of their site that I found through Google, I then found a list of drivers with different version numbers. It is not clear what these numbers mean. They seem to be ordered along the release dates, but they seem to serve different chipsets. It meant I should use the 1.2 version. I found the 1.2 driver from here and downloaded it. It took a while with the download being 65 MB and the speed about 9KB/s. The FTP server asks for a password, but anything seems to be fine.
The install was painless, I re-paired the headset and computer and it got the headset profile and it worked fine in Skype.
The initial tests seem to indicate that the bluetooth headset has a high noise level. I will need to do some more tests, but I bought this el cheapo device so that I can find out more about what I really want to to get out of a Bluetooth headset.
The range is excellent. I can walk around my apartment and get good reception everywhere.
Simulated universe theory: Wrong or meaningless?
1) We have no idea if computers can ever be as powerful as to do this simulation. In effect, we already today have big problems getting complex systems to work. Mac OS X was preceded by botched attempts by Apple to create a new operating system from scratch. Windows NT (and its descendants 2000 and XP and Vista) was created by hiring Dave Cutler et consortes who made Vax/VMS. Just extrapolating the curves may well be naïve.
2) If we indeed are simulated, than why specifically by a computer? We know that our current computer systems have problems "evolving" into more meaningful complexity. Why not by something completely different? If we agree that there are different kinds of simulations than by a computer, maybe there are more of these other kinds of simulations? Maybe they vastly outnumber computer simulations? In that case we can just state "We live in something that is guided by something", which is getting close to standard physics. Maybe there aren't turtles all the way down?
Disclaimer: I'm a layman.
Europython 2007
I especially appreciated Arlo Belshee's talks and workshops on pair programming and other development techniques.
Joachim and Tess at the "All drinks on Google" night
The conference facilities at Hotel Reval were excellent.

A mix of Irish, English, German, Swedish and Polish pythonistas on a night out along the Gedimino pedestrian street. And Tess is not (that) drunk, she just made a face at the moment the picture was taken, methinks. Lennart and Magda in fondo.
More pictures from others: