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

<channel>
	<title>Agrafix Webdesign Blog &#187; Programmieren</title>
	<atom:link href="http://blog.agrafix.net/category/programmieren/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.agrafix.net</link>
	<description>Programmieren, Technik und Internet</description>
	<lastBuildDate>Tue, 17 Aug 2010 13:45:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How-To: Automatisches MySQL Dump FTP-Backup</title>
		<link>http://blog.agrafix.net/2010/08/automatisches-mysql-dump-ftp-backup/</link>
		<comments>http://blog.agrafix.net/2010/08/automatisches-mysql-dump-ftp-backup/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 15:27:38 +0000</pubDate>
		<dc:creator>Dominic</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[Technik]]></category>

		<guid isPermaLink="false">http://blog.agrafix.net/?p=371</guid>
		<description><![CDATA[
			
				
			
		
Hallo,
da bei vielen Anwendungen nicht nur Dateien sondern auch Datenbanken wichtig sind, ist es auch enorm wichtig diese mitzusichern. Eine einfache Möglichkeit um MySQL Datenbanken in der Shell zu sichern ist es, einen MySQL Dump anzulegen. Das geht schnell und einfach &#8211; mit diesem Tool kann man einzelne Datenbanken und ganze Server sichern und wiederherstellen.
Das [...]


<em>Keine ähnlichen Beiträge vorhanden</em>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.agrafix.net%2F2010%2F08%2Fautomatisches-mysql-dump-ftp-backup%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.agrafix.net%2F2010%2F08%2Fautomatisches-mysql-dump-ftp-backup%2F&amp;source=agrafixblog&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Hallo,<br />
da bei vielen Anwendungen nicht nur Dateien sondern auch Datenbanken wichtig sind, ist es auch enorm wichtig diese mitzusichern. Eine einfache Möglichkeit um MySQL Datenbanken in der Shell zu sichern ist es, einen MySQL Dump anzulegen. Das geht schnell und einfach &#8211; mit diesem Tool kann man einzelne Datenbanken und ganze Server sichern und wiederherstellen.<br />
Das per Hand zu machen wäre eine Heidenarbeit, ein Cronjob ist deshalb eine enorme Entlastung.<br />
Gerne hat man aber mehrere Datenbanksicherungen zur Verfügung, falls ein Fehler in dem Dump vorliegt und dieser irreperabel ist. Es ist also intelligent mehrere Dumps hochzuladen und sie nach dem aktuellen Datum + evtl. dem DB-Namen. Für das Datum gibt es in der Shell &#8216;date&#8217;. Mit date kann das Datum in verschiedenen Formaten ausgegeben und bspw. in einer Variable abgespeichert werden. Um das dann schließlich auf einen FTP-Server hochzuladen, benötigen wir zum Autoeinloggen einen Eintrag in der ~/.netrc. Dann können wir einfach mit wput den Dump hochladen. Auf meinem<a href="http://www.ubuntu.com/" target="_blank" title="Betriebssystem Ubuntu"> Ubuntu </a>System ist wput standardmäßig nicht installiert, wir können es aber ganz einfach mit &#8217;sudo apt-get install wput&#8217; nachinstallieren.</p>
<p>Um uns das ganze zu vereinfachen und nicht jedes Mal die ganzen Befehle einzugeben, erstellen wir ein einfaches Shell-Script.<br />
Da wir per wput im Script hochladen und während des Vorgangs nichts eingeben können, immerhin ist es automatisiert, benötigen wir die erwähnte ~/.netrc. In ihre konfigurieren wir die Login Dateien.<br />
~ steht immer für das Homeverzeichnis des angemeldeten Users. In meinem Fall ist das /home/dominic/. Heißt also die File ist in Wirklichkeit /home/dominic/.netrc<br />
Im Normalfall ist diese leer. Hier schreiben wir den Host-, Loginnamen und das Passwort rein:</p>
<blockquote><p>
machine: ftp.domain.com<br />
login: LOGIN<br />
password: PASSWORD
</p></blockquote>
<p>Die richtigen Rechte sind 600. Die setzen wir mit &#8221; chmod 600 ~/.netrc&#8221;.<br />
Danach ist es uns möglich, ohne Password oder Login auf dem FTP Server, hier ftp.domain.com, einzuloggen.</p>
<p>Da wäre nur noch das eigentliche Script. Hier ist es einfach mal schnell runtergeschrieben, die Erklärung erübrigt sich dank der Kommentare.<br />
Vorweg: Bei mysqldump ist es enorm wichtig, dass Passwort direkt und ohne Leerzeichen hinter -p zu schreiben, sonst kommt ein Syntax Error.</p>
<blockquote><p>
#!/bin/sh<br />
#MySQL-Dump Backupscript</p>
<p>#Schreiben des aktuellen Datums im Format DD.MM.YYYY in eine Variable<br />
today=$(date +%d.%m.%Y)</p>
<p>#Erstellen eines MySQL Dump einer einzelnen Datenbank<br />
mysqldump &#8211;database DBNAME -u USER -pPASSWORD</p>
<p>#Falls nicht vorhanden wird wput installiert<br />
apt-get install wput</p>
<p>#Hochladen des Dumps<br />
wput $today ftp://ftp.domain.com
</p></blockquote>
<p>Zum Schluß kommt noch der Cronjob.<br />
Dazu editieren wir die Crontabelle mit &#8220;crontab -e&#8221;</p>
<blockquote><p>
55 23  * * *  sh /PFAD/ZUM/SCRIPT.sh
</p></blockquote>
<p>Wenn ihr alles richtig gemacht habt, dann startet jeden Tag um 23:55 Uhr ein Cronjob, der einen MySQL-Dump der von euch ausgewählten Datenbank macht.</p>
<p>Fehler oder Anmerkungen bitte in die Kommentare schreiben!<br />
<strong><br />
Nachtrag:</strong><br />
Wenn ihr euren Dump nicht nur nach dem aktuellen Datum benennen wollt, sondern z.B. auch nach der Datenbank, so könnt ihr den Namen einfach an &#8220;date +%d.%m.%Y&#8221; hängen. Beispiel: &#8220;date +%d.%m.%Y-bthost.sql&#8221; gibt 12.08.2010-bthost.sql aus. Außerdem könnt ihr die Darstellung des Datums auch variieren, schaut dazu am besten in die Man-Page von date.</p>
<!-- PHP 5.x --><img src="http://blog.agrafix.net/?ak_action=api_record_view&id=371&type=feed" alt="" />

<p><em>Keine ähnlichen Beiträge vorhanden</em></p>]]></content:encoded>
			<wfw:commentRss>http://blog.agrafix.net/2010/08/automatisches-mysql-dump-ftp-backup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DSLan v1.4</title>
		<link>http://blog.agrafix.net/2010/08/dslan-v1-4/</link>
		<comments>http://blog.agrafix.net/2010/08/dslan-v1-4/#comments</comments>
		<pubDate>Sun, 08 Aug 2010 20:57:23 +0000</pubDate>
		<dc:creator>agrafix</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Projekte]]></category>
		<category><![CDATA[1.4]]></category>
		<category><![CDATA[dslan]]></category>
		<category><![CDATA[staemme]]></category>
		<category><![CDATA[version]]></category>

		<guid isPermaLink="false">http://blog.agrafix.net/?p=367</guid>
		<description><![CDATA[
			
				
			
		
Liebe Leser,
gerade eben haben wir die DSLan v1.4 veröffentlicht. Die DSLan ermöglicht es einen Local-Area-Netzwerk Server mit maximal 10 Spielern des Spiels Die-Stämme zu erstellen.
Download und weitere Info&#8217;s: http://dslan.gfx-dose.de
Liebe Grüße,
Agrafix


Ähnliche Beiträge:Jubiläum



<strong>Ähnliche Beiträge:</strong><ol><li><a href='http://blog.agrafix.net/2009/08/jubilaum/' rel='bookmark' title='Permanent Link: Jubiläum'>Jubiläum</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.agrafix.net%2F2010%2F08%2Fdslan-v1-4%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.agrafix.net%2F2010%2F08%2Fdslan-v1-4%2F&amp;source=agrafixblog&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Liebe Leser,</p>
<p>gerade eben haben wir die<a href="http://dslan.gfx-dose.net" target="_blank" title="Die Stämme Lan"> DSLan </a>v1.4 veröffentlicht. Die<a href="http://dslan.gfx-dose.net" target="_blank" title="Die Stämme Lan"> DSLan </a>ermöglicht es einen Local-Area-Netzwerk Server mit maximal 10 Spielern des Spiels Die-Stämme zu erstellen.</p>
<p>Download und weitere Info&#8217;s: <a href="http://dslan.gfx-dose.de">http://dslan.gfx-dose.de</a></p>
<p>Liebe Grüße,<br />
Agrafix</p>
<!-- PHP 5.x --><img src="http://blog.agrafix.net/?ak_action=api_record_view&id=367&type=feed" alt="" />

<p><strong>Ähnliche Beiträge:</strong><ol><li><a href='http://blog.agrafix.net/2009/08/jubilaum/' rel='bookmark' title='Permanent Link: Jubiläum'>Jubiläum</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.agrafix.net/2010/08/dslan-v1-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eigene XOR Funktion</title>
		<link>http://blog.agrafix.net/2010/07/eigene-xor-funktion/</link>
		<comments>http://blog.agrafix.net/2010/07/eigene-xor-funktion/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 19:47:24 +0000</pubDate>
		<dc:creator>agrafix</dc:creator>
				<category><![CDATA[Autoit]]></category>
		<category><![CDATA[logisch]]></category>
		<category><![CDATA[xor]]></category>

		<guid isPermaLink="false">http://blog.agrafix.net/?p=354</guid>
		<description><![CDATA[
			
				
			
		
Liebe Leser,
ein kleines Code-Snippet für alle, die die XOR-Funktion verstehen wollen  

#cs
Coding by www.agrafix.net
&#160;
---------------------
The functions
---------------------
#ce
; Nand Function
Func nand&#40;$a, $b&#41;
	Return BitNOT&#40;BitAnd&#40;$a, $b&#41;&#41;
EndFunc
&#160;
; XOR Function
Func xor&#40;$a, $b&#41;
	Return  nand&#40;nand&#40;$a, nand&#40;$a, $b&#41;&#41;, nand&#40;$b, nand&#40;$a,$b&#41;&#41;&#41;
EndFunc
&#160;
#cs
---------------------
Proof of Concept: my xor function returns the same stuff as the Built-in XOR function
---------------------
#ce
If xor&#40;0xAB, 0xBC&#41; == BitXor&#40;0xAB, 0xBC&#41; Then ; horray, it [...]


<strong>Ähnliche Beiträge:</strong><ol><li><a href='http://blog.agrafix.net/2009/12/zwei-einfache-algorithmen-kgv-und-ggt/' rel='bookmark' title='Permanent Link: Zwei einfache Algorithmen: kgV und ggT'>Zwei einfache Algorithmen: kgV und ggT</a></li>
<li><a href='http://blog.agrafix.net/2009/08/in_array-fur-javascript/' rel='bookmark' title='Permanent Link: in_array() für Javascript'>in_array() für Javascript</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.agrafix.net%2F2010%2F07%2Feigene-xor-funktion%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.agrafix.net%2F2010%2F07%2Feigene-xor-funktion%2F&amp;source=agrafixblog&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Liebe Leser,</p>
<p>ein kleines Code-Snippet für alle, die die XOR-Funktion verstehen wollen <img src='http://blog.agrafix.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="font-style: italic; color: #669900;">#cs
Coding by www.agrafix.net
&nbsp;
---------------------
The functions
---------------------
#ce</span>
<span style="font-style: italic; color: #009933;">; Nand Function</span>
<span style="color: #0000FF; font-weight: bold;">Func</span> nand<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$a</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$b</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Return</span> <span style="color: #000080; font-style: italic; font-weight: bold;">BitNOT</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #000080; font-style: italic; font-weight: bold;">BitAnd</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$a</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$b</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span>
&nbsp;
<span style="font-style: italic; color: #009933;">; XOR Function</span>
<span style="color: #0000FF; font-weight: bold;">Func</span> xor<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$a</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$b</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Return</span>  nand<span style="color: #FF0000; font-weight: bold;">&#40;</span>nand<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$a</span><span style="color: #FF0000; font-weight: bold;">,</span> nand<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$a</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$b</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="color: #FF0000; font-weight: bold;">,</span> nand<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$b</span><span style="color: #FF0000; font-weight: bold;">,</span> nand<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$a</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$b</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span>
&nbsp;
<span style="font-style: italic; color: #669900;">#cs
---------------------
Proof of Concept: my xor function returns the same stuff as the Built-in XOR function
---------------------
#ce</span>
<span style="color: #0000FF; font-weight: bold;">If</span> xor<span style="color: #FF0000; font-weight: bold;">&#40;</span>0xAB<span style="color: #FF0000; font-weight: bold;">,</span> 0xBC<span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #FF0000; font-weight: bold;">==</span> <span style="color: #000080; font-style: italic; font-weight: bold;">BitXor</span><span style="color: #FF0000; font-weight: bold;">&#40;</span>0xAB<span style="color: #FF0000; font-weight: bold;">,</span> 0xBC<span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #0000FF; font-weight: bold;">Then</span> <span style="font-style: italic; color: #009933;">; horray, it works!</span>
	<span style="color: #000080; font-style: italic; font-weight: bold;">ConsoleWrite</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #008080;">&quot;Congratz Bro, you coded a XOR function :D&quot;</span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #AA0000;">@CRLF</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">Else</span> <span style="font-style: italic; color: #009933;">; this will never happen</span>
	<span style="color: #000080; font-style: italic; font-weight: bold;">ConsoleWrite</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #008080;">&quot;Sorry, but you suck!&quot;</span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #AA0000;">@CRLF</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">EndIf</span></pre></div></div>

<p>Viel Vergnügen damit,<br />
Agrafix</p>
<!-- PHP 5.x --><img src="http://blog.agrafix.net/?ak_action=api_record_view&id=354&type=feed" alt="" />

<p><strong>Ähnliche Beiträge:</strong><ol><li><a href='http://blog.agrafix.net/2009/12/zwei-einfache-algorithmen-kgv-und-ggt/' rel='bookmark' title='Permanent Link: Zwei einfache Algorithmen: kgV und ggT'>Zwei einfache Algorithmen: kgV und ggT</a></li>
<li><a href='http://blog.agrafix.net/2009/08/in_array-fur-javascript/' rel='bookmark' title='Permanent Link: in_array() für Javascript'>in_array() für Javascript</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.agrafix.net/2010/07/eigene-xor-funktion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Agrafix.net in neuem Design</title>
		<link>http://blog.agrafix.net/2010/05/agrafix-net-in-neuem-design/</link>
		<comments>http://blog.agrafix.net/2010/05/agrafix-net-in-neuem-design/#comments</comments>
		<pubDate>Sat, 22 May 2010 17:35:57 +0000</pubDate>
		<dc:creator>agrafix</dc:creator>
				<category><![CDATA[Aktuelles]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[Webseiten]]></category>
		<category><![CDATA[agrafix]]></category>
		<category><![CDATA[div]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[webdesign]]></category>

		<guid isPermaLink="false">http://blog.agrafix.net/?p=342</guid>
		<description><![CDATA[
			
				
			
		
Lange hat sich www.agrafix.net in gleichem Design präsentiert, deshalb war jetzt Zeit für etwas neues. Im Grunde habe ich ein neues Design für die Seite erstellt, die Referenz-Icons vereinheitlicht und auf der Startseite werden nun die letzten 3 Blogbeiträge angezeigt. Wie gefällt euch das neue Design?
Besuche www.agrafix.net
Wärend der &#8220;Umstellung&#8221; bin ich natürlich auf ein paar [...]


<strong>Ähnliche Beiträge:</strong><ol><li><a href='http://blog.agrafix.net/2009/11/das-agrafix-blog-team-wachst/' rel='bookmark' title='Permanent Link: Das Agrafix-Blog Team wächst'>Das Agrafix-Blog Team wächst</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.agrafix.net%2F2010%2F05%2Fagrafix-net-in-neuem-design%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.agrafix.net%2F2010%2F05%2Fagrafix-net-in-neuem-design%2F&amp;source=agrafixblog&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Lange hat sich www.agrafix.net in gleichem Design präsentiert, deshalb war jetzt Zeit für etwas neues. Im Grunde habe ich ein neues Design für die Seite erstellt, die Referenz-Icons vereinheitlicht und auf der Startseite werden nun die letzten 3 Blogbeiträge angezeigt. Wie gefällt euch das neue Design?</p>
<p><a href="http://www.agrafix.net" target="_blank">Besuche www.agrafix.net</a></p>
<p>Wärend der &#8220;Umstellung&#8221; bin ich natürlich auf ein paar interessante Dinge gestroßen:</p>
<h3>1) Die SQL, die es ermöglicht die letzten Blogbeiträge aus einem Wordpress auszulesen:</h3>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> post_title<span style="color: #66cc66;">,</span> post_content<span style="color: #66cc66;">,</span> guid<span style="color: #66cc66;">,</span> post_author <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #66cc66;">&#91;</span>PREFIX<span style="color: #66cc66;">&#93;</span>_posts <span style="color: #993333; font-weight: bold;">WHERE</span> post_status <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'publish'</span> <span style="color: #993333; font-weight: bold;">AND</span> post_type <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'post'</span> <span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> post_date <span style="color: #993333; font-weight: bold;">DESC</span> <span style="color: #993333; font-weight: bold;">LIMIT</span> <span style="color: #cc66cc;">3</span></pre></div></div>

<h3>2) Außerdem noch ein Tipp für alle xHTML+CSS-Designer: Um ein komplettes DIV zu verlinken habe ich folgenden Code genutzt:</h3>
<p><strong>CSS:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">div<span style="color: #6666ff;">.nelement</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
div<span style="color: #6666ff;">.nelement</span> a <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
div<span style="color: #6666ff;">.nelement</span> a<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>	
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p><strong>xHTML:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;nav&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;navhome&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;nelement&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;index.php?show=home&quot;</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;Home&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #ddbb00;">&amp;nbsp;</span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;navref&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;nelement&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;index.php?show=ref&quot;</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;Referenzen&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #ddbb00;">&amp;nbsp;</span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;navblog&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;nelement&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;http://blog.agrafix.net&quot;</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;_blank&quot;</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;Blog&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #ddbb00;">&amp;nbsp;</span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;navimp&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;nelement&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;index.php?show=imprint&quot;</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;Impressum&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #ddbb00;">&amp;nbsp;</span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Das war&#8217;s auch schon <img src='http://blog.agrafix.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<!-- PHP 5.x --><img src="http://blog.agrafix.net/?ak_action=api_record_view&id=342&type=feed" alt="" />

<p><strong>Ähnliche Beiträge:</strong><ol><li><a href='http://blog.agrafix.net/2009/11/das-agrafix-blog-team-wachst/' rel='bookmark' title='Permanent Link: Das Agrafix-Blog Team wächst'>Das Agrafix-Blog Team wächst</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.agrafix.net/2010/05/agrafix-net-in-neuem-design/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zwei einfache Algorithmen: kgV und ggT</title>
		<link>http://blog.agrafix.net/2009/12/zwei-einfache-algorithmen-kgv-und-ggt/</link>
		<comments>http://blog.agrafix.net/2009/12/zwei-einfache-algorithmen-kgv-und-ggt/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 21:55:47 +0000</pubDate>
		<dc:creator>agrafix</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[mathe]]></category>

		<guid isPermaLink="false">http://blog.agrafix.net/?p=199</guid>
		<description><![CDATA[
			
				
			
		
Heute präsentiere ich endlich mal wieder einen Beitrag der sich in die Richtung Mathe/Informatik bewegt. Eigentlich nichts weltbewegendes, nur zwei einfache Algorithmen, die einem beispielsweise beim Bruchrechnen das Leben einfacher machen können: Das kleinste gemeinsame Vielfache und der größte gemeinsame Teiler.

&#60;?php
/**
 * größer gemeinsamer Teiler nach Euclid
 *
 * @param int $a
 * @param int [...]


<em>Keine ähnlichen Beiträge vorhanden</em>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.agrafix.net%2F2009%2F12%2Fzwei-einfache-algorithmen-kgv-und-ggt%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.agrafix.net%2F2009%2F12%2Fzwei-einfache-algorithmen-kgv-und-ggt%2F&amp;source=agrafixblog&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Heute präsentiere ich endlich mal wieder einen Beitrag der sich in die Richtung Mathe/Informatik bewegt. Eigentlich nichts weltbewegendes, nur zwei einfache Algorithmen, die einem beispielsweise beim Bruchrechnen das Leben einfacher machen können: Das kleinste gemeinsame Vielfache und der größte gemeinsame Teiler.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #009933; font-style: italic;">/**
 * größer gemeinsamer Teiler nach Euclid
 *
 * @param int $a
 * @param int $b
 * @return int
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> ggT<span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span><span style="color: #339933;">,</span> <span style="color: #000088;">$b</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$b</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$a</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> ggT<span style="color: #009900;">&#40;</span><span style="color: #000088;">$b</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span><span style="color: #339933;">%</span><span style="color: #000088;">$b</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * kleinstes gemeinsames Vielfaches
 *
 * @param int $a
 * @param int $b
 * @return int
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> kgV<span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span><span style="color: #339933;">,</span> <span style="color: #000088;">$b</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span><span style="color: #339933;">*</span><span style="color: #000088;">$b</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span>ggT<span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span><span style="color: #339933;">,</span> <span style="color: #000088;">$b</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Beispiel</span>
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Type:text/plain&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;ggT(114, 24) = &quot;</span><span style="color: #339933;">.</span>ggT<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">114</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">24</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;kgV(45, 35) = &quot;</span><span style="color: #339933;">.</span>kgV<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">45</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">35</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Die Ausgabe sollte wie folgt aussehen:</p>
<pre>ggT(114, 24) = 6
kgV(45, 35) = 315</pre>
<p>Wer den ggT bzw den kgV von mehreren Zahlen braucht, kann sich an folgende Regel halten:</p>
<pre>kgV(a, b, c, d) = kgV(kgV(a, b), kgV(c, d))</pre>
<!-- PHP 5.x --><img src="http://blog.agrafix.net/?ak_action=api_record_view&id=199&type=feed" alt="" />

<p><em>Keine ähnlichen Beiträge vorhanden</em></p>]]></content:encoded>
			<wfw:commentRss>http://blog.agrafix.net/2009/12/zwei-einfache-algorithmen-kgv-und-ggt/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP und register_globals</title>
		<link>http://blog.agrafix.net/2009/08/php-und-register_globals/</link>
		<comments>http://blog.agrafix.net/2009/08/php-und-register_globals/#comments</comments>
		<pubDate>Fri, 07 Aug 2009 17:06:15 +0000</pubDate>
		<dc:creator>agrafix</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[register_globals]]></category>

		<guid isPermaLink="false">http://blog.agrafix.net/?p=44</guid>
		<description><![CDATA[
			
				
			
		
Ich versteh&#8217; es einfach nicht. Warum gibt es immer noch Webhoster die die php.ini-Setting register_globals aktiviert haben? Ich war gestern abend mindestens eine halbe Stunde auf Bug-Suche, bis ich bemerkt hatte das unser liebes register_globals Variablen definiert hatte &#8211; die eigentlich leer bleiben hätte sollen. Ja, man darf mir jetzt unsauberes Coden vorwerfen &#8211; ich [...]


<em>Keine ähnlichen Beiträge vorhanden</em>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.agrafix.net%2F2009%2F08%2Fphp-und-register_globals%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.agrafix.net%2F2009%2F08%2Fphp-und-register_globals%2F&amp;source=agrafixblog&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Ich versteh&#8217; es einfach nicht. Warum gibt es immer noch Webhoster die die php.ini-Setting register_globals aktiviert haben? Ich war gestern abend mindestens eine halbe Stunde auf Bug-Suche, bis ich bemerkt hatte das unser liebes register_globals Variablen definiert hatte &#8211; die eigentlich leer bleiben hätte sollen. Ja, man darf mir jetzt unsauberes Coden vorwerfen &#8211; ich hätte jeder Variable vor der Verwendung ja einen Initialwert geben können. Allerdings kommt PHP doch eigentlich auch gut ohne aus &#8211; und wenn man mal was quick&#8217;n'dirty machen will scheitert PHP an seinen eigenen Einstellungen&#8230;</p>
<p>register_globals wird endlich mit PHP6 abgeschafft &#8211; seit PHP5.3 gillt es als &#8220;veraltet&#8221;. Und warum gibt&#8217;s dann immer noch Webhoster die sowas standardmäßig aktivieren?!</p>
<!-- PHP 5.x --><img src="http://blog.agrafix.net/?ak_action=api_record_view&id=44&type=feed" alt="" />

<p><em>Keine ähnlichen Beiträge vorhanden</em></p>]]></content:encoded>
			<wfw:commentRss>http://blog.agrafix.net/2009/08/php-und-register_globals/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>in_array() für Javascript</title>
		<link>http://blog.agrafix.net/2009/08/in_array-fur-javascript/</link>
		<comments>http://blog.agrafix.net/2009/08/in_array-fur-javascript/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 09:01:57 +0000</pubDate>
		<dc:creator>agrafix</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Array]]></category>
		<category><![CDATA[in_array]]></category>

		<guid isPermaLink="false">http://blog.agrafix.net/?p=40</guid>
		<description><![CDATA[
			
				
			
		
Da in_array() eine nützliche Funktion in PHP ist, habe ich sie für JavaScript umgeschrieben:

Array.prototype.in_array = function&#40;search&#41; &#123;
	for&#40;var i=0; i &#60; this.length; i++&#41; &#123;
		if &#40;this&#91; i&#93; === search&#41; &#123;
			return true;
		&#125;
	&#125;
&#160;
	return false;
&#125;

Die Funktion wird wie folgt angewendet:

var arr = new Array&#40;&#34;rock&#34;, &#34;and&#34;, &#34;roll&#34;&#41;;
alert&#40;arr.in_array&#40;&#34;rock&#34;&#41;&#41;; // -&#62; true
alert&#40;arr.in_array&#40;&#34;pop&#34;&#41;&#41;; // -&#62; false
alert&#40;arr.in_array&#40;&#34;nd&#34;&#41;&#41;; // -&#62; false

Viel Vergnügen damit  


Ähnliche Beiträge:Eigene [...]


<strong>Ähnliche Beiträge:</strong><ol><li><a href='http://blog.agrafix.net/2010/07/eigene-xor-funktion/' rel='bookmark' title='Permanent Link: Eigene XOR Funktion'>Eigene XOR Funktion</a></li>
<li><a href='http://blog.agrafix.net/2010/08/aglinker/' rel='bookmark' title='Permanent Link: agLinker'>agLinker</a></li>
<li><a href='http://blog.agrafix.net/2009/12/zwei-einfache-algorithmen-kgv-und-ggt/' rel='bookmark' title='Permanent Link: Zwei einfache Algorithmen: kgV und ggT'>Zwei einfache Algorithmen: kgV und ggT</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.agrafix.net%2F2009%2F08%2Fin_array-fur-javascript%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.agrafix.net%2F2009%2F08%2Fin_array-fur-javascript%2F&amp;source=agrafixblog&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Da <a href="http://de3.php.net/in_array">in_array()</a> eine nützliche Funktion in <a href="http://de3.php.net/in_array">PHP</a> ist, habe ich sie für JavaScript umgeschrieben:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">Array.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">in_array</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>search<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#91;</span> i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">===</span> search<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Die Funktion wird wie folgt angewendet:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> arr <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;rock&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;and&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;roll&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>arr.<span style="color: #660066;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;rock&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// -&gt; true</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>arr.<span style="color: #660066;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;pop&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// -&gt; false</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>arr.<span style="color: #660066;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;nd&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// -&gt; false</span></pre></div></div>

<p>Viel Vergnügen damit <img src='http://blog.agrafix.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<!-- PHP 5.x --><img src="http://blog.agrafix.net/?ak_action=api_record_view&id=40&type=feed" alt="" />

<p><strong>Ähnliche Beiträge:</strong><ol><li><a href='http://blog.agrafix.net/2010/07/eigene-xor-funktion/' rel='bookmark' title='Permanent Link: Eigene XOR Funktion'>Eigene XOR Funktion</a></li>
<li><a href='http://blog.agrafix.net/2010/08/aglinker/' rel='bookmark' title='Permanent Link: agLinker'>agLinker</a></li>
<li><a href='http://blog.agrafix.net/2009/12/zwei-einfache-algorithmen-kgv-und-ggt/' rel='bookmark' title='Permanent Link: Zwei einfache Algorithmen: kgV und ggT'>Zwei einfache Algorithmen: kgV und ggT</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.agrafix.net/2009/08/in_array-fur-javascript/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Quadratische Gleichung Lösen</title>
		<link>http://blog.agrafix.net/2009/07/quadratische-gleichung-losen/</link>
		<comments>http://blog.agrafix.net/2009/07/quadratische-gleichung-losen/#comments</comments>
		<pubDate>Sat, 18 Jul 2009 13:06:42 +0000</pubDate>
		<dc:creator>agrafix</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.agrafix.net/?p=18</guid>
		<description><![CDATA[
			
				
			
		
Um das wp-syntax plugin zu testen habe ich ein kleines PHP Script zum Lösen von quadratischen Gleichungen veröffentlicht:

&#60;?php
/**
 * ax² + bx + c = 0 solver
 * 
 * @author agrafix.net
 */
header&#40;&#34;Content-Type: text/plain;charset=utf-8&#34;&#41;;
&#160;
// input -&#62; ax² + bx + c = 0
$a = 1;
$b = 3;
$c = 1;
&#160;
// calc
print &#34;Eq: &#34;.$a.&#34;x² + &#34;.$b.&#34;x + [...]


<em>Keine ähnlichen Beiträge vorhanden</em>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.agrafix.net%2F2009%2F07%2Fquadratische-gleichung-losen%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.agrafix.net%2F2009%2F07%2Fquadratische-gleichung-losen%2F&amp;source=agrafixblog&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Um das wp-syntax plugin zu testen habe ich ein kleines PHP Script zum Lösen von quadratischen Gleichungen veröffentlicht:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #009933; font-style: italic;">/**
 * ax² + bx + c = 0 solver
 * 
 * @author agrafix.net
 */</span>
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Type: text/plain;charset=utf-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// input -&gt; ax² + bx + c = 0</span>
<span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$b</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$c</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// calc</span>
<span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot;Eq: &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$a</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;x² + &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$b</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;x + &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$c</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; = 0<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$d</span> <span style="color: #339933;">=</span> <span style="color: #990000;">pow</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$b</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">*</span><span style="color: #000088;">$a</span><span style="color: #339933;">*</span><span style="color: #000088;">$c</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot;D = <span style="color: #006699; font-weight: bold;">$d</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$d</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot;L = {}&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000088;">$x1</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color: #000088;">$b</span> <span style="color: #339933;">+</span> <span style="color: #990000;">sqrt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$d</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$a</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$x2</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color: #000088;">$b</span> <span style="color: #339933;">-</span> <span style="color: #990000;">sqrt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$d</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$a</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$x1</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$x2</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot;L = {&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">round</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$x1</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;}&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot;L = {&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">round</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$x1</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;, &quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">round</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$x2</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;}&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<!-- PHP 5.x --><img src="http://blog.agrafix.net/?ak_action=api_record_view&id=18&type=feed" alt="" />

<p><em>Keine ähnlichen Beiträge vorhanden</em></p>]]></content:encoded>
			<wfw:commentRss>http://blog.agrafix.net/2009/07/quadratische-gleichung-losen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
