<?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>Developer Papercuts &#187; Basics</title>
	<atom:link href="http://www.vogella.de/blog/tag/basics/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.vogella.de/blog</link>
	<description>Tips around Eclipse and Android programming</description>
	<lastBuildDate>Wed, 08 Feb 2012 17:31:00 +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>Eclipse 3.6M4 &#8211; Tiny nice things</title>
		<link>http://www.vogella.de/blog/2009/12/12/eclipse-3-6-ease-of-use/</link>
		<comments>http://www.vogella.de/blog/2009/12/12/eclipse-3-6-ease-of-use/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 17:31:00 +0000</pubDate>
		<dc:creator>Lars Vogel</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Basics]]></category>
		<category><![CDATA[Commands]]></category>
		<category><![CDATA[Planet]]></category>
		<category><![CDATA[RCP]]></category>

		<guid isPermaLink="false">http://www.vogella.de/blog/?p=1646</guid>
		<description><![CDATA[I personally believe that little things make a difference. Eclipse 3.6 is going to be great for new (and perhaps also for experienced) plugin and RCP developers. 

Especially I like in the Eclipse 3.6M4 release:


-consoleLog included per default in a new launch configuration
RCP with a View


I believe the solution of  Bug for -consoleLog ...]]></description>
			<content:encoded><![CDATA[<p>I personally believe that little things make a difference. Eclipse 3.6 is going to be great for new (and perhaps also for experienced) plugin and RCP developers. </p>
<p>Especially I like in the Eclipse 3.6M4 release:</p>
<p><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=284704">-consoleLog included per default in a new launch configuration</a><br />
<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295145">RCP with a View</a></p>
<p>I believe the solution of <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=284704"> Bug for -consoleLog </a> will solve the most common problem with getting started for new Plugin / RCP developers. Also the update of the PDE RCP templates will hopefully guide new developers in using commands instead of actions. </p>
<p>The change in <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=284704"> Bug for -consoleLog </a> was also a <a href="http://www.vogella.de/blog/2009/11/30/consolelog-runtime-configuration/">community decision</a>, which is a good example that Eclipse does consider user feedback. </p>
<p>Thanks to all involved parties and the Eclipse community for these changes. <img src='http://www.vogella.de/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><strong>Update</strong> Unfortunately <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=253105">Mail Template</a> was not part of M4.</p>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://www.vogella.de/blog/2009/12/12/eclipse-3-6-ease-of-use/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fresh (and free) icons for applications</title>
		<link>http://www.vogella.de/blog/2009/11/19/icons-eclipse/</link>
		<comments>http://www.vogella.de/blog/2009/11/19/icons-eclipse/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 05:17:20 +0000</pubDate>
		<dc:creator>Lars Vogel</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Basics]]></category>
		<category><![CDATA[Graphics]]></category>

		<guid isPermaLink="false">http://www.vogella.de/blog/?p=1371</guid>
		<description><![CDATA[I always use the Eclipse icons for my applicatons. Recently one of my users complainted that my icons look "oldisch"....

I quick call for help via twitter returned the following sites which provide free and fantastic looking icons. 

http://commons.wikimedia.org/wiki/Crystal_Clear
http://www.famfamfam.com 
http://iconlet.com
http://www.iconfinder.net/browse

Thanks to everyone for the links. Hope this helps also others to spice up their applications. ...]]></description>
			<content:encoded><![CDATA[<p>I always use the Eclipse icons for my applicatons. Recently one of my users complainted that my icons look &#8220;oldisch&#8221;&#8230;.</p>
<p>I quick call for help via <a href="http://www.twitter.com/vogella">twitter</a> returned the following sites which provide free and fantastic looking icons. </p>
<p><a href="http://commons.wikimedia.org/wiki/Crystal_Clear">http://commons.wikimedia.org/wiki/Crystal_Clear</a><br />
<a href="http://www.famfamfam.com">http://www.famfamfam.com </a><br />
<a href="http://iconlet.com">http://iconlet.com</a><br />
<a href="http://www.iconfinder.net/browse">http://www.iconfinder.net/browse</a></p>
<p>Thanks to everyone for the links. Hope this helps also others to spice up their applications. <img src='http://www.vogella.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>(Disclaimer: Of course these icons are not specific to Eclipse and could be used in other applications as well)</p>
<p class="wp-flattr-button"></p> <p><a href="http://www.vogella.de/blog/?flattrss_redirect&amp;id=1371&amp;md5=f12380680ff766dc70085cb6cd5515d4" title="Flattr" target="_blank"><img src="http://www.vogella.de/blog/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.vogella.de/blog/2009/11/19/icons-eclipse/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Disassemble Java class files via javap</title>
		<link>http://www.vogella.de/blog/2009/11/16/decompiling-java-class/</link>
		<comments>http://www.vogella.de/blog/2009/11/16/decompiling-java-class/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 15:30:20 +0000</pubDate>
		<dc:creator>Lars Vogel</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Basics]]></category>

		<guid isPermaLink="false">http://www.vogella.de/blog/?p=1321</guid>
		<description><![CDATA[Today I received the question how someone could see the Java code for a Java class file. You can disassemble the Java byte code via the command line tool javap.

Lets assume you have this tiny Java class Test.java



Compile this class via javac Test. javaand you receive Java.class

If you you run javap Test you receive ...]]></description>
			<content:encoded><![CDATA[<p>Today I received the question how someone could see the Java code for a Java class file. You can disassemble the Java byte code via the command line tool javap.</p>
<p>Lets assume you have this tiny Java class Test.java</p>
<pre class="brush: java; title: ; notranslate">
package test;

public class Test {

	int number = 5;

	public void sayHello() {
		System.out.println(&quot;Hello&quot;);
	}
}
</pre>
<p>Compile this class via javac Test. javaand you receive Java.class</p>
<p>If you you run javap Test you receive the attributes and method signatures.</p>
<pre class="brush: java; title: ; notranslate">
C:\temp\javaptest&gt;javap Test
Compiled from &quot;Test.java&quot;
public class test.Test extends java.lang.Object{
    int number;
    public test.Test();
    public void sayHello();
}
</pre>
<p>If you you run javap -C Test you receive the byte-code</p>
<pre class="brush: java; title: ; notranslate">

C:\temp\javaptest&gt;javap -c Test
Compiled from &quot;Test.java&quot;
public class test.Test extends java.lang.Object{
int number;

public test.Test();
  Code:
   0:   aload_0
   1:   invokespecial   #1; //Method java/lang/Object.&quot;&lt;init&gt;&quot;:()V
   4:   aload_0
   5:   iconst_5
   6:   putfield        #2; //Field number:I
   9:   return

public void sayHello();
  Code:
   0:   getstatic       #3; //Field java/lang/System.out:Ljava/io/PrintStream;
   3:   ldc     #4; //String Hello
   5:   invokevirtual   #5; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
   8:   return

}
</pre>
<p>To get the full Java source code you can use the tool <a href="http://www.varaneckas.com/jad">jad</a>.</p>
<p><strong>16.11.2008 Updated entry based on comments from Eric and Phil. Thanks! </strong></p>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://www.vogella.de/blog/2009/11/16/decompiling-java-class/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Using Collections.sort and Comparator in Java</title>
		<link>http://www.vogella.de/blog/2009/08/04/collections-sort-java/</link>
		<comments>http://www.vogella.de/blog/2009/08/04/collections-sort-java/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 20:17:18 +0000</pubDate>
		<dc:creator>Lars Vogel</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Basics]]></category>

		<guid isPermaLink="false">http://www.vogella.de/blog/?p=794</guid>
		<description><![CDATA[Sorting a collection in Java is easy, just use Collections.sort(Collection) to sort your values. For example:



This is possible because Integer implements the Comparable interface. This interface defines the method compare which performs pairwise comparison of the elements and returns -1 if the element is smaller then the compared element, 0 if it is equal ...]]></description>
			<content:encoded><![CDATA[<p>Sorting a collection in Java is easy, just use Collections.sort(Collection) to sort your values. For example:</p>
<pre class="brush: java; title: ; notranslate">
package de.vogella.algorithms.sort.standardjava;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Simple {
	public static void main(String[] args) {
		List list = new ArrayList();
		list.add(5);
		list.add(4);
		list.add(3);
		list.add(7);
		list.add(2);
		list.add(1);
		Collections.sort(list);
		for (Integer integer : list) {
			System.out.println(integer);
		}
	}
}
</pre>
<p>This is possible because Integer implements the Comparable interface. This interface defines the method compare which performs pairwise comparison of the elements and returns -1 if the element is smaller then the compared element, 0 if it is equal and 1 if it is larger. </p>
<p>But what if what to sort differently, e.g. for example in different order. Well, you could just use Collection.reverse(). Or you define your own class with implements the interface Comparator. </p>
<pre class="brush: java; title: ; notranslate">
package de.vogella.algorithms.sort.standardjava;

import java.util.Comparator;

public class MyIntComparable implements Comparator&lt;Integer&gt;{

	@Override
	public int compare(Integer o1, Integer o2) {
		return (o1&gt;o2 ? -1 : (o1==o2 ? 0 : 1));
	}
}
</pre>
<pre class="brush: java; title: ; notranslate">
package de.vogella.algorithms.sort.standardjava;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Simple2 {
	public static void main(String[] args) {
		List&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;();
		list.add(5);
		list.add(4);
		list.add(3);
		list.add(7);
		list.add(2);
		list.add(1);
		Collections.sort(list, new MyIntComparable());
		for (Integer integer : list) {
			System.out.println(integer);
		}
	}
}
</pre>
<p>The nice thing about this approach is that you then <strong>sort any object by any attribute or even a combination of attributes</strong>. For example if you have objects of type Person with an attribute income and dataOfBirth you could define different implementations of  Comparator and sort the objects according to your needs.</p>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://www.vogella.de/blog/2009/08/04/collections-sort-java/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Java Performance with Strings and StringBuilder</title>
		<link>http://www.vogella.de/blog/2009/07/19/java-string-performanc/</link>
		<comments>http://www.vogella.de/blog/2009/07/19/java-string-performanc/#comments</comments>
		<pubDate>Sun, 19 Jul 2009 16:59:06 +0000</pubDate>
		<dc:creator>Lars Vogel</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Basics]]></category>
		<category><![CDATA[Performance]]></category>

		<guid isPermaLink="false">http://www.vogella.de/blog/?p=585</guid>
		<description><![CDATA[Strings are very frequently used in Java programs. This blog post tries to explain what a programmer needs to consider from a performance point of view.  It will also explain in what situations you should use StringBuilder instead of String.

Strings in Java are immutable. If you look at the source code of String ...]]></description>
			<content:encoded><![CDATA[<p>Strings are very frequently used in Java programs. This blog post tries to explain what a programmer needs to consider from a performance point of view.  It will also explain in what situations you should use StringBuilder instead of String.</p>
<p>Strings in Java are <a href="http://www.vogella.de/articles/JavaConcurrency/article.html#immutability">immutable</a>. If you look at the source code of String you find that java.lang.String has the following properties.</p>
<pre class="brush: java; title: ; notranslate">
/** The value is used for character storage. */
    private final char value[];

 /** The offset is the first index of the storage that is used. */
    private final int offset;

 /** The count is the number of characters in the String. */
    private final int count;
</pre>
<p>The array is used to store the values of this String. </p>
<p>As Strings are immutable they can be freely shared. This property is utilized in the method substring(). The method substring will use a reference to the same String and only change the offset and the lenght value for the String. The same string is in this case used several times. </p>
<p>Therefore using  <strong> substring requires only a constant amount of time (and almost no additional memory) and can be freely used</strong>.</p>
<p>The operation  <strong> concat() </strong> (which is called by the + operator) combines two Strings. This method has to copy the characters of the two Strings and therefore  <strong>takes time and extra space which is propotional to the length of the two strings  </strong>.</p>
<p>The object StringBuilder has a more effectly way of concatenate Strings. It works similar to the class ArrayList by allocating a predefined array for storing the characters and keeps track of the used space. Every time the space is exceeded then it will extend the available capacity).</p>
<p>Does this means that you always have to use StringBuilder if you are concatening strings? </p>
<p>No. Of course if in your program you combine only a few times String the runtime overhead is normally not relevant for the overall performance. </p>
<p>But of course if you combine frequently strings in your program you should switch to StringBuilder. </p>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://www.vogella.de/blog/2009/07/19/java-string-performanc/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>

