Friday, November 20, 2009

Counting in Base 36 with JavaScript and Ruby

Converting from Base 36 to integer in Ruby couldn't make this any easier:

str.to_i(36)

and back to Base 36:
int.to_s(36)

Humorously, JavaScript is very similar, just not as elegant:
parseInt(str, 36)

and back to Base 36:
int.toString(36)

Counting in Base 36 in both languages is an exercise in converting to integer incrementing and then converting back to Base 36:
def inc36(str)
n = str.to_i(36)
n += 1
n.to_s(36)
end

And in JavaScript:
function inc36(str) {
var n = parseInt(str, 36);
n++;
return n.toString(36);
}

Good times! I hope this helps someone. Googling for the answer did not turn up many hits.

Monday, September 14, 2009

VMA + Twitter = New Day for Marketing

I believe that the scandal that Kanye created with Taylor Swift was staged by Mtv. I would guess that Kanye and Mtv were in on it at a minimum, but it is possible that all four (Mtv, Beyonce, Taylor and Kanye) were all in on it, but I doubt it. The Rhapsody commercial that followed ("this is Taylor Swift's time") immediately following the incident seemed a little like an apology.

But the change for marketing came at the end when Mtv showed that they were *measuring* the Twitter traffic and pointed out that the traffic really jumped when Kanye did his thing. Mtv just proved to the rest of the world that if something big enough happens a measurable amount of
chatter will be generated. Granted, few people will get the level of traffic that Mtv generated, but I don't think that makes it any less important for businesses of all sizes.

Sunday, August 23, 2009

Adding commas to numbers

I could not find any good utils out there to add commas to numbers in JavaScript. So I wrote one:



I found a Ruby example a long time ago, and it has served me well. Here is my Ruby comma util:



I love the Ruby version, but I am pretty proud of my JavaScript version as well.

Friday, August 21, 2009

Firefox Prism Page Search

Firefox Prism is nice, but it is killing me. I use it primarily for Gmail. Gmail's keyboard shortcuts don't work from time to time. "gi" or Goto Inbox never works. "y" or Archive works most of the time.

I wish they would open up more of the options because this one is driving me nuts.

Tuesday, August 18, 2009

Google Reader Request: Why am I subscribed to this blog?

I am reading a blog post from a blog that I don't remember subscribing to. I don't remember because I subscribed to it a month ago and they haven't updated since then. I actually prefer this model of posting. Few REALLY GOOD posts because then when you read them it is like you have found a gem that you weren't really looking for.

But then you have people like me, who don't post very often, and when they do they are complain about some feature that an awesome tool on the Internet doesn't have. And you wonder, why did I subscribe to this feed? It is because 2 years ago this guy actually posted something useful and you thought future posts would be good too. HAH! I tricked you!

What is missing from Reader is the ability to find out why I subscribed to a feed in the first place. My first gut reaction to this "need" is a "note" icon next to the name of the poster. When clicking on the icon a note is displayed which I wrote sometime soon after subscribing that tells me why I subscribed. My second gut reaction that was prompted by the disgust of having to write something like that is that Google creates a summary of the blog as a whole.

I doubt any of these are really good ideas, especially since it is so easy to just go back and read past titles and dive into posts for clarification, but it sure would be nifty to not have to research why I subscribed to this random feed. Hopefully the brilliant Reader team can come up with something better that fits the need.

Thursday, July 2, 2009

Daily Inspiration In Passwords

I have been running a little personal experiment that seems to be working. Instead of using some random whack password like 4tUg9giB I use something like Dr1nkL3ssDP. That password would remind me on a daily, and sometimes hourly, basis that I should drink less Dr. Pepper. It meets the criteria of being strong, it is meaningful which means it is easy to remember, and the best part is that it is a reminder of an improvement that you are trying to make at the time.

Also, since you should change your passwords often, you can change your password to help you with your next improvement.


*Note* All passwords used in this post have never been used by me, which should be obvious since I still drink Dr. Pepper like never before.

Wednesday, June 24, 2009

Default Browser in Mac OS X

My current browser is Firefox. I am not a big fan of Safari. I am using Prism until Google Chrome is available for Mac OS X. Whenever I click a link in Gmail (which is a Prism app) it would open up in Safari. Annoying.

So, I opened up Options in Firefox and found the "Check Now" button to set Firefox to be the default browser. Nothing changed. So I went to Options in Safari, to see if I could make it the default browser, thinking I would go back to Firefox and hopefully fix the mess. I was surprised to find a setting that allowed you to choose your default web browser. I selected Firefox. And now links in my Gmail Prism app open up in Firefox.

So, if you are wondering how to make Firefox your default web browser on Mac OS X, just go into Safari's options (on the General tab) and set it. Easy. When you know where to look.