Tuesday, January 31, 2017

Codecademy

Per a friends referral, today I tried https://www.codecademy.com. My username was already taken so I must have tried this site a while back. I was able to reset my password and locate a course called "Learn Java". I liked that the dashboard looked very similar to CodeFights and figured it would be good practice for working up to using the CodeFights website. I did not find any other Java related courses in the catalog but figured I would give it a chance and maybe this course was required before showing other options.


I started working on the course "Learn Java". It was going ok considering I have a good deal of coursework behind me and was familiar with a lot of the things they were talking about such as variable types and writing equations with operators. It had a lot of hands on practice editing existing code but may be confusing to someone new to coding. It didn't offer much help if you were stuck on something. For example, I entered "5>7" with no spaces where they wanted "5 > 7". The previous example would work with no issue in an IDE or command prompt so I was somewhat disappointed.

I flew through the first 50% of the course with no issues and then tried to work on the Object Oriented section and the page just froze on a blank screen. I could go back to other sections with no issue. I rebooted my computer, cleared cookies and even tried another browser and no go on the next section. I'll add this to my notebook to do list for a later date but so far have been unimpressed with Codecademy.

Programming By Doing Lesson 12

Programming By Doing Lesson 12

Desired output:
My name is Jennifer Hurd and I'll graduate in 2099.

My working code:

public class StillUsingVariables
{

public static void main (String[] args )
{
int graduationYear;
String myName;

graduationYear = 2099;
myName = "Jennifer Hurd";

System.out.println("My name is " + myName + " and I'll graduate in " + graduationYear + "." );

}
}

Programming By Doing Lesson 11

Programming By Doing Lesson 11 - My Code

I am finding the programming by doing to be great practice. It does not use the IDE so it forces you to work a bit harder but the command prompt is great at returning errors that point to what the issue is.

On this lesson the desired output is:
This is room # 113
e is close to 2.71828
I am learning a bit about Computer Science

My working code:
public class UsingVariables
{

public static void main (String[] args )
{
int roomNumber;
double nearby;
String classRoom;

roomNumber = 113;
nearby = 2.71828;
classRoom = "Computer Science";

System.out.println("This is room # " + roomNumber);
System.out.println("e is close to " + nearby);
System.out.println("I am learning a bit about " + classRoom);


}
}

Learn Java Tutorial for Beginners, Part 30: Using Generics

Learn Java Tutorial for Beginners, Part 29: Upcasting and Downcasting

Monday, January 30, 2017

How to Use Git and GitHub - Udacity



Some of the references I have been using continue to refer to Git and GitHub, so I searched for a reference to what this is. So far I have been able to learn that these are for file sharing, saving old versions and comparing new versions. I also found out that there is a file compare feature built into Windows Command prompt called "FC". I used it below to compare the two files given in the Udacity example and here is the output:

C:\Users\jenni\Downloads>FC game_old.js game_new.js

