Profile

wshaffer: (Default)
wshaffer

September 2021

S M T W T F S
   123 4
56789 1011
12131415161718
19202122232425
2627282930  

Custom Text

Most Popular Tags

I don't remember how I did programming in the days before Google and Stack Overflow. I think I spent a lot of time flipping through books. Or possibly actually memorized language syntax, which seems like a horrible waste of neurons that might be more profitably put to other uses.

However, if you want to get good results out of Google, you've got to know how to search for the right thing. There is a thing that I often want to do in Ruby, where I've got a variable that holds a string, and I want to put the value of that variable into another string. And somehow I always end up searching for something like "ruby string substitution" and getting pages and pages of stuff on the sub method, which is nice but not what I want at all.

So this is a note to myself: the thing you want to do is called "variable interpolation" and it works a little something like this:

thingy = "variable interpolation"
puts ("When you want to put a variable into a string, that's called #{thingy}.")

(no subject)

Date: 2015-03-13 10:36 pm (UTC)
ext_116426: (Default)
From: [identity profile] markgritter.livejournal.com
I have this problem frequently with Google, that if I don't know the right terminology I get pages and pages of something that is related but not quite right, because Google assumes I knew what I was doing. It'd be great to have a "I don't exactly know what I'm looking for is called" mode that went for breadth rather than depth.

(no subject)

Date: 2015-03-14 02:03 am (UTC)
From: [identity profile] en-ki.livejournal.com
I have kinda the opposite problem. For the past few years, Google has been trying to guess what you might mean for each word rather than just searching for the word itself, so several times a day when I'm searching for some exact word I have to go back and put the word in quotes because Google thinks I'm misspelling something.

(no subject)

Date: 2015-03-14 02:43 am (UTC)
ext_116426: (Default)
From: [identity profile] markgritter.livejournal.com
I agree, the non-exact matches when I want exactness are a problem, I want "close in meaning" search not "nearest neighbor word" search.

(no subject)

Date: 2015-03-14 02:06 am (UTC)
From: [identity profile] en-ki.livejournal.com
AFAIK only Perl and Ruby call this "interpolation". It's "expansion" (a broader concept) in shells and "formatting" (subtly different concept) in Python and most other languages.

Oddly enough, you'll probably get the most reliable Google results for this question if you pretend you don't know anything and put it in language that is as untechnical as possible. E.g., {put variable in string ruby} works well.

(no subject)

Date: 2015-03-14 02:11 am (UTC)
From: [identity profile] en-ki.livejournal.com
Speaking of shells and terminology that's hard to search for: I can never remember the name for process substitution or how to find it in docs.

(no subject)

Date: 2015-03-14 04:13 am (UTC)
From: [identity profile] wshaffer.livejournal.com
A whole set of slightly confusing conversations I've had with Python developers has suddenly become clear. (We were rewriting error message strings together, and I kept wondering why they kept talking about "formatting" when nothing was being formatted in the sense that I understood that term. I never bothered to clear up the misunderstanding because it didn't seem to prevent me from being able to edit the strings correctly.)

Expand Cut Tags

No cut tags

Style Credit