Fibonacci in BASH

January 3rd, 2008

So here’s the big surprise. Shell scripting! It’s not what most people think of when they think of programming, but systems administrators are still doing lots of scripting work to automate tasks. Shell scripting can tackle some pretty serious and complicated problems, so running our Fibonacci program is no sweat. If you haven’t seen the Fibonacci in C and the Fibonacci in PHP, now might be a good time to review them.

So what are the gotchas for scripting in BASH? What killed me is whitespace! (a=1 is not the same as a = 1). Once you get the hang of it, it’s not a big deal, but if you are used to working in PHP or another language that ignores whitespace, you’ll run through a few syntax errors before figuring it out. Using an editor like Vim that has syntax highlighting will help a lot there.So there is the third version of our Fibonacci project. Coming soon, I’ll take on the popular scripting languages perl, python, and ruby.

Fibonacci in PHP

January 3rd, 2008

So here is my second post in the Fibonacci project. For those of you that have not seen the first post here, the Fibonacci project is a learning experiment designed to highlight the similarities and differences between programming languages. In our C Fibonacci example, we learned that we need to declare variables and types, even the return type of a function. In this PHP example, we’ll see that PHP, while different, is very similar to C in syntax.

You’ll notice a couple of things about this version of the Fibonacci program. Because it’s intended to be run on the command line, the first line tells the shell which interpretor to use. In addition, I have been careful here to return an exit code so that the shell knows that the program completed successfully.Stay tuned for our next installment, I’ll keep it a surprise, and even though everyone thinks it will be Ruby, I’m going to save that one for later.

Fibonacci in C

January 3rd, 2008

Welcome to the first post of the Fibonacci project. In the following weeks, I am going to write this simple program in as many languages as possible, to highlight the similarities and differences between them. Today I will start with C, a classic language that is still in use today, and a good foundation for everything else that we will see. Rather than writing a lengthy post with each language, I’ll try to comment the code to point out the important things. Hopefully, this learning experiment will teach me something, and hopefully it will provide a handy resource for people to compare languages, even if it’s in a limited capacity.

So before I started, I gave myself the following “spec sheet” for writing the code:

The purpose of the Fibonacci project is to create a simple programming example in as many languages as possible, to provide a clear demonstration of the differences and similarities between them.

The sample code should:

  • Accept an input “x” (A value to progress up to)
  • Starting at 0 and 1, output the Fibonacci sequence up to “x” permutations.
  • There should be two functions, for clarity.
    • (main) Accepts the input and calls the fibonacci function.
    • (fibonacci) One that accepts the value of x and outputs the sequence.

The code should accept input from the console (stdin), with a prompt, and output to the console (stdout). This is so we keep everything simple. All of the code should be thoroughly commented.

So there’s my version of the Fibonacci sequence generator in C. I’m sure there are some problems with it, but the above code works. What would you change to make it better? Stay tuned for the next installment … PHP.

Ruby on Rails Password Hashing Module

October 14th, 2007

This is a very simple password module that is also easy to use. Simpy place it in /lib inside your Ruby on Rails application and start protecting your passwords today. This code uses a long hash, and creates individual salts for each password stored. It should be very computationally expensive for someone to crack every password in your database, were they to fall into the wrong hands. Of course, if your database is in the wrong hands, you probably have bigger problems. But even some large sites have been caught storing passwords in plain text.

Ruby Password Hashing Code

Usage

Using the the password module is simple. All you need to do is save the file above as “password.rb” in the lib directory of your rails project. Then require_dependency “password” in your application.rb. Once that is done you are free to use the functions in any controller.

Example

application.rb

account_controller.rb

This is an example account controller.

 

user.rb

This is the model for the user class. As you can see, password checking against a hashed password is very simple here. Authenicating the user returns a User object, which is stored in the session[:user] variable in the controller above.

Google Conversion Optimizer Results

October 8th, 2007

Well, it’s been awhile since I first looked at conversion optimizer. I thought I would give you a brief update on my thoughts, and a report with some actual data. For another take on this tool from Google, take a look at the discussion on PPC Discussions, or this post from blogation.

So How Did Conversion Optimizer Work?

