<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Bryan Helmig &#187; Work</title>
	<atom:link href="http://bryanhelmig.com/category/work/feed/" rel="self" type="application/rss+xml" />
	<link>http://bryanhelmig.com</link>
	<description>...and a digital brain freeze.</description>
	<lastBuildDate>Mon, 24 May 2010 18:18:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Setting up Ubuntu 10.04 with Apache, memcached, ufw, MySQL, and Django 1.2 on Linode</title>
		<link>http://bryanhelmig.com/setting-up-ubuntu-10-04-with-apache-memcached-ufw-mysql-and-django-1-2-on-linode/</link>
		<comments>http://bryanhelmig.com/setting-up-ubuntu-10-04-with-apache-memcached-ufw-mysql-and-django-1-2-on-linode/#comments</comments>
		<pubDate>Mon, 24 May 2010 08:40:03 +0000</pubDate>
		<dc:creator>Bryan</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[linode]]></category>
		<category><![CDATA[memcache]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[ufw]]></category>

		<guid isPermaLink="false">http://bryanhelmig.com/?p=286</guid>
		<description><![CDATA[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&#8217;d walk through my process for setting up all this Django goodness on what is basically a LAMP setup (where &#8220;P&#8221; stands for Python!) with [...]]]></description>
			<content:encoded><![CDATA[<p>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&#8217;d walk through my process for setting up all this Django goodness on what is basically a LAMP setup (where &#8220;P&#8221; stands for Python!) with a few extras like memcached and ufw. We&#8217;ll get to a level of general security, but not prefect security.</p>
<p>Also, we&#8217;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&#8217;s get going!</p>
<p><strong>Initial Setup</strong><br />
First thing to do is log in via the standard SSH on your Linode&#8217;s IP, port 22, and with <em>root</em> as your username. We&#8217;ll change the login user away from root, but for now, this will do (plus we can skip all that sudo stuff). First, let&#8217;s update and upgrade the system.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> update <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> upgrade</pre></div></div>

<p>Awesome, you should be 100% up-to-date. Now its time to get to the fun part, let&#8217;s <strong>install</strong> some of the software we&#8217;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.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> build-essentials
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> apache2 apache2.2-common apache2-mpm-worker apache2-threaded-dev libapache2-mod-wsgi python-dev
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> mysql-server python-mysqldb
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> memcached libmemcache-dev
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> ufw</pre></div></div>

<p>Really quickly, let&#8217;s get <strong>python-memcached</strong> installed (alternatively, if you need some raw speed, look up cmemcached or python-libmemcached). This will take a few steps&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># create and enter a temp dir in /home</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>home <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> downloads <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">cd</span> downloads
<span style="color: #666666; font-style: italic;"># get django 1.2 tar and untar it</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-O</span> pymem.tar.gz <span style="color: #c20cb9; font-weight: bold;">ftp</span>:<span style="color: #000000; font-weight: bold;">//</span>ftp.tummy.com<span style="color: #000000; font-weight: bold;">/</span>pub<span style="color: #000000; font-weight: bold;">/</span>python-memcached<span style="color: #000000; font-weight: bold;">/</span>python-memcached-1.45.tar.gz <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-zxvf</span> pymem.tar.gz
<span style="color: #666666; font-style: italic;"># enter the directory and install</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> python-memcached-<span style="color: #000000;">1.45</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> python setup.py <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>Now its time for Django! <strong>Django 1.1.1</strong> is a lot easier to install than Django 1.2:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># install django 1.1.1</span>
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> python-django</pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># enter the downloads directory in /home</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>downloads
<span style="color: #666666; font-style: italic;"># get django 1.2 tar and untar it</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-O</span> django12.tar.gz http:<span style="color: #000000; font-weight: bold;">//</span>www.djangoproject.com<span style="color: #000000; font-weight: bold;">/</span>download<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.2</span><span style="color: #000000; font-weight: bold;">/</span>tarball<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-zxvf</span> django12.tar.gz
<span style="color: #666666; font-style: italic;"># enter the directory and install django 1.2</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> Django-<span style="color: #000000;">1.2</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> python setup.py <span style="color: #c20cb9; font-weight: bold;">install</span>
<span style="color: #666666; font-style: italic;"># strictly optional delete of downloads directory, be careful with rm -r</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>home <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-r</span> downloads</pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># turn on ufw</span>
ufw <span style="color: #7a0874; font-weight: bold;">enable</span>
<span style="color: #666666; font-style: italic;"># log all activity (you'll be glad you have this later)</span>
ufw logging on
<span style="color: #666666; font-style: italic;"># allow port 80 for tcp (web stuff)</span>
ufw allow <span style="color: #000000;">80</span><span style="color: #000000; font-weight: bold;">/</span>tcp
<span style="color: #666666; font-style: italic;"># allow our ssh port</span>
ufw allow <span style="color: #000000;">5555</span>
<span style="color: #666666; font-style: italic;"># deny everything else</span>
ufw default deny
<span style="color: #666666; font-style: italic;"># open the ssh config file and edit the port number from 22 to 5555, ctrl-x to exit</span>
<span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ssh<span style="color: #000000; font-weight: bold;">/</span>sshd_config
<span style="color: #666666; font-style: italic;"># restart ssh (don't forget to ssh with port 5555, not 22 from now on)</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ssh</span> reload</pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># replace 24 with however many megabytes of cache is appropriate</span>
memcached <span style="color: #660033;">-u</span> root <span style="color: #660033;">-d</span> <span style="color: #660033;">-m</span> <span style="color: #000000;">24</span> <span style="color: #660033;">-l</span> 127.0.0.1 <span style="color: #660033;">-p</span> <span style="color: #000000;">11211</span></pre></div></div>

<p>Alright, with that out of the way, let&#8217;s get MySQL nice and tight. The standard install of MySQL can suck up a lot of memory, so we&#8217;ll suggest a few ways to lighten the load:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># open mysql conf and set these settings:</span>
<span style="color: #666666; font-style: italic;">#    key_buffer = 16k</span>
<span style="color: #666666; font-style: italic;">#    max_allowed_packet = 1M</span>
<span style="color: #666666; font-style: italic;">#    thread_stack = 64K</span>
<span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>my.cnf
<span style="color: #666666; font-style: italic;"># restart mysql</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>mysql restart</pre></div></div>

<p>Now let&#8217;s get a new user setup and leave behind this <strong>root</strong> nonsense for safety&#8217;s sake. Your username is going to be <strong>bobby</strong> for this example. Replace <strong>bobby</strong> everywhere if you want something different.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># create bobby, you'll be asked to set the password and such</span>
adduser bobby
<span style="color: #666666; font-style: italic;"># edit the ssh file and add the line: AllowUsers bobby</span>
<span style="color: #666666; font-style: italic;"># ctrl-x to exit and save</span>
<span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ssh<span style="color: #000000; font-weight: bold;">/</span>sshd_config
<span style="color: #666666; font-style: italic;"># restart ssh</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ssh</span> reload
<span style="color: #666666; font-style: italic;"># log out and login as bobby from now on!</span></pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>bobby<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> public_html
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> public_html<span style="color: #000000; font-weight: bold;">/</span>examplesite.com
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> public_html<span style="color: #000000; font-weight: bold;">/</span>examplesite.com<span style="color: #000000; font-weight: bold;">/</span>logs
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> public_html<span style="color: #000000; font-weight: bold;">/</span>examplesite.com<span style="color: #000000; font-weight: bold;">/</span>private</pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>bobby<span style="color: #000000; font-weight: bold;">/</span>public_html<span style="color: #000000; font-weight: bold;">/</span>examplesite.com<span style="color: #000000; font-weight: bold;">/</span>demoproject<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> apache
<span style="color: #c20cb9; font-weight: bold;">nano</span> apache<span style="color: #000000; font-weight: bold;">/</span>demoproject.wsgi</pre></div></div>

<p>First, in the <strong>demoproject.wsgi</strong> file you should paste and save:</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">import os, sys
&nbsp;
<span style="color: #000099;">apache_configuration</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> os.path.dirname<span style="">&#40;</span>__file__<span style="">&#41;</span></span>
<span style="color: #000099;">project</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> os.path.dirname<span style="">&#40;</span>apache_configuration<span style="">&#41;</span></span>
<span style="color: #000099;">workspace</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> os.path.dirname<span style="">&#40;</span>project<span style="">&#41;</span></span>
sys.path.append<span style="">&#40;</span>workspace<span style="">&#41;</span>
&nbsp;
sys.path.append<span style="">&#40;</span>'/usr/lib/python2.5/site-packages/django/'<span style="">&#41;</span>
sys.path.append<span style="">&#40;</span>'/home/bobby/public_html/examplesite.com/demoproject'<span style="">&#41;</span>
&nbsp;
os.environ<span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>'DJANGO_SETTINGS_MODULE'<span style="">&#93;</span></span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 'demoproject.settings'</span>
import django.core.handlers.wsgi
<span style="color: #000099;">application</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> django.core.handlers.wsgi.WSGIHandler<span style="">&#40;</span><span style="">&#41;</span></span></pre></div></div>

<p>We&#8217;re so close, let&#8217;s get the other Apache files setup. Oh, and don&#8217;t worry about that <strong>www-data</strong> thing just yet, we&#8217;ll get to that in a second.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># give the www-data user/group permission on public_html</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> www-data:www-data <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>bobby<span style="color: #000000; font-weight: bold;">/</span>public_html
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>sites-available<span style="color: #000000; font-weight: bold;">/</span>examplesite.com</pre></div></div>

<p>Place the text below in the <strong>examplesite.com</strong> 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.</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">&lt;VirtualHost *:<span style="">80</span>&gt;
    #Basic setup
    ServerAdmin your@email.com
    ServerName www.examplesite.com
    ServerAlias examplesite.com
&nbsp;
    &lt;Directory /home/bobby/public_html/examplesite.com/demoproject/apache/&gt;
        Order deny,allow
        Allow from all
    &lt;/Directory&gt;
&nbsp;
    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
&nbsp;
    WSGIDaemonProcess examplesite.com user<span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">www-data group=www-data threads=<span style="">20</span> processes<span style="color: #000066; font-weight:bold;">=</span>2</span>
    WSGIProcessGroup examplesite.com
&nbsp;
    WSGIScriptAlias / /home/bobby/public_html/examplesite.com/demoproject/apache/demoproject.wsgi
&lt;/VirtualHost&gt;</pre></div></div>

<p>A few more final things:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> a2ensite examplesite.com
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 restart</pre></div></div>

<p><strong>Time to admire your handiwork.</strong></p>
<p>Congrats! You&#8217;re all set up and ready to roll! Nothing can stop you now! Here&#8217;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.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># measure your memory usage in kb</span>
<span style="color: #c20cb9; font-weight: bold;">ps</span> aux <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $3&quot;\t&quot;$6&quot;\t&quot;$11;sum+=$6;cpu+=$3} END {print &quot;Total RSS&quot;, sum, &quot;\nTotal CPU&quot;, cpu}'</span></pre></div></div>

<p>Also, under Ubuntu 10.04 (Lucid), Python&#8217;s site-packages is now called dist-packages. Just a FYI.</p>
]]></content:encoded>
			<wfw:commentRss>http://bryanhelmig.com/setting-up-ubuntu-10-04-with-apache-memcached-ufw-mysql-and-django-1-2-on-linode/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Python Crossword Puzzle Generator</title>
		<link>http://bryanhelmig.com/python-crossword-puzzle-generator/</link>
		<comments>http://bryanhelmig.com/python-crossword-puzzle-generator/#comments</comments>
		<pubDate>Sat, 10 Apr 2010 21:18:31 +0000</pubDate>
		<dc:creator>Bryan</dc:creator>
				<category><![CDATA[Boring Stuff]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[crosswords]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://bryanhelmig.com/?p=275</guid>
		<description><![CDATA[As my next miniature project will be a site for teachers that will make random generation of crossword puzzles and word search puzzles, I thought I&#8217;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 [...]]]></description>
			<content:encoded><![CDATA[<p>As my next miniature project will be a site for teachers that will make random generation of crossword puzzles and word search puzzles, I thought I&#8217;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&#8217;d like the code to fit snugly in my web framework of choice: Django; the popular PHP version just wouldn&#8217;t cut it. Anyways, scroll down to see the code, or read on for a little primer about the process behind it.</p>
<p><strong>Puzzles like these:</strong></p>
<pre>
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
</pre>
<p><strong>Behind the Scenes</strong></p>
<p>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 &#8220;best&#8221; 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.</p>
<p>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 <strong>1, 1</strong> coordinate of the grid as the <em>seed</em>. In tests, the placement of the first word at <strong>1, 1</strong> 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&#8217;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&#8217;ve made it through once, we can loop over the unplaced words and looks for any lucky chances for a second placement.</p>
<p>This suggested coordinate system allows for a much faster fit than some methods I&#8217;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.</p>
<p><strong>Operation</strong></p>
<p>Be mindful when you create a word list to exclude words like &#8220;an&#8221; or  &#8220;or&#8221; because these have a tendency to be placed <em>inside </em>other  already placed words. This can be confusing. Simply run the code below.</p>
<p>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.</p>
<p>When you call the compute_crossword(<em>seconds</em>) 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&#215;20 and 2 seconds is fine for 25&#215;25 and 3 seconds is good for 30&#215;30. Additionally, if you have a massive word list, you may want to double the time alloyed. Finally, if you can&#8217;t run psycho, quadruple these times for similar quality.</p>
<p><strong>The Code:</strong></p>

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

<p><strong>Sample output:</strong></p>
<p>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.</p>
<pre>
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
</pre>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://bryanhelmig.com/python-crossword-puzzle-generator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Favorite Way To Sell Files Online</title>
		<link>http://bryanhelmig.com/my-favorite-way-to-sell-files-online/</link>
		<comments>http://bryanhelmig.com/my-favorite-way-to-sell-files-online/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 22:48:42 +0000</pubDate>
		<dc:creator>Bryan</dc:creator>
				<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://bryanhelmig.com/?p=254</guid>
		<description><![CDATA[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&#8217;t like what your [...]]]></description>
			<content:encoded><![CDATA[<p>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 (<em>their </em>store on <em>their </em>site). This puts you at the mercy of their approval process and can shut down your income in a flash if they don&#8217;t like what your are selling. Wouldn&#8217;t it be awesome if you could just <strong>sell some digital file on your site</strong>, receive the money <strong>directly in your PayPal account</strong> and <strong>automate the file delivery</strong>?</p>
<p><strong>Try BitBuffet.com if you want to <a href="http://bitbuffet.com/">sell files online.</a> I promise you&#8217;ll be impressed (because I built it myself to be a simple and effective solution for delivering digital files).</strong></p>
<p>I&#8217;ve been using BitBuffet.com to sell my WordPress themes at GazelleThemes.com and haven&#8217;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).</p>
<p>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 <em>your </em>settings.</p>
<p><strong>Sell Albums or MP3&#8242;s On Your MySpace/Band Website</strong></p>
<p>Since my band <strong>Glass Cannon </strong>is getting ready to release our debut album, I can also use BitBuffet.com to host and sell an album. Again, all I&#8217;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!</p>
<p><strong>Sell Photos From Your Online Portfolio/Flickr</strong></p>
<p>Although I&#8217;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&#8217;t have to worry about people stealing your work by sharing a download link (each is unique and expires according to your settings).</p>
<p><strong>Sell <em>Any </em>Digital File From Your Site</strong></p>
<p>It doesn&#8217;t matter what it is! Software, images, designs, HTML/CSS themes, WordPress Themes, Joomla! Themes, Woopra Themes, MP3&#8242;s, Albums, eBooks, vector images&#8230; you name it! If it is digital, BitBuffet.com offers the easiest way to deliver the file with after PayPal payments!</p>
<p><em><strong>Some of the Features:</strong></em></p>
<ul>
<li>Unlimited Bandwidth</li>
<li>Unlimited Sales</li>
<li>Keep Your Profits</li>
<li>Pay Flat-Fee Month-to-Month or Yearly</li>
<li>Payment Directly Into Seller&#8217;s Personal PayPal Account</li>
</ul>
<p>Check out <a href="http://bitbuffet.com/">BitBuffet.com</a> today and let me know in the comments what you think!</p>
]]></content:encoded>
			<wfw:commentRss>http://bryanhelmig.com/my-favorite-way-to-sell-files-online/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Automated Rank (and Link) Tracking Done Easy</title>
		<link>http://bryanhelmig.com/rank-tracking-done-easy/</link>
		<comments>http://bryanhelmig.com/rank-tracking-done-easy/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 08:55:39 +0000</pubDate>
		<dc:creator>Bryan</dc:creator>
				<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://bryanhelmig.com/?p=230</guid>
		<description><![CDATA[Finally, after months of tweaking and building, I&#8217;ve launched Rankiac.com, a super charged automatic Google rank checker. It&#8217;s a dandy little SEO tool that doesn&#8217;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) [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_231" class="wp-caption alignright" style="width: 204px"><img class="size-full wp-image-231  " title="email cropped" src="http://bryanhelmig.com/wp-content/uploads/2009/12/emailcropped.png" alt="A sample email. Simple easy." width="194" height="218" /><p class="wp-caption-text">A sample email. Simple easy.</p></div>
<p>Finally, after months of tweaking and building, I&#8217;ve launched Rankiac.com, a super charged <a href="http://rankiac.com/">automatic Google rank checker</a>. It&#8217;s a dandy little SEO tool that doesn&#8217;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!). <strong>Oh, and it emails you an update every morning! </strong>That last feature was <em>key </em>for me.</p>
<h3>So, what&#8217;s it do?</h3>
<p>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&#8217;s Site Explorer). But my favorite feature is by far and away <strong>daily emails</strong>.</p>
<h4>Daily Emails!</h4>
<p>How I love rolling out of bed in the morning (or lately is been afternoon&#8230;) and checking all my ranks from my iPhone&#8217;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.</p>
<h4>Charting</h4>
<p>I also love charts. Rankiac has &#8216;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, <strong>you can download all the data in CSV</strong> format as well, in case you wanna play with the data yourself.</p>
<h3>If you&#8217;re interested, here&#8217;s a <strong>coupon</strong>: <em>zr6voq1y</em>. Just sign up and enter it in your profile!</h3>
<p>It&#8217;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!</p>
<p>So what are you waiting for, go sign up at <a href="http://rankiac.com/">Rankiac</a>!</p>
<p><em>PS: I&#8217;ve also built two little baby sites for those who want a simple <a href="http://googlerankchecker.net/">Google rank checker</a> or fast <a href="http://reciprocallinkchecker.net/">reciprocal link checker</a> on the fly!<br />
</em></p>
]]></content:encoded>
			<wfw:commentRss>http://bryanhelmig.com/rank-tracking-done-easy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bing, Yahoo!, Google and the Ad Serving Internets</title>
		<link>http://bryanhelmig.com/bing-yahoo-google-and-the-ad-serving-internets/</link>
		<comments>http://bryanhelmig.com/bing-yahoo-google-and-the-ad-serving-internets/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 21:27:03 +0000</pubDate>
		<dc:creator>Bryan</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[adsense]]></category>
		<category><![CDATA[bing]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[yahoo]]></category>

		<guid isPermaLink="false">http://bryanhelmig.com/?p=180</guid>
		<description><![CDATA[I run a few websites (lets just say over a dozen) so I generally spend a lot of my time optimizing and tweaking these sites. My first site, a free guitar lesson resource, survives solely off of Adsense. I like Adsense, its easy to use, is extremely popular, and there are is no shortage of [...]]]></description>
			<content:encoded><![CDATA[<p>I run a few websites (lets just say over a dozen) so I generally spend a lot of my time optimizing and tweaking these sites. My first site, a free guitar lesson resource, survives solely off of Adsense. I like Adsense, its easy to use, is extremely popular, and there are is no shortage of willing advertisers.</p>
<p>I receive decent traffic from all three of the big search engines, and while the night may still be quite young, I can already see which site I am leaning towards as my favorite search engine&#8230;</p>
<h3>A comparison of revenue earning power.</h3>
<p>Thanks to Google Analytics&#8217;s handy Adsense integration, I can see exactly which keywords will give me better eCPM, or &#8220;the estimated revenue from AdSense per thousand ad page views&#8221;. Out of my largest referrers, the highest eCPM earners are&#8230;</p>
<ol>
<li><em>Bing </em>with<strong> <em>425%</em></strong> of average eCPM!</li>
<li><em>Yahoo!</em> with <strong>188%</strong> of average eCPM.</li>
<li><em>Direct (no referral)</em> at <strong>98%</strong> of average eCPM.</li>
<li><em>Google </em>with <strong>71%</strong> of average eCPM.</li>
</ol>
<p>Now these numbers should be taken with a grain of salt, I haven&#8217;t controlled for other variables, like landing pages, keywords or traffic numbers. However, a cursory overview tells me that any set of numbers with a extreme deviations from the average warrant further investigation. Discuss this, I will.</p>
<h3>What&#8217;s going on?</h3>
<p>Well, Bing and Yahoo! both rank me much, much higher on my target terms than Google (think top 5 vs. top 50). So right off the bat, I am thinking of this in a couple ways:</p>
<ol>
<li><em>Bing </em>and <em>Yahoo!</em> are both sending me much <strong>more </strong>relevant traffic. Therefore the users are <strong>more </strong>engaged with the site, and are more <strong>willing to explore </strong>relevant advertising offers.</li>
<li><em>Bing </em>and<em> Yahoo! </em>are both sending me much <strong>less </strong>relevant traffic. Therefore the users are <strong>less </strong>engaged with the site, and want to <strong>click away </strong>from the site through advertisements.</li>
<li><em>Google </em>users are more web savvy, and tend to <strong>ignore </strong>the branding of the the Google Adsense ads (they do have a distinct look).</li>
</ol>
<p>Well which is it? Well, let me bring in some more information: bounce rates. Bounce rates are great indicators of whether people stick around on your site or not, the lower the bounce rate, the better. Low bounce rates mean users spend more time on your site, time that is likely to translate to favorable actions (bookmarking, ad clicking, etc.), so there might be a little harmonizing amongst the data&#8230; Let us explore:</p>
<ol>
<li><em>Yahoo!</em> with a BR of <strong>38.06%</strong>.</li>
<li><em>Bing </em>with a BR of <strong>39.52%</strong>.</li>
<li><em>Direct (no referral) </em>with a BR of<strong> 45.37%</strong>.</li>
<li><em>Google </em>with a BR of <strong>50.98%</strong>.</li>
</ol>
<p>Anyway you slice it, this doesn&#8217;t look good for Google. Google has the highest bounce rate of the bunch, even higher than the site average. Yahoo! and Bing are both neck and neck. And they make me more money per click-through, Win-win! However, in all fairness, they are sending traffic from different search terms. Yahoo! and Bing just seem to be better at choosing relevant search terms at the moment.</p>
<p>The last theory I put forth was one that suggests that Google users are a little less advertisement prone than their counterparts at Bing and Yahoo!. Perhaps this is true since most folks are learning of Bing through Microsoft&#8217;s big ad campaign. Sheeple in, sheeple out. Coincidence!? Probably. Who knows.</p>
<h3>Why is it so?</h3>
<p>Well, in reality, it may not be so. The data isn&#8217;t very normalized. In fact, as of right now, both Bing and Yahoo! combined only send about 1/5 of the traffic Google sends. But this number is growing everyday, so we&#8217;ll have to come back in a couple months to see if this changes.</p>
<p>But as for now, I am thinking Bing and Yahoo! are both ranking me better for keywords I know my site is good for. Google just seems to be pickier (and a little less efficient in this case). My suggestion would be to get you some Bing traffic and see for yourself.</p>
<p>Whoever is reading this and has a soft spot for statistics of any sort, perhaps you can put forth some clarifications or suggestions. I&#8217;d love it.</p>
<p><em>Edit: Now with the Yahoo!/Bing deal, let&#8217;s hope these numbers hold up and more traffic comes pouring through. <img src='http://bryanhelmig.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </em></p>
]]></content:encoded>
			<wfw:commentRss>http://bryanhelmig.com/bing-yahoo-google-and-the-ad-serving-internets/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Let&#8217;s J.am &#8211; Collaborative Music</title>
		<link>http://bryanhelmig.com/lets-jam-collaborative-music/</link>
		<comments>http://bryanhelmig.com/lets-jam-collaborative-music/#comments</comments>
		<pubDate>Sun, 03 May 2009 05:36:45 +0000</pubDate>
		<dc:creator>Bryan</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[creation]]></category>
		<category><![CDATA[jam]]></category>
		<category><![CDATA[music]]></category>

		<guid isPermaLink="false">http://bryanhelmig.com/?p=162</guid>
		<description><![CDATA[Just this weekend, I launched my take on collaborative music online. I am sure there are already sites out there that do this, but I wanted to focus on the layering concept of creating music with a multitrack editor. Anyone who&#8217;s ever recorded with a single microphone knows the process of layering subsequent tracks well. [...]]]></description>
			<content:encoded><![CDATA[<p>Just this weekend, I launched my take on <a href="http://letsj.am/">collaborative music online</a>. I am sure there are already sites out there that do this, but I wanted to focus on the layering concept of creating music with a multitrack editor. Anyone who&#8217;s ever recorded with a single microphone knows the process of layering subsequent tracks well. You start with a click track or something similar and build up from that, one layer at a time.</p>
<p>I really think that this process opens up a ton of new possibilities in music creation by allowing people from all musical backgrounds to share and mix increasingly unique songs. We even provide the <a href="http://letsj.am/samples/">free drum samples</a> if you can provide the beats.</p>
<p>It&#8217;s 100% free and you can check it out at <a href="http://letsj.am/">http://letsj.am</a>. I encourage you to log in and post a few tracks or layers yourself. There&#8217;s also a tutorial/wiki if you want to learn a little about the process. Feel free to leave a comment or suggestion here, or drop me a message.</p>
]]></content:encoded>
			<wfw:commentRss>http://bryanhelmig.com/lets-jam-collaborative-music/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tag Description Plugin For WordPress</title>
		<link>http://bryanhelmig.com/tag-description/</link>
		<comments>http://bryanhelmig.com/tag-description/#comments</comments>
		<pubDate>Sat, 28 Mar 2009 19:05:09 +0000</pubDate>
		<dc:creator>Bryan</dc:creator>
				<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://bryanhelmig.com/?p=157</guid>
		<description><![CDATA[This has been added in 2.8! Don&#8217;t install this if you have 2.8! Read this instead. This little plug-in adds a fancy little description field to the &#8220;Edit Tag&#8221; pane in WordPress. It also adds a function called single_tag_description(); that does just that but only on the tag page. Not really sure why the tag [...]]]></description>
			<content:encoded><![CDATA[<p><strong>This has been added in 2.8! Don&#8217;t install this if you have 2.8! Read <a href="http://codex.wordpress.org/Template_Tags/tag_description">this instead</a>.</strong></p>
<p>This little plug-in adds a fancy little description field to the &#8220;Edit Tag&#8221; pane in WordPress. It also adds a function called <code>single_tag_description();</code> that does just that but only on the tag page. Not really sure why the tag description isn&#8217;t available by default, seems like it would be pretty useful. Basically, you can describe your tags and echo that description on each tag page with the above function; pretty simple!</p>
<p>Please enjoy and note that some of the code came from a thread I read on WordPress.org, but some of it came from extracting similar core code, I just made it into a WordPress plugin. <a href="http://bryanhelmig.com/downloads/ct.php?go=http://bryanhelmig.com/downloads/tag-description-1.0.zip">Download it now</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://bryanhelmig.com/tag-description/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Magatheme: Cool Minimal WordPress Theme</title>
		<link>http://bryanhelmig.com/magatheme-cool-minimal-wordpress-theme/</link>
		<comments>http://bryanhelmig.com/magatheme-cool-minimal-wordpress-theme/#comments</comments>
		<pubDate>Mon, 09 Feb 2009 07:05:33 +0000</pubDate>
		<dc:creator>Bryan</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[3 column]]></category>
		<category><![CDATA[golden ratio]]></category>
		<category><![CDATA[magazine]]></category>
		<category><![CDATA[minimal]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://bryanhelmig.com/?p=126</guid>
		<description><![CDATA[If you&#8217;d like some customization done on the theme, I refer you to the stellar Magatheme Pro Package WordPress Magazine Theme with customization! It&#8217;s got all the options you all asked for, built-in! Everything from an awesome tab slider and homepage layout to drop down menus and a couple subtle color schemes are ready out [...]]]></description>
			<content:encoded><![CDATA[<p style="border: 1px dotted #eeeeee; padding: 10px; background: #fbfbfb none repeat scroll 0% 0%; width: 95%;"><strong>If you&#8217;d like some customization done on the theme,</strong> I refer you to the stellar Magatheme Pro Package <a href="http://www.gazellethemes.com/magatheme-minimal-magazine-theme-for-wordpress/#content">WordPress Magazine Theme</a> with customization! It&#8217;s got all the options you all asked for, built-in! Everything from an <strong>awesome tab slider </strong>and <strong>homepage layout </strong>to <strong>drop down menus </strong>and <strong>a couple subtle color schemes </strong>are ready out of the box. <a rel="nofollow" href="http://www.gazellethemes.com/magatheme-minimal-magazine-theme-for-wordpress/#content">So check it out!</a></p>
<p><a href="http://bryanhelmig.com/wp-content/uploads/2009/02/screenshot.png"><img class="alignright size-medium wp-image-127" title="magatheme minimal wordpress theme screenshoot" src="http://bryanhelmig.com/wp-content/uploads/2009/02/screenshot-240x300.png" alt="magatheme minimal wordpress theme screenshoot" width="240" height="300" /></a>Well, I just got finished with the brand new <strong>Magatheme </strong><strong>(1.0.5)</strong>! Ultimately, I&#8217;ll incorporate a full front page outline (<a rel="nofollow" href="http://www.gazellethemes.com/magatheme-minimal-magazine-theme-for-wordpress/#content">Pro Edition</a>), just like your favorite magazine themes have, but until then you&#8217;ll just have to enjoy this classy, minimalistic WordPress theme just like any other Plain Jane theme.</p>
<p>But wait! If you <a href="http://bryanhelmig.com/downloads/ct.php?go=http://bryanhelmig.com/downloads/magatheme-1.0.5-bh.zip">download</a> within the next 15 minutes you get&#8230;</p>
<ul>
<li>A classy, minimalistic design!</li>
<li>3 column, golden ratio deduced layout!</li>
<li>A cool, slightly blue ice color scheme!</li>
<li>Six sidebars! Count them, six!
<ul>
<li>Wide Sidebar</li>
<li>Left Sidebar</li>
<li>Right Sidebar</li>
<li>Left Footbar</li>
<li>Mid Footbar</li>
<li>Right Footbar</li>
</ul>
</li>
<li>Completely valid XHTML and CSS!</li>
<li>WordPress 2.7 compatibility!</li>
<li>Zebra striped comments!</li>
<li>Highlighted author comments!</li>
<li><strong>(Pro)</strong> Selectable magazine or blog style homepage.</li>
<li><strong>(Pro)</strong> Over 15 widget ready locations.</li>
<li><strong>(Pro)</strong> 4 color schemes.</li>
<li><strong>(Pro)</strong> No-edit ad and tracking integration.</li>
<li><strong>(Pro)</strong> Feedburner integration.</li>
<li><strong>(Pro)</strong> Drop down menus and fancy homepage tab slider.</li>
<li><strong>(Pro)</strong> Hide/show author, date, categories, tags, and comment sections.</li>
</ul>
<p>Leave a comment below and let me know what you think of the theme! I&#8217;d love to hear it. Perhaps your suggestions will make it into the next version.</p>
<p><em><span style="text-decoration: line-through;">PS: I haven&#8217;t tested IE6 yet, let me know if it works for you!</span> It works in IE6!<br />
</em></p>
<p><a href="http://bryanhelmig.com/downloads/ct.php?go=http://bryanhelmig.com/downloads/magatheme-1.0.5-bh.zip">Download it now!</a> or <a href="http://wp-themes.com/magatheme/" target="_blank">View the Demo!</a> or <a href="http://demo.gazellethemes.com/?wptheme=Magatheme%20Pro">View the Pro Demo!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://bryanhelmig.com/magatheme-cool-minimal-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>100</slash:comments>
		</item>
	</channel>
</rss>
