Easy Concurrency with Stackless Python - Since messing around with Erlang over the last couple months I've been very impressed with it's simplicity in managing concurrency. Erlang's message passing infrastructure really allows developers to have the locking just work without doing anything unnatural in code for synchronization. You almost let the problems define the locking behavior for you. Such elegance isn't limited Erlang, oh no. Python's also been shown some concurrency-love by way of a specialized implementation called Stackless Python. Stackless Python avoids using C's call stack and relies on lightweight microthreads rather than operating system threads or processes for concurrency. Channels (similar to Erlang's message passing) are used for synchronization and communication between tasklets (the implementation of microthreads). Note that stackless python is a cooperative multitasking framework so you do have the responsibility of explicitly relinquishing...
Now in Django - Welp, this site has been ported to Django. It's my second Django project but this is the first one that extends beyond two pages. Since putting it on production equipment a few things aren't working quite right but it's passable for now. Tomorrow I'll clean up any loose ends and write the story of the port. The URL rewrites to .aspx filenames are annoying me, but I might leave them to remind me of the old days. If I get motivated over the weekend I might set up some 301's. Please, If anybody sees anything broken or odd please email me. Now it's time to sleep!
Stored Procedures in Django - Web development platforms like Django go a long way to removing the need for writing hand-crafted SQL with all of their ORM goodness. Sometimes, for some reason or another, it's handy to execute hand-crafted SQL code or even a stored procedure. Naturally that should be a last resort and I don't intend on starting a discussion about when it is and when is not appropriate, but for those situations where it is this article applies. Database To illustrate how to do this I'll start out with the following MySQL table (the remainder of the post assumes it's filled with sample data). It'll sit underneath the the Document class in an application named "searcher". I'm sort of working backwards here as I've actually generated this table from a model I've included later...
Tale of a Website, from Rails to ASP.NET to Django - I hesitate to call it complete yet but for the most part www.chrisumbel.com has been ported from ASP.Net to Django. Sure, there really isn't a lot to this site so no port would have been incredibly painful but I'm quite pleased with the effort level (or lack thereof) required to get it done. Aside from just this port it's been a long and interesting ride for just a bunch of blog posts and comments. Ancient History: Rails in my basement In reality the story began with Ruby on Rails several years back. This site still bares the look, feel, basic data structure and even a few blog posts from kilnaar.com which was based on a Rails and MySQL stack and spent most of its time running on various OpenBSD, Solaris and...
Windows Services in Python - Any more it seems that virtually all the code I write on the windows platform ends up being a windows service. It's just the nature of the kind of work I do: the underappreciated guts that sit far beneath the software that users directly interact with. Obviously windows services are typically written in mainstream .Net languages like C# or VB these days but it's also easy if not easier to do in Python. Requirements A Python Interpreter - this one's pretty obvious. Can't run Python code without a Python interpreter. Python for Windows Extensions - this is a wonderful, easy to install project that exposes the innards of windows to Python. Administrative access - you must be logged in with administrative access in order to install your service. The Code Once...
Scripting Your .Net Applications with IronPython - At several points in my .Net development career I've had the need to make an application I wrote scriptable. Sometimes it was to provide easy product extension to customers or lower level information workers. Sometimes it was to ease maintenance of very fine grained logic that has the capacity to change frequently or unpredictably. But every time I found it to be one of the more interesting facets of the project at hand. Early in .Net's history this was made easy by using Visual Studio for Applications (VSA) which allowed you to host arbitrary C# or VB.Net code within the executing AppDomain. Unfortunately VSA was plagued with resource leak problems and was therefore impractical in most enterprise situations. VSA was eventually deprecated. One of the many alternatives is to perform dynamic,...
Using reCAPTCHA With Django - I sure was naive. When I launched a certain django-based site that accepted user comments (wonder which one that is?) a while back I thought I could block the comment spam myself without CAPTCHA. After a few months of traffic I started getting hammered with it and tried blocking IPs, keywords and patterns. All to no avail. The trouble-spot was a strait-forward, regular old HTML form that accepted the comment input. I needed it to appeal to wide browser requirements of the site. My AJAX-jQuery-to-django-piston-service comment submissions rarely were the source of spam entry but I needed my regular forms locked down as well. I toyed with the idea of rolling my own CAPTCHA but I honestly have bigger fish to fry. Turns out that integrating reCAPTCHA with django was a...
Home-Brewing a Full-Text Search in Google's AppEngine - I've recently deployed a django application on Google's AppEngine. I'm not sure how I've avoided it thus far but seems to fit my needs relatively well. DataStore (AppEngine's data storage engine) really impressed me. The python API feels so much like django's ORM that there was practically zero learning curve for a chap like me. One thing that disappointed me, however, was the state of the search facility. The built-in google.appengine.ext.search.SearchableModel suffers from many problems outlined all over the web. i.e. the need to create n indexes to handle for n search terms, index creation failures, inability to exclude properties and a lack of support for common search operations. A brief web search for alternatives turned up a semi-commercial product and a few open source offerings but nothing that really piqued...
Using Solr in Django for Full-Text Searching via Solango - I've been doing quite a bit of work with Solr lately, both at the office and at home and, by golly, I love it! It's very powerful and simple to integrate with regardless of your platform. In this post I'll explain how to use Solr as a data-store independent search provider for Django projects. I'll assume that you have a functional Solr install and generally understand how to use it. If that's not the case Apache's Solr documentation can help. Get Solango The easiest way to get your project talking to Solr is via the Solango Django application. Grab the source from here and copy the solango sub-directory into your PYTHON_PATH. Configure Solango Solango must now be configured. Jump into the solango directory that you copied above and edit the settings.py...
Tags:
.Net .net framework 4.0 ADO.NET Android AppleScript Astoria BI BeOS C C++ Data Services EF GNOME GObject Groovy HTML Haiku JVM Java Mac MongoDB ORM Objective-C Operating Systems Oracle SSRS Solr VS 2010 Vala Web Services appengine c# clojure cloud clr cocoa touch concurrency couchdb cql curl database django dlr dynamic entity framework erlang exchange server filestream full-text functional go iPhone indexes ironpython ironruby jQuery linq lisp lucene mongodb monitoring natural language object oriented parallel performance podcasts powershell python rails refactoring remoting reporting services rs ruby scripting security setpolicies simpledb sql 2008 sql server systems programming testing tools vb virtualization wave webdav windows xml