Ruby String Concatenation

Ran in to a bug tonight.  See it?

def display_value
display_value = notes.blank? ? "untitled" : notes
display_value << " (#{ shortcut })" unless shortcut.blank?
display_value
end

Need a hint?  The symptom was the +notes+ field being unexpectedly changed.

+display_value+ is pointed at +notes+. “<<” then goes ahead and changes that value (which both attributes are pointed at), thus both are effectively changed.

So, while it’s nice to avoid the extra String creation with “<<” where possible – sometimes, you’ve just gotta go with the “+=” to clone, then modify.


a and b ending up the same:
>> a = "a"
=> "a"
>> b = a
=> "a"
>> b << "asomething"
>> a.object_id == b.object_id
=> true


and different:
>> a = "a"
=> "a"
>> b = a
=> "a"
>> b += "something"
=> "asomething"
>> a.object_id == b.object_id
=> false

Leave a comment

Filed under rails, Ruby

Writing to NTFS

Who has two thumbs and is writing to NTFS from OSX?  Well… me.

but who’s making it possible (and easy)?  This guy.

Leave a comment

Filed under Uncategorized

Royal Crown Cola

Ohhhh, the “RC” stands for “Release Candidate”.  Who k

Looking forward to this book too.

Leave a comment

Filed under Uncategorized

Yarrrrgggh!

Happy “International Talk Like A Pirate Day“.

If yer pirateese be a little rusty. Thar’s naught wrong wit’ askin’ for a little help (ye needs t’ be usin’ a Mac):

Leave a comment

Filed under Uncategorized

Apple Love

A week of so ago, I started having some serious issues with my Macbook Pro.  I’d be cruising along normally when suddenly things would konk-out on me.  Keystrokes were basically being “ignored”.  Meaning, that when things became responsive again – it wouldn’t “catch up” with the queue of letters, it would just start paying attention again.

It was quite annoying – and not app specific.

After a bit of time, things got worse — occasional crashes (without warning) and every once in a while the “Eject” symbol would come up on screen – sometimes accompanied by the *ejecting* sound… sometimes not.  It really seemed like an OS problem so I went ahead and re-installed, but it quickly became evident that things were still on the decline.

When the OS re-install didn’t work, my next thought was that maybe there was a keyboard problem – causing the machine to basically think that I was flooring the eject button all day (er something like that).  The guys at the Apple Store seemed to think that made a bit of sense as well and decided to replace the keyboard and top plate (or whatever it’s called) on the machine.

Of course, as with any machine that you have a warranty on, it was expired by 2 weeks… the difference was that where your car dealer normally laughs and says “that’ll be $2,300” – the Apple guy laughs and says “close enough, we’ll cover it”.  I have no idea how much the repair would actually cost but I was really happy to hear that.  The machine was ready later that day and (knock on wood) appears to be fixed.  I’ve got things restored and have been cruising along without issues.

Actually, I do need to find out how much this repair would have cost.  The feel of the machine is completely different with the new keyboard – it literally feels like a brand new machine to me.  Especially since the OS is completely re-installed (I decided to start from scratch and only bring “old stuff” over to this machine when I realize that I really miss it… so far nothing).  If the cost is reasonable, I might actually consider having it replaced next time I’m feeling like the machine is getting a little stale!

And they all lived happily ever after.  The End.

Leave a comment

Filed under Uncategorized

Expecting More: Writeboard

The beauty of 37signals products, including Writeboard, is keeping things simple.  But if you’re going to do just the simple stuff – you need to do it right.

It’s pretty clear where the “formatting guide” should open:

but no.  Instead my editing area is pushed off the screen and my sidebar real-estate continues to be underused.


Ok, well that’s unfortunate (and admittedly quite minor).  At least now I can figure out what syntax to use to insert a pre-formatted block…  or maybe not.  The formatting guide not only doesn’t include what I want – it doesn’t mention that there are other options even available.

It’s pretty simple to find the true formatting guide for Writeboards though.  All you have to do is traverse the internets for 20 minutes.

1. Try the formatting guide.

2. Start a blog post complaining about it appearing in a nonsensical location.

3. Search Wikipedia for “Writeboard” and find the note about Textile.

4. Go to the Textile Wikipedia page

5. Use their link to the full syntax reference.

See!  It’s nice and simple!  Hooray!

1 Comment

Filed under Usability

A (tiny) realization about my personal information

Getting junk mail used to be such a pain.  Another “Shopper Stopper”, pizza ad, “coupon book”, or amazing credit card offer.

Yesterday when I received an email (seemingly from a friend) asking for my physical address, I thought: “Hmmm, that’s weird.  Why would this guy be asking for my physical address, I smell a hoax.”  But about 15 seconds later, I was sending my address along anyway.  Why?  Junk mail doesn’t annoy me anymore – it’s spot on “The Annoying List” (TM) has been replaced by junk email.

Turns out the email was legit, so I’ll be expecting my ticking package in the mail any time now.  At the end of the day though – if someone already has my email address… I’ve already lost, so go ahead and take my physical one.

Ed. Note: Junk mail does still annoy me, not because of the time spent carrying things to the recycle bin but because I wish they wouldn’t waste the paper in the first place.  But it takes A LOT of pizza coupons to add up to 1 copy of the Yellow Pages – please people, stop paying for ads in there.  Unless you’re selling hearing aids or Rascals, I have a hard time believing you’re reaching your target audience.

1 Comment

Filed under Uncategorized

What’s The Use Case?

So, I bought some socks last weekend.

 

So… re-sealable bag?  Really?

Perfect for all the times that I’ve thought: “Glad I got these new socks, but why must they all start to get stale when I only need to wear one pair today?”

Apparently I’m not the only one who isn’t completely onboard.

3 Comments

Filed under Marketing

Roughin It

It’s tough to work without my office lake view…

but I get by…

Leave a comment

Filed under Uncategorized

Subversion checksum mismatch

Early on on a project we had an class called ‘document’.  As things went on, not only did that object become more of a ‘file’ but a new class came along that really was more of a ‘document’ but we called it an ‘exhibit’ (since ‘document’ was taken).

Well, the other day I finally bit the bullet and renamed things.  Unfortunately, somewhere in the middle of having the old class vacate the ‘document’ name and the new one move in – subversion got thoroughly confused.

There are some scary ways out there to get around “checksum mismatch” in subversion but this one really made it simple and worked just fine.  I figure a solution that fixes a potentially scary problem in 5 minutes (and without the need for a helmet) is worth passing along.

In other news… git will be coming soon to our project.  To be continued…

(and no, we didn’t really name a class ‘File’)

Leave a comment

Filed under Uncategorized