I am a new user of SMACK chat API. I am trying to write a multi user chat application but not able to do it. Can anyone give me simple full version of code for this.
Here is my code
ConnectionConfiguration config = new ConnectionConfiguration("127.0.0.1",5222);
connection = new XMPPConnection(config);
connection.connect();
connection.login("aa", "bb");
MultiUserChat muc = new MultiUserChat(connection, "test#testdomain");
muc.join("nick");
One thing I notice about your code is that you do not add a message listener anywhere. Your code will not be notified of new messages unless you call something like
muc.addMessageListener(...
Related
I am building a chat application using botframework v4 with .net core. I want to implement customized typing indicator. Currently I am using below code and it is showing typing indicator like below image
public async override Task OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken = default)
{
ITypingActivity replyActivity = Activity.CreateTypingActivity();
await turnContext.SendActivityAsync((Activity)replyActivity);
await Task.Delay(5000);
await base.OnTurnAsync(turnContext, cancellationToken);
}
output:
But instead of showing this typing symbol(...), I need to show some customized message (like bot is typing) and after getting bot response indicator need to remove automatically.
Using WebChat, there's not a built-in way to easily customize the typing indicator. But you should be able to modify the css. I would start with some investigation here.
If you are wanting to do this for more than just WebChat, that might not be possible. Instead of using typing activities, you might be able to use proactive messages to accomplish the goal.
I need to display a few of webpages from a remote Apache webserver for the IoT Core app I'm developing. I've used the WebView class method .Navigate() for non-protected pages and It works really neat. However, for my project, I need to login first into the webserver (username + password) and then retrieve the info from the pages, but I don't know how to do it using the WebView class. I'm clueless.
I found a solution that uses the WebBrowser class Navigate(), sending the credentials as a 64 base encoded string, but the Navigate() of WebView only allows 1 argument, the URI, and nothing else. I can't seem to find WebBrowser class neither.
I've already tried to embed the username/password into the URI but It's not working properly and I'm aware It's not a good idea to do it so.
Is it possible to achieve this using WebView?Any suggestions/ideas?
Any help appreciated
Edit: I've found a solution that works well for my problem, I'm posting it in case it can be of help to someone with similar issues.
Uri req_uri = new Uri(uri_list[i]);
HttpBaseProtocolFilter filter = new HttpBaseProtocolFilter();
filter.ServerCredential = new PasswordCredential(req_uri.ToString(), "username", "password");
HttpCookieCollection cookiejar = filter.CookieManager.GetCookies(req_uri);
if (cookiejar.Count > 0)
{
foreach (HttpCookie cookie in cookiejar)
{
filter.CookieManager.SetCookie(cookie);
}
}
Windows.Web.Http.HttpClient client = new Windows.Web.Http.HttpClient(filter);
Windows.Web.Http.HttpRequestMessage http_req = new Windows.Web.Http.HttpRequestMessage();
http_req.Method = Windows.Web.Http.HttpMethod.Get;
http_req.RequestUri = req_uri;
var clientResponse = client.GetAsync(req_uri);
webView.NavigateWithHttpRequestMessage(http_req);
http_req.Dispose();
client.Dispose();
You might me able to use the NavigateWithHttpRequestMessage which would allow you to navigate to a page using a HttpRequestMessage.
You would still need to authenticate out-of-band, using HttpClient, obtain the cookies and authentication headers, then use them when you build your HttpRequestMessage.
Here's a StackOverflow that should help with that
If your remote web server supports HTTP Basic authentication you can pass the credentials in the URL like so:
https://Username:Password#www.example.com/index.html
I want to create get and forget Url using vb.net. Basically I will push an url(just get response from url, not showing in the browser/run in background) and forget. I want push 10 url at the same time when I the button clicked. Here's my code, but it still processing the url the url one by one.
I have tried using Task, but I got an error when including "Imports System.Threading.Tasks" because my .net framework version still 3.5.
It is impossible to upgrade my .Net version, so is anyone have an advice?
Please let me know what should I do, thanks before :)
You can use regular threads for this sort of thing. My VB.Net is very rusty. Here's approximately what I would do in C#. It should translate directly to VB.Net
List<Thread> threads = new List<Thread>();
foreach (string url in MyUrls)
{
Thread t = new Thread(() => MyUrlPushMethod(url));
t.Start();
threads.Add(t);
}
foreach (var thread in threads)
{
thread.Join();
}
I would like to be able to gather info like how often certain windows are opened, what types of user data are accessed, how often menu items are clicked, etc. Does anyone know of a 3rd party (open source or commercial) Cocoa/Obj-C library or plugin that would allow me to gather this info?
I have used pinch media in the past, and they merged with Flurry. Library was simple to use and was setup in around 40 minutes.
I don't know any library for that but at least to get informed about when the user switches the front application you can install an event handler like this:
EventTypeSpec eventType;
eventType.eventClass = kEventClassApplication;
eventType.eventKind = kEventAppFrontSwitched;
EventHandlerUPP handlerUPP = NewEventHandlerUPP(FrontAppSwitchedDetector_callback);
OSStatus status=InstallApplicationEventHandler(handlerUPP,1,&eventType,self,&_eventHandlerRef);
... and when receiving an callback you may get the current front application process:
pascal OSStatus FrontAppSwitchedDetector_callback(EventHandlerCallRef nextHandler,EventRef theEvent,void* userData)
{
ProcessSerialNumber newSerial;
GetFrontProcess(&newSerial);
//to something with that ....
return (CallNextEventHandler(nextHandler, theEvent));
}
I'm having trouble in testing an RCP application with Sleak because it does not display anything, it only shows the message "WARNING: Device is not tracking resource allocation".
I've setup Sleak from this tutorial and I don't know what's wrong.
Does anyone know a solution for this? Thanks in advance.
Do you have the correct version? Can you see the sleak view in your RCP-application? If not make sure it's in your launch configuration. Also double check that you have set the
org.eclipse.ui/debug=true
org.eclipse.ui/trace/graphics=true
correct in the tracing tab. There are properties with similar names.
You can write
org.eclipse.ui.internal.misc.Policy.DEBUG_SWT_GRAPHICS = true;
org.eclipse.ui.internal.misc.Policy.DEBUG_SWT_DEBUG = true;
before
Display display = PlatformUI.createDisplay();
This will create in Workbench.createDisplay() method
new Display with data tracking.