Wednesday, March 9, 2011

First Use Of Amazon CloudFormation

Amazon recently release a new product called CloudFormation. It’s basically an automated build out of several Amazon AWS products, driven by a simple XML file.

One of the templates offered out of the box is for a complete WordPress install. After following the wizard like instructions, I had a basic WordPress installation up and running in a matter of minutes.

I played with several WordPress settings, saved changes, added posts and pages, and even modified the theme.

Overall it was a painless experience. I downloaded the template XML so I could modify for future needs, and tuned the server off after about 4 hours. Total charges were around $3. Of course that’s with little data transfer.

One feature I haven’t been able to get working yet is WordPress MultiSite. I kept getting an error pointing to a location on the server that was throwing a 404 error. This could be a problem with a plugin. Further investigation is needed.

What I really liked was I could turn on a dev box for a demo or to work on a new site without having to setup a new web hosting. Not sure yet how feasible it would be to run the site 24/7, but for dev and test it would be great.
read more...

Required And Optional Function Parameters

I love using different programming languages. Whether it's C#, PHP, Python or Ruby on Rails, they each have their strengths, which makes finishing projects faster. Choose the best tool for the problem.

Today a project I'm working on required an additional parameter to a  Javascript method that was already called in several files. In C# I could write an overload method

Use Overloading in C# versions below 4
[csharp]
public void MyFunctionA (int par1, int par2)
{
//some code
}

public void MyFunctionA (int par1, int par2, string par3)
{
//some code
}
[/csharp]

Use Default values in C# 4
[csharp]
public void MyFunctionA(int a, int b = 0)
{
//some code
}
[/csharp]

A solution I just found today is using named parameters with defaults
[csharp]
public void MyFunctionB(int par1, int par2,
string par3 = "test")
{

}

MyFunctionB(par1: 10, par2: 4);
MyFunctionB(par1: 10, par2: 4, par3: "My Test");
[/csharp]

One way to do it in PHP is through a default value function parameter. If nothing is passed into the function for that parameter, the default is used:
[php]
function myFunctionA ($par1, $par2 = "test") {
//some code
}
[/php]

And in because I'm just starting to learn Ruby on Rails, I wondered how it handled function defaults or overloads. This is what I found on StackOverflow. Pretty clean, and similar to PHP.

[ruby]
def hello_world(name, message="Hello World"):
print "name = "+name
print "message = "+message
[/ruby]

And finally to Javascript, the real piece I needed to solve. Javascript let's you create a method with no defined parameters, but gives you an array you can check for values. Here is an example:

[javascript]
function myFunctionA() {
alert(arguments[0]);
alert(arguments[1]);
}
[/javascript]

This Javascript option worked great for our needs. We were able to leave the code written originally, but allow new references to the function to add in a new parameter. I didn't want to have another method with duplicate code just to handle the one new parameter, and this seemed to be the best solution.

I'm sure some of you would solve it a different way, so please share.

Thanks to Noah Sparks for helping resolve this issue.
read more...

Friday, March 4, 2011

Tumblr Search Killed The Migration

After posting a few things on Tumblr the past few days, I noticed the Tumblr search is broken. At least on my site. Judge for yourself. This is a show stopper for me.

I posted something on my Tumblr site on Seth Goden's new book Poke the Box (Amazon affiliate link). A few hours later, I wanted to see what a user would find if they searched for the word 'book'. I assumed my Pose the Box entry would be at the top of the list. Not so.

Before




After



read more...

4 Hot Social Gaming Trends to Watch

Link to article.

More than 18,000 interactive gaming industry pros came to San Francisco for the Game Developers’ Conference this week, an annual event that draws programmers, artists, producers, game designers, audio professionals, business decision-makers and anyone else involved in the development of interactive games.
read more...

Book Review: Poke the Box

Stop whining. Stop making excuses. Stop worrying about failure. Stop stopping. In a nutshell, that's what I got out of Seth Godin's new book, Poke the Box. Seth is a great story teller. He's great at painting a picture you see yourself in, and then paints the alternative picture which he want's you to put yourself in. And this book is no different.

One of my favorite lines in this book is, "Who's the VP of go?". Organizations have people in all levels of decision making, but no one is tasked specifically to make things go. Not to monitor, or measure, or adjust, but to make things go.

Seth also talkes about companies still opting for conformity in it's work force, over people who will ask questions and take initiative. It's funny to think that organizations still think this way, seeing how we haven't been an industrial nation for several generations. Today, education is delivered the same way it was 50 years ago, yet current and future generations aren't learning the same was as we did 50 years ago.

There is a lot of room for improvement on all levels. I like the entrepreneurial view of fail fast and fail often, It's what helps us see how to make improvements. This is a great book, has lot's of messages, and hopefully get's you thinking about how to start things, consistently. It's only 96 pages long, and it's really cheap. I got the Kindle version to save a tree.

Poke the Box (Amazon affiliate link).
read more...
 
Copyright © 2003 - 2014 Thom Allen Weblog • All Rights Reserved.