blog.eliotsykes.com

Icon

Q&A on Kickstarter blog

Kickstarter_logo

Funny thing happened this week.  Thanks to my tight-fisted goal of pledging a dollar a day to a different Kickstarter project, I ended up having a Q&A with Kickstarter’s wonderful Cassie Marketos (check out Cassie’s mail-order snackfood project) and the results of which you can read on the Kickstarter blog: Why I Pledge: Eliot Sykes. There’s a few ideas in there that I hope will help get even more Kickstarter projects funded.

3 ways to use SendSocial, 7 things to send, 3 things not to

sendsocial-logo

SendSocial is a new service (available in just the UK initially, other countries to follow) that lets you post anything to anyone when all you have is their twitter username or their e-mail address.  You don’t need to know their home or work address.

This is one of those ideas that made me think wow, that’s a cool idea.  I’m a tad amazed this hasn’t been done yet (if it has been, let me know in the comments, sounds like the sort of thing that someone would have tried back in the original dotcom bubble).

The idea has legs and the track record of one of the guys behind it, Ben Way, makes you think it has got a great chance of doing well.  I hope so, I love to hear UK startups making it worldwide.

A few ways that come to mind on what to use SendSocial for apart from sending gifts to virtual friends:

1. Say thanks to a blogger or twittering friend
Is there someone who’s given you help through their tweets or blog? You could send them a note or even a gift – much more personal than an e-mail. I was thinking of sending some food to one or two people I follow virtually who’s advice has helped me out but that’s probably a bit of a bad idea, would you feel 100% safe eating something that a near stranger sent you? A gift voucher or a handwritten note is probably a safer bet.

2. Let influencers know about your new product/book
Launching a new product that lends itself to physical samples or a book? Send samples in the post to blogger and twitter influencers related to your industry.

3. Get the attention of a journalist/blogger/celebrity
Send something in the post to get the attention of a blogger who gets way too much e-mail from strangers for you to stand a chance of being heard over the crowd.

7 things to send:

  1. A handwritten note
  2. A Xmas/Birthday/Holiday/Thank you card
  3. Home made treats (if you know the recipient)
  4. Chocolates, but not (I think people won’t be keen to eat food sent by strangers).  Send a small gift card instead for somewhere they can buy chocolates of their choice (I’m having a hard time coming up with ideas for this – Thorntons? WHSmith do chocolate now too right? Any other ideas?)
  5. Cup of Coffee – send a Costa/Nero/Starbucks/Pret/etc. gift card is what I mean
  6. A Book or DVD you think they’d like
  7. Gift card for Amazon or any other shop you think they’d like

3 things not to send:

  • Ticking alarm clock
  • Lock of your hair
  • Anything written using blood

What do you recommend sending, or not?

Great idea for crafting your own shirts – Blank-Label.com

blank-label-shirt

I can’t remember how I found them, but when I did I signed up for Blank Label‘s launch e-mail a few weeks back just ‘cos I love the idea.

In a world of design your own t-shirt startups, Blank Label is a breath of fresh air that lets you design your own (proper collared) shirts (like the one in the photo above I guess, taken from their home page). Are there other sites that give you this option? I don’t know, anyway I liked the tone of Danny Wong’s launch e-mail:

For being our beloved friend when we had a sh*t website and signed up early for the launch, here’s your special promocode for 20% off your first order.

(I’m guessing the Blank Label guys won’t mind me sharing the promo code here: “20peroff”). Here’s their home page

Heroku vs EngineYard Cloud vs Joyent

heroku vs   logo-engineyard vs   joyent

Scroll to end to see detailed updates, in brief:
Update 1 – Heroku respond to EngineYard’s e-mail
Update 2 – EngineYard Co-Founder Tom Mornini tweeted about the tone of sales rep’s e-mail

I’m getting bored of Joyent’s shared accelerator manual mongrel restarts so I’m considering switching hosts, plus one of their employees totally wasted my time after they contacted me on twitter out of the blue – I know most Joyent customers have a good relationship with them, unluckily and I expect uncharacteristically I’ve only had an average experience with them.

Anyway, so the candidates were Heroku and EngineYard Cloud.  Heroku is very unlikely due to their $100 per month full on SSL costs.  After I posted a comment about this on RubyInside, an EngineYard rep sent me the following email:

