Tuesday, September 30, 2014

App testing on a device

Most of the time when testing and debugging  code an emulator is used. Once a working version of code is complete, I test on actual device such as a phone and tablet. An unexplained snag happen with the phone though. For some reason Eclipse did not see the device although my computer did. Previously it had been working.  I tried restarting Eclipse as well as the phone , neither of which   fixed the problem. I tried a tablet and that worked fine. Next I went to Google and did a search and came up with a few suggestions. One suggestion was to make sure USB debugging was checked. It was not and it was grayed out. No matter what was done it would not let me check it. Finally I found a solution, which is that when the USB is plugged in to the phone it won't allow you to change USB debugging setting. So with this new information I was able to correct the problem. All this left one question. How was the setting changed?

Thursday, September 25, 2014

Cursor position

While trying to compare data retrieved from the database I was using dbc.moveToPrevious in a while  loop and was getting the wrong data. I did not take in to account that the act of checking if the cursor could move to previous position, it actually moves the cursor. To fix that I used dbc.moveToNext() to put the cursor in to correct position.

I am getting closer to finishing my app. Three major things left to do is formatting, Internationalizing it and adding an advertisement banner. 



10,000 hour to Mastery.
10,000 - 611.5 = 9388.5 hours left

Monday, September 8, 2014

Fizz Buzz test

 While on G+ I came across a programming test which looked simple enough, FizzBuzzTest ,So I thought I would try it. My first attempt turned out to be very close to what was needed but it would print out 1, 2, FizzBuzz, Fizz, FizzBuzz....

public class FizzBuzz {

public static void main(String[] args) {
boolean flag = true;
for (int count = 1; count < 101; count++) {

if (count % 3 == 0) {
System.out.print("Fizz");
flag = false;
}
if (count % 5 == 0) {
System.out.print("Buzz");
flag = false;
}

if (flag){
System.out.print(count);
        flag = true;
                        }
System.out.print(" , ");
if (count % 10 == 0) System.out.println();
}
}
}

The problem is highlighted in red. I changed the flag inside the brackets of the if test.

The corrected version.
public class FizzBuzz {

public static void main(String[] args) {
boolean flag = true;
for (int count = 1; count < 101; count++) {

if (count % 3 == 0) {
System.out.print("Fizz");
flag = false;
}
if (count % 5 == 0) {
System.out.print("Buzz");
flag = false;
}

if (flag)
System.out.print(count);

flag = true;
System.out.print(" , ");
if (count % 10 == 0) System.out.println();
}
}
}

Also note that I removed the brackets for the if test since there is only one statement. Which is something I relearned. I became so use to adding brackets.

10,000 hour to Mastery.
10,000 - 603.5 = 9396.5 hours left