How to test Applications using Eclipse ? (Introducing my new book)

16 May

Application testing plays very important role in any development process.  After spending numerous hours on it, I have decided to put what I felt was important in to a short book, which is intended to help developers  to get  started with  application testing using Eclipse.

918Y5X8TILL._AA1500_

The book is very practical, there is almost no theory, just recipes that introduce essential concepts of testing such as Breakpoints and JUnit tests.It is short and strict to the point. You can read it and do all the recipes in one day, and in the end, you will have deep understanding of how to debug your application using Eclipse.

The book is available in paperback as well as ebook formats.

WeightTracker Android App Prototype Demo Video

6 May

Here is one of the applications I was talking about in the last post. This app prototype was created by our team specifically for Ontario Center of Excellence contest. It took us around 3 weeks to develop it. No more words, everything else is in the video. Enjoy :)

 

Recognition from Seneca College

8 Apr

Today I have received congratulatory letter from Seneca College President for participating in 2 projects sponsored by Ontario Center Of Excellence.

I will tell you more about both projects in the upcoming months.

20130408-203122.jpg

Java Helper Class: BMI calculator, lb to kg converter, kg to lb converter, feet to cm converter, cm to feet converter

22 Mar

Hey Guy’s,

Long time no seen. Today I want to share with you Java helper class that I have designed for one  of the projects I am working on. This class will be useful for you, if your application works with height and weight conversions, also if you need to calculate Body Mass Index.

My helper class has following functionality:

- Kg to Lb Converter
- Lb to Kg Converter
- BMI (Body Mass Index) Calculator and “Classificator
- Feet to Cm Converter
- Cm to Feet Converter

Here is the class:

import java.text.DecimalFormat;

/**
* This class is used for any calculations connected with Weight and Height
*  - KG to LB converter (and vice versa)
*  - Feet to Cm converter (and vice versa)
*  - BMI Calculation
*
*/
public class HeightWeightHelper {

/**
*
* @param value double that is formatted
* @return double that has 1 decimal place
*/
private double format ( double value) {
  if ( value != 0){
   DecimalFormat df = new DecimalFormat("###.#");
   return Double.valueOf(df.format(value));
 } else {
   return -1;
 }
}

/**
*
* @param lb - pounds
* @return kg rounded to 1 decimal place
*/
public double lbToKgConverter(double lb) {
  return format(lb * 0.45359237 );
}

/**
*
* @param kg - kilograms
* @return lb rounded to 1 decimal place
*/
public double kgToLbConverter(double kg) {
  return format(kg * 2.20462262);
}

/**
*
* @param cm - centimeters
* @return feet rounded to 1 decimal place
*/
public double cmToFeetConverter(double cm) {
  return format(cm * 0.032808399 );
}

/**
*
* @param feet - feet
* @return centimeters rounded to 1 decimal place
*/
public double feetToCmConverter(double feet) {
  return format(feet * 30.48 );
}

/**
*
* @param height in <b>cm</b>
* @param weight in <b>kilograms</b>
* @return BMI index with 1 decimal place
*/
public double getBMIKg (double height, double weight) {
  double meters = height/100;
  return format( weight / Math.pow(meters,2));
}

/**
*
* @param height in <b>feet</b>
* @param weight in <b>pounds</b>
* @return BMI index with 1 decimal place
*/
public double getBMILb (double height, double weight) {
  int inch = (int)(height *12);
  return format((weight*703) / Math.pow(inch, 2));
}

/**
*
* @param bmi (Body Mass Index)
* @return BMI classification based on the bmi number
*/
public String getBMIClassification (double bmi) {

 if (bmi <= 0) return "unknown";
 String classification;

 if (bmi < 18.5) {
  classification = "underweight";
 } else if (bmi < 25) {
  classification = "normal";
 } else if (bmi < 30) {
  classification = "overweight";
 } else {
  classification = "obese";
 }

 return classification;
}

}//end of class

P.S If you want to have JUnit tests for this class let me know, I have them too :)

Regards,

Anatoly

How to setup ADT (Android Development Tools) on 64bit Fedora 17 ?

9 Jan

Quick Intro

Yesterday I was excited to receive a task to install ADT for Eclipse and Android SDK on my machine , I thought it would be a “piece of cake”, so with a high level of excitement I have started….

As I use  my laptop with Fedora 17 (64bit) for all my developments, I have decided that I will put my Android Development Tools in it as well.

Installation…

As my first step I went to the http://developer.android.com/sdk/index.html and thankfully there is ADT bundle for Linux 64-bit, which consists of custom version of Eclipse Juno, equipped with everything one needs for Android development and  Android SDK that includes such tools as Android debugger and Emulator.

After downloading Android SDK I have run Eclipse, and surprisingly, instead of default Eclipse intro, ADT-equipped Eclipse has fancy intro:

adt-intro

ISSUE 1: Android Project Replaced with Android Application Project

After Eclipse has fully loaded, I have decided to create an Android Project. My instructions said that I need to go to File -> New – >”Android Project”. Unfortunately, the version that I have installed does not have option “Android Project”. Closest option to “Android Project” was “Android Application Project”. Here is the screenshot:

Android Development_tools_create_project

After trying to find “Android Project” for at least half an hour, I have discovered that other people have the same issue:

