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.

Saw this in someone’s signature on Democratic Underground

and just needed to share it.

Image

Oh, well.

The only agent who has ever signed any of my stuff just rejected the new book.

It’s very hard not to want to just pack it in now and call it a failure.

My latest E-Mail to Comcast

I thought you’d like to know I’ve managed to catch you and your company in your lies about throttling my internet service.

As I’ve documented before, these problems have been taking place for over two years. During that time I have either independently or, at your direction, replaced every single piece of equipment in my home network. Some pieces have even been replaced twice, at great expense.

When the problems grew acute your company first insisted that nothing was wrong.

Then when caught and forced to admit that there was a problem, your guys tried to claim that it was caused by a contractor of yours giving me the wrong power supply for the modem you forced me to rent instead of the modem I owned. That did not solve the problem.

Next you claimed it was caused by an old television hooked up to a completely different branch of the cable, not in the same line as the modem. Removing it did not help. In fact, it got worse the next day.

Then your techs came out and ripped my network apart. They said they couldn’t find a problem. They offered two theories: either it was my Vonage box (which was one of the items replaced twice) or “you’re being throttled.” That was an exact quote from your tech, even though later you tried to deny that he’d ever said that on Twitter.

Well, out of pure frustration today, I took the Vonage box out of my network.

The throttling got even worse.

Turns out my Vonage box was handling QoS, which gave my web traffic higher priority than all other traffic. So without the Vonage box in the picture, I couldn’t get any of my web traffic out through your throttling, where before it had a better chance.

So why did your guys claim it was the Vonage box? To try and cover up your throttling (which you would now have to admit you’ve been doing for nearly two years)? Or to get me to sign up for your more expensive and less reliable “digital voice” service?

And when I call and try to cancel my television service next week, is your operator going to hang up on me again? Are you finally willing to admit that you are abusing your power as a monopoly in my neighborhood (no other broadband service is available at my address)? Including refusing to let me cancel or downgrade my other services so I don’t have to give you any more money than is absolutely necessary?

Checking the disk on your iPod even when Windows doesn’t want you to.

iTunes under Windows is, at best, a flaky piece of software. One annoying thing it does is sometimes fail to properly close down the connection between your computer and an iPod when you’re syncing it. This results in the “OK to disconnect” never showing up, sometimes even after you’ve pressed the button to forcibly eject the iPod.

When this happens, sometimes the “dirty” bit will be checked in the NTFS structures on your iPod. Then, whenever you plug it in, the computer will nag you to scan the disk on your iPod and fix any errors. Of course you can’t do that because iTunes grabs the iPod and won’t let it go, so Windows can’t do low level work. They usually ask you to schedule a disk check when you reboot your computer, which is also a pain.

For those who haven’t yet figured it out (and until this morning I was one), here’s how to get around that.

  • When the message shows up, tell Windows you will scan later.
  • Let iTunes finish with the pod, and (hopefully) eject it.
  • Go into Task Manager. There are two ways you can do this. #1 is the classic “three finger salute” of Ctrl-Alt-Del. The other in more recent versions of Windows is to right click on the taskbar and select the “Task Manager” option.
  • Click on the “Processes” tag.
  • Locate the “iTunesHelper.exe” process, and end it by clicking on the “End Process” button.
  • Locate the “iPodService.exe” process, and end it the same way. Shutting down these two processes will prevent iTunes from waking up and seizing your iPod.
  • Connect the iPod, and when the nag pops up, this time tell Windows to scan the pod immediately and fix all errors. Without iTunes in the way, it will be able to do so. It will make sure everything is okay and clean that “dirty” bit so it won’t bother you any more.
  • Disconnect the iPod.
  • Put things back to normal by going into your iTunes program folder (usually c:\Program Files\iTunes, c:\Program Files (x86)\iTunes, or c:\Programs\iTunes depending upon the flavor of Windows you have installed) and run the “iTunesHelper.exe” program. This will restart the two services you killed earlier.

Not the simplest of processes, necessarily, but less of a pain in the ass than rebooting when you have a lot of work open.

11/08/09: “90 Minutes Of Explosions and Tits.”

On this week’s “This Week In, This Week Out,” Pab is trapped in the basement of the Algonquin, so ignore the background noise by concentrating on the much clearer sounding comments by Tom Smith, Kris Leeds, and Habermann.

This week, we discuss Comcast’s possible plans for NBC/Universal, a faith-based prison, the next franchise for J.J. Abrams to screw up, the Teabagger Temper Tantrum, a woman who finally passed her drivers’ test, and the average color of the universe, among other things. And, as always, we announce the winner of the Asshole Of The Week award.

The show this week runs one hour and one minute, and can be downloaded by clicking here. The RSS feed for the weekly podcast can be subscribed to here. Show notes for this week’s show can be found here.

Comment on this week’s show is welcomed either through this blog post or via E-Mail.

Welcome to the World’s Shortest and Probably Least Effective write-in election campaign

In New Jersey Assembly District 1 (Cumberland/Cape May), the Democratic Candidates Nelson Albano and Matt Milam today started sending out robocalls making it clear that they are opposed to same-sex marriage.

Well, you know what? Fuck them.

If you live in Assembly District 1 (where it’s Albano and Milam versus Donohue and McCann), then send a real message on your ballot, and let them know that bigotry is not acceptable just because it has a (D) after its name.

Tomorrow, write in Paul L. Sungenis and Bryan F. Irrera for Assembly. And spread the word.