For the campaign I used it on, it worked well. Remember as I wrote initially, this is a campaign that had not been optimized thoroughly, although I had added some campaign negative keywords. I suppose the best test of the tool will be to put it up against my manual optimization skills. Perhaps I’ll try the technique advocated by Rose Sylvia of deleting all broad match terms, or try some other quick, formulaic approach. I think using a technique that can be applied quickly like that would create a more fair comparison, since the time needed to set up Google’s Conversion Optimizer is minimal.

I’m still going to reserve final judgment until further testing is completed, but in this case, Google’s tool did a fantastic job. Here are my numbers from the seven day period before using conversion optimizer, and the seven day period after turning it on. I am not using the day that I switched it, and I made no other changes to the ads or the landing page.

Just take a look at the before numbers:

before-conversion-optimizer

 

 

 

 

 

So I was paying a little too much here. One of the ad groups is doing well, but the other is a little high on my conversion cost, and it’s the bigger one, of course. I decided I didn’t want to spend more than $70.00 per conversion, and that was what I ending up setting my Max CPA(Cost Per Acquisition) at. So how much did Google help me out?

after-conversion-optimizer

 

 

 

 

 

Final Analysis

Not too bad. In the end, we have:

  • 400 less clicks
  • 106936 less impressions
  • 22% higher CTR (click through rate)
  • 4 cents higher average CPC
  • $ 620.24 less spent. That represents $88.61 saved everyday.
  • Slightly higher average position
  • A little more than 42% lift in conversion rate
  • A 35% reduction in cost per conversion.
  • And even with less spend, we have 24 more conversions. That’s a little more than 3 extra sales every day.

So for this example, in this situation, Conversion Optimizer worked fairly well. It met my $70 CPA goal, and it saved me money while converting more traffic to sales. I can’t issue a blanket recommendation, but for anyone with unoptimized Adwords campaigns, or for the small business owner who needs to lower his or her cost per acquisition without paying for expensive software or consulting, Google Conversion Optimizer deserves a look.

Google Adwords Conversion Optimizer First Look

September 26th, 2007

So Google launched a new tool for adwords advertisers today, Conversion Optimizer (beta of course!). I manage a number of campaigns, and one of them is perfect for me to test this new tool, so I went ahead and started today. Here is a brief rundown of the tool and what to expect when setting it up. It’s easy, I promise.

What is Conversion Optimizer?

Conversion Optimizer for Adwords is a new bid management tool from Google that allows advertisers to target a cost per acquisition, rather than cost per click. Using data that is not available to you, but is available to google, they will target an acquisition cost that you set.


From Google:

Suppose you know how much you’re willing to pay for a conversion, and you know that your ads get better conversion rates on certain days of the week. Normally, you’d spend time monitoring and adjusting your cost-per-click (CPC) bids in order to get more conversions for a lower cost.

You can read more about conversion optimizer here, straight from the horse’s mouth.

How do I qualify to use the Conversion Optimizer?

It’s simple really, according to Google you only need to meet two requirements.

  • You must have conversion tracking enabled.
  • You have to have at least 300 conversions in the last 30 days.

I was lucky to have a campaign that meets these requirements. Since most of my campaigns are broken out into multiple specific campaigns for optimization purposes, a lot of them don’t get that many conversions a day. But I did have one that I still haven’t done much work on, so it’s perfect for this test.

So how do I start?

It’s easy, really! Here is a brief rundown, with a few screenshots so that you know what to expect.

The Conversion Optimizer is a new bidding strategy option, so you need to edit the settings for your campaign and click the link that says “View and edit bidding options”. Clicking on that link will bring you to the following page, with a new option:

keyword-bidding-options

Selecting “Use the converstion optimizer” and clicking “Save and Continue” takes you to a page where you will actually set your targeted CPA (Cost Per Acquisition), along with a recommendation from Google based on your conversion history.

edit-ad-group-bids

Once you’ve edited and saved your bids, you are presented with a disclaimer before you can continue:

By clicking ‘I Agree’ you indicate you understand and accept the following conditions for the Conversion Optimizer (beta).

1. Your actual cost per acquisition (CPA) depends on factors outside Google’s control, so your actual costs can exceed the maximum CPA bid that you specify. However, the AdWords system automatically adjusts your costs over time, with the goal of keeping your average CPA under your specified bid.

