Ruby’s Object::send can call private and protected methods


Photo by xiaming

One of the hallmarks of object oriented programming in most every implementation of it that I know of is the ability to designate certain methods as “private” or “protected”, thus keeping them from being called willy-nilly by any old script that wants to call them. Ruby also has this, of course, but interestingly enough it can be easily circumvented.

I guess there are a few posts floating around about it, but I discovered it by accident playing around in irb this evening. I was reading David A. Black’s The Well Grounded Rubyist, where he mentions that you could send a message to a class either within the class definition itself, or by simply sending it to the class object like you’d send any other message:

1
2
3
4
5
6
7
# The normal way to do it
class Thing
  message :whatever
end
 
# you could also do this
Thing.message(:whatever)

Continue reading ‘Ruby’s Object::send can call private and protected methods’

blip.fm/philcrissman

I barely use Blip.fm. Every time I visit it, I think, this is pretty cool. I should use this more. Then I don’t really use it.

I’m at http://blip.fm/philcrissman, if you like that sort of thing.

Scripty2

Calloo, callay.

Making the web more delicious: Scripty2

The Idle Canadians

Mark is an old friend of mine; good to see he’s still doing music.

Dilbert on Agile Programming

This is old, but I’m reminded of it every time I hear the term Agile Programming, now. Which is probably not really a bad thing, as it serves as a good reminder to make sure this isn’t really what we’re doing.

dilbert-agile_programming

A Simple Email Filtering Plan

I’m trying a new plan to attempt to keep my email inbox at or near zero.

One of my challenges in going through email, especially if it stacks up a lot in one or two days, is deciding what I need to keep. There are a lot of emails I may want to refer back to, but determining which ones and how to categorize them starts to seem like more trouble than it’s worth.

My new idea, which I’m currently testing to see how it works, is to create three new folders/labels:

  • 1 week
  • 1 month
  • 1 year

The idea is (hopefully) to look at any new email as it comes in and ask, “Do I need to save this?” If not, delete. If yes, then, the question become: How long? Then stash it in the “1 week”, “1 month”, or “1 year” folder, depending on how long I think the information in it may actually be relevant. (This assumes I don’t already have a folder or label where this email “belongs”). I’m not too worried about finding emails within each folder, as search has become pretty good, both within gmail and within Postbox (it’s a little better in Gmail, so I can always pop into the browser if I’m having trouble finding something).

The next step is to simply review the “1 week” folder every Monday; if something doesn’t absolutely need to be there, it gets deleted (if no longer relevant) or pushed to the “1 month” folder. Same steps for the “1 month” folder, but on the first of the month. Ditto for the 1 year; if I haven’t looked an email for a year, I’m going to assume it’s either a “delete forever” or a “keep forever” email, and either trash or stash it accordingly.

It’s hardly a “43 folders” level of organization, but it might be Just Enough to stay near inbox zero. We’ll see how it works.

Sun VirtualBox

Even if you don’t need to run Windows for yourself, you might need to run it for someone else. In particular, if you’re a web developer, you want to know how Internet Explorer will mutilate your web pages so you can minimize that behavior. You may also need to open a Microsoft Access database that is powering the non-profit web-site you agreed to upgrade and maintain pro-bono (I’m just saying, it could happen).

The easiest solution is to actually run Windows XP (we will not speak about Vista) so you can run IE and/or MS Access or whatever else it is you happen to need. But if you don’t have a spare old PC kicking around your options are 1) Multiboot or Bootcamp; nice but requires rebooting your computer to get between Windows and your OS. 2) VMWare Fusion or Parallels; nice but cost monies. Not a lot, but still.

I’m not sure when it was introduced, but Sun’s Oracle’s(?) VirtualBox does what VMWare fusion or Parallels would do for you; for free. (Gasp).

Yes; it’s very nice.

VirtualBox during an XP install

The only gotcha that I found (I probably should have read the user manual) is that to get my newly created virtual machine to read the CD drive, I had to not only mount it (which was obvious) but also check “Allow passthrough”. Not sure why you would want to mount a CD and not read it, but to each their own, I guess. After that, it worked peachy.

John Adams

aandfsm

If web comics are awesome, and history is awesome, what does that make web comics about history? Really awesome. Especially when they’re as smart as Kate Beaton’s, whose work can be found at Hark! A Vagrant.

The HBO mini-series John Adams is also very good.

At least let’s pretend we’re not biased

Before I leave the restroom, I like to check that the fly of my jeans is zipped up. Call me crazy. It’s just a common courtesy that I like to extend to society at large, sparing people the awkwardness of either needing to pretend they don’t notice, or of overcoming social barriers to let me know that it’s down. I’m just looking out for you, that’s all.

