Older blog entries for MichaelCrawford (starting at number 220)

Ask Advogato: PHP and MySQL?

I want to write a small web application for use on one of my websites. I'm happy to Read The Fine Manual, but I ask your advice on which parts are most pertinent to my problem. The reason I don't want to just figure it all out for myself is that there is a dauntingly large quantity of documentation available online, so I don't quite know where to begin.

If you don't want to respond here, you can either email me at (Harvest This, Spammers!) michael@geometricvisions.com or post in my Kuro5hin diary, where the topic has its own individual page.

While I have done some web application programming before, it's been a long time, and it was all done in Java with Enhydra. Enhydra's a great application server, but it's vastly more powerful than my simple needs require. Also my web hosting service actively supports PHP and MySQL, so I wont need to ask the hostmaster to install anything.

It's been so long since I've done any SQL that I've completely forgotten it, and I've never designed the schema (the layout of tables and fields) of an SQL database before.

There is also the issue of security, a topic which has evolved vastly since my last web programming job back in '99.

I did work through the simple PHP tutorial at php.net, and feel that it would probably work just fine for what I want to do.

I think my database would only require a single table with a dozen or so fields.

I'd like to have a web page with a form on it. One of the form fields would accept the user's email address. When the form is submitted, it would be added as a new record to the table, with each form field being placed into its own field in the record. There would be some additional fields as well.

There would be an integer field whose value would indicate whether the record was new, had been downloaded, or was old. Newly-added records would be set to new.

Periodically I would log into a password-protected web page and download a text file containing all the new records. The text file would be formatted as either tab-delimited, CSV (comma separated values) or maybe XML. There would need to be some way to prevent user-entered data from screwing up this file, for example if a user entered a comma in one of the form fields.

Once the download has succeeded, the included records would be marked as downloaded. I think it would be best if I were to manually order this, rather than having it done automatically when the download completes.

Again on a password-protected page, I would be presented with an HTML table of the downloaded records, and I could manually mark them as old. I would want a way to either mark them all at once, or individually. Gmail has something like this, where one can check individual emails, or check all the emails displayed on the page.

When this happens, the email address from each record would be used to send the user a confirmation email; this would require my PHP script to either talk SMTP directly, or maybe pipe some text into /usr/bin/mail.

Note that this would not be used for spamming my users; the page containing the form would inform them that the confirmation mail was going to be sent, and that would be the only mail I'd ever send in an automated way.

If you think there's a better way to do this than PHP and MySQL, I'm completely open to it, however, I'm very loyal to my hosting service (I've been with them for ten years), and I hate to bug the hostmaster to go out of his way for anything.

Thanks for any help you can give me -- michael@geometricvisions.com

Fix for libao dlsym_auto_underscore on Mac OS X

libao is a cross-platform audio output library used by, among others, ogg123. When libao-0.8.8 is built on Mac OS X, trying to run ogg123 meets with this complaint:

dyld: lazy symbol binding failed: Symbol not found:
  Referenced from: /usr/local/lib/libao.2.dylib
  Expected in: flat namespace

I'm not sure, but I think the dlsym_auto_underscore was required in previous versions of Mac OS X, but for me on 10.4.9 it worked to simply remove it from the darwin CFLAGS setting in the configure script:

From this:

                PLUGIN_LDFLAGS="-module -avoid-version"
                DEBUG="-g -Wall -D__NO_MATH_INLINES
-fsigned-char -Ddlsym=dlsym_auto_underscore"
                CFLAGS="-D__NO_MATH_INLINES -fsigned-char
                PROFILE="-g -pg -D__NO_MATH_INLINES
-fsigned-char -Ddlsym=dlsym_auto_underscore" ;;

To this:

                PLUGIN_LDFLAGS="-module -avoid-version"
                DEBUG="-g -Wall -D__NO_MATH_INLINES
                CFLAGS="-D__NO_MATH_INLINES -fsigned-char"
                PROFILE="-g -pg -D__NO_MATH_INLINES
-fsigned-char" ;;
Ask Advogato: Understanding BitTorrent Log Files?

I have a BitTorrent tracker for Creative Commons-licensed music. My HTTP logs tell me that about fourteen .torrent files are downloaded each day, but trackerlyze tells me that about 750 payload files are downloaded each day. This is supported by the enormous size of my log files.

But when I download my own torrents, I rarely see any other peers. The only seed is the one I operate.

I suspect my tracker is getting hijacked to serve for other files, but I am using the --allowed_dir command-line parameter to limit the .torrents to my own. Could it be broken?

Thanks for any advice you can give me -- michael@geometricvisions.com


I just wrote a piece about recent events in Pakistan: the President has un-seated the Chief Justice of the Supreme Court:

It has a Creative Commons license.

21 Feb 2007 (updated 21 Feb 2007 at 11:33 UTC) »

Do you play piano? Or enjoy using a MIDI sequencer such as Rosegarden to remix music?

I have written the scores to my songs "Emergence" and "Recursion" in Lilypond. I composed them long ago, but only in my own mind - I never wrote them down before now. I had tried some other music scoring software, but was never satisfied with it.

You can find the scores on my music download page. There are MIDI files, US Letter and A4 PDFs, and of course the Lilypond source files, as well as audio recordings of them.

They each have the Creative Commons Attribution-ShareAlike 2.5 license. I encourage you to copy, perform and record them, and especially to use them to inspire your own music - provided you share alike, as is required by the license.

I have two other pieces still to score. It's going to take a while for me to get them done. I also plan to compose four or five new pieces, and once I do, I'll make new recordings and get a "glass master" CD made - that is, have my CD pressed in quantity at a factory.

