skoop.dev

  • About
  • @skoop@phpc.social
  • DbFinderPlugin: The ORM isn’t important anymore

    August 13, 2008
    doctrine, orm, php, propel, symfony

    One of the most important changes in symfony 1.1 was the creation of the symfony platform, the core of symfony had it’s classes completely refactored into a fully decoupled set of classes that could easily be picked or overruled when required. It meant total independence of those classes whenever you would choose to do that. An excellent path to go for symfony, as it gives more control to the developer.

    With the ORM, that was not fully possible. You would still have to write your code ORM-specific. For Propel, you’d use the Criteria object to build your query, and for Doctrine, you’d use the (slightly more beautiful) chaining of methods to build a query. But if you’d written code for one, you could not easily change to the other. Even moving from Propel 1.2 to Propel 1.3 would offer some challenges.

    Enter the DbFinderPlugin, a plugin written by Francois Zaninotto. This seems to be the ultimate solution in writing code that is portable between the different ORM’s. When used consistently throughout a project, switching to another ORM should be as simple as installing and configuring the new ORM plugin, configuring your databases.yml, and that’s it. DbFinderPlugin will take care of the rest.

    I see two very important advantages for the usage of this plugin:

    • Plugin development – Using DbFinderPlugin, it’s now very easy to write plugins that don’t care about the ORM you are using. The community will benefit a lot from this, as all plugin authors that use this plugin will now write plugins that are compatible with all ORMs. And the plugin authors will benefit a lot from this as well, since it will make their life a lot easier in writing plugins for all ORMs
    • Project development – You don’t really need to think about which ORM you need to use up front. You just start with the default Propel with DbFinderPlugin. Then, as the project advances, you can decide what you prefer: Propel or Doctrine. Or you make a choice at the start of your project, but halfway a technical requirement makes you reconsider that choice: switching should now be very easy. No need to rewrite all your queries anymore.

    The only possible downside at this point is that Doctrine is not fully supported yet. Propel 1.2 and Propel 1.3 are fully supported already though, so at least switching to the speed and efficiency of Propel 1.3 is already possible. As Doctrine-support is completed, I see a bright future for this plugin and symfony development in general.

  • Adding a link to a form element with Zend Framework

    August 10, 2008
    decorators, php, zend, zend framework, Zend_Form

    The problem I was stumped on friday was stupid enough. We have a form builder using Zend_Form that builds a form based on external XML input. In certain situations, a form field needs to have an associated link with it.

    I was quickly told by the friendly people in #php_bnl on irc.freenode.net that I needed to use Decorators for that, so I went diving into the documentation. Reading the official documentation, I couldn’t really get into how exactly the decorators worked and what I could do with them, however, DevZone to the rescue, because Matthew wrote an excellent article there on using the Decorators with Zend_Form. After reading through this article, I quickly understood how things worked, and had easily solved my problem. Well, almost.

    I got as far as setting the decorator order using $element->setDecorators(array()), and then, since I was using the Description decorator for this purpose, using $element->setDescription() to add my link to the form. All seemed well, except for one thing: Instead of a link being added to the form, I got the escaped HTML output.

    Diving back into the documentation, I really couldn’t figure out how to solve this. I knew there should be an easy way to do it, but I couldn’t figure it out. on IRC, I mostly got suggestions telling me to extend the element class I was trying to add a link to, but that seemed overkill for such a small exception. I tweeted my frustration, and quickly got a response from Matthew that I should e-mail him.

    It seems I was indeed very close and there is indeed a very simple solution to the problem: you need to set the decorator with an additional configuration parameter. So, this will work:

    $element->setDecorators(array(array(‘Description’, array(‘escape’ => false))));

    Of course a note needs to be put here: Don’t use this easily. You *are* turning off the escaping, so you need to be sure that whatever you put into the description is save data. But, being the slightly pragmatic developer that I am, for a situation like this, I much prefer this approach over having to subclass an element and override quite a few of the original methods of the element.

  • symfony-framework.nl: The Community Edition

    August 9, 2008
    netherlands, php, symfony

    With the worldwide growth of symfony, The Netherlands has not stayed behind. Usage in the Netherlands has grown, and with bigger sites like Dutch Cowboys and Kliknieuws moving to a symfony platform, I think symfony is starting to prove it’s worth in the dutch web application world.

    But with bigger sites moving to the platform, those are also proving the point I was trying to make with symfony-framework.nl: symfony *is* a platform that you can use for your applications. And with a growing number of developers using symfony in The Netherlands, it’s not just advocacy that is needed, but also a central place for the community to hang out.

    Which is why I started working on the next version of the site. Instead of a static one-way communication of reasons to use symfony and news, the site now offers more options for the community to interact. Besides the fact that you can now comment on newsitems, a new forum has opened, where you can ask questions (or help others), but also post job openings.

    So I hereby want to invite all the dutch developers using symfony to come by and have a look. And of course, offer feedback and give input on new features you’d like to see. This is definitely not the last update of the site 😉

  • Symfony 1.1 highlights

    July 29, 2008
    ibuildings, meta, php, symfony

    It’s not a full list and does not pretend to be. It is simply my view on why symfony 1.1 is a great successor to symfony 1.0.

    Read here.

  • Code analogy

    July 21, 2008
    atk, atkMetaNode, php

    anything you want to change can be done in postMeta
    only rarely you need to manually add stuff in the meta function
    the policy is named policy because it enforces a standard on how to map database stuff to the application
    in the meta function, this policy can be influenced
    compare it to pregnancy
    meta() is what happens inside the female
    based on dna, policies, whatever food she happens to be eating etc, the baby is constructed
    once it’s born, you give it clothing etc.
    sometimes however, you need to do surgery on the pre-born
    if you wait until postmeta, it is either too late, or inefficient
    which is why some stuff is done in meta()
    e.g. if the womb is constructing a boy but you want a girl, you could let it be born first and then do a gender change
    but that’s a lot of overhead
    so for performance reasons, you might change the gender before the utensils are appended to the unborn
    (which is basically what things like $policy->setTypeAndParams do
    (to make it a little more complete, even metanodes have a constructor, but that would then be comparable to conception, and you don’t want to fiddle with stuff there yet)

    also published on the ATK wiki .

  • Details make the difference

    July 8, 2008
    http, opensource, php, symfony, zemanta

    The Zemanta API is quite a simple API at this point, but it works nicely. To give some background, you feed the API with a text, Zemanta analyses this text, and offers links, images and tags as a suggestion for usage with the text. Excellent for weblogs and magazines looking to enrich their content. The API call therefore is nothing more than a POST request that requires a few parameters: text, return format, method (currently simply zemanta.suggest) and an API key. Should not be too hard, you’d think?

    Think again
    Since it’s a simple request, I immediately decided to use the already installed sfWebBrowserPlugin for this request. It has a very simple API, and should work fine. However, I couldn’t get it to work correctly. I kept getting a 403 Developer Inactive error. A weird error, which led me to believe I might be using an incorrect API key. I double checked it with the key in my control panel, but nope, everything was correct.

    I need a second opinion
    I wasn’t making any progress, so on to the next attempt: Use another tool to do the same thing. I decided to dust off my Zend_Http_Client knowledge and use that instead. After 10 minutes of work (well, mostly reading into the exact syntax of doing the call) I had a working example. Including a valid response. So no problem on the Zemanta side, the developer was active! It was something in symfony or the plugin.

    Let’s squash that bug
    I couldn’t have it that something worked fine in Zend Framework, but wouldn’t work in my beloved symfony. So I started trying other things, trying to chase the parameters sent with the request, but all seemed fine. After looks of searching through the code, trying the different adapters that come with sfWebBrowserPlugin, and comparing the approach of sfWebBrowserPlugin with the approach of Zend_Http_Client, I noticed one thing: the call to http_build_query() was different.

    sfCurlAdapter was calling http_build_query($parameters) where Zend_Http_Client was calling http_build_query($this->paramsPost, ”, ‘&’ ). Notice the two extra parameters, of which the second is the most important in this situation. It turns out if you leave the seperator parameter empty, it defaults to the encoded &, which clearly the Zemanta API at least could not handle (and perhaps others as well). When I changed the call to http_build_query($parameters, null, ‘&’ ), the problem was solved! I got back the expected XML response using the sfWebBrowserPlugin.

    Contribute!
    As I’d suggest every Open Source user to do, I immediately opened a bug for this so that it can be fixed by the developer of the plugin. Contributing back fixes like these to the project helps all users, and eventually makes the project so much better

    Update!
    It seems I have been stupid all along. The bug was already fixed in the sfWebBrowserPlugin a long time ago. I installed the plugin a long time ago into my project and never since updated it to the latest version, not even when encountering this bug. My bad, sorry Francois! 🙂

  • Here we go again, two days in a row

    June 28, 2008
    live, music, paradiso

    Since Paradiso in itself is a venue to always look forward to, and Live simply has this special meaning in my life, it’s a complete bonus to be able to attend two shows by Live in a row there. This time, there’s no release out that triggers them to be here, yet the shows will still be special: Live will be recording a DVD during the shows.

    I can’t really tell you why, but Live has always triggered something in me. And it seems with a lot of dutchies, they become popular here first, and then the rest of the world joined in with Throwing Copper, Secret Samadhi and The Distance To Here mostly. And though their most recent offerings have not always been as good (in my humble opinion) as their earlier offerings, they still rock big time.

    Before any Live concert I attend, I always have one or two songs that I’d love to hear. This time round, it’s Waitress and Stage, both from Throwing Copper, that have my special fancy. I don’t think there’s a big chance of them playing those though, since they are recording a DVD and that DVD most probably will need to contain mostly their hits. Still, I can hope for it of course 😉

  • The new ICANN TLD proposal

    June 26, 2008
    icann, internet, tld

    The Internet as it is right now is already a chaos. The list of Top Level Domains is growing fast. But it doesn’t make things more clear. Take for instance the .jobs Top Level Domain. What exactly does this add to the available list? Most companies still list their vacancies on their website, and they’ll probably keep doing this. Why? Well, potential candidates will get a good impression of the company, and (potential) clients will see that the company is quite busy because it is looking for new people, so it must be doing something good, right? Having job openings on your website is always good marketing. So why the hell add a new Top Level Domain for it?

    With this new proposal accepted, as it is implemented (Q1 2009 most probably), organizations worldwide will be able to apply for their own Top Level Domain. In the buzz about this announcement on the web, I see examples such as .ebay. Now, please explain to me, aside from Ebay wanting to protect their trademark, why the hell would anyone want a .ebay address. What would be the purpose? There is only one Ebay, and it’s easily reachable by going to Ebay.com (or any of the local versions). 

    I have this crazy theory about this whole proposal. It’s a theory so wild that none of you would’ve ever thought of it. This theory consists of a single word.

        MONEY

    I don’t know why, because I’ve always believed ICANN to be a non-profit organization put in place to ensure the safety and availability of the whole domain system, but it seems that ICANN is quite anxious to get new money in. I mean, it doesn’t sound really useful, but well, what can you do? If you are a multi-million international company, you need to protect your trademark, so you will have to shell out the cash to register your own TLD. So it will be easy money for ICANN. Very easy money.

    The only good thing that I’ve seen in the proposal is the fact that they also want to implement top level domains with other characters than the current limited set of 37 characters, so countries with different character sets, such as China, Japan, the Arab world and Russia, will finally be able to get their “native” domains.

    Since the proposal has already been accepted, I’m afraid there will be little that can be done to stop this. I surely wonder how this will play out, but I’m not looking forward to this whole new dimension in the chaos of domains.

  • Dutch PHP Conference 2008

    June 10, 2008
    conferences, Dutch PHP Conference, php

    This year the conference is bigger and better. More people will attend (which I guess will add to the less personal approach of the event, but what’s to be expected of an event this big?) but also there is an extra day. Aside from the regular conference day, there is now also a workshop day. A day on which the speakers dive into a topic for a full day together with the attendees. I am proud to be one of the speakers on the tutorial day. I will be doing a tutorial on symfony 1.1 together with Fabien Potencier, the big man behind symfony.

    Even though I am excited to be doing a workshop, it is a shame that I can not attend any others. There’s some great tutorials on the tutorial day, including one on Zend Framework by Matthew Weier O’Phinney. I would’ve loved to attend that one.

    My plans for the regular conference day (Which is nearly sold out, but not fully sold out yet! Register now!) are as follows:

    Obviously, I’ll want to attend the keynotes by Zeev and Marco. They are big and important people in the PHP community, it will be interesting to see what they will be talking about.

    The first parallel-session, I will most probably attend Gaylord Aulke’s presentation on An Infrastructure for Team Based PHP Development. I am very interested in what Gaylord has to say about this, especially since I am currently involved in a project for him.

    For the second parallel-session, I’ve made the tough decision to go to Lorna Mitchell’s session onPHP Deployment with Subversion. Why this one? Well, first of all, it sounds like an interesting topic, especially given my earlier post on deployment. And since I already know symfony, I can skip Fabien’s session. And even though the security session by Johann-Peter Hartmann from Mayflower also looks interesting, Lorna’s talk just seems to be the place to be for me.

    After the break, session three was another mindbreaker in terms of choosing. Ivo Jansch’ talk on Enterprise PHP Development seemed an interesting choice, and Stefan Priebsch’ look ahead at the future of PHP may be interesting, but I’ve opted to attend Matthew’s talk on using Zend Framework for instituting best practices. I’ve been digging into using Zend Framework in combination with symfony a lot lately, so this is a good choice.

    With a closing keynote by Terry Chay, we will know for sure that the conference will be going out with a bang. I’m really curious to finally see Terry speak. It will be an interesting experience, I am sure.

    Once again, it looks like the Dutch PHP Conference will become an awesome event, and I am sure I will update you guys afterwards 🙂

  • Digitizing music: Terratec PhonoPreAmp iVinyl

    June 5, 2008
    music, technology, terratec, vinyl

    CD Spin Doctor software Having ripped almost my full CD collection already, and having quite a few classics in my vinyl collection, I was eager to get a huge bunch of those digitized. I just didn’t have a way to do that. Research learned that my initial idea of buying a turntable that had a USB connection wasn’t a good one: The built-in analog/digital converter in all but the most expensive of those are not that good, leaving you with a quite metally sound to your music.

    Still having my old trusty turntables in the attic did make the problem a little easier. Surely there must be machines that simply take a phono signal, and converPhonoPreAmp iVinylt it to digital data! Indeed there are, and quite a few. I quickly had my eye on a nice machine by Terratec, aptly named the PhonoPreAmp iVinyl. A little box that simply had the connectors for the audio signal and a connector for USB. It also does allow line in, though I don’t really need that. But at around 100 euro in price, a nice little investment for my digital music collection. And what an investment it is! It is really as simple as just connecting your turntable, connecting USB to your computer, and record. The software you get as well, for Mac it is Roxxio’s CD Spin Doctor, is excellent for this. Even though it seems a bit unstable at times, it easily records the music, suggests points where the different tracks on one side of the vinyl start, and allow for filtering (though the filters don’t seem that good). The only “downside” is that it seems to save in .aiff format by default. Good of course, but having the choice for mp3 or ogg for those that want it (to save diskspace for instance) would be nice. I have not yet checked all features of the software though, so perhaps it’s there, just not immediately visible.

    Anyway, I am quite happy with this purchase. Since the digitizing is real-time, it still requires quite a bit of time, especially if your vinyl collection, like mine, is 1000+ records. But it’s an awesome opportunity to get some of that good old music into your digital collection.

Previous Page
1 … 29 30 31 32 33 … 61
Next Page

skoop.dev

  • Bandcamp
  • Mastodon
  • Bandcamp