Monthly Archives

September 2012

Get Top results in fuzzy matches with Python

There is usually some scenario that inevitably comes up for me every couple years where I need to see if a phrase or word matches comparably with another one. However, there is the unfortunate circumstance (especially when dealing with thousands and thousands of possible matches) that the best match is not always the correct match.

So I hacked together this basically ugly set of functions to ultimately do one thing, return the top 3 results and their match percentage.

A screenshot of Bluehost's View Temporary Site message

Bluehost View Temporary Site Bug

Bluehost

Love it or hate it (or possibly overwhelming indifference) it is around and here to stay. I’ve used many different services and while I am sure there are many horror stories (no matter what hosting company you go with) I’ve only had several issues with them over the past few years.

I’ve got several accounts with them, have gotten other associates of mine to use them as well, and run more than 40 different websites across the strata. Once in a while, something particularly odd or annoying happens.

A screenshot of Bluehost's View Temporary Site message
Seen this message before?

I only use them for shared hosting, for more serious en-devours I use the cloud (particularly, AWS) as I’m sure I’ve expressed before.

Like many hosting services they go down sometimes. Sometimes its only for 20 minutes because some fool who ran a bad runaway script with a forever loop, sometimes its for a few hours because their daemons became unstable. Whatever, downtimes are not a big issue, they happen rarely (perhaps a few times a year, sometimes a couple times within a single week, and other times not for an 8 or 10 month stretch).

I don’t have a problem with it, in fact I fully understand how that kind of thing can happen.

What drives me crazy is when strange anomalies crop up. For example, sometimes their DNS zone files will get “reset”. You’ll notice this in particular when you have multiple domains pointing at different IP addresses.

When this happens, the wrong IP addresses get reported to some DNS servers temporarily and dish you out an IP address that, while it belongs to Bluehost, is not the correct IP address for your domain.

What happens then? Lets say your primary domain is server.com and you have an addon domain called server2.com. Your IP address for server.com is 123.123.123.100 and for server2.com its IP address is 222.222.222.200. Well one day you try going to server2.com and instead get sent to 123.123.123.199 (and when you check your DNS zone editor, you’ll see the address has been set to 123.123.123.100) then you see the infamous Bluehost message View Temporary Site for about two nanoseconds and then you get sent to server2.server.com

What do you need to do?

Well, you need to flush your DNS cache. I also recommend you stick to using Google’s public DNS server, but that’s up to you (8.8.8.8 and also 8.8.4.4 are available)

How to Logout of Amazon Web Services

This may seem like a crazy thing to post about, however, there is this extremely annoying bug that occurs if you login incorrectly to Amazon Web Services, whether you are trying to access your EC2 or whatever.

Let me start from the beginning, let’s say you have a personal Amazon account (not a far stretch of the imagination I hope), and let’s say that you have a separate account with which you use to access AWS (also, not really straying from the norm here). Now, lets say you need to enter the AWS Console for some administration and it asks you to login.

Then you make a blunder and accidentally login as your normal self.

Well, now you’ve done it. You are re-directed to a page that states you have not yet signed up for the Amazon web services and would you pretty please like to sign-up? Well of course you don’t since you’re already signed up with another account.

Then you try to log out so you can log in with the right account, and that is when your nightmare begins.

Maybe you try going to just the normal www.amazon.com site and logging out that way… nope, no good.

You try looking around the AWS pages… nothing, just more “Sign Me Up Scotty!”.

Then you start sweating and realize you might have to clear your cookies; maybe you don’t sweat, maybe you don’t care – but if you’re like me, you don’t like to clear your cookies on your browser. You like your cookies.

So you have the option of opening up another different browser, perhaps Firefox instead of Chrome this time and logging in that way.

Well of course you can login, navigate to the console and you can logout from there.

Well there’s the rub. You can use that link to log yourself out on the other browser of course.

Now occasionally it may slip your mind to copy that link and bookmark it for future use. Well no longer! I am here to give you that magical URL link so you can bookmark it and treasure it and love it.

https://console.aws.amazon.com/ec2/logout!doLogout

There, do you feel better and all warm and fuzzy?

I do.