Binary Expressions

« Previous PageNext Page »

2007-11-1

PHP Calendar Functions Error

Filed under: — Adam @ 11:56 am

I was trying to use the PHP calendar API and immediately received this error message, “Fatal error: Call to undefined function cal_days_in_month()”. This error message means PHP was not compiled with the calendar extension.

Solution


The only solution to this error message and other similar error messages relating to the PHP calendar API requires PHP to be compiled with the calendar extension by adding “–enable-calendar” to the “configure command” as stated in the PHP documentation on the Calendar functions page.

How to Tell if the Calendar Extension is Installed


You can verify weather or not the PHP Calendar extension was compiled at install by using the phpinfo() function. When viewing the output of phpinfo() look under “Configure Command” just below “Build Date” and if you do not see “–enable-calendar” present then all PHP Calendar functions will not work.

Configure Example


./configure –with-mysql=/usr/local –with-mssql=/usr/local –with-apxs –with-zlib-dir=/usr/lib –with-libxml-dir=/usr/local –with-config-file-path=/var/www/conf –with-iconv=/usr/local/bin/iconv –enable-exif –-enable-mbstring –enable-calendar

2007-10-20

WordPress v2.05 to 2.3 Upgrade

Filed under: — Adam @ 9:18 am

Well this upgrade went very smooth with no problems at all. It really only took 3 steps to upgrade WordPress from v2.05 to v2.3. I had to upgrade two plugins and I deleted all the obsolete plugins to keep things clean. I admit a fresh install might have been better but didn’t want the hassle of putting the pieces back together.

Akismet plugin didn’t require any upgrade.

Upgraded WP Plugins (installed fresh)

Removed WP Plugins

  • WordPress Database Backup (upgrade required)
  • WP-Cron (obsolete)
  • WP-Cron-Mail (obsolete)
  • WP-Cron Dashboard (obsolete)
  • WP-Cron Future Pings (obsolete)
  • WP-Cron Gravatar Cache (obsolete)
  • WP-Cron Moderation (obsolete)
  • WP-Cron Reminder (obsolete)
  • WP-Cron UpdateLinks (obsolete)
  • WP-phpMyAdmin (upgrade required)

Source: Upgradding Wordpress

2007-10-17

PHP Free Chat - Joining Chat Email Notification

Filed under: — Adam @ 2:50 pm

I recently upgraded an install of PHP Free Chat to that latest version of 1.0 Final. However it was still lacking a feature to notify individual(s) that someone has joined the chat if they were not already in the chat application to begin with. I came across a posting explaining how to achieve this in PHP Free Chat at PHP Free Chat Forum. After a little reading and discussion I was able to implement the feature.

Here’s my modified version for the solution based on the forum posting. The pfcmail() function can be made to be way more versatile for any use, however for my use it was made to be simple and produce properly formated email messages.

Solution


  1. Create a new PHP file called pfcmail.php with the following lines of code.
  2. 1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    
    < ?php
    function pfcmail($szChannel,$szNickname)
    {
    	$szCurrentDateTime = date('F j, Y @ g:i:sa', time());
    	$szClientIP = getenv("REMOTE_ADDR");
    	$szHostName = gethostbyaddr("$szClientIP");
    	$szServerName = getenv("SERVER_NAME");
    	$szEmailWebmaster = getenv("SERVER_ADMIN");
     
    	$szEmailTo = "Webmaster <$szEmailWebmaster>";
    	$szMsgHeaders = "From: $szEmailWebmaster\r\n";
    	$szMsgHeaders .= "X-Mailer: PHP\r\n";
    	$szMsgHeaders .= "MIME-Version: 1.0\r\n";
    	$szMsgHeaders .= "Content-type: text/plain; charset=UTF-8";
    	$szMsgSubject = "[WEB] Chat Login - $szNickname in channel $szChannel at $szCurrentDateTime";
     
    	$szMsgBody = "Date\t\t\t\t: $szCurrentDateTime\n";
    	$szMsgBody .= "Server Name\t\t\t: $szServerName\n";
    	$szMsgBody .= "Client IP\t\t\t: $szClientIP\n";
    	$szMsgBody .= "Client Hostname\t\t: $szHostName\n\n";
     
    	$szMsgBody .= "Join chat now by going to http://$szServerName/chat/index.php.\n\n";
     
    	$szMsgBody .= "---\n";
    	$szMsgBody .= "Email message auto-generated by PHP mail().";
     
    	$nSendEmail = mail($szEmailTo, $szMsgSubject, $szMsgBody, $szMsgHeaders);
    }
    ?>
    Note: The extra r, n and t’s should have a \ character before them to produce a carriage return, new line and tab. WordPress appears to remove the character.
  3. Make sure to modifiy the code in pfcmail.php for the To, from, subject and body of the email message to your requirements.
  4. Save pfcmail.php file into the following path, /src/commands/.
  5. Edit /src/commands/nick.class.php at line number 84, just before “return true;” add the following code and save.
  6. require_once(dirname(__FILE__).”/pfcmail.php”);
    pfcmail($c->title, $newnick);

