Random writings on running, software & product development, business and anything else

Category: Technology (Page 2 of 12)

Technology, software development, FOSS (Free and Open Source Software) and the web. From languages like PHP to specific tools, books and anything else.

Site Rebuild

For a while I have had 2 blogs, but both have been very quiet. Time to rectify this, so I am merging the personal site into the business / software development one, here at ernieleseberg.com.

Things will be a bit messy for the time being, but that is better than nothing at all.

Jigoshop v1.0 beware

Jigoshop recently released v1.0 of their WordPress e-commerce plugin. Beware the upgrade from the existing version is far from smooth. This was found out the hard way when a client updated their site. Tax calculations, featured products shortcode and products out of stock are just some of the errors encountered.

There are fixes in the support forum, but I would suggest waiting for v1.01 at a minimum.

Drupal Redirects Deletion

As part of a system data migration to Drupal 7, we have been using the Redirect module to handle redirects from old urls to the new.
This works fine, but as part of our fine tuning of the import process we clean out some of the content and then reimport. A node_delete does not remove the redirect so later when the redirect is added, the system returns a PDO Exception.
Continue reading

15 Years of KDE

KDE Official LogoIt is coming on 15 years since the original announcement for KDE. For most of my time using Linux KDE has been my preferred desktop environment and still is today.
The first time I saw KDE was in about 1998/9 when I installed Mandrake on my aging Windows PC. It took a few years before KDE/Linux became my default environment and then I did head to Gnome land around KDE4/4.1. But that is history.
Today I run Kubuntu not only for personal use but also business and software development. By the weekend it will be Kubuntu 11.10 with KDE 4.7.2.
And should I go down the tablet route, KDE might have me covered with Plasma Active.

WooCommerce – No Thanks

WooThemes LogoSo WooThemes have released v1 of WooCommerce an ecommerce plugin for WordPress. This is a fork of the Jigowatt ecommerce plugin Jigoshop. Given the GPL licensing of the code the fork was legally fine, but I found the whole process ethically dubious. The reason for the fork seemed to be purely for financial gain given their own attempts to create an ecommerce plugin had failed and they could not come to a commercial agreement with Jigowatt or at least 1 other similar plugin development group.
Jigoshop LogoI have 1 site about to go live using Jigoshop, but another in early stages of development. It would be derelict of me not to at least check out WooCommerce for the sake of my client.
Continue reading

Goodbye devreview


devReview is a site I have run through a couple of incarnations over the last 4-5 years. It has never really had the time & attention for the plans I had for it, so I have decided to close it down, and put the domain up for sale through sedo. All the content that is relevant will be moved here over the coming days.

PHP News #7

PHP news for the fortnight ending August 27th, 2010.

  • Jolt is a new PHP5.3+ framework aimed at fast and efficient web application development.
  • CodeMash a multi development language technical conference on current practices, methodologies and technology trends. January 12-14, 2011, Sandusky, Ohio.
  • Embarcadero RAD Studio XE with support for PHP
  • Registration opens for ZendCon 2010. Early bird by 19 September.
  • Zend Framework 1.10.8 Released with bug fixes
  • CakePHP 1.2.8 released of bugfixes and optimisations
  • Phantm 1.05 released. Statically analyses PHP code to detect and report type mismatches

Bash hour date formatting issue

The little things that can trip you up. I had completed a bash script that took some log files, moved & renamed and then archived. Quite a common usage of the Linux shell. Worked yesterday, but this morning I was getting errors. Edited script file below

PREFIX=$(date +"%k%M")
# Edited

for FILE in 2* ; do
  mv $FILE temp/$PREFIX-$FILE;
done

# and more

Why would the mv work yesterday, but fail this morning, with errors about target not a directory. The answer is in the use of the date formatting %k. From the man page:

%k     hour ( 0..23)

The hour in 8:53 using %k does not return 8, its is 8 with a space in front of it. This only became obvious when I placed double quotes around the mv destination.
Simple fix, use %H, which will return two digits, in this case 08. Problem solved.

Using MySQL stored procedures

A lot of my past software development background has been around client/server in financial markets, with the main RDBMS use in Sybase, but also MS SQL Server and Oracle. In most cases stored procedures is the way to query and manipulate the database. There are a number of reasons for this including security, performance and centralised business logic out of the client.
Now in recent years I have made the move to web development in PHP, and in most cases using MySQL as the database server. From personal experience of others code, and available FOSS systems, it is extremely rare to see use of MySQL stored procedures behind web sites. They are there, have been for a number of years, and do work. So why is this so?
The first reason I could understand, was that they are a MySQL 5 feature, and most FOSS apps set their MySQL minimum requirements at version 4.x.
I now understand a 2nd and crucial reason, thanks to a post by Jay Pipes. MySQL stored procedures are not the same as Sybase or MS SQL. The shared compilation performance benefit is not there in MySQL 5.0/1 for non persistent or pooled connections. ie. most smaller to medium web sites. Their usage may actually be to the detriment of performance.
So stored procedures can have a use in MySQL, but mostly in limited use cases.

Nginx and PHP environment directive

With the Apache web server, I set a server wide directive of which environment the server is in, eg. production, test or dev, using the SetEnv directive. In a PHP script I can pick up this value, and set on all debugging in dev, or suppression in production. Having it set 1 place in Apache means I don’t need to hard code the environment in any PHP code, making movement of code between environments cleaner.
Recently I have begun to use Nginx as the web server with PHP fastcgi for a project, and was looking for a similar set up. The answer I have come up with is an additional entry in my fastcgi_params file. The exact name & location of this file may be different for you. Mine is located at /etc/nginx/fastcgi_params.

fastcgi_param  SYS_ENV             dev;

This way in my bootstrap script I can have the following code:

if ($_SERVER['SYS_ENV'] === 'production') {
    date_default_timezone_set('America/Los_Angeles');    
} else { // Test and dev
    error_reporting(E_ALL|E_STRICT);
    date_default_timezone_set('Australia/Sydney');
    ini_set('display_errors','On');
}

There is probably another way to do this with Nginx, and I would be happy to hear it, as I try and improve my Nginx knowledge.

« Older posts Newer posts »

© 2024 Ernie Leseberg

Theme by Anders NorenUp ↑