RSS

Tag Archives: help

Now What?

A number of software development courses, such as Codecademy or even traditional university classes, prepares the student to solve problems using their language of choice, but leaves them unprepared to go to the next step.  This next step is to take what you have created and fold it into something free-standing and usable; Something you can share with friends; Something attractively packaged.

My own dilemma is that I have been taking classes and practicing programming C++ on my mac using XCode as my IDE. Now that I have actually created something (a personal summertime project between classes), I want a good way to present my work. Something more attractive and user friendly than the Terminal environment I currently have.

According to apple, my next step is Cocoa. But, what is Cocoa?

Apple defines Cocoa as “Cocoa is an application environment for both the OS X operating system and iOS, the operating system used on Multi-Touch devices such as iPhone, iPad, and iPod touch.” Which could be meaningful… but not very descriptive to me.

Image

                            Hot Cocoa

For anyone familiar with Apple lore, Cocoa was first introduced as NeXTSTEP in 1989: A product of Steve Jobs’ successor company NexT. “You can use several programming languages when developing Cocoa software, but the essential, required language is Objective-C … You can even mix C++ code with your Cocoa code and link the compiled code into the same executable.”  It is this last phrase that gives me hope that I can figure out how to possibly use the work I have don’t so far and weave it (somehow) together with cocoa to add a friendlier appearance to my work. Furthermore, it looks like I could also use Ruby or Python with Cocoa, two languages that I have been working with and find to be somewhat less awkward at times than C++.

So, how to actually put this together: C++ and Cocoa?

            -I’ve been sifting through resources for a couple days now trying to identify some starting point to this without much luck.

-Perhaps this is the wrong way to go about using my C++ code, but is there another way?

 
Leave a comment

Posted by on August 4, 2013 in Uncategorized

 

Tags: , , , , , , , , , ,

Stack Overflow hates me

ImageI tend to ask a lot of questions that stack overflow considers useless. I understand the format of the site – it’s a place where people can ask questions that can be answered accurately and with references. An easy way to get your question flagged is to ask for a recommendation for something – a question that can only be answered by opinion and therefore does not have a discrete, ‘provable’ answer.

However, I still want my questions answered. I really do need help and I’m not sure where else to turn to get it (to reach such a well experienced audience).

What I am dealing with is:

ImageI have a small C++ program that I have developed in Xcode. Things are pretty close to working, but I would like to take my program and wrap it in a more attractive user  interface. Somehow, I thought I was just needing to learn some more C++. I thought that was all in ‘book 2’ or something. But I am getting the impression that I need another program and I have no idea where to start.

(The layers of programming are amazingly deep)

So, please write if anyone out there knows of

#1 a good program to do this with -or- a way to approach it by linking my C++ programs in XCode to an objective-C interface (blahblah, these are words I can repeat, but I don’t understand how to do it)  

#2 know a website / book / youtube channel that embodies a walkthrough approach to doing this

 
Leave a comment

Posted by on August 2, 2013 in Uncategorized

 

Tags: , , , , , , , , ,

My own Coding Problem

ImageI’ve been considering a new classroom exercise to describe genetics and the inheritance of alleles within a population. The idea is that every student draws two coins randomly to start – these represent two alleles for a single gene in that organism. Then each student has the opportunity to ‘breed’ with another student to make two offspring. The genetics of the offspring will be determined randomly from that of the parents (something like each parent flips their coins until they get one heads and one tails – the heads from each parent goes to the offspring).

We’ll do this for several generations and track the frequency of alleles through time.

 

OK – now to coding:

I thought this sounded like a simple project that could be simulated easily, so that’s a coding challenge for myself. To start with, I thought I would build the program up bit by bit doing unit testing along the way. At this point I am trying to just set up the parental generation. To do this, I:

1. get input from the user: how many people are playing?

                                          how many different alleles for the gene exist?

2. loop through making ‘User’ objects for each person playing. Each User object has an id number for tracking (idNum) and two alleles determined randomly(alleles[0,1]). I was thinking of keeping my list of users as an array called players[0…10max]

But, I’m stuck already!

I am getting and using my userData with no problem. I think I am even setting up my objects alright and assigning them two randomly determined elements. But instead of those elements being coins (representing alleles), I’m getting the address of a char within the first denomination….

Any help at all is greatly appreciated, but remember – I’m doing this to learn, so I need to be able to understand the solution, not just get it solved.

 

