tag:blogger.com,1999:blog-46501522294382385292024-03-13T21:48:51.433+01:00OBSCURED CLARITYA CACHE FOR CURIOSITYTim Molterhttp://www.blogger.com/profile/09117791052747688044noreply@blogger.comBlogger211125tag:blogger.com,1999:blog-4650152229438238529.post-34613739964866971722013-08-02T11:53:00.002+02:002013-08-02T11:53:23.762+02:00How Bitcoin WorksI recently found one of the best technical explanations of Bitcoin and wanted to share...<br />
<br />
<br />
<iframe width="560" height="315" src="//www.youtube.com/embed/Lx9zgZCMqXE" frameborder="0" allowfullscreen></iframe>Tim Molterhttp://www.blogger.com/profile/09117791052747688044noreply@blogger.com0tag:blogger.com,1999:blog-4650152229438238529.post-82196094770724130592013-01-20T22:59:00.000+01:002013-01-23T08:42:31.999+01:00Unit Testing with HSQLDB<div class="separator" style="clear: both; text-align: center;"><a href="http://xeiam.com/yank.jsp" imageanchor="1" style="clear:left; float:left;margin-right:1em; margin-bottom:1em"><img border="0" height="200" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJo25wKOiIwE5PwvhItz1yGLgctyWN2wD0Hhkc_L-YoPqs6-pKEPE0B-4H5_h3I9yYu5xZeJwVDLRepSXjx85qKhvqUX0gb6ApZLQvPJ-tCNgdztWM8z6MZd-N7ZUvUL-qw3LeMI6Fhyphenhyphen0/s200/yank_256.png" /></a></div>The latest <a href="http://xeiam.com/yank_changelog.jsp">release (2.0.0) of Yank</a> - the Ultra-Light JDBC Persistance Layer for Java, finally contains unit-tested code. This blog is about how HSQLDB was used for performing in-memory unit tests using JUnit. Just like most things, once you know the few tricks, it's really easy.<br />
<br />
Once nice feature of HSQLDB is that you can set up 100% in-memory tables, which makes unit testing a snap because you don't need to worry about having a database setup on the machine running the database. The following code snippets show how easy it was to setup a unit test for testing the core JDBC persistance layer code in Yank. While this is specific to Yank, this example should help you unit test any of your JDBC code using HSQLDB. After all, the main trick is to have your database properties setup correctly, as shown in HSQL_DB.properties below. <br />
<span class="fullpost"><br />
<h4>TestBooksTable.java</h4><pre name="code" class="java">package com.xeiam.yank.unit;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import com.xeiam.yank.DBConnectionManager;
import com.xeiam.yank.PropertiesUtils;
import com.xeiam.yank.demo.Book;
import com.xeiam.yank.demo.BooksDAO;
/**
* @author timmolter
*/
public class TestBooksTable {
@BeforeClass
public static void setUpDB() {
Properties dbProps = PropertiesUtils.getPropertiesFromClasspath("HSQL_DB.properties");
Properties sqlProps = PropertiesUtils.getPropertiesFromClasspath("HSQL_SQL.properties");
DBConnectionManager.INSTANCE.init(dbProps, sqlProps);
}
@AfterClass
public static void tearDownDB() {
DBConnectionManager.INSTANCE.release();
}
@Test
public void testBooksTable() {
BooksDAO.createBooksTable();
Book book = new Book();
book.setTitle("Cryptonomicon");
book.setAuthor("Neal Stephenson");
book.setPrice(23.99);
int i = BooksDAO.insertBook(book);
assertThat(i, equalTo(1));
List<Book> books = new ArrayList<Book>();
book = new Book();
book.setTitle("Cryptonomicon");
book.setAuthor("Neal Stephenson");
book.setPrice(23.99);
books.add(book);
book = new Book();
book.setTitle("Harry Potter");
book.setAuthor("Joanne K. Rowling");
book.setPrice(11.99);
books.add(book);
book = new Book();
book.setTitle("Don Quijote");
book.setAuthor("Cervantes");
book.setPrice(21.99);
books.add(book);
int[] returnValue = BooksDAO.insertBatch(books);
assertThat(returnValue.length, equalTo(3));
List<Book> allBooks = BooksDAO.selectAllBooks();
assertThat(allBooks.size(), equalTo(4));
book = BooksDAO.selectBook("Cryptonomicon");
assertThat(book.getPrice(), equalTo(23.99));
}
}
</pre><h4>HSQL_DB.properties</h4><pre name="code" class="java">driverclassname=org.hsqldb.jdbcDriver
# 100% in memory DB
myconnectionpoolname.url=jdbc:hsqldb:mem:aname;shutdown=true
myconnectionpoolname.user=sa
myconnectionpoolname.password=
myconnectionpoolname.maxconn=10
</pre><h4>HSQL_SQL.properties</h4><pre name="code" class="java">BOOKS_CREATE_TABLE=CREATE TABLE Books (TITLE VARCHAR(42) NULL, AUTHOR VARCHAR(42) NULL, PRICE DECIMAL(10,2) NOT NULL)
BOOKS_SELECT_BY_TITLE=SELECT * FROM BOOKS WHERE TITLE = ?
</pre><h4>Ultra-Light JDBC Persistance Layer</h4><p><a href="http://xeiam.com/yank.jsp">Yank</a> is a very easy-to-use yet flexible Java persistence layer for JDBC-compatible databases build on top of <a href="http://commons.apache.org/dbutils/">org.apache.DBUtils</a>. Yank wraps DBUtils, hiding the nitty-gritty Connection and ResultSet details behind a straight-forward proxy class: DBProxy. "Query" methods execute SELECT statements and return a List of POJOs. "Execute" methods execute INSERT, UPDATE, and DELETE (and more) statements. </p><p>Usage is very simple: define DB connectivity properties, create a DAO and POJO class, and execute queries.</p><h4>Features</h4><ul><li>Depends on light-weight and robust DBUtils library</li>
<li>~13KB Jar</li>
<li>Apache 2.0 license</li>
<li>Batch execute</li>
<li>Automatic POJO and POJO List querying</li>
<li>Works with any JDBC-compliant database</li>
<li>Write your own SQL statements</li>
<li>Optionally store SQL statements in a Properties file</li>
<li>Built-in Connection pool</li>
</ul><h4>What's Next?</h4><p>Now go ahead and <a href="/yank_examplecode.jsp">study some examples</a>, <a href="/yank_changelog.jsp">download the thing</a> and <a href="https://github.com/timmolter/Yank/issues">provide feedback</a>.</p><br />
<br />
Piece of Cake!!!<br />
</span>Tim Molterhttp://www.blogger.com/profile/09117791052747688044noreply@blogger.com1tag:blogger.com,1999:blog-4650152229438238529.post-5998965968773469112013-01-17T08:46:00.002+01:002013-03-10T09:17:21.030+01:00XChange Release 1.3.0<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXuJ1P-ZYiUzv0BZKmsn7WokeNM_yjMNJ9C8_mzO-9MSXhvX5Z1wXPam5fnhXJjGKKATCYDtmJk3OlhHVJDk05E8w-9MHlkTHprOSqPtN1XV4sdCKLA8Gd-jOaIVK1rCEIDBwPgepi1f4/s1600/xchange_example1.png" imageanchor="1" style="clear:left; float:left;margin-right:1em; margin-bottom:1em"><img border="0" height="136" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXuJ1P-ZYiUzv0BZKmsn7WokeNM_yjMNJ9C8_mzO-9MSXhvX5Z1wXPam5fnhXJjGKKATCYDtmJk3OlhHVJDk05E8w-9MHlkTHprOSqPtN1XV4sdCKLA8Gd-jOaIVK1rCEIDBwPgepi1f4/s200/xchange_example1.png" /></a></div>Our Financial Exchange Library for Java, XChange, has seen a lot of active development since the previous release in October 2012. We went from 2 to 7 exchange implementations thanks mostly to the growing community starting to support the project more. <br />
<br />
Here's a list of the supported exchanges. More detailed info can be found <a href="https://github.com/timmolter/XChange/wiki/Exchange-Support">here</a>, which includes planned future exchange implementations.<br />
<ul><li>MtGox - polling and streaming market data, authenticated trading</li>
<li>Bitstamp - polling market data, authenticated trading</li>
<li>BTC-E - polling market data, authenticated trading</li>
<li>VirtEx - polling market data</li>
<li>CampBX - polling market data</li>
<li>BitcoinCharts - polling market data (Bitcoin Exchange Rates)</li>
<li>OpenExchangeRates - polling market data (Fiat Currency Exchange Rates)</li>
</ul><span class="fullpost"><br />
Internally, we introduced a new and improved REST interface that sits between our xchange classes and the HttpTemplate class responsible for fetching JSON. It also gives XChange clients access to the raw unmarshalled JSON data if they want it, which was something XChange needed for a long time.<br />
<br />
All exchange implementations have full-coverage unit tests.<br />
<br />
We've been able to reduce the number of dependencies a lot. One of the main focuses of XChange is to be very lightweight. Most notably is the outdated org.json jar. We dug into the Socket.io code, and painstakingly swapped out the old code with our already-used Jackson JSON code. This is good news for apps like <a href="https://play.google.com/store/apps/details?id=com.veken0m.cavirtex&hl=en">Bitcoinium</a> and <a href="https://multibit.org/">Multibit</a>, which both use XChange, for keeping their executable footprint small.<br />
<br />
Another major accomplishment with this release, is that the artifacts are now hosted on Maven Central: <a href="http://search.maven.org/#search%7Cga%7C1%7Cxeiam%20xchange">XChange artifacts on Maven Central</a> <br />
<br />
We're thinking about adding an arbitrage API within XChange next as the MtGox, BTC-E, and Bitstamp implementations all contain trading functionality.<br />
<br />
<h4>Relevant Links</h4><a href="http://https://github.com/timmolter/XChange/wiki/Exchange-Support">Detailed Exchange Support</a><br />
<a href="https://github.com/timmolter/XChange/issues">Bug Reports and Feature Requests</a><br />
<a href="http://xeiam.com/xchange.jsp">XChange Home on xeiam.com</a><br />
<a href="http://search.maven.org/#search%7Cga%7C1%7Cxeiam%20xchange">XChange artifacts on Maven Central</a><br />
<a href="https://github.com/timmolter/XChange">XChange project on Github</a><br />
</span>Tim Molterhttp://www.blogger.com/profile/09117791052747688044noreply@blogger.com0tag:blogger.com,1999:blog-4650152229438238529.post-17722686816674593982013-01-10T13:02:00.000+01:002013-01-10T13:02:02.237+01:00Very Realistic Robot Face<iframe width="420" height="315" src="http://www.youtube.com/embed/knRyDcnUc4U" frameborder="0" allowfullscreen></iframe>Tim Molterhttp://www.blogger.com/profile/09117791052747688044noreply@blogger.com0tag:blogger.com,1999:blog-4650152229438238529.post-35950323191536423942012-12-13T14:52:00.000+01:002013-01-06T14:57:29.873+01:00Mechanical Bird Song Device from 1890<iframe width="560" height="315" src="http://www.youtube.com/embed/tPKFT_t2rL0" frameborder="0" allowfullscreen></iframe>Tim Molterhttp://www.blogger.com/profile/09117791052747688044noreply@blogger.com0tag:blogger.com,1999:blog-4650152229438238529.post-81620119118250301712012-11-14T14:51:00.000+01:002013-01-06T14:56:17.096+01:00High-Speed Robot Hand<iframe width="420" height="315" src="http://www.youtube.com/embed/-KxjVlaLBmk" frameborder="0" allowfullscreen></iframe>Tim Molterhttp://www.blogger.com/profile/09117791052747688044noreply@blogger.com0tag:blogger.com,1999:blog-4650152229438238529.post-50198812023618231252012-10-29T13:26:00.000+01:002012-10-29T14:09:59.118+01:00Unit Testing Runtime Exceptions with JUnit4 and HamcrestJunit and Hamcrest make unit testing with Java almost enjoyable. In this post, I show how to unit test Exceptions with JUnit4 and Hamcrest. In this over-simplified example, I'm testing a method that always throws an IllegalArgumentException. In real-life the IllegalArgumentException would only be thrown under special circumstances given certain arguments, and those are the ones you want to test with the unit test. <br />
<br />
The basic idea is to surround the method you want to test with a try catch block and pass it an argument that will trigger the IllegalArgumentException to be thrown. The fail method call should never be reached, and if it does the unit test should fail. What should happen is that the IllegalArgumentException is caught, followed by a check for the correct message. <br />
<span class="fullpost"><br />
<pre class="java" name="code">import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.fail;
import org.junit.Test;
/**
* The following example code demonstrates how to unit test Exceptions with JUnit and Hamcrest
*/
public class ExceptionUnitTesting {
@Test
public void test() {
try {
blah("asdf");
fail("Expected exception");
} catch (IllegalArgumentException e) {
assertThat(e.getMessage(), is(equalTo("Argument foo is not valid!")));
}
}
/**
* @param foo
* @throws IllegalArgumentException - in this test case always
*/
private void blah(String foo) {
throw new IllegalArgumentException("Argument foo is not valid!");
}
}
</pre><br />
Piece of Cake!!!<br />
</span>Tim Molterhttp://www.blogger.com/profile/09117791052747688044noreply@blogger.com0tag:blogger.com,1999:blog-4650152229438238529.post-257978881101597612012-10-01T10:22:00.000+02:002012-10-01T10:22:00.509+02:00Import a Maven Git Project Into Eclipse<h3>The Easy Way</h3><br />
<b>Prerequisites</b><br />
<a href="http://obscuredclarity.blogspot.de/2012/04/hello-world-maven-m2eclipse-and-eclipse.html">Install M2Eclipse</a><br />
<br />
Step 1: Clone or create Git Repo. First, you need to clone a Git repo into an empty folder in your workspace. You need to use a Git client such as <a href="http://www.sourcetreeapp.com/">SourceTree</a> or <a href="http://code.google.com/p/tortoisegit/">TortoiseGit</a> for this. Create you workspace first if it isn't already, and clone the git repo directly into a new folder labeled with the project name.<br />
<br />
Step 2: Import Into Eclipse. In the Package Explorer view, right-click and choose Import... In the wizard choose Maven -> "Existing Maven Projects" as the project type. Search for the project home directory and click though the wizard.<br />
<span class="fullpost"><br />
<h3>The Hard Way</h3><br />
<b>Prerequisites</b><br />
<a href="http://obscuredclarity.blogspot.de/2012/04/hello-world-maven-m2eclipse-and-eclipse.html">Install M2Eclipse</a><br />
<a href="http://obscuredclarity.blogspot.de/2011/04/install-egit-for-eclipse.html">Install egit</a><br />
<br />
Step 1: Right-click in the Package Explorer area and select Import..., select Maven -> Check out Maven Projects from SCM, and click Next. <br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj31ZTyRODXqyTwVN3Hs-Qhy5l-fxFk9zTShshw8xzgOhxDG16SW2ghUwCvjSTRnPY2T6EmUvi6gk3Vj4ZJDI3XReak13V5V6w5M4TpMYGf0YROw0E70fb8LMglWDRrZuyDsPFNjkVfw10/s1600/Screen+shot+2012-08-08+at+3.40.56+PM.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="400" width="384" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj31ZTyRODXqyTwVN3Hs-Qhy5l-fxFk9zTShshw8xzgOhxDG16SW2ghUwCvjSTRnPY2T6EmUvi6gk3Vj4ZJDI3XReak13V5V6w5M4TpMYGf0YROw0E70fb8LMglWDRrZuyDsPFNjkVfw10/s400/Screen+shot+2012-08-08+at+3.40.56+PM.png" /></a></div><br />
Step 2: Choose "git" as the SCM connector next to "SCM URL:" and type in the Git repo URL. If there are no connectors to choose from you have to first install that Eclipse plugin. To do that, click on the "m2e Marketplace" link in the lower right hand corner of the dialog box.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj41lq7-g0p8e4HPajcKB9zIdeBN_nmT-5_jhJkTRidvKy3CUpQZ3XYTP-_GW4SXuS3R4iNa3jjPmbMkETo0ZSwlhpT_p0pR-5CK6-NPdOupoGBvihU9_6U5TnM56SUwMlzKwX0MY9Ylro/s1600/Screen+shot+2012-08-08+at+3.41.14+PM.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="336" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj41lq7-g0p8e4HPajcKB9zIdeBN_nmT-5_jhJkTRidvKy3CUpQZ3XYTP-_GW4SXuS3R4iNa3jjPmbMkETo0ZSwlhpT_p0pR-5CK6-NPdOupoGBvihU9_6U5TnM56SUwMlzKwX0MY9Ylro/s400/Screen+shot+2012-08-08+at+3.41.14+PM.png" /></a></div><br />
Step 3: Check m2e-egit and click Finish.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYmS1Mzc5auZTTRMv1DUVvU5yzBm006uXks1j8mkUBegdl0cAqwTIgQlXEHDKk2LKVN27xVAWpfcTuLYxqOGyfnutE33jUrhCpf48r3pSQrl6dEYh8zDpxDNW05wAyR8kwDvelbmh-V_Y/s1600/Screen+shot+2012-08-08+at+3.44.41+PM.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="145" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYmS1Mzc5auZTTRMv1DUVvU5yzBm006uXks1j8mkUBegdl0cAqwTIgQlXEHDKk2LKVN27xVAWpfcTuLYxqOGyfnutE33jUrhCpf48r3pSQrl6dEYh8zDpxDNW05wAyR8kwDvelbmh-V_Y/s400/Screen+shot+2012-08-08+at+3.44.41+PM.png" /></a></div><br />
Step 4: Select "git" as the SCM connector and type in the Git repo URL.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIUt5ThKmTntkjLcTD7Jhf979ymLxkW_SBhcyb9lnDrR6b2z4aLNxnTGGuZPvEbWN8WR6FdbOL8eFbyLDKTKZq1SwBjLHp7tThkAkMM_G9oc8xjVUwLoiVnfMo2bsDsV9xVQTVdfqbJHk/s1600/Screen+shot+2012-08-08+at+4.51.20+PM.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="400" width="384" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIUt5ThKmTntkjLcTD7Jhf979ymLxkW_SBhcyb9lnDrR6b2z4aLNxnTGGuZPvEbWN8WR6FdbOL8eFbyLDKTKZq1SwBjLHp7tThkAkMM_G9oc8xjVUwLoiVnfMo2bsDsV9xVQTVdfqbJHk/s400/Screen+shot+2012-08-08+at+4.51.20+PM.png" /></a></div><br />
Step 5: After asking you for the passphrase for ssh access to the Git repo, it will download and import the Java project as a Maven project into your workspace.<br />
<br />
Piece of Cake!!!<br />
</span>Tim Molterhttp://www.blogger.com/profile/09117791052747688044noreply@blogger.com0tag:blogger.com,1999:blog-4650152229438238529.post-15692091533614872512012-09-23T00:12:00.002+02:002012-09-23T00:12:39.543+02:00Bird Brains<iframe width="560" height="315" src="http://www.youtube.com/embed/ZRz7Xwi1ypU" frameborder="0" allowfullscreen></iframe>Tim Molterhttp://www.blogger.com/profile/09117791052747688044noreply@blogger.com0tag:blogger.com,1999:blog-4650152229438238529.post-24382183775739521282012-09-20T11:29:00.001+02:002012-09-20T11:29:07.915+02:00Bacteria as a Superorganism<object width="526" height="374"><param name="movie" value="http://video.ted.com/assets/player/swf/EmbedPlayer.swf"></param><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always"/><param name="wmode" value="transparent"></param><param name="bgColor" value="#ffffff"></param><param name="flashvars" value="vu=http://video.ted.com/talk/stream/2009/Blank/BonnieBassler_2009-320k.mp4&su=http://images.ted.com/images/ted/tedindex/embed-posters/BonnieBassler-2009.embed_thumbnail.jpg&vw=512&vh=288&ap=0&ti=509&lang=en&introDuration=15330&adDuration=4000&postAdDuration=830&adKeys=talk=bonnie_bassler_on_how_bacteria_communicate;year=2009;theme=evolution_s_genius;theme=medicine_without_borders;theme=unconventional_explanations;theme=animals_that_amaze;event=TED2009;tag=MacArthur+grant;tag=bacteria;tag=biology;tag=communication;tag=disease;tag=evolution;tag=health;tag=human+origins;tag=microbiology;tag=science;&preAdTag=tconf.ted/embed;tile=1;sz=512x288;" /><embed src="http://video.ted.com/assets/player/swf/EmbedPlayer.swf" pluginspace="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" bgColor="#ffffff" width="526" height="374" allowFullScreen="true" allowScriptAccess="always" flashvars="vu=http://video.ted.com/talk/stream/2009/Blank/BonnieBassler_2009-320k.mp4&su=http://images.ted.com/images/ted/tedindex/embed-posters/BonnieBassler-2009.embed_thumbnail.jpg&vw=512&vh=288&ap=0&ti=509&lang=en&introDuration=15330&adDuration=4000&postAdDuration=830&adKeys=talk=bonnie_bassler_on_how_bacteria_communicate;year=2009;theme=evolution_s_genius;theme=medicine_without_borders;theme=unconventional_explanations;theme=animals_that_amaze;event=TED2009;tag=MacArthur+grant;tag=bacteria;tag=biology;tag=communication;tag=disease;tag=evolution;tag=health;tag=human+origins;tag=microbiology;tag=science;&preAdTag=tconf.ted/embed;tile=1;sz=512x288;"></embed></object>Tim Molterhttp://www.blogger.com/profile/09117791052747688044noreply@blogger.com0tag:blogger.com,1999:blog-4650152229438238529.post-81192730774049223512012-09-20T11:10:00.002+02:002012-09-20T11:11:12.945+02:00Good Overview of Superstring Theory<object width="526" height="374"><param name="movie" value="http://video.ted.com/assets/player/swf/EmbedPlayer.swf"></param><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always"/><param name="wmode" value="transparent"></param><param name="bgColor" value="#ffffff"></param><param name="flashvars" value="vu=http://video.ted.com/talk/stream/2005/Blank/BrianGreene_2005-320k.mp4&su=http://images.ted.com/images/ted/tedindex/embed-posters/BrianGreene-2005.embed_thumbnail.jpg&vw=512&vh=288&ap=0&ti=251&lang=en&introDuration=15330&adDuration=4000&postAdDuration=830&adKeys=talk=brian_greene_on_string_theory;year=2005;theme=unconventional_explanations;theme=peering_into_space;event=TED2005;tag=physics;tag=science;tag=universe;&preAdTag=tconf.ted/embed;tile=1;sz=512x288;" /><embed src="http://video.ted.com/assets/player/swf/EmbedPlayer.swf" pluginspace="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" bgColor="#ffffff" width="526" height="374" allowFullScreen="true" allowScriptAccess="always" flashvars="vu=http://video.ted.com/talk/stream/2005/Blank/BrianGreene_2005-320k.mp4&su=http://images.ted.com/images/ted/tedindex/embed-posters/BrianGreene-2005.embed_thumbnail.jpg&vw=512&vh=288&ap=0&ti=251&lang=en&introDuration=15330&adDuration=4000&postAdDuration=830&adKeys=talk=brian_greene_on_string_theory;year=2005;theme=unconventional_explanations;theme=peering_into_space;event=TED2005;tag=physics;tag=science;tag=universe;&preAdTag=tconf.ted/embed;tile=1;sz=512x288;"></embed></object>Tim Molterhttp://www.blogger.com/profile/09117791052747688044noreply@blogger.com0tag:blogger.com,1999:blog-4650152229438238529.post-9531435252989102362012-09-19T23:24:00.004+02:002012-09-19T23:24:38.071+02:00What Is Life Really?<iframe width="560" height="315" src="http://www.youtube.com/embed/6jIeHsefCPk" frameborder="0" allowfullscreen></iframe>Tim Molterhttp://www.blogger.com/profile/09117791052747688044noreply@blogger.com0tag:blogger.com,1999:blog-4650152229438238529.post-41123347666577028892012-09-11T10:45:00.000+02:002012-09-11T10:45:13.047+02:00Avoiding Name Collisions When Organizing Imports in EclipseIs there any way to get Eclipse to automatically give preference to a preferred import when organizing imports? Thankfully, the answer is yes.<br />
<br />
For example, I'd like to be able to write:<br />
<br />
List<String> myList = new ArrayList<String>();<br />
<br />
hit <b>Ctrl</b> + <b>Shift</b> + <b>O</b> and have Eclipse add:<br />
<br />
import java.util.List;<br />
<br />
And not always ask me which List I want to import:<br />
<span class="fullpost"><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkmDVu_flDZLTu3-2u63bcHf19oMGReOysD35QMiVj51JbGMF4T9P-G_LFnO55FBUBS35b0LHBm4m7oy2uClJi5Kr6JNZ6fVRUrE6ZtnZC5Re2ufhnwc4pMJXDKPIpdpGvtW27RJVSeNc/s1600/Screen+shot+2012-09-11+at+10.30.35+AM.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="214" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkmDVu_flDZLTu3-2u63bcHf19oMGReOysD35QMiVj51JbGMF4T9P-G_LFnO55FBUBS35b0LHBm4m7oy2uClJi5Kr6JNZ6fVRUrE6ZtnZC5Re2ufhnwc4pMJXDKPIpdpGvtW27RJVSeNc/s400/Screen+shot+2012-09-11+at+10.30.35+AM.png" /></a></div><br />
To tell Eclipse not to ever consider java.awt.List, for example, go to Preferences --> Java --> Appearance --> Type Filters menu. Click add and enter Types you do not want Eclipse to consider for automatic insertion of import statements.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMq1or454bIcDAPo3Usop1q1vN8IZeofVOZ4txNzgLPiYzjl0LYlTJDYf0qA5lErTFv5F9PYECX73TDd13Ay-Vhp_6dljhtf6Qy_m8O40mCMxdS1ZvvqRiZry8M9MdfUVicKfCsWOr3Jo/s1600/Screen+shot+2012-09-11+at+10.45.04+AM.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="324" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMq1or454bIcDAPo3Usop1q1vN8IZeofVOZ4txNzgLPiYzjl0LYlTJDYf0qA5lErTFv5F9PYECX73TDd13Ay-Vhp_6dljhtf6Qy_m8O40mCMxdS1ZvvqRiZry8M9MdfUVicKfCsWOr3Jo/s400/Screen+shot+2012-09-11+at+10.45.04+AM.png" /></a></div><br />
Piece of Cake!!!<br />
</span>Tim Molterhttp://www.blogger.com/profile/09117791052747688044noreply@blogger.com0tag:blogger.com,1999:blog-4650152229438238529.post-9520925191964390612012-08-28T23:42:00.001+02:002013-03-10T14:08:40.754+01:00XChange - Open Source Java API for MtGox Bitcoin Exchange<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxikQiYy9J24AjK2LcJwhWyQR3Ceak_VeAYqiyz1dolYRSWnWfgX_reE7QUh9qtPQdi5vFS3n4ZwOSOaSho7Rl76bTjlVzdwy1xCtnX8jfZZCGYe6UFphKUJTsqxib2EKiEgruzMpTRFY/s1600/xchange_256.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxikQiYy9J24AjK2LcJwhWyQR3Ceak_VeAYqiyz1dolYRSWnWfgX_reE7QUh9qtPQdi5vFS3n4ZwOSOaSho7Rl76bTjlVzdwy1xCtnX8jfZZCGYe6UFphKUJTsqxib2EKiEgruzMpTRFY/s200/xchange_256.png" width="200" /></a></div><br />
UPDATE March 9, 2013: <a href="http://blog.xeiam.com/2013/03/xchange-150-released.html">Version 1.5.0 released</a>. Support for 10 exchanges.<br />
<br />
UPDATE Jan 31, 2013: Version 1.4.0 released. Support for Canadian Virtual Exchange. Mostly bug fixes.<br />
<br />
UPDATE Jan 16, 2013: Version 1.3.0 released. Support for many more exchanges. See <a href="http://xeiam.com/xchange_changelog.jsp">release notes</a> and also <a href="http://obscuredclarity.blogspot.de/2013/01/xchange-release-130.html">XChange Release 1.3.0 Announcement</a><br />
<br />
UPDATE Oct 11, 2012: Version 1.2.0 released. Support for Canadian Virtual Exchange.<br />
<br />
<a href="https://github.com/timmolter/XChange/wiki/Exchange-Support">Supported Exchanges</a><br />
<br />
Together with other members from the Bitcoin community, I've recently created a new open source Java library called XChange. XChange is a Java library providing a simple and consistent API for interacting with a diverse set of financial security exchanges including Bitcoin. The first exchange implemented is the world's largest Bitcoin exchange - Mt Gox. The plan is to add more Bitcoin exchanges and other traditional financial exchanges offerring trading APIs such as Interactive Brokers.<br />
<br />
As of the most recent release 1.1.0, Xchange offers the following functionality:<br />
<ul><li>Support for MtGox Bitcoin Exchange (public) polling market data (ticker, depth, trades, etc.)</li>
<li>Support for MtGox Bitcoin Exchange (private) polling trade data (account info, market order, limit order, cancel order open orders, etc.)</li>
<li>Support for MtGox Bitcoin Exchange (public) streaming market (ticker)</li>
</ul><span class="fullpost">Next up on the todo list is:<br />
<ul><li>Support for MtGox Bitcoin Exchange (public) streaming market (depth, trades, etc.)</li>
<li>Support for MtGox Bitcoin Exchange (private) streaming trade data (account info, market order, limit order, cancel order open orders, etc.)</li>
</ul><h1>Relevant Links</h1>Project Home - <a href="http://xeiam.com/xchange.jsp">http://xeiam.com/xchange.jsp</a><br />
Code on Github - <a href="https://github.com/timmolter/XChange">https://github.com/timmolter/XChange</a><br />
Example Code - <a href="http://xeiam.com/xchange_examplecode.jsp">http://xeiam.com/xchange_examplecode.jsp</a><br />
<br />
<h1>Examples</h1>The following examples demonstrate getting Ticker data from MtGox, first using the polling API, and second using the streaming API.<br />
<br />
<h3>Ticker via Polling API</h3><pre class="java" name="code">package com.xeiam.xchange.examples.mtgox.v1.polling;
import com.xeiam.xchange.Currencies;
import com.xeiam.xchange.Exchange;
import com.xeiam.xchange.ExchangeFactory;
import com.xeiam.xchange.dto.marketdata.Ticker;
import com.xeiam.xchange.service.marketdata.polling.PollingMarketDataService;
/**
* Test requesting polling Ticker at MtGox
*/
public class TickerDemo {
private static PollingMarketDataService marketDataService;
public static void main(String[] args) {
// Use the factory to get the version 1 MtGox exchange API using default settings
Exchange mtGox = ExchangeFactory.INSTANCE.createExchange("com.xeiam.xchange.mtgox.v1.MtGoxExchange");
// Interested in the public polling market data feed (no authentication)
marketDataService = mtGox.getPollingMarketDataService();
// Get the latest ticker data showing BTC to USD
Ticker ticker = marketDataService.getTicker(Currencies.BTC, Currencies.USD);
double value = ticker.getLast().getAmount().doubleValue();
String currency = ticker.getLast().getCurrencyUnit().toString();
System.out.println("Last: " + currency + "-" + value);
System.out.println("Last: " + ticker.getLast().toString());
System.out.println("Bid: " + ticker.getBid().toString());
System.out.println("Ask: " + ticker.getAsk().toString());
// Get the latest ticker data showing BTC to EUR
ticker = marketDataService.getTicker(Currencies.BTC, Currencies.EUR);
System.out.println("Last: " + ticker.getLast().toString());
System.out.println("Bid: " + ticker.getBid().toString());
System.out.println("Ask: " + ticker.getAsk().toString());
// Get the latest ticker data showing BTC to GBP
ticker = marketDataService.getTicker(Currencies.BTC, Currencies.GBP);
System.out.println("Last: " + ticker.getLast().toString());
System.out.println("Bid: " + ticker.getBid().toString());
System.out.println("Ask: " + ticker.getAsk().toString());
}
}
</pre>Result:<br />
<pre class="java" name="code">Last: USD-5.14739
Last: USD 5.14739
Bid: USD 5.12011
Ask: USD 5.1299
Last: EUR 4.07
Bid: EUR 4.0527
Ask: EUR 4.07
Last: GBP 3.3452
Bid: GBP 3.3
Ask: GBP 3.34091
</pre><br />
<h3>Ticker via Streaming API</h3><pre class="java" name="code">package com.xeiam.xchange.examples.mtgox.v1.streaming;
import java.util.concurrent.BlockingQueue;
import com.xeiam.xchange.Currencies;
import com.xeiam.xchange.Exchange;
import com.xeiam.xchange.dto.marketdata.Ticker;
import com.xeiam.xchange.mtgox.v1.MtGoxExchange;
import com.xeiam.xchange.service.marketdata.streaming.StreamingMarketDataService;
/**
* Test requesting streaming Ticker at MtGox
*/
public class TickerDemo {
public static void main(String[] args) {
TickerDemo tickerDemo = new TickerDemo();
tickerDemo.start();
}
private void start() {
// Use the default MtGox settings
Exchange mtGox = MtGoxExchange.newInstance();
// Interested in the public streaming market data feed (no authentication)
StreamingMarketDataService streamingMarketDataService = mtGox.getStreamingMarketDataService();
// Get blocking queue that receives streaming ticker data
BlockingQueue<ticker> tickerQueue = streamingMarketDataService.requestTicker(Currencies.BTC, Currencies.USD);
// take streaming ticker data from the queue and do something with it
while (true) {
try {
// Put your ticker event handling code here
doSomething(tickerQueue.take());
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
/**
* Do something fun with the streaming data!
*
* @param ticker
*/
private void doSomething(Ticker ticker) {
System.out.println(ticker.toString());
}
}
</pre>Result:<br />
<pre class="java" name="code">Ticker [timestamp=2012-08-26T20:09:13.202Z, last=USD 10.6, bid=USD 10.55248, ask=USD 10.6, tradableIdentifier=BTC, volume=3078691906206]
Ticker [timestamp=2012-08-26T20:09:18.651Z, last=USD 10.6, bid=USD 10.55248, ask=USD 10.6, tradableIdentifier=BTC, volume=3068691906206]
Ticker [timestamp=2012-08-26T20:09:19.568Z, last=USD 10.6, bid=USD 10.55248, ask=USD 10.6, tradableIdentifier=BTC, volume=3068691906206]
Ticker [timestamp=2012-08-26T20:09:23.152Z, last=USD 10.6, bid=USD 10.55248, ask=USD 10.6, tradableIdentifier=BTC, volume=3068691906206]
Ticker [timestamp=2012-08-26T20:09:23.975Z, last=USD 10.6, bid=USD 10.55248, ask=USD 10.6, tradableIdentifier=BTC, volume=3068691906206]
Ticker [timestamp=2012-08-26T20:09:24.790Z, last=USD 10.6, bid=USD 10.55248, ask=USD 10.6, tradableIdentifier=BTC, volume=3068691906206]
Ticker [timestamp=2012-08-26T20:09:25.205Z, last=USD 10.6, bid=USD 10.55248, ask=USD 10.6, tradableIdentifier=BTC, volume=3068691906206]
Ticker [timestamp=2012-08-26T20:09:26.018Z, last=USD 10.6, bid=USD 10.55248, ask=USD 10.6, tradableIdentifier=BTC, volume=3068691906206]
Ticker [timestamp=2012-08-26T20:09:26.543Z, last=USD 10.6, bid=USD 10.55248, ask=USD 10.6, tradableIdentifier=BTC, volume=3068691906206]
</pre>Piece of Cake!!!<br />
<br />
</span>Tim Molterhttp://www.blogger.com/profile/09117791052747688044noreply@blogger.com0tag:blogger.com,1999:blog-4650152229438238529.post-66545049027073750042012-08-27T16:43:00.000+02:002012-08-27T16:43:57.966+02:00Running Average and Running Standard Deviation in JavaToday I needed to generate statistics for a simulation in real-time, which forced me to code a class that calculates the running average and running standard deviation of incoming data. I remember doing this a long time ago for another project based on MATLAB, but today I needed a Java implementation. The following code example shows how to calculate the running average and running standard deviation for streaming data. Thanks to <a href="http://subluminal.wordpress.com/2008/07/31/running-standard-deviations/">Subluminal Messages</a> for the simple math implementation!<br />
<span class="fullpost"><br />
<h1>The Code</h1><pre name="code" class="java">public class RunningStatDemo {
public static void main(String[] args) {
RunningStatDemo rsd = new RunningStatDemo();
rsd.go();
}
private void go() {
RunningStat rs = new RunningStat();
rs.put(1);
System.out.println("ave: " + rs.getAverage());
System.out.println("std: " + rs.getStandardDeviation());
rs.put(1);
System.out.println("ave: " + rs.getAverage());
System.out.println("std: " + rs.getStandardDeviation());
rs.put(10);
System.out.println("ave: " + rs.getAverage());
System.out.println("std: " + rs.getStandardDeviation());
rs.put(20);
System.out.println("ave: " + rs.getAverage());
System.out.println("std: " + rs.getStandardDeviation());
rs.put(50);
System.out.println("ave: " + rs.getAverage());
System.out.println("std: " + rs.getStandardDeviation());
rs.put(50);
System.out.println("ave: " + rs.getAverage());
System.out.println("std: " + rs.getStandardDeviation());
}
public class RunningStat {
private int count = 0;
private double average = 0.0;
private double pwrSumAvg = 0.0;
private double stdDev = 0.0;
/**
* Incoming new values used to calculate the running statistics
*
* @param value
*/
public void put(double value) {
count++;
average += (value - average) / count;
pwrSumAvg += (value * value - pwrSumAvg) / count;
stdDev = Math.sqrt((pwrSumAvg * count - count * average * average) / (count - 1));
}
public double getAverage() {
return average;
}
public double getStandardDeviation() {
return Double.isNaN(stdDev) ? 0.0 : stdDev;
}
}
}
</pre><br />
<h1>Results</h1><pre name="code" class="java">ave: 1.0
std: 0.0
ave: 1.0
std: 0.0
ave: 4.0
std: 5.196152422706632
ave: 8.0
std: 9.055385138137417
ave: 16.4
std: 20.354360712142253
ave: 22.0
std: 22.794736234490628
</pre><br />
Piece of Cake!!!<br />
<br />
</span>Tim Molterhttp://www.blogger.com/profile/09117791052747688044noreply@blogger.com1tag:blogger.com,1999:blog-4650152229438238529.post-47181887439635385192012-08-26T23:34:00.001+02:002012-08-26T23:34:28.699+02:00Create Javadocs for a Multi-Module Maven ProjectIn this tutorial, I show how to create Javadocs for a multi-module Maven project. Creation of Javadocs requires the use of the Maven maven-javadoc-plugin plugin and running "mvn javadoc:aggregate" on the parent pom.xml. For the sake of this tutorial, I'm taking some excerpts from one of my current Open Source Projects - <a href="http://xeiam.com/xchange.jsp">XChange</a>. <br />
<h1>Relevant Links</h1><a href="https://github.com/timmolter/XChange">XChange on Github</a> - To see an actual working example<br />
<a href="http://xeiam.com/xchange/javadoc/index.html">Javadocs for XChange on xeiam.com</a> - To see what the generated Javadocs look like.<br />
<span class="fullpost"><br />
<h1>How To</h1>Step 1: Add the following to the parent pom.xml file:<br />
<br />
<pre name="code" class="java"><build>
<pluginmanagement>
<plugin>
<groupid>org.apache.maven.plugins</groupId>
<artifactid>maven-javadoc-plugin</artifactId>
<version>2.8.1</version>
</plugin>
</pluginManagement>
<plugins>
<plugin>
<groupid>org.apache.maven.plugins</groupId>
<artifactid>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>
</pre>Step 2: Run the following mvn command:<br />
<br />
<div class="unix">mvn javadoc:aggregate<br />
</div><br />
Piece of Cake!!!<br />
<br />
See also: <a href="http://obscuredclarity.blogspot.com/2012/05/maven-project-compiles-in-eclipse-but.html">Maven Project Compiles in Eclipse but Maven Build Fails</a><br />
See also: <a href="http://obscuredclarity.blogspot.com/2012/05/using-maven-offline.html">Using Maven Offline</a><br />
See also: <a href="http://obscuredclarity.blogspot.com/2012/04/hello-world-maven-m2eclipse-and-eclipse.html">Hello World - Maven, M2Eclipse and Eclipse</a><br />
<br />
</span>Tim Molterhttp://www.blogger.com/profile/09117791052747688044noreply@blogger.com0tag:blogger.com,1999:blog-4650152229438238529.post-50492399689625242462012-08-25T17:20:00.002+02:002012-08-25T17:26:21.213+02:00Java XChart Library Now Supports Error Bars<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMkz9gRLSE9UOORnXQe2sJYwtRfqGT0zltAfEHqbhGOAjmbU8cRxfbPuqvhpSYLJ9NVuzE0wz43K1Lyo5rrBmVAxyQ49ilvgfH7A3JzBleYBdNQcxdrcKVTDfAEOgDQ32AcSZaC2koD8A/s1600/xchart_example8.png" imageanchor="1" style="clear:left; float:left;margin-right:1em; margin-bottom:1em"><img border="0" height="148" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMkz9gRLSE9UOORnXQe2sJYwtRfqGT0zltAfEHqbhGOAjmbU8cRxfbPuqvhpSYLJ9NVuzE0wz43K1Lyo5rrBmVAxyQ49ilvgfH7A3JzBleYBdNQcxdrcKVTDfAEOgDQ32AcSZaC2koD8A/s200/xchart_example8.png" /></a></div><a href="http://xeiam.com/xchart.jsp">XChart</a> provides a super light-weight and dependency-free charting API for Java. It is open source, hosted on Github, and is licensed with an Apache 2.0 license. I created it over a year ago because I was looking for and couldn't find an easy-to-use plotting library for Java that was similar to the MATLAB's charting tool. I tried JFreeChart of course, but I found that the learning curve was very steep. Like MATLAB's charting functions, I just wanted to simply pass my data to an API, and after a few lines of code, have a plot. <br />
<br />
I just recently added support in XChart for making plots with error bars, which is what this post is about. The following demo, shows how to add error bars to an XChart chart. BTW, if you have any feature requests for XChart, please feel free to open a new issue on Github <a href="https://github.com/timmolter/XChart/issues">here</a>. For more XChart exmaples go <a href="http://xeiam.com/xchart_examplecode.jsp">here</a>.<br />
<span class="fullpost"><br />
<h1>XChart - Open Source Charting API</h1>To use XChart, you first need to get the XChart jar, which is available <a href="http://xeiam.com/xchart.jsp">here</a>. If you use Maven, just add the following to your dependencies in pom.xml:<br />
<pre name="code" class="java"><dependency>
<groupId>com.xeiam</groupId>
<artifactId>xchart</artifactId>
<version>1.1.0</version>
</dependency>
</pre><br />
The XChart artifacts are currently hosted on the Xeiam Nexus repository here:<br />
<pre name="code" class="java"><repositories>
<repository>
<id>xchange-release</id>
<releases/>
<url>http://nexus.xeiam.com/content/repositories/releases</url>
</repository>
<repository>
<id>xchange-snapshot</id>
<snapshots/>
<url>http://nexus.xeiam.com/content/repositories/snapshots/</url>
</repository>
</repositories>
</pre><br />
<h1>Error Bars Example Code</h1><pre name="code" class="java">package com.xeiam.xchart.example;
import java.util.ArrayList;
import java.util.Collection;
import com.xeiam.xchart.Chart;
import com.xeiam.xchart.series.Series;
import com.xeiam.xchart.series.SeriesColor;
import com.xeiam.xchart.series.SeriesLineStyle;
import com.xeiam.xchart.series.SeriesMarker;
import com.xeiam.xchart.swing.SwingWrapper;
/**
* Create a Chart with error bars
*
* @author timmolter
*/
public class Example8 {
public static void main(String[] args) {
// generates data
int size = 10;
Collection<number> xData1 = new ArrayList<number>();
Collection<number> yData1 = new ArrayList<number>();
Collection<number> errorBars = new ArrayList<number>();
for (int i = 0; i <= size; i++) {
xData1.add(i);
yData1.add(10 * Math.exp(-i));
errorBars.add(Math.random() + .3);
}
// Create Chart
Chart chart = new Chart(600, 400);
// Customize Chart
chart.setChartTitleVisible(false);
chart.setChartLegendVisible(false);
chart.setAxisTitlesVisible(false);
// Series 1
Series series1 = chart.addSeries("10^(-x)", xData1, yData1, errorBars);
series1.setLineColor(SeriesColor.PURPLE);
series1.setLineStyle(SeriesLineStyle.DASH_DASH);
series1.setMarkerColor(SeriesColor.GREEN);
series1.setMarker(SeriesMarker.SQUARE);
new SwingWrapper(chart).displayChart();
}
}
</pre>
<h1>Resulting Plot</h1><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisZTLiRWRCI6K7fwOFQcwe4-fPQ496JPIqEdFRfs3fIaAxVeylIYPN2N1bIlav0GISGVNnrR2IiWt-eR3vF9NAXKGposZho7zRae7CVyhm6lpufUHAGRn2_BQvOy5d0PpouwIkhfn440E/s1600/xchart_example8.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="295" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisZTLiRWRCI6K7fwOFQcwe4-fPQ496JPIqEdFRfs3fIaAxVeylIYPN2N1bIlav0GISGVNnrR2IiWt-eR3vF9NAXKGposZho7zRae7CVyhm6lpufUHAGRn2_BQvOy5d0PpouwIkhfn440E/s400/xchart_example8.png" /></a></div>Piece of Cake!!!
See also: <a href="http://obscuredclarity.blogspot.com/2011/08/java-web-apps-integrating-charts-into.html">Java Web Apps - Integrating Charts into a Servlet</a>
</span>Tim Molterhttp://www.blogger.com/profile/09117791052747688044noreply@blogger.com0tag:blogger.com,1999:blog-4650152229438238529.post-13224978418468225132012-08-21T14:15:00.001+02:002012-08-21T14:15:06.792+02:00Jeff Hawkins on Brain Science<object width="526" height="374"><param name="movie" value="http://video.ted.com/assets/player/swf/EmbedPlayer.swf"></param><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always"/><param name="wmode" value="transparent"></param><param name="bgColor" value="#ffffff"></param><param name="flashvars" value="vu=http://video.ted.com/talk/stream/2003/Blank/JeffHawkins_2003-320k.mp4&su=http://images.ted.com/images/ted/tedindex/embed-posters/JeffHawkins-2003.embed_thumbnail.jpg&vw=512&vh=288&ap=0&ti=125&lang=en&introDuration=15330&adDuration=4000&postAdDuration=830&adKeys=talk=jeff_hawkins_on_how_brain_science_will_change_computing;year=2003;theme=inspired_by_nature;theme=tales_of_invention;theme=how_the_mind_works;theme=what_s_next_in_tech;theme=technology_history_and_destiny;event=TED2003;tag=AI;tag=brain;tag=cognitive+science;tag=computers;tag=intelligence;tag=memory;tag=science;tag=technology;&preAdTag=tconf.ted/embed;tile=1;sz=512x288;" /><embed src="http://video.ted.com/assets/player/swf/EmbedPlayer.swf" pluginspace="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" bgColor="#ffffff" width="526" height="374" allowFullScreen="true" allowScriptAccess="always" flashvars="vu=http://video.ted.com/talk/stream/2003/Blank/JeffHawkins_2003-320k.mp4&su=http://images.ted.com/images/ted/tedindex/embed-posters/JeffHawkins-2003.embed_thumbnail.jpg&vw=512&vh=288&ap=0&ti=125&lang=en&introDuration=15330&adDuration=4000&postAdDuration=830&adKeys=talk=jeff_hawkins_on_how_brain_science_will_change_computing;year=2003;theme=inspired_by_nature;theme=tales_of_invention;theme=how_the_mind_works;theme=what_s_next_in_tech;theme=technology_history_and_destiny;event=TED2003;tag=AI;tag=brain;tag=cognitive+science;tag=computers;tag=intelligence;tag=memory;tag=science;tag=technology;&preAdTag=tconf.ted/embed;tile=1;sz=512x288;"></embed></object>Tim Molterhttp://www.blogger.com/profile/09117791052747688044noreply@blogger.com0tag:blogger.com,1999:blog-4650152229438238529.post-31010026136736262552012-08-09T13:17:00.003+02:002012-08-09T13:17:13.301+02:00To Infinity and Beyond<iframe width="560" height="315" src="http://www.youtube.com/embed/iBsywDWmwyA" frameborder="0" allowfullscreen></iframe>Tim Molterhttp://www.blogger.com/profile/09117791052747688044noreply@blogger.com0tag:blogger.com,1999:blog-4650152229438238529.post-17082822649875537452012-08-08T10:31:00.002+02:002012-08-08T10:31:59.055+02:00Richard Feynman - The Pleasure Of Finding Things Out<iframe width="420" height="315" src="http://www.youtube.com/embed/Bgaw9qe7DEE" frameborder="0" allowfullscreen></iframe>Tim Molterhttp://www.blogger.com/profile/09117791052747688044noreply@blogger.com0tag:blogger.com,1999:blog-4650152229438238529.post-33905059291482162742012-08-06T12:11:00.001+02:002012-08-27T08:32:40.192+02:00Curiosity Rover Lands Successfully on Mars!<!-- Start of guardian embedded video --><br />
<!-- To prevent the video from auto playing set 'a=true' in the following line of code--><br />
<iframe src="http://gu-embedded-video.appspot.com/?a=false&i=brightcove/poster/2012/8/3/120803challengesofmars_6500096.jpg&f=brightcove/2012/8/3/120803challengesofmars-16x9.mp4&u=/science/video/2012/aug/03/curiosity-terror-nasa-mars-video&tn=Curiosity\'s seven minutes of terror on Nasa mission to Mars - video:Video:1782926" style="border:0; overflow:hidden;" scrolling="no" width="460px" height="397px"></iframe><br />
<!-- End of guardian embedded video --><br />
<span class="fullpost"><br />
<iframe width="560" height="315" src="http://www.youtube.com/embed/4ddtoZNidIM" frameborder="0" allowfullscreen></iframe><br />
<br />
<iframe width="560" height="315" src="http://www.youtube.com/embed/gwinFP8_qIM" frameborder="0" allowfullscreen></iframe><br />
<br />
<iframe width="420" height="315" src="http://www.youtube.com/embed/gZX5GRPnd4U" frameborder="0" allowfullscreen></iframe><br />
</span><br />
<br />
<iframe width="560" height="315" src="http://www.youtube.com/embed/fJgeoHBQpFQ" frameborder="0" allowfullscreen></iframe>Tim Molterhttp://www.blogger.com/profile/09117791052747688044noreply@blogger.com0tag:blogger.com,1999:blog-4650152229438238529.post-39225248663998888082012-06-10T22:00:00.001+02:002012-08-12T15:45:00.530+02:00Bergmolch<h1>Bergmolch </h1>Oberstdorf, Germany (June 2012)<br />
<a href="http://de.wikipedia.org/wiki/Bergmolch">Wikipedia Aricle</a><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioMYbvlv1pDJgcHSCs6BFw8uLdP7P5yychq_mBlHMwF7jz2aK_U3Q7J3r8jOx1FTpoM6ds17V-hIa8QO3xDEXqOycKB-Lsa-JP6mXhUq7nRGh2ifCWoMeJtGxgulsYLU88JBAfJwxHb3E/s1600/IMG_8566.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="267" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioMYbvlv1pDJgcHSCs6BFw8uLdP7P5yychq_mBlHMwF7jz2aK_U3Q7J3r8jOx1FTpoM6ds17V-hIa8QO3xDEXqOycKB-Lsa-JP6mXhUq7nRGh2ifCWoMeJtGxgulsYLU88JBAfJwxHb3E/s400/IMG_8566.jpg" /></a><br />
<span class="fullpost"><br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-vs-SJK1ZSqBdfdLy0k_om-CWG-r69CuNekwWmoWob3qgE66iqvO-66RHaJ3E2uhtuUq5Gi4a9olF1v4I6xb7vw7umpJ34q2mlYI9-vCMp8HpQHvjCYCWpL7FM2nz9w4te7Dz_2SWlWY/s1600/IMG_8550.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="300" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-vs-SJK1ZSqBdfdLy0k_om-CWG-r69CuNekwWmoWob3qgE66iqvO-66RHaJ3E2uhtuUq5Gi4a9olF1v4I6xb7vw7umpJ34q2mlYI9-vCMp8HpQHvjCYCWpL7FM2nz9w4te7Dz_2SWlWY/s400/IMG_8550.jpg" /></a><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglVH30tP29YWdLP6WKr23fCrY6-Vrqtv7fNnF3D0c6ecDNK1vF84Kbuqv64fpUtJMZLJnu8PP6ywTWlvfDYGEWrsHjLgH-ncmRcT-SZ3MUXpr6ZWfuhtOR-pKaEt7VUv686fdK5Tx8E5U/s1600/IMG_8598.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="267" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglVH30tP29YWdLP6WKr23fCrY6-Vrqtv7fNnF3D0c6ecDNK1vF84Kbuqv64fpUtJMZLJnu8PP6ywTWlvfDYGEWrsHjLgH-ncmRcT-SZ3MUXpr6ZWfuhtOR-pKaEt7VUv686fdK5Tx8E5U/s400/IMG_8598.jpg" /></a><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitUcToRlrMVRwwObwPYc9xTc9ZbnCX2NwxnHclHut8YA58NClJE9F-dl2MtIoRb19AVb6DGBdaQImzPRqgG05pWY1RcsZeoJgo58ZgnQlzn20MetZcpRkyOuNXfNkth5KE9qWPZmHmreM/s1600/IMG_8584.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="267" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitUcToRlrMVRwwObwPYc9xTc9ZbnCX2NwxnHclHut8YA58NClJE9F-dl2MtIoRb19AVb6DGBdaQImzPRqgG05pWY1RcsZeoJgo58ZgnQlzn20MetZcpRkyOuNXfNkth5KE9qWPZmHmreM/s400/IMG_8584.jpg" /></a><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjGCj8kF3EOKGhMaQmaiamUdma3ch1uZnwwqzWPZ4c4Y93SOHgRBMGtFcC5ZY8QqB3h4XwBuMaU7u3oyNjQSRDoVyMFyk-eMlf0Z2McWPAfoX0JesYAxVbxvjPy-KeqHoGrsCMHpSSLjA/s1600/IMG_9260.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="267" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjGCj8kF3EOKGhMaQmaiamUdma3ch1uZnwwqzWPZ4c4Y93SOHgRBMGtFcC5ZY8QqB3h4XwBuMaU7u3oyNjQSRDoVyMFyk-eMlf0Z2McWPAfoX0JesYAxVbxvjPy-KeqHoGrsCMHpSSLjA/s400/IMG_9260.jpg" /></a><br />
<br />
<br />
</span>Tim Molterhttp://www.blogger.com/profile/09117791052747688044noreply@blogger.com0tag:blogger.com,1999:blog-4650152229438238529.post-38735406868540435102012-06-10T21:08:00.000+02:002013-07-11T12:00:26.292+02:00Schwarzer Rüsselkäfer - Otiorhynchus coecus<h1>Schwarzer Rüsselkäfer - Otiorhynchus coecus</h1>Oberstdorf, Germany (June 2012)<br />
<a href="http://de.wikipedia.org/wiki/Schwarzer_R%C3%BCsselk%C3%A4fer">Wikipedia Aricle</a><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgG8I-bA12biya3lvK10hEZwm27VklryrAyPNYDpOSdx-YpebbAh1l4pZ1v7ULE1k-qrwp1smiPboA9TeM3l5ktnMdRTCJTi-nKQ1NRTvUaXGH1iv2a-Dhsagp3xmFH5aq1Gx6LIKR8-fc/s1600/IMG_8776.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="266" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgG8I-bA12biya3lvK10hEZwm27VklryrAyPNYDpOSdx-YpebbAh1l4pZ1v7ULE1k-qrwp1smiPboA9TeM3l5ktnMdRTCJTi-nKQ1NRTvUaXGH1iv2a-Dhsagp3xmFH5aq1Gx6LIKR8-fc/s400/IMG_8776.jpg" /></a><br />
<span class="fullpost"><br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwU1qjz9YQEjp_GQrVCbfwq2hMb0bb8rcdwEY9PF5vaUaz01csx7wquGx7URWolqcficr4FpM4ZnSDtvKbWooy4ZAGHnkVVKIw87F5oYQJtu5bebo6GsSOB1cTYzdnRIiWVjKnR3mRATY/s1600/IMG_8722.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="266" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwU1qjz9YQEjp_GQrVCbfwq2hMb0bb8rcdwEY9PF5vaUaz01csx7wquGx7URWolqcficr4FpM4ZnSDtvKbWooy4ZAGHnkVVKIw87F5oYQJtu5bebo6GsSOB1cTYzdnRIiWVjKnR3mRATY/s400/IMG_8722.jpg" /></a><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZE5eAXGDiZKmMmbRYZssxRaXDW3a3FDK0qU5-efC4YEh-r1Ku5CaT5cUGTBRs98Cm9sECGZBRsBNobASt0jSbGVdXFsRQYHpvF5gSnOKYaWRa672bMLrc506bNY_hdZ71R-FstXGcMhQ/s1600/IMG_8781.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="266" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZE5eAXGDiZKmMmbRYZssxRaXDW3a3FDK0qU5-efC4YEh-r1Ku5CaT5cUGTBRs98Cm9sECGZBRsBNobASt0jSbGVdXFsRQYHpvF5gSnOKYaWRa672bMLrc506bNY_hdZ71R-FstXGcMhQ/s400/IMG_8781.jpg" /></a><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKvGH6A9SZ5phJ30uvKlKAZ4fuRwqUOj164HjVCMZZmn3zLergKC61n3a_08iaP-mGfyjRi5KjzfOWgnOQp2pEF1q_PU8n2br3pXdBKOjvmKUcTcIwub0zTtSX48c3_c9Wa6RqmkGU9r4/s1600/IMG_8693.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="278" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKvGH6A9SZ5phJ30uvKlKAZ4fuRwqUOj164HjVCMZZmn3zLergKC61n3a_08iaP-mGfyjRi5KjzfOWgnOQp2pEF1q_PU8n2br3pXdBKOjvmKUcTcIwub0zTtSX48c3_c9Wa6RqmkGU9r4/s400/IMG_8693.jpg" /></a><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizebO6UIUOE8cbz1aTc3vrBImShQ1D8dxEL_8zl_KNb9MumB2vA8wZZAV8vI6IACMefBgVLOvp_flBrybgch-REcpQ0O4u8TpKeQI9iV3YLKc2XLWPVsdrkZfs6y6QVdQR78l7EhCit_E/s1600/IMG_8650.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="400" width="267" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizebO6UIUOE8cbz1aTc3vrBImShQ1D8dxEL_8zl_KNb9MumB2vA8wZZAV8vI6IACMefBgVLOvp_flBrybgch-REcpQ0O4u8TpKeQI9iV3YLKc2XLWPVsdrkZfs6y6QVdQR78l7EhCit_E/s400/IMG_8650.jpg" /></a><br />
<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDdHczcLt5dOJsNU0CEoSXLnxTxTjoFmB0tDYp4sYhqaLspDyA88VKBplibRX_nGAfjylqpNuhAamrvG6exqW05JNfmU1IKWsTnrn4ewtERJ-G9w1zpbHwV3PvBzBLPW6A3AmT-XatPsU/s1600/IMG_8659.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="318" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDdHczcLt5dOJsNU0CEoSXLnxTxTjoFmB0tDYp4sYhqaLspDyA88VKBplibRX_nGAfjylqpNuhAamrvG6exqW05JNfmU1IKWsTnrn4ewtERJ-G9w1zpbHwV3PvBzBLPW6A3AmT-XatPsU/s400/IMG_8659.jpg" /></a><br />
</span>Tim Molterhttp://www.blogger.com/profile/09117791052747688044noreply@blogger.com0tag:blogger.com,1999:blog-4650152229438238529.post-83090891079728860812012-06-10T19:53:00.002+02:002012-06-10T19:53:56.613+02:00Ultra Slow Motion Video of Saw Blade Cutting Steel<iframe width="420" height="315" src="http://www.youtube.com/embed/mRuSYQ5Npek" frameborder="0" allowfullscreen></iframe>Tim Molterhttp://www.blogger.com/profile/09117791052747688044noreply@blogger.com0tag:blogger.com,1999:blog-4650152229438238529.post-64724485418747735162012-06-10T11:08:00.000+02:002014-09-27T20:10:56.423+02:00Alpine Tubifex WormsYesterday, while my cousin and I were hiking in the German alps, we stumbled upon some very bizarre creatures in a small permanent puddle in a cow pasture at around 1500m above sea level. What we at first saw was what looked like a colony of tiny red things undulating together and anchored to the silty bottom of the puddle. <br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgu7qEliz9Gyp2A8wFZHplHfVT9hxVt8V6Tx5ri_sM2G491psG51fGgs8jJoi0RxBoommDO_7khiQMAb99GDZwyO5NqpUIjlDL-evcvgPg5nXebH_1QnVDed2PvQa4n9p0MXjs1GhBvwwM/s1600/_MG_3671.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="267" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgu7qEliz9Gyp2A8wFZHplHfVT9hxVt8V6Tx5ri_sM2G491psG51fGgs8jJoi0RxBoommDO_7khiQMAb99GDZwyO5NqpUIjlDL-evcvgPg5nXebH_1QnVDed2PvQa4n9p0MXjs1GhBvwwM/s400/_MG_3671.jpg" /></a><br />
<span class="fullpost"><br />
<br />
After poking the moving red mat, it quickly receded and disappeared under the surface leaving little holes.<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyukCGRtLXAj0BFo7ytXO8ZQ2Ta0heinKAUxjgkkrY4C3mCBXPn0DnBnF9Fx3OP6UU6xirmzNqTaGwD4VD9pYfKPZp0-DveABVCugg4QXhKbDD5kJpQjT8BsA9T_yszUs8-__2MFgMERs/s1600/_MG_3675.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="267" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyukCGRtLXAj0BFo7ytXO8ZQ2Ta0heinKAUxjgkkrY4C3mCBXPn0DnBnF9Fx3OP6UU6xirmzNqTaGwD4VD9pYfKPZp0-DveABVCugg4QXhKbDD5kJpQjT8BsA9T_yszUs8-__2MFgMERs/s400/_MG_3675.jpg" /></a><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhV9d5mf7kXQToESYrRJUPXnwz9Raz8avwsziGvV7RrPs5tfdjQ5EoYfXSNlKUJYwPipbUgszePlnYNmzvuDr6PQKBPpQ1pUFgToQ5vgWvNaj7sTw4ukqb8OSs8sj4hHzZ8-81T-aNIyU/s1600/_MG_3676.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="267" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhV9d5mf7kXQToESYrRJUPXnwz9Raz8avwsziGvV7RrPs5tfdjQ5EoYfXSNlKUJYwPipbUgszePlnYNmzvuDr6PQKBPpQ1pUFgToQ5vgWvNaj7sTw4ukqb8OSs8sj4hHzZ8-81T-aNIyU/s400/_MG_3676.jpg" /></a><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglaSpbmnZ1MAIrBbISMwmwBAKTmZkNsXrXlZaE0xTwE3nkeAaOpA_T4hvTh2MWg5DEkTtdmD61i34o8o-xGHSRb7X5r-fSer5z9AaZsS40IudjDPmDjKzpQEHmwTFQS3xOLdmq4HIQX6E/s1600/_MG_3677.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="267" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglaSpbmnZ1MAIrBbISMwmwBAKTmZkNsXrXlZaE0xTwE3nkeAaOpA_T4hvTh2MWg5DEkTtdmD61i34o8o-xGHSRb7X5r-fSer5z9AaZsS40IudjDPmDjKzpQEHmwTFQS3xOLdmq4HIQX6E/s400/_MG_3677.jpg" /></a><br />
<br />
Here's what the red things turned out to be - little red worms.<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSr_kA_0Hg4WmzU5xX1PYCnFX71hngT2IqMXfVWmCcnm-tYdLoDfs5Xf-MTOcb_zkMeuZ6_k3cfdEpYXdEVZRi8Mv4-D2Eq0TJNiqm0aqf5_HMJyAGlVbh6he459fWhfPJ7qnwDI1L1KU/s1600/_MG_3668.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="334" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSr_kA_0Hg4WmzU5xX1PYCnFX71hngT2IqMXfVWmCcnm-tYdLoDfs5Xf-MTOcb_zkMeuZ6_k3cfdEpYXdEVZRi8Mv4-D2Eq0TJNiqm0aqf5_HMJyAGlVbh6he459fWhfPJ7qnwDI1L1KU/s400/_MG_3668.jpg" /></a><br />
<br />
After taking pictures and doing some online research at home, we determined that they must have been Tubifex worms. Here are the links to the <a href="http://de.wikipedia.org/wiki/Tubifex">German</a> and <a href="http://en.wikipedia.org/wiki/Tubifex">English</a> Wikipedia pages. <br />
<br />
</span>Tim Molterhttp://www.blogger.com/profile/09117791052747688044noreply@blogger.com1