NULL problem in GPix admin panel
Latest weeks I got many bug reports about error like this:
Database Error: DB Error: constraint violation(update `mp_settings` set site_name`='XXXX',`site_description`='YYYY',`currency_symbol`='$',`user_accounts`='1',`approval_required`='0', `admin_email`='manager@example.com',`html_email`='0',`use_fckeditor`='1', `secret`='jdb314tab518', `interlaced_images`='0',`palette_images`='0',`site_down`=NULL, `blog_comments`='0', `expires_check_at`=NULL,`multiple_grid_pages`='1',`grid_columns`='1',`rss_latest_pixels`='10',`rss_top_pixels`='10', `rss_blog_articles`='0',`pixel_list_by_clicks`='0',`seo_status`='optimized',`link_to_us_enabled`=NULL,`upload_images`='1', `order_image_galleries`='ksort#SORT_REGULAR',`pixel_list_enable_images`='1' where `id`='1' [nativecode=1048 ** Column 'site_down' cannot be null])
this error just "come". Many users don't touch admin settings very long time and got this error when have tried to update settings. After research I discover that problem caused by new MySQL version (5.1). I am not sure if this problem have relation with mysql configuration settings, but it isn't GPix problem with MySQL 5.0 and lower GPix work many years without any notice. Look like MySQL 5.1 don't like definition NULL default 0 and situation when GPix try to update table and don't set value for column with this definition MySQL generate this error.
So, question is how we can solve this? - it is simple
look error message for table and column. In our case
- mp_settings - it is table name. You can see it in first line of message after word 'update'
- site_down - is our column and you can see it at the end of message before 'cannot be null'
Now you can build and execute mysql query which will fix this error:
ALTER TABLE `mp_settings` MODIFY `site_down` `site_down` INT NULL DEFAULT 0;
do not forget to replace table name(mp_settings) and column name(site_down - twice)
Execute query like this via phpMyAdmin or mysql console and error will go away.
GPix 1.4.0 released
Why I release 1.4.0 directly after 1.3.6?
answer is simple - new core functionality.
- fixed missed header problem. Sent mails going to spam in several Outlook versions.
- 'original image loss' problem solved for admin and users http://forum.tufat.com/showthread.php?t=55832
- fixed NULLs errors for settings table
- backlink-IPN paypal problems http://forum.tufat.com/showthread.php?t=55833
- option to disable images in tooltip
- developed integration design
New integration design provide way integrated GPix with third party software. As example in 1.4.0 you can see Joomla integration.
In next version I plan Drupal, WordPress.org, Mambo and vBulletin
paypal problem
Some users report problem with PayPal module. After step 6(process payment) GPix return them to step 1(get pixels), but payment page expected.
After multiple tests and user site verification I define settings combination which broke GPix payment process.
Before official GPix 1.3.6 release all users can download fix from official support forum
GPix 1.3.5 released
version 1.3.5 contain next updates:
- fix logout problem
- member optition to remove existing region
- double PayPal transaction confirmation
- fix localization functionality for PHP4
- fix 'get pixel' functionality for free for table with brouke id
- discounts for coupons and mails
- add new region property description - configurable via admin
- region page added with grid link point option which can be enabled via admin
- Allow users to add pixel ads together with keywords for their sites. It makes sense only if you implement an additional page that is optimized for user’s pixel ad. A Victor clicks pixel ad on home page and it will be redirected to this page. Users’ keywords will replace pixel site keywords on this page. Than, Visitor may click again on pixel ad and it will be redirected to the advertising site. - translation for title and description header tags.
- categories for grids and regions
new GLink release
As usually GLink release come after GPix release.
At this moment, I prepare new options functionality, which is developed for GPix.
GPix 1.3.4
Thanks for all how help for this release. I hope we remove most of bugs (software have bugs by definition, he-he).
This release contain next changes:
- german and french translation updated
- multi get fixes
- pixel list in admin area(such as in GLink)
- "maintain settings" beatified
- fix admin and user side update for original image
- front-end link in admin toolbar
- 'timezone set' functionality added. Affect web and mysql servers
- original image functinality improved
- original image from admin side
- add 'settings' functionality, which use options table, with option per row functionality
- add to Gpix an additional field in order to allow admin putting some additional meta tags (robots, keywords, description, author, copyright).
- search for several words
- improved "htmlyesno" smarty plugin functionality. Added new options "default" and "value". Labels used for radios, now you to select user can click to strings "yes" or "no".
- pending status (waiting for an administration approval after user side update)
if Admin enables "Yes". An approved User may change later (after approval it's content) the content of the linked site to show offensive/obscene/adult material and Admin may not dicovered it
As usually I help to update customized templates for free if you help for this release. Be free to request my help if you need it.
Settings optimization.
GPix design implement cell per option philosophy and this require to run database each time when I add new option.
So, today I finish to test philosophy 'row per option'. I just tested code which use actively options table with new option 'timezone'. So, to add new options I will need to add html code only. This mean that alter table query will not be required.
You Tube mod
Release for YouTube mod can be accessible via phpLD official site only.
This release contains fixes for problem with empty video items.
I am sure phpLD core team will update file on official forums.
optimization with memcached - is it simple to implement?
memcached is service which provide memory cache storage. It can provide access to cached object via network and it is extrimly fast!
memcashed pecl module is a way which can be used to access cache storage. How it work? It more complicated instead Cache_Lite, but it is fastest. This fact can be explain: Cache_Lite use file system to store cache objects.
So, how PHP developer can use memcached module?
First memcached service need to be installed and configured. It can be done for Unix/Linux systems and for Windows NT/XP/Vista.
Second implement memcached usage to cache functionality like this:
<?php $memcache = new Memcache; $memcache->connect($memcached_host, $memcached_port) or die("Can not connect to memcached server"); if ($content = $memcache->get('content_key')) { $content = generated_complicated_content($params); $memcache->set('content_key', $content, 0, 30); } echo $content; ?>
look really simple and very useful.
PEAR::Cache_lite - speed, simplicity, security
One way to speed up web application is to lower database usage. Databases designed to provide very fast manipulation with data in files. Often developer use databases for everything and store session data, user files. This action make tables big and database server work slowly... As result an simple file based cache will speed up application very quick.
An simple example what we can do with Cache_lite:
<?php // Include the package require_once('Cache/Lite.php'); $id = 'example_id'; $options = array( 'cacheDir' => '/tmp/', // directory where cache files will be stored 'lifeTime' => 3600 // expired time ); $Cache_Lite = new Cache_Lite($options); // Test if there is a valid cache for this id if (!$data = $Cache_Lite->get($id)) { // Cache miss ! // multiple sql queries or high load functionality put generated content to data $data = get_generated_content(); // save generated content $Cache_Lite->save($data); } echo $data; ?>
Simple and efficient. Variable data will contain string, so if you need to store objects just use serialize

