<?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>mgBlog</title>
	<atom:link href="http://mgsimon.de/feed/" rel="self" type="application/rss+xml" />
	<link>http://mgsimon.de</link>
	<description>Esc(ape), einfach ein anderes Blog über technische Spielerei ...</description>
	<lastBuildDate>Mon, 11 Feb 2013 11:18:42 +0000</lastBuildDate>
	<language>de-DE</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>V8, JavaScript Shell unter Ubuntu</title>
		<link>http://mgsimon.de/2013/01/06/v8-javascript-shell-unter-ubuntu/</link>
		<comments>http://mgsimon.de/2013/01/06/v8-javascript-shell-unter-ubuntu/#comments</comments>
		<pubDate>Sun, 06 Jan 2013 16:13:38 +0000</pubDate>
		<dc:creator>mg</dc:creator>
				<category><![CDATA[Linux & Unix]]></category>
		<category><![CDATA[uup]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[V8]]></category>

		<guid isPermaLink="false">http://mgsimon.de/?p=3718</guid>
		<description><![CDATA[JavaScript eine nicht zu untersch&#228;tzende Interpretersprache. Installiert in so gut wie jedem g&#228;ngigen Browser findet mittlerweile nach und nach den Weg zur&#252;ck zum Server. Ein kurzer Versuch &#8220;JavaScript / V8&#8243; unter Linux nativ in der Shell laufen zu lassen kurz notiert &#8230; V8 Quellen $ sudo apt-get install git git-svn subversion $ git clone git://github.com/v8/v8.git [...]]]></description>
				<content:encoded><![CDATA[<p>JavaScript eine nicht zu untersch&#228;tzende Interpretersprache. Installiert in so gut wie jedem g&#228;ngigen Browser findet mittlerweile nach und nach den Weg zur&#252;ck zum Server. </p>
<div id="attachment_3742" class="wp-caption alignnone" style="width: 452px"><img src="http://mgsimon.de/wp-content/uploads/2013/01/JavaScript_Shell_V8.png" alt="JavaScript Shell :: V8" width="442" height="283" class="size-full wp-image-3742 stamp" /><p class="wp-caption-text">JavaScript Shell :: V8</p></div>
<p>Ein kurzer Versuch &#8220;JavaScript / V8&#8243; unter Linux nativ in der Shell laufen zu lassen kurz notiert &#8230;</p>
<p><span id="more-3718"></span><div style="background-color: rgb(191, 228, 255); border:1px solid rgb(128, 201, 255); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/info.png" alt="Hinweis" title="Hinweis" width="24" height="24" style="margin: 4px 8px 0 0; float:left;"/>Das folgende Beispiel wurde unter Ubuntu 12.10 (Quantal Quetzal) <strong>64-bit</strong> durchgef&#252;hrt.</div></p>
<p><strong>V8 Quellen</strong></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get install</span> <span style="color: #c20cb9; font-weight: bold;">git</span> <span style="color: #c20cb9; font-weight: bold;">git-svn</span> subversion
$ <span style="color: #c20cb9; font-weight: bold;">git clone</span> git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>v8<span style="color: #000000; font-weight: bold;">/</span>v8.git v8</pre></td></tr></table></div>

<p><strong>V8 Vorbereiten</strong></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> v8
$ <span style="color: #c20cb9; font-weight: bold;">make</span> dependencies</pre></td></tr></table></div>

<p><strong>V8 Bauen</strong></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get install</span> <span style="color: #c20cb9; font-weight: bold;">g++</span>
$ <span style="color: #c20cb9; font-weight: bold;">make</span> native</pre></td></tr></table></div>

<p><strong>V8 Testen</strong></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666;">$ </span>out<span style="color: #000000; font-weight: bold;">/</span>native<span style="color: #000000; font-weight: bold;">/</span>shell</pre></td></tr></table></div>

<p><strong>V8 Hello World</strong></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;">V8 version 3.16.2 <span style="color: #009900;">&#40;</span>candidate<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#91;</span>sample shell<span style="color: #009900;">&#93;</span>
<span style="color: #339933;">&gt;</span> print<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Hello World!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Hello World<span style="color: #339933;">!</span></pre></td></tr></table></div>

<p>L&#228;uft und wer noch mehr will &#8230;</p>
<div style="background-color: rgb(191, 255, 191); border:1px solid rgb(128, 255, 128); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/tip.png" alt="Tipp" title="Tipp" width="24" height="24" style="margin: 4px 8px 0 0; float:left;" />Buchtipp <a href="http://www.amazon.de/dp/B008UCNLII/ref=nosim?tag=mgs-21">JavaScript f&#252;r Enterprise-Entwickler: Professionell programmieren im Browser und auf dem Server</a>.</div>
]]></content:encoded>
			<wfw:commentRss>http://mgsimon.de/2013/01/06/v8-javascript-shell-unter-ubuntu/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Android Development Tools Bundle unter Ubuntu 64-bit</title>
		<link>http://mgsimon.de/2012/12/31/android-development-tools-bundle-unter-ubuntu-64-bit/</link>
		<comments>http://mgsimon.de/2012/12/31/android-development-tools-bundle-unter-ubuntu-64-bit/#comments</comments>
		<pubDate>Mon, 31 Dec 2012 13:30:39 +0000</pubDate>
		<dc:creator>mg</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux & Unix]]></category>
		<category><![CDATA[uup]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://mgsimon.de/?p=3697</guid>
		<description><![CDATA[Mittlerweile kann ein Linux-Bundle (http://developer.android.com/) f&#252;r den schnellen Einstieg in die Android Programmierung heruntergeladen werden. Einfach auspacken, starten und loslegen &#8230; &#8230; geht leider nicht. Entweder man installiert eine Entwicklungsumgebung unter Linux f&#252;r Android manuell &#8220;Hello World Android unter Linux&#8221; oder mit einem kleinem Workaround das Bundle &#8230; Problem Die angepasste Entwicklungsumgebung &#8220;adt-bundle-linux-x86_64/eclipse/eclipse&#8221; startet mit [...]]]></description>
				<content:encoded><![CDATA[<p>Mittlerweile kann ein <a href="http://developer.android.com/sdk/index.html">Linux-Bundle (http://developer.android.com/)</a> f&#252;r den schnellen Einstieg in die Android Programmierung heruntergeladen werden. Einfach auspacken, starten und loslegen &#8230;</p>
<div id="attachment_3699" class="wp-caption alignnone" style="width: 452px"><img src="http://mgsimon.de/wp-content/uploads/2012/12/ADT_Bundle_adb_Unexpected_exception.png" alt="ADT Bundle :: adb Unexpected exception" width="442" height="138" class="size-full wp-image-3699 stamp" /><p class="wp-caption-text">ADT Bundle :: adb Unexpected exception</p></div>
<p>&#8230; geht leider nicht.</p>
<p>Entweder man installiert eine Entwicklungsumgebung unter Linux f&#252;r Android manuell <a href="http://mgsimon.de/2009/12/19/hello-world-android-unter-linux/" title="Hello World Android unter Linux">&#8220;Hello World Android unter Linux&#8221;</a> oder mit einem kleinem Workaround das Bundle &#8230;</p>
<p><span id="more-3697"></span><div style="background-color: rgb(191, 228, 255); border:1px solid rgb(128, 201, 255); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/info.png" alt="Hinweis" title="Hinweis" width="24" height="24" style="margin: 4px 8px 0 0; float:left;"/>Das folgende Beispiel wurde unter Ubuntu 12.10 (Quantal Quetzal) <strong>64-bit</strong> durchgef&#252;hrt.</div></p>
<p><strong>Problem</strong></p>
<p>Die angepasste Entwicklungsumgebung &#8220;adt-bundle-linux-x86_64/eclipse/eclipse&#8221; startet mit der Fehlermeldung &#8220;Unexpected exception &#8216;Cannot run program &#8230; adb &#8230;&#8221;.</p>
<p>Das Programm &#8220;adb&#8221; (Android Debug Bridge) befindet sich wie in der Fehlermeldung angezeigt im Unterverzeichnis &#8220;sdk/platform-tools&#8221; und kann auch aus der Shell heraus nicht gestartet werden.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>adb
bash: .<span style="color: #000000; font-weight: bold;">/</span>adb: Datei oder Verzeichnis nicht gefunden</pre></td></tr></table></div>

<p>Die &#220;berpr&#252;fung mit &#8220;file&#8221; zeigt ein &#8220;32-bit executable&#8221; an.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">file</span> adb
adb: ELF <span style="color: #000000;">32</span>-bit LSB executable, Intel <span style="color: #000000;">80386</span>, version <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>SYSV<span style="color: #7a0874; font-weight: bold;">&#41;</span>, dynamically linked <span style="color: #7a0874; font-weight: bold;">&#40;</span>uses shared libs<span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000; font-weight: bold;">for</span> GNU<span style="color: #000000; font-weight: bold;">/</span>Linux 2.6.8, not stripped</pre></td></tr></table></div>

<p><strong>L&#246;sung</strong></p>
<p>Damit &#8220;adb&#8221; in der 32-bit Version unter Ubuntu <strong>64-bit</strong> funktioniert m&#252;ssen die 32-bit Bibliotheken installiert werden.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666;">$ </span><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get install</span> ia32-libs</pre></td></tr></table></div>

<p>Nach der Installation startet die Entwicklungsumgebung Eclipse und in der Shell &#8220;adb&#8221; ohne Fehlermeldung.</p>
<p><strong>Beispiel</strong></p>
<p>Umfangreiche Beispiele k&#246;nnen mit dem Android SDK Manger &#252;ber &#8220;Window / Android SDK Manager / Samples for SDK&#8221; nachinstalliert werden.</p>
<div id="attachment_3708" class="wp-caption alignnone" style="width: 452px"><img src="http://mgsimon.de/wp-content/uploads/2012/12/ADT_Bundle_Android_SDK_Manager.png" alt="ADT Bundle :: Android SDK Manager" width="442" height="318" class="size-full wp-image-3708 stamp" /><p class="wp-caption-text">ADT Bundle :: Android SDK Manager</p></div>
<p>Wenn erst einmal die zus&#228;tzlichen Beispiele installiert sind, k&#246;nnen leicht &#252;ber &#8220;File / New / Project&#8230; / Android Sample Project&#8221; aus einer umfangreichen Sammlung Android Projekte erstellt werden.</p>
<div id="attachment_3727" class="wp-caption alignnone" style="width: 452px"><img src="http://mgsimon.de/wp-content/uploads/2012/12/ADT_Bundle_New_Android_Sample_Project.png" alt="ADT Bundle :: New Android Sample Project" width="442" height="417" class="size-full wp-image-3727 stamp" /><p class="wp-caption-text">ADT Bundle :: New Android Sample Project</p></div>
<p>Das Beispielprojekt kann anschlie&#223;end &#252;ber das Kontextmen&#252; &#8220;Run As / Android Application&#8221; im Emulator gestartet werden.</p>
<div id="attachment_3728" class="wp-caption alignnone" style="width: 452px"><img src="http://mgsimon.de/wp-content/uploads/2012/12/AVD_Beispielprojekt_LunarLander.png" alt="AVD :: Beispielprojekt LunarLander" width="442" height="604" class="size-full wp-image-3728 stamp" /><p class="wp-caption-text">AVD :: Beispielprojekt LunarLander</p></div>
<p>Und schon funktioniert es auch mit dem Bundle unter Ubuntu <strong>64-bit</strong> &#8230; eigentlich soll ja immer alles leichter werden, wenn da nicht immer die Ausnahmen w&#228;ren. :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://mgsimon.de/2012/12/31/android-development-tools-bundle-unter-ubuntu-64-bit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Filme unter Ubuntu f&#252;r das Google Nexus 7 konvertieren</title>
		<link>http://mgsimon.de/2012/12/26/filme-unter-ubuntu-fur-das-google-nexus-7-konvertieren/</link>
		<comments>http://mgsimon.de/2012/12/26/filme-unter-ubuntu-fur-das-google-nexus-7-konvertieren/#comments</comments>
		<pubDate>Wed, 26 Dec 2012 08:47:08 +0000</pubDate>
		<dc:creator>mg</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux & Unix]]></category>
		<category><![CDATA[Mobil]]></category>
		<category><![CDATA[uup]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://mgsimon.de/?p=3635</guid>
		<description><![CDATA[Das Tablet Nexus 7 von Google hat eine ordentliche Aufl&#246;sung aber daf&#252;r etwas wenig Speicher. Um den einen oder anderen Film unterwegs ansehen zu k&#246;nnen, m&#252;ssen die Filme zuvor in das richtige Format konvertiert werden. Erste Versuche unter Ubuntu das richtige Format &#8211; zwischen Quantit&#228;t und Qualit&#228;t &#8211; zu erstellen &#8230; Filme k&#246;nnen unter Ubuntu [...]]]></description>
				<content:encoded><![CDATA[<p>Das Tablet Nexus 7 von Google hat eine ordentliche Aufl&#246;sung aber daf&#252;r etwas wenig Speicher. Um den einen oder anderen Film unterwegs ansehen zu k&#246;nnen, m&#252;ssen die Filme zuvor in das richtige Format konvertiert werden.  </p>
<div id="attachment_3642" class="wp-caption alignnone" style="width: 452px"><img src="http://mgsimon.de/wp-content/uploads/2012/12/GoogleVideoPlayerFail.png" alt="Google Video Player :: Fail" width="442" height="276" class="size-full wp-image-3642 stamp" /><p class="wp-caption-text">Google Video Player :: Fail</p></div>
<p>Erste Versuche unter Ubuntu das richtige Format &#8211; zwischen Quantit&#228;t und Qualit&#228;t &#8211; zu erstellen &#8230;</p>
<p><span id="more-3635"></span><div style="background-color: rgb(191, 228, 255); border:1px solid rgb(128, 201, 255); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/info.png" alt="Hinweis" title="Hinweis" width="24" height="24" style="margin: 4px 8px 0 0; float:left;"/>Das folgende Beispiel wurde unter Ubuntu 12.10 (Quantal Quetzal) durchgef&#252;hrt und auf einem Nexus 7 von Google getestet.</div></p>
<p>Filme k&#246;nnen unter Ubuntu u.a. mit der Software HandBrake in verschiedene Formate konvertiert werden. Die aktuellste Version kann im Terminal nach hinzuf&#252;gen des Pakets durch &#8220;apt&#8221; installiert werden.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> apt-add-repository ppa:stebbins<span style="color: #000000; font-weight: bold;">/</span>handbrake-releases
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get update</span>
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get install</span> handbrake-gtk</pre></td></tr></table></div>

<p>Nach erfolgreicher Installation befindet sich HandBrake im Starter und bietet umfangreiche Einstellungsm&#246;glichkeiten an.</p>
<div id="attachment_3651" class="wp-caption alignnone" style="width: 452px"><img src="http://mgsimon.de/wp-content/uploads/2012/12/UbuntuHandBrakeEncoding.png" alt="Ubuntu HandBrake :: Encoding" width="442" height="332" class="size-full wp-image-3651 stamp" /><p class="wp-caption-text">Ubuntu HandBrake :: Encoding</p></div>
<div style="background-color: rgb(191, 228, 255); border:1px solid rgb(128, 201, 255); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/info.png" alt="Hinweis" title="Hinweis" width="24" height="24" style="margin: 4px 8px 0 0; float:left;"/>Der 7&#8243;-Bildschirm des Nexus 7 von Google hat die Aufl&#246;sung 1280&#215;800-HD und das Betriebssystem Android 4.2.1 Jelly Bean unterst&#252;tzt die Video Codecs H.263, H.264 AVC, MPEG-4 SP, und VP8.</div>
<p>Folgende Formate werden empfohlen.<br />
<center><br />
<table>
<tr>
<th></th>
<th>SD (Low quality)</th>
<th>SD (High quality)</th>
<th>HD</th>
</tr>
<tr>
<th>Video codec</th>
<td>H.264</td>
<td>H.264</td>
<td>H.264</td>
</tr>
<tr>
<th>Video resolution</th>
<td>176 x 144 px</td>
<td>480 x 360 px</td>
<td>1280 x 720 px</td</tr>
<tr>
<th>Video frame rate</th>
<td>12 fps</td>
<td>30 fps</td>
<td>30 fps</td>
</tr>
<tr>
<th>Video bitrate</th>
<td>56 Kbps</td>
<td>500 Kbps</td>
<td>2 Mbps</td>
</tr>
<tr>
<th>Audio codec</th>
<td>AAC-LC</td>
<td>AAC-LC</td>
<td>AAC-LC</td>
</tr>
<tr>
<th>Audio channels</th>
<td>1 (mono)</td>
<td>2 (stereo)</td>
<td>2 (stereo)</td>
</tr>
<tr>
<th>Audio bitrate</th>
<td>24 Kbps</td>
<td>128 Kbps</td>
<td>192 Kbps</td>
</tr>
</table>
<p></center></p>
<p>Als Kompromiss zwischen Qualit&#228;t und Dateigr&#246;&#223;e habe ich folgende Einstellungen gew&#228;hlt.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">Video Encode: H.264
Framerate: 30
Bitrate (kbps): 500</pre></td></tr></table></div>

<p>Nach Auswahl der Quelle (Source) und des Titels (Title) kann die Konvertierung &#252;ber &#8220;Start&#8221; gestartet werden.</p>
<div style="background-color: rgb(191, 255, 191); border:1px solid rgb(128, 255, 128); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/tip.png" alt="Tipp" title="Tipp" width="24" height="24" style="margin: 4px 8px 0 0; float:left;" />Kann als Quelle eine DVD nicht verwendet werden, hilft der Artikel <a href="http://wiki.ubuntuusers.de/Codecs#DVD-Wiedergabe">DVD-Wiedergabe</a> (libdvdcss2) weiter.</div>
<p>Die Video-Dateien k&#246;nnen komfortabel durch <a href="https://play.google.com/store/apps/details?id=com.sand.airdroid">AirDroid</a> mit dem Browser auf das Tablet geladen werden.</p>
<div style="background-color: rgb(191, 255, 191); border:1px solid rgb(128, 255, 128); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/tip.png" alt="Tipp" title="Tipp" width="24" height="24" style="margin: 4px 8px 0 0; float:left;" />AirDroid nimmt nur Video-Dateien mit der Endung .mp4 oder .3gp an. Einfach die Dateien von .m4v in .mp4 umbenennen.</div>
<p>Die Filme sollten nach dem hinzuf&#252;gen auf dem Tablet in der Anwendung &#8220;Play Movies&#8221; unter &#8220;Meine Videos&#8221; zur Auswahl angezeigt werden &#8230;</p>
<div id="attachment_3676" class="wp-caption alignnone" style="width: 452px"><img src="http://mgsimon.de/wp-content/uploads/2012/12/PlayMoviesMeineVideos.png" alt="Play Movies :: Meine Videos" width="442" height="276" class="size-full wp-image-3676 stamp" /><p class="wp-caption-text">Play Movies :: Meine Videos</p></div>
<p>&#8230; und k&#246;nnen direkt abgespielt werden. :-)</p>
<p>Quellen:</p>
<ul>
<li><a href="http://support.google.com/nexus/bin/answer.py?hl=de&#038;answer=2667663&#038;topic=2841129&#038;ctx=topic">Nexus 7 Technische Daten</a></li>
<li><a href="http://developer.android.com/guide/appendix/media-formats.html">Android Supported Media Formats</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://mgsimon.de/2012/12/26/filme-unter-ubuntu-fur-das-google-nexus-7-konvertieren/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Ubuntu, Welcome back to the Mac</title>
		<link>http://mgsimon.de/2012/12/22/ubuntu-welcome-back-to-the-mac/</link>
		<comments>http://mgsimon.de/2012/12/22/ubuntu-welcome-back-to-the-mac/#comments</comments>
		<pubDate>Sat, 22 Dec 2012 16:10:09 +0000</pubDate>
		<dc:creator>mg</dc:creator>
				<category><![CDATA[Linux & Unix]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[uup]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MacOSX]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://mgsimon.de/?p=3541</guid>
		<description><![CDATA[Seit Ewigkeiten auf der Suche nach einem schnellen zuverl&#228;ssigen Linux Rechner bin ich nach einigen Fehlversuchen bei einem Mac h&#228;ngen geblieben. Auf die Frage, Ubuntu auf dem Mac zu installieren, dachte ich mir immer &#8211; so etwas macht man nicht. Mittlerweile nach langj&#228;hriger Benutzung verwende ich selten wenige native Anwendungen unter Mac OS X. Ein [...]]]></description>
				<content:encoded><![CDATA[<p>Seit Ewigkeiten auf der Suche nach einem schnellen zuverl&#228;ssigen Linux Rechner bin ich nach einigen Fehlversuchen bei einem Mac h&#228;ngen geblieben. Auf die Frage, Ubuntu auf dem Mac zu installieren, dachte ich mir immer &#8211; so etwas macht man nicht. Mittlerweile nach langj&#228;hriger Benutzung verwende ich selten wenige native Anwendungen unter Mac OS X. Ein Versuch nach langer Zeit doch mal wieder mit Linux / Ubuntu &#8230;</p>
<p><div id="attachment_3589" class="wp-caption alignnone" style="width: 452px"><img src="http://mgsimon.de/wp-content/uploads/2012/12/UbuntuDesktopMacBookPro.png" alt="Ubuntu Desktop / MacBook Pro :: Wenn der Apfel durchscheint ... :-)" width="442" height="276" class="size-full wp-image-3589 stamp" /><p class="wp-caption-text">Ubuntu Desktop / MacBook Pro :: Wenn der Apfel durchscheint &#8230; :-)</p></div><br />
<span id="more-3541"></span><div style="background-color: rgb(191, 228, 255); border:1px solid rgb(128, 201, 255); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/info.png" alt="Hinweis" title="Hinweis" width="24" height="24" style="margin: 4px 8px 0 0; float:left;"/>Das folgende Beispiel wurde mit Ubuntu 12.10 (Quantal Quetzal) auf einem Apple MacBook (MacBookPro7,1) durchgef&#252;hrt.</div></p>
<div style="background-color: rgb(191, 255, 191); border:1px solid rgb(128, 255, 128); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/tip.png" alt="Tipp" title="Tipp" width="24" height="24" style="margin: 4px 8px 0 0; float:left;" />Die Modellbezeichnung befindet sich auf Mac OS X unter &#8220;Apfel / &#220;ber diesen Mac / Weitere Informationen &#8230; / Modell-Identifizierung&#8221;.</div>
<p>Unter Linux kann die Modellbezeichnung mit folgendem Befehl in der Shell angezeigt werden.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> dmidecode <span style="color: #660033;">-s</span> system-product-name
MacBookPro7,<span style="color: #000000;">1</span></pre></td></tr></table></div>

<div style="background-color: rgb(255, 204, 191); border:1px solid rgb(255, 153, 128); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/warn.png" alt="Warnung" title="Warnung" width="24" height="24" style="margin: 4px 8px 0 0; float:left;" />Eine vollst&#228;ndige Datensicherung ist unbedingt erforderlich. Daten k&#246;nnen durch Ver&#228;nderung der Partition verloren gehen und das System k&#246;nnte unter Umst&#228;nden nicht mehr funktionieren!</div>
<p><strong>Vorbereitungen</strong></p>
<p><em>Datensicherung</em></p>
<p>Viele Wege f&#252;hren nach Rom, ich habe einfach eine Festplatte &#252;ber USB angeschlossen und mit Time Machine eine Vollsicherung erstellt.</p>
<p><em>Installationsmedium</em></p>
<p>Die .iso-Datei f&#252;r das Ubuntu Installationsmedium kann unter &#8220;<a href="http://www.ubuntu.com/download/desktop">Download Ubuntu for your desktop</a>&#8221; heruntergeladen werden. Mit einer leeren DVD kann das Medium durch das &#8220;Festplatten-Dienstprogramm&#8221; erstellt werden. </p>
<div id="attachment_3600" class="wp-caption alignnone" style="width: 452px"><img src="http://mgsimon.de/wp-content/uploads/2012/12/MacOSXFestplattenDienstprogrammInstallationsmedium.png" alt="Mac OS X Festplatten-Dienstprogramm :: Installationsmedium" width="442" height="335" class="size-full wp-image-3600 stamp" /><p class="wp-caption-text">Mac OS X Festplatten-Dienstprogramm :: Installationsmedium</p></div>
<p>Einfach die .iso-Datei hinzuf&#252;gen und selektieren. Anschlie&#223;end &#252;ber &#8220;Brennen&#8221; das Medium erstellen.</p>
<p><em>rEFIt</em></p>
<div style="background-color: rgb(191, 228, 255); border:1px solid rgb(128, 201, 255); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/info.png" alt="Hinweis" title="Hinweis" width="24" height="24" style="margin: 4px 8px 0 0; float:left;"/>Der Bootloader GRUB kann nicht direkt verwendet werden. Intel-Macs verwenden gegen&#252;ber handels&#252;blichen PCs EFI statt eines BIOS.  rEFIt kann die verschiedenen Betriebssysteme verwalten und auf dem Mac den Bootvorgang von Ubuntu einleiten, der dann schlie&#223;lich von GRUB vollendet wird.</div>
<p>rEFIt kann unter &#8220;<a href="http://refit.sourceforge.net/doc/c1s1_install.html">Installing rEFIt</a>&#8221; heruntergeladen werden und mit dem Standard-Installer unter Mac OS X installiert werden. </p>
<div id="attachment_3610" class="wp-caption alignnone" style="width: 452px"><img src="http://mgsimon.de/wp-content/uploads/2012/12/MacOSXrEFIt.png" alt="Mac OS X :: rEFIt" width="442" height="315" class="size-full wp-image-3610 stamp" /><p class="wp-caption-text">Mac OS X :: rEFIt</p></div>
<p><em>Partition</em></p>
<p>Eine Partition f&#252;r Ubuntu kann mit dem Festplatten-Dienstprogramm erstellt werden. Die vorhandene Partition nach Bedarf verkleiner und den Rest als freien Speicherplatz einrichten. </p>
<div id="attachment_3614" class="wp-caption alignnone" style="width: 452px"><img src="http://mgsimon.de/wp-content/uploads/2012/12/MacOSXFestplattenDienstprogrammPartitionieren.png" alt="Mac OS X Festplatten-Dienstprogramm :: Partitionieren" width="442" height="337" class="size-full wp-image-3614 stamp" /><p class="wp-caption-text">Mac OS X Festplatten-Dienstprogramm :: Partitionieren</p></div>
<p><strong>Installation</strong></p>
<div style="background-color: rgb(191, 255, 191); border:1px solid rgb(128, 255, 128); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/tip.png" alt="Tipp" title="Tipp" width="24" height="24" style="margin: 4px 8px 0 0; float:left;" />Eine Kabel gebundene Verbindung zum weltweiten Netz erleichtert die Installation, da Aktualisierungen und Treiber nachgeladen werden und drahtlose Verbindungen erst nach der Konfiguration funktionieren.</div>
<div style="background-color: rgb(255, 204, 191); border:1px solid rgb(255, 153, 128); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/warn.png" alt="Warnung" title="Warnung" width="24" height="24" style="margin: 4px 8px 0 0; float:left;" />Der Grafikkartentreiber funktioniert erst nach der Konfiguration. Die Bootoption &#8220;nomodeset&#8221; ist erforderlich, damit vorerst Ubuntu ohne NVIDIA-Treiber gestartet werden kann!</div>
<p>Das Ubuntu Installationsmedium einlegen und w&#228;hrend des n&#228;chsten Neustarts die Taste &#8220;c&#8221; gedr&#252;ckt halten bis von der DVD gestartet wird. Nach gew&#228;hlter Sprache die zus&#228;tzliche Bootoption &#252;ber F6 (Sonstiges) &#8220;nomodeset&#8221; ausw&#228;hlen. Durch &#8220;ESC&#8221; und &#8220;Eingabe&#8221; wird der erste Start von der CD eingeleitet.</p>
<p>Die Installation kann anschlie&#223;end &#252;ber &#8220;Ubuntu 12.10 installieren&#8221; gestartet werden (siehe auch <a href="http://wiki.ubuntuusers.de/Ubuntu_Installation">Ubuntu Installation</a>).</p>
<p>Nach erfolgreicher Installation wird das System neu gestartet. Linux (Ubuntu) wird vom neuen Bootmen&#252; rEFIt angeboten und sollte zur Konfiguration ausgew&#228;hlt werden.</p>
<p><strong>Konfiguration</strong></p>
<div style="background-color: rgb(255, 204, 191); border:1px solid rgb(255, 153, 128); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/warn.png" alt="Warnung" title="Warnung" width="24" height="24" style="margin: 4px 8px 0 0; float:left;" />Der Grafikkartentreiber funktioniert erst nach der Installation des propriet&#228;ren Treibers. Ein Starten im &#8220;Wiederherstellungsmodus&#8221; &#252;ber &#8220;Erweiterte Optionen f&#252;r Ubuntu&#8221; und anschlie&#223;endem &#8220;resume&#8221; ist erforderlich.</div>
<p><em>Aktualisierungen</em></p>
<p>Nach dem ersten Start sollten alle Aktualisierungen mit der Anwendung &#8220;Software-Aktualisierungen&#8221; installiert werden. Das System muss meistens anschlie&#223;end neu wie zuvor im &#8220;Wiederherstellungsmodus&#8221;  gestartet werden.</p>
<p><em>Treiber</em></p>
<div style="background-color: rgb(255, 204, 191); border:1px solid rgb(255, 153, 128); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/warn.png" alt="Warnung" title="Warnung" width="24" height="24" style="margin: 4px 8px 0 0; float:left;" />Das Paket &#8220;linux-header-generics&#8221; muss f&#252;r die propriet&#228;ren Treiber zuvor installiert werden.</div>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666;">$ </span><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get install</span> linux-headers-generic</pre></td></tr></table></div>

<p>Damit die Grafik und das Funknetzwerk funktioniert, m&#252;ssen die propriet&#228;ren Treiber &#8220;Broadcom&#8221; und &#8220;NVIDIA&#8221; unter &#8220;Software-Paketquellen / Zus&#228;tzliche Treiber&#8221; aktiviert werden.</p>
<div id="attachment_3580" class="wp-caption alignnone" style="width: 452px"><img src="http://mgsimon.de/wp-content/uploads/2012/12/Ubuntu_Konfiguration_Treiber.png" alt="Ubuntu Konfiguration :: Treiber" width="442" height="285" class="size-full wp-image-3580 stamp" /><p class="wp-caption-text">Ubuntu Konfiguration :: Treiber</p></div>
<p>Das System kann anschlie&#223;end &#8220;normal&#8221; mit besserer Aufl&#246;sung neu gestartet werden.</p>
<p><em>Touchpad</em></p>
<p>Damit das Touchpad &#228;hnliche Eigenschaften wie unter Mac OS X annimmt, einfach unter &#8220;Systemeinstellungen / Maus und Touchpad&#8221; die Option &#8220;Mausklicks per Touchpad freischalten&#8221; deaktivieren und die Option &#8220;Bildlauf mit zwei Fingern&#8221; aktivieren.</p>
<div id="attachment_3575" class="wp-caption alignnone" style="width: 452px"><img src="http://mgsimon.de/wp-content/uploads/2012/12/Ubuntu_Konfiguration_MausTouchpad.png" alt="Ubuntu Konfiguration :: Maus und Touchpad" width="442" height="260" class="size-full wp-image-3575 stamp" /><p class="wp-caption-text">Ubuntu Konfiguration :: Maus und Touchpad</p></div>
<p><em>Bildschirmhelligkeit</em></p>
<p>Durch die Installation des NVIDIA-Treibers funktioniert die Einstellung der Bildschirmhelligkeit &#252;ber die Funktionstasten &#8220;F1&#8243; und &#8220;F2&#8243; nicht.</p>
<p>Durch die zus&#228;tzliche manuelle Konfiguration in der Datei &#8220;/etc/X11/xorg.conf&#8221; folgender Zeile im Bereich &#8220;Screen&#8221; (siehe Zeile 10) funktioniert die Einstellung nach dem n&#228;chsten Neustart wieder.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">Option      &quot;RegistryDwords&quot; &quot;EnableBrightnessControl=1&quot;</pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666;">$ </span><span style="color: #c20cb9; font-weight: bold;">sudo</span> gedit <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>X11<span style="color: #000000; font-weight: bold;">/</span>xorg.conf</pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="text" style="font-family:monospace;">...
Section &quot;Screen&quot;
    Identifier     &quot;Screen0&quot;
    Device         &quot;Device0&quot;
    Monitor        &quot;Monitor0&quot;
    DefaultDepth    24
    SubSection     &quot;Display&quot;
        Depth       24
    EndSubSection
    Option      &quot;RegistryDwords&quot; &quot;EnableBrightnessControl=1&quot;
EndSection
...</pre></td></tr></table></div>

<p><strong>Fazit</strong></p>
<p>Ubuntu auf einem MacBook Pro ist schnell und bringt Spa&#223;, aber die Installation ist immer noch nicht ohne Probleme zu bewerkstelligen. Ich dachte Ubuntu w&#252;rde mittlerweile Erwachsen sein und eine Installation w&#252;rde reibungsloser ablaufen.</p>
<p><strong>siehe auch &#8230;</strong></p>
<ul>
<li><a href="https://help.ubuntu.com/community/MacBookPro7-1/Oneiric">MacBookPro7-1/Oneiric</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://mgsimon.de/2012/12/22/ubuntu-welcome-back-to-the-mac/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>&#8220;more&#8221; kann weniger als &#8220;less&#8221; &#8230;</title>
		<link>http://mgsimon.de/2012/08/26/more-kann-weniger-als-less/</link>
		<comments>http://mgsimon.de/2012/08/26/more-kann-weniger-als-less/#comments</comments>
		<pubDate>Sun, 26 Aug 2012 06:44:43 +0000</pubDate>
		<dc:creator>mg</dc:creator>
				<category><![CDATA[Linux & Unix]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[uup]]></category>
		<category><![CDATA[Cygwin]]></category>
		<category><![CDATA[less]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MacOSX]]></category>
		<category><![CDATA[more]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://mgsimon.de/?p=25</guid>
		<description><![CDATA[&#8220;more&#8221; und &#8220;less&#8221; sind Pager, um Textdateien in der Shell seitenweise anzeigen zu k&#246;nnen. Dabei bietet &#8220;less&#8221; wesentlich mehr als &#8220;more&#8221;. &#8230; &#8220;mehr&#8221; kann weniger als &#8220;weniger&#8221;, dabei ist oft weniger mehr. Ein Artikel ohne Mehrwert, aber was f&#252;r ein Wortspiel &#8230; :-)]]></description>
				<content:encoded><![CDATA[<p>&#8220;<a href="http://wiki.ubuntuusers.de/more" target="_blank">more</a>&#8221; und &#8220;<a href="http://wiki.ubuntuusers.de/less" target="_blank">less</a>&#8221; sind Pager, um Textdateien in der Shell seitenweise anzeigen zu k&#246;nnen. Dabei bietet &#8220;less&#8221; wesentlich <strong>mehr</strong> als &#8220;more&#8221;.</p>
<div id="attachment_3511" class="wp-caption alignnone" style="width: 452px"><img src="http://mgsimon.de/wp-content/uploads/2012/08/less.png" alt="less - Hilfe" title="less - Hilfe" width="442" height="277" class="size-full wp-image-3511 stamp" /><p class="wp-caption-text">less &#8211; Hilfe</p></div>
<p><span id="more-25"></span><div style="background-color: rgb(191, 255, 191); border:1px solid rgb(128, 255, 128); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/tip.png" alt="Tipp" title="Tipp" width="24" height="24" style="margin: 4px 8px 0 0; float:left;" />Mit &#8220;h&#8221; kann die umfangreiche Hilfe in &#8220;less&#8221; aufgerufen werden und wer einen guten Ersatz f&#252;r &#8220;tail -f&#8221; sucht, kann einfach mit &#8220;F&#8221; das gleiche Ergebnis unter &#8220;less&#8221; erreichen.</div></p>
<p><em>&#8230; &#8220;mehr&#8221; kann <strong>weniger</strong> als &#8220;weniger&#8221;</em>, dabei ist oft <strong>weniger</strong> <strong>mehr</strong>. </p>
<p>Ein Artikel ohne <strong>Mehr</strong>wert, aber was f&#252;r ein Wortspiel &#8230; :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://mgsimon.de/2012/08/26/more-kann-weniger-als-less/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Amazon Kindle 1-Click, Kindersicherung</title>
		<link>http://mgsimon.de/2012/08/19/amazon-kindle-1-click-kindersicherung/</link>
		<comments>http://mgsimon.de/2012/08/19/amazon-kindle-1-click-kindersicherung/#comments</comments>
		<pubDate>Sun, 19 Aug 2012 09:34:38 +0000</pubDate>
		<dc:creator>mg</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Mobil]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Kindle]]></category>
		<category><![CDATA[MacOSX]]></category>

		<guid isPermaLink="false">http://mgsimon.de/?p=3484</guid>
		<description><![CDATA[amazon.de hat mit der letzten Aktualisierung f&#252;r den Kindle die 1-Click Sicherheit durch eine Kindersicherung verbessert. Mit der Kindersicherung kann der Zugang zum weltweitem Netz, dem Archiv und dem Kindle-Shop eingeschr&#228;nkt werden. Einfach &#252;ber &#8220;Einstellungen&#8221; den Men&#252;punkt &#8220;Kindersicherung&#8221; ausw&#228;hlen und nach erstmaliger Passworteingabe k&#246;nnen die drei Funktionen ausschlie&#223;lich nach Eingabe des Passworts aktiviert oder deaktiviert [...]]]></description>
				<content:encoded><![CDATA[<p>amazon.de hat mit der letzten Aktualisierung f&#252;r den <a href="http://www.amazon.de/dp/B0051QVF7A/ref=nosim?tag=mgs-21">Kindle</a> die 1-Click Sicherheit durch eine Kindersicherung verbessert.</p>
<div style="background-color: rgb(191, 228, 255); border:1px solid rgb(128, 201, 255); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/info.png" alt="Hinweis" title="Hinweis" width="24" height="24" style="margin: 4px 8px 0 0; float:left;"/>Die Kindersicherung ist auf dem Amazon <a href="http://www.amazon.de/dp/B0051QVF7A/ref=nosim?tag=mgs-21">Kindle</a> (Version: Kindle 4.1.0.) und <strong>nicht</strong> in der Kindle Anwendung unter Android oder Mac OS X vorhanden.</div>
<div id="attachment_3487" class="wp-caption alignnone" style="width: 452px"><img src="http://mgsimon.de/wp-content/uploads/2012/08/AmazonKindleKindersicherung.jpg" alt="Amazon Kindle - Kindersicherung" title="Amazon Kindle - Kindersicherung" width="442" height="618" class="size-full wp-image-3487 stamp" /><p class="wp-caption-text">Amazon Kindle &#8211; Kindersicherung</p></div>
<p><span id="more-3484"></span>Mit der Kindersicherung kann der Zugang zum weltweitem Netz, dem Archiv und dem <strong>Kindle-Shop</strong> eingeschr&#228;nkt werden. Einfach &#252;ber &#8220;Einstellungen&#8221; den Men&#252;punkt &#8220;Kindersicherung&#8221; ausw&#228;hlen und nach erstmaliger Passworteingabe k&#246;nnen die drei Funktionen ausschlie&#223;lich nach Eingabe des Passworts aktiviert oder deaktiviert werden.</p>
<p>Dann kann man ja doch mal den <a href="http://www.amazon.de/dp/B0051QVF7A/ref=nosim?tag=mgs-21">Kindle</a> ohne &#8220;<a href="http://mgsimon.de/2011/10/16/amazon-kindle-1-click-benutzerfreundlichkeit-oder-sicherheitslucke/" title="Amazon Kindle 1-Click, Benutzerfreundlichkeit oder Sicherheitsl&#252;cke?">Frei-Shopping</a>&#8221; aus der Hand geben &#8230; :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://mgsimon.de/2012/08/19/amazon-kindle-1-click-kindersicherung/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Android und JSON, JSONViewer ein Beispiel</title>
		<link>http://mgsimon.de/2011/11/10/android-und-json-jsonviewer-ein-beispiel/</link>
		<comments>http://mgsimon.de/2011/11/10/android-und-json-jsonviewer-ein-beispiel/#comments</comments>
		<pubDate>Thu, 10 Nov 2011 07:47:31 +0000</pubDate>
		<dc:creator>mg</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Mobil]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[SDK]]></category>

		<guid isPermaLink="false">http://mgsimon.de/?p=3129</guid>
		<description><![CDATA[JSON wegen der Einfach- und Kompaktheit ideal f&#252;r die mobile Kommunikation, enth&#228;lt das SDK von Android einige Klassen der Referenzimplementierung. Ein kleines Beispiel kurz notiert &#8230; Kofiguration Im Manifest f&#252;r Android wird die Berechtigung f&#252;r den Zugriff auf das weltweite Netz (Zeile 7) konfiguriert. 1 2 3 4 5 6 7 8 9 10 11 [...]]]></description>
				<content:encoded><![CDATA[<p>JSON wegen der Einfach- und Kompaktheit ideal f&#252;r die mobile Kommunikation, enth&#228;lt das SDK von Android einige Klassen der Referenzimplementierung.<br />
<div id="attachment_3370" class="wp-caption alignnone" style="width: 452px"><img src="http://mgsimon.de/wp-content/uploads/2011/10/AndroidJSONViewer.png" alt="Android :: JSONViewer" title="Android :: JSONViewer" width="442" height="265" class="size-full wp-image-3370 stamp" /><p class="wp-caption-text">Android :: JSONViewer</p></div>Ein kleines Beispiel kurz notiert &#8230;</p>
<p><span id="more-3129"></span><div style="background-color: rgb(191, 228, 255); border:1px solid rgb(128, 201, 255); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/info.png" alt="Hinweis" title="Hinweis" width="24" height="24" style="margin: 4px 8px 0 0; float:left;"/>Das folgende Beispiel wurde unter Mac OS X 10.6.8 mit der Java Version 1.6.0_26, Eclipse EE 3.7.1 Indigo und ADT (Android Development Tools) Plugin f&#252;r Eclipse durchgef&#252;hrt. Siehe auch <a href="http://mgsimon.de/2009/12/19/hello-world-android-unter-linux/">Hello World Android unter Linux</a> …</div></p>
<p><strong>Kofiguration</strong></p>
<p>Im Manifest f&#252;r Android wird die Berechtigung f&#252;r den Zugriff auf das weltweite Netz (Zeile 7) konfiguriert.</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
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;manifest</span> <span style="color: #000066;">xmlns:android</span>=<span style="color: #ff0000;">&quot;http://schemas.android.com/apk/res/android&quot;</span></span>
<span style="color: #009900;">  <span style="color: #000066;">package</span>=<span style="color: #ff0000;">&quot;de.mgsimon.android.jsonviewer&quot;</span> <span style="color: #000066;">android:versionCode</span>=<span style="color: #ff0000;">&quot;1&quot;</span></span>
<span style="color: #009900;">  <span style="color: #000066;">android:versionName</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;uses-sdk</span> <span style="color: #000066;">android:minSdkVersion</span>=<span style="color: #ff0000;">&quot;8&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;uses-permission</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.permission.INTERNET&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;application</span> <span style="color: #000066;">android:icon</span>=<span style="color: #ff0000;">&quot;@drawable/icon&quot;</span> <span style="color: #000066;">android:label</span>=<span style="color: #ff0000;">&quot;@string/app_name&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;activity</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;.JSONViewerActivity&quot;</span> <span style="color: #000066;">android:label</span>=<span style="color: #ff0000;">&quot;@string/app_name&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;intent-filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;action</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.intent.action.MAIN&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.intent.category.LAUNCHER&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/intent-filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/activity<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/application<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/manifest<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p><em>JSONViewer/AndroidManifest.xml</em></p>
<p><strong>Layout</strong></p>
<p>Das Layout enth&#228;lt ein Eingabefeld (EditText) f&#252;r die URL, ein Button (ImageButton) zum abrufen der URL und ein mehrzeiliges Textfeld (TextView) zum anzeigen.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;RelativeLayout</span> <span style="color: #000066;">xmlns:android</span>=<span style="color: #ff0000;">&quot;http://schemas.android.com/apk/res/android&quot;</span></span>
<span style="color: #009900;">  <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span> <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;LinearLayout</span> <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/linearLayoutUrl&quot;</span> <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;match_parent&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;EditText</span> <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/editTextURL&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span> <span style="color: #000066;">android:singleLine</span>=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;0dp&quot;</span> <span style="color: #000066;">android:layout_weight</span>=<span style="color: #ff0000;">&quot;2&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;requestFocus<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/requestFocus<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/EditText<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ImageButton</span> <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/imageButtonLoad&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span> <span style="color: #000066;">android:src</span>=<span style="color: #ff0000;">&quot;@android:drawable/ic_media_play&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;0dp&quot;</span> <span style="color: #000066;">android:layout_weight</span>=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/ImageButton<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/LinearLayout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ScrollView</span> <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span> <span style="color: #000066;">android:layout_below</span>=<span style="color: #ff0000;">&quot;@+id/linearLayoutUrl&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">android:layout_margin</span>=<span style="color: #ff0000;">&quot;5dip&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;TextView</span> <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/textViewContent&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span> <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">android:textAppearance</span>=<span style="color: #ff0000;">&quot;?android:attr/textAppearanceMedium&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ScrollView<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/RelativeLayout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p><em>JSONViewer/res/layout/main.xml</em></p>
<p><strong>Activity</strong></p>
<p>Die Aktivit&#228;t JSONViewerActivity erweitert Activity (Zeile 26) und initialisiert notwendige Komponenten in der &#252;berschriebene Methode onCreate (Zeile 37). Referenzen zu Elementen des UI werden &#252;ber findViewById (Zeile 41,43 und 44) gesetzt und dem ImageButton (Zeile 45) wird die aufzurufende Methode f&#252;r das Event onClick (Zeile 48) &#252;berschrieben.</p>
<p>Die Methode onClick &#8211; aufgerufen durch Klick auf dem Button &#8211; startet mit &#252;bergebener URL (Zeile 50) einen Thread (Zeile 51). Die Klasse UrlLoadTask zeigt vor (Zeile 63) dem Thread einen Status an und aktualisiert die Aktivit&#228;t nach (Zeile 94) dem Thread. </p>
<p>Die Daten werden unabh&#228;ngig des Threads f&#252;r die Benutzeroberfl&#228;che in der Methode doInBackground (Zeile 69) verarbeitet.  </p>
<div style="background-color: rgb(191, 255, 191); border:1px solid rgb(128, 255, 128); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/tip.png" alt="Tipp" title="Tipp" width="24" height="24" style="margin: 4px 8px 0 0; float:left;" />Application not responding (ANR) Meldungen werden nach etwa drei Sekunden geworfen, wenn die Benutzeroberfl&#228;che blockiert wird. Alle langl&#228;ufigen und unbekannten Laufzeiten nebenl&#228;ufig ausf&#252;hren, dann klappt es auch ohne ANR.</div>
<p>Im Hintergrund herunterladen (Zeile 71-73), JSONObject erzeugen (Zeile 74) und die TextView aktualisieren (Zeile 97).</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
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">de.mgsimon.android.jsonviewer</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.IOException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.net.URI</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.net.URISyntaxException</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.http.HttpResponse</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.http.ParseException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.http.client.ClientProtocolException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.http.client.HttpClient</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.http.client.methods.HttpGet</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.http.impl.client.DefaultHttpClient</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.http.util.EntityUtils</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.json.JSONException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.json.JSONObject</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.app.Activity</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.app.ProgressDialog</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.os.AsyncTask</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.os.Bundle</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.View</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.EditText</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.ImageButton</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.TextView</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> JSONViewerActivity <span style="color: #000000; font-weight: bold;">extends</span> Activity <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">private</span> EditText mEditTextUrl<span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">private</span> ImageButton mImageButtonLoad<span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">private</span> TextView mTextViewContent<span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">private</span> URI mUri<span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">private</span> ProgressDialog mProgressDialog<span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #008000; font-style: italic; font-weight: bold;">/** Called when the activity is first created. */</span>
  @Override
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onCreate<span style="color: #009900;">&#40;</span>Bundle savedInstanceState<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onCreate</span><span style="color: #009900;">&#40;</span>savedInstanceState<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    setContentView<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">layout</span>.<span style="color: #006633;">main</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    mEditTextUrl <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>EditText<span style="color: #009900;">&#41;</span> findViewById<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">editTextURL</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    mEditTextUrl.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://mgsimon.appspot.com/aboutmyrequest&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    mTextViewContent <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>TextView<span style="color: #009900;">&#41;</span> findViewById<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">textViewContent</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    mImageButtonLoad <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>ImageButton<span style="color: #009900;">&#41;</span> findViewById<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">imageButtonLoad</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    mImageButtonLoad.<span style="color: #006633;">setOnClickListener</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">View</span>.<span style="color: #006633;">OnClickListener</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
      @Override
      <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onClick<span style="color: #009900;">&#40;</span><span style="color: #003399;">View</span> v<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
          mUri <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> URI<span style="color: #009900;">&#40;</span>mEditTextUrl.<span style="color: #006633;">getText</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #000000; font-weight: bold;">new</span> UrlLoadTask<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">execute</span><span style="color: #009900;">&#40;</span>mUri<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>URISyntaxException e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          mTextViewContent.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">class</span> UrlLoadTask <span style="color: #000000; font-weight: bold;">extends</span> AsyncTask<span style="color: #339933;">&lt;</span>URI, <span style="color: #003399;">Void</span>, JSONObject<span style="color: #339933;">&gt;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    @Override
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> onPreExecute<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      mProgressDialog <span style="color: #339933;">=</span> ProgressDialog.<span style="color: #006633;">show</span><span style="color: #009900;">&#40;</span>JSONViewerActivity.<span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #0000ff;">&quot;&quot;</span>,
          <span style="color: #0000ff;">&quot;Loading. Please wait...&quot;</span>, <span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    @Override
    <span style="color: #000000; font-weight: bold;">protected</span> JSONObject doInBackground<span style="color: #009900;">&#40;</span>URI... <span style="color: #006633;">uris</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
        HttpClient client <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DefaultHttpClient<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        HttpGet get <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HttpGet<span style="color: #009900;">&#40;</span>uris<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        HttpResponse response <span style="color: #339933;">=</span> client.<span style="color: #006633;">execute</span><span style="color: #009900;">&#40;</span>get<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        JSONObject jso <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JSONObject<span style="color: #009900;">&#40;</span>EntityUtils.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span>response
            .<span style="color: #006633;">getEntity</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span>jso<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>ClientProtocolException e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        mTextViewContent.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">IOException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        mTextViewContent.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">ParseException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        mTextViewContent.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>JSONException e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        mTextViewContent.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    @Override
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> onPostExecute<span style="color: #009900;">&#40;</span>JSONObject jso<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>jso <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
          mTextViewContent.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span>jso.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>JSONException e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        mTextViewContent.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
      mProgressDialog.<span style="color: #006633;">dismiss</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><em>JSONViewer/src/de.mgsimon.android.jsonviewer/JSONViewerActivity.java</em></p>
]]></content:encoded>
			<wfw:commentRss>http://mgsimon.de/2011/11/10/android-und-json-jsonviewer-ein-beispiel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Konfigurationsverwaltung mit RCS, dateibasierte Versionierungen</title>
		<link>http://mgsimon.de/2011/11/03/konfigurationsverwaltung-mit-rcs-dateibasierte-versionierungen/</link>
		<comments>http://mgsimon.de/2011/11/03/konfigurationsverwaltung-mit-rcs-dateibasierte-versionierungen/#comments</comments>
		<pubDate>Thu, 03 Nov 2011 19:24:37 +0000</pubDate>
		<dc:creator>mg</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux & Unix]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[uup]]></category>
		<category><![CDATA[Cygwin]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MacOSX]]></category>
		<category><![CDATA[RCS]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://mgsimon.de/?p=3318</guid>
		<description><![CDATA[Kennt man nicht die schnellen &#196;nderungen in der einen oder anderen Konfigurationsdatei? Und die immer mehr werdenden Sicherungskopien? configfile.bak configfile.201111031811 configfile.201111031815 configfile.mgsimon configfile&#8230; Wieso nicht mit einer einfachen Versionsverwaltung? Old school RCS ist auf so gut wie jedem Linux, Unix oder Mac OS X vorhanden &#8230; RCS Revision Control System (RCS) ist eine Versionierung f&#252;r [...]]]></description>
				<content:encoded><![CDATA[<p>Kennt man nicht die schnellen &#196;nderungen in der einen oder anderen Konfigurationsdatei? Und die immer mehr werdenden Sicherungskopien?</p>
<ul>
<li>configfile.bak</li>
<li>configfile.201111031811</li>
<li>configfile.201111031815</li>
<li>configfile.mgsimon</li>
<li>configfile&#8230;</li>
</ul>
<p>Wieso nicht mit einer einfachen Versionsverwaltung? Old school RCS ist auf so gut wie jedem Linux, Unix oder Mac OS X vorhanden &#8230;</p>
<p><span id="more-3318"></span><div style="background-color: rgb(191, 228, 255); border:1px solid rgb(128, 201, 255); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/info.png" alt="Hinweis" title="Hinweis" width="24" height="24" style="margin: 4px 8px 0 0; float:left;"/>Das folgende Beispiel wurde unter Mac OS X 10.6.8 mit der RCS Version 5.7 durchgef&#252;hrt.</div><strong>RCS</strong></p>
<p>Revision Control System (RCS) ist eine Versionierung f&#252;r einzelne Dateien. Dabei werden die Versionen mit einer zus&#228;tzlichen &#8220;,v-Datei&#8221; verwaltet. Ohne ein Repository k&#246;nnen beliebige Dateien schnell und einfach versioniert werden. Ideal zur Verwaltung verschiedener Konfigurationsst&#228;nde, ohne gleich jedes Mal eine manuelle Sicherungskopie erstellen zu m&#252;ssen.</p>
<div style="background-color: rgb(191, 255, 191); border:1px solid rgb(128, 255, 128); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/tip.png" alt="Tipp" title="Tipp" width="24" height="24" style="margin: 4px 8px 0 0; float:left;" />Die f&#252;r Windows frei verf&#252;gbare Unix Emulation <a href="http://www.cygwin.com/" target="_blank">Cygwin</a> unterst&#252;tzt RCS.</div>
<p><strong>Sicherung</strong></p>
<p>ohne RCS</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666;">$ </span><span style="color: #c20cb9; font-weight: bold;">cp</span> logging.properties logging.properties.201111031811</pre></td></tr></table></div>

<p>mit RCS</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">rcs</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-U</span> logging.properties
RCS file: logging.properties,v
enter description, terminated with single <span style="color: #ff0000;">'.'</span> or end of file:
NOTE: This is NOT the log message<span style="color: #000000; font-weight: bold;">!</span>
<span style="color: #000000; font-weight: bold;">&gt;&gt;</span> existing version
<span style="color: #000000; font-weight: bold;">&gt;&gt;</span> .
<span style="color: #000000; font-weight: bold;">done</span>
$ ci <span style="color: #660033;">-u</span> logging.properties
logging.properties,v  <span style="color: #000000; font-weight: bold;">&lt;</span>--  logging.properties
initial revision: <span style="color: #000000;">1.1</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

<div style="background-color: rgb(191, 255, 191); border:1px solid rgb(128, 255, 128); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/tip.png" alt="Tipp" title="Tipp" width="24" height="24" style="margin: 4px 8px 0 0; float:left;" />Damit die Zugriffsrechte erhalten bleiben und die aktuelle Arbeitskopie nicht gel&#246;scht wird immer erst eine initiale Version ohne &#8220;strict locking&#8221; (rcs -i -U datei) erstellen und anschlie&#223;end (ci -u datei) versionieren.</div>
<p><strong>Neue Konfiguration</strong></p>
<p>Gew&#252;nschte Anpassungen in der der aktuellen Datei vornehmen, speichern und sichern.</p>
<p>ohne RCS</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666;">$ </span><span style="color: #c20cb9; font-weight: bold;">cp</span> logging.properties logging.properties.201111031815</pre></td></tr></table></div>

<p>mit RCS</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">$ ci <span style="color: #660033;">-u</span> logging.properties
logging.properties,v  <span style="color: #000000; font-weight: bold;">&lt;</span>--  logging.properties
new revision: <span style="color: #000000;">1.2</span>; previous revision: <span style="color: #000000;">1.1</span>
enter log message, terminated with single <span style="color: #ff0000;">'.'</span> or end of file:
<span style="color: #000000; font-weight: bold;">&gt;&gt;</span> log <span style="color: #c20cb9; font-weight: bold;">more</span> startup messages
<span style="color: #000000; font-weight: bold;">&gt;&gt;</span> .
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

<p><strong>Versionshistorie</strong></p>
<p>ohne RCS</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">nicht wirklich möglich</pre></td></tr></table></div>

<p>mit RCS</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">$ rlog logging.properties
&nbsp;
RCS file: logging.properties,v
Working file: logging.properties
head: <span style="color: #000000;">1.2</span>
branch:
locks:
access list:
symbolic names:
keyword substitution: kv
total revisions: <span style="color: #000000;">2</span>;	selected revisions: <span style="color: #000000;">2</span>
description:
existing version
<span style="color: #660033;">----------------------------</span>
revision <span style="color: #000000;">1.2</span>
date: <span style="color: #000000;">2011</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">11</span><span style="color: #000000; font-weight: bold;">/</span>03 <span style="color: #000000;">18</span>:<span style="color: #000000;">46</span>:<span style="color: #000000;">57</span>;  author: mgsimon;  state: Exp;  lines: +<span style="color: #000000;">2</span> <span style="color: #660033;">-2</span>
log <span style="color: #c20cb9; font-weight: bold;">more</span> startup messages
<span style="color: #660033;">----------------------------</span>
revision <span style="color: #000000;">1.1</span>
date: <span style="color: #000000;">2011</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">11</span><span style="color: #000000; font-weight: bold;">/</span>03 <span style="color: #000000;">18</span>:<span style="color: #000000;">44</span>:<span style="color: #000000;">54</span>;  author: mgsimon;  state: Exp;
Initial revision
=============================================================================</pre></td></tr></table></div>

<p><strong>Ver&#228;nderungen</strong></p>
<p>ohne RCS</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">diff</span> logging.properties logging.properties.201111031811 
<span style="color: #000000;">61</span>,62c61,<span style="color: #000000;">62</span>
<span style="color: #000000; font-weight: bold;">&lt;</span> org.apache.catalina.startup.ContextConfig.level = FINE
<span style="color: #000000; font-weight: bold;">&lt;</span> org.apache.catalina.startup.HostConfig.level = FINE
<span style="color: #660033;">---</span>
<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #666666; font-style: italic;">#org.apache.catalina.startup.ContextConfig.level = FINE</span>
<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #666666; font-style: italic;">#org.apache.catalina.startup.HostConfig.level = FINE</span></pre></td></tr></table></div>

<p>mit RCS</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">$ rcsdiff logging.properties
===================================================================
RCS file: logging.properties,v
retrieving revision <span style="color: #000000;">1.2</span>
<span style="color: #c20cb9; font-weight: bold;">diff</span> -r1.2 logging.properties
mgBook:conf mgsimon$ rcsdiff -r1.1 logging.properties
===================================================================
RCS file: logging.properties,v
retrieving revision <span style="color: #000000;">1.1</span>
<span style="color: #c20cb9; font-weight: bold;">diff</span> -r1.1 logging.properties
<span style="color: #000000;">61</span>,62c61,<span style="color: #000000;">62</span>
<span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #666666; font-style: italic;">#org.apache.catalina.startup.ContextConfig.level = FINE</span>
<span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #666666; font-style: italic;">#org.apache.catalina.startup.HostConfig.level = FINE</span>
<span style="color: #660033;">---</span>
<span style="color: #000000; font-weight: bold;">&gt;</span> org.apache.catalina.startup.ContextConfig.level = FINE
<span style="color: #000000; font-weight: bold;">&gt;</span> org.apache.catalina.startup.HostConfig.level = FINE</pre></td></tr></table></div>

<p><strong>Alte Konfiguration</strong></p>
<p>ohne RCS</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666;">$ </span><span style="color: #c20cb9; font-weight: bold;">cp</span> logging.properties.201111031811 logging.properties</pre></td></tr></table></div>

<p>mit RCS</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">co</span> -r1.1 logging.properties
logging.properties,v  --<span style="color: #000000; font-weight: bold;">&gt;</span>  logging.properties
revision <span style="color: #000000;">1.1</span>
writable logging.properties exists; remove it? <span style="color: #7a0874; font-weight: bold;">&#91;</span>ny<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>n<span style="color: #7a0874; font-weight: bold;">&#41;</span>: y
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

<p><strong>Konfigurations&#228;nderungen</strong></p>
<p>ohne RCS</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">nicht wirklich möglich</pre></td></tr></table></div>

<p>mit RCS</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">find</span> conf<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-name</span> <span style="color: #000000; font-weight: bold;">*</span>,v
conf<span style="color: #000000; font-weight: bold;">//</span>catalina.properties,v
conf<span style="color: #000000; font-weight: bold;">//</span>context.xml,v
conf<span style="color: #000000; font-weight: bold;">//</span>logging.properties,v
conf<span style="color: #000000; font-weight: bold;">//</span>server.xml,v
conf<span style="color: #000000; font-weight: bold;">//</span>tomcat-users.xml,v
conf<span style="color: #000000; font-weight: bold;">//</span>web.xml,v</pre></td></tr></table></div>

<p><strong>Zusammenfassung</strong></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">rcs -i -U datei =&gt; ci -u datei =&gt; vi datei =&gt; ci -u datei =&gt; ...</pre></td></tr></table></div>

<p>Keep IT simple &#8230; ;)</p>
<p><strong>Weiter &#8230;</strong></p>
<ul>
<li><a href="http://www.gnu.org/software/rcs/manual/rcs.html">RCS Dokumentation</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://mgsimon.de/2011/11/03/konfigurationsverwaltung-mit-rcs-dateibasierte-versionierungen/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Google App Engine und JSON, AboutMyRequest ein Beispiel</title>
		<link>http://mgsimon.de/2011/10/30/google-app-engine-und-json-aboutmyrequest-ein-beispiel/</link>
		<comments>http://mgsimon.de/2011/10/30/google-app-engine-und-json-aboutmyrequest-ein-beispiel/#comments</comments>
		<pubDate>Sun, 30 Oct 2011 14:37:54 +0000</pubDate>
		<dc:creator>mg</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[App]]></category>
		<category><![CDATA[Engine]]></category>
		<category><![CDATA[GAE]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[Servlet]]></category>

		<guid isPermaLink="false">http://mgsimon.de/?p=3131</guid>
		<description><![CDATA[Die JavaScript Object Notation (JSON) ist ein leicht lesbares und leichtgewichtiges Protokoll, um Daten strukturiert mit wenigen Regeln verwalten zu k&#246;nnen. Viele Wege f&#252;hren nach JSON, hier ein kleines Beispiel in Java &#8230; AboutMyRequest &#8230; &#8230; oder einfach &#252;ber mein Request soll als kleines Beispiel die Informationen &#252;ber eine Anfrage zur Anwendung in der Google [...]]]></description>
				<content:encoded><![CDATA[<p>Die <a href="http://json.org/" target="_blank">JavaScript Object Notation (JSON)</a> ist ein leicht lesbares und leichtgewichtiges Protokoll, um Daten strukturiert mit wenigen Regeln verwalten zu k&#246;nnen.<br />
<div id="attachment_3262" class="wp-caption alignnone" style="width: 452px"><img src="http://mgsimon.de/wp-content/uploads/2011/10/GoogleAppEngineJSONAboutMyRequest.png" alt="Google App Engine JSON :: AboutMyRequest" title="Google App Engine JSON :: AboutMyRequest" width="442" height="228" class="size-full wp-image-3262 stamp" /><p class="wp-caption-text">Google App Engine JSON :: AboutMyRequest</p></div></p>
<p>Viele Wege f&#252;hren nach JSON, hier ein kleines Beispiel in Java &#8230;</p>
<p><span id="more-3131"></span><div style="background-color: rgb(191, 228, 255); border:1px solid rgb(128, 201, 255); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/info.png" alt="Hinweis" title="Hinweis" width="24" height="24" style="margin: 4px 8px 0 0; float:left;"/>Das folgende Beispiel wurde unter Mac OS X 10.6.8 mit der Java Version 1.6.0_26, Eclipse EE 3.7.1 Indigo und Google Plugin f&#252;r Eclipse 2.4.1 durchgef&#252;hrt. Siehe auch <a href="http://mgsimon.de/2011/10/25/hello-world-google-app-engine/" title="Hello World Google App Engine">Hello World Google App Engine</a> &#8230;</div></p>
<p><strong>AboutMyRequest &#8230;</strong></p>
<p>&#8230; oder einfach &#252;ber mein Request soll als kleines Beispiel die Informationen &#252;ber eine Anfrage zur Anwendung in der Google App Engine in JSON zur&#252;ck beantworten.</p>
<p><strong>JSON Referenzimplementierung</strong></p>
<p>Im SDK von der Google App Engine sind die Klassen der Referenzimplementierung zur Verarbeitung von JSON im Paket  com.google.appengine.repackaged.org.json (appengine-api-labs-1.5.4.jar) vorhanden.</p>
<div style="background-color: rgb(191, 255, 191); border:1px solid rgb(128, 255, 128); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/tip.png" alt="Tipp" title="Tipp" width="24" height="24" style="margin: 4px 8px 0 0; float:left;" />Damit die Dokumenation der Referenzimplementierung von Douglas Crockford in Eclipse verwendet werden kann, k&#246;nnen die Quellen unter <a href="https://github.com/douglascrockford/JSON-java" target="_blank">JSON-java</a> als ZIP-Archiv heruntergeladen werden und dem Projekt hinzugef&#252;gt werden.</div>
<p><strong>AboutMyRequestServlet</strong></p>
<p>Ein neues Servlet wird im Google App Engine Projekt bei selektiertem Package &#252;ber &#8220;File / New / Class&#8221; mit folgenden Einstellungen erstellt.<br />
<div id="attachment_3271" class="wp-caption alignnone" style="width: 452px"><img src="http://mgsimon.de/wp-content/uploads/2011/10/GoogleAppEngineJSONEclipseNewJavaClass.png" alt="Google App Engine JSON :: Eclipse New Java Class" title="Google App Engine JSON :: Eclipse New Java Class" width="442" height="528" class="size-full wp-image-3271 stamp" /><p class="wp-caption-text">Google App Engine JSON :: Eclipse New Java Class</p></div></p>
<ul>
<li>Name: AboutMyRequestServlet</li>
<li>Superclass: javax.servlet.http.HttpServlet</li>
</ul>
<p>In dem folgenden Servlet wird ein JSONObject erzeugt (Zeile 20) und die jeweiligen Header-Informationen hinzugef&#252;gt (Zeile 25). Das JSONObject wird mit dem richtigen Media Type (Zeile 27) &#252;ber Response einfach zum Client gesendet (Zeile 28).</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
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">tld.sld.my.example</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.IOException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Enumeration</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.ServletException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.http.HttpServlet</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.http.HttpServletRequest</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.http.HttpServletResponse</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.google.appengine.repackaged.org.json.JSONException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.google.appengine.repackaged.org.json.JSONObject</span><span style="color: #339933;">;</span>
&nbsp;
@SuppressWarnings<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;serial&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> AboutMyRequestServlet <span style="color: #000000; font-weight: bold;">extends</span> HttpServlet <span style="color: #009900;">&#123;</span>
&nbsp;
	@Override
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> doGet<span style="color: #009900;">&#40;</span>HttpServletRequest req, HttpServletResponse resp<span style="color: #009900;">&#41;</span>
			<span style="color: #000000; font-weight: bold;">throws</span> ServletException, <span style="color: #003399;">IOException</span> <span style="color: #009900;">&#123;</span>
		JSONObject jsonObject <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JSONObject<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
			Enumeration<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;</span> names <span style="color: #339933;">=</span> req.<span style="color: #006633;">getHeaderNames</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">while</span><span style="color: #009900;">&#40;</span>names.<span style="color: #006633;">hasMoreElements</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #003399;">String</span> name <span style="color: #339933;">=</span> names.<span style="color: #006633;">nextElement</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				jsonObject.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>name, req.<span style="color: #006633;">getHeader</span><span style="color: #009900;">&#40;</span>name<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			resp.<span style="color: #006633;">setContentType</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;application/json&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			resp.<span style="color: #006633;">getWriter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">print</span><span style="color: #009900;">&#40;</span>jsonObject<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>JSONException e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><em>AboutMyRequestServlet.java</em></p>
<p><strong>Konfiguration</strong></p>
<p>Damit das Servlet im Container bekannt ist (&lt;servlet&gt;) und &#252;ber eine URL aufl&#246;sbar ist (&lt;servlet-mapping&gt;), muss folgende Konfiguration in der Datei &#8220;war/WEB-INF/web.xml&#8221; hinzugef&#252;gt werden.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>AboutMyRequest<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>tld.sld.my.example.AboutMyRequestServlet<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>AboutMyRequest<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/aboutmyrequest<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p><em>web.xml</em></p>
<p>Anschlie&#223;end kann die Webanwendung &#252;ber &#8220;Run / Run As / Web Application&#8221; gestartet werden und lokal &#252;ber <a href="http://localhost:8888/aboutmyrequest" target="_blank">http://localhost:8888/aboutmyrequest</a> getestet werden. </p>
<p><strong>Antworten</strong></p>
<p>Nach erfolgreicher Publizierung in der Google App Engine kann auf das Servlet &#252;ber http://myappid.appspot.com/aboutmyrequest wie z.B. <a href="http://mgsimon.appspot.com/aboutmyrequest" target="_blank">http://mgsimon.appspot.com/aboutmyrequest</a> zugegriffen werden.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#123;</span>
    <span style="color: #3366CC;">&quot;Accept-Language&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;de-de,de;q=0.8,en-us;q=0.5,en;q=0.3&quot;</span><span style="color: #339933;">,</span>
    <span style="color: #3366CC;">&quot;Host&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;mgsimon.appspot.com&quot;</span><span style="color: #339933;">,</span>
    <span style="color: #3366CC;">&quot;Accept-Charset&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;ISO-8859-1,utf-8;q=0.7,*;q=0.7&quot;</span><span style="color: #339933;">,</span>
    <span style="color: #3366CC;">&quot;X-AppEngine-Country&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;DE&quot;</span><span style="color: #339933;">,</span>
    <span style="color: #3366CC;">&quot;User-Agent&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; de; rv:1.9.2.23) Gecko/20110920 Firefox/3.6.23&quot;</span><span style="color: #339933;">,</span>
    <span style="color: #3366CC;">&quot;Accept&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&quot;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><em>Antwort einer Anfrage durch Mozilla Firefox unter Mac OS X auf einem MacBook Pro</em></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#123;</span>
    <span style="color: #3366CC;">&quot;Host&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;mgsimon.appspot.com&quot;</span><span style="color: #339933;">,</span>
    <span style="color: #3366CC;">&quot;Referer&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;http://mgsimon.de/&quot;</span><span style="color: #339933;">,</span>
    <span style="color: #3366CC;">&quot;X-AppEngine-Country&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;DE&quot;</span><span style="color: #339933;">,</span>
    <span style="color: #3366CC;">&quot;User-Agent&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;Mozilla/5.0 (Linux; U; Android 2.3.3; de-de; HTC_DesireZ_A7272 Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1&quot;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><em>Antwort einer Anfrage durch Browser unter Android auf einem HTC Desire Z</em><br />
<div style="background-color: rgb(191, 228, 255); border:1px solid rgb(128, 201, 255); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/info.png" alt="Hinweis" title="Hinweis" width="24" height="24" style="margin: 4px 8px 0 0; float:left;"/>Die Anfrage wird durch die Google App Engine um zus&#228;tzliche Informationen wie z.B. die i18n Info &#8220;X-AppEngine-Country&#8221;:&#8221;DE&#8221; erweitert.</div></p>
<p><strong>Weiter &#8230;</strong></p>
<ul>
<li><a href="http://tools.ietf.org/html/rfc4627" target="_blank">rfc4627</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://mgsimon.de/2011/10/30/google-app-engine-und-json-aboutmyrequest-ein-beispiel/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Hello World Google App Engine</title>
		<link>http://mgsimon.de/2011/10/25/hello-world-google-app-engine/</link>
		<comments>http://mgsimon.de/2011/10/25/hello-world-google-app-engine/#comments</comments>
		<pubDate>Tue, 25 Oct 2011 15:19:39 +0000</pubDate>
		<dc:creator>mg</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[App]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Engine]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Servlet]]></category>

		<guid isPermaLink="false">http://mgsimon.de/?p=3132</guid>
		<description><![CDATA[Google App Engine ist eine Plattform zum Entwickeln und Hosten von Webanwendungen auf den Servern von Google. Dabei werden die Ressourcen in der Infrastruktur von Google dynamisch in Abh&#228;ngigkeit der Last zugewiesen. Ohne sich Gedanken um CPU, Bandbreite oder Speicher machen zu m&#252;ssen, werden laut Google bis zu 5 Millionen Seitenaufrufe pro Monat kostenlos und [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://code.google.com/intl/de-DE/appengine/" target="_blank">Google App Engine</a> ist eine Plattform zum Entwickeln und Hosten von Webanwendungen auf den Servern von Google.  Dabei werden die Ressourcen in der Infrastruktur von Google dynamisch in Abh&#228;ngigkeit der Last zugewiesen. Ohne sich Gedanken um CPU, Bandbreite oder Speicher machen zu m&#252;ssen, werden laut Google bis zu 5 Millionen Seitenaufrufe pro Monat kostenlos und dar&#252;ber hinaus zu <a href="http://code.google.com/intl/de-DE/appengine/docs/billing.html" target="_blank">wettbewerbsf&#228;higen Preisen</a> angeboten.<br />
<div id="attachment_3176" class="wp-caption alignnone" style="width: 452px"><img src="http://mgsimon.de/wp-content/uploads/2011/10/HelloWorldGoogleAppEngineMozillaFirefox.png" alt="Hello World Google App Engine :: Mozilla Firefox" title="Hello World Google App Engine :: Mozilla Firefox" width="442" height="137" class="size-full wp-image-3176 stamp" /><p class="wp-caption-text">Hello World Google App Engine :: Mozilla Firefox</p></div> Die Anwendungen k&#246;nnen in einer Umgebung f&#252;r Phyton oder Java umgesetzt werden. </p>
<p>&#8220;Hello World&#8221; in der Google App Engine, ein erstes kleines Beispiel in Java. Ab in die Cloud, schnell, schneller, am schnellsten &#8230;</p>
<p><span id="more-3132"></span><div style="background-color: rgb(191, 228, 255); border:1px solid rgb(128, 201, 255); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/info.png" alt="Hinweis" title="Hinweis" width="24" height="24" style="margin: 4px 8px 0 0; float:left;"/>Das folgende Beispiel wurde unter Mac OS X 10.6.8 mit der Java Version 1.6.0_26, Eclipse EE 3.7.1 Indigo und Google Plugin f&#252;r Eclipse 2.4.1 durchgef&#252;hrt.</div><br />
<strong>Google App Engine Account</strong></p>
<p>F&#252;r die Verwendung der Google App Engine ist ein Google-Konto und die Anmeldung unter <a href="http://appengine.google.com" target="_blank">appengine.google.com</a> notwendig. </p>
<p>Einfach mit der E-Mail und dem Passwort anmelden und auf der folgenden Seite &#252;ber &#8220;Create Application&#8221; das eigene Konto durch eine Handynummer best&#228;tigen. Eine SMS mit einem Code zur Best&#228;tigung wird unmittelbar an die angegebene Nummer gesendet. Nach der Best&#228;tigung kann die erste Anwendung erstellt werden. </p>
<p>&#8220;Application Identifier&#8221;, &#8220;Application Title, &#8220;I accept these terms.&#8221; und die Anwendung kann &#252;ber &#8220;Create Application&#8221; erstellt werden.</p>
<p><div style="background-color: rgb(191, 255, 191); border:1px solid rgb(128, 255, 128); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/tip.png" alt="Tipp" title="Tipp" width="24" height="24" style="margin: 4px 8px 0 0; float:left;" />Auf der Suche nach einem noch verf&#252;gbarem &#8220;Application Identifier&#8221; kann der Name des eigenen Google-Kontos verwendet werden, dieser sollten in der Regel f&#252;r das eigene Konto reserviert sein.</div> <div id="attachment_3155" class="wp-caption alignnone" style="width: 452px"><img src="http://mgsimon.de/wp-content/uploads/2011/10/HelloWorldGoogleAppEngineDashboard.png" alt="Hello World Google App Engine :: Dashboard" title="Hello World Google App Engine :: Dashboard" width="442" height="276" class="size-full wp-image-3155 stamp" /><p class="wp-caption-text">Hello World Google App Engine :: Dashboard</p></div> <strong>Entwicklungsumgebung Eclipse</strong></p>
<p>Anwendungen f&#252;r die Google App Engine k&#246;nnen mit dem <a href="http://code.google.com/intl/de-DE/appengine/downloads.html#Google_App_Engine_SDK_for_Java" target="_blank">SDK f&#252;r Java</a> manuell oder mit etwas mehr Benutzerfreundlichkeit dem <a href="http://code.google.com/intl/de-DE/appengine/downloads.html#Download_the_Google_Plugin_for_Eclipse" target="_blank">Google Plugin</a> in der IDE Eclipse erstellt werden.</p>
<p><a href="http://www.eclipse.org/downloads/" target="_blank">Eclipse herunterladen</a>, Archiv extrahieren, Eclipse starten und das Google Repository &#252;ber &#8220;Help / Install New Software&#8230; / Add&#8230;&#8221; mit folgenden Angaben hinzuf&#252;gen.</p>
<ul>
<li>Name: Google</li>
<li>Location: http://dl.google.com/eclipse/plugin/3.7</li>
</ul>
<p><div style="background-color: rgb(191, 255, 191); border:1px solid rgb(128, 255, 128); color: rgb(0, 0, 0); margin:0 0 1.5em; overflow:auto; padding: 3px;">
<img src="/wp-content/plugins/MyShortCodes/tip.png" alt="Tipp" title="Tipp" width="24" height="24" style="margin: 4px 8px 0 0; float:left;" />Google stellt das Plugin f&#252;r mehrere Eclipse Versionen (Galileo, Helios, Indigo &#8230;) in verschiedene Repositories bereit. Die Adressen f&#252;r die jeweilige Version sind unter <a href="http://code.google.com/intl/de-DE/eclipse/docs/download.html" target="_blank">Google Plugin f&#252;r Eclipse</a> aufgelistet.</div> Anschlie&#223;end wird das Google Plugin f&#252;r Eclipse zur Installation angeboten.</p>
<p><div id="attachment_3180" class="wp-caption alignnone" style="width: 452px"><img src="http://mgsimon.de/wp-content/uploads/2011/10/HelloWorldGoogleAppEngineInstallAvailableSoftware.png" alt="Hello World Google App Engine :: Install Available Software" title="Hello World Google App Engine :: Install Available Software" width="442" height="344" class="size-full wp-image-3180 stamp" /><p class="wp-caption-text">Hello World Google App Engine :: Install Available Software</p></div> Nach der Installation werden einige neue Funktionen in Eclipse durch das Google Plugin f&#252;r Eclipse angeboten.</p>
<div id="attachment_3198" class="wp-caption alignnone" style="width: 287px"><img src="http://mgsimon.de/wp-content/uploads/2011/10/HelloWorldGoogleAppEngineEclipsePlugin.png" alt="Hello World Google App Engine :: Eclipse Plugin" title="Hello World Google App Engine :: Eclipse Plugin" width="277" height="191" class="size-full wp-image-3198 stamp" /><p class="wp-caption-text">Hello World Google App Engine :: Eclipse Plugin</p></div>
<p><strong>Hello World</strong></p>
<p>Einfach &#252;ber &#8220;File / New / Project &#8230;&#8221; ein &#8220;Google / Web Application Project&#8221; ausw&#228;hlen und durch &#8220;Next >&#8221; mit folgenden Einstellungen &#252;ber &#8220;Finish&#8221; ein neues Projekt erstellen.</p>
<ul>
<li>Project name: HelloWorldGoogleAppEngine</li>
<li>Package: tld.sld.my.example</li>
<li>Use Google Web Toolkit abw&#228;hlen</li>
</ul>
<p><div id="attachment_3173" class="wp-caption alignnone" style="width: 452px"><img src="http://mgsimon.de/wp-content/uploads/2011/10/HelloWorldGoogleAppEngineCreateWebApplicationProject.png" alt="Hello World Google App Engine :: Create Web Application Project" title="Hello World Google App Engine :: Create Web Application Project" width="442" height="590" class="size-full wp-image-3173 stamp" /><p class="wp-caption-text">Hello World Google App Engine :: Create Web Application Project</p></div> Die notwendige Verzeichnisstruktur und initiale Konfiguration wird mit dem folgendem Servlet durch das Plugin automatisch erstellt.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">tld.sld.my.example</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.IOException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.http.*</span><span style="color: #339933;">;</span>
&nbsp;
@SuppressWarnings<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;serial&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> HelloWorldGoogleAppEngineServlet <span style="color: #000000; font-weight: bold;">extends</span> HttpServlet <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> doGet<span style="color: #009900;">&#40;</span>HttpServletRequest req, HttpServletResponse resp<span style="color: #009900;">&#41;</span>
			<span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">IOException</span> <span style="color: #009900;">&#123;</span>
		resp.<span style="color: #006633;">setContentType</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;text/plain&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		resp.<span style="color: #006633;">getWriter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Hello, world&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Das erste Servlet &#8220;Hello World Google App Engine&#8221; ohne eine Zeile selbst geschrieben zu haben &#8230; ;)</p>
<p><strong>Test</strong></p>
<p>Die Entwicklungsumgebung bietet durch das Google Plugin f&#252;r Eclipse eine lokale Simulationsumgebung an. </p>
<p>Die Google App Engine Web Anwendung wird bei selektiertem Projekt &#252;ber &#8220;Run / Run As / Web Application&#8221; lokal gestartet und im Browser kann &#252;ber die URL http://localhost:8888/ die folgende Startseite geladen werden.<br />
<div id="attachment_3204" class="wp-caption alignnone" style="width: 452px"><img src="http://mgsimon.de/wp-content/uploads/2011/10/HelloWorldGoogleAppEngineHelloAppEngine.png" alt="Hello World Google App Engine :: Hello App Engine" title="Hello World Google App Engine :: Hello App Engine" width="442" height="164" class="size-full wp-image-3204 stamp" /><p class="wp-caption-text">Hello World Google App Engine :: Hello App Engine</p></div> Der Quelltext der Startseite befindet sich in der Datei &#8220;/war/index.html&#8221;. Der erste Link &#8220;HelloWorldGoogleAppEngine&#8221; zeigt auf das zuvor erstellte Servlet.</p>
<p><div id="attachment_3176" class="wp-caption alignnone" style="width: 452px"><img src="http://mgsimon.de/wp-content/uploads/2011/10/HelloWorldGoogleAppEngineMozillaFirefox.png" alt="Hello World Google App Engine :: Mozilla Firefox" title="Hello World Google App Engine :: Mozilla Firefox" width="442" height="137" class="size-full wp-image-3176 stamp" /><p class="wp-caption-text">Hello World Google App Engine :: Mozilla Firefox</p></div> <strong>Ab in die Cloud &#8230;</strong></p>
<p>Damit das erste Beispiel im weltweiten Netz erreichbar ist, muss die Anwendung in die Cloud von Google publiziert werden. </p>
<p>In der Konfigurationsdatei appengine-web.xml unter &#8220;war/WEB-INF&#8221; die eigene zuvor erstellte Anwendungs-ID (myappid) eintragen.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;appengine-web-app</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://appengine.google.com/ns/1.0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;application<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>myappid<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/application<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!--</span>
<span style="color: #808080; font-style: italic;">    By default, App Engine sends requests serially to a given web server.</span>
<span style="color: #808080; font-style: italic;">    To allow App Engine to send multiple requests in parallel specify:</span>
&nbsp;
<span style="color: #808080; font-style: italic;">      &lt;threadsafe&gt;true&lt;/threadsafe&gt;</span>
<span style="color: #808080; font-style: italic;">  --&gt;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- Configure java.util.logging --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;system-properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;java.util.logging.config.file&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;WEB-INF/logging.properties&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/system-properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/appengine-web-app<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Das Projekt kann &#252;ber das Kontextmen&#252; &#8220;Google / Deploy to App Engine&#8221; zur App Engine von Google &#252;bertragen werden.</p>
<p>Anschlie&#223;end kann auf die Anwendung &#252;ber http://myappid.appspot.com (myappid = zuvor erstellter Application Identifier) wie z.B. <a href="http://mgsimon.appspot.com" target="_blank">http://mgsimon.appspot.com</a> zugegriffen werden.</p>
<p>Fertig &#8230; erst einmal. ;)</p>
<p><strong>Weiter &#8230;</strong></p>
<ul>
<li><a href="http://code.google.com/intl/de-DE/appengine/" title="Google App Engine Projekt" target="_blank">Google App Engine Projekt</a></li>
<li><a href="http://code.google.com/intl/de-DE/appengine/docs/" title="Google App Engine Dokumentation" target="_blank">Google App Engine Dokumentation</a></li>
<li><a href="http://code.google.com/intl/de-DE/appengine/docs/java/javadoc/" title="Google App Engine Javadoc" target="_blank">Google App Engine Javadoc</a></li>
<li><a href="https://appengine.google.com/" title="Google App Engine Administration" target="_blank">Google App Engine Administration</a></li>
<li><a href="http://www.amazon.de/gp/product/B003DL3NT8/ref=nosim?tag=mgs-21" title="Programming Google App Engine (Animal Guide)" target="_blank">Programming Google App Engine (Animal Guide)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://mgsimon.de/2011/10/25/hello-world-google-app-engine/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
