parse4cn1 callback usage example - callback

I have been using the new parse4cn1 and I must say its been pleasant, until I tried to use the signUpcallback and logincallback to direct users in my app to the "welcome" form after successful sign up or login. All I tried didn't work. So please I would like to see some working examples of parse4cn1 callback and if possible codename one callbacks in general.Thanks all

Good to hear that you find parse4cn1 useful!
There aren't any callback examples because parse4cn1 does not (yet) support asynchronous calls. This is not because of any technical limitations and should be straightforward to implement.
Support for callbacks isn't planned yet but you're free to give it a shot and I'll be glad to merge your PR (in that case please be sure to first check the guidelines for contributing).

Related

how do we know if what customer says meet the intent?

I'm new to Dialogflow and I want to learn something from it. Currently I'm stuck with 2 problems. First is how do we know if what customer says meet the intent?:
According to google's tutorial, it puts in training phrases:like the screen shot. In my case, I don't know how to trigger the intent. I tried My favorite color is Tony. It would ask as what I expected:What's your favorite color. But if I just say, Tony, It would goes to the fallback case. I'm confused about how would the intent be trigger. Is it by entity? or something else?
In addition, I currently wrote a coupon lines of code on linux(which could convert to other language as well) to turn on and off a board's led light(my friend helped me). However, since I'm new to dialogflow and I want to do things like: If I talk to google, it would turn it on/off. I'm wondering how should I do it. Could I get some hint? I never learned api before and I could certainly learn it on my own. I just wanna need some help.
p.s: I learned one year C++, so I'm not familiar with javascript, if completing this project requires javascript, I would certainly do that. Just need some hint pls.
Thanks!!
First, you should know that you need not learn any other language if you are already good at something & that is cause Dialogflow offers you SDKs for that. You can check it out over here: https://dialogflow.com/docs/sdks.
Now coming to your query, when user enters anything, that query comes to dialogflow & then it tries to find matches between different training phrases that you have entered in your intent. If there's a match found, having scored more than threshold, it sends us the response defined for that intent. You can even define custom entities, such as for colors, it would just help dialogflow to find more accurate intent. Following snaps should help you understand a situation better:
1. Intent-1
2. Intent-2
3. Custom entity
4. Output
Hope this answers your query.

Why doesn't Catalyst support routes dispatching

I'm wondering why Catalyst does not have a routes-based dispatching mechanism. Does anyone have insights on that?
I know most of it would be achievable with chained methods, but I sometimes struggle with them (my bad, I know). I used routes in Mojolicious and they feel somewhat more comfortable.
I'm tempted to roll my own based on Path::Router, but before I embark on such a project I thought I'd ask some wise people.
And, while I'm at it, is there any good source for understanding dispatching in Catalyst, beside reading the code?
Thanks-
It is possible to construct routes as the dispatching mechanism in Catalyst. This SO question and answer discusses it, and the meaty part can be found in this Advent Calendar article.
That first link will also refer you to The Definitive Guide to Catalyst, a book well worth getting hold of. Dispatching is discussed at length therein.

IcedCoffeeScript or jQuery deferred

