Since when does initialize not take arguments?

Since WHEN?!

def initialze(attributes)
  @attributes = attributes
  load_xml_request
end

Since you SPELLED IT WRONG! :)

Hi? Uh, yeah, hi. I need… it’s pretty simple actually I just need the world, uh, yeah on my desk Tuesday morning. Um… Can I give you the specs tomorrow? Thanks!

I have a very urgent asp.net project that I need done by Tuesday.

I want it to be designed using 3 tier model

1- Data Access Layer ‘DAL’. I want to use subsonic for that. Also stored procedures. Did you work with subsonic?

2- Business Logic Layer ‘BLL’

3- User interface ‘UI’ (The UI has 5 pages)

I need very high OO code quaity. I am a programmer myself and I will review the code.

Also, the database is MS SQL 2005.

Let me know asap if you can do it and I will forward the specs to you.

Thanks

The kittens are crying.

Walking backwards in the opposite direction.

Or… -2 * -2 = 4

Infinitely iterate through an array in Ruby.

class Array
 
  def roll
    loop { each { |e| yield(e) } }
  end
 
end
>> a = [ 'a', 'b', 'c' ]
=> ["a", "b", "c"]
>> a.roll { |e| puts e; sleep 1 }
a
b
c
a
b
c
a
...

I, Object.

From the GNU Smalltalk documentation:

I am an abstract class. My objects represent things that are discrete and map to a number line. My instances can be compared with < and >.

The documentation is written from the perspective of the object. Brilliant.

It’s called the Consumerist for fuck’s sake.

I’ve loosely followed the happenings over at the Consumerist for about a year now. Reading articles here and there and reading about half the comments for each article.

The articles themselves are decent. They’re revealing and interesting to read.

Some of the comments, however, are a different story. The following were taken from this article:

Our bank has me properly trained.

All I had to do was upgrade my account to playa level, in accordance with the higher balance, and I could use a lot more of my money daily.

Wanting to make a purchase @ Best Buy, and he Banks with Bank of America?? That’s like admitting you are a stupid consumer.

If you can afford to put it on the debit card, you can just as well put it on the credit card and immeidately pay down the balance without incurring interest. This is credit cards 101 stuff here LOL.

They reek of playing by the rules and using workarounds to “correct” an issue that, in my mind, shouldn’t have been an issue in the first place.

On a positive note, there are some level-headed, reasonable commentators as well.

I think the OP has a right to be mad. It’s HIS money.

“OP” means “original poster,” and usually refers to the author of the article about which people are commenting.

I think it is a big deal that he was denied access to his own money. It’s not Bank of America’s money, it’s his money.

I’d like to focus on this comment for a moment:

I am so sick of consumers like you who think there’s no problem anywhere until something happens to you personally, and that if problems happen to others its their fault because they are not as slick or whatever as you are.

See anything odd?

This part, I am so sick of consumers like you…

I’ve been noticing this house of mirrors kind of dichotomy for quite some time.

It’s one in which I must be very careful about the language I use. Each word is both ally and enemy. Use a word in one context and it becomes a scholar of truth. The same word in a different context can turn on you like beaten dog. And some words, ought not be used at all.

In its common usage, “consumer” is one of them.

Using the term “consumer” as a description of a human being is like throwing your chips into the pile. You’ve agreed to play the game. Their game. A game you cannot win because of the very definition of the word.

Sure, everyone consumes. Consume food. Consume “goods.” Consume air. “Consumer” doesn’t seem like such a bad word. Does it?

Have you ever met someone that was able to argue their way into or out of anything? Regardless of how ridiculous their stance may have sounded in the beginning, you were eventually able to see their point of view.

Like most things, language isn’t permanent. Quite literally, a word means no more and no less than what I say it does. In my mind and in my communications. You can agree or disagree to use it in the same way. The practice of “rewiring” words is deceptive. It’s also common. The best defense is to be aware of it.