Here’s the code with some debugging output statements:

//

//  main.cpp

//  CoinsLabSimulation

//

//  Created by Jack on 6/27/13.

//  Copyright (c) 2013 Jack Treml. All rights reserved.

//

//A simulation game to test how my coins lab idea will work

#include <iostream>

#include <cmath>

#include <time.h>

using namespace::std;

class User{

private:

    int idNum;

    string alleles[2];

public:

    User(int A){idNum=A;};//int myArray[] = new int[idNum];

    char getAlleles();

    void setAlleles(string, int[]);

};

void getInput(int userInput[]);

void randomAssignment(int userInput[], string denominations[], int players[]);

int main()

{

    srand(time(NULL));

    int userInput[2];

    char p[10] = {“pennies”};   //I hate character arrays / strings in C++

    char n[10] = {“nickels”};   //I want an array of the coins we will use as alleles in this game

    char d[10] = {“dimes”};

    char q[10] = {“quarters”};

    char s[15] = {“SusanBAnthonys”};

    string denominations[5] = {p,n,d,q,s}; //this needs to be fixed so I can call on this array for coin types

    int players[10];

    getInput(userInput);

    cout<<“We will be playing with “<<userInput[0]<<” players and “<<userInput[1]<<” alleles”<<endl;

    cout<<“Alleles used will be:”<<endl;

    for (int i =0; i<userInput[1]; i++) {

        cout<<denominations[i]<<endl;

    }

    randomAssignment(userInput, denominations, players);

    return 0;

} //end main

//*****************non-member functions

void getInput(int usersChoices[]){  //fx to retreive user settings –unit test passed

cout<<“How many players will be participating(10 max)?”<<endl;

cin>>usersChoices[0];

cout<<“How many denominations would you like to use?”<<endl;

cin>>usersChoices[1];

}// end getInput

void randomAssignment(int userNumbers[], string allelesUsed[], int player[]){ //will create user objects and assign each alleles

    //————-   unit test:

    cout<<endl<<endl<<“Unit Test”<<endl;

     cout<<allelesUsed[0]<<”    “<<allelesUsed[3]<<endl<<endl;

    //————-   pass

    User *a[10];

    for (int i=0; i<userNumbers[0]; i++) {

        a[i] = new User(i);

        a[i]->setAlleles(*allelesUsed,userNumbers);  ///trace this

    }

}// end randomAssignment

//******************User Member Methods

void User::setAlleles(string allelesUsed,int userNum[]){

    int max = userNum[1];

    int randomNumber = floor(1 + (rand() % max));

    cout<<“Random number: “<<randomNumber<<endl;

    string allele1 = &allelesUsed[randomNumber];

    randomNumber = floor(1 + (rand() % max));

    cout<<“Random number: “<<randomNumber<<endl;

    string allele2 = &allelesUsed[randomNumber];

    alleles[0] = allele1;

    alleles[1] = allele2;

    //———–unit test2

    cout<<“UNIT TEST2::::Alleles for this player are: “<<allele1<<” and “<<allele2<<endl;

    //———–fail – it’s using the random number as an address within ‘pennies’

    cout<<“Alleles for this player are: “<<alleles[0]<<” and “<<alleles[1]<<endl;

}

char User::getAlleles(){}

————————————————————-

my output looks like this:

How many players will be participating(10 max)?

2

How many denominations would you like to use?

4

We will be playing with 2 players and 4 alleles

Alleles used will be:

pennies

nickels

dimes

quarters

 

 

Unit Test

pennies    quarters

 

Random number: 4

Random number: 2

UNIT TEST2::::Alleles for this player are: ies and nnies

Alleles for this player are: ies and nnies

Random number: 1

Random number: 2

UNIT TEST2::::Alleles for this player are: ennies and nnies

Alleles for this player are: ennies and nnies

 

 

 
1 Comment

Posted by on June 29, 2013 in Uncategorized

 

Tags: , , , , , , , ,

A Question about Kindle

Has anyone out there been publishing on Kindle? I wanted to format my children’s book, Sheriff Harry, for publishing with Amazon, but I’m afraid I’m inept at formatting for this platform.

With iBooks Author, there is a simple WYSIWYG interface, so it was simple to drop images and text in. However, Every time I try to make a kindle document, all I get is the HTML code showing through.

I’ve looked around and tried following other’s advice, but so far haven’t been able to make it work. Any help would be greatly appreciated (suggestions, templates, websites with good walkthroughs).

