Easy Database Development Using Rekall
Listing 1. The On Display Function for the Philosophers Block
def eventFunc (block, row) : someMainForm = block.getForm(); currBlock = block; dataLabel = someMainForm.getNamedCtrl("current_philosopher"); dataLabel.setText(currBlock.getNamedCtrl("last_name").getValue());
Listing 2. The On Display Function for the Publications Block
def eventFunc (block, row) : mainForm = block.getForm(); currBlock = block; dataLabel = mainForm.getNamedCtrl("current_philosopher"); currBlock.setUserFilter(dataLabel.getValue());
Finally, I need some way of listing the philosophers I have in my database. Figure 7 shows the report functionality of Rekall.
Rekall also offers a number of other components, such as reports, queries and data copiers. Each component can be created with the same ease and offers the same versatility as the forms.
As I have demonstrated, Rekall and PostgreSQL offer the ability to complete all kinds of database programming tasks quickly under Linux while providing the cross-platform capability that many consultants need. As companies migrate to Linux for their desktops, products such as Rekall will come into far greater demand.
As it is configured after a default installation, PostgreSQL 8.0.2 authenticates its users by checking their Linux identities. To create a more secure application, you should change this to password authentication. The following steps describe how to do so.
First, modify the password of the database user postgres so that you can log in when passwords are required:
At a command prompt, type su and enter your root password.
Then, type su postgres.
Now, start the psql monitor by typing psql template1.
We modify the password by typing alter user postgres with password 'pgUser89' or some other suitable password.
Exit the monitor by typing \q and pressing Enter.
Second, modify the pg_hba.conf file so that the database accepts md5 passwords for all connections. By default, it's configured to authenticate based on the identity of the current Linux account. On a default installation, this file is found under /var/lib/pgsql/data. This file has lines that look like this:
# "local" is for Unix domain socket connections only local all all trust # IPv4 local connections: host all all 127.0.0.1/32 md5 # IPv6 local connections: host all all ::1/128 md5
To enable passwords, change the trust option on the line for local to md5 and save the file. Then, restart PostgreSQL. On a Red Hat-like system, this can be done by issuing the command /sbin/service postgresql reload.
After this is done, users and databases can be created by using PostgreSQL's built-in tools or by using third-party tools such as PgAdminIII. The PostgreSQL Web site always is the best resource for more information on these topics.
Resources for this article: /article/8271.
- Is the Private Cloud a Real Cloud?
- Give new life to old phones and tablets with these tips!
- Readers' Choice Awards 2014 Poll
- rsync, Part II
- Linux Systems Administrator
- Senior Perl Developer
- Technical Support Rep
- Tech Tip: Really Simple HTTP Server with Python
- Memory Ordering in Modern Microprocessors, Part I