Tuesday, March 29, 2011

Amazon CloudPlayer Fail On iOS

No luck using Amazons new web based CloudPlayer on iOS. Wants me to use Internet Explorer. Really? Did Microsoft pay for that?

read more...

Friday, March 11, 2011

Exclude Images From WordPress Gallery Display

I wrote this post yesterday which had several images as part of the content. One image was used in a different section of the post, but I wanted to group specific images together to highlight a point I was making.

WordPress adds all images uploaded during post creation to a Gallery. Once all the images have been uploaded, you can select the Gallery tab, and insert the gallery right into the post. However, I wanted to exclude one of the images. But there wasn't anything in the image manager that allowed me to exclude an image. (WordPress guys, please add this feature.)

No worries though, the WordPress Gallery is really short code, and the short code allows for parameters. In this case, I was able to add the exclude parameter with the ID of the image I didn't want in the Gallery, and whala, I was able to display what I wanted. You can get the ID of the image in the Library and hover over the image, you should see a value for attachment_id, make note of it. The short code lookes like this:

[ gallery exclude="123" ]
read more...

Thursday, March 10, 2011

Simply Design Your Web Site

I visited the io9.com web site today, after getting there from an external link. I've visited this site before, and mostly read stories they publish via RSS. But today, when I landed on the home page, I was frozen. I had no idea what to do.


Over the past several weeks I've been working on a project where the initial landing page needs to give the visitor enough information about the sites offering, and make it painlessly obvious what options are available. I consider myself an expert web browser, but I must admit when I landed on io9.com today, I had no idea what they wanted me to do.


Experimenting, redefining, shifting, and tossing, has shown us so much can be accomplished through simplicity. Using a sifting method, we have been able to remove the pieces of a web site that shift the focus from the message. Are the elements on your site changing the focus of your message. If they are, remove them, or add elements that speak to the message.


For example, looking at my site, I can see there are several elements that probably distract visitors from my message. Those are things in the side bar. Here are some things that could probably be removed. I wonder if I can find something that would let me track the effectiveness of these sidebar elements.


[gallery link="file" columns="2" orderby="ID" exclude="1556"]

Remember to "simply" design your website.

read more...

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...
 
Copyright © 2003 - 2014 Thom Allen Weblog • All Rights Reserved.