<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>iTeh DI Edmund Siegfried Haselwanter</title>
    <link>http://iteh.at/de/rss/</link>
    <language>de-at</language>
    <ttl>40</ttl>
    <description>RSS Feed des Weblogs von iTeh DI Edmund Siegfried Haselwanter.</description>
    
    
        <item>
          <title>Deployment von Java Web Applikationen mit Chef von Opscode</title>
          <description>&lt;p&gt;There is a rework of the data driven deployment of java web applications. This &lt;a href=&quot;http://vagrantup.com&quot;&gt;Vagrant&lt;/a&gt; project on github ( &lt;a href=&quot;https://github.com/iteh/vagrant-demos/tree/master/vagrant-java-application-reworked&quot;&gt;https://github.com/iteh/vagrant-demos/&lt;/a&gt; ) showcases the &lt;a href=&quot;http://www.opscode.com/blog/2010/05/06/data-driven-application-deployment-with-chef/&quot;&gt;application cookbook for chef&lt;/a&gt; with a reworked application definition and &lt;span class=&quot;caps&quot;&gt;LWRP&lt;/span&gt; for Tomcat.&lt;/p&gt;&lt;h2&gt;Data Driven Java Application Deployment got better&lt;/h2&gt;
&lt;p&gt;The application cookbook helps to install a full application stack for java web applications. It abstracts the installation of apache, tomcat and mysql to be modeled through a data driven concept. In this rework we add a tomcat_context &lt;span class=&quot;caps&quot;&gt;LWRP&lt;/span&gt; and move the application recipes to definitions.&lt;/p&gt;
&lt;p&gt;Now we can use something like this:&lt;br /&gt;
&lt;code&gt;
app = JSON.parse(File.open( File.join( File.dirname(__FILE__), \
                 &quot;../databags/jolokia.json&quot;)).read)&lt;/p&gt;
&lt;p&gt;node.run_state[:current_app] = app&lt;/p&gt;
&lt;p&gt;application_java_webapp &amp;#8220;jolokia-java_webapp&amp;#8221;&lt;br /&gt;
application_tomcat &amp;#8220;jolokia-tomcat&amp;#8221;&lt;/p&gt;
&lt;p&gt;node.run_state.delete(:current_app)&lt;/p&gt;
&lt;p&gt;&lt;/code&gt;&lt;/notextile&gt;&lt;br /&gt;
The configuration is still the same and can be found in databags/apps/java_app.json. It defines the server name and alias, the war and container context as well as the database to use.&lt;/p&gt;
&lt;h2&gt;Run it&lt;/h2&gt;
&lt;p&gt;Download the archive or to a git clone. Ensure that you have a proper Vagrant environment installed. Change to the &amp;#8220;vagrant-java-application-reworked&amp;#8221; directory and enter&lt;/p&gt;
&lt;p&gt;$ vagrant up&lt;/p&gt;
&lt;p&gt;This will download the lucid32 box (500 MB so this can take a while on the first download) and do the provisioning&lt;/p&gt;
&lt;p&gt;after the chef-solo run you can access &lt;a href=&quot;http://java_app.smackaho.st:4567/probe/&quot;&gt;http://java_app.smackaho.st:4567/probe/&lt;/a&gt; with the username &amp;#8220;probe&amp;#8221; and the password &amp;#8220;probe&amp;#8221; this hits the application through apache. &lt;a href=&quot;http://java_app.smackaho.st:4568/probe/&quot;&gt;http://java_app.smackaho.st:4568/probe/&lt;/a&gt; will hit tomcat directly.&lt;/p&gt;
&lt;p&gt;To prove the jdbc connection go to &lt;a href=&quot;http://java_app.smackaho.st:4567/probe/sql/datasourcetest.htm?webapp=/probe&amp;amp;resource=jdbc/java_app&quot;&gt;http://java_app.smackaho.st:4567/probe/sql/datasourcetest.htm?webapp=/probe&amp;amp;resource=jdbc/java_app&lt;/a&gt;&lt;/p&gt;</description>
          <pubDate>Wed, 22 Jun 2011 22:00:00 GMT</pubDate>
          <guid>http://www.iteh.at/de/blog/2011/06/23/deployment-von-java-web-applikationen-mit-chef-von-opscode/</guid>
          <link>http://iteh.at/de/blog/2011/06/23/deployment-von-java-web-applikationen-mit-chef-von-opscode/</link>
        </item>
    
        <item>
          <title>Data Driven Deployment einer Java Web Application mit Chef Solo</title>
          <description>&lt;h2&gt;Chef Application Cookbook Showcase&lt;/h2&gt;
&lt;p&gt;Dieses &lt;a href=&quot;http://vagrantup.com&quot;&gt;Vagrant&lt;/a&gt; Projekt auf unserem Github Repository ( &lt;a href=&quot;https://github.com/iteh/vagrant-demos/tree/master/vagrant-java-application&quot;&gt;https://github.com/iteh/vagrant-demos/&lt;/a&gt; ) zeigt die Verwendung des &lt;a href=&quot;http://www.opscode.com/blog/2010/05/06/data-driven-application-deployment-with-chef/&quot;&gt;Application Cookbooks für Chef&lt;/a&gt;&lt;/p&gt;&lt;h2&gt;Data Driven Java Application Deployment&lt;/h2&gt;
&lt;p&gt;Das Application Cookbook hilft dabei einen kompletten Applikations Stack für Java Webapplikationen zu beschreiben und zu installieren. Es abstrahiert dabei die Installation von Apache2, Tomcat6 und Mysql durch einen Daten getriebenen Ansatz.&lt;/p&gt;
&lt;p&gt;Im Kern dieses Konzepts steh die Beschreibung der Abhängigkeiten der Web Applikation rein durch Daten. In diesem Beispiel werden wir die Applikation &amp;#8220;Probe&amp;#8221; auf einen Tomcat6 Container deployen und über einen Apache2 Reverse Proxy servicieren.&lt;/p&gt;
&lt;p&gt;Die Konfiguration kann in databags/apps/java_app.json gefunden werden. Die Konfiguration beschreibt die Abhängigkeit der Komponenten wie auch die konkreten Daten Servername, Tomcat Context der Applikation, sowie die Datenbank Ressource.&lt;/p&gt;
&lt;h2&gt;Chef-Solo Tweaks&lt;/h2&gt;
&lt;p&gt;Databags und Chef-Search sind eigentlich dem Chef-Client vorbehalten und können nicht von Chef-Solo aus genutzt werden, da &amp;#8211; Nomen est Omen &amp;#8211; Solo keinen &amp;#8220;Server&amp;#8221; kennt. Das Applikation Cookbook verwendet diese Funktionen und daher sind ein paar Veränderungen an Chef-Solo und Vagrant notwendig.&lt;/p&gt;
&lt;p&gt;Um Vagrant Databags beizubringen wird folgender Patch verwendet: &lt;a href=&quot;https://gist.github.com/867958&quot;&gt;Vagrant_monkeypatch.rb&lt;/a&gt; Chef-Solo weiss aber immer noch nicht wie es Databags vom Filesystem laden soll, wie es eine Suche und wie es das Speichern der Node Daten ohne einen Server bewerkstelligen kann. Das wird mit cookbooks/vagrant/libraries/chef_solo_databag_patch.rb einer Erweiterung von &lt;a href=&quot;https://gist.github.com/867960&quot;&gt;chef_solo_patch.rb&lt;/a&gt; erledigt.&lt;/p&gt;
&lt;p&gt;Das Speichern des Knoten macht im Moment nichts, gibt nur eine Warnung aus, dass ein Cookbook gerne Daten speichern möchte. Das genügt für diese Demonstration. Auch die Suche ist recht &amp;#8220;dumm&amp;#8221; implementiert und gibt nur das entsprechende Databag zurück.&lt;/p&gt;
&lt;h2&gt;Run it&lt;/h2&gt;
&lt;p&gt;Um das Beispiel selbst auszuprobieren einfach entweder das aktuellste Archiv von Github herunterladen oder mit git klonen. Eine Vagrant Installation vorausgesetzt in das Verzeichnis &amp;#8220;vagrant-java-application&amp;#8221; wechseln und&lt;/p&gt;
&lt;p&gt;$ vagrant up&lt;/p&gt;
&lt;p&gt;auf der Kommandozeile eingeben. Das wird eine Ubuntu lucid32 box herunterladen (500 MB das kann somit ein wenig dauern) und die Provisionierung mit Chef-Solo durchführen.&lt;/p&gt;
&lt;p&gt;Nach einem erfolgreichen Chef-Solo Durchlauf kann man die Applikation unter &lt;a href=&quot;http://java_app.smackaho.st:4567/probe/&quot;&gt;http://java_app.smackaho.st:4567/probe/&lt;/a&gt; erreichen. Username ist &amp;#8220;probe&amp;#8221; und das Passwort ist &amp;#8220;probe&amp;#8221;. Diese &lt;span class=&quot;caps&quot;&gt;URI&lt;/span&gt; geht über den Apache Reverse Proxy auf den Tomcat. Die Applikation kann auch direkt auf dem Tomcat aufgerufen werden:   &lt;a href=&quot;http://java_app.smackaho.st:4568/probe/&quot;&gt;http://java_app.smackaho.st:4568/probe/&lt;/a&gt; .&lt;/p&gt;
&lt;p&gt;Das auch Mysql und &lt;span class=&quot;caps&quot;&gt;JDBC&lt;/span&gt; korrekt funktionieren kann man unter dieser &lt;span class=&quot;caps&quot;&gt;URI&lt;/span&gt; sehen: &lt;a href=&quot;http://java_app.smackaho.st:4567/probe/sql/datasourcetest.htm?webapp=/probe&amp;amp;resource=jdbc/java_app&quot;&gt;http://java_app.smackaho.st:4567/probe/sql/datasourcetest.htm?webapp=/probe&amp;amp;resource=jdbc/java_app&lt;/a&gt;&lt;/p&gt;</description>
          <pubDate>Fri, 15 Apr 2011 22:00:00 GMT</pubDate>
          <guid>http://www.iteh.at/de/blog/2011/04/16/data-driven-deployment-einer-java-web-application-mit-chef-solo/</guid>
          <link>http://iteh.at/de/blog/2011/04/16/data-driven-deployment-einer-java-web-application-mit-chef-solo/</link>
        </item>
    
        <item>
          <title>Wordpress über JSON Api mit Facebook Page oder Tumblr befüllen</title>
          <description>&lt;p&gt;In diesem Beispiel zeigen wir die Installation von Wordpress in einem Ubuntu &lt;span class=&quot;caps&quot;&gt;LAMP&lt;/span&gt; Stack. Weiters wird das &lt;span class=&quot;caps&quot;&gt;JSON&lt;/span&gt;-Api Plugin für Wordpress und ein Theme installiert. Danach wird mit Mechanize der Wordpress Blog automatisch installiert und konfiguriert. Anschliessend erzeugen wir noch Einträge im Wordpress Blog indem wir Postings von einer Facebook Page und von einem Tumblr Blog über deren &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt; abfragen und mit der &lt;span class=&quot;caps&quot;&gt;JSON&lt;/span&gt; Wordpress &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt; dem Blog hinzufügen.&lt;/p&gt;&lt;p&gt;&lt;iframe title=&quot;YouTube video player&quot; width=&quot;560&quot; height=&quot;349&quot; src=&quot;http://www.youtube.com/embed/yJAfnMZTfdI&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;&lt;/p&gt;
&lt;p&gt;Grundlage ist hier die schon bekannte Wordpress Installation aus den vorangegangenen Beispielen. &lt;br /&gt;
Dieses mal möchten wir aber Version 3.1 von Wordpress installieren. Dazu kann man eine der tollen Funktionen der automatisierten Installation mit Chef verwenden. Die Versionsnummer von Wordpress ist ein Parameter. Im Vagrant Konfigurationsfile können wir hier einfach den gewünschten Wert setzen:&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; config.&lt;span class=&quot;Entity&quot;&gt;chef&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;json&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;merge!&lt;/span&gt;({
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt;       &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;mysql&lt;/span&gt; =&amp;gt; { ... },
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt;       &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;wordpress_hostname&lt;/span&gt; =&amp;gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;wordpress.smackaho.st&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;,
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt;       &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;wordpress&lt;/span&gt; =&amp;gt; {
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt;         &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;version&lt;/span&gt; =&amp;gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;3.1&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;,
&lt;span class=&quot;line-numbers&quot;&gt;   6 &lt;/span&gt;         &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;checksum&lt;/span&gt; =&amp;gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;297dbd014f3688b6d57329eb2988cb906fbdb1fadea33768d4584f9cbf090794&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   7 &lt;/span&gt;       } 
&lt;span class=&quot;line-numbers&quot;&gt;   8 &lt;/span&gt;     }) 
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;Die Wordpress Installation wird nun noch um das wundervolle Wordpress Plugin &lt;span class=&quot;caps&quot;&gt;JSON&lt;/span&gt;-Api und das freie Wordpress Theme Paragram erweitert. Dazu wird unser Wordpress Cookbook einfach um den jeweiligen Code erweitert.&lt;/p&gt;
&lt;p&gt;Das lässt sich sehr einfach mit den &lt;code&gt;remote_file&lt;/code&gt; und &lt;code&gt;execute&lt;/code&gt; Chef Ressourcen bewerkstelligen&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt; remote_file &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;Support&quot;&gt;Chef&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;Config&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;StringConstant&quot;&gt;&lt;span class=&quot;StringConstant&quot;&gt;:&lt;/span&gt;file_cache_path&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;}&lt;/span&gt;&lt;/span&gt;/json-api.1.0.7.zip&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;do&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt;   source &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;http://downloads.wordpress.org/plugin/json-api.1.0.7.zip&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt;   mode &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;0644&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;  
&lt;span class=&quot;line-numbers&quot;&gt;   6 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   7 &lt;/span&gt; execute &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;unzip-json-api&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;do&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   8 &lt;/span&gt;   cwd &lt;span class=&quot;Support&quot;&gt;File&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;join&lt;/span&gt;(node[&lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;wordpress&lt;/span&gt;][&lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;dir&lt;/span&gt;],&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;wp-content/plugins&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)
&lt;span class=&quot;line-numbers&quot;&gt;   9 &lt;/span&gt;   command &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;unzip &lt;span class=&quot;StringEmbeddedSource&quot;&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;Support&quot;&gt;Chef&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;Config&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;StringConstant&quot;&gt;&lt;span class=&quot;StringConstant&quot;&gt;:&lt;/span&gt;file_cache_path&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;}&lt;/span&gt;&lt;/span&gt;/json-api.1.0.7.zip&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  10 &lt;/span&gt;   creates &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;#{&lt;/span&gt;node&lt;span class=&quot;StringEmbeddedSource&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;StringConstant&quot;&gt;&lt;span class=&quot;StringConstant&quot;&gt;:&lt;/span&gt;wordpress&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;StringConstant&quot;&gt;&lt;span class=&quot;StringConstant&quot;&gt;:&lt;/span&gt;dir&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;}&lt;/span&gt;&lt;/span&gt;/wp-content/plugins/json-api/readme.txt&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  11 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;Damit machen wir einen Download des Plugins und des Themes und entpacken es in das Wordpress Verzeichnis.&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; $ vagrant up
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;Wenn man nun die Seite http://wordpress.smackaho.st:4567/wp-admin/install.php besucht kann man wie gewohnt die Einstellungen vornehmen.&lt;br /&gt;
In diesem Fall möchten wir aber diesen Teil überspringen und werden automatisch ein Setup ausführen:&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; ruby setup_wordpress.&lt;span class=&quot;Entity&quot;&gt;rb&lt;/span&gt;
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;im Verzeichnis der Demonstration einfach ruby setup_wordpress.rb eingeben. Damit werden die notwendigen Einstellungen für diese Demonstration ausgeführt. Dieses Script verwendet Mechanize um in einer Web-Session die &lt;span class=&quot;caps&quot;&gt;HTTP&lt;/span&gt; Aufrufe, die man normalerweise über einen Browser macht, auszuführen.&lt;br /&gt;
Es wird zuerst ein Login gemacht, dann Kategorien hinzugefügt, Plugins aktiviert und Plugin Einstellungen gesetzt.&lt;/p&gt;
&lt;p&gt;Im Anschluss daran verwenden wir die &lt;span class=&quot;caps&quot;&gt;JSON&lt;/span&gt; &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt;. Auf der Ruby Seite verwenden wir das Gem Restclient um die &lt;span class=&quot;caps&quot;&gt;JSON&lt;/span&gt; Payload zu erzeugen.&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; ruby importer.&lt;span class=&quot;Entity&quot;&gt;rb&lt;/span&gt;
&lt;/pre&gt;&lt;/code&gt;
&lt;p&gt;Zuerst erzeugen wir einen einfachen Eintrag mit einem Bild als Attachment. Dann fragen wir über die &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt; von Tumblr unsere Tumblr Postings ab und erzeugen in einer Schleife die Aufrufe über die &lt;span class=&quot;caps&quot;&gt;JSON&lt;/span&gt; &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt;. Dann folgt noch ein Beispiel mit der Facebook Graph &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt;. In einer Schleife arbeiten wir die Postings einer Facebook Page ab, und erzeugen eine dem Posting Typ entsprechende &lt;span class=&quot;caps&quot;&gt;JSON&lt;/span&gt; Payload (Wobei wir hier auch Postings des Typs &lt;em&gt;Photo&lt;/em&gt; bearbeiten und das verknüpfte Photo als Attachement erzeugen).&lt;/p&gt;</description>
          <pubDate>Tue, 15 Mar 2011 23:00:00 GMT</pubDate>
          <guid>http://www.iteh.at/de/blog/2011/03/16/wordpress-ueber-json-api-mit-facebook-page-oder-tumblr-befuellen/</guid>
          <link>http://iteh.at/de/blog/2011/03/16/wordpress-ueber-json-api-mit-facebook-page-oder-tumblr-befuellen/</link>
        </item>
    
        <item>
          <title>Fehler bei Tomcat: Too many open files</title>
          <description>&lt;h3&gt;Das Symptom&lt;/h3&gt;
