w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Ajax call and returning json?
You may want to have a look here: http://en.wikipedia.org/wiki/JSON and to try to log your call result to the console (console.log(var)) so you can have a better view of the real form in which data is passed.

Categories : Javascript

Will returning an object call it's destructor?
You may add a move constructor (c++11) or a copy destructor: class Callback{ friend Manager; private: explicit Callback(Drawable** targetPtr) : drawablePtr(targetPtr) {} // C++11 Callback(Callback&& rhs) : drawablePtr(rhs.drawablePtr) { rhs.drawablePtr = NULL; } // else Callback(Callback& rhs) : drawablePtr(rhs.drawablePtr) { rhs.drawablePtr = NULL; } public: ~Callback(){ if (drawablePtr) { (*drawablePtr) = NULL; } } private: Drawable ** drawablePtr; };

Categories : C++

How to call another module without returning to the first one after completion?
I think all you're looking for is the command Exit Sub which will make the program leave the subroutine without continuing any further, But the way you usually want to do this is, rather than calling a Sub, rather call a Function that returns a boolean value. So, for example: Public Function MyFunc() as Boolean .... If [good] MyFunc = True Else MyFunc = False End Function Then you could do something along the lines of: Sub MyCallingSub() ... If MyFunc = True then Exit Sub Else ... End Sub It just adds in A LOT more felxibility and ability to choose whether you want to continue further in your sub or not. Hope that makes sense.

Categories : Excel

Returning many columns in a function call
Update: After second look I see that you're using a function(completely overlooked) which returns only one value , can you change it to procedure instead? SQL: DROP PROCEDURE IF EXISTS procedure_institute_university; DELIMITER $$ CREATE PROCEDURE procedure_institute_university (IN_partnership_id INTEGER(11)) BEGIN SELECT UPPER(institute.Code) as `institiute_code`, university.id as `university_id`, UPPER(university.UnivAcronym) as `university_acronym` FROM partnership LEFT JOIN institute ON institute.id = partnership.iid LEFT JOIN university ON university.id = partnership.uid WHERE partnership.id = IN_partnership_id AND partnership.active = '1' LIMIT 1; END$$ PHP: $sql = "call procedure_institute_university(15)"; $ru

Categories : PHP

How to call a returning value function in AsyncTask
You can create an Interface and return value from onPostExecute() of AsyncTask or you can register a BroadcastReceiver and fire in from onPostExecute() method of AsyncTask. I had created a demo using Interface and BroadcastReceiver you can download and check it.

Categories : Android

Wordpress returning 0 on ajax call
You need to remove spaces in 'wp_ajax_nopriv_ header_galley_ajax' and 'wp_ajax_ header_galley_ajax': add_action( 'wp_ajax_nopriv_header_galley_ajax', 'header_galley_ajax' ); add_action( 'wp_ajax_header_galley_ajax', 'header_galley_ajax' );

Categories : Ajax

jQuery AJAX call not returning data
stlll, it seems a cross-domain issue: please try this library https://github.com/padolsey/jQuery-Plugins/blob/master/cross-domain-ajax/jquery.xdomainajax.js as a jsonp the result is already a callback function with a javascript object argument. Make sure that the returned function by the server is implemented: The server could return my_callback({...}). You need to implement my_callback function client-side. place some alerts/console.log on both success and error functions. Always make a little debug of your own before posting the issue. as posted in the comment: state the return code of the ajax call.

Categories : Javascript

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 the result of a function call with/without parentheses
Sorry I don't read correctly your question, as F is afunction you are using () to evaluate the function. So then the result of Write-Type function is the same for me in PowerShell V2.0. So, In PowerShell 3.0 I meet your problem. Now using : Trace-Command -name TypeConversion -Expression {Write-Type (F)} -PSHost Versus Trace-Command -name TypeConversion -Expression {Write-Type (G)} -PSHost as far as I understand the () before before returning object generate the following Converting "Collections.Generic.LinkedList" to "System.Type". Conversion to System.Type Conversion to System.Type Could not find a match for "System.Collections.Generic.LinkedList". Could not find a match for "Collections.Generic.LinkedList". Converting "Collections.Generic.

Categories : Powershell

AJAX Call returning 404(Local) in IIS 7.5 but same works in other IIS
That's normal. You have hardcoded the url to your controller action: url: '/Controller/FunctionName', If you deploy your application in a virtual directory in IIS the correct url should be: url: '/YourAppName/Controller/FunctionName', That's the reason why you should absolutely never hardcode urls in an ASP.NET MVC application but ALWAYS use url helpers to generate it: url: '@Url.Action("FunctionName", "Controller")', and if this AJAX call is in a separate javascript file where you cannot use server side helpers, then you could read this url from some DOM element that you are AJAXifying. For example let's suppose that you had an anchor: @Html.ActionLink("click me", "FunctionName", "Controller", null, new { id = "myLink" }) that you AJAXify: $('#myLink').click(function() {

Categories : Asp Net Mvc

paypal rest api payment call returning 401 using php
A 401 error generally indicates that the access token is either invalid or expired: https://developer.paypal.com/webapps/developer/docs/integration/direct/rest-payments-error-handling/ Are you including "Bearer" in the Authorization header? Example: Authorization:Bearer EMxItHE7Zl4cMdkvMg-f7c63GQgYZU8FjyPWKQlpsqQP

Categories : PHP

AngularJS REST async call not returning data
you have to return the promise in your service return $q.all(newsCall, tweetsCall).then(function(values) { var news = values[0].data.results; var tweets = values[1].data.results; var a = doSomeThing(news); var b = doSomeThingToo(tweets); return [a, b]; }); en then in your controller wait for it to resolve: dataService.getNewsAndTweets().then(function(data){ $scope.news = data[0]; $scope.tweets = data[0]; });

Categories : Rest

Hash::make('password') returning different results at every call
That's what it's supposed to do. It's supposed to create a different password each time, as it's creating a new random salt. To check the user's password, you use the check method. if(Hash::check('1234', $password)){ } Or you can use Auth::attempt. $user = array( 'email' => $email, 'password' => $password ); if (Auth::attempt($user)){ } Docs: http://laravel.com/docs/security

Categories : PHP

Web Api call is returning a 404 error with GUID passed as param
ASP.NET Web API, by default, binds request body to a complex type (Pizza, in your case). Web API binds the body in its entirety to one parameter. Simple types such as GUID are bound from the URI path and query string. So, by passing GUID in the URI and posting only the JSON corresponding to pizza object (only the pizza and not anything else such as order ID), you can get this working.

Categories : Asp Net Mvc

.success not returning xml data correctly in ajax call
If elm is $('photos').children(), then what does elm.find('photo') return? I'm guessing nothing as you already have the photo elements in elm, and don't have to use find() at all? $(entry).find('photos').children().each(function() { var div = $('<div />', {'class':'photos'}), img = $('<img />', {src: 'img/photos/'+$(this).text(), alt: ''}); $self.append( div.append(img) ); });

Categories : Jquery

Returning values from Javascript modules after ajax call
Your "getRoots" function does not return anything. Using the $.ajax(successCallback) or $.ajax.done() patter is the same thing. You are not deferring anything. There is no way you can do this without callbacks, events or promises. Callbacks and events are basically the same, only the latter allow better architectural decoupling (highly debatable fact). Promises mean that you can write var x = getRoots() and x will be undefined until the browser gets back a response from the server. Your application has to account for this. So either you start coding with the async pattern in mind (callbacks, events) or design applications that handle null/undefined values gracefully. Using callbacks: function getStuff(callback) { $.ajax(...).done(function(data) { // maybe process data?

Categories : Javascript

Why is my call to get Twitter user timeline returning "401 Unauthorized."?
I have created a test console application on GitHub that does this here: Authenticate and request a user's timeline with Twitter API 1.1 oAuth Please see my question and answer, markup if you find it of use.

Categories : C#

R system call returning stdin without escape characters
Your code is working fine, R is just printing your escaped characters as escapes. If you do cat(paste(system("./f.py", intern=TRUE), collapse="")) you should see your desired output.

Categories : Python

API call returning extra unnecessary HTML header information
Another (convoluted) solution is to run it through this HTML Sanitizer API - https://www.mashape.com/pbkwee/html-sanitizer#!endpoint-HTML-Sanitizer I ran your output above and it almost removed everything, except it padded div tags at both ends (well you can remove them)

Categories : Javascript

Returning object for method call expression doesn't work
I found the issue. I had thought the conversion issue was due to the return type of the method expression, but I forgot I had a conversion expression for one of the method parameters as well - and it was that conversion that was in error. I have an explicit conversion to a value type from a given object, but upon further investigation, it turns out you have to convert "object" to the actual type before implicit conversions will work. ;) So, in summary, if you have a method that returns something other than "object", simply use "Expression.Convert" or "Expression.TypeAs" to convert/box the return type into an object type. ;)

Categories : C#

Neat ruby way of returning failure or continuing after function call
A bit of DRY maybe? Something like def call_func(_method, arguments) raise "your exception" if send(_method, arguments) == -1 end call_func(:function_call, arguments) call_func(:another_function_call, arguments2)

Categories : Ruby

Can non-trivial constructors call Future returning functions (how or alternatives)
What you want to do is not possible with standard constructors. Instead, try a static method that returns a new instance wrapped in a Future. Something like: class Schema { Schema._fromApi(String apiResults) { ... } static Future<Schema> build(String jsonString) { return getContentsOfUrl(jsonString['url']) .then((contents) => new Schema._fromApi(contents)); } }

Categories : Dart

Ajax call for form submit not returning the original response
you can use dataType to tell jQuery what you are expecting. From Doc dataType (default: Intelligent Guess (xml, json, script, or html)) Type: String The type of data that you're expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be returned as a string). If you are expecting plain string use $.ajax({ // Other attributes dataType: "text" });

Categories : Jquery

Is there something wrong with my call to the rotten tomatoes API ? It's returning only 3 movies instead of the number requested?
var_dump(count($box_office_movies['movies'])); // returns only 3 movies .. i get 50 movies. The url returns an array with 3 keys: { movies: {..}, links: {...}, link_template: '...' } Seems to work fine here...

Categories : PHP

Jquery ajax call returns error when the rest service is returning a string
try setting your datatype to text jsonp dataType: 'jsonp', http://api.jquery.com/jQuery.ajax/ You will have to do one of two things to go with this to resolve the error further; making changes on the server side to pass the data back as json and not as text retun the string encoded in json return "{"text":"abc"}"; //or something like this Why? jquery cross-domain requests are only allowed for dataTypes "script" and "jsonp". I have updated your fiddle it still throws an error but that is related to a parse json error

Categories : Java

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

Use tuple-returning Python function in another function call
Try this: bar(np.array([7,8]), *fu()) (unpack the tuple returned by fu())

Categories : Python

Python - Chaining methods: returning `self` vs returning a new cloned object
Django does this so that the base query can be kept around and reused, without inheriting changes from a future "child" query, like your exclude() on your filter(). I'm guessing somebody tried storing queries for later, and realized that didn't work well without copying. I cloned the django repo and did a quick git log on django/db/models/query.py, searching for the phrase clone. The patch that introduces this change is here: https://github.com/django/django/commit/d4a3a4b

Categories : Python

Oracle Query is returning value when setting value to it, but not returning value when passing date value
Since you're already forcing the date format, you can use the following query instead: SELECT INCIDENT_ID FROM INC_SM1 I WHERE I.CLOSE_TIME >= START_DATE AND I.CLOSE_TIME < END_DATE

Categories : Oracle

JavaScript, stringify, replacer - returning undefined vs. returning nothing
If you don't provide an explicit return, the return value is undefined. Your second function always returns undefined, in other words. Because the function always returns undefined, there'll never be anything included in the JSON stringified result, so the overall effect is that you get undefined. It's sort-of an anti-pattern to do this: if (something) { return whatever; } else { return somethingElse; } Your first function would be more idiomatic as: str = JSON.stringify(o,function(k,v) { return Object.isSealed(this) ? undefined : v; }); edit — note that JSON.stringify() calls your replacer function first with an empty key, and "v" equal to this a new wrapper object containing the object to be stringified (and note that that object is not sealed). That is, before chec

Categories : Javascript

Returning 'nil' from a Lua function in C vs returning 0 values
Yes, this is perfectly valid. If you're trying to request/assign more return values than there are (no matter whether you try to get one or ten), you'll get nil for the undefined ones (i.e. those not returned). function test1() return 5 end local a, b = test1() -- a = 5, b = nil function test2() return 1, 2 end local c, d, e = test2() -- c = 1, d = 2, e = nil function test3() end local f, g = test3() -- f = nil, g = nil You probably can't find it in Lua's source because it's no special case or anything. It's just Lua's generic way to handle return values. Update: The difference you've noticed when trying to print return values is the fact that this is not just an assignment. Of course there is a slight difference between returning nil and returning nothing at all - and it

Categories : C

As we all know constructor is not having a returning type but in the code below constructor is returning...can any one explain
This: complex_1 complex_1::operator+(complex_1 c) is a definition of a class complex_1 member function (complex_1:: means this) that returns an object of type complex_1. c is not a constructor but an object of type complex_1 that is returned in this function.

Categories : C++

Returning a Unicode string vs. Returning a normal string encoded as UTF-8?
UTF-8 is an encoding of the entire Unicode character set. It is backwards compatible with ASCII. For characters outside the ASCII set, multibyte encodings are used. All ASCII strings are Unicode strings. All Unicode strings are not ASCII strings.

Categories : Python

stop further ajax call until previous call completed in window scroll event .
I would add some bool flag indicating whether loading products is in progress. You should check the flag as a first action in scroll handler. The flag should be set to true when you enter to the if statement, and reset to false on ajax complete handler.

Categories : Jquery

how to call synchronise call in sqlite phonegap (check duplicate item before insert )
Move the call to insertData into the queryexcecute function. Please note that you do not need to read the entire table yourself; just execute this: SELECT 1 FROM CaseTable WHERE CaseName = ? and check whether you get some record back. Alternatively, ensure you have a UNIQUE constraint on the CaseName column, and unconditionally execute an INSERT OR IGNORE statement.

Categories : Jquery

Bing Map v7, Direct call vs Ajax Call. Delay on Callback Function
One thing you might want to look at doing to speed things up is to perform the geocode on the server side. You could do this right in the ShowMap function. You can find information on how to use the Bing Maps REST services in .NET here: http://msdn.microsoft.com/en-us/library/jj819168.aspx

Categories : Javascript

cannot call methods on slider prior to initialization attempt to call method 'value'
So I have seen this type of thing a lot. You can do one of the following (AFAIK): var slider; $(function () { var slider = $("#slider-vertical").slider({ orientation: "horizantal", range: "min", min: 0, max: 100, value: 60, slide: function (event, ui) { $("#amount").val(ui.value); } }); $("#amount").val(slider.slider("value")); }); function UpdateSlider(PhaseInStatusReportVal) { slider.slider("value").val(PhaseInStatusReportVal); } or $("#slider-vertical").slider().slider("value").val(PhaseInStatusReportVal); I like the first option better.

Categories : Jquery

Android: How to open Call Log (missed-outgoing-incoming call view)?
I'm not sure if you can open it that way (at least, not on all devices), but you can get the call log like this (you have to show it to the user yourself. Check the link bellow). This is the save way, to make sure that the user is going to see exactly what you want, but you have to create it yourself. Check this thread for further help: How do I access call log for android? . Hope this helps.

Categories : Android

How does the call stack look like for a recursive delete call in a binary search tree?
For questions about recursive functions, sometimes it helps to just think of or draw a simple tree and just map out on paper how the function goes through it. First thing, it's been a while since I used c++, but for the sake of this example I'm going to change your code to: void btree::destroy_tree(node* leaf) { if(leaf !=NULL) { if (leaf->left != NULL) destroy_tree(leaf->left); if (leaf->right != NULL) destroy_tree(leaf->right); delete leaf; } } just so there's less stuff on the stack. Think about how the logic of this function works recursively through a tree. Take the following tree example which I snagged from Wikipedia Let's say you call destroy_tree(root). The function destroy_tree(root) calls destroy_tr

Categories : C++

How can I make voice call/How can I identify call using AT commands in visual basic?
You start voice calls with AT command ATD12345678; and (circuit switched) data calls with ATD12345678 (for phone number 12345678). If you have not worked with AT commands before, by all means read the V.250 specification (linked from http://stackoverflow.com/tags/at-command/info). It will teach you all you need to get started using AT commands correctly.

Categories : Vb.Net



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