Hi Eliot,

You should also know Engine Yard Cloud comes up to 40% cheaper than Heroku. We deliver a better solution with a much easier INCLUDED SSL service.

Not to mention with Heroku you are relying on their multi-tenant architecture (their app goes down so does your app) – not the case with Engine Yard. In addition to having a more secure environment, and save cost, our dashboard is built on a battle tested Rails Stack for the last 3 years.

Also here’s some information on further details:

Our cloud dashboard allows you to easily create and manage an infrastructure for deploying rails applications.

You can easily deploy rails applications and all their dependencies including any gems from any git repository via the dashboard UI or from the command line with a special git commit message.

Heroku doesn’t offer support or monitoring. – Our cloud dashboard allows you to easily create and manage an infrastructure for deploying rails applications. We ping your site every two minutes and manage alerts that are sent directly to you in an email.

We have customers running very redundant environments via the app server load balancing and master-slave DB configurations we provide at the click of a button. In addition, our design has the safety of not making customer environments reliant on our own application. If there is a problem in our application it only effects the ability to deploy, provision new resources, etc. It doesn’t effect the operation of a customers running environment at all and we feel adds more safety than the multi-tenant environment in Heroku.

Also, we did a pricing analysis against Heroku and we discovered that once you have gone beyond the low priced/free entry level servers with Heroku, you might be paying a lot more.

Check this out:

Let’s take a production app running on two small instances on Engine Yard Cloud and a third instance running a dedicated database. And let’s say you have 10GB of data with daily snapshots = 300GB of data (very, very conservative – assumes that all the data changes every day).

On Engine Yard that configuration will cost (Cloud Plan):
2 x small instances = $259.20
1 x database instance = $129.20
300 GB of EBS space = $30.00
Bandwidth + i/o ~ $20.00
*******************************
Total = $438.40
(Each small cloud instance runs 6 mongrels, so this runs 12 mongrels in a redundant configuration.)
An equivalent environment on Heroku would be:
12 Dynos = $396
Ronin Database = $200
Backups = $20
************************
Total = $616.00

In this case, Engine Yard works out to be about 30% cheaper than Heroku.

If you are interested, I would be happy to discuss this in further detail or show you a quick technical demo of our Engine Yard Cloud product. Please let me know what are good dates and times for you to talk next week.

Thanks for your time, I appreciate it.

Best Regards,
Manpreet

It was considerate of EngineYard’s rep Manpreet to contact me, but to be honest he’s scared me off with those hundreds of dollars quotes like that’s nothing for a small guy startup like me to pay for hosting.

Anyway, I post this here in the hope it is of use to others weighing up the differences between Heroku and EngineYard.

I’ve e-mailed Heroku about the following things, I’ll update the blog if I get a response Heroku have responded see Update 1 below.

  • Heroku’s multi-tenant vs EngineYard’s single-tenant architecture
  • EngineYard’s claim Heroku doesn’t offer support or monitoring
  • Estimates for sites with 10,000 / 50,000 / 100,000 visitors per month

Update 1
Oren Teich of Heroku has kindly taken the time to send this detailed response – many thanks Oren

Hi Eliot,

Thanks for getting in touch. To respond to each of your questions directly:

* Heroku’s multi-tenant vs Other’s single-tenant architecture

In any compute environment, if a server fails that will impact your application. That isn’t different if you’re on Heroku or any other provider. The question is, how do you handle the failure. The very multi-tenancy that Heroku provides gives us a huge advantage in handling this. Every system is fully redundant for EVERY user on Heroku, from the $0/month on up. This means that there is no single point of failure (SPOF).

When you use a service that makes you manage your own VMs/AMI/EC2 images, the SPOF problem is _yours_ to manage and maintain. When you start small with a single image, if that image goes down your app is down. The Heroku stack is made up of 6+ discreet layers to provide users with the performance and flexibility they require. If you wanted to duplicate this setup elsewhere, you would need at least 12 different images.

* The claim Heroku doesn’t offer support or monitoring

This is false. http://support.heroku.com is available, and as you can see from tweets on twitter, people love our support. It is true that we don’t offer 24×7 support right now, though that is coming soon. All apps are fully monitored. Heroku’s entire philosophy is to take the management pain out of the hands of the customer. We don’t make you manage your own images. We don’t make you manage software payloads.

The way we handle monitoring specifically is we have extensive internal monitoring, tracking over 100 metrics. 99% of the time, we are able to resolve any issues without the customer ever experiencing any issues. On the rare situations that an issue is visible to the customer, we post an update to http://status.heroku.com and reach out to effected users, working with them 1:1 to ensure their app is fully restored.

* Estimates for sites with 10,000 / 50,000 / 100,000 visitors per month

This is always tricky, since every app is different. Here’s the short version – 10,000 per month should easily be handled by the free dyno. 50,000 is $36/month. 100,000 is up to $100/month, depending on your app performance. For reference, we have sites serving >200,000,000 (yes million) visitors per month, and they spend in the range of $1500.

From the deployment in <5 minutes to a COMPLETELY managed operational stack, we believe, and our customers tell us all the time, that Heroku saves them hours, days and even weeks. Often, by using Heroku our customers are able to forgo additional hires. As a user of Heroku said (http://news.ycombinator.com/item?id=883691), “It’s only expensive if your time is worthless”. That said, we often wind up being an incredibly reasonable place to host your application.

The details: Let’s make a few assumptions. If you’re app responds to a request in 200ms, each dyno can serve 5 requests per second. A free dyno could theoretical serve of 432,000 requests per day. Even with peaky traffic and multiple reuqests per visit, that’s still 20,000 visitors per day, for FREE. To get concurrency with 2 or more dynos, you’re now serving twice the traffic. It’s literally 1 second to change your concurrency, and we bill based on the hour so you can do it anytime, and see the impact for yourself.

Ultimately of course, this is just a vendor selling their product. The best thing to do is try it out for yourself – get an app up and runing on Heroku, and let us know how it’s working for you! We think you’ll love it, and we’d love to hear your feedback, good bad or indifferent!

Thanks for giving us the time to answer your questions,
Oren Teich

So who would you opt for?

Both hosts have very happy customers who swear they would never go anywhere else so I’m going to assume their service levels are high and comparable to each other (especially for my meagre needs).

So what separates them in my mind for my small solo startup use case is initial cost and personality.

And so my choice between the two would be Heroku, because 1) how honestly presented their communication was; 2) they didn’t make any false claims against their competition; and 3) you can try out their offering free. See Update 2 below, EngineYard’s CTO agreed the e-mail was in a poor tone and has taken steps to rectify it.

