Skip to content

Content Tagged "python"

Page 3 of 5

Content Tagged "python"

Python classes to generate CSS

February 4, 2015Categories: Idea, Software
A while ago I got fed up with CSS and its cumbersomeness. As my poison of choice is python , I was thinking it would be quite useful to have a bunch of classes capable of generating CSS automatically in python. One could have a base class, a set of properties, a name-value dictionary and a way to…

D-BUS: DBUS and Mad scientists... - 2004 Style

October 9, 2014Category: Software
TL;DR : This post is about an experience I had in 2004 and it’s part of my consolidating technical posts I wrote in time. It may or may not be relevant to today’s technologies. For the last while I was poking around with the glorious D-BUS ... As it's always the case with new cutting edge…

Python Tutorial - Guess a Number Game

August 1, 2014Category: Software
A while ago I had a problem to solve: Write a program to guess a number between 1 and 1,000,000 in python. This is a simple learning program, done in high school or university, particularly when learning a programming language. The Problem The problem can be translated in the following parts…

Load a CSV File with Header in Postgres via Psycopg

July 5, 2014Category: Software
My task is to create a script to load a bunch of files into a DB model. The files are CSV, with quoted strings and headers. Postgres has a COPY command which I find fabulous for loading data. unfortunately, the psycopg implementations copy_from() , copy_to() and copy_expert() have very few examples…

Braindump: Use a Decorator to Time your Python Function

July 4, 2014Category: Software
In the programs I write these days I use timing methods to profile the code, mainly because I find it easier to split and sum deltas based on functions. For example, I have a script that loads an XML file, parses it into a relational-ish layout, and uploads the layout into a database. Therefore, I…

Insert in PostgreSQL in (Almost) Constant Time

May 15, 2014Category: Software
One of the things I did was to write a script to insert records in a PostgreSQL database. The records have with a quite simple structure: id - char(20) content - XML field aside - XML field I was working with a sample of 10,000 entries out of 40 million and the script went through several…

Formless Step in FormWizard

May 7, 2014Category: Software
Sometimes you'd need to show a purely informational page as part of a FormWizard. As far as I could see, there are two solutions to the problem: If the info is something like a summary, you have it available in the "success" page (the one after the wizard is finished) Alternatively, you can make it…

Create Data Once in a FormWizard

May 6, 2014Category: Software
At one of the sites I'm building I need to walk users through a registration process: Select a supported tool Generate an ID Create a configuration based on the previous two steps To do this, I chose to use a FormWizard with three steps, one for each of the above. The problem then becomes to…

Send POST to server via python-requests

April 15, 2014Category: Software
The other day I've had a question asked: How do you send a form data to a server and get the reply? My solution involves python-requests : r.text contains the reply HTML page, which then needs to be processed via e.g. python's DOM processing module or BeautifulSoup (if you're looking for…

Loading XSDs into Oracle through Python

April 2, 2014Category: Software
Following the previous incursions in Oracle and their own documentation, we decided it was useful to attach schemas to the inserted data, just because only XML with schemas attached can be indexed. When you have some million entries, indexing seems like a good idea (once you decide what to index…
PreviousNext

All tags