What is the equivalent of 'index_delta' in Thinking Sphinx v3? - ruby

This question is related to this one: Using Delta Indexes for associations in Thinking Sphinx
I have exactly the same dilemma right now. I tried the solution posted by Pat and Claudio but no luck since I'm using Thinking Sphinx version 3.0.6.
I'm using ts delayed delta gem as well.

This is covered here: https://github.com/pat/thinking-sphinx/issues/780 - but the short answer is:
ThinkingSphinx::Deltas::IndexJob.new('product_delta').perform
If you want to queue it up in Delayed Job, though, then the following is what you're after:
Delayed::Job.enqueue(
ThinkingSphinx::Deltas::DelayedDelta::DeltaJob.new('product_delta')
)

Related

Corenlp server shows different NER result from local 3.8 version

I uses the sentense
He died in the day before yesterday.
to process corenlp NER.
On the server, I got the result like this.
And in local, I uses the same sentence, got the result of
He(O) died(O) in(O) the(O) day(TIME) before(O) yesterday(O) .(O)
So, how can I get the same result like the server?
In order to increase the likelihood of getting a relevant answer, you may want to rephrase your question and provide a bit more information. And as a bonus, in the process of doing so, you may even find out the answer yourself ;)
For example, what url are you using to get your server result? When I check here: http://nlp.stanford.edu:8080/ner/process , I can select multiple models for English. Not sure which version their API is based on (would say the most recent stable version, but I don't know). Then the title of your post suggests you are using 3.8 locally, but it wouldn't hurt to specify the relevant piece in your pom.xml file, or the models you downloaded yourself.
What model are you using in your code? How are you calling it? (i.e. any other annotators in your pipeline that could be relevant for NER output)
Are you even calling it from code (if so, Java? Python?), or using it from the command line?
A lot of this is summarised in https://stackoverflow.com/help/how-to-ask and it's not that long to read through ;)

Feedjira: Feed update returns duplicates

I am trying to print rss/atom feed updates using ruby. Feedjira seems to be the best bet for this. Unfortunately the update feature does not seem to work properly. I get duplicate entries.
Here is a simple example that produces the problem:
require 'feedjira'
require 'pp'
feed = Feedjira::Feed.fetch_and_parse "http://lorem-rss.herokuapp.com/feed?unit=second&interval=10"
loop do
feed = Feedjira::Feed.update(feed)
pp feed.new_entries
sleep 20
end
Any suggestions? Maybe other libraries? Or am I missing something important when using Feedjira?
There a several questions around this topic for Feedzirra the former name for Feedjira, but the update feature seems to be a new feature: http://feedjira.com/updating-feeds.html
The updated functionality was removed from feedjira due to serious problems. See
(commit) https://github.com/feedjira/feedjira/commit/6f56516934a9bdb8691f2bbe98be0f2b7c25b7ea
(discussion) https://github.com/feedjira/feedjira/issues/218

Pagination with Letters as index

I may have misunderstood what index is, after reading my question, you'll soon realize so please correct me if i was wrong. anyhow,
Is there any tutorial on paginating in codeigniter. Something that is simple and concise, i don't need complex ones since ill have hard time understanding the whole code.
A B C D
Ants
Airplane
Something like above, instead of number paging, would it be possible to paginate by first letters?
Ive encountered alot of sites that have these although im not sure if coding this would need any add-ons.
I think you have to build one. already this topic is disccused in CI forum.
Please check the forum link:
http://ellislab.com/forums/viewthread/164849/

How to create a spreadsheet with formulas using Rails?

I need some gem/plugin to create an Excel spreadsheet with formulas to use in my Rails application. Any suggestions?
I've used Roo and it's quite good and easy to do spreadsheet processing (once you get all the gem dependencies installed). However, it doesn't support formulas natively. It won't eval the formula and return the result (this would be difficult I think -- use the excel engine?) but it will give you the text of the formula, for example:
=SUM(.A1,.B1)
It'd be pretty easy to handle this specific case but if you have many different formulas and functions then rolling your own evaluator is going to be difficult. Going and getting A1 and B1 to add them together is very doable with Roo. It's just a question of how complex your formulas are.
writeexcel does it wonderfully!
I think you should create blank Excel file with formulas and then fill it with Rails. Because you can't create formulas with Ruby.
There's a spreadsheet gem listed on RubyGems but having never used it I can't recommend it.

Better ruby markdown interpreter?

I'm trying to find a markdown interpreter class/module that I can use in a rakefile.
So far I've found maruku, but I'm a bit wary of beta releases.
Has anyone had any issues with maruku? Or, do you know of a better alternative?
I use Maruku to process 100,000 - 200,000 documents per day. Mostly forum posts but I also use it on large documents like wiki pages. Maruku is much faster than BlueCloth and it doesn't choke on large documents. It's all Ruby and although the code isn't especially easy to extend and augment, it is doable. We have a few tweaks and extras in our dialect of Markdown.
If you want something that is pure Ruby, I definitely recommend Maruku.
For the fastest option out there, you probably want RDiscount. The guts are implemented in C.
See also: "Moving Past BlueCloth" on Ryan Tomayko's blog.
Ryan's post includes the following benchmark of 100 iterations of a markdown test:
BlueCloth: 13.029987s total time, 00.130300s average
Maruku: 08.424132s total time, 00.084241s average
RDiscount: 00.082019s total time, 00.000820s average
Update August 2009
BlueCloth2 was released (http://www.deveiate.org/projects/BlueCloth)
It's speed is on par with RDiscount because it is based on RDiscount - it is not pure Ruby.
(Thanks Jim)
Update November 2009
Kramdown 1.0 was just released. I haven't tried it yet, but it is a pure-Ruby Markdown parser that claims to be 5x faster than Maruku.
Update April 2011
Maruku hasn't seen a commit since June 2010. You may want to look into Kramdown instead.
A new fast option that is not pure Ruby: GitHub has released Redcarpet, which is based on libupskirt: https://github.com/blog/832-rolling-out-the-redcarpet
Update August 2013
Kramdown is still a very healthy project (based on recent commits, outstanding issues, pull requests) and a great choice for a pure Ruby Markdown engine https://github.com/gettalong/kramdown
Redcarpet is probably still the most commonly used and actively maintained option for people that don't need or want pure Ruby.
The listing at http://ruby-toolbox.com/categories/markup_processors.html would be a good place to start looking.
RDiscount is Fast and simple to use.
Try RDiscount. BlueCloth is slow and buggy.
The benchmark in the answer given by casey use BlueCloth 1. BlueCloth 2 is the fastest these days : http://www.deveiate.org/projects/BlueCloth
I believe BlueCloth is the most prominent one.
Looks like a lot of these answers are outdated.
Best thing I've found out there as of now (summer 2013) is the Redcarpet gem: https://github.com/vmg/redcarpet
To ensure you're getting BlueCloth 2, install like this:
gem install bluecloth
Note that "bluecloth" should be in all lowercase, not camel case.
Source: http://rubygems.org/gems/bluecloth
If you need a fair example for how to use something like Kramdown in a rakefile there is a repo on github with code and articles in markdown.md that can be converted to html with Ruby code syntax highlighting but alas line numbers as well.(I would prefer to turn off line numbering)
If anyone knows how to shut off the line numbering default please tell us.
Anyway the link is https://github.com/elm-city-craftworks/practicing-ruby-manuscripts

Resources