Namespaces, *sigh*

If you read internals (and by read, I mean glance at the barrage of subjects in your inbox), you too have seen the flood of namespaces related emails. I have no technical expertise to add to the conversation. However, unlike the otehr 90% of the people that are like me, I decided not to get involved. The garbage collector being discussed is much more interesting. For those that have not been following along, here is the basics from the best of my memory.
People asked for namespaces.

The powers that be did not want to do them.

Someone with CVS access made a patch and suddenly it was a good idea.

Yay! We have namespaces in PHP6 and maybe 5.3.

Some people with CVS access decided they did not like them again.

Then other people defended them and get major kudos from all over the internet.

Then more patches were made to make them do what the haters wanted them to do.

And now people are again calling for resolution to an issue that afaik, was solved when it was commited to HEAD.

Then there are the pilot fish in all this. They swim along in the conversation trying to steer things their way. They want this feature or that feature or some odd thing that they used Super Pascal for AS400 in 1994. They say things like "while we are talking about namespaces, blah blah blah".

Now, if you don't care what I think about namespaces, you can stop reading here.

.

.

.

Ok, still here. Namespaces that are one per file, but only protect the functions and classes in the file are pointless. It is syntactical sugar. Instead of my_function. I have the namespace my with a function named function. But, in some other file I can call my::function or use my; and then use function. Boy, that makes it all clear. Right? If it is going to be one per file, lets scope the whole file please. Some of us still use PHP as Rasmus intended (or as I believe he intended). To quickly build pages using includes sanely. My include "header.php"; beats your object with a header method any day. Every developer I have worked with understood include "header.php"; in seconds. But dammit, the down side is that something in header.php eventually makes my life hell because of scoping.

Most of all, would someone please just say the magic words to make the insanity stop. There is a "REAL" internals list somewhere that we can't all see. You guys hash it out on there and then tell us what the plan is. All this back and forth is making us crazy. Maybe I should rehash unicode support again just to see the namespaces discussions die. I am not sure if that would be better or worse.

That is all that I have to say about that.

MySQL Conference Submissions

Well, it seems to be the thing to do to talk about the things you submitted to MySQL Conference.  So, I figured I would share.  I submitted 3 topics.
From one server to a cluster

In the last 10 years, dealnews.com has grown from a single shared hosting account to an entire rack of equipment.  Luckily, we started using PHP and MySQL very early in the company's history.

From the early days of growing a forum to surviving _Slashdotting_, _Digging_ and even a Yahoo! front page mention, we have had to adapt both our hardware and software many times to keep up with the growth.

I will discuss the traps, bottlenecks, and even some big wins we have encountered along the way using PHP and MySQL.  From the small scale to using replication and even some MySQL Cluster we have done many interesting things to give our readers (and our content team) a good experience when using our web site.

MySQL hacks and tricks to make Phorum fast

Phorum is the message board software used by MySQL.  One reason they chose Phorum was because of its speed.  We have to use some tricks and fancy SQL to make this happen.  Things we will talk about in this session include:

* Using temporary tables for good uses.
* Why PHP and MySQL can be a bad mix with large data sets.
* What mysqlnd will bring to the table with the future of PHP and MYSQL.
* How Phorum uses full text indexing and some fancy SQL to make our search engine fast.
* Forcing MySQL to use indexes to ensure proper query performance.

Perils of distributed software

Ever wrote software that has to be installed on n + infinity environments?  Phorum is such software.  The Phorum team has been developing for 10 years.  The vast number of configurations and wide range of user experience has shaped how we have written Phorum.  I will share some of the PHP, MySQL and user issues we have seen and how we have tried to work around them.

Wish me luck.  Maybe you can get the full version of one or all of thse in April.

Putting files into a database

So, once again, I was listening to the Pro::PHP Podcast (or is it Newscast?  guys?).  They were talking about putting files in to a database table.  Now, most people will say you should never do this.  And lots of time they are right.  And once upon a time I agreed with them without question.  Then I started living in the real world where sometimes you have to do things you never thought you would.  Here are the two places where I stores files in a database.

Phorum

