w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Same call returning different JSON results on Android vs iOS
I finally figured it out! I believe that the issue was how the data is interpreted on iOS vs Android. On Android, I could just pass back any sort of integer (signed or unsigned, 8, 16, or 32 bit) and it would just seem to work out. However, on iOS, I needed to do a bitwise shifting process on the JSON Output (before encoding) to make it into an unsigned 16 bit integer. Then once it got back to the Pebble, there is code to shift that unsigned 16 bit integer into an unsigned 8 bit integer, before assigning it to a standard c int uint16_t value1 = icon_tuple1->value->int16; uint8_t icon1 = value1 >> 11; dayTransition.day[0].currentWeather = icon1; TL;DR Shift your JSON >> 11, return to device, then unshift it << 11 in the received phase on the device.

Categories : PHP

Returning control codes as JSON to a jquery ajax json call
Firstly, try using a different ascii code. Character 1F is a "Unit separator". (It's unprintable). Check here. [Edit: try x20. It is a space.] [Edit 2: since you want unit separator and jQuery.parseJSON does not seems to like it, we will use eval(). Now, specifying dataType as 'json' will parse the response from the server; there's no need to manually parse it yourself: We will specific dataType as 'text' and manually parse json with eval(): $.ajax({ url: "/jsontest.asp", type: "POST", cache: false, dataType: "text", success: function(data) { // data is "{"val1":123,"val2":"abcx1Fdef"}" var o = eval("(" + data + ')'); // parse json // will split the text using x1F as delimiter var separated = o.val2.split('x1F'); // sepa

Categories : Jquery

Ajax json always returning error although json format in response is correct
Indeed the string <!-- 0.375s --> is breaking your code. Try to find out where it is comming from. Some steps: What layout are you using to render this? Try debug($this->layout) in your Controleler to see which on it is. This may very well be in there since I don't see you setting the layout to ajax for example. Cake has this ajax layout, which essentially is an empty layout. It should not contain anything more than echo $content_for_layout; in CakePHP 1.3. Check and be sure that your is "spitted out" UTF-8 encoded. This is a must for JSON. Try replacing your current view code with echo json_encode($response); or to keep the trilateral check: echo isset($response) ? json_encode($response) : ''; The JavaScriptHelper will to the same thing anyway. This "strange string" may very we

Categories : Ajax

Returning valid JSON from JSON Formatter on HTTP OK for WebAPI
Not sure what is the best practice here and may be someone from ASP.NET Web API team can answer but this works. public HttpResponseMessage Get() { return Request.CreateResponse<object>(HttpStatusCode.OK, new object()); }

Categories : C#

Json.NET adding backslash while returning json serialized string
No. it doesn't class Program { class Book { public int ID; public string BookName; } static void Main() { var books = new List<Book> { new Book { ID = 1, BookName = "A" }, new Book { ID = 2, BookName = "B" } }; var x = from d in books select new { ID = d.ID, BookName = d.BookName }; string str = JsonConvert.SerializeObject(x.ToList()); Console.WriteLine(str); } } There could be two problems: A) You are looking at the result from the debugger. To check for this, Put the JsonConvert in a temporary variable (like I did) and look at it with the debugger. Click on the arrow right of the hourglass and select Text Visualizer. or B) The calling method is transformi

Categories : C#

Query returning no results
You are not doing the actual query: $q = "SELECT * FROM restable WHERE pk_tId = '" . $id . "'"; $query = mysql_query($q); // <- you forgot this line, $q is only a string if (mysql_num_rows($query ) === 0){ echo "No results"; } The reason that the mysql_num_rows function still makes the condition, is because it returns false. 0 and false are the same if you compare with two equal signs. If you would have done this: if (mysql_num_rows($query ) === 0){ // This only fires when the functions return INT 0 if (mysql_num_rows($query ) === false){ // This only fires when the function returns false (on error) too clearify a bit more: 1==true -> true 1===true => false (not the same type) 0==false -> true 0===false -> false (not the same type) 1==

Categories : PHP

mysql returning only 2 results
Just fix your code to: $query = mysql_query("SELECT trackingno FROM xx where orderid='".$item->increment_id."'"); if ($query){ while ($data = mysql_fetch_assoc($query)){ echo $data['trackingno'] ; } } The reason you get 2 items is that you used mysql_fetch_array once. That gives you just one row from the database. First element in array is number-indexed, another is string-indexed. So you had: $compiledresults[0] and $compiledresults['trackingno'] in fact.

Categories : PHP

SQL SUM statements returning different results
A left join returns every matching row in the right-hand table for each row in the left-hand table. To see what happens, remove the group by from your second query. SELECT * FROM #sales t LEFT JOIN #sales a ON t.YearSold = a.YearSold AND a.Quarter='Q1' LEFT JOIN (select * from #sales where Quarter='Q2') b ON t.YearSold = b.YearSold LEFT JOIN (select * from #sales where Quarter='Q3') c ON t.YearSold = c.YearSold LEFT JOIN (select * from #sales where Quarter='Q4') d ON t.YearSold = d.YearSold You'll see there are four rows for each year. That's because from #sales will give you four rows for each year. The end result is that the group by counts everything four times.

Categories : SQL

mysql_stmt_fetch not returning results?
Yes, it doesn't. If you bother to read the manual page for this function, you will be aware of what does it return and how it works in general. And of the function get_result() as well, which you actually need

Categories : PHP

Query isn't returning all of the possible results
you should use one query instead of running same query multiple times for each condition , wrap all your rating conditions in a group with a parent AND operator and just loop through the result set ignore the multiple loops it will effect the execution time SELECT `user_id`, `rank`, `habbo_name`, `rating`, `branch` FROM `personnel` WHERE status='active' AND ( `rating` LIKE '%(DIROPS)%' OR `rating` LIKE '%(CO TECOM)%' OR `rating` LIKE '%(XO TECOM)%' OR `rating` LIKE '%(TECOM%' OR `rating` LIKE '%/TECOM%' ) AND `branch`='usmc' ORDER BY `habbo_n

Categories : PHP

DOMDocument not returning results (PHP)
That is correct behavior since $xpath->query method returns an object of type DOMNodeList. Try iterating $results object like this: if ($results) { for ($i=0; $i < $results->length; $i++) { $node = $results->item($i); var_dump($node); } }

Categories : PHP

TFS API not returning results in MVC application
I finally got access to the server. It was related to privileges. The user I was using turned out not setup as an admin on the TFS server. I just needed to use an alternate one with administrative account.

Categories : C#

Function not returning multiple results
Scalar functions return a single value. If you need multiple values you need a Table-Valued function. See here for more detail on Table-Valued functions.

Categories : SQL

Returning SQL-query results in Clojure?
Long time since I've played [FR] with clojure, but as far as I remember, sql/with-query-results does not return result. It merely evaluate a sub-expression (the last parameter) with the query result as a parameter: (defn list-domains [] (sql/with-connection db (sql/with-query-results rows ["select * from domains"] (do-something-with rows) ))) If you really want to return, you could try to instantiate the sequence by using doall: (defn list-domains [] (sql/with-connection db (sql/with-query-results rows ["select * from domains"] (doall rows) ))) EDIT: Hum ... well ... as a matter of fact, this is the exact same solution as provided by the documentation for with-query-results :/

Categories : Mysql

SQL max() over(partition) returning multiple results
I was taking the max of mt.version and partitioning it by mt.version so I wasn't getting any new data. A correct version of what I previously wrote could be: select *, max(mt.version) over (partition by mt.partitiongroup) from mytable mt where mt.id = 'some uuid'; I wasn't realizing while trying out this new concept that the partition group had to be different than the max aggregation.

Categories : SQL

MySQL <> not working - returning those results
Replace this AND with an OR (`habbo_name` <> '-Jose,' AND `habbo_name` <> 'tharuka$') to (`habbo_name` <> '-Jose,' OR `habbo_name` <> 'tharuka$') Or you can use the following `habbo_name` NOT IN ('-Jose,','tharuka$')

Categories : Mysql

MySql FULLTEXT returning 0 results
do you mean this? against('h.h h.hs' IN BOOLEAN MODE) if its two values then use this where article_name IN ('h.h' , 'h.hs') AND article_content in ('h.h' , 'h.hs')

Categories : Mysql

Manipulate & use the results of UPDATE .... RETURNING
That syntax won't work (unfortunately! that would be convenient). Either you update and then create another query, or you do everything in a stored procedure where you can safely store and handle query resuts, so that you just have one single database call from your application.

Categories : Postgresql

MYSQL returning incomplete results
(SELECT id FROM books WHERE id < 2 and section = 1 ORDER BY id DESC LIMIT 1) UNION (SELECT id FROM books WHERE id >= 2 and section = 1 ORDER BY id ASC LIMIT 2) The problem with your query is that you're picking random ids less than 2 and greater than 2, without taking the section into account. If those IDs aren't in section 1, they won't be included in the result. The WHERE clause in your outer query is not distributed into the subqueries. The subqueries are executed independently, returning IDs, which are put into the IN clause. Then the outer query filters by section. FIDDLE

Categories : Mysql

MongoTemplate find not returning results
Try this: query = new Query(Criteria.where("docType").is("row") .and("value.entity.city").is("CITY")); You're code doesn't need the andOperator function (as that translates to $and). It just needs multiple criteria using and. And, you can use query.toString() to see what the output would be of the query (and compare it to what you might have used in the MongoDB shell.

Categories : Mongodb

PHP using $_GET at sql query returning no results
You have quotes around your email in the get request. http://**********/android_connect/get_all_products.php?user_email="m" ^ ^ Therefore mysql will be looking for something that matches "m" not just m. You should remove the quotes from the URL or strip them out before adding it to your query: $user_email = trim($user_email, '"'); At the very least you should escape the query before running it: $test = mysql_real_escape_string($test); $result = mysql_query($test) or die(mysql_error());

Categories : Java

$.post with jQuery not returning results when done
function updateCount(text){ text = encodeURIComponent(text); $.post("../process/countpaste.php", {text: text}).done(function( data ) { $( "#stats" ).empty().append( data ); }); } not $(data) but just (data)

Categories : PHP

SqlDataReader returning incorrect results
It is staggeringly unlikely that you're seeing a new never-seen-before issue on command / result mismatches; more likely, your code is simply getting something wrong; the first thing to do is to simplify (and fix a lot of the problems): public bool Read(string ID) { using(var connection = new SqlConnection(ConnectionString)) using (var command = connection.CreateCommand()) { command.CommandText = "select * from Sounds where ID=@ID"; command.Parameters.AddWithValue("ID",ID); Connection.Open(); using(var reader = command.ExecuteReader()) { if(reader.Read() { FillClass(reader); return true; } return false; } } } The next interesting question is "wh

Categories : Dotnet

MongoDB $near Returning Max Results with Max Distance
In this mailing list post, Eliot mentions that $near does not use a cursor, so its results are limited to either 4MB or 100 documents, whichever is reached first. The current documentation says the same, but this is true only for 2d indexes (the documentation should be fixed by DOCS-1841). If you are storing points in GeoJSON and using 2dsphere indexes (new in version 2.4), $near queries do utilize cursors and should not have a hard upper limit of 100 documents. Consider the following examples, first using a 2d index: > var point = [0,0]; > for(i=0;i<200;i++) db.foo.insert({x: point}); > db.foo.ensureIndex({x: "2d"}); > db.foo.find({x: {$near: point}}).count(true); 100 > db.foo.find({x: {$near: point}}).limit(200).count(true); 100 Then using a 2dsphere index with equ

Categories : Mongodb

MySQL fulltext not returning any results when it clearly should be
words that are present in 50% or more of the rows are considered common and do not match. From the Doc That means if you look for a word that most records contain, then it will be ignored in the search.

Categories : Mysql

TStringHelper is not returning the correct results
The TStringHelper functions are 0-based, not 1-based. From the linked docs for TStringHelper.Chars (emphasis mine): Accesses individual characters in this zero-based string. From the link for TStringHelper.SubString (again, emphasis mine): Returns the substring starting at the position StartIndex and optionally ending at the position StartIndex + Length, if specified, from this 0-based string. The code sample from the Chars link also shows the loop running from 0 to Length - 1, instead of the usual string loop that runs from 1 to Length(string) (code comment mine): var I: Integer; MyString: String; begin MyString := 'This is a string.'; for I:= 0 to MyString.Length - 1 do // Note start and end of loop condition Write(MyString.Chars[I]); end.

Categories : Delphi

asp.net LDAP query not returning all results
It is likely that changes have not yet been replicated. LDAP clients must never search for an entry that was just modified or added because of eventual consistency. The correct procedure for an LDAP client that makes a change to an entry is to attach the post-read request control to the modify request. The post-read response will contain the state of the entry after the modification was complete. A professional quality LDAP proxy server with server affinity can be placed between clients and servers to ensure that client operations are always sent to the same server (usually for a configurable period of time). This negates the effect of eventual consistency. For more information, see the article post-read request control.

Categories : C#

PHP XPath search returning 0 results
To fix this problem I first registered the namespace: $xpathvar->registerNamespace('transXchange', 'http://www.transxchange.org.uk/'); And then modified the query like so: $queryResult = $xpathvar->query('//transXchange:AnotherChild/transXchange:id'); This returned the ID successfully.

Categories : PHP

Oracle 9.0.1.1 - Same query returning different results
This is not a question we can answer. You have a simple GROUP BY query and it will sum those attributes in a consistent fashion. If you get different results it is because the underlying data is different when you run the query. You provide a sample of the "actual data" but neglect to say which table it comes from. Let's assume it is the sales_detail table. If there are records in a table which sum to X but the query returns an aggregated value of 2 X you must have double counting. That is, the joins in the query are causing you to get two instances of each sales_detail record. Now you also say this is a transient phenomenon. If so, then it seems likely that something is temporarily spawning a second version of some record. Perhaps you have an EOD process which generates a additio

Categories : SQL

SQL injection not returning expected results
Your current injection generates this code: SELECT * FROM customer_data WHERE username = 'admin' AND password = '' OR '1'='1' It gives you all the rows from the table. And you just fetch the 1-st one. To crack the site, try this: <?php $username = 'admin'; $password = "' OR username='admin"; $sql = "SELECT * FROM customer_data WHERE username = '$username' AND password = '$password'"; print $sql; Prints: SELECT * FROM customer_data WHERE username = 'admin' AND password = '' OR username='admin' This selects the necessary row.

Categories : PHP

Why is this implementaion of Lucene not returning any results?
The query object TermQuery will try to match the input value exactly as is. Any difference between input and indexed values (such as Fl instead of FL) will result in zero match. All casing, spaces and symbols need to be identical for Lucene to return a matching document. I would suggest pre-processing the input and indexed value before hand (i.e. lower-casing strings before indexing, and similarly for all search input) to avoid the subtle differences.

Categories : C#

Replacing fetched results when returning 0 from DB
See this question. This is the expression you are looking for. $price = ($row[price] === 0) ? "P.O.D." : ("£ ".$row[price]); Edit: Side note: I use === 0 because of the problem that is described in this question.

Categories : PHP

SELECT statement with sqlsrv_query not returning results
You should change your identical operator(===) to equal operator(==). Your $rows should actually contain values and you can test that by doing print_r($rows) or vardump($rows) I tested this: $rows = array(1=>"a",2=>"b"); if ($rows === true) echo "There are rows. <br />"; else echo "There are no rows. <br />"; This does return "There are no rows" but if you change "===" to "==", you should be getting the "There are rows" answer. 1 == 1 is true 1 === '1' is not true (left val is an integer, the other is a string) 1 == '1' is true (disregards variable type) I hope this helps.

Categories : PHP

MySQL UNION returning no results whatsoever
$querystring = "SELECT contact_name, contact_name_arabic FROM CONTACTS WHERE (contact_name LIKE '%".$queryString."%' OR contact_name_arabic LIKE '%".$queryString."%') UNION SELECT company_name, company_name_arabic FROM COMPANIES WHERE (company_name LIKE '%".$queryString."%' OR company_name_arabic LIKE '%".$queryString."%')"; Remove the parenthesis,Mysql will try to run (SELECT blah which is not valid. EDIT:I added some parentheses, try it.

Categories : PHP

Javascript While Loop Returning Strange Results
prompt returns a string. Adding a number to a string results in a string: > "12" + 13 "1213" While subtraction results in an integer, as only string concatenation is done with a plus sign: > "12" - 13 -1 You need to convert your user's input into an integer: var bet = parseInt(prompt("How much do you bet? Enter a number between 1 and " + funds + " without the $ sign."), 10);

Categories : Javascript

mysql query keeps returning duplicated results
Try adding the DISTINCT clause in your select statement http://dev.mysql.com/doc/refman/5.0/en/distinct-optimization.html

Categories : PHP

MySQL query with Python not returning all results
You are not opening output file for writing, at least not in the piece of code you've published. for entry in cursor: ## what output? when and how was it opened? output.write(str(entry) + " ") Have you opened "output.txt" with "w" (which stands for write) mode earlier? In this code you're only opening "input.txt" file on line 4. If you want to write to "input.txt" file in append mode the code needs to be: i.write(str(entry) + " ") (and the file must be opened in append or write mode). Also in query arguments you don't need to pass four lines. In your query you only supply one parameter (table1.name = %s) you only need to pass parameter to this %s, which I guess will be line.

Categories : Python

SerialPort.DataReceived Returning Strange Results
One part of your problem is that serial communication is far from instantaneous. The .ReadExisting() method pulls data out of the SerialPort object's buffer, but does nothing to assure that the device has finished issuing its command. Think of it like this: +----+ +----------+ +------------+ |Your|--Command-->|Serial |---UART--->| Device | |Code| |Port Obj | | | +----+ +----------+ +------------+ +----+ +----------+ +------------+ |Your|<--Read-----|Serial | |Device | |Code| (is empty) | | |(processing)| +----+ +----------+ +------------+ +----+ +----------+ +------------+ |Your| |Seria

Categories : C#

Returning PHP results to original html page
You missed echoing out the results of the search: Edit index.php if($_POST['doSearch'] == 'Submit') { $value=$_POST['keywords']; $newsum= round($total,1); if($newsum >= 3.5) { $message=$newsum.'/5'; echo $message; // added } else { echo "Nope"; // this is only to make sure something at all is echoed. } } Then alter your JS: // submit action instead of click is the way to use form data <script src="http://code.jquery.com/jquery-latest.js"></script> <script> $(document).ready(function(){ $('#search').submit(function(e){ e.preventDefault(); $.post("index.php", $("#search").serialize(), function(response) { $('#col').html(response); }); }); }); </script> NOTE You added PHP

Categories : PHP

utf8_unicode_ci not returning case insensitive results?
the database should be case insensitive when searching, correct? Yes. What am I doing wrong? Nobody actually knows. It can be anything. See, you are judging by indirect consequences. Failed authentication can be caused by zillion issues, not necessarily connected to encodings. A debugging code, which runs two straight queries against 2 constant names can be more assuring. It shouldn't be an issue but be sure you are running $mysqli->set_charset('utf8'); after connect.

Categories : PHP



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.