Recently while working on a Backbone.JS/jQuery/CoffeeScript project, I found myself in a mess of callback and timing issues. I needed to wait for something to complete before proceeding and found myself in a mess of nested callbacks ... which is confusing and hard to debug. Then I found 2 possible solutions jQuery deferred or IcedCoffeeScript
IcedCoffeeScript looks really easy, simply adding await & defer. However, I wonder if its there to stay? Only 2 questions here on StackOverflow? Not much talk about it compared to CoffeeScript
Another thing is whats the difference between the 2 methods, they seem to do mostly the same thing? Except in IcedCoffeeScript, it looks more like procedural code, and in jQuery deferred, it doesn't solve my mess of callbacks as much
These are very different technologies:
IcedCoffeeScript is a precompiler that extends CoffeeScript with the await and defer keywords that transform code for you so that you can write code in a synchronous style. In the generated JavaScript, await and defer produce nested functions.
jQuery Deferred (aka Promises) are a way of side-stepping callbacks altogether: Instead of taking a callback, an async function can return a Promise. You then attach callbacks to the Promise. It's a simple, but powerful technique. I devote a chapter to it in my book, Async JavaScript.
Each of these technologies works best with a certain kind of API. await and defer expect a function to take a single callback as its last argument. Promises work best when you have lots of other Promises in your app.
There's no magic bullet for dealing with async behavior in JavaScript. You need to understand callbacks, Promises, and PubSub (aka EventEmitters) and choose the best tool for each job. Even if you use IcedCoffeeScript (which is cool), there are still times when Promises will save you a huge amount of work.
I hope that helps. Check out my book, Async JavaScript, for much more information.
I think IcedCoffeeScript is here to stay.
I plan on supporting it indefinitely, and am pretty regular in patching it against the mainline. I use it on almost all of my personal projects, and the site Combosaurus.com, an OkCupid Labs project just about to hit general release, is written in IcedCoffeeScript.
I wrote a blog post about the differences between standard event callbacks, pub sub and deferreds, which might help you out:
Event Emitter, Pub Sub or Deferred Promises … which should you choose?
The intro reads:
The obvious answer to the question “should you choose an Event
Emitter, Pub Sub or Deferred / Promises” is that it depends on what
you are doing.
In this post I will explore a little about how each pattern works with
(very) basic implementations, and then I’ll look at the reasons why
you might choose one over another.
And the summary is:
Event Emitter is a real classic, and allows for good practices and
control over things that happen; Pub Sub is more flexible for
cross-component events; Deferred and Promises give a powerful way to
handle callbacks.
Applying the summary to your problem - I would suggest that Deferred's and Promises would probably help you out a lot.
I don't know about you, but I found getting my head around how I would implement Deferred really helped me understand the intricacies of using it. I've included some sample code in the post too, which being (extremely) simple, might help you out when looking at someone else's more robust attempt.
Oh, I'd definitely rely on IcedCoffeeScript. If you like and use CoffeeScript syntax, you'll find out it simply "blends" naturally with it...
Regarding the project future, I had the same dilemma a while ago, but it looks like Maxwell Krohn is actively maintaining it and there's a growing community and awareness around it (ok, maybe not here on stackoverflow yet).
I've started using it last year and now I couldn't really imagine coding "real-life" apps without await and defer.
You can find a brief "protip" on elegant asynchronous control flow with ICS here and I also wrote a 5-parts ironically-titled article on using Node.js for generic web projects here mentioning ICS.

Implementation of SimulTweet for twitter?

I'm wondering if anyone has any tips on how to implement the SimulTweet function that Twittelator Neue has?
This feature allows you to send a single tweet from multiple twitter accounts at the same time.
I am keen on implementing something similar...and I"m not sure where to start.
https://img.skitch.com/20111205-ngqp8tppuprr7w4r9jig65pm2y.jpg is a screen cap of the interface.
Take a look at ShareKit. It doesn't do the simultaneous tweeting, but it has all the code you need to implement it. I'm currently implementing this for a project. When it's finished I'll try to share the code somewhere.

How to implement Urban Airship for Push notification in iPhone?

I'm trying to use urbanairship push notification. But while creating instance of UAirship, it is showing error that UAirship is undeclared.i have implemented urbanairship upto http://urbanairship.com/docs/apns_test_client.html#prerequisite and after then i do not know what should i do ? Waiting for response. Thanks.
Have you included UAirship.h and UAPush.h ?
I got something similar just now. Might not be the same problem, but there seems to be a massive bug in the UA library - a combination of careless code design, and badly written code.
Apparently ... you MUST NOT make calls to "UAPush" until AFTER you have invoked
[UAirship takeOff:...]
This shouldn't be a problem. Firstly, UA shouldn't crash! Secondly, there's plenty of calls to UAPush that make sense before calling takeOff. So far as I can tell, this is undocumented (like most of UA, sadly :( ). i.e. I'd read through the official website and the scant docs multiple times, and never saw mention of this requirement.
See https://docs.urbanairship.com/display/DOCS/Getting+Started%3A+iOS%3A+Push, the mostly simplest guide with pictures... Watch for the possible cases you have missed which you shouldn't have.