<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:ymaps="http://api.maps.yahoo.com/Maps/V2/AnnotatedMaps.xsd">

<channel>
	<title>The Codebelay Blog &#187; WebApps</title>
	<atom:link href="http://www.codebelay.com/blog/category/webapps/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codebelay.com/blog</link>
	<description>Safely Reach New Tech Heights Through Our Startup Insights</description>
	<lastBuildDate>Wed, 25 Jan 2012 19:12:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Upgrade Your Rails Facebook App to SSL</title>
		<link>http://www.codebelay.com/blog/2011/09/13/upgrade-your-rails-facebook-app-to-ssl/</link>
		<comments>http://www.codebelay.com/blog/2011/09/13/upgrade-your-rails-facebook-app-to-ssl/#comments</comments>
		<pubDate>Wed, 14 Sep 2011 05:39:27 +0000</pubDate>
		<dc:creator>barce</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[WebApps]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[facebook apps]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://www.codebelay.com/blog/?p=1159</guid>
		<description><![CDATA[On October 1st of this year, Facebook will be requiring that all apps on Facebook must support HTTPS (SSL). I&#8217;ve provided a guide below which I&#8217;ve used for apps I&#8217;ve worked on that are Rails based. This guide shows you how to change your Rails Facebook App into an app that supports SSL using Passenger [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>On October 1st of this year, <a href="https://developers.facebook.com/blog/post/499/">Facebook will be requiring that all apps on Facebook must support HTTPS (SSL)</a>.</p>
<p>I&#8217;ve provided a guide below which I&#8217;ve used for apps I&#8217;ve worked on that are Rails based. </p>
<p>This guide shows you how to change your Rails Facebook App into an app that supports SSL using <a href="http://www.modrails.com/index.html">Passenger</a> and Apache2.</p>
<p><strong>Step 1: Get an SSL cert or roll your own.<br />
</strong></p>
<p><a href="http://www.dreamhost.com/">Dreamhost.com</a> made it very easy to add an SSL cert for just $15.00 / year.</p>
<p>I tried out my app out using a locally signed certificate which seemed to work just fine:</p>
<div style="padding: 5px; color: #fff; background: #000">
openssl genrsa -des3 -out server.key 2048<br />
openssl req -new -key server.key -out server.csr<br />
cp server.key server.key.org<br />
openssl rsa -in server.key.org -out server.key<br />
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
</div>
<p><br/><br />
<strong>Step 2: Install and compile Apache 2<br />
</strong><br />
Get the latest version of Apache: <a href="http://httpd.apache.org/download.cgi">http://httpd.apache.org/download.cgi</a>.</p>
<p>Configure and compile Apache:<br />
./configure &#8211;prefix=/usr/local/apache2 &#8211;enable-rewrite &#8211;enable-so &#8211;enable-ssl<br />
make &#038;&#038; make install</p>
<p><strong>Step 3: Configure your Rails app<br />
</strong><br />
gem install passenger<br />
passenger-install-apache2-module</p>
<p><strong>Step 4: Edit your Apache 2 config files:<br />
</strong><br />
Edit httpd.conf. For example:</p>
<div style="padding: 5px; color: #fff; background: #000">
<pre style="color: #fff; background: #000;">
LoadModule fcgid_module modules/mod_fcgid.so
LoadModule passenger_module /Users/jimbarcelona/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.8/ext/apache2/mod_passenger.so
PassengerRoot /Users/jimbarcelona/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.8
PassengerRuby /Users/jimbarcelona/.rvm/wrappers/ruby-1.9.2-p290/ruby

<Directory "/Users/jimbarcelona/rails_apps">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

Include conf/extra/httpd-vhosts.conf
Include conf/extra/httpd-ssl.conf

<IfModule mod_fcgid.c>
IPCCommTimeout 40
IPCConnectTimeout 10

# TODO: change this to production if you are on production
DefaultInitEnv RAILS_ENV development
SocketPath /tmp/fcgidsock
</IfModule>
</pre>
</div>
<p><br/></p>
<p>Edit extra/httpd-vhosts.conf:</p>
<div style="padding: 5px; color: #fff; background: #000">
<pre style="color: #fff; background: #000;">
<VirtualHost *:80>
  ServerName berkeley.l33tcave.com
  ServerAdmin wwwadmin@berkeley.l33tcave.com
  DocumentRoot /Users/jimbarcelona/rails_apps/github/hipsterhookups.com/public
  ErrorLog /usr/local/apache2/logs/rails_error_log
  RewriteEngine On
  <Directory /Users/jimbarcelona/rails_apps/github/hipsterhookups.com/public>
    AllowOverride All
    Options -MultiViews
  </Directory>
  RailsEnv development
</VirtualHost>
</pre>
</div>
<p><br/></p>
<p>Edit extra/httpd-ssl.conf:</p>
<div style="padding: 5px; color: #fff; background: #000">
<pre style="color: #fff; background: #000;">
#   General setup for the virtual host
DocumentRoot "/Users/jimbarcelona/rails_apps/github/hipsterhookups.com/public"
ServerName berkeley.l33tcave.com:443
ServerAdmin you@example.com
ErrorLog "/usr/local/apache2/logs/error_log"
TransferLog "/usr/local/apache2/logs/access_log"

# needed for rails
Options Indexes ExecCGI FollowSymLinks
RewriteEngine On
RailsEnv development

AddHandler fcgid-script .fcgi

  <Directory /Users/jimbarcelona/rails_apps/github/hipsterhookups.com/public>
    AllowOverride All
    Options -MultiViews
  </Directory>
</pre>
</div>
<p><br/><br />
Be sure to add your SSL certs in the httpd-ssl.conf too!</p>
<p><strong>Step 5: Start Apache<br />
</strong></p>
<p># check syntax<br />
apachectl configtest<br />
# start apache<br />
apachectl start</p>
<p><strong>Step 6:</strong> Go to facebook and use https for canvas URLs</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codebelay.com/blog/2011/09/13/upgrade-your-rails-facebook-app-to-ssl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting Up Cucumber and RSpec on Padrino</title>
		<link>http://www.codebelay.com/blog/2011/07/26/setting-up-cucumber-and-rspec-on-padrino/</link>
		<comments>http://www.codebelay.com/blog/2011/07/26/setting-up-cucumber-and-rspec-on-padrino/#comments</comments>
		<pubDate>Wed, 27 Jul 2011 04:14:01 +0000</pubDate>
		<dc:creator>barce</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[WebApps]]></category>

		<guid isPermaLink="false">http://www.codebelay.com/blog/?p=1145</guid>
		<description><![CDATA[This is a quick guide on how to set up Cucumber and RSpec on Padrino. I&#8217;ve created a simple test app on github that reflects the steps written down here. 1. Create the app: padrino g project todo -t cucumber -d sequel -b 2. In the Gemfile use rake 0.8.7: gem 'rake', "0.8.7" 3. In [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>This is a quick guide on how to set up <a href="http://cukes.info/">Cucumber</a> and <a href="http://rspec.info/">RSpec</a> on <a href="http://www.padrinorb.com/">Padrino</a>.</p>
<p>I&#8217;ve created<a href="https://github.com/barce/padrino_testlab"> a simple test app on github</a> that reflects the steps written down here.</p>
<p>1. Create the app:</p>
<pre>padrino g project todo -t cucumber -d sequel -b</pre>
<p>2. In the Gemfile use rake 0.8.7:</p>
<pre>gem 'rake', "0.8.7"</pre>
<p>3. In features/support/env.rb comment out &#8220;require &#8216;spec/expectations&#8217;&#8221; so it looks like:</p>
<pre># require 'spec/expectations'</pre>
<p>At this point &#8216;cucumber features&#8217; should work and should return a failed test for adding two numbers.</p>
<p>Also at this point, if you create any models, then bare specs for them will be created in the &#8216;spec/models&#8217; folder.</p>
<p>Please feel free to leave questions or comments if you&#8217;ve got a different way of setting things up on Padrino.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codebelay.com/blog/2011/07/26/setting-up-cucumber-and-rspec-on-padrino/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How To Test Image Uploads With MiniTest On Padrino</title>
		<link>http://www.codebelay.com/blog/2011/07/22/how-to-test-image-uploads-with-minitest-on-padrino/</link>
		<comments>http://www.codebelay.com/blog/2011/07/22/how-to-test-image-uploads-with-minitest-on-padrino/#comments</comments>
		<pubDate>Fri, 22 Jul 2011 17:11:04 +0000</pubDate>
		<dc:creator>barce</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[WebApps]]></category>

		<guid isPermaLink="false">http://www.codebelay.com/blog/?p=1127</guid>
		<description><![CDATA[This week I got to pair program with Oren Golan whose last high profile job was at Border Stylo. While there, he wrote a series of excellent blog posts that I highly recommend reading. The one that caught my eye was his post on MiniTest, that&#8217;s a lighter version of RSpec. We created a Padrino [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>This week I got to pair program with <a href="https://github.com/oren">Oren Golan</a> whose last high profile job was at <a href="http://borderstylo.com">Border Stylo</a>. While there, he wrote <a href="http://borderstylo.com/posts_by/oren-golan">a series of excellent blog posts</a> that I highly recommend reading. The one that caught my eye was <a href="http://borderstylo.com/posts/251-minitest-rubys-new-bff">his post on MiniTest</a>, that&#8217;s a lighter version of RSpec.</p>
<p>We created a <a href="http://www.padrinorb.com/">Padrino</a> app that uses the <a href="http://sequel.rubyforge.org/">Sequel</a> gem as an ORM for SQLite.</p>
<p>We tested a raw file upload and the uploading capabilities of <a href="https://github.com/jnicklas/carrierwave">Carrierwave</a>.</p>
<p>The working test is on <a href="http://github.com/barce/test">http://github.com/barce/test</a>, and to run it just clone the repo and type the following:</p>
<div style="background: #000; color: #fff; padding: 5px;">
cd test<br />
bundle install<br />
padrino sq:migrate:up</p>
</div>
<p>Here&#8217;s the test:</p>
<div style="background: #000; color: #fff; padding: 5px;">
<pre style='background: #000; color: #fff'>
# put this into the test/test.rb file
require 'rubygems'
gem 'minitest'
require 'minitest/autorun'
require 'rack/test'
require '../config/boot.rb'

class TestManualBadgeType < MiniTest::Unit::TestCase
  include Rack::Test::Methods

  FILE2UPLOAD  = "/Users/jimbarcelona/pink-pony.jpg"
  UPLOADEDFILE = "/Users/jimbarcelona/repos/oren/forks/test/test/pink-pony.jpg"

  def app() Test end

  def setup
    if File.exist?(UPLOADEDFILE)
      File.delete(UPLOADEDFILE)
    end
  end

  def test_opload
    post '/', 'file' => Rack::Test::UploadedFile.new(FILE2UPLOAD, 'image/jpeg')

    assert_equal last_response.status, 201
  end

  def test_carrierwave_201
    post '/carrierwave', 'file' => Rack::Test::UploadedFile.new(FILE2UPLOAD, 'image/jpeg')

    assert_equal last_response.status, 201
  end

  def test_carrierwave_file_exist
    post '/carrierwave', 'file' => Rack::Test::UploadedFile.new(FILE2UPLOAD, 'image/jpeg')
    assert_equal last_response.status, 201
  end
end
</pre>
</div>
<p>Now you&#8217;re ready to run the test upload:</p>
<div style="background: #000; color: #fff; padding: 5px;">
cd test<br />
ruby test.rb
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.codebelay.com/blog/2011/07/22/how-to-test-image-uploads-with-minitest-on-padrino/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why is Foursquare Down? 3 Educated Guesses</title>
		<link>http://www.codebelay.com/blog/2010/10/04/why-is-foursquare-down-3-educated-guesses/</link>
		<comments>http://www.codebelay.com/blog/2010/10/04/why-is-foursquare-down-3-educated-guesses/#comments</comments>
		<pubDate>Tue, 05 Oct 2010 01:38:51 +0000</pubDate>
		<dc:creator>barce</dc:creator>
				<category><![CDATA[scalability hacking]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[TechBiz]]></category>
		<category><![CDATA[WebApps]]></category>
		<category><![CDATA[amazon ec2]]></category>
		<category><![CDATA[foursquare]]></category>
		<category><![CDATA[scalability]]></category>

		<guid isPermaLink="false">http://www.codebelay.com/blog/?p=979</guid>
		<description><![CDATA[Why is Foursquare down? Update (5 October 2010 at 5:36 pm PDT) : The folks at Foursquare tell us why in a post-mortem. There are autosharding issues with MongoDB. Yup, my guesses were wrong, unless you consider MongoDB a kind of cache. I used to work for a few sites that required high scalability expertise. [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Why is <a href="http://foursquare.com/">Foursquare</a> down?</p>
<p><strong><em>Update (5 October 2010 at 5:36 pm PDT) :</em> The folks at Foursquare tell us <a href="http://blog.foursquare.com/2010/10/05/so-that-was-a-bummer/">why in a post-mortem</a>. There are autosharding issues with <a href="http://www.mongodb.org/">MongoDB</a>. Yup, my guesses were wrong, unless you consider MongoDB a kind of cache. <img src='http://www.codebelay.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </strong></p>
<p>I used to work for a few sites that required high scalability expertise. Now that we&#8217;re over 5 hours into the outage I&#8217;ll share some of my thoughts.</p>
<p>But before I do, I&#8217;d just like to say, I really hope that it&#8217;s nothing bad and I really like the Foursquare peeps. I&#8217;m not putting out this article to harsh on anybody, but just to share some knowledge I have. Outages happen to everybody!</p>
<p><a href="http://www.codebelay.com/blog/wp-content/uploads/2010/10/foursquaredown.png"><img src="http://www.codebelay.com/blog/wp-content/uploads/2010/10/foursquaredown-300x137.png" alt="" title="foursquaredown" width="300" height="137" class="aligncenter size-medium wp-image-980" /></a></p>
<p><b>Also, I do not feel that this meltdown is in any way indicative of <a href="http://aws.amazon.com/">Amazon&#8217;s EC2</a></b>. I have a <a href="http://www.mychamberapp.com/">site</a> that shares the same IP space and facility as Foursquare and we have had no outages today.</p>
<ul>
<li>The worst case scenario is a full scale<a href="http://www.wired.com/epicenter/2009/01/magnolia-suffer/"> Magnolia meltdown</a>. This is where because of a backup process that was off, they cannot restore ever from backup. Odds: unlikely.</li>
<li>Someone turned off caching. I&#8217;m not sure how cache dependent the architecture is at Foursquare. If someone turned off the cache and the cache is just plain gone, then the caches have to be re-built. Rebuilding caches, depending on the time and complexity of each query can take up to 100x more time that it takes to retrieve the cache. If there&#8217;s some cached item that takes 100 seconds per user, the site will be down for a long time. They can only put a user back on foursquare at a rate of 100 per second if that&#8217;s the case, unless they can concurrently run the re-building of the cache.</li>
<li>There&#8217;s an issue with a hacker who has broken through security and is wreaking havoc on Foursquare. It&#8217;s happened to the best sites, e.g. Google in the 90s, and it&#8217;s pretty tough to recover from. Sometimes you let the criminals in and do their worst while keeping the site up. Sometimes you have 0 tolerance.</li>
<p>I wish Foursquare the best of luck. I am more than happy to lend a hand to their issues, if they need another pair of eyes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codebelay.com/blog/2010/10/04/why-is-foursquare-down-3-educated-guesses/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dineovore Gives Techies an API</title>
		<link>http://www.codebelay.com/blog/2010/08/29/dineovore-gives-techies-an-api/</link>
		<comments>http://www.codebelay.com/blog/2010/08/29/dineovore-gives-techies-an-api/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 01:44:37 +0000</pubDate>
		<dc:creator>barce</dc:creator>
				<category><![CDATA[iPhone Dev]]></category>
		<category><![CDATA[Social Media]]></category>
		<category><![CDATA[WebApps]]></category>

		<guid isPermaLink="false">http://www.codebelay.com/blog/2010/08/29/dineovore-gives-techies-an-api/</guid>
		<description><![CDATA[Check out Dinevore if you&#8217;re a foodie who is a techie. Their API is now live! Contact them via twitter or contact their team via email.]]></description>
			<content:encoded><![CDATA[<p></p><p>Check out <a href="http://www.dinevore.com/">Dinevore</a> if you&#8217;re a foodie who is a techie. Their API is now live!</p>
<p>Contact them via <a href="http://twitter.com/dinevore">twitter</a> or contact <a href="mailto:team@dinevore.com">their team via email</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codebelay.com/blog/2010/08/29/dineovore-gives-techies-an-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter: Thoughts That Are Hard to Fit Into 140 Characters</title>
		<link>http://www.codebelay.com/blog/2010/06/01/twitter-thoughts-that-are-hard-to-fit-into-140-characters/</link>
		<comments>http://www.codebelay.com/blog/2010/06/01/twitter-thoughts-that-are-hard-to-fit-into-140-characters/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 09:20:36 +0000</pubDate>
		<dc:creator>barce</dc:creator>
				<category><![CDATA[Erlang]]></category>
		<category><![CDATA[Social Media]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[TechBiz]]></category>
		<category><![CDATA[WebApps]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.codebelay.com/blog/?p=786</guid>
		<description><![CDATA[What are the limits of expressing thoughts in Twitter? Here&#8217;s a powerful but inefficient (when run) thought that can be expressed on Twitter, a quick sort in Erlang in 126 characters. qsort([]) -> []; qsort([Pivot&#124;T]) -> qsort([X &#124;&#124; X]]></description>
			<content:encoded><![CDATA[<p></p><p>What are the limits of expressing thoughts in Twitter?</p>
<p>Here&#8217;s a powerful but inefficient (when run) thought that can be expressed on Twitter, a quick sort in Erlang in 126 characters.</p>
<div style="padding: 5px 5px 5px 5px; background: #000; color: #fff;">
qsort([]) -> [];<br />
qsort([Pivot|T]) -><br />
   qsort([X || X <- T, X < Pivot])<br />
   ++ [Pivot] ++<br />
   qsort([X || X <- T, X >= Pivot]).
</div>
<p>A lot of Perl one-liners can fit into a tweet &#8211; powerful and useful ones.</p>
<p>Haikus can be expressed in a tweet.</p>
<p>The answer to the question, &#8220;What form of body language do most FBI interrogators consider to be the most telling?&#8221; can be answered in a tweet.</p>
<p>A marriage proposal can be answered in a tweet.</p>
<p>You can propose the concept of a hash tag in a tweet:</p>
<p><a href="http://www.flickr.com/photos/25419820@N00/1236321800"><img src="http://farm2.static.flickr.com/1410/1236321800_a275c8e8c2.jpg" alt="hashtag proposal" /><br />
</a></p>
<p>However, there are many thoughts that seem to be difficult to fit into a tweet:</p>
<ul>
<li>The Pythagorean Theorem and one of its many proofs
<li>Anselm&#8217;s Ontological Proof for God&#8217;s Existence
<li>Merge Sort in Ruby
<li>Merge Sort in PHP
<li>Why you should or shouldn&#8217;t outsource
<li>What qualities make a great tech  hire
<li>Well-thought out political proofs
<li>How to subtly tell someone something in an indirect way with the only others knowing being those in the know
<li>A legally-binding, work contract &#8211; It would be amazing if you could!
<li>The mechanism for how DNA works
</ul>
<p>Twitter encourages the laconic expression of thought which means plenty of affirmations, aphorisms, insults, congratulations, and reminders that can display any combination of sharp wit, pointed humor, and succinctness of expression. The <em>mot juste</em> becomes very important with the constraint of 140 characters.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codebelay.com/blog/2010/06/01/twitter-thoughts-that-are-hard-to-fit-into-140-characters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>URL Shorteners: tinyurl.com bit.ly and seductive.me</title>
		<link>http://www.codebelay.com/blog/2010/05/17/url-shorteners-tinyurl-com-bit-ly-and-seductive-me/</link>
		<comments>http://www.codebelay.com/blog/2010/05/17/url-shorteners-tinyurl-com-bit-ly-and-seductive-me/#comments</comments>
		<pubDate>Mon, 17 May 2010 08:11:25 +0000</pubDate>
		<dc:creator>barce</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[TechBiz]]></category>
		<category><![CDATA[Webalytics]]></category>
		<category><![CDATA[WebApps]]></category>

		<guid isPermaLink="false">http://www.codebelay.com/blog/?p=784</guid>
		<description><![CDATA[There&#8217;s a pretty useful spreadsheet comparing different URL shorteners here: http://spreadsheets.google.com/pub?key=pApF4slh39ZkqUOoZQSo8bg . Tinyurl just really shortens your URL and doesn&#8217;t provide any other data. A great feature is the preview option that allows you to preview a link so you don&#8217;t get Rick-rolled. Bit.ly is my favorite service. The features I like are its API, [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>There&#8217;s a pretty useful spreadsheet comparing different URL shorteners here:<br />
<a href="http://spreadsheets.google.com/pub?key=pApF4slh39ZkqUOoZQSo8bg">http://spreadsheets.google.com/pub?key=pApF4slh39ZkqUOoZQSo8bg</a> .</p>
<p><a href="http://tinyurl.com/">Tinyurl</a> just really shortens your URL and doesn&#8217;t provide any other data. A great feature is the preview option that allows you to preview a link so you don&#8217;t get Rick-rolled.</p>
<p><a href="http://bit.ly/">Bit.ly</a> is my favorite service. The features I like are</p>
<ul>
<li>its <a href="http://code.google.com/p/bitly-api/wiki/ApiDocumentation">API</a>,</li>
<li>its analytics, and </li>
<li>its <a href="http://bitly.pro/">Pro feature</a> which allows you to make a branded URL shortener</li>
</ul>
<p>I wanted to figure out just how much effort it was to code a URL so I coded up my own MVC <a href="http://toys.lerdorf.com/archives/38-The-no-framework-PHP-MVC-framework.html">based on Rasmus&#8217; article on making one in PHP</a>, and added URL shortening code to it. You can <a href="http://github.com/barce/ezmvc">get the URL shortener I wrote</a> on Github.</p>
<p>Here are a few things that I noticed once I put this code on <a href="http://seductive.me/">Seductive.me</a>:</p>
<ol>
<li><a href="http://twitter.com/nikibobb/status/13940708676">Somebody found a bad, infinite loop</a> that I accidentally put into the code</li>
<li>URL Shortener services that offer analytics have to sort out &#8220;bots&#8221; from real user clicks, and I&#8217;m not sure they are correct 100% of the time</li>
<li>Using CRC32 as my hashing mechanism for shortening URLs will cause <a href="http://www.codinghorror.com/blog/2007/08/url-shortening-hashes-in-practice.html">a link collision after 65,536 URLs</a> shortened.</li>
<li>Seductive.me is a lame url for a URL shortener which is why I got <a href="http://3vi.be">3vi.be</a> the next day.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.codebelay.com/blog/2010/05/17/url-shorteners-tinyurl-com-bit-ly-and-seductive-me/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Notes on adding more MySQL databases</title>
		<link>http://www.codebelay.com/blog/2009/11/10/notes-on-adding-more-mysql-databases/</link>
		<comments>http://www.codebelay.com/blog/2009/11/10/notes-on-adding-more-mysql-databases/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 23:56:04 +0000</pubDate>
		<dc:creator>barce</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[scalability hacking]]></category>
		<category><![CDATA[WebApps]]></category>

		<guid isPermaLink="false">http://www.codebelay.com/blog/?p=665</guid>
		<description><![CDATA[Just notes for myself on adding more MySQL databases without shutting down the master database. on existing slave: /etc/init.d/mysqld stop copy data dir from /var/lib/mysql and data from /var/run/mysqld to new slave database: cd /var/lib tar cvf Mysql_slave.tar mysql/* scp Mysql_slave.tar root@new-db.com:/var/lib/. cd /var/run tar cvf Mysqld_slave.tar mysqld/* scp Mysqld_slave.tar mysqld/* scp Mysqld_slave.tar root@new-db.com:/var/run/. copy [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Just notes for myself on adding more MySQL databases without shutting down the master database.</p>
<p>on existing slave:</p>
<div style="border: 1px solid #fff; background: #000; color: #fff; padding: 5px 5px 5px 5px;">
/etc/init.d/mysqld stop
</div>
<p>copy data dir from /var/lib/mysql and data from /var/run/mysqld to new slave database:</p>
<div style="border: 1px solid #fff; background: #000; color: #fff; padding: 5px 5px 5px 5px;">
cd /var/lib<br />
tar cvf Mysql_slave.tar mysql/*<br />
scp Mysql_slave.tar root@new-db.com:/var/lib/.<br />
cd /var/run<br />
tar cvf Mysqld_slave.tar mysqld/*<br />
scp Mysqld_slave.tar mysqld/*<br />
scp Mysqld_slave.tar root@new-db.com:/var/run/.
</div>
<p>copy /etc/my.cnf from old slave to new slave<br />
add entry for new server-id</p>
<p>start existing slave:</p>
<div style="border: 1px solid #fff; background: #000; color: #fff; padding: 5px 5px 5px 5px;">
cd /var/lib<br />
tar xvf Mysql_slave.tar<br />
cd /var/run<br />
tar xvf Mysqld_slave.tar<br />
/etc/init.d/mysqld start
</div>
<p>start new slave:</p>
<div style="border: 1px solid #fff; background: #000; color: #fff; padding: 5px 5px 5px 5px;">
/etc/init.d/mysqld start<br />
mysql<br />
start slave;
</div>
<p>on masterdb:<br />
e.g.:</p>
<div style="border: 1px solid #fff; background: #000; color: #fff; padding: 5px 5px 5px 5px;">
grant replication slave on *.* to &#8216;repl&#8217;@&#8217;192.168.107.33&#8242; identified by &#8216;password&#8217;;
</div>
<p>test on master:<br />
create database repl;</p>
<p>check on slave:<br />
show databases; /* should show new database */</p>
<p>test on master:<br />
drop database repl;</p>
<p>check on slave:<br />
show databases; /* new database should be dropped */</p>
<p>Now it&#8217;s time to turn this into an automated shell script with <a href="http://expect.nist.gov/">Expect</a> in there.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codebelay.com/blog/2009/11/10/notes-on-adding-more-mysql-databases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Social Media Backup &#8211; What are the options now?</title>
		<link>http://www.codebelay.com/blog/2009/10/04/social-media-backup-what-are-the-options-now/</link>
		<comments>http://www.codebelay.com/blog/2009/10/04/social-media-backup-what-are-the-options-now/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 17:13:57 +0000</pubDate>
		<dc:creator>barce</dc:creator>
				<category><![CDATA[Social Media]]></category>
		<category><![CDATA[TechBiz]]></category>
		<category><![CDATA[WebApps]]></category>

		<guid isPermaLink="false">http://www.codebelay.com/blog/?p=643</guid>
		<description><![CDATA[Bad things happen: Dear Twitter, My Twitter page @mostlylisa has been hacked and deleted. It&#8217;s GONE!!! I am currently catatonic. Please help me restore my account, it&#8217;s like, my meaning in life. Much love to whom ever helps me! PS. If you miss me like I miss you, you can always be my Friend OR [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Bad things happen:</p>
<div style="border: 1px solid #000; padding: 5px 5px 5px 5px;">
Dear Twitter,</p>
<p>My Twitter page <a href="http://twitter.com/mostlylisa">@mostlylisa</a> has been hacked and deleted. It&#8217;s GONE!!! I am currently catatonic. Please help me restore my account, it&#8217;s like, my meaning in life.</p>
<p>Much love to whom ever helps me!</p>
<p>PS. If you miss me like I miss you, you can always be my Friend OR Fan on Facebook. I know it&#8217;s not the same, but it&#8217;s all I have now. *hold me*
</p></div>
<p>It only took twitter about 3 days to recover from this.</p>
<p><a href="http://twitter.com/djsteen/statuses/4599867733" border="0"><img src="http://www.codebelay.com/blog/wp-content/uploads/2009/10/djsteen.png" alt="djsteen" title="djsteen" width="534" height="166" class="aligncenter size-full wp-image-644" /></a></p>
<p>Is there a faster way?</p>
<p>First let&#8217;s look at the current options:</p>
<ul>
<li><a href="http://tweetbackup.com/">TweetBackup</a> (<a href="http://www.nytimes.com/external/gigaom/2009/08/06/06gigaom-back-up-your-social-media-profiles-69520.html">NY Times</a>)</li>
<li><a href="http://backupmytweets.com/">BackUpMyTweets</a></li>
<li>If you are popular enough and folks raise a raucous, Twitter will go into the database back-up and restore your account into its pristine set up.</li>
</ul>
<p>BackupMyTweets required too much info to get it working. No, you cannot have my gmail password.</p>
<p>I&#8217;ve tried Tweetbackup and they get kudos for using <a href="http://oauth.net/">OAuth</a> to make it easy to back your tweets up.</p>
<p>The 3rd option, begging Twitter, simply can&#8217;t scale and will only work for those few elites close to Twitter or popular enough. There isn&#8217;t a consumer solution.</p>
<p>How do we solve the problem of social media backup?</p>
<p>The great thing is the problem is:</p>
<ul>
<li>technical</li>
<li>can have the same business model as insurance</li>
<li>will gain recognition as more snafus happen</li>
</ul>
<p>Once again, if you haven&#8217;t already, use <a href="http://backupmytweets.com/">BackUpMyTweets</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codebelay.com/blog/2009/10/04/social-media-backup-what-are-the-options-now/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Benchmarking Inserts on Drizzle and MySQL</title>
		<link>http://www.codebelay.com/blog/2009/09/08/benchmarking-insert-on-drizzle-and-mysql/</link>
		<comments>http://www.codebelay.com/blog/2009/09/08/benchmarking-insert-on-drizzle-and-mysql/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 17:00:40 +0000</pubDate>
		<dc:creator>barce</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[scalability hacking]]></category>
		<category><![CDATA[WebApps]]></category>
		<category><![CDATA[mysql drizzle benchmarking]]></category>

		<guid isPermaLink="false">http://www.codebelay.com/blog/?p=630</guid>
		<description><![CDATA[I&#8217;m not comparing apples to apples yet&#8230; but out of the box, drizzle does inserts faster than MySQL using the same table type, InnoDB. Here&#8217;s what I&#8217;m comparing: drizzle r1126 configured with defaults, and MySQL 5.1.38 configured with ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex \ --enable-thread-safe-client --enable-local-infile --enable-shared \ --with-plugins=partition,innobase which is really nothing complicated. SQL query caching [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>I&#8217;m not comparing apples to apples yet&#8230; but out of the box, <a href="https://launchpad.net/drizzle">drizzle</a> does inserts faster than <a href="http://www.mysql.com/">MySQL</a> using the same table type, <a href="http://en.wikipedia.org/wiki/Innodb">InnoDB</a>.</p>
<p>Here&#8217;s what I&#8217;m comparing:<br />
drizzle r1126 configured with defaults, and<br />
MySQL 5.1.38 configured with </p>
<div style="color: #fff; background: #000; padding: 5px 5px 5px 5px">
<pre>
./configure --prefix=/usr/local/mysql --with-extra-charsets=complex \
--enable-thread-safe-client --enable-local-infile --enable-shared \
--with-plugins=partition,innobase
</pre>
</div>
<p>which is really nothing complicated.</p>
<p>SQL query caching is turned off on both database servers. Both are using the InnoDB engine plug-in.</p>
<p>I&#8217;m running these benchmarks on a MacBook Pro 2.4 GHz Intel Core 2 Duo with 2GB 1067 MHz DDR3 RAM.</p>
<p>I wrote <a href="http://www.codebelay.com/blog/2007/04/19/more-mysql-51-benchmarks-my-code-is-faster-and-slower-wtf/">benchmarking software about 2 years ago to test partitions</a> but I&#8217;ve since abstracted the code to be database agnostic.</p>
<p>You can get <a href="http://github.com/barce/partition_benchmarks/tree/master">the benchmarking code at Github</a>.</p>
<p>At the command-line, you type:</p>
<div style="color: #fff; background: #000; padding: 5px 5px 5px 5px">
php build_tables.php 10000 4 drizzle
</div>
<p>where 10000 is the number of rows allocated total, and 4 is the number of partitions for those rows.</p>
<p>You can type the same thing for mysql:</p>
<div style="color: #fff; background: #000; padding: 5px 5px 5px 5px">
php build_tables.php 10000 4 mysql
</div>
<p>and get interesting results.</p>
<p>Here&#8217;s what I got:</p>
<h3>MySQL</h3>
<pre>
bash-3.2$ php build_tables.php 10000 4 mysql
Elapsed time between Start and Test_Code_Partition: 13.856538
last table for php partition: users_03
Elapsed time between No_Partition and Code_Partition: 14.740206
-------------------------------------------------------------
marker           time index            ex time         perct
-------------------------------------------------------------
Start            1252376759.26094100   -                0.00%
-------------------------------------------------------------
No_Partition     1252376773.11747900   13.856538       48.45%
-------------------------------------------------------------
Code_Partition   1252376787.85768500   14.740206       51.54%
-------------------------------------------------------------
Stop             1252376787.85815000   0.000465         0.00%
-------------------------------------------------------------
total            -                     28.597209      100.00%
-------------------------------------------------------------
20000 rows inserted...
</pre>
<h3>drizzle</h3>
<pre>
bash-3.2$ php build_tables.php 10000 4 drizzle
Elapsed time between Start and Test_Code_Partition: 7.502141
last table for php partition: users_03
Elapsed time between No_Partition and Code_Partition: 7.072367
-------------------------------------------------------------
marker           time index            ex time         perct
-------------------------------------------------------------
Start            1252376733.68141500   -                0.00%
-------------------------------------------------------------
No_Partition     1252376741.18355600   7.502141        51.47%
-------------------------------------------------------------
Code_Partition   1252376748.25592300   7.072367        48.52%
-------------------------------------------------------------
Stop             1252376748.25627400   0.000351         0.00%
-------------------------------------------------------------
total            -                     14.574859      100.00%
-------------------------------------------------------------
20000 rows inserted...
</pre>
<p>MySQL: 699 inserts per second<br />
drizzle: 1372 inserts per second<br />
As far as inserts go, drizzle is about 2 times faster out of the box than MySQL.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codebelay.com/blog/2009/09/08/benchmarking-insert-on-drizzle-and-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.509 seconds -->