&lt;p&gt;Tomcat reagiert nur mehr mit einer &lt;span class=&quot;caps&quot;&gt;HTTP&lt;/span&gt; 500 Fehlermeldung. In den Catalina Logfiles (catalina.out) sieht man Einträge der Art:&lt;/p&gt;
&lt;code&gt;&lt;pre class=&quot;sunburst&quot;&gt;

org.&lt;span class=&quot;Entity&quot;&gt;apache&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;tomcat&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;jni&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;Error&lt;/span&gt;: &lt;span class=&quot;Variable&quot;&gt;Too&lt;/span&gt; many open files
       at org.&lt;span class=&quot;Entity&quot;&gt;apache&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;tomcat&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;jni&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;Socket&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;accept&lt;/span&gt;(&lt;span class=&quot;Variable&quot;&gt;Native&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Method&lt;/span&gt;)
       at org.&lt;span class=&quot;Entity&quot;&gt;apache&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;tomcat&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;util&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;net&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;AprEndpoint&lt;/span&gt;&lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;$&lt;/span&gt;Acceptor&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;run&lt;/span&gt;(&lt;span class=&quot;Support&quot;&gt;AprEndpoint&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;java&lt;/span&gt;:&lt;span class=&quot;Constant&quot;&gt;1110&lt;/span&gt;)
       at java.&lt;span class=&quot;Entity&quot;&gt;lang&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;Thread&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;run&lt;/span&gt;(&lt;span class=&quot;Support&quot;&gt;Thread&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;java&lt;/span&gt;:&lt;span class=&quot;Constant&quot;&gt;619&lt;/span&gt;)
&lt;span class=&quot;Variable&quot;&gt;Mar&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;12&lt;/span&gt;, &lt;span class=&quot;Constant&quot;&gt;2009&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;12&lt;/span&gt;:&lt;span class=&quot;Constant&quot;&gt;01&lt;/span&gt;:&lt;span class=&quot;Constant&quot;&gt;34&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;PM&lt;/span&gt; org.&lt;span class=&quot;Entity&quot;&gt;apache&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;tomcat&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;util&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;net&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;AprEndpoint&lt;/span&gt;&lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;$&lt;/span&gt;Acceptor&lt;/span&gt; run
&lt;span class=&quot;Variable&quot;&gt;SEVERE&lt;/span&gt;: &lt;span class=&quot;Variable&quot;&gt;Socket&lt;/span&gt; accept failed

&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;Dann hat man sehr wahrscheinlich Probleme mit File-Handles. Es kann nun sein, dass die Applikation so gebaut ist, dass man hier die Konfiguration der Infrastruktur anpassen muss, oder dass man es mit einem Bug in der Applikation selbst zu tun hat.&lt;/p&gt;
&lt;h3&gt;Um sicher zu sein &amp;#8230; &lt;code&gt;lsof&lt;/code&gt; und &lt;code&gt;ulimit&lt;/code&gt; sind deine Freunde&lt;/h3&gt;
&lt;p&gt;Um die aktuelle Konfiguration zu sehen verwendet man &lt;code&gt;ulimit&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;ulimit -a&lt;/code&gt;:&lt;/p&gt;
&lt;code&gt;&lt;pre class=&quot;sunburst&quot;&gt;

$ ulimit &lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;a
core file size          (blocks, &lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;c) &lt;span class=&quot;Constant&quot;&gt;0&lt;/span&gt;
data seg size           (kbytes, &lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;d) unlimited
scheduling priority             (&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;e) &lt;span class=&quot;Constant&quot;&gt;0&lt;/span&gt;
file size               (blocks, &lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;f) unlimited
pending signals                 (&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;i) &lt;span class=&quot;Constant&quot;&gt;13664&lt;/span&gt;
max locked memory       (kbytes, &lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;l) &lt;span class=&quot;Constant&quot;&gt;32&lt;/span&gt;
max memory size         (kbytes, &lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;m) unlimited
open files                      (&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;n) &lt;span class=&quot;Constant&quot;&gt;1024&lt;/span&gt;
pipe size            (&lt;span class=&quot;Constant&quot;&gt;512&lt;/span&gt; bytes, &lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;p) &lt;span class=&quot;Constant&quot;&gt;8&lt;/span&gt;
&lt;span class=&quot;Variable&quot;&gt;POSIX&lt;/span&gt; message queues     (bytes, &lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;q) &lt;span class=&quot;Constant&quot;&gt;819200&lt;/span&gt;
real&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;time priority              (&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;r) &lt;span class=&quot;Constant&quot;&gt;0&lt;/span&gt;
stack size              (kbytes, &lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;s) &lt;span class=&quot;Constant&quot;&gt;8192&lt;/span&gt;
cpu time               (seconds, &lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;t) unlimited
max user processes              (&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;u) &lt;span class=&quot;Constant&quot;&gt;13664&lt;/span&gt;
virtual memory          (kbytes, &lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;v) unlimited
file locks                      (&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;x) unlimited
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;interessant ist die Zeile mit&lt;/p&gt;
&lt;p&gt;&lt;code&gt;open files                      (-n) 1024&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;die hier zeigt, dass man im Moment 1024 offene File-Handles &lt;strong&gt;pro&lt;/strong&gt; Prozess haben darf.&lt;/p&gt;
&lt;h3&gt;Wieviel File-Handles &amp;#8220;verbraucht&amp;#8221; Tomcat? Frag &lt;code&gt;lsof&lt;/code&gt;!&lt;/h3&gt;
&lt;p&gt;Um die aktuell offenen File-Handles zu sehen kann man das Kommando &lt;code&gt;lsof&lt;/code&gt; verwenden.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;lsof |grep tomcat&lt;/code&gt; zeigt alle offenen File-Handles von Tomcat (oder für Java: &lt;code&gt;grep java&lt;/code&gt;)&lt;/p&gt;
&lt;p&gt;Um diese Ausgabe mit den Einstellungen zu vergleichen können wir &lt;code&gt;wc&lt;/code&gt; verwenden :-)&lt;/p&gt;
&lt;code&gt;&lt;pre class=&quot;sunburst&quot;&gt;
$ lsof &lt;span class=&quot;Keyword&quot;&gt;|&lt;/span&gt;grep tomcat&lt;span class=&quot;Keyword&quot;&gt;|&lt;/span&gt;wc &lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;l
&lt;span class=&quot;Constant&quot;&gt;136&lt;/span&gt;
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;&lt;code&gt;wc&lt;/code&gt; zählt die Anzahl der Zeilen.&lt;/p&gt;
&lt;p&gt;Wenn man hier nun einen vernünftigen Wert bekommt, kann man die Konfiguration anpassen. Das macht man wieder mit &lt;code&gt;ulimit&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;ulimit -n &amp;lt;value&amp;gt;&lt;/code&gt; lässt uns einen Wert setzen. Ein möglicher Wert wäre zum Beispiel 4096. &lt;strong&gt;Aber&lt;/strong&gt;: Sollte der ermittelte Wert sehr gross sein ( e.g. &amp;gt; 5000 ), dann sollte man eher nach einem Fehler in der Applikation suchen.&lt;/p&gt;
&lt;p&gt;Und nicht vergessen: Tomcat muss neu gestarten werden, damit die Einstellungen wirksam werden!&lt;/p&gt;</description>
          <pubDate>Tue, 07 Dec 2010 13:33:09 GMT</pubDate>
          <guid>http://www.iteh.at/de/blog/2010/12/07/fehler-bei-tomcat-too-many-open-files/</guid>
          <link>http://iteh.at/de/blog/2010/12/07/fehler-bei-tomcat-too-many-open-files/</link>
        </item>
    
        <item>
          <title>Wordpress LAMP Stack mit einer Zeile Code installieren</title>
          <description>&lt;p&gt;Im Posting &lt;a href=&quot;/de/blog/2010/12/05/vagrant-sind-sie-bereit-ihren-umgang-mit-it-infrastruktur-zu-revolutionieren/&quot;&gt;Vagrant: Sind Sie bereit Ihren Umgang mit IT Infrastruktur zu revolutionieren? &lt;/a&gt; haben wir die Installation von Vagrant kennengelernt und einen Apache Webserver installiert. Nun wollen wir eine Virtuelle Machine vorbereiten mit der man Wordpress Seiten ausprobieren bzw. entwickeln kann.&lt;/p&gt;&lt;p&gt;Der Focus liegt nun auf Chef bzw. Chef-Solo von Opscode. Es gibt bereits &lt;a href=&quot;https://github.com/opscode/cookbooks&quot; title=&quot;Cookbooks&quot;&gt;eine Menge an sogenannten Kochrezepten&lt;/a&gt; für die Installation von Infrastruktur Komponenten. Für einen funktionierenden &lt;a href=&quot;http://wordpress.org/&quot;&gt;Wordpress Blog&lt;/a&gt; benötigen wir Apache2, PHP5 und Mysql.&lt;/p&gt;
