<?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>ADI64 feat. n0stradamus &#187; Allgemein</title>
	<atom:link href="http://adrian.holfter.de/blog/category/allgemein/feed/" rel="self" type="application/rss+xml" />
	<link>http://adrian.holfter.de/blog</link>
	<description>Reiche Eltern für alle!</description>
	<lastBuildDate>Wed, 04 Jan 2012 22:47:27 +0000</lastBuildDate>
	<language>de</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>das ist echt bitter</title>
		<link>http://adrian.holfter.de/blog/2012/01/das-ist-echt-bitter/</link>
		<comments>http://adrian.holfter.de/blog/2012/01/das-ist-echt-bitter/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 22:46:31 +0000</pubDate>
		<dc:creator>Markus</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[adware]]></category>
		<category><![CDATA[bing]]></category>
		<category><![CDATA[directx]]></category>
		<category><![CDATA[facepalm]]></category>
		<category><![CDATA[installer]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[Random]]></category>
		<category><![CDATA[uncool]]></category>
		<category><![CDATA[verschimmelt]]></category>
		<category><![CDATA[what where they thinking]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[wtf]]></category>

		<guid isPermaLink="false">http://adrian.holfter.de/blog/?p=719</guid>
		<description><![CDATA[&#160;]]></description>
			<content:encoded><![CDATA[<p><a href="http://adrian.holfter.de/blog/wp-content/uploads/2012/01/bingbar.png"><img class="alignnone size-full wp-image-718 aligncenter" src="http://adrian.holfter.de/blog/wp-content/uploads/2012/01/bingbar.png" alt="" width="526" height="402" /></a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://adrian.holfter.de/blog/2012/01/das-ist-echt-bitter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>(English) Solved: Broadcom BCM4306 + ndiswrapper</title>
		<link>http://adrian.holfter.de/blog/2011/12/english-solved-broadcom-bcm4306-ndiswrapper/</link>
		<comments>http://adrian.holfter.de/blog/2011/12/english-solved-broadcom-bcm4306-ndiswrapper/#comments</comments>
		<pubDate>Sat, 31 Dec 2011 12:46:28 +0000</pubDate>
		<dc:creator>ADI64</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Archlinux]]></category>
		<category><![CDATA[b43legacy]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ndiswrapper]]></category>

		<guid isPermaLink="false">http://adrian.holfter.de/blog/?p=707</guid>
		<description><![CDATA[Leider ist der Eintrag nur auf English verfügbar.]]></description>
			<content:encoded><![CDATA[<p>Leider ist der Eintrag nur auf <a href="http://adrian.holfter.de/blog/en/category/allgemein/feed/">English</a> verfügbar.</p>
]]></content:encoded>
			<wfw:commentRss>http://adrian.holfter.de/blog/2011/12/english-solved-broadcom-bcm4306-ndiswrapper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>(English) go-preload benchmark</title>
		<link>http://adrian.holfter.de/blog/2011/11/english-go-preload-benchmark/</link>
		<comments>http://adrian.holfter.de/blog/2011/11/english-go-preload-benchmark/#comments</comments>
		<pubDate>Mon, 28 Nov 2011 00:35:00 +0000</pubDate>
		<dc:creator>Markus</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Archlinux]]></category>
		<category><![CDATA[benchmark]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[precache]]></category>
		<category><![CDATA[preload]]></category>
		<category><![CDATA[speed]]></category>

		<guid isPermaLink="false">http://adrian.holfter.de/blog/?p=701</guid>
		<description><![CDATA[Leider ist der Eintrag nur auf English verfügbar.]]></description>
			<content:encoded><![CDATA[<p>Leider ist der Eintrag nur auf <a href="http://adrian.holfter.de/blog/en/category/allgemein/feed/">English</a> verfügbar.</p>
]]></content:encoded>
			<wfw:commentRss>http://adrian.holfter.de/blog/2011/11/english-go-preload-benchmark/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reconnect Skript für Level One WBR-6600</title>
		<link>http://adrian.holfter.de/blog/2011/11/wbr6600-reconnect/</link>
		<comments>http://adrian.holfter.de/blog/2011/11/wbr6600-reconnect/#comments</comments>
		<pubDate>Fri, 11 Nov 2011 16:28:04 +0000</pubDate>
		<dc:creator>Markus</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[autoit]]></category>
		<category><![CDATA[do it yourself]]></category>
		<category><![CDATA[gpl]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[reconnect]]></category>
		<category><![CDATA[router]]></category>
		<category><![CDATA[wbr6600]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://adrian.holfter.de/blog/?p=672</guid>
		<description><![CDATA[Leider ist der Eintrag nur auf English verfügbar.]]></description>
			<content:encoded><![CDATA[<p>Leider ist der Eintrag nur auf <a href="http://adrian.holfter.de/blog/en/category/allgemein/feed/">English</a> verfügbar.</p>
]]></content:encoded>
			<wfw:commentRss>http://adrian.holfter.de/blog/2011/11/wbr6600-reconnect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Command-line contact management</title>
		<link>http://adrian.holfter.de/blog/2011/08/command-line-contact-management/</link>
		<comments>http://adrian.holfter.de/blog/2011/08/command-line-contact-management/#comments</comments>
		<pubDate>Sun, 14 Aug 2011 20:41:57 +0000</pubDate>
		<dc:creator>n0stradamus</dc:creator>
				<category><![CDATA[Allgemein]]></category>

		<guid isPermaLink="false">http://adrian.holfter.de/blog/?p=639</guid>
		<description><![CDATA[Für diejenigen, die gerne mit der Kommandozeile arbeiten und auch ohne X-Server Zugriff auf ihre Kontakte haben möchten, bietet sich mit abook eine bequeme, auf ncurses basierende Möglichkeit. Wer für diesen Zweck kein eigenes Programm verwenden möchte, bzw. nicht in Schwierigkeiten mit dem abook-Format geraten möchte, der ist mit einer Reihe von Skripten gut beraten. [...]]]></description>
			<content:encoded><![CDATA[<p>Für diejenigen, die gerne mit der Kommandozeile arbeiten und auch ohne X-Server Zugriff auf ihre Kontakte haben möchten, bietet sich mit <strong>abook</strong> eine bequeme, auf ncurses basierende Möglichkeit. Wer für diesen Zweck kein eigenes Programm verwenden möchte, bzw. nicht in Schwierigkeiten mit dem abook-Format geraten möchte, der ist mit einer Reihe von Skripten gut beraten. Diese werden in diesem Artikel vorgestellt.<br />
<span id="more-639"></span><br />
Dieser Artikel bezieht sich auf einen älteren Artikel im <a href="http://www.linux.com/archive/articles/57894" target="_blank">linux.com-Archiv</a>. Die hier vorgestellten Skripte basieren auf dem darin vorgestellten System.</p>
<h3>mutt alias</h3>
<p><strong>abook</strong> bietet eine Funktion um aus den vorhandenen Kontaktdaten Aliase für mutt zu generieren. Das ist auch mit einem kleinen Skript möglich:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># File: cbook2alias.sh</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Speicherort des Addressbuches</span>
<span style="color: #007800;">CBOOK_DIR</span>=~<span style="color: #000000; font-weight: bold;">/</span>.cbook
&nbsp;
<span style="color: #007800;">MAIL_LIST</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">'^Email:'</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$CBOOK_DIR</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">egrep</span> <span style="color: #660033;">-o</span> <span style="color: #ff0000;">'[^ ]+$'</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #007800;">INFO_LIST</span>=<span style="color: #ff0000;">&quot;&quot;</span>
<span style="color: #007800;">NAME</span>=<span style="color: #ff0000;">&quot;&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">for</span> ADDRESS <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #800000;">${MAIL_LIST[*]}</span>; <span style="color: #000000; font-weight: bold;">do</span>
  <span style="color: #007800;">INFO_LIST</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'BEGIN { RS = &quot;###&quot;; FS = &quot;Email: &quot; } ($2 ~ &quot;'</span><span style="color: #007800;">$ADDRESS</span><span style="color: #ff0000;">'&quot;) { print $1 }'</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$CBOOK_DIR</span>&quot;</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
  <span style="color: #007800;">NAME</span>=<span style="color: #800000;">${INFO_LIST[0]:0:1}</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;alias <span style="color: #007800;">${NAME,}</span><span style="color: #007800;">${INFO_LIST[1],,}</span> &lt;<span style="color: #007800;">$ADDRESS</span>&gt;&quot;</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

<p><strong>Anwendungsbeispiel:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># File: ~/.cbook</span>
Ron Wesley
Fuchsbau
<span style="color: #000000;">1337</span> Irgendwo im Nirgendwo
Email: ron<span style="color: #000000; font-weight: bold;">@</span>weasley.hog
Birthday: 12.12.9000</pre></div></div>

<p><code>$ ./cbook2alias.sh<br />
alias rweasley &#60;ron@weasley.hog&#62;</code><br />
Wie man sieht, wird der Vorname auf den Anfangsbuchstaben verkürzt und dieser vor den Nachnamen gehängt. Eine Modifikation von Zeile 13 kann diesen Effekt aufheben:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>13
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">NAME</span>=<span style="color: #800000;">${INFO_LIST[0]}</span></pre></td></tr></table></div>

<p><code>$ ./cbook2alias.sh<br />
alias ronweasley &#60;ron@weasley.hog&#62;</code></p>
<h3>Geburtstagsübersicht</h3>
<p>Manche Geburtstage sollte man einfach nicht vergessen. Damit das passiert, kann man sich aus dem Addressbuch die kommenden Geburtstage anzeigen lassen:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash </span>
<span style="color: #666666; font-style: italic;"># File: cbook_birthdays.sh</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Variables</span>
<span style="color: #007800;">CBOOK_DIR</span>=~<span style="color: #000000; font-weight: bold;">/</span>.cbook
&nbsp;
<span style="color: #666666; font-style: italic;"># This var  holds a list of all the birthdays in the contacts file</span>
<span style="color: #007800;">BD_LIST</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">'^Birthday:'</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$CBOOK_DIR</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">egrep</span> <span style="color: #660033;">-o</span> <span style="color: #ff0000;">'[^ ]+$'</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #666666; font-style: italic;"># This var will hold a list of information for the person corresponding to a birthday in BD_LIST</span>
<span style="color: #007800;">INFO_LIST</span>=<span style="color: #ff0000;">&quot;&quot;</span>
<span style="color: #666666; font-style: italic;"># The persons name</span>
<span style="color: #007800;">NAME</span>=<span style="color: #ff0000;">&quot;&quot;</span>
<span style="color: #666666; font-style: italic;"># The flag that is relevant for output</span>
<span style="color: #007800;">ONE_MONTH_FLAG</span>=<span style="color: #c20cb9; font-weight: bold;">false</span>
<span style="color: #666666; font-style: italic;"># Current date and delimiter</span>
<span style="color: #007800;">CUR_DAY</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #ff0000;">&quot;%d&quot;</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">CUR_MONTH</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #ff0000;">&quot;%m&quot;</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">CUR_YEAR</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #ff0000;">&quot;%Y&quot;</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #666666; font-style: italic;"># Birthday segment indices, delimiter and format</span>
<span style="color: #007800;">BD_DAY</span>=<span style="color: #000000;">2</span>
<span style="color: #007800;">BD_MONTH</span>=<span style="color: #000000;">1</span>
<span style="color: #007800;">BD_YEAR</span>=<span style="color: #000000;">0</span>
<span style="color: #007800;">DELIM</span>=<span style="color: #ff0000;">&quot;.&quot;</span>
<span style="color: #007800;">FMT</span>=<span style="color: #ff0000;">&quot;ymd&quot;</span>
<span style="color: #666666; font-style: italic;"># helper variables</span>
<span style="color: #007800;">TEMP</span>=<span style="color: #ff0000;">&quot;&quot;</span>
<span style="color: #007800;">NUM</span>=<span style="color: #000000;">0</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Functions</span>
<span style="color: #000000; font-weight: bold;">function</span> print_usage <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage: <span style="color: #780078;">`basename $0`</span> [Options]&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Description:&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;This script helps you remember birthdays. You can pass it&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;some options concerning the date format. Then you&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;will get to see a list of birthdays to come for this year.&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Options:&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;-m&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span> print only the birthdays for this month (the ones that are to come&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;-f &lt;FORMAT&gt;&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span> the date format, choose one of [dmy,mdy,ymd]&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span> d for day, m for month, y for year&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;-d &lt;DELIMITER&gt;&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span> the date delimiter&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;-h, --help&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span> display this message&quot;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Argument parsing</span>
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">true</span>; <span style="color: #000000; font-weight: bold;">do</span>
    <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
        <span style="color: #660033;">-h</span> <span style="color: #000000; font-weight: bold;">|</span> --help<span style="color: #7a0874; font-weight: bold;">&#41;</span>
               print_usage
                <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span>
                <span style="color: #000000; font-weight: bold;">;;</span>
        -m<span style="color: #7a0874; font-weight: bold;">&#41;</span>
                <span style="color: #007800;">ONE_MONTH_FLAG</span>=<span style="color: #c20cb9; font-weight: bold;">true</span>
                <span style="color: #7a0874; font-weight: bold;">shift</span>
                <span style="color: #000000; font-weight: bold;">;;</span>
        -f<span style="color: #7a0874; font-weight: bold;">&#41;</span>
                <span style="color: #666666; font-style: italic;"># The date format of the birthday</span>
                <span style="color: #007800;">FMT</span>=<span style="color: #ff0000;">&quot;$2&quot;</span>
                <span style="color: #7a0874; font-weight: bold;">shift</span> <span style="color: #000000;">2</span>
                <span style="color: #000000; font-weight: bold;">;;</span>
        -d<span style="color: #7a0874; font-weight: bold;">&#41;</span>
                <span style="color: #666666; font-style: italic;"># The date delimiter</span>
                <span style="color: #007800;">DELIM</span>=<span style="color: #ff0000;">&quot;$2&quot;</span>
                <span style="color: #7a0874; font-weight: bold;">shift</span> <span style="color: #000000;">2</span>
                <span style="color: #000000; font-weight: bold;">;;</span>
         <span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">shift</span>; <span style="color: #7a0874; font-weight: bold;">break</span>
                <span style="color: #000000; font-weight: bold;">;;</span>
    <span style="color: #000000; font-weight: bold;">esac</span>
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#===============</span>
<span style="color: #666666; font-style: italic;"># The main work</span>
<span style="color: #666666; font-style: italic;">#===============</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;"># find out the date segment indices</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$FMT</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;ymd&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #007800;">TEMP</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$FMT</span> <span style="color: #000000; font-weight: bold;">|</span> fold -w1<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #007800;">NUM</span>=<span style="color: #000000;">0</span>
    <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$NUM</span> <span style="color: #660033;">-lt</span> <span style="color: #800000;">${#TEMP[*]}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${TEMP[$NUM]}</span>&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
            d<span style="color: #7a0874; font-weight: bold;">&#41;</span>
                <span style="color: #007800;">BD_DAY</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$NUM</span>&quot;</span><span style="color: #000000; font-weight: bold;">;;</span>
            m<span style="color: #7a0874; font-weight: bold;">&#41;</span>
                <span style="color: #007800;">BD_MONTH</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$NUM</span>&quot;</span><span style="color: #000000; font-weight: bold;">;;</span>
            y<span style="color: #7a0874; font-weight: bold;">&#41;</span>
                <span style="color: #007800;">BD_YEAR</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$NUM</span>&quot;</span><span style="color: #000000; font-weight: bold;">;;</span>
            <span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;OMG! Error!&quot;</span>
                <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">2</span>
        <span style="color: #000000; font-weight: bold;">esac</span>
        <span style="color: #007800;">NUM</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$NUM</span>+<span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">for</span> BDAY <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #800000;">${BD_LIST[*]}</span>; <span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #007800;">INFO_LIST</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'BEGIN { RS = &quot;###&quot;; FS = &quot;Birthday: &quot; } ($2 ~ &quot;'</span><span style="color: #007800;">$BDAY</span><span style="color: #ff0000;">'&quot;) { print $1 }'</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$CBOOK_DIR</span>&quot;</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
        <span style="color: #007800;">NAME</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${INFO_LIST[0]}</span> <span style="color: #007800;">${INFO_LIST[1]}</span>&quot;</span>
        <span style="color: #666666; font-style: italic;"># Decide wether the birthday has already taken place</span>
        <span style="color: #007800;">TEMP</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$BDAY</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tr</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DELIM</span>&quot;</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;"># Print the month-only birthdays first</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$CUR_MONTH</span> <span style="color: #660033;">-eq</span> <span style="color: #800000;">${TEMP[$BD_MONTH]}</span> <span style="color: #660033;">-a</span> <span style="color: #007800;">$ONE_MONTH_FLAG</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$CUR_DAY</span> <span style="color: #660033;">-le</span> <span style="color: #800000;">${TEMP[$BD_DAY]}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$BDAY</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #007800;">$NAME</span>(<span style="color: #007800;">$(($CUR_YEAR - ${TEMP[$BD_YEAR]})</span>))&quot;</span>
                <span style="color: #000000; font-weight: bold;">fi</span>
        <span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$CUR_MONTH</span> <span style="color: #660033;">-le</span> <span style="color: #800000;">${TEMP[$BD_MONTH]}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                <span style="color: #666666; font-style: italic;"># if were in here, it is this month or some month in the future</span>
                <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$CUR_DAY</span> <span style="color: #660033;">-le</span> <span style="color: #800000;">${TEMP[$BD_DAY]}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                        <span style="color: #666666; font-style: italic;"># if we're here, it has not yet passed</span>
                        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$BDAY</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #007800;">$NAME</span>(<span style="color: #007800;">$(($CUR_YEAR - ${TEMP[$BD_YEAR]})</span>))&quot;</span>
                <span style="color: #000000; font-weight: bold;">fi</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

<p><strong>Anwendungsbeispiel</strong><br />
Bei Verwendung des Addressbuchs von oben:<br />
<code>$ date +%Y<br />
2011<br />
$ ./cbook_birthdays.sh -f dmy<br />
12.12.9000       Ron Weasley(-6989)</code></p>
<h3>Vorteile</h3>
<p>Bei Verwendung kleiner Skripte stellt sich fast keine Problematik bezüglich verschiedenen Formaten. Eine Konversion in andere ist eigentlich immer möglich. Natürlich bedeutet das ein wenig Arbeit, aber das bedeutet nicht dass es unmöglich ist <img src='http://adrian.holfter.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Dieser Artikel ist nicht in Stein gemeisselt. Die Skripte unterstehen noch einer gewissen Entwicklung. Eine aktuelle Version der Skripte gibt es auf <a href="https://github.com/n0stradamus/CLI-contact-management-scripts" title="github">github</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://adrian.holfter.de/blog/2011/08/command-line-contact-management/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>29. Bundeswettbewerb Informatik &#8211; 2. Runde</title>
		<link>http://adrian.holfter.de/blog/2011/07/29-bundeswettbewerb-informatik-2-runde/</link>
		<comments>http://adrian.holfter.de/blog/2011/07/29-bundeswettbewerb-informatik-2-runde/#comments</comments>
		<pubDate>Sun, 03 Jul 2011 15:19:31 +0000</pubDate>
		<dc:creator>ADI64</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[29]]></category>
		<category><![CDATA[bundeswettbewerb informatik]]></category>
		<category><![CDATA[bwinf]]></category>
		<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://adrian.holfter.de/blog/?p=626</guid>
		<description><![CDATA[Coolerweise habe ich es mit meinen Lösungen für die zweite Aufgabe im 29. Bundeswettbewerb Informatik (BwInf) in die Endrunde geschafft. n0stradamus ist leider knapp an der Endrunde vorbei. Zum Nachvollziehen und vielleicht auch zum Vorbereiten auf den nächsten BwInf könnt ihr euch meine Dokumentation (1. und 2. Aufgabe) hier anschauen: Klick klack]]></description>
			<content:encoded><![CDATA[<p>Coolerweise habe ich es mit meinen Lösungen für die zweite Aufgabe im 29. Bundeswettbewerb Informatik (BwInf) in die Endrunde geschafft. n0stradamus ist leider knapp an der Endrunde vorbei. Zum Nachvollziehen und vielleicht auch zum Vorbereiten auf den nächsten BwInf könnt ihr euch meine Dokumentation (1. und 2. Aufgabe) hier anschauen: <a href="http://adrian.holfter.de/zeugs/bwinf29_runde2.tar.gz">Klick klack</a></p>
]]></content:encoded>
			<wfw:commentRss>http://adrian.holfter.de/blog/2011/07/29-bundeswettbewerb-informatik-2-runde/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Virtual DJ mit foobar2000 kombinieren</title>
		<link>http://adrian.holfter.de/blog/2011/05/virtual-dj-mit-foobar2000-kombinieren/</link>
		<comments>http://adrian.holfter.de/blog/2011/05/virtual-dj-mit-foobar2000-kombinieren/#comments</comments>
		<pubDate>Tue, 10 May 2011 22:00:51 +0000</pubDate>
		<dc:creator>Markus</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[do it yourself]]></category>
		<category><![CDATA[fb2k]]></category>
		<category><![CDATA[flac]]></category>
		<category><![CDATA[Music]]></category>
		<category><![CDATA[ogg]]></category>
		<category><![CDATA[skin]]></category>
		<category><![CDATA[virtual dj]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://adrian.holfter.de/blog/?p=594</guid>
		<description><![CDATA[Leider ist der Eintrag nur auf English verfügbar.]]></description>
			<content:encoded><![CDATA[<p>Leider ist der Eintrag nur auf <a href="http://adrian.holfter.de/blog/en/category/allgemein/feed/">English</a> verfügbar.</p>
]]></content:encoded>
			<wfw:commentRss>http://adrian.holfter.de/blog/2011/05/virtual-dj-mit-foobar2000-kombinieren/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Demos aufzeichnen mit .kkapture und als .avi (Xvid/mp3) abspeichern</title>
		<link>http://adrian.holfter.de/blog/2011/04/demos-aufzeichnen-mit-kkapture-und-als-avi-xvidmp3-abspeichern/</link>
		<comments>http://adrian.holfter.de/blog/2011/04/demos-aufzeichnen-mit-kkapture-und-als-avi-xvidmp3-abspeichern/#comments</comments>
		<pubDate>Tue, 26 Apr 2011 14:18:12 +0000</pubDate>
		<dc:creator>n0stradamus</dc:creator>
				<category><![CDATA[Allgemein]]></category>

		<guid isPermaLink="false">http://adrian.holfter.de/blog/?p=569</guid>
		<description><![CDATA[Entgegen dem bisherigen Linux-Fokus nun einmal ein Artikel nur über Windows In diesem Artikel soll erklärt werden, wie man &#8220;rohes&#8221; Videomaterial von Demos mit dem Tool kkapture aufnimmt und dann mit VirtualDub nachbearbeitet. Möglichkeiten, den Vorgang mittels Scripting zu automatisieren werden auch beleuchtet. Der Autor will sich keinesfalls einen Video-Profi nennen, dementsprechend erhebt dieser Leitfaden [...]]]></description>
			<content:encoded><![CDATA[<p>Entgegen dem bisherigen Linux-Fokus nun einmal ein Artikel nur über Windows <img src='http://adrian.holfter.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
In diesem Artikel soll erklärt werden, wie man &#8220;rohes&#8221; Videomaterial von Demos mit dem Tool <a href="http://www.farb-rausch.de/~fg/kkapture/">kkapture</a> aufnimmt und dann mit <a href="http://www.virtualdub.org/">VirtualDub</a> nachbearbeitet. Möglichkeiten, den Vorgang mittels Scripting zu automatisieren werden auch beleuchtet. Der Autor will sich keinesfalls einen Video-Profi nennen, dementsprechend erhebt dieser Leitfaden auch keinerlei Anspruch auf Vollständigkeit.</p>
<p><span id="more-569"></span></p>
<p style="text-align: center;">&#8212;</p>
<p>Bevor richtig losgelegt werden kann, müssen einige Codecs installiert werden. Verwendet wird in unserem Beispiel <a href="http://www.koepi.info/xvid.html">Xvid</a> und <a href="http://www.rarewares.org/mp3-lame-dshow-acm.php">LAME mp3</a>. Aus Gründen der Kompabilität ist es ratsam, die 32bit-Version von VirtualDub zu verwenden. Nutzer von Windows Vista/7 finden <a href="http://granjow.net/virtualdub-tutorial-installing.html">hier</a> weitere Tipps zur Installation von LAME.</p>
<p>So, nun sind die Codecs installiert. Damit sie eingesetzt werden können, muss erstmal Videomaterial an den Start gebracht werden. Also: kkapture starten, eine Demo auswählen und unkomprimiertes Material abspeichern lassen. Falls hier schon Probleme auftreten sollten, die Tipps auf <a href="http://wurstcaptures.untergrund.net/index.php?page=kkapture">wurstcaptures</a> helfen vielleicht weiter.</p>
<p>Gehen wir davon aus, dass das Aufzeichnen mit kkapture geklappt hat und nun die gerade eben erstellte Folge von .avi-Dateien in VirtualDub geöffnet ist(<em>Open video file&#8230;</em> und <em>Append segment&#8230;</em>).<br />
<a href="http://wurstcaptures.untergrund.net/index.php?page=converting">wurstcaptures</a> empfiehlt 2-Pass Encodings für eine optimale Qualität mit Xvid, also machen wir uns VirtualDubs Job-System zunutze. Vorher legen wir aber fest, ob das Format verändert werden soll (<em>Video &gt; Filters&#8230; &gt; Add &gt; resize</em>, auf Verhältnistreue achten!), oder nur gewisse Teile des Videos im Endergebnis beinhaltet sein sollen (<em>Video &gt; Filters&#8230; &gt; Filter in der Liste auswählen &gt; Cropping&#8230;</em>).<br />
Anschließend wird der Audio-Codec eingestellt: <em>Audio &gt; Full processing mode</em> und <em> Audio &gt; Compression&#8230; &gt; Codec auswählen</em></p>
<p>Okay, damit haben wir alles eingestellt, was wir brauchen um die beiden Jobs für jeweils den ersten und den zweiten Encoding-Pass einzurichten:</p>
<p><strong>Job 1</strong></p>
<ul>
<li><em>Video &gt; Compression &gt; Xvid auswählen &gt; Configure &gt; Encoding Type: TwoPass &#8211; 1st pass</em></li>
<li><em>File &gt; Queue batch operation &gt; Save as AVI file&#8230;</em></li>
</ul>
<p><strong>Job 2 </strong></p>
<ul>
<li><em> Video &gt; Compression &gt; Xvid auswählen &gt; Configure &gt; Encoding Type: TwoPass &#8211; 2nd pass</em></li>
<li><em>File &gt; Queue batch operation &gt; Save as AVI file&#8230;</em></li>
</ul>
<p>Nun kann man per <em>File &gt; Jobs&#8230;</em> sich die Jobliste anzeigen lassen, die Abarbeitung starten und sich einen Kaffee holen gehen <img src='http://adrian.holfter.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
Die Größe der Datei lässt sich beeinflussen, indem man Auflösung, Bitrate und Framerate des  Videos verändert. Um A/V-Desynchronisation zu vermeiden, kann man die gewünschte Framerate gleich in kkapture festlegen. Es gibt bestimmt auch Wege, dies in VirtualDub zu tun, diese führten beim Autor aber zum Misserfolg <img src='http://adrian.holfter.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><strong>Weiterführendes:</strong><br />
Wer sich mit dem .avi-Containerformat nicht zufriedengeben möchte, ist vielleicht mit <a href="http://virtualdubmod.sourceforge.net/">VirtualDubMod</a> glücklicher. Dieses unterstützt mehrere Containerformate, darunter auch .mkv<br />
Freunde der Kombination h.264/AAC finden auf <a href="http://wurstcaptures.untergrund.net/index.php?page=converting">wurstcaptures</a> weiterführendes. Wie man merkt, war wurstcaptures eine meiner Hauptquellen <img src='http://adrian.holfter.de/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /><br />
Die Jobs von VirtualDub nehmen einem viel Arbeit ab, sie kann man auch scripten. Ein Tool das dabei hilft, wäre <a href="http://dubman.sourceforge.net/">DubMan</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://adrian.holfter.de/blog/2011/04/demos-aufzeichnen-mit-kkapture-und-als-avi-xvidmp3-abspeichern/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Binärbaum zeichnen</title>
		<link>http://adrian.holfter.de/blog/2011/04/binarbaum-zeichnen/</link>
		<comments>http://adrian.holfter.de/blog/2011/04/binarbaum-zeichnen/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 14:52:04 +0000</pubDate>
		<dc:creator>n0stradamus</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[do it yourself]]></category>
		<category><![CDATA[n0stradamus]]></category>

		<guid isPermaLink="false">http://adrian.holfter.de/blog/?p=465</guid>
		<description><![CDATA[In diesem Artikel möchte ich ein Verfahren erklären, der einem die links abgebildete Datenstruktur ähnlich wie bei einem Aufruf des Befehls pstree ausgiebt]]></description>
			<content:encoded><![CDATA[<p>Im Rahmen dieses Artikels möchte ich ein Verfahren erklären,<img class="alignright" src="http://www.coder-wiki.de/uploads/Algorithmen/vollstaendiger-binaerbaum.png" alt="" width="143" height="100" /> das einem die rechts abgebildete Datenstruktur bereitstellt, sodass eine Ausgabe ähnlich der von <em>pstree -A</em> wäre.</p>
<p>Das fertige Ergebnis sollte folgendermaßen aussehen (In Anlehnung an den rechts dargestellten Baum &#8211; die Nummerierung erfolgt von links nach rechts):</p>
<pre>[Wurzel] + [Blatt 1, Ebene 1] + [Blatt 1, Ebene 2] + [Blatt 1, Ebene 3]
         |                    |                    ` [Blatt 2, Ebene 3]
         |                    ` [Blatt 2, Ebene 1] + [Blatt 3, Ebene 3]
         |                                         ` [Blatt 4, Ebene 3]
         `[Blatt 2, Ebene 1] + [Blatt 3, Ebene 2] + [Blatt 5, Ebene 3]
                             |                    ` [Blatt 2, Ebene 3]
                              ` [Blatt 2, Ebene 1] + [Blatt 3, Ebene 3]
                                                    ` [Blatt 4, Ebene 3]</pre>
<p><span id="more-465"></span></p>
<p>Wir zeichnen also bei jeder Verzweigung ein Plus, dann den Namen des Blattes und immer so weiter, bis ein Blatt erreicht ist, dass sich nicht mehr verzweigt. Dann wird eine neue Zeile begonnen und so lange unter jedes Plus ein &#8220;|&#8221; geschrieben, bis man wieder auf dem Level angelangt ist, zu dem das Blatt gehört. Soweit so gut, ist ja nicht so komplex.</p>
<p>Die Probleme fingen bei mir an, als ich diese Idee in Code umsetzen musste: Ich hatte eine Liste mit Objektinstanzen, aus denen ein Baum generiert werden sollte.</p>
<p>Jedes Objekt hatte drei für die Ausgabe relevante Attribute:</p>
<pre>Objekt* child1; <span style="color: #339966;">//Der Pointer auf das erste Blatt dieser Objektinstanz</span>
Objekt* child2; <span style="color: #339966;">//Der Pointer auf das zweite Blatt dieser Objektinstanz</span>
string name; <span style="color: #339966;">// Der Name dieser Objektinstanz
//Die Pointer beziehen sich jeweils auf andere, in der Liste vorhandene Instanzen.</span></pre>
<p>Also hatte ich folgende fixe Idee: Ich baue in das Objekt eine Funktion ein, die mir den String zusammenbastelt und sich, um die Verschachtelung darzustellen, wieder selbst aufruft. Damit muss ich nicht festhalten, welche Information von welchem Blatt nun ausgegeben werden soll. Fassen wir diese Idee in Pseudo-Pseudocode zusammen:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># Die Funktion erhält eine Liste, in der jeder Index eine Zeile symbolisiert</span>
<span style="color: #808080; font-style: italic;"># Zeile 1 also Index 0 usw...</span>
<span style="color: #ff7700;font-weight:bold;">def</span> generate_tree <span style="color: black;">&#40;</span>list_of_strings<span style="color: black;">&#41;</span>:
 <span style="color: #808080; font-style: italic;"># An die aktuelle Zeile den Namen unseres Blattes dranhängen</span>
 list_of_strings.<span style="color: black;">back</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">append</span><span style="color: black;">&#40;</span> name <span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Wenn unser Objekt ein Kind hat, dann müssen wir ein </span>
<span style="color: #808080; font-style: italic;"># Plus dranhängen und die Rekursion anstoßen.</span>
<span style="color: #808080; font-style: italic;"># Die Unterscheidung ob &quot;+&quot; oder &quot;-&quot; ist nicht notwendig, </span>
<span style="color: #808080; font-style: italic;"># sieht aber am Ende schicker aus:</span>
 <span style="color: #ff7700;font-weight:bold;">if</span> has_child1:
  <span style="color: #ff7700;font-weight:bold;">if</span> has_child2:
   list_of_strings.<span style="color: black;">back</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">append</span><span style="color: black;">&#40;</span> <span style="color: #483d8b;">&quot;+&quot;</span> <span style="color: black;">&#41;</span>
  <span style="color: #ff7700;font-weight:bold;">else</span>:
   list_of_strings.<span style="color: black;">back</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;-&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;"># Hiermit starten wir die Rekursion</span>
  <span style="color: #808080; font-style: italic;"># Das Folgende soll einen Memberaufruf symbolisieren :)</span>
  child1.<span style="color: black;">generate_tree</span><span style="color: black;">&#40;</span> list_of_strings <span style="color: black;">&#41;</span>
&nbsp;
 <span style="color: #ff7700;font-weight:bold;">if</span> has_child2: <span style="color: #808080; font-style: italic;"># Ein Objekt kann ja bis zu zwei Kinder haben</span>
  buffer = <span style="color: #483d8b;">&quot;&quot;</span> <span style="color: #808080; font-style: italic;">#Einen Buffer anlegen</span>
  <span style="color: #808080; font-style: italic;"># Die Position des letzten Plusses rausfinden</span>
  p = list_of_strings.<span style="color: black;">back</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">find_last_of</span><span style="color: black;">&#40;</span> <span style="color: #483d8b;">&quot;+&quot;</span> <span style="color: black;">&#41;</span> 
  <span style="color: #808080; font-style: italic;"># Die Position des letzten Strichs rausfinden</span>
  k = list_of_strings.<span style="color: black;">back</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">find_last_of</span><span style="color: black;">&#40;</span> <span style="color: #483d8b;">&quot;|&quot;</span> <span style="color: black;">&#41;</span> 
&nbsp;
  <span style="color: #ff7700;font-weight:bold;">if</span> p <span style="color: #66cc66;">&lt;</span> k: <span style="color: #808080; font-style: italic;">#Den höheren Wert der beiden müssen wir nehmen</span>
   p = k
&nbsp;
<span style="color: #808080; font-style: italic;"># Von 0 bis p in Einerschritten durchgehen</span>
  <span style="color: #ff7700;font-weight:bold;">for</span> i=<span style="color: #ff4500;">0</span> | i <span style="color: #66cc66;">&lt;</span>= p | i++
   <span style="color: #ff7700;font-weight:bold;">if</span> i <span style="color: #66cc66;">&lt;</span> p:
    <span style="color: #ff7700;font-weight:bold;">if</span> list_of_strings.<span style="color: black;">back</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span> == <span style="color: #483d8b;">&quot;+&quot;</span> <span style="color: #ff7700;font-weight:bold;">or</span> list_of_strings.<span style="color: black;">back</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span> == <span style="color: #483d8b;">&quot;|&quot;</span>:
     buffer.<span style="color: black;">append</span><span style="color: black;">&#40;</span> <span style="color: #483d8b;">&quot;|&quot;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">else</span>:
     buffer.<span style="color: black;">append</span><span style="color: black;">&#40;</span> <span style="color: #483d8b;">&quot; &quot;</span> <span style="color: black;">&#41;</span>
   <span style="color: #ff7700;font-weight:bold;">else</span> <span style="color: #ff7700;font-weight:bold;">if</span> i == p:
    buffer.<span style="color: black;">append</span><span style="color: black;">&#40;</span> <span style="color: #483d8b;">&quot;`&quot;</span> <span style="color: black;">&#41;</span>
&nbsp;
  list_of_strings.<span style="color: black;">append</span><span style="color: black;">&#40;</span> buffer <span style="color: black;">&#41;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;"># Wieder eine Rekursion starten</span>
  <span style="color: #808080; font-style: italic;"># Das ist auch ein Memberaufruf</span>
  child2.<span style="color: black;">generate_tree</span><span style="color: black;">&#40;</span> list_of_strings <span style="color: black;">&#41;</span>
<span style="color: #808080; font-style: italic;"># ENDE der Funktion</span></pre></td></tr></table></div>

<p>So&#8230;diese Zeilen verlangen ein wenig nach Erklärung:<br />
Zeile 1: Wir hängen den Namen des Blattes an das letzte Element in der Liste dran. Es ist egal ob die aktuelle Instanz jetzt Wurzel ist oder nicht. Wichtig ist nur, dass die übergebene Liste nicht leer ist. Dafür muss beim Aufruf der Funktion beim Wurzelelement gesorgt sein.</p>
<p>Zeile 11-15: Hier wird nur unterschieden, ob die aktuelle Instanz ein oder zwei Blätter hat und dementsprechend das Verbindungszeichen gewählt</p>
<p>Zeile 19/20: Hier wird die Funktion <em>generate_tree</em> bei dem ersten Kind aufgerufen, mit Übergabe der auch von dieser Funktion verwendeten Liste. Dadurch ist gewährleistet, dass alle ersten Kinder des jeweils vorhergehenden Blatts in einer Zeile stehen.</p>
<p>Zeile 21: Nun ist die Funktion für das erste Kind durchgelaufen, wenn es ein zweites Kind gibt, wird es nun etwas schwieriger, einen String zusammenzubauen.</p>
<p>Zeile 22-26: Es wird ein Puffer angelegt (er wird am Ende die neue Zeile enthalten, die wir zusammengebaut haben), der Index des letzten Plusses und der Index des letzten senkrechten Striches herausgefunden. Zur Erinnerung: Striche sollten die Verzweigung über mehrere Zeilen hinweg kenntlich machen. Plusse sollten zeigen, dass dieses Blatt mehr als ein Kind hat.</p>
<p>Zeile 28-Ende: Die Zuweisung in Zeile 29 macht nur Sinn, wenn man sich die for-Schleife danach anschaut. Wir gehen jeden einzelnen Index der letzten Zeile in der Liste bis <em>p</em> durch. <em>p</em> ist der Index des letzten Plusses/letzten Striches, je nachdem welcher Index höher ist. Solange <em>i &lt; p </em> gilt, wird unter jeden Strich/jedes Plus ein weiterer Strich gehängt (indem man dieses Zeichen an den Puffer hängt). Haben wir <em>p</em> erreicht, so wird ein &#8220;`&#8221; an den Puffer gehängt, weil jetzt endlich der Name des zweiten Kindes kommen kann.<br />
Dazu hängen wir den Buffer an die Liste dran (er symbolisiert ja eine neue Zeile) und rufen <em>generate_tree</em> bei dem zweiten Kind auf, mit unserer Liste als Parameter.</p>
<p style="text-align: center;">&#8212;&#8211;</p>
<p style="text-align: left;">Eine Implementierung dieses Algorithmus in C++ könnte folgendermaßen aussehen: <a title="Beispiel-Implementierung" href="http://adrian.holfter.de/blog/wp-content/uploads/2011/04/objekt_de.cpp">*klick*</a></p>
<p>Die Funktion funktioniert allerdings nur unter zwei Bedingungen:</p>
<ul>
<li>Verwendung eines Monospace-Fonts bei der Ausgabe</li>
<li>Die übergebene Liste ist beim Aufruf der Funktion beim Wurzelelement NICHT leer. Sie muss mindestens einen leeren String enthalten.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://adrian.holfter.de/blog/2011/04/binarbaum-zeichnen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unser Blog wird bilingual</title>
		<link>http://adrian.holfter.de/blog/2011/04/unser-blog-wird-bilingual/</link>
		<comments>http://adrian.holfter.de/blog/2011/04/unser-blog-wird-bilingual/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 14:53:00 +0000</pubDate>
		<dc:creator>ADI64</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[bilingual]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[zu viel Zeit]]></category>

		<guid isPermaLink="false">http://adrian.holfter.de/blog/?p=462</guid>
		<description><![CDATA[Man werfe einen kleinen Blick auf die Leiste rechts &#8211; da ist ja ein Sprachwähler! Da ich in der nächsten Zeit nicht allzu viel zu tun habe, habe ich beschlossen, den Blog zweisprachig werden zu lassen. Wichtige und große Artikel und Seiten sollen relativ schnell übersetzt werden, kleinere kommen dann irgendwann. Das Ziel ist, dass [...]]]></description>
			<content:encoded><![CDATA[<p>Man werfe einen kleinen Blick auf die Leiste rechts &#8211; da ist ja ein Sprachwähler!</p>
<p>Da ich in der nächsten Zeit nicht allzu viel zu tun habe, habe ich beschlossen, den Blog zweisprachig werden zu lassen. Wichtige und große Artikel und Seiten sollen relativ schnell übersetzt werden, kleinere kommen dann irgendwann.</p>
<p>Das Ziel ist, dass der Blog nicht nur deutschsprachigen Menschen weiterhilft, sondern auch den ganzen Rest da draußen erreichen kann. Wir sind ja nicht nur zum Amusement hier <img src='http://adrian.holfter.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://adrian.holfter.de/blog/2011/04/unser-blog-wird-bilingual/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

