Archive for May, 2009

Catching up

May 17, 2009

An unexpected hiatus there for a bit, but I’ll see what I can do about catching up. So, what is the state of the world these days?

Well, there was a bit of flak about Carrie Prejan, the Miss California story. As you readers probably know, she stated that she thought marriage should be between a man and a woman, and hoped that wouldn’t cause offense. Then she got in trouble because of a little bit of breast exposure that happened previously. Big deal. Talk about misplaced priorities. She is in favor of restricting the rights of others, but gets in trouble for having slightly more of the human body exposed? She probably shouldn’t have got in trouble for her wrong headed bigoted views either. She simply said what she thought and I’m not in favor of having a thought police state. But folks, she is a senior at a small San Diego Christian community college who studied to be a special education teacher. What does any does any of it matter? She is not the person to go to for an in depth discussion about societal freedoms and contracts. I see a very small teapot with a tempest in it.

There’s the Obama thing at ASU. They withheld an honorary doctorate stating that “his body of work is yet to come”. That does contradict past honorees, but o.k. I admit, I’m not really a big fan of the whole honorary doctorate deal anyway. All I really wanted to say here is that all those at ASU who received a real doctorate also have their body of work yet to come. There’s also the speech at Notre Dame. Apparently some, but not all people, just can’t seem to look past the abortion issue. Look, you have a chance to see a historical sitting president live. Enjoy. I’m sure there are also several law professors at Notre Dame who recognize Roe v. Wade as established precedent. You are not going to agree with everyone on everything.

Let’s see, we also have the Pelosi tortue story. Unless there is a recording somewhere, we’ll probably never know exactly for sure what was said, although her story is consistent Graham’s. Although I am a registered Democrat, I’m not really a big fan of Pelosi. To me she seems somewhat dogmatic and doesn’t think too well on her feet. I probably would have voted for another Democrat if I lived in her district (or perhaps even a Republican if one seemed qualified that I liked). But let’s move on, can we? Some people are builders and some are destroyers. Instead of offering up constructive solutions, most Republicans these days seem to be bent on destructive take downs.

Advertisements

That science and religion thing again

May 3, 2009

In a recent study coming out, a conclusion is being made that most scientists do not abandon their faith. Professor Ecklund, Assistant Professor of Sociology at Rice University surveyed 300 scientists over 3 years and found:

Less than 5% of scientists have no faith at all. 35% claim to be “spiritual atheists” which they define as having a belief in something larger than themselves. This group has rather eclectic views, using a bit of Eastern religious thought integrated with scientific thought as foundation for that belief. 68% of scientists on the whole have some sort of compatibility in their beliefs with science and religion. 50% of them are committed to their religious faith.

This contrasts with previous surveys of the National Academy of Science members, where:

The authors report “near universal rejection” of the transcendent by NAS natural scientists. Overall, 93 percent of NAS scientists do not profess a belief in God (72.2 percent disbelief, 20.8 agnostic), and 92.1 percent do not profess a belief in immortality (76.7 percent disbelief, 23.3 percent agnostic). Disbelief in God and immortality among NAS biological scientists was 65.2 percent and 69.0 percent respectively, and among NAS physical scientists it was 79 percent and 76.3 percent respectively.

(from Nature).

It is not said what type of scientists Ecklund interviewed, but I do not that a lot of social scientists are religious. I suppose if one were going to churches to find scientists to interview, you would find some bias towards religious belief. I suspect her sampling was better than that though, but I would be surprised if she interviewed very many natural scientists.

In any case, from my point of view it doesn’t matter very much. I have known a few religious scientists who were quite good, even excellent, in the scientific area of expertise. Ken Miller, of Brown University, is a good example. But when it comes to religion, the rigor that they bring to scientific investigations, they check at the door. Compartmentalization. The beliefs go without the thorough examination that characterizes their professional lives. Perhaps it is the sense of community and tradition that they don’t feel the need to probe too deeply. If these beliefs are not being used to justify controlling others or harmful behaviors (as is too often the case with the religious minded), than it is not really a problem. As the article states, many of the scientists recognize the validity of evolution and maintaining high science standards. I presume they (of the Christian persuasion anyway) see the creation myth as metaphor or something. This begs the question of when does one stop unraveling biblical metaphors before the whole thing becomes undone?

