Okt 01
  • english
  • german

Sometimes, you might need to check whether a string has already been urlencoded with PHP or not. Sadly, PHP doesn't offer such a function but because I recently needed it, I tried this one:

/**
 * Returns true if given string is url encoded
 *
 * @param string $string
 * @return boolean
 */
function is_urlencoded($string) {
	return $string === urlencode(urldecode($string));
}

This works fine for me (as far as I have tested), so maybe it is a litte help for anyone with the same problem

Aug 29
  • english
  • german

If you program PHP code with Eclipse PDT, you surely missed the auto generate getter and setter refactoring option which is known from the JDT. So you had to write hundreds of thousands of lines of code to create those methods for the uncountable amount of data objects you wrote until now.

To speed things up, here's a solution with templates:

Click Window - Preferences - PHP - Templates and create a new template with the following content:

/**
*    Set the ${word_selection} value
*    @param unknown_type $$${word_selection}
*/
public function set${variable}($$${word_selection}) {
$$this->${word_selection} = $$${word_selection};
}

/**
*    Returns the ${word_selection} value.
*    @return unknown_type
*/
public function get${variable}() {
return $$this->${word_selection};
}
${cursor}

To use this template, type the template shortcut you have chosen in a PHP file of your choice (e.g. "getset"), followed by a variable name of your class (z.B. getsetcolor). Now highlight the word "color" (or yours, if different) and then press ctrl+space. Voila, there you have the desired methods. The cursor is on the right position for the variable type in the javadoc comment. Type "string" (or your type) and then jump to the method names with tab. You should type e.g. "Color" (starts with capital letter) and that's it!

This method should save you at least 1-2 minutes per property - try it!

Aug 26
  • german

Wer im TYPO3 auch schon mal ein Modul im Extension Manager erstellt hat, wird das Problem kennen: Man hast nicht wirklich viel Einfluss auf die letztendliche Position im Backend. Man kann zwischen einem neuen Modul, dem File-, Web-, Help-, User- oder Tools-Menü wählen. Das klingt jetzt vielleicht viel und ausreichend, aber was wenn es zusätzlich ein anderes Modul im Backend gibt welches durch eine Extension angelegt wurde? Weiterlesen »

Mrz 25
  • english
  • german

To offer my blog to more people, I decided to publish my posts also in english some time ago. To do with wordpress as easy as possible, I used the jLnguage Plugin. After a little while, the category feed for eSteak was not working any more. I noticed that quickly because this feed is displayed on the eSteak homepage. I did not really find a reason for that, so my only solution was, to put that post into another category.

During the last few days, I realized that my feedburner feed had no readers any more and I asked myself why. At least the news services with wich I signed up should have been there. After checking it myself, I got timeout, plus a cpu load of almost 100% caused by a single httpd2 process. Weiterlesen »

Mrz 13
  • english
  • german

While analyzing my blog statistics, I was really happy finding out that many people came with the keyword "symfony" and I didn't think about it any further. After googling it myself, I realized that my post about symfony and testing is listed on the first page. I welcome this very much, particularly there are a thousand other websites writing much more about symfony.

Have I already mentioned that I really like wordpress ;-)

Mrz 12
  • english
  • german

After editing one single class file in my project (one in /lib that has nothing to do with the database), I unpredictably got the error "wrapped: Cannot fetch TableMap for undefined table: xxx" in the prod mode as well as in the dev mode.
XXX stands for a random table name in my database.

I tried to clear symfony cache, browser cache and finally I replaced the file with the old version, with any improvement of the situation. My last chance was a restart of the apache server, then everything was running like before. I have absolutely no clue where this error came from...

UPDATE: The restart was not the solution! The error just took some time to reappear. Thus, I added some debug code before the actual php exception is thrown. Then I found out that "lib/model/om/BaseXXXPeer.php" could not include the file "lib/model/XXXPeer.php" which is very logical for me, because the controller is located in "web/". Seen from there, tha path should be "../lib/model ...". After adding "../" to the include_path variable in the php.ini, the error seems to be gone.

I don't get why those includes do not use absolute paths. It would be very nice to see this in the next version of symfony.

Mrz 12
  • english
  • german

After upgrading from php 5.0.4 to 5.2.5 on my server, I got a blank page as output several times. In dev mode, the error message said, that a creole file could not be loaded. I had to change the include_path value in the php.inito get it working. I just added "/usr/share/php/pear/symfony/lib/vendor", then the error was gone. Depending on whether you installed your symfony via pear or via svn, the path has to be changed of course.

Finally, don't forget to clear the symfony cache (symfony cc).

Mrz 10
  • english
  • german

After fighting against Apache and PHP on the webserver for two days (I had to recompile it in the end), my website is now online. I hope it fits its purpose and I appreciate any comments.

http://www.esteak.net

Mrz 09
  • english
  • german

I haven't written anything here for some time now. With a reason! As I already mentioned a few times, I am currently working on a small plattform and because I invested a lot of energy and time in getting it done, the moment is almost there! I think on monday (tomorrow), it'll be online. I will not reveal the name yet, but describe its functions.

It is all about MooTools, in my opinion THE JavaScript framework. What I don't like about it is, that you can only find plugins, that some people write for it, in the MooTools forum, because a simple internet search is not that satisfying. The forum again, is quite big and, as the users mostly talk about the linked plugins, also a bit unclear. So it may take some time until you have downloaded the piece of javascript you came for.

The website I developed, is designed to do better. Everyone can, after signing up, upload his own plugins, categorize and tag them. Additionally, you can define dependencies to other packages (also the core).

The users then can (without login) put plugins in the download basket (no shopping cart) and download them later. The website will care for the dependencies, and add them to the download automatically. You can also exclude the core packages if you already have a mootools script.

Of course, users can also rate the plugins and leave a comment. These ratings, the categories and the tags are intended to assist the user to find and download the plugin the want and to make these actions as easy and comfortable as possible.

I hope, this website will help the mootools framework to become even more successful than it is right now. I appreciate any comments, even if the website is not yet online. Of course I will write a new post when the website is finally online and then I will see whether the effort of the last days weeks was worth it. One more thing: it'll be completely free for everyone, of course!

Feb 25
  • english
  • german

After further investigation of the problem I posted last Thursday, I finally found a solution to get it to work! I took a closer look at the subversion repository and found another branch (which is described nowhere). So you have to add an svn:external to the plugin folder named sfPHPUnitPlugin and targetting to http://svn.symfony-project.com/plugins/sfPHPUnitPlugin/branches/1.0/. Then you need to update the plugin folder. If you then type symfony -T, the new tasks are visible.

Hurray! But wait a minute: it still doesn't work! There seems to be one mistake in the file "sfPHPUnitTestPrinterTap.php" in the "lib" directory of the plugin. In line 159, you need to replace the "$suite->testCount()" by "$suite->count()" and then it finally works! Unbelievable, but true. After a long journey, I made it - symfony runs with PHPUnit. Thank God.