The eZ Components BookLatest events |
Monday, June 30. 2008iRefuseToUse aNamingSchemeI find the recent discussion about good naming schemes quite funny. Namespaces are potentially coming in PHP 5.3 (does anyone believe?) and people start discussion about how they can even shorten their names from Abstract to aSomething and from Interface to iAnotherthing. I'm a fan of short names. As Lars pointed out:
and
I agree with these rules and am of the opinion that class names must all above anything contain a semantic. Interfaces indicate what you can do with an object, while abstract classes model that different classes have a common base and can be used in the same mannor. And indeed you can add these semantics to names without using the terms. Good examples are Persistable which indicates that an object implementing this interface can be persisted, Configurable or Connectable. Abstract classes usually model a common base for other classes and define how these are being used Reflector and Configurator are good examples for such semantics. If this does not indicate their abstractness good enough to you, you can still indicate that this is a basis for other classes to be extended before being used: BaseReflector or BaseConfigurator. In fact for me, the abstractness of a class does not really matter that much. Most commonly you also provide descendants of this class and it is commonly clear that one should not use DatabaseHandler but either of OracleHandler or MysqlHandler. Just my .02.
Posted by Tobias Schlitt
at
19:49
| Comments (0)
| Trackbacks (0)
Defined tags for this entry: php api design
Monday, June 23. 2008Sending HEAD requests with ext/curlext/curl is the common tool of choice, if one needs to perform more advanced HTTP requests from a PHP script (for simple ones, use a stream!). I recently wanted to perform a HEAD request to a file, after which I wanted to perform some more advanced HTTP interaction, so CURL was also the tool of choice here. Trying it out on the shell with a local web server, CURL was operating quite slow, in contrast to a GET request. The -i command line switch makes curl include the headers in the printed output, -X lets you define a custom HTTP request.
A difference of 6 seconds runtime of a HEAD in contrast to 0.2 seconds for a GET is quite contrary to the original idea of a HEAD request. HEAD is used to just receive the headers of an URI instead of receiving the whole contents, to save bandwidth, memory and execution time. ext/curl showed the exact same problem. Fiddling a bit with the command line switches, I found to replace -i with -I which makes curl print only the headers, but not the body of the response.
0.04 seconds is now even faster than the corresponding GET request, with the -I switch, which took me 0.09 seconds. Now I just needed to transfer the command line options to the corresponding ext/curl ones:
The RETURNTRANSFER makes ext/curl return the HTTP response instead of printing it. Using the CUSTOMREQUEST option you define to send a HEAD request instead of a standard GET or POST request. The HEADER option makes ext/curl include the response headers in the return value of curl_exec() call and NOBODY avoids the inclusion of the body content here. The URL option as usually sets the URL to request and curl_exec() makes ext/curl execute the request. The runtime was even a fraction of a second faster here, compared to the command line version, but that can be subjectively. However, the HEAD request works as expected now. Maybe it's useful for someone to know this. Sunday, June 22. 2008Hierarchical cachingOne of the cool new features in the new 2008.1 release of the eZ Components library is hierarchical caching. Until now, we supported several types of cache storages. Some of these utilize the file system to store data, others can use APC or Memcache. While file based caches are usually large, since disk space is getting cheaper and cheaper, they are also much slower than memory based caches. RAM caches in contrast are blazingly fast, but memory is still much more limited than disk space. Therefore it is sensible, that the most important data for a website is stored in memory while less important stuff gets cached on the disk. The new ezcCacheStack class in the eZ Cache component provides an automatic way of realizing this. You simply stack together an arbitrary number of storages. The stack will store every item into all of the stacked caches. You can configure how many items may reside in a storage. A replacement strategy class takes care about purging a certain number items in case a storage runs full. On restore, the stack will fetch the desired item from the topmost cache it is still stored in. Replacement strategies shipped with the eZ Cache component provide you with 2 well-known cache algorithms: Least Recently Used (LRU) and Least Frequently Used (LFU). The first one keeps track on when a cache item was last used and discards items that have not been used for the longest time, in case a storage runs full. LFU, in contrast to that, purges items that have been used least frequently. If none of these strategies fits your needs, you can always implement your own strategy, quite easily. Using the cache stack with an appropriate replacement strategy allows you to simply ignore which items are stored where and simply use the stack as your only cache storage. There are lots of other cool things in the 2008.1 package, which was released last Monday. We have 3 new components: Document, to parse and render different document formats, Feed, for creation and aggregation of XML feeds, and Search, which is a search engine abstraction layer, modelled after the PersistentObject component. Beside that, some other components got major new features. Feedback as usually highly appreciated. Enjoy! Friday, June 20. 2008eZ Conference: A technical view on eZ Components slidesI'll be giving a session on the technical aspects of eZ Components in about 20 minutes at the annual eZ Conference here in Skien, Norway. Here are my slides of this presentation for download. It also includes code examples for many new features in our most recent release 2008.1 (hot, just fron Tuesday). I'll write some more about that later. Update (2008-06-20, 15:13): I messed up with the download link, which is fixed now. Wednesday, June 18. 2008Firefox 3 out nowLast night the Mozilla developers released Firefox 3.0 to the wild. Congratulations for the new major version! I've been using the RCs since some weeks to see what the new version can. My impressions are a bit mixed. On the one hand, I love the new rendering, which seems much faster and smooth. The new bookmark management is quite cool and after some fiddling I also got my foreward/backward button back, which is 1 button instead of 2 now. Luckily, most of my favorid extensions already have adopted Firefox 3 and run smoothly. Web developer toolbar, Flashgot, Adblock plus, Flashblock, Google preview, Download Statusbar, Greasemonkey and the StumbleUpon work nicely. Firebug ist still in beta state for 3.0, but also works fine so far. However, there are still some, which did not see new releases for ages and therefore do not seem to be even near to a Firefox 3 version. I needed to switch from All-In-One-Gestures to Firegestures, which was fine, since I mostly use the "back" functionality which works the same in both. Tab Mix Plus does not work at all, but is essential for me. Started from the undo close tab history, which gives you a list of recently closed tabs instead of just restoring the last, over the duplicate tab function to the central close button, I'm missing a good part of my used Firefox functionality. I'm a bit sad, that I neither have the time nor the possibility to dig deeper into XUL stuff to fix the issues myself, which would be the open source way to do it. However, I still hope that someone else out there will have or that other people will come up with a different extension which brings the same nice features. So long, I can live quite good with Firefox 3 for now. It still hangs in certain conditions on my system, but that should be fixed in one of the next bug fix releases. I know very well, that X.0 versions are never absolutly stable. Amazing, how stable Firefox 3 already is! In that sense, great work, Firefox hackers! Everyone out there should download and try out Firefox 3.0 today, to help with building the desired world record. There have already been more than 250,000 downloads from Germany, as I write this article. So, let's see where this leads. :) Update (2008-06-18, 19:08): The Search Status extension works, seems I had disactivated it for some reason. Update (2008-06-23, 10:36): Thanks to a comment here, I got aware of a recent dev build of Tab Mix Plus. Luckily it seems to work quite fine, so my FF3 is near to be complete now. :) Thursday, May 29. 20086 essential PHP development tools slides from IPC/DLWA little bit belated, but as promised during the session, I just uploaded my slides from the talk 6 essential PHP development tools in 60 minutes. Since there is so much to say I actually managed to get 4,5 tools through and for all of these it felt to be too few time. I think I should provide a workshop for the next conference Hope to see you there! 'till next time. Wednesday, May 28. 2008eZ Components status slides from IPC/DLWYou can find my slides from The state of eZ Components online now. The talk was quite crowded and I hope to also have attract some new contributors. Tuesday, May 27. 2008Database abstraction slides from IPCI just uploaded my slides from the talk Database abstraction with eZ Components. Thanks to the attendees for being so active and even borrowing me a notebook and an USB stick, since the beamer disliked my Thinkpad! :) The slides are CC by (see last slide for details). Tuesday, May 20. 2008Girl Geek Dinner right before IPC/DLW next weekNext week the Dynamic Languages World conference (aka International PHP Conference Spring Edition) will be held in Karlsruhe, Germany. Nicole organized a Girl Geek Dinner right before the main events start (that means Monday evening). I really like the idea of Girl Geek Dinner, since it's a good attempt to raise the women rate on geek events, which is usually (sadly) extremly low. On the other hand I like to hang around, have some good meal, enjoy a beer and a good technical discussion. Therefore: +1 from my side for Girl Geek Dinner. :) Saturday, May 3. 2008Removed 1100 photos from FlickrAfter some heavy discussions with Kore and others I researched about German law in respect to individual rights on photos yesterday. Thanks to Arne, who gave me a good starting point (German) for my research. In the end, Kore was mostly right with his interpretation, what made me remove about 1100 photos from my Flickr gallery. All of those showing people dedicatedly where I do not feel to have the explicit permission to publish their pictures. I'll try to explain the reasons, my personal issues and possibly solutions in this article. Continue reading "Removed 1100 photos from Flickr"
Posted by Tobias Schlitt
at
12:01
| Comments (12)
| Trackbacks (0)
Defined tags for this entry: community related, law, legal issues, photography, photos, php conference, privacy
Friday, May 2. 2008RoR does not scale?It's interessting to see more people abandoning Ruby on Rails. Not that I have something against Ruby itself, but it really seems to me that RoR does not scale. Hope Twitter tries with PHP. ;) Tuesday, April 15. 2008Human support and feature requests at XingI like Xing. I actually like some of the social networks, although I think there are far to many of them. However, Xing is useful to me for keeping my address book updated by my business contacts themselves and to be up2date about who is doing what. Nice! I'm also a "premium" (in the sense of paying) user in Xing. On the one hand because that gives me some nice additional features and safes me from advertisement. On the other one because I think paying for a good online service is a good idea. What I really wonder is: What happens to the feature requests and support questions I address to Xing? I don't really have the impression anyone takes care in anyway. Therefore I'd like to tell you the story of 2 tiny feature requests I addressed to Xing some months ago and several times since then. I think, I did not request features that are too difficult to realize. Now, I don't have any clue about web applications, so I might be wrong in this impression. ;) I'm also quite sure that many more people out there would love to see the same stuff realized, so it's not even that they consider my questions too useless for a qualified response. However, whenever I send them a message via their contact form, I receive an autogenerated message ala "Thanks for your request, we take our users requests serious" a few hours later. Good to hear, that their system at least received my message. Another one, probably also auto-generated, that says "We forwarded your message to the development department." flies to my inbox usually a few days or weeks. Good to see, you take care over there at Xing! Although this is the final message I received about every such request. No, to stay seriously and keep sarcasm away, is anyone taking care? I can't believe. I requested one and the same feature 3 times now and another one 2 times already. Without any response that seemed to be written by anything else than a computer. I'm not even sure that any human being ever read my mails. Maybe they have some fancy text recognition tool that generates standard replies automatically? Is it so hard to send a reply like "Sorry, we are not able to realize this, because..." or "Sorry, we don't think that feature Foo Bar is useful to our users, because..."? Is it so hard to give a use the feeling that anyone really takes care? Possibly I just asked the wrong question. If it is that way, please let me know. To let you finally know what I want: Xing offers an RSS feeds for a lot of stuff. From the latest visitors of my profile to any Would be interessting to know if anyone ever had success with a feature request at Xing, or if they just implement what the think is useful for their users? Thursday, April 3. 2008Fighti |





