Category Archives: software arch.

software architecture

locking and concurrency in python, part 2

Previously, I created a "MultiLock" class for managing locks and lockgroups across a shared file system. Now I want to create a simple command-line utility that uses this functionality. To start, we can create a simple runone() function that leverages … Continue reading

Posted in python, shell tips, software arch. | Comments Off on locking and concurrency in python, part 2

locking and concurrency in python, part 1

I would like to do file-locking concurrency control in python. Additionally, I would like to provide a "run-once-and-only-once" functionality on a shared cluster; in other words, I have multiple batch jobs to run over a shared compute cluster and I … Continue reading

Posted in python, software arch. | Comments Off on locking and concurrency in python, part 1

python, analyzing csv files, part 2

Previously, we discussed analyzing CSV files, parsing the csv into a native python object that supports iteration while providing easy access to the data (such as a sum by column header). For very large files this can be cumbersome, especially … Continue reading

Posted in data arch., python, software arch. | Leave a comment

python, analyzing csv files, part 1

I would like to analyze a collection of CSV (comma-separated-values) files in python. Ideally, I would like to treat the csv data as a native python object. For example, >>> financial_detail = Report('financial-detail.csv') >>> transactions = {} >>> for row … Continue reading

Posted in data arch., python, software arch. | Leave a comment

python daemon

I would like to create a python daemon, completely detaching from the terminal or parent process, and yet retaining any log handlers through the python logging module. There is a wonderful example at cookbook-278731 of a well-behaved daemon, and see … Continue reading

Posted in python, software arch. | Leave a comment

python logging

I would like customizable logging in python applications, and I would like to easily send log messages to multiple handlers without any modification of the application code. The built-in logging module provides a very robust and easy-to-use logging capability. In … Continue reading

Posted in python, software arch. | Leave a comment

javascript keyboard buffer, part 4

Previously, we created a JavaScript keyboard buffer that can edit text in a static html page as well as play back each key as it was typed. I would like to combine all of this into a single JavaScript include … Continue reading

Posted in css, html, javascript, software arch. | Leave a comment

css opacity in javascript

I want register JavaScript events to toggle CSS opacity on selectable images. For example, given a div with a list of images like the following, <div id="foo_images"> <img src="foo.jpg" /> <img src="bar.jpg" /> <img src="baz.jpg" /> ... </div> I would … Continue reading

Posted in css, html, javascript, software arch. | Leave a comment

php DB adapter, decorator

Previously, I created a php database adapter that calls mysql stored procedures as if they were local php functions. Now I want to refactor each of the features of the DB adapter into a decorator design pattern. The core database … Continue reading

Posted in php, software arch. | Leave a comment

php DB adapter, revisited

I would like to call mysql stored procedures as if they were local php functions. For example, let's use the following mysql stored procedure, DELIMITER // CREATE PROCEDURE `usersByPage`(page_num INT, per_page INT) BEGIN SET @lim_start = (page_num - 1) * … Continue reading

Posted in mysql, php, software arch. | Leave a comment