Always Get Better

Archive for January, 2009

GoDaddy Hit by DoS Attack

Thursday, January 15th, 2009

Until recently, Always Get Better was hosted by GoDaddy. We moved in November so I could have better control of the various web sites I am running. I can say that I was not unhappy with the service offered by GoDaddy – I just outgrew it.

I guess I got lucky this time. According to cnet, GoDaddy was struck by a denial-of-service attack on the morning of January 14, 2008. There are conflicting reports (naturally) of the exact number of sites affected ranging from several to several thousand.

Get Your Boss to Do What You Want

Wednesday, January 14th, 2009

Communication Overtones asks “What do you do when you are sure you are right about something but your boss won’t listen to you?” Any manager worth his salt knows to surround himself with talent that will compliment his own skills – he will draw from the experts around him to formulate his plans and direction.

Experienced managers also learn to trust their own instinct even when the advice from the experts is contrary. So what do you do when your manager has decided to go with their own judgement even though you are sure they’re wrong. After all, you’re being paid for exactly what you are bringing to the table, so where is the sense in overriding your recommendation?

There are a few ways to proceed:

  1. Insist on your course of action and hold your ground until your manager is forced to reconsider.
  2. Back down – the manager is in effect your client, and you can lead a horse to water but not necessarily get them to drink.
  3. Plant the seed.

Plant the Seed
By “planting the seed”, I mean be subtle about your course of action. Let your manager know what you are thinking and leave it at that. It will get at them subconsciously until they come at you weeks later with a great new idea that sounds suspiciously like the one you had brought forward.

Be Patient
When you plant seeds, you need to be aware that it takes time for your point of view to enter your boss’ mindset. Depending on the concept and its complexity, it could take months for this passive approach to take effect. You could say this technique only works for non-critical ideas, but that isn’t necessarily true – it only works if you have enough patience to let your course of action sit.

Let It Go
Because this technique is a passive method for subordinates to get what they want out of higher-ups, you need to be prepared to let your idea get overridden. If your manager truly sees fit not to invest in your idea and you can’t make them come around to your point of view then your two options are either to put your ego aside and accept it so you can move on, or find another manager/company who want to run with it.

W3C MobileOK Checker

Tuesday, January 13th, 2009

The mobile web is finally starting to be taken seriously. Trying to access the Internet on a 2″ screen is torturous at best; only rare gems like GMail actually bother to display content optimized for hand-held devices. Forget trying to access JavaScript – or worse, Flash – menus. Any image wider than 100 pixels causes the text-wrapping to fail forcing the user to scroll vertical and horizontally.

Early in December 2008, the W3C announced a new MobileOK Checker addition to their excellent suite of quality assurance tools that include the famous CSS and HTML validators.

Photo by Matt (Tj)

Photo by Matt (Tj)

The MobileOK checker reviews the markup and overall page content against a set of basic tests created for mobile platforms. Always Get Better scores 81% – not bad considering the site is essentially an out-of-the-box WordPress with no particular optimizations in place.

RIAA Changes Tactics

Monday, January 12th, 2009

The RIAA has had an interesting few years. Their business model is dying and they have been fighting to save it by suing evil music thieves like single mothers on disability pay, deceased grandmothers and, most heinous of all, families who do not own computers.

Now the Association has backed off slightly and switched to a more cost-effective method; at least, they have offloaded the burden of identifying music pirates to the ISPs that host them. Rather than issue subpoenas to service providers for the names of their downloading subscribers, the RIAA has switched to sending lists of IP addresses and evidence to those ISPs it has partnered with. The ISP can then take measures into its own hands by:

  • sending warning emails
  • sending warning letters
  • reducing bandwidth/speed of violators’ Internet connection

It works for everyone except Internet users – the RIAA gets counter-sued less because it is no longer serving papers to innocent bystanders victimized by faulty IP records or the delays between court orders and identifying information (leading, for example, to charges against families who don’t even own a computer when in fact the former occupants of their home was involved in downloading). The ISPs get an excuse to rid themselves of customers who make full use of the bandwidth and network resources they are paying for.

I recently heard an argument that people who download or otherwise pirate a particular piece of software or music are unlikely to have purchased it at all therefore prosecuting them is pointless since they would never have been a customer anyway – the creator of the downloaded content hasn’t “lost” money. Where I come from, if we aren’t willing to pay for something for any reason idealogical or otherwise, we simply do not own it – we don’t try to source it for free. I’m not defending the RIAA, I just don’t understand the value derived from downloading libraries of music.

Python file upload

Friday, January 2nd, 2009

I recently needed to handle file uploads from a Flash form post using CGI and Python. I made two discoveries:

  1. Python’s CGI library ignores query string variables on POST requests.
  2. After you’ve done it once, working with POST variables whether uploaded files or otherwise is dead simple!

Here is the file I came up with:

[source:python]
#!/usr/bin/python
import cgi, sys, os

UPLOAD_DIR = “/home/user/uploads”

postVars = cgi.FieldStorage()

if postVars.has_key(“myFile”):
fileitem = postVars[“myFile”]

# If myFile doesn’t contain a FILE, exit
if not fileitem.file:
return

# Strip file extension
(name,ext) = os.path.splitext( fileitem.filename )

# If a binary file, ensure write flags are binary
if ext == “.jpg” or ext == “.png” or ext == “.gif”:
ioFlag = “wb”
else:
ioFlag = “w”

# Save file data to disk stream
fileObj = file(os.path.join(self.path, fileitem.filename),ioFlag)
while 1:
chunk = fileitem.file.read(100000)
if not chunk: break
fileObj.write(chunk)
fileObj.close()
[/source]

Bonus points for checking for and creating a new directory to store the uploaded file in, if needed.

Create Directory in Python

Thursday, January 1st, 2009

I needed to learn how to create directories using Python and found this great resource (digression: check out this author’s page headers – way cool!)

Although I didn’t really add anything new to the code, I ended up creating the following commented function which I share here in case it helps more users to understand.

[source:python]
# If directory (path) doesn’t exist, create it
def createPath(path):
if not os.path.isdir(path):
os.mkdir(path)

# Example of Windows file path
createPath( “C:\\Python\\myNewDirectory” )

# Example of Linux file path
createPath( “/home/username/myNewDirectory” )
[/source]