You should now be receiving email notifications each time an individual joins chat.

2007-10-13

PHP vs ASP

Filed under: — Adam @ 10:21 pm

php:-) Closer to Java/C++/Perl Style of Programming
asp:-| VBscript ?

php:-) No Show Stopper Bugs
asp:-( just surf to any asp based portal and see what i’m talking about

php:-) Cross Platform Migration Strategy.
asp:-( Chilisoft ASP ? (cost lots of $$$s)

php:-| no application variables … but what is that anyway ? server’s
database ?
asp:-) application variables

php:-| HTTP GET and POST variables are automatically created as global
variables (security??)
asp:-| i have to “Request.” my HTTP GET and POST variables??

php:-( if your php script is not working , you can blame no one but yourself

asp:-) You can blame Micro$oft, iis , asp and so on…

php:-( you don’t have time for a coffie break because your computer never
crashes
asp:-) you have a lot of coffie breaks …

2007-10-5

Sendmail - Setup as Smart_Host

Filed under: — Adam @ 12:56 pm

I will go through a basic setup of Sendmail as a smart host. The goal is to relay all mail outgoing from an internal OpenBSD server to a gateway that will then send out the email on the server’s behalf. No inbound email traffic is permitted to the internal OpenBSD server only the outside world sees the gateway as the mail server. I’m by no means a Sendmail expert, the steps I explain here is what I’ve learned on my own and with the assistance of dhartmei and NicM in IRC EFNet #OpenBSD channel and cannonball in IRC Freenode #sendmail channel.

