My First Bottle Stopper On Etsy
Categories: Code, Wood
I’m testing the waters with selling my bottle stoppers on Etsy. The site has the benefit of an existing user base, but my small collection of items (currently only one) is most likely lost among the vast quantities of items. I posted a cherry bottle stopper with a stainless steel base as my first test. There has been almost negligible traffic to the item listing with almost every page hit being sourced from the bit.ly link that I’ve posted in a few places. I plan on posting a few more bottle stoppers up there to site for a while. From what I’ve learned so far, popular stores are somewhat self sustaining, but newer, smaller sellers are all but lost in the void. The $0.20 posting fee is trivial and spending a few dollars to force myself to think about how I can market my woodworking crafts is a worthwhile expense.
An alternative to selling on Etsy is to host my own store. OpenCart is currently in the lead of the free apps. Magento was quickly eliminated as being too large/complicated for a site that would only have a few dozen items for sale. I also couldn’t image being able to turn a client loose on its admin interface to manage their business.
Related to the self hosting, I still have a few shared accounts with Joyent. The uptime has been great and my only complaint is that I didn’t upgrade my lifetime shared hosting when they started offering accelerators. That would have given me more options and capabilities with the hosting. In search of a cheap VPS hosting option, I found LowEndBox.com, a blog that posts sub $7/mo hosting deals. If you set your expectations appropriately and do a little bit of research about the companies providing the offer, then you can find a good deal. I managed to get a dedicated 2gb OpenVZ from ChicagoVPS for $7/mo. For the price, it is exceeding my expectations and I plan on hosting a few personal sites and services that can tolerate some downtime. There hasn’t been any provider caused downtime yet, but my expectations are not set to a level I would need for a production site. My expectations may change with time.
ImportError: No module named os
Category: Code
When running Python 2.7 with Apache 2.2 and modwsgi 3.3. Make sure Apache is loading the correct version of modwsgi. I ran in to the following error, which wasted about 15 minutes of my life before realizing the one character typo.
[client 192.168.0.10] mod_wsgi (pid=5800): Exception occurred processing WSGI script 'D:/www/myapp.wsgi'.
Traceback (most recent call last):
File "D:/www/myapp.wsgi", line 1, in <module>
ImportError: No module named os
That puzzling error was the result of the following line in the httpd.conf.
LoadModule wsgi_module "@WWWROOT@/modules/mod_wsgi-win32-ap22py26-3.3.so"
See it? The line should be.
LoadModule wsgi_module "@WWWROOT@/modules/mod_wsgi-win32-ap22py27-3.3.so"
Running Python With Apache on Windows
Category: Code
My day job has a Windows environment and avoids installing other OSes unless absolutely necessary. Windows is great on the desktop, but has many limitations when tasked with running a web site that relies heavily upon open source languages and products. Its limitations are front and center when trying to host a Python web application. Below are some of the gotchas that I’ve encountered and how I addressed the problem.
The Python GIL
Every Python developer should be familiar with the GIL. If you’re not, follow that link and start reading. TL;DR? Threads of the same process block each other on all IO. By itself, the GIL is an easy beast to tame by spawning more processes, instead of threads. On *nix OSes, processes are relatively light weight and you can fork a process and continue on your merry way. Processes on Windows are heavier and it does not support fork without installing more software. Cygwin and Windows Services for Unix are the two ways of making Windows behave more like *nix for specially compiled programs.
Apache MPM (Multi-Processing Modules)
Apache is a great HTTP server application that provides more functionality than most sites will ever need or use. It is also one of the few options that is designed to run as a service on Windows. The lighter weight options, nginx and lighttpd are usually better for my needs, but both have issues with running as a Windows service.
Apache supports a few different Multi-Processing Modules, prefork is the default for *nix. On Windows, there is only one MPM, mpm_winnt. This MPM works great and follows the Windows idea of spawning threads when you want work done. The GIL makes almost any Python website unusably slow when run on Windows with Apache. Most web applications are a bunch of IO (Network, database, disk, etc.) with a small amount of CPU. This basically turns Apache in to a single threaded web server. The prefork MPM does not experience this problem due to its use of processes instead of threads.
I observed the situation where a page that by itself would take about 1 second to generate, could take tens of seconds to finish if there were more than 2-3 overlapping requests. Each new request (in a thread) would get roughly equal time and slow down all previous threads. It was possible to block the site for minutes with as few as 10 requests.
Faking a Python MPM
There is a way of configuring a Windows server so that it can serve a Python web application and avoid the GIL. A multi-process MPM is conceptual the same as a load balancer sitting in front of several web servers. An incoming request is routed to a individual web server to handle.
Apache as a Balancer
Apache can function as a load balancer if another option is not available. Here’s a configuration snippet that will equally balance requests among three Apache instances running on the same machine as the instance acting as the load balancer (reverse proxy). See mod_proxy documentation for the rest of the configuration directives that you will need to fully configure.
<Proxy balancer://cluster>
BalancerMember http://192.168.0.10:9001 smax=3 max=10 ttl=120 route=www_1
BalancerMember http://192.168.0.10:9002 smax=3 max=10 ttl=120 route=www_2
BalancerMember http://192.168.0.10:9003 smax=3 max=10 ttl=120 route=www_3
</Proxy>
ProxyPass / balancer://cluster/
ProxyPassReverse / balancer://cluster/
Gotchas
This configuration of faking a server farm on a single machine requires some new problems to be resolved. Thankfully, these are not that difficult once you are aware of them.
Lots-O-Logs
Every request will be logged by the load balancing Apache instance and the proxied instance that does the work. This is not necessarily a bad thing by itself. It is useful to know which Apache instance handled a specific request and also get the aggregate view (load balancer logs). Unless steps are taken, this will double the disk IO and space requirements.
The simple resolution is to disable all logging on the worker instances. This can be accomplished by using CustomLog and a conditional environment variable that is never set.
LogFormat " " empty
# Below will never output anything, but it will create an empty file
CustomLog "D:/logs/carme/apache/access-1.log" empty env=NOTHING_IS_LOGGED
Logging has now been reduced to a normal volume, but you will not know which instance handled the request. To regain that bit of information, you can add %{BALANCER_WORKER_ROUTE}e to the LogFormat of the load balancer. This will include whatever value is set for route= in the above BalancerMember configuration. E.g. www_1, www_2, or www_3.
Fixing IPs
The instances behind the load balancer, and application code will see every request as if it is coming from the load balancing instance. This can be resolved with the Apache module mod_rpaf.
2009 Jetta Sportwagen - Stuck Fuel Door
Category: Random Babble
I went to fill up my car and was unable to get the fuel flap open. It’s one of the new, push in the flap to release the latch to cause it spring open. I wasn’t able to open it. The car needs to be unlocked to allow the latch to open. Unfortunately, it turns out that the fine folks over at VW could have put a bit more effort in to testing the mechanism because this is not always the case.
After a short search, I found others who discovered that the fuel flap locking mechanism can get out of sync with the state of the door locks. The solution is to lock and unlock all of the doors a few times. The flap should pop itself open once the locking mechanism wakes up because the initial (failed) attempt to open it already released the latch.
Once again there is a chill in the air. The winter brewing season is here! I’ve never been very good at keeping journals for my various hobbies. No woodworking project journal, bee journal is all voice recordings and blog posts, and brewing has previously been notes on the recipe paper. I’ve always been very good at taking notes and documenting software projects, but that is what I do for a living.
My brewing will get a bit more methodical thanks to BrewedByUs.com – a homebrewing site with recipes and journals. The site was brainstormed over pizza. Sadly, my workload prevented me from being able to help with the initial implementation, but Mark Lavin has done an amazing job laying the foundation. I’ve recently joined him to help with continued development. There are many great improvements planned and we’ve had a lot of good feedback from the many fellow homebrewers on Google Plus.
In my opinion, one of the best features of the site is its ability to track modifications to user created recipes. A pet peeve of mine with every site that has recipes is that users will highly rate a recipe, but mention that they changed almost everything about it. The BrewedByUs site will let anyone create a recipe, and anyone else can adapt the recipe to properly track those changes.
BrewedByUs.com is a Django powered site that makes use of many open source applications. Although the code for the site itself is not shared with the public, we have and will continue to contribute back to Django and the other upstream applications. The site is integrated with many other OAuth providers, so it’s fast and easy to create an account without needing to remember yet another password. Give it a spin and let me know what you think.
Upload plugin. View the code and help. Scroll. Click “submit”. Scroll. Click “No” to enable plugin. I’ve repeated this pattern way to often whenever I set up or update a Textpattern based site. No more.
Textpattern added the ability for plugins to run some code when they are installed; PLUGIN_LIFECYCLE_NOTIFY. This was intended to let a plugin update database schemas, create default forms, or do any of the other set up work the plugin needs to only do once.
Going forward, I plan on updating all of my plugins to enable themselves when installed. My first public plugin to gain this benefit is mem_self_register v0.9.9.
Release Notes:
- added ability to customize new password reset mail message.
- auto-enabled on install.
- numerous fixes related to creating email messages.
How to auto-enable a plugin
Set the plugin[‘flag’].
$plugin['flags'] = PLUGIN_LIFECYCLE_NOTIFY;
Register the callback function.
if (@txpinterface == 'admin')
{
register_callback('mem_self_auto_enable', 'plugin_lifecycle.mem_self_register', 'installed');
}
Provide the function that sets the status of the plugin in the database.
/** Automatically enable plugin when installed */
function mem_self_auto_enable($event, $step)
{
$plugin = substr($event, strlen('plugin_lifecycle.'));
$prefix = 'mem_self_register';
if (strncmp($plugin, $prefix, strlen($prefix)) == 0)
{
safe_update('txp_plugin', "status = 1", "name = '" . doSlash($plugin) . "'");
}
}
Welcome null!
Category: Random Babble
Seems like Verizon needs to do a better job with checking data that is outputted on their website. Apparently, I no longer have a name.

