I have an application that runs on Postgres & Mysql. Each program checks to determine the database type and then imports either postgres_db as db_util or mysql_db as db_util. This works without a problem if all code referencing the class db_util is in the __main__ module. When I started putting code in classes Continue reading
in index.php set the timezone after the definitions
#set timezone date_default_timezone_set('America/Denver'); require_once($yii); Yii::createWebApplication($config)->run();
for error CException:
Application runtime path "/var/www/html/yiitest/protected/runtime" is not valid. Please make sure it is a directory writable by the Web server process.
chcon -Rv --type=httpd_sys_content_t /var/www/html
To set the context permanently:
semanage fcontext -a -t httpd_sys_content_t "/path to/html(/.*)?"
For full exlplanation
Common wisdom says “MySQL does not support server side cursors”. I searched and did not find anything that indicated this was old information. After a lot of unsuccessful work to get MySQL to handle cursors with 1 million plus rows, I was directed to use Postgres.
After installing Postgres and running benchmarks, I was unable to get the same transaction through-put as I had achieved with MySQL. This may be a tuning issue, but after a week of working on it the best I could get was 20,000 rows per minute in Postgres versus 350,000 per minute rows in MySQL. So back to MySql and rereading the documentation for the MySQLdb interface for Python. Quite by accident I read about SSCursor and SSDictCursor in the Using and Extending section of the documentation. These cursor types will open a server side cursor and will process the large transaction set. As a bonus, it performs almost as well as the regular cursor.
On my i-3, 3gig memory Fedora 17 box, I am achieving over 300,000 rows per minute which is acceptable for the processes being performed.
Upgraded from Fedora 15 to Fedora 17 and installed Postgres db as I needed the functionality of a server-side query. After the upgrade, I was unable to log on to phpPgAdmin and in the httpd error log I was seeing the message.
PHP Strict Standards: Only variables should be passed by reference in /usr/share/phpPgAdmin/redirect.php on line 14
Finally, I thought about SELinux and in the boolean options section there is an option
apache - Allow HTTPD scripts and modules to access databases
I enabled this option and the problem is solved.
For those who use the command line
setsebool -P httpd_can_network_connect_db 1
If you are using the WordPress Zenon theme and need to make some heavy customization, you may want to follow the best practices to create a child theme. Unfortunately, the Zenon theme does not support the child themes due to some inconsistent coding. The following patches to the main theme will allow the support child themes. This code should work for the Lite and Pro version, but it has not been tested on the Lite version. The code was passed back to the theme developer for inclusion in future releases and hopefully a future release will include it. Continue reading
To support a marketing project, I developed a screen scraping program which harvested names and addresses from a county public website and downloaded the information in a csv format. This file was then edited in Excel and mail merged to a Word document, saving hours of labor each week.
One challenge of the project was to cleanse the addresses to reduced the number of returns from the mailing due to invalid addresses. As part of the cleansing process, the address was run through a parser written in PHP. This code was found online and was a good starting spot. However, there were some problems with parsing streets, cities and states that had two words. Several modifications later, some of the problems were cleared up, but several adjustments are still pending.
I made the changes needed for the project, but time did not permit correcting all the issues.
The updates address parse routine can be located at http:github.com/cswaim. Let me hear how you are using this.
For a recent project, the client required that several remote computers be time synch’ed by a Trimble GPS unit. The software running on the remote computers was written in C++. I was unable to find a generalized routine to get the gps time, but I did locate some code that defined all the command and report messages, so using that base code, I developed a routine to issue commands to the gps and process the returned messages.
I have posted the class in a github repository and have included as sample driver. You can find the repository at http://github.com/cswaim/gps. If you use this, let me hear how you are using it.
I heard from several international friends this weekend after updating the tpg_get_posts plugin. They all had the same message, “your upgrade broke my website” or variants of that message. And they were right. Continue reading
A recent project which involved working with MySQL Workbench and accessing a MySQL database on a Fedora 14 computer has proven to be a challenge in getting the connection established. Besides receiving rather meaningless errors Continue reading