Setup

  • Make a copy of openbsd-localhost.mc, “cp usr/share/sendmail/cf/openbsd-localhost.mc /usr/share/sendmail/cf/openbsd-localhost-smarthost.mc”.
  • Edit openbsd-localhost-smarthost.mc and add this statement without double quotes “include(`/usr/share/sendmail/m4/cf.m4′)dnl”.
  • Edit openbsd-localhost-smarthost.mc and add this statement without double quotes “define(`SMART_HOST’,`input_host_here’)dnl”. Note: if an IP address is used enclose the IP address with square brackets.
  • Compile configuration file without double quotes, “sudo m4 /usr/share/sendmail/cf/openbsd-localhost-smarthost.mc > /etc/mail/localhost.cf”. If you receieve “permission denied”, try this instead “sudo ksh -c ‘m4 /usr/share/sendmail/cf/openbsd-localhost-smarthost.mc > /etc/mail/localhost.cf’”.
  • Shutdown Sendmail (kill). Without double quotes do “sudo kill ‘head -n1 /var/run/sendmail.pid’”.
  • Start Sendmail as started previously, “sendmail -L sm-mta -C/etc/mail/localhost.cf -bd -q30m”. You can see how sendmail was started by executing without double quotes “grep sendmail /etc/rc.conf*”. In my case it returned /etc/rc.conf:sendmail_flags=”-L sm-mta -C/etc/mail/localhost.cf -bd -q30m”.

openbsd-localhost-smarthost.mc example

divert(-1)
#
# Copyright (c) 1998 Sendmail, Inc.  All rights reserved.
# Copyright (c) 1983 Eric P. Allman.  All rights reserved.
# Copyright (c) 1988, 1993
#       The Regents of the University of California.  All rights reserved.
#
# By using this file, you agree to the terms and conditions set
# forth in the LICENSE file which can be found at the top level of
# the sendmail distribution.
#
#

#
#  This configuration only runs sendmail on the localhost interface.
#  This allows mail on the local host to work without accepting
#  connections from the net at large.
#

divert(0)dnl
include(`/usr/share/sendmail/m4/cf.m4')dnl
VERSIONID(`@(#)openbsd-localhost-smarthost.mc $Revision: 1.4 $')
OSTYPE(openbsd)dnl
FEATURE(nouucp, `reject')dnl
FEATURE(`accept_unresolvable_domains')dnl
FEATURE(`no_default_msa')dnl
define(`SMART_HOST',`[10.10.8.1]')dnl
MAILER(local)dnl
MAILER(smtp)dnl
DAEMON_OPTIONS(`Family=inet, address=127.0.0.1, Name=MTA')dnl
DAEMON_OPTIONS(`Family=inet6, address=::1, Name=MTA6, M=O')dnl
DAEMON_OPTIONS(`Family=inet, address=127.0.0.1, Port=587, Name=MSA, M=E')dnl
DAEMON_OPTIONS(`Family=inet6, address=::1, Port=587, Name=MSA6, M=O, M=E')dnl
CLIENT_OPTIONS(`Family=inet6, Address=::')dnl
CLIENT_OPTIONS(`Family=inet, Address=0.0.0.0')dnl
dnl
dnl Some broken nameservers will return SERVFAIL (a temporary failure)
dnl on T_AAAA (IPv6) lookups.
define(`confBIND_OPTS', `WorkAroundBrokenAAAA')dnl

2007-9-30

Parents 1, Smart-Ass, Teenage Son, 0

Filed under: — Adam @ 9:15 pm

I came across this amazing blog entry about an experience some parents had with there smart-ass teenage son. I must say well worth the lengthy read, cheers to the parents at a well done job as a gag and as a lesson to there teenage son.

Source: Boobs, Injuries & Dr. Pepper - Parents 1, Smart-Ass, Teenage Son, 0

2007-7-10

PEAR::HTML_BBCodeParser Upgrade 1.1 to 1.2.2

Filed under: — Adam @ 12:54 pm

Problem #1 - “[notice] child pid 13449 exit signal Segmentation fault (11)”

On a OpenBSD v3.7 i386 system running Apache v1.3.29 (not chrooted) with PHP v5.1.4 I upgraded HTML_BBCodeParser from version 1.1 to version 1.2.2 by running at command line “pear upgrade-all”. After the upgrades were complete the web site would not load a web page anymore. I looked at my HTTPD server logs and noticed I was receiving the following error message in error_log file, “[notice] child pid 13449 exit signal Segmentation fault (11)” whenever there was a HTTP request on port 80 or 443 to the web site. I couldn’t understand what the problem could be but then decided to uninstall HTML_BBCodeParser v1.2.2 and re-install HTML_BBCodeParser v1.1 to see if the web site would still function. Indeed the web site did load and function fine. So I decided to uninstall and install each version up to v1.2.2 to see where the breaking point was. As soon as the latest version of HTML_BBCodeParser v1.2.2 is installed the web site stops functioning. I was able to determine that there was something that has changed in v1.2.2 or something I did wrong in the Filters I created and existing filters I altered.

Solution #1

I uninstalled HTML_BBCodeParser then manually removed the directory /usr/local/lib/php/HTML/HTML_BBCodeParser. Then I installed HTML_BBCodeParser v1.2.2 and copied the BBCodeParser.ini example from /usr/local/lib/php/doc/HTML_BBCodeParser/BBCodeParser/example/ to /usr/local/lib/php/HTML/BBCodeParse/. After that the web site functioned as normal again.

Problem #2 - “Warning: strpos() [function.strpos]: Empty delimiter.”

However I discovered that when using PHP 5 one has to alter the BBCodeParser.ini file otherwise you will receive the following warning message when trying to load a web page using HTML_BBCodeParser, “Warning: strpos() [function.strpos]: Empty delimiter. in /usr/local/lib/php/HTML/BBCodeParser.php on line 354″.

Solution #2

Edit your BBCodeParser.ini and alter the line for the opening tag character and closing tag character to be enclosed by double quotes around the square brackets, [ and ]. Apparently this has been an issue for awhile now, http://pear.php.net/bugs/bug.php?id=2580.

Example After Alteration - BBCodeParser.ini

[HTML_BBCodeParser]

; possible values: single|double
; use single or double quotes for attributes
quotestyle = single

; possible values: all|nothing|strings
; quote all attribute values, none, or only the strings
quotewhat = all

; the opening tag character
open = "["

; the closing tag character
close = "]"

; possible values: true|false
; use xml style closing tags for single html tags ( or )
xmlclose = true

; possible values: a comma seperated list of filters
; comma seperated list of filters to use
filters = Basic,Extended,Links,Images,Lists,Email

2007-6-27

Microsoft Surface Parody

Filed under: — Adam @ 11:02 pm

A great parody of Microsoft’s new upcoming product called Surface.


Source: YouTube.com

2007-6-25

Ninja Training

Filed under: — Tux @ 3:10 pm

This is such a cool site and one of the best sites that i have ever found about Ninja and how you can learn everything about them. The equipment/weapons is pretty cheap if you ask me and really cool looking. The only thing is they let anyone just take it which isn’t good for the criminals finding out about the site and learn the art of the Ninja.
Source: ninjitsuryu.com

Women Vs. Men Showering

Filed under: — Tux @ 2:50 pm

The differences between women and men showering.


Source: YouTube.com

2007-6-23

Kid’s Bookmarks - Updated

Filed under: — Adam @ 10:49 am

I have fixed the following broken links.

  • Online Etch a Sketch
  • Shrek
  • Rob Briggs BurgerTime
  • Robb Briggs games - working on it

Added the following links.

  • Bratz
  • Webkinz
  • GameGoo
  • Schoolastic Games

Web Site: The Kid’s Bookmarks

2007-6-20

Joy of Tech - #974 - Wii Bowling

Filed under: — Adam @ 10:10 pm

I found this comic strip amusing as it is making fun of Nintendo Wii Sports Bowling. Anyone that has become addicted to this game will be more then familiar with this joke.

Source: Joy of Tech #974

« Previous PageNext Page »

Take back your mailbox - CAUCE.org

Powered By Wordpress PHP: Hypertext Preprocessor MySQL Powered Download Juice, the cross-platform podcast receiver
Proud To Be Canadian Get Firefox Valid XHTML Valid CSS
<NO>OOXML Logo


27 queries. 0.693 seconds.
Copyright © 2004 - 2005 by Adam Douglas