Archive for 8th December 2006

In Praise of iG:Syntax Hiliter

You’ve probably noticed in my Programming entries, I’m using a WordPress plugin to display code in a color-formatted view with line numbers.

The plugin I am using is iG:Syntax Hiliter, made by Amit Gupta, a fellow geek based in India. (I had a friend in grade school named Manish Gupta; I don’t know if maybe they are related. From what I gather, “Gupta” is the “Smith” of India; but I digress.)

Anyway, Amit used the very popular GeSHi (Generic Syntax Highligher) code highlighting program, written in PHP, as the building block; he also relied on the Yahoo! User Interface Library. Amit didn’t credit those as clearly as I would have, but he didn’t hide the fact he used them, either, and he is distributing his code under an open license.

That makes him good people, as we say in Maine.

There are a number of benefits to iG:Syntax Hiliter:

  • It’s one of the few that works with WordPress 2.x
  • It’s easy to skin.
  • He’s taken care so that the default install works with most WordPress themes.
  • He’s done a good job of documenting the operation of the plugin, but it’s not that hard to use.

I chose it because the other WordPress 2.x-compatable syntax highlighters I could find, I didn’t like. They all had one or two serious problems with aesthetics; Amit’s plugin is by far the most elegant.

I highly recommend iG:Syntax Hiliter. It’s right up there with Akismet, in my humble opinion.

A Simple Calendar Page To Display Date-Specific Data In PHP

Recently asked on Yahoo! Answers:

PHP-MYSQL - filling a calendar?

i wrote this code for writing a calendar. The calendar is MTWRFSS.The inputs that are required are:
1)Month Name
2)Starting column to begin the fill. For example, Dec2006 starts on Friday, so there are 4 blanks (m-t-w-r)
3)Number of days in month.
// link with code (txt) format
http://www.target209.com/sample.txt

Im probably just going to make a table thats stores 1-3.

In my main table, it stores, key(primary auto increment, date(datetime format), and journal entry.

OBJECTIVE - While the code in sample.txt is executing, it will make a hyperlink if an entry exists for that day. So the user can just click on the calendar day, and then the results will display in the main section of the page.

My theory is to
1)do a sql query to find out all the days that exist for month xx. then set them to an temp array.
1a–assume there are entries on the 3,8,13,23,28th day of month xx. Then write an if statement to check the For $i value against the the temp array.
Any thougts?

With all due respect to the questioner, who’s a pretty nice fellow in my opinion, one of the things I remember from when I first started programming — and something I see oft repeated in my travels — is that newbies tend to view problems as a lot more complex than they are. I think that’s actually an issue anytime someone takes on something new; your skill set is limited, so everything seems tough, and the more you try to fit it into what you do know, the harder it becomes to resolve.

However, a calendar is a pretty straightforward problem, when you break it down into its components.

Continue reading ‘A Simple Calendar Page To Display Date-Specific Data In PHP’ »