Ruby Parser
I want to know whether it is possible to parse ruby language using just deterministic parser having no backtracking at all ?? ...
I want to know whether it is possible to parse ruby language using just deterministic parser having no backtracking at all ?? ...
I have a class Foo which has several methods like button_0_0, button_0_1, button_0_2, button_1_0, etc. I would like to be able to access these alternatively via the following syntax: foo.button[0][1] foo.button[1][2] # etc. I know I could just create a @button instance variable and iterate through all the button_* accessors and add t...
Does anyone know how to get auto-complete working in Notepad++ using the .API files provided on the N++ site? Autocomplete works fine for me in languages which have an XML autocomplete file in the APIs folder, but completely non-functional for languages that use a .API file (ruby, AutoIt, others). From what I've been able to find online...
In other languages you have a number of possibilities usually for memory reclamation: Mark objects and then remove them Explicit retain and release Count references to objects Internal heap disposition How does Ruby work? ...
Hello all, I'd like to save some hash objects to a collection (in Java world think of List). I've search online to see if there is a similar data structure in ruby and have found none. For the moment being I've been trying to save hash a[] into hash b[], but have been having issues trying to get data out of hash b[]. Are there any buil...
redirect_to :controller=>'groups',:action=>'invite' but I got error because redirect_to send GET method I want to change this method to 'POST' there is no :method option in redirect_to what will I do ? Can I do this without redirect_to. Edit: I have this in groups/invite.html.erb <%= link_to "Send invite", group_members_path(:gr...
If I want to build a DSL in Ruby 1.9 or JRuby, will I need to do any of these stages by hand: Lexing Interpretation Parsing Just-in-time compilation Obviously, being a programmer, I don't like to write actual code as much as I can get away with, so I'm hoping none of these steps require manual labor :) ...
Currently I am using this to strip out whitespaces. class Newsletter < ActiveRecord::Base before_validation :clean_up_whitespace end def clean_up_whitespace fields_to_strip = ['title','notes'] fields_to_strip.each { |f| unless self.attributes[f].nil? self.attributes[f].strip! end } end I want to do something simi...
In the edit method of my controller I get an :model object, e.g. params[:model]. :model contains, name = "bill", address = "sfas", etc. I just want to add to the :model, e.g. :model add {key, value}. Sure it's dead simple but not sure what the syntax is. ...
In a few of my controllers I have a before_filter that checks if a user is logged in? for CRUD actions. application.rb def logged_in? unless current_user redirect_to root_path end end private def current_user_session return @current_user_session if defined?(@current_user_session) @current_user_session = U...
I'm interested in learning more about how ActiveRecord was designed and why particular decisions were made along the way that led to the implementation that we have now. Could anyone provide some examples of good or bad design decisions that were made in ActiveRecord's implementation? ...
I'm looking to do some sentence analysis (mostly for twitter apps) and infer some general characteristics. Are there any good natural language processing libraries for this sort of thing in Ruby? Similar to http://stackoverflow.com/questions/870460/java-is-there-a-good-natural-language-processing-library but for Ruby. I'd prefer somethi...
I'm trying to understand the practical impact of different threading models between MRI Ruby 1.8 and JRuby. What does this difference mean to me as a developer? And also, are there any practical examples of code in MRI Ruby 1.8 that will have worse performance characteristics on JRuby due to different threading models? ...
Hi All, Could someone please explain to me why I'm getting an ActionView::TemplateError when I try to use AJAX to update the interface while using the following code: CODE I have the following structure: Site -> Building -> Control. Each loops through it's collection of items and renders a partial for each. From Site to Building wo...
Me and my team are starting to build up a few re-usable scripts. They're re-usable within our org only as they work with proprietry apps and our particular server environment. So not really suitable for rubyforge or github, etc. My question is, what is the best practice for ensuring we're all using the latest and greatest scripts acro...
Does someone know a good web service to resize images ? Either an open source (PHP/Python/Ruby) application, or a company providing a web service api. ...
Browsing the web says that Rails is not compatible with Ruby 1.9 but I would like to know if it's always the case? And how long should we wait to see a Rails version working with Ruby 1.9? Is it work in progress? In dev stage? ...
This is what I have now - which looks too verbose for the work it is doing. @title = tokens[Title].strip! || tokens[Title] if !tokens[Title].nil? Assume tokens is a array obtained by splitting a CSV line. now the functions like strip! chomp! et. all return nil if the string was not modified "abc".strip! # => nil " abc ".str...
Hello, what do you recommend? Authlogic or restful_authentication? Is it hard, to build the email-activation-step into authlogic (as far as I know, Authlogic hasn't this feature included). ...
I've got a few ruby gems that won't go away. I think it has to do with when I installed them. Occasionally I have forgotten to use "sudo" before doing a gem install, which results in a write error and from what I can gather puts a copy of the gem in my user directory instead of somewhere it can run. But gem uninstall doesn't work. ...