Tuesday, December 31, 2013
Thursday, December 19, 2013
Game Development Links
HTML 5 game dev
Java Games
Facebook Game
Thursday, December 05, 2013
Wednesday, December 04, 2013
PHP and Class Variables
Pass a variable into a class through the __construct($variable) function
Variables set in the __Construct can be referenced throughout the class as $this->variable
Can be referenced outside the class as
$Class->variable
Variable Can be passed into a class function like Class::function(variable);
Variables set in the __Construct can be referenced throughout the class as $this->variable
Can be referenced outside the class as
$Class->variable
Variable Can be passed into a class function like Class::function(variable);
Saturday, November 30, 2013
Thursday, November 21, 2013
iPad Display Stand for POS
This is a cool site that sales display stands for iPads. I'm considering something like this for one of my clients
>> Check it out
Thursday, November 14, 2013
C++ understanding fstream
My brain choked the other day when dealing with the ifstream method inside of the the fstream directive. I just couldn't wrap my brain around how the ifstream associates variable values. My friend told me that I was an idiot. He explained that ifstream works the same way that cin works.
basically
lets say you have a text file that is called names.txt and the file looks like this
Johnny Bobby Dave Suzy
Now you want to assign those values to variables using ifstream
Using 4 variables (name1, name2, name3, name4) you'd just say
ifstream inputFile;
inputFile >> name1 >> name2 >> name3 >> name4;
Just like it would look with cin
cin >> name1 >> name2 >> name3 >> name4;
C++ doesn't care if the input is coming from a text file or a keyboard. Duh.
basically
lets say you have a text file that is called names.txt and the file looks like this
Johnny Bobby Dave Suzy
Now you want to assign those values to variables using ifstream
Using 4 variables (name1, name2, name3, name4) you'd just say
ifstream inputFile;
inputFile >> name1 >> name2 >> name3 >> name4;
Just like it would look with cin
cin >> name1 >> name2 >> name3 >> name4;
C++ doesn't care if the input is coming from a text file or a keyboard. Duh.
C++ assigning values to arrays
If you need to assign values to a two dimensional array use a nested "for" loop
ex:
const int ROW = 3;
const int COLS = 2;
int arrayN[ROW][COLS];
int counter1, counter2;
for(counter1 = 0; counter1 < ROW; counter1++)
{ for(counter2 = 0; counter2 < COLS; counter2++)
{
cin >> arrayN[counter1][counter2];
}
}
When spitting an array out
for(counter1 = 0; counter1< COLS; counter1++)
{ for(counter2 = 0; counter2 < ROW; counter2++)
{
cout << arrayN[counter1][counter2];
}
}
ex:
const int ROW = 3;
const int COLS = 2;
int arrayN[ROW][COLS];
int counter1, counter2;
for(counter1 = 0; counter1 < ROW; counter1++)
{ for(counter2 = 0; counter2 < COLS; counter2++)
{
cin >> arrayN[counter1][counter2];
}
}
When spitting an array out
for(counter1 = 0; counter1< COLS; counter1++)
{ for(counter2 = 0; counter2 < ROW; counter2++)
{
cout << arrayN[counter1][counter2];
}
}
PHP Resources
Everyone could use a new trick or for their PHP bag. Here are some great resources that might just do the trick.
Village Host Pizza Lexington KY
I had the pleasure of eating at Village Host Pizza in downtown Lexington this weekend. I had the cheeseburger pizza. It was pretty good, however the thing to get at this restaurant is the salad bar. It might just have the best salad bar in Lexington .
Christmas Chimes
Christmas favorites
Fantastic compilation of singers who where hot back in the day. Any Williams, Robert Goulet, Barbara Streisand - you name it. Great record
Christmas Strings
Fantastic record by the Herald Singing Strings playing some classic instrumentals of Christmas favorites. Great great great. The record was totally worn down.
Merry Christmas from Lawrence Welk and His Champagne Music
I absolutely love the happy sounding Lawrence Welk orchestra. These Christmas classics have the added flavor that Welks arrangements have. Some how he manages to make happy Christmas songs even happier!. Great.
Monday, November 11, 2013
Asp.net Resources
I never thought in a million years that I would be learning how to develop on Microsoft platforms. I'm not exactly an enthusiast at this point, but I'm having to learn C# and ASP.net after the main developer at work left. Below is a series of resources that I've found helpful thus far.
Wednesday, November 06, 2013
Resources for Putting a SSD in an old Mac Book Pro
I've wanted to upgrade my Mac Book Pro hard drive for some time now and I'm considering a SSD. Here is an article on doing just that.
Installing a SSD in Mac Book Pro
Corsair 360 GB SSD
Corsair 360 GB SSD
Tuesday, November 05, 2013
Sitecore Rocks Resources
OverView of Sitecore Rocks
Of note is how to connect a VS solution to your sitecore layouts.
This is the mother load Simplify Visual Studio Project Creation
Create a Visual Studio 2010 Project for a Sitecore Solution
Sitecore website needs to compile?
C# Tutorials
Sitecoreblog by Alex Shyba
Monday, September 23, 2013
Returning Multiple Values with a Function in PHP
As I'm coding I try to package my code in useful pieces that make it easy to understand what is going on in my programs. What that means in practice is using functions to do the packaging. Functions are just actions that can include multiple statements and do multiple things. If variables are the nouns of your program then a function is the verb. Functions are sometimes also referred to as methods.
Anyways, one action you might want a function to do is return a value. To do this you may have a function fetch results from a database or perform some equation base on a value being passed to the function. For example I could make a function that adds 10 to a value.
Arrays are variables with multiple values. An example of an array might be a variable called $color. There are many colors, so it would make sense to create our variable $color using an array. To make an array you declare the variable and specify the values like so: $color = array(red,blue,green,black); You access the values by specifying the key (Pointing at which value you want). To access red you would: echo $color[0]; Arrays start with 0 as the first value. Another type of array are associative arrays. These types of arrays have user defined keys instead of the default numbered keys. For example I could have and array of the traits of a person: $person = array( 'name' => 'Jason', 'address' => '123 Main St.', 'age' => '25'); To access Jason's address you would echo $person['address'];
So that brings us to the main objective here: Creating a function that returns multiple values.
Hope you find this useful!
Anyways, one action you might want a function to do is return a value. To do this you may have a function fetch results from a database or perform some equation base on a value being passed to the function. For example I could make a function that adds 10 to a value.
function addTen($number) {In the above example I have a function called addTen that is passed a number and returns that number with 10 added to it. In order to have the code spit out the value you just echo out the function. Pretty simple
$sum = $number + 10;
return $sum;
}
echo addTen(5);
Returning Multiple Values
A function returning one variable is easy. Functions are meant to return a variable. Having a function return multiple variables is a little more complicated. The way it is achieved is with an array.Arrays are variables with multiple values. An example of an array might be a variable called $color. There are many colors, so it would make sense to create our variable $color using an array. To make an array you declare the variable and specify the values like so: $color = array(red,blue,green,black); You access the values by specifying the key (Pointing at which value you want). To access red you would: echo $color[0]; Arrays start with 0 as the first value. Another type of array are associative arrays. These types of arrays have user defined keys instead of the default numbered keys. For example I could have and array of the traits of a person: $person = array( 'name' => 'Jason', 'address' => '123 Main St.', 'age' => '25'); To access Jason's address you would echo $person['address'];
So that brings us to the main objective here: Creating a function that returns multiple values.
// This is handy if you had a function that could do a database call and return a bunch of values. You could then access those values as an arrayThis method has all sorts of uses. This is extremely useful when dealing with a database and you want to consolidate your fetch operations in a function but want to separate your styling code from the function.
function animals() {
$dog = "odie";
$cat = "garfield";
$rabbit = "bugs";
$donkey = "eeyore";
$animals = array (
dog => $dog,
cat => $cat,
rabbit => $rabbit,
donkey => $donkey
);
return $animals;
}
// set variable equal to the function returning the array
$animals = animals();
//access the values through the keys of the array
echo $animals['dog'];
echo "
";
echo $animals['cat'];
echo "
";
Hope you find this useful!
Subscribe to:
Posts (Atom)







