How to disable return message from pubnub using pubnub php v4 sdk - pubnub

I am new in PubNub PHP SDK v4. Here's my concern that I would like to ask.
When I ran PHPUnit --filter Nameofcontroller, I've noticed that pubnub sdk is returning messages as such: [2018-08-08 05:16:09] PubNub.DEBUG:
I want to disable it. Is there a way on how to do it? I can't find it in pubnub's documentation guide.
Thanks!

Disable Debug STDOUT Output PubNub PHP SDK 4.0
You can disable the STDOUT print statements by setting up your own NullLogger following the PubNub PHP Troubleshooting guide. Using a Psr\Log\NullLogger instead of Monolog\Handler\ErrorLogHandler is the best option.
use Psr\Log\NullLogger;
use PubNub\PNConfiguration;
use PubNub\PubNub;
$pnconf = new PNConfiguration();
$pnconf->setPublishKey("pub_key");
$pnconf->setSubscribeKey("sub_key");
$pubnub = new PubNub($pnconf);
$pubnub->getLogger()->pushHandler(new NullLogger());
Using this code sample you can redirect all log message output to your desired location such as /dev/null 😉
Reference: https://github.com/Seldaek/monolog/issues/460

Related

How to use and access the preference in thunderbird , in Webextension environment ,not in the legacy