&lt;p&gt;Diese Rezepte müssen wir in den cookbooks Ordner legen. Weiters benötigen wir noch das Rezept für Wordpress. Eine Beschreibung für das &lt;a href=&quot;https://github.com/opscode/cookbooks/blob/master/wordpress/README.rdoc&quot;&gt;Wordpress Rezept kann man hier finden&lt;/a&gt; .&lt;/p&gt;
&lt;p&gt;Unser cookbooks Ordner schaut nun also so aus:&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt; drwxr&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;xr&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;x  &lt;span class=&quot;Constant&quot;&gt;10&lt;/span&gt; ehaselwanter  ehaselwanter  &lt;span class=&quot;Constant&quot;&gt;340&lt;/span&gt;  &lt;span class=&quot;Constant&quot;&gt;6&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Dez&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;21&lt;/span&gt;:&lt;span class=&quot;Constant&quot;&gt;24&lt;/span&gt; apache2
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; drwxr&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;xr&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;x   &lt;span class=&quot;Constant&quot;&gt;7&lt;/span&gt; ehaselwanter  ehaselwanter  &lt;span class=&quot;Constant&quot;&gt;238&lt;/span&gt;  &lt;span class=&quot;Constant&quot;&gt;7&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Dez&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;09&lt;/span&gt;:&lt;span class=&quot;Constant&quot;&gt;50&lt;/span&gt; apt
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt; drwxr&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;xr&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;x  &lt;span class=&quot;Constant&quot;&gt;11&lt;/span&gt; ehaselwanter  ehaselwanter  &lt;span class=&quot;Constant&quot;&gt;374&lt;/span&gt;  &lt;span class=&quot;Constant&quot;&gt;6&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Dez&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;21&lt;/span&gt;:&lt;span class=&quot;Constant&quot;&gt;24&lt;/span&gt; mysql
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt; drwxr&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;xr&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;x   &lt;span class=&quot;Constant&quot;&gt;7&lt;/span&gt; ehaselwanter  ehaselwanter  &lt;span class=&quot;Constant&quot;&gt;238&lt;/span&gt;  &lt;span class=&quot;Constant&quot;&gt;6&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Dez&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;21&lt;/span&gt;:&lt;span class=&quot;Constant&quot;&gt;25&lt;/span&gt; openssl
&lt;span class=&quot;line-numbers&quot;&gt;   6 &lt;/span&gt; drwxr&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;xr&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;x   &lt;span class=&quot;Constant&quot;&gt;8&lt;/span&gt; ehaselwanter  ehaselwanter  &lt;span class=&quot;Constant&quot;&gt;272&lt;/span&gt;  &lt;span class=&quot;Constant&quot;&gt;6&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Dez&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;21&lt;/span&gt;:&lt;span class=&quot;Constant&quot;&gt;25&lt;/span&gt; php
&lt;span class=&quot;line-numbers&quot;&gt;   7 &lt;/span&gt; drwxr&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;xr&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;x   &lt;span class=&quot;Constant&quot;&gt;8&lt;/span&gt; ehaselwanter  ehaselwanter  &lt;span class=&quot;Constant&quot;&gt;272&lt;/span&gt;  &lt;span class=&quot;Constant&quot;&gt;6&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Dez&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;21&lt;/span&gt;:&lt;span class=&quot;Constant&quot;&gt;24&lt;/span&gt; wordpress
&lt;span class=&quot;line-numbers&quot;&gt;   8 &lt;/span&gt; drwxr&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;xr&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;x   &lt;span class=&quot;Constant&quot;&gt;3&lt;/span&gt; ehaselwanter  ehaselwanter  &lt;span class=&quot;Constant&quot;&gt;102&lt;/span&gt;  &lt;span class=&quot;Constant&quot;&gt;6&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Dez&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;21&lt;/span&gt;:&lt;span class=&quot;Constant&quot;&gt;20&lt;/span&gt; wordpress_demo
&lt;span class=&quot;line-numbers&quot;&gt;   9 &lt;/span&gt; 
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;Wobei apt für die Aktualisierung von apt-get zuständig ist und openssl eine Abhängigkeit der verwendeten Rezepte darstellt&lt;/p&gt;
&lt;p&gt;Nun benötigen wir noch ein Rezept, um Wordpress zu installieren:&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;&lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; wordpress_demo cookbook&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;&lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; This cookbook includes and sets up a server with wordpress&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;&lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt; require_recipe &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;wordpress&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   6 &lt;/span&gt; 
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;Wie versprochen, genau &lt;strong&gt;eine&lt;/strong&gt; Zeile Code :-)&lt;/p&gt;
&lt;p&gt;Damit das Ganze funktioniert müssen wir Chef Solo und Vagrant noch ein wenig Konfiguration mit auf den Weg geben:&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;Vagrant&lt;/span&gt;::&lt;span class=&quot;Entity&quot;&gt;Config&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;run&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;do &lt;/span&gt;|&lt;span class=&quot;Variable&quot;&gt;config&lt;/span&gt;|
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;  &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; All Vagrant configuration is done here. For a detailed explanation&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;  &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; and listing of configuration options, please view the documentation&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;  &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; online.&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   6 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   7 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;  &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; Every Vagrant virtual environment requires a box to build off of.&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   8 &lt;/span&gt;   config.&lt;span class=&quot;Entity&quot;&gt;vm&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;box&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;base&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;                 
&lt;span class=&quot;line-numbers&quot;&gt;   9 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  10 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;  &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; Forward guest port 80 to host port 4567 and name the mapping &amp;quot;web&amp;quot;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  11 &lt;/span&gt;   config.&lt;span class=&quot;Entity&quot;&gt;vm&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;forward_port&lt;/span&gt;(&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;web&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;Constant&quot;&gt;80&lt;/span&gt;, &lt;span class=&quot;Constant&quot;&gt;4567&lt;/span&gt;)   
&lt;span class=&quot;line-numbers&quot;&gt;  12 &lt;/span&gt;   
&lt;span class=&quot;line-numbers&quot;&gt;  13 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;  &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; This path will be expanded relative to the project directory&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  14 &lt;/span&gt;   config.&lt;span class=&quot;Entity&quot;&gt;chef&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;cookbooks_path&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;cookbooks&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  15 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;  &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; ensure the latest packages&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  16 &lt;/span&gt;   config.&lt;span class=&quot;Entity&quot;&gt;chef&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;add_recipe&lt;/span&gt;(&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;apt&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;) 
&lt;span class=&quot;line-numbers&quot;&gt;  17 &lt;/span&gt;   
&lt;span class=&quot;line-numbers&quot;&gt;  18 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;  &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt;this recipe we want to run&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  19 &lt;/span&gt;   config.&lt;span class=&quot;Entity&quot;&gt;chef&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;add_recipe&lt;/span&gt;(&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;wordpress_demo&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;) 
&lt;span class=&quot;line-numbers&quot;&gt;  20 &lt;/span&gt;   
&lt;span class=&quot;line-numbers&quot;&gt;  21 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;  &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; just set a password for now&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  22 &lt;/span&gt;   config.&lt;span class=&quot;Entity&quot;&gt;chef&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;json&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;merge!&lt;/span&gt;({
&lt;span class=&quot;line-numbers&quot;&gt;  23 &lt;/span&gt;       &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;mysql&lt;/span&gt; =&amp;gt; {
&lt;span class=&quot;line-numbers&quot;&gt;  24 &lt;/span&gt;         &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;server_debian_password&lt;/span&gt; =&amp;gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;secure_password&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;,
&lt;span class=&quot;line-numbers&quot;&gt;  25 &lt;/span&gt;         &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;server_root_password&lt;/span&gt; =&amp;gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;secure_password&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;,
&lt;span class=&quot;line-numbers&quot;&gt;  26 &lt;/span&gt;         &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;server_repl_password&lt;/span&gt; =&amp;gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;secure_password&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  27 &lt;/span&gt;       }
&lt;span class=&quot;line-numbers&quot;&gt;  28 &lt;/span&gt;     })
&lt;span class=&quot;line-numbers&quot;&gt;  29 &lt;/span&gt;   
&lt;span class=&quot;line-numbers&quot;&gt;  30 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;  &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; we use chef-solo to provision stuff&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  31 &lt;/span&gt;   config.&lt;span class=&quot;Entity&quot;&gt;vm&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;provisioner&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;chef_solo&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  32 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  33 &lt;/span&gt; 
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;Und los geht es.&lt;/p&gt;
&lt;p&gt;Ein vagrant up im Projekt Verzeichnis erzeugt eine neue Virtuelle Maschine basierend auf unsere Base Box lucid32. Danach werden alle Abhängigkeiten von Wordpress und Wordpress selbst installiert.&lt;/p&gt;
&lt;p&gt;Sobald das Kommando fertig durchgelaufen ist kann man die Installation unter&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt; http&lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;/&lt;/span&gt;&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;localhost:&lt;span class=&quot;Constant&quot;&gt;4567&lt;/span&gt;&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;wordpress&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;wp&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;admin&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;install.&lt;span class=&quot;Entity&quot;&gt;php&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; 
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;bewundern.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/199/Wordpress-Vagrant.png&quot;  alt='Wordpress Installation' /&gt;&lt;/p&gt;
&lt;p&gt;Und wieder zum Selbst ausprobieren:&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt; git&lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;/&lt;/span&gt;&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;github.&lt;span class=&quot;Entity&quot;&gt;com&lt;/span&gt;&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;iteh&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;vagrant&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;demos.&lt;span class=&quot;Entity&quot;&gt;git&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; cd vagrant&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;demos&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;vagrant&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;wordpress
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt; vagrant up
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt; 
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;und ein wenig warten :-)&lt;/p&gt;</description>
          <pubDate>Tue, 07 Dec 2010 11:48:17 GMT</pubDate>
          <guid>http://www.iteh.at/de/blog/2010/12/07/wordpress-lamp-stack-mit-einer-zeile-code-installieren/</guid>
          <link>http://iteh.at/de/blog/2010/12/07/wordpress-lamp-stack-mit-einer-zeile-code-installieren/</link>
        </item>
    
        <item>
          <title>Vagrant: Sind Sie bereit Ihren Umgang mit IT Infrastruktur zu revolutionieren? </title>
          <description>&lt;p&gt;&lt;a href=&quot;http://vagrantup.com/&quot;&gt;Vargant&lt;/a&gt; ist ein Tool für das Erstellen und Verbreiten von virtualisierten Entwicklungsumgebungen.&lt;/p&gt;
&lt;p&gt;Vagrant baut hier auf &lt;a href=&quot;http://www.ruby-lang.org/&quot;&gt;Ruby&lt;/a&gt; auf und ermöglicht es, ausgehend von einer Basis Installation, automatisiert spezielle Entwicklungsumgebungen aufzubauen. Die Beschreibung der aktuellen Infrastruktur wird mit dem ausgezeichneten Provisionierungs Tool Chef von Opscode gemacht. Damit hat man nun die Möglichkeit jedem Entwickler eine reproduzierbare und portable Entwicklungsumgebung zur Verfügung zu stellen.&lt;/p&gt;&lt;h2&gt;Virtualbox&lt;/h2&gt;
&lt;p&gt;Vagrant benötigt &lt;a href=&quot;http://www.virtualbox.org/&quot;&gt;Oracles VirtualBox&lt;/a&gt;, um die virtuellen Umgebungen herzustellen. VirtualBox ist eine Virtualiserungssoftware für x86 Systeme. Virtualbox eignet sich für Server als auch für Desktop Virtualisierungen, und ist im Moment die einzige Virtualisierungslösung in professioneller Qualität, die auch Open Source Software ist. VirtualBox ist für Windows, Mac OS X, Linux, und Solaris erältlich.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.virtualbox.org/wiki/Downloads&quot;&gt;Hier ist ein Link zur Download Seite von Virtualbox&lt;/a&gt; .&lt;/p&gt;
&lt;h2&gt;Vagrant installieren&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;http://www.virtualbox.org/&quot;&gt;Oracles Virtualbox&lt;/a&gt; setzt eine Ruby und Rubygems Umgebung voraus. &lt;br /&gt;
Nach der Installation von &lt;a href=&quot;http://www.ruby-lang.org/&quot;&gt;Ruby&lt;/a&gt; , &lt;a href=&quot;http://rubygems.org/&quot;&gt;Rubygems&lt;/a&gt; und Virtualbox (in einer Version grösser 3.2) kann man Vagrant installieren:&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; $ gem install vagrant
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt; $ vagrant box add base http&lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;/&lt;/span&gt;&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;files.&lt;span class=&quot;Entity&quot;&gt;vagrantup&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;com&lt;/span&gt;&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;lucid32.&lt;span class=&quot;Entity&quot;&gt;box&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; $ vagrant init
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt; $ vagrant up
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;Die Vagrant virtuelle Maschine erreicht man nun mit ssh auf localhost, Port 2222&lt;/p&gt;
&lt;p&gt;Eine Liste von &lt;a href=&quot;https://github.com/mitchellh/vagrant/wiki/Available-Vagrant-Boxes&quot;&gt;verschiedenen Basis Boxen kann man hier finden [klick]&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Ein einfaches Beispiel ist nun mit chef-solo Apache2 zu installieren. Dazu brauchen wir ein $Vagrantfile$ im aktuellen Projektverzeichnis (da wo wir vagrant init gemacht haben) das folgendermassen aussieht:&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;Vagrant&lt;/span&gt;::&lt;span class=&quot;Entity&quot;&gt;Config&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;run&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;do &lt;/span&gt;|&lt;span class=&quot;Variable&quot;&gt;config&lt;/span&gt;|
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;  &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; All Vagrant configuration is done here. For a detailed explanation&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;  &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; and listing of configuration options, please view the documentation&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;  &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; online.&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   6 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;  &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; Every Vagrant virtual environment requires a box to build off of.&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   7 &lt;/span&gt;   config.&lt;span class=&quot;Entity&quot;&gt;vm&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;box&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;base&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;                 
&lt;span class=&quot;line-numbers&quot;&gt;   8 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   9 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;  &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; Forward guest port 80 to host port 4567 and name the mapping &amp;quot;web&amp;quot;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  10 &lt;/span&gt;   config.&lt;span class=&quot;Entity&quot;&gt;vm&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;forward_port&lt;/span&gt;(&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;web&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;Constant&quot;&gt;80&lt;/span&gt;, &lt;span class=&quot;Constant&quot;&gt;4567&lt;/span&gt;)   
&lt;span class=&quot;line-numbers&quot;&gt;  11 &lt;/span&gt;   
&lt;span class=&quot;line-numbers&quot;&gt;  12 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;  &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; This path will be expanded relative to the project directory&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  13 &lt;/span&gt;   config.&lt;span class=&quot;Entity&quot;&gt;chef&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;cookbooks_path&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;cookbooks&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  14 &lt;/span&gt;   
&lt;span class=&quot;line-numbers&quot;&gt;  15 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;  &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt;this recipe we want to run&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  16 &lt;/span&gt;   config.&lt;span class=&quot;Entity&quot;&gt;chef&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;add_recipe&lt;/span&gt;(&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;apache_demo&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)
&lt;span class=&quot;line-numbers&quot;&gt;  17 &lt;/span&gt;   
&lt;span class=&quot;line-numbers&quot;&gt;  18 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;  &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; we use chef-solo to provision stuff&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  19 &lt;/span&gt;   config.&lt;span class=&quot;Entity&quot;&gt;vm&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;provisioner&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;chef_solo&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  20 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;Der Einfachheit halber verwenden wir das Standard Apache2 Cookbook von Opscode.&lt;/p&gt;
&lt;p&gt;Sie können das Vagrant Projekt auch hier auf &lt;a href=&quot;https://github.com/iteh/vagrant-demos&quot;&gt;Github abholen [klick]&lt;/a&gt; und in das Verzeichnis $vagrant-apache$ wechseln.&lt;br /&gt;
Nach einem einfach $vagrant up$ sollte der Apache auch schon in Ihrer Virtuellen Maschine verwendbar sein:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/198/it_works.png&quot;  alt='it-works' /&gt;&lt;/p&gt;
&lt;p&gt;Gratuliere!&lt;/p&gt;</description>
          <pubDate>Sun, 05 Dec 2010 17:45:05 GMT</pubDate>
          <guid>http://www.iteh.at/de/blog/2010/12/05/vagrant-sind-sie-bereit-ihren-umgang-mit-it-infrastruktur-zu-revolutionieren/</guid>
          <link>http://iteh.at/de/blog/2010/12/05/vagrant-sind-sie-bereit-ihren-umgang-mit-it-infrastruktur-zu-revolutionieren/</link>
        </item>
    
        <item>
          <title>Die offizielle Facebook-Seite aus rechtlicher Sicht</title>
          <description>&lt;p&gt;Eine kleine Sammlung an Links zu Thema Facebook Fan Page und Recht:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.jusmeum.de/blog/social-media-law-12/die-offizielle-facebook-seite-aus-667&quot;&gt;Die offizielle Facebook-Seite aus rechtlicher Sicht &amp;#8211; Teil 1: Einrichtung und Impressum&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.jusmeum.de/blog/social-media-law-12/die-offizielle-facebook-seite-aus-1372&quot;&gt;Die offizielle Facebook-Seite aus rechtlicher Sicht &amp;#8211; Teil 2: Wie und wo richte ich ein den rechtlichen Anforderungen genügendes Impressum ein?&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.jusmeum.de/blog/social-media-law-12/die-offizielle-facebook-seite-aus-1539&quot;&gt;Die offizielle Facebook-Seite aus rechtlicher Sicht &amp;#8211; Teil 3: Der Inhalt der Pinnwandeinträge&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.jusmeum.de/blog/social-media-law-12/die-offizielle-facebook-seite-aus-1811&quot;&gt;Die offizielle Facebook-Seite aus rechtlicher Sicht &amp;#8211; Teil 4: Das Einbinden fremder &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt;-Feeds&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.jusmeum.de/blog/social-media-law-12/die-offizielle-facebook-seite-aus-1994&quot;&gt;Die offizielle Facebook-Seite aus rechtlicher Sicht &amp;#8211; Teil 5: iStockphoto, fotolia &amp;amp; Co: Verletzt die Nutzung von Fotos aus Fotodatenbanken bei Facebook das Urheberrecht?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
          <pubDate>Thu, 25 Nov 2010 11:44:20 GMT</pubDate>
          <guid>http://www.iteh.at/de/blog/2010/11/25/die-offizielle-facebook-seite-aus-rechtlicher-sicht/</guid>
          <link>http://iteh.at/de/blog/2010/11/25/die-offizielle-facebook-seite-aus-rechtlicher-sicht/</link>
        </item>
    
        <item>
          <title>Was ist RSS und warum brauchen Sie es für Facebook</title>
          <description>&lt;p&gt;Was versteckt sich hinter dem Kürzel &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt;? &amp;#8220;Was ist ein &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; Feed?&amp;#8221;, wurden wir schon oft gefragt und denken, dass es allmählich an der Zeit ist, etwas Licht in diese Ecke der IT zu bringen. Zunächst werden wir erklären, wie man &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; als Internetnutzer verwenden kann und danach zeigen wir, was das ganze mit Facebook zu tun hat.&lt;/p&gt;
&lt;p&gt;Möchten Sie bei unserem Weblog am Laufenden bleiben? Es gibt verschiedene Möglichkeiten, um die letzten Neuigkeiten unseres Webauftrittes mitzubekommen. Die meistgenutzte Variante ist einen unserer &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; Feeds zu den verschiedenen Themen zu abonnieren. Was aber ist nun so ein &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; Feed?&lt;/p&gt;&lt;h3&gt;Was ist &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; ist eine Technologie, die von Millionen Internetusern auf dieser Welt genutzt wird, um bei Ihren Lieblingseiten am Laufenden zu bleiben.&lt;/p&gt;
&lt;p&gt;Vor der Zeit von &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; (und ähnlichen Technologien) musste man sich als Benutzer eine Seite extra &lt;em&gt;bookmarken&lt;/em&gt; und diese Webseite immer und immer wieder besuchen, um sich über Neuigkeiten zu informieren.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Die Probleme mit Bookmarks sind:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;als Benutzer muss man aktiv auf alle Seiten, an denen man Interesse hat, zugreifen&lt;/li&gt;
	&lt;li&gt;schwierig wird es, bei mehr als einer handvoll Seiten, auf jeder Einzelnen immer nachzusehen und den Überblick zu behalten&lt;/li&gt;
	&lt;li&gt;vergisst man, regelmässig nachzusehen, können neue Informationen untergehen und übersehen werden&lt;/li&gt;
	&lt;li&gt;da man nicht weiss, ob sich etwas verändert hat, besucht man manche Seiten zu oft und sieht immer nur den selben Inhalt&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; ändert alles&lt;/h3&gt;
