Review of Siri voice app for iphone 4s

I've been playing with Siri on the new iphone 4s for about 12 hours now and I can honestly say I'm quite impressed with the features.  The small help section within Siri gets you going quickly with example commands.  When Siri doesn't understand a command, she prompts you to do a web search for that phrase.  Of course saying things like "google barack obama" or "search for barack obama" also command her to do a google search for those terms.

A lot of the examples show how you can text, email, or call using Siri by just referring to a person's first name.

"Text Vinny"

"Email Vinny"

If you have multiple Vinnies in your contacts, Siri will show you a list and prompt you to choose one.  This makes perfect sense.  However, the voice commands don't appear to work very well for choosing which Vinny.  Siri doesn't seem to understand names very well ( which from a programmers point of view makes perfect sense ).  I was hoping that it would work like most phone systems work however, where I could say "one" and Siri would select the first Vinny in the list or "two" for selecting the second Vinny and so on.  It doesn't work like that.  So you either have to click the "Vinny" that you want or try to say their whole name in the original request like: "Email Vinny Boombotz."  And you have to really pronounce names phonetically ( not necessarily how they're pronounced ) to get the right name to show up.

The same issue comes up with email addresses.  When you command:

"Email Vinny Boombotz"

If Vinny Boombotz has multiple email addresses, Siri will show you a list of Vinny's email addresses and prompt you to choose one.

I've found that text commands work better than email commands and that's usually because most of my contacts only have one mobile phone number and therefore one texting address.  Saying "Text Vinny Boombotz" will have Siri prompt you for the body of the message.  Saying "Text Vinny Boombotz I'll be right over" will have Siri put "I'll be right over" in the body of the message.  Pretty handy.

Creating meetings and reminders works very well.  When you say "Remind me to call Vinny Boombotz at 8:30pm" Siri will set up a reminder for 8:30pm with Vinny's number attached.  So the reminder winds up with a "call" button on it for easy dialing.

Commands like "what's the weather today" and "show me today's meetings" are pretty handy as well.

Commands like "Find me an italian restaurant" have Siri locate italian restaurants local to you.  Clicking on one shows a map and then clicking on the map label will show you the phone number and address of the restaurant.

There's a whole slew of mapping functions that I haven't even tried yet.

The Wolfram Alpha piece of Siri is kind of like the ultimate bar bet tool.  You can ask questions like:

"Who won best actor in 1982?"

"Who won the SuperBowl in 1986?"

"What's the population of China?"

"How many calories in an Egg McMuffin?"

And the Wolfram Alpha piece kicks in and gives you a handful of information on your topic.  Again, if its not in Wolfram Alpha, then it falls back to a web search.  But I found this much quicker then typing in a search.  I'm probably going to use this piece of it quite a lot.

There's also a bunch of fun questions you can ask Siri that I mentioned here.

There's big things missing from Siri right now that I hope get improved.  There's really no concept of "latest news" or "latest baseball scores."  Siri will prompt you to do web search for these terms.  Ideally, they should open up the API to/from Siri so that if you ask for "latest baseball scores" it can query ESPN or another sports outlet for that request.  It would be really killer if when you created iphone apps that you could register some Siri answers in your app so certain questions would go to your app instead of just a default web search from Siri.

So in the baseball case, the ESPN app could register answers with Siri to questions like "Latest baseball scores" or "Next Texas Rangers game."  So if Siri couldn't find the answers to those questions, it could question the ESPN app on your phone for those questions, before doing a default web search.

In conclusion, I think Siri is a nice addition to the iphone.  It's not quite a killer app but its definitely useful and something I'll probably be using a few times a week.

Fun questions to ask Siri for iphone 4s

In addition to the usual helpful things like sending texts and setting up appointments, Siri also responds to a bunch of silly questions as well.  Try these and see what you get:

What is the meaning of life?

Siri, what is your favorite color?

Siri, how old are you?

Siri, how do you work?

Knock knock?


On Technical Recruiter Spam

I haven't updated my linkedin or dice.com profiles in about a year.  I figured by not updating those profiles that it would slow down the constant onslaught of recruiters phoning and emailing me about web developer positions.  It hasn't worked so far.  I really appreciate someone giving me the opportunity to apply to interesting jobs but the recruiting industry is just broken and full of lazy people who can't be bothered to do anything other than a simple keyword search.  I have a lot of experience so I'm going to show up in a lot of keyword searches but that doesn't mean those jobs are applicable to me or that I would be interested in them.

So if you're going to contact me anyway, you might as well try not to annoy me.  Here are some ways dear recruiter of not annoying me:

