Search Results

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

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

  • Parsing JSON with eval

    - by Neethusha
    I have this code: function useHttpResponse() { if (xmlhttp.readyState==4 ) { var response = eval('('+xmlhttp.responseText+')'); alert(response); for(i=0;i<response.Users.length;i++) alert(response.Users[i].UserId); } } When i alert, the first alert is "[object Object]" Why is that so? I need to remove that...how?

    Read the article

  • Flash - eval() available?

    - by user246114
    Hi, Is there any way to execute arbitrary code in Flash, like javascript's eval()? I'd like to take some code as a string and execute it, if possible (I understand this is not a great idea), Thanks

    Read the article

  • access static class from asp.net form

    - by Eden
    I am using <%# MyFormatClass(Eval("fieldname")) % to display data in a grid view on my page. MyFormatClass works fine, but now I want to move it to a central location that can be used by many pages. When I try to access the class <%# Utils.MyFormatClass(Eval("fieldname")) % it no longer works. Is this something we are allowed to do?

    Read the article

  • How to rewrite this eval block

    - by est
    Hi, This code smells... how do I rewrite it better? my $record; eval { while ( # undef $record here, so if getRecord() failed, nothing will be written # in the reject file do { undef $record; defined( $record = $dataFile->getRecord ) } ) { $LT_DataFile->encode($record); } 1; }; if ( my $error = $@ ) { $rejectFile->writeRecord( $error, $record ); } Thanks.

    Read the article

  • how to unpack the contents of a javascript file?

    - by altvali
    Hi all! You know how those packed js files look like, right? eval(function(p,a,c,k,e,d){ ... } ('obfuscated-string'.split('|'),0,{})) It just so happens to be that i have to tweak some large legacy code that looks like that and i want to find a way to turn this into a more readable version. If that's not possible, can i at least get rid of the eval?

    Read the article

  • JSON.parse vs. eval()

    - by Kevin Major
    My Spider Sense warns me that using eval() to parse incoming JSON is a bad idea. I'm just wondering if JSON.parse() - which I assume is a part of JavaScript and not a browser-specific function - is more secure.

    Read the article

  • "Decompile" Javascript function? *ADVANCED*

    - by caesar2k
    [1] Ok, I don't even know how to call this, to be honest. So let me get some semi-pseudo code, to show what I'm trying to do. I'm using jquery to get an already existing script declared inside the page, inside a createDocument() element, from an AJAX call. GM_xmlhttprequest({ ... load:function(r){ var doc = document_from_string(r.responseText); script_content = $('body script:regex(html, local_xw_sig)', doc).html(); var scriptEl = document.createElement('script'); scriptEl.type = 'text/javascript'; scriptEl.innerHTML = script_content; // good till here (function(sc){ eval(sc.innerHTML); // not exactly like this, but you get the idea, errors alert('wont get here ' + local_xw_sig); // local_xw_sig is a global "var" inside the source })(scriptEl); } }); so far so good, the script indeed contains the source from the entire script block. Now, inside this "script_content", there are auto executing functions, like $(document).ready(function(){...}) that, everything I "eval" the innerHTML, it executes this code, halting my encapsulated script. like variables that doesn't exist, etc removing certain parts of the script using regex isn't really an option... what I really wanted is to "walk" inside the function. like do a (completely fictional): script = eval("function(){" + script_content + "};"); alert(script['local_xw_sig']); // a03ucc34095cw3495 is there any way to 'disassemble' the function, and be able to reach the "var"s inside of it? like this function: function hello(){ var message = "hello"; } alert(hello.message); // message = var inside the function is it possible at all? or I will have to hack my way using regex? ;P [2] also, is there any way I can access javascript inside a document created with "createDocument"?

    Read the article

  • Are Dynamic Prepared Statements Bad? (with php + mysqli)

    - by John
    I like the flexibility of Dynamic SQL and I like the security + improved performance of Prepared Statements. So what I really want is Dynamic Prepared Statements, which is troublesome to make because bind_param and bind_result accept "fixed" number of arguments. So I made use of an eval() statement to get around this problem. But I get the feeling this is a bad idea. Here's example code of what I mean // array of WHERE conditions $param = array('customer_id'=>1, 'qty'=>'2'); $stmt = $mysqli->stmt_init(); $types = ''; $bindParam = array(); $where = ''; $count = 0; // build the dynamic sql and param bind conditions foreach($param as $key=>$val) { $types .= 'i'; $bindParam[] = '$p'.$count.'=$param["'.$key.'"]'; $where .= "$key = ? AND "; $count++; } // prepare the query -- SELECT * FROM t1 WHERE customer_id = ? AND qty = ? $sql = "SELECT * FROM t1 WHERE ".substr($where, 0, strlen($where)-4); $stmt->prepare($sql); // assemble the bind_param command $command = '$stmt->bind_param($types, '.implode(', ', $bindParam).');'; // evaluate the command -- $stmt->bind_param($types,$p0=$param["customer_id"],$p1=$param["qty"]); eval($command); Is that last eval() statement a bad idea? I tried to avoid code injection by encapsulating values behind the variable name $param. Does anyone have an opinion or other suggestions? Are there issues I need to be aware of?

    Read the article

  • Trouble using 'eval' to define a toplevel function when called from within an object.

    - by mschaef
    I've written (in JavaScript) an interactive read-eval-print-loop that is encapsulated within an object. However, I recently noticed that toplevel function definitions specified to the interpreter do not appear to be 'remembered' by the interpreter. After some diagnostic work, I've reduced the core problem to this: var evaler = { eval: function (str) { return eval(str); }, }; eval("function t1() { return 1; }"); // GOOD evaler.eval("function t2() { return 2; }"); // FAIL After running this script, I have a definition for t1, and no defintion for t2. The act of calling eval from within evaler is sufficiently different from the toplevel call that the global definition does not get recorded. What does happen is that the call to evaler.eval returns a function object, so I'm presuming that t2 is being defined and stored in some other set of bindings that I don't have access to. (It's not defined as a member in evaler.) Is there any easy fix for this? I've tried all sorts of fixes, and haven't stumbled upon one that works. (Most of what I've done has centered around putting the call to eval in an anonymous function, and altering the way that's called, chainging __parent__, etc.) Any thoughts on how to fix this?

    Read the article

  • WebTextEdit ClientSideEvent Javascript - Can't Eval

    - by ismail
    Hi, I urgently need help, please. WebtextEdit ClientSideEvent execute javascript statement on mousemove event. I can successfully change the style of another object type on this WebTextEdit ClientSide MouseMove event: document.getElementById("Object2").style.backgroundColor = '#F0F5F7'; But when I want to change the style of the WebTextEdit control: document.getElementById("WebTextEdit1").style.backgroundColor = '#F0F5F7'; Then nothing happens. When I execute the script on the same WebTextEdit Clientside for another object which is not a WebtextEdit: Object2.style.border='1px solid #FFE6A0'; Then it works. But when I want to change the WebtextEdit Clientside style: WebTextEdit1.style.border='1px solid #FFE6A0'; Then I get Error: Can't Eval WebTextEdit1.style.border='1px solid #FFE6A0';

    Read the article

  • Build a HyperLink in a GridView in ASP.NET webforms - Eval not working

    - by MarceloRamires
    I have a gridview with a template field that has a HyperLink: <asp:TemplateField ItemStyle-Width="12%" HeaderText="VER" HeaderStyle-HorizontalAlign="Center" SortExpression="Ver" ItemStyle-HorizontalAlign="Center"> <ItemTemplate> <asp:HyperLink ID="HyperLink1" NavigateUrl="~/Admin/Teste/Teste.aspx?rac=<%#Eval('idApontamento')%>" runat="server">TEXT</asp:HyperLink> </ItemTemplate> </asp:TemplateField> I am getting The server tag is not well formed. in the HyperLink line. What should I do in order to directly build a querystring in a HyperLink ?

    Read the article

  • asp Repeater ItemTemplate - eval whole object

    - by Tomasz Bitowt
    Currently I am using asp:Repeater like this: <asp:Repeater ID="itemsRepeater" runat="server"> <ItemTemplate> <my:Button runat="server" Title='<%# DataBinder.Eval(Container.DataItem, "Title") %>' /> </ItemTemplate> </asp:Repeater> But now, I would like to send whole model to my:Button control like: <asp:Repeater ID="itemsRepeater" runat="server"> <ItemTemplate> <my:TabListButton runat="server" Mode;='<%# this %>' /> </ItemTemplate> </asp:Repeater> Could you tell me how to handle that?

    Read the article

  • C# eval equivalent?

    - by Adhip Gupta
    I can do an eval("something()"); to execute the code dynamically in JavaScript. Is there a way for me to do the same thing in C#? What I am exactly trying to do is that I have an integer variable (say i) and I have multiple properties by the names: "Property1","Property2","Property3" etc. Now, I want to perform some operations on the " Propertyi " property depending on the value of i. This is really simple with Javascript. Is there any way to do this with C#? Edit: Oh, and I am using C# 2.0

    Read the article

  • jQuery eval of ajax inline script not throwing errors

    - by Josh
    http://stackoverflow.com/questions/606794/debugging-ajax-code-with-firebug This question is quite similar, though old and without real answers. I'm currently putting together an app that has scripts that get loaded in with an ajax request. An example: var main = _main.get(); main.load( someurl ); Where someurl is a page that contains an inline script element: <script type="text/javascript"> $(document).ready( function(){ var activities = new activities(); activities.init(); }); </script> jQuery will do a line by line eval of js that lives in inline script tags. The problem is, I get no errors or any information whatsoever in firebug when something goes awry. Does anyone have a good solution for this? Or a better practice for loading pages which contain javascript functionality? Edit: A little progress... so at the top of the page that is being loaded in via ajax, I have another script that was being included like this: <script type="text/javascript" src="javascript/pages/activities.js"></script> When I moved the inline $(document).ready() code in the page to the end of this included file, instead, syntax errors were now properly getting thrown. As an aside, I threw a console.log() into the inline script tag, and it was being logged just fine. I also tried removing the $(document).ready() altogether, and also switching it out for a $(window).load() event. No difference. May have something to do with the inline scripts dependency on the included activities.js, I guess. :: shakes head :: javascript can be a nightmare.

    Read the article

  • geom_ribbon doesn't work - Error in eval(expr, envir, enclos) : object 'variable' not found

    - by Marciszka
    I try to add a geom_ribbon object to my ggplot2 plot. In my data frame, I have an NA values that (I guess) may cause a problem. This is a reproducible example of data drame I have: base <- c(1:10, rep(NA, 10)) output1 <- c(rep(NA, 9), 10 - 0:10) output2 <- c(rep(NA, 9), 10 + 0:10) xaxis <- 1:20 df <- data.frame(xaxis, base, output1, output2) df xaxis base output1 output2 1 1 1 NA NA 2 2 2 NA NA 3 3 3 NA NA 4 4 4 NA NA 5 5 5 NA NA 6 6 6 NA NA 7 7 7 NA NA 8 8 8 NA NA 9 9 9 NA NA 10 10 10 10 10 11 11 NA 9 11 12 12 NA 8 12 13 13 NA 7 13 14 14 NA 6 14 15 15 NA 5 15 16 16 NA 4 16 17 17 NA 3 17 18 18 NA 2 18 19 19 NA 1 19 20 20 NA 0 20 And my attempt to plot a ggplot2 object with a geom_ribbon: dfm <- melt(df, id=1) ggplot(dfm, aes(x = xaxis, y = value, colour = variable)) + geom_line(aes(group=variable)) + geom_ribbon(data=df, aes(group = 1, ymin=output1, ymax=output2)) And, eventually, I got an error I cannot deal with: Error in eval(expr, envir, enclos) : object 'variable' not found Thank ypu in advance for any suggestions.

    Read the article

  • SOA & BPM Best of Oracle OpenWorld 2011

    - by JuergenKress
    Oracle OpenWorld 2011 is over – what important updates did you miss? Keynotes: Best of Oracle OpenWorld keynotes and general session is available on-demand: " + __flash__argumentsToXML(arguments,0) + "")); }' s_getswfurl='function () { return eval(instance.CallFunction("" + __flash__argumentsToXML(arguments,0) + "")); }' s_getcharset='function () { return eval(instance.CallFunction("" + __flash__argumentsToXML(arguments,0) + "")); }' s_getversion='function () { return eval(instance.CallFunction("" + __flash__argumentsToXML(arguments,0) + "")); }' s_getmovieid='function () { return eval(instance.CallFunction("" + __flash__argumentsToXML(arguments,0) + "")); }' s_getpageurl='function () { return eval(instance.CallFunction("" + __flash__argumentsToXML(arguments,0) + "")); }' s_getpagename='function () { return eval(instance.CallFunction("" + __flash__argumentsToXML(arguments,0) + "")); }' s_getaccount='function () { return eval(instance.CallFunction("" + __flash__argumentsToXML(arguments,0) + "")); }' s_gettrackclickmap='function () { return eval(instance.CallFunction("" + __flash__argumentsToXML(arguments,0) + "")); }' s_getdomindex='function () { return eval(instance.CallFunction("" + __flash__argumentsToXML(arguments,0) + "")); }' onomnitureunload='function () { return eval(instance.CallFunction("" + __flash__argumentsToXML(arguments,0) + "")); }' We recommend to watch: Oracle Cloud Computing Larry Ellison, CEO, Oracle Watch full-length keynote   Middleware General Session Hasan Rizvi, SVP, Oracle Watch full-length general session Presentations: All presentations are available online at the OpenWorld Content Catalog Product highlight: Was to launch of BPM Suite 11.1.1.5 Feature Pack Released and the Oracle Process Accelerators. For details please visit the Oracle BPM team blog and the Oracle SOA team blog.

    Read the article

  • executing perl code stored in a database?

    - by TheGNUGuy
    Hey everyone, Is it possible to save some perl code in a database then retrieve it using a select statement and then execute that perl code? I have tried using the eval() function but that doesn't seem to work. Here is what I'm trying right now and it doesn't seem to work: my $temp = $qryResults[0]; print $temp."\n"; eval{"$temp"}; the output is $con->Disconnect();exit; Thanks for the help!

    Read the article

  • Matching n parentheses in perl regex

    - by coding_hero
    Hi, I've got some data that I'm parsing in Perl, and will be adding more and more differently formatted data in the near future. What I would like to do is write an easy-to-use function, that I could pass a string and a regex to, and it would return anything in parentheses. It would work something like this (pseudocode): sub parse { $data = shift; $regex = shift; $data =~ eval ("m/$regex/") foreach $x ($1...$n) { push (@ra, $x); } return \@ra; } Then, I could call it like this: @subs = parse ($data, '^"([0-9]+)",([^:]*):(\W+):([A-Z]{3}[0-9]{5}),ID=([0-9]+)'); As you can see, there's a couple of issues with this code. I don't know if the eval would work, the 'foreach' definitely wouldn't work, and without knowing how many parentheses there are, I don't know how many times to loop. This is too complicated for split, so if there's another function or possibility that I'm overlooking, let me know. Thanks for your help!

    Read the article

  • Ruby - Possible to pass a block as a param as an actual block to another function?

    - by Markus O'Reilly
    This is what I'm trying to do: def call_block(in_class = "String", &block) instance = eval("#{in_class}.new") puts "instance class: #{instance.class}" instance.instance_eval{ block.call } end # --- TEST EXAMPLE --- # This outputs "class: String" every time "sdlkfj".instance_eval { puts "class: #{self.class}" } # This will only output "class: Object" every time # I'm trying to get this to output "class: String" though call_block("String") { puts "class: #{self.class}" } On the line where it says "instance.instance_eval{ block.call }", I'm trying to find another way to make the new instance variable run instance eval on the block. The only way I can think of to get it to do that is to pass instance_eval the original block, not as a variable or anything, but as a real block like in the test example. Any tips?

    Read the article

  • How to evaluate a custom math expression in Python

    - by taynaron
    I'm writing a custom dice rolling parser (snicker if you must) in python. Basically, I want to use standard math evaluation but add the 'd' operator: #xdy sum = 0 for each in range(x): sum += randInt(1, y) return sum So that, for example, 1d6+2d6+2d6-72+4d100 = (5)+(1+1)+(6+2)-72+(5+39+38+59) = 84 I was using regex to replace all 'd's with the sum and then using eval, but my regex fell apart when dealing with parentheses on either side. Is there a faster way to go about this than implementing my own recursive parsing? Perhaps adding an operator to eval?

    Read the article

  • Updating a popup window from source page

    - by Blem
    I have a list of people wrapped in a-tags with onclick for opening a popup window. That popup window contains a previous and next button that invoker a function in the parent window to get the previous/next a-tag and execute the onclick for it. nextAnchor.onclick(); This should update the popup window with the new persons info, but it doesn't update. Adding an alert("") right after makes it update. What i found searching is something about having to leaving the session before JavaScript will update the display and they suggested using setTimeout. Problem is i'm calling on a DOM element and i can't send it in to the setTimeout, so i ended up with setTimeout('eval("'+nextAnchor.getAttribute("onClick")+'")',10); So is there another way to make it update or a way of making the setTimeout use the onclick of a DOM element or is this an acceptable solution even though it uses eval?

    Read the article

  • JQuery getJSON - ajax parseerror

    - by JW
    I've tried to parse the following json response with both the JQuery getJSON and ajax: [{"iId":"1","heading":"Management Services","body":"<h1>Program Overview</h1><h1>January 29, 2009</h1>"}] I've also tried it escaping the "/" characters like this: [{"iId":"1","heading":"Management Services","body":"<h1>Program Overview <\/h1><h1>January 29, 2009<\/h1>"}] When I use the getJSON it dose not execute the callback. So, I tried it with JQuery ajax as follows: $.ajax({ url: jURL, contentType: "application/json; charset=utf-8", dataType: "json", beforeSend: function(x) { if(x && x.overrideMimeType) { x.overrideMimeType("application/j-son;charset=UTF-8"); } }, success: function(data){ wId = data.iId; $("#txtHeading").val(data.heading); $("#txtBody").val(data.body); $("#add").slideUp("slow"); $("#edit").slideDown("slow"); },//success error: function (XMLHttpRequest, textStatus, errorThrown) { alert("XMLHttpRequest="+XMLHttpRequest.responseText+"\ntextStatus="+textStatus+"\nerrorThrown="+errorThrown); } }); The ajax hits the error ans alerts the following: XMLHttpRequest=[{"iId":"1","heading":"Management Services","body":"<h1>Program Overview </h1><h1>January 29, 2009</h1>"}] textStatus=parseerror errorThrown=undefined Then I tried a simple JQuery get call to return the JSON using the following code: $.get(jURL,function(data){ var json = eval("("+data+");"); wId = json.iId; $("#txtHeading").val(json.heading); $("#txtBody").val(json.body); $("#add").slideUp("slow"); $("#edit").slideDown("slow"); }) The .get returns the JSON, but the eval comes up with errors no matter how I've modified the JSON (content-type header, other variations of the format, etc.) What I've come up with is that there seem to be an issue returning the HTML in the JSON and getting it parsed. However, I have hope that I may have missed something that would allow me to get this data via JSON. Does anyone have any ideas?

    Read the article

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