…does nerdy things.

Poor Man’s Continuous Integration With Django/Python

Filed under: Work — Bryan on Dec 20th, 2011 @ 4:32 pm

Don’t feel like setting up Jenkins you lazy bum? Fine. Try this on for size: use a Github service hook to ping a Django view which runs a bash script out of process. Sound like a bad idea? Probably, but bad is a relative thing you see… here’s how:

  • Gonna need the at command. Do that now: apt-get install at
  • Gonna need two bash scripts: delay_deploy.sh and deploy.sh
  • Gonna need a view to receive the hook

First, let’s do the deploy.sh script:

#!/bin/bash
 
cd /path/to/repo
git pull origin master
service apache2 restart
# or anything else you might need

Second, let’s do the delay_deploy.sh script:

#!/bin/bash
 
at -f '/path/to/deploy.sh' now

If you have a standard Django/Apache/mod_wsgi setup, we will have a problem running this script from a view because Apache is running under a non-root user (as it should be). Usually it is under the user www-data, but you can double check with ps aux | grep apache. The same holds for Nginx, lighttpd, etc…

Third, let’s permit www-data (or whoever) to sudo delay_deploy.sh (which will running a static, out of process command via at). This requires editing the /etc/sudoers file, so nano /etc/sudoers and add this line:

www-data ALL= NOPASSWD: /path/to/delay_deploy.sh

Now, www-data can run delay_deploy.sh as root, but only delay_deploy.sh and nothing else. This is much safer that allowing www-data to run /usr/bin/at or something more generic. Also, don’t forget to run chmod +x on both scripts.

The reason you can’t just hit the deploy.sh script is pretty simple: the server will wait on the command to finish, but the command will kill the server. Not good. So our two script method fixes this: the delay script triggers an out of process deploy script. Also, its good to keep sudo power very, very specific.

Fourth, let’s work on that view. I’ll leave it up to the reader to decide where to put it and how to secure it (hint: maybe check for a regularly changed secret GET param key and restrict to Github’s IP address):

from django.views.decorators.csrf import csrf_exempt
 
@csrf_exempt
def do_deploy(request):
    """
    Smile. Life's just gotten easier.
    """
    import simplejson
    import subprocess
 
    from django.http import HttpResponse, Http404
 
    if request.method != 'POST':
        raise Http404
 
    if not 'payload' in request.POST.keys():
        raise Http404
 
    # might raise 404 if secret GET key isn't good 
    # or requesting IP isn't whitelisted 
 
    payload = simplejson.loads(request.POST['payload'])
 
    out_json = {'status': 'failed'}
 
    # only trigger if master branch receives a commit
    if payload['ref'] == 'refs/heads/master':
        # DO NOT use any user input when calling scripts, as
        # this is naughty enough already
 
        subprocess.call('sudo /path/to/delay_deploy.sh', shell=True)
        out_json['status'] = 'success'
 
    return HttpResponse(simplejson.dumps(out_json), content_type='application/json')

Fifth, and finally, set up your Post Receive Hook or custom Service Hook with Github to hit the URL for the above view. If you need to debug, check out hurl.it for some handy dandy POST testing action.

Another warning: letting HTTP requests trigger sudo’d events is very, very dangerous. While as far as I know, this particular method is mostly safe, it most certainly isn’t best practices. Light me up in the comments.

Python and the DocuSign API

Filed under: Work — Bryan on Nov 4th, 2011 @ 10:36 am

SOAP is a bit foreign to me (JSON + good documentation seems so much easier), but I finally managed to authenticate DocuSign with a SOAP client in Python. The code below assumes you have a developer account all set up and have suds, the Python SOAP library, installed:

from suds.client import Client
 
class DocuSign(Client):
    """
    Create a preloaded suds client.
    """
    def __init__(self, username, password, integrator_key, demo=False):
 
        url = 'https://%s.docusign.net/api/3.0/schema/dsapi.wsdl' % 'demo' if demo else 'www'
        location = 'https://%s.docusign.net/api/3.0/dsapi.asmx' % 'demo' if demo else 'www'
        auth = {
            'X-DocuSign-Authentication': '<DocuSignCredentials>' +
                ('<Username>%s</Username>' % username) +
                ('<Password>%s</Password>' % password) +
                ('<IntegratorKey>%s</IntegratorKey>' % integrator_key) +
            '</DocuSignCredentials>'}
 
        super(DocuSign, self).__init__(url, location=location, headers=auth)
 
client = DocuSign(
    username='me@example.com', 
    password='secret', 
    integrator_key='FOOO-6deb3ff9-5479-1241-9287-11f4919c7417', 
    demo=True)
 
print client.service.Ping()

Just follow the DocuSign documentation and suds documentation!

Chasing Those Long Tail Keywords

Filed under: Work — Bryan on Oct 23rd, 2011 @ 6:34 pm

With Snapier.com, my early stage startup, we’re betting that a large fraction of our future customers will find us from organic searches. However, we know better than to bet the house on a single, high value keyword like API integration. So, we’re trying to think a little like Hacker News’ resident SEO expert Patrick McKenzie (patio11):

…go for long tailed keywords, and make sure you have a scalable system to create the content.

The solution is our directory of API integrations, the Zapbook. We’ve built a quick and dirty system of categorizing what we are calling “snaps”, little pieces of content that fall into categories that encompass popular web services. The hope is that we can build up a powerhouse of extremely useful (if narrow) solutions that will rank highly across very specific long tail searches.

Some things we spent some time thinking about:

Common sense URL structure:

We wanted to be sure that we wouldn’t be shooting ourselves in the foot if we decide to make changes later on down the road. So we kept URL structure really simple and obvious. Ideally, we should be able to restructure the way a user searches and navigates the Zapbook without altering the URLs Google has indexed.

Simplified content creatation:

Our Snapbook is no good without content, so we made it super simple to manually add small pieces of content as we go along the path of building our company. Convenience is key. Eventually, it should be trivial to let users augment content as they use the site, or have services like Textbroker automatically handle this.

Measurable value of content:

We can track every user that signs up after landing on a piece of deep content. From that, we can calculate the value of an average (or specific) piece of content, allowing us to justify spending more or less time or money on content creation.

20 Minutes With Stripe and Django

Filed under: Work — Bryan on Oct 11th, 2011 @ 12:14 am

If you use this, make sure you are PCI compliant, otherwise explore stripe.js…