Thanks very much in advance.

-Jack

 
Leave a comment

Posted by on January 9, 2013 in Uncategorized

 

Tags: , , , , , , ,

Apple Customer Service is second to none

Genius…delivered.

Last night I had to resubmit my eBook to Apple as I described in a previous post. Because I was a little unsure of things today I checked up on haw it looked in the iTunes Connect site and found that I had a pair of error messages. The first was completely innocuous, just indicating that my Book was ‘Not On’ the iTunes Store because it was presently in review for QC. That’s no big deal and just meant, ‘Sit on your hands for a minute.’

However, the second message was less clear. It read, ‘Unknown Issue. Due to an unknown issue, your content is not on the store. Please Contact us for more information.’ I tried to do that, but found myself in a loop where I could never get through to an actual email tool to enter my concern. Then I noticed a toll free number I could call on the same page. That’s normally poison and not that different from a prison sentence while getting jerked around for an hour or more navigating menus.

Today: Not the Case.

Three rings, then an actual, live human being answered the phone! For a minute I thought I must have a wrong number. But not only did this human answer the phone, but he was even able to help me identify the issue and clear everything up in less than 5 minutes total time.

 
2 Comments

Posted by on October 5, 2012 in Uncategorized

 

Tags: , , , , , , , ,

How to program ‘ZombieCatchAlice’

OK, I’ve thrown together a quick program with a Zombie chasing Alice through the streets of a little city. He says ‘Brains!’, she yells ‘Oh, Help!’, runs a couple of paces, turns, yells for help again and runs a few paces. All the while, the zombie is following her around the screen and the camera follows the action. 

What I don’t know how to do is program an event that is triggered by the zombie ‘catching’ alice. I’d like to see the zombie get her, turn her into a zombie and the two can go after other characters on the screen.

 

Help is greatly appreciated.

 

 
Leave a comment

Posted by on September 5, 2012 in Uncategorized

 

Tags: , , , , , ,

Codecademy Problem

I’m stuck. In working on a section in codecademy’s JavaScript class relating to methods and objects that inherit these methods, I’ve become a bit confused. The problem that I’m on involves an original Object that is a Car that contains the method ‘accelerate.’ – I’m OK with this:

Objects are things within a class, i.e. they are all contain similar property. In this example our Objects are Cars. There can be many different kinds of cars, each with different property such as (different colors, makes, speed, etc). But they are all in the same ‘class’ (i.e. same kind of thing: cars)

Methods are Functions that manipulate Objects. In this example, if we have made a Car Object that has the property Blue and Ford and 10 mph, we can now do something with this object using a method. The codecademy project has us write an ‘accelerate’ Method that adds 10 to the speed. OK – so every time we send our car object to that method, it looks for the speed property and increases it by 10.

Inheritance is a way of making subsets of an Object so that they automatically get the properties that the ‘parent’ Object has, but can also be given new properties that the ‘parent’ Object does not have. In the present codecademy example, we are making an ElectricCar Object that inherits from the Car Object. No problem, this is a good example because we can easily see that it is still a kind of car and that means it makes sense that it should have all the same properties as other cars (color, make, speed – perhaps Blue, Chevy Volt, 20Mph) But we also want to give it properties that other cars do not have, like ‘electricity’ (meaning battery charge).

 

OK, here’s what I have with some notes to follow along an to indicate where I am having problems. Help is greatly appreciated.

 

function Car( listedPrice ) {
var price = listedPrice;
this.speed = 0;
this.numWheels = 4;

this.getPrice = function() {
return price;
};
}

Car.prototype.accelerate = function() {
this.speed += 10;
};

function ElectricCar( listedPrice ) {
var price = listedPrice;
this.electricity = 100;
}
ElectricCar.prototype = new Car();

// Write the accelerate method for ElectricCar here
myElectricCar.accelerate = function() {
this.speed += 20;
};

// Write the decelerate method for ElectricCar here
myElectricCar.decelerate = function(secondsStepped) {
this.speed -= (5*secondsStepped);
};

myElectricCar = new ElectricCar(500);

myElectricCar.accelerate();
console.log(“myElectricCar has speed ” + myElectricCar.speed);
myElectricCar.decelerate(3);
console.log(“myElectricCar has speed ” + myElectricCar.speed);

 

 

 
Leave a comment

Posted by on August 7, 2012 in Uncategorized

 

Tags: , , , , , , ,