&lt;p&gt;Was wäre, wenn eine Webseite Sie von sich aus über einen neu-veröffentlichten Artikel informieren könnte? Im Prinzip ist &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; die Technologie, mit der man diesen Umkehrprozess bewerkstelligen kann.&lt;/p&gt;
&lt;p&gt;&amp;#8220;Wie ist es nun möglich diesen Prozess umzudrehen?&amp;#8221;, werden Sie sich fragen. Sie müssen nicht mehr auf Ihren Lieblingsseiten nachsehen, ob es neue oder relevante Informationen gibt &amp;#8211; nein &amp;#8211; &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; &lt;em&gt;sendet&lt;/em&gt; neue Informationen zu Ihnen und Sie können diese sofort konsumieren. Das spart Zeit (kein nachsehen müssen mehr) und versorgt Sie immer mit den aktuellsten Artikeln, schnell, nachdem sie veröffentlicht wurden.&lt;/p&gt;
&lt;p&gt;Daher erklärt sich auch das Kürzel &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt;: &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; steht für &lt;em&gt;Really Simple Syndication&lt;/em&gt; , besser bekannt als &lt;em&gt;News Feed&lt;/em&gt; den man abonnieren (neudeutsch: &lt;em&gt;subscribe&lt;/em&gt;) kann.&lt;/p&gt;
&lt;p&gt;Sehen Sie es einfach gesagt als eine Art &amp;#8220;Zeitschriften-Abonnement&amp;#8221;. Wie bei einer Zeitschrift bekommt man regelmässig die neue Ausgabe zugestellt. Anders, als bei einer physischen Zeitschrift, werden die Artikel aber unmittelbar an ihren &lt;em&gt;&lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; Reader&lt;/em&gt; ausgeliefert, sobald diese erscheinen.&lt;/p&gt;
&lt;p&gt;Die technischen Details zur Funktion von &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; werden wir eventuell in einem zukünftigen Artikel erklären (ein guter Zeitpunkt, um den &lt;a href=&quot;http://www.iteh.at/de/rss/&quot;&gt;Weblog Feed von iTeh zu abonnieren&lt;/a&gt; &amp;#8211; so werden Sie auch automatisch über all unsere neuen Artikel informiert :-)).&lt;/p&gt;
&lt;p&gt;Zu technisch meinen Sie? Keine Angst! Es gibt nahezu für jedes Betriebssystem sehr einfach zu bedienende Feed-Reader. Und einmal installiert, werden diese auch automatisch verwendet.&lt;/p&gt;
&lt;p&gt;Eine Auswahl an &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; Readern:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.rssowl.org/&quot;&gt;RSSOwl&lt;/a&gt; – wahrscheinlich einer der beliebtesten freien Open Source &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt;-Reader; nettes klares Interface; unterstützt viele Sprachen&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.blogbridge.com/&quot;&gt;BlogBridge&lt;/a&gt; – einfaches, browser-artiges Interface; auch Open Source und populär&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.cincomsmalltalk.com/BottomFeeder/&quot;&gt;BottomFeeder&lt;/a&gt; – ein &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt;-Reader für Poweruser&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/77/&quot;&gt;Sage&lt;/a&gt; – Sage ist ein Firefox-Addon for &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt;; sehr einfach zu benutzen&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.feedly.com/&quot;&gt;Feedly&lt;/a&gt; – &lt;strong&gt;Feedly&lt;/strong&gt; ist ein neuerer &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; Reader; auch eine Firefox-Extension; Besonderheit: Zeigt die Einträge eher wie ein Magazin und trifft damit die natürlichen Lesegewohnheiten&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.google.com/reader&quot;&gt;Google Reader&lt;/a&gt; – ein webbasierter &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt;-Reader von Google; erlaubt sehr einfach die gefundenen Artikel im eigenen sozialen Netz weiterzugeben&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.bloglines.com/&quot;&gt;Bloglines&lt;/a&gt; – vor dem Google Reader war Bloglines der populärste browserbasierende &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt;-Reader; die eigenen &lt;em&gt;Subscriptions&lt;/em&gt; können für andere sichtbar gemacht werden&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.netvibes.com/&quot;&gt;Netvibes&lt;/a&gt; – Netvibes ist eher eine webbasierte Startseite als ein standalone &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt;-Reader; Sie sagen von sich selbst, dass Netvibes _die schnellste Art um Dein Echtzeit-Web zu verfolgen.&lt;br /&gt;
Alles-in-einem Ort und immer up-to-date. _ ist&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.mozillamessaging.com/en-US/thunderbird/&quot;&gt;Thunderbird&lt;/a&gt; – der populäre E-Mail-Client der Mozilla Foundation kann auch als &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt;-Reader eingesetzt werden.&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://reederapp.com/&quot;&gt;Reeder&lt;/a&gt; &amp;#8211; für iPhone und iPad; kann mit Google Reader synchronisiert werden&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;Wie man &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; verwendet&lt;/h3&gt;
&lt;p&gt;Zuerst einmal installieren Sie sich einen &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt;-Reader – Probieren Sie einfach den einen oder anderen der oben angeführten Reader aus, denn der &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt;-Reader sollte zu Ihnen passen und Ihnen Spass machen.&lt;/p&gt;
&lt;p&gt;Am einfachsten ist es, erst einmal einen webbasierten &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt;-Reader zu verwenden. Der &lt;a href=&quot;http://www.google.com/reader&quot;&gt;Google Reader&lt;/a&gt; ist recht einfach zu verwenden. Beginnen Sie einfach einmal mit einem &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt;-Reader. Die abonnierten &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; Feeds lassen sich nahzu bei jedem &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt;-Reader wieder exportieren und in einen anderen importieren.&lt;/p&gt;
&lt;p&gt;Die meisten Feed Reader funktionieren ähnlich wie E-Mail Clients. Nachdem man einen Feed abonniert hat, sieht man die ungelesenen Artikel speziell markiert (im Google Reader fett geschrieben). Hier kann man dann eben diesen Artikel lesen. Danach werden diese Artikel als &lt;em&gt;gelesen&lt;/em&gt; markiert.&lt;/p&gt;
&lt;h3&gt;Und wo kommen die Feeds her?&lt;/h3&gt;
&lt;p&gt;Es gibt unter anderem zwei Plätze wo man nach &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; Feeds suchen kann:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Auf einer Webseite&lt;/li&gt;
	&lt;li&gt;Direkt im Browser&lt;/li&gt;
&lt;/ol&gt;
&lt;h4&gt;Auf einer Webseite&lt;/h4&gt;
&lt;p&gt;Vielleicht ist es Ihnen ja schon aufgefallen: In den letzten Jahren haben immer mehr Webseiten viele kleine Symbole, die als Buttons oder Widgets funktionieren.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/photos/pimkie_fotos/2452194706/&quot; title=&quot;iconos-rss by Chesi - Fotos CC, on Flickr&quot;&gt;&lt;img src=&quot;http://farm4.static.flickr.com/3291/2452194706_d0b474f664.jpg&quot; width=&quot;400&quot; height=&quot;272&quot; alt=&quot;iconos-rss&quot; class=&quot;centered&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Meist sind diese orange und tragen Namen wie &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt;, &lt;span class=&quot;caps&quot;&gt;XML&lt;/span&gt;, &lt;span class=&quot;caps&quot;&gt;ATOM&lt;/span&gt;. Fast immer braucht man dann nur auf ein Symbol klicken und es öffnet sich automatisch der vorher installierte &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt;-Reader. Oder Sie kopieren den Link, der sich hinter dem Button verbirgt, und abonnieren so direkt im &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt;-Reader den entsprechenden Feed.&lt;/p&gt;
&lt;h4&gt;Im Browser&lt;/h4&gt;
&lt;p&gt;Die meisten Browser zeigen das bekannte &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; Symbol in der Titelleiste an. Wenn Sie eine Seite besuchen, die auch einen &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt;-Feed anbietet, genügt ein Klick auf das Symbol, um den Feed zu abonnieren.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/photos/edkohler/957446925/&quot; title=&quot;RSS Options Typepad by edkohler, on Flickr&quot;&gt;&lt;img src=&quot;http://farm2.static.flickr.com/1371/957446925_705140133b.jpg&quot; width=&quot;254&quot; height=&quot;128&quot; alt=&quot;RSS Options Typepad&quot; class=&quot;centered&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Nun da Sie einen oder mehrere &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; Feeds abonniert haben, werden Sie keine wichtigen Informationen mehr übersehen!&lt;/p&gt;
&lt;h3&gt;Und was hat das mit Facebook zu tun?&lt;/h3&gt;
&lt;p&gt;Nun Facebook kann hier sozusagen in die Rolle des Benutzers schlüpfen. &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; Feeds sind ja von einem beliebigen Konsumenten &lt;em&gt;lesbar&lt;/em&gt;. Und es gibt eine ganze Reihe von Facebook Applikationen, die es ermöglichen, einen &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; Feed auf Facebook zu posten. Was macht das nun für einen Sinn, fragen Sie? Na genau den selben. Stellen Sie sich vor, Sie haben einen neuen Newseintrag auf Ihrem Webauftritt veröffentlicht, oder gerade ein neues Produkt oder Wellnesspacket zusammengestellt.&lt;/p&gt;
&lt;p&gt;Falls Sie eben diese Information nun mit einem &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; Feed auf Ihrem Internet Aufritt anbieten, dann kann man &lt;em&gt;automagisch&lt;/em&gt; sozusagen, genau diese Information, ohne weiteres zutun, all Ihren Fans mitteilen. &lt;a href=&quot;http://www.rssgraffiti.com/&quot;&gt;RSSGrafitti&lt;/a&gt; ist genau so eine App. Als Beispiel können Sie unsere &lt;a href=&quot;http://www.facebook.com/pages/Graz-Austria/iTeh-creating-solutions/133902059980071&quot;&gt;Facebook Page&lt;/a&gt; ansehen. Hier sind die beiden &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; Feeds für &lt;a href=&quot;http://www.iteh.at/de/rss/news-info/&quot;&gt;News&lt;/a&gt; und &lt;a href=&quot;http://www.iteh.at/de/rss/blog-info&quot;&gt;Blog Artikel&lt;/a&gt; mit der Facebook Page verbunden.&lt;/p&gt;
&lt;p&gt;Falls Sie das Thema interessiert und Sie bei der Umsetzung Unterstützung brauchen, kontaktieren Sie uns doch einfach auf unserer &lt;a href=&quot;http://www.iteh.at/de/kontakt&quot;&gt;Kontaktseite&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Wir hoffen, Ihnen die Welt der &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; Feeds ein wenig verständlicher gemacht zu machen.&lt;/p&gt;</description>
          <pubDate>Thu, 01 Jul 2010 00:00:00 GMT</pubDate>
          <guid>http://www.iteh.at/de/blog/2010/07/01/was-ist-rss-und-warum-brauchen-sie-es-fuer-facebook/</guid>
          <link>http://iteh.at/de/blog/2010/07/01/was-ist-rss-und-warum-brauchen-sie-es-fuer-facebook/</link>
        </item>
    
        <item>
          <title>Chef von Opscode und der Power von Ruby</title>
          <description>&lt;p&gt;Neuere Versionen von &lt;a href=&quot;http://www.opscode.com/chef&quot;&gt;Chef von Opscode&lt;/a&gt; stellen eine interessante Ressource zur Verfügung: &lt;a href=&quot;http://wiki.opscode.com/display/chef/Resources#Resources-RubyBlock&quot;&gt;ruby_block&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Das sind wirklich tolle Neuigkeiten, denn damit lassen sich schnell Lösungen implementieren.&lt;/p&gt;
&lt;p&gt;Beispielsweise kann man damit einen speziellen &lt;span class=&quot;caps&quot;&gt;HTTP&lt;/span&gt; Request während eines Chef Laufes machen: einen &lt;span class=&quot;caps&quot;&gt;GET&lt;/span&gt; Request an den localhost, aber mit dem &lt;code&gt;Host&lt;/code&gt; Header auf einen &lt;span class=&quot;caps&quot;&gt;FQDN&lt;/span&gt; gesetzt:&lt;/p&gt;&lt;h3&gt;Installation eines Ruby Http Clients&lt;/h3&gt;
&lt;p&gt;Für dieses Beispiel müssen wir zuerst einen Ruby Http Client installieren. Ich habe hier das Gem &lt;a href=&quot;http://curb.rubyforge.org/&quot;&gt;Curb&lt;/a&gt;, welches auf libcurl aufbaut, verwendet. Also installieren wir diesen als erstes.&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; curl_devel &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; package &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;curl-devel&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;do&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt;   action &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;install&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt; curl_devel.&lt;span class=&quot;Entity&quot;&gt;run_action&lt;/span&gt;(&lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;install&lt;/span&gt;)
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;Mit dieser Schreibweise weisen wir OpsChef an den Code schon in der &lt;a href=&quot;http://wiki.opscode.com/display/chef/Anatomy+of+a+Chef+Run&quot;&gt;Compile-Phase des OpsChef Laufes&lt;/a&gt; auszuführen. Das ist notwendig, da wir im selben Lauf die Bibliothek verwenden wollen. Der &lt;em&gt;normale&lt;/em&gt; &lt;code&gt;package&lt;/code&gt; Aufruf würde nur dafür sorgen, dass curl-devel &lt;em&gt;nach&lt;/em&gt; dem Opschef Lauf installiert ist.&lt;/p&gt;
&lt;p&gt;Nun brauchen wir noch die Ruby Anbindung von &lt;code&gt;libcurl&lt;/code&gt;, das Gem &lt;code&gt;curb&lt;/code&gt;&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; curb_gem &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; gem_package &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;curb&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;do&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt;   action &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;install&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt; curb_gem.&lt;span class=&quot;Entity&quot;&gt;run_action&lt;/span&gt;(&lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;install&lt;/span&gt;)
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;Wie gehabt muss das wieder hier wieder in der Compile-Phase geschehen. Damit sind die Vorbereitungen für unseren &lt;code&gt;ruby_block&lt;/code&gt; fast abgeschlossen. Wir müssen Opschef noch mitteilen, dass wir &lt;code&gt;curb&lt;/code&gt; jetzt auch verwenden wollen. Dazu muss der &lt;code&gt;Gem&lt;/code&gt; Pfad neu geladen und &lt;code&gt;curb&lt;/code&gt; &lt;em&gt;required&lt;/em&gt; werden.&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;Gem&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;clear_paths&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;curb&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/code&gt;&lt;h3&gt;Ruby Code in Aktion&lt;/h3&gt;
&lt;p&gt;So. Jetzt können wir endlich unseren &lt;code&gt;ruby_block&lt;/code&gt; verwenden.&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; ruby_block &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;do-http-request-with-cutom-header&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;do&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt;   block &lt;span class=&quot;Keyword&quot;&gt;do&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt;     timeout &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;600&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt;     host &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;localhost:8080&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt;     real_host &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;my.realhost.com&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   6 &lt;/span&gt;     &lt;span class=&quot;Support&quot;&gt;Chef&lt;/span&gt;::&lt;span class=&quot;Entity&quot;&gt;Log&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;info&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;call get on &lt;span class=&quot;StringEmbeddedSource&quot;&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;#{&lt;/span&gt;host&lt;span class=&quot;StringEmbeddedSource&quot;&gt;}&lt;/span&gt;&lt;/span&gt;, maximal request time: &lt;span class=&quot;StringEmbeddedSource&quot;&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;#{&lt;/span&gt;timeout&lt;span class=&quot;StringEmbeddedSource&quot;&gt;}&lt;/span&gt;&lt;/span&gt; seconds&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   7 &lt;/span&gt;     c &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;Curl&lt;/span&gt;::&lt;span class=&quot;Entity&quot;&gt;Easy&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;new&lt;/span&gt;(&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;http://&lt;span class=&quot;StringEmbeddedSource&quot;&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;#{&lt;/span&gt;host&lt;span class=&quot;StringEmbeddedSource&quot;&gt;}&lt;/span&gt;&lt;/span&gt;/maintenance/do_something&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;) &lt;span class=&quot;Keyword&quot;&gt;do &lt;/span&gt;|&lt;span class=&quot;Variable&quot;&gt;curl&lt;/span&gt;|
&lt;span class=&quot;line-numbers&quot;&gt;   8 &lt;/span&gt;       curl.&lt;span class=&quot;Entity&quot;&gt;headers&lt;/span&gt;[&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;Host&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;] &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; real_host
&lt;span class=&quot;line-numbers&quot;&gt;   9 &lt;/span&gt;       curl.&lt;span class=&quot;Entity&quot;&gt;verbose&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  10 &lt;/span&gt;       curl.&lt;span class=&quot;Entity&quot;&gt;timeout&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; timeout
&lt;span class=&quot;line-numbers&quot;&gt;  11 &lt;/span&gt;     &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  12 &lt;/span&gt;     c.&lt;span class=&quot;Entity&quot;&gt;perform&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  13 &lt;/span&gt;     &lt;span class=&quot;Keyword&quot;&gt;if&lt;/span&gt; c.&lt;span class=&quot;Entity&quot;&gt;response_code&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;200&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  14 &lt;/span&gt;       &lt;span class=&quot;Support&quot;&gt;Chef&lt;/span&gt;::&lt;span class=&quot;Entity&quot;&gt;Log&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;info&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;GET success! response was:&lt;span class=&quot;StringEmbeddedSource&quot;&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;#{&lt;/span&gt;c&lt;span class=&quot;StringEmbeddedSource&quot;&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;body_str&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  15 &lt;/span&gt;     &lt;span class=&quot;Keyword&quot;&gt;else&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  16 &lt;/span&gt;       &lt;span class=&quot;Support&quot;&gt;Chef&lt;/span&gt;::&lt;span class=&quot;Entity&quot;&gt;Log&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;GET FAILED. response code &lt;span class=&quot;StringEmbeddedSource&quot;&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;#{&lt;/span&gt;c&lt;span class=&quot;StringEmbeddedSource&quot;&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;response_code&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;}&lt;/span&gt;&lt;/span&gt;, body: &lt;span class=&quot;StringEmbeddedSource&quot;&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;#{&lt;/span&gt;c&lt;span class=&quot;StringEmbeddedSource&quot;&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;body_str&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  17 &lt;/span&gt;     &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  18 &lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  19 &lt;/span&gt;   action &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;create&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  20 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;Wie das Beispiel zeigt kann man mit dieser Ressource wirklich sehr viel machen.&lt;/p&gt;</description>
          <pubDate>Mon, 14 Jun 2010 00:00:00 GMT</pubDate>
          <guid>http://www.iteh.at/de/blog/2010/06/14/chef-von-opscode-und-der-power-von-ruby/</guid>
          <link>http://iteh.at/de/blog/2010/06/14/chef-von-opscode-und-der-power-von-ruby/</link>
        </item>
    
        <item>
          <title>Radiant das No Fluff just Stuff Rails CMS</title>
          <description>&lt;p&gt;&lt;a href=&quot;http://www.radiantcms.org/&quot;&gt;Radiant&lt;/a&gt; ist ein auf das wesentliche reduzierte, Open Source Content Management System für kleine Teams.&lt;/p&gt;
&lt;p&gt;Die aktuelle Version ist 0.9.1 Diese Version enthält ein leistungsfähiges Erweiterungssystem. System-Entwickler können Radiant einfach auf ihre spezifischen Bedürfnisse zuschneidern.&lt;/p&gt;
&lt;p&gt;Die Kernfunktionalität besteht aus:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Einer eleganten, schlanken Benutzeroberfläche&lt;/li&gt;
	&lt;li&gt;Flexiblen Layouts mit Templating, Snippets, Seiten Teilen, und einer eigenen Template Sprache&lt;/li&gt;
	&lt;li&gt;Einem First-Class-Erweiterungs / Plugin-System&lt;/li&gt;
	&lt;li&gt;Einfacher Benutzerverwaltung und Berechtigungen&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Weitere Funktionen &amp;#8230;&lt;/p&gt;&lt;h3&gt;Einfache Admin Oberfäche&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;http://radiantcms.org/&quot;&gt;Radiant&lt;/a&gt; ist von Grund auf so einfach wie möglich aufgebaut und verfügt über eine elegante Schnittstelle zur Administration, die sich rund um die drei Schlüsselkomponenten dreht: Seiten, Snippets und Layouts.&lt;/p&gt;
&lt;h3&gt;Seiten&lt;/h3&gt;
&lt;p&gt;Seiten enthalten den Kern der Inhalte und können mit Markdown, Textile oder &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; verfasst werden. Die einzelnen Seiten (Pages) werden aus Seitenteilen (Page Parts) wie zum Beispiel Body und Sidebar aufgebaut.&lt;/p&gt;
&lt;h3&gt;Snippets&lt;/h3&gt;
&lt;p&gt;Inhalte, die an mehreren Stellen verwendet werden, können in so genannten Snippets gespeichert werden. Snippets sind &lt;span class=&quot;caps&quot;&gt;PHP&lt;/span&gt; includes oder Rails Partials sehr ähnlich.&lt;/p&gt;
&lt;h3&gt;Layouts&lt;/h3&gt;
&lt;p&gt;Layouts enthalten in der Regel das &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;-Seiten Design. Layouts sind sehr flexibel und können die Seiten Teile beliebig einbinden. Beispielsweise kann ein Layout den Hauptteil und die Seitenleiste anzeigen, während ein anderes Layout (ein Drucklayout) nur den Hauptteil anzeigt.&lt;/p&gt;
&lt;h3&gt;Flexible Seiten-Struktur&lt;/h3&gt;
&lt;p&gt;Im Gegensatz zu vielen anderen Blogging-Engines ermöglicht &lt;a href=&quot;http://radiantcms.org/&quot;&gt;Radiant&lt;/a&gt; es, Seiten nach einer beliebigen Hierarchie zu ordnen. Ein Weblog in &lt;a href=&quot;http://radiantcms.org/&quot;&gt;Radiant&lt;/a&gt; kann so einfach sein wie eine Sammlung von Seiten unterhalb einer Seite in der Hierarchie.&lt;/p&gt;
&lt;h3&gt;Radius Template-Sprache&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;http://radiantcms.org/&quot;&gt;Radiant&lt;/a&gt; verfügt über eine spezielles Makro-Sprache (ähnlich zu &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;) die &lt;a href=&quot;http://radius.rubyforge.org/&quot;&gt;Radius&lt;/a&gt; genannt wird. &lt;a href=&quot;http://radius.rubyforge.org/&quot;&gt;Radius&lt;/a&gt; erleichtert es Inhalte von anderen Seiten einzubinden, über Unterseiten zu iterieren und Inhalte abhängig von Bedingungen anzuzeigen. Radius Tags können in Seiten, Snippets und Layouts verwendet werden.&lt;/p&gt;
&lt;h3&gt;Beliebige Textfilter&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;http://radiantcms.org/&quot;&gt;Radiant&lt;/a&gt; kommt mit Unterstützung für Markdown und Textile. &lt;a href=&quot;http://radiantcms.org/&quot;&gt;Radiant&lt;/a&gt; kann einfach von Entwicklern um Text-Filter für andere Markup-Sprache wie RDoc, BBCode oder Structured Text erweitert werden.&lt;/p&gt;
&lt;h3&gt;Intelligentes Page Caching&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;http://radiantcms.org/&quot;&gt;Radiant&lt;/a&gt; beinhaltet einen intelligenten Caching-Mechanismus, welcher in der Standard Einstellung Inhalte Minuten 5 zwischenspeichert. Dies gewährleistet, dass Inhalte immer aktuell sind und sorgt für eine optimale Leistung.&lt;/p&gt;
&lt;h3&gt;Ruby on Rails als Basis&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;http://radiantcms.org/&quot;&gt;Radiant&lt;/a&gt; wurde mit Ruby on Rails umgesetzt. Dies bedeutet, dass es für Entwickler einfach ist &lt;a href=&quot;http://radiantcms.org/&quot;&gt;Radiant&lt;/a&gt; zu erweitern da Rails eine weithin akzeptierte Webanwendungs Entwicklungsplattform ist.&lt;/p&gt;
&lt;h3&gt;Lizenziert unter der &lt;span class=&quot;caps&quot;&gt;MIT&lt;/span&gt; License&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;http://radiantcms.org/&quot;&gt;Radiant&lt;/a&gt; ist unter der &lt;span class=&quot;caps&quot;&gt;MIT&lt;/span&gt;-Lizenz freigegeben. Damit ist &lt;a href=&quot;http://radiantcms.org/&quot;&gt;Radiant&lt;/a&gt; frei für kommerzielle und non-profit Nutzung. Es bedeutet auch, dass &lt;a href=&quot;http://radiantcms.org/&quot;&gt;Radiant&lt;/a&gt; frei modifiziert und verteilt werden darf, solange der entsprechende Hinweise aus dem Quellcode nicht entfernt wird.&lt;/p&gt;
&lt;h3&gt;Weiterführende Links&lt;/h3&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.radiantcms.org/&quot;&gt;Radiant Homepage&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://wiki.radiantcms.org/Documentation&quot;&gt;Radiant Dokumentation&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://ext.radiantcms.org/extensions&quot;&gt;Radiant Extensions&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://github.com/search?q=radiant&quot;&gt;Radiant on Github&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
          <pubDate>Thu, 10 Jun 2010 00:00:00 GMT</pubDate>
          <guid>http://www.iteh.at/de/blog/2010/06/10/radiant-das-no-fluff-just-stuff-rails-cms/</guid>
          <link>http://iteh.at/de/blog/2010/06/10/radiant-das-no-fluff-just-stuff-rails-cms/</link>
        </item>
    
        <item>
          <title>Strings in Ruby</title>
          <description>&lt;p&gt;In den vorangegangenen Artikeln haben wir schon Strings verwendet. Es gibt zwei Arten von Strings in Ruby. Strings mit doppelten Anführungszeichen &lt;code&gt;&quot;&lt;/code&gt; und Strings in einfachen Anführungszeichen &lt;code&gt;'&lt;/code&gt;. Ruby verhält sich hier also wie die meisten anderen Sprachen. Der grosse Unterschied zwischen diesen beiden Varianten ist, wie Ruby den Inhalt interpretiert. Oder eben: Wie Ruby ihn eventuell &lt;em&gt;nicht&lt;/em&gt; interpretiert ;-)&lt;/p&gt;&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;this is a string&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;this is a string&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;this is another string&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;this is another string&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   6 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   7 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;we can calc: 2+2=&lt;span class=&quot;StringEmbeddedSource&quot;&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;StringConstant&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;Keyword&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;StringConstant&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   8 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;we can calc: 2+2=4&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   9 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  10 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;opps. wrong quotation for calc #{2+2}&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  11 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;opps. wrong quotation for calc &lt;span class=&quot;StringConstant&quot;&gt;\#&lt;/span&gt;{2+2}&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  12 &lt;/span&gt; 
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;Strings die in doppelte Anführungszeichen eingefasst sind werden in Ruby &lt;em&gt;interpoliert&lt;/em&gt; . Strings in einfachen Anführungszeichen werden so interpretiert wie sie dastehen, bis auf zwei Ausnahmen:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;code&gt;\’&lt;/code&gt;  =&amp;gt; um das einfache &lt;code&gt;‘&lt;/code&gt; zu escapen&lt;/li&gt;
	&lt;li&gt;&lt;code&gt;\\&lt;/code&gt; =&amp;gt; um das Escape Zeichen zu escapen&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;\&lt;/code&gt; ist eine sogenannte Escape Sequenz&lt;/p&gt;
&lt;p&gt;Da Ruby bei einfachen Anführungszeichen alle Zeichen so versteht wie sie da stehen wird auch die Berechnung bei angeführten &amp;#8220;wrong quotation&amp;#8221; Beispiel nicht ausgeführt.&lt;/p&gt;
&lt;h3&gt;Strings in doppelten Anführungsstrichen&lt;/h3&gt;
&lt;p&gt;Strings in doppelten Anführungsstrichen werden &lt;em&gt;ausgewertet&lt;/em&gt;. Das heisst alle im String enthaltenen Expressions werden durch ihr Ergebnis, ihren &lt;em&gt;Wert&lt;/em&gt; ersetzt. Diesen Vorgang nennt man &lt;strong&gt;Interpolation&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Weiters gibt es auch viel mehr Escape Sequenzen.&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;code&gt;\”&lt;/code&gt; Das Doppeltes Anführungszeichen&lt;/li&gt;
	&lt;li&gt;&lt;code&gt;\\&lt;/code&gt; Backslash&lt;/li&gt;
	&lt;li&gt;&lt;code&gt;\a&lt;/code&gt; Bell&lt;/li&gt;
	&lt;li&gt;&lt;code&gt;\b&lt;/code&gt; Backspace&lt;/li&gt;
	&lt;li&gt;&lt;code&gt;\r&lt;/code&gt; Wagenrücklauf&lt;/li&gt;
	&lt;li&gt;&lt;code&gt;\n&lt;/code&gt; Neu Zeile&lt;/li&gt;
	&lt;li&gt;&lt;code&gt;\s&lt;/code&gt; Leerzeichen&lt;/li&gt;
	&lt;li&gt;&lt;code&gt;\t&lt;/code&gt; Tabulator&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Einige Beispiele:&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; puts &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Hello&lt;span class=&quot;StringConstant&quot;&gt;\t&lt;/span&gt;&lt;span class=&quot;StringConstant&quot;&gt;\t&lt;/span&gt;world&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Hello&lt;/span&gt;           world 
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; puts &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Hello&lt;span class=&quot;StringConstant&quot;&gt;\b&lt;/span&gt;&lt;span class=&quot;StringConstant&quot;&gt;\b&lt;/span&gt;&lt;span class=&quot;StringConstant&quot;&gt;\b&lt;/span&gt;&lt;span class=&quot;StringConstant&quot;&gt;\b&lt;/span&gt;&lt;span class=&quot;StringConstant&quot;&gt;\b&lt;/span&gt;Goodbye world&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Goodbye&lt;/span&gt; world 
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   6 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; puts &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Hello&lt;span class=&quot;StringConstant&quot;&gt;\r&lt;/span&gt;Start over world&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   7 &lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Start&lt;/span&gt; over world 
&lt;span class=&quot;line-numbers&quot;&gt;   8 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   9 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; puts &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;1. Hello&lt;span class=&quot;StringConstant&quot;&gt;\n&lt;/span&gt;2. World&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  10 &lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;1&lt;/span&gt;. &lt;span class=&quot;Variable&quot;&gt;Hello&lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  11 &lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;2&lt;/span&gt;. &lt;span class=&quot;Variable&quot;&gt;World&lt;/span&gt; 
&lt;/pre&gt;&lt;/code&gt;&lt;h3&gt;String Interpolation&lt;/h3&gt;
&lt;p&gt;Die String Interpolation erlaubt das Ausführen von Ruby Code in Strings. Die Syntax dafür ist &lt;code&gt;#{expression}&lt;/code&gt;. Die &lt;code&gt;expression&lt;/code&gt; kann hier beliebiger Ruby Code sein. Hier ein paar einfache Beispiele:&lt;br /&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;1 + 2 = &lt;span class=&quot;StringEmbeddedSource&quot;&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;StringConstant&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;StringConstant&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;1 + 2 = 3&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;the meaning of life is &lt;span class=&quot;StringEmbeddedSource&quot;&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;StringConstant&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;StringConstant&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;ZeroDivisionError&lt;/span&gt;: divided by &lt;span class=&quot;Constant&quot;&gt;0&lt;/span&gt;         
&lt;span class=&quot;line-numbers&quot;&gt;   6 &lt;/span&gt; from (irb):&lt;span class=&quot;Constant&quot;&gt;75&lt;/span&gt;&lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;in&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;/&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;         
&lt;span class=&quot;line-numbers&quot;&gt;   7 &lt;/span&gt; from (irb):&lt;span class=&quot;Constant&quot;&gt;75&lt;/span&gt;         
&lt;span class=&quot;line-numbers&quot;&gt;   8 &lt;/span&gt; from :&lt;span class=&quot;Constant&quot;&gt;0&lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   9 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  10 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;ein string und &lt;span class=&quot;StringEmbeddedSource&quot;&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;noch &lt;span class=&quot;StringEmbeddedSource&quot;&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;e&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;i&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;n&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Entity&quot;&gt;join&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt; string&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;StringEmbeddedSource&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  11 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;ein string und noch ein string&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Das erste Beispiel zeigt, dass man in Strings einfach rechnen kann.&lt;/p&gt;
&lt;p&gt;Das zweite Beispiel veranschaulicht, dass hier besonders auf eine gute Fehlerbehandlung geachtet werden muss. Es sollten wirklich nur Expressions im String vorkommen, die auch ein String Ergebnis zurück liefern können. In diesem Beispiel versagt die Division durch &lt;code&gt;O&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Das dritte Beispiel zeigt einen etwas komplizierteren Ausdruck. Es wird hier zuerst aus einem &lt;code&gt;Array&lt;/code&gt; mit einem &lt;code&gt;join&lt;/code&gt; ein String gemacht. Zu diesem String wird dann &lt;code&gt;' string'&lt;/code&gt; dazu addiert.&lt;/p&gt;</description>
          <pubDate>Thu, 08 Apr 2010 00:00:00 GMT</pubDate>
          <guid>http://www.iteh.at/de/blog/2010/04/08/strings-in-ruby/</guid>
          <link>http://iteh.at/de/blog/2010/04/08/strings-in-ruby/</link>
        </item>
    
        <item>
          <title>Grundlegende Syntax der Sprache Ruby</title>
          <description>&lt;p&gt;Wie bei jeder Programmiersprache muss man sich auch bei Ruby mit der grundlegenden Syntax vertraut machen. Ruby hat eine saubere, einfache Syntax die nun anhand einiger Beispiele illustriert wird.&lt;/p&gt;&lt;p&gt;Der Basis Zeichencode von Ruby 1.8.7 basiert auf &lt;span class=&quot;caps&quot;&gt;ASCII&lt;/span&gt;. Grossklein Schreibung ist signifikant. &lt;code&gt;example&lt;/code&gt; oder &lt;code&gt;Example&lt;/code&gt; bedeuten unterschiedliche Sachen. Alle syntaktischen Strukturen in Ruby (ausgenommen Identifier oder Literale) können mit sogenannten Whitespace Zeichen oder Kommentaren angereichert werden. Die Whitespace Zeichen in Ruby sind: Leerzeichen (&lt;code&gt;\s&lt;/code&gt;), Tabulator (&lt;code&gt;\t&lt;/code&gt;), vertikaler Tabulator (&lt;code&gt;\v&lt;/code&gt;), Backspace, Zeilenumbruch (Carriage-Return, &lt;code&gt;\n&lt;/code&gt; oder &lt;code&gt;\r\n&lt;/code&gt;) und Seitenvorschub(formfeed,&lt;code&gt;\f&lt;/code&gt;). Der Zeilenumbruch wird nur als Whitespace interpretiert, wenn der Ausdruck die darauf folgende Zeile auch einschliesst.&lt;/p&gt;
&lt;p&gt;Folgende Wörter sind reserviert:&lt;/p&gt;
&lt;table&gt;
	&lt;tr&gt;
		&lt;td&gt;&lt;i&gt;&lt;span class=&quot;caps&quot;&gt;FILE&lt;/span&gt;&lt;/i&gt;  &lt;/td&gt;
		&lt;td&gt;and    &lt;/td&gt;
		&lt;td&gt;def       &lt;/td&gt;
		&lt;td&gt;end     &lt;/td&gt;
		&lt;td&gt;in      &lt;/td&gt;
		&lt;td&gt;or      &lt;/td&gt;
		&lt;td&gt;self   &lt;/td&gt;
		&lt;td&gt;unless &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;&lt;i&gt;&lt;span class=&quot;caps&quot;&gt;LINE&lt;/span&gt;&lt;/i&gt; &lt;/td&gt;
		&lt;td&gt; begin &lt;/td&gt;
		&lt;td&gt; defined? &lt;/td&gt;
		&lt;td&gt; ensure &lt;/td&gt;
		&lt;td&gt; module &lt;/td&gt;
		&lt;td&gt; redo   &lt;/td&gt;
		&lt;td&gt; super &lt;/td&gt;
		&lt;td&gt; until &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;&lt;span class=&quot;caps&quot;&gt;BEGIN&lt;/span&gt;   &lt;/td&gt;
		&lt;td&gt;  break&lt;/td&gt;
		&lt;td&gt;  do      &lt;/td&gt;
		&lt;td&gt;  false &lt;/td&gt;
		&lt;td&gt;  next  &lt;/td&gt;
		&lt;td&gt;  rescue&lt;/td&gt;
		&lt;td&gt;  then &lt;/td&gt;
		&lt;td&gt;  when &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;&lt;span class=&quot;caps&quot;&gt;END&lt;/span&gt;      &lt;/td&gt;
		&lt;td&gt; case  &lt;/td&gt;
		&lt;td&gt; else     &lt;/td&gt;
		&lt;td&gt; for    &lt;/td&gt;
		&lt;td&gt; nil    &lt;/td&gt;
		&lt;td&gt; retry  &lt;/td&gt;
		&lt;td&gt; true  &lt;/td&gt;
		&lt;td&gt; while &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;alias    &lt;/td&gt;
		&lt;td&gt; class &lt;/td&gt;
		&lt;td&gt; elsif    &lt;/td&gt;
		&lt;td&gt; if     &lt;/td&gt;
		&lt;td&gt; not    &lt;/td&gt;
		&lt;td&gt; return &lt;/td&gt;
		&lt;td&gt; undef &lt;/td&gt;
		&lt;td&gt; yield &lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;Ein einfaches Beispiel das eine kurze Begrüssung zurückgibt:&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;say_hello&lt;/span&gt;(&lt;span class=&quot;Variable&quot;&gt;name&lt;/span&gt;) 
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; &lt;span class=&quot;Comment&quot;&gt;  &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; Say Hello followed by name&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt;   result &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Hello, &lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;+&lt;/span&gt; name 
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;return&lt;/span&gt; result
&lt;span class=&quot;line-numbers&quot;&gt;   6 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   7 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   8 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   9 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;say_hello&lt;/span&gt;(&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Ms. Doe&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)
&lt;span class=&quot;line-numbers&quot;&gt;  10 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Hello, Ms. Doe&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  11 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; puts &lt;span class=&quot;Entity&quot;&gt;say_hello&lt;/span&gt;(&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Mrs. Doe&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)
&lt;span class=&quot;line-numbers&quot;&gt;  12 &lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Hello&lt;/span&gt;, &lt;span class=&quot;Variable&quot;&gt;Mrs&lt;/span&gt;. &lt;span class=&quot;Variable&quot;&gt;Doe&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  13 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;Wir haben hier eine einfache Methode definiert, die einen Grusstext gefolgt vom übergebenen Text zurück gibt. Die Methode wird mit dem Keyword &lt;code&gt;def&lt;/code&gt; eingeleitet, gefolgt vom Methoden Namen &lt;code&gt;say_hello&lt;/code&gt; und den Parametern in Runden Klammern hier (&lt;code&gt;name&lt;/code&gt;). Der Methodenkörper wird mit dem Keyword &lt;code&gt;end&lt;/code&gt; abgeschlossen. Strichpunkte am Ende einer Zeile sind nicht notwendig, wenn jedes Statement in einer eigenen Zeile steht. Die Einrückung ist nicht signifikant, sollte aber zwei Zeichen gross sein.&lt;/p&gt;
&lt;p&gt;Die erste Zeile in der Methode ist ein Kommentar. Dieser wird mit einem &lt;code&gt;#&lt;/code&gt; eingeleitet. In der nächsten Zeile wird die Zeichenkette &lt;code&gt;&quot;Hello, &quot;&lt;/code&gt; mit dem Wert des Paramters &lt;code&gt;name&lt;/code&gt; verbunden und der lokalen Variable &lt;code&gt;result&lt;/code&gt; zugewiesen. Schlussendlich wird &lt;code&gt;result&lt;/code&gt; an den Aufrufer returniert. Besonders zu beachten ist hier auch, dass die lokale Variable nicht erst definiert werden muss. Sie beginn einfach mit der ersten Zuweisung an zu &lt;em&gt;leben&lt;/em&gt;.&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;say_hello&lt;/span&gt;(&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Ms. Doe&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;gibt also den Wert &lt;code&gt;&quot;Hello, Ms. Doe&quot;&lt;/code&gt; zurück. Bei der nächsten Zeile wird der Methode &lt;code&gt;puts&lt;/code&gt; der Rückgabewert des Methodenaufrufes von  &lt;code&gt;say_hello(&quot;Mrs. Doe&quot;)&lt;/code&gt; übergeben. &lt;code&gt;puts&lt;/code&gt; gibt diesen Wert einfach auf der Konsole aus. Bei dieser Zeile sieht man auch, dass die Runden Klammern bei einem Methodenaufruf optional sind.&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; puts &lt;span class=&quot;Entity&quot;&gt;say_hello&lt;/span&gt;(&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Mrs. Doe&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Hello&lt;/span&gt;, &lt;span class=&quot;Variable&quot;&gt;Mrs&lt;/span&gt;. &lt;span class=&quot;Variable&quot;&gt;Doe&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;puts&lt;/span&gt;(&lt;span class=&quot;Entity&quot;&gt;say_hello&lt;/span&gt;(&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Mrs. Doe&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;))
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Hello&lt;/span&gt;, &lt;span class=&quot;Variable&quot;&gt;Mrs&lt;/span&gt;. &lt;span class=&quot;Variable&quot;&gt;Doe&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   6 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   7 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; puts say_hello &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Mrs. Doe&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   8 &lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Hello&lt;/span&gt;, &lt;span class=&quot;Variable&quot;&gt;Mrs&lt;/span&gt;. &lt;span class=&quot;Variable&quot;&gt;Doe&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   9 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;Diese drei Aufrufe sind also gleichwertig. Hier sollte man sich einen vernünftigen Mittelweg angewöhnen. Bei einfachen Aufrufen kann man getrost auf die Klammern verzichten. Kompliziertere Aufrufe sollten aber für eine bessere Lesbarkeit geklammert werden (Ihre Kollegen werden Ihnen das danken :). Diese Regel für Klammern gilt selbstverständlich auch bei den Methodendefinitionen. So kann man die Methode &lt;code&gt;say_hello&lt;/code&gt; auch wie folgt definieren:&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;say_hello&lt;/span&gt; name 
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt;   &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Hello, &lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;+&lt;/span&gt; name 
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; say_hello &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Adam&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   6 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Hello, Adam&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;In diesem Beispiel kann man noch eine weitere Besonderheit von Ruby sehen: Der letzte berechnete Wert eines Blocks ist immer automatisch der Rückgabewert des Blocks. Man kann also auf das &lt;code&gt;return&lt;/code&gt; Statement verzichten, wenn möchte. &lt;strong&gt;Aber Achtung!&lt;/strong&gt; Es ist wirklich darauf zu achten, dass es der &lt;strong&gt;letzte&lt;/strong&gt; Wert ist:&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;say_hello&lt;/span&gt; name 
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt;   puts &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Hello, &lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;+&lt;/span&gt; name 
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; puts &lt;span class=&quot;Entity&quot;&gt;say_hello&lt;/span&gt;(&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Adam&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)
&lt;span class=&quot;line-numbers&quot;&gt;   6 &lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Hello&lt;/span&gt;, &lt;span class=&quot;Variable&quot;&gt;Adam&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   7 &lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   8 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;Hier wird zwar der String &lt;code&gt;&quot;Hello, Adam&quot;&lt;/code&gt; &lt;strong&gt;in&lt;/strong&gt; der Methode ausgegeben, das &lt;code&gt;puts&lt;/code&gt; bekommt aber den Rückgabewert des Statements &lt;code&gt;puts &quot;Hello, &quot; + name&lt;/code&gt; und der ist &lt;code&gt;nil&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Man kann die Methode natürlich auch in nur einer Zeile definieren:&lt;br /&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;say_hello&lt;/span&gt; name; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Hello, &lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;+&lt;/span&gt; name ;&lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;puts&lt;/span&gt;(&lt;span class=&quot;Entity&quot;&gt;say_hello&lt;/span&gt;(&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Eva&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;))
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Hello&lt;/span&gt;, &lt;span class=&quot;Variable&quot;&gt;Eva&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
&lt;/pre&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Wie man aber unschwer erkennen kann ist das alles andere als lesbar und sollte nur in wirklichen Ausnahmefällen gemacht werden!&lt;/p&gt;
&lt;h3&gt;Ruby Namen&lt;/h3&gt;
&lt;p&gt;Im vorangehenden Beispiel haben wir schon ein paar Regeln für Namen in Ruby angewendet. Hier nun eine kleine Zusammenfassung dieser Regeln. Manche der Regeln für Namen sind für Teile der Sprache die wir noch nicht kennengelernt haben, dazu kommen wir noch in späteren Blog Artikeln.&lt;/p&gt;
&lt;p&gt;In Ruby entscheidet das erste Zeichen eines Namens wie er verwendet/interpretiert wird. Manche dieser Regeln sind Konventionen an die man sich halten soll, andere wiederum sind zwingend vorgeschrieben.&lt;/p&gt;
&lt;p&gt;Namen in Ruby bestehen aus Buchstaben &lt;code&gt;a-z&lt;/code&gt; &lt;code&gt;A-Z&lt;/code&gt; Zahlen &lt;code&gt;0-9&lt;/code&gt; und dem Unterstrich. Lokale Variablen, Methoden Namen oder Methoden Parameter können mit einem Buchstaben oder einem Unterstrich anfangen, nicht aber mit einer Zahl. Der Buchstabe sollte hier ein Kleinbuchstabe sein. Man kann zum Beispiel Methoden auch mit einem Grossbuchstaben beginnen lassen, die Konvention sagt aber ein Methodenname sollte ausschliesslich Kleinbuchstaben und gegebenenfalls Unterstriche beinhalten.&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;SayHello&lt;/span&gt;(&lt;span class=&quot;Variable&quot;&gt;name&lt;/span&gt;)
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt;   puts &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Hello, &lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;+&lt;/span&gt; name 
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;SayHello&lt;/span&gt;(&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Adam&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)
&lt;span class=&quot;line-numbers&quot;&gt;   6 &lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Hello&lt;/span&gt;, &lt;span class=&quot;Variable&quot;&gt;Adam&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   7 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   8 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   9 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;_sayHello&lt;/span&gt;(&lt;span class=&quot;Variable&quot;&gt;name&lt;/span&gt;)
&lt;span class=&quot;line-numbers&quot;&gt;  10 &lt;/span&gt;   puts &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Hello, &lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;+&lt;/span&gt; name 
&lt;span class=&quot;line-numbers&quot;&gt;  11 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  12 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  13 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; _&lt;span class=&quot;Entity&quot;&gt;sayHello&lt;/span&gt;(&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Adam&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)
&lt;span class=&quot;line-numbers&quot;&gt;  14 &lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Hello&lt;/span&gt;, &lt;span class=&quot;Variable&quot;&gt;Adam&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  15 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  16 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  17 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;hello23&lt;/span&gt;(&lt;span class=&quot;Variable&quot;&gt;number&lt;/span&gt;)
&lt;span class=&quot;line-numbers&quot;&gt;  18 &lt;/span&gt;   &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Hello Number &lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;+&lt;/span&gt; number
&lt;span class=&quot;line-numbers&quot;&gt;  19 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  20 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  21 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; _my_var &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;hello23&lt;/span&gt;(&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;24&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)
&lt;span class=&quot;line-numbers&quot;&gt;  22 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Hello Number 24&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  23 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;MyVar&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;hello23&lt;/span&gt;(&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;42&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)
&lt;span class=&quot;line-numbers&quot;&gt;  24 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; puts _my_var
&lt;span class=&quot;line-numbers&quot;&gt;  25 &lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Hello&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Number&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;24&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  26 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  27 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; puts &lt;span class=&quot;Variable&quot;&gt;MyVar&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  28 &lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Hello&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Number&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;42&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  29 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  30 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  31 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;MyVar&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;hello23&lt;/span&gt;(&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;666&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)
&lt;span class=&quot;line-numbers&quot;&gt;  32 &lt;/span&gt; (irb):&lt;span class=&quot;Constant&quot;&gt;27&lt;/span&gt;: warning: already initialized constant &lt;span class=&quot;Variable&quot;&gt;MyVar&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  33 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Hello Number 666&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  34 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; puts &lt;span class=&quot;Variable&quot;&gt;MyVar&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  35 &lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Hello&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Number&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;666&lt;/span&gt;
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;In diesen Beispielen sieht was mit Konvention gemeint ist: Es würde zumindest bis auf ein Beispiel trotzdem ohne Probleme funktionieren. Einzig das letzte Beispiel mit &lt;code&gt;MyVar&lt;/code&gt; zeigt eine weitere Regel auf: Konstanten beginnen in Ruby mit einem Grossbuchstaben. Und was man hier noch zum ersten mal richtig spüren kann: In Ruby sind sehr viele Sachen trotzdem erlaubt, der Programmierer wird als mündig erklärt und man kann auch einer Konstanten (allerdings mit einer Warnung einen neuen Wert zuweisen. Das kann man auch unterbinden, dazu später mehr)&lt;/p&gt;
&lt;p&gt;Weiters setzt man mit einem Prefix Zeichen den sogenannten Scope, den Sichtbarkeitsbereich, einer Variablen. Eine Global gültige Variable beginnt mit einem Dollar Zeichen (&lt;code&gt;$&lt;/code&gt;), eine Instanz Variable mit einem &amp;#8220;at&amp;#8221; Zeichen (@) und Klassen Variablen mit einem doppelten &amp;#8220;at&amp;#8221; Zeichen (@@)&lt;/p&gt;
&lt;p&gt;Als Konventionen gelten weiters: Methoden- oder Variablennamen die aus mehreren Wörtern zusammengesetzt sind werden mit Kleinbuchstaben geschrieben, wobei die Wörter durch Unterstriche getrennt werden. Klassen Namen beginnen mit einem Grossbuchstaben und werden ohne Unterstriche geschrieben, wobei jedes einzelne Wort mit einem Grossbuchstaben beginnt.&lt;/p&gt;
&lt;p&gt;Noch eine Tabelle zur Illustration:&lt;/p&gt;
&lt;table&gt;
	&lt;tr&gt;
		&lt;th colspan=&quot;4&quot;&gt;Variablen &lt;/th&gt;
		&lt;th&gt;Konstanten und&lt;/th&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;th&gt;Lokale &lt;/th&gt;
		&lt;th&gt;Globale &lt;/th&gt;
		&lt;th&gt;Instanz &lt;/th&gt;
		&lt;th&gt;Klassen &lt;/th&gt;
		&lt;th&gt;Klassen-Namen&lt;/th&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;name &lt;/td&gt;
		&lt;td&gt;$debug &lt;/td&gt;
		&lt;td&gt;@name &lt;/td&gt;
		&lt;td&gt;@@sum &lt;/td&gt;
		&lt;td&gt;PI&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;x_value &lt;/td&gt;
		&lt;td&gt;$_ &lt;/td&gt;
		&lt;td&gt;@V &lt;/td&gt;
		&lt;td&gt;@@B &lt;/td&gt;
		&lt;td&gt;String&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;myVar &lt;/td&gt;
		&lt;td&gt;$&lt;span class=&quot;caps&quot;&gt;CUSTOMER&lt;/span&gt; &lt;/td&gt;
		&lt;td&gt;@line_1 &lt;/td&gt;
		&lt;td&gt;@@max &lt;/td&gt;
		&lt;td&gt;MinPerHour&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;thx1138 &lt;/td&gt;
		&lt;td&gt;$plan9 &lt;/td&gt;
		&lt;td&gt;@_ &lt;/td&gt;
		&lt;td&gt;@@x_pos &lt;/td&gt;
		&lt;td&gt;MyClass&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;_42 &lt;/td&gt;
		&lt;td&gt;$Global &lt;/td&gt;
		&lt;td&gt;@point2 &lt;/td&gt;
		&lt;td&gt;@@MAXX &lt;/td&gt;
		&lt;td&gt;Music_Video&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;Method können zusätzlich noch mit einem der Zeichen &lt;code&gt;?&lt;/code&gt;, &lt;code&gt;!&lt;/code&gt; oder &lt;code&gt;=&lt;/code&gt; beendet werden.&lt;/p&gt;</description>
          <pubDate>Wed, 07 Apr 2010 00:00:00 GMT</pubDate>
          <guid>http://www.iteh.at/de/blog/2010/04/07/grundlegende-syntax-der-sprache-ruby/</guid>
          <link>http://iteh.at/de/blog/2010/04/07/grundlegende-syntax-der-sprache-ruby/</link>
        </item>
    
        <item>
          <title>Ruby Programmier Paradigmen</title>
          <description>&lt;p&gt;Im Kern ist Ruby eine objektorientierte Sprache. Alles ist ein Objekt. Yukihiro „Matz“ Matsumoto hat seine Sprache allerdings ähnlich wie C++ als „Multiparadigmen-Sprache“ entworfen. Das ermöglicht Software Entwicklern unter anderem funktionale (es gibt anonyme Funktionen, Closures und Continuations; Alle Ausdrücke haben einen Wert und Funktionen returnieren die letzte Auswertung), prozedurale (Variablen und Funktionen die ausserhalb einer Klasse definiert werden sind automatisch Teil des Root Objektes) als auch objektorientierte (alles ist ein Objekt) &lt;a href=&quot;http://de.wikipedia.org/wiki/Programmierparadigma&quot;&gt;Programmierparadigmen&lt;/a&gt; einzusetzen. Weiters unterstützt Ruby auch Introspection, Reflection und Metaprogramming. Im Folgenden werden Beispiele der am weitesten verbreiteten Paradigmen gezeigt:&lt;/p&gt;&lt;h3&gt;Objektorientierte Programmierung&lt;/h3&gt;
&lt;p&gt;In der Sprache Ruby ist alles ein Objekt: Jeder Datentyp ist ein Objekt. Auch Klassen und solche, die in vielen anderen Sprachen als primitive Datentypen gelten, wie etwa Integer, Booleans oder &lt;em&gt;nil&lt;/em&gt;. Jede Funktion ist eine Methode. Alle Variablen sind Referenzen zu Objekten und nicht selbst Objekte.&lt;/p&gt;
&lt;h4&gt;Klassenbasierte Objektorientierung&lt;/h4&gt;
&lt;p&gt;Eine Klasse kann wie folgt definiert werden:&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;JEntityNameType&quot;&gt;Bird&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;sing&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt;    puts &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;singing&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   6 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   7 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;Bird&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;class&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   8 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Variable&quot;&gt;Class&lt;/span&gt;
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;Klassen werden mit dem Keyword Class definiert. Methoden mit dem Keyword def. Hier sieht man auch, dass die Klasse Bird selbst eine Objekt vom Typ Class ist.&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; my_bird &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;Bird&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;new&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Comment&quot;&gt;&lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt;&amp;lt;Bird:0x1016d0360&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; my_bird.&lt;span class=&quot;Entity&quot;&gt;class&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Variable&quot;&gt;Bird&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; my_bird.&lt;span class=&quot;Entity&quot;&gt;class&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;superclass&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   6 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Variable&quot;&gt;Object&lt;/span&gt;
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;Ein Objekt wird mit der Methode .new erzeugt. Die Ausgabe zeigt dass die Variable my_bird auf ein Objekt der Klasse Bird verweist und automatisch ein Kind von Object ist.&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; my_bird.&lt;span class=&quot;Entity&quot;&gt;sing&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt; singing
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;Eine Methode wird einfach &lt;em&gt;auf&lt;/em&gt; dem Objekt aufgerufen.&lt;/p&gt;
&lt;p&gt;Eine Ableitung wird so definiert:&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;JEntityNameType&quot;&gt;FlyingBird&lt;span class=&quot;EntityInheritedClass&quot;&gt; &lt;span class=&quot;EntityInheritedClass&quot;&gt;&amp;lt;&lt;/span&gt; Bird&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;fly&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt;     puts &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;flying&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   6 &lt;/span&gt;  
&lt;span class=&quot;line-numbers&quot;&gt;   7 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; my_flying_bird &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;FlyingBird&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;new&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   8 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Comment&quot;&gt;&lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt;&amp;lt;FlyingBird:0x1016bbd48&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   9 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; my_flying_bird.&lt;span class=&quot;Entity&quot;&gt;fly&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  10 &lt;/span&gt; flying
&lt;span class=&quot;line-numbers&quot;&gt;  11 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  12 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; my_flying_bird.&lt;span class=&quot;Entity&quot;&gt;sing&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  13 &lt;/span&gt; singing
&lt;span class=&quot;line-numbers&quot;&gt;  14 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  15 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; my_flying_bird.&lt;span class=&quot;Entity&quot;&gt;class&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  16 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Variable&quot;&gt;FlyingBird&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  17 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; my_flying_bird.&lt;span class=&quot;Entity&quot;&gt;class&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;superclass&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  18 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Variable&quot;&gt;Bird&lt;/span&gt;
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;my_flying_bird ist also ein Kind von Bird und Bird ist ein Kind von Object. FlyingBird erbt alle Methoden der Klasse Bird (unter anderem auch sing). Zusätzlich wird für FlyingBird noch die Methode fly definiert.&lt;/p&gt;
&lt;h4&gt;Prototypenbasierte Objektorientierung&lt;/h4&gt;
&lt;p&gt;Ruby bietet auch die von JavaScript oder Io bekannte prototypenbasierte Objektorientierung.&lt;/p&gt;
&lt;p&gt;Das obige Beispiel mit Prototypen realisiert:&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;?&amp;gt;&lt;/span&gt; my_bird &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;Object&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;new&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Comment&quot;&gt;&lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt;&amp;lt;Object:0x101662c48&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;my_bird.sing&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;   puts &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;singing&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   6 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   7 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  
&lt;span class=&quot;line-numbers&quot;&gt;   8 &lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;?&amp;gt;&lt;/span&gt; my_bird.&lt;span class=&quot;Entity&quot;&gt;sing&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   9 &lt;/span&gt; singing
&lt;span class=&quot;line-numbers&quot;&gt;  10 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  11 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  
&lt;span class=&quot;line-numbers&quot;&gt;  12 &lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;?&amp;gt;&lt;/span&gt; my_flying_bird &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; my_bird.&lt;span class=&quot;Entity&quot;&gt;clone&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  13 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Comment&quot;&gt;&lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt;&amp;lt;Object:0x101656dd0&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  14 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;my_flying_bird.fly&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  15 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;   puts &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;flying&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  16 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  17 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  18 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  
&lt;span class=&quot;line-numbers&quot;&gt;  19 &lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;?&amp;gt;&lt;/span&gt; my_flying_bird.&lt;span class=&quot;Entity&quot;&gt;sing&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  20 &lt;/span&gt; singing
&lt;span class=&quot;line-numbers&quot;&gt;  21 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  22 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; my_flying_bird.&lt;span class=&quot;Entity&quot;&gt;fly&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  23 &lt;/span&gt; flying
&lt;span class=&quot;line-numbers&quot;&gt;  24 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
&lt;/pre&gt;&lt;/code&gt;&lt;h4&gt;Objektorientierung mit Mixins&lt;/h4&gt;
&lt;p&gt;Ruby bietet keine Mehrfachvererbung. Das heisst man kann in Ruby nicht von mehr als einer Klasse erben. Das stellt aber keine Einschränkung dar, da mit Modulen und Mixins ein eigenens Konzept existiert, um Implementierungen allgemein für Klassen zur Verfügung zu stellen.&lt;/p&gt;
&lt;p&gt;In Ruby sind Mixins Module, die in andere Objekte eingebunden werden. Hier eine Implementierung des obigen Beispiels mit Modulen und Mixins:&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;JEntityNameType&quot;&gt;Communication&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;sing&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt;     puts &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;singing&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   6 &lt;/span&gt;  
&lt;span class=&quot;line-numbers&quot;&gt;   7 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;JEntityNameType&quot;&gt;Movement&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   8 &lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;fly&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   9 &lt;/span&gt;     puts &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;flying&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  10 &lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  11 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  12 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  13 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;JEntityNameType&quot;&gt;Bird&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  14 &lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Communication&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  15 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  16 &lt;/span&gt;  
&lt;span class=&quot;line-numbers&quot;&gt;  17 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;JEntityNameType&quot;&gt;FlyingBird&lt;span class=&quot;EntityInheritedClass&quot;&gt; &lt;span class=&quot;EntityInheritedClass&quot;&gt;&amp;lt;&lt;/span&gt; Bird&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  18 &lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Movement&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  19 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  20 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  21 &lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;?&amp;gt;&lt;/span&gt; my_bird &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;Bird&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;new&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  22 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Comment&quot;&gt;&lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt;&amp;lt;Bird:0x10162c418&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  23 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; my_flying_bird &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;FlyingBird&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;new&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  24 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Comment&quot;&gt;&lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt;&amp;lt;FlyingBird:0x101628f98&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  25 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  26 &lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;?&amp;gt;&lt;/span&gt; my_bird.&lt;span class=&quot;Entity&quot;&gt;sing&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  27 &lt;/span&gt; singing
&lt;span class=&quot;line-numbers&quot;&gt;  28 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  29 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  30 &lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;?&amp;gt;&lt;/span&gt; my_flying_bird.&lt;span class=&quot;Entity&quot;&gt;sing&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  31 &lt;/span&gt; singing
&lt;span class=&quot;line-numbers&quot;&gt;  32 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  33 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; my_flying_bird.&lt;span class=&quot;Entity&quot;&gt;fly&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  34 &lt;/span&gt; flying
&lt;span class=&quot;line-numbers&quot;&gt;  35 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;Auch die protoypische Variante lässt sich mit Mixins und Modulen umsetzen&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; my_flying_bird &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;Object&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;new&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt; my_flying_bird.&lt;span class=&quot;Entity&quot;&gt;extend&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Communication&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; my_flying_bird.&lt;span class=&quot;Entity&quot;&gt;extend&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Movement&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;?&amp;gt;&lt;/span&gt; my_flying_bird.&lt;span class=&quot;Entity&quot;&gt;sing&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   6 &lt;/span&gt; singing
&lt;span class=&quot;line-numbers&quot;&gt;   7 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   8 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; my_flying_bird.&lt;span class=&quot;Entity&quot;&gt;fly&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   9 &lt;/span&gt; flying
&lt;span class=&quot;line-numbers&quot;&gt;  10 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
&lt;/pre&gt;&lt;/code&gt;&lt;h3&gt;Prozedurale Programmierung&lt;/h3&gt;
&lt;p&gt;Auch die Prozedurale Syntax wird von Ruby unterstützt. Allerdings muss man beachten, dass alle Methoden Definitionen, die ausserhalb einer Klasse vorgenommen werden, automatisch Methoden der Klasse Object &amp;#8211; der Mutter aller Objekte &amp;#8211; werden. Das hat zur Folge, dass diese Methoden auch in allen anderen Objekten und Klassen sichtbar sind (und schlimmstenfalls eine bestehende Methode der Klasse Object überschreiben!)&lt;/p&gt;
&lt;p&gt;Das einfachste Hello World Programm kann somit als:&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;hello_world&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt;   puts &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Hello World!&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;?&amp;gt;&lt;/span&gt; hello_world
&lt;span class=&quot;line-numbers&quot;&gt;   6 &lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Hello&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;World&lt;/span&gt;!
&lt;/pre&gt;&lt;/code&gt;
&lt;p&gt;definiert werden.&lt;/p&gt;
&lt;p&gt;Die Konsequenz kann wie folgt veranschaulicht werden:&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;JEntityNameType&quot;&gt;Dummy&lt;/span&gt;; &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; dummy &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;Dummy&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;new&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;Comment&quot;&gt;&lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt;&amp;lt;Dummy:0x1015e6d00&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; dummy.&lt;span class=&quot;Entity&quot;&gt;hello_world&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Hello&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;World&lt;/span&gt;!
&lt;span class=&quot;line-numbers&quot;&gt;   6 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; dummy.&lt;span class=&quot;Entity&quot;&gt;to_s&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   7 &lt;/span&gt; =&amp;gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;#&amp;lt;Dummy:0x1015e6d00&amp;gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   8 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;   9 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;to_s&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  10 &lt;/span&gt;   &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;my to_s&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  11 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  12 &lt;/span&gt; 
&lt;span class=&quot;line-numbers&quot;&gt;  13 &lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; dummy.&lt;span class=&quot;Entity&quot;&gt;to_s&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;  14 &lt;/span&gt; my to_s
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;Da &lt;b&gt;jede&lt;/b&gt; Methode, die &lt;b&gt;nicht&lt;/b&gt; im Kontext einer Klasse oder eines Objektes definiert wird automatisch Teil der Basisklasse Object wird, kann es einem schnell passieren unerwünschte Seiteneffekte zu erzielen.&lt;/p&gt;
&lt;h3&gt;Funktionale Programmierung&lt;/h3&gt;
&lt;p&gt;In Ruby hat jeder Ausdruck einen Wert. Das kann dafür genutzt werden Probleme funktional zu lösen:&lt;/p&gt;
&lt;p&gt;Das folgendende Beispiel zeigt ein case-Konstrukt, das je nach Wert der Variable option einen anderen Wert zurück liefert.&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; option &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;array&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt; result &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;case&lt;/span&gt; option
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt;           &lt;span class=&quot;Keyword&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;number&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;   &lt;span class=&quot;Keyword&quot;&gt;then&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   4 &lt;/span&gt;           &lt;span class=&quot;Keyword&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;string&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;  &lt;span class=&quot;Keyword&quot;&gt;then&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Got a String&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   5 &lt;/span&gt;           &lt;span class=&quot;Keyword&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;array&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;then&lt;/span&gt; [&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;I&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;am&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;a&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Array&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;]
&lt;span class=&quot;line-numbers&quot;&gt;   6 &lt;/span&gt;           &lt;span class=&quot;Keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;raise&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;unknown option&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   7 &lt;/span&gt;         &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;line-numbers&quot;&gt;   8 &lt;/span&gt; =&amp;gt; [&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;I&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;am&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;a&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;Array&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;]        
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;In Ruby kann man auch Lambda Konstrukte definieren. Mit einem Lambda-Konstrukt kann man einen Codeblock in einer Funktionsvariablen speichern.&lt;/p&gt;
&lt;code lines=&quot;table&quot; lang=&quot;ruby&quot;&gt;&lt;pre class=&quot;sunburst&quot;&gt;&lt;span class=&quot;line-numbers&quot;&gt;   1 &lt;/span&gt; print_function &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; lambda { |&lt;span class=&quot;Variable&quot;&gt;item&lt;/span&gt;| print item &lt;span class=&quot;Keyword&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;1&lt;/span&gt; }
&lt;span class=&quot;line-numbers&quot;&gt;   2 &lt;/span&gt; [&lt;span class=&quot;Constant&quot;&gt;1&lt;/span&gt;,&lt;span class=&quot;Constant&quot;&gt;2&lt;/span&gt;,&lt;span class=&quot;Constant&quot;&gt;3&lt;/span&gt;].&lt;span class=&quot;Entity&quot;&gt;each&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;amp;&lt;/span&gt;print_function
&lt;span class=&quot;line-numbers&quot;&gt;   3 &lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;234&lt;/span&gt;=&amp;gt; [&lt;span class=&quot;Constant&quot;&gt;1&lt;/span&gt;, &lt;span class=&quot;Constant&quot;&gt;2&lt;/span&gt;, &lt;span class=&quot;Constant&quot;&gt;3&lt;/span&gt;]
&lt;/pre&gt;&lt;/code&gt;</description>
          <pubDate>Tue, 06 Apr 2010 00:00:00 GMT</pubDate>
          <guid>http://www.iteh.at/de/blog/2010/04/06/ruby-programmier-paradigmen/</guid>
          <link>http://iteh.at/de/blog/2010/04/06/ruby-programmier-paradigmen/</link>
        </item>
    
        <item>
          <title>Die Programmiersprache Ruby - Einleitung</title>
          <description>&lt;p&gt;Die Geburtsstunde der Sprache &lt;a href=&quot;http://www.ruby-lang.org&quot;&gt;Ruby&lt;/a&gt; war der 24. Februar 1993. Der Erfinder von &lt;a href=&quot;http://www.ruby-lang.org&quot;&gt;Ruby&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Yukihiro_Matsumoto&quot;&gt;Yukihiro Matsumoto&lt;/a&gt; hatte das Ziel eine neue Sprache zu entwickeln, die sowohl die Vorzüge funktionaler als auch imperativer Programmiersprachen in sich vereint. In den Worten von Matsumoto: &lt;em&gt;&amp;#8220;I wanted a scripting language that was more powerful than Perl, and more object-oriented than Python. That&amp;#8217;s why I decided to design my own language&amp;#8221;&lt;/em&gt;. Der Weblog von &lt;a href=&quot;http://translate.google.com/translate?u=http%3A%2F%2Fwww.rubyist.net%2F~matz%2F&amp;amp;langpair=ja|en&amp;amp;hl=en&amp;amp;ie=UTF-8&amp;amp;oe=UTF-8&amp;amp;prev=%2Flanguage_tools&quot;&gt;Matz in English&lt;/a&gt;&lt;/p&gt;&lt;h3&gt;Die erste Veröffentlichung&lt;/h3&gt;
&lt;p&gt;Die erste Version von Ruby 0.95 wurde in einer Japanischen Newsgroup am 21. Dezember 1995 veröffentlicht und verfügte schon über die meisten der jetzt so populären Sprachen Features wie &lt;a href=&quot;http://en.wikipedia.org/wiki/Object_oriented&quot;&gt;objekt-orientiertes Design&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Class_(computer_science)&quot;&gt;Klassen&lt;/a&gt; mit Vererbung, &lt;a href=&quot;http://en.wikipedia.org/wiki/Mixin&quot;&gt;Mixins&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Iterator&quot;&gt;Iteratoren&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Closure_(computer_science)&quot;&gt;Closures&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Exception_handling&quot;&gt;Exception Handling&lt;/a&gt;, und &lt;a href=&quot;http://en.wikipedia.org/wiki/Garbage_collection_(computer_science)&quot;&gt;Garbage Collection&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Ruby, die Sprache&lt;/h3&gt;
&lt;p&gt;Die Sprache Ruby wurde hautsächlich durch die Sprachen Perl, Smalltalk, Eiffel und Lisp beeinflusst. Sie kombiniert eine Perl ähnliche Syntax mit Sprachfeatures aus der Smalltalk Welt. Ruby ist eine moderne, interpretierte, objektorientierte und vielseitige höhere Programmiersprache.&lt;/p&gt;
&lt;p&gt;Ruby unterstützt viele Programmierparadigmen wie zum Beispiel Prozedurale, Objektorierte und Funktionale Programmierung sowie Nebenläufigkeit). Die Sprache bietet &lt;a href=&quot;http://de.wikipedia.org/wiki/Dynamische_Typisierung&quot;&gt;dynamische Typisierung&lt;/a&gt;, &lt;a href=&quot;http://de.wikipedia.org/wiki/Reflexion_(Programmierung)&quot;&gt;Reflexion&lt;/a&gt; und automatische Speicherverwaltung.&lt;/p&gt;
&lt;p&gt;Die Standard Implementierung der Sprache Ruby in der Version 1.8.7 ist in C geschrieben. Im Moment gibt es keine Sprachspezifikation was diese Implementierung zur Referenz macht. Im Moment (2010) gibt es eine ganze Reihe alternativer Implementierungen der Sprache in unterschiedlichem Fertigstellungsgrad. Namentlich: &lt;span class=&quot;caps&quot;&gt;YARV&lt;/span&gt;, JRuby, Rubinius, IronRuby, MacRuby und HotRuby.&lt;/p&gt;
&lt;p&gt;IronRuby, JRuby und MacRuby verfügen über Just-in-Time Compilation, MacRuby bietet zusätzlich Ahead-of-Time Compilation. Der Offizielle 1.9 Branch von Ruby ist auf &lt;span class=&quot;caps&quot;&gt;YARV&lt;/span&gt; aufgebaut und wird wohl Ruby &lt;span class=&quot;caps&quot;&gt;MRI&lt;/span&gt; ersetzen.&lt;/p&gt;
&lt;h3&gt;Links:&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;http://www.ruby-lang.org/en/&quot;&gt;Ruby Homepage&lt;/a&gt; &lt;br /&gt;
&lt;a href=&quot;http://www.ruby-doc.org&quot;&gt;Ruby Dokumentation&lt;/a&gt; &lt;br /&gt;
&lt;a href=&quot;http://antoniocangiano.com/2008/12/09/the-great-ruby-shootout-december-2008/&quot; title=&quot;December 2008: Ruby implementations comparison &quot;&gt;The Great Ruby Shootout&lt;/a&gt; &lt;br /&gt;
&lt;a href=&quot;http://www.sapphiresteel.com/The-Little-Book-Of-Ruby&quot;&gt;Collingbourne, Huw (June 17 2006), The Little Book Of Ruby, free &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt; eBook&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.sapphiresteel.com/the-book-of-ruby&quot;&gt;Collingbourne, Huw (April 18 2009), The Book Of Ruby, free &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt; eBook&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://ruby.on-page.net&quot;&gt;Ruby.on-page.net simple Ruby manual with many samples&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.ruby-lang.org/en/documentation/ruby-from-other-languages/&quot;&gt;Ruby From Other Languages&lt;/a&gt; &lt;br /&gt;
&lt;a href=&quot;http://spec.ruby-doc.org/&quot;&gt;Wiki: Ruby language and implementation specification&lt;/a&gt; &lt;br /&gt;
&lt;a href=&quot;http://www.eqqon.com/index.php/Ruby_C_Extension_API_Documentation_%28Ruby_1.8%29&quot; title=&quot;MRI 1.8&quot;&gt;Writing C Extensions to Ruby&lt;/a&gt; &lt;br /&gt;
&lt;a href=&quot;http://www.rubyflow.com/&quot;&gt;RubyFlow: Community Filtered Ruby News&lt;/a&gt; &lt;br /&gt;
&lt;a href=&quot;http://rubyreflector.com&quot;&gt;The Ruby Automated Ruby News Reflector&lt;/a&gt;&lt;/p&gt;</description>
          <pubDate>Mon, 05 Apr 2010 00:00:00 GMT</pubDate>
          <guid>http://www.iteh.at/de/blog/2010/04/05/die-programmiersprache-ruby-einleitung/</guid>
          <link>http://iteh.at/de/blog/2010/04/05/die-programmiersprache-ruby-einleitung/</link>
        </item>
    
        <item>
          <title>Neue Seite Online</title>
          <description>&lt;h3&gt;Die neue Firmenwebseite ist nun online&lt;/h3&gt;