In case you haven’t heard, payment gateways, merchant accounts and all that jazz are now obsolete thanks to Stripe. Stripe offers a simple to set up payment service with an absolutely wonderful API. Instead of comparing and contrasting dozens of merchant accounts and struggling with arcane API’s, with Stripe you input your name, address, SSN, and bank account information (among a few other things) and… you’re done.

In addition to a sane API, they offer great libraries for PHP, Python and Ruby along with wonderful documentation. Kudos to the developer team at Stripe, they’ve really outdone themselves.

Enough praising Stripe, let’s learn how to integrate it with Django. This should only take 20 minutes or so, and you shouldn’t have a problem bending this method to your will.

Things we need:

  1. Some way to store the sale in our database.
  2. A form that will validate the card details.
  3. A template to display the form with proper, human readable errors.
  4. The Stripe Python library:
    sudo pip install --index-url https://code.stripe.com --upgrade stripe

Luckily, we need not start from scratch on everything, as there is a very useful snippet for a credit card form we can start with. With that in mind, let’s lay out our project. I’ve decided to create a sales app that will contain: a Sale model, a SalePaymentForm, and a single view for displaying and parsing the form. First up, the Sale model in mystore/sales/models.py:

from django.db import models
 
import settings
 
class Sale(models.Model):
    def __init__(self, *args, **kwargs):
        super(Sale, self).__init__(*args, **kwargs)
 
        # bring in stripe, and get the api key from settings.py
        import stripe
        stripe.api_key = settings.STRIPE_API_KEY
 
        self.stripe = stripe
 
    # store the stripe charge id for this sale
    charge_id = models.CharField(max_length=32)
 
    # you could also store other information about the sale
    # but I'll leave that to you!
 
    def charge(self, price_in_cents, number, exp_month, exp_year, cvc):
        """
        Takes a the price and credit card details: number, exp_month,
        exp_year, cvc.
 
        Returns a tuple: (Boolean, Class) where the boolean is if
        the charge was successful, and the class is response (or error)
        instance.
        """
 
        if self.charge_id: # don't let this be charged twice!
            return False, Exception(message="Already charged.")
 
        try:
            response = self.stripe.Charge.create(
                amount = price_in_cents,
                currency = "usd",
                card = {
                    "number" : number,
                    "exp_month" : exp_month,
                    "exp_year" : exp_year,
                    "cvc" : cvc,
 
                    #### it is recommended to include the address!
                    #"address_line1" : self.address1,
                    #"address_line2" : self.address2,
                    #"daddress_zip" : self.zip_code,
                    #"address_state" : self.state,
                },
                description='Thank you for your purchase!')
 
            self.charge_id = response.id
 
        except self.stripe.CardError, ce:
            # charge failed
            return False, ce
 
        return True, response

A couple things to point out before moving on. One, we initialize the Stripe API in the __init__ method and use the API key you should set in settings.py as STRIPE_API_KEY = “somelongstripefromstripe”. Two, we wrap the actual charge API call in a try/except block so we can catch any errors Stripe might throw. Notice that we return that error as it is important to show the real, human readable error to the end user. You’ll see how in a second. Three, we make sure to set the charge_id on the mode, but we’ll need to remember to call the save() method.

Next, we need a form to handle the user’s data. Luckily, that snippet from before will come in handy, as the only thing we need to do is switch out the payment implementation. So, without further ado, here is the SalePaymentForm in mystore/sales/forms.py:

from datetime import date, datetime
from calendar import monthrange
 
from django import forms
 
from sales.models import Sale
 
class CreditCardField(forms.IntegerField):
    def clean(self, value):
        """Check if given CC number is valid and one of the
           card types we accept"""
        if value and (len(value) &lt; 13 or len(value) &gt; 16):
            raise forms.ValidationError("Please enter in a valid "+\
                "credit card number.")
        return super(CreditCardField, self).clean(value)
 
class CCExpWidget(forms.MultiWidget):
    """ Widget containing two select boxes for selecting the month and year"""
    def decompress(self, value):
        return [value.month, value.year] if value else [None, None]
 
    def format_output(self, rendered_widgets):
        html = u' / '.join(rendered_widgets)
        return u'<span style="white-space: nowrap;">%s</span>' % html
 
class CCExpField(forms.MultiValueField):
    EXP_MONTH = [(x, x) for x in xrange(1, 13)]
    EXP_YEAR = [(x, x) for x in xrange(date.today().year,
                                       date.today().year + 15)]
    default_error_messages = {
        'invalid_month': u'Enter a valid month.',
        'invalid_year': u'Enter a valid year.',
    }
 
    def __init__(self, *args, **kwargs):
        errors = self.default_error_messages.copy()
        if 'error_messages' in kwargs:
            errors.update(kwargs['error_messages'])
        fields = (
            forms.ChoiceField(choices=self.EXP_MONTH,
                error_messages={'invalid': errors['invalid_month']}),
            forms.ChoiceField(choices=self.EXP_YEAR,
                error_messages={'invalid': errors['invalid_year']}),
        )
        super(CCExpField, self).__init__(fields, *args, **kwargs)
        self.widget = CCExpWidget(widgets =
            [fields[0].widget, fields[1].widget])
 
    def clean(self, value):
        exp = super(CCExpField, self).clean(value)
        if date.today() &gt; exp:
            raise forms.ValidationError(
            "The expiration date you entered is in the past.")
        return exp
 
    def compress(self, data_list):
        if data_list:
            if data_list[1] in forms.fields.EMPTY_VALUES:
                error = self.error_messages['invalid_year']
                raise forms.ValidationError(error)
            if data_list[0] in forms.fields.EMPTY_VALUES:
                error = self.error_messages['invalid_month']
                raise forms.ValidationError(error)
            year = int(data_list[1])
            month = int(data_list[0])
            # find last day of the month
            day = monthrange(year, month)[1]
            return date(year, month, day)
        return None
 
class SalePaymentForm(forms.Form):
    number = CreditCardField(required=True, label="Card Number")
    expiration = CCExpField(required=True, label="Expiration")
    cvc = forms.IntegerField(required=True, label="CCV Number",
        max_value=9999, widget=forms.TextInput(attrs={'size': '4'}))
 
    def clean(self):
        """
        The clean method will effectively charge the card and create a new
        Sale instance. If it fails, it simply raises the error given from
        Stripe's library as a standard ValidationError for proper feedback.
        """
        cleaned = super(SalePaymentForm, self).clean()
 
        if not self.errors:
            number = self.cleaned_data["number"]
            exp_month = self.cleaned_data["expiration"].month
            exp_year = self.cleaned_data["expiration"].year
            cvc = self.cleaned_data["cvc"]
 
            sale = Sale()
 
            # let's charge $10.00 for this particular item
            success, instance = sale.charge(1000, number, exp_month,
                                                exp_year, cvc)
 
            if not success:
                raise forms.ValidationError("Error: %s" % instance.message)
            else:
                instance.save()
                # we were successful! do whatever you will here...
                # perhaps you'd like to send an email...
                pass
 
        return cleaned

