Jan 30
While using PHP5, almost everyone knows that SimpleXML is the easiest class to utilize when absorbing data from an XML source (be it XML, Atom, RSS, etc...). But, there are instances where things aren't as smooth as one would hope. I was reading in some RSS feeds from WeatherBug the other day, and was all fine and dandy, until I came to an annoying little snippet of code within the feed.


When I got to that data, SimpleXML couldn't retrieve it. When I did a dump of the entire feed, SimpleXML expressed the description tags as being empty. Ok...so how the heck can we get at it?

It's much simpler than one would expect. You forcibly convert the value of that field to a string. That's it.


The annoyingly difficult thing about this, is that I knew I wouldn't be able to figure it out on my own, and the PHP docs didn't help with that one. I went to Google, and that took a few tricky searches to find what I needed too!

Source: Using SimpleXML to Parse RSS Feeds

Tip: That link also shows how to traverse different namespaces, just in case your RSS or XML sources use namespaces, which the last time that happened I used a DOMDocument object, which was a little more work than necessary. I wish I knew this back then!

Posted by Brendon Kozlowski

Jan 3
Google Labs has not given up on their little endeavors, and one of the recent additions to the host of services is the Chart API. By using a series of GET variables in a web request, one can have a dynamically generated chart returned for them. The following chart is the "Hello World" example they give using the following code:

Hello World Chart

Continue reading "Google's New API: Google Chart"

Posted by Brendon Kozlowski

Jun 15
Although I personally detest Wordpress, it does have its uses and the user-interface is well-constructed, making it much easier for non-technical users to use it. Regardless, when it doesn't do quite what you want it to do, extending it can sometimes be really easy (due to the massive number of plugins), or extremely difficult. Most of the time, in my case (recently), it's the latter and not the former.

I was recently given the task to import an unmodified XML dataset into a web-based tool as tabular data, HTML'ified, and allow for visual editing of the information, and they wanted to use Wordpress. I thought, "Okay, that should be easy enough." Well, okay, do I create a plugin to handle the import? I don't really want to learn Wordpress hooks and programming functionality considering I hate the thing...no, I'll just import it directly into the database. I used a diff tool to discover that creating a new draft entry only modifies three database tables anyway, that's easy enough. Got that working, 1-2-3, lickity-split!

But now, we need to let staff have access to modify the tabular data.

Continue reading "Extending the Wordpress Visual Editor"

Posted by Brendon Kozlowski

Jun 6
I'm amazed, stunned, and laughingly surprised that programmers have taken it amongst themselves to come up with a new language based on what we like to refer to as "1334" speak. Granted, this isn't quite "leet" speak, but more like an amalgamation of statements poking fun at current illiterate IM conversationalists. You have to check this out to believe it.

LOLCODE.com

If nothing else, the CafePress store should be cool. :-)

Posted by Brendon Kozlowski

May 28
For information on exactly what dp.SyntaxHighlighter is, please see it's code-site on Google Code. Due to theme compatibility I've had to make some moderate changes to the original CSS of the SyntaxHighlighter package (for better, not for worse), there are no actual visual differences from the examples given in the original package (well, there shouldn't be anyhow, that's what my modifications were for, but this is a first release / test version).

I've always preferred the markup that the SyntaxHighlighter script from Dream Projections (now hosted on Google Code) created over GeSHi's output. Although when using GeSHi the code itself is made "pretty", it's not a necessity, so I feel that the use of JavaScript and CSS would be better served for this purpose than using server-side techniques as GeSHi does. This is where dp.SyntaxHighlighter comes to the rescue, and it handles it wonderfully!

What would the output look like using this script/plugin?
Example without JavaScript enabled:
Using a PRE tag:
<?php
    //the infamous Hello World
    echo "Hello World!";
?>

Using a TEXTAREA tag:

With JavaScript/plugin enabled (either PRE or TEXTAREA):


You'll have to read on to see supported languages and usage information.

Continue reading "Serendipity dp.SyntaxHighlighter Plugin Available"

Posted by Brendon Kozlowski

(Page 2 of 6, totaling 27 entries)