First Ripe Blueberry of 2011
Category: Random Babble
The first ripe blueberry of 2011 and it was delicious!
The Battery Goes Pop!
Category: Random Babble
On a few separate occasions, Alissa or I have heard a single load popping noise from an unknown and untraceable source. Turns out that the popping noise was caused by batteries literally exploding. I wouldn’t have known if it wasn’t for a 9v battery on my desk busting its case with a single loud pop. Fortunately, I had a protective shield of miscellaneous papers, tools and other junk that has been piling up. Coincidentally, the expiration printed on the battery is March 2011.


SawStop SketchUp Models
Category: Hobby
I’ve been planning the tool layout for my woodworking workshop using SketchUp. It’s a very simple to use 3d modeling program with a decent collection of online components that can be downloaded in to a sketch. I’ve been unable to upload sketches to the “3D Warehouse”, but am posting them now in the hopes of saving others some time. The main dimensions of the model were referenced from the manuals and the miter slots should be accurate.
In a 12’ wide area, it is possible to fit the Professional Cabinet Saw (PCS) with 52” rails and still have space to walk comfortably around one side of the saw (~3’) and squeeze around the other (~2).

Sawstop PCS with 36" rails SketchUp Model PCS with 36_ rails.skp
SawStop PCS with 52" rails SketchUp Model PCS with 52_ rails.skp
« Newer - Older »