I’ve removed a few of the bits from the snippet, mainly to simplify things, as we don’t need to filter out Discover cards or the like. The primary thing to notice is how if the charge isn’t successful, we raise a ValidationError and pass in the message from Stripe’s exception. This will allow us to display it as a normal error on the form. But before we we move on to the view, notice how we initialize a blank Sale? The charge() method doesn’t require a saved model instance, but we make sure to save it if it is successful. It might be more appropriate to make this a ModelForm, but for now, it works.

Let’s take a look at mystore/sales/urls.py:

from django.conf.urls.defaults import *
from sales import views
 
urlpatterns = patterns('',
    url(r'^charge/$', views.charge, name="charge"),
)

Nothing fancy here. Let’s take a look at and mystore/sales/views.py:

from django.shortcuts import render_to_response
from django.http import HttpResponse
from django.template import RequestContext
 
from sales.models import Sale
from sales.forms import SalePaymentForm
 
def charge(request):
    if request.method == "POST":
        form = SalePaymentForm(request.POST)
 
        if form.is_valid(): # charges the card
            return HttpResponse("Success! We've charged your card!")
    else:
        form = SalePaymentForm()
 
    return render_to_response("sales/charge.html",
                        RequestContext( request, {'form': form} ) )

Once again, nothing very fancy here either. Let’s take a look at templates/sales/charge.html:

<html>
<head>
  <title>Stripe Example</title>
</head>
<body>
 
<div class="wrapper">
 
  {% for key, value in form.errors.items %}
      <p>{{ value }}</p>
  {% endfor %}
 
  <form action="" method="post">{% csrf_token %}
 
    {% for field in form %}
      <div class="field-wrapper">
 
        <div class="field-label">
          {{ field.label_tag }}:
        </div>
 
        <div class="field-field">
          {{ field }}
          {{ field.errors }}
        </div>
 
      </div>
    {% endfor %}
 
    <br>
    <input type="submit" value="Charge Me!" />
  </form>
 
</div>
 
</body>
</html>

This should come as no surprise to you, but there isn’t much going on here. Probably the only slightly odd thing is the for loop over the form.errors dictionary, as this is where we will grab the ValidationError placed on the form itself as we caught it during the charge phase.

Besides for setting up the standard Django stuff like the database and admin bits (mystore/sales/admin.py), that pretty much covers it.

This is a method similar to what we’re using on our new product Zapier, so go grab the code off of GitHub!

Setting up Ubuntu 10.04 with Apache, memcached, ufw, MySQL, and Django 1.2 on Linode

Filed under: Work — Tags: , , , , , , — Bryan on May 24th, 2010 @ 3:40 am

Call me a sucker, but I love a good server setup as much as the next guy, I just have a little trouble setting it up sometimes. So I thought I’d walk through my process for setting up all this Django goodness on what is basically a LAMP setup (where “P” stands for Python!) with a few extras like memcached and ufw. We’ll get to a level of general security, but not prefect security.

Also, we’ll keep this well within the 360 megabytes allotted for the cheapest Linode. Before we get underway, just create a new Linode with Ubuntu 10.04 (32-bit), set your password. Alright, let’s get going!

Initial Setup
First thing to do is log in via the standard SSH on your Linode’s IP, port 22, and with root as your username. We’ll change the login user away from root, but for now, this will do (plus we can skip all that sudo stuff). First, let’s update and upgrade the system.

apt-get update &amp;&amp; apt-get upgrade

Awesome, you should be 100% up-to-date. Now its time to get to the fun part, let’s install some of the software we’ll be using! Below are the commands to install Apache, MySQL, mod_wsgi and the python MySQL bindings, as well as memcached and ufw. If you have any prompts for passwords, you know what to do! Just remember what you set them as.

apt-get install build-essentials
apt-get install apache2 apache2.2-common apache2-mpm-worker apache2-threaded-dev libapache2-mod-wsgi python-dev python-setuptools
apt-get install mysql-server python-mysqldb
apt-get install memcached libmemcache-dev
apt-get install ufw

Really quickly, let’s get python-memcached installed (alternatively, if you need some raw speed, look up cmemcached or python-libmemcached). This will take a few steps…

# create and enter a temp dir in /home
cd /home && mkdir downloads &amp;&amp; cd downloads
# get django 1.2 tar and untar it
wget -O pymem.tar.gz ftp://ftp.tummy.com/pub/python-memcached/python-memcached-1.47.tar.gz &amp;&amp; tar -zxvf pymem.tar.gz
# enter the directory and install
cd python-memcached-1.47 &amp;&amp; python setup.py install

Now its time for Django! Django 1.1.1 is a lot easier to install than Django 1.2.4:

# install django 1.1.1
apt-get install python-django

But let’s say we need Django 1.2.4: its gonna take a few more commands to make this happen. Watch out for that last command, anytime you use rm -r you can run into real trouble if you mistype (but we’re not production yet so no worries, right?).

# enter the downloads directory in /home
cd /home/downloads
# get django 1.2 tar and untar it
wget -O django124.tar.gz http://www.djangoproject.com/download/1.2.4/tarball/ &amp;&amp; tar -zxvf django124.tar.gz
# enter the directory and install django 1.2
cd Django-1.2.4 &amp;&amp; python setup.py install
# strictly optional delete of downloads directory, be careful with rm -r
cd /home &amp;&amp; rm -r downloads

Actual Configuration
Let’s work backwards, we’ll start with the easy stuff and work our way to the more complicated things. Let’s get ufw and the SSH port out of the way first. Go ahead and pick a number between 1024-8000ish for the port we will eventually; I chose 5555 but you can should use something else.

# turn on ufw
ufw enable
# log all activity (you'll be glad you have this later)
ufw logging on
# allow port 80 for tcp (web stuff)
ufw allow 80/tcp
# allow our ssh port
ufw allow 5555
# deny everything else
ufw default deny
# open the ssh config file and edit the port number from 22 to 5555, ctrl-x to exit
nano /etc/ssh/sshd_config
# restart ssh (don't forget to ssh with port 5555, not 22 from now on)
/etc/init.d/ssh reload