&lt;h4&gt;Radiant &lt;span class=&quot;caps&quot;&gt;CMS&lt;/span&gt;&lt;/h4&gt;
&lt;p&gt;Die Webseite wurde mit dem Content Management System &lt;a href=&quot;http://radiantcms.org/&quot;&gt;Radiant&lt;/a&gt; realisiert. &lt;br /&gt;
Eine kurze Übersicht über Radiant gibt folgende Präsentation, welche beim &lt;a href=&quot;http://webmontag-graz.at/&quot;&gt;Webmontag in Graz&lt;/a&gt; vorgetragen wurde.&lt;/p&gt; &lt;div style=&quot;width:425px&quot; id=&quot;__ss_3605098&quot;&gt;&lt;strong style=&quot;display:block;margin:12px 0 4px&quot;&gt;&lt;a href=&quot;http://www.slideshare.net/ehaselwanter/webmontag-graz-radiant-cms&quot; title=&quot;Webmontag Graz Radiant CMS&quot;&gt;Webmontag Graz Radiant &lt;span class=&quot;caps&quot;&gt;CMS&lt;/span&gt;&lt;/a&gt;&lt;/strong&gt;&lt;object width=&quot;425&quot; height=&quot;355&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=webmontag-radiant-100331122614-phpapp02&amp;rel=0&amp;stripped_title=webmontag-graz-radiant-cms&quot; /&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;/&gt;&lt;param name=&quot;allowScriptAccess&quot; value=&quot;always&quot;/&gt;&lt;embed src=&quot;http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=webmontag-radiant-100331122614-phpapp02&amp;rel=0&amp;stripped_title=webmontag-graz-radiant-cms&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;425&quot; height=&quot;355&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div style=&quot;padding:5px 0 12px&quot;&gt;View more &lt;a href=&quot;http://www.slideshare.net/&quot;&gt;presentations&lt;/a&gt; from &lt;a href=&quot;http://www.slideshare.net/ehaselwanter&quot;&gt;Edmund Haselwanter&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;
&lt;h4&gt;JQuery&lt;/h4&gt;
&lt;p&gt;Weiters wurden einige Interaktions Möglichkeiten mit der Javascript Bibliothek &lt;a href=&quot;http://jquery.com/&quot;&gt;JQuery&lt;/a&gt; umgesetzt.&lt;/p&gt;</description>
          <pubDate>Tue, 30 Mar 2010 00:00:00 GMT</pubDate>
          <guid>http://www.iteh.at/de/blog/2010/03/30/neue-seite-online/</guid>
          <link>http://iteh.at/de/blog/2010/03/30/neue-seite-online/</link>
        </item>
    
    
  </channel>
</rss>