If you make a remix of any of my songs, post them on the web and email me the link at michael@geometricvisions.com and I'll link you.


I'll be playing piano at an Open Mic at The Maplewood Pub in North Vancouver, BC tonight. More info can be found on my live performance schedule.

I just started piano lessons with a wonderful teacher named Angela Bonilla. She has a Master's degree from the conservatory at Versailles, France.

Yesterday evening she started teaching me Beethoven's Moonlight Sonata. I downloaded the score from The Mutopia Project, which transcribes scores from books whose copyright has expired. All their scores are either public domain or have Creative Commons licenses.

What that means is that I will be able to offer a free download of the piece once I learn it well enough to record. You see, one cannot offer free downloads of even very old music if one got the score from a book that is still under copyright.

I plan to contribute to The Mutopia Project when I get better at using the Lilypond music engraving program.

17 Jan 2007 (updated 17 Jan 2007 at 11:58 UTC) »

In my previous diary I invited residents of Vancouver BC to meet for coffee or beer. Having finally decided to invest in more ink ($$$) for my CD label printer, I can offer an incentive: a free copy of my CD Geometric Visions.

The music has a Creative Commons license. Under the CC logo, it says "Please Burn Copies For Your Friends".

Email me at newcomer@vancouverdiaries.com to arrange a meeting. I work in Gastown and live near the Joyce SkyTrain station.

The manager at the cafe where I used to play the open mic back east had me convinced to start selling the CD instead of giving them away anymore. But I've decided I'm better off giving it away for free. My objective is to get more people listening to my music, and not yet to earn a living from it. I make good money as a programmer.

Work, Writing, Music

Been a while since I posted. Quite a lot has happened. I had been searching for a perm job for a while because I wanted to get out of software consulting - it is a hard way to live. I recently moved from Nova Scotia to Vancouver, British Columbia to take a job with a wonderful company. But the catch is that my wife is remaining behind until she graduates from art school.

It's been quite an experience. I've been writing about it in The Vancouver Diaries. My new blog is all hand-coded static HTML pages - not a web application - but with the help of CPAN's XML::RSS::FromHTML, a couple days ago I was able to add an RSS feed for it. Behold:

Feed Icon

If you live in Vancouver, drop me a line at newcomer@vancouverdiaries.com and lets meet for coffee or a beer. Or soon, you'll be able to come hear me play the keyboard at the various open mics around town. Keep on eye on my live performance schedule to find out when I'm playing.

What Is This Management Book Called? Who Wrote It?

I've been self-employed as a consultant for years, but wish to give it up for a salaryman job. Because I have nearly twenty years of experience, I was recently offered a position as a Team Lead - also known as a Technical Lead - and have been applying for software management jobs as well.

Team Leadership is halfway between being a software engineer and a manager; one provides technical leadership to a team of software engineers, for example putting better development methodologies in place as well as mentoring the engineers to help them improve their skills and advance in their careers. Someone else, who may not be an engineer at all, provides the personnel and financial management.

But I don't have much experience as a manager. I think my best bet is to purchase and read some good management books. I want to read one particular book very first thing, but I cannot recall its title or author. Perhaps you can help:

The book is specifically aimed at software engineers who just got promoted to management positions - folks just like what I expect to be. Thus the language is couched in terms familiar to any software engineer, but it points out what one needs to do differently as a manager than what one did as a software engineer.

It introduces all the kinds of skills a new manager will need to perform their work. I didn't spend much time skimming the book when I found it in a store a while back, but I expect it would including project management, hiring, discipline, performance reviews and (God help me!) firing incompetent engineers, budgeting and so on.

I'm going to visit the bookstore where I originally found this tomorrow, so I might find it by browsing the shelves, but if not I want to order it online. I can't do that if I don't know the title and author.

If you know what the book is called, either post your response in your diary or email me at hotcoder@gmail.com I will be eternally in your debt.

I did search for it at the ACCU Book Reviews page, but couldn't find it. I don't know whether it hasn't been reviewed or if it's review just doesn't describe it as a management introduction for ex-software engineers.

In any case, I welcome your recommendations for other introductory management books. Entering "managing" or "management" in the book review search form turned up many excellent books which I will read eventually, but which books should I read first? Try the searches yourself:

You can assume I know how to architect software, but I'm not so clueful as to how to lead others to carry out my architectural plans.

I am grateful for any help you can give me.

Looking For A Senior Software Engineer Or Technical Lead?

Then there's not much time to waste, as I have already been offered a position! But I may not actually take it. Please have a look at:

Thank you for your consideration.

17 Aug 2006 (updated 18 Aug 2006 at 01:44 UTC) »

Now featured on the front page at Kuro5hin is my new essay:

If you or anyone you know is affected by this mental illness or by schizoaffective disorder - which I have - then I encourage you to print some hardcopies of this article to pass around.

I've been passing out hardcopies to the staff and members at the local chapter of the Canadian Mental Health Association, and it's just been lighting up the place.

There's a follow-up discussion at the above link, but a more printer-friendly version is the copy at my own website, which has simpler markup and a print-specific CSS stylesheet that enables really nice hardcopies.

There are a couple nits that still need to be corrected in the kuro5hin version, but the one at my website has the Creative Commons Attribution-NoDerivs 2.5 license. Once I'm able to get K5's editors to make the corrections for me K5's version will be CC-licensed too.

Membership at Kuro5hin is free, and it's become a great community to be part of once again now that they've clamped down on the trolls.

211 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!