Search Results

Search found 10241 results on 410 pages for 'sqlite3 ruby'.

Page 16/410 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • Fast ruby http library for large XML downloads

    - by Vlad Zloteanu
    I am consuming various XML-over-HTTP web services returning large XML files ( 2MB). What would be the fastest ruby http library to reduce the 'downloading' time? Required features: both GET and POST requests gzip/deflate downloads (Accept-Encoding: deflate, gzip) - very important I am thinking between: open-uri Net::HTTP curb but you can also come with other suggestions. P.S. To parse the response, I am using a pull parser from Nokogiri, so I don't need an integrated solution like rest-client or hpricot.

    Read the article

  • Ruby is already using the class name of my model

    - by Octopus Inc
    I'm making a forum application with various levels of authorization, one of which is a Monitor. I am doing this by extending my User class, and I plan on fine tuning this with "-ship" classes (e.g. administratorship, authorship, moderatorship, etc.). Apparently the Monitor class is part of ruby mixin. How do I keep my resource name without the collisions?

    Read the article

  • Ruby On Rails and UTF-8

    - by Semyon Perepelitsa
    I have an Rails application with SayController, hello action and view template say/hello.html.erb. When I add some cyrillic character like "?", I get an error: ArgumentError in SayController#hello invalid byte sequence in UTF-8 Headers: {"Cache-Control"=>"no-cache", "X-Runtime"=>"11", "Content-Type"=>"text/html; charset=utf-8"} I use Windows 7 x64, Ruby 1.9.1p378, Rails 2.3.5, WEBrick server.

    Read the article

  • Ruby - Read file in batches

    - by Algorist
    Hi, I am reading a file that is 10mb in size and which contains some id's. I read them into a list in ruby. I am concerned that it might cause memory issues in the future, when the number of id's in file might increase. Is there a effective way of reading a large file in batches? Thank you

    Read the article

  • Ruby BigDecimal sanity check (floating point newb)

    - by Andy
    Hello, Hoping to get some feedback from someone more experienced here. I haven't dealt with the dreaded floating-point calculation before... Is my understanding correct that with Ruby BigDecimal types (even with varying precision and scale lengths) should calculate accurately or should I anticipate floating point shenanigans? All my values within a Rails application are BigDecimal type and I'm seeing some errors (they do have different decimal lengths), hoping it's just my methods and not my object types... Thanks!

    Read the article

  • OpenID authentication in Ruby on Rails

    - by martinatime
    I am a neophyte with Ruby on Rails but I've created a couple of small apps. Anyway, I'm really interested in OpenID and I would like to implement OpenID authentication and maybe some Sreg stuff in a Rails app. All of the research that I have done has come up with articles that are out of date or just don't work for me. Since I'm so new to Rails I'm having difficulty debugging the issues so... What is the best way to implement OpenId in Rails? Thanks

    Read the article

  • Execute script with Ruby on Rails?

    - by yuval
    I want to start my daemon with my application. In the command line, I can write something like lib/daemons/mydaemon_ctl start to start up my daemon, but I have to do this manually. I want the daemon to start when I start my server (i.e. when the initializer files are loaded). Is there a ruby command for executing a command line? Something like exec "lib/daemons/mydaemon_ctl start"? Thanks!

    Read the article

  • Ruby Nokogiri uninitialized constant

    - by donald
    `<main>': uninitialized constant Object::Nakogiri (NameError) I get that message when trying to run a simple code (ruby test.rb): require 'rubygems' require 'nokogiri' require 'open-uri' url = "http://www.walmart.com/cp/Baby-Days/1035659?povid=cat14503-env172199-module122910-lLinksptBABY" doc = Nakogiri::HTML(open(url)) puts doc.at_css("title").text I have the gem installed: ~/Code $ gem list --local | grep nokogiri nokogiri (1.4.4, 1.4.3.1)

    Read the article

  • accessing Ruby variable(from model or controller) in SASS

    - by corroded
    Is there a way to access ruby variables in sass or do i have to make a custom function for it? What im trying to do is to generate a stylesheet for each user so in the controller, i do something like: def show respond_to do |format| format.css{render :partial => "styles"} end end then in the view name _styles.haml i do this: :sass #header :background url(user.banner.url) is this possible at all?

    Read the article

  • Stop duplicates from being added to an array of Ruby objects

    - by Dom
    how can I eliminate duplicate elements from an array of ruby objects using an attribute of the object to match identical objects. with an array of basic types I can use a set.. eg. array_list = [1, 3, 4 5, 6, 6] array_list.to_set => [1, 2, 3, 4, 5, 6] can I adapt this technique to work with object attributes? thanks

    Read the article

  • numerical computation locks up ruby

    - by kolosy
    i'm trying to implement an id obfuscation scheme, with a simple hash borrowed elsewhere. i've added a method on the application helper: @@M_ID = 2**31-1 @@PRIME = 1580030173 @@PRIME_INVERSE = 59260789 # (calculated from MAXID and PRIME offline) def obfuscate_id(x) if x return ((x * @@PRIME) & @@M_ID) else x end end for some reason, whenever this is called, ruby locks up, and starts eating up disk space on my mac... like - gigs of it. any ideas?

    Read the article

  • Login to a Remote Service (ruby based) from iPhone

    - by Chris Maness
    Ok here's my problem in a nutshell I've built a web service from ruby on rails. I'm using restful_authentication to create and run the login but I'm also building an iPhone application to access my web service but I can't quite figure it out. I was wondering if anyone could help me figure out a place to begin.

    Read the article

  • Support for IMAP IDLE in ruby

    - by Asaxena
    Ok, I have been suck on it for hours. I thought net/imap.rb with ruby 1.9 supported the idle command, but not yet. Can anyone help me in implementing that? From here, I though this would work: class Net::IMAP def idle cmd = "IDLE" synchronize do tag = generate_tag put_string(tag + " " + cmd) put_string(CRLF) end end def done cmd = "DONE" synchronize do put_string(cmd) put_string(CRLF) end end end But imap.idle with that just return nil.

    Read the article

  • Compare two times without regard to Date associated - Ruby

    - by H55nick
    I am trying to find the difference in time (without days/years/months) of two different days. Example: #ruby >1.9 time1 = Time.now - 1.day time2 = Time.now #code to make changes #test: time1 == time2 # TRUE My solution: time1 = time1.strftime("%h:%m").to_time time2 = time2.strftime("%h:%m").to_time #test time1 == time2 #True #passes I was wondering if there was a better way of doing this? Maybe we could keep the Date the same as time1/time2?

    Read the article

  • How do I print an array in Rails?

    - by Abid Hussain
    I am new to Rails and I am using Ruby version 1.9.3 and Rails version 3.0.0. I want to print an array in Rails. How do I do that? For example, we have to use print_r to print an array in PHP: <?php $a = array ('a' => 'apple', 'b' => 'banana', 'c' => array ('x', 'y', 'z')); print_r ($a); ?> Output: <pre> Array ( [a] => apple [b] => banana [c] => Array ( [0] => x [1] => y [2] => z ) ) </pre> How do I print an array in Rails?

    Read the article

  • Routing Users to single Models with Rails

    - by Eric Koslow
    I'm creating a Rails app for students and high schools and I'm having some trouble with my User.rb. I want to have a user model to be used for logging in, but having that user have many roles. The tricky part is that I want users that have a student role to have_one student page, and those that have a role of principal to have_one high_school page. The students and also nested in the high_school so the entire thing becomes a big mess. So my question(s): How do I limit a user to only creating one student / high school to represent them? Also how would I nest this student pages inside the highschool without screwing up the user system? My environment: Rails3 and Ruby 1.9.2dev Thank you!

    Read the article

  • Headless gem: webkit_server: cannot connect to X server

    - by 23tux
    I've got some problems running capybara-webkit with the Headless gem, Xvfb and our ci server. We use this setup for automatic integration testing and javascript testing of our Ruby on Rails 3.2 app. During the tests it complains that webkit_server: cannot connect to X server But when I ps aux | grep Xvfb deploy 1602 0.0 0.1 61696 1912 pts/2 S+ Jul10 0:00 /usr/bin/Xvfb :99 -screen 0 1280x1024x24 -ac I see the Xvfb running. If I run the tests with --trace it also only shows the error log above and I can't debug the error. Any ideas how I could get some more information, or even a solution?

    Read the article

  • Rails 3.0/3.2: Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id

    - by Nick5a1
    I'm following the Kevin Skoglund tutorial Ruby on Rails 3 Essential Training, which was written for rails 3.0, though I am currently using 3.2. It uses the following method in the pages_controller with a before_filter to display only the pages which belong to the parent subject. The tutorial explicitly uses .find_by_id because if the result is nil it "will not return an error". However I get the "Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id" error when trying to view a page where @subject has been set to nil. def find_subject if params[:subject_id] @subject = Subject.find_by_id(params[:subject_id]) end end The actual code that is causing the error is: def list @pages = Page.order("pages.position ASC").where(:subject_id => @subject.id) end Is this something that has changed since 3.0? If so, what would be the correct way to implement this functionality in 3.2?

    Read the article

  • Build custom error messages in model files (example: using the 'pluralize' method)

    - by user502052
    I am using Ruby on Rails 3.0.7 and I would like to use the pluralize method in a my model file in order to properly build custom error messages. For example, I would like to do something like the following: NAME_MIN_LENGHT = 2 # Is 2 but I plan to change that (maybe dynamically... if it is possible) in future development validates :name, :length => { :minimum => NAME_MIN_LENGHT, :too_short => "is too short (minimum is #{pluralize(NAME_MIN_LENGHT, "character")})", }, How can I do that? Is it advisable? Why?

    Read the article

  • Rendering another Action without changing URL?

    - by Michael Stum
    I have this code in my Rails 3 controller: def index now = Time.now.utc.strftime("%m%d") redirect_to :action => "show", :id => now end def show begin @date = Time.parse("12#{params[:id]}") dbdate = params[:id] rescue ArgumentError @date = Time.now.utc dbdate = @date.strftime("%m%d") end @date = @date.strftime("%B %d") @events = Event.events_for_date(dbdate) end So basically index is just a specialized version of show, hence I want it to execute show, render the show.html.erb view - but I do not want to change the URL like redirect_to does. I have tried this approach: def index now = Time.now.utc.strftime("%m%d") params[:id] = now show render :action => "show" end Now, this works, but it just smells badly. I'm new to Ruby and Rails, so I just wonder if there is something fundamentally wrong or if there is a better way to do this?

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >