Mephisto Trackback Library

written by edavis on December 3rd, 2007 @ 07:46 PM

I really enjoy using Mephisto but it is missing some of the features that other blogging applications have. One is the ability to send a trackback ping to another blog post. So I built my own library to handle it.

Download trackback.rb

require 'net/http'
require 'uri'

# Simple trackback class to send a trackback to another weblog
# This is used via the console
#
# Example:
# >> t = Trackback.new("theadmin.org", 227)
# >> t.send('http://trackback.example/url.php?1234')
#
class Trackback

  @data = { }

  def initialize(host, article_id)
    site = Site.find_by_host(host)
    article = site.articles.find(article_id)

    if article.nil?
      raise "Could not find article"
    end

    if article.published_at.nil?
      raise "Article not published"
    end

    @data =  {
      :title => article.title,
      :excerpt => article.body_html,
      :url => "http://" + get_full_url(site, article),
      :blog_name => site.title
    }
  end

  def send(trackback_url)
    u = URI.parse trackback_url
    res = Net::HTTP.start(u.host, u.port) do |http|
      http.post(u.request_uri, url_encode(@data), { 'Content-Type' => 'application/x-www-form-urlencoded; charset=utf-8' })
    end
    RAILS_DEFAULT_LOGGER.info "TRACKBACK: #{trackback_url} returned a response of #{res.code} (#{res.body})"
    return res
  end

  private

  def url_encode(data)
    return data.map {|k,v| "#{k}=#{v}"}.join('&')
  end

  def get_full_url(site, article)
    article_peramlink = article.hash_for_permalink
    url = site.host + '/' + site.permalink_style
    ['permalink', 'year', 'month', 'day'].each do |value|
      url.gsub!(/:#{value}/,article_peramlink[value.to_sym].to_s)
    end
    return url
  end

end

To install this just save the above code to a file in your Mephisto’s lib/ directory. Now you can send a trackback to a website using the Rails console:

$ script/console production
>> t = Trackback.new("theadmin.org", 227)
>> t.send("http://acheron/blog1/wp-trackback.php?p=1")
=> #<Net::HTTPOK 200 OK readbody=true>

I haven’t had a lot of time to work on it, so I hope I can get some help improving it. Some ideas I have to improve it:

  • Turn into a Mephisto plugin
  • Unit tests
  • Scan all urls in the Article, looking for trackback urls.
  • Support other types of trackbacks

Download trackback.rb

Eric

2008 Goals

written by edavis on November 27th, 2007 @ 09:48 AM

After reading Shane’s post about setting goals I decided I needed to sit down and plan out my next year. 2007 has been a great year for me both personally and professional. I see 2008 as a year of growing and refining what I started in 2007.

2007 Highlights

To see where I am going, I need to know where I’ve been. Some of the major highlights of 2007 have been:

  1. Got married
  2. Started my own business to do custom software development, Little Stream Software
  3. Moved my family up to Oregon
  4. Flew across an ocean (Kauai rocks)
  5. Trained myself in JavaScript and PHP
  6. Meet at least 84 new people

2008 Goals

  1. Grow my business to make $100,000 in revenue in 2008
  2. Finish my personal and business emergency savings
  3. Get 3 paid Ruby on Rails projects
  4. Grow my RSS and newsletter subscribers to 500 people
  5. Redesign my core websites
  6. Participate on 10 Open Source projects
  7. Incorporate my business
  8. Write a short ebook ( 30 to 100 pages)
  9. Contribute a patch to Ruby on Rails

Scare yourself goal

My first goal of growing my business to make $100,000 in revenue is my “scare yourself” goal. Compared to what I have made, $100,000 is such a large number it terrifies me. Even if every month I made as much as best month, I would still come up short. I see three solutions to fill this gap:

  1. Charge more
  2. Work more
  3. Get creative

Option #1 will not work. I am already charging were I should be at, upping my rate will start to price me out of my bread and butter projects.

Option #2 is also a no go. I started my business to have more time with my family, not to have less time.

So that leaves Option #3, get creative. I will be thinking though the details of this option but think of it now as using leverage to complete more work.

Eric

Progress Review - October 2007

written by edavis on November 5th, 2007 @ 01:59 PM

October brought my business some great events and some disappointments.

October Daily Actions

Marketing ideas are usually really simple but taking action on those ideas are extremely hard. Last month I said I was going to focus on closing the sales that I had pending. I closed some but I had a hard time working on the daily actions I set for myself. The three actions I was supposed to do were:

By the end of the month, I found I never really did any of them. The excuse I have is that I was busy working on billable work. This is a really good excuse, but the lack of action will end up hurting me in coming months as my marketing has lulled next to nothing.

October Monthly Goal

On a better note, my October goal was to bring in $7,000 in revenue. This goal was to make me stretch and was basically double the amount of work I had confirmed.

Guess what? ….. I reached it

Near the end of the month about 66% of the goal was complete and I was pushing really hard to hit 100%. Then I had a project make some changes that resulted in a ton of work for me to do before the end of the month. This push let me finish my goal, in fact I even beat it by an extra 10%.

It is really surprising what you can do if you put your head to it.

November Goals and Actions

For November I decided to try something new with my goals and actions. Instead of having 10 marketing actions and one goal, I split my goals and actions into 3 sections, each with their own daily actions and rewards.

Business Section

I had a killer month last month, far exceeding my revenue goal. From the projects I currently have, I think I can have another killer month. I’ve also been wanting to add something to my website that I can give away to visitors, so I will be starting to work on that resource this month.

Goals

  1. $7,000 in revenue
  2. Planning completed on a free web resource
  3. Finish all portfolio tasks
Marketing Section

Over the past few months, my marketing has slowed down a lot. My biggest problem is that I am not meeting enough new people. So my November Marketing goals are focusing on meeting new people.

Goals

  1. Meet 5 new people
  2. Get 5 new newsletter subscriptions
Personal Development Section

This section is a bit of an experiment. Since the business is part of my life, it should somehow improve the skills I have. Recently, due to long work hours and just an addiction to reading, I have stockpiled a huge amount of blog posts and books to read. I am already a fast reader, but if I could double my reading speed I would be able to start to catch up and pick up a lot of good information.

Goals

  1. Speed read at 750 words per minute with 70% comprehension
Some lessons I learned from this month:
  • Let your goals help push you to success: I was afraid to set such a high goal in October but I am now glad I did. If it was lower, I wouldn’t have driven myself as hard to reach it. Your goals should be far enough out of your grasp, that you need to strain to reach them.
  • Track what you want to improve: The last two weeks of October, I started to track how much revenue I made every day. This let me see that I was making progress to my goal and helped motivate me to put in that extra hour of billable work each day.
  • Reward yourself: As you accomplish major tasks, take the time to reward yourself. This can be as simple as an hour playing a game, or are large having a shopping spree at your favorite book store. Rewarding the little successes really make running your business fun.

Eric

Does your business make you happy?

written by edavis on November 1st, 2007 @ 09:53 AM

This morning as I boiled a pot of water, I took a step outside and saw the sun rising through the fall leaves of a tree. Something about it really hit me; the tree, the sun, or maybe the idea that I am able to take time off of my work to really see the world around me.

I realized that my business is making me happy. Not happy like “I am happy I decided to do this” happy, but really deep down happy. Like “My life is fulfilled” happy. My business is letting me work on fun projects with great people and is providing all that I need to survive (that includes a lot of books to read). The best part about my business is that it is mine and all of the successes and failures are because of my choices.

I think we all lose sight of the real reason we start a business, to improve our lives and the lives of people we care about. My business has improved mine and it makes me happy.

Eric

Has your business improved your life? Would you ever give it up?

Tech Age, Tech Trash

written by edavis on October 15th, 2007 @ 02:06 PM

Our society has grown dependent on computers. They are used in our shoes, clothing, and our children’s dolls. We are creating these computers at a breaking rate but are we really disposing of them correctly?

As harmless as they appear, these discarded computers and electronics contain substances that pose a threat to our environment and to our bodies. According to the Elizabeth Gorssman, author of “High Tech Trash:

Discarded electronics account for approximately 70 percent of heavy metals and 40 percent of the lead found in U.S. landfills according to a 2001 EPA report.

The world generates twenty to fifty million metric tons of e-waste each year, according to the United Nations Environment Programme.

There are several things each of us can do to help:

  • Recycle old computers - organizations like Freegeek take old computers and will refurbish or break them down for recycling.
  • Donate your old phone or computer to a charity or a needy individual.
  • Slow down your electronic purchases - do you really need a new cell phone every 6 months?

This post was created as part of Blog Action Day, where bloggers around the world unite to write about the environment.

Eric