Clean Eating

cleanEatinMemeI have been suffering for a while with bad Sinus infections. They would normally happen a few times a year and they would really knock me for a week or so, resulting in a course of Antibiotics to clear the infection.

I decided that I had to do something about it so I made an appointment with the Allergy and Treatment Clinic. I wasn’t quite sure what to expect but I went through the various tests and discussed the outcomes.

So it turns out that my digestive system was pretty shot from all of the Antibiotics. It had never occurred to me to take a dose of probiotics to help build up my immune system again! I was also drinking way too much Coffee which was having a bad affect on me. To top all this, I was Lactose intolerant!

So what was the Treatment?
Supplements to treat build up the digestive system again and Clean Eating.

Clean eating for me means cutting out all dairy, all refined foods, all high sugar foods (Especially Milk Chocolate, which I was a bit addicted to) as well as well as any stimulants like Coffee. I have been at it just over too week now and I am really seeing a benefit. My weight is obviously dropping but the big thing I have noticed is that my energy is “more even”. I am not getting big slumps where I am just too tired. I also have a lot more energy and stamina when I am running.




One of my favorite recipes that I have tried it is for a Flapjack snack that I bring to work:

2 cups oats
1 cup ground almonds
1/2 cup of broken pecans
Handful of whole almonds
1 cup gooey chopped dates*
1/2 cup raisins or presoaked goji berries
3/4 cup broken banana chips
1 teaspoon cinnamon
1-2 teaspoons ground nutmeg
1/2 cup raw agave, maple syrup or honey
1 cup extra virgin coconut oil

You can see the full recipe here.

, , , ,

No Comments

How to add namespace attribute to XmlType Annotation in XJC generated Classes

I recently came across a really frustrating issue on a client site when trying to marshal a webservice response. The client code was generated using the XJC compiler in ANT and worked fine in local unit tests and when called on a JBoss application server running locally. The problem occurred when we tried to run the same code on a old application server that is used in production. We kept getting the following error:

com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 219 counts of IllegalAnnotationExceptions
Two classes have the same XML type name "". Use @XmlType.name and @XmlType.namespace to assign different names to them.
        this problem is related to the following location:

It looked like the other application server was not able to able to see the namespace for the generated classes that was generated in package-info.java. As a result there was a conflict with any class in the generated code with the same class name when the response was unmarshalled. We were using the standard Spring Jaxb2Marshaller so I know it could not be that:


	
		
			……
        	
	
 

I searched the web for information on how to add the namespace attribute to the generated classes but there were a lot of people looking for the same information and not answers:
How do I add a namespace attribute to an element in JAXB when marshalling?
Finally I found this page (http://www.java.net/node/655594) and the suggestion to use the “-npa” argument to the xjc compiler. This argument tells the compiler to suppress generation of package level annotations (**/package-info.java). You can see a full list of XJC commands here.

You can added it to the ant task as follows:

    

          
          
          	
          

This will tell the XJC compiler to add the namespace attribute to the @XMLType annotation:

@XmlType(name = "GeneratedClass", namespace = "http://www.mynamespace.com/API/V2", propOrder = {
	    "value"
})	

The marshaller is now able to map between the node in the response and the correct class.

, , ,

6 Comments

How to get started in Android

Google have launched Android Training.  This will give Android beginners a step by step approach to getting started with Android.

It is a problem driven approach so each class will look at a problem and show how it should be approached.  There are plenty of sample apps to get you started.

I would recommend that you place close attention to the following classes:

Designing for Multiple Screens

This class will show you how to avoid common mistakes when trying to cater for the various Android screen sizes and also how to adapt your UI for various screen flows.  If you design your app with multiple screen sizes in mind from the start it will save you a lot of pain later.

Optimizing Battery Life

This is a great lesson that teaches you how to save battery power by disabling background tasks when the state of the device changes.  Such as loss of connectivity.

As well as Android Training, there are lots of other articles and tutorials.  This should get you well on the way to developing your first Android App.





Mobiletuts+ Tutorials

However, if you a looking for more Android tutorial resources, it is worth checking out Mobiletuts+ tutorials for Android.  They have lots of *really* good tutorials from beginner to advanced.   They also have some specialised premium tutorials that take you to the next level but there are lots of free ones to get you started.

 

Here is a sample of some of my favourite tutorials from Mobiletuts+:

 

How to Publish to the Android Market

This tutorial gives you step by step of how to get your finished app published in the Android Market from checking what permissions you require to deciding on the SDK compatibility.

 

 

 

Android Fundamentals: Working With Content Providers

This is the first of a series of tutorials on Android Fundamentals.   I would recommend working though all of the tutorials in this series.  This tutorial will show you how Android uses content providers to enable applications to share and use data.

 

 

 

Android User Interface Design: Working With Fragments

This tutorial is part of another great series from Mobiletuts+ on Android UI Design.  Fragments were introduced to allow you to break your UI into separate independent parts.  On a larger screen such as a tablet multiple fragments can be show at ones.   Fragments were introduced as part of  3.0 but you can add it to 1.6+ apps.   This tutorial will show you what you need to get started.

 

, , , ,

1 Comment

How to apply CCS3 media query techniques in Android Development

Here is a great post from RomanNurik on the Android developer blog.

The number of people working on mobile apps, and specifically Android, is growing fast. Since modern mobile software-development is a relatively new profession, the community is growing by sucking in experts from related domains, one being web design and development.

It turns out that familiarity with web UI development, particularly using modern HTML5 techniques, can be a great primer for Android UI development. The Android framework and SDK have many analogues to tools and techniques in the Web repertoire of HTML, CSS, and JavaScript.

In this blog post, we’ll walk through a few web development features and look for matches in the world of Android UI development.

He discuses how you can apply many of the custom layouts used in Css3 media queries in Android layout development.  Rather than repeating, the whole post here, jump over to the Android developer blog and have a look at the post.

, , , ,

No Comments

Android Fragments now available for Android 1.6 or higher

Google have released the fragment API which is part of 3.0 as a static library.

Fragements allow screen elements to be broken into framents, that be arranged depending on the screen size of the device. This is great for 3.0 developers that develop for tablets as it allows you to also design for a smaller resolution screen.

Until now this was only available to android 3.0 but the new static library allows anyone that develops for Android 1.6 and higher to import the static library.

This library is available through the SDK Updater; it’s called “Android Compatibility package”.

If you wan to learn more about Fragments and what they can be used for, have a look at this post from Dianne Hackborn.

, , , , , ,

1 Comment