<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4182612167066186067</id><updated>2012-01-17T10:34:07.272-08:00</updated><category term='Wii'/><category term='Android'/><category term='java'/><category term='Google App Engine'/><category term='Rest'/><title type='text'>blog of broschb</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://broschb.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4182612167066186067/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://broschb.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>broschb</name><uri>http://www.blogger.com/profile/11782431763402290064</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>7</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4182612167066186067.post-3386632930379806720</id><published>2011-01-02T19:33:00.000-08:00</published><updated>2011-01-02T20:02:21.358-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='Android'/><category scheme='http://www.blogger.com/atom/ns#' term='Wii'/><title type='text'>Android Wii Balance Board Scale (WiiScale)</title><content type='html'>I recently published a new application to the Android market.  This application is called WiiScale.  The application utilizes the Wii Balance Board to sync with a supported Android device, and display the weight to the user, in short, it allows the Wii Balance Board to be used as a scale with your Android device.  The purpose of this post is to show how another external Android application can integrate with the WiiScale application using &lt;a href="http://developer.android.com/reference/android/content/Intent.html"&gt;Intents&lt;/a&gt;.  I have provided a sample Android application that contains all of the functionality outlined in this that can be used as a reference or starting point if necessary.  The source can be found on &lt;a href="https://github.com/broschb/WiiScaleTest"&gt;github&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;It is actually very straightforward to create and call an Intent to request the users weight from WiiScale.  The following code will do a few things.  It will first call a method to check if the required intent for WiiScale is available on the users phone.  If the intent is available it calls the intent, if it is not, it directs the user to the Android market to download the application.&lt;br /&gt;&lt;script src="https://gist.github.com/763104.js"&gt; &lt;/script&gt;&lt;br /&gt;&lt;br /&gt;The uri is specific uri defined by the WiiScale application for receiving intents.  The unit parameter can have two values.  The valid values are 'lbs' or 'kg' depending on whether your application would like the weight in pounds or kilograms.  The WEIGHT_REQUEST variable is just a static Integer datatype to uniquely identify the intent when we get the result back.  Note the call to 'startActivityForResult', this will allow your application to get a result back in the onActivityResult method.  This method looks like the following.&lt;br /&gt;&lt;br /&gt;&lt;script src="https://gist.github.com/763106.js"&gt; &lt;/script&gt;&lt;br /&gt;&lt;br /&gt;This simply checks to make sure the activity result if for our WEIGHT_REQUEST from WiiScale intent call, and that it returned successfully.  WiiScale returns two values from the intent.  The unit of measure, either 'kg' or 'lbs' and the weight in the given unit measurement.  Your application can then use this data as you please.  It couldn't be simpler to integrate WiiScale into your own application.  Please see the source on &lt;a href="https://github.com/broschb/WiiScaleTest"&gt;github&lt;/a&gt; for for details as well as how to check if the intent is available on your phone.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4182612167066186067-3386632930379806720?l=broschb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://broschb.blogspot.com/feeds/3386632930379806720/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4182612167066186067&amp;postID=3386632930379806720' title='31 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4182612167066186067/posts/default/3386632930379806720'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4182612167066186067/posts/default/3386632930379806720'/><link rel='alternate' type='text/html' href='http://broschb.blogspot.com/2011/01/android-wii-balance-board-scale.html' title='Android Wii Balance Board Scale (WiiScale)'/><author><name>broschb</name><uri>http://www.blogger.com/profile/11782431763402290064</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>31</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4182612167066186067.post-7700035076555435364</id><published>2010-06-16T20:56:00.000-07:00</published><updated>2010-06-16T21:07:55.421-07:00</updated><title type='text'>My First Android Application In The Market!</title><content type='html'>I finally published my first android application to the android market. I have written several small applications over the past year, I may just start to publish some of them, we'll see they are mainly for my own or my children's amusement, but others may find them fun or useful.  For this application wrote a small app for the World Cup.  I wrote a vuvuzela application, it's pretty simple, you just blow into the microphone and the vuvuzela sound comes out.  The QR for the application is below.  Give it a try, although simple I learned how to play sounds and record via the microphone in android, i'll write some posts in the future on how I accomplished this.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Vuvuzela Application QR-Code(scan w/ barcode scanner on android phone, or search Vuvuzela in market).&lt;/span&gt;&lt;br /&gt;&lt;img src="http://qrcode.kaywa.com/img.php?s=8&amp;d=market%3A%2F%2Fsearch%3Fq%3Dpname%3Acom.my.vuvuzela" alt="qrcode"  /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4182612167066186067-7700035076555435364?l=broschb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://broschb.blogspot.com/feeds/7700035076555435364/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4182612167066186067&amp;postID=7700035076555435364' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4182612167066186067/posts/default/7700035076555435364'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4182612167066186067/posts/default/7700035076555435364'/><link rel='alternate' type='text/html' href='http://broschb.blogspot.com/2010/06/my-first-android-application-in-market.html' title='My First Android Application In The Market!'/><author><name>broschb</name><uri>http://www.blogger.com/profile/11782431763402290064</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4182612167066186067.post-7462900778081779529</id><published>2009-08-13T17:22:00.000-07:00</published><updated>2009-08-13T17:52:24.436-07:00</updated><title type='text'>Android and Google App Engine</title><content type='html'>As the second part to my little series on developing an application across GAE(Google App Engine) and Android, I am going to continue with the example from my previous &lt;a href="http://broschb.blogspot.com/2009/08/restful-service-on-google-app-engine.html"&gt;post &lt;/a&gt;on creating a REST service on GAE.  In this post I will go through a very simple &lt;a href="http://www.android.com/about/"&gt;Android &lt;/a&gt;application that will use &lt;a href="http://www.restlet.org/"&gt;Restlet &lt;/a&gt;to call a Restful service deployed in GAE.  I will assume the user has some basic knowledge of developing an android application, although this will be a very simple example so it should be easy to follow.&lt;br /&gt;&lt;br /&gt;First download Restlet from &lt;a href="http://www.restlet.org/downloads/2.0/"&gt;here&lt;/a&gt;, if you do not already have it.  You will need at least version 2.0 milestone 3.  Once this is ready add the org.restlet.android.jar to the classpath of the project.&lt;br /&gt;&lt;br /&gt;First using the eclipse plugin for Android development create a new project, and an Activity.  I am just going to use the Hello World activity that is created by the plugin as a starting point.  I modified the layout for the page to look like the following, I just gave the TextView an id so that I could refer to it in the Activity.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;&amp;lt;LinearLayout xmlns:android=&amp;quot;http://schemas.android.com/apk/res/android&amp;quot;&lt;br /&gt;    android:orientation=&amp;quot;vertical&amp;quot;&lt;br /&gt;    android:layout_width=&amp;quot;fill_parent&amp;quot;&lt;br /&gt;    android:layout_height=&amp;quot;fill_parent&amp;quot;&lt;br /&gt;    &amp;gt;&lt;br /&gt;&amp;lt;TextView  &lt;br /&gt; android:id=&amp;quot;@+id/title&amp;quot; &lt;br /&gt;    android:layout_width=&amp;quot;fill_parent&amp;quot; &lt;br /&gt;    android:layout_height=&amp;quot;wrap_content&amp;quot; &lt;br /&gt;    /&amp;gt;&lt;br /&gt;&amp;lt;/LinearLayout&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now on to the activity itself, in this example the application will just call the Restful service running on the GAE when starting up.  If the current date is before the expiration date a message will display telling the user when the app will expire, and if the application is already expired, it will display a message telling the user so.  Obviously this example is not practical, and in a real application more would be done to provide a better user experience, but this is just to show how one could call the service.&lt;br /&gt;&lt;br /&gt;In the onCreate method a handle to the TextView is created, and the text is set to display the correct message based on the expire date.  A method called getExpireDate is called to do the actual checking of the date, parse the xml returned from the server, and generate the message string.  You can see the class in all it's glory below.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package test.app;&lt;br /&gt;&lt;br /&gt;import java.io.ByteArrayInputStream;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;import java.text.ParseException;&lt;br /&gt;import java.text.SimpleDateFormat;&lt;br /&gt;import java.util.Date;&lt;br /&gt;&lt;br /&gt;import javax.xml.parsers.DocumentBuilder;&lt;br /&gt;import javax.xml.parsers.DocumentBuilderFactory;&lt;br /&gt;import javax.xml.parsers.ParserConfigurationException;&lt;br /&gt;&lt;br /&gt;import org.restlet.representation.Representation;&lt;br /&gt;import org.restlet.resource.ClientResource;&lt;br /&gt;import org.restlet.resource.ResourceException;&lt;br /&gt;import org.w3c.dom.Document;&lt;br /&gt;import org.w3c.dom.Element;&lt;br /&gt;import org.w3c.dom.Node;&lt;br /&gt;import org.w3c.dom.NodeList;&lt;br /&gt;import org.xml.sax.SAXException;&lt;br /&gt;&lt;br /&gt;import android.app.Activity;&lt;br /&gt;import android.os.Bundle;&lt;br /&gt;import android.widget.TextView;&lt;br /&gt;&lt;br /&gt;public class Test extends Activity {&lt;br /&gt; private SimpleDateFormat df = new SimpleDateFormat("MMM d, yyyy HH:mm:ss a");&lt;br /&gt;    /** Called when the activity is first created. */&lt;br /&gt;    @Override&lt;br /&gt;    public void onCreate(Bundle savedInstanceState) {&lt;br /&gt;        super.onCreate(savedInstanceState);&lt;br /&gt;        setContentView(R.layout.main);&lt;br /&gt;        TextView v = (TextView) findViewById(R.id.title);&lt;br /&gt;        v.setText(getExpireDate());&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    private String getExpireDate(){&lt;br /&gt;&lt;br /&gt;     String expireDate = "";&lt;br /&gt;     boolean expired = false;&lt;br /&gt;     String url = "http://10.0.2.2:8080";&lt;br /&gt;  ClientResource resource = new ClientResource(url);&lt;br /&gt;  try {&lt;br /&gt;   Representation r = resource.get();&lt;br /&gt;   DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();&lt;br /&gt;   DocumentBuilder builder = dbf.newDocumentBuilder();&lt;br /&gt;            Document dom = builder.parse(new ByteArrayInputStream(r.getText().getBytes("UTF-8")));&lt;br /&gt;            Element root = dom.getDocumentElement();&lt;br /&gt;            NodeList nodes = root.getElementsByTagName("date");&lt;br /&gt;            System.out.println("");&lt;br /&gt;//   DomRepresentation rep = new DomRepresentation(r);&lt;br /&gt;//   NodeList nodes = rep.getDocument().getDocumentElement().getChildNodes();&lt;br /&gt;   for (int i = 0; i &lt; nodes.getLength(); i++) {&lt;br /&gt;                Node node = nodes.item(i);&lt;br /&gt;                if(node.getNodeName().equals("date")){&lt;br /&gt;                 expireDate = node.getFirstChild().getNodeValue();&lt;br /&gt;                 Date date = df.parse(expireDate);&lt;br /&gt;                 Date today = new Date();&lt;br /&gt;                 if(date.before(today))&lt;br /&gt;                  expired=true;&lt;br /&gt;               &lt;br /&gt;                }&lt;br /&gt;        } &lt;br /&gt;  } catch (ResourceException e) {&lt;br /&gt;   e.printStackTrace();&lt;br /&gt;  } catch (IOException e) {&lt;br /&gt;   // TODO Auto-generated catch block&lt;br /&gt;   e.printStackTrace();&lt;br /&gt;  } catch (ParserConfigurationException e) {&lt;br /&gt;   // TODO Auto-generated catch block&lt;br /&gt;   e.printStackTrace();&lt;br /&gt;  } catch (SAXException e) {&lt;br /&gt;   // TODO Auto-generated catch block&lt;br /&gt;   e.printStackTrace();&lt;br /&gt;  } catch (ParseException e) {&lt;br /&gt;   // TODO Auto-generated catch block&lt;br /&gt;   e.printStackTrace();&lt;br /&gt;  } &lt;br /&gt;  &lt;br /&gt;  //create date string&lt;br /&gt;  String returnMessage="";&lt;br /&gt;  if(expired){&lt;br /&gt;   returnMessage = "The app expired on "+expireDate;&lt;br /&gt;  }else{&lt;br /&gt;   returnMessage = "The app will expire on "+expireDate;&lt;br /&gt;  }&lt;br /&gt;  return returnMessage;&lt;br /&gt;    &lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I am using the Restlet libraries to call the service on GAE using a ClientResource, with the URL the service is running at, and then calling get on that URL.  I am then using some DOM libraries that are included with Android to parse the xml result.  Restlet does include some libraries to do this, but I couldn't get them to work properly, I'm not sure that they are fully supported in this release of Restlet for Android.  Once the expire date is pulled out of the result, the comparison is done, and the display string generated.  This is fairly straightforward and simple, and Restlet makes doing this very easy.  The url that is used in the example should be the url that your application is running in under GAE, in the example above I was running on localhost, and 10.0.2.2 is the machine address that the android emulator uses to access a url running on your local machine.&lt;br /&gt;&lt;br /&gt;The only other thing that is left to do is to enable the internet permission on android, to let Android and the users know that the application will be accessing the internet.  If you don't know how to do that refer to the Android documentation, but I have included my full manifest for the example below.  That's it!&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;&amp;lt;manifest xmlns:android=&amp;quot;http://schemas.android.com/apk/res/android&amp;quot;&lt;br /&gt;      package=&amp;quot;test.app&amp;quot;&lt;br /&gt;      android:versionCode=&amp;quot;1&amp;quot;&lt;br /&gt;      android:versionName=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;    &amp;lt;application android:icon=&amp;quot;@drawable/icon&amp;quot; android:label=&amp;quot;@string/app_name&amp;quot;&amp;gt;&lt;br /&gt;        &amp;lt;activity android:name=&amp;quot;.Test&amp;quot;&lt;br /&gt;                  android:label=&amp;quot;@string/app_name&amp;quot;&amp;gt;&lt;br /&gt;            &amp;lt;intent-filter&amp;gt;&lt;br /&gt;                &amp;lt;action android:name=&amp;quot;android.intent.action.MAIN&amp;quot; /&amp;gt;&lt;br /&gt;                &amp;lt;category android:name=&amp;quot;android.intent.category.LAUNCHER&amp;quot; /&amp;gt;&lt;br /&gt;            &amp;lt;/intent-filter&amp;gt;&lt;br /&gt;        &amp;lt;/activity&amp;gt;&lt;br /&gt;    &amp;lt;/application&amp;gt;&lt;br /&gt;    &amp;lt;uses-sdk android:minSdkVersion=&amp;quot;3&amp;quot; /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;uses-permission android:name=&amp;quot;android.permission.INTERNET&amp;quot;&amp;gt;&amp;lt;/uses-permission&amp;gt;&lt;br /&gt;&amp;lt;/manifest&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4182612167066186067-7462900778081779529?l=broschb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://broschb.blogspot.com/feeds/7462900778081779529/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4182612167066186067&amp;postID=7462900778081779529' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4182612167066186067/posts/default/7462900778081779529'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4182612167066186067/posts/default/7462900778081779529'/><link rel='alternate' type='text/html' href='http://broschb.blogspot.com/2009/08/android-and-google-app-engine.html' title='Android and Google App Engine'/><author><name>broschb</name><uri>http://www.blogger.com/profile/11782431763402290064</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4182612167066186067.post-5490723856525218965</id><published>2009-08-08T09:30:00.000-07:00</published><updated>2009-08-10T18:34:47.842-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Rest'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='Google App Engine'/><title type='text'>Restful Service on Google App Engine</title><content type='html'>I have been playing around with GAE(Google App Engine) and Android recently, and as part of my experimenting I wanted to to be able to call a service running on GAE from Android.  I found a great library called &lt;a href="http://www.restlet.org/"&gt;Restlet&lt;/a&gt;.  Restlet provides a simple framework and api for creating and consuming rest services, it even includes libraries for GAE and Android so I thought I would give it a shot.  I am going to write a series of posts that will contain a basic GAE application for a rest service, an Android application to consume the Restful service, and finally I will write a post that shows a simple example of writing some information to the GAE datastore.  My example will be target toward providing a simple solution to a question on &lt;a href="http://stackoverflow.com/questions/1223552/how-to-time-bomb-an-android-application/1225427#1225427"&gt;stackOverFlow&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;For part one I will go over an example for creating a restful service using the Restlet api.  I will be using the eclipse with the GAE plugin installed.  In eclipse create a new Google web application project, and enter the project details, I unchecked the use GWT box, as I am not using that.  This will create a basic servlet project, we will not use the servlet that is created, but it sets up the basic project structure for us.  Next download Restlet from &lt;a href="http://www.restlet.org/downloads/"&gt;here&lt;/a&gt;, and add the org.restlet.gae.jar to the war/WEB-INF/lib folder of your project, and make sure it is in the classpath. We are now ready to add Restlet functionality to our project.&lt;br /&gt;&lt;br /&gt;This example will use two classes, so create two classes, I have created TestApplication and TestResource.  As you can see below.  Test application extends Application, and here we will create our Restlet to direct calls to.  The TestResource extends ServerResource.  This class allows us to tie our rest services into other logic, such as accessing the datastore or other various config.  In this class I have created two methods, represent, and accept representation.  These will handle the associated Post and Get requests marked by their corresponding annotation.  Take notice of the @Get annotation on the represent method, I have specified that I will return type of "xml".  And then looking at the body of the represent method, I create a simple xml document, and populate and create a date element populated with today's date.  This date could be hard coded in the class or retrieved from the datastore, but this shows the basic idea of returning the date from a restful service.  Take a look at the full classes below.&lt;br /&gt;&lt;br /&gt;TestApplication.java&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;import org.restlet.Application;&lt;br /&gt;import org.restlet.Restlet;&lt;br /&gt;import org.restlet.routing.Router;&lt;br /&gt;&lt;br /&gt;public class TestApplication extends Application{&lt;br /&gt;&lt;br /&gt; /**&lt;br /&gt; * Creates a root Restlet that will receive all incoming calls.&lt;br /&gt; */&lt;br /&gt;@Override&lt;br /&gt;public synchronized Restlet createRoot() {&lt;br /&gt;    // Create a router Restlet that routes each call to a&lt;br /&gt;    // new Resource&lt;br /&gt;    Router router = new Router(getContext());&lt;br /&gt;&lt;br /&gt;    router.attachDefault(TestResource.class);&lt;br /&gt;    return router;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;TestResource.java&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;import java.util.Date;&lt;br /&gt;&lt;br /&gt;import org.restlet.data.MediaType;&lt;br /&gt;import org.restlet.ext.xml.DomRepresentation;&lt;br /&gt;import org.restlet.representation.Representation;&lt;br /&gt;import org.restlet.resource.Get;&lt;br /&gt;import org.restlet.resource.Post;&lt;br /&gt;import org.restlet.resource.ServerResource;&lt;br /&gt;import org.w3c.dom.Document;&lt;br /&gt;import org.w3c.dom.Element;&lt;br /&gt;&lt;br /&gt;public class TestResource extends ServerResource{&lt;br /&gt;&lt;br /&gt; @Get("xml")&lt;br /&gt;  public Representation represent(){&lt;br /&gt;  // Generate the right representation according to its media type.&lt;br /&gt;          try {&lt;br /&gt;           DomRepresentation domRep = new DomRepresentation(MediaType.TEXT_XML);&lt;br /&gt;              // Generate a DOM document representing the list of&lt;br /&gt;              // items.&lt;br /&gt;              Document d = domRep.getDocument();&lt;br /&gt;              Element r = d.createElement("expire_date");&lt;br /&gt;              d.appendChild(r);&lt;br /&gt;               Element date = d.createElement("date");&lt;br /&gt;               date.appendChild(d.createTextNode(new Date().toLocaleString()));&lt;br /&gt;               r.appendChild(date);&lt;br /&gt;              d.normalizeDocument();&lt;br /&gt;  &lt;br /&gt;              // Returns the XML representation of this document.&lt;br /&gt;              return domRep;&lt;br /&gt;          } catch (IOException e) {&lt;br /&gt;              e.printStackTrace();&lt;br /&gt;          }&lt;br /&gt;  return null;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; @Post&lt;br /&gt;  public Representation acceptRepresentation(Representation entity){&lt;br /&gt;  //Could process some post requests here and possibly write to the datastore&lt;br /&gt;  return null;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The only thing left to do now is configure the web.xml to route to our servlet correctly.  Open war/WEB-INF/web.xml, and delete the generated web-app config tags and add the following.  Here we are intercepting all requests for simplicity, but these could be changed, and routing everything to our test.TestApplication class, change this to whatever you named your application class above.&lt;br /&gt;&lt;br /&gt;web.xml&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5"&amp;gt;&lt;br /&gt; &amp;lt;display-name&amp;gt;first steps servlet&amp;lt;/display-name&amp;gt;&lt;br /&gt; &amp;lt;!-- Application class name --&amp;gt;&lt;br /&gt; &amp;lt;context-param&amp;gt;&lt;br /&gt;  &amp;lt;param-name&amp;gt;org.restlet.application&amp;lt;/param-name&amp;gt;&lt;br /&gt;  &amp;lt;param-value&amp;gt;&lt;br /&gt;   test.TestApplication&lt;br /&gt;      &amp;lt;/param-value&amp;gt;&lt;br /&gt; &amp;lt;/context-param&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;!-- Restlet adapter --&amp;gt;&lt;br /&gt; &amp;lt;servlet&amp;gt;&lt;br /&gt;  &amp;lt;servlet-name&amp;gt;RestletServlet&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;  &amp;lt;servlet-class&amp;gt;org.restlet.ext.servlet.ServerServlet&amp;lt;/servlet-class&amp;gt;&lt;br /&gt; &amp;lt;/servlet&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;!-- Catch all requests --&amp;gt;&lt;br /&gt; &amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;  &amp;lt;servlet-name&amp;gt;RestletServlet&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;  &amp;lt;url-pattern&amp;gt;/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt; &amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;&amp;lt;/web-app&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;That is it, you can now run this with the embedded server provided by the GAE eclipse plugin by running your application as a google web application, and directing your browser to http://localhost:8080/.  You should see the xml returned by the request with today's date.  When you are ready you can deploy the application to the app server and access it from your appspot address.  In my next post I will go over how to consume this request from an android application.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;****UPDATE(8-10-09)*****&lt;br /&gt;I have been informed that some distributions of restlet do not include the app engine jar, it should be noted that this is only available on Version 2.0, and Milestone 3 according to the release notes.   If you go &lt;a href="http://www.restlet.org/downloads/2.0/"&gt;here&lt;/a&gt; and download restlet-2.0m3.zip, it should contain the jar file.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4182612167066186067-5490723856525218965?l=broschb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://broschb.blogspot.com/feeds/5490723856525218965/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4182612167066186067&amp;postID=5490723856525218965' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4182612167066186067/posts/default/5490723856525218965'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4182612167066186067/posts/default/5490723856525218965'/><link rel='alternate' type='text/html' href='http://broschb.blogspot.com/2009/08/restful-service-on-google-app-engine.html' title='Restful Service on Google App Engine'/><author><name>broschb</name><uri>http://www.blogger.com/profile/11782431763402290064</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4182612167066186067.post-3094478433918543170</id><published>2009-06-25T21:02:00.001-07:00</published><updated>2009-06-25T21:06:38.156-07:00</updated><title type='text'>Importing large datasets in MySql</title><content type='html'>&lt;span style="font-family: georgia;"&gt;    &lt;span style="font-size:85%;"&gt;I have been working a new website &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: georgia;font-size:85%;" &gt;&lt;a href="http://www.cyclebrain.com/" id="r0jd" title="cyclebrain.com"&gt;cyclebrain.com&lt;/a&gt;.  This website will be a bicycle journal and statistics management site.  Allowing a user to track all kinds of statistics about their bicycles, rides, and equipment they use, or that is part of their bicycle.  The website is up and currently I am allowing beta testers, so if you're interested then go the &lt;a href="http://www.cyclebrain.com/" id="osk4" title="sign up now!!"&gt;site&lt;/a&gt; and request to be a beta user, you will be able to give feedback as to what features you would like, as well as any other changes you think would make the site great.&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: center; font-family: georgia;"&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:85%;"&gt;        But enough about the site for now, I will post future posts about the site, and the technology I am using as well as obstacles I have had to overcome, both to give credit to those who have made what I want to achieve easier, and also as a way for me to log things I don't want to forget.&lt;br /&gt;&lt;br /&gt;  The first thing I would like to write about is how to import large data sets into a MySQL database.  For &lt;a title="cyclebrain" href="http://www.cyclebrain.com/" id="c5wr"&gt;cyclebrain&lt;/a&gt; I have some database tables where I store information to allow a user to select the country, state, and city there are from as part of the user preferences.  This is great, except one of the import files is over 300MB!  This has caused issues with the interface my hosting provider has provided.  I have tried a few different tactics to achieve this, such as using MySQL QueryBrowser and trying to execute the scripts, this took way too long and I was losing my connection to the database.  I also tried uploading the files and connecting to the database via an ssh client, this too did not work.  I also tried splitting the file into smaller files and running those, this worked the best but I was still getting timeout errors, and I was tired of tracking which files I had run, and which had errors.&lt;br /&gt;&lt;br /&gt;  I just happened to be browsing &lt;a title="dzone" href="http://www.dzone.com/" id="iv.v"&gt;dzone&lt;/a&gt; and came across a &lt;a title="post" href="http://qualitypoint.blogspot.com/2009/02/mysql-importing-large-sql-file.html" id="aqbu"&gt;post&lt;/a&gt; where someone was running into the same issue, and in the comments there was a link to &lt;a title="BigDump" href="http://www.ozerov.de/bigdump.php" id="rlzm"&gt;BigDump&lt;/a&gt;.  BigDump is great.  It takes a large sql file and breaks it up into smaller sessions, so issues like timeouts, are less prone to being encountered.  You simply just upload a php file to your server, and put the sql files in the same, web accessible, directory.  You then just bring up the page in your browser.  It lists all of the sql files, and give you the option to run them.  It couldn't be simpler.  BigDump does have some restrictions with the files it can handle and the formats, but for my files, simple sql inserts it worked great.  One problem that I did have was BigDump stopping on any errors in my sql file.  I ran into primary key constraint violations, after checking my file I did not notice these inconsistencies, I'm thinking it may have something to do with the way BigDump breaks up the requests, and maybe there was some duplication in the queries at the end of one request, and the beginning of another.  No matter, I just commented out the code that stops the process on this error and ran it again.  No problems, this worked for me, as I can deal with a few rows missing.  I may go back and log these so I can make sure they worked, but for now this works, and &lt;a title="BigDump" href="http://www.ozerov.de/bigdump.php" id="baaa"&gt;BigDump&lt;/a&gt;has saved me some headaches.&lt;br /&gt;&lt;br /&gt; &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4182612167066186067-3094478433918543170?l=broschb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://broschb.blogspot.com/feeds/3094478433918543170/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4182612167066186067&amp;postID=3094478433918543170' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4182612167066186067/posts/default/3094478433918543170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4182612167066186067/posts/default/3094478433918543170'/><link rel='alternate' type='text/html' href='http://broschb.blogspot.com/2009/06/importing-large-datasets-in-mysql.html' title='Importing large datasets in MySql'/><author><name>broschb</name><uri>http://www.blogger.com/profile/11782431763402290064</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4182612167066186067.post-6562718254406486979</id><published>2008-05-24T16:39:00.000-07:00</published><updated>2008-12-11T08:30:41.849-08:00</updated><title type='text'>Photo Collage</title><content type='html'>&lt;div style="text-align: left;"&gt;The other day I was surfing the new on &lt;a href="http://www.dzone.com/links/index.html"&gt;dzone,&lt;/a&gt; and came across a link to the following photoshop &lt;a href="http://www.photoshopessentials.com/photo-effects/polaroids/"&gt;tutorial&lt;/a&gt;.  I though this was cool, and since I don't have photoshop, I was going to try and create this via &lt;a href="http://www.gimp.org/"&gt;gimp,&lt;/a&gt; which I have done with many photoshop tutorials.  The more I looked at this, the more I though about writing an application to automate this task, and just to see if I could do it.  I wrote the application using java, and their is a screenshot of it in action below.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_-vPAW2KrXVQ/SDisetkxqxI/AAAAAAAAAC8/dt4jKPguMG4/s1600-h/photoCollageScreen"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_-vPAW2KrXVQ/SDisetkxqxI/AAAAAAAAAC8/dt4jKPguMG4/s400/photoCollageScreen" alt="" id="BLOGGER_PHOTO_ID_5204099013056506642" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The application supports using any background image you like, adding extra polaroid like photos, adding drop shadows to the photos, and moving and rotating the photos.  You can also save your newly created work of art  as well, you can see the lovely image of my son fixing his bike that I created below.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_-vPAW2KrXVQ/SDiuZdkxq0I/AAAAAAAAADU/mt1DfXUwj3w/s1600-h/reedBike.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_-vPAW2KrXVQ/SDiuZdkxq0I/AAAAAAAAADU/mt1DfXUwj3w/s400/reedBike.png" alt="" id="BLOGGER_PHOTO_ID_5204101121885449026" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I will probably provide more details of what was involved to create the application in another post, or I may update this post.  There are still many things that could be done to make it more functional, but hey it's not bad for a few hours of work.  It probably would have taken me more time to recreate this image in Photoshop or Gimp, but hey I'm no artist.  You can try the application out for yourself by pressing the orange button below.   Once the application opens up, click select photo to load a photo of your choice, don't worry the screen will still look black after doing this, then click add photo to add a polaroid.  You should now see your background image showing through the photo, add a few more and have fun.  NOTE:  You will need to have java 5 or greater installed, if you do not have it you can click on the 'Get Java Software' button below.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;p align="center"&gt;&lt;a href="http://www.jroller.com/bones/resource/webstart/photoCollage.jnlp"&gt;        &lt;img style="border-style: none;" src="http://www.jroller.com/bones/resource/webstart/jws-button.png" alt="Launch Button" height="23" width="88" /&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://java.com/java/download/index.jsp?cid=jdp128800" target="_blank"&gt;&lt;br /&gt;&lt;img style="margin: 8px;" alt="GetJava Download Button" title="GetJava" src="http://java.com/en/img/everywhere/getjava_med.gif?cid=jdp128800" border="0" height="43" width="100" /&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4182612167066186067-6562718254406486979?l=broschb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://broschb.blogspot.com/feeds/6562718254406486979/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4182612167066186067&amp;postID=6562718254406486979' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4182612167066186067/posts/default/6562718254406486979'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4182612167066186067/posts/default/6562718254406486979'/><link rel='alternate' type='text/html' href='http://broschb.blogspot.com/2008/05/photo-collage.html' title='Photo Collage'/><author><name>broschb</name><uri>http://www.blogger.com/profile/11782431763402290064</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_-vPAW2KrXVQ/SDisetkxqxI/AAAAAAAAAC8/dt4jKPguMG4/s72-c/photoCollageScreen' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4182612167066186067.post-2422130336829601504</id><published>2008-05-21T16:33:00.000-07:00</published><updated>2009-08-05T10:58:32.244-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Dynamic Jasper Report Using Crosstabs</title><content type='html'>&lt;span style=";font-family:arial;font-size:100%;"  &gt;Today I was doing some searching for creating dynamic jasper reports, i.e. not have my columns defined in my report template.  This &lt;a href="http://www-128.ibm.com/developerworks/websphere/library/techarticles/0505_olivieri/0505_olivieri.html"&gt;article&lt;/a&gt; is a well known reference that discuss modifying the xml template at run time using velocity.  This seemed like overkill for what I wanted to accomplish.  So I continued searching and found references to using crosstabs to accomplish what I needed.&lt;br /&gt;&lt;br /&gt;Unfortunately I was unable to find any examples on generating a report using crosstabs.  The Jasper Reports example didn't apply to my scenario, and I feel it didn't apply to the majority of users needs.  The forums for ireport and Jasper Reports contain many entries with developers struggling to get crosstabs working.  So below is a simple example of how to accomplish this using a &lt;a href="http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/data/JRBeanCollectionDataSource.html"&gt;JRBeanCollectionDataSource&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The first thing I needed to do was create a simple bean to use in the datasource.  I created a simple class called MyBean.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:times new roman;"&gt;public class MyBean {&lt;/span&gt; &lt;span style="font-family:times new roman;"&gt;    String header;&lt;/span&gt; &lt;span style="font-family:times new roman;"&gt;    String row;&lt;/span&gt; &lt;span style="font-family:times new roman;"&gt;    String value;&lt;br /&gt;&lt;br /&gt;public MyBean(String header, String row,String value){&lt;br /&gt;this.row = row;&lt;br /&gt;this.header = header;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:times new roman;"&gt;        this.value = value;&lt;br /&gt;} &lt;/span&gt;&lt;span style="font-family:times new roman;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;Next I created some simple beans and added them to my datasource.  And generated the report based upon my template.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;        ArrayList&lt;mybean&gt; beans = new ArrayList&lt;mybean&gt;();&lt;br /&gt;MyBean a1 = new MyBean("header1","row1","VA&lt;/mybean&gt;&lt;/mybean&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;mybean&gt;&lt;mybean&gt;LUE1");&lt;br /&gt;MyBean a2 = new MyBean("header2","row1","VALUE2");&lt;br /&gt;MyBean a3 = new MyBean("header3","row1","VALUE3");&lt;br /&gt;beans.add(a1);&lt;br /&gt;beans.add(a2);&lt;br /&gt;beans.add(a3);&lt;br /&gt;&lt;/mybean&gt;&lt;/mybean&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;mybean&gt;&lt;mybean&gt;        MyBean b1 = new MyBean("header1","row2","VALUE1");&lt;br /&gt;MyBean b2 = new MyBean("header2","row2","VALU&lt;/mybean&gt;&lt;/mybean&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;mybean&gt;&lt;mybean&gt;E2");&lt;br /&gt;MyBean b3 = new MyBean("header3","row2","VALUE3");&lt;br /&gt;beans.add(b1);&lt;br /&gt;beans.add(b2);&lt;br /&gt;beans.add(b3);&lt;br /&gt;&lt;br /&gt;JRBeanCollectionDataSource ds = new JRBeanCollectionDataSource(beans);&lt;br /&gt;&lt;br /&gt;&lt;/mybean&gt;&lt;/mybean&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;mybean&gt;&lt;mybean&gt;&lt;span style="font-size:100%;"&gt;So now I have my datasource defined.  For each row that I generate I can have as many columns as I want giving each column a unique name.  To add a new row, I simply create new beans with a new row name.  And for each column I can pass in a value.&lt;br /&gt;&lt;br /&gt;To create the report template, add three fields, as defined in our bean above.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/mybean&gt;&lt;/mybean&gt;&lt;/span&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_-vPAW2KrXVQ/SDS6J3gjBSI/AAAAAAAAACU/mlXYdabc6UQ/s1600-h/snapshot1.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_-vPAW2KrXVQ/SDS6J3gjBSI/AAAAAAAAACU/mlXYdabc6UQ/s200/snapshot1.png" alt="" id="BLOGGER_PHOTO_ID_5202988148201817378" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:100%;"&gt;Then we need to create a crosstab.  When creating make a row group using the $F{row} value for the row group bucket expression, and the $F{header} for the header group bucket expression.  Lastly set up the measure as follows.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_-vPAW2KrXVQ/SDS7bXgjBUI/AAAAAAAAACk/Tt07ko2WYbI/s1600-h/snapshot2.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_-vPAW2KrXVQ/SDS7bXgjBUI/AAAAAAAAACk/Tt07ko2WYbI/s320/snapshot2.png" alt="" id="BLOGGER_PHOTO_ID_5202989548361155906" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;And when you generate your report you should have something like the following.  This could use some cleaning up but gives the general idea, and hey, it's more information than I was able to find.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_-vPAW2KrXVQ/SDS9RXgjBWI/AAAAAAAAAC0/B4T7eXTyBqc/s1600-h/snapshot3.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_-vPAW2KrXVQ/SDS9RXgjBWI/AAAAAAAAAC0/B4T7eXTyBqc/s400/snapshot3.png" alt="" id="BLOGGER_PHOTO_ID_5202991575585719650" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;UPDATE&lt;br /&gt;&lt;/span&gt;As requested here is the &lt;a href="http://broschb.googlepages.com/crosstabtest.jrxml"&gt;jrxml&lt;/a&gt; file for the crosstab report.  In addition I have started to experiment with using the jasper reports api to create a report from a template or from scratch.  This works well for some other scenarios that I have come across.  The one nice thing about crosstabs though, is that it handles the wrapping of columns to new pages when they exceed the page width.  Another option is &lt;a href="http://dynamicjasper.sourceforge.net/"&gt;Dynamic Jasper&lt;/a&gt;, I briefly looked at this, and it looks pretty nice, but using the api directly was a better solution at the time.  As with any report, I don't think there is one magic bullet to solve all problems, and each problem must be looked at uniquely to determine the best approach.&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4182612167066186067-2422130336829601504?l=broschb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://broschb.blogspot.com/feeds/2422130336829601504/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4182612167066186067&amp;postID=2422130336829601504' title='33 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4182612167066186067/posts/default/2422130336829601504'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4182612167066186067/posts/default/2422130336829601504'/><link rel='alternate' type='text/html' href='http://broschb.blogspot.com/2008/05/dynamic-jasper-report-using-crosstabs.html' title='Dynamic Jasper Report Using Crosstabs'/><author><name>broschb</name><uri>http://www.blogger.com/profile/11782431763402290064</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_-vPAW2KrXVQ/SDS6J3gjBSI/AAAAAAAAACU/mlXYdabc6UQ/s72-c/snapshot1.png' height='72' width='72'/><thr:total>33</thr:total></entry></feed>
