Search Results

Search found 4 results on 1 pages for 'engwan'.

Page 1/1 | 1 

  • ruby on rails named scope implementation

    - by Engwan
    From the book Agile Web Development With Rails class Order < ActiveRecord::Base named_scope :last_n_days, lambda { |days| {:conditions => ['updated < ?' , days] } } named_scope :checks, :conditions => {:pay_type => :check} end The statement orders = Orders.checks.last_n_days(7) will result to only one query to the database. How does rails implement this? I'm new to Ruby and I'm wondering if there's a special construct that allows this to happen. To be able to chain methods like that, the functions generated by named_scope must be returning themselves or an object than can be scoped further. But how does Ruby know that it is the last function call and that it should query the database now? I ask this because the statement above actually queries the database and not just returns an SQL statement that results from chaining.

    Read the article

  • Javascript regex hangs (using v8)

    - by Engwan
    Im using this regex to get the contents of a tag in a file. var regex = new RegExp("<tag:main>((?:.|\\s)*)</tag:main>"); This causes the v8 engine to hang indefinitely. Now, if I use new RegExp("<tag:main>([\s\S]*)</tag:main>"), all is good. Anyone have an idea why the first one takes too long?

    Read the article

  • Safari Javascript parent.frames.length

    - by Engwan
    I get a parse error from Safari with this code: for (var i=0; i<parent.frames.length; i++){...} doing alert(parent.frames.length); works and outputs the correct value which is 5. I also tried but failed: var len = parent.frames.length alert(len); //Correct for (var i=0; i<len; i++){...} //Parse Error When i type this code into the console directly, it works fine. And it also works fine in other browsers. What seems to be the problem?

    Read the article

  • Problem running latex from FastCGI

    - by Engwan
    I have a program which does a system call: latex somefile.latex This runs ok, when I type it directly in the command line, or when i invoke the program via CGI. But when it is using FastCGI, the system call returns: This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009) ---! Must increase the hyph_size (Fatal format file error; I'm stymied) I already tried to increase the hyph_size but still no effect.

    Read the article

1