pack-objects died with strange error when running git push

Git No Comments »

If you get errors such as

fatal: Out of memory, malloc failed
error: pack-objects died with strange error
error: failed to push some refs to ‘git@myserver.com:foo.git’

when running

git push

first, upgrade git to the latest version on both ends, then check if

git repack

still works. If not, you might have a local issue.

If repack still works, your remote server (the server you push to) might actually run out of memory, which can easily happen with for example smallish VPS slices. So, just increase your swap file as Linus suggests, like this and it might start working again. Hope it helps.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Forwarding Multiple Messages with Thunderbird - And Not as Attachments

Uncategorized No Comments »

Mozilla Thunderbird does not have a built-in option to right-click and forward multiple messages without sending them as attachments of a single message or sending each message inline after entering the address manually. While this makes sense as it minimizes server resources and web traffic,  sometimes it is more convenient for sender to send (bounce) multiple messages to the same recipient in one action, giving the reader single messages in her inbox. Luckily there’s the Mail Redirect Add-on that helps with this task, one of the most useful Thunderbird extensions. 

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Sorted and Translated ActiveRecord Model with Globalize2 and Ruby Magic

Uncategorized No Comments »

This code returns all records of your model sorted by translated field name when using Globalize2 :

#app/models/widget.rb

def self.all_sorted
Widget.find(:all, :joins => :globalize_translations,
:conditions => ['locale = ?', I18n.locale]).sort_by(&:name)

end

As outlined it this post, :joins => :globalize_translations is mandatory. The unary ampersand operator converts a Proc to a block, so in this case sort_by(&:name) is “shorthand” for

sort {|x,y| x.name <=> y.name}

Ruby sometimes feels like assembling a Swiss watch in code, where other languages feel like fixing an old car.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

no such file to load — readline (LoadError) when running script/console

Ruby on Rails, Ubuntu/Linux 19 Comments »

If you get

Loading development environment (Rails 2.3.2)
/usr/local/lib/ruby/1.8/irb/completion.rb:10:in `require’: no such file to load — readline (LoadError)
        from /usr/local/lib/ruby/1.8/irb/completion.rb:10
        from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `require’
        from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `load_modules’
        from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `each’
        from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `load_modules’
        from /usr/local/lib/ruby/1.8/irb/init.rb:21:in `setup’
        from /usr/local/lib/ruby/1.8/irb.rb:54:in `start’
        from /usr/local/bin/irb:13

when running script/console, you might be missing some libraries after you’ve installed Ruby from source. So you might try (Ubuntu, Debian):

sudo apt-get install libncurses5-dev

sudo apt-get install libreadline5-dev

Then cd to the folder with your unpacked Ruby sources, subfolder ext/readline:

cd /usr/src/ruby-1.8.7-p72/ext/readline

ruby extconf.rb

make

sudo make install

There is no need to recompile Ruby. If you get any of these:

checking for tgetnum() in -lncurses… no
checking for tgetnum() in -ltermcap… no
checking for tgetnum() in -lcurses… no
checking for readline/readline.h… no
checking for editline/readline.h… no

you’re still missing libraries so re-check if the apt-get commands above completed without errors. Hope it helps.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in