A Little Focus Goes A Long Way: Tweet, Like and Plus Counts Done!
by Mike Levin SEO & Datamaster, 02/07/2012
Yesterday was very good productivity-wise. I got focus time at work, then a bit after work before going to bed, then even more after the wife and baby fell asleep. It was the first night in a week I was not trying to catch up on my sleep to fight a lingering cold. I feel the cost of it this morning. I’m not 30 anymore. I am quite afraid there is an inverse relationship between health and the ability to get work done.
Anyway, it is becoming clear how important getting back into the flow or the zone quickly—like throwing a switch—really is. Those scraps of time spent on distractions like email and web surfing when you actually have the time to focus is profoundly damaging, because it’s a double-whammy hit. You lose that precious time you could have spent focused, and add stress over it during the time you can’t afford to focus.
Anyway, I achieved some tricky architectural goals in my app yesterday and this morning. I have 2 new types of boundaries or limits that I can use to moderate usage and reduce server-load and abuse of the system. First, I made it so that you only ever process 25 rows ever with a bookmarklet click. That actually is both types of limits: 1st on crawls, and 2nd type on question-mark replacement. I could enable 100-page crawls, but only 25 question-mark replacements per click, or visa versa.
I have also dramatically simplified the questions that pop up when you start a crawl so that your experience is instant and positive.
Today, I am trying to make the WordPress daily journal experience a little less painful. I’m used to writing in either vim or Google Docs, both of which have dramatically different, but distinctly useful advantages. The default WordPress editor is masochistic by comparison, so I went looking for a way to make it more pleasant. First I tried the Visual Editor Font Size plug-in, but it only made the font-size bigger in an already minuscule-window, and when you go to the “Just Write” full-screen mode, you lose the larger font-size you just set. Well, I kept searching, and found Cleaner WordPress Editor, which I’m using right now, and so far appears to precisely fill the bill. I’m using a much larger, much more visually attractive font in the WordPress editor, and it got rid of an extra column, making the window MUCH bigger. This not belongs in this blog-post regarding focus, and REGAINING of focus, because I use the journal-writing as a sort of descent-into-focus, forcing out all distraction, forcing my conscious mind to focus on the work-at-hand, and the work-at-hand ONLY, with the hope that I transition into that flow/zone state.
Okay, I only have a small window left this morning for advancement. It’s already 10:40AM, and much of the morning was lost on a combination of email and distractions. FOCUS! FOCUS! FOCUS!
I have a meeting with the big-boss coming up later today, and once 12:30 hits, I’m not going to be able to look back at the code before talking and presenting to Brian. I would like to have question-mark replacement. The alternative work to focus on is splitting the behavior for internal company people versus the public, but that can come later. That will have no impact on this meeting. Having question-marks not properly replaced will. How quickly can I slam out these functions? It is the same thing that all these social media buttons are doing throughout the Internet, and implementing should be trivial—especially if I can find Python code examples!
Well, getting the tweet count couldn’t be simpler. It’s an http get request, like:
…so, the Python function to implement this should be:
…Reva just helped me look at a Drupal PHP module that does Google AdWords keyword volume lookups. I’d love to get that in, but I’m sure we’re going to reach quota’s on an anonymous login, so I’m going to make that a tomorrow project. Just keep note of where those files are.
…okay, back to the Twitter Tweet count function.
def tweets(url): resp = urllib2.urlopen(‘http://urls.api.twitter.com/1/urls/count.json?url=’ + url) adict = json.load(resp) return adict[‘count’]
Ridiculously simple! Should have done that long, long ago!
Facebook is just as easy:
Ugh, the Google+ API was way more complex than the Twitter and Facebook. The unofficial API that’s out there is a strange blend of the http GET and POST method, plus using JSON data on the post, with a special application/json Content-Type. The shape of the JSON object that you submit is fairly complex, as is the JSON response object that you get back. Ugh! Echo’s of the nightmare AdWords API. Anyway, I got it done, and my Tiger application will be able to go to the public with tweet counts, like counts, and plus counts, all built-in, and the first exposure to question-mark replacement after an initial crawl.
The meeting with the big-wig was pushed off until Friday, which is a major bummer, because I was actually ready for it today with the public-facing features and modified behavior all ready. Also, Fridays I very frequently work from home as my focus-Fridays, which is what made this project possible in the first place. But that will give special emphasis to the importance of the meeting. I just hope it is not cancelled on Friday.