In a word: You can't, so don't waste a bunch of time trying like I did.
Well, as a relative newbie I shouldn't definitively state that it can't be done, but such is my assessment based on a morning of internet research and trial and error.
As much as I would prefer being able to use a single Python interpreter on my machine, in the end the easiest way to get the Python Imaging Library (PIL) installed was to download the standalone Python 2.2 installer for windows from http://python.org/download/. This will create a separate installation of the Python interpreter from the one used by Cygwin that should enable you to install PIL without a hitch.
By default, the installer will put Python in C:Python22. Assuming you've already downloaded and run the PIL Windows installer for Python 2.2 from http://www.pythonware.com/products/pil/, all you need to do is move the file PIL.pth and the whole directory PIL from C:py22 to C:Python22Libsite-packages, and copy the files _imaging.pyd and _imagingtk.pyd from C:py22DLLs to C:Python22DLLs
With that done, you should be able to run the demo scripts in C:py22Samples with no trouble - just make sure you specify the correct Python interpreter! If you want to run PIL scripts from a Cygwin shell, you'll need to specify the full path to your other Python interpreter:
$/cygdrive/c/python22/python viewer.py /path/to/some/file.jpg
Thankfully, you can use ln to create a symbolic link in your Cygwin path so you're not forced to type that full path:
$ln -s C:/python22/python /usr/bin/python22
Now, in Cygwin, you can run python to use the Cygwin Python interpreter, or python22 to use the PIL-enabled Python interpreter.
Postscript: According to the post at http://sources.redhat.com/ml/cygwin/2002-05/msg00582.html it is possible to compile PIL from source under Cygwin, but it takes some doing.
I've been using PHP for so long that I haven't had much call to delve into the CGI-BIN directory in quite a while. Once I determined that my host has Python installed, I decided to see if I can run Python scripts from the CGI-BIN directory. It can be done, but right off the bat I ran into a problem whose cause wasn't immediately apparent.
I had a simple hello world script in the cgi-bin directory:
print "Content-Type: text/html\n\n"
print "Hello, world!"
Path to the interpreter correct, check. Permissions set to executable, check. Nevertheless, Apache kept returning an HTTP 500 error, and writing "Premature end of script headers" to the log.
Shame on me for editing the file over ange-ftp from a Windows installation of Emacs; the script was getting saved with the vexing MS-DOS style rn newlines, which was causing the error. Once I figured that out and stripped those damn ^M characters from the file in Emacs literal mode, I remember having the same problem back when I was using PERL.
With a little more digging I finally found out how to do what I've always suspected was possible, that is to configure Emacs to always create files in 'UNIX' mode even when running on Windows. Add this to your .emacs file:
(setq default-buffer-file-coding-system 'undecided-unix)
And, to fix the newline characters in an existing file, you can use
(Usually bound to C-x RET f.) Enter 'unix' at the prompt, and re-save the file.
(Many thanks to Stephen Leake for his post at http://mail.gnu.org/archive/html/help-emacs-windows/2002-12/msg00053.html)
It's that time of year again. I was moving forward by leaps and bounds on SnapSnap, and then I came down with a nasty cold/flu for the better part of a week. Too fuzzy headed to trust myself not to write sloppy code on the project, I instead returned to my JavaBook and split my time between reading, typing in code samples and excercises, and blowing my nose.
That weekend, I dug out my outdated copy of O'Reilly's Learning Python, and began re-reading that as well. It had been almost two years since I bought that book, and at the time I didn't make much progress. With the benefit of the additional PHP programming experience I've gained in the meantime, I found the book to be a weird combination of hand-holding and overexplanation; it's frustratingly slow paced and yet full of esoteric asides about memory optimization and the language's C underpinnings. I turned instead to the official Python Tutorial, and Mark Pilgrim's Dive Into Python, and began a new ProgrammingStuff section on Python.
People generally seem to be divided into two groups about Python... the ones who sneer at the whitespace-dependent syntax and the ones who become fanatically excited by its elegance after about 30 minutes of fooling with it. I fall squarely in the second camp.
The only problem is, there are probably even fewer Python jobs out there right now than PHP Jobs, so I really need to evaluate the amount of time I devote to tinkering with it.
There are quite a few Java jobs out there (as compared to PHP jobs), but I know I have a long, hard road ahead of me before I can hope to be hired as a Java programmer. I've learned enough to know that, at least for the types of projects I've been developing on my own time so far, it's not the language I would reach for first. I like it a lot better than what little C I have learned in the past, but strong typing isn't very conducive to rapid development, or writing code as easily readable as, say, Python.
While I understand and to a certain degree buy into the philosophy behind Java's strong typing, I think Guido Van Rossum's comments about strong vs. weak typing best sum up my own feelings on the matter.
So, SnapSnap has gotten lost in the shuffle for a couple of weeks. Actually, it's close to three weeks now. I've had an interesting e-mail exchange with a potential collaborator that is going to get me back on track with it, although it looks like it's going to result in some pretty serious changes (for the better) to the system's inner architecture.
And on top of everything remains the fact that I remain unemployed. I have been sending my resumes hither and yon across Massachusetts, and trying to decide what types of retail establishments I would be least miserable at if it comes to that.
Time to refocus on something, which is probably going to be SnapSnap.
I went into town to check the mail yesterday, and because the dog is a much more social animal than I'll ever be I took him along. He likes to walk around in the center in hopes that somebody will stop and make a big fuss over him.
Being a good citizen, I took it upon myself to clean up after my dog after he pooped prominently on the sidewalk. There aren't any "public" trashcans that I know of in the center of town, so we walked behind a building containing a couple of businesses and some apartments. There's a dumpster there, which seemed like a better place for canine excrement than out in front of the building. In the six years we've had the dog, I've deposited many a poo-bag into dumpsters behind businesses and even other apartment buildings, without incident.
Well, yesterday I guess my luck ran out. There was a man standing near the dumpster, talking to somebody in an idling car. As I deposited the bag into the dumpster, the man by the car broke off his conversation and said loudly, "That's for tenants, you know."
I looked up in surprise, and before I could formulate a reply he continued, "I pay to have that stuff removed!"
Taken aback as I always am by the petty assholery of other humans, I was still at a loss for words.
In his best I-know-full-well-you're-not-a-tenant-but-I'm-cleverly-making-a-point voice he asked me, "Are you a tenant?"
At times like this, when I am utterly enraged by such stupid confrontations or spectacularly bad customer service, my brain simply shuts down; my ability to form intelligent arguments (or even ad hominem arguments) leaves me completely. I often wish it didn't, but perhaps it's for the best; it's probably my brain's way of telling me it's not worth the mental energy.
So, I merely mumbled some stupid apology. Having put me in my place, the guy gave me a big fake grin and said, "Just so you know. And I like your dog, so I'll let it go this time."
"Let it go?" What, like he's going to call the cops if I do it again? Or send me a bill for the cost of hauling a bag of poop? I understand his point; to paraphrase the argument used to tell kids why they shouldn't throw rocks into ponds, if everybody threw dog poop into the lake, there wouldn't be a lake anymore, would there? But it's not like he caught me heaving a 30 gallon Hefty bag full of feces into his dumpster. It's not even like I drive up to the center of down and use that dumpster every time I walk the dog.
The witty rejoinder I should have used occurred to me, as it always does, about 30 seconds later:
Next time, I'll leave the dog crap on your sidewalk.
He struck me as the sort who would have gotten really belligerent if I had argued with him at all. What gets me is the fact that the guy would have been just as snotty if he had caught me leaving the dog poop on the sidewalk; no doubt he would have made some witty comment about my own toilet habits. So, once again my brain was probably right: Not worth the effort.
Last year, before the chain of events that made it possible for us to get back to New England, I had finally resigned myself to living in Los Angeles indefinitely. It was for that reason that I found myself watching hockey again, rooting for the Los Angeles Kings, partly because they were the only team whose games were regularly broadcast on our cable, and partly because it seemed like a way to make peace with my surroundings... although I never got the impression that L.A. is much of a hockey town.
Anyway, now that we're back in Bruins country I've been following the team on their journey down the porcelain receptacle after a great start last fall. Things were looking up about a week ago, and I was looking forward to watching the Bruins play the Kings tonight... and then I watched that stinker in Phoenix, for which Robbie Ftorek managed to get himself fired.
I missed last night's game against the Sharks, but from what I've read it wasn't much better. At this point it seems like the only reason it might be worth staying up for the Bruins-Kings game tonight would be to see the Kings in action again. Even then I wouldn't get to hear Bob Miller call the game... I'd have to settle for Dave Shea instead.
As anyone looking for a PHP programming job in the current economy knows, those jobs are few and far between. That's a problem if that happens to be the only language you know.
There are plenty of people, CTOs and CIOs included, who are quick to dismiss PHP (PHP's not a "Real" language) because
I should know about that last one, because that was me when I first got into PHP; it's really easy to begin peppering HTML pages with an echo statement here and a for loop there, and then maybe you decide to try hooking up with a MySQL database so you just stick the password right in the same file, and before you know if you've got a big kludgey mess. It works, but it's just as much of a pain to maintain as a static HTML page.
Getting a handle on PHP's OOP features was probably the single biggest milestone for me. Apart from leading to much neater, better organized code it also familiarized me with the style and terminology that many "Real" Object-Oriented languages use, to the point where Java has finally begun to make sense to me.
I'm also learning Python, which is a damn elegant language but for which there's even less advertised demand than PHP. The thing I find most encouraging is that I'm finding the learning curve for both Java and Python significantly shorter than I did as recently as two years ago... When I first started with PHP I was most concerned with the hows of piecing a script together, but I think I've since made the leap to understanding the whys of organizing code in certain ways. The whys are ultimately more important, because it makes it a lot easier to apply concepts from one language to another. It's sort of like learning one Romance language and suddenly realizing that the others are very similar in a lot of ways.
My friend Ryan has asked me several times since last summer when I'm going to start keeping a weblog again, and each time my response has been "Weeell, I'll probably wait until I have a job; I wouldn't want prospective employers to take exception with any particularly opinionated things I might write."
Well, as most anyone reading this probably knows, the fact of the matter is that nowadays there aren't really any prospective employers out there, so in the words of the esteemed Dr. Emmet Brown, I figured... what the hell!
Besides: if somebody is actually thinking of hiring me they may as well get a better glimpse into what makes me tick than an hour's worth of interview can provide.
I haven't done any writing of this sort since July 2002. I hardly know where to pick up the threads. My wife and I escaped from Los Angeles at the end of August 2002 and made our way to central Massachusetts, where we're staying with my parents.
No, we're not living in the basement.
I did have some contracting work after moving, but that slowly dried up, and so began the search for gainful employment in a truly crappy economy. In about three months of searching, composing cover letters, and faxing resumes I've had exactly one callback. Two interviews and almost two months later, somebody else got that job.
If I hadn't hated Los Angeles quite as much as I did, I would be inclined to second-guess the decision to leave a very stable job doing something I enjoy to drive cross-country and move back in with my folks with no real job prospects on the horizon.
Considering the exponential increase in quality of life, however, I think I'd still rather be temporarily broke and close to my family out in the sticks than employed and in southern California.
Get this: When my wife and I pulled into Flagstaff, Arizona after our first day's drive out of Los Angeles, we realized we could smell our bottled water. Most people would be inclined to make a remark about how clean the air is in Flagstaff, but that would be overlooking the obvious correlation of how filthy the air is in southern California.
Yes, it stays relatively warm there during the winter while we get snow and temperatures in the teens for several months. I'll even confess that now, in March, I'm looking forward to the end of winter and all the green and warm breezes that spring will bring.
Who wouldn't be?
I would rather have spring to look forward to than nothing, which is what I had to look forward to for those six years in Sherman Oaks. However, I can understand how difficult it is for native Los Angelenos to conceive of dealing with snow and below-freezing temperatures for a few months out of the year.
Having lived there as an outsider I will say that turnabout is fair play: Having grown up in woodsy, hilly New England it's difficult to conceive of dealing with cloudless skies and 80+ degree temperatures for most of the year, year after year. The monotony is enough to drive a person insane.
The thing about seasons is this: No matter what lousy things may be going on in your life, the seasons are something you can count on to bring change. I think the perpetual summer of southern California is largely responsible for the pervasive sense of detachment I felt there.