compare_oracle / oraclechunk29.json
xPXXX's picture
Upload 10 files
b34f274
Raw
History Blame Contribute Delete
25.6 kB
Invalid JSON:Unexpected non-whitespace character after JSONat line 2, column 1
{"QuestionId": 20652487, "AnswerCount": 3, "Tags": "<php>", "CreationDate": "2013-12-18T07:54:16.847", "AcceptedAnswerId": "20654194", "Title": "move_uploaded_file permission denied", "Body": "<p>I'm getting error in uploading image to directory folder named <code>images</code>. Though I created a folder <code>images</code>. </p>\n\n<p>Error Occur</p>\n\n<pre><code>1. Warning: move_uploaded_file(images/Rachel Leigh Cook.jpg): failed to open stream: \n2. Permission denied in /usr/home/mer/public_html/salico/ZNote/php/image_upload_do.php \n3. Unable to move '/var/tmp/phpGV5fVF' to 'imagesRachel Leigh Cook.jpg' in \n /usr/home/mer/public_html/salico/ZNote/php/image_upload_do.php \n</code></pre>\n\n<p>My code </p>\n\n<pre><code>$upfile = ( isset( $_FILES['userfile'] ) ) ? $_FILES['userfile'] : '' ;\n\nif ( is_array( $upfile ) ) {\n\n $file_name = $upfile['name'];\n $file_temp = $upfile['tmp_name'];\n\n $dir_file = 'images/'.$file_name;\n\n if ( is_uploaded_file( $file_temp ) ) {\n\n if ( move_uploaded_file( $file_temp, $dir_file ) ) {\n echo 'Successfully Uploaded';\n } else {\n echo 'Failed to upload';\n }\n }\n}\n</code></pre>\n\n<p>I think there is nothing wrong in my code. Do I need to edit the <code>php.ini</code> file?</p>\n", "Lable": "No"}
{"QuestionId": 20657028, "AnswerCount": 1, "Tags": "<android>", "CreationDate": "2013-12-18T11:33:08.560", "AcceptedAnswerId": null, "Title": "R-generate private Key from Fingerprint - android signature", "Body": "<p>im using </p>\n\n<pre><code>androiddebugkey, PrivateKeyEntry,\nCertificate fingerprint (SHA1): 68:1F:B8:80:C0:B9:96:D1:6E:95:86:69:CD:DB:0E:28:DC:9E:89:51\n</code></pre>\n\n<p>is there a way to reverese and generate private key from fingerprint to sgin andriod new release with correct key that in production play store , </p>\n", "Lable": "No"}
{"QuestionId": 20730666, "AnswerCount": 1, "Tags": "<windows-phone-8><monogame><cocos2d-x-for-xna>", "CreationDate": "2013-12-22T14:54:58.157", "AcceptedAnswerId": "29146011", "Title": "Cocos2d-XNA: How to integrate MonoGame", "Body": "<p>I have a confusion regarding Cocos2d-XNA.\nIs it already have MonoGame in it? If not, how do I combine those two?\nIf yes, what is the role of Cocos2d-XNA and what is the role of MonoGame?</p>\n\n<p>I tried to look for both website but not able to find these information.</p>\n\n<p>If needed: I'm trying to build a game in WP8.</p>\n", "Lable": "No"}
{"QuestionId": 20758103, "AnswerCount": 3, "Tags": "<python><class><object>", "CreationDate": "2013-12-24T09:18:08.943", "AcceptedAnswerId": "20758187", "Title": "Delete a Python object and make it point to None", "Body": "<p>Here is my class definition :</p>\n\n<pre><code>class Playingsound:\n def ___init___(self):\n # blah\n\n def fadeout_and_stop(self):\n # do somthing (fadeout during 100 ms)\n del self\n</code></pre>\n\n<p>Here is my problem (similar to that one : <a href=\"https://stackoverflow.com/questions/293431/python-object-deleting-itself\">Python object deleting itself</a>) :</p>\n\n<pre><code>&gt;&gt;&gt; a = Playingsound()\n&gt;&gt;&gt; time.sleep (1.0)\n&gt;&gt;&gt; a.fadeout_and_stop()\n&gt;&gt;&gt; time.sleep (1.0) # after 1 second, the playback should be finished !\n&gt;&gt;&gt; a\n&lt;__main__.Playingsound instance at 0x01F23170&gt;\n</code></pre>\n\n<p>Instead of this, I would like <code>a</code> to be totally destroyed after the call of <code>fadeout_and_stop</code>, and its reference to be <code>None</code> :</p>\n\n<pre><code>&gt;&gt;&gt; a\n&lt;None&gt;\n</code></pre>\n\n<p>How to do this with Python ?</p>\n", "Lable": "No"}
{"QuestionId": 20847312, "AnswerCount": 1, "Tags": "<ios><objective-c><nsstring><nsdate><nsdateformatter>", "CreationDate": "2013-12-30T20:49:10.373", "AcceptedAnswerId": "20847382", "Title": "Combined date and time in objective c", "Body": "<p>I am using Gdata library for my iPhone app and getting the Google events but Google is returning me date as <strong>2014-01-02T13:00:00-06:00</strong>. It's a string.</p>\n\n<p>How can I get the \"<strong>2014-01-02</strong>\" and \"<strong>13:00</strong>\" in separate strings?</p>\n\n<p>Thanks</p>\n", "Lable": "No"}
{"QuestionId": 20885975, "AnswerCount": 2, "Tags": "<printing><label><zpl>", "CreationDate": "2014-01-02T15:18:38.687", "AcceptedAnswerId": "20886843", "Title": "Can't define label length - ZPL (RW 220)", "Body": "<p>fellows,</p>\n\n<p>what I'm trying to do should be simple: to print an example label from ZPL II Programming Guide. But no matter what I write, the label is always printed with 40mm length. </p>\n\n<p>This is the code: </p>\n\n<pre><code>^XA\n^LH0,30\n^FO20,10^AD^FDVERSUL^FS\n^XZ\n</code></pre>\n\n<p>I tried changing the label's settings in the printer's properties, tried to add the ^LL command, set units to dots. I'm using the console from Zebra Setup Utilities, and I've already changed the language to ZPL. Nothing changed. </p>\n\n<p>Do you know what I'm doing wrong or if is there any other place I should change the label's settings?</p>\n\n<p>BTW: the printer is working fine in CPCL mode, it looks like it's something regarding ZPL's configuration.</p>\n\n<p>Thanks in advance.</p>\n", "Lable": "No"}
{"QuestionId": 20931792, "AnswerCount": 1, "Tags": "<c++><linux><qt><qmake><qtgui>", "CreationDate": "2014-01-05T09:01:05.767", "AcceptedAnswerId": "20931889", "Title": "Porting and running a simple Qt Program to FriendlyARM-embedded devices", "Body": "<p>As you know, the major source for downloading QT is \n <a href=\"http://qt-project.org/downloads\" rel=\"nofollow\">http://qt-project.org/downloads</a>.</p>\n\n<p>Before Qt 5.0, there was a link for Qt for Embedded Linux, for example:\n qt-everywhere-opensource-src-4.8.5.tar.gz</p>\n\n<p>I assumed it's somehow a replacement for Qtopia. Also, I assumed the 'everywhere' means 'embedded'.\nAre my assumptions correct?</p>\n\n<p>If my assumptions are right, is it OK to use the above everywhere version instead of old Qtopia? </p>\n\n<p>another problem is: I configured the Qtopia to build libraries statically (using default -shared) then I built it and installed it successfully.</p>\n\n<p>Now I at host computer I have Qtopia 4.3.5 embedded ARM software at the following default path:\n/usr/local/Trolltech/QtopiaCore4.3.5embedded-arm</p>\n\n<p>Q: Why there are no designer program at /bin directory.</p>\n\n<p>I just have the following binaries:\nmoc, qmake, rcc, uic\nthen I wrote a typical hello world Qt with QApplication and QLabel classes:</p>\n\n<pre><code> #include &lt;QApplication&gt;\n #include &lt;QLabel&gt;\n\n int main(argc, char* argv[])\n {\n QApplication app(argc, argv);\n QLabel Hello(\"Hello\");\n Hello.show();\n return app.exec(); \n }\n</code></pre>\n\n<p>I compiled this code with newly installed qmake and it's totally OK.\nIf the name of binary is qt_hello, I have the following output:</p>\n\n<p># file qt_hello</p>\n\n<p>ELF 32-bit LSB executable, ARM, version 1(SYSV), dynamically linked (use shared libs),\n for GNU/Linux 2.6.32, not stripped</p>\n\n<p>Now, when I port the binary to ARM embedded device board (using flash disk USB),\nand run it, I have the following output:</p>\n\n<p># ./qt_hello\nerror while loading shared libraries: libQtGui.so.4: cannot open shared object file: no such file or directory.</p>\n\n<p>based on error message, I guess, I should configure tries to configure Qtopia again with -static option. I used the following\ncommand:\n<code>./configure -embedded arm -xplatform qws/linux-arm-g++ -depths 16,3 -nomake examples<br>\n -nomake tests -static</code>\nafter a couple of hours, the software was configured, built and installed successfully,\nafter qmaking my hello program, unfortunately it's linked shared and I had above errors\non ARM embedded device?</p>\n\n<p>Am I miss something? Please shed some light.</p>\n\n<p>FYI, the Qtopia4.6.3 is installed on the ARM Embedded device</p>\n\n<p>-- Saeed Amrollahi Boyouki</p>\n", "Lable": "No"}
{"QuestionId": 21008691, "AnswerCount": 2, "Tags": "<macos><opengl><haskell><glut>", "CreationDate": "2014-01-08T23:21:38.480", "AcceptedAnswerId": "21373994", "Title": "Haskell openGL and GLUT freeze on Mac OS X? Can I use GLFW over GLUT?", "Body": "<p>I am trying to do graphics in Haskell and have been using Haskell.org's tutorial (<a href=\"http://www.haskell.org/haskellwiki/OpenGLTutorial1\" rel=\"nofollow\">http://www.haskell.org/haskellwiki/OpenGLTutorial1</a>). However, when I attempt to execute the following code (this code was taken DIRECTLY from the linked tutorial above):</p>\n\n<pre><code>import Graphics.UI.GLUT\n\nmain :: IO ()\nmain = do\n (_progName, _args) &lt;- getArgsAndInitialize\n _window &lt;- createWindow \"Hello World\"\n displayCallback $= display\n mainLoop\n\ndisplay :: DisplayCallback\ndisplay = do\n clear [ ColorBuffer ]\n flush\n</code></pre>\n\n<p>Everything successfully compiles but upon actually running the \"main\", a white, ghc window opens and immediately freezes. I have tried using other code from this tutorial but to no avail. I am running OS X 10.8.5 and using EclipseFP. Is this a MAC only problem?</p>\n", "Lable": "No"}
{"QuestionId": 21054275, "AnswerCount": 1, "Tags": "<php>", "CreationDate": "2014-01-10T20:57:27.210", "AcceptedAnswerId": null, "Title": "Is it possible to use a string variable as the entire condition in an if block (without using eval() )?", "Body": "<p>As background, I'm writing php code that parses csv files and does something with each row of each csv file. What that \"something\" is depends on the values in the row. It's easy to test the values with an \"if\" structure, however, hardcoding the conditions is not optimal for two reasons:</p>\n\n<ol>\n<li><p>there are several hundred possible conditions to be tested. That's just to begin with. More conditions will be added in the future.</p></li>\n<li><p>Each csv row does not need to be tested for each condition; as soon as a condition for a row evaluates to true, no further conditions need be evaluated. </p></li>\n</ol>\n\n<p>Ideally, for my situation, the \"if\" conditions would be stored in a postgres table, put into a string variable one by one, and then each variable would tested by a single if structure (inside a loop of some kind) until a condition evaluates to true.</p>\n\n<p>Simplified example:</p>\n\n<pre><code>$arrayOne[3] = \"foo\";\n\n// in practice, the value of this variable would not be hard-coded;\n// it would come from a postgres table\n$conditionString=\"\\$arrayOne[3] == \\\"VANILLA\\\"\";\n\nif($conditionString) {\n // do something, then exit the loop this if statement would be\n // inside of in actual practice\n}\n</code></pre>\n\n<p>This question was essentially asked at</p>\n\n<p><a href=\"https://stackoverflow.com/questions/3191911/php-if-condition-inside-string\">PHP - if condition inside string</a></p>\n\n<p>There were three basic answers:</p>\n\n<ol>\n<li>You could use eval(), but DON'T! It's evil! (agreed)</li>\n<li>Hard-code all the conditions (not optimal for reasons provide above and others)</li>\n<li>Store the conditions in a schema (which is what I'm doing) and then parse and convert to php code.</li>\n</ol>\n\n<p>Solution 3 is generally what I'm looking for, but second part seems inefficient and unnecessarily complex. After all, why build up php code from numerous strings (of an unknown number, by the way, which complicates storage in postgres) when it seems so much easier to just store and then evaluate the single string you need?</p>\n\n<p>Is there a way to do that?</p>\n\n<p>Many thanks for the responses so far. ComFreek, thanks to you in particular for the detailed response. The solution you suggest may be just what I need, but frankly, I don't have the experience to know immediately if that's the case. I'll definitely spend time trying to understand what you're saying. Hopefully, it will solve my problem.</p>\n\n<p>In case it doesn't, and in the meantime, to answer a few questions others asked:</p>\n\n<p>1) the if conditions will not usually be simple. Many will contain multiple and compound AND and OR tests. A sample condition, in pseudo-code, might be: ( field2==\"BUY\" AND ( strpos(\"REINVEST DIVIDEND\", field6) OR strpos(\"CASH MERGER, field6) ) AND field2!=\"TTXY\" AND field3>0 ).</p>\n\n<p>2) The CSV files come from numerous financial institutions. They contain much the same information, but each has unique data, and all of them have the data in different locations. What's more they express the data differently. In some, a payment is indicated by a negative number; in others, by a positive number. Some have separate fields for deposits and withdrawals; some indicate deposits and withdrawals with a code in another column. And so on. The code needs to determine the nature of the transaction (credit card purchase, check, stock buy or sell, retirement contribution, and on and on) and then, if it can, assign the correct debit/credit account numbers (from a chart of accounts) to that transaction. Altogether, there are hundreds of possible conditions, likely to become thousands. (In case anyone is wondering, the code can determine the institution a particular csv file comes from and will test the transactions in that file only against conditions relevant to that institution.)</p>\n\n<p>3) The code needs to be flexible enough to easily (in other words, without having to write new code) allow for new tests to be added in the future. For me, being able to add a new condition to a postgres table (which will then be another test for the code to check) is sufficient flexibility.</p>\n\n<p>To try to answer Phil's questions and comments (which I may not be understanding correctly):</p>\n\n<p>1) I know what preg_match is, but haven't really explored what it can do, so it may in fact be the answer to my problem. I'll check it out.</p>\n\n<p>2) currently, the code does not group transactions (which is to say a single row from a single csv file); rather, it looks at each row, determines what it is, then stores it an additional data in appropriate postgres tables, then moves to the next row. There are certain \"types\" of transactions (say credit card purchases) but they're never grouped for further processing.</p>\n\n<p>3) Each transaction should satisfy one and only condition (though that condition may be complex).</p>\n\n<p>4) With regard to matching the entire string, unless I'm missing something (very possible), it's not that simple. For example, let's say a given transaction is a stock purchase. The code can determine that by seeing that \"action\" field contains the word \"Buy\" AND the \"quantity\" field is greater than zero (one or the other of these conditions alone might not be enough to be certain the transaction is a stock purchase), but the \"ticker\" field could be any of thousands of strings that aren't known in advance--\"GOOG\", \"MSFT\", \"KO\" or whatever.</p>\n\n<p>Again, thanks to all for the responses so far.</p>\n", "Lable": "No"}
{"QuestionId": 21076453, "AnswerCount": 1, "Tags": "<php><mysql><arrays>", "CreationDate": "2014-01-12T15:25:16.840", "AcceptedAnswerId": null, "Title": "MySQL query returns images in a grid", "Body": "<p>In my code I use this MySQL query:</p>\n\n<pre><code> $qry=\"SELECT ServiceIcon FROM Services INNER JOIN UserServices ON UserServices.ServiceID=Services.ServiceID WHERE UserServices.UserID=$_SESSION[SESS_MEMBER_ID]\";\n $result=mysql_query($qry);\n\n header(\"Content-type: image/png\");\n echo mysql_result($result,0);\n</code></pre>\n\n<p>I want these images to be displayed in a grid of 3 icons wide. Currently they're displayed on top of each other however. So I should echo an like this:</p>\n\n<pre><code>echo '&lt;ul&gt;';\nforeach ($images as $image) {\necho '&lt;li&gt;&lt;img src=\"' . $image['src'] . '\" id=\"' . $image['id'] . '\" /&gt;&lt;/li&gt;';\n}\n\necho '&lt;/ul&gt;';\n</code></pre>\n\n<p>What I don't understand is how I should incorporate into my code. Or maybe my code is not even the right way to do it. Please help me out.</p>\n\n<p>EDIT: So this is the complete file in question:</p>\n\n<pre><code>&lt;?php\n session_start(); \n include \"connection.php\";\n // just so we know it is broken\n error_reporting(E_ALL);\n // some basic sanity checks\n\n $qry=\"SELECT ServiceIcon FROM Services INNER JOIN UserServices ON UserServices.ServiceID=Services.ServiceID WHERE UserServices.UserID=$_SESSION[SESS_MEMBER_ID]\";\n $result=mysql_query($qry);\n\n header(\"Content-type: image/png\");\n\n\n?&gt;\n&lt;html&gt;\n&lt;head&gt;\n&lt;style&gt;\nul.horizontal-display {\nmargin: 0;\npadding: 0;\n}\n\nul.horizontal-display li {\nlist-style: none;\ndisplay: inline-block;\n}\n&lt;/style&gt;\n&lt;/head&gt;\n&lt;body&gt;\n&lt;?php\necho '&lt;ul class=\"horizontal-display\"&gt;';\nforeach ($images as $image) {\necho '&lt;li&gt;&lt;img src=\"' . $result . '\" id=\"' . $image['id'] . '\" /&gt;&lt;/li&gt;';\n}\n\necho '&lt;/ul&gt;';?&gt;\n&lt;/body&gt;\n&lt;/html&gt;\n</code></pre>\n", "Lable": "No"}
{"QuestionId": 21085915, "AnswerCount": 1, "Tags": "<c++><opencv><flann>", "CreationDate": "2014-01-13T07:25:56.177", "AcceptedAnswerId": null, "Title": "what type of data does flann index need by using LshIndexParams?", "Body": "<p>I want to use LSH to speed up the searching,and i found in opencv flann can do this,by using LshIndexParams? The problem is i cannot get the format right. i use bag of words to generate a \nmat output and feed it to flann, but i get errors all the time.</p>\n\n<pre><code>OpenCV Error: Unsupported format or combination of formats (type=2\n</code></pre>\n\n<p>) in buildIndex_, file /home/vampire/opencv-2.4.8/modules/flann/src/miniflann.cpp, line 315\nterminate called after throwing an instance of 'cv::Exception'\n what(): /home/vampire/opencv-2.4.8/modules/flann/src/miniflann.cpp:315: error: (-210) type=2\n in function buildIndex_</p>\n\n<p>part of the code likes this:</p>\n\n<pre><code> Mat img_BOWdescriptor=BOW_descriptors(path);\ncout&lt;&lt;img_BOWdescriptor&lt;&lt;endl;\nimg_BOWdescriptor.convertTo(img_BOWdescriptor,img_BOWdescriptor.rows,img_BOWdescriptor.cols,CV_32F);\ncout&lt;&lt;img_BOWdescriptor&lt;&lt;endl;\ncout&lt;&lt;\"done\"&lt;&lt;endl;\n\ncout&lt;&lt;\"ini flann index......\"&lt;&lt;endl;\nMat indices = Mat(img_BOWdescriptor.rows, 1, CV_32S);\nMat dist = Mat(img_BOWdescriptor.rows, 1, CV_32F);\ndescriptors_all.convertTo(descriptors_all,descriptors_all.rows,descriptors_all.cols,CV_32F);\n\nflann::Index* flann_index=new flann::Index(descriptors_all,flann::LshIndexParams(20,10,2));\ncout&lt;&lt;\"done\"&lt;&lt;endl;\ndouble t=(double)getTickCount();\n\ncout&lt;&lt;\"flann matching......\"&lt;&lt;endl;\nflann_index-&gt;knnSearch(img_BOWdescriptor, indices, dist, 1,flann::SearchParams(32));\n</code></pre>\n\n<p>and i also tried to convert to other type, no one works, does any one know how to do it?\nand after i get result,how can i know if it matches?</p>\n", "Lable": "No"}
{"QuestionId": 21115121, "AnswerCount": 4, "Tags": "<shell>", "CreationDate": "2014-01-14T13:47:06.523", "AcceptedAnswerId": "21115356", "Title": "How to check pattern match by using /bin/sh, not by /bin/bash", "Body": "<p>I'm using Ubuntu system shell, not bash, and I found the regular way can not work:</p>\n\n<pre><code>#!/bin/sh\nstring='My string';\n\nif [[ $string =~ .*My.* ]]\nthen\n echo \"It's there!\"\nfi\n</code></pre>\n\n<p>error [[: not found!</p>\n\n<p>What can I do to solve this problem?</p>\n", "Lable": "No"}
{"QuestionId": 21180213, "AnswerCount": 2, "Tags": "<angularjs><restangular>", "CreationDate": "2014-01-17T07:29:59.710", "AcceptedAnswerId": "21180439", "Title": "RESTAngular PUT not saving entire payload", "Body": "<p>I am trying to make a PUT request using RESTAngular. I am fairly new to Angular as well as RESTAngular.</p>\n\n<h3>Following is code snippet which works.</h3>\n\n<pre><code>$scope.itemToUpdate = Restangular.all($scope.slug);\n$scope.itemToUpdate.getList().then(function(items){\n var item = items.one($routeParams.id);\n item.name = $scope.singular.name;\n item.description = $scope.singular.description;\n item.put();\n});\n</code></pre>\n\n<h3>This doesn't work.</h3>\n\n<pre><code> $scope.itemToUpdate = Restangular.all($scope.slug);\n $scope.itemToUpdate.getList().then(function(items){\n var item = items.one($routeParams.id);\n item = $scope.singular;\n item.put();\n });\n</code></pre>\n\n<p>Don't know what am I doing wrong.</p>\n\n<p><code>$scope.singular</code> gets it data initially as following. <code>Restangular.one('roles', $routeParams.id).getList().$object</code>.</p>\n\n<p>Basically idea is to update this model from form and also prepopulate the form with relevant data when slug matches the id. I can change the way things are wired up if required. So feel free to suggest best practices.</p>\n\n<h3>Edit 2</h3>\n\n<p>This official demo is very helpful in solving the issue.\n<a href=\"http://plnkr.co/edit/d6yDka?p=preview\" rel=\"nofollow\">http://plnkr.co/edit/d6yDka?p=preview</a> </p>\n", "Lable": "No"}
{"QuestionId": 21182113, "AnswerCount": 2, "Tags": "<c#><xml><linq><xml-parsing><linq-to-xml>", "CreationDate": "2014-01-17T09:22:31.577", "AcceptedAnswerId": "21185755", "Title": "Querying XML and updating certain elements", "Body": "<p>I have an XML file in the following format</p>\n\n<pre><code>&lt;?xml version=\"1.0\" ?&gt;\n&lt;AA someattrib=\"xyz\"&gt;\n &lt;BB someOtherAttrib=\"xyz\"&gt;\n &lt;Title&gt;&lt;/Title&gt;\n &lt;CC&gt;\n\n &lt;myNode rowid=\"\"&gt;\n &lt;subNode1&gt;&lt;/subNode1&gt;\n &lt;subNode2&gt;&lt;/subNode2&gt;\n &lt;nodeOfInterest&gt;&lt;/nodeOfInterest&gt;\n &lt;/myNode &gt;\n &lt;myNode rowid=\"\"&gt;\n &lt;subNode1&gt; &lt;/subNode1&gt;\n\n &lt;/myNode&gt;\n &lt;/CC&gt;\n &lt;/BB&gt;\n&lt;/AA&gt;\n</code></pre>\n\n<p>I want to use Linq to pick out one node by the name 'MyNode' where the rowid is a particular number that I will be getting from a collection in an object. Once I get myNode I want to update the value of the child nodeOfInterest if it is present. If not present, then I would like to add it. Once done I want to save the file.</p>\n\n<p>This is what I have at the moment but it may not be the right approach.</p>\n\n<pre><code> foreach (User employee in Users)\n {\n\n XPathNavigator node = xNav.SelectSingleNode(\"/AA/BB/CC/myNode[@rowid = '\"+employee.ID.ToString()+\"']\");\n XPathNodeIterator nodeIterator= node.SelectChildren(\"nodeOfInterest\", \"\");\n if (nodeIterator.Count == 1)\n {\n\n }\n else\n {\n }\n\n }\n</code></pre>\n\n<p>Is there a way this can be done using a direct join between the List and the xmldoc in memory? This will be a large list and an equally large xml file. I dont think running a loop and calling selectSingleNode is the most efficient way.</p>\n\n<p>Thanks for your inputs</p>\n", "Lable": "No"}
{"QuestionId": 21253166, "AnswerCount": 8, "Tags": "<javascript><php><jquery><html><xss>", "CreationDate": "2014-01-21T08:48:17.723", "AcceptedAnswerId": "21253518", "Title": "Can someone edit javascript file offline to run malicious code?", "Body": "<p>I am worried about something related to javascript files of my website, I am not sure if this is doable.</p>\n\n<p>Js files will be downloaded when someone visits a website, what if someone edited the downloaded js script and inserted his own code, then refreshed the website. In the new refresh the website will read the edited Js file and will run the malicious code. The malicious code might be used to run some code at the server in normal ways.</p>\n\n<p><strong>Example:</strong></p>\n\n<p>A user is only allowed to post an article in his page:</p>\n\n<p><strong>HTML</strong></p>\n\n<p>Article form will only show for the user in his page.</p>\n\n<pre><code>&lt;?php\nif( $user-&gt;id == $page-&gt;userID )\n{\n?&gt; \n&lt;form&gt;\n&lt;h1&gt;Add new article:&lt;/h1&gt;&lt;br /&gt;\n&lt;textarea name=\"articleText\" cols=\"65\" rows=\"3\"&gt;&lt;/textarea&gt;\n&lt;input class=\"SubmitArticle\" id=\"&lt;?php echo $userPage-&gt;id; ?&gt;\" name=\"SubmitArticle\" type=\"button\" value=\"Submit article\" /&gt;\n&lt;/form&gt;\n&lt;?php\n}\n?&gt;\n</code></pre>\n\n<p><strong>Javascript</strong></p>\n\n<pre><code>$(\".SubmitArticle\").click( function(e){\n var targetPage = $(this).attr('id');\n var thisForm = $(this).parent();\n var postData = thisForm.serialize() + \"&amp;targetPage=\" + targetPage;\n\n $.post(document.location, postData, function(data) {\n $('#mainDiv').html(data);\n });\n});\n</code></pre>\n\n<p><strong>PHP</strong></p>\n\n<pre><code>if( isset($_POST[\"SubmitArticle\"]) )\n{\n $pageID = $_POST[\"targetPage\"];\n $text = $_POST[\"articleText\"];\n\n PublishArticle( $pageID , $text );\n}\n</code></pre>\n\n<p><strong>Malicious Code:</strong></p>\n\n<p>Code inserted in JS file to write article on other users pages (which is not allowed), the attacker reads page id from html element using view page source (lets say page_id=12):</p>\n\n<pre><code>postData = \"SubmitArticle=1&amp;targetPage=12&amp;articleText='Muwhahahah'\";\n$.post(document.location, postData, function(data) {\n});\n</code></pre>\n\n<p>What is the solution if this is possible?</p>\n", "Lable": "No"}