News aggregator

Using Symfony Dependency Injection with Zend_Application

Planet-php - 6 hours 13 min ago

As a follow-up to my recent post on Dependency Injection containers and Zend_Application I was eager to find out if its possible to integrate the new Symfony Dependency Injection Container into the Zend Framework. To my suprise its possible without having to make any changes to one of the two components. An example use-case would look like:

$container = new sfServiceContainerBuilder(); $loader = new sfServiceContainerLoaderFileXml($container); $loader->load(APPLICATION_PATH.'/config/objects.xml'); $application = new Zend_Application( APPLICATION_ENV, APPLICATION_PATH . '/config/application.xml' ); $application->getBootstrap()->setContainer($container); $application->bootstrap() ->run();

Resources instantiated by Zend_Application are then injected into the container by the name of the resource and are given the resource instance. Any object from the Symfony container can then use these dependencies in their object setup. The only drawback of the integration is the fact that the Symfony Container is case-sensitive in regards to the service names but Zend_Application lower-cases all service before injecting them into the container. The following code is a restatement of my previous example of a MyModel class which requires a Zend_Db and Zend_Cache constructor argument.

$container->register('myModel', 'MyModel') ->addArgument(new sfServiceReference('db')) ->addArgument(new sfServiceReference('cache'));

Access to a MyModel instance with its dependencies is then granted through the call $container->myModel throughout the application. Make sure to call this after running Zend_Application::bootstrap, so that the Resource dependencies are injected first.

Categories: php

Watch Tour de France 2009 online

WebUser - Sat, 2009-07-04 07:00
The Tour de France begins this weekend and you can watch coverage of the world's most famous cycling event on the web.
Categories: general tech

Watch US Moto GP online

WebUser - Sat, 2009-07-04 06:57
Moto GP returns to Laguna Seca in California this weekend with Valentino Rossi hoping to extend his championship lead and you can watch online.
Categories: general tech

Tyche Moving to New Hardware

Dreamhost Status - Sat, 2009-07-04 04:19

The web server, tyche, is currently having issues on boot. We’re currently working on moving it to new hardware and should have it back up within the next hour. Check back for updates!

-The Happy DreamHost Server Moving Robot

Categories: general tech

Speaking in the Fall

Planet-php - Sat, 2009-07-04 03:47

With the announcement of the speakers for this year’s Zend/PHP Conference it seems I’ll be giving three talks this fall (in the span of two months):

First at CodeWorks 2009 (Dallas) I’ll be giving a talk on best practices, standards and tools to help with both in your PHP development:

  • “B,S,T…Easy as 1,2,3″

The other two will be at ZendCon (in San Jose). They’re on two different topics:

  • “Taming the Deployment Beast” - looking at some of the development and deployment practices that can make releasing your code simpler
  • “Right Where You Belong (The PHP Community)” - no matter what your skill level or area of focus, everyone has a place they can call their own in the PHP community. This talk highlights a few of them.

Hope to see you all there! Here’s more info on the two conferences: CodeWorks (Sept. 26th-27th in Dallas) and ZendCon (Oct. 19th-22nd in San Jose)

Categories: php

OpenSolaris Tour 2009 - Day 2 - Sao Leopoldo/BRAZIL

weblogs.java.net - Sat, 2009-07-04 01:04
Sao Leopoldo is a small city outside of the great metropolitan area of Porto Alegre. In there, just happened the Day 2 of OpenSolaris Tour 2009 at UNISINOS.
Categories: JSP/Java

PHPFreaks.com: 10 Signs of Crappy PHP Software

PHP Developer - Fri, 2009-07-03 23:51

On PHPFreaks.com they have a new "top ten" list of signs to look out for to tell if you're dealing with crappy software or not.

Like it or not, as a professional developer, sooner or later you are going to do some customising (if you are lucky, "extending") of existing software. If you are not familiar with the software, it is good advice to look into it before accepting the job. I had to learn that the hard way. But how do you recognize crappy applications without getting knee deep into the code?

Their list of signs include:

  • The software tries to reinvent the object model, or "fix" language features.
  • Scattered HTML and SQL
  • Multiple levels of inheritance
  • In the code base, there is a directory called "core"
