Telemarketers

A lady just called me on my work phone asking if I was an engineer or an IT person. “I’m an engineer,” I said, thinking perhaps it was someone else in Newton looking to contact IT. She then asked if I could give her the number of one of the heads of IT.

I said, “I really can’t give out that information, but you can send a message to their email address–they’re extremely quick at getting back to people.” I gave her the aforementioned address.

She responded callously: “Well, I spoke to”–and proceeded to name mispronunciations of several of my more senior coworkers–” and Raja, who I actually met in person recently”–here she probably meant a coworker of mine named Raju–” so my contacts are all in engineering, but can you cut me a break here and direct me to someone in IT?”

When I again declined to give her any specific information of my coworkers, she asked, “Your office is–the Boston office, you’re in, what, Needham, right?”

And here I had the overwhelming temptation to say something I did not say, but am convinced would have been the right thing:

“Ma’am, I’m sorry, I have to stop you right there. You’re not very good at this–I know, I know, cold calling is hard–but it sounds like you just incorrectly read off everyone listed on my LinkedIn profile. You should take a little time to try to pronounce names–like Raju. That’s an Indian name, and means something completely different from the word ‘Raja’, which means ‘King’, and was incedentally the name of the tiger from Disney’s Alladin. You should also sound confident in more details, like the name of my company, the location of my office, et cetera. I’m not going to ask you who you’re calling for; I can’t do anything for you anyway, but you should convince yourself before you call that my company needs what you’re selling. Give it another try with someone else on LinkedIn, I’m sure you’ll do great. Have a nice day, ma’am.”

Instead I was more direct, and simply told her I couldn’t give out any information further than the address I’d already given her.

One day I am going to be an old man who shouts inanities at telemarketers.

I look forward to that day with great relish.

Ruby URL Get/Set Field methods

I was writing a quick script and needed to modify a url quickly to change the fields on a url.

def url_get_field ( url, field )
  m=/.*[&?]#{field}=(.+?)(&.*)/.match(url)
  n=/.*[&?]#{field}=(.+)/.match(url)
  if !m.nil?
    return m[1]
  elsif !n.nil?
    return n[1]
  else
    return ""
  end
end

def url_set_field ( url, field, value )
  m=/(.*[&?]#{field}=)(.+?)(&.*)/.match(url)
  n=/(.*[&?]#{field}=)(.+)/.match(url)
  if !m.nil?
    url = m[1] + value + m[3]
  elsif !n.nil?
    url = n[1] + value
  else
    unless /.+[?&].+?=.+/.match(url).nil?
      url = url + '&'
    else
      url = url + '?'
    end
    url = url + field + "=" + value
  end
  url
end

def url_remove_field ( url, field )
  m=/(.*)([&?])(#{field}=(.+?))(&(.*))/.match(url)
  n=/(.*)([&?])(#{field}=(.+))/.match(url)
  unless m.nil?
    url = m[1] + m[2] + m[6]
  else
    url = n[1] unless n.nil?
  end
  url
end

Now it’s easy enough to do! check this out:

irb(main):160:0> url = 'http://pigsflew.com'
=> "http://pigsflew.com"
irb(main):161:0> url = url_set_field( url, 'test', 'omg' )
=> "http://pigsflew.com?test=omg"
irb(main):162:0> url = url_set_field( url, 'archives', '526')
=> "http://pigsflew.com?test=omg&archives=526"
irb(main):163:0> url_get_field( url, 'test' )
=> "omg"
irb(main):164:0> url_remove_field( url, 'test' )
=> "http://pigsflew.com?archives=526"
irb(main):165:0>