Now that you have ufw and SSH locked down, its time to move onto setting up memcached (which is super easy). We’ll just run it as root and be done with it (you will need to repeat this command on each boot):

# replace 24 with however many megabytes of cache is appropriate
memcached -u root -d -m 24 -l 127.0.0.1 -p 11211

Alright, with that out of the way, let’s get MySQL nice and tight. The standard install of MySQL can suck up a lot of memory, so we’ll suggest a few ways to lighten the load:

# open mysql conf and set these settings:
#    key_buffer = 16k
#    max_allowed_packet = 1M
#    thread_stack = 64K
nano /etc/mysql/my.cnf
# restart mysql
/etc/init.d/mysql restart

Now let’s get a new user setup and leave behind this root nonsense for safety’s sake. Your username is going to be bobby for this example. Replace bobby everywhere if you want something different.

# create bobby, you'll be asked to set the password and such
adduser bobby
# edit the ssh file and add the line: AllowUsers bobby
# ctrl-x to exit and save
nano /etc/ssh/sshd_config
# restart ssh
/etc/init.d/ssh reload
# log out and login as bobby from now on!

It’s time for the nitty gritty stuff: setting up Apache and mod_wsgi with Django for the domain you own called examplesite.com (creative, I know). We need to make a public_html folder in bobby’s home folder and place a folder called examplesite.com (as well as a few more). We’ll do that first.

cd /home/bobby/
mkdir public_html
mkdir public_html/examplesite.com
mkdir public_html/examplesite.com/logs
mkdir public_html/examplesite.com/private

Right now you should place your Django project into the public_html/examplesite.com folder. For example, if the project is housed in demoproject (eg: demoproject/manage.py, demoproject/urls.py, etc.) you’ll want it placed ALA public_html/examplesite.com/demoproject. Time to get the Apache config files up and running. Here we go!

cd /home/bobby/public_html/examplesite.com/demoproject/
mkdir apache
nano apache/demoproject.wsgi

First, in the demoproject.wsgi file you should paste and save:

import os, sys
 
apache_configuration= os.path.dirname(__file__)
project = os.path.dirname(apache_configuration)
workspace = os.path.dirname(project)
sys.path.append(workspace)
 
sys.path.append('/usr/lib/python2.5/site-packages/django/')
sys.path.append('/home/bobby/public_html/examplesite.com/demoproject')
 
os.environ['DJANGO_SETTINGS_MODULE'] = 'demoproject.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

We’re so close, let’s get the other Apache files setup. Oh, and don’t worry about that www-data thing just yet, we’ll get to that in a second.

# give the www-data user/group permission on public_html
sudo chown -R www-data:www-data /home/bobby/public_html
sudo nano /etc/apache2/sites-available/examplesite.com

Place the text below in the examplesite.com config file (remember the www-data part from the last command?). You can modify the threads and processes numbers to suit your moods and load.

    #Basic setup
    ServerAdmin your@email.com
    ServerName www.examplesite.com
    ServerAlias examplesite.com
 
        Order deny,allow
        Allow from all
 
    LogLevel warn
    ErrorLog  /home/bobby/public_html/examplesite.com/logs/apache_error.log
    CustomLog /home/bobby/public_html/examplesite.com/logs/apache_access.log combined
 
    WSGIDaemonProcess examplesite.com user=www-data group=www-data threads=20 processes=2
    WSGIProcessGroup examplesite.com
 
    WSGIScriptAlias / /home/bobby/public_html/examplesite.com/demoproject/apache/demoproject.wsgi

A few more final things:

sudo a2ensite examplesite.com
sudo /etc/init.d/apache2 restart

Time to admire your handiwork.

Congrats! You’re all set up and ready to roll! Nothing can stop you now! Here’s a neat command to measure your memory usage as mine rarely gets over 160mb. This gives lots of room for growth as you can always increase the memcached size, MySQL settings, and Apache/mod_wsgi instances/threads.

# measure your memory usage in kb
ps aux | awk '{print $3"\t"$6"\t"$11;sum+=$6;cpu+=$3} END {print "Total RSS", sum, "\nTotal CPU", cpu}'

Also, under Ubuntu 10.04 (Lucid), Python’s site-packages is now called dist-packages. Just a FYI.

Python Crossword Puzzle Generator

Filed under: Boring Stuff,Work — Tags: , — Bryan on Apr 10th, 2010 @ 4:18 pm

As my next miniature project will be a crossword puzzle maker for teachers that will make random generation of crossword puzzles and word search puzzles, I thought I’d share the code I developed to create these puzzles on the fly. While I was working on it, I ran across many different scripts to accomplish this, but none of them were in my most favorite of languages: Python. Besides, I’d like the code to fit snugly in my web framework of choice: Django; the popular PHP version just wouldn’t cut it. Anyways, scroll down to see the code, or read on for a little primer about the process behind it.

Puzzles like these:

p u m p e r n i c k e l -    p u m p e r n i c k e l v
a - - - - - - - a - - e -    a w j m p c a y a w r e s
l - s n i c k e r - - a -    l f s n i c k e r b z a x
a - a - - - - - a - - v -    a f a z k e u i a b f v k
d - f - c - - - m - - e -    d x f v c j f d m c n e x
i - f j o r d - e - - n -    i d f j o r d z e j g n z
n - r - d - - - l i p - -    n r r x d j a o l i p d j
- c o r a l - - - - i - -    i c o r a l u s t o i x w
- - n - - i - - - - s - -    m r n u e i i h o t s y w
- - - - - m i s t - t - -    m w e x s m i s t r t u j
p l a g u e - - - - o - -    p l a g u e b n h k o m s
- - - - - - - d a w n - -    f m n v j f p d a w n c q
- - - - - - - - - - - - -    m h j a e d p p r g t p j

Behind the Scenes

This program is actually very simple and creates completely random crosswords on the fly. Naturally, the more words you have, the better it will be at placing the most possible on a board. However, increasing the number of words will increase computation time. Additionally, increasing the board size will severely increase computation time. To counteract the fact that sometimes it will randomly generate a sub-par board, we will generate many different boards in an allotted time and only keep the “best” board (in this case, the board with the most words placed). So, as the board and word list gets bigger, the number of prospective boards created decreases within a fixed time.