Categories: php

M3DD/LA - A gather of mobile and embedded community in Latin America

weblogs.java.net - Fri, 2009-07-03 22:55
On June 20th, Brazil hosted the first edition of M3DD/LA (Java Mobile, Media and eMbedded Developer Days - Latin American Edition), in Goiania. The event was huge success (600 attendees) and organizers are considering a big event for next year.
Categories: JSP/Java

M3DD/LA - A gather of mobile and embedded community in Latin America

weblogs.java.net - Fri, 2009-07-03 22:55
On June 20th, Brazil hosted the first edition of M3DD/LA (Java Mobile, Media and eMbedded Developer Days - Latin American Edition), in Goiania. The event was huge success (600 attendees) and organizers are considering a big event for next year.
Categories: JSP/Java

PEAR Blog: PHP 5.3 Windows and PEAR (go-pear.phar)

PHP Developer - Fri, 2009-07-03 22:20

The PEAR blog has a quick note for users of PHP 5.3 and Windows:

Some users have reported that the windows builds of PHP 5.3 are not able to open the shipped go-pear.phar file.

If this is your situation, you can use their workaround (run the distributed phar version) or grab the non-pharred version.

Categories: php

Lorna Mitchell's Blog: Status Codes for Web Services

PHP Developer - Fri, 2009-07-03 21:44

Lorna Mitchell has posted the last article in her look at web services - a focus on status codes.

Unlike the other posts in this series, this one is quite specific to one type of service - REST - since it deals with status codes, specifically HTTP ones. The ideas are transferrable however and other types of service can return statuses in a similar way.

She mentions things to keep in mind in returning the codes, some of the more interesting codes as well as some typical situations where things like an error code 500 would be thrown.

Status codes are like a headline to the calling entity about what happened, and are a valuable tool in the web service toolkit.
Categories: php

A tale of two components (JSF2)

weblogs.java.net - Fri, 2009-07-03 21:44
In this blog, I'll examine two different ways to create a poll component with JSF 2, and in doing so, we'll look briefly at the two different ways that you specify id's in the two JSF 2 Ajax APIs.
Categories: JSP/Java

Oracle Technology Network: High Performance and Availability with Oracle RAC and PHP

PHP Developer - Fri, 2009-07-03 20:12

John Lim has written up an article for the Oracle Technology Network about creating high performance systems with Oracle's Real Application Clusters (RAC) and PHP.

Running a software application that is able to work reliably through hardware and software failures is incredibly hard. [...] In this article, I will cover the network, architecture and design of our RAC application. Then I will discuss the real-world experiences and problems we experienced.

He details their RAC setup - load balancers, application servers and their RAC servers - before working through the different technologies and how they're all installed and configured to work together most efficiently.

Categories: php

Automatic compression of jsf.js

weblogs.java.net - Fri, 2009-07-03 19:45
Just a quick note that we've now added automatic compression of the jsf.js file served by JSF 2. The file size of jsf.js, 71k uncompressed, comes to about 16k compressed (there are a lot of comments in there). There is no user action required to make this happen: If the Project stage is Development, the file is served uncompressed (for ease in debugging with something like Firebug), but if the Project stage is anything else, then the file is compressed (and essentially unreadable, since besides stripping all comments, variable names are stripped, as well as all line breaks).
Categories: JSP/Java

Symfony: return javascript response

Stereo Development Blog - Fri, 2009-07-03 19:11

This is an old trick, but I still find it useful and will post it here in case it will help other symfony developers out there. If you are using the prototype.js library for your ajax requests, the Ajax.Request (and similar) utility methods will automatically evaluate the server’s response as javascript if the response has the ‘text/javascript’ content-type header. You can do this by setting your response headers like so:

// from within a template: sfContext::getResponse()->setContentType('text/javascript');   // from your action $this->getResponse()->setContentType('text/javascript');   // as an action that returns some javascript directly $this->getResponse()->setContentType('text/javascript'); return $this->renderText("alert('This is a javascript alert')");

This proves useful when you want to open up a modal window, show an alert, update multiple areas on a page, or just about anything else with javascript returned from your ajax request.

Categories: general tech, php, software

