Publish/Subscribe Implementation with the Zend Framework

by Kevin on December 21, 2008

Download Source|Try Online Demo

I’ve been meaning to post our implementation of a publish/subscribe system for quite some time, but it took a winter blizzard for me to finally get it done. I don’t want to get caught up in the terminology of Observer Pattern versus publish/subscribe versus loosely-coupled event driven architecture, etc. What I do want to do is describe a simple approach to loosely-coupling PHP classes with events that occur in your application.

One other thing to note. I mentioned the Zend Framework in the title. The demo project is built using the Zend Framework, but the publish/subscribe implementation is largely independent of Zend except for the use of the Zend_Loader class. We really like the Zend Framework so you’ll probably see more of it in our examples in the future.

Just to make things clear, here is the terminology I will be using to describe the actors and actions in our publish/subscribe system:

  • Event - encapsulates information sent between the publisher and subscriber
  • Event Subscriber - subscribes to events and receives them when they are published
  • Event Dispatcher - maintains event/subscriber relationships and delivers events that are published

Read more »

Connect one HDMI source to multiple outputs

by Kevin on November 23, 2008

I recently made a leap to the 21st Century by purchasing a Samsung 1080p LCD TV and an Xbox 360 console! While I’m sure you are very happy for me, there’s no need to blog about the actual purchase. That was relatively easy. The only difficult part was convincing my wife that we should spend our $$$ on more electronic gear. :-)

At any rate, the new TV is in our family room which is directly adjacent to my office. I already had a small hole in the wall between the 2 rooms for running other cables (i.e. networking, DVR), but I’ll save that process for another blog entry. At any rate, I spend quite a bit of my time hiding out in my office working, etc. and thought it would be great to be able to play the 360 both in the office and in the family room, especially considering I prefer shooters which aren’t exactly family-friendly. So, I definitely wanted to be able to connect my 360 to both my TV and computer monitor.
Read more »

Generate ODF documents in Java with ODFDOM

by Greg on November 22, 2008

Since it has been a while since I posted anything to the ol’ blog here I figured I was due for some content. So, here we go - we’re going to play around with the Open Document Format (ODF) in Java in this post. Why Java? Because that’s what the super-cool ODFDOM is written in of course. ODFDOM is an api to easily read/write ODF documents. ODF documents are based on XML and compete with Microsoft’s own Open XML document format. ODFDOM supercedes previous ODF libraries AODL and Odf4j and it is sponsored by Sun. Basically, its the one you want to use should you decide you need fixed format document generation in java - hey that’s exactly what we’re going to talk about here, sweet.
Read more »

Friendly Timezone names for PHP

by Greg on September 23, 2008

Until recently, I’ve never had a requirement to show a list of timezones in a form for the user to select their location from. So, no big deal, PHP has a list of supported timezones that seem to make sense (similar to the linux/unix timezone format)…only there’s a problem - its huge and isn’t the most user-friendly list out there. In fact, I would prefer to use a list similar to the one Windows displays to the user when they open the clock settings.
Well in order to show that list to the user, I needed a mapping of the timezone display names in the Windows list to the timezone names in php - for example, (GMT-06:00) Central Time (US & Canada) => America/Chicago.

For the most part, this was pretty easy - there are only a few instances where you cannot directly map a city from the PHP identifier to one in the Windows display name but with a little research it didn’t take long to complete the list.
Read more »

Wiring a house with a Gigabit backbone

by Greg on September 23, 2008

Recently, my wife and I finished the basement in our house and I installed a gigabit backbone to connect all the rooms. This was actually the second time that I did this install because I had done it in our previous home before we moved so I already had the tools. A couple of people have asked me what I used, so I decided to put everything I know about it here in this post including tools I own, the equipment I installed, and where I ordered everything. Now, I’m not saying this is the best way to wire a gigabit infrastructure in your house…this is just the way I did it.

Read more »

Apache virtual hosts in OS X Leopard

by Greg on September 23, 2008

I know, I know - this has been done lots of times before. But I’m posting here for my reference because everytime I go to set one up I always either forget where the apache conf files are (/etc/apache2) or I forget to allow access to the directory. So this is how I do it:

Step 1

Open Terminal and cd to /etc/apache2

Step 2
edit httpd.conf in vi or whatever (probably need to use sudo command to open it in write mode)
Find the line towards the bottom of the file that includes the httpd-vhosts.conf file
Read more »

Simple Application with Zend_Auth and Zend_Acl

by Greg on September 23, 2008

Download Source|Try Online Demo

Ok, so I’ve been looking into Zend Framework a bit recently and I think its pretty great. What I wanted to accomplish with the Zend framework was a simple app that would allow users to login and have secure/unsecure areas in the site. I also wanted users to be automatically sent to the login form anytime they attempted to enter a secure area (if they were not already logged in). So I decided to implement this basic concept in Zend to familiarize myself with the framework and in the end have an something that I could just copy and use as a a starting point for new web apps.
Read more »

Finding the Master Node in a JBoss Cluster

by Kevin on September 22, 2008

If you’re using JBoss Application Server for any sizeable application, you’re most likely using a clustered deployment. Clustering is a must in today’s world but can present some challenges when it comes to management and monitoring.

Recently, I had the task of writing an web application to browse the messages in a JBossMQ JMS queue. This task would have been relatively easy if the javax.jms.QueueBrowser interface could be utilized. However, with the case of JBossMQ (and possibly other JMS providers), due to message prefetching and caching, the QueueBrowser will most likely not return an accurate list of what is in a JMS queue at any given point in time. If you want more information on the behavior for JBossMQ specifically, read this. To make a long story short, the only way to accurately browse and manipulate the contents of a JMS queue with JBossMQ is to use the org.jboss.mq.server.jmx.Queue mbean which resides for the specified queue on the Master node.
Read more »

Need inspiration for your tech startup?

by Kevin on September 21, 2008

If you’re like me, you need a little extra motiviation from time-to-time.  When it’s 11pm and you’re weighing the decision to go to bed, do some gaming, or keep plugging away at your latest side-project, check out this post from Steve Place on his graduatedTaste blog.

Reading through this list just might do the trick and motivate you to finish the night strong, even if it requires an extra cup of coffee the next day.

:-)

Thumbs up to Magento ecommerce

by Greg on September 11, 2008

Recently, one of our clients needed a shopping cart for wholesale customers. We turned to the open-source, php based Magento eCommerce platform for the heavy lifting - they offer flexible theme support, great documentation, and an excellent backend admin interface.



The community for Magento also seems very strong - most questions we had were easily answered by searching the forums.

We stumbled across a link to Ecommerce-Extensions.com while in the forums, and boom! We had a great looking, full-fledged cart up and running in no time. Ecommerce-Extensions.com makes a sharp ‘clean’ series of Magento store themes and their price was reasonable. At the time, a single-domain license was $149 - easily paid for itself in just the time it saved us to get the cart up and going.

So, in short, if you need an end-to-end solution for a online store, you should definitely give both Magento and Ecommerce-Extensions.com a look.