Tuesday, April 27, 2010

Checking requirements in Routes

Here by i have checked routes for domain_name with alpha-numeric.

map.home '/homes/:domain_name/:id',:controller=>'home', :action=>'new', :requirements => { :domain_name => /[A-Za-z0-9.]+/}

Friday, April 16, 2010

sending ajax request in rails

Hi

Just for syntax, used this for sending ajax request..


new Ajax.Request('/controller/action', {asynchronous:true, evalScripts:true, method:'get', parameters:'params1=' + param + '&param2=' + param + '&param3=' + param }); return false;

Thanks,
Sri

sending ajax request in rails

Hi

Just for syntax, used this for sending ajax request..


new Ajax.Request('/controller/action', {asynchronous:true, evalScripts:true, method:'get', parameters:'params1=' + param + '&param2=' + param + '&param3=' + param }); return false;

Thanks,
Sri

Thursday, April 8, 2010

Find Number of mp3 files in a directory

To Find Number of mp3 files in a directory,

I got this,

ls | grep .*.mp3 | wc -l


Thanks,
Srikanth

Friday, April 2, 2010

Thinking sphinx

Hi,

This is a Great plugin in Rails for the search options. This comes with many inbuilt functionalities. There are many tutorials & Videos on how to work this.

But I struggled a lot in Installation.

1. I have installed the Thinking sphinx Plugin, But there was error

srikanth@client30:~/project$ rake thinking_sphinx:index

Sphinx cannot be found on your system. You may need to configure the following
settings in your config/sphinx.yml file:
* bin_path
* searchd_binary_name
* indexer_binary_name

For more information, read the documentation:
http://freelancing-god.github.com/ts/en/advanced_config.html
Generating Configuration to /home/srikanth/projects/
thisproject/config/development.sphinx.conf


Solution : You will have to download and install the sphinx software. Thinking sphinx is only a wrapper around sphinx.

You can get sphinx at http://sphinxsearch.com/


2) After I Install sphinx, when I start it
srikanth@client30:~/projects/
my project$ rake thinking_sphinx:start
(in /home/srikanth/projects/my project)
Failed to start searchd daemon. Check /home/srikanth/projects/my project/log/searchd.log.
Failed to start searchd daemon. Check /home/srikanth/projects/my project/log/searchd.log

Solution: you need to configure and start the sphinx daemon

rake thinking_sphinx:configure
rake thinking_sphinx:start


& This should work.. It worked for me when i did

rake thinking_sphinx:start -t



Now everything works fine :):)

Thanks,
Srikanth