stackoverflow.com Archives - 31 August 2014, Sunday

  • artificial intelligence - Natural Language Processing in

    stackoverflow.com 11 Aug '14, 5pm

    You need to be much more specific about what these "general characteristics" are. In NLP "general characteristics" of a sentence can mean a million different things - sentiment analysis (ie, the attitude of the speaker), basic part of speech tagging, use of personal pronoun, does the ...

  • on rails find_or_initialize

    stackoverflow.com 01 Aug '14, 1pm

    Is there any better way to achieve this in Ruby on Rails? I'm searching for 11 fields and all are required also, and if not found initialize it. There will be more required fields adding to it. This query works perfect for me, but it just doesn't look like the best way to do this. fin...

  • php - Ruby On Rails Service Container

    stackoverflow.com 25 Jul '14, 12am

    I think it's important to not mix up Ruby (the language) and Ruby on Rails (the framework) - I'm not saying that you're doing this, just bear with me. Ruby has some 'best practices' in terms of how your code is laid out and solutions to common problems, but you're free to use any desi...

  • Bootstrap css customizations and javascript not loading (Ruby 1.9.3p547, Rails 4.1.4)

    stackoverflow.com 19 Jul '14, 2am

    source 'https://rubygems.org' ruby '2.0.0' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.0.2' # Use SCSS for stylesheets gem 'sass-rails', '~> 4.0.0' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # Use CoffeeScript for ...

  • javascript - ruby on rails showing landing page differently from localhost and html file

    stackoverflow.com 24 Jun '14, 3am

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="author" content=""> <title>Grayscale - Free One Page Theme for Bootstrap 3</title> <!-- Bootstrap Core...

  • on rails - Redis::InheritedError when calling Sidekiq worker

    stackoverflow.com 23 Jun '14, 4pm

    Whenever I call a Sidekiq worker I'm getting the following error: Redis::InheritedError (Tried to use a connection from a child process without reconnecting. You need to reconnect to Redis after forking.) I'm hosting on Heroku and using Redis Cloud which I'm connecting to with connect...

  • ios - How to vibrate iPhone on music beats?

    stackoverflow.com 21 Jun '14, 11am

    i want an iPhone app that will listen to salsa music and vibrate to the beat (on 1). The salsa beat consists of 8 counts: 1,2,3 pause, 5, 6, 7 pause.... We want the iPhone to vibrate on the 1 of every beat. The iPhone should listen to the music, analyse it and identify the "1" on its ...

  • Designing Web Sites with Ruby on

    stackoverflow.com 19 Jun '14, 6pm

    I'm just learning Ruby on Rails. I've read a few books, I've watched lots of Railscasts, I've looked at some examples. However, when working on my first serious project with Rails, I've gotten hung up on how to properly implement some very basic web site features that most tutorials I...

  • on rails - ActiveRecord serialize using JSON instead of YAML

    stackoverflow.com 25 Aug '13, 8am

    I wrote my own YAML coder, that takes a default. Here is the class: class JSONColumn def initialize(default={}) @default = default end # this might be the database default and we should plan for empty strings or nils def load(s) s.present? ? JSON.load(s) : @default.clone end # this sh...

  • on Rails Best pratices - Big Controller vs Small Controller

    stackoverflow.com 04 Aug '13, 8pm

    I need some informations for the best pratices in Ruby on Rails, especially with Controler who have to do a lot of things , so, a simple "show" action is now up to lines. I know, it's not really good, and i have specific code in it. Here is a sample code : def show sound = Sound.find(...

  • on rails - Custom authentication strategy for devise

    stackoverflow.com 16 May '13, 4am

    I found this very helpful snippet in this thread on the devise google group initializers/some_initializer.rb: Warden::Strategies.add(:custom_strategy_name) do def valid? # code here to check whether to try and authenticate using this strategy; return true/false end def authenticate! #...

  • transactions - PHP / MySQL - how to prevent two requests *Update

    stackoverflow.com 12 Apr '13, 6pm

    I have some question ... example: a user will buy something for his USD Check his USD Balance Deduct the USD from his account Make an Order -> order queue user becomes his item and the other one becomes his USD Lets say, the users makes 5 requests in the same second (very fast). So it...

  • How do I use Twitter Bootstrap with Ruby on Rails 3.2.12?

    stackoverflow.com 11 Mar '13, 5am

    I'm switching from PHP to Ruby on Rails and I'm loving it, the only thing is I'm so used to Twitter Bootstrap for most of my designs and now I feel crippled without it, I followed some tutorials like adding bootstrap-sass and what not to my Gemfile , but I still appear to be missing i...

  • Using existing SQL Server database with Ruby on

    stackoverflow.com 07 Mar '13, 4am

    You're in luck, friend. My first Rails project (7 years ago) was against a horribly set up SQL Server database. Per the above, you need to set up your database.yml appropriately. But for an existing database, obviously it is unlikely that the table and column names conform to the Rail...

  • Error with new Rails 3.2.8 project - `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)

    stackoverflow.com 04 Mar '13, 4pm

    I've just created a new amazon Linux instance and installed ruby 1.9.3 and rails 3.2.8. Upon creating a new project I immediately receive failures due to sqlite3. The error is: [root@xxxxx fun]# rails server /usr/local/share/gems/gems/sqlite3-1.3.6/lib/sqlite3.rb:6:in `require': canno...

  • on rails - RVM Bundle Install Missing Gem Error

    stackoverflow.com 23 Feb '13, 6am

    I'm kind of stuck with this problem. I am currently trying to host a Rails3/Ruby1.9.3 App on a shared host(Site5). They only provide 1.8.7 for Ruby. So, I tried installing RVM so I can make use of Ruby 1.9.3. After installing RVM successfully, running 'bundle install', I encountered t...

  • on rails - How to have blank lines in a .text.haml document

    stackoverflow.com 11 Feb '13, 12pm

    I'm creating an e-mail notification in a .text.haml document. How does one denote a blank line? = @variable.name + " , you have a new update." = = = "There has been new activity." In the above example I would like the two lines that have just the haml '=' on them to be blank lines but...

  • open source - Ruby on Rails monitoring tools on own servers

    stackoverflow.com 10 Feb '13, 7am

    We're already using the NewRelic service to monitor RoR applications. We have some customers whose security policies will not allow us to use external services to monitor their internal applications. Could anybody recommend some open-source (non commercial) monitoring tools which coul...

  • on rails events and decoupling

    stackoverflow.com 19 Jan '13, 6am

    I'm new to Rails and have been trying to figure out how to structure my applications. Coming from a Symfony2 background I am used to an event driven approach. Events allow for strong decoupling of components. Does Rails have framework events/hooks? What is the Rails approach to decoup...

  • bash - How to stop Ruby WEBrick app from Terminal in Xubuntu

    stackoverflow.com 05 Jan '13, 12pm

    I started learn Ruby. I tried to work with WEBrick server. After ruby index.rb command server starts. And how to stop it? I tried Ctrl+c, Ctrl+X and other. It still working. Then I pushed Ctrl+Z. Bash said: [1]+ Stopped ruby index.rb. But process is still working, and using my port, t...

  • mysql - SQL Query Ruby On

    stackoverflow.com 01 Jan '13, 6pm

    Hi I have two models team and fixture, the fixture model has two columns home_team_id and away_team which contain the foreign key of team primary key. I am trying to do a select query where I can get the team name through using the home_team_id and away_team_id in the fixture table. c...

  • on Rails 3: Sign-In With devise and cancan

    stackoverflow.com 01 Jan '13, 1pm

    rspec test fail - user sign out - Ruby on Rails 3 Tutorial book Chap 9 Ruby on rails mysql problem CanCan, Devise, Rails and Backbone.js, issue with :update CanCan + Devise for the devise user model How to add authentication before filter to a rails 3 apps with devise for user sign up...

  • on rails - get jquery to submit one of two forms

    stackoverflow.com 31 Dec '12, 5pm

    i am trying to get jquery to submit one of two forms when a submit_tag is clicked. I am basing my conditions on the presence of text. so whichever form has text in then submit that one. My forms looks like this <div class="container margin50"> <div class="row"> <div class="span6 offse...

  • on rails - Use jquery to check which form is completed and then submit using one button

    stackoverflow.com 31 Dec '12, 1pm

    I have two forms that make a separate requests to different apis. What i am trying to achieve is to maybe have jquery check which form has been completed and then submit the relevant form. Each request goes through its specific controller. the forms are like this <div class="container...

  • on rails 3 - timesheet in rails3

    stackoverflow.com 28 Dec '12, 12pm

    <tr id="row<%= index %>" valign="top" class ='time_stamp'> <%= hidden_field_tag "timesheet[timesheet_line_items_attributes][#{index}][id]",timesheet_line_item.id%> <%= hidden_field_tag "timesheet[timesheet_line_items_attributes][#{index}][_destroy]"%> <td valign="top" style='padding-l...

  • Create a has_many association where a condition applies to the primary table in ruby on

    stackoverflow.com 26 Dec '12, 5pm

    Soliciting Rails Association Feedback + Questions from a Noob How can I create, associate, and de-associate related records in Rails ActiveRecord with accepts_nested_attributes_for Rails: How do I define an association extension in a module that gets included in my AR model? How do yo...

  • Applicability of ruby on rails for a video heavy application?

    stackoverflow.com 26 Dec '12, 1pm

    I intend to develop a web application that will have most of the features like facebook and youtube have, for instance - a user can share videos with their friends, people can comment on the videos and upvote or downvote each others comments, form groups etc. etc. I would like to know...

  • Adding html tag in ruby on rails controller

    stackoverflow.com 26 Dec '12, 10am

    How do I add html tag in ruby on rails controller? I want to add this statement include a_tag in ruby on rails controller. "Go straight to <a href='http://www.sportskaki.com'>www.sportskaki.com</a> to reply. game_message.message = " Would you like to play " + @game.sport.sport_name.to...

  • on rails - How to "soft delete" user with Devise

    stackoverflow.com 26 Dec '12, 2am

    I could advise overriding destroy method on your User model to simply do update_attribute(:deleted_at, Time.current) (instead of actually destroying), but this deviation from standard API could become burdensome in the future, so here's how to modify the controller. Devise has a bunch...

  • on Rails Console with Associations

    stackoverflow.com 26 Dec '12, 12am

    Rails ActiveRecord associations inconsistently updated has_many, belongs_to association where has_many associated model has two alias fk in belongs_to associated_model Rails Associations (belongs_to, has_many) can't save 2 ids in table with a create method (user, post, comment) How to...