Search Results

Search found 10455 results on 419 pages for 'ruby on rails 3 1'.

Page 81/419 | < Previous Page | 77 78 79 80 81 82 83 84 85 86 87 88  | Next Page >

  • more ruby way of doing project euler #2

    - by aharon
    I'm trying to learn Ruby, and am going through some of the Project Euler problems. I solved two as such: def fib(n) return n if n < 2 vals = [0, 1] n.times do vals.push(vals[-1]+vals[-2]) end return vals.last end i = 1 s = 0 while((v = fib(i)) < 4_000_000) s+=v if v%2==0 i+=1 end puts s While that works, it seems not very ruby-ish—I couldn't come up with any good purely Ruby answer like I could with the first one ( puts ( (0..999).inject{ |sum, n| n%3==0||n%5==0 ? sum : sum+n } )).

    Read the article

  • Can't type after "ruby script/server" in InstantRails

    - by mathee
    I'm a newb to RoR. I'm using the book "Agile Web Development with Rails" to get started on Windows 7. In the command window, I run the following. >rails demo >cd demo >ruby script/server At this point, it boots the Mongrel server: => Booting Mongrel => Rails 2.3.5 application starting on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server The book goes on to tell me to run ruby script/generate controller Say but, I cannot Ctrl-C -- or type anything for that matter -- after booting the Mongrel server. Am I supposed to create the new controller in another instance of the InstantRails command window? Right now, the only way I can stop the server is closing the window in which I started the server! Please let me know if you need any other details. tia.

    Read the article

  • OCIError (ruby on rails)

    - by swingfuture
    I am using rails freeze 1.2.3 to run a rails app. Because the app is on a remote machine, I used ssh tunnel (ssh -l -L) to show the app on my screen. When I ran it, it correctly prompted the login page, after I put in the info, I got this error: OCIError in ServiceController Error while trying to retrieve text for error ORA-12154 I have tried the same app on a different machine w/o using freeze (because that machine has rails version 1.2.3 while current one has 2.0.2). Is that where the error comes from? Thanks.

    Read the article

  • The State of RDF in Ruby

    - by Daniel
    I'm wondering about the current support there is in Ruby for semantic web technologies. Is there good RDF options? It seems that the last surveys done were circa 2007 ( http://paul-classic.stadig.name/2007/10/26/the-state-of-rdf-support-in-ruby-2007/ ). Is Redland's RDF wrappers the best way to go for RDF support - all the other projects mentioned in that aging article seem to be unsupported or dropped. Is Ruby perhaps a bad choice if one which to pursue projects pertaining to the semantic web?

    Read the article

  • Querying Active Directory in ruby app on Windows box

    - by Ben
    I have a small ruby app in which I'm trying to query some information from Active Directory. The app will be run by a Windows user who is already logged in. It looks like the ruby-net-ldap gem wants me to connect to an LDAP server using an IP address, port and then pass my username and password. Is there a way to achieve this (with a different gem, say) so that I don't have to pass this information (I don't have the current user's password for example, so that's not going to work)? I'm also hosting a Trac website on our intranet (which is written in Python if I remember correctly and that seems to know the current Windows username and domain. If it can do it, surely my little ruby app can access this information too?

    Read the article

  • Reference book on Ruby on Rails social network site for novices

    - by Christopher
    Hey, so I am a novice programmer who has only worked with HTML, CSS, and a touch of Java a couple of years ago. I am looking to try to get a social network site up and running on Ruby on Rails and was looking at RailsSpace: Building a Social Networking Website with Ruby on Rails (Addison-Wesley Professional Ruby Series) - Paperback (July 30, 2007) by Michael Hartl. This was published in 2007, however, and the newer reviews say it is not very helpful. Does anyone know if there are any new publications out there that walk you through building a social network site while teaching you the code(rather than just using a out of the box program)? Thanks

    Read the article

  • Storing cvs data for further manipulation using Ruby

    - by ischnura
    I am dealing with a csv file that has some customer information (email, name, address, amount, [shopping_list: item 1, item 2]). I would like work with the data and produce some labels for printing... as well as to gather some extra information (total amounts, total items 1...) My main concern is to find the appropriate structure to store the data in ruby for future manipulation. For now I have thought about the following possibilities: multidimensional arrays: pretty simple to build, but pretty hard to access the data in a beautiful ruby way. hashes: having the email as key, and storing the information in different hashes (one hash for name, another hash for address, another hash for shopping list...) (getting the cvs data in to a Database and working with the data from ruby??) I would really appreciate your advice and guidance!!

    Read the article

  • Running a Ruby interpreter on iPad

    - by slothbear
    I'll be taking a trip soon with my iPad, without my laptop. I'd like to continue to tinker with Ruby while I'm on the road. I have an iPhone developer program membership, and I'm not interested in submitting this stuff to the app store. I found the shinycocos project, which appears to embed a Ruby interpreter in an app. But I can't get it to run, and it seems pretty customized for running cocos2d stuff. My first goal is to run an interactive command line like Try Ruby!. After that, I'd like to enter small programs in a UITextView and run them. I'd appreciate any clues, tips, or existing projects you might know of.

    Read the article

  • Creating Ruby applications for Windows.

    - by Omega
    I want to develop a Windows application. Honestly I care little about cross-platforms for now (but still would be good) I want to use Ruby, since it has quite a simple syntax and is so.. well, simple and easy to learn. My application is like a "game level creator", where you can design your own level and then run it with another application which is a "game level player" by reading the project file created by the creator app. You get the idea. Now, I got a new PC and is completely clean. Absolutely no trace of my old Ruby experiments and fails. First of all, I will need to choose a GUI platform for my Ruby application! Can you recommend me one? I have heard of Shoes and Tk, but want to know what you think.

    Read the article

  • Having difficulty catching postgresql exception in sequel/ruby

    - by mhd
    I have postgresql table that has somekind of unique constraint. I have ruby script that will update this table. The ruby script should be able to switch to UPDATE instead of INSERT when this kind of error occured: PGError: ERROR: duplicate key value violates unique constraint CMIIW, sequel seems cannot catch this exception?? Anyway,sample code below is something that I would like to see to work but apparently not: @myarray.each do |x| fresh_ds = DB["INSERT INTO mytable (id, col_foo) values ('#{x}' ,'#{myhash[x]}')"] result = fresh_ds.insert catch Sequel::Error do fresh_ds = DB["UPDATE mytable set col_foo = '#{myhash[x]} where id = #{x}"] result = fresh_ds.update end end Maybe my ruby code is wrong or I missed something I don't know. Any solution? Thanks. UPDATE: code below works, the error is caught when unique constraint is violated. @myarray.each do |x| begin # INSERT CODE rescue Sequel::Error # UPDATE CODE end end

    Read the article

  • best IDE for ruby on rails

    - by Sanjay
    Having moved from java to ruby, I am struggling to find a good IDE for ruby. I used eclipse on java, so I tried Aptana Studio (previously Radrails), but its not even half as good. Currently I am trying out Netbeans for Ruby. Please suggest me the best RoR IDE out there. I believe TextMate is universally accepted as the best editor on Mac OS X. I am looking for windows. So far it seems netbeans and e-texteditor are worth a try.

    Read the article

  • c struct map to ruby using SWIG

    - by pierr
    Hi, Is there any body can confirm the description here is true? My experience is that I can not use Example::Vector.new at all. C/C++ structs are wrapped as Ruby classes, with accessor methods (i.e. "getters" and "setters") for all of the struct members. For example, this struct declaration: struct Vector { double x, y; }; gets wrapped as a Vector class, with Ruby instance methods x, x=, y and y=. These methods can be used to access structure data from Ruby as follows: $ irb irb(main):001:0> require 'Example' true irb(main):002:0> f = Example::Vector.new #<Example::Vector:0x4020b268> irb(main):003:0> f.x = 10 nil irb(main):004:0> f.x 10.0

    Read the article

  • What does :this means in Ruby on Rails?

    - by Marco
    Hi, I'm new to the Ruby and Ruby on Rails world. I've read some guides, but i've some trouble with the following syntax. I think that the usage of :condition syntax is used in Ruby to define a class attribute with some kind of accessor, like: class Sample attr_accessor :condition end that implicitly declares the getter and setter for the "condition" property. While i was looking at some Rails sample code, i found the following examples that i don't fully understand. For example: @post = Post.find(params[:id]) Why it's accessing the id attribute with this syntax, instead of: @post = Post.find(params[id]) Or, for example: @posts = Post.find(:all) Is :all a constant here? If not, what does this code really means? If yes, why the following is not used: @posts = Post.find(ALL) Thanks

    Read the article

  • make Ruby script run once a second

    - by Matt Hintzke
    I have a ruby script that needs to run about 1 time a second. What I am doing is using a ruby script to keep track of modifications of files in a directory. I want the script to run once a second so that the modifications are updated in "live" time. Basically, I want my script to do the same kind of thing as running "top" on a unix shell. Where the screen is updated every second or so. Is there an equivalent to setInterval in ruby like there is in javascript? Thanks

    Read the article

  • Creating DB views in Ruby on Rails

    - by Zigu
    Hey guys, I'm building a "reports" functionality to a project. 3 roles here: 1) Volunteers (they report what hours they volunteered) 2) Supervisors (they look at the reported stuff, note: one supervisor can view all projects) 3) Projects (Represents a work project that some collection of volunteers work on) To explain what it does: A report will be specified by the supervisor to generate based on a query of what he needs. These could be plausible reports: 1) The total number of volunteers, and the total amount of volunteer hours on this project 2) All the volunteer's names and emails associated with a project 3) The number of active projects vs. the total number of projects I was thinking maybe that creating a view in rails and storing the name of that view so Rails will just check the view whenever a supervisor wants to pull up the "report". Is a view really the answer or is it better to just save a query? Can Rails do this or is there an even better or more simple way of achieving this functionality? Cheers, -Jeremiah Tantongco

    Read the article

  • Non-trivial desktop apps that use Ruby?

    - by Mark A. Nicolosi
    I'm about to start a project developing a Ruby desktop application. I expect to to be fairly big and I want to learn techniques for dividing code among modules and other techniques for managing complexity. Most large apps I've looked at are Rails apps, but these aren't very helpful, because most of the work is done by Rails itself. What source code would you recommend I take a look at? I'm not interested in libraries or Rails apps, because I get how they do things. CLI apps are OK, but I'm mostly interested in GUI apps (I'm using Gtk+, but I can learn just as much from apps using other GUI toolkits).

    Read the article

  • Declaring an integer Range with step != 1 in Ruby

    - by Dan Tao
    Hey guys, I'm completely new to Ruby, so be gentle. Say I want to iterate over the range of even numbers from 2 to 100; how would I do that? Obviously I could do: (2..100).each do |x| if x % 2 == 0 # my code end end But, obviously (again), that would be pretty stupid. I know I could do something like: i = 2 while i <= 100 # my code i += 2 end I believe I could also write my own custom class that provides its own each method (?). I am almost sure that would be overkill, though. I'm interested in two things: Is it possible to do this with some variation of the standard Range syntax (i.e., (x..y).each)? Either way, what would be the most idiomatic "Ruby way" of accomplishing this (using a Range or otherwise)? Like I said, I'm new to the language; so any guidance you can offer on how to do things in a more typical Ruby style would be much appreciated.

    Read the article

  • Ruby On Rails CMS Framework

    - by stel
    Hi! I want to create a framework fo rails application. It will be a rails application but packed into gem (like a Radiant CMS). It must work like this: gem install cmsframework and then: cmsframework the_app After that we have a sceleton of rails app without any controllers etc.. - all controllers loaded from cmsframework gem. If I want to rewrite some files (for example public/styles.css) I must simply create it in my app (the_app). If I want new functions in my app I can create a plugin. But the main functionalities must be loaded from cmsframework gem. What is the best way to implement this?

    Read the article

  • Double "!!" in Ruby [closed]

    - by Alex Maslakov
    Possible Duplicate: What does !! mean in ruby? Ruby, !! operator (a/k/a the double-bang) Sometimes I see a Ruby code like this def sent? !!@sent_at end It seems to be not logical. Is it necessary to use here double !? As far as I'm concerned, it might be just def sent? @sent_at end UPDATE: then what is the difference between these def sent? !!@sent_at end def sent? @sent_at.nil? end def sent? @sent_at == nil end

    Read the article

  • Mainstream Linux on 1GB HDD

    - by Ariel Nundi
    Hi, I've decided to start learning Linux + Ryby + RoR. The problem is the only personal computer I have is a laptop with 1GB flash card and I can't afford to buy more hardware right now. The laptop has dual core CPU and 2GB of RAM. Can you recommend a Linux distribution I can install? I've tried the netbook version of Ubuntu, but install failed because of lack of space. I'd prefer a more popular distribution, so I can use my skills say on a job. TIA

    Read the article

  • What happens when Phusion PassengerMaxPoolSize is reached?

    - by bmurtagh
    The subject of my post pretty much sums up my question: What happens when PassengerMaxPoolSize is reached? For Example: PassengerMaxPoolSize is configured to 40 based off our system specs What happens if all 40 sessions are active (processing a request) and our load balancer passes another session to this particular web server? This would send a 41st session to be processed without an available Passenger process.

    Read the article

  • Is there a rails3-compatible emacs mode yet ?

    - by julien
    Rinari hasn't been updated in the last few months, and there doesn't seem to be such progress made in the branches on github. I've never tried emacs-rails, but from what I can see, the same applies. So, is there a rails mode somewhere that's compatible with v3 ?

    Read the article

  • Require a specific version of ActiveRecord

    - by magnushjelm
    I have both Rails 2.3.4 and Rails 3.0.0.beta installed on my local machine. I am using ActiveRecord in a stand alone ruby script and when I do require 'active_record' 3.0.0.beta is loaded. How can I force it to require 2.3.4 instead? (without uninstalling 3.0.0.beta)

    Read the article

  • installing by_star gem?

    - by keruilin
    Can someone shed light on how to setup by_star gem: https://rubygems.org/gems/by_star? I ran ruby script/plugin install git://github.com/radar/by_star.git. However, when I went to call a by_star method in one of my models from console, I got an undefined method error. Do I need include or require statement? Could I be missing dependent gems? Ruby version issue?

    Read the article

< Previous Page | 77 78 79 80 81 82 83 84 85 86 87 88  | Next Page >