08 Nov 2008

WebByNode: A New Hosting Service Launching Soon

RubyonRails posted by Akhil Bansal

Guys, I received a mail today that there will be a new hosting service launching soon. They said that it makes easier to deploy your applications. Whether its Ruby on Rails, Django, LAMP or your choice of Linux Distribution, its a ready-to-go solution. For more information please visit http://www.webbynode.com/

I am signing up there as a beta tester. Lets see how webby-node can help rails community by its services.

04 Nov 2008

Ruby Funday: A Day full of Ruby fun event in India

RubyonRails posted by Akhil Bansal

Monday, Tuesday, Wednesday, Thursday, Friday, Funday and Sunday.

Surprised, This is not a typo. Saturday is now converted to Funday. How??? Why??? When???

Geekeerie has started organizing new kind of events in India. One of those kinds of event is Ruby Funday. Which is a full day pure geek ruby event. Where geeks will show their code, tricks and funde ;) .

The first Ruby Funday is scheduled for 22, Nov 2008 at Noida, India. For more details please visit their site(beta).

12 Aug 2008

Hoptoad: A Rails Exception Handling Service

Rails Deprecations, RubyonRails, applications, exceptions, hoptoad, rails, rails plugins, thoughtbot posted by Administrator

Many of you guys(as me) may have used Exception Notifier plugin to get Rails app exceptions right into your mailbox, and may also have faced some problem like this.

Also if you have 2-3 or more apps running in production then managing such exception mails is also a big headache. In such case one have to keep track of many things like which type of error is resolved/unresolved for which project etc… .

So, here is a good news for those who don’t know about Hoptoad. It is an hosted service by thoughtbot which receives your exceptions, notify you once per error type by email and keep track(resolved/unresolved, count etc…) of your errors on project basis.

By now its a free service. I’m gonna use this as my next project goes live. What abt you??? ;-P

08 Aug 2008

Hosting Rails app and Wordpress on same domain(as folder instead of subdomain)

Apache, RubyonRails, deployment, hosting, rails, virtualhost, wordpress posted by Akhil Bansal

Hey guys, Yesterday I did an interesting server configuration. Actually we had a rails app hosted on server which is using passenger(a.k.a mod_rails). This application can be access by going to http://domain.com . Also we had a wordpress running which could be access by going to http://blog.domain.com.

But, for SEO sake I had to change configuration so that wordpress can be access by http://domain.com/blog instead of http://blog.domain.com/

The problem was if I configure wordpress for http://domain.com/blog and go to this url, the request was handled by rails app because of domain.com virtualhost.

So what I did? I changed apache virtualhost configuration for http://blog.domain.com and http://domain.com as:

Also I created a symbolic link to wordpress installation directory under rails public folder(ln -s /var/www/html/wordpress /var/www/html/railsapp/blog).

I restarted apache and it worked fine. Wordpress was running at http://domain.com/blog and rails app was as http://domain.com/.

31 Jul 2008

When Ultrasphinx is used with STI…

RubyonRails, STI, rails, ultrasphinx posted by Akhil Bansal

Hi Guys, it has been a long time since I last posted. I had worked on several things since then, and have couple of posts pending/draft. One of those posts is related to Ultrasphinx, when it is used with STI models.

For those who are new to Ultrasphinx: Ultrasphinx is a rails plugin and client to the Sphinx(full text search engine) written by Evan Weaver. More about Ultrasphinx here.

Lets get into the situation. Consider a STI case where we are using ultrasphinx to index several fields:

Now assume we have following data in posts table:
picture-4.png
and now in application root:

By this point we have created sphinx configuration file, indexed all records from ultrasphinx models and started sphinx search daemon.

Now open script/console and create and fire a query to find some articles:

Here when you run the query you get an exception, because it is trying to find an article with id 5, which actually a story type not article. So why it is trying to find such article?

Now have a look into config/ultrasphinx/development.conf file. Under section “source articles_main” you’ll get “SELECT (posts.id * 3 + 0) AS id, ‘’ AS article_title, posts.body AS body, ‘Article’ AS class, 0 AS class_id, posts.title AS title FROM posts WHERE posts.id >= $start AND posts.id <= $end GROUP BY posts.id" Which is a SQL to get record to index.

If you check it carefully you'll findout that it should select all articles record to index but unfortunately it is selecting all records from table and considering them as articles. To fix it you need to modify this query and add "posts.type = 'Article'" in where condition. So the query should be "SELECT (posts.id * 3 + 0) AS id, '' AS article_title, posts.body AS body, 'Article' AS class, 0 AS class_id, posts.title AS title FROM posts WHERE (posts.type = 'Article') and posts.id >= $start AND posts.id <= $end GROUP BY posts.id"

But still there is a problem. If you do this manually you have to do it again and again whenever you issue "rake ultrasphinx:configure" because this configuration file will be overwritten.

Better option is to add conditions in models as is_indexed options like:

and it worked fine.

Manik gave me an idea to write a patch for ultrasphinx to add such conditions automatically in case of STI. So may be another post related to ultrasphinx will be soon ;-)

Update: Here is the patch Git patch: Fix STI Issue. After applying this patch you need not to add conditions explicitly for such case. It will automatically check and add conditions for STI.

Next Page »« Previous Page