The code first randomizes the word list and then sorts by word length. The idea here is that longer words are more difficult to place, so get them placed when the board is the most open. Next, we place the longest word on the 1, 1 coordinate of the grid as the seed. In tests, the placement of the first word at 1, 1 yielded by far the best results on average. Then we go to the next longest word and loop over its letters and each cell in the grid. When we find a match, we back it up and suggest a coordinate placement for that word. Once we’ve checked every letter against every cell, we chose the best (the word best is used very loosely here) coordinate and apply the word to the grid. Now we move on the next word and so forth. Once we’ve made it through once, we can loop over the unplaced words and looks for any lucky chances for a second placement.

This suggested coordinate system allows for a much faster fit than some methods I’ve seen that will randomly place a word to see if it works. Additionally, it requires the word cross other words which is the point of well, a crossword puzzle.

Operation

Be mindful when you create a word list to exclude words like “an” or “or” because these have a tendency to be placed inside other already placed words. This can be confusing. Simply run the code below.

You can feed the Crossword class a list of Word classes, or a list of tuples or lists with the word and clue. Either way works.

When you call the compute_crossword(seconds) method, it does all the work of computing the best crossword in however many seconds you passed. 1 second is probably enough for crossword grids of less that 20×20 and 2 seconds is fine for 25×25 and 3 seconds is good for 30×30. Additionally, if you have a massive word list, you may want to double the time alloyed. Finally, if you can’t run psycho, quadruple these times for similar quality.

The Code:

import random, re, time, string
from copy import copy as duplicate
 
# optional, speeds up by a factor of 4
import psyco
psyco.full()
 
class Crossword(object):
    def __init__(self, cols, rows, empty = '-', maxloops = 2000, available_words=[]):
        self.cols = cols
        self.rows = rows
        self.empty = empty
        self.maxloops = maxloops
        self.available_words = available_words
        self.randomize_word_list()
        self.current_word_list = []
        self.debug = 0
        self.clear_grid()
 
    def clear_grid(self): # initialize grid and fill with empty character
        self.grid = []
        for i in range(self.rows):
            ea_row = []
            for j in range(self.cols):
                ea_row.append(self.empty)
            self.grid.append(ea_row)
 
    def randomize_word_list(self): # also resets words and sorts by length
        temp_list = []
        for word in self.available_words:
            if isinstance(word, Word):
                temp_list.append(Word(word.word, word.clue))
            else:
                temp_list.append(Word(word[0], word[1]))
        random.shuffle(temp_list) # randomize word list
        temp_list.sort(key=lambda i: len(i.word), reverse=True) # sort by length
        self.available_words = temp_list
 
    def compute_crossword(self, time_permitted = 1.00, spins=2):
        time_permitted = float(time_permitted)
 
        count = 0
        copy = Crossword(self.cols, self.rows, self.empty, self.maxloops, self.available_words)
 
        start_full = float(time.time())
        while (float(time.time()) - start_full) < time_permitted or count == 0: # only run for x seconds
            self.debug += 1
            copy.current_word_list = []
            copy.clear_grid()
            copy.randomize_word_list()
            x = 0
            while x < spins: # spins; 2 seems to be plenty
                for word in copy.available_words:
                    if word not in copy.current_word_list:
                        copy.fit_and_add(word)
                x += 1
            #print copy.solution()
            #print len(copy.current_word_list), len(self.current_word_list), self.debug
            # buffer the best crossword by comparing placed words
            if len(copy.current_word_list) > len(self.current_word_list):
                self.current_word_list = copy.current_word_list
                self.grid = copy.grid
            count += 1
        return
 
    def suggest_coord(self, word):
        count = 0
        coordlist = []
        glc = -1
        for given_letter in word.word: # cycle through letters in word
            glc += 1
            rowc = 0
            for row in self.grid: # cycle through rows
                rowc += 1
                colc = 0
                for cell in row: # cycle through  letters in rows
                    colc += 1
                    if given_letter == cell: # check match letter in word to letters in row
                        try: # suggest vertical placement 
                            if rowc - glc > 0: # make sure we're not suggesting a starting point off the grid
                                if ((rowc - glc) + word.length) <= self.rows: # make sure word doesn't go off of grid
                                    coordlist.append([colc, rowc - glc, 1, colc + (rowc - glc), 0])
                        except: pass
                        try: # suggest horizontal placement 
                            if colc - glc > 0: # make sure we're not suggesting a starting point off the grid
                                if ((colc - glc) + word.length) <= self.cols: # make sure word doesn't go off of grid
                                    coordlist.append([colc - glc, rowc, 0, rowc + (colc - glc), 0])
                        except: pass
        # example: coordlist[0] = [col, row, vertical, col + row, score]
        #print word.word
        #print coordlist
        new_coordlist = self.sort_coordlist(coordlist, word)
        #print new_coordlist
        return new_coordlist
 
    def sort_coordlist(self, coordlist, word): # give each coordinate a score, then sort
        new_coordlist = []
        for coord in coordlist:
            col, row, vertical = coord[0], coord[1], coord[2]
            coord[4] = self.check_fit_score(col, row, vertical, word) # checking scores
            if coord[4]: # 0 scores are filtered
                new_coordlist.append(coord)
        random.shuffle(new_coordlist) # randomize coord list; why not?
        new_coordlist.sort(key=lambda i: i[4], reverse=True) # put the best scores first
        return new_coordlist
 
    def fit_and_add(self, word): # doesn't really check fit except for the first word; otherwise just adds if score is good
        fit = False
        count = 0
        coordlist = self.suggest_coord(word)
 
        while not fit and count < self.maxloops:
 
            if len(self.current_word_list) == 0: # this is the first word: the seed
                # top left seed of longest word yields best results (maybe override)
                vertical, col, row = random.randrange(0, 2), 1, 1
                ''' 
                # optional center seed method, slower and less keyword placement
                if vertical:
                    col = int(round((self.cols + 1)/2, 0))
                    row = int(round((self.rows + 1)/2, 0)) - int(round((word.length + 1)/2, 0))
                else:
                    col = int(round((self.cols + 1)/2, 0)) - int(round((word.length + 1)/2, 0))
                    row = int(round((self.rows + 1)/2, 0))
                # completely random seed method
                col = random.randrange(1, self.cols + 1)
                row = random.randrange(1, self.rows + 1)
                '''
 
                if self.check_fit_score(col, row, vertical, word): 
                    fit = True
                    self.set_word(col, row, vertical, word, force=True)
            else: # a subsquent words have scores calculated
                try: 
                    col, row, vertical = coordlist[count][0], coordlist[count][1], coordlist[count][2]
                except IndexError: return # no more cordinates, stop trying to fit
 
                if coordlist[count][4]: # already filtered these out, but double check
                    fit = True 
                    self.set_word(col, row, vertical, word, force=True)
 
            count += 1
        return
 
    def check_fit_score(self, col, row, vertical, word):
        '''
        And return score (0 signifies no fit). 1 means a fit, 2+ means a cross.
 
        The more crosses the better.
        '''
        if col < 1 or row < 1:
            return 0
 
        count, score = 1, 1 # give score a standard value of 1, will override with 0 if collisions detected
        for letter in word.word:            
            try:
                active_cell = self.get_cell(col, row)
            except IndexError:
                return 0
 
            if active_cell == self.empty or active_cell == letter:
                pass
            else:
                return 0
 
            if active_cell == letter:
                score += 1
 
            if vertical:
                # check surroundings
                if active_cell != letter: # don't check surroundings if cross point
                    if not self.check_if_cell_clear(col+1, row): # check right cell
                        return 0
 
                    if not self.check_if_cell_clear(col-1, row): # check left cell
                        return 0
 
                if count == 1: # check top cell only on first letter
                    if not self.check_if_cell_clear(col, row-1):
                        return 0
 
                if count == len(word.word): # check bottom cell only on last letter
                    if not self.check_if_cell_clear(col, row+1): 
                        return 0
            else: # else horizontal
                # check surroundings
                if active_cell != letter: # don't check surroundings if cross point
                    if not self.check_if_cell_clear(col, row-1): # check top cell
                        return 0
 
                    if not self.check_if_cell_clear(col, row+1): # check bottom cell
                        return 0
 
                if count == 1: # check left cell only on first letter
                    if not self.check_if_cell_clear(col-1, row):
                        return 0
 
                if count == len(word.word): # check right cell only on last letter
                    if not self.check_if_cell_clear(col+1, row):
                        return 0
 
 
            if vertical: # progress to next letter and position
                row += 1
            else: # else horizontal
                col += 1
 
            count += 1
 
        return score
 
    def set_word(self, col, row, vertical, word, force=False): # also adds word to word list
        if force:
            word.col = col
            word.row = row
            word.vertical = vertical
            self.current_word_list.append(word)
 
            for letter in word.word:
                self.set_cell(col, row, letter)
                if vertical:
                    row += 1
                else:
                    col += 1
        return
 
    def set_cell(self, col, row, value):
        self.grid[row-1][col-1] = value
 
    def get_cell(self, col, row):
        return self.grid[row-1][col-1]
 
    def check_if_cell_clear(self, col, row):
        try:
            cell = self.get_cell(col, row)
            if cell == self.empty: 
                return True
        except IndexError:
            pass
        return False
 
    def solution(self): # return solution grid
        outStr = ""
        for r in range(self.rows):
            for c in self.grid[r]:
                outStr += '%s ' % c
            outStr += '\n'
        return outStr
 
    def word_find(self): # return solution grid
        outStr = ""
        for r in range(self.rows):
            for c in self.grid[r]:
                if c == self.empty:
                    outStr += '%s ' % string.lowercase[random.randint(0,len(string.lowercase)-1)]
                else:
                    outStr += '%s ' % c
            outStr += '\n'
        return outStr
 
    def order_number_words(self): # orders words and applies numbering system to them
        self.current_word_list.sort(key=lambda i: (i.col + i.row))
        count, icount = 1, 1
        for word in self.current_word_list:
            word.number = count
            if icount < len(self.current_word_list):
                if word.col == self.current_word_list[icount].col and word.row == self.current_word_list[icount].row:
                    pass
                else:
                    count += 1
            icount += 1
 
    def display(self, order=True): # return (and order/number wordlist) the grid minus the words adding the numbers
        outStr = ""
        if order:
            self.order_number_words()
 
        copy = self
 
        for word in self.current_word_list:
            copy.set_cell(word.col, word.row, word.number)
 
        for r in range(copy.rows):
            for c in copy.grid[r]:
                outStr += '%s ' % c
            outStr += '\n'
 
        outStr = re.sub(r'[a-z]', ' ', outStr)
        return outStr
 
    def word_bank(self): 
        outStr = ''
        temp_list = duplicate(self.current_word_list)
        random.shuffle(temp_list) # randomize word list
        for word in temp_list:
            outStr += '%s\n' % word.word
        return outStr
 
    def legend(self): # must order first
        outStr = ''
        for word in self.current_word_list:
            outStr += '%d. (%d,%d) %s: %s\n' % (word.number, word.col, word.row, word.down_across(), word.clue )
        return outStr
 
