<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>entwicklungsgedanken &#187; PHP</title>
	<atom:link href="http://www.entwicklungsgedanken.de/category/webdevelopment/php-webentwicklung/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.entwicklungsgedanken.de</link>
	<description>Verschiedene Gedanken rund um die Softwareentwicklung</description>
	<lastBuildDate>Mon, 09 Jan 2012 14:47:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Configure the symfony-mailer (swiftmailer) during runtime</title>
		<link>http://www.entwicklungsgedanken.de/2010/05/03/configure-the-symfony-mailer-swiftmailer-during-runtime/</link>
		<comments>http://www.entwicklungsgedanken.de/2010/05/03/configure-the-symfony-mailer-swiftmailer-during-runtime/#comments</comments>
		<pubDate>Mon, 03 May 2010 08:45:32 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Webdevelopment]]></category>
		<category><![CDATA[configure]]></category>
		<category><![CDATA[mailer]]></category>
		<category><![CDATA[multi-client]]></category>
		<category><![CDATA[runtime]]></category>
		<category><![CDATA[swiftmailer]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/?p=413</guid>
		<description><![CDATA[One of my current projects is a multi-client environment. Each client has its own smtp-settings for the mailings that are done within that application. From static &#8230; Symfony allows the configuration of the mailer in its factories.yml. There smtp-settings can be definied. But in this case this is impossible as every client has different smtp-settings [...]]]></description>
			<content:encoded><![CDATA[<p>One of my current projects is a multi-client environment. Each client has its own smtp-settings for the mailings that are done within that application.</p>
<h3>From static &#8230;</h3>
<p>Symfony allows the configuration of the mailer in its <code>factories.yml</code>. There smtp-settings can be definied. But in this case this is impossible as every client has different smtp-settings (every client can use its own smtp-settings to handle mailings).</p>
<p>As I did not want to create an instance of the <a href="http://swiftmailer.org/">Swift_Mailer</a> (and<a href="http://swiftmailer.org/docs/smtp-transport"> Swift_SmtpTransport</a>) myself I decided to create my own mailer-class which is derived from the symfony one. So I get the full benefits of logging.</p>
<h3>&#8230; to dynamic</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> myDynamicMailer <span style="color: #000000; font-weight: bold;">extends</span> sfMailer
<span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span>sfEventDispatcher <span style="color: #000088;">$dispatcher</span><span style="color: #339933;">,</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// Load client based configuration</span>
    <span style="color: #000088;">$cfg</span> <span style="color: #339933;">=</span> EmailConfiguration<span style="color: #339933;">::</span><span style="color: #004000;">getCurrent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$cfg</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>isSmtpConfigured<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;class&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Swift_MailTransport&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #666666; font-style: italic;">// Update settings for the current client</span>
      <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;transport&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;param&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;host&quot;</span><span style="color: #009900;">&#93;</span>      <span style="color: #339933;">=</span> <span style="color: #000088;">$cfg</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getHostname<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;transport&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;param&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;port&quot;</span><span style="color: #009900;">&#93;</span>      <span style="color: #339933;">=</span> <span style="color: #000088;">$cfg</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getPort<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;transport&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;param&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;username&quot;</span><span style="color: #009900;">&#93;</span>  <span style="color: #339933;">=</span> <span style="color: #000088;">$cfg</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getUsername<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;transport&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;param&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;password&quot;</span><span style="color: #009900;">&#93;</span>  <span style="color: #339933;">=</span> <span style="color: #000088;">$cfg</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getDecryptedPassword<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    parent<span style="color: #339933;">::</span>__construct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$dispatcher</span><span style="color: #339933;">,</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Simply update <code>factories.yml</code> with the new class and the dynamic configuration is applied.</p>

<div class="wp_syntax"><div class="code"><pre class="yaml" style="font-family:monospace;">all:
  mailer:
    class: myDynamicMailer
    # Rest follows here</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2010/05/03/configure-the-symfony-mailer-swiftmailer-during-runtime/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing TYPOlight-error #145 &#8211; Table &#8216;./tl_search&#8217; is marked as crashed and should be repaired</title>
		<link>http://www.entwicklungsgedanken.de/2009/11/30/fixing-typolight-error-145-table-tl_search-is-marked-as-crashed-and-should-be-repaired/</link>
		<comments>http://www.entwicklungsgedanken.de/2009/11/30/fixing-typolight-error-145-table-tl_search-is-marked-as-crashed-and-should-be-repaired/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 16:30:38 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Typolight]]></category>
		<category><![CDATA[crashed]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[repair]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/?p=358</guid>
		<description><![CDATA[Today a website of a customer running with TYPOlight stopped working. The friendly “there is an error”-message appeared. Even the administration-backend was not working anymore. Enabling the “display-error” setting revealed that there was a database-problem (perhaps due to a crash of mysql). #145 - TABLE './tl_search' IS marked AS crashed AND should be repaired The [...]]]></description>
			<content:encoded><![CDATA[<p>Today a website of a customer running with TYPOlight stopped working. The friendly “there is an error”-message appeared. Even the administration-backend was not working anymore.</p>
<p>Enabling the “display-error” setting revealed that there was a database-problem (perhaps due to a crash of mysql).</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">#<span style="color: #cc66cc;">145</span> <span style="color: #66cc66;">-</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">'./tl_search'</span> <span style="color: #993333; font-weight: bold;">IS</span> marked <span style="color: #993333; font-weight: bold;">AS</span> crashed <span style="color: #993333; font-weight: bold;">AND</span> should be repaired</pre></div></div>

<p>The problem was that I have no shell-access to the server of the hosting provider and no administrative-console for the database. So I built a little “repair-script” to fix this issue.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Typolight table repair script</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'TL_ROOT'</span><span style="color: #339933;">,</span> <span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Load the configuration</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'system/config/localconfig.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$con</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'TL_CONFIG'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'dbHost'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
  <span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'TL_CONFIG'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'dbUser'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
  <span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'TL_CONFIG'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'dbPass'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'TL_CONFIG'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'dbDatabase'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$con</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Repair table</span>
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;REPAIR TABLE tl_search&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$con</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_fetch_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">mysql_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$con</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Its placed where the “front-controller” (index.php) resides and after executing it via browser the problem is gone and the website is up and running again.</p>
</p>
<pre></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2009/11/30/fixing-typolight-error-145-table-tl_search-is-marked-as-crashed-and-should-be-repaired/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Its time to change the orm</title>
		<link>http://www.entwicklungsgedanken.de/2009/09/05/its-time-to-change-the-orm/</link>
		<comments>http://www.entwicklungsgedanken.de/2009/09/05/its-time-to-change-the-orm/#comments</comments>
		<pubDate>Sat, 05 Sep 2009 12:25:15 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Webdevelopment]]></category>
		<category><![CDATA[dead]]></category>
		<category><![CDATA[Doctrine]]></category>
		<category><![CDATA[future]]></category>
		<category><![CDATA[maintenance]]></category>
		<category><![CDATA[migration]]></category>
		<category><![CDATA[propel]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/?p=347</guid>
		<description><![CDATA[I attended the great symfony day 09 in cologne yesterday. It was an awesome conference with nice people, interesting talks and discussions. Propel is dead One thing got crystal clear during the talks. Propel is dead! In the next version 1.3 of symfony Doctrine will be the default orm. If thats not a hint &#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>I attended the great <a href="http://www.symfonyday.com/en/">symfony day 09</a> in cologne yesterday. It was an awesome conference with nice people, interesting talks and discussions.</p>
<h3>Propel is dead</h3>
<p>One thing got crystal clear during the talks. <strong>Propel is dead!</strong> In the next version 1.3 of symfony <a href="http://www.doctrine-project.org/">Doctrine</a> will be the default orm. If thats not a hint &#8230; In symfony 2.0 Propel will be deprecated. Additionally the &#8220;leader of Propel&#8221; <a href="http://groups.google.com/group/propel-development/browse_thread/thread/60621ae4e539145d/829895b081ec7873#829895b081ec7873">stated out</a> that he is no longer leading Propel.</p>
<p>So its time to move to Doctrine. The new features in Doctrine 1.2 described by<a href="http://www.jwage.com/"> Jonathan Wage</a> are quite nice. And Doctrine 2.0 will be even more impressive.</p>
<p>Sadly it will require a lot of work rewriting Propel &#8220;criteria queries&#8221; with Doctrine&#8217;s <a href="http://www.doctrine-project.org/documentation/manual/1_1/en/dql-doctrine-query-language">DQL-queries</a>. But I&#8217;m certain that this step makes my applications future prove.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2009/09/05/its-time-to-change-the-orm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Solving SOAP-ERROR: Parsing WSDL in PHP</title>
		<link>http://www.entwicklungsgedanken.de/2009/04/20/solving-soap-error-parsing-wsdl-in-php/</link>
		<comments>http://www.entwicklungsgedanken.de/2009/04/20/solving-soap-error-parsing-wsdl-in-php/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 21:21:55 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Webdevelopment]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[parse error]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[SOAP]]></category>
		<category><![CDATA[WSDL]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/?p=244</guid>
		<description><![CDATA[Consuming web services is nothing special nor exciting. In one of my current projects I just did this. Using the web service on my development-system and on the test-system works just fine. However when deploying the module to the production-system and using it an exception is thrown containing the following error: SOAP-ERROR: Parsing WSDL: Couldn't [...]]]></description>
			<content:encoded><![CDATA[<p>Consuming web services is nothing special nor exciting. In one of my current projects I just did this. Using the web service on my development-system and on the test-system works just fine.</p>
<p>However when deploying the module to the production-system and using it an exception is thrown containing the following error:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">SOAP<span style="color: #339933;">-</span>ERROR<span style="color: #339933;">:</span> Parsing WSDL<span style="color: #339933;">:</span> Couldn<span style="color: #0000ff;">'t load from '</span>https<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//my-webservice-provider/service.wsdl'</span></pre></div></div>

<p>This exception was thrown during the initialization of my custom soap client (which derives from <a href="http://www.php.net/manual/de/class.soapclient.php">SoapClient</a>). So what is the problem here? Two systems worked perfectly. One system is causing troubles. The issue is probably not caused by the code itself&#8230;</p>
<h3>Conclusion</h3>
<p>The error message given by the SoapClient is misleading and should be more precise! The openssl extension for PHP (php5-openssl) simply <strong>was not installed</strong> on the production system. Because the service is consumed via https openssl is a requirement.</p>
<p>I would asume an error message like: &#8220;Cannot load openssl extension&#8221; or something like that&#8230; But as <a href="http://en.wikipedia.org/wiki/Test-driven_development">TDD</a> tells you: Don&#8217;t asume anything.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2009/04/20/solving-soap-error-parsing-wsdl-in-php/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Solving utf-8-encoding-issues when connecting to oracle with php and oci8</title>
		<link>http://www.entwicklungsgedanken.de/2009/04/06/solving-utf-8-encoding-issues-when-connecting-to-oracle-with-php-and-oci8/</link>
		<comments>http://www.entwicklungsgedanken.de/2009/04/06/solving-utf-8-encoding-issues-when-connecting-to-oracle-with-php-and-oci8/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 20:24:22 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Webdevelopment]]></category>
		<category><![CDATA[Encoding]]></category>
		<category><![CDATA[OCI8]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[UTF8]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/?p=223</guid>
		<description><![CDATA[In a recent project of mine a web-application is developed. This application consumes &#8220;some data&#8221; from an enterprise Oracle database. The development environment has the latest oracle drivers installed. Everything works as expected. Even the connection-speed is very good. But then comes the deployment of that application. The production environment already runs for a while [...]]]></description>
			<content:encoded><![CDATA[<p>In a recent project of mine a web-application is developed. This application consumes &#8220;some data&#8221; from an enterprise Oracle database. The development environment has the latest oracle drivers installed. Everything works as expected. Even the connection-speed is very good.<br />
But then comes the deployment of that application. The production environment already runs for a while and hosts a certain amount of applications. Oracle driver had been installed a while ago.</p>
<h3>Here comes trouble&#8230;</h3>
<p>Both environments (production and dev/test-system) connect to the same Oracle database. Inside the production environment all data received from the Oracle database is corrupt due to wrong encoding. A simple <code>mb_detect_encoding</code> shows &#8216;UTF8&#8242; which cannot be. The whole web-application &#8220;is&#8221; utf-8. There is no implicit or explicit conversion of encodings performed. So the problem must be caused by the Oracle drivers themselves.</p>
<h3>Fixme</h3>
<p>setlocale did not work. The encoding option in the dsn (connection string) did not work. What did work was setting the <code>NLS_LANG</code> in the registry. The key can be found inside <code>HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\{SomeInstance}</code>. In this case the <code>NLS_LANG</code> was set to <code>GERMAN_GERMANY.UTF8</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2009/04/06/solving-utf-8-encoding-issues-when-connecting-to-oracle-with-php-and-oci8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Problems with Apache FOP when calling through PHP&#8217;s exec</title>
		<link>http://www.entwicklungsgedanken.de/2008/12/17/problems-with-apache-fop-when-calling-through-phps-exec/</link>
		<comments>http://www.entwicklungsgedanken.de/2008/12/17/problems-with-apache-fop-when-calling-through-phps-exec/#comments</comments>
		<pubDate>Wed, 17 Dec 2008 17:03:43 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Webdevelopment]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[exec]]></category>
		<category><![CDATA[font]]></category>
		<category><![CDATA[FOP]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[xsl:fo]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/?p=134</guid>
		<description><![CDATA[I&#8217;m currently using the latest version of Apache&#8217;s FOP (0.95). To create the pdf-file from the transformed fo-file I simply call the fop-binary via PHP&#8217;s exec. The command is built dynamically. // Some static command here $cmd = '/path/to/fop -c config.yml -fo input.fo -pdf outfile.pdf'; exec&#40;$cmd&#41;; So quiet This doesn&#8217;t work! There is no pdf-file. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently using the latest version of Apache&#8217;s FOP (0.95). To create the pdf-file from the transformed fo-file I simply call the fop-binary via PHP&#8217;s <code>exec</code>. The command is built dynamically.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Some static command here</span>
<span style="color: #000088;">$cmd</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'/path/to/fop -c config.yml -fo input.fo -pdf outfile.pdf'</span><span style="color: #339933;">;</span>
<span style="color: #990000;">exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cmd</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>So quiet</h3>
<p>This doesn&#8217;t work! There is no pdf-file. <code>exec</code> gives no output, no warning, no error &#8230; Simply nothing. If I run the command inside the shell the pdf files gets created as expected.</p>
<h3>Use-Cache = true</h3>
<p>The cause of the problem is the config-option <code>use-cache</code> which is set to <code>true</code> on default.<br />
FOP wants to create a cache-file to speed up the font-embedding-process which fails in my case.<br />
Running the fop-command as the user apache runs with gives an error. The creation of the cache-file fails due to missing filesystem permissions. I really have no idea why this output isn&#8217;t catched by <code>exec</code>. Some java-related behavior? Perhaps stdout is redirected somewhere else?</p>
<h3>Use-Cache = false</h3>
<p>I&#8217;m not using the &#8220;auto-detection&#8221;-feature for font-embedding as I clearly define where my fonts reside. So I added the option into my <a href="http://xmlgraphics.apache.org/fop/0.95/configuration.html">fop-config-file</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">false</pre></div></div>

<p>Finally everything works as expected.</p>
<h3>Redirection</h3>
<p>In order to get information of what fop does use the following command:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$ouput</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$ret</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">exec</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/path/to/fop -fo test.fo -pdf test.pdf &gt; /path/to/logfile.log 2&gt;&amp;1'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ouput</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ret</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2008/12/17/problems-with-apache-fop-when-calling-through-phps-exec/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Problems with default values in Propel</title>
		<link>http://www.entwicklungsgedanken.de/2008/12/05/problems-with-default-values-in-propel/</link>
		<comments>http://www.entwicklungsgedanken.de/2008/12/05/problems-with-default-values-in-propel/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 13:11:46 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Webdevelopment]]></category>
		<category><![CDATA[default values]]></category>
		<category><![CDATA[modified]]></category>
		<category><![CDATA[propel]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/?p=116</guid>
		<description><![CDATA[Default values rule! I&#8217;m using Propel 1.2 (an upgrade will be done soon) but for other people out there &#8230; Consider the following declaration-fragment for the &#8220;Foo-entity&#8221;. Nothing special here. &#60;column name=&#34;name&#34; type=&#34;VARCHAR&#34; size=&#34;32&#34; required=&#34;true&#34; /&#62; &#60;column name=&#34;culture&#34; type=&#34;CHAR&#34; size=&#34;5&#34; required=&#34;true&#34; default=&#34;de_DE&#34; /&#62; Now if we create the new object and show the state (var_dump) [...]]]></description>
			<content:encoded><![CDATA[<h3>Default values rule!</h3>
<p>I&#8217;m using Propel 1.2 (an upgrade will be done soon) but for other people out there &#8230;</p>
<p>Consider the following declaration-fragment for the &#8220;Foo-entity&#8221;. Nothing special here.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;column</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;name&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;VARCHAR&quot;</span> <span style="color: #000066;">size</span>=<span style="color: #ff0000;">&quot;32&quot;</span> <span style="color: #000066;">required</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;column</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;culture&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;CHAR&quot;</span> <span style="color: #000066;">size</span>=<span style="color: #ff0000;">&quot;5&quot;</span> <span style="color: #000066;">required</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">default</span>=<span style="color: #ff0000;">&quot;de_DE&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>Now if we create the new object and show the state (<code>var_dump</code>) of the object the <code>culture</code>-field is set to &#8216;de_DE&#8217; which is correct.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$inst</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Foo<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$inst</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Foobar'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$inst</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>But if you look in your (debug-)logfiles you will see that the <code>insert-query</code> will be generated as:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> foo <span style="color: #66cc66;">&#40;</span>NAME<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Foobar'</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<h3>Where is the value for the culture column?</h3>
<p>Propel keeps track of the modified columns to reduce the size of the <code>update/insert-queries</code>. The default values for the object will not be set through the generated class-methods. Instead the default values are directly assgined in the member-variable of the generated class. So Propel is unaware that the values has changed.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$culture</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'de_DE'</span><span style="color: #339933;">;</span></pre></div></div>

<h3>Conclusion</h3>
<p>I don&#8217;t know if this bug is fixed in Propel 1.3. Soon I will know &#8230;</p>
<p>As I will continue working with Propel 1.2 in the current project the &#8220;workaround&#8221; is to manually set the culture. This is best done in the constructor of your derived class. So Propel knows that the column is modified.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> Foo <span style="color: #000000; font-weight: bold;">extends</span> BaseFoo
<span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
     <span style="color: #666666; font-style: italic;">// Note: The generated base-class does not have a constructor</span>
     <span style="color: #666666; font-style: italic;">// so parent::__construct will fail!</span>
     <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCulture</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getCulture</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2008/12/05/problems-with-default-values-in-propel/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Translating the sfAssetLibraryPlugin using gettext instead of XLIFF</title>
		<link>http://www.entwicklungsgedanken.de/2008/10/31/translating-the-sfassetlibraryplugin-using-gettext-instead-of-xliff/</link>
		<comments>http://www.entwicklungsgedanken.de/2008/10/31/translating-the-sfassetlibraryplugin-using-gettext-instead-of-xliff/#comments</comments>
		<pubDate>Fri, 31 Oct 2008 17:25:54 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Webdevelopment]]></category>
		<category><![CDATA[I18N]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[sfAssetLibrary]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/?p=70</guid>
		<description><![CDATA[I&#8217;m using the sfAssetLibraryPlugin in one of my active projects. This project uses gettext for interface translation. The plugin ships with XLIFF-files for interface translation. In order to get gettext working simply create the required directories inside the plugin-directory (plugins/sfAssetLibraryPlugin/modules/sfAsset/i18n) and create a new catalog for each language (de, en, fr, ...). The important thing [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m using the <a href="http://www.symfony-project.org/plugins/sfAssetsLibraryPlugin">sfAssetLibraryPlugin</a> in one of my active projects. This project uses <a href="http://de.wikipedia.org/wiki/GNU_gettext">gettext</a> for interface translation.</p>
<p>
The plugin ships with <a href="http://de.wikipedia.org/wiki/XLIFF">XLIFF</a>-files for interface translation. In order to get gettext working simply create the required directories inside the plugin-directory (<code>plugins/sfAssetLibraryPlugin/modules/sfAsset/i18n</code>) and create a new catalog for each language (<code>de, en, fr, ...</code>).
</p>
<p>The important thing here is to take care of the &#8220;translation-namespace&#8221; the plugin uses (<code>sfAsset</code> in this case).</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">echo</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Description'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'sfAsset'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><div id="attachment_83" class="wp-caption alignleft" style="width: 217px"><a href="http://www.entwicklungsgedanken.de/wp-content/uploads/2008/10/sfasset-gettext.png"><img src="http://www.entwicklungsgedanken.de/wp-content/uploads/2008/10/sfasset-gettext-207x300.png" alt="Directory layout" title="sfasset-gettext" height="250" class="size-medium wp-image-83" /></a><p class="wp-caption-text">Directory layout of the sfAssetLibraryPlugin</p></div><br />
So your gettext-catalog-file has to be named <code>sfAsset.po</code> and not <code>message.po</code> as one could think when reading in the <a href="http://trac.symfony-project.org/wiki/HowToUseI18NWithGettext">symfony-wiki</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2008/10/31/translating-the-sfassetlibraryplugin-using-gettext-instead-of-xliff/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL-Join with multiple conditions when using Propel</title>
		<link>http://www.entwicklungsgedanken.de/2008/09/03/sql-join-with-multiple-conditions-when-using-propel/</link>
		<comments>http://www.entwicklungsgedanken.de/2008/09/03/sql-join-with-multiple-conditions-when-using-propel/#comments</comments>
		<pubDate>Wed, 03 Sep 2008 19:12:52 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Webdevelopment]]></category>
		<category><![CDATA[Multiple]]></category>
		<category><![CDATA[propel]]></category>
		<category><![CDATA[SQL-Join]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/?p=64</guid>
		<description><![CDATA[Propels (Creole) &#8220;criteria infrastructure&#8221; is a great speed-up for the development process and makes it easy to &#8220;write&#8221; queries. However if you are forced to create a SQL-Join which requires multiple join-conditions the criteria-api is not a helper anymore. In order to make use of the criteria-api even in this case a &#8220;hack&#8221; can be [...]]]></description>
			<content:encoded><![CDATA[</p>
<p><a href="http://propel.phpdb.org/trac/">Propels</a> (Creole) &#8220;<a href="http://propel.phpdb.org/trac/wiki/Users/Documentation/1.3/Criteria">criteria infrastructure</a>&#8221; is a great speed-up for the development process and makes it easy to &#8220;write&#8221; queries. However if you are forced to create a SQL-Join which requires multiple join-conditions the criteria-api is not a helper anymore.</p>
<p>
In order to make use of the criteria-api even in this case a &#8220;hack&#8221; can be used. <a href="http://stereointeractive.com/blog/2007/05/12/left-joins-with-multiple-conditions-using-propel-criteria/">Someone else</a> described it in a blog-post.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$c</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Criteria<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$c</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addJoin</span><span style="color: #009900;">&#40;</span>Object1Peer<span style="color: #339933;">::</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> Object2Peer<span style="color: #339933;">::</span><span style="color: #004000;">ID</span> <span style="color: #339933;">.</span>
  <span style="color: #0000ff;">' AND '</span> <span style="color: #339933;">.</span> Object1Peer<span style="color: #339933;">::</span><span style="color: #004000;">LOCALE</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' = '</span> <span style="color: #339933;">.</span> Object2Peer<span style="color: #339933;">::</span><span style="color: #004000;">LOCALE</span> <span style="color: #339933;">.</span>
  <span style="color: #0000ff;">' AND '</span> <span style="color: #339933;">.</span> Object1Peer<span style="color: #339933;">::</span><span style="color: #004000;">WHATEVER</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' = '</span> <span style="color: #339933;">.</span> Object2Peer<span style="color: #339933;">::</span><span style="color: #004000;">WHATEVER</span><span style="color: #339933;">,</span>
  Criteria<span style="color: #339933;">::</span><span style="color: #990000;">JOIN</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>
Its a &#8220;hack&#8221; but you are not required to write the whole sql-query on your own and can rely on the criteria-api.
</p>
<p>
As I found out the Propel-developers are <a href="http://propel.phpdb.org/trac/ticket/167#comment:13">aware of this problem</a> and a solution is planned for the (hopefully soon) next Propel release 1.4.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2008/09/03/sql-join-with-multiple-conditions-when-using-propel/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Geocoding über HTTP mit dem Google-Maps Geocoding-Service</title>
		<link>http://www.entwicklungsgedanken.de/2008/03/07/geocoding-uber-http-mit-dem-google-maps-geocoding-service/</link>
		<comments>http://www.entwicklungsgedanken.de/2008/03/07/geocoding-uber-http-mit-dem-google-maps-geocoding-service/#comments</comments>
		<pubDate>Fri, 07 Mar 2008 16:14:40 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Webdevelopment]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[geocoding-service]]></category>
		<category><![CDATA[google-maps]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/2008/03/07/geocoding-uber-http-mit-dem-google-maps-geocoding-service/</guid>
		<description><![CDATA[Der Google-Maps-Service ermöglicht Geocoding mittels HTTP-Anfragen. Eine feine Sache und dank JSON als Rückgabeformat und json_decode sehr einfach zu nutzen. Problem mit dem Encoding und json_decode Der folgende Code liefert nicht das erwartete Ergebnis. Die Funktion json_decode liefert für die Antwort ein &#8220;leeres Ergebnis&#8221;. Eine Analyse von $reponse zeigt einen fehlerhaft codierten String. Das ß [...]]]></description>
			<content:encoded><![CDATA[<div class="lang-de"></div>
<p>Der Google-Maps-Service ermöglicht <a href="http://code.google.com/apis/maps/documentation/services.html#Geocoding_Direct">Geocoding mittels HTTP-Anfragen</a>. Eine feine Sache und dank JSON als Rückgabeformat und <a href="http://de.php.net/manual/en/function.json-decode.php">json_decode</a> sehr einfach zu nutzen.</p>
<h4>Problem mit dem Encoding und json_decode</h4>
<p>Der folgende Code liefert <strong>nicht das erwartete Ergebnis</strong>. Die Funktion json_decode liefert für die Antwort ein &#8220;leeres Ergebnis&#8221;.</p>
<p>Eine Analyse von <code>$reponse</code> zeigt einen fehlerhaft codierten String. Das ß ist falsch codiert, obwohl der Reponse in UTF-8 vorliegt (vorliegen sollte).</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Hinweis: Fehlerauswertung fehlt hier gänzlich,</span>
<span style="color: #666666; font-style: italic;">// was in produktivem Code nicht sein darf!</span>
<span style="color: #000088;">$handle</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$url</span>    <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://maps.google.de/maps/geo?key=myKey&amp;output=json&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$url</span>   <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&amp;q=Vollmerhauser Straße 115, 51645 Gummersbach, Deutschland&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Set curl options</span>
<span style="color: #990000;">curl_setopt</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$handle</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$handle</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Get code and parse json</span>
<span style="color: #000088;">$response</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_exec</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$handle</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$json</span>     <span style="color: #339933;">=</span> <span style="color: #990000;">json_decode</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$response</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">curl_close</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$handle</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Fügt man jedoch einen User-Agent als curl-option (<strong>CURLOPT_USERAGENT</strong>) hinzu, ist das Ergebnis korrekt und json_decode verrichtet seinen Dienst, wie erwartet. Ein sehr seltsames Verhalten&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// ... Code siehe oben</span>
<span style="color: #990000;">curl_setopt</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$handle</span><span style="color: #339933;">,</span> CURLOPT_USERAGENT<span style="color: #339933;">,</span> 
    <span style="color: #0000ff;">'Mozilla/5.0 (X11; U; Linux i686; de-DE; rv:1.7.6) Gecko/20050309 Firefox/1.0.1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// ... Code siehe oben</span></pre></div></div>

<h4>StatusCode 620 (G_GEO_TOO_MANY_QUERIES)</h4>
<p>Der Geocoder liefert eigene Response-Codes (GGeoStatusCode) um den Status der Geocodierung anzuzeigen. Bei vielen Anfragen tritt häufig der Response-Code 620 (G_GEO_TOO_MANY_QUERIES) auf.</p>
<p>
Google beschränkt also die Anzahl der Geocoding-Operation pro Sekunde. Deshalb müssen die Anfragen limitiert werden.
</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Warte 100ms</span>
<span style="color: #990000;">usleep</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">100000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Nun sinkt natürlich der Datendurchsatz, aber damit kann man leben, denn die Anfragen werden richtig beantwortet. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2008/03/07/geocoding-uber-http-mit-dem-google-maps-geocoding-service/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

