<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US">
  <title>ie.brokethe.net - Home</title>
  <id>tag:ie.brokethe.net,2009:mephisto/</id>
  <generator version="0.7.3" uri="http://mephistoblog.com">Mephisto Noh-Varr</generator>
  
  <link href="http://ie.brokethe.net/" rel="alternate" type="text/html" />
  <updated>2008-12-15T11:33:49Z</updated>
  <link rel="self" href="http://feeds.feedburner.com/Iebrokethenet" type="application/atom+xml" /><entry xml:base="http://ie.brokethe.net/">
    <author>
      <name>Nick Poulden</name>
    </author>
    <id>tag:ie.brokethe.net,2008-12-15:245</id>
    <published>2008-12-15T10:57:00Z</published>
    <updated>2008-12-15T11:33:49Z</updated>
    <link href="http://ie.brokethe.net/2008/12/15/import-production-database-into-development-environment" rel="alternate" type="text/html" />
    <title>Capistrano task to copy production database into your local development database</title>
<content type="html">
            &lt;p&gt;I frequently need to copy my production database in to my local development environment so I can work with the same data as on the live site. I’ve written 3 capistrano tasks that make this a lot easier: backup, import_backup and backup_and_import.&lt;/p&gt;


	&lt;p&gt;‘backup’ runs mysqldump on the production server using the production username and password supplied in your database.yaml file, before zipping the file and downloading it to a local directory called ‘backups’.&lt;/p&gt;


	&lt;p&gt;‘import_backup’ imports the latest backup file in the ‘backups’ folder into your local development database, using the ‘development’ username and password in database.yml.&lt;/p&gt;


	&lt;p&gt;‘backup_and_import’ performs the above 2 commands one after the other. If you want to try it out, copy the code below into your deploy.rb file, then try ‘cap backup_and_import’ from your root rails folder.&lt;/p&gt;


&lt;pre&gt;
require 'yaml'

desc "Copy the remote production database to the local development database" 
task :backup, :roles =&amp;gt; :db, :only =&amp;gt; { :primary =&amp;gt; true } do
  filename = "#{application}.dump.#{Time.now.to_i}.sql.bz2" 
  file = "/tmp/#{filename}" 
  on_rollback { delete file }
  db = YAML::load(ERB.new(IO.read(File.join(File.dirname(__FILE__), 'database.yml'))).result)['production']
  run "mysqldump -u #{db['username']} --password=#{db['password']} #{db['database']} | bzip2 -c &amp;gt; #{file}"  do |ch, stream, out|
    puts out
  end
  `mkdir -p #{File.dirname(__FILE__)}/../backups/`
  get file, "backups/#{filename}" 
  run "rm #{file}" 
end

desc "Copy the latest backup to the local development database" 
task :import_backup do
  filename = `ls -tr backups | tail -n 1`.chomp
  if filename.empty?
    logger.important "No backups found" 
  else
    ddb = YAML::load(ERB.new(IO.read(File.join(File.dirname(__FILE__), 'database.yml'))).result)['development']
    logger.debug "Loading backups/#{filename} into local development database" 
    `bzip2 -cd backups/#{filename} | mysql -u #{ddb['username']} --password=#{ddb['password']} #{ddb['database']}`
    logger.debug "command finished" 
  end
end

desc "Backup the remote production database and import it to the local development database" 
task :backup_and_import do
  backup
  import_backup
end
&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://ie.brokethe.net/">
    <author>
      <name>Nick Poulden</name>
    </author>
    <id>tag:ie.brokethe.net,2008-12-04:244</id>
    <published>2008-12-04T12:09:00Z</published>
    <updated>2008-12-04T12:17:17Z</updated>
    <link href="http://ie.brokethe.net/2008/12/4/e-resistible-online-takeaways" rel="alternate" type="text/html" />
    <title>e-resistible Online Takeaways</title>
<content type="html">
            &lt;p&gt;e-resistible was programmed by me from scratch in Ruby on Rails. You can &lt;a href="http://www.e-resistible.co.uk/"&gt;order takeaway online&lt;/a&gt; as well as searching for specific food types on your area, such as &lt;a href="http://www.e-resistible.co.uk/chinese-takeaway/london"&gt;chinese takeaway in london&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;The site has about 150 restaurants so far but is growing by the day. It was recently featured in &lt;a href="http://www.independent.co.uk/news/education/higher/campus-dragons-the-entrepreneurial-spirit-is-soaring-across-universities-in-the-uk-1049816.html"&gt;The Independent&lt;/a&gt;. This is probably the most successful website I’ve put together, but also the most challenging from a code point of view.&lt;/p&gt;


	&lt;p&gt;I hope to go into some more details of the challenges I faced and how they were overcome in future blogs.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://ie.brokethe.net/">
    <author>
      <name>Nick Poulden</name>
    </author>
    <id>tag:ie.brokethe.net,2008-07-09:236</id>
    <published>2008-07-09T16:49:00Z</published>
    <updated>2008-07-09T16:51:27Z</updated>
    <link href="http://ie.brokethe.net/2008/7/9/rails-utf-8-problem" rel="alternate" type="text/html" />
    <title>Rails UTF-8 problem</title>
<content type="html">
            For some reason the UTF-8 content in my database wasn't correctly rendering in the HTML. Turns out that *removing* encoding: utf8 from database.yml fixed the problem. Strange!
          </content>  </entry>
  <entry xml:base="http://ie.brokethe.net/">
    <author>
      <name>Nick Poulden</name>
    </author>
    <id>tag:ie.brokethe.net,2008-06-05:235</id>
    <published>2008-06-05T20:08:00Z</published>
    <updated>2008-06-05T20:08:32Z</updated>
    <link href="http://ie.brokethe.net/2008/6/5/git-submodule-conflicts" rel="alternate" type="text/html" />
    <title>Git submodule conflicts</title>
<content type="html">
            &lt;p&gt;If you ever get this message:&lt;/p&gt;

&lt;pre&gt;
$ git pull
fatal: cannot merge modes?
Merge with strategy recursive failed.
&lt;/pre&gt;

&lt;p&gt;It's because there are conflicting submodules - you need to make sure your local submodules match those of the origin before pulling.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://ie.brokethe.net/">
    <author>
      <name>Nick Poulden</name>
    </author>
    <id>tag:ie.brokethe.net,2008-04-04:233</id>
    <published>2008-04-04T09:03:00Z</published>
    <updated>2008-04-04T09:09:00Z</updated>
    <category term="Mac" />
    <link href="http://ie.brokethe.net/2008/4/4/famfamfam-icon-set-for-omnigraffle" rel="alternate" type="text/html" />
    <title>famfamfam icon set for OmniGraffle</title>
<content type="html">
            I created an OmniGraffle stencil of the excellent &lt;a href="http://www.famfamfam.com/"&gt;famfamfam icon set&lt;/a&gt; made available under the Creative Commons license by Mark James. The first 12 hours has already seen over 100 downloads from the OmniGraffle Stencil website &lt;a href="http://www.graffletopia.com/"&gt;Graffletopia&lt;/a&gt;. Check it out &lt;a href="http://www.graffletopia.com/stencils/347"&gt;here&lt;/a&gt;.
          </content>  </entry>
  <entry xml:base="http://ie.brokethe.net/">
    <author>
      <name>Nick Poulden</name>
    </author>
    <id>tag:ie.brokethe.net,2008-03-19:231</id>
    <published>2008-03-19T16:18:00Z</published>
    <updated>2008-03-19T16:22:09Z</updated>
    <category term="Windows" />
    <category term="windows" />
    <link href="http://ie.brokethe.net/2008/3/19/git-on-windows" rel="alternate" type="text/html" />
    <title>Git on Windows</title>
<content type="html">
            &lt;p&gt;If you want to use git with windows, here's what you need to do. This is assuming you'll be using the windows command prompt to enter commands.&lt;/p&gt;

&lt;p&gt;
&lt;ol&gt;
&lt;li&gt;Go to &lt;a href="http://code.google.com/p/msysgit/downloads/list"&gt;http://code.google.com/p/msysgit/downloads/list&lt;/a&gt; and download the latest Windows build of Git (at the time of writing the latest one is Git-preview20080301.exe)&lt;/li&gt;
&lt;li&gt;Double click the install file - make sure the 'Run git from the windows command prompt' option is selected&lt;/li&gt;
&lt;li&gt;Finish the installation and open a command prompt&lt;/li&gt;
&lt;li&gt;To clone a remote repository, type git clone ssh://git_username@git_host/path/to/repos local_repos_dir&lt;/li&gt;
&lt;/ol&gt;

It's the last step that had me stumped for a while. There's no colon after the git_host and it seems to need ssh:// at the start.
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://ie.brokethe.net/">
    <author>
      <name>Nick Poulden</name>
    </author>
    <id>tag:ie.brokethe.net,2008-02-11:217</id>
    <published>2008-02-11T14:42:00Z</published>
    <updated>2008-02-12T10:47:59Z</updated>
    <category term="Misc" />
    <link href="http://ie.brokethe.net/2008/2/11/download-mms-file" rel="alternate" type="text/html" />
    <title>Download MMS file</title>