Poll Result: Java Technologies Employment Market

weblogs.java.net - Fri, 2009-07-03 16:40
This past week's java.net poll on the Java technologies job market implies that the global economic downturn is far from over... Also:
Java Today: JavaFX: gr8 2 c on fonz; Project Marble - augmented reality in Java with JMF, Java3D, NYArToolkit and Trident; and Rails on GlassFish - "most performant of all", "simpler and just works", "blazing speed".
Weblogs: Event Based Programming in JavaFX; 2 JavaOne Hands On Labs , Sun Technology Exchange, Java Technology Day Israel, and Java Day Turkey; and My CommunityOne 2009 presentation is online.
Forums: Glassfish Performance??; open jdk7 build error; and Possible to set http listener with web application at / context?.
Featured Articles: Grails and Continuous Integration: An Essential Combo; Exposing Domain Models through the RESTful Service Interface, Part 1.
Featured Podcast: Java Mobility Podcast 81: JTDF.
Categories: JSP/Java

Beautiful Continuous Integration?

Medieval Programming - Fri, 2009-07-03 15:28

Its great to see that continuous integration acceptance is growing. Sismo is the CI system created by the symfony team for monitoring symfony itself. It is written in symfony and will be open sourced.
When I first saw it, I was not happy about it. Mainly because it is “yet another tool”. But what I do like is to look at it. Its the most beautiful CI frontend I know. You might argue that being beautiful does not matter for a software development tool, but I tend to disagree. It just makes it more pleasant to work with it.

Chapeau, Sensio designers. I really like your designs. I think the symfony components website, which just had the third component launched, is one of the most appealing framework/library sites I have seen so far.

Categories: php

DevShed: Using the spl_autoload() Functions to Build Loader Apps in PHP

PHP Developer - Fri, 2009-07-03 14:26

In the next to last article of their loader series, DevShed looks at replacing some of the file loading functionality in their examples with functions from the SPL.

As I mentioned before, the Standard PHP library comes bundled with some helpful functions, such as "spl_autoload()," "spl_register_extension()" and "spl_autoload_register()" that allow you to either use a default implementation of the "__autoload()" function, or create a custom one for it.

Their example defines the extensions to use for autoloading and the name of the file/class to pull in. The rest is done automagically.

Categories: php

Symfony Components : The Event Dispatcher

Symfony - Fri, 2009-07-03 14:12

After the YAML and the Dependency Injection, it's time for the Symfony Event Dispatcher component to join the crowd of the Symfony components. This component is not new. It has been introduced in symfony 1.1 and is heavily used in the symfony core to make symfony more decoupled and more flexible.

The Symfony Event Dispatcher component is represented by an Octopus.

Of course, you can start using it right away in your non-symfony projects by reading the dedicated book:

Like other published components, the component comes with a test suite that covers 100% of the code, and it is continuously built by the Sensio Labs continuous integration server, Sismo.

Be trained by symfony experts - Jul 22 Paris - Aug 19 San Francisco - Sep 23 Paris - Oct 21 Nantes - Nov 18 Paris
Categories: php, software

DPC 2009 Day 1

Planet-php - Fri, 2009-07-03 13:18
After my colleague Cal reviewed DPC's tutorial day, it's now my turn to look back at the first real conference day of 2009's Dutch PHP Conference.

The day started with a nice movie made by Almer and Norman after which Cal officially opened the Dutch PHP Conference and introduced Andrei Zmievski to do the opening keynote. Andrei gave an outline of developments in PHP including the changes we are going to see in future versions. Closures, namespaces, better garbage collection and a few more things are coming to PHP5.3, but I think this isn't new to most people. I haven't really read a lot on PHP6 yet other than Unicode, so the addition of traits, C# style getters and setters and scalar/return value type hinting were new to me. I think this was a nice talk to be the opening keynote, because other than just being infomrative the talk also had the right amount of humor with some examples of frustrated people reporting "bugs" and a setting for y2k compliance. I wasn't active in PHP 10 years ago, but it made me laugh when I heard that the y2k_compliance setting basically did nothing other than stop people asking about it.


Continue reading "DPC 2009 Day 1"
Categories: php
Syndicate content