Currently using this method as a legacy method.
this.prefService = Components
.classes["#mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
this.prefBranch = this.prefService.getBranch(root);
but i did not get a complete idea about how to use this in the webextension environment thunderbird .any api in order to use this feature ?
I solved my issue, by using Web Extension experiment.
Implemented the same legacy extension function with the Web Extension Experiment Specification and that solved my need at this moment.
the link mentioned below.
https://thunderbird-webextensions.readthedocs.io/en/68/how-to/experiments.html
https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/functions.html
I think you can use the storage.local API (see documentation, it seems to work the same for Firefox and Thunderbird). This allows you to store data related to your add-on with something like:
let settingItem = browser.storage.local.set(
keys // object
)
and to retrieve or remove it after that (see available methods).

How to set dynamic waterfall steps in Bot framework v4(.net core)?

I have bot in v3(.net framework) for multiple intent and every intent having different set of questions/steps. There I am using 'PromptOption. choice' for showing dynamic set of questions/steps and taking answer from 'resume' method. added code below.
PromptDialog.Choice( context: context, **resume: ResumeAfterPromptAnswer, options: promptData.Choices**, prompt: promptData.Text, retry: BotConstants.InvalidSelection, attempts: 2, promptStyle: PromptStyle.Auto );
Now I am trying to migrate my bot to v4 but I am not getting such prompt functionality in V4. just having option for waterfall steps but not able to add steps dynamicaly.
If you have any solution please post it.
Thanks in advance.
What you're attempting to do is entirely possible in v4. I recommend checking out these community extensions, since they offer some v3-ish functions in v4:
Bot Builder ChoiceFlow (I think this is what you're looking for)
Bot Builder v4 FormFlow
Alternatively, you could use the vanilla v4 SDK and Create advanced conversation flow using branches and loops. The Complex Dialog Sample is a pretty good example of how to do this.
All that being said, I don't 100% understand what you're asking. If this doesn't address your question, please provide an example conversation flow and I can adjust my answer.

There is a crash when I use MimeKit in Xamrain.IOS

Intalled the Mime Kit and MailKit to packages folder of xamrion.IOS, and try to use them to send an email. It works, but there is a crash when running new MimeMessage()
How to fix this issue.
I am a super beginner with IOS AND Xamarin, thanks very much for your help.
About 6 or 7 lines unable to locate assembly 'I18N' (culture:'')
Log:
2017-07-27 16:18:05.103 AAAA.iOS[523:215341] Xamarin.iOS: Unable to locate assembly 'I18N' (culture: '')
async public void sentEmail(string fileName, string addressEmail)
{
var message = new MimeMessage();
System.Diagnostics.Debug.WriteLine(" SendMail MimeMessage ");
First off, if you are using the simulator you will not be able to send emails using anything that depends on Apple's mail app because it is not installed on the simulator.
If that's not the case, i would recommend using UIMessage instead. Xamarin has great documentation on how to create a pop over view to compose an email and send wit from inside your custom application.
EDIT:
here is the the link to the Xamarin tutorial on sending emails.
You need to go into your iOS Project Options -> iOS Build options and then enable the i18n assemblies to be included.

How to debug a '4005 Path Not Found' error?

I am trying to integrate Pusher with my web application that uses backbone.js. I'm following the Pusher with Backbone guide in the Pusher docs.
So I'm seeing this error pop up in the web console on application start up
Pusher : Error : {"type":"PusherError","data":{"code":4005,"message":"Path not found"}}
What is this 'path' that cannot be found? I found nothing in the Pusher docs.
A 4005 error generally means that the WebSocket URL you are using doesn't identify an application to connect to.
In terms of usage of the Pusher JavaScript library this means you've likely supplied an empty string as the app_key to the Pusher constructor.
var pusher = new Pusher('');
You can see this in action here:
http://jsbin.com/evulaj/1/edit
Open the JavaScript console to see the error. You can also check the app_key value set by checking pusher.key.
Note: I appreciate this error is a bit cryptic. I'll see if we can remedy this
in my case, wsHost: process.env.MIX_PUSHER_WS_HOST was giving an empty value, and fixed it by changing .env file.
PUSHER_WS_HOST=my.host.com
MIX_PUSHER_WS_HOST="${PUSHER_WS_HOST}"
or you can do:
wsHost: window.location.hostname

Output to Chrome console from Node.js

I'm looking for a way to output Node variables directly into the google chrome browser console. The same way a console.log() works on the client side. Something like this for php. This would greatly speed up development.
NOTE:
Since the old answer (written in september 2014) refers to an older version of node-inspector, my instructions are not relevant anymore in 2017. Also, the documentation has gotten a lot better, so I have updated my original answer:
node-inspector is what you need.
It opens up an instance of Chrome with its developer tools for debugging.
It's also easy to use:
1. Install
$ npm install -g node-inspector
2. Start
$ node-debug app.js
Source: https://github.com/node-inspector/node-inspector
You might want to try NodeMonkey - https://github.com/jwarkentin/node-monkey
I know it's an old question but came on top of my Google search so maybe somebody will find my answer useful.
So you can use node --inspect-brk index.js
Now, all you have to do is basically just type chrome://inspect in your Chrome address bar and click Open dedicated DevTools for Node
In DevTools, now connected to Node, you’ll have all the Chrome DevTools features you’re used to:
Complete breakpoint debugging, stepping w/ blackboxing
Source maps for transpiled code
LiveEdit: JavaScript hot-swap evaluation w/ V8
Console evaluation with ES6 feature/object support and custom object formatting
Sampling JavaScript profiler w/ flamechart
Heap snapshot inspection, heap allocation timeline, allocation profiling
Asynchronous stacks for native promises
Hope that helped.
The closest thing to this I've seen is Node JS console object debug inspector
See this post for usage and potential issues: http://thomashunter.name/blog/nodejs-console-object-debug-inspector/
For users with nodejs on linux via ssh-shell (putty):
Problem with nodejs on linux-ssh-shell is, that you have no browser connected.
I tried all this solutions, but didnt get it to work.
So i worked out a solution with firebase (https://firebase.google.com), because my project uses firebase.
If you are familiar with firebase, than this is a great way. If not, firebase is worth using in combination with nodejs - and its free!
In the server-side-script (started with node) use a own function log():
// server-side:
// using new firebase v3 !
var fbRootRef = firebase.database();
var fbConsoleRef = fbRootRef.ref("/console");
var log = function(args) {
fbConsoleRef.set({'obj': args});
}
// inside your server-code:
log({'key':'value'});
On client-side you create a firebase-reference on this console-object:
// client side:
fbRootRef.child('/console').on('value', function(d) {
var v = d.val();
console.log(v);
});
Now everything logged on server-side with the log() - function is transferred in realtime to the firebase-database and from there triggering the client-console-reference and logged into the browsers console.
If anyone needs help, i will explain in more detail and could give a more extended version of this logging with types (console./log/warn/info), grouping with title-info (i.e. server says: (filename + line).
Setting up firebase for your project is done in max 30 minutes, inserting the console-function in 30 minutes. I think its worth the time!
You can use bonsole, a simple way to log something in browser. Even in Linux, you can go to the LAN's ip to check it.
The most simple way with least dependencies is using a WebSocket connection to send the messages to the browser. Any WebSocket example you can find on the internet will suffice to accomplish this. Everything else requires to be heavily integrated into the host system and wouldn't work if you want to actually run this on a remote server. You can also send commands to the server directly from the browser console this way.
Links:
https://www.npmjs.com/package/websocket
https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications

Resources