Words are like opinions. Opinions are subjective. You understand what I am saying because of the agreed upon definitions of the words I am using. Or you don’t. Or you understand some, but not all. Or you understand, but disagree. The last one is rare.

Now, imagine for a moment that you and I are good friends with staggering wealth. We agree to redefine a word, say, “consumer,” to mean “unit of consumption that leads to profit.”

With our financial influence we begin to use the word “consumer” in all communications. The word, to a degree, fits, or makes sense, in the contexts it is being used, and so catches on.

Finally, you take the bait. “I’m a consumer, damn it! I have rights!”

No, no you don’t. Humans have rights. Consumers, per the game (context) you’re playing, do not.

Same word, different contexts. I use the word context here to describe a social climate. By social climate I mean a rather large group of humans who subscribe to a certain set of rules. This is that. This is considered good form, that isn’t. So on and so forth. I don’t call it culture because I believe culture to mean something produced serendipitously over time, not arbitrarily as in my above example.

Now we come full circle. The very name of the website, “consumerist.com,” leads me to believe the people engaged therein have all agreed to step into yours and mine’s house of mirrors. No matter how much progress they make in “improving” it, we will always be the game masters. Should they come close to completion, with a stroke of the pen we will return them to the beginning. New restrictions, new technicalities, new rules. Unending rules. Arbitrary rules. Rules designed to keep them minimally satisfied, and always busy enough to prevent them from really thinking about the situation they’re in.

If you’ve come this far, and I trust you have because I believe you to be intelligent, it is of the utmost importance that you realize there are games within games. Breaking out of one is often not good enough. There are many games we have been fooled into playing.

I’ll end this by saying that simple is good. If a system is so big you can’t hold the entire thing in your head at once, it’s too complex. Break it down and distribute. The Constitution is a small, relatively simple document. The IRS tax code is a large, complex document.

Production-grade code versus getting it out there.

I’m constantly at war with myself and other forces to “get the simplest thing that can work” up and running quickly and at the same time not writing absolutely shitty code that has to be massaged a week later.

Actually, it’s not the massaging that I mind — I like refactoring code. What bothers me is it never feels like there’s enough time or emphasis given to creating time to go back and refactor. It’s always about moving forward and making it work, regardless of the quality of work being done. So long as it looks good on the outside.

It feels like the only real option I have is to “slow down.” I think this coming week I’ll do that. Slow down, but remain steady. Slow and steady.

Everything wrong with the Windows developer community.

I wasn’t aware I needed to make my Internet Explorer professional. Really, I wasn’t.

What I find interesting is that they didn’t include, oh, I dunno, a JavaScript debugger in there.

Zoom in with your Mac!

This trick was shown to me just a few days ago and it’s been so helpful I thought I’d share it:

Hold down CONTROL and scroll with your mouse (or trackpad) and the entire operating system will zoom in!

Here’s a screen cast showing this in action!

Turn an acts_as_tree structure into a select drop-down.

This is probably the easiest way to turn Rails’ acts_as_tree structure into a select field:

HTML:

<select name="category_id">
  <%= expand_tree_into_select_field(Category.top) %>
</select>

Ruby helper:

def expand_tree_into_select_field(categories)
  returning(String.new) do |html|
    categories.each do |category|
      html << %{<option value="#{ category.id }">#{ '&nbsp;&nbsp;&nbsp;' * category.ancestors.size }#{ category.name }</option>}
      html << expand_tree_into_select_field(category.children) if category.has_children?
    end
  end
end

The Category.top method is simply:

def self.top
  find(:all, :conditions => [ 'parent_id IS NULL' ])
end

Finally, your Category class should implement has_children?:

def has_children?
  children.size > 0
end

That last bit is, of course, optional. You could easily write category.children.size > 0, but that’s not very object-oriented now, is it?

Enjoy!

Next Page »

Clicky Web Analytics