Ever wrote software that has to be installed on n + infinity environments.  It really sucks.  Phorum version 3.3 or 3.4 was the first to allow attachments.  We put them on disk.  The instructions for setting up a spot on disk for attachments was longer than all the rest of the install document.  The support questions were even worse.  And there there were the people that left their old host and didn't take the files with them.  Just the database.  DOH!  So, in Phorum 5 we decided that for ease of use, there would be no need for Phorum to write to disk.  Well, we tried really hard anyway.  Its almost true.  We only write cache data to disk.  No config is written by the applicaiton and no permanent storage is written to disk.  Phorum 5.2 (near beta) has a new file storage system that allows for modules to be written to store the data wherever you want it.  There is already a disk storage module.  But, already there are people asking really naive questions about it.  Probably because someone told them to never store files in a table.

Replication

At dealnews we have a lot of images.  Every deal gets its own image.  We do 100+ deals a day.  So, getting those images distributed to all the servers is a task.  A deal could go from idea to live in 2 minutes.  So, we decided to store the images in the database.  3 versions of the image in fact.  With a little mod_rewrite magic we can pull the image from the DB and put it on disk on a front end server if its not on the server already.  From that point forward the file is served off of disk.  So, its a one time db hit per image per server.  Not that big of a deal.  We use a CDN now too, so it's really not a big deal.  We could probably skip the on disk part all together.  Backups are easy.  All the attributes of a deal are in the database.  Not some in the db and some on some disk.  We can just import the db to a test machine and have a fully functioning set of data to work with.

My editor of choice

So, I was listening to the Pro PHP Podcast on the way home from work today.  They were talking about Komodo a lot.  I figured I would give my favorite editor a plug.  Believe it or not, it's jEdit.

I keep trying all the latest and greatest editors out there.  I fought with Eclipse and have tried the newer more PHP centric offerings built on Eclipse.  I recently tried out Komodo Edit for a week.  I had tried the Komodo IDE when it came out for Mac a while back.  But, I just keep coming back to jEdit.

What I like about it

The main thing that I like about jEdit over the other top contenders of the new generation is that it has a simple file browser.  It does not have the concept of "projects".  Eclipse and Komodo both have these concepts.  But, when I really got to looking at the projects in Komodo, you basically set a point in your filesystem and tell it that everything in this dir is Project Foo.  So, really, you have to have your code organized on disk anyway.  It also bugged me (in Komodo Edit at least) that my project file had to live in the same dir with my project's code.  That just seemed awkward.  Not everyone that shares my SVN is gonna want that and its gonna be sitting there in my svn status as an unknown file.

Another thing I like about jEdit is the rather large plugin repository.  Now, it's an older project, so that is something that you would hope any established application would have.  But, if I am thinking about switching today, I have to give the nod to jEdit here.  The list is a bit Java-centric of course.  It's a Java application after all.  But, there are some good ones in there like a PHP code structure browser.  I can't live without that.  Makes finding functions or methods really easy in large libraries.

What I don't like

Its Java so its not quite like working with a native application.  The dialogs are funny and the UI is just a bit off even with the Mac plugin that makes it more Mac looking.  Having said that, I don't want a truly "Mac like" editor.  BBEdit and XCode are not my kind of editors.  I like tabbed interfaces vs. multi windowed UIs.

Its not an IDE, its an editor.  There is no debugging, at least, not easily.  There looks to be some ability to hook in debugging tools, but I have not gone through the trouble.  Of course, that could be said of many of the IDEs out there.  PHP has never had the ease of debugging that say Visual Basic had (still has?) back in 1998 when that was my full time job.  That was one thing about VB I loved.  The language was "eh".  But the IDE was really nice.

Things I don't care about that you might

jEdit does not have an SVN plugin that I can find.  I like my command line.  I know one coworker is addicted to the Eclipse real time SVN diff highlighting.  There is a CVS plugin, but I don't know how good it is.  I am not aware of any PHP code completion, but it may be there.  I have an odd knack for remembering stuff like that and those little pop ups just annoy me.  Oh, and did I mention its Java?  That put me off for a long time.  But, it won me over.

Phorum 5.2.0-alpha released

Yes! Its here! Phorum 5.2 has reached alpha status. Its been over a year since we branched the 5.1 code and started on 5.2. A lot has changed and Phorum is better for it. Much of the success of Phorum 5.2 goes to Maurice Makaay. He has done a lot of work to make the core code cleaner and easier for module developers. He has also been instrumental in the documentation project. As for new features and changes, below are a few. We are still updating a wiki page with all the changes and features at http://www.phorum.org/development/wiki/Phorum52News.

For your users:

  • Brand new template. Emerald is a more modern, full featured template. It uses many interface design recommendation used by usability professionals.

  • Rewritten search engine for faster search with more options.

  • New hybrid read page that is threaded and shows all messages

  • Better error messages when posting to help your users know what is wrong.

  • All new code for forum feeds. Both RSS 2.0 and Atom are supported.

  • New announcement module that gets announcements out of the message list and into a more prominent position.


For the admins:

  • New APIs for making modules that work with the core. (Along with full docs)

  • Template core changes so that similar vars in different templates have the same name.

  • More modules included with Phorum and officially supported.

  • Module run time ordering. You can not control in what order you modules run.

  • Sanity checks updated to help admins know if their Phorum is running properly.


There is a lot more that I don't want to list here. Please have a look at http://www.phorum.org/development/wiki/Phorum52News for the full list. We will be updating that list as we go along as well.

What is alpha status you ask? Well, while in alpha status, Phorum 5.2 may still get new minor features and code may be reworked extensively. Basically, it means that the major features we wanted for 5.2 are done. They need testing and that is where you come in. If you have the facility to test the code with your data, please do and report bugs.

O'Reilly Open Source Conference Day Two

So, day two was the cool keynote day.  Day one keynotes were from Tim O'Reilly (not that he is not cool) and the vendors sponsors.  The Intel building blocks stuff was neat, but most of it was vendor stuff IMO.

Today we had the "cool thing to here and see, but I proabably won't use it" keynote.  It was The Processing Development Environment.  It was really cool.  You can read more about it at processing.org.

The next keynote was hard for me to follow.  There were no slides he stood behind the podium the whole time.  Gnat  seemed to love it as he all told us in IRC.  You can read the guys blog at overcomingbias.com.  It was basically about overcoming the biases you have.... I think.

Interestingly, (speaking of bias) the next keynote was from Microsoft.  Coincidence?  According to the speaker, MS (or at least this guy) is really trying to make some Open Source stuff.  Time will tell.  Also, they are "working" with the OSI to get their licensing approved as Open Source licenses.  As somone in IRC said, its a win/win from them.  If they don't get approved, they can just blame the OSI for being inflexible.  Nate kind of put him on the spot about patents after his talk.  He handled it well and kind of rode the fence.

The last keynote was, for me, the pay off keynote.  Its the one I will remember from this year the most.  It was about branding.  The poor guy did not have his slides due to technical issues and still did a great job.  You can read Steve's blog at steve-yegge.blogspot.com.  Maybe he will post the slides.

I attended a couple of good sessions today.  One was about caching, mostly with APC.  But, if you stripped down the APC stuff and just took some of his concepts, you could apply some of it to lots of caching methods.  The talk was given by Gopal Vijayaraghavan of Yahoo! I don't have a URL for the site where his slides may be.  If I find it, I will post it.

Another one was about legacy PHP code.  I didn't agree with 100% of what he was saying, but if you are in the boat he described, anything is better than where you are.  The guys site is clintonrnixon.net.  Hopefully he will put of the slides and maybe a blog post about it.

The last talk that I want to tell you about was from Amy Hoy.   She gave the "When Interface Design Attacks!" again this year. Just like last year, it was brilliant.  There were new topics like web 2.0.  I was happy to see that the Phorum 5.2 template I have been working on (emerald) already included many of her recommendations.  I guess she rubbed off on me last year.  Amy has started her own consulting company.  If we need a usability and/or interface design help again (bleh, the last one was less than exciting) I will push for using her for sure.  Check out her site (linked above) for more stuff from her.

The day (and conference really) ended with parties.  We went to the Sourceforge Open Source Awards party.  phpBB won best tool for communication.  Gag me with a chicken bone.  I guess it has a large install base.  But, MySpace has lots of users too.  That does not mean its not a black eye on the internet.  Ok, MySpace is worse than phpBB for sure.  But, c'mon, I write Phorum.  I am biased (see above keynote =).  It was a popularity contest and I guess there are more kiddies to vote for them than say Pidgin which is what I voted for.  With all the trouble they have had with their name, I wonder if "Gaim" would have gotten more votes.  (see other keynote on branding =).  The phpBB team may need to see the branding keynote from this morning.  It talked about how it takes a generation to change perception about a brand.  Most people I talked to here have a negative reaction to the phpBB brand.

The rest of the night we just hung out at the party hosted by Jive Software. We use OpenFire from those guys.  I am not a big Java user on the server.  Its just one more different thing to admin in a company that is 99% GNU C apps on the servers.  But, Openfire does a damn good job with XMPP.

In closing, O'Reilly Open Source Convention was great.  I got some great ideas of stuff we should be doing.  I got confirmation of things that we are already doing.  And most important, IMO, we got to share with others how we solve problems.  As  Gopal said in his caching talk, sometimes is better to stop doing stuff and tell others what you are doing (paraphrase).

O'Reilly Open Source Conference Day One

Day one is complete.  Portland is great as always.  Its really day 1 1/2 since we got in at 1PM yesterday.  That allowed us to go to the MySQL/Zend party last night.  Great party by those guys.  Touched based with old friends and made some new ones.

I kind of session hopped today.  Of note, I attended Andi Gutmans PHP Security talk which really had little to do with PHP.  Like Larry Wall's onion metaphor, Andi presented an onion metaphor for security.  I stopped in for a while on the SOLR talk.  It looks neat.  I like that it is a REST interface to Lucene.  If we were not using Sphinx already I might take a longer look.  But, we like Sphinx and, SOLR and Lucene are Java.  Not that there is anything wrong with that, we just don't use Java a lot, so its just one more thing that would be out of the norm.  I admit I spent a good bit of time in what is being called the "hallway track" working on some code.  Work does not stop just because you are at a conference.

I got to hang out with Jay Pipes of the MySQL Community team a good bit.  We talked about the MySQL forums (which or course runs Phorum) and how they want to improve them.  They would like to see tagging, user and post rating and some other things.  Some good things will come out of that.  Hopefully they have some of the tagging stuff done already at MySQL Forge and can contribute that code to Phorum, saving us time.

I hosted the Caching for fun and profit BoF.  It was not packed, but it was a good time.  The MySQL BoF was at the same time, so we lost some folks to that I am sure.  They had beer and pizza.  Brad Fitzpatrick did come by and contribute.  Thanks Brad.  It was mostly the same stuff you get on the memcached mailing list.  "How do we expire lots of cache at once?"  Questions about different clients.  Stuff like that.  It kind of turned into a memcached BoF, but I tried to share the dealnews experience with the attendees including our MySQL Cluster pushed caching.

I have met many readers of both dealnews and this blog (hi to you) while here.  Glad to know that both my professional work and my personal work are of use to folks.  The demographic at this conference is dead on for dealnews.  Maybe I can get them to sponsor it next year.  That would be cool.

I say every year that I want to present "next year".  Something always keeps me from doing it.  Usually its just not having time to prep for it.  By the time I think about it, the call for papers has passed.  I really want to get it done this time.  We shall see I suppose.

We went to the Sun party tonight.  It was a good time.  There was beer that was free as in beer.  More hanging with friends and talking about all kinds of stuff.  Now, all you Slashdotters sit down.  I saw people from the PostgreSQL and MySQL teams drinking beer and having fun together.  OMGWTFBBQ!!!1!!  See, the people that really matter in those projects don't bicker and fight about which is better.  They just drink beer and have a good time together.

Anyhow, I will blog more after day 2.  There won't be a day 3 as I have to catch an 11:30 flight back home.  That is usually how it goes.  Not sure why they book anything on Friday really.  Even O'Reilly has its "after party" on Thursday night.  Its late, and I need sleep.

Phorum + Sphinx = really fast

Thomas wrote the Sphinx search module nearly a month ago. I have just now gotten to looking at it. From the things I have read, Sphinx looks really cool. I am considering using it in some other sites.

Sphinx is a "standalone search engine, meant to provide fast, size-efficient and relevant fulltext search functions to other applications. Sphinx was specially designed to integrate well with SQL databases and scripting languages. Currently built-in data sources support fetching data either via direct connection to MySQL, or from an XML pipe."

(Originally posted on the Phorum web site)

Phorum 5.2 Template

As Thomas has said, we have started working on 5.2. I had wanted to redo the template for 5.1, but by the time that came up on the list, there was so much already done to the code, I did not want to hold it back. I know some of you went to a lot of trouble to change your 5.0 templates to work with 5.1. Keep in mind that 5.2 may very well be a year or more off in the future. We don't release major changes as stable on a whim.

For those that want to keep up with the new template, you can see it at http://dev.phorum.org/phorum5-dev/. Keep in mind that some or all of it could be broken at any given time.

(Originally posted on the Phorum web site)