CrapFlingingMonkey.com

A voice for all developers

CrapFlingingMonkey.com

Fidy Says

Qwest Web.Help … Wtf?

22nd September 2008

I was browsing the web, when I was suddenly stupified with a Qwest message in my web browser. Yes, I am a Qwest subscriber, but I (purposely) didn’t install any of their software. Apparently, when an internet request can’t be resolved (the domain doesn’t exist), Qwest wants to hijack the traffic and display ‘custom’ alternatives provided by Yahoo Search. It essentially destroyed any built-in browser behavior. Both IE8 and Firefox give their own ‘custom search results’ for mistyped (or search) urls, why add the ISP to this mix as well?

This is completely preposterous — think of the implications this would have, both on the user experience and on automated scripts. I was completely confused when I reached this — I was browsing the Google App Engine apps, and clicked on a mis-linked app, and was all of a sudden on a Qwest page.

The good news is: there is an opt out. Unfortunately, it’s hidden several layers deep in the UI. I recommend if you see this error message, you call Qwest and express to them your disapproval of this ’service’.

See the image for the search page after I had ‘opted out’, and the request was pending (which having that, in itself, is pretty lame)

posted in Rants | 2 Comments

The SEO Scam

29th July 2008

It seems like every business I work with is paying loads of money for SEO work to be done. While SEO is extremely important for larger web-based companies, it’s just not applicable, to the scale SEO companies want you to think, to smaller companies with a little web presence. However, that’s exactly where ‘SEO Optimization’ companies are focused — they want to make a quick, easy buck off a local company. While this is great for the SEO Company, small businesses are getting ripped off without even knowing it. I’ve tried to narrow down why exactly SEO companies are so successful at gaining customers:

Obscure Definition of Optimization

Nobody knows how Google, or any search engine for that matter, works. Nobody. This is why so many non-techy, quick-to-make-a-buck people are so quick to jump on it — they can say whatever they want, people will listen to them, and nobody can tell them for sure if they are wrong. This is the main reason why most SEO Optimization companies are a couple of ex-Radioshack salesmen, accompanied by their iPhone, attend small business conventions and conferences, suckering in the less tech-savvy SBO.

Non-measurable Results

Any un-accredited SEO firm won’t supply local businesses with the proper tools to analyze how much the SEO optimization really isn’t doing anything for them. With analytics tools such as Google Analytics available, small business owners can see just how much the SEO company really sucks at what they do, and how little difference they really make. SEO companies won’t even direct the SBO towards its presence.

Every Company Wants to Be Number One

This is probably the biggest reason why these companies are so successful — the average SBO wants to get traffic. To do that, they feel like they should be in the top results. However, they don’t feel like paid search is valuable, since it’s most often on a pay-per-click basis. They feel like a single, swift payment to ‘optimize’ their site will yield long-term benefit. After all, they’re paying for it. The fact is, it won’t. Web-based companies allocate vast amounts of resources to keep content fresh and clean. A small website for a local company simply can’t, and shouldn’t keep up. There will always be a place for them, but Amazon will always be in search results before Fred’s Corner Shop (unless, of course, Fred’s Corner Shop was web-based and allocated a lot of time and money toward becoming #1). The month or so (hah, why do they take a month?) that SEO Optimization companies work on a site just doesn’t provide enough to keep a site fresh for even a year.

So, I can’t provide rants without making a few suggestions the SBOs. Hire a kid out of high school, have him put up some meta keywords and description relevant to your site, and make sure links throughout your site have descriptive text instead of just ‘click here’. Also, talk to any business partners and get them to put a link to your site. Most importantly, put some CONTENT on your website. That’s it.

Keep in mind I’m not bagging on SEO for web-based companies. It really is important to make sure certain stuff happens like only one URL per page, rel=”nofollow” attributes are attached with valid links, page weight is low, have a siteindex, don’t have hidden elements with bogus content, [insert BS SEO optimization rule here...].

posted in Rants | 3 Comments

Python Script For Automated Voting

22nd July 2008

This was a python script created by me a while ago to automate voting for a particular user. It may not work anymore, as this script was written quite a while ago. It’s not commented or anything. Here is the original post:

I created a small script to do the clearing of the cookies for you and everything. I tried to have it solve the captcha for you automagically, but it just wasn’t happening (I used ocrad and tesseract, and cleaning the image using imagemagick first). Anyways, you can sit there all day and enter the captchas to keep voting.

A few requirements:
* I wrote it using python 2.5.1. Not sure what other version it will work on.
* PIL required
* mechanize required

both of the required modules are available in the ubuntu repositories. I think that’s all you need, let me know if you run into any troubles.

sudo apt-get install python-imaging python-mechanize

A couple notes about it:
* You don’t have to hit “submit”, you can just press enter
* check the console for updates on whether it was submitted ok or not

Let me know if you want help learning how to set it up.

#!/usr/bin/python
 
# Displays the Captcha from http://basketball.seniorclassaward.com/public/men/vote.aspx?usr=public&gen=M
# so that you can enter it so that Jacee Carroll will win. It automagically keeps track/clears cookies (via mechanize)
# so you can submit more than once every 24 hours
 
# Written by Josh
 
import pygtk, gtk
import StringIO
import ImageFile
import re
from mechanize import Browser
pygtk.require('2.0')
 
# taken from http://www.daa.com.au/pipermail/pygtk/2003-June/005268.html
def image_to_gtkpixbuf(image):
    file = StringIO.StringIO ()
    image.save (file, 'ppm')
    contents = file.getvalue()
    file.close ()
    loader = gtk.gdk.PixbufLoader ('pnm')
    loader.write (contents, len (contents))
    pixbuf = loader.get_pixbuf ()
    loader.close ()
    return pixbuf
 
class Submitter:
 
    def get_image(self):
        # Get the image
        image_url = 'http://basketball.seniorclassaward.com/Captcha.aspx'
 
        image_response = self.br.open_novisit(image_url)
 
        p = ImageFile.Parser()
        while 1:
            data = image_response.read(1024)
            if not data:
                break
            p.feed(data)
        image_response.close()
        return p.image
 
    def __init__(self):
        self.br = Browser()
        self.br.set_handle_robots(False)
        self.url = 'http://basketball.seniorclassaward.com/public/men/vote.aspx?usr=public&gen=M'
        self.br.open(self.url)
 
        self.captcha = self.get_image()
 
    def submit(self, captcha_text):
        captcha_textbox = 'ctl00$DefaultContentPlaceholder$PublicBallot$CaptchaTextBox'
        jaycee_checkbox = 'ctl00$DefaultContentPlaceholder$PublicBallot$BallotCheckBoxList$0'
 
        br = self.br
        br.select_form( name='aspnetForm' )
        br[captcha_textbox] = captcha_text
        br[jaycee_checkbox] = ['on']
 
        response = br.submit()
 
        r = response.read()
        if re.search(r"ATTENTION:\\n([^']+)'", r):
            res = re.search(r"ATTENTION:\\n([^']+)'", r)
            print "Error submitting: " + res.groups()[0]
            return False
        elif re.search(r"COMPLETE:\\n([^']+)'", r):
            res = re.search(r"COMPLETE:\\n([^']+)'", r)
            print "SUCCESS! " + res.groups()[0]
 
        return True
 
class Control:
    def __init__(self):
        self.window = gtk.Window()
        self.window.connect("destroy", gtk.main_quit)
 
        self.submitter = Submitter()
 
        self.box = gtk.HBox(False, 0)
        self.window.add(self.box)
 
        self.submitButton = gtk.Button("Submit")
        self.submitButton.connect('clicked', self.submit)
 
        self.box.pack_start(self.submitButton, True, True, 0)
        self.submitButton.show()
 
        self.text = gtk.Entry()
        self.text.connect("activate", self.submit)
        self.box.pack_start(self.text, True, True, 0)
        self.text.show()
 
        self.set_image(self.submitter.captcha)
        self.box.pack_start(self.image, True, True, 0)
        self.image.show()
 
        self.box.show()
        self.window.show()
 
        self.text.grab_focus()
 
    def set_image(self, image):
        self.image = gtk.Image()
        self.image.set_from_pixbuf(
                image_to_gtkpixbuf(image))
 
    def change_image(self):
        self.box.remove( self.image )
        self.set_image( self.submitter.get_image() )
        self.box.pack_start(self.image, True, True, 0)
        self.image.show()
        return True
 
    def submit(self, evt):
        if self.submitter.submit( self.text.get_text().upper() ):
            # reset the submitter
            self.submitter = Submitter()
            self.change_image()
 
            self.text.set_text('')
            self.text.grab_focus()
 
def main():
    gtk.main()
    return 0
 
if __name__ == "__main__":
    Control()
    main()

This was a just-for-fun thing for me, so I could test out some various web tools for python. I tried simple urllib/urllib2, ClientForm, ClientCookies, and mechanize, and found mechanize to be the most robust and easiest to use, although it was missing out on some features that I thought may be useful (as higher-level modules normally do).

Also, I didn’t like this:

        if re.search(r"ATTENTION:\\n([^']+)'", r):
            res = re.search(r"ATTENTION:\\n([^']+)'", r)

posted in Code | 1 Comment

© 2008 CrapFlingingMonkey.com. All Rights Reserved. Powered by Happy Cat.