Thursday, November 28, 2013

Monday, November 18, 2013

SSH

If you are using VPS with root access you need to connect to your server often. If already have a id_rsa.pub file you can use this to authorize your server as well.

cat ~/.ssh/id_rsa.pub

any paste the content in your servers

~/.ssh/authorized_keys

file. You will not be prompted for password again.


If you are using a server often you can add server definition to you ssh config file as well

~/.ssh/config

Add following

Host dev
   HostName dev.example.com
   Port 22000
   User foo

After that you can connect to host with this command

ssh  dev



Friday, November 15, 2013

Openning your local work to internet

You may want to show your work to other people which are not currently sitting near you. You can use localtunnel for that purpose. You can install local tunnel by using the following command. Local tunnel is using node.js therefore you also need to install nodejs first if you donot h

npm install -g localtunnel

After that use

    lt --port 8000

you will see something like this

    your url is: http://gqgh.localtunnel.me

which means that your local application can be accessable now over the internet. be aware that everybody can see your application now.



Thursday, November 7, 2013

Thinking in Sphinx

Thinking in Sphinx is a ruby interface for Sphinxsearch engine.


install sphinxsearch

  sudo apt-get install sphinxsearch

install thinking sphinx

  sudo add-apt-repository ppa:dhuggins/cmusphinx
  sudo apt-get update
  sudo apt-get install sphinxsearch

add required gems

  gem 'mysql2'
  gem 'thinking-sphinx'

install

  bundle install

create a file under app/indices/ called _index.rb
add the following

ThinkingSphinx::Index.define :article, :with => :active_record do
  # fields
  indexes title, :sortable => true
  indexes content
  # attributes
  has created_at, updated_at
end

After that you can test your searches in rails console

example search

  Article.search params[:search]

 @articles = Article.search Riddle::Query.escape(params[:search])



Links:

http://pat.github.io/thinking-sphinx/

http://blog.app2technologies.com/basic-thinking-sphinx-setup-in-rails-3.1-or-newer-on-ubuntu-12.04/


LinkWithin

Related Posts Plugin for WordPress, Blogger...