Invalid JSON:Unexpected non-whitespace character after JSONat line 2, column 1
| {"QuestionId": 3016223, "AnswerCount": 4, "Tags": "<c#><security><directory>", "CreationDate": "2010-06-10T16:10:54.273", "AcceptedAnswerId": "3016704", "Title": "How to determine if a directory path was SUBST'd", "Body": "<p>How can I figure out if a file is in a folder that has been <a href=\"https://ss64.com/nt/subst.html\" rel=\"nofollow noreferrer\">SUBST'ed</a> or is located in a user folder using C#?</p>\n", "Lable": "No"} | |
| {"QuestionId": 3019400, "AnswerCount": 1, "Tags": "<ruby-on-rails><xml-serialization>", "CreationDate": "2010-06-11T00:05:17.670", "AcceptedAnswerId": "3019419", "Title": "Customizing Rails XML rendering to include extra properties", "Body": "<p>Let's say I have a model like this:</p>\n\n<pre><code>create_table :ninjas do |t|\n t.string name\nend\n</code></pre>\n\n<p>And the Ninja class with an extra property:</p>\n\n<pre><code>class Ninja < ActiveRecord::Base\n def honorific\n \"#{name}san\"\n end\nend\n</code></pre>\n\n<p>And in my controller I just want to render it to XML:</p>\n\n<pre><code>def show\n render :xml => Ninja.find(params[:id])\nend\n</code></pre>\n\n<p>The honorific part isn't rendered. That makes sense, since it's just a method, but is there a way of tricking it? </p>\n\n<p>I'm totally up for answers to the effect of, \"You're doing this totally wrong.\" I'll just add that I really do want to calculate the honorific on the fly, and not, like, store it in the database or something.</p>\n", "Lable": "No"} | |
| {"QuestionId": 3048949, "AnswerCount": 1, "Tags": "<reporting-services>", "CreationDate": "2010-06-15T20:56:35.850", "AcceptedAnswerId": null, "Title": "Can I get a tab to display in a rendered report?", "Body": "<p>I have built an RDL report and after rendering any tab characters contained within my returned data do not appear in the generated report. Is it possible to display tab characters? (Users want to have the basic formatting of their 'comments' field to appear.) Tabs added to the rdl itself are maintained, but those in the data seemed to be stripped out by the rendering engine.</p>\n", "Lable": "No"} | |
| {"QuestionId": 3118401, "AnswerCount": 3, "Tags": "<cocoa-touch><ipad><uiwebview><uipopovercontroller>", "CreationDate": "2010-06-25T13:34:24.707", "AcceptedAnswerId": null, "Title": "iPad UIWebView position a UIPopoverController view at a href link coords", "Body": "<p>I'm hoping that this question isn't a stupid one but how does one go about positioning a UIPopoverController view over a UIWebView so that the popup view arrow points at the UIWebView link that was clicked to show it?</p>\n\n<p>I'm using the delegate method;</p>\n\n<pre><code>-(BOOL) webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType {\nif ( [[[inRequest URL] absoluteString] hasPrefix:@\"myscheme:\"] ) {\n//UIPopoverController stuff here\nreturn NO;\n}\n</code></pre>\n\n<p>}</p>\n\n<p>to capture and route the click but I'm unsure how to get the link coords to position the popup view.</p>\n\n<p>Any help or pointer to relevant info would be very much appreciated.</p>\n", "Lable": "No"} | |
| {"QuestionId": 3119409, "AnswerCount": 1, "Tags": "<iphone>", "CreationDate": "2010-06-25T15:44:32.863", "AcceptedAnswerId": null, "Title": "sandboxd Notice: deny file-write-data", "Body": "<p>I am working through some crash logs and keep seeing messages like this one:</p>\n\n<p>Fri Jun 25 09:09:01 unknown sandboxd[427] : MyApp(422) deny file-write-data /private/var/mobile/Media/PhotoData</p>\n\n<p>Am I doing something wrong that is causing this? This one has to do with taking photos from within the app, but I have seen others in parts of my app as well.</p>\n\n<p>As far as I can tell I am seeing no errors in my app and am not trying to write to the device outside my sandbox area.</p>\n\n<p>Thanks for any help you can provide.</p>\n", "Lable": "No"} | |
| {"QuestionId": 3121597, "AnswerCount": 2, "Tags": "<json><rest><web-services><cxf>", "CreationDate": "2010-06-25T21:34:44.337", "AcceptedAnswerId": "3121657", "Title": "How to handle REST Exceptions?", "Body": "<p>We are in the middle of a ongoing discussion about how to handle REST exceptions.</p>\n\n<p>Response Content type : JSON</p>\n\n<p>Two solutions we have:</p>\n\n<ol>\n<li>Throw all the unchecked exceptions as a JSON response.</li>\n<li>Send Request Invalid Response code.</li>\n</ol>\n\n<p>Arguments:</p>\n\n<ul>\n<li>When its a error, why return JSON? Just send a invalid response code.</li>\n</ul>\n\n<p>Counter Argument:</p>\n\n<ul>\n<li>Response code are too technical to handle for normal developers.</li>\n</ul>\n\n<p>Whats your say??</p>\n", "Lable": "No"} | |
| {"QuestionId": 3160829, "AnswerCount": 3, "Tags": "<programming-languages><text><compression><language-design><text-processing>", "CreationDate": "2010-07-01T18:58:48.563", "AcceptedAnswerId": "3781015", "Title": "Identifying frequent formulas in a codebase", "Body": "<p>My company maintains a domain-specific language that syntactically resembles the Excel formula language. We're considering adding new builtins to the language. One way to do this is to identify verbose commands that are repeatedly used in our codebase. For example, if we see people always write the same 100-character command to trim whitespace from the beginning and end of a string, that suggests we should add a <code>trim</code> function.</p>\n\n<p>Seeing a list of frequent substrings in the codebase would be a good start (though sometimes the frequently used commands differ by a few characters because of different variable names used).</p>\n\n<p>I know there are well-established algorithms for doing this, but first I want to see if I can avoid reinventing the wheel. For example, I know this concept is the basis of many compression algorithms, so is there a compression module that lets me retrieve the dictionary of frequent substrings? Any other ideas would be appreciated.</p>\n", "Lable": "No"} | |
| {"QuestionId": 3236070, "AnswerCount": 1, "Tags": "<java><android><audio>", "CreationDate": "2010-07-13T10:04:09.063", "AcceptedAnswerId": "3236661", "Title": "Sound works on HTC Desire but not on T-Mobile G1", "Body": "<p>I defined the following Sound Class to play Sound in my Pacman Game:</p>\n\n<pre><code>public class Sound {\n\n private static boolean sound = true;\n\n private static MediaPlayer eatSound;\n private static MediaPlayer shortEatSound;\n private static MediaPlayer eatCherry;\n private static MediaPlayer eatGhost;\n private static MediaPlayer extraLive;\n private static MediaPlayer intermission;\n private static MediaPlayer openingSound;\n private static MediaPlayer pacmanDiesSound;\n private static MediaPlayer sirenSound;\n\n public static void initializeOpenSound(Context context) {\n openingSound = MediaPlayer.create(context, R.raw.opening_song);\n }\n\n public static void initializeSounds(Context context) {\n eatSound = MediaPlayer.create(context, R.raw.eating);\n shortEatSound = MediaPlayer.create(context, R.raw.eating_short);\n eatCherry = MediaPlayer.create(context, R.raw.eating_cherry);\n eatGhost = MediaPlayer.create(context, R.raw.eating_ghoasts);\n extraLive = MediaPlayer.create(context, R.raw.extra_lives);\n intermission = MediaPlayer.create(context, R.raw.intermission);\n pacmanDiesSound = MediaPlayer.create(context, R.raw.pac_man_dies);\n sirenSound = MediaPlayer.create(context, R.raw.siren);\n }\n\n public static int getOpeningSoundDuration() throws SoundInitializationError {\n if (openingSound != null) {\n return openingSound.getDuration();\n } else {\n throw new SoundInitializationError(\"Opening Sound not initialized!\");\n }\n }\n\n public static void playSirenSound() throws SoundInitializationError {\n if (isSoundOn()) {\n if (sirenSound != null) {\n sirenSound.start();\n } else {\n throw new SoundInitializationError(\"Siren Sound not initialized!\");\n }\n }\n }\n\n public static void playPacmanDiesSound() throws SoundInitializationError {\n if (isSoundOn()) {\n if (pacmanDiesSound != null) {\n pacmanDiesSound.start();\n } else {\n throw new SoundInitializationError(\"Pacman Dies Sound not initialized!\");\n }\n }\n }\n\n public static void playOpeningSound() throws SoundInitializationError {\n if (isSoundOn()) {\n if (openingSound != null) {\n openingSound.setLooping(true);\n openingSound.start();\n } else {\n throw new SoundInitializationError(\"Opening Sound not initialized!\");\n }\n }\n }\n\n public static void playIntermissionSound() throws SoundInitializationError {\n if (isSoundOn()) {\n if (intermission != null) {\n intermission.start();\n } else {\n throw new SoundInitializationError(\"Intermission Sound not initialized!\");\n }\n }\n }\n\n public static void playExtraLiveSound() throws SoundInitializationError {\n if (isSoundOn()) {\n if (extraLive != null) {\n extraLive.start();\n } else {\n throw new SoundInitializationError(\"Extra Live Sound not initialized!\");\n }\n }\n }\n\n public static void playEatSound() throws SoundInitializationError {\n if (isSoundOn()) {\n if (eatSound != null) {\n eatSound.start();\n } else {\n throw new SoundInitializationError(\"Eat Sound not initialized!\");\n }\n }\n }\n\n public static void playShortEatSound() throws SoundInitializationError {\n if (isSoundOn()) {\n if (shortEatSound != null) {\n shortEatSound.start();\n } else {\n throw new SoundInitializationError(\"Short Eat Sound not initialized!\");\n }\n }\n }\n\n public static void playEatCherrySound() throws SoundInitializationError {\n if (isSoundOn()) {\n if (eatCherry != null) {\n eatCherry.start();\n } else {\n throw new SoundInitializationError(\"Eat Cherry Sound not initialized!\");\n }\n }\n }\n\n public static void playEatGhostSound() throws SoundInitializationError {\n if (isSoundOn()) {\n if (eatGhost != null) {\n eatGhost.start();\n } else {\n throw new SoundInitializationError(\"Eat Ghost Sound not initialized!\");\n }\n }\n }\n\n public static void stopOpeningSound() throws SoundInitializationError {\n if (openingSound != null) {\n openingSound.stop();\n } else {\n throw new SoundInitializationError(\"Opening Sound not initialized!\");\n }\n }\n\n public static boolean isSoundOn() {\n return sound;\n }\n\n public static void setSoundOn(boolean b) {\n sound = b;\n }\n\n}\n</code></pre>\n\n<p>This works perfectly well on my HTC Desire, but on my T-Mobile G1, only the OpeningSound can be played. The other sound files aren't played, but there is also no exception. Both devices use 2.1.</p>\n\n<p>Any hints?</p>\n", "Lable": "No"} | |
| {"QuestionId": 3265823, "AnswerCount": 4, "Tags": "<javascript><scope><global>", "CreationDate": "2010-07-16T14:22:21.853", "AcceptedAnswerId": null, "Title": "JavaScript: global scope", "Body": "<p>Nowdays, i create a .js file with a lot of functions and then I link it to my html pages. That's working but I want to know what's the best way (good practices) to insert js in my pages and avoid conflicts with scope...\nThank you.</p>\n", "Lable": "No"} | |
| {"QuestionId": 3299735, "AnswerCount": 1, "Tags": "<java-me>", "CreationDate": "2010-07-21T13:30:05.877", "AcceptedAnswerId": null, "Title": "How to create a Startup Application in JavaME", "Body": "<p>How to create a Startup Application in JavaME.the Program will starts while the boot up of the Mobile</p>\n", "Lable": "No"} | |
| {"QuestionId": 3299867, "AnswerCount": 2, "Tags": "<sql><teradata>", "CreationDate": "2010-07-21T13:42:51.523", "AcceptedAnswerId": "3299922", "Title": "SQL: have a CTE be just literals", "Body": "<p>This is in teradata.</p>\n\n<p>For many good reasons, I would like to have a something like the below, where I start by making a CTE that just has a list of literals, and then can refer to it in later statements:</p>\n\n<pre><code>with MyList(num) as(\n 'a','b','c','d'\n)\n\nselect foo from mytable where x in ( select(num) from MyList))\n</code></pre>\n\n<p>This is a very contrived example, and I know that it would have few applications in reality. But it does get at the question.</p>\n\n<p>Thanks!</p>\n", "Lable": "No"} | |
| {"QuestionId": 3305013, "AnswerCount": 3, "Tags": "<java><queue><huffman-code>", "CreationDate": "2010-07-22T00:53:04.697", "AcceptedAnswerId": "3305051", "Title": "Priority Queues with Huffman tree", "Body": "<p>i am trying to create a Huffman tree by reading in a file and counting the frequency of each letter space symbol etc. i'm using a Priorityqueue to queue the items from smallest to largest but when i insert them into the queue they dont queue correctly here is my code.\n package huffman;</p>\n\n<p>import java.io.FileNotFoundException;\nimport java.io.FileReader;\nimport java.util.ArrayList;\nimport java.util.PriorityQueue;\nimport java.util.Scanner;</p>\n\n<p>public class Huffman {</p>\n\n<pre><code>public ArrayList<Frequency> fileReader(String file)\n{\n ArrayList<Frequency> al = new ArrayList<Frequency>();\n Scanner s;\n try {\n\n s = new Scanner(new FileReader(file)).useDelimiter(\"\");\n while (s.hasNext())\n {\n boolean found = false;\n int i = 0;\n String temp = s.next();\n while(!found)\n {\n\n\n if(al.size() == i && !found)\n {\n found = true;\n al.add(new Frequency(temp, 1));\n }\n else if(temp.equals(al.get(i).getString()))\n {\n int tempNum = al.get(i).getFreq() + 1;\n al.get(i).setFreq(tempNum);\n found = true;\n }\n i++;\n\n }\n\n\n\n }\n } catch (FileNotFoundException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n return al;\n}\npublic void buildTree(ArrayList<Frequency> al)\n{\n PriorityQueue<Frequency> pq = new PriorityQueue<Frequency>();\n for(int i = 0; i < al.size(); i++)\n {\n pq.add(al.get(i)); \n }\n while(pq.size() > 0)\n {\n System.out.println(pq.remove().getString());\n }\n}\npublic void printFreq(ArrayList<Frequency> al)\n{\n for(int i = 0; i < al.size(); i++)\n {\n System.out.println(al.get(i).getString() + \"; \" + al.get(i).getFreq());\n }\n}\n</code></pre>\n\n<p>}</p>\n\n<p>in the buildTree() method is where im having the problem. what im trying to do is queue Frequency objects which holds the letter/space/symbol and the frequency as an int the frequency class is this.\n public class Frequency implements Comparable {\n private String s;\n private int n;</p>\n\n<pre><code>Frequency(String s, int n)\n{\n this.s = s;\n this.n = n;\n}\npublic String getString()\n{\n return s;\n}\npublic int getFreq()\n{\n return n;\n}\npublic void setFreq(int n)\n{\n this.n = n;\n}\n@Override\npublic int compareTo(Object arg0) {\n // TODO Auto-generated method stub\n return 0;\n}\n</code></pre>\n\n<p>}</p>\n\n<p>how can i get the priorityqueue to use the frequency number to queue them from smallest to biggest?</p>\n", "Lable": "No"} | |
| {"QuestionId": 3322278, "AnswerCount": 4, "Tags": "<sql><sql-server><vb.net>", "CreationDate": "2010-07-23T20:55:05.403", "AcceptedAnswerId": "3322300", "Title": "SQL: how to check for a specific DateTime", "Body": "<p>i need to check for a specific DateTime value in my table from my code (VB.NET) and i don't know how to format the DateTime as a string. i've read that SQL Server will recognize my string if it's in either date, time, or date and time format. i mean:</p>\n\n<pre><code>'May 15, 2004'\n'5/15/2004'\n'20040515'\n'2004 4 am'\n</code></pre>\n\n<p>will SQL Server recognize these strings as valid DateTime values? i'm curious because if i check the actual DateTime values in the table they are in this format:</p>\n\n<pre><code>2/2/2006 3:49:33 PM\n</code></pre>\n", "Lable": "No"} | |
| {"QuestionId": 3403560, "AnswerCount": 2, "Tags": "<php><mysql><csv>", "CreationDate": "2010-08-04T07:49:15.767", "AcceptedAnswerId": "3403669", "Title": "Import CSV file in mysql with email validation", "Body": "<p>I have a 2 column in my subscriber table. </p>\n\n<p>Name | email</p>\n\n<p>I want to import a CSV file data in respective column with validation of email column.</p>\n\n<p>I have done uploading CSV part, but i don't know how to insert data with email validation.</p>\n\n<p>How I can do this, I have search allover net but I can't find any working answer on it.</p>\n\n<p>Please help </p>\n", "Lable": "No"} | |
| {"QuestionId": 3475827, "AnswerCount": 1, "Tags": "<iphone><web-services>", "CreationDate": "2010-08-13T10:04:13.907", "AcceptedAnswerId": null, "Title": "How to make session time out from client side", "Body": "<p>I need to test a client app on IPhone which connect to a WebServices.\nThis connection time out is check once/day at 6am.\nSo, we can only test \"time-out\" case only once/day.\nI want to test more time/day. But I can not change on Web Service because of no authentication.</p>\n\n<p>There a solution to use a proxy server to catch package, change session ID and send to test server. But I don't know how to do it?\nCan anyone help me?\nAny other solution?</p>\n\n<p>Thanks in advance</p>\n", "Lable": "No"} | |
| {"QuestionId": 3583245, "AnswerCount": 4, "Tags": "<python><django>", "CreationDate": "2010-08-27T10:24:05.260", "AcceptedAnswerId": "3583302", "Title": "How to pass a variable from the url to a view in django?", "Body": "<p>Simple question. </p>\n\n<p>How can I pass a variable from the URL to the view? I'm following the <a href=\"http://www.djangobook.com/en/2.0/chapter04/\" rel=\"nofollow noreferrer\">Date Example</a>.</p>\n\n<p>My view needs to arguments:</p>\n\n<pre><code>def hours_ahead(request, offset):\n</code></pre>\n\n<p>My url.py has this\"</p>\n\n<pre><code>(r'^plus/\\d{1,2}/$', hours_ahead),\n</code></pre>\n\n<p>I know I need to pass another argument through but I don't know how to get the number from the URL string (i.e. 'time/plus/<strong>4</strong>/'. Something like this?</p>\n\n<pre><code>(r'^plus/\\d{1,2}/$', hours_ahead, offset=??),\n</code></pre>\n", "Lable": "No"} | |
| {"QuestionId": 3685703, "AnswerCount": 5, "Tags": "<javascript><json><function><serialization><stringify>", "CreationDate": "2010-09-10T15:01:11.137", "AcceptedAnswerId": null, "Title": "Javascript: stringify object (including members of type function)", "Body": "<p>I'm looking for a solution to serialize (and unserialize) Javascript objects to a string across browsers, including members of the object that happen to be functions. A typical object will look like this:</p>\n\n<pre><code>{\n color: 'red',\n doSomething: function (arg) {\n alert('Do someting called with ' + arg);\n }\n}\n</code></pre>\n\n<p>doSomething() will only contain local variables (no need to also serialize the calling context!).</p>\n\n<p>JSON.stringify() will ignore the 'doSomething' member because it's a function. I known the toSource() method will do what I want but it's FF specific.</p>\n", "Lable": "No"} | |