class Word(object):
    def __init__(self, word=None, clue=None):
        self.word = re.sub(r'\s', '', word.lower())
        self.clue = clue
        self.length = len(self.word)
        # the below are set when placed on board
        self.row = None
        self.col = None
        self.vertical = None
        self.number = None
 
    def down_across(self): # return down or across
        if self.vertical: 
            return 'down'
        else: 
            return 'across'
 
    def __repr__(self):
        return self.word
 
### end class, start execution
 
#start_full = float(time.time())
 
word_list = ['saffron', 'The dried, orange yellow plant used to as dye and as a cooking spice.'], \
    ['pumpernickel', 'Dark, sour bread made from coarse ground rye.'], \
    ['leaven', 'An agent, such as yeast, that cause batter or dough to rise..'], \
    ['coda', 'Musical conclusion of a movement or composition.'], \
    ['paladin', 'A heroic champion or paragon of chivalry.'], \
    ['syncopation', 'Shifting the emphasis of a beat to the normally weak beat.'], \
    ['albatross', 'A large bird of the ocean having a hooked beek and long, narrow wings.'], \
    ['harp', 'Musical instrument with 46 or more open strings played by plucking.'], \
    ['piston', 'A solid cylinder or disk that fits snugly in a larger cylinder and moves under pressure as in an engine.'], \
    ['caramel', 'A smooth chery candy made from suger, butter, cream or milk with flavoring.'], \
    ['coral', 'A rock-like deposit of organism skeletons that make up reefs.'], \
    ['dawn', 'The time of each morning at which daylight begins.'], \
    ['pitch', 'A resin derived from the sap of various pine trees.'], \
    ['fjord', 'A long, narrow, deep inlet of the sea between steep slopes.'], \
    ['lip', 'Either of two fleshy folds surrounding the mouth.'], \
    ['lime', 'The egg-shaped citrus fruit having a green coloring and acidic juice.'], \
    ['mist', 'A mass of fine water droplets in the air near or in contact with the ground.'], \
    ['plague', 'A widespread affliction or calamity.'], \
    ['yarn', 'A strand of twisted threads or a long elaborate narrative.'], \
    ['snicker', 'A snide, slightly stifled laugh.']
 
a = Crossword(13, 13, '-', 5000, word_list)
a.compute_crossword(2)
print a.word_bank()
print a.solution()
print a.word_find()
print a.display()
print a.legend()
print len(a.current_word_list), 'out of', len(word_list)
print a.debug
#end_full = float(time.time())
#print end_full - start_full

Sample output:

You should be able to see the associated methods lining up with the output. A side note: you must run the display() method before the legend() method can be ran.

mist
lime
snicker
paladin
caramel
leaven
pumpernickel
coral
fjord
plague
piston
lip
dawn
saffron
coda

p u m p e r n i c k e l -
a - - - - - - - a - - e -
l - s n i c k e r - - a -
a - a - - - - - a - - v -
d - f - c - - - m - - e -
i - f j o r d - e - - n -
n - r - d - - - l i p - -
- c o r a l - - - - i - -
- - n - - i - - - - s - -
- - - - - m i s t - t - -
p l a g u e - - - - o - -
- - - - - - - d a w n - -
- - - - - - - - - - - - -

p u m p e r n i c k e l v
a w j m p c a y a w r e s
l f s n i c k e r b z a x
a f a z k e u i a b f v k
d x f v c j f d m c n e x
i d f j o r d z e j g n z
n r r x d j a o l i p d j
i c o r a l u s t o i x w
m r n u e i i h o t s y w
m w e x s m i s t r t u j
p l a g u e b n h k o m s
f m n v j f p d a w n c q
m h j a e d p p r g t p j

1               4     8 -
  - - - - - - -   - -   -
  - 2             - -   -
  -   - - - - -   - -   -
  -   - 6 - - -   - -   -
  - 3         -   - -   -
  -   -   - - - 10   12 - -
- 5       9 - - - -   - -
- -   - -   - - - -   - -
- - - - - 11       -   - -
7           - - - -   - -
- - - - - - - 13       - -
- - - - - - - - - - - - -

1. (1,1) across: Dark, sour bread made from coarse ground rye.
1. (1,1) down: A heroic champion or paragon of chivalry.
2. (3,3) across: A snide, slightly stifled laugh.
2. (3,3) down: The dried, orange yellow plant used to as dye and as a cooking spice.
3. (3,6) across: A long, narrow, deep inlet of the sea between steep slopes.
4. (9,1) down: A smooth chery candy made from suger, butter, cream or milk with flavoring.
5. (2,8) across: A rock-like deposit of organism skeletons that make up reefs.
6. (5,5) down: Musical conclusion of a movement or composition.
7. (1,11) across: A widespread affliction or calamity.
8. (12,1) down: An agent, such as yeast, that cause batter or dough to rise..
9. (6,8) down: The egg-shaped citrus fruit having a green coloring and acidic juice.
10. (9,7) across: Either of two fleshy folds surrounding the mouth.
11. (6,10) across: A mass of fine water droplets in the air near or in contact with the ground.
12. (11,7) down: A solid cylinder or disk that fits snugly in a larger cylinder and moves under pressure as in an engine.
13. (8,12) across: The time of each morning at which daylight begins.

15 out of 20
811

My Favorite Way To Sell Files Online

Filed under: Work — Bryan on Feb 15th, 2010 @ 5:48 pm

There are quite a few services out there that provide a mechanism for digital downloads, most of them are cart based or even store based (their store on their site). This puts you at the mercy of their approval process and can shut down your income in a flash if they don’t like what your are selling. Wouldn’t it be awesome if you could just sell some digital file on your site, receive the money directly in your PayPal account and automate the file delivery?

Try BitBuffet.com if you want to sell digital goods. I promise you’ll be impressed (because I built it myself to be a simple and effective solution for delivering digital files).

I’ve been using BitBuffet.com to sell my WordPress themes at GazelleThemes.com and haven’t hit any snags at all. I just upload the zip file containing my theme and copy the button code onto my website. I even get email notifications when I receive a sale and nice flash charts showing my past sales (including a massive database for searching past sales).

I can set how long the download links are active and how many times they can download. After the time is up, the link no longer works. I can send freebie to friends and resend lost download links. Each download link is unique and expires according to your settings.

Sell Albums or MP3′s On Your MySpace/Band Website

Since my band Glass Cannon is getting ready to release our debut album, I can also use BitBuffet.com to host and sell an album. Again, all I’ll need to do is make a zip of the file, upload it to BitBuffet.com and copy the button to my bands site (or MySpace). All they have to do is click, pay through PayPal and check their email!

Sell Photos From Your Online Portfolio/Flickr

Although I’m not a photographer (I just play one on TV), I can see photographers selling their high resolution files to interested buyers. Since the files are securely hosted, you don’t have to worry about people stealing your work by sharing a download link (each is unique and expires according to your settings).

Sell Any Digital File From Your Site

It doesn’t matter what it is! Software, images, designs, HTML/CSS themes, WordPress Themes, Joomla! Themes, Woopra Themes, MP3′s, Albums, eBooks, vector images… you name it! If it is digital, BitBuffet.com offers the easiest way to deliver the file with after PayPal payments!

Some of the Features:

  • Unlimited Bandwidth
  • Unlimited Sales
  • Keep Your Profits
  • Pay Flat-Fee Month-to-Month or Yearly
  • Payment Directly Into Seller’s Personal PayPal Account

Check out BitBuffet.com today and let me know in the comments what you think!

Notorious B.I.G’s Crack Commandments In Business

Filed under: Interesting — Bryan on Feb 5th, 2010 @ 5:22 pm

In case you need a refresher, check out the tune here. While some are a stretch, a few are really quite relevant.

1. Never let no one know how much dough you hold.

Keep your finances (good or bad) to yourself.

Don’t make the mistake of bragging about how well or mentioning how badly you’re doing unless you have a very good reason for it. What you think of as idle talk amongst friends can get around very quickly and can affect future deals or relationships. When it comes to finances, its just better to keep your mouth shut.

2. Never let ‘em know your next move.

