[x]Blackmoor Vituperative

Sunday, 2009-03-08

Doublet solver for Perl

Filed under: Programming — bblackmoor @ 23:27

I have translated my doublet solver for Python to Perl. Having already done the difficult part — figuring out what the script needs to do — putting it into a specific language is, aside from a “gotcha” now and then, mostly just grunt work. But I was curious how it would compare with the Python version. I expected it to take an hour or so, but it took me most of the evening, partly because I got distracted by Celebrity Apprentice, and partly because I had to re-think how to handle arrays of arrays (more on that later).

So here is a link to the script, for anyone who might find it educational (rename it to doublet.pl in order to run it), and the official Scrabble word list (you will need to unzip it, of course).

For instructions on how to use the script, run doublet.pl -h

For the rules of the puzzle, what the output looks like, and so on, read my blog entry for the doublet solver for Python.

Some observations:

I have been writing Perl for years: well over a decade. At the time I discovered it, it could do things which were not feasible any other way. When you need to drive a screw and all you have is a hammer, you use a hammer and you are grateful to have it. I was grateful to have Perl.

Times have changed. There are a number of other widely supported languages which do what Perl does with more elegance and less perversity: PHP and Python, to name a couple you might have heard of. None of these languages are perfect. I suspect that no language will ever be perfect, because human beings are not perfect. Nonetheless, if given the choice, I would not choose to use Perl now that there are, in my opinion, better alternatives available.

As an example of things that Perl does poorly when compared to other languages, compare how PHP handles arrays to how Perl handles arrays. I mentioned in my doublet solver for Python that I was a bit disappointed in how Python handles arrays (what Python calls “lists” and “dictionaries”), but I think Python is a step above Perl in this area, while PHP is superior to them both.

Because of the way Perl handles (or rather, does not handle) multidimensional arrays, I had to put the code through some contortions to translate the doublet solver: instead of an array of arrays, I had to choose between using an array of references to other arrays (which is cumbersome), or an array of strings that pretend to be arrays (which is inelegant). I chose the latter. It works, yes, but I can’t say that I am pleased with it. I suppose I could have used “hashes” (what Perl calls associative arrays), but that would have been even uglier than the string solution, in my opinion.

I should point out that in both this script and the Python doublet solver, I used very few comments. Partly that is because the scripts are so short, and partly because I think what they do is self-evident. In general, I think comments are useful for a relatively small number of cases:

  1. Documenting the API for reusing a function or object.
  2. Explaining decisions which may be counterintuitive or inobvious.
  3. Pointing out kludges which, for whatever reason, seemed appropriate at the time.
  4. Notes for later improvements.
  5. Explaining algorithms which may not be obvious.
  6. Explaining function calls or API calls where the names used for variables, etc., are cryptic or misleading.
  7. Explaining the purpose of code so obfuscated that it looks like line noise.

That last item shows up in Perl a lot. But in this case, I think I made the code as transparent as it can be.

Saturday, 2009-03-07

End so-called “Daylight Saving Time”!

Filed under: Society — bblackmoor @ 11:51

So-called “Daylight Saving Time” does not save anything. Not time, not money, not lives. On the contrary, it costs the USA millions in lost productivity. It also costs lives. Studies have shown that traffic accidents increase every time Daylight Saving Time is implemented. It is time to put an end to this wasteful, anachronistic foolishness. Write to your state and federal representatives. It will only take a moment to do, and it really can make a difference.

Wednesday, 2009-03-04

Movies in fifteen minutes

Filed under: Entertainment,Movies — bblackmoor @ 14:21

I stumbled across Movies in Fifteen Minutes earlier today. It is really quite funny.

Tuesday, 2009-03-03

Reasons to migrate from Microsoft Office to OpenOffice.org

Filed under: Software — bblackmoor @ 21:13

I took some time and wrote up a recommendation for people who still use Microsoft Office. It’s easy to criticize people still using Microsoft Office, but perhaps they really don’t know why they should migrate to OpenOffice.org. I hope that this detailed recommendation helps them make the best decision.

It is imperative that businesses eliminate all unlicensed software. Migrating from Microsoft Office to OpenOffice.org offers a cost-effective alternative to purchasing additional licenses of Microsoft Office. In addition, migration to OpenOffice.org offers significant benefits, such as cross-platform compatibility, increased security, and more reliable access to archived documents. Migrating to OpenOffice.org also provides a more user-friendly upgrade path than migrating to Microsoft Office 2007, because OpenOffice.org uses a standard, familiar user interface.

(from Recommendation to migrate from Microsoft Office to OpenOffice.org [PDF])

Monday, 2009-03-02

The losing battle for technology freedom

Filed under: Intellectual Property,Society,Technology — bblackmoor @ 18:41

Penguin Pete is far more optimistic than I am. The history of media (words, music, images, etc.) in the USA and elsewhere is one of increasing layers of restrictions on consumers, and ever-expanding protections for the media robber barons and the Digital Rights Mafia (DRM).

It will get worse before it gets better. Or, as my grandmother once said, “You can’t get blood out of a turnip, but you can sure ruin the turnip trying.”

The painfully ridiculous end to the NYU revolution

Filed under: Entertainment,Society — bblackmoor @ 18:22

A group of students took over a food court at NYU, for reasons which I don’t fully understand. I suspect the people who took over the food court do not understand what they were doing either. Eventually, the administration got tired of waiting for the “revolutionaries” to give up, and kicked them out of the food court.

This is what happens when you buy your kids Macs and pay for them to get liberal arts degrees.

Another RIAA horror story

Filed under: Intellectual Property,Music — bblackmoor @ 16:27

Ray Breckerman brings us another horror story from the war being waged on us by the Digital Rights Mafia (DRM): the story of Brittany Kruger, a Michigan college student who has been targeted by the RIAA extortion machine. Brittany’s story is better than most: as a result of her fight, the lies and crimes of RIAA and their MediaSentry stooges are being dragged into the light, hopefully to burn to ash like the blood-sucking monsters they are.

Brittany has written an open letter describing her experiences, and P2Pnet has granted permission to reprint it:

My name is Brittany Kruger. I’m not a criminal. I’m not a tough person. I cry almost every night these days, and I’m scared to death of what is going to happen to me in the future. Most of all I’m not a pirate, I don’t have a peg leg or a hook for a hand, and I don’t raid ships on the high seas looking for booty.I was a regular kid (I may be 22 years old now, but I still rely on my parents for almost everything!). I’ve no real knowledge of the world at this point in life other than how hard it is to establish credit or get a loan.

Today, February 3rd, I had a lovely conversation with one Morgan Schwartzlander [the ‘lead’ at the RIAA settlement extortion centre], and let me just tell you, it was outstanding, so great in fact I got off the phone in tears. My suggested settlement of $2,000 was “ridiculous” compared to their (“not negotiable”) $8,100 settlement.

Morgan will tell you that she is “not legal counsel” but she’ll tell you what she would do if she were in your situation, she’ll give you some statistics about how motions to quash are almost never granted, and then she’ll tell you that whoever suggested your motion to quash is an idiot (I don’t think she knew that was my dad).

I make about $4,500 in a YEAR working at Dairy Queen, and they want a lump sum of $8,000+? I don’t know how that’s going to work. When I buy a song from iTunes, it only cost $.99. Not every college student can have mommy and daddy pay for all their problems to go away.

I was looking through my journal to refresh my bad memory of how everything happened, then I decided that I didn’t want to bore you with dates. So I’m going to tell what I’ve learned about myself these past 2 years.

Today I realized that I cry a lot! Over and over I question myself “am I a bad person?” I’ve never killed anyone, I’m a very sympathetic and forgiving person, I volunteer, and I go to church.

But these people at the RIAA still have a way of making me question myself. Are some people just programmed to be bad no matter how hard they try to be good? That’s exactly how it seems to go for me, one step forward two steps back (or that seems to be how it is for my one person pity party).

Then my mom assures me that it’s not me. The jobs (I call them jobs because I would assume that a career is something that makes you feel good about what you do) these people hold are there to make people feel bad because they don’t have the monetary funds to make all their problems just go away. They are bullies!

I wonder how people like Ms Schwartzlander or Mr Kelso sleep at night, I wonder if they go to church every Sunday and think “I’m a good person”.

[Note: Kelso is Donald J, a Holmes Roberts & Owen attack lawyer acting for the Big 4’s RIAA as it extorts American students such as Brittany.]

I think all the time about how something that I love so much could get me into so much trouble?

I never sold copyrighted music for profit; I used it [P2P] to find new music or to figure out if I liked a band enough to buy their CD (because I hate buying a CD for just one song)! I didn’t think I was hurting the bands that I love by finding more of their music, listening to it, and then buying their CD. That makes no sense.

I didn’t even know what copyright was until got called to the Dean’s Office.

I don’t know how everyone else spends their college life, but for me a large portion consists of printing off endless amounts of documents that use language I don’t understand, making pleasant phone calls to settlement agencies, and racing papers to the local court house.

That’s precious time I could be using (studying or hanging out with friends) that’s wasted because of money.

I wonder how many college students have had to go to the police station to file a complaint about a “private investigator” invading my privacy, and have had the police look at them as if they were totally incompetent?

How many students have had their university hand them over like a piece of meat to hungry billion dollar corporate wolves?

I know that the University of Michigan didn’t do that, and Harvard University didn’t do that.

I feel bad for my roommates and friends too, because I know they get pulled into a lot of the problems that I have. They get caught answering the phone when it’s a settlement agency and have no idea what to do or say.

How are they supposed to comfort me when I’m having a bad day? I know that hundreds of kids at NMU, at one point or another, downloaded music, but they didn’t get their computers hacked into, and get accused like me of being a pirate like me, and they’re lucky for that. I think they know that.

I’m not a regular college student. I’m an example for everyone to stop and look at, with a giant stamp on my forehead that says, “Don’t be like me, because I made one mistake as a teenager that will ruin the rest of my life”.

You might not see my face or name plastered everywhere, but I can guarantee you that I’m in every statistic, you see a poster on the wall warning you against “illegal downloading”.

I’m the person they’re talking about. I might even be one of the “stupid” ones fighting the RIAA.

I’m Doe # 5, but I prefer to be called Brittany, because that’s who I am.

I’m a person, not an IP address or a case number.

I’m a person and no one will ever change that about me. I’m me and no one else will ever tell me different. I need to believe in that. Everyone makes mistakes, and the people who are doing this to me are no different.

I’m scared, and now I worry all the time about what is going to happen to me.

I don’t know if it has made me a stronger person or a weaker person. I have problems sleeping, my hair is falling out in ungodly amounts, I’m having a hard time concentrating in class, but most of all I hate the fact that I’ve pulled my entire family into this.

My dad helps me all the time figuring out what I should do, my mom listens to me when I’m having a bad day and need someone to cry to, my brothers and sister, I’m sure get jipped on the time my parents spend with them, and there’s always that perpetual question “hey isn’t your sister being sued or something for downloading music?”.

Right now it doesn’t seem like this is ever going to end, I’m just now entering the tunnel and the light is miles away.

I know it will end. I just don’t know how long it will take to get there.

I guess Murder by Death was right when they said “Sometimes the line walks you”.

« Previous Page