For me this doesn’t end here, there is one thing that is stopping me from switching to Heroku – I want a full SSL cert for Missed Connections and the cost is $100 per month, which I can’t stretch to, so that leaves me back at square one :-( .  If I come up with a new option I’ll report it here. (Here’s why Heroku’s full SSL fees are at this price)

Update 2
EngineYard Co-Founder and CTO Tom Mornini kindly tweeted about the original EngineYard e-mail. Due to EngineYard’s enthusiastic customers I get the feeling the dodgy tone of that e-mail was uncharacteristic of EngineYard and Tom’s tweet confirms that:

@eliotsykes I apologize for tone of initial email. I’ve personally communicated displeasure with tone to our VP Sales, who agreed. From @tmornini

Virtualbox How To: Accessing Guest Apache from Host

For Virtualbox users, here’s a useful article on how to access Apache running on your guest OS from within your host OS.

In brief, assign port 8888 on host OS (Windows XP for me) to forward to Apache’s port 80 in the guest OS (Ubuntu for me) with these commands:

cd C:\Program Files\Sun\xVM VirtualBox
VBoxManage setextradata MyUbuntu "VBoxInternal/Devices/pcnet/0/LUN#0/Config/apache/HostPort" 8888
VBoxManage setextradata MyUbuntu "VBoxInternal/Devices/pcnet/0/LUN#0/Config/apache/GuestPort" 80
VBoxManage setextradata MyUbuntu "VBoxInternal/Devices/pcnet/0/LUN#0/Config/apache/Protocol" TCP

Shutdown Virtualbox completely, not just the guest OS, but the Virtualbox application too. Start Virtualbox back up, start the guest OS, open a browser in your host OS, and go to the URL http://localhost:8888/ to see your Apache home page.

Fixing “A copy of ApplicationHelper has been removed from the module tree but is still active”

I found a few Ruby on Rails questions posted that ask how to fix “A copy of ApplicationHelper has been removed from the module tree but is still active” errors, unfortunately none seemed to have solutions.

So unluckily I got this error yesterday (in development environment only) with Rails 2.1.x.

I narrowed it down to a method I’d added to ApplicationHelper which used a class method on an HtmlUtil module I’d written.

The new method in ApplicationHelper is as follows:

module ApplicationHelper
  ...
  def title
    HtmlUtil.escape_html page_title
  end
  ...
end

The problem was only the first request after a server restart would work.  Subsequent requests would give the “A copy of ApplicationHelper has been removed from the module tree but is still active” error message.

To fix it I ‘require’d the HtmlUtil at the top of ApplicationHelper:

require 'html_util'
module ApplicationHelper
  ...
end

So, if you’re getting this error, you may be using another module in your ApplicationHelper. Try to fix it by requiring the module at the top of the helper.

How to use Rails templates in WordPress themes

Have your cake and eat it. Man I love the cake

Man I love the cake

The Why
This last week I’ve been redesigning Missed Connections and today was time to bring the blog on board with the new design.

Under the hood Missed Connections is running Ruby on Rails, except for the site’s blog which is WordPress.

I wanted the blog to look like it belonged to the rest of the site so I decided to use the same design generated by the Rails layout template to create the WordPress theme.  Now I have a WordPress theme that is generated by a Rails app.  If I update my Rails layout, I only need to call ‘rake blog_theme:update’ and the WordPress theme gets updated too.

Below is how I did this and how you can too, simply and quickly.  All we’ll need is some Rails knowledge, and no experience of WordPress or PHP to make this work.

The How
In brief, we’re going to create a controller action that generates a HTML response (that contains some PHP) and have rake package this generated code up as a WordPress theme.

  1. Create a BlogThemesController: script/generate controller BlogThemes
  2. Inside BlogThemesController write an empty show action method:
    def show
      # do nothing or render :layout => 'my_custom_layout'
      # if you're not using the default layout
    end
  3. Add a route for the show action to config/routes.rb:
    map.resource :blog_theme
  4. Create an empty template file for the show action at app/views/blog_themes/show.html.erb
  5. Copy and paste the following mix of ERB and PHP code into show.html.erb, and check that the angle brackets in the PHP code don’t get changed to entity codes or similar when pasting. Later we’ll call the show action and get a generated PHP file as the response.
    <%
     # This assumes that in your layout, the title in the head is output like:
     # <title><%= @title %></title>
     # Change this line to how you set the title for your layout and remember
     # *not* to html escape this.
     @title = "<?php wp_title('&laquo;', true, 'right'); ?>
     <?php bloginfo('name'); ?>"
    %>
    <?php if ( have_posts() ) : ?>
     <?php while (have_posts()) : the_post(); ?>
     <h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>
     <?php the_content(); ?>
     <p>
     <a href="<?php the_permalink() ?>">Link to post</a> |
     Posted by <?php the_author(); ?> on <?php the_time('F jS, Y') ?> |
     Categorized as <?php the_category(', '); ?> <?php edit_post_link(); ?>
     </p>
     <?php comments_template(); ?>
     <?php endwhile; ?>
     <p>
     <?php posts_nav_link() ?>
     <?php previous_post_link(); ?><br />
     <?php next_post_link(); ?><br />
     </p>
    <?php else : ?>
     <p>Sorry, no posts matched your criteria</p>
    <?php endif; ?>
    <?php get_search_form(); ?>
  6. Now we’re going to create a CSS file containing the comments required by all WordPress themes. Create an empty file in your Rails app at public/stylesheets/wordpress/style.css
  7. Copy and paste the following CSS comments into the empty file:
    /*
    
    These comments must be in style.css and are used by wordpress
    
    Theme Name: Rails generated theme
    Theme URI: homepage
    Description: A rails generated theme
    Author: Eliot Sykes
    Author URI: http://blog.eliotsykes.com/
    Version: 1.0
    
    */
  8. Almost done, now we’re going to create a Rake task that will call the BlogThemesController#show action and package up the generated PHP code and the CSS file as a WordPress theme. In your Rails app, create an empty file at lib/tasks/blog-theme.rake. Copy and paste the following into this file, and edit the theme_home and blog_theme_url variables to the correct values for your production environment:
    namespace :blog_theme do
      desc 'Update the wordpress blog theme'
      task :update => :environment do
        puts "Updating wordpress theme"
        require 'action_controller/integration'
        app = ActionController::Integration::Session.new;
        # Change this to the production url for your blog_theme
        blog_theme_url = "http://www.missedconnections.com/blog_theme"
        app.get(blog_theme_url)
        index_content = app.response.body
        # Change theme_home to the correct path for your
        # environment, leave the final directory as rails-generated
        theme_home = '/home/user/web/blog/wp-content/themes/rails-generated'
        mkdir theme_home unless File.exists? theme_home
        index_path = "#{theme_home}/index.php"
        puts "Writing index.php to '#{index_path}'"
        File.open(index_path, 'w') {|f| f.write(index_content) }
        puts "chmod index.php"
        File.chmod(0755, index_path)
        puts "Copying style.css to '#{theme_home}'"
        cp 'public/stylesheets/wordpress/style.css',
          "#{theme_home}/style.css", :verbose => true
        puts "Wordpress theme updated"
      end
    end
  9. Run ‘rake blog_theme:update RAILS_ENV=production’ to create the WordPress theme in your WordPress installation.
  10. Log in to your WordPress admin go to  Appearance > Themes and select/preview the “Rails Generated” theme.

Now anytime you want to update your blog layout to be in line with changes you’ve made to the Rails layout, simply call that rake task again.

After seeing how things turn out, you may want to play around with the CSS and show.html.erb to get things looking right.  I edited the CSS in my Rails app’s existing CSS file at public/stylesheets/app.css.  For the generated PHP template I gave it a body class of ‘blog’ and used this in app.css to make it obvious which CSS rules were WordPress specific.

You can see the final results at the Missed Connections site. See how the blog has a very similar layout to the info pages that are served by Rails like the About Us and Thank yous pages.

Important: if your WordPress blog is on another domain/subdomain
If your WordPress blog isn’t on the same domain as your Rails app use full URLs for all assets and links that are in your Rails layout, instead of absolute or relative paths. For assets (stylesheets, images, javascript files) use the AssetTagHelper to make sure the full URL is used. Create a asset_host.rb file in config/initializers and paste this into it:

ActionController::Base.asset_host = Proc.new { |source, request|
  "#{request.protocol}#{request.host}"
}

All images in your layout should use the image_tag helper, and use the _url (i.e. not _path) helper methods for generating link URLs in your layout. Also use the javascript_include_tag and stylesheet_link_tag helper methods to generate full URLs for javascript and CSS files.

Summary
Using this method gives you many of the advantages of Rails layouts inside WordPress.  It also makes maintenance of your blog and app a little easier and less repetitive.

P.S. If you’re reading this, then there’s a fair chance you run a few MySql databases and a few different web applications (e.g. a few Rails apps and a few PHP apps) on the same server.  If you want a way to backup your database and your application directories securely my 6 minute backups project on github could help you out.

My favourite twitter bird illustration

twitter_bird_01

Just added this excellent illustration from Matt Hamm to the info pages on Missed Connections (e.g. the about page).

Matt has kindly made the icon free to use, so a big thanks to you Matt.

Super Simple Spam Protection in Rails

spam

Had a few spam bots visit Missed Connections recently, so I went looking for a quick way to banish them and found this post by Jonas Arnklint:

Super Simple Spam Protection in Rails

Thanks Jonas!

Sign the petition to free UK postcodes!

About time this postcode data was freed up like most forward thinking nations.

http://petitions.number10.gov.uk/nfppostcodes/

UK currently #21 in the UN’s best countries to live, if this works maybe we’ll get to #20.5

Who’s Blog?



Hello, I’m Eliot Sykes and this is my blog. Thank you for visiting. I'm the Founder of MissedConnections.com


Read about my current projects, contact me or find me on github