Read my latest article: Six days to complete the Rails hosting survey (posted Thu, 24 Apr 2014 14:36:00 GMT)

Join the zsh revolution

Posted by Thu, 27 May 2010 17:17:00 GMT

I love the OhMyZsh community. Let’s grow it a little more this next Tuesday.

Twitter / Oh My Zsh: Declaring that next Tuesda ...

Join the Zsh revolution here…

Oh My Zsh gets theme support

Posted by Mon, 31 Aug 2009 15:00:00 GMT

I just pushed a small change to Oh My Zsh, which gives it rudimentary support for themes. What I’m hoping to do is collect prompts from tons of people and make it simple for others to find a PROMPT that works well for them.

robbyrussell's oh-my-zsh at 2c9f74b5c3f6910e7c66601008e9ddd0444b70c7 - GitHub

As of right now, there are only three for you to choose from. So, please head over to github, fork Oh My Zsh, add your theme, and send a pull request. :-)

zsh /Users/robbyrussell/Projects/development/planetargon/brainstorm 2014 zsh

Once I get it merged in, we’ll get a screenshot of it added to the Oh My Zsh wiki. (see themes)

I know that many of you have some really sweet prompts configured as I got a lot of response with my post, Show me your and I’ll show you mine.

..and on the seventh day, Science created zsh

Posted by Mon, 31 Aug 2009 01:08:00 GMT

Inspired by some recent posts from Tom on zsh, I decided that I’d do my part to help people give it a whirl. I’ve been using zsh for a few years now and haven’t found myself missing bash.

If you’re interested in taking a few minutes to give zsh a while, you’re in luck. I recently reorganized all of my zsh config into a package and tossed it on github to share. My goal was to create a reusable tool that would allow people to get up and running quickly with some of the fun configuration that I’ve come to rely on on a daily basis.

For example:

  • Auto-complete rake and capistrano tasks
  • Git branch names when you’re in a git project directory structure
  • Tons of color highlighting (grep, git, etc.)
  • Sexy prompts.. (so say me)
  • much much more…

I invite you to give Oh My Zsh a whirl, which should take you less than a minute. Just follow the instructions.

Also, Oh My Zsh is Snow Leopard compatible. ;-)

Fixing PostgreSQL corruption with Rails?

Posted by Sun, 06 Aug 2006 00:16:00 GMT

3 comments Latest by Robert Treat Tue, 08 Aug 2006 17:26:04 GMT

People have been emailing me to let me know that the search on my blog was broken. Today I finally set out to fix the problem, which looked like a complex issue with my PostgreSQL database. I’m not sure how long ago it started so I am not sure what was the cause at the moment. If you did a search on my blog you’d get an application error and behind the scenes, you would see the following error.

PGError: ERROR:  missing chunk number 0 for toast value 58441

Eek!

So, I tried to REINDEX the table and it didn’t solve the problem… so I started poking around with different types of queries to see what I could do to generate the error again. Didn’t take me long to figure out that it had something to do with the body column in the contents table.


db_name=# SELECT count(id) FROM contents WHERE body ~* 'postgresql' LIMIT 20;
ERROR:  missing chunk number 0 for toast value 58441

db_name_=# SELECT count(id) FROM contents WHERE excerpt ~* 'postgresql' LIMIT 20;
 count 
-------
     0
(1 row)

What am I to do? I did some googling (and go figure… the error being returned was caught on my blog by google)... which was amusing.

In the #postgresql channel on freenode they recommended that I try and find the specific row in the table that was causing this error. I decided to just run a for loop in script/console on the Content object in Typo and print out the name of each record until it gave me an error.


for i in 1..30000
  puts Content.find( i ).title
  i =+ 1
end

This began to print out titles of older blog entries and sure enough… the loop died when it hit the following error. :-)


  PostgreSQL sequences in Rails
  When TSearch2 Met AJAX
  ActiveRecord::StatementInvalid: PGError: ERROR:  missing chunk number 0 for toast value 58441
  : SELECT * FROM contents WHERE (contents.id = 1678)  LIMIT 1
          from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/connection_adapters/abstract_adapter.rb:88:in `log'
          from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/connection_adapters/postgresql_adapter.rb:137:in `execute'
          from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/connection_adapters/postgresql_adapter.rb:351:in `select'
          from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/connection_adapters/postgresql_adapter.rb:118:in `select_all'
          from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/base.rb:431:in `find_by_sql'
          from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/base.rb:395:in `find'
          from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/base.rb:393:in `find'
          from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/base.rb:409:in `find'
          from (irb):23
          from (irb):22
  >> exit

15.seconds.later I logged into psql and ran DELETE FROM contents WHERE id = 1678... and all is well!

irb history hack

Posted by Wed, 05 Oct 2005 18:43:00 GMT

Okay, I’ve posted a few things about console recently and I know that you’re all using it… right?

Well, Jeremy Kemper (bitsweat) mentioned at the PDX.rb meeting last night that there was a way to keep history of your irb commands. (more than just readline… up-arrow’n).

You can actually quit irb, restart it and still see your history. This makes Robby happy.

See here for details

Thanks Jeremy!

Master, console, and servant part two

Posted by Tue, 04 Oct 2005 04:54:00 GMT

This is a brief addition to the post from a few days ago, Master, console, and servant.

Noradio on IRC pointed out one thing that I did not mention in my previous blog entry… that you can bind a subsession of irb to a specific object. What??

Okay, let me explain this a bit more. Instead of always setting a variable to hold an instance of an object, you can be a bit more creative with irb.

I present…

So, for example. You can perform the following in script/console.

irb Model.find(4) name

If there is an attribute/method called name in your model, then it will call it there. See my screen shot for some more details of how I used the jobs and fg # commands to switch jobs…. and I even found out what happens when you attempt to switch to the current thread. :-)

Until next time…

Older posts: 1 2