Monthly Archive for January, 2010

Socket Object Class unit for Free Pascal 2.2 (and similar implementations)

I believe in sharing code. When I have something that’s up to snuff, and I think can help other programmers, I believe in spreading it around. That’s what the programming community is all about (or, at least, should be).

Back in 1998, I wrote a small package of routines for programming for the internet under Virtual Pascal for OS/2. Over the years the library grew, I moved to Windows, and I moved from the now-discontinued VP to Free Pascal (as did most other Pascal programmers). The library kept evolving over time.

Recently, while working on my still-in-progress “Scooter” podcatcher (which hopefully I will finish one of these days), I adapted the library to the “class” model for objects as defined by Delphi and adopted by FPC. With nothing better to do the past few days I went in, polished up the code a bit, finally wrote some documentation (in the form of HTML help as used by FPC), and have decided to put it out there.

Briefly, what this unit does is create an object class called TSocketObj, which allows you to create and use socket connections over TCP/IP in programs created by Free Pascal. This encapsulates and greatly simplifies the techniques normally used in Winsock programming. There’s also an implementation of TStream called TSocketStream, which lets you use Internet connections the same way you would use memory or file streams, and a descendant of TSocketObj specifically for retrieving files from web servers using HTTP GET calls. Until you try it, you won’t believe how easy it can be for your program to grab a file off a webserver.

The code may be freely redistributed as long as my notice remains in the source code. Programs compiled with this code may be redistributed as long as credit is given.

If you’ve come up with an improvement or new version of this unit, please let me know.

If you want to, you can grab it here: SocketClasses for Free Pascal

“The Left have nowhere else to go.”

The mantra of the right-leaning, pro-corporate wing of the Democratic Party who are currently in control has always been that liberals and progressives will toe the line and vote for “moderate” and conservative Democrats because “they have nowhere else to go.” I think that yesterday’s special Senate race proved otherwise.

The Left went shopping.
The Left went out to dinner.
The Left went to the movies.
The Left went home.
In fact, the Left went everywhere except the polls.

Maybe someone will actually get the message, although I doubt it. The liberals and progressives are tired of having to choose between the evil of two lessers, like happened in Massachusetts. They’re done giving moderate and conservative Democrats a free pass because the Powers that Be say that they have nowhere else to go. Being offered a choice for the Last Liberal’s dearly departed seat between a Republican and an unexciting Democrat talking pretty much like a Republican, they chose to sit out the fight.

The Republicans, on the other hand, were fired up and excited and turned out in record numbers for their side. If the Democrats had given their base a candidate they can get excited about, then they would have turned out in similar numbers, too. They didn’t, so the base didn’t.

So the next time someone makes the argument that the Left have nowhere else to go, tell that to Senator Martha Coakley.

Contest for YA and MG writers

I doubt I’ll be entering this one since the agency in question has rejected both my YA novels (Go To Hell and Squire) already, but I wanted to bring it to everyone else’s attention.

May Kole, an agent at Andrea Brown Literary and blogger at Kidlit.com is having a contest for the beginnings of a YA or MG novel:

Since the query contest worked out so well in October, I’m going to do another contest at the beginning of 2010… novel beginnings! That’s right, the beginning (up to 500 words) of your YA or MG novel!

 

It’s too messy to have people post their entries in comments, so please don’t leave an entry there. Only use the comments to ask questions. This time, I’m going to let you enter by e-mail only, to mary at kidlit dot com, with the subject line “Kidlit Contest.” Copy and paste your novel text… do not send attachments. Your entry has to be for a children’s novel (YA or MG, sorry, no picture books this time around), it has to be for a manuscript that is FINISHED and could be sent out to an agent, and it must be under 500 words.

The prize is unremarkable as far as these sorts of contests go, but a valuable one: winners get a critique, anywhere from 1-15 pages depending upon your placement among the winners.

 

The full details can be found here at Mary’s blog.

On the naming of the year.

I seemed to annoy a lot of people over the last nine years. True, my being an asshole had a lot to do with it, but one particular quirk of mine seemed to piss some people off.

It’s how I pronounced the year. Most people I knew were saying “two thousand three” (for example) while I was saying “twenty-oh three.”

It made sense to me. If the previous century had yielded “nineteen-” dates, why not “twenty-” for years beginning in “20″? True, I didn’t go so far as to call two thousand “twenty hundred,” but still….

Now I’m starting to hear people referring to the new year, lo and behold, as “twenty ten.” Rather than let my usual arrogance get the better of me and claim that I finally brought the rest of the world around to my (correct) way of thinking, I’ll confess that there is a more logical reason why I’m starting to hear people say “twenty ten” instead of “two thousand ten.”

People are lazy.

Think about it. Ours is a language where speakers will go out of their way to drop syllables whenever they can. We created the contraction, for example. (Yes, other languages do similar things, but English still created it no matter what you say, or what the facts may say. I love my bloody language, I do.) So our tongues will go the easiest route whenever possible.

“Two thousand nine” is four syllables. So is “twenty oh nine.” Given a choice between two phrases that have the same number of syllables, it then becomes a matter of how difficult each is to say.

“Two thousand nine” is almost all giding consonants, with only the “t” at the beginning and an often half-spoken “d” a plosive. “Twenty Oh Nine” has two or three plosive consonants depending on how much you emphasize either the W or second T. Gliders are easier to say than plosives, so lazy tongues went with the name of least resistence and said “Two thousan’ nine.”

“Two thousand ten” is four syllables. “Twenty ten” is three. So even with the more difficult plosives (if you bother to enunciate them) the latter is easier to say. Especially for those who will skip the second “t” and say “twennyten.”

That’s why, for the rest of the century, we can look for English speakers to finally sound like I have for most of the past decade. Welcome to Twenty Ten, everyone.

Gotta love laziness.