Tag Archive: PHP


Flast

I’m excited to announce the official release of Flast! (my very first open source project!)

For those of you who don’t know (everyone), Flast is an open source framework for PHP version 5.3.  It is focused on performance (fast) and removing restrictions on developers (flexible).

You can check out Flast here: http://sourceforge.net/projects/flast

Your feedback is much appreciated.

Here’s a little history about why I decided to create Flast…..

While working on DealsPlus and Sazze, we evaluated many PHP frameworks, but decided to create our own because they were all to slow and/or forced us to use a particular coding methodology (i.e. MVC).  After successfully creating a very useful framework that actually improves performance, I wanted to give back to the open  source community by using my experience (and the awesome new features in PHP 5.3) to create a framework that gives the developer complete control over performance and functionality.

Right now, Flast is in a very early pre-Alpha phase, but it should be useful by the time a production ready PHP 5.3 is released.

PHP Memcached Manager

We’ve been using memcached on both our sites for a while now to help alleviate database load and speed things up in general.

However, we’ve been lacking a good web-based manager to see the cache status and manually clear the cache.  (I’ve been doing this via telnet on the command line and have been to busy to write my own script…..)

Today, I stumbled accross this gem: http://livebookmark.net/journal/2008/05/21/memcachephp-stats-like-apcphp/

It’s a simple GUI for memcached that is written in PHP and was exactly what I was looking for!

PHP Alternative Syntax

So, I was having a discussion with a fellow developer at work today about the advantages of using PHP’s alternative syntax (details here).

Just so we know where everyone’s coming from, I come from a programming background and my colleage comes from a design background.

Anyway, he came to me asking my opinion on using the alternative syntax in scripts where we have a lot of HTML markup mixed in with the PHP code.  His reasons for wanting to do this?  The same as most proponents for using the alternative syntax…….it’s shorter and is easier to read.

Now I try to be impartial when making coding decisions because, let’s face it, our opinions do not affect how the machines execute our code.  It’s a travesty, but it’s true.  However, I just don’t agree that alternative syntax makes code shorter or easier to read.

Wait, wait.   Give me a chance to demonstrate my reasoning before you condem me.

Let’s look at some example code using the alternative syntax:

<p>What a niffty paragraph</p>
<?php if($a == $b): ?>
<p>Only the cool people see this!</p>
<?php endif; ?>
<p>Wow, aren't paragraphs great?</p>

Now, you might say, “this is super awesome. it’s so easy to see where the if block ends and there’s no separate lines for the PHP start and stop tags.”

However, you can do the same thing with less typing in the normal syntax.

Here’s the same code using the normal syntax:

<p>What a niffty paragraph</p>
<?php if($a == $b){ ?>
<p>Only the cool people see this!</p>
<?php } ?>
<p>Wow, aren't paragraphs great?</p>

As you can see, the normal syntax is shorter than the alternative syntax.  The number of lines are the same, but the number of characters is less.  Multiply this character difference by the number of times you use if, while, for, and switch in your script and you have a noticeably larger script file when using alternative syntax.  Which means?  Yep, it takes longer to execute scripts that use the alternative syntax than scripts that use the normal syntax.  Is this execution time difference big enough to matter?  Well, that’s a personal question that each script owner must answer for themselves.

And as for the readability aspect, any developer that is worth their salt uses an editor that highlights or otherwise shows matching braces.  Want to know where the other one is?  Just click on the one your curious about and the editor will show you the other one.

It is my experience that code is hard to read because the person who wrote it did  not format it properly.

Anyway, that’s just my opinion.  I’m sure everyone else has their own.  Please feel free to discuss.  Who knows, maybe you’ll change my mind ;)

Pingback is probably one of the greatest things for blogging since…..well…..blogging itself.

If you don’t know what pingback is, check out this well written article: What are Trackbacks and Pingbacks at WordPress?

Anyways, we just implemented the XML-RPC pingback protocol in PHP for Sazze because we’re allowing users to link to their relevant blog articles when they write reviews (see it in action).

In order to share the love, we ask that our users, in turn, place a link to their Sazze review on their blog.  However, with pingback we can make the link exchange automatic and that is win-win for everyone.  We promote our users’ blog articles on Sazze and we get a pingback link in their blog article’s comments.

Unfortunately, it seems that blogspot does not support the pingback protocol.  Instead they have a proprietary system called “linkbacks”.

Basically, blogspot searches blogs and includes them in its “blog search” index.  If your blog happens to be included in that search index, then blogspot will detect your links to their hosted blogs when it updates its index, and include a “linkback” link to your article on the blogspot blog that you referenced.

For everyone else whose blog is not indexed by blogspot, you’re out of luck.  No “linkbacks” for you.

Personally, I think this really sucks!  Blogspot is one of the larger blog hosting sites, and the fact that they don’t support one of the best open standards for inter-blog communication and article sharing is just disgusting.

I blame Google’s influence.  They like to pretend that they aren’t like Microsoft, but to them, their way is always the right/only way.  Hmmmm………sounds like Microsoft, no?

Follow

Get every new post delivered to your Inbox.