1.) If my profile lists that I'm not willing to relocate then don't send me a job clear across the state.  Or the country.   Or the world.   These would require relocation.  While I realize that New Jersey is one of the smaller states in the union, it is still 166 miles north to south and 57 miles wide.  Since I live towards one end of it as referenced by my address, it makes little sense to assume I can commute to the other end.  That's over a 100 mile commute.  A quick google map search could give you that.  

2.) If the job entails working WITH a "guru," "ninja," or "rock star" then I am not interested.  A real guru is much too enlightened to ever refer to themselves as a guru, nor would they allow another to refer to them as such.  So when I see "guru" as my potential boss/coworker, I read "asshole."  A ninja would have altered the job ad before it went live so as to preserve his identity.  And rock stars aren't developers.  They are girls named Kim that play bass guitar.

3.) If the position entails that I NEED to be a "guru," "ninja," or "rock star" then I am not interested. Please see above.

4.) If my profile lists I'm looking for full time work, then don't send me jobs that aren't full time.  I really don't get this one.  And I don't have anything funny to add to it either.  It's really just sad that people don't pay attention to this.

5.) If the position requires being an expert in some technology that I don't have as my primary skill set, then don't bother contacting me because I probably couldn't even do the job.  

6.) Stop asking for "excellent communication skills."  If I had those, I wouldn't be a developer, I would be a salesman.  Or Steve Jobs.  I can communicate well enough to get the point across the first time.  Is that excellence?  Perhaps to you it is, but you also think the world is full of gurus and ninjas so I can't really take your assessment at face value.

7.) If the position does not require me to write code to get a job offer then I'm not interested.  Because that means your other developers didn't need to write code to get their jobs there and probably two-thirds of those developers are terrible.  I don't want to work with terrible people.  The better job you do at weeding out the crappy developers, the more I will think of your organization.

8.) If the position is for a company whose name you cannot divulge until we've had several conversations then I'm not interested.  I understand not putting the name in the job ad online,  that's pretty standard these days, but if you're contacting me directly then you should give me the name of the company.  Otherwise it implies a lack of trust on my part, like I'm going to steal this commission from you somehow.  So, first, you're making contact with a stale account since I haven't updated my profile in a year.  So you're assuming I'm looking for job when I'm probably not.  And then to try and entice me into the job market, you neglect to give me the company name so I can do research on it?  That's pretty lame.

I could go on and on here, but what about you?  What are your suggestions for technical recruiters?


How to find all the distinct PHP session variables that your applications uses.

The short answer is a one line *nix shell command:

grep -hor "\$_SESSION\['[A-Za-z0-9_]*'\]" * | sort -u

This command: 
  • looks through all the files in your application recursively for the PHP $_SESSION reference
  • finds any variables named with capital letters, or lowercase letters, or underscores, or numbers
  • sorts the list alphabetically 
  • removes the duplicate items in the list

The long answer is that I found myself with an interesting dilemma recently.  How to find all the PHP session variables set in my application.  Some pieces of the application were new code, some were older legacy code.  I needed to get the full list of session variables because I needed to delete most, but not all of them for a certain usage case ( ie, the user is still logged in and has some properties, but the other session data could be safely destroyed ).

So I began with some command line greps on linux.  First I tried:

grep -r \$_SESSION *

This was  a decent list, but about 1000 rows long.  Too unwieldy to deal with.  Let's get rid of the filenames, I don't really care where the session values are set for my case.

grep -hr \$_SESSION *

This is a little better, but I don't need the whole line, just the session variable itself.  Let's see if we can start to grab the session var using a regex pattern.

grep -hor "\$_SESSION\[" *

That's getting us closer.  Now, I know ( or assume ) that my variables will only include upper/lower case letters as well as numbers and underscore.  Let's add those to the pattern.  ( you DO speak regex don't you? )

grep -hor "\$_SESSION\['[A-Za-z0-9_]*'\]" * 

Now we are cooking.  This is a nice list of the session variables ( albeit only one array level deep which is all I needed ).  Now how to remove the duplicates?  Maybe we should "sort" them first?

grep -hor "\$_SESSION\['[A-Za-z0-9_]*'\]" * | sort 

That is really close.  Is there a way to remove duplicates with the "sort" command?  Yes, there is.  Hot dog.

grep -hor "\$_SESSION\['[A-Za-z0-9_]*'\]" * | sort -u

There it is.  That's the final command I used which located around 50 variables in the old legacy code and new modular code that were used in the sessions.  The only really drawback to this code is it will not find multiple nested array values on the session itself, but you could add that as a separate regex if you need.


Yahoo email account hacked

My wife started sending me emails about male enhancements around 3am Saturday morning.  I first took slight offense to this but quickly realized they were addressed to everyone in her address book.  Her Yahoo email account had been hacked.

We updated her account password, alerted Yahoo security via a basic form on the Yahoo site, and added a "sign-in seal" to the account.

But really, this should not have happened in the first place.  There's a page in the Yahoo accounts menus that shows you the last 20 or so places you've logged in from.  There's a bunch from our hometown and then a couple in France.  She's never logged into Yahoo from France.  Ever.  Shouldn't Yahoo be throwing a red flag on that and displaying some of the maiden name, first pet name questions?

The other disappointing piece of this is that there's no "sign me out of everywhere" button, you can only opt to be signed out every day.

This is really terrible security.  I haven't forced her to switch to Gmail yet but I probably will strongly urge her to do so in the coming weeks.

  • Gmail has two factor authentication which practically eliminates this.
  • Gmail has a button to sign you out everywhere
  • I *think* Gmail has something if you're logging in from a different country ( but I'm not positive on that )


Diary of a mysql database problem in 15 minutes

1:42pm - frantic instant message comes in from a smallish project that their site is down.

1:42pm - I ssh into both the webserver and the database server.  Database server takes awhile to actually get a login prompt.

1:43pm - Email containing frantic instant message with importance set to high ( side note- people still use importance in emails? people still email after they've contacted you another way?  people still email? )

1:44pm - I run "top" on both the webserver and the database server.   ( There isn't any other monitoring since it's a smallish project.   there probably should be.  Will have to get client to pay for that.)  Webserver looks fine.  Database server load is really high, around 5 when it's usually around 0.30.  This is a mysql linux server.

1:45pm - exit "top" and open a mysql command line prompt.

1:46pm - execute "show processlist" in mysql.  A ton of queries show up, all behind one sinister looking one on a new table that's been set up recently.

1:47pm - execute "explain sinister-looking query" in mysql to see how mysql is executing that query.

1:48pm - possible_keys = NULL

1:49pm - Ruh roh.  Execute "alter table add index..."

1:50pm - database working.

1:51pm - database working.

1:52pm - database working.

1:53pm - database done working.  execute "show processlist" to see 2 queries left on stack.

1:54pm - Execute "top" command, load is down to 2.7 and falling. 1.9 now.  0.70 now.

1:55pm - Declare crisis averted via instant message and email.  Wonder again if people still use email.

1:56pm - Assign developer responsible for non-indexed table the task of making sure the schema changes get into source code control.

1:57pm - Go back to regular work.


Write helpful code comments or none at all.

Stumbled onto the following comment in some code I'm working on:

//Code updated by Crappy Developer - 06/22/2011. Fix for Prod problem.

This is a terrible code comment.  I would rather you not even put this comment into the code.

First off, I've replaced the name of the developer with "Crappy Developer" to protect their public persona and since that's how they are now known to me.

The comment "Fix for Prod problem" tells me nothing.  Aren't all problems Production problems?  Otherwise, they're not problems.  What was the actual bug?  Under which circumstances was it reproducible?  How did you fix it?  Any tricky business logic involved here?

And then there's the "//Code updated by.."  You might think that giving the date of the fix and the developer's name is at least a little bit helpful, but all of that can be discovered with "git blame."  This clown probably doesn't know "git blame" exists.  I'll have to send him the man page on that.

So the next time you leave a comment in the code, make sure its worth the time of the next developer that might see it.  And make sure they aren't just going to blog about how terrible your comment was.  You're wasting time with lame code comments, so please stop it.


Using Gmail "Details" link to discover older IP addresses

For one project that I'm working on, they have a very strict firewall setup which restricts SSH access to only internal machines and those temporary machines outside the network that need access ( like if you're working from home ).  So as my IP address changes at home, I need to notify the service that my IP address has changed from A to B.  The service prefers if I can give them both the old address and the new address because they'll take out the old address from the firewall rules and add access for the new IP address ( yes, they are that anal ).  I was keeping this list on a pad by my desk but today I found myself downstairs, away from that pad, so I couldn't find my previous IP address, just the new one.

Fearing that I would have to walk ALL the way upstairs to get that pad, I thought for a few seconds and remembered the "Details" link in the footer of my gmail page.  Clicking "Details" in the footer of gmail will show you the last 10 instances of logins/refreshes to your gmail page.  Sure enough, I was able to find the number 7 entry was from last night and showed my previous IP address.  I copied it into my firewall request and got back to my work.


MySql tip for displaying query results vertically

I have a need at the day job to view mysql records via the mysql command line client.  Some of the tables I'm looking at have 100 to 200 columns so it's pretty annoying to view this data horizontally across the screen.  If you end your queries in the mysql command line client with \G instead of a semicolon, then it will display the results vertically down the page.  Try it out!

SELECT * FROM users WHERE id = 72 \G