But if religious scientists were to apply the same exacting standards to religious beliefs that they do to their professional work, what would they find? That if a God did or occasionally does intervene in the workings of the universe, the scientific tools they have for their work are perfectly capable of investigating such. Scientific method and secular reasoning totally dismantle (well, to 99% certainty anyway, if I were given to throwing out numbers) any such supernatural notion. What about a noninterventionist Deistic God? Not only do we have no reason to guess such a being exists, what use would it be?

Python for fun

May 1, 2009
Pining for the fjords

Pining for the fjords

A while back I had posted something about Paul Graham’s essay on good hacking environments. As an aside, one of the observations he made (with which I don’t necessarily agree) is that there will be a tendency to find better hackers coding Python than coding Java. I do more Java myself these days, but find I really like Python as well. So let’s talk about Python for a bit. This has become relevant for me because I want to get started on one of the coding projects that has been sitting on my queue at home. After pondering things for a while, I’ve decided to go Python (I already have several Java projects lined up). Python code is pretty, web friendly, object oriented (though you can write it like it isn’t if you really want), and has a lot of useful libraries.

The coolest thing about the language, of course, is that the creator, Guido van Rossum, named it after Monty Python, a little British comedy group that was responsible for finding things like the holy graile, the meaning of life, and starting a religion after a boy called Brian who grew up to be a man called Brian. One of the funky things about the language of Python is that all blocks must be indented. It is part of the syntax as it were. That took me some getting used to, but since pretty code should be nicely indented anyway, that’s not really that intrusive. There are editors that will assist with that, such as emacs (also xemacs), which will run under Windows as well. Python also has its own ide as well, called Eric, which coincidentally is also the name of one of the Monty Python members. Although Python is almost trivially on every Linux system (though you may need to select the software; I did for SuSE) you can have it Windows too.

One of the fun things about Python is its support for imaginary (complex) numbers (square root of -1, for well defined rules of multiplication). Stick a j on a number to make it imaginary. For example, in Python you can write a complex number such as a = 3.0 + j5.0 . Then establish that a.real is 3.0 and a.imag is 5.0. With that comes a lot of manipulations, etc. You can do the same thing in Java, but you would need to find a library for it, or write it yourself.

So what else does Python give you? One of the powerful web application servers out there is Zope, written in Python. I have not played with this yet, but am reasonably confident that if you are writing Python apps, you could easily leverage what Zope offers. You can do graphics using the TK (toolkit) interface arising out of TCL/TK by using TKInter, and I’ve recently found out about vpython, another library that allows you to do 3d graphics and animation. Apparently a lot of colleges are using this to have inexperienced (from a coding point of view) students write their own physics demos. I expect I’ll play with this a bit going forward.

What does code in Python look like? Here’s an example of some really simple throwaway code I did several years ago. This sends email to a specified address (maintained in a separate configuration file called mailconfig.py).

import smtplib, string, sys, time, mailconfig, os
mailserver = mailconfig.smtpservername

interestingStuff = sys.argv[1]

fd = os.popen('hostname')
myhostret = fd.readlines()[0].split('\n')

From = mailconfig.sender
To = mailconfig.recipient
Subj = 'Some Alert!'

date = time.ctime(time.time())
text = ('From: %s\nTo: %s\nDate: %s\nSubject: %s\n\n'
% (From, To, date, Subj))

text = text + "Something interesting happened on " + myhostret[0] + " for " + interestingStuff

text = text + "\n\n" + mailconfig.signature

print 'Connecting...'
server = smtplib.SMTP(mailserver)
failed = server.sendmail(From, To, text)
server.quit()

Of course, one can add to this and make it as complicated as one wants. The import at the beginning just specifies some libraries like the stmplib that the Python interpreter needs to do its work. Python can look even more simple. All you need to do is run the interpreter and type in equations to use it as a calculator (that’s what I often do for quick calculations…either that or Lisp).

So, go ahead, if you are not a software developer, try your hand at some simple Python code. I am of the opinion that everyone should know a little coding, just like everyone knows how to hammer a nail in a piece of wood. Not everybody is going to build fancy furniture and houses, but should be able to do a few simple things here and there. Python is a great language to get started playing around and pick up a few things. I promise it won’t kill your parrot.