Where to find information about Nautilus D-Bus interface - dbus

I am planning to develop a command line application that interact with Nautilus, but I cannot find a reference for the D-Bus interface that Nautilus exposes.

For the time being, the only DBUS interface that nautilus implements is this:
http://www.freedesktop.org/wiki/Specifications/file-manager-interface/

Although I haven't found any doc on this either, at least you can use sth like d-feet to find out what interface/method/etc. nautilus has.
(and I don't think there are a lot of useful functions~~)

Related

Retrieve network camera stream URL in Linux

I am trying to retrieve rtsp URLs of cameras on my network. I can do this using Onvif Device Manager on Windows but how to do this on Linux using C/C++ or command line tool. I have tried various libs e.g. onvifc (OpenCVR) and onvifcpplib but none of them could compile on Linux, neither they have API documentation. Any suggestions please!
I was able to find a gsoap-onvif solution from https://github.com/tonyhu/gsoap-onvif. This programs successfully retrieves parameters from most of the Onvif complaint cameras.
you can have a try with python onvif, some feature you can use, may be other feature such as PTZ you can use .
also, you can have a try with opencvr's another project, https://github.com/veyesys/h5stream, if you can't compile,you can download from sourceforge.
Good luck.

Detect when new file is added to a directory

How can I detect a new file being added to a specific directory?
What I am looking for is something like an event_listener for when a new file is created. I am not interested in using a loop that keeps searching the directory for new files because I need the name of the file when it is added to the directory.
Unfortunately, there is no native Erlang API to perform what you are looking for.
Any non-polling solution has to rely on specific APIs from the operating system. On MacOS X and FreeBSD, you could use kqueue(2) API. On Linux, you could use inotify(7) API. Both APIs work with select(2) and you can use Erlang's driver_select function to select on the file descriptors provided by these APIs. Writing such a driver is not extremely difficult.
You can find on Github several drivers for inotify and one driver for kqueue.
In case you are working on Unix like OS you should consider using inotifywait tool.
I just found nice Erlang wrapper around useful system tools: https://github.com/sdanzan/erlang-systools
inoteefy gives you a nice listener based api on top of the Linux inotify api. Example for listening to updates to /tmp/:
1> inoteefy:watch("/tmp/", fun(X) -> io:format("File event: ~p~n", [X]) end).
ok
File event: {"/tmp/",[create],0,"foo.txt"}
File event: {"/tmp/",[open],0,"foo.txt"}
File event: {"/tmp/",[attrib],0,"foo.txt"}
File event: {"/tmp/",[close_write],0,"foo.txt"}
here I'm doing touch /tmp/foo.txt after starting the watch

SNMPd: Cannot open /proc/bus/pci

I cross-compiled NET-SNMP 5.7.1 from sources to a PowerPC using ELDK-3.1.
When I try to load the snmpd daemon in my embedded board, I see the message:
# snmpd -f -Lo
pcilib: Cannot open /proc/bus/pci
pcilib: Cannot find any working access method.
Of course my PPC board has no PCI, and I wonder why is netsnmp looking for it.
In more than one place I see this same message (sourceforge, mail-archive, google-groups), but ir has no answer at all. Another variant, with a little but unhelpful responses at (archlinuxarm).
Can anybody please help me?
I'm assuming you're on a Linux target.
Net-SNMP's changelog lists "[PATCH 3057093]: allow linux to use libpci for creating useful ifDescr strings".
The configure script will search for an available libpci, and, having found one, will define
HAVE_PCI_LOOKUP_NAME and HAVE_PCI_PCI_H. To disable this code: after configuring, you can change those defines in include/net-snmp/net-snmp-config.h, then rebuild. The affected code is in agent/mibgroup/if-mib/data_access/interface_linux.c.
There's also a patch in this bug report: http://sourceforge.net/p/net-snmp/bugs/2449/
I resolved the issue using the stock snmpd that comes with the Raspbian.
In /etc/snmp/snmpd.conf file I isolated the issue to the following line
agentAddress udp:161,udp6:[::1]:161
Instead of listening on all interfaces, if I specify the the ip address of the eth0 interface i.e.:
agentAddress udp:10.0.1.5:161,udp6:[::1]:161
Then snmpd starts fine.
My speculation is that the stock snmpd tries to enumerate all possible interfaces including the pci ones.

Opening a file with the default viewer on Linux

I am working at an OS independent file manager (mostly Windows and Linux), and I am wondering if there is a Linux way to open a file in its default viewer. For example, open a html file with Firefox, an .avi with vlc, and so on.
On Windows, there is a function ShellExecute() that does that, but my understanding is that on Linux it is not that simple, and each desktop environment has a specific way.
I would appreciate any help with this.
You could use xdg-open(1). It works on all freedesktop compliant desktops.
The default programs for different mime-types are defined in /etc/mailcap and $HOME/.mailcap, indexed by file type and action (display, edit, print). The command line interface is run-mailcap. See also the manpages run-mailcap(1) and mailcap(5).
It depends what desktop environment you're using in Linux. Gnome for example has a MIME database you can use to find out what to launch for a given file.
Sahil Muthoo has given you good advice. I will just give further examples.
If xdg-open is not available you can also use "gnome-open" for GNOME and "kfmclient" for KDE.

Invoking the new NotifyOSD framework in C?

I want to make my GTK+ applications use the new notification area in Ubuntu. How can I do this? An example is shown below:
(source: iconocast.com)
I'm not on an Ubuntu box so I can't write out any examples.
But Ubuntu's NotificationDevelopmentGuidelines page has a lot of information.
Examples in C, C#, and Python.
Debain also has a tutorial that should more or less have some commonality.
Basically your going to be tying into the NotifyOSD framework which leverages the Free Desktop Foundations D-Bus messaging system.
For development you'll need libnotify ( only online documentation I could find )
If you just want some quick results from the command line or to use in a shell script you can also use the notify-send command.
Usage:
notify-send [OPTION...] <SUMMARY> [BODY]
Example:
notify-send Test "Totally gnarly message bro"
Or you can specify an icon:
notify-send -i ../icon.jpg Image "This is a sweet picture"
There are a bunch of other options, expire time, urgency level, category.
Ubuntu doesn't follow the Notification specification that closely, they don't honor alot of the options defined by the FSF. Don't be surprised if some things don't work with ubuntu's notifier that you see working with another notifier system.
Some Other resources:
Ubuntu's NotifyOSD wiki page.
ArsTechnica has a great article on the new notification's system.
Great article on some of the flaws in Ubuntu's notification's implementation.

Resources