dbus c api example doesn't work - c

I work on UBuntu 12.04 LTS. I'm trying to use sendsignal and receive functions from this site but they don't work correctly. In my program I first call sendsignal("mySignal) then receive(). I get following info:
Sending signal with value mySignal
Name Error(Connection ":1.95" is not allowed to own the service "test.signal.source" due to security policies in the configuration file)
Because of that I replaced conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err); with conn = dbus_bus_get(DBUS_BUS_SESSION, &err); in both functions. Now a signal is sent but receive function doesn't see that signal, i.e. NULL == msg that's true. I also commented out dbus_connection_close(conn); because of the following error:
process 12612: Applications must not close shared connections - see dbus_connection_close() docs. This is a bug in the application.
How to make it working ?

Maybe try:
Run dbus-launch in a terminal. Copy and paste the terminal output to a file, and edit it to export the content as environment variables. By doing this, you launch a new dbus daemon and exposes it to the subsequent application.
Source the environment setting file in your terminal before running both the signal sending and receiving examples. This makes the app connects to the new session bus.
I'm guessing your sending example is launching its own dbus daemon, but the other app does not have a clue what the daemon is, thus you need to expose the daemon through an env variable. Another possible cause is your sending and receiving application are using the defaule login session bus but the policy does not allow them to use.
Let us know if this works or not.

Related

Correct configuration of SignalR for long running process

Scenario: WPF application that sends a file to a server and the server, in turn, performs a series of validations that can take several minutes, during which the server sends a series of messages to tell the application what it is doing (signalr), in at the end of everything, it warns that the process has ended.
What I'm doing: Every time the application is sending a new file I start the hub await hubConnection.Start() and at the end of it all I stop.
The process consists of: doing some local validations, sending the file to the server, monitoring the processing (signalr) and at the end, if applicable, downloading a file with the error;
It's all working fine, but I'm afraid something might go wrong along the way, flag not sending the messages, etc.
My question: What is the correct way to do this? When should I connect the hub (await for hubConnection.Start())? Should I do this when starting the app? How do I receive the messages later (in each message I have an identifier of the file I am working on)?

Start a ssh login shell using existing connection

My application has an existing ssh connection to a remote server. This application has an socket on the localhost. How can I start a login shell using this existing connection, simular to
ssh user#host
does.
Of course my application has to use some api when a program connects to the socket and wants to start a remote shell. (I can use The Secure Shell (SSH) Transport Layer Protocol https://www.rfc-editor.org/rfc/rfc4253 for that), thats not the problem. My problem is how to redirect stdin and stdout and stderr from the terminal/konsole to the socket.
Can someone give a hint about that? Thanks in advance.
(I have an fuse fs which provides sftp access to different folders on the server, it would be awesome when it can also offer terminal access to the server and possibly a chat session using ssh-chat... user has toc click on a desktop file my fuse fs provides, and the right program is started to make the connection to socket and start the terminal. This of course only works in a graphical environment)

Monaca Localkit Launch Error

When I try to launch the Monaca Localkit application, it shows "Unable to start HTTP server. Maybe the port is occupied. Please change the port and restart the program."
Then, I have changed my port setting many times, but it still shows the same message.
My default port setting is 8001. And I checked whether other application is using this port by netstat command. But no application is using.
I tried to re-install Monaca Localkit application too. But the result is the same as before.
How can I fix this problem? Please give me an advise.
It means that another program is using that port, maybe another instance of localkit? If yes, terminate the program to free the port. You should also check if your firewall allows communications through port 8001.
If you want just to change port, you can open Localkit and go, from the menu bar, to Monaca Localkit -> Preferences and change Listening Port.

How to change the admin port using the Google App engine launcher?

It's easy to change the port of the application using the launcher. Go to Edit>>Application Settings (or alternatively Ctrl+i) and change the port. Since I was getting an error similar to the one given below, I changed the application port from 8080 to 48080. Unfortunately, I am not able to change the admin port from 8000 to 48000, because of which I am getting the following error.
google.appengine.tools.devappserver2.wsgi_server.BindError: Unable to bind localhost:8000
I also tried the method illustrated in the following image (my reference being this link):
Regardless of what I try, my web-browsers (Chrome and Firefox) return a message similar to This webpage is not available. Any ideas are appreciated.
I have seen this before, when I had a crashed instance running on the port. You may have a frozen Python script running on that port. On a Mac, I can go to Activity Monitor and kill the process. Not sure if you can do that via task manager in Windows. You may need to restart machine.

Start application from driver

Can I start another application from a driver code? The code is written in C and compiled with DDK.
I don't think so. Instead:
You can have a service which sends down a DeviceIoControl to the device.
The device then keeps (doesn't complete) the associated IOCTL
When the device wants to launch the application, then it completes the IOCTL
When the service notices that its DeviceIoControl has been completed, then it starts the other application
A service could launch an application but I don't know whether it can launch it on the user's desktop. If you want the launched application to interact with the logged-in end-user user then, instead of having a service as described above, it would be better to put the DeviceIoControl functionality in a (visible or invisible) application, which is started automatically in the user's workstation when the user logs in.
If you do this then beware assuming that there is only one logged-in user (there may be many, on a Citrix/terminal server).

Resources