Monthly Archives: June 2012

Function to get numeral range for code

Here’s the code I wrote for the ‘numbers’ function. This is another simple function to obtain input from the user.The only thing needed if to verify that the input is within range and that that value is passed back out of the function:


//function to get numerals to be used in code

var numbers = function(){

var enteredNumber = 0;

var numbersVeritas = false;

while (numbersVeritas === false){

console.log(“***numbers function reached***”);

//player inputs how many digits the code will be

// so far numbers function works fine

enteredNumber = prompt(“code will consist of numerals 1 – : (1-9)”);

if (enteredNumber>0 && enteredNumber <=9){

console.log(“We will be using numerals from 1 to “+ enteredNumber+ ” for our code”);

numbersVeritas = true;

return enteredNumber;

} else{

alert(“number is out of range.”);

numbersVeritas = false;







//function call

var enteredNumber = numbers(); // brings the variable enteredNumber out of the function

console.log(enteredNumber); // used to verify enteredNumber is passed back from function

Leave a comment

Posted by on June 30, 2012 in Uncategorized



Sometimes, in the summer, I forget I’m a teacher and get pretty down. I love having the summer off to spend with my son, but I certainly have the itch to get back in the classroom. I found a paper today from the March4, 1876 edition of the British Medical Journal entitled, “A word on the Origin of Bacteria, and on Abiogenesis.” In this article William Roberts (a contemporary of Pasteur) does a wonderful job in explaining the faults of the theory of abiogenesis. Such a wonderful job that I will have to include this letter in my reading packet / handbook for General Biology.

We live in an age of certainty about where life comes from. It is very interesting to go back and see just how hard fought the ideas we take for granted once were.

1 Comment

Posted by on June 30, 2012 in Uncategorized


Cool site about RNA folding

A friend of mine just made me aware of this site that makes RNA folding into a game. The educational aspect focuses on teaching students/ players that RNA is not just a simple, linear molecule (like people think of mRNA most of the time) that carries information from DNA about making proteins. RNA is also a very dynamic molecule that has a number of functions not directly related to carrying information about building proteins. In fact, these molecules are so multifunctional, there is a pretty believable theory out there that the first life on this planet was wholly RNA-based.

This game illuminates just why the RNA-first theory makes so much sense: Because RNA can actually ‘do things’. It can fold on itself and form structures very similar to proteins and these structures can have functions very much as proteins do. In fact, many of us think about RNA as functional all the time. Ribosomes are perfect examples of this: RNA that acts as an enzyme.

I can’t wait to show this to my students in the Fall and see if it helps them get a better grasp on DNA/RNA base-pairing as well as the idea that folding of molecules dictates functions.


here’s the link, I hope you enjoy:

Leave a comment

Posted by on June 29, 2012 in Education, Uncategorized


Tags: , , , , , , ,

function#1: User provides number of digits in the secret code

Here’s my first function.

It prompts the user to provide a number of digits from 1-6. It then confirms this with the user – well, really just me for debugging purposes. I also use a Boolean ‘codeVeritas’ to ensure that the number of digits the user enters is within the parameters defined.


//gets the number of digits used
var code = function(){
    var enteredCode = 0;
    var codeVeritas = false;
    //so far the codeVeritas is working fine
    while (codeVeritas === false){
        console.log(“***code function reached***”);
        enteredCode = prompt(“How many digits shall the code be? (1-6)”);
        //verify input
        if (enteredCode > 0 && enteredCode <= 6){
            console.log(“We will be using “+ enteredCode+ ” digits in our code”);
            codeVeritas = true;
            return enteredCode;    
        } else{
            alert(“number is out of range.”);



Tags: , , , , , , ,

Outlining and early steps in coding mastermind

The only language that I have an even decent grasp on right now is javascript. So, even though I know I’ll have to redo most of my work in order to get this project into XCode, I’m starting there.


My first thought was to create an outline of how I think the program should function.


I’m not sure what will change over time, but to start I had this:


//gets the number of digits used

var code = function(){

console.log(“***code function reached***”);



//gets numerals to be used in code

var numbers = function(){

console.log(“***numbers function reached***”);



//sets up an array of numbers that will be the secret code

// code is the number of digits, number is the integers used for each digit

setSecretCode = function(code,numbers){

console.log(“***reached setSecretCode function***”);



//accepts guess from user and parses it into an array of ‘code’ length

acceptGuess = function(code,numbers){

    console.log(“***acceptGuess function reached***”);



var compareGuess = function(){

    console.log(“***compareGuess function reached***”);



var showResult = function(){

    console.log(“***showResult function reached***”);

    exitShowResultLoop = true;




var exitShowResultLoop = false;

//computer prompts users for parameters to build secret code

var enteredCode = code(); // brings the variable  enteredCode out of the function

console.log(enteredCode); //checking variable

var enteredNumber = numbers(); // brings the variable enteredNumber out of the function

 console.log(enteredNumber); //checking variable


//computer sets secret code

var secret = setSecretCode(enteredCode,enteredNumber);


//printout of array for debugging

console.log(“secret code is: “+ secret);


//play the game using a while loop to loop until correct guess is made

while (exitShowResultLoop === false){

    var guessArray = acceptGuess(enteredCode, enteredNumber);

    console.log(“guess is: “+guessArray);


    showResult(); //contains an exit clause


console.log(“You’ve done it!!! Congratulations!!”);


 Really, this is just a list of functions and function calls that I want to build out. I think that if I can write each of these properly, I should have a functioning game. For starters, I have a ton of console.log()’s littered everywhere just to make sure that the program is going to each function in turn. Once I complete a section, I comment them out or completely delete then and replace them with notes about how things work.

Another important thing I learned was that it’s easiest to look at this in chunks. set variables myself and send them into the functions so they could be made independently. I’m sure this is not worth mentioning to anyone who has done any programming, but to someone like me it was an epiphany.


More later as I flesh things out….


Tags: , , , , , ,

Still hot

My son wanted to roast marshmallows this morning.


On an open fire.

I’ve mentioned that it’s been 100+ degrees for as long as I can remember – and zero rain. We’re living in a state that might as well be a tinderbox. And he wants to have a fire.

Well, I’ve been reading ‘The Happiness Project’ – a book which I have to say is OK, but at least half of my interest in it comes from my amazement over the author’s life. It’s primarily a handbook on happiness punctuated with personal vignettes illustrating how the author puts the rules she proposes to work in her own life. 

My amusement comes from rules like ’embrace failure’ which she provides examples for that remind the reader of what a perfect life she has and how much yours sucks. Failure in her life is exemplified by not getting a regular column in The Washington Post or New Yorker or something and only being the #5 most awesome blog in the world.

Examples of failure in most people’s lives are more like,’fired from job and left by spouse / girlfriend / S.O. on same day that you were diagnosed with cancer. – Oh, and I don’t have a nationally syndicated column in the world’s best newspapers either.’

She’s also a bit sad because being beautiful, smart and rich sometimes leaves you with no need to have direction in her life. 


Hey – I didn’t mean to pan this book or anything. Actually, there’s a lot of pretty decent advice in there. And most of it is at least putatively grounded in solid research (I admit to being too lazy to look that up myself). In fact, I wouldn’t be making this blog at all if it wasn’t for her suggestion to do it.

But, why am I talking about this book at all? Because the author also references another work on parenting that I thought was interesting. The advice she passes along can be boiled down to – ‘Take it easy. Stop saying NO to everything and get behind your child’s ideas rather than obstructing them.’ That sounds obvious, but how many of us actually do that? It’s so much more likely that we say, ‘No, we’re not doing that’ than, ‘well, why not start a campfire and roast marshmallows in the scorching heat while risking starting a wildfire that could engulf the entire midwest?’

And you know what? It was fun. It wasn’t that hot early in the morning. And keeping a bucket of water next to the fire made me feel much more in control of the situation and at least somewhat ameliorated the risk of catastrophe. 

All in all, being amore agreeable person helped us both enjoy our day a little more.


Tags: , , , , , , , ,

More on setting up the mastermind app

In my last post I mentioned that several things had to be set up in iTunes Connect, but I didn’t provide much in the way of details. Here, I’m uploading a couple screenshots to show what kind of setup was done. I am assuming that you already have a developer account and can sign into iTunes Connect with it. The first screenshot if of iTunes Connect after signing in. This is the main menu page where you can look at stats of previous apps you’ve made, read your contracts, adjust financial information or goto ‘manage apps’ to see what you have going on right now – this is also the place where you make new apps.

Go into the manage tab and you will see something that looks like screenshot #2. For DHS, this presently shows that we have two apps available on the app store (green lights), one that had a problem that I still need to fix (red light) and the new one I just made (SafeCracker! -which has a yellow light).

If you click on any of these apps, you will see info about them. I clicked on the new SafeCracker! app and was taken to a screen that looks like screenshot#3.

You can create a new app from the screenshot#2 page and you will be prompted to enter info that you see in my screenshot #3. As I said before, you may have to upload some placeholders until you have artwork made up.




A quick outline on what we need to do to get a simple app:

1. The hard part (make the app itself – I’ve already posted an outline of the way this might be coded, I’ll certainly spend a lot more time fleshing this out here as we go)

2. Setting up space with apple to publish this app

a. Come up with a good name (I’m thinking of something like ‘codeBreaker’ or safeCracker) and reserve that on iTunes Connect (the developer side of iTunes)

b. Describe the app, put together a prototype with artwork to make screenshots and Icons required in iTunes Connect and certainly required to make the app itself.

Presently, I’ve chosen the name SafeCracker! and made up a quick mock of an icon in powerpoint (shown). You have to have an icon and at least one screenshot to reserve the name with, but you can change these as you go along the process. As I said, I made an icon that will have to be refined and for now, I’m using a screenshot from another app to placehold. You need to add some other details as well in the registration form, but most of those are simply things you can make up on the spot. For instance, I use the 6 digit date as my SKU number.Image

Leave a comment

Posted by on June 27, 2012 in Uncategorized


Tags: , , , ,

Defining some terms (JS)

After playing with codecademy’s JS course for about two weeks, I’m nearly finished. That said, I am not ready to go on with the next subject, I need some serious review and practice.

I’ve talked about this before with respect to MasterMind, but I thought I would pursue this a little more explicitly. I also thought that since I am working on making the MasterMind project as a way to practice what I’ve learned, apply it to another coding language (to get some flexibility) and develop the whole thing as an app, I might as well also use this app as a step-by-step in making an app and getting it into the app store.

That’s what this blog is supposed to be about anyway, perhaps by following a specific example in real time, it might be a lot easier for me to focus my thoughts and outline the process more clearly. I’ll outline that process as a series of goals in my next post.

This one is meant to be a place where I can post what I understand about JS as an object-oriented programming language. Specifically, I wanted to define some terms in plain language. 

This is important because I would like anyone who reads this to help edit these definitions for me to make sure they are both accurate and clear.

These definitions are also important so that I can use these terms in my discussion about constructing the MasterMind program.


My definitions:

Arrays are collections of items (that may be objects)


                  var contacts = [bob, mary];

                  where bob and mary are objects with a variety of characteristics.

Classes are templates to create objects with similar qualities. (classes are what constructors make)


Objects are (self contained units) things that have:

                  Properties (these can be values, variables or other objects)

          Methods are functions that operate on Objects

          Members are the specific examples of Objects

          Properties are the characteristics of each object


Prototypes  ???



Constructors are specialized Methods that are used to create groups (or Classes) of Objects



                  function Person(first,last,age) {

                                     this.firstname = first;

                                      this.lastname = last;

   this.age = age;

   var bankBalance = 7500;

where three parameters are sent in as variables and one is set within the constructor


                  Constructors are called to create new objects as below:


                  var john = new Person(‘John’,’Smith’,30);

where john is the new object of the type Person and he has the characteristics listed –these match up to parameters in the constructor.





OK… next: map out Mastermind.

Leave a comment

Posted by on June 27, 2012 in Uncategorized


Tags: , , , , , ,

Again, with the heat?

An excessive heat warning was just issued until Saturday evening and it’s not hard to see why. The forecast for this week is HOT and DRY. We’re predicted to get highs of 104, 104, 99, 101, 97, 99, 97, 98 and 100 degrees F tomorrow (Thrs) through next Friday. All with 0% chance of precipitation. This combination is what is fueling the fires in the West and is killing everything here. Really, how can anything survive?

I have to complain about the weather here online because I always feel like I’ll expose myself as a liberal if I acknowledge the extreme weather conditions around here. That’s probably a pretty unfair statement, but I do feel like the weather – once a safe subject for conversation when surrounded by people of different beliefs- is loaded nowadays. Am I right about this?

Leave a comment

Posted by on June 27, 2012 in Uncategorized


Tags: , , , , ,