Monday, March 29. 2004
If you have macros in configure.in that aclocal can't find, it doesn't report an error, because it assumes that they are shell codes (I think). So when configure complains about text that is supposed to be an autoconf macro but isn't defined, you know you forgot to tell aclocal where to find the m4 file defining the macro. So: aclocal-1.7 -I /usr/share/aclocal/gnome2-macros
grrrr argh
Sunday, March 28. 2004
Tamara's not as excited as I about zombies. But, come on, zombies!
Friday, March 26. 2004
Some people involved in the original Mac have set up an interesting site chronicling the development of the machine. Check it out.
I just spent about 10 hours trying to find a bug in my FDTD code; it turned out a misplaced parenthesis in the expression that calculated memory offsets. That's got to be the costlyiest misplaced ) in my experience. But on the upside it did help me find some other, much more subtle bugs that would have been less obvious and could have affected the output without my knowing it. There still appears to be a bug, but I finally licked this one, so I'm going to bed. uggg.
Friday, March 19. 2004
I'm in the middle of writing a FDTD program that will eventually facilitate my my research, but I'm getting gleefully distracted with fun programming things right now. Chief among them is the idea of embedding Python in as the interperter. I know Python builds on Minerva, the computer I will eventually be running my simulations on, so I feel ok doing this.
I think embedding Python will allow alot more flexibility in the definition of a structure, and it will make it easy to test new algorithms and so on. It also makes it a lot easier to add a GUI. In any case, I think it's a really smashing idea, but I'm not going to tell me supervisor about it until I have it finished, because it's also a big, really interesting, waste of time.
In any case, I finally got a little sample to build and run by hand. I'm using Boost's Python library, since is seems the most mature and most activly developed of the ones I've looked at. In particular, it can convert C++ exceptions to Python exceptions, and allows for Python classes to be derived from classes written in C++. Boost stuff uses it's own build tool, bjam, which I don't really care to learn, and I've settled on autotools for this project anyway. So I've been trying to figure out what bjam does so I can do that in autoconf.
There's nothing like an example, so assuming you have Python and a compatible version of Boost-Python installed...
Input file, boosttest.cc:
#include
using namespace boost::python;
#include
using namespace std;
char const* greet()
{ return "hello, world"; }
BOOST_PYTHON_MODULE(boosttest)
{
def("greet", greet);
}
NOTE: I've discovered the that the module name, the item in the parentheses following BOOST_PYTHON_MODULE, has to match the name of the final .so file.
Commands to build it:
g++ -c -Wall -DBOOST_PYTHON_DYNAMIC_LIB -g -O0 -fno-inline \
-fPIC -I /usr/include/python2.3/ boosttest.cc objcopy --set-section-flags .debug_str=contents,debug boosttest.o g++ -g -fPIC -shared -o boosttest.so -L ~/lib -lboost_python \
-Wl,-rpath-link,. -Wl,-soname,boosttest.so boosttest.o
I'm not sure what the objcopy is all about, but oh well.
Output:
mhughe@tesla:~/testbay$ python
Python 2.3.3 (#2, Feb 24 2004, 09:29:20) [GCC 3.3.3 (Debian)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
>>> import boosttest
>>> dir(boosttest) ['_doc_', '_file_', '_name_', 'greet', 'square']
>>> boosttest.greet()'hello, world'
>>> boosttest.square() Traceback (most recent call last):
File "", line 1, in ? Boost.Python.ArgumentError: Python argument types in
boosttest.square() did not match C++ signature:
square(int)
>>> boosttest.square(2) 4
>>>
NIFTY. The goal of course is not to run the program from Python, but rather to embed Python in the program. It'll take a command line arg that will tell it what .py file to run, and execute it in the interperter.
It will be interesting to see if there is any significant speed or memory impact (consider a smallish problem might take 512 Mb and run for an hour or two...)
Sunday, March 7. 2004
I just finished reading (well, two days ago) Oryx and Crake by Margaret Atwood. It's a sort of cautionary tale of biotech gone wrong, about playing god, revenge, jealousy, personal pain in a complicated world, and so on. It's a really good book and there's lots to think about, the responsibility of an engineer for what they produce, for one thing. This was only the second Atwood book I've ever read, the first being A Handmaids Tale, which was for a undergrad English class. I'll probably read a few of her others now. I tried to read Orwell's 1984 after I read The Handmaids Tale, as they deal with similar themes, but I never quite got through it, or started on it really. Too much oppressive society all at once is bad. Atwood hasn't had the pop culture impact as Orwell, but I guess he had a few years on her.
We went to see a documentary film called The Corporation this evening. It was very interesting, and gave me lots of stuff to think about. It was basically about how the corporation gained status as a "person" in the eyes of the law, and what the effects of that has been. A major component was detailing how the corporation, as a person, has many of the same characteristics of a psychopath. It looks at what motivates corporations, what the consequences are, how people within a corporation behave, and asks questions about how much ethical responsibility various individuals within a corporation have. There are a number of case studies, from Goodyear (tires) to Interface (carpets), and the interviews with their CEO's are revealing. Ray Anderson, the CEO of Interface, was asked to give a speech to a task for that was being created in his company to look at Interface's environmental impact, so that they could formulate a response to customer queries. He didn't really care about it, but he looked around for inspiration, and found a book, or it landed on his desk, and read it. And it really opened his eyes to how his company relates to the environment, and he worked to create positive change at Interface, by increasing the use of recycled material and so on. Contrast this with a former Goodyear CEO who said that if he could, he would make change, but the CEO is really beholden to all these other people and it's difficult to make "morally or ethically correct" decisions. True to a certain extent, and what I found interesting was that corporations, as legal entities, are required by law to maximize shareholder profit. That makes it almost impossible to make decisions which have socially responsible results. There was also quite a bit from a former CEO of Royal Dutch / Shell. He entertained protesters on his lawn after they hung a "murder" sign on the roof of his surprisingly modest home out in the countryside. So he talked to them for a while, and basically found out that they are worried about basically the same things he is worried about, but that the difference was that they felt they couldn't do anything about it, while he felt he could. They also talk about how Bolivia turned to the World Bank for a loan to fix up it's water supply in its third largest city. The World Bank told them they had to privatize the water supply to get the loan, and the water works ended in the hands of Bechtel (I used to work for a company that was largely owned by Bechtel, Bantrel, and I see they still have the same ugly ass web page as they did six years ago). The water was being metered out, with people having to make the choice between water and food, or water and sending their kids to school, and it led to a bit of a revolution, which returned control of the water supply to the people. Then there was Monsanto, and the patenting of genes, and so on. Patents, especially on things like genes, always get my knickers in a twist. Anyway, I think it was a fairly well rounded documentary, there were people on both sides represented. The main theme of the film was the problems with the corporation, but I think it was a pretty fair look at it. It was well put together and cleverly done.
I finally got permanent links working in my blog, after much wondering and gnashing of teeth (whatever that means). Comments are also working now, finally, after many ages! Click on the permanent link for the entry, and then you can leave a comment. Now if only I can figure out why those internal server errors show up every so often....
|