Open Source

Using the Python Database APIs

Using the Python Database APIs

First, some history about Python and relational databases. Python’s support for relational databases started out with ad hoc solutions, with one solution written to interface with each particular database, such as Oracle. Each database module created its own API, which was highly specific to that database because each database vendor evolved its own API based on its own needs. This is hard to support, because coding for one database and trying to move it to the other gives a programmer severe heartburn, as everything needs to be completely rewritten and retested.

Over the years, though, Python has matured to support a common database, or DB, API, that’s called the DB API. Specific modules enable your Python scripts to communicate with different databases, such as DB/2, PostgreSQL, and so on. All of these modules, however, support the common API, making your job a lot easier when you write scripts to access databases. This section covers this common DB API.

Tags:

Python Test Cases and Test Suites

Python Test Cases and Test Suites

Unit testing revolves around the test case, which is the smallest building block of testable code for any circumstances that you’re testing. When you’re using PyUnit, a test case is a simple object with at least one test method that runs code; and when it’s done, it then compares the results of the test against various assertions that you’ve made about the results.

Tags:

Python Functions

Python Functions: Grouping Code under a Name

Most modern programming languages provide you with the capability to group code together under a name; and whenever you use that name, all of the code that was grouped together is invoked and evaluated without having to be retyped every time.

To create a named function that will contain your code, you use the word def, which you can think of as defining a functional block of code.

Tags:

Using More Built-in Python Types

Using More Built-in Python Types

Beside strings and numbers, Python provides four other important basic types: tuples, lists, sets, and dictionaries. These four types have a lot in common because they all allow you to group more than one item of data together under one name. Each one also gives you the capability to search through them because of that grouping. These groupings are indicated by the presence of enclosing parentheses (), square brackets [], and curly braces {}.

WARNING: When you write a program, or read someone else’s program, it is important to pay attention to the type of enclosing braces when you see groupings of elements. The differences among {}, [], and () are important.

Tags:

Why you should hire a professional for your Joomla site in 2010

Have you heard the following from your clients? Or does this describe you?

Tags:

Creating Articles in Joomla

Excerpt from Beginning Joomla! Website Development

By Cory Webb

An article is the main way that content is displayed in a Joomla! site. Articles can be organized into categories and sections, or they can be uncategorized. The term “content item” was used in Joomla! 1.0, but that phrase has been deprecated in favor of the term “article.” You will often catch people like me, who have been around Joomla! since before it was Joomla!, still referring to articles as content items. Just know that they are one in the same.

Tags:
Syndicate content