Archive of articles classified as' "Uncategorized"

Back home

daemon_controller + Thinking Sphinx

22/07/2009

I’ve created simple rails initiator in order to start Sphinx through daemon_controller based on the Thinking Sphinx configuration. I hope it will help somebody.

require 'daemon_controller'
 
def before_start
  if not ThinkingSphinx.define_indexes?
    config = ThinkingSphinx::Configuration.instance
    cmd = "#{config.bin_path}#{config.indexer_binary_name} --config \"#{config.config_file}\" --all"
    cmd << " --rotate" if ThinkingSphinx.sphinx_running?
    system cmd
  end
end
 
if defined?(ThinkingSphinx)
  if not ThinkingSphinx.sphinx_running? 
    conf_instance = ThinkingSphinx::Configuration.instance
    @controller = DaemonController.new(
      :identifier => 'Sphinx search server',
      :start_command => "#{conf_instance.bin_path}#{conf_instance.searchd_binary_name} --pidfile --config \"#{conf_instance.config_file}\"",
      :before_start => method(:before_start),
      :ping_command => lambda { TCPSocket.new(conf_instance.configuration.searchd.address, conf_instance.configuration.searchd.port) },
      :pid_file => conf_instance.configuration.searchd.pid_file,
      :log_file => conf_instance.configuration.searchd.log)
      @controller.start
  end
end
4 Comments

The Rails Initialization Process

22/07/2009

I found really nice description of rails initialization process here.

No Comments

capistrano recipes for ubuntu

19/07/2009

Few nice capistrano recipes which may help you automate Ubuntu Server setup:

No Comments

Decoration in Ruby

30/06/2009

Interesting discussion about object decoration in ruby.

No Comments

drop all tables and sequences in oracle

18/05/2009

tables:

SELECT 'DROP TABLE ' || TABLE_NAME || ' CASCADE CONSTRAINTS;' FROM user_tables;

sequences:

SELECT 'DROP SEQUENCE ' || sequence_name || ';' FROM user_sequences;
No Comments

Google engine support for java

7/04/2009

Looks like google engine will support java. Pretty exciting :)

No Comments

apache2 utils

13/03/2009

deactivate site:

a2dissite site_name

activate site:

a2ensite site_name
No Comments

windows 7

10/01/2009


No Comments

Properties pattern

23/10/2008

Really nice ‘introduction’ to properties pattern by Steve Yegge

No Comments

how to remove .svn from all folders – command line

15/10/2008
find . -name ".svn" -exec rm -rf '{}' \;
No Comments