Comparing files game_old.js and GAME_NEW.JS
***** game_old.js
KEY_CODES = {
  32: 'space',
***** GAME_NEW.JS
KEY_CODES = {
  13: 'enter',
  32: 'space',
*****

***** game_old.js
  37: 'left',
  38: 'up',
  39: 'right',
***** GAME_NEW.JS
  37: 'left',
  39: 'right',
*****

Notice that it shows differences between the old and new version of the files. This could be very useful.

As recommended by the video, I downloaded Sublime Text Editor and Git. They recommended opening Sublime from Git which was not working for me so I will revisit this later and try to resolve. In the meantime I have more understanding of what Github is used for.

Tuesday, January 24, 2017

Studying Progress Week 3

I am on week three of studying and today I am up to 139 hours of coding practice. This includes previous classwork on Java and Android. One thing I have figured out is that I get bored when just working on one learning resource for too long. I have decided to stagger the learning with websites and books to keep it interesting. So as I was looking around for more resources I stumbled upon Alice and downloaded Alice 2 which contained tutorials.



I found the link to this programming practice through the Oracle website. I was moving along with no problems on tutorials 1-3. But I ran into a known bug in tutorial 4 with placing a beach chair on the grass. After I reached this I could not get past it. Overall this seems like a good program to teach early programming but not for those ready for more of a challenge. I could have spent a few days placing pictures onto scenes and dragging and dropping commands but decided against it since time is important.  http://www.alice.org/index.php.

As an alternative, I downloaded Android Studio which is used to make Android apps. I had it on my old laptop but needed it again. I had gone to the Google Study Jam last year and took the Android for Beginners class on Udacity but missed the last class due to family illness and did not complete the program. I decided to start up again today and am going to add this to my to do list on my study plan.

Overall, I do feel like the learning is progressing. I am working on a plan to get more study hours in. My goal is 20hrs a week but I have fallen short the first couple weeks. I did set a high goal considering I work full time, so I am happy with 10-15hrs per week but still would like to aim for 20hrs. 

I have started a meetup at the local library to learn java with a first meeting in February. I believe this should help with the learning hours goal as well as get some other interested people to attend meetups with.


Learn Java Tutorial for Beginners, Part 28: Casting Numerical Values

Learn Java Tutorial for Beginners, Part 27: Encapsulation and the API Docs

Monday, January 23, 2017

Programming By Doing Lesson 10

Programming By Doing Lesson 10 - My Code

public class MoreVariablesAndPrinting
{
public static void main( String[] args )
{
String name, eyes, teeth, hair;
int age, height, weight;

name = "Zed A. Shaw";
age = 35;  //not a lie
height = 74;  //inches
weight = 180; //lbs
eyes = "Blue";
teeth = "White";
hair = "Brown";

double inToCm = height * 2.54;
double poundsToKilos = weight * 0.453592;

System.out.println( "Let's talk about " + name + "." );
System.out.println( "He's " + height + " inches (or " + inToCm + " cm) tall." );
System.out.println( "He's " + weight + " pounds (or " + poundsToKilos + " kg) heavy." );
System.out.println( "Actually, that's not too heavy." );
System.out.println( "He's got " + eyes + " eyes and " + hair + " hair." );
System.out.println( "His teeth are usually " + teeth + " depending on the coffee." );

//This line is tricky; try to get it exactly right.
System.out.println( "If I add " + age + ", " + height + ", and " + weight + " I get " + (age + height + weight) + "." );

}
}

My output from command prompt is slightly different probably because I used a double variable. 

c:\Users\jenni\OneDrive\Documents\CompSci>java MoreVariablesAndPrinting
Let's talk about Zed A. Shaw.
He's 74 inches (or 187.96 cm) tall.
He's 180 pounds (or 81.64656 kg) heavy.
Actually, that's not too heavy.
He's got Blue eyes and Brown hair.
His teeth are usually White depending on the coffee.
If I add 35, 74, and 180 I get 289.

Programming By Doing Lesson 9

Programming By Doing Lesson 9 - My code

//declare the class public - available to anyone
public class VariablesAndNames
{
//declare the main method which does not return anything
public static void main ( String[] args )
{
//declare five number variables
int cars, drivers, passengers, cars_not_driven, cars_driven;
double space_in_a_car, carpool_capacity, average_passengers_per_car;

//assign the variables a value
cars = 100;
space_in_a_car = 4.0;
drivers = 30;
passengers = 90;
cars_not_driven = cars - drivers;
cars_driven = drivers;
carpool_capacity = cars_driven * space_in_a_car;
average_passengers_per_car = passengers / cars_driven;

//print each item on a separate line
System.out.println( "There are " + cars + " cars available." );
System.out.println( "There are only " + drivers + " drivers available." );
System.out.println( "There will be " + cars_not_driven + " empty cars today." );
System.out.println( "We can transport " + carpool_capacity + " people today." );
System.out.println( "We have " + passengers + " to carpool today." );
System.out.println( "We need to put about " + average_passengers_per_car + " in each car." );
}
}

And my output in command prompt:
c:\Users\jenni\OneDrive\Documents\CompSci>javac VariablesAndNames.java

c:\Users\jenni\OneDrive\Documents\CompSci>java VariablesAndNames
There are 100 cars available.
There are only 30 drivers available.
There will be 70 empty cars today.
We can transport 120.0 people today.
We have 90 to carpool today.
We need to put about 3.0 in each car.

Learn Java Tutorial for Beginners, Part 26: Polymorphism

Learn Java Tutorial for Beginners, Part 25: Public, Private and Protected

Tuesday, January 17, 2017

Programming By Doing Lesson 8

I ran into an error that I could not resolve using the command prompt on this one. The error I received was:

NumbersAndMath.java:7: error: unexpected type
        System.out.println( "Hens " = (25 + 30 /6 ) );
                            ^
  required: variable
  found:    value
1 error

I added a screenshot below since the copy/paste put the arrow in a different location:




I kept looking at the quote and the word Hen and was unable to figure out what the issue was.  It was not until I copied my code and pasted into Eclipse that I realized my error. In Eclipse it gave the error "The left-hand side of an assignment must be a variable". BINGO. It was then that I noticed I had accidentally typed an equals sign in this code instead of the + sign. Problem solved. I corrected and reran the code with no issues as below.

public class NumbersAndMath
{
public static void main (String[] args )
{
System.out.println( "I will now count my chickens:" );

System.out.println( "Hens " + (25 + 30 /6 ) );
System.out.println( "Roosters " + ( 100 - 25 * 3 % 4) );

System.out.println( "Now I will count the eggs:" );
System.out.println( 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6 );

System.out.println( "Is it true that 3 + 2 < 5 - 7?" );
System.out.println( 3 + 2 < 5 - 7 );

System.out.println( "What is 3 + 2? " + ( 3 + 2) );
System.out.println( "What is 5 - 7? " + (5 - 7) );
        System.out.println( "Oh, that's why it's false." );

System.out.println( "How about some more." );
System.out.println( "Is it greater? " + ( 5 > -2 ) );
System.out.println( "Is it greater or equal? " + ( 5 >= -2 ) );
System.out.println( "Is it less or equal? " + ( 5 <= -2 ) );
}
}


Programming by Doing Lesson 7 - Your Initials

My results from Programming by Doing Lesson 7 - Your Initials:


ProgrammingByDoing Lesson 6 - Letter to Yourself

Here are my results for Lesson 6:

ProgrammingByDoing Lesson 4

First create the text file below:


Then run it from the command prompt:


Java Practice from the Command Prompt

I am working through the practice problems here: https://programmingbydoing.com/

If you have problems with this not working from the command prompt, make sure to setup your environmental variables. There is info listed on the January 9 post near the end regarding environmental variables. This may vary for your operating system and machine type.

Make sure to change your directory in the command prompt to point to the CompSci folder you have created.  Here is where mine is located: cd c:\Users\jenni\OneDrive\Documents\CompSci

If you are able to get to lesson 2, here is the resulting picture that SineWave should produce:




Monday, January 16, 2017

Think Java - Chapter 2 Exercise 2.3: My Finished Code


public class Time {

public static void main(String[] args) {
int hoursInDay = 24;
int minutesInHour = 60;
int secondsInHour = 60;

int currentHour = 17;
int currentMinute = 38;
int currentSecond = 30;

if (currentMinute > 0 | currentSecond > 0) {
currentHour = currentHour + 1;
}

int hourCountdown = hoursInDay - currentHour;
int minuteCountdown = minutesInHour - currentMinute;
int secondCountdown = secondsInHour - currentSecond;

if (currentMinute <= 0) {
minuteCountdown = 0;
}

if (currentSecond <= 0) {
secondCountdown = 0;
}

System.out.println(hourCountdown + " hours " + minuteCountdown + " minutes and " + secondCountdown
+ " seconds remaining today.");

}

}

Think Java - Chapter 2 Exercise 2: My Finished Code

public class Date {

public static void main(String[] args) {
System.out.println("Hello World!");

String day = "Monday";
int date = 16;
String month = "January";
int year = 2017;
System.out.println("American format:");
System.out.println(day + " " + month + " " + date + ", " + year);

System.out.println("European format:");
System.out.println(day + " " + date + " " + month + ", " + year);
}

}

Think Java - Chapter 1: My Finished Code for Exercises

Note: Use the shortcut to format your code CTRL+Shift+F.
Below is the code used for Chapter 1 exercises.
****************

public class HelloWorld {

public static void main(String[] args) {
System.out.println("Hello World!");

/*
*
* Test comment
*/
System.out.println("How are you?");

}
}

Learn Java Tutorial for Beginners, Part 24: Packages

Learn Java Tutorial for Beginners, Part 23: Interfaces



At the end of this practice with interfaces, John explains how an interface is like a bank. It has expected transactions (methods). When you open a bank account you expect the bank to have certain functions such as deposit, withdrawl, cashing checks, etc. He uses this example to try to make interfaces more clear. Interfaces only contain methods which carry over to the classes.

Learn Java Tutorial for Beginners, Part 22: Inheritance



Learning how to use extends to setup inheritance.

Learn Java Tutorial for Beginners, Part 21: toString() and the Object class

End of Week One - 116 hours down

So, I have reached the end of week one with 116 hours of java to date.  This was the first week I was counting hours toward building my 1000 hours of java which is considered an entry level developer.

This week I read the first three chapters of Think Java by Allen B. Downey. The thing I have realized is I cannot just read the chapters. I am making flashcards and stopping and Googling things for more information so it takes longer than say an hour to read three chapters but that is ok since it is all relevant to the learning process. His book is a definite must read for beginners. I love
that the language he uses is easy to understand and he provides practice throughout the book.


I will leave the first week with this tip I discovered about debugging. When you are stuck on an issue you cannot figure out, often you can come to a conclusion by talking to another person about it. If no one is available, explain the issue step by step to an object (example: rubber duck) and you would be surprised how many times you can find a solution.

https://en.wikipedia.org/wiki/Rubber_duck_debugging

Tuesday, January 10, 2017

End of Day 2

Well today I practiced debugging and learned more about the Java API (see my last two posts for practice info). I tried practicing the skills I have so far and found that Code Fights were just too hard for my current skill level. On the other hand, CodingBat was better suited for beginners but not too easy. I plan to try to work my way through CodingBat over the next couple months before trying Code Fights again. I found some free online PDF's and added them to the resource page. I'm going to start reading Think Java and will update with a review when finished.

Practice debugging Java in Eclipse

Today I was looking to practice debugging in Java.  Most videos I found online did not provide code. I found this older example and was able to copy the code and follow along.

http://www.developer.com/java/other/article.php/2221711/Debugging-a-Java-Program-with-Eclipse.htm By David Gallardo



I also learned how to quickly switch from debug mode to java mode by pressing these buttons in the upper right corner of Eclipse.







Code used for practice debugging:


Using the JAVA API Online Documentation



This is an excellent video of a walk-through of using the online Java API documentation by Craig Piercy.

Monday, January 9, 2017

End of Day 1

Today I spent the first half of the day setting up a study plan and my Blogger.  I added pages to the Blogger which turned out to be a task in itself since you have to add a pages widget and then enable the pages in the layout before they will show.  I also added an hours counter widget to track my progress.

I spent a couple hours following the free tutorials "Java Tutorial for Complete Beginners" on Udemy by John Purcell.  These are excellent and I would highly recommend.  They are easy to follow and he explains most everything as you go.  I just finished String Builder and String Formatting which is in Section 2 number 24.

My plan is to spend some time watching and following videos, some time reading, and some time just practicing.

The last hour or so I spent on the programmingbydoing.com website. Here they have you run java practice programs from the command line to start.  I didn't get very far before I ran into an error "'javac' is not recognized as an internal or external command".  I had run into this error a couple months ago, but today was determined to fix it.

After much googling, I found that I needed to set environmental variables in my computer for java to run properly from the command prompt. This will vary by operating system, but if you search for environmental variables, your operating system (Windows 10 for me), and java, you should be able to find the answer.

Here are the environmental variables that worked for my computer with Windows 10:

Environmental Variables:
JAVA_HOME
%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Java\jdk1.8.0_74

PATH
%JAVA_HOME%\bin


Just starting out...

A Little Backgroud and Why Java?

Hi, I'm Jen.  I've decided to learn java. Many tech people have recommended starting a blog to record your journey, so here I am.

I have a Bachelor's Degree in Information Technology. The degree I received was very general to the technology field.  I took Microsoft, Cisco, and database classes.  I received several certifications like A+, Network+, Security+. This gave me what I needed to get a career in tech but my degree did not give me specific enough skills to take my career to the next level.  I took one java class in school and it was the hardest of all of my computer classes.  I love math and computers have always interested me, so I came out even more determined to master java.

I would love to be able to sit back and create a few mobile apps, that just sounds exciting. I have read java can run on almost any device.  I would like to find out more about this as well as contribute to creating programs.  I also want to find out more about servlets and how businesses use them. Right now it is all a bit fuzzy but I have a basic understanding and am ready to dedicate the time and effort to learn this in 2017.

My goal is to have 1000 hours of learning completed by the end of 2017.  I have given myself 100 hours of credit for work already done in my college java class as well as work already completed on Udemy. My plan is to focus about 80% of my time on java.  The other 20% will be on skills like HTML, SQL and XML.  I would like to attend at least one or two meetups per month as well as read a few books along the way.

If you know of any free resources or have any suggestions, feel free to comment.  I am going to try to update this blog weekly as I go.