Cyprich.com

Occasionally Relevant Insights from a Software Builder

By

Happy Programmer’s Day!


// Compile with Visual C# 2005.

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;

namespace HappyProgrammersDay
{
class Program
{
static void Main (string [] args)
{
DateTime dtNow = DateTime.Now;
Calendar calDay = CultureInfo.InvariantCulture.Calendar;

if (calDay.GetDayOfYear (dtNow) == 256)
Console.WriteLine ("Happy Programmer's Day!");
}
}
}


Today is Programmer’s Day. This is the 256th day of the year which usually turns out to be September 13, but on leap years its the 12th day. The number 256 is used because if you fill a byte with 1’s, i.e. 1111 1111, the value of it is 256. Aren’t we programmers clever?

The traditions to this day are, according to Wikipedia, “behaving silly, coding silly programs, mini computer games, playing with old computers, etc.”. This isn’t an official statutory holiday, but I think if enough people contact their local political representative, we can make it one.

By

Zend Core: PHP Makes It Into Prime Time

PHP has been steadily growing in usage since the start of the millennium. It has overtaken Perl as the primary programming language for web applications and will likely dominate this area for many years to come. The language is becoming increasingly common in the corporate world in spite of the initial suspicion many had over it being a free and open source application.

One of the advantages of PHP is the ease in learning it. Enough can be picked up in a few days to create database driven web sites. The only real issue is that PHP can be difficult to install and setup, and also in installing a database server to go with it. This is easier with Linux because the typical installation includes PHP and a database, such as MySQL. If your using Windows, PHP and a database server needs to be installed manually.

Zend has provided a quick way to setup a PHP development environment with Zend Core. This is a collection of applications that installs and configures PHP. It can also install MySQL and add support to several other databases (DB2, Informix, Oracle, and SQL Server).

image

In Windows, PHP can be setup to work with IIS or Apache can be installed instead. Working with MySQL on the command line can be a challenge, so phpMyAdmin can be setup as well. For programmers willing to learn a robust PHP library, Zend Framework is available.

Zend Core can be installed in Windows, 32/64-bit Linux, and Macintosh OS X. This is the simplest way to create a PHP development environment which is not just for novices, but for experienced users as well. There isn’t any tinkering to make PHP or the applications it uses work properly. The advantage of using Zend Core is that it will update PHP and any of the applications that it installs. You no longer have to visit the MySQL site, for instance, to check if a new version of the database is available.

Zend Core is a free download, but requires registration with Zend first.

By

Fixing Database Error 1054 in Fireboard

I found another problem with Fireboard. After I installed it, I went to the Forum Administration option in the Fireboard Control Panel and got the following error:

DB function failed with error number 1054
Unknown column ‘g.group_id’ in ‘on clause’ SQL=SELECT a.*, a.name AS category, u.name AS editor, g.name AS groupname, h.name AS admingroup FROM jos_fb_categories AS a LEFT JOIN jos_users AS u ON u.id = a.checked_out LEFT JOIN jos_core_acl_aro_groups AS g ON g.group_id = a.pub_access LEFT JOIN jos_core_acl_aro_groups AS h ON h.group_id = a.admin_access GROUP BY a.id ORDER BY a.ordering, a.name

I found the solution from terrox in the Fireboard forums. You can fix the problem by downloading admin.fireboard.zip and extracting it to the /administrator/components/com_fireboard folder in your Joomla installation. There is a folder called /components/com_fireboard that can easily be confused with the correct folder. Keep in mind that you are replacing the admin.fireboard.php file. If you are not prompted with a message asking to replace a file, your probably copying to the wrong folder.

The Forum Administration option should then work correctly and you can begin creating forums for your web site.

By

Installing Fireboard in Joomla 1.5

Fireboard is a forum application that integrates with Joomla. It works without any problems in Joomla 1.0, but when you try installing it in 1.5, you get the following error (the folders may be different on your installation):

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 58368 bytes) in /var/www/joomla15/libraries/joomla/installer/adapters/component.php on line 548

What’s happening here is that PHP is running out of memory and more needs to be allocated for the installation to succeed. There are two ways you increase the memory.

  1. Modify php.ini

    If you are using your own server, find the php.ini file (on Linux, type locate php.ini) and add the following command:memory_limit = 12M

    If this command already exists, the increase the memory to 12M.

  2. Modify .htaccess

    Chances are that you won’t have access to php.ini if you are on a shared hosting plan. The alternative is to edit the .htaccess in the root folder of your Joomla installation. The default installation of Joomla has the file named as htaccess.txt. You will need to rename it to .htaccess before adding to it. Add the following command to the .htaccess file:php_value memory_limit 12M

If the memory problem persists, increase the value until it works.

As a side note, you need to have the System – Legacy plugin activated before you can install Fireboard. The application was written for Joomla 1.0 and won’t run natively in 1.5. You can find the plugin through the Extensions menu, and then select Plugin Manager.