<content type="html">
            If you need to download an MMS file to your local machine, try http://geocities.com/majormms/. You can then use ffmpeg to convert to a format of your choice, like flv.
          </content>  </entry>
  <entry xml:base="http://ie.brokethe.net/">
    <author>
      <name>Nick Poulden</name>
    </author>
    <id>tag:ie.brokethe.net,2008-02-06:214</id>
    <published>2008-02-06T12:33:00Z</published>
    <updated>2008-03-08T16:48:10Z</updated>
    <category term="Mac" />
    <category term="console" />
    <category term="mac" />
    <category term="shortcuts" />
    <category term="terminal" />
    <link href="http://ie.brokethe.net/2008/2/6/mac-terminal-shortcuts" rel="alternate" type="text/html" />
    <title>Mac Terminal Shortcuts</title>
<content type="html">
            &lt;p&gt;Here are some useful shortcuts for getting around the mac terminal. The first table applies to the Leopard terminal.&lt;/p&gt;


	&lt;table&gt;
		&lt;tr&gt;
			&lt;th&gt;Key &lt;/th&gt;
			&lt;th&gt;Description &lt;/th&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; ⌘ + N &lt;/td&gt;
			&lt;td&gt; Create a new shell window &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; ⌘ + T &lt;/td&gt;
			&lt;td&gt; Create a new shell tab &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; ⌘ + ` &lt;/td&gt;
			&lt;td&gt; Next Terminal window &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; ⌘ + ~ &lt;/td&gt;
			&lt;td&gt; Previous Terminal window &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; ⌘ + } &lt;/td&gt;
			&lt;td&gt; Next Terminal tab &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; ⌘ + { &lt;/td&gt;
			&lt;td&gt; Previous Terminal tab &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; ⌘ + W &lt;/td&gt;
			&lt;td&gt; Close window or tab &lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;




	&lt;p&gt;Most consoles should support these shortcuts:&lt;/p&gt;


	&lt;table&gt;
		&lt;tr&gt;
			&lt;th&gt;Key &lt;/th&gt;
			&lt;th&gt;Description &lt;/th&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Ctrl-A &lt;/td&gt;
			&lt;td&gt; Move the cursor to the beginning of the command line. &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Ctrl-B &lt;/td&gt;
			&lt;td&gt; Move the cursor back one character. &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Ctrl-C &lt;/td&gt;
			&lt;td&gt; Break out of the command without any change to the settings. &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Ctrl-D &lt;/td&gt;
			&lt;td&gt; Delete the character at the cursor. &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Ctrl-E &lt;/td&gt;
			&lt;td&gt; Move the cursor to the end of the command line. &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Ctrl-F &lt;/td&gt;
			&lt;td&gt; Move the cursor forward one character. &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Ctrl-I &lt;/td&gt;
			&lt;td&gt; Recall a complete command name; same as the Tab key operation. &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Ctrl-K &lt;/td&gt;
			&lt;td&gt; Delete all characters from the cursor to the end of the command line &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Ctrl-L &lt;/td&gt;
			&lt;td&gt; Redisplay the current command line, same as the Ctrl-R key. &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Ctrl-N &lt;/td&gt;
			&lt;td&gt; Recall the most recent command in the command history relative to the current pointer in the history list. &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Ctrl-P &lt;/td&gt;
			&lt;td&gt; Recall the oldest command in the command history, beginning with the most recent command. &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Ctrl-R &lt;/td&gt;
			&lt;td&gt; Redisplay the current command line; same as Ctrl-L key. &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Ctrl-T &lt;/td&gt;
			&lt;td&gt; Transpose the characters to the left of the cursor with the character located at the cursor. &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Ctrl-U &lt;/td&gt;
			&lt;td&gt; Delete all characters from the cursor to the beginning of the command line. &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Ctrl-V &lt;/td&gt;
			&lt;td&gt; Insert a code to indicate that the immediately following value is a command entry. &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Ctrl-W &lt;/td&gt;
			&lt;td&gt; Delete the word to the left of the cursor. &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Ctrl-X &lt;/td&gt;
			&lt;td&gt; Delete all characters from the cursor to the beginning of the command line. &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Ctrl-Y &lt;/td&gt;
			&lt;td&gt; Recall the most recent entry in the buffer (which contains the last ten items you deleted). &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Esc-B &lt;/td&gt;
			&lt;td&gt; Move the cursor back one word. &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Esc-C &lt;/td&gt;
			&lt;td&gt; Capitalize the word at the cursor. &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Esc-D &lt;/td&gt;
			&lt;td&gt; Delete from the cursor to the end of the word. &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Esc-F &lt;/td&gt;
			&lt;td&gt; Move the cursor forward one word. &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Esc-L &lt;/td&gt;
			&lt;td&gt; Change the word at the cursor to lowercase. &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Esc-Q &lt;/td&gt;
			&lt;td&gt; Insert a code to indicate that the immediately following value is a command entry. &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Esc-U &lt;/td&gt;
			&lt;td&gt; Capitalize letters from the cursor to the end of the word. &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Esc-Y &lt;/td&gt;
			&lt;td&gt; Recall the next deleted buffer. (Effective after using Ctrl-Y.) &lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;
          </content>  </entry>
</feed>