Keep your core strategies/opportunities under wraps.

I know its tempting to talk about your plans or techniques, but just like #1, sometimes it’s just best to shut up. Biggie elaborates on this with “don’t you know Bad Boys move in silence or violence” which is just another way of letting you know that the big dogs don’t over-plan and discuss, and they act.

3. Never trust nobody.

Words are words. Get a contract.

Trust is a funny and terribly fragile thing. While your business partners or clients may not want to ruin you from the outset, who knows what the future will bring? You need to protect yourself. Hire a lawyer, get a contract. Live by this motto: “Everybody signs something.”

4. Never get high, on your own supply.

Discover the customers’ needs; don’t substitute your own.

While you may think you have it under control, your customer should come first. They are the ones controlling your paycheck. Don’t forget that. If you think you have all the answers, be prepared to fail. Badly.

5. Never sell no crack where you rest at.

Don’t mix business with personal life.

It’s easy to bring your personal life into business, and some people have no problems maintaining the difference. But when you become a friend to all, you may have trouble making necessary decisions in the face of emotion. Just know that if you do mix the two, you may need to break the connection to make the right decision.

6. That God damn credit, dead it.

Get cash upfront unless you don’t care about being paid.

This goes back to #3, don’t trust anyone. Get a contract and get the cash upfront. While Biggie was dealing with unreliable crackheads, you’ll still run across unreliable or dishonest businessmen. When in doubt, get it in cash.

7. Keep your family and business completely separated.

Don’t work with family for family’s sake.

This is an elaboration on #5, but don’t hire friends or family just because they are who they are. Do they have a strong skill-set? Can they contribute to your bottom line? If you can’t be honest here, you won’t make it far.

8. Never keep no weight on you.

Learn to delegate effectively.

Biggie clarifies this with the line: “them cats that squeeze your guns can hold jumps too.” In Biggie’s case, he doesn’t want to get nailed with possession. In your case, hire someone to do your dirty work for you. Learn to delegate and get on with more important things.

9. If you ain’t gettin bags stay the fuck from police.

Watch who you are perceived as working with.

There are probably a lot of people who in hindsight would have taken a different route when dealing with unsavory people. Biggie had the right idea, your colleagues will form their own assumption, some of them negative.

10. A strong word called consignment; if you ain’t got the clientele say hell no.

Don’t take credit without a means to repay.

This is the flip-side of #6, don’t take obligations you can’t repay. This is one very quick way of run yourself into the ground. If you already have revenue and need to grow, then by all means.

What do you think? Did I interpret one wrong?

Automated Rank (and Link) Tracking Done Easy

Filed under: Work — Bryan on Dec 17th, 2009 @ 3:55 am
A sample email. Simple easy.

A sample email. Simple easy.

Finally, after months of tweaking and building, I’ve launched Rankiac.com, a super charged automatic Google rank checker. It’s a dandy little SEO tool that doesn’t do a whole heck of a lot, but what it does, it does well. At the moment, it (1) tracks rankings in Google, (2) watches your important links and (3) keeps track of backlinks (and lets you know when it finds a new one!). Oh, and it emails you an update every morning! That last feature was key for me.

So, what’s it do?

Well, it does just what I mentioned before! Tracks keyword rankings in Google (hundreds of them!), hyperlinks between sites (we watch out for pesky no-follows), and backlinks (from Yahoo’s Site Explorer). But my favorite feature is by far and away daily emails.

Daily Emails!

How I love rolling out of bed in the morning (or lately is been afternoon…) and checking all my ranks from my iPhone’s email app. Anywhere you want, its easy access to a simple method that keeps you in the loop. I tend to forget to look at my other keywords, but Rankiac never forgets. Its handy.

Charting

I also love charts. Rankiac has ‘em. See how each of your keywords is doing over time and plan accordingly. Link building making your domains slowly increase in rankings? Double check with one click. Oh, also, you can download all the data in CSV format as well, in case you wanna play with the data yourself.

If you’re interested, here’s a coupon: zr6voq1y. Just sign up and enter it in your profile!

It’s good for the first 25 users and gives you 91 days free (in addition to the 14 day free trial!). After that, I think it runs about 11 cents a day, or less that 3 and a half bucks a month when you buy a year!

So what are you waiting for, go sign up at Rankiac!

PS: I’ve also built two little baby sites for those who want a simple Google rank checker or fast reciprocal link checker on the fly!

6 IT Decisions for Non-IT Management

Filed under: Boring Stuff — Bryan on Nov 4th, 2009 @ 6:18 pm
  1. The first consideration is: is the level of spending tied to the overall strategy? Given that there are uncertain returns for IT investments, the spending should be considered like any other business investment and prudence should be exercised just the same. While industry bookmarks can be an exceptional indicator, they should not be the targeted spending.
  2. The second consideration is: is the money focused on essential, benefit producing programs? While it may be tempting to streamline all business processes, it is foolish to equally distribute investments among business processes that will benefit unevenly. However, a careful balance must be struck to avoid any bottlenecks.
  3. The third consideration is: at what scope will the business benefit from IT centralization? Another tempting move may be to provide company-wide IT integration, or centralization, regardless of the cost. This may appear to be an excellent way to provide cost savings (by buying in bulk), but the added benefit of centralization may be entirely mitigated by the added costs.
  4. The fourth consideration is: does the business need a premier, top-of-the-line system to operate efficiently? If left to IT management, the added cost/benefit ratio may be clearly defined in raw technology terms, but the benefit as perceived by IT management may not translate to overall benefits to the business.
  5. The fifth consideration is: at what point does the marginal cost of more hassle cross the marginal benefit of more security?  In other words, by increasing IT security, are you inadvertently creating insurmountable obstacles for non-IT employees? Research suggests that the weakest link of most security chains is the human element, and the human element is best handled through proper training, not extravagant (and costly) firewalls and encryption.
  6. The sixth and final consideration is: place blame on the management of IT implementation, not the IT systems. Most IT systems are built to exact specifications, and many are industry wide solutions adopted elsewhere. When the expected benefits don’t materialize, find the problem in the decision chain that approved inappropriate systems, not in the IT system itself.

Six IT Decisions Your IT People Shouldn’t Make – March 3, 2009 – Jeanne W. Ross and Peter Weill

Next Page »
All articles are licensed under a Attribution-Noncommercial-Share Alike 3.0 Unported License. All files/themes are released under the GPL License where applicable. © 2012 Bryan Helmig Hosted on Webfaction.