Nov
19
2010
0

Filesystem fixtures for symfony

This is just a quick post to provide a landing page for a new symfony plugin I’ve created: sfFilesystemFixturesPlugin. I’m not going to explain the plugin in detail here, all the information you need is on the plugin’s readme page.

In a nutshell, the plugin lets you populate a symfony project with filesystem data like images and thumbnails in much the same way as you would populate a database using regular symfony fixtures.

Feel free to leave questions, comments, and bug reports in the comments.

Jun
10
2010
8

Per-environment fixtures in symfony

UPDATE:

I have now packaged this script into a symfony plugin called sfEnvironmentFixturesPlugin. Check it out and hit the ‘I use it’ link if you find it useful!

Feel free to leave questions, comments, and bug reports in the comments.

Symfony‘s fixtures are a great way to set up initial data and/or test data for a system. Whenever I create a new symfony project however, I always find myself wishing there was an easy way to specify which fixtures contain data required for production systems (the ‘initial’ data) and which contain data that I only need when developing (the ‘test’ data).

I recently started such a project and came across a reasonably elegant solution. With a simple YAML file placed in your fixtures directory, you too can have such a set up if so desired.

(more…)

Apr
29
2010
5

Why I avoid using Subversion externals

I’ve been using Subversion for a few years now and one of the tricks I’ve picked up on is avoiding the use of externals like the plague. I first stumbled upon this idea when including a large code base as an external in one of my own projects.

Subversion operations on the project in question were lightning fast. I could make a code change, and the commit operation would take only the blink of an eye. Likewise, updating other working copies with my changes was similarly instantaneous.

Then I included a large dependency as a Subversion external. From that point on, Subversion operations were very sluggish and it soon became a chore to update my working copies.

(more…)

Mar
17
2010
7

Creating web thumbnails with PHP Imagick

It may seem like a subject that has been done to death, but creating thumbnails from images can be a complex and frustrating task, especially when you’re faced with a wide variety of formats in your source images.

The script below uses PHP’s Imagick extension to create a thumbnail from pretty much any source image. It can handle RGB & CMYK images, TIFFs, PNGs, JPEGs, GIFs, BMPs and just about any other format in just about any size, and it can also handle images with embedded colour profiles (this is very helpful when converting images created in Adobe software).

(more…)

Dec
03
2009
46

Expanding forms with symfony 1.2 and Doctrine

I recently started learning how to use the forms system in symfony 1.2 and for the most part I was impressed with its simplicity and flexibility. Unfortunately I was thrown in the deep end somewhat when a project I was working on had a requirement for an “expanding” form – that is, one where a certain section of a form should be able to be repeated as many times as necessary to accommodate the user’s needs.

In the case of the project in question, the specific situation was an application form where the user could fill out any number of team members involved in their project. Each team member consisted of a name and a role, both free-form text fields. Team members were to be stored in the database, linked to the application in a one to many relationship.

Circumstances conspired that this must be achieved in a single form, so full of confidence in symfony’s design decisions regarding the forms system, a bit of light Googling revealed the answer – symfony’s embedded forms system. Great, so you just plonk in a few embedded forms and away you go, right? Wrong.

The good news is, I managed to find a solution that satisfied the requirements, eventually. The bad news is that it is not easy, elegant, or particularly reusable.

What follows is a loose guide to implementing such a system. Being a relative newcomer to symfony I cannot guarantee that this is the best way to do things, so tread with caution, and if you think of a better way to achieve the same outcome, please please let me know! Read on if you dare… (more…)

Sep
29
2009
16

Automatically signing .jar files in NetBeans

Just a quick article on something I struggled to find a good example for – configuring NetBeans to sign a .jar file after compilation is complete.

This is very handy, for example, when developing an applet that requires permission to access the file system. This requires the applet to be “signed” using the jarsigner utility, and this quickly becomes a tedious step when testing changes made in your applet in the browser itself.

(more…)

Jul
22
2009
0

Revisited: foreachif()

A while ago I blogged about my desire for a foreachif() construct in PHP. A recent comment from a reader made me re-think the concept and consider ways in which it could be implemented elegantly, without the need for changes to PHP‘s syntax.

(more…)

Written by Erin in: IT,PHP,Programming | Tags: , ,
Dec
12
2008
6

PHP wish list – part 2: reverse combined operators

It’s time for part 2 of my PHP wish list! In this instalment I’ll detail another feature that I would love to see in PHP: reverse combined operators.

If you missed part 1 (you probably did), you can read it here.

“What the hell is a reverse combined operator?” I hear you scream. Well, technically they probably don’t exist yet, so I’m sure a better name could be found, but bear with me and I’ll try to explain…

(more…)

Written by Erin in: PHP,Programming | Tags: , , ,
Dec
04
2008
16

PHP wish list – part 1: foreachif()

PHP is a great programming language. Honestly, I’ve worked with it almost every day for 5 or so years and I still love it. I haven’t even considered trying Python, promise! *looks guiltily at Andi and Zeev*

Sometimes though, I do wish for something more. Never enough to switch teams (sorry Python), but there are a few points I keep coming back to. This, in fact, is at the present moment the sole reason for this blog’s existence – I simply don’t have anywhere else to voice my frustration.

So, without further ado I give you part 1 of my PHP wish list: the foreachif() construct!

(more…)

Written by Erin in: PHP,Programming | Tags: , , ,