Sunspot - мощност до приложението си с Solr преди да го знаят

Този пост е част 2 от 2 в серия Ruby Gems


Заглавието е малко скептичен. Не е ли? Но, повярвайте ми, това е вярно. Вие може да реализира Solr мощност търсите във вашите Ruby по релси прилагане, без да знаят Solr . Да, разбира се знаят за Solr. Това, което не знаят е, как да я накара да работи за вас. Да проверим как може да мощност вашето приложение с използване Solr Sunspot скъпоценен камък.

Какво е Sunspot?

Sunspot е Ruby библиотека за изразителен, мощен взаимодействие с търсачката Solr. Sunspot е построен на върха на библиотеката RSolr, което осигурява ниско ниво интерфейс за Solr взаимодействие; Sunspot осигурява прост, интуитивен, изразителен DSL подкрепени от мощни функции за индексиране и търсене на обекти за тях.

Използване на слънчевите петна DSL, можете лесно да прилагат Solr захранва търсенето. Нейната дроп-ин подкрепа с релси модели позволяват да мощност вашия сайт с няколко реда код.

Монтаж

Добавете следния ред в Bundle файл.

gem 'sunspot_rails'
gem 'sunspot_solr'

Then run ‘bundle install’.  Continue reading

Patriotism in TV Commercials



I’m big fan of TV commercials in indian televisions those try to promote patriotism. They nicely talks about their country and to love her even when advertising their products.

Though many of the TV programs (like Reality Shows, family breaking serials) ideas are borrowed from indian televisions, I was always thinking why we don’t see such patriotism in our ads?  Why our commercials do not talk to love our country, to use our local products! I think my days of frustration are over. Recently I’ve seen two tv commercials that are talking about the love for the country and make some change. I’ve embedded those two in this post.

Robi (Mobile operator) TV Commercial:

Frutika (mango juice) TV Commercial

These two are ads I watch in full each time they are broadcasted. Each time I see them I see like I’m seeing it for the first time.

If these ads can change a single person, or at least make him to think different; that’s a big success. I wish to more like these in coming days.

Development/Staging server on Heroku

Deploying with heroku is as easy as just pushing your master branch. However, this does not work for me as I manage different branch for development and staging. If I push these branches to heroku (different instance), it won’t work. It is because Heroku considers only master branch for deployment.

The work-around is very easy with the power of git. All you need to push your WHAT-EVER local branch to master on git. Please make sure you’re not doing this to your production instance.

I’ve created another instance that I will use solely for development test. My local development branch of git is named ‘develop’. So this is what I need to run

git push heroku-dev develop:master

Here, heroku-dev  is the name of my git remote server for testing. I’m pushing my local develop branch to remote’s master branch. Now, heroku will respect your wish :) .

Rails 4 “Routing Concerns”

Today, while digging routing guides of Ruby on Rails, I spot this new feature which is available in Ruby on Rails 4. Routing Concern is a wonderful concept of re-using routing definitions. I just love how Rails try to reckon on DRY principle. I’ve worked in a project where routes.rb has about 50 lines of definition while the project was progress not more than 20%. There were many similar routing definitions in different scopes (namespaces). Routing Concerns will now enable us write less codes to define application routes.

I’m now going to show how to use it as Rails guide already did the job. I’m simply copying the codes over here.

Update:

I’ve also found this blog shared on facebook by one of my friend

Passenger – Run Rails app in development mode

When you run Rails app using Phusion Passenger (modrails), by default, it runs in ‘production’ mode. However, if you want to run it in ‘development’ mode for any reason, you need to add a directive in your apache/nginx configuration.

Apache :

RailsEnv development

Continue reading

Handlebars helpers

In an application we are using Handlebars templating. However, we needed many custom helpers to do what we wanted to achieve. Here are some of those helpers. It may help someone who is looking for achieving similar things. Examples are included.

Adding/Subtracting

Character limit with trailing characters (optional).

Using Non-ORM data sources with Tastypie in Django

Source: http://www.inquisitr.com/183142/state-department-to-reject-keystone-xl-pipeline-reroute/

Recently, I’ve worked with Tastypie which is my first introduction to tastypie. Tastypie itself is wonderful and very easy to work. However, my first catch was that I’ve to use it in a scenario where data source is not django’s ORM. My goal is to expose some API endpoints but the data will come from some other external API. Confusing? Let’s discuss about the implementation not about the wisdom of use cases. If you do not have introduction to the Tastypie, please have a look at their documentation .

Generally, when we create a Tastypie resource, our class inherits ModelResource. ModelResource is actually provides django’s ORM specific accesses as the resource is created on top of Django models. The fact is that, ModelResource is a thin wrapper on top of it’s Resource class and overrides few methods. If we want to use our custom data sources, we will have to override some methods of this Resource class based on our requirements. The methods we have to override are:

Continue reading

KnockoutJS Starter

KnockoutJS Starter

I received the paperback of KnockoutJS Starter book on 28th  December, 2012 though I’ve already completed many pages reading its PDF version. I could not publish my review as I was little busy with our Ruby Conference in Bangladesh .

KnockoutJS Starter is written by Eric M. Barnard and is published by Packt Publishing. This is a very short book which can be completed reading within a week or two.

Continue reading

2013 RubyConf Bangladesh

Бях представяне през 2013 г. RubyConf Бангладеш събитие

I was presenting in 2013 RubyConf Bangladesh event

Well, finally the moment came. RubyConf Bangladesh finally happened at the BASIS Auditorium. The whole day was fun.

The event was scheduled at 11am. However, audience started arriving from 9am. We’ve been thrilled to see the enthusiasm among the audience. The event started 5 mins later than scheduled.

Initially Fayaz Taher,  from BDTech Social, welcomed everyone to the conference and invited Fazle Taher , from Infra Blue Technologies, to present his Keynote. After the keynote, there was a interesting Ice Breaking session. In that session, audience are encouraged to meet and network with new people, exchange business cards/contact details. At the end of that session, a pop question asked to audience to name of 5 new people they just met. S M Rasel (from NewsCred Inc) won that prize. He is my co-worker and he proved what he always used to say (he used to see he “can remember names using some techniques”).

Continue reading