w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
AngularJS promise chain
Can you try //skipping the first then .then(function(result){ var deferred = $q.defer(); console.log('confirmed? ', result); if (result){ //After this line it doesn't do nothing, also if the promise is resolved return deferred.resolve(reservationService.confirm($scope.object)); } deferred.resolve(); return deferred.promise; }) .then(function(){ //this function is never executed $scope.$emit('object:detail',{object: $scope.object}); }); For chaining then, the last then success or failure function should return a promise. As the $q documentation mentions then(successCallback, errorCallback) – regardless of when the promise was

Categories : Angularjs

Q Promise chain and NodeJS callbacks
As far as I can tell, you need to return a promise from getItemData. Use Q.defer() as you do in second(), and resolve it when the callbacks complete with the data. You can then push that into list. To save code, you can use Q.nfcall to immediately call a node-style-callback function, and return a promise instead. See the example in the API docs: https://github.com/kriskowal/q/wiki/API-Reference#qnfcallfunc-args

Categories : Javascript

Why is PHP throwing throwing a "Cannot Redeclare" error at a local, included function?
The key is this error message: Fatal error: Cannot redeclare sec_session_start() (previously declared in E:Additional ProgramsxampphtdocsVista_Ridge_Territory_SystemPHPScriptsVRC_Header.php:14) in E:Additional ProgramsxampphtdocsVista_Ridge_Territory_SystemPHPScriptsVRC_Header.php on line 24 The only way for this error to occur is if you have included VRC_Header.php twice. This has nothing to do with jQuery, and nothing to do with sessions or regenerating session ids. The two different line numbers are just pointing to the start/end of the function. Try putting an echo() command above the function, and you should see the echo happening twice. Even better, put the following code above your function, and it'll display a more useful error message, including a backtrace that will help y

Categories : PHP

Error about std::promise in C++
std::promise<> is not copyable, and in calling run_thread() you are implicitly trying to invoke the copy constructor. The error message is telling you that you cannot use the copy constructor since it is marked private. You need to pass a promise by reference (std::promise<DataWareHouse> &). This is safe if callerFunc() is guaranteed not to return until run_thread() is finished with the object (otherwise you will be using a reference to a destroyed stack-allocated object, and I don't have to explain why that's bad).

Categories : C++

Spring web application, try to send response as json throwing error 500 error
It looks like you need to use at least Jackson version 1.9.2 or above. In the source for Jackson 1.9.0 and 1.9.1, the method definition for org.codehaus.jackson.map.SerializationConfig.isEnabled() has been removed. This is why you are receiving the NoSuchMethodError exception. Then in the source code for Jackson 1.9.2 you see the following: /* /********************************************************** /* MapperConfig overrides for 1.8 backwards compatibility /********************************************************** */ /* NOTE: these are overloads we MUST have, but that were missing * from 1.9.0 and 1.9.1. Type erasure can bite in the ass... *<p> * NOTE: will remove either these variants, or base class one, in 2.0. */ /** * Alias for {@link MapperConfig#isEnabled(org.cod

Categories : Json

Reading file in vbscript throwing error with invalid procedure call or argument error
If you feed something that VBScript can use as a string to .OpenTextFile, the method will try to open a file and perhaps throw a "file not found" error. >> strInputPath1 = "C: est" & "" & "css" & "" & "main.css" >> WScript.Echo strInputPath1 >> set f = goFS.OpenTextFile(strInputPath1,1) >> C: estcssmain.css Error Number: 76 Error Description: Path not found To get an "Invalid procedure call" error, you have to pass something sinister, e.g. an Empty value: >> strInputPath1 = Empty >> set f = goFS.OpenTextFile(strInputPath1,1) >> Error Number: 5 Error Description: Invalid procedure call or argument These facts make it highly probable that you either changed the content of the variable strInputPath1 between its i

Categories : Vbscript

How to send error in signal chain
The primary method to do this is by using -flattenMap:, similar to how you've written the -filter: above. Using your example: RACSignal *B = [A flattenMap:^(NSNumber *number) { if (number.intValue == -1) { return [RACSignal error:[NSError errorWithDomain:@"MyDomain" code:0 userInfo:nil]]; } else { return [RACSignal return:number]; } }]; Update Alternatively, using the newer -try: operator: RACSignal *B = [A try:^(NSNumber *number, NSError **error) { if (number.intValue == -1) { *error = [NSError errorWithDomain:@"MyDomain" code:0 userInfo:nil]; return NO; } return YES; }];

Categories : IOS

Why does this resolved Q promise responds to valueOf() with a promise?
It seems your promise is not resolved yet. It's not well documented, but scattered over the wiki pages I found: The valueOf call returns the promise itself by default. The valueOf method is useful for providing information about the promise in the same turn of the event loop. For example, resolved promises return their resolution value and rejections return an object that is recognized by isRejected. If the promise is fulfilled, promise.valueOf() returns the fulfilled value. If the promise is or has forwarded to a deferred promise, it returns most recently deferred promise. For rejected promises, promise.valueOf() returns a sentinel object with {rejectedPromise: true, reason: {}} When you're doing Thing.fetch(1).then(console.log); it will of course print "b"

Categories : Javascript

Chain of Responsibility Dynamic Chain
Do you want to give users ability to build chains... without ability to build chains? Either user is responsible for chaining objects, or throw the chaining away and provide any collection for FieldProcessors (then call them in order they're in collection). If the chaining is important, the best you can do is a chain validation for cycles and unreachable links before processing.

Categories : C#

Keytool error: Failed to establish chain from reply
You should keep your trial_ca_ssl.cer text on top of top server.cer. This will make a hierarchy of two certificate like this. Then you should import it. -----BEGIN CERTIFICATE----- MIIDSjCCAjKgAwIBAgIIEvabM2CgLZcwDQYJKoZIhvcNAQEFBQAwMzETMBEGA1UE AxMKV2FsdGVyIENBMTEPMA0GA1UEChMGV2FsdGVyMQswCQYDVQQGEwJTRTAeFw0w MzA5MjkwOTI2MzRaFw0wNDA5MjgwOTM2MzRaMDMxEzARBgNVBAMTCldhbHRlciBD QTExDzANBgNVBAoTBldhbHRlcjELMAkGA1UEBhMCU0UwggEgMA0GCSqGSIb3DQEB AQUAA4IBDQAwggEIAoIBAQC3hXksEud68WwPWWHLJQQkTCuX/K32KHPPn/uPUzab Cpc/FnaTmF9yEHmpFdAUr0v5ZPnxVQpcuwrDZc4YfaTLfyUHicQbkftsPAj/2hE4 UukS2j+nQQcJEnIY0vSZOAOLU3j4bf/RlS6Jl7TPFFfWTxuQF8AruQ+YhaE52JFi SapGGXKQJxhsvKT91rLaWSFWNMTTLSDPaBXYEYFuFhLNclDJWf4whfxHSHHkARB/ 3Z0XlT4sFj0fmqEQ6yQb6/WqMFK+1XAIBXZO2MXe26IigWkXw1GfkIx1+fbUPrzu 8EI2jb0TWl21

Categories : Java

How can I know the error reason in promise's rejection handler?
Handling of errors returned by the server is not yet fully implemented in ember data. For reference, as stated in this blog post about ember-data: We want to make error handling and dealing with client and server conflicts rock solid. A pull request from Paul Chavard is currently open and looks like a solid starting point for error handling. You should see much more development on this in the near future. But there are some workaround you can do to get to that information in the meanwhile. For example: Ember.RSVP.configure('onerror', function(error) { console.log(error.message); console.log(error.stack); }); Or use a dirty hack to get to that information. Since ember-data uses jQuery under the hood you can subscribe to ajaxError: $(document).ajaxError(function(event, jqXHR,

Categories : Ember Js

WCF error "The X.509 certificate chain building failed" despite trusted root CA
I had this problem - this is what I'd suggest: On the server, make sure that the root cert is located on the "local computer" side of the computer, not "Current User". The other thing is that the SSL cert needs to be derived from the root cert. I eventually got it all to work using a script that included these lines: rem creates root authority file and cert in localmachine oot and gives it the right to sign certs makecert.exe -a sha1 -n CN=RootCert RootCertName -sr LocalMachine -ss Root -sky signature -pe -r -sk MyNewKey -cy authority rem creates ssl cert, puts it in the currentuserPersonal store, signing it based on the root cert makecert.exe -n cn=HostURL SSLCertName -is root -ic RootCertName -sky exchange -pe -sv SSLCertPrivateKeyName -eku 1.3.6.1.5.5.7.3.1 It's complicated, t

Categories : Wcf

jquery configuration error: readyList.promise is not a function
I ran into this error on a page where an earlier (non-jQuery) script had defined Object.prototype.extend, so when jQuery tried to call jQuery.extend (inside the definition of jQuery.Deferred, which is the constructor for readyList) it was overridden by the non-jQuery definition. This caused readyList not to inherit the promise method, which caused the error. For example, the following HTML recreates the "TypeError: readyList.promise is not a function" error in the Error console: <!doctype html> <html lang="en" dir="ltr"> <head> <meta charset="UTF-8"> </head> <body> <script type="text/javascript"> Object.prototype.extend = function(){ console.log('Object.prototype.extend', this, arguments); for (var i = 0; i < argume

Categories : Javascript

AngularJS Resource error callback being called with a promise
I solved the problem. The error was in my HTTP interceptor, where upon an error code, I was accidentally returning $q.reject(promise) rather than $q.reject(response). The bugged version: .factory('httpInterceptor', function($q) { return function(promise) { return promise.then( // On success, just forward the response along. function(response) { return response; }, function(response) { // ... where I process the error return $q.reject(promise); } ); }; The fixed version: .factory('httpInterceptor', function($q) { return function(promise) { return promise.then( // On success, just forward the response along. function(resp

Categories : Angularjs

How to resolve a promise inside another promise?
Here is an example that essentially does what you need: public static Result social() { final F.Promise<WS.Response> twitterPromise = WS.url("http://search.twitter.com/search.json").setQueryParameter("q", "playframework").get(); final F.Promise<WS.Response> githubPromise = WS.url("https://api.github.com/legacy/repos/search/playframework").get(); return async( twitterPromise.flatMap( new F.Function<WS.Response, F.Promise<Result>>() { public F.Promise<Result> apply(final WS.Response twitterResponse) { return githubPromise.map( new F.Function<WS.Response, Result>() { public Result apply

Categories : Java

Resolve promise based on another promise
It doesn't work as well for more complex functions, but in your example you could do something like: case 'can_we_do_it_like_this': return funReturningPromise(); You can also try adding your own promise.prototype.chain method if you're using only q promises.

Categories : Javascript

Using PDF.js throwing a 404 error
So the problem is that you cannot use any pre-built pdf.js that you find on the web. You MUST build the js from the git repo yourself. I installed the git command line tool, get the repo, install Node.js, run the make command and use the resulting js files in your code. The instructions on git were clear and concise, and I had only one problem: I got an "unexpected token" when loading the file. It was around line 24, my build produced this: PDFJS.build = ''git' is not recognized as an internal or external command, operable program or batch file. '; I just replaced this line with a generic: PDFJS.build = '695e92c'; and it all worked fine. (well, I still need to make a viewer) But i have no errors now. Hope this helps someone.

Categories : Javascript

Angularjs what is the differences of handling ajax from success/error and promise?
According to the Angular documentation, {HttpPromise} – Returns a promise object with the standard then method and two http specific methods: success and error. The then method takes two arguments: a success and an error callback which will be called with a response object. The success and error methods take a single argument - a function that will be called when the request succeeds or fails respectively. To answer your question, the only difference is that success and error only take one argument, whereas then takes two arguments. The first will always be invoked before the second, simply because you've listed it in that order, and that's how promises work. If you had listed another then, then it would be invoked third.

Categories : Angularjs

AngularJS Promise - error while navigating away from page if data still loading
Try to use onbeforeunload event like this: var isUnload; function getEmployees() { var deferred = $q.defer(); $http.get("/api/employees").success(function(data) { deferred.resolve(data); }).error(function() { if (!isUnload) { deferred.reject("An error occurred while retrieving data."); } }); return deferred.promise; } window.addEventListener("beforeunload", function() { isUnload = true; });

Categories : Javascript

new Angular.js 1.1.5 resource returning promise then() function error followed by another request
Fully exposed promises are currently only avaliable in master (commit https://github.com/angular/angular.js/commit/05772e15fbecfdc63d4977e2e8839d8b95d6a92d). Beginning with 1.1.3, $resource exposed the promises' then function via $then (likewise $resolved): Template.$addNew(value).$then( function( value ){newids.push(value);}, function ( error ) {console.log ('error')} )

Categories : Angularjs

Response.End() throwing an Error
Try this code: Response.ContentType = "application/octet-stream"; Response.AppendHeader("Content-Disposition", "attachment; filename =" + strFileName + ".xls"); Response.TransmitFile(strFilePath); HttpContext.Current.ApplicationInstance.CompleteRequest();

Categories : Asp Net

Why this program is not throwing any error?
Since you are only asking about the declaration of p: char **ptr[] = {s+3, s+2, s+1, s}, ***p;//Here is the same as: char **ptr[] = {s+3, s+2, s+1, s}; char ***p;

Categories : C++

PDO throwing error if MYSQL_ATTR_INIT_COMMAND is used
You are using PHP >= 5.3.6, so add charset to dsn and don't use PDO::MYSQL_ATTR_INIT_COMMAND. Further I think you can only execute 1 query with PDO::MYSQL_ATTR_INIT_COMMAND. That might be the problem. mysql:host=localhost;dbname=php_orm_test;charset=utf8

Categories : PHP

IE8 is throwing error with jQuery
jQuery 2.0 dropped support for some browsers. See the release post at http://blog.jquery.com/2013/04/18/jquery-2-0-released/ Quoting from the post: No more support for IE 6/7/8: Remember that this can also affect IE9 and even IE10 if they are used in their “Compatibility View” modes that emulate older versions. To prevent these newer IE versions from slipping back into prehistoric modes, we suggest you always use an X-UA-Compatible tag or HTTP header. If you can use the HTTP header it is slightly better for performance because it avoids a potential browser parser restart. Reduced size: The final 2.0.0 file is 12 percent smaller than the 1.9.1 file, thanks to the elimination of patches that were only needed for IE 6, 7, and 8. We had hoped to remove even more cod

Categories : Javascript

Set variable in Jinja throwing error
Why not use the Jinja2 built-in last() filter? http://jinja.pocoo.org/docs/templates/#last i.e. try: {% for key, values in chat_data.items %} {{values.from}} <br/> <b> Query: </b>{{values.init_query}}<br/> {{ values.chat|last }} {% endfor%} Using set should still work though.

Categories : Django

Why is mechanize throwing a HTTP 403 error?
The trick is probably in the request headers selenium is sending, apart from the user agent header, some servers check other headers as well to ensure a real browser is talking to them. look at one of my older answers: urllib2.HTTPError: HTTP Error 403: Forbidden In your place, I would try adding all the headers your real chrome browser sends, and then eliminate the unnecessary ones.

Categories : Python

On edit of my form It is throwing error
So, after all our chatting, you had to: Make your column not nullable. This is not required, but it makes no sense to have a null-approved user Update your model to fit your table's new column with a public bool Approved { get; set;} Use it on your view with Html.CheckBoxFor(e=>e.Approve)

Categories : C#

SQL xml output parameter throwing error?
Unfortunately the answer to your question is no. The driver does not support reading stored procedure output of the XML data type. If you have to use the XML data type as an output parameter, you must first convert the XML data type to a VARCHAR or LONGVARCHAR in the stored procedure before it can be read.

Categories : SQL

Why is include? throwing an argument error?
http://www.ruby-doc.org/core-1.9.3/String.html#method-i-include-3F Returns true if str contains the given string or character. That means it requires exactly 1 argument, so no wonder it throws ArgumentError when called without arguments. So the code should be: if $next_move.include? 'instructions' puts '$next_move is instructions' else puts '$next move is NOT instructions' end

Categories : Ruby

MySQL throwing error on second JOIN
Please make sure that WHERE condition must be after all JOIN SELECT sales_order.created_at , order_item.order_id, sales_order.increment_id, SUM(order_item.qty_ordered) AS qty_ordered , COUNT( * ) FROM order_item JOIN sales_order ON sales_order.entity_id = order_item.order_id JOIN product_catalog ON product_catalog.entity_id = order_item.product_id WHERE product_catalog.size = 14 AND sales_order.created_at > '2012-11-15 00:00:00' GROUP BY order_item.order_id; First of all you have to JOIN your tables which you need. Then after WHERE clause come for conditions.

Categories : Mysql

Ajax Post Throwing Error
There's an error in your ajax post method or your controller. If you leave the ajax method as is, you can modify your controller to: [HttpPost] [ActionName("FirstAjax")] [OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")] public JsonResult FirstAjax() { var postedData = new StreamReader(Request.InputStream); var jsonEncoded = postedData.ReadToEnd(); //String with json //Decode your json and do work. return Json("works", JsonRequestBehavior.AllowGet); } If you don't want to change the controller, then you need to change the javascript to: var serviceURL = '/ContactForm/FirstAjax'; $.ajax({ type: "POST", url: serviceURL, data: { contactForm: JSON.stringify(formInfo) }, contentType: "application/json; charset=utf-8",

Categories : Asp Net Mvc

Execution of variable throwing error
You need to bind the output columns of your SELECT statement to some output variables. Otherwise, you are just executing the statement, and nothing is returned. Here is an example: DECLARE v1 NUMBER (10); v2 VARCHAR2 (20); BEGIN EXECUTE IMMEDIATE 'select 1, ''hello'' from dual' INTO v1, v2; DBMS_OUTPUT.put_line ('v1 = ' || v1); DBMS_OUTPUT.put_line ('v2 = ' || v2); END; (output) v1 = 1 v2 = hello This will only work if you are returning one row. If the query is returning multiple rows, you need to open the results into a cursor. Example: DECLARE TYPE EmpCurTyp IS REF CURSOR; -- define weak REF CURSOR type emp_cv EmpCurTyp; -- declare cursor variable my_ename VARCHAR2(15); my_sal NUMBER := 1000; BEGIN OPEN emp_cv FOR -- open cursor variab

Categories : Oracle

410 code not getting captured but throwing error instead
This is how GetResponse method works. It throws an exception when it does not get code 200. Try to put your request.GetResponse() into try .. catch block. Catch WebException. In catch clause you can handle situation, when the status code is not 200. try { HttpWebResponse response = (HttpWebResponse)request.GetResponse(); } catch(Exception ex) { var exStatusCode = ex.Code //check the status code against this var exResponse = ex.Response //use your response like this }

Categories : C#

PYAML throwing a representation error
YAML does support nested recursive structures: import ruamel.yaml data = [1, 3] data.append(data) print ruamel.yaml.dump(data) Will give you YAML with an anchor (&id001) and a reference (*id001): &id001 - 1 - 3 - *id001 And your simple derivative of a dict can be dumped, at least with ruamel.yaml without a problem as well¹: import ruamel.yaml class NestedDict(dict): """Implementation of perl's autovivification feature.""" def __getitem__(self, item): try: return dict.__getitem__(self, item) except KeyError: value = self[item] = type(self)() return value data = NestedDict(a=1, b=2) data['c'] = data print ruamel.yaml.dump(data) This gives you: &id001 !!python/object/new:__main__.NestedDict dictitems: a:

Categories : Python

PHP PDO throwing Fatal error 1064
You cannot specify parameter for table name and column names. Change your $stmt like follows: $stmt = $pdo->prepare("SELECT Username, Password, Email FROM $table WHERE Username = ?"); And your execute as follows: $stmt->execute(array($user)); Here is a good explanation why you cannot specify parameter for table names or column names: http://www.php.net/manual/en/pdo.prepare.php#111977

Categories : PHP

Paperclip throwing NilClass error for .first
I suspect one of your assets may not have a photo stored. Try doing this instead: <%= @gallery.assets.first.photo.url(:thumb) if !@gallery.assets.empty? && @gallery.assets.first.photo %> or even better put something like this in your gallery model; def thumb_url unless assets.empty? assets.first.photo.url(:thumb) if assets.first.photo end end and then in your view: <%= @gallery.thumb_url %>

Categories : Ruby On Rails

Compiler error when throwing exception
According to cppreference.com std::length_error has the two constructors: explicit length_error( const std::string& what_arg ); explicit length_error( const char* what_arg ); And you are trying to construct with an empty parameters list. You need to pass in a string to the constructor.

Categories : C++

Perl code is not throwing any error
$b is a predeclared variable in Perl. It is used with sort() like so: my @sorted = sort { $a <=> $b } @list; It is documented in perldoc perlvar.

Categories : Perl

CAML Query throwing error
You have some basic syntax errors in your query above, so they may be causing the issue. See if this helps. You were missing a left angle-bracket in the first tag. You had too many tags and they were out of sequence. I changed the Type attribute of the first tag to Text. <Where> <And> <Eq><FieldRef Name="Status" /><Value Type="Text">Completed</Value></Eq> <And> <Geq> <FieldRef Name="Created" /><Value IncludeTimeValue="TRUE" Type="DateTime">2013-07-02T00:00:01Z</Value> </Geq> <Leq> <FieldRef Name="Created" /><Value IncludeTimeValue="TRUE" Type="DateTime">2013-07-02T23:59:59Z</Value>

Categories : Misc

Update Query Throwing error
You need to add the t1 to from clause the subquery : select t1.price from t1,t2 where t1.customer=t2.customer and t1.sku=t2.sku and t1.weekno= t2.weekno

Categories : SQL



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