2. When you enable the Conversion Optimizer, a small portion of the traffic on your ads will be used for evaluation purposes. This evaluation is part of our work to ensure a high-quality final product. Your cost and ad performance will not be negatively affected.

No surprise there, Google is testing something new. Once you agree to their terms, you are redirected back to the campaign summary screen, which should show you a confirmation that your campaign is now using Conversion Optimizer, and you now see that your Default Bid is set to your “Max CPA”.

complete

That’s all there is to getting started. Will it work for you? I’m not sure, but like anything, you should always be testing.

Should you use conversion optimizer?

Only time will tell if this tool will work well, and if it will be worth it for you, but there are some circumstances where it may be useful, for example, if you are not currently using any bid management solution, or if targeting a specific CPA is a large part of your marketing strategy.

I do have a few concerns though. Like much of Google’s secret sauce, the data and methods they use to optimize your campaign are not available for you to examine (Google even tells you this data isn’t available to you). If the tool works really well, this may not be a issue for the smaller advertiser or business that wants to target a CPA without manually optimizing each campaign, hiring an agency, or paying for expensive bid management software, however I think that professionals in the industry want to know what is happening behind the scenes with their campaigns; these larger advertisers and agencies will continue to use and refine the tools they are currently using.

For anyone that’s interested, I’ll post an update with my results in a week or so. Even with the issues I brought up, I’m still interested to see how Google’s new automatic bid management tool works. What do you think? Are you testing this already, do you plan to, or have you already decided against it?

Competitive Keyword Research Tool

September 21st, 2007

Rand posted a list of interesting and useful queries that you can perform on google to give you some insight into the competition. Now I like doing search engine queries as much as anyone, but all that tedious typing things in just doesn’t cut it for me, so I built a little tool to help out.

competitive-keyword-researc

This page basically takes your keyword(s) and builds the queries for you, so you can view the results of all these queries quickly. Clicking a query will load it into an iframe in the page. Feel free to use it, but as with anything provided for free, please don’t abuse it!

Competitive Keyword Research Tool

Google Website Optimizer, the Universe, and Everything

September 18th, 2007

Just random, I thought that some of you might find this entertaining. I’m running a Google Website Optimizer experiment, and as of this morning, my best combination is … well, if you’re a fan you’ll understand.

google-knows-the-answer

Obviously, this experiment is a long way from finishing. I might actually have to scale it back and re-run it. I don’t think the page I’m testing has enough traffic to test all the variables I’m testing at once in a reasonable amount of time. I’ll try and cover that when I write about my experience with Website Optimizer later this week.

NoDoFollow – A Firefox Extension

September 10th, 2007

Updated, should install and work on Firefox up to 3.5.x Download HERE

Well, I’m not going to get too heavily into the debate over whether or not to nofollow your internal links, but thinking about how I would go about doing it, I decided that it would be helpful to see all the links on the page, and if they were dofollow or nofollow links. So I present NoDoFollow, a simple firefox extension that highlights the links on the page, color coded according to their follow status.

Here is a screenshot of what it looks like when activated (Thanks, Matt Cutts. I knew I would find some nofollow links on your blog):

nodofollow-screenshot

The extension installs into your tools and right click menu and highlights the links pinkish red for nofollow, and light blue for dofollow.

I hope that someone finds this useful. I have at least one friend who was asking for this since he wants to try and test  using nofollow on internal links.

Download NoDoFollow Here

If you find NoDoFollow useful, or have comments, bug reports, or other requests, please comment here, and I’ll see what I can do to help you out!

Bryan Eisenberg Interview

September 7th, 2007

Bryan Eisenberg gave the best presentation I saw at SES San Jose this year (I missed are paid links evil, my partner in crime got to attend that gem of a session), so I’ve been looking at some of his work more closely. I’m very intrigued by the Persuasion Architechture, and the idea of creating visitor profiles and role playing through them as you design and optimize your site.

Stephan Spencer, Netconcepts’ founder and president, interviewed Bryan about personas and Persuasion Architecture. Read more about how this unique insight into designing customer-specific content will help you understand how to convert views into sales.

read the interview with Bryan Eisnenberg