I had the fantastic good fortune of having once had a history teacher who went out of his way to try to get his 12th grade history class to actually think. Among the things he attempted to get us to notice were the various words and phrases which people use which virtually broadcast their biases and preconceptions to you. When you hear a pundit talking earnestly about “U.S. imperialism,” for example, you can often (perhaps not always) assume a worldview behind it that owes a debt to Marxism. Which is not automatically a bad thing; the Marxist economic model has a lot of common sense to it. Whether you agree with his ultimate conclusions or not, it’s absurd to simply try to brush him under the table… but that’s a whole other rant. The point is not whether having a Marxist-inspired point of view is right or wrong; the point is that by way a person uses the word “imperialism” in relation to post-World War 2 history, you can fairly accurately place them in this worldview. They don’t even have to tell you.

However, what the unwitting broadcast of worldview does do is indicate that the speaker may be unaware of the extent of their own bias. The problem with being unaware of your own bias is that you can’t really engage in dialogue. To even have a rational conversation, someone needs to point out that you are making one or more assumptions, which you may or may not be willing to admit to holding.

But maybe I’m being biased here, myself; let’s talk about the term ‘imperialism’ again, for a moment. By taking exception to the phrase ‘U.S. imperialism,’ am I just being an apologist for U.S. foreign policy? Argh. God forbid. That’s the last thing I’m even interested in doing. The problem is the allusion to ‘imperialism’ as practiced historically by the European powers; as soon as we start to draw a comparison like that, we’re making just a little bit too large of a jump. Take Leopold II of Belgium, to provide some context. It is fine to take issue with the current foreign policy of the U.S., or any other nation. But to label it with the blanket term “imperialism” is a bit too drastic of a comparison, unless there is a very real comparison to be made. All too often the term is only barely applicable (if at all) and serves solely to demonize whichever nation it’s being applied to.

It’s like a broader application of Godwin’s Law. Man, as soon as you start comparing anyone to Hitler, you are pretty much broadcasting that dialogue with you will be impossible. Either the characterization is accurate, which is (I’m sorry) extremely unlikely; or, the individual under scrutiny is not really analogous to Hitler, but you’re choosing to make the comparison anyway. Either way, there’s not a lot to talk about. (The assumption being that in the edge case that “another Hitler” ever really rose to power in some nation, it would be obvious, and the real matter would be what should we do about it.)

Here’s some words or phrases off the top of my head that expose so much bias they are apt to stop any meaningful dialogue in its tracks:

  • “Imperialism”: already talked about.
  • “Fascism”: similar to above. If it’s really fascism, you don’t need to point that out. It probably isn’t.
  • “Liberal media”: Some readers are going to cheer at the inclusion of this phrase, others are going to be mad at me. The point is, a blanket characterization like this doesn’t actually accomplish anything. If you’re going to throw around terms like this, how can we actually talk about anything?
  • “[whoever] is/could be the anti-Christ”: This is not intended to belittle anyone’s religious beliefs. But look, if you’re willing to earnestly suggest that a given person might be The Antichrist, well…. It’s like a Christian version of Godwin’s Law. We can’t really have a rational chat about a person if you think they’re the Antichrist, can we?
  • “vast right wing conspiracy”: Are you serious? Same category as “liberal media”. I mean really, as if the collective listenership of Rush Limbaugh and Sean Hannity could band together for some sort of clandestine agenda.

There are doubtless countless other key words or phrases that reveal the speakers bias; probably many even more subtle and hard to pick out.

Here’s the thing: if we’re going to have any sort of rational discussion, we need to be at least willing to consider that we could be biased — that is, that there may be assumptions we are making which the person we are talking to is not making; that there may be conclusions we have already accepted as fact which our associates have not; that we could be dismissing arguments reflexively without even listening to them, because we “already know they’re wrong.”

It’s probably impossible to completely eradicate bias; I’m not even sure it’s desirable. I mean, you want to at least have a point of view. But let’s at least be aware of our own biases, and at least attempt to give our loyal opposition (whoever that happens to be) the courtesy of hearing them out without prejudice. And where possible, lets avoid loaded phrases that carry mountains of assumptions along with them and broadcast our biases indiscriminately. It’s sort of like walking around with your ideological fly unzipped.

People Who Pirate Music Are Also More Likely to Purchase Music

The full story from the guardian.co.uk is here.

I only post this (other than the fact that it is interesting) because I think if you think about it for a moment, it should be almost a stunningly obvious tautology.

People who will bother to pirate music are going to be, generally speaking, People Who Really Like Music. I don’t think that is too unrealistic of an assumption.

So what the study is saying is that People Who Really Like Music are more likely to purchase music.

No! Really? What a crazy idea.




Fork me on GitHub