Wave Coders List of things to do

Friday, February 19, 2010

New! Proposal Document

You guessed it, the Proposal Spec. You've been waiting for it and it has arrived.

Learn about how your sketches become a proposal document with a few pointers to get you started.

Let me know what you think

Enjoy!

Wednesday, February 17, 2010

Specifications Document Introduction

Ever had an idea to build a cool application?

Of course you have, many of us do. The question is if its such a great idea, how do you go about making it?

Well its by creating a specifications document.
If you want to know more, go to the tab entitled "Concepts" and in the coming weeks I will explain how and what a document spec is and who its designed for.
This is especially for all those with a great idea for an app.

Tuesday, February 16, 2010

Cappuccino - Atlas

For all those who are not informed yet...HTML5 is coming and coming fast by end of year.
Apple, Microsoft and Google are declaring war on Flash. What to do for all those Flash coders? Move to HTML5 and fast! Cappuccino is a new IDE that the guys from 280slides is developing. This works in Objective J which is like Objective C with a twist of java. I will be demonstrating the concepts here in the coming weeks so stay tuned.

Monday, February 15, 2010

Random Cycling

For those who want a random routine that selects an element from a list of objects - for example:

My list of objects I wish to randomly select is..
a = ['apple','watermelon','cheese','milk','oranges']

All you want is a random order or selection like..
cheese, apple, milk, watermelon and oranges

Then reset the list so you can again select from the list in a different random sequence.

To do this I use my RandomGen() class. It has the following parameters:

getRNDPosition(theArray,resetList)

  • theArray is any linear Array type which represents the group of elements you want to cycle through randomly until all is selected. This array is a list of zeros that represent each element in your list of objects. In this case we have 5 elements in our sample list above.

  • reseList is a boolean type (TRUE or FALSE - 1 or 0) that wants to know if you want to reset the array once it has chosen all of the elements in the group which simply means you selected everything.

Lets start creating this randomGen() class

Step 1: Random Array

The first thing I create in my class is the ability to create a group of elements that will represent my selection of objects. So I do something like this...

on createRandomArray(theCnt)

theRnd = []

repeat with z = 1 to theCnt

theRnd.append(0)

end repeat

return theRnd

end

b = createRandomArray(5)
returns: [0,0,0,0,0]

So now when I call this function I get back an array that looks like this. I have to specify the number of elements to select from. Pass this function the count of your array objects (a.count) to get the exact objects needed.

Step 2: Random Generator

Now lets create the main method or function for randomization

on getRNDPosition(theArray,resetList)

if voidP(resetList)then resetList = true
if resetList parameter is not sent, set default to FALSE

rndCells = []

new array position to select from

repeat with z = 1 to theArray.count

if theArray[z] = 0 then rndCells.append(z)

end repeat

repeat loop and create an array with only cell positions that have NOT been selected

if rndCells.count = 0 then

if resetList then

resetArray(theArray)
return getRNDPosition(theArray,resetList)

else

return void

end if

end if

if the array contains nothing - all is selected then here is where we can reset the array
or we can return void for array completed
we'll build this function next

pickCell = random(rndCells.count)

select a random cell position from the array of non selected objects

pickPosition = rndCells[pickCell]

define pickPosition as the position of the selected cell

theArray[pickPosition] = 1

mark the cell position chosen as picked by changing 0 to 1

return pickPosition

return the selected cell position

end

Step 3:Reset Array

Now lets create the function for reseting the random array. This will require us to reset all the cellpositions from 1 to 0. We do this like this..

on resetArray theArray

repeat with z = 1 to theArray.count

theArray[z] = 0

end repeat

loop through the array and reset all objects to 0

return theArray

return reset array

end

Step 4: Using the code

Now lets use the function.

Define your objects

myObjects = ['apple','watermelon','cheese','milk','oranges']

Define the random var you want to control.

myRandomArray = createRandomArray(myObjects.count)

Now let's randomize

myPick = getRNDPosition(myRandomArray,true)

returns: 4,2,5,1 or 3

Get your selected object it represents from your array with the following.

myObject = myObjects[myPick]

Everytime you do myPick = getRNDPosition(myRandomArray,true) you'll get a different position until all are selected. Then the array will reset and you start all over again.