Tuesday, January 14, 2014

Java Programming

Currently, I am taking some time to beef up on my Java. I took a class in once when I still lived in Austin, something like 8 years ago. I only managed to accomplish one working app in the language, so I am very fuzzy on it.

Why some Java? The data algorithms class that starts at the end of the month is in Java. Handily, the course instructors have an intro to programming class in Java. So t is easy to walk through the exercises.

I have a longer post about the work I did over the holiday and the re-do of a web site we have. Also, we bought a machine to be our server and installed Ubuntu. Our plan is to host our website for C's business and host whatever portfolio pieces I want, and maybe make it part entertainment machine: storing movies and shows more easily connect to Amazon Prime viewing and the like.

Short Update and Task Idea

1/14/14
Not much coding today. Still have much hatred in my heart for the quadratic formula. I mean really, if someone gave me this piece of code:

public class Quadratic {

    public static void main(String[] args) {
        double b = Double.parseDouble(args[0]);
        double c = Double.parseDouble(args[1]);

        double discriminant = b*b - 4.0*c;
        double sqroot =  Math.sqrt(discriminant);

        double root1 = (-b + sqroot) / 2.0;
        double root2 = (-b - sqroot) / 2.0;

        System.out.println(root1);
        System.out.println(root2);
    }
}

Then, told me to “an appropriate error message if the discriminant is negative, and behaves appropriately (avoiding division by zero) if a is zero.” I would do this:

public class Quadratic {

    public static void main(String[] args) {
        double b = Double.parseDouble(args[0]);
        double c = Double.parseDouble(args[1]);

        double discriminant = b*b - 4.0*c;
       
        if (discriminant > 1) System.out.println("Discriminant is a negative number");
        else
        {
          double sqroot =  Math.sqrt(discriminant);

          double root1 = (-b + sqroot) / 2.0;
          double root2 = (-b - sqroot) / 2.0;

          System.out.println(root1);
          System.out.println(root2);
        }
    }
}

Then, tell them there is no “a” and that the only division in this code is by 2.0, which means there is no cases possible of division by zero. Is that so wrong?

Other programming task ideas: programming a widget that tracks how many hours I spend programming.

Wednesday, January 1, 2014

Career Decisions II: The Game Plan

If I am going to indeed change careers, I need a plan. A combination of books and Coursera classes will fill out gaps in my knowledge.

Since knowledge without application is useless, I am hoping to have a implementation or deliverable piece for each section. For example, after I have finished the HTML/CSS, I plan to re-do a website. I don't know how feasible it is to have one for each section, though, since for some things like the Data Structures section, it would not be clear to me what the deliverable piece would be. Perhaps since that section is handled by a class, it isn't quite so imperative to have a deliverable?

Knowledge

Here are the sections I am currently covering:
HTML/CSS
I picked up "Head First HTML" and am working through it.
Deliverable: website redo. C's website is one we quickly put together. It would be fun to walk through a redo and make it work better for them.

Javascript/JQuery
I'll probably work through a boo for this one.
Deliverable: Undecided

Data Structures I & II
Coursera is holding both of these soon. The first at the end of the month and the second in March. I am already signed up for both of them.
Deliverable: Course completion

Java and/or C#
Java will be used in the Data Structures class, so maybe I will go with C#. That will be really useful given my current company.
Deliverable: Undecided

I am sure this list will change over time.

Implementation

I have some ideas about longer term projects to work on to help build my skills. It would be great to find an open source project to contribute to, but how to actually go about that isn't clear to me. To me, it is the equivalent of walking into an operating room and asking if anyone needs a hand.

Alternatively, I have thought about setting up a server and creating different versions of blackjack that would use different programming languages and frameworks. For example, one blackjack game would be coded in Python using Django, and another version would be coded in Ruby using Rails. I like this because the challenge stays static and allows me to compare the different languages and frameworks.

Finally, I have always wanted to create a timeline of historical events that would allow me to compare events in different locations. For example, when the Normans were invading England, what was happening in China? I am investigating this project - more to come.