<?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>BibaBlog &#187; bridge</title>
	<atom:link href="http://wap.ecw.de/archives/tag/bridge/feed" rel="self" type="application/rss+xml" />
	<link>http://wap.ecw.de</link>
	<description>Vom Erfinder der Pandemie</description>
	<lastBuildDate>Tue, 31 Aug 2010 18:57:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Perle IOLAN und RXTXcomm (Java) unter Linux</title>
		<link>http://wap.ecw.de/archives/1271</link>
		<comments>http://wap.ecw.de/archives/1271#comments</comments>
		<pubDate>Thu, 07 Jan 2010 12:38:35 +0000</pubDate>
		<dc:creator>Schakko</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bridge]]></category>
		<category><![CDATA[daemon]]></category>
		<category><![CDATA[ethernet]]></category>
		<category><![CDATA[iolan]]></category>
		<category><![CDATA[perle]]></category>
		<category><![CDATA[port]]></category>
		<category><![CDATA[rxtx]]></category>
		<category><![CDATA[rxtxcomm]]></category>
		<category><![CDATA[serial]]></category>
		<category><![CDATA[seriell]]></category>
		<category><![CDATA[trueport]]></category>

		<guid isPermaLink="false">http://wap.ecw.de/?p=1271</guid>
		<description><![CDATA[Für unser aktuelles Projekt verwenden wir eine Perle IOLAN-Box. Die Box stellt serielle Ports &#8211; in unserem Fall sind das zwei Stück &#8211; über Ethernet zur Verfügung. Der Einsatzbereich ist z.B. nötig, wenn man GSM-Modems in abgeschirmten Räumen (Rechenzentren, Bunkern) betreiben will. Die IOLAN-Box bildet eine Bridge zwischen Seriell- und Ethernet ab. So lässt sich [...]]]></description>
			<content:encoded><![CDATA[<p>Für unser aktuelles Projekt verwenden wir eine Perle IOLAN-Box. Die Box stellt serielle Ports &#8211; in unserem Fall sind das zwei Stück &#8211; über Ethernet zur Verfügung.<br />
Der Einsatzbereich ist z.B. nötig, wenn man GSM-Modems in abgeschirmten Räumen (Rechenzentren, Bunkern) betreiben will. Die IOLAN-Box bildet eine Bridge zwischen Seriell- und Ethernet ab. So lässt sich das GSM-Modem (Seriell) an die IOLAN-Box (Seriell) anschließen, die wiederum über Ethernet an das Netzwerk angebunden ist. Für Linux und Windows existieren passende Programme, die nun lokal wiederum die Verbindung über das Netzwerk als serielles Interface abbilden.</p>
<p>Gestern stieß ich bei der Einrichtung der lokalen Schnittstellen auf ein Problem: RXTXComm &#8211; <em>das</em> Java-Framework zur Kommunikation mit seriellen/parallelen Schnittstellen &#8211; listete beim Start die /dev/tx00*-Devices nicht auf. Die FAQ von RXTX weist daraufhin, dass man per<br />
<i>System.setProperty(&#8220;gnu.io.rxtx.SerialPorts&#8221;, portFileNames)</i> zusätzliche Ports definieren kann. Der Lösungsansatz brachte kein Erfolg.<br />Zweite Idee war dann, dass ich &#8211; wie in der FAQ beschrieben &#8211; die <i>tx*</i>-Devices manuell in die RXTXCommDriver.java eintrage. Auch das war nicht von Erfolg gekrönt.</p>
<p />
Der ausschlaggebende Punkt war schließlich, dass die /dev/tx00*-Devices die falschen Berechtigungen besaßen: RXTXComm erkennt die seriellen Schnittstellen <strong>nur</strong> wenn /dev/tx00* der Gruppe <i>uucp</i> angehört (<i>chown uucp /dev/tx*</i>) und die Gruppe Schreib- <strong>und</strong> Leserechte besitzt (<i>chmod g+rw /dev/tx*</i>).</p>
]]></content:encoded>
			<wfw:commentRss>http://wap.ecw.de/archives/1271/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using BIRT and PHP without Zend Plaform</title>
		<link>http://wap.ecw.de/archives/273</link>
		<comments>http://wap.ecw.de/archives/273#comments</comments>
		<pubDate>Tue, 24 Apr 2007 15:33:58 +0000</pubDate>
		<dc:creator>Schakko</dc:creator>
				<category><![CDATA[Arbeit]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Publikationen]]></category>
		<category><![CDATA[birt]]></category>
		<category><![CDATA[bridge]]></category>

		<guid isPermaLink="false">http://192.168.0.78/staging/blog-test/wordpress/archives/273</guid>
		<description><![CDATA[Oh well&#8230; my first blog entry in English, because I think this article is interesting for all the PHP developers out there &#8211; including non-German people Every developer will reach the point generating reports for the running project. Making reports with Java oder .NET is relatively easy. Products like Crystal Reports (commercial) or BIRT (open [...]]]></description>
			<content:encoded><![CDATA[<p>Oh well&#8230; my first blog entry in English, because I think this article is interesting for all the PHP developers out there &#8211; including non-German people <img src='http://wap.ecw.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Every developer will reach the point generating reports for the running project. Making reports with Java oder .NET is relatively easy. Products like Crystal Reports (commercial) or BIRT (open source) support developers in designing and creating pleasant reports.</p>
<p>PHP can be extended with the function of BIRT with buying the Zend Platform. But in most cases the minority of people is able to buy this product. Zend Platform costs around 1000$ &#8211; 1500$ for a one year license.</p>
<p>Our development team had the problem of generating reports with PHP more than one time. In our last project we used FOP + XSL/XSLT from the Apache Foundation and triggered the report building by using exec() and command line.<br />
The problem with FOP is that it is highly memory intensive and the building of XSLT templates is time consuming &#8211; if you do not have nice tools for that.<br />
Last week I investigated and evaluated BIRT for using it in a J2EE/GWT-based application we are programming. The BIRT Designer is a nice tool for creating reports in HTML and/or PDF and we will (hopeley) include it in our project.<br />
I demonstrated the results Christoph who was really amazed of it. Christoph said &#8220;Well&#8230; it would be so nice using BIRT with PHP for ZABOS (ZABOS is our SMS Alert System). But Zend Platform is sooo expensive.&#8221; (mimimi)<br />
It was friday afternoon and nothing more was to do so I decided to look for reporting mechanisms in PHP. The results were&#8230; let&#8217;s say: poor <img src='http://wap.ecw.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>The next idea was triggering BIRT from command line via PHP exec()&#8217;s method. I wrote a wrapper class in Java, which could be used to start BIRT from command line (using java -jar de.ecw.birt.BIRTRunner &#8211;help).<br />
After some minutes of coding and testing this class worked like a charme. I was happy, but I thought &#8220;Woah&#8230; It would be nice using Java directly from PHP&#8221;. I remembered that there was a PHP module called php_java which could access Java through the JNI (Java Native Interface). But all the comments on php.net said the old php_java module is more than deprecated and does not work. The newer commentator said that the <a href="http://php-java-bridge.sourceforge.net/" target="_blank" class="bb-url">php/Java-Bridge</a> was a worth checking at. Hm&#8230; I read the documentation of the php/Java-Bridge and was enthusiastic: This was exactly what I needed.</p>
<p>I downloaded the latest release and was a little bit confused about the different files and JARs.<br />
The solution is easy: Unpack the JavaBridge.war archive. The folder <span style="font-style:italic">/java</span> is needed in your PHP project path and includes all classes for connecting to the JavaBridge-server.<br />
The file /WEB-INF/lib/JavaBridge.jar must be extracted to a directory of your choice (= $path-to-java-bridge). Please create inside this directory another directory called &#8216;lib&#8217;.<br />
Your folder must look like this:<br />
<span style="font-style:italic"><br />
/java-bridge<br />
  JavaBridge.jar<br />
  /lib<br />
</span></p>
<p>Afterwards I started the server:</p>
<pre class="brush: bash;">
cd $path-to-java-bridge
java.exe -Dphp.java.bridge.base=$path-to-java-bridge -jar JavaBridge.jar SERVLET:8080 6 php-java-brige.log
</pre>
<p>The log file did not show any error so I tried a simple &#8220;Hello world&#8221; in Java and PHP:</p>
<pre class="brush: php;">
&lt;?php
  // index.php
  require_once(&quot;java/Java.inc&quot;);
  $aString = new Java(&quot;java.lang.String&quot;, &quot;Hello world&quot;);
  print $aString;
?&gt;
</pre>
<p>Really nice: PHP connected to the local JavaBridge server. The JavaBridge instantiates a new String-object an called the toString() method. This was exactly what I needed for using php/Java-bridge with BIRT.</p>
<p>I refactored my own BIRTRunner class so that I just needed to call 4 methods and I got the desired result.<br />
The appended .jar file must be extracted to the $path-to-java-bridge/lib, and you must restart the JavaBridge AND Apache. There seems to be an issue with UTF-8/JavaBridge/Apache.</p>
<p>My index.php had to be refactored too:</p>
<pre class="brush: php;">
&lt;?php
  // index.php
  // require JavaBridge interface
  require_once(&quot;java/Java.inc&quot;);
  // set encoding to UTF-8
  java_set_file_encoding(&quot;UTF-8&quot;);

  // remove try-/catch-block if not using PHP5
  try
  {
    // where our reports are stored
    $targetFile = &quot;d:/result.html&quot;;
    // ConcreteTask encapsulate the logic
    $birtTask = new Java(&quot;de.ecw.birt.task.ConcreteTask&quot;);
    // the home of your BIRT-runtime directory
    $birtTask-&gt;setEngineHome('D:\Development\BIRT_Runtime\ReportEngine');
    // the path of your BIRT report design
    $birtTask-&gt;setReportPath('D:\Development\BIRT\workspace\CAPlan\user.rptdesign');
    // create new render options
    $htmlRenderOptions = new Java(&quot;org.eclipse.birt.report.engine.api.HTMLRenderOption&quot;);
    $htmlRenderOptions-&gt;setOutputFileName($targetFile);
    $birtTask-&gt;setRenderOption($htmlRenderOptions);
    // run the BIRT task
    $birtTask-&gt;run();

    // get file content and print to browser
    $content = file_get_contents($targetFile);
    echo $content;
  }
  catch (JavaException $e)
  {
    print $e-&gt;getMessage();
  }
?&gt;
</pre>
<p>To my surprise it worked. I had not really expected it &#8211; but I was really able to use PHP and BIRT without buying Zend Platform.</p>
<p>There are so many possibilities and TODOs I want to mention:<br />
  * You can create the .rptdesign on-the-fly using Smarty<br />
  * You cold write a wrapper class on PHP side so it is much easier to create reports<br />
  * &#8230; to be continued</p>
]]></content:encoded>
			<wfw:commentRss>http://wap.ecw.de/archives/273/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
