Comparing a Clock to the Number Line

I’m working on a new blog, Game Building Basics.

In the blog I’m trying to go back to the first days of learning to program games.  I had so many questions and there were so few resources.  It took me forever to learn about trigonometry and its uses.

Going through college  and pre-calc really helped a lot.

My sister-in-law teaches grade school and when I was asking her about helping me with a blog post about the number line she mentioned that students in third grade have to be taught to see the clock as just another number line.

One of the things I like doing on the new blog is making small javascript visuals so that’s what I did.  You can see the numberline clock along with an analog and a digital clock here: Number Line Clock.

I’m looking forward to making more animations.  The clock is a work in progress.  I need to rewrite the code, add comments and write an introduction for the clock.


Leave a comment

Text Editors and Razor

Learned a few things.

First, I learned a bit about Razor.  I didn’t know you could do so much with it.  Why do I even need JavaScript any more? Hah…

Second, I can throw text editors in now.

@Html.TextAreaFor(model => model.Description, new { @id = "myTextArea" })

Just set up the text editor to act on a text area with id “myTextArea” … pretty nice.  Worked for both editors I’m using.

Leave a comment and Web Development

It seems I had a little time this summer to work on a project.  I came upon a video that talked about how to learn coding by reading it.  The speaker asked for help from the community to create a place where you can do that.  So I decided to try learning python/flask on Microsoft Virtual Academy to see if I could create such a website.  Well that didn’t work.  Not that I couldn’t learn it, but it seemed like I was bashing my head against a wall.  While that’s my description of what most coding is like, I don’t really enjoy doing that.

Enter  So much easier just to get started.  The database is pretty much created for you.  All the code to access the database.  Man, that’s just so much better.  Now though, I run into other problems.  Mostly how to create a working, viewable, usable website.

There are so many javascript frameworks that I’m lost in a sea of one-word.js scripts.  Do I even need them?  So far, I’ve used bootstrap and I’m considering a bit of jqueryui.

What I really need is a way to advance.  I’m reaching a plateau in my (oh the pun…) development in regards to web dev.  I don’t know what the next step is.  Same problem always plagued me with programming before college.

Maybe I just need a new more challenging project?  More intricate might be the better term.

Leave a comment

Python Web Development

Trials and travails…

Yesterday I started learning how to create web apps with python and flask.  I’m viewing videos on Microsoft Virtual Academy.  I’m trying to figure out how to set the app up on something other than azure.  It is a nightmare.

I just want to deploy to my virtualbox linux, you’d think that wouldn’t be a problem.

Visual studio gives you the option to publish to ftp, except I can’t get an ftp server running without issue on linux.  proftpd didn’t work at all.  vsftpd had a crazy error that took me an hour to fix.  Now I can’t figure out where my files are going to.  This should not be rocket science!

Leave a comment

Cut out for Programming?

Sometimes I wonder if I’m cut out for this work.  When a college assignment seems so difficult that I want to do anything but…

Yet when I was working, it doesn’t seem like it was ever as bad as this.

However, thinking about it now I remember all the times where I just wanted to take a break but I kept throwing myself against the code, designing, writing, testing, designing writing testing… over and over again.

Hard but still I don’t think it was as bad as this.

This assignment is actually challenging which is unusual for classes at my school up to this point.

Create a multi-threaded chat server.

The hard part is do I need to take to the originating program?  Where do I put my utility functions?

If a thread wants to send something to all the other chat clients, how do I do that?  Is the function a part of the threaded class?  Or should I somehow talk to the main thread, call a function there?

My solution was a list of the threads (chat clients) and a thread will add and remove itself from the list.  I still haven’t tested it to make sure it works correctly.

Then the thread sends a message to each thread in the list (not itself).

When the thread closes (this was a tough one) the thread removes itself from the list.  I was thinking I should keep the functions in the main thread and somehow call back to them.. or have the main thread test when the thread closes somehow but these all seemed overly difficult if not impossible.

In my work in Unity3d I am use to creating the observer pattern (I think that’s it) which probably would have been appropriate here.  In fact, if I had more time I would look it up and try to model it correctly.  It is really the exact thing I need.

Anyway, sometimes this work is tough.  I wonder what my next job will be like.

Leave a comment

Quickly Changing Gears in a Sorting Algorithm

My current assignment (and last of the semester) is to code a small program to test the run times of some sorting algorithms.

Considering we’re given the code for the algorithms that seemed an easy enough job (it was!).  However, as usual he did throw a tiny curveball in just for fun.  Instead of the code he gives which sorts in ascending order, we have to sort in descending order.

I do not mean to imply this is a difficult task.  Actually, it is quite fun.  It turns out for three of the sorts I am working with (I don’t have the code for the other two) it involves a simple change of a single operator.


// Here is a sort in Java
  private static void selectionSort(int[] a)
        int i, j, max;
        int temp;
        for (i = 0; i < a.length; i++)
            max = i;
            for (j = i + 1; j < a.length; j++)
                if (a[j] < a[max])
                    max = j;
            temp = a[i];
            a[i] = a[max];
            a[max] = temp;

All you have to do is change a single < operator to a >. Can you figure it out?
You can do the same thing with selection sort and merge sort. Merge sort takes a bit more looking because, at least in my implementation, it’s much more code.

I posted this because I think it’s very interesting how you can change what might seem like complex behavior with the simple change of a single operator.

, ,


Proper Assignments

Does anyone else wish that professors would include the bare minimum of:

  • Program requirements
  • Sample input
  • Sample output

For every assignment?

Especially the professors who are anal and picky about everything?

Leave a comment