Search Results

Search found 1064 results on 43 pages for 'eval'.

Page 4/43 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Executing a dynamically bound function in Clojure

    - by Carl Smotricz
    I'd like to pre-store a bunch of function calls in a data structure and later evaluate/execute them from within another function. This works as planned for functions defined at namespace level with defn (even though the function definition comes after my creation of the data structure) but will not work with functions defined by let [name (fn or letfn inside the function. Here's my small self-contained example: (def todoA '(funcA)) (def todoB '(funcB)) (def todoC '(funcC)) (def todoD '(funcD)) ; unused (defn funcA [] (println "hello funcA!")) (declare funcB funcC) (defn runit [] (let [funcB (fn [] (println "hello funcB"))] (letfn [(funcC [] (println "hello funcC!"))] (funcA) (eval todoA) ; OK (funcB) ; OK (eval todoB) ; "Unable to resolve symbol: funcB in this context" at line 2 (funcC) ; OK (eval todoC) ; "Unable to resolve symbol: funcC in this context" at line 3 ))) Is there a simple fix I could undertake to get eval'd quoted calls to functions to work for functions defined inside another function?

    Read the article

  • how to create local dynamic varables

    - by xielingyun
    this is my code, i want to use eval() to get the rule status and eval() nead local varables, there is many classes inherit class base, so i should to rewrite get_stat() in every class.i just want to avoid this, an idea is to create dynamic varables in get_stat(),eg. in class b it dynamic create var a and b how to create dynamic varables in function? or any other way to avoid this stupid idea i use python 3.2.3, locals() does not work class base(object): def check(self): stat = get_stat() def get_stat(self): pass class b(base): rule = 'a > 5 and b < 3' a = 0 b = 0 def update_data(self, a, b): self.a = a self.b = b def get_stat(self): a = self.a b = self.b return eval(rule) class b(base): rule = 'd > 5 and e < 3' d = 0 e = 0 def update_data(self, d, e): self.d = d self.e = e def get_stat(self): d = self.d e = self.e return eval(rule)

    Read the article

  • Formatting with echo command

    - by johannix
    The actual situation is a bit complicated, but the issue I'm running into is that I have an echo command within an eval command. Like so: $ eval echo 'keep my spacing' keep my spacing $ echo 'keep my spacing' keep my spacing I was wondering how I could keep eval from stripping my spacing so that the first command prints out the same message as the second...

    Read the article

  • CakePHP requestAction and eval code

    - by Naveed
    Hi, I am using cakephp for my site. I have stored multiple blocks in database and trying to access the code with following syntax. foreach($blocks as $block){ if($block['Block']['position'] == 'left'){ $str = $block['Block']['value']; eval("\"echo $str\";"); } } And i m getting this error; : Undefined property: View::$requestAction [APP\views\layouts\home.ctp(60) : eval()'d code Your Help will be highly appreciated. Thanks,

    Read the article

  • Confused by "let" in Clojure

    - by Tom Dalling
    I just started playing with Clojure, and I wrote a small script to help me understand some of the functions. It begins like this: (def *exprs-to-test* [ "(filter #(< % 3) '(1 2 3 4 3 2 1))" "(remove #(< % 3) '(1 2 3 4 3 2 1))" "(distinct '(1 2 3 4 3 2 1))" ]) Then it goes through *exprs-to-test*, evaluates them all, and prints the output like this: (doseq [exstr *exprs-to-test*] (do (println "===" (first (read-string exstr)) "=========================") (println "Code: " exstr) (println "Eval: " (eval (read-string exstr))) ) ) The above code is all working fine. However, (read-string exstr) is repeated so I tried to use let to eliminate the repetition like so: (doseq [exstr *exprs-to-test*] (let [ex (read-string exstr)] ( (do (println "===" (first ex) "=========================") (println "Code: " exstr) (println "Eval: " (eval ex)) ) )) ) But this works once for the first item in *exprs-to-test*, then crashes with a NullPointerException. Why is the addition of let causing the crash?

    Read the article

  • Set .aspx page title to that of an Eval

    - by user1860529
    I am trying to use an <%# Eval("name") %> to be the title of my page. I can't seem to figure out any solutions online. I have tried the other StackOverflow question but that did now work either. The page is a bio.aspx and on the site it is displayed as bio.aspx?id=123 so the page title needs to vary depending on the ID. I figured I could just use the Eval("name") but no luck yet. I currently am using JavaScript: window.onload = function() { document.title = '<%# Eval("name") %> | Title Line'; } This works, but it still leaves the title tags empty, and it's kind of spammy. Here is the codebehind: using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class DoctorBio : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Page.Title = "Your Page Title"; HtmlMeta metaDescription = new HtmlMeta(); metaDescription.Name = "description"; metaDescription.Content = "brief description"; Page.Header.Controls.Add(metaDescription); HtmlMeta metaKeywords = new HtmlMeta(); metaKeywords.Name = "keywords"; metaKeywords.Content = "keywords, keywords"; Page.Header.Controls.Add(metaKeywords); } protected void SetPageTitle(object title) { this.Title = title.ToString(); } protected string ReplaceLineBreaks(object text) { string newText = text as string; if (newText == null) { return string.Empty; } return newText.Replace("\r\n", "<br />"); } }

    Read the article

  • Add new types to Go

    - by nevalu
    I'm trying add new types for that been managed/used as in Go core types. To create new types is anything very interesting to validate data before of send it to a non-SQL DBMS or to check data from a form. Go uses univeral constants to define them at global level: var DateType = universe.DefineType("date", universePos, &dateType{}) In this case they're defined to be called from a package like types: var Date = &dateType{} I get these errors: test.go:58: o.lit undefined (cannot refer to unexported field lit) test.go:62: *dateType is not Type missing Pos() token.Position The code is based on: http://github.com/tav/go/blob/master/src/pkg/exp/eval/value.go http://github.com/tav/go/blob/master/src/pkg/exp/eval/type.go package main import ( "exp/eval" "fmt" // "go/token" ) // http://github.com/tav/go/blob/master/src/pkg/exp/eval/value.go type DateValue interface { eval.Value Get(*eval.Thread) string Set(*eval.Thread, string) } /* Date */ type dateV string func (v *dateV) String() string { return fmt.Sprint(*v) } func (v *dateV) Assign(t *eval.Thread, o eval.Value) { *v = dateV(o.(DateValue).Get(t)) } func (v *dateV) Get(*eval.Thread) string { return string(*v) } func (v *dateV) Set(t *eval.Thread, x string) { *v = dateV(x) } // http://github.com/tav/go/blob/master/src/pkg/exp/eval/type.go type Type interface { eval.Type // isDate returns true if this is a date type. isDate() bool } /* Common type */ type commonType struct{} // added func (commonType) isDate() bool { return false } /* Date */ type dateType struct { commonType } // * It should not be an universal constant //var universePos = token.Position{"<universe>", 0, 0, 0} // added //var DateType = universe.DefineType("date", universePos, &dateType{}) var Date = &dateType{} func (t *dateType) compat(o Type, conv bool) bool { t2, ok := o.lit().(*dateType) return ok && t == t2 } func (t *dateType) lit() Type { return t } func (t *dateType) isDate() bool { return true } func (t *dateType) String() string { return "<date>" } func (t *dateType) Zero() eval.Value { res := dateV("") return &res } /* Named types */ /* type NamedType struct { eval.NamedType Def Type }*/ type NamedType struct { // added // token.Position Name string // Underlying type. If incomplete is true, this will be nil. // If incomplete is false and this is still nil, then this is // a placeholder type representing an error. Def Type // True while this type is being defined. incomplete bool methods map[string]eval.Method } func (t *NamedType) isDate() bool { return t.Def.isDate() } /* *********************** */ func main() { print("foo") }

    Read the article

  • Trouble using eval() with cython

    - by Peter Stewart
    I was trying to speed up some code, and then I tried compiling a class and a function using cython and WOW! I havn't measured it yet but it looks at least 10x faster. I first looked at cython just two days ago, I'm very impressed! However, I can't get eval() to work. def thefirst(int a): d = eval('1+2+a') return d I compile this to module1.pyd file and call it with the python file: from module1 import thefirst x = thefirst(2) print x This returns: NameError: name 'a' is not defined. All help is appreciated.

    Read the article

  • Eval ID on radiobutton in Datalist

    - by ravi
    my code gota datalist with radio button and iv made it single selectable onitemdatabound....now im trying to evaluate a hiddenfield on basis of selected radio button my code goes like this aspx code <asp:DataList ID="DataList1" runat="server" RepeatColumns = "4" CssClass="datalist1" RepeatLayout = "Table" OnItemDataBound="SOMENAMEItemBound" CellSpacing="20" onselectedindexchanged="DataList1_SelectedIndexChanged"> <ItemTemplate> <br /> <table cellpadding = "5px" cellspacing = "0" class="dlTable"> <tr> <td align="center"> <a href="<%#Eval("FilePath")%>" target="_blank"><asp:Image ID="Image1" runat="server" CssClass="imu" ImageUrl = '<%# Eval("FilePath")%>' Width = "100px" Height = "100px" style ="cursor:pointer" /> </td> </tr> <tr > <td align="center"> <asp:RadioButton ID="rdb" runat="server" OnCheckedChanged="rdb_click" AutoPostBack="True" /> <asp:HiddenField ID="HiddenField1" runat="server" Value = '<%#Eval("ID")%>' /> </td> </tr> </table> </ItemTemplate> </asp:DataList> code behind protected void SOMENAMEItemBound(object sender, DataListItemEventArgs e) { RadioButton rdb; rdb = (RadioButton)e.Item.FindControl("rdb"); if (rdb != null) rdb.Attributes.Add("onclick", "CheckOnes(this);"); } protected void rdb_click(object sender, EventArgs e) { for (int i = 0; i < DataList1.Items.Count; i++) { RadioButton rdb; rdb = (RadioButton)DataList1.Items[i].FindControl("rdb"); if (rdb != null) { if (rdb.Checked) { HiddenField hf = (HiddenField)DataList1.Items[i].FindControl("HiddenField1"); Response.Write(hf.Value); } } } } the javascript im using... function CheckOnes(spanChk){ var oItem = spanChk.children; var theBox= (spanChk.type=="radio") ? spanChk : spanChk.children.item[0]; xState=theBox.unchecked; elm=theBox.form.elements; for(i=0;i<elm.length;i++) if(elm[i].type=="radio" && elm[i].id!=theBox.id) { elm[i].checked=xState; } } iam getting an error like this Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. Details: Error parsing near 'pload Demonstration|'. is there any other way to do this or can nyone plz help to get rid of this problem

    Read the article

  • ASP:LinkButton and Eval

    - by sgibbons
    I'm using an ASP:LinkButton inside of an ItemTemplate inside of a TemplateField in a GridView. For the command argument for the link button I want to pass the ID of the row from the datasource that the gridview is bound to, so I'm doing something like this: <asp:LinkButton ID="viewLogButton" CommandName="viewLog" CommandArgument="<%#Eval("ID")%>" Text="View Log" runat="server"/> Unfortunately, the resulting HTML is this: <asp:LinkButton ID="viewLogButton" CommandName="viewLog" CommandArgument="3" Text="View Log" runat="server"/> It seems that it is parsing the Eval() properly, but this is somehow causing it not to parse the LinkButton tag and just dump it out as literal text. Does anyone know: a) why this is happening and, b) what a good solution to this problem is?

    Read the article

  • emacsclient -eval "(insert \"something\")" is not working for me

    - by manu
    I recently upgraded to Ubuntu 10.04 which comes with Emacs 23. I need Jabref to push citations to Emacs. However, despite I installed the Jabref plugin to push citations through emacsclient, it's not working. I did my testing, and read some of the Emacs Lisp Intro. Some commands do work, for instance if I type (in the console): emacsclient --eval "(switch-to-buffer \"*sratch*\")" the emacs windows switches to that buffer. However if I issue an insert command: emacsclient --eval "(insert \"do you see me?\")" no text is inserted in the current buffer. Does Emacs 23 changed something about insert?

    Read the article

  • Ruby: Parse, replace, and evaluate a string formula

    - by Swartz
    I'm creating a simple Ruby on Rails survey application for a friend's psychological survey project. So we have surveys, each survey has a bunch of questions, and each question has one of the options participants can choose from. Nothing exciting. One of the interesting aspects is that each answer option has a score value associated with it. And so for each survey a total score needs to be calculated based on these values. Now my idea is instead of hard-coding calculations is to allow user add a formula by which the total survey score will be calculated. Example formulas: "Q1 + Q2 + Q3" "(Q1 + Q2 + Q3) / 3" "(10 - Q1) + Q2 + (Q3 * 2)" So just basic math (with some extra parenthesis for clarity). The idea is to keep the formulas very simple such that anyone with basic math can enter them without resolving to some fancy syntax. My idea is to take any given formula and replace placeholders such as Q1, Q2, etc with the score values based on what the participant chooses. And then eval() the newly formed string. Something like this: f = "(Q1 + Q2 + Q3) / 2" # some crazy formula for this survey values = {:Q1 => 1, :Q2 => 2, :Q3 => 2} # values for substitution result = f.gsub(/(Q\d+)/) {|m| values[$1.to_sym] } # string to be eval()-ed eval(result) So my questions are: Is there a better way to do this? I'm open to any suggestions. How to handle formulas where not all placeholders were successfully replaced (e.g. one question wasn't answered)? Ex: {:Q3 = 2} wasn't in values hash? My idea is to rescue eval()... any thoughts? How to get proper result? Should be 2.5, but due to integer arithmetic, it will truncate to 2. I can't expect people who provide the correct formula (e.g. / 2.0 ) to understand this nuance. I do not expect this, but how to best protect eval() from abuse (e.g. bad formula, manipulated values coming in)? Thank you!

    Read the article

  • Javascript eval limits

    - by user117701
    Is there a limit to javascript's eval, like in lenght? I'm trying to build an app where you can store JS code in the DB, which you can later load and eval in order to execute it, but i'm reaching a limit. First of all, the code has to all be in one line. Any multiline statements are not executed. Next, i'm reaching a limit in length (i guess). If i execute the code manually, it works, but put that same code in the db, load it via ajax, and try to execute it, and it fails. Any ideas why?

    Read the article

  • A better and faster way for eval?

    - by user1707250
    I want to build my queries dynamically and use the following snippet: --snip-- module.exports = { get : function(req, res, next) { var queryStr = "req.database.table('locations').get(parseInt(req.params.id))"; if (req.params.id) { if (req.fields) { queryStr += '.pick(' + req.fieldsStr + ')'; } console.log(queryStr); eval(queryStr).run(function(result) { console.log(result); res.send(result); }); } else if (!req.params.id) { --snip-- However introducing eval opens up my code to injection (req.fields is filled with url parameters) and I see the response time of my app increase from 7 to 11ms Is there a smarter way to accomplish what I did here? Please advice.

    Read the article

  • How to catch a carp-warning?

    - by sid_com
    I tried to catch a carp-warning ( carp "$start is $end" if (warnings::enabled()); ) with eval but it didn't work, so I looked in the eval-documentation and I discovered, that eval catches only syntax-errors, run-time-errors or executed die-statements. How could I catch a carp-warning? #!/usr/bin/env perl use warnings; use strict; use 5.012; use List::Util qw(max min); use Number::Range; my @array; my $max = 20; print "Input (max $max): "; my $in = <>; $in =~ s/\s+//g; $in =~ s/(?<=\d)-/../g; eval { my $range = new Number::Range( $in ); @array = sort { $a <=> $b } $range->range; }; if ( $@ =~ /\d+ is > \d+/ ) { die $@ }; # catch the carp-warning doesn't work die "Input greater than $max not allowed $!" if defined $max and max( @array ) > $max; die "Input '0' or less not allowed $!" if min( @array ) < 1; say "@array";

    Read the article

  • How can I change some specific carps into croaks in Perl?

    - by sid_com
    I tried to catch a carp-warning: carp "$start is > $end" if (warnings::enabled()); ) with eval {} but it didn't work, so I looked in the eval documentation and I discovered, that eval catches only syntax-errors, run-time-errors or executed die-statements. How could I catch a carp warning? #!/usr/bin/env perl use warnings; use strict; use 5.012; use List::Util qw(max min); use Number::Range; my @array; my $max = 20; print "Input (max $max): "; my $in = <>; $in =~ s/\s+//g; $in =~ s/(?<=\d)-/../g; eval { my $range = new Number::Range( $in ); @array = sort { $a <=> $b } $range->range; }; if ( $@ =~ /\d+ is > \d+/ ) { die $@ }; # catch the carp-warning doesn't work die "Input greater than $max not allowed $!" if defined $max and max( @array ) > $max; die "Input '0' or less not allowed $!" if min( @array ) < 1; say "@array";

    Read the article

  • C#: Dynamically instantiate different classes in the same statement?

    - by C. Griffin
    Here is a simplified version of what I'm trying to do: Without having multiple if..else clauses and switch blocks, can I mimic the behavior of Javascript's eval() shudder to instantiate a class in C#? // Determine report orientation -- Portrait or Landscape // There are 2 differently styled reports (beyond paper orientation) string reportType = "Portrait"; GenericReport report; report = new eval(reportType + "Report()"); // Resolves to PortraitReport() The need stems from the fact that I have 6 types of Crystal Reports (that do the same thing, but look drastically different) for 50 states. There are 3 styles each, rather than entertain the notion of a giant switch block with nested if..else statements determining which of 900 reports to use, I was hoping for an eval-like solution.

    Read the article

  • What's the different?

    - by question_about_the_problem
    I'm not php expert and I don't know what's the different(1) between a and b. a.)eval('return "'.base64_decode("encoded_text").'";') b.)base64_decode("encoded_text") -I THINK, a is php code and b is just string. And my other question is: What is the diffent(2) between c and d? c.)eval('return "'.base64_decode("encoded_text").'";') d.)eval(base64_decode("encoded_text")) So I have 2 questions. Who can answer/help ? Thanks.

    Read the article

  • iptables - quick safety eval & limit max conns over time

    - by Peter Hanneman
    Working on locking down a *nix server box with some fancy iptable(v1.4.4) rules. I'm approaching the matter with a "paranoid, everyone's out to get me" style, not necessarily because I expect the box to be a hacker magnet but rather just for the sake of learning iptables and *nix security more throughly. Everything is well commented - so if anyone sees something I missed please let me know! The *nat table's "--to-ports" point to the only ports with actively listening services. (aside from pings) Layer 2 apps listen exclusively on chmod'ed sockets bridged by one of the layer 1 daemons. Layers 3+ inherit from layer 2 in a similar fashion. The two lines giving me grief are commented out at the very bottom of the *filter rules. The first line runs fine but it's all or nothing. :) Many thanks, Peter H. *nat #Flush previous rules, chains and counters for the 'nat' table -F -X -Z #Redirect traffic to alternate internal ports -I PREROUTING --src 0/0 -p tcp --dport 80 -j REDIRECT --to-ports 8080 -I PREROUTING --src 0/0 -p tcp --dport 443 -j REDIRECT --to-ports 8443 -I PREROUTING --src 0/0 -p udp --dport 53 -j REDIRECT --to-ports 8053 -I PREROUTING --src 0/0 -p tcp --dport 9022 -j REDIRECT --to-ports 8022 COMMIT *filter #Flush previous settings, chains and counters for the 'filter' table -F -X -Z #Set default behavior for all connections and protocols -P INPUT DROP -P OUTPUT DROP -A FORWARD -j DROP #Only accept loopback traffic originating from the local NIC -A INPUT -i lo -j ACCEPT -A INPUT ! -i lo -d 127.0.0.0/8 -j DROP #Accept all outgoing non-fragmented traffic having a valid state -A OUTPUT ! -f -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT #Drop fragmented incoming packets (Not always malicious - acceptable for use now) -A INPUT -f -j DROP #Allow ping requests rate limited to one per second (burst ensures reliable results for high latency connections) -A INPUT -p icmp --icmp-type 8 -m limit --limit 1/sec --limit-burst 2 -j ACCEPT #Declaration of custom chains -N INSPECT_TCP_FLAGS -N INSPECT_STATE -N INSPECT #Drop incoming tcp connections with invalid tcp-flags -A INSPECT_TCP_FLAGS -p tcp --tcp-flags ALL ALL -j DROP -A INSPECT_TCP_FLAGS -p tcp --tcp-flags ALL NONE -j DROP -A INSPECT_TCP_FLAGS -p tcp --tcp-flags ACK,FIN FIN -j DROP -A INSPECT_TCP_FLAGS -p tcp --tcp-flags ACK,PSH PSH -j DROP -A INSPECT_TCP_FLAGS -p tcp --tcp-flags ACK,URG URG -j DROP -A INSPECT_TCP_FLAGS -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP -A INSPECT_TCP_FLAGS -p tcp --tcp-flags ALL FIN,PSH,URG -j DROP -A INSPECT_TCP_FLAGS -p tcp --tcp-flags FIN,RST FIN,RST -j DROP -A INSPECT_TCP_FLAGS -p tcp --tcp-flags SYN,RST SYN,RST -j DROP -A INSPECT_TCP_FLAGS -p tcp --tcp-flags ALL SYN,FIN,PSH,URG -j DROP -A INSPECT_TCP_FLAGS -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -j DROP #Accept incoming traffic having either an established or related state -A INSPECT_STATE -m state --state ESTABLISHED,RELATED -j ACCEPT #Drop new incoming tcp connections if they aren't SYN packets -A INSPECT_STATE -m state --state NEW -p tcp ! --syn -j DROP #Drop incoming traffic with invalid states -A INSPECT_STATE -m state --state INVALID -j DROP #INSPECT chain definition -A INSPECT -p tcp -j INSPECT_TCP_FLAGS -A INSPECT -j INSPECT_STATE #Route incoming traffic through the INSPECT chain -A INPUT -j INSPECT #Accept redirected HTTP traffic via HA reverse proxy -A INPUT -p tcp --dport 8080 -j ACCEPT #Accept redirected HTTPS traffic via STUNNEL SSH gateway (As well as tunneled HTTPS traffic destine for other services) -A INPUT -p tcp --dport 8443 -j ACCEPT #Accept redirected DNS traffic for NSD authoritative nameserver -A INPUT -p udp --dport 8053 -j ACCEPT #Accept redirected SSH traffic for OpenSSH server #Temp solution: -A INPUT -p tcp --dport 8022 -j ACCEPT #Ideal solution: #Limit new ssh connections to max 10 per 10 minutes while allowing an "unlimited" (or better reasonably limited?) number of established connections. #-A INPUT -p tcp --dport 8022 --state NEW,ESTABLISHED -m recent --set -j ACCEPT #-A INPUT -p tcp --dport 8022 --state NEW -m recent --update --seconds 600 --hitcount 11 -j DROP COMMIT *mangle #Flush previous rules, chains and counters in the 'mangle' table -F -X -Z COMMIT

    Read the article

  • Sublime Text 2 + Eval in REPL

    - by user330121
    Using sublime text 2 on windows 8, I've set my key-bindings to: [ { "keys": ["ctrl+alt+f"], "args": { "id": "repl_f#", "file": "config/F/Main.sublime-menu" }, "command": "run_existing_window_command" }, { "keys": ["ctrl+shift+enter"], "args": { "scope": "selection" }, "command": "repl_transfer_current" } ] But when I press "ctrl+shift+enter" I get the following error. Does anyone know how to resolve this? Traceback (most recent call last): File ".\sublime_plugin.py", line 356, in run_ File ".\text_transfer.py", line 123, in run File ".\sublimerepl.py", line 437, in find_repl File ".\repls\subprocess_repl.py", line 185, in is_alive File ".\subprocess.py", line 705, in poll File ".\subprocess.py", line 874, in _internal_poll WindowsError: [Error 6] The handle is invalid

    Read the article

  • Bundler isn't loading gems

    - by Garrett
    I have been having a problem with using Bundler and being able to access my gems without having to require them somewhere, as config.gem used to do that for me (as far as I know). In my Rails 3 app, I defined my Gemfile like so: clear_sources source "http://gemcutter.org" source "http://gems.github.com" bundle_path "vendor/bundler_gems" ## Bundle edge rails: git "git://github.com/rails/arel.git" git "git://github.com/rails/rack.git" gem "rails", :git => "git://github.com/rails/rails.git" ## Bundle gem "mongo_mapper", :git => "git://github.com/jnunemaker/mongomapper.git" gem "bluecloth", ">= 2.0.0" Then I run gem bundle, it bundles it all up like expected. Inside the environment.rb file that is included within boot.rb it looks like this: # DO NOT MODIFY THIS FILE module Bundler file = File.expand_path(__FILE__) dir = File.dirname(file) ENV["PATH"] = "#{dir}/../../../../bin:#{ENV["PATH"]}" ENV["RUBYOPT"] = "-r#{file} #{ENV["RUBYOPT"]}" $LOAD_PATH.unshift File.expand_path("#{dir}/gems/builder-2.1.2/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/builder-2.1.2/lib") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/text-hyphen-1.0.0/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/text-hyphen-1.0.0/lib") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/i18n-0.3.3/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/i18n-0.3.3/lib") $LOAD_PATH.unshift File.expand_path("#{dir}/dirs/arel/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/dirs/arel/lib") $LOAD_PATH.unshift File.expand_path("#{dir}/dirs/rails/activemodel/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/dirs/rails/activemodel/lib") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/jnunemaker-validatable-1.8.1/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/jnunemaker-validatable-1.8.1/lib") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/abstract-1.0.0/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/abstract-1.0.0/lib") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/erubis-2.6.5/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/erubis-2.6.5/lib") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/mime-types-1.16/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/mime-types-1.16/lib") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/mail-2.1.2/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/mail-2.1.2/lib") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/rake-0.8.7/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/rake-0.8.7/lib") $LOAD_PATH.unshift File.expand_path("#{dir}/dirs/rails/railties/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/dirs/rails/railties/lib") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/memcache-client-1.7.7/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/memcache-client-1.7.7/lib") $LOAD_PATH.unshift File.expand_path("#{dir}/dirs/rack/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/dirs/rack/lib") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/rack-test-0.5.3/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/rack-test-0.5.3/lib") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/rack-mount-0.4.5/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/rack-mount-0.4.5/lib") $LOAD_PATH.unshift File.expand_path("#{dir}/dirs/rails/actionpack/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/dirs/rails/actionpack/lib") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/bluecloth-2.0.7/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/bluecloth-2.0.7/lib") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/bluecloth-2.0.7/ext") $LOAD_PATH.unshift File.expand_path("#{dir}/dirs/rails/activerecord/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/dirs/rails/activerecord/lib") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/text-format-1.0.0/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/text-format-1.0.0/lib") $LOAD_PATH.unshift File.expand_path("#{dir}/dirs/rails/actionmailer/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/dirs/rails/actionmailer/lib") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/tzinfo-0.3.16/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/tzinfo-0.3.16/lib") $LOAD_PATH.unshift File.expand_path("#{dir}/dirs/rails/activesupport/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/dirs/rails/activesupport/lib") $LOAD_PATH.unshift File.expand_path("#{dir}/dirs/rails/activeresource/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/dirs/rails/activeresource/lib") $LOAD_PATH.unshift File.expand_path("#{dir}/dirs/rails/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/dirs/rails/lib") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/mongo-0.18.2/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/gems/mongo-0.18.2/lib") $LOAD_PATH.unshift File.expand_path("#{dir}/dirs/mongomapper/bin") $LOAD_PATH.unshift File.expand_path("#{dir}/dirs/mongomapper/lib") @gemfile = "#{dir}/../../../../Gemfile" require "rubygems" unless respond_to?(:gem) # 1.9 already has RubyGems loaded @bundled_specs = {} @bundled_specs["builder"] = eval(File.read("#{dir}/specifications/builder-2.1.2.gemspec")) @bundled_specs["builder"].loaded_from = "#{dir}/specifications/builder-2.1.2.gemspec" @bundled_specs["text-hyphen"] = eval(File.read("#{dir}/specifications/text-hyphen-1.0.0.gemspec")) @bundled_specs["text-hyphen"].loaded_from = "#{dir}/specifications/text-hyphen-1.0.0.gemspec" @bundled_specs["i18n"] = eval(File.read("#{dir}/specifications/i18n-0.3.3.gemspec")) @bundled_specs["i18n"].loaded_from = "#{dir}/specifications/i18n-0.3.3.gemspec" @bundled_specs["arel"] = eval(File.read("#{dir}/specifications/arel-0.2.pre.gemspec")) @bundled_specs["arel"].loaded_from = "#{dir}/specifications/arel-0.2.pre.gemspec" @bundled_specs["activemodel"] = eval(File.read("#{dir}/specifications/activemodel-3.0.pre.gemspec")) @bundled_specs["activemodel"].loaded_from = "#{dir}/specifications/activemodel-3.0.pre.gemspec" @bundled_specs["jnunemaker-validatable"] = eval(File.read("#{dir}/specifications/jnunemaker-validatable-1.8.1.gemspec")) @bundled_specs["jnunemaker-validatable"].loaded_from = "#{dir}/specifications/jnunemaker-validatable-1.8.1.gemspec" @bundled_specs["abstract"] = eval(File.read("#{dir}/specifications/abstract-1.0.0.gemspec")) @bundled_specs["abstract"].loaded_from = "#{dir}/specifications/abstract-1.0.0.gemspec" @bundled_specs["erubis"] = eval(File.read("#{dir}/specifications/erubis-2.6.5.gemspec")) @bundled_specs["erubis"].loaded_from = "#{dir}/specifications/erubis-2.6.5.gemspec" @bundled_specs["mime-types"] = eval(File.read("#{dir}/specifications/mime-types-1.16.gemspec")) @bundled_specs["mime-types"].loaded_from = "#{dir}/specifications/mime-types-1.16.gemspec" @bundled_specs["mail"] = eval(File.read("#{dir}/specifications/mail-2.1.2.gemspec")) @bundled_specs["mail"].loaded_from = "#{dir}/specifications/mail-2.1.2.gemspec" @bundled_specs["rake"] = eval(File.read("#{dir}/specifications/rake-0.8.7.gemspec")) @bundled_specs["rake"].loaded_from = "#{dir}/specifications/rake-0.8.7.gemspec" @bundled_specs["railties"] = eval(File.read("#{dir}/specifications/railties-3.0.pre.gemspec")) @bundled_specs["railties"].loaded_from = "#{dir}/specifications/railties-3.0.pre.gemspec" @bundled_specs["memcache-client"] = eval(File.read("#{dir}/specifications/memcache-client-1.7.7.gemspec")) @bundled_specs["memcache-client"].loaded_from = "#{dir}/specifications/memcache-client-1.7.7.gemspec" @bundled_specs["rack"] = eval(File.read("#{dir}/specifications/rack-1.1.0.gemspec")) @bundled_specs["rack"].loaded_from = "#{dir}/specifications/rack-1.1.0.gemspec" @bundled_specs["rack-test"] = eval(File.read("#{dir}/specifications/rack-test-0.5.3.gemspec")) @bundled_specs["rack-test"].loaded_from = "#{dir}/specifications/rack-test-0.5.3.gemspec" @bundled_specs["rack-mount"] = eval(File.read("#{dir}/specifications/rack-mount-0.4.5.gemspec")) @bundled_specs["rack-mount"].loaded_from = "#{dir}/specifications/rack-mount-0.4.5.gemspec" @bundled_specs["actionpack"] = eval(File.read("#{dir}/specifications/actionpack-3.0.pre.gemspec")) @bundled_specs["actionpack"].loaded_from = "#{dir}/specifications/actionpack-3.0.pre.gemspec" @bundled_specs["bluecloth"] = eval(File.read("#{dir}/specifications/bluecloth-2.0.7.gemspec")) @bundled_specs["bluecloth"].loaded_from = "#{dir}/specifications/bluecloth-2.0.7.gemspec" @bundled_specs["activerecord"] = eval(File.read("#{dir}/specifications/activerecord-3.0.pre.gemspec")) @bundled_specs["activerecord"].loaded_from = "#{dir}/specifications/activerecord-3.0.pre.gemspec" @bundled_specs["text-format"] = eval(File.read("#{dir}/specifications/text-format-1.0.0.gemspec")) @bundled_specs["text-format"].loaded_from = "#{dir}/specifications/text-format-1.0.0.gemspec" @bundled_specs["actionmailer"] = eval(File.read("#{dir}/specifications/actionmailer-3.0.pre.gemspec")) @bundled_specs["actionmailer"].loaded_from = "#{dir}/specifications/actionmailer-3.0.pre.gemspec" @bundled_specs["tzinfo"] = eval(File.read("#{dir}/specifications/tzinfo-0.3.16.gemspec")) @bundled_specs["tzinfo"].loaded_from = "#{dir}/specifications/tzinfo-0.3.16.gemspec" @bundled_specs["activesupport"] = eval(File.read("#{dir}/specifications/activesupport-3.0.pre.gemspec")) @bundled_specs["activesupport"].loaded_from = "#{dir}/specifications/activesupport-3.0.pre.gemspec" @bundled_specs["activeresource"] = eval(File.read("#{dir}/specifications/activeresource-3.0.pre.gemspec")) @bundled_specs["activeresource"].loaded_from = "#{dir}/specifications/activeresource-3.0.pre.gemspec" @bundled_specs["rails"] = eval(File.read("#{dir}/specifications/rails-3.0.pre.gemspec")) @bundled_specs["rails"].loaded_from = "#{dir}/specifications/rails-3.0.pre.gemspec" @bundled_specs["mongo"] = eval(File.read("#{dir}/specifications/mongo-0.18.2.gemspec")) @bundled_specs["mongo"].loaded_from = "#{dir}/specifications/mongo-0.18.2.gemspec" @bundled_specs["mongo_mapper"] = eval(File.read("#{dir}/specifications/mongo_mapper-0.6.10.gemspec")) @bundled_specs["mongo_mapper"].loaded_from = "#{dir}/specifications/mongo_mapper-0.6.10.gemspec" def self.add_specs_to_loaded_specs Gem.loaded_specs.merge! @bundled_specs end def self.add_specs_to_index @bundled_specs.each do |name, spec| Gem.source_index.add_spec spec end end add_specs_to_loaded_specs add_specs_to_index def self.require_env(env = nil) context = Class.new do def initialize(env) @env = env && env.to_s ; end def method_missing(*) ; yield if block_given? ; end def only(*env) old, @only = @only, _combine_only(env.flatten) yield @only = old end def except(*env) old, @except = @except, _combine_except(env.flatten) yield @except = old end def gem(name, *args) opt = args.last.is_a?(Hash) ? args.pop : {} only = _combine_only(opt[:only] || opt["only"]) except = _combine_except(opt[:except] || opt["except"]) files = opt[:require_as] || opt["require_as"] || name files = [files] unless files.respond_to?(:each) return unless !only || only.any? {|e| e == @env } return if except && except.any? {|e| e == @env } if files = opt[:require_as] || opt["require_as"] files = Array(files) files.each { |f| require f } else begin require name rescue LoadError # Do nothing end end yield if block_given? true end private def _combine_only(only) return @only unless only only = [only].flatten.compact.uniq.map { |o| o.to_s } only &= @only if @only only end def _combine_except(except) return @except unless except except = [except].flatten.compact.uniq.map { |o| o.to_s } except |= @except if @except except end end context.new(env && env.to_s).instance_eval(File.read(@gemfile), @gemfile, 1) end end module Gem @loaded_stacks = Hash.new { |h,k| h[k] = [] } def source_index.refresh! super Bundler.add_specs_to_index end end But when I try to access any of my gems, e.g. MongoMapper, Paperclip, Haml, etc. I get: NameError: uninitialized constant MongoMapper The same goes for any other gem. Does Bundler not include gems like the old Rails 2.0 did? Or is something messed up with my system? Any help would be appreciated, thank you!

    Read the article

  • How to "eval" Objective-C code in iPhone

    - by DJYod
    Hi, does a method such as "eval" in Javascript exist in Objective-C (iPhone SDK) ? I use PhoneGap and I want to create a window which is specific for each of my project and I can't use the html file... so I want from JS call a method and give in argument OC code to ben interpreted ... Any idea? Thank you for your help

    Read the article

  • using eval in Java

    - by karthi-27
    I am new to Java. I have a string like the following: str="4*5"; Now I have to get the result of 20 by using the string. I know in some other languages the eval function will do this. How do I do this in Java?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >