<?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>Der Blog von Benny Neugebauer &#187; Programmierung</title>
	<atom:link href="http://www.bennyn.de/programmierung/feed" rel="self" type="application/rss+xml" />
	<link>http://www.bennyn.de</link>
	<description>Alles über die Informatik &#38; Co.</description>
	<lastBuildDate>Mon, 06 Feb 2012 11:49:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Div Element horizontal und vertikal zentrieren</title>
		<link>http://www.bennyn.de/programmierung/css/div-element-horizontal-und-vertikal-zentrieren.html</link>
		<comments>http://www.bennyn.de/programmierung/css/div-element-horizontal-und-vertikal-zentrieren.html#comments</comments>
		<pubDate>Fri, 27 Jan 2012 12:16:14 +0000</pubDate>
		<dc:creator>bennyn</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[div]]></category>
		<category><![CDATA[element]]></category>
		<category><![CDATA[horizontal]]></category>
		<category><![CDATA[vertikal]]></category>
		<category><![CDATA[zentrieren]]></category>

		<guid isPermaLink="false">http://www.bennyn.de/?p=3140</guid>
		<description><![CDATA[Ein Code sagt mehr als tausend Worte: 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 &#60;!DOCTYPE html&#62; &#60;html&#62; &#60;head&#62; &#60;meta charset=&#34;utf-8&#34; /&#62; &#60;title&#62;Centering a Div horizontally and vertically&#60;/title&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>Ein Code sagt mehr als tausend Worte:</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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;!</span>DOCTYPE html<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>html<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>head<span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>meta charset<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;utf-8&quot;</span> <span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;</span>title<span style="color: #339933;">&gt;</span>Centering a Div horizontally and vertically<span style="color: #339933;">&lt;/</span>title<span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>style type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/css&quot;</span><span style="color: #339933;">&gt;</span>
      html
      <span style="color: #009900;">&#123;</span>
        background<span style="color: #339933;">-</span>color<span style="color: #339933;">:</span> black<span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
&nbsp;
      body
      <span style="color: #009900;">&#123;</span>
        width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">100</span><span style="color: #339933;">%;</span>
        height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">100</span><span style="color: #339933;">%;</span>
        position<span style="color: #339933;">:</span> static<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* don't make it relative! */</span>
      <span style="color: #009900;">&#125;</span>
&nbsp;
      <span style="color: #666666; font-style: italic;">#centered
</span>      <span style="color: #009900;">&#123;</span>
        position<span style="color: #339933;">:</span> absolute<span style="color: #339933;">;</span>
        height<span style="color: #339933;">:</span> 396px<span style="color: #339933;">;</span>
        width<span style="color: #339933;">:</span> 400px<span style="color: #339933;">;</span>
        margin<span style="color: #339933;">:</span> <span style="color: #339933;">-</span>198px 0px 0px <span style="color: #339933;">-</span>200px<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* 50% height, 0px, 0px, 50% width */</span>
        top<span style="color: #339933;">:</span> <span style="color: #cc66cc;">50</span><span style="color: #339933;">%;</span>
        left<span style="color: #339933;">:</span> <span style="color: #cc66cc;">50</span><span style="color: #339933;">%;</span>
        background<span style="color: #339933;">-</span>color<span style="color: #339933;">:</span> violet<span style="color: #339933;">;</span>
        border<span style="color: #339933;">:</span> 1px solid white<span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #339933;">&lt;/</span>style<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>body<span style="color: #339933;">&gt;</span>  
    <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;centered&quot;</span><span style="color: #339933;">&gt;&lt;/</span>div<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>html<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bennyn.de/programmierung/css/div-element-horizontal-und-vertikal-zentrieren.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript AMD Example with RequireJS</title>
		<link>http://www.bennyn.de/programmierung/javascript/javascript-amd-example-with-requirejs.html</link>
		<comments>http://www.bennyn.de/programmierung/javascript/javascript-amd-example-with-requirejs.html#comments</comments>
		<pubDate>Wed, 25 Jan 2012 14:09:18 +0000</pubDate>
		<dc:creator>bennyn</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[amd]]></category>
		<category><![CDATA[asynchronous]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Example]]></category>
		<category><![CDATA[loading]]></category>
		<category><![CDATA[Module]]></category>
		<category><![CDATA[requirejs]]></category>

		<guid isPermaLink="false">http://www.bennyn.de/?p=3131</guid>
		<description><![CDATA[One line of code is worth ten thousand words. ./index.html &#60;!DOCTYPE html&#62; &#60;html&#62; &#60;head&#62; &#60;meta charset=&#34;utf-8&#34; /&#62; &#60;title&#62;Asynchronous Module Definition Example with RequireJS&#60;/title&#62; &#60;/head&#62; &#60;body&#62; &#60;!-- Let's use RequireJS as module loader (there are also others!) --&#62; &#60;script src=&#34;./js/require-1.0.4.js&#34;&#62;&#60;/script&#62; &#60;script&#62; require(['js/my_amd_module'], // Requires ./js/my_amd_module.js function(myModule) { myModule.sayHello(); myModule.doSomething(); }); &#60;/script&#62; &#60;/html&#62; ./js/my_amd_module.js define&#40;'js/my_amd_module', // module [...]]]></description>
			<content:encoded><![CDATA[<p>One line of code is worth ten thousand words.</p>
<h2>./index.html</h2>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;meta charset=&quot;utf-8&quot; /&gt;
    &lt;title&gt;Asynchronous Module Definition Example with RequireJS&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;  
    &lt;!-- Let's use RequireJS as module loader (there are also others!) --&gt;
    &lt;script src=&quot;./js/require-1.0.4.js&quot;&gt;&lt;/script&gt;
    &lt;script&gt;
      require(['js/my_amd_module'], // Requires ./js/my_amd_module.js
      function(myModule)
      {
        myModule.sayHello();
        myModule.doSomething();        
      });
    &lt;/script&gt;
&lt;/html&gt;</pre></div></div>

<h2>./js/my_amd_module.js</h2>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">define<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'js/my_amd_module'</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// module name, has to match filename (without .js)</span>
  <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'js/jquery-1.7.min'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// requirements of this module (./js/jquery-1.7.min.js)</span>
  <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#41;</span> <span style="color: #006600; font-style: italic;">// $ for jQuery</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#123;</span>
      sayHello<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
      <span style="color: #009900;">&#123;</span>
        <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Hello World!'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
      doSomething<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
      <span style="color: #009900;">&#123;</span>
        <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'I did.'</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: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bennyn.de/programmierung/javascript/javascript-amd-example-with-requirejs.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mit Java in eine Textdatei schreiben</title>
		<link>http://www.bennyn.de/programmierung/java/mit-java-in-eine-textdatei-schreiben.html</link>
		<comments>http://www.bennyn.de/programmierung/java/mit-java-in-eine-textdatei-schreiben.html#comments</comments>
		<pubDate>Fri, 13 Jan 2012 21:53:39 +0000</pubDate>
		<dc:creator>bennyn</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Inhalt]]></category>
		<category><![CDATA[schreiben]]></category>
		<category><![CDATA[Textdatei]]></category>

		<guid isPermaLink="false">http://www.bennyn.de/?p=3128</guid>
		<description><![CDATA[Mit dem folgendem Code kann ein beliebiger Inhalt in eine Textdatei geschrieben werden. Sollte die Datei bereits existieren, wird der Text am Ende der Datei angefügt: import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; &#160; public class SimpleFileWriter &#123; &#160; static final Logger logger = Logger.getLogger&#40;SimpleFileWriter.class.getName&#40;&#41;&#41;; &#160; public static void writeFile&#40;String pathName, String [...]]]></description>
			<content:encoded><![CDATA[<p>Mit dem folgendem Code kann ein beliebiger Inhalt in eine Textdatei geschrieben werden. Sollte die Datei bereits existieren, wird der Text am Ende der Datei angefügt:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.File</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.FileWriter</span><span style="color: #339933;">;</span>
<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.logging.Level</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.logging.Logger</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> SimpleFileWriter
<span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> Logger logger <span style="color: #339933;">=</span> Logger.<span style="color: #006633;">getLogger</span><span style="color: #009900;">&#40;</span>SimpleFileWriter.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> writeFile<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> pathName, <span style="color: #003399;">String</span> content<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>
    <span style="color: #003399;">File</span> file <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">File</span><span style="color: #009900;">&#40;</span>pathName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">FileWriter</span> writer <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">FileWriter</span><span style="color: #009900;">&#40;</span>file, <span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      writer.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span>content<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      writer.<span style="color: #006633;">flush</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: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<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>
      writeFile<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;C:/Temp/test.txt&quot;</span>, <span style="color: #0000ff;">&quot;Hello World!&quot;</span> <span style="color: #339933;">+</span> <span style="color: #003399;">System</span>.<span style="color: #006633;">getProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;line.separator&quot;</span>, <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Data was successfully written.&quot;</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> ex<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      logger.<span style="color: #006633;">log</span><span style="color: #009900;">&#40;</span>Level.<span style="color: #006633;">WARNING</span>, ex.<span style="color: #006633;">getLocalizedMessage</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></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bennyn.de/programmierung/java/mit-java-in-eine-textdatei-schreiben.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Print Windows cmd output with Java</title>
		<link>http://www.bennyn.de/programmierung/java/print-windows-cmd-output-with-java.html</link>
		<comments>http://www.bennyn.de/programmierung/java/print-windows-cmd-output-with-java.html#comments</comments>
		<pubDate>Fri, 13 Jan 2012 20:17:11 +0000</pubDate>
		<dc:creator>bennyn</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[cmd]]></category>
		<category><![CDATA[command-line]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[output]]></category>
		<category><![CDATA[print]]></category>
		<category><![CDATA[show]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.bennyn.de/?p=3119</guid>
		<description><![CDATA[For some Java applications it might be important to access the console to print some information from a console command. That&#8217;s why I wrote a little program which reads the output from the Windows command-line interface (cmd) and shows it on the screen. Note: This script also works on a Linux shell! 1 2 3 [...]]]></description>
			<content:encoded><![CDATA[<p>For some Java applications it might be important to access the console to print some information from a console command. That&#8217;s why I wrote a little program which reads the output from the Windows command-line interface (cmd) and shows it on the screen. Note: This script also works on a Linux shell!<br />
<span id="more-3119"></span></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
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.BufferedReader</span><span style="color: #339933;">;</span>
<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.io.InputStream</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.InputStreamReader</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.UnsupportedEncodingException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.logging.Level</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.logging.Logger</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> ConsoleOutputPrinter
<span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> Logger logger <span style="color: #339933;">=</span> Logger.<span style="color: #006633;">getLogger</span><span style="color: #009900;">&#40;</span>ConsoleOutputPrinter.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">String</span> getOutputFromConsoleCommand<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> command<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">UnsupportedEncodingException</span>, <span style="color: #003399;">IOException</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #003399;">Process</span> console <span style="color: #339933;">=</span> <span style="color: #003399;">Runtime</span>.<span style="color: #006633;">getRuntime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">exec</span><span style="color: #009900;">&#40;</span>command<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003399;">String</span> consoleEncoding <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">System</span>.<span style="color: #006633;">getProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;os.name&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">contains</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Windows&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
      consoleEncoding <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;CP850&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #003399;">InputStream</span> is <span style="color: #339933;">=</span> console.<span style="color: #006633;">getInputStream</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// use .getErrorStream() for error messages!</span>
    <span style="color: #003399;">BufferedReader</span> br <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">BufferedReader</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">InputStreamReader</span><span style="color: #009900;">&#40;</span>is, consoleEncoding<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    StringBuilder sb <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> StringBuilder<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003399;">String</span> line <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>line <span style="color: #339933;">=</span> br.<span style="color: #006633;">readLine</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: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      sb.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span>line<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">System</span>.<span style="color: #006633;">getProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;line.separator&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">return</span> sb.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</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;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<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: #003399;">String</span> consoleOutput <span style="color: #339933;">=</span> getOutputFromConsoleCommand<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ping localhost&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>consoleOutput<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> ex<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      logger.<span style="color: #006633;">log</span><span style="color: #009900;">&#40;</span>Level.<span style="color: #006633;">WARNING</span>, ex.<span style="color: #006633;">getLocalizedMessage</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></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bennyn.de/programmierung/java/print-windows-cmd-output-with-java.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to parse JSON with jQuery</title>
		<link>http://www.bennyn.de/programmierung/javascript/how-to-parse-json-with-jquery.html</link>
		<comments>http://www.bennyn.de/programmierung/javascript/how-to-parse-json-with-jquery.html#comments</comments>
		<pubDate>Tue, 27 Dec 2011 19:37:25 +0000</pubDate>
		<dc:creator>bennyn</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[boolean]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[number]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[String]]></category>

		<guid isPermaLink="false">http://www.bennyn.de/?p=3075</guid>
		<description><![CDATA[With jQuery you could easily parse a JSON (which is an object in JavaScript Object Notation). The method parseJSON of jQuery translates the JSON even into the corresponding JavaScript data types. As an example I have chosen the following JSON: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 [...]]]></description>
			<content:encoded><![CDATA[<p>With jQuery you could easily parse a JSON (which is an object in JavaScript Object Notation). The method <code>parseJSON</code> of jQuery translates the JSON even into the corresponding JavaScript data types. As an example I have chosen the following JSON:</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
</pre></td><td class="code"><pre class="json" style="font-family:monospace;">{
        &quot;firstName&quot;: &quot;Joe&quot;,
        &quot;lastName&quot; : &quot;Black&quot;,
        &quot;age&quot;      : 28,
        &quot;address&quot;  :
        {
          &quot;streetAddress&quot;: &quot;1st Street&quot;,
          &quot;city&quot;         : &quot;New York&quot;,
          &quot;state&quot;        : &quot;NY&quot;,
          &quot;postalCode&quot;   : &quot;10021&quot;
        },
        &quot;phoneNumber&quot;:
        [
          {
            &quot;type&quot;  : &quot;home&quot;,
            &quot;number&quot;: &quot;212555-1234&quot;
          },
          {
            &quot;type&quot;  : &quot;fax&quot;,
            &quot;number&quot;: &quot;646555-4567&quot;
          }
        ],
        &quot;married&quot; : true,
        &quot;developer&quot; : true	
}</pre></td></tr></table></div>

<p>This JSON contains nested objects like <code>address</code>, an array like <code>phoneNumber</code> and key-value pairs of different types like <code>firstName</code> (string), <code>age</code> (number) and <code>married</code> (boolean).</p>
<p><strong>Here it is shown how it is parsed:</strong><br />
<span id="more-3075"></span></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
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">&lt;script src=&quot;./js/jquery-1.7.min.js&quot;&gt;&lt;/script&gt;
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
  <span style="color: #003366; font-weight: bold;">var</span> json <span style="color: #339933;">=</span> <span style="color: #3366CC;">'{&quot;firstName&quot;:&quot;Joe&quot;,&quot;lastName&quot;:&quot;Black&quot;,&quot;age&quot;:28,&quot;address&quot;:{&quot;streetAddress&quot;:&quot;1st Street&quot;,&quot;city&quot;:&quot;New York&quot;,&quot;state&quot;:&quot;NY&quot;,&quot;postalCode&quot;:&quot;10021&quot;},&quot;phoneNumber&quot;:[{&quot;type&quot;:&quot;home&quot;,&quot;number&quot;:&quot;212555-1234&quot;},{&quot;type&quot;:&quot;fax&quot;,&quot;number&quot;:&quot;646555-4567&quot;}],&quot;married&quot;:true,&quot;developer&quot;:false}'</span><span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">var</span> object <span style="color: #339933;">=</span> jQuery.<span style="color: #660066;">parseJSON</span><span style="color: #009900;">&#40;</span>json<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">var</span> firstName <span style="color: #339933;">=</span> object.<span style="color: #660066;">firstName</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// Joe</span>
  <span style="color: #003366; font-weight: bold;">var</span> age <span style="color: #339933;">=</span> object.<span style="color: #660066;">age</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// 28</span>
  <span style="color: #003366; font-weight: bold;">var</span> streetAddress  <span style="color: #339933;">=</span> object.<span style="color: #660066;">address</span>.<span style="color: #660066;">streetAddress</span><span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">var</span> numberOfPhoneNumbers <span style="color: #339933;">=</span> object.<span style="color: #660066;">phoneNumber</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// 2</span>
  <span style="color: #003366; font-weight: bold;">var</span> homeNumber <span style="color: #339933;">=</span> object.<span style="color: #660066;">phoneNumber</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">number</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// 212555-1234</span>
  <span style="color: #003366; font-weight: bold;">var</span> faxNumber <span style="color: #339933;">=</span> object.<span style="color: #660066;">phoneNumber</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">number</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// 646555-4567</span>
  <span style="color: #003366; font-weight: bold;">var</span> married <span style="color: #339933;">=</span> object.<span style="color: #660066;">married</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// true</span>
&nbsp;
  <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>married <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
    <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'He is a lucky one!'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// ...and he is ;)</span>
&nbsp;
  <span style="color: #006600; font-style: italic;">// Checking data types</span>
  <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span><span style="color: #009900;">&#40;</span>firstName<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// string</span>
  <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span><span style="color: #009900;">&#40;</span>age<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// number</span>
  <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span><span style="color: #009900;">&#40;</span>married<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// boolean</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bennyn.de/programmierung/javascript/how-to-parse-json-with-jquery.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