http://stackoverflow.com/questions/11329753/no-android-project-option-in-eclipse
http://stackoverflow.com/questions/11604641/difference-between-android-application-project-and-android-project

Solution:

So my decision was to use “Android Applciation Project”, I have just unchecked option to select launch icon.

I have set Project name, Package name and Activity. Everything seemed to be fine and my project was populated with whole bunch of android related files.

ISSUE 2: R Cannot be resolved to a variable   and adb cannot be found

After project files were generated I have faced my next problem. In my src file I had 2 errors regarding “R” which cannot be resolved. After doing a research again I have found out that even more people have the same issue:

http://stackoverflow.com/questions/7906606/after-installing-android-adt-14-r-cannot-be-resolved
http://stackoverflow.com/questions/885009/r-cannot-be-resolved-android-error
http://stackoverflow.com/questions/8266100/r-cannot-be-resolved-in-eclipse-android-project
http://stackoverflow.com/questions/7824730/r-cannot-be-resolved-to-a-variable
…………

Most of the advices were to clean and rebuild the project which did not gave me any results. One of the advice was to install ia32-lib, however this library is available for other “distros”, but not Fedora.
After 2 hours of trying different stuff, which did not work, I have found out the cause of the problem.

Reason of the error:

The reason why R cannot be resolved is because R should point to the R.java file, which is auto generated and is located in the gen folder. In our case R.java was not generated, thus Eclipse was not able to resolve it.

Together with “R cannot be resolved” error, Eclipse Error Log gave me one more error which looked like this:

Unexpected exception 'Cannot run program 
"/home/aspektor/adt-bundle-linux-64/sdk/platform-tools/adb": error=2 
No such file or directory' while attempting to get adb version from

It looked to me that these problems are connected.

Solution:

After couple of hours of trying tons of different things, I have realized that the reason of the problem is that Android SDK is initially intended for 32 bits. As I have 64bit Linux I need to install additional 32bit packages to make it work.

Thankfully I have found wonderful guide, that helped me in solving most of my issues:

http://fedoraproject.org/wiki/HOWTO_Setup_Android_Development

I have run this command to install 32bit packages:

# yum install glibc.i686 glibc-devel.i686 libstdc++.i686 
zlib-devel.i686 ncurses-devel.i686 libX11-devel.i686 
libXrender.i686 libXrandr.i686

I have also set up PATH in ~/.bash_profile so adb and other tools can be found:

export ANDROID_SDK_HOME=/home/aspektor/adt-bundle-linux-64/sdk
PATH=$PATH:$HOME/adt-bundle-linux-64/sdk:$HOME/adt-bundle-linux-64/tools
export PATH
# For SDK version r_08 and higher, also add this for adb:
PATH=$PATH:$HOME/adt-bundle-linux64/sdk/platform-tools
export PATH

Finally, I have restarted Eclipse, cleaned and rebuild my project and 5 hours later..... tired but satisfied I have created ADV (emulator) and run my ADT project.

Thankfully it worked:

eclipse-works

After-thoughts…

I think it would be reasonable for Android website to ADVICE (put it in bold and somewhere where everyone could see? ) people who have 64-bit Linux need additional 32 bit libraries. It would save folks like me a lot of time. Not saying that these packages should be per-requisite before downloading bundle :)

If you have any other comments, go ahead, I would love to hear them!

Regards,

Anatoly

Eclipse Platform: Eclipse runs and is usable on GTK+ 3 [STATUS REPORT 20 NOVEMBER]

20 Nov

If you are passionate about SWT as development tool, you will be very excited to know that SWT runs on GTK+ 3 and it is usable! You have probably seen post, couple of weeks ago, that Eclipse starts successfully.  Today I want to show you a screenshot of how Eclipse on GTK+ 3 looks like  after couple of weeks of debugging:

Eclipse screenshot on GTK+3

Image is clickable !

Of course there are number of issues, that should  be resolved, but the progress is obvious!
I will keep you posted :)
Cheers,

Anatoly

 

Check out more posts on “SWT migration From GTK+ 2 to GTK+ 3″

Eclipse SWT builds against GTK+ 3 (Status Report 30 October 2012). First look at ControlExample on GTK+ 3

30 Oct

As I have promised before, I’ll be making status reports on migration of SWT to GTK+ 3 more often from now.

Couple of weeks passed, since I’v posted that we are moving with a good speed towards the goal of building against GTK+ 3.0.  And with great pleasure I want to inform you that, last week we were able to build with GTK+ 3.0 and see the shell with Hello World on it.

Today we went even further, and for the first time, I want to show you how ControlExample looks like in GTK+ 3.0 ( to make it work you need to comment out line 108 as BrowserTab produces errors that stops ControlExample to be displayed):

ControlExample picture running on GTK 3

Of course it is far from perfect, but I would say that it is a big step forward considering, that 4 months ago we had bunch of errors (116?) that prevented us from building at all. 

What’s Next ?  Debugging…debugging….debugging….

I will keep you posted :)

Regards,
Anatoly

 

Check out more posts on “SWT migration From GTK+ 2 to GTK+ 3″

Follow

Get every new post delivered to your Inbox.

Join 273 other followers

%d bloggers like this: