How to adjust the log output level of GTK4? - linux

When developing an application based on GTK4, a log will be printed every time it is started. How can I get rid of it?
(conquerdocker:17460): Gtk-WARNING **: 09:13:21.962: Unknown key gtk-button-images in /home/aszswaz/.config/gtk-4.0/settings.ini
(conquerdocker:17460): Gtk-WARNING **: 09:13:21.962: Unknown key gtk-menu-images in /home/aszswaz/.config/gtk-4.0/settings.ini
(conquerdocker:17460): Gtk-WARNING **: 09:13:21.963: Unknown key gtk-toolbar-style in /home/aszswaz/.config/gtk-4.0/settings.ini

If you are not concerned about having any log output when you are executing your program, you could call your program and redirect the logging output to "/dev/null", such as:
./your_program_name > /dev/null
Alternatively, since your program is most likely a GUI program and doesn't require a terminal/console window, you could set up a desktop file similar to the following example.
[Desktop Entry]
Type=Application
Name=GtkProgramName
Icon=/home/username/.local/share/icons/hicolor/48x48/apps/GTK.png
Categories=Utilities;
StartupNotify=true
Terminal=false
Exec=/path/to/your/Programs/your_program_name
The key attribute here is the "Terminal=false" attribute which will run your program without a terminal, and therefore a user would not see spurious messages. Desktop files usually are placed in the "~/.local/share/applications folder" and have a permission mask of "rw-rw-r--".
You might give those options a try.
Regards.

Related

How to make Midnight Commander open file with default application in Windows

I recently started using Midnight Commander on my Windows 10 system, but I can't seem to get it to handle images or pdf files properly. When I select the file and press Enter, nothing happens. I've tried altering the extension file to the following.
default/*
Open=(%f)
After making that change, I get this error.
C:/Users/MyUser/AppData/Local/Temp/mc-MyUser/mcext2509Z1: line 13: C:/Test.txt: Permission denied
I am using the Powershell v7.3.2 in Windows Terminal v1.15.3465.0 on Windows 10 v.19044.2486
Try
default/*
Open=start %f
Try start C:\Test.txt from the cmd command line to test.
See https://superuser.com/q/550138. Try
start "" %f
For Powershell try
Start-Process %f

What is the GNOME_TERMINAL_SCREEN environment variable?

I've recently installed Ubuntu 20.4 LTS on one of my computers. This release of Ubuntu uses the gnome desktop manager (3.36.3) with gnome-terminal (3.36.2) by default.
In each terminal window that I open, the GNOME_TERMINAL_SCREEN environment variable is defined to "/org/gnome/Terminal/screen/some-guid", where each terminal window's GUID is unique.
Does anyone know what this variable is supposed to be used for? Is there some way of using the GUID in Xlib or XCB to identify the terminal's X window?
The $GNOME_TERMINAL_SCREEN environment variable contains an object path for D-Bus.
It is used to address a tab in the Gnome Terminal when starting a process in it, and to be signalled of its termination.
You can see the relevant part of its D-Bus interface by running this command:
dbus-send --session --type=method_call --print-reply \
--dest=org.gnome.Terminal "$GNOME_TERMINAL_SCREEN" \
org.freedesktop.DBus.Introspectable.Introspect
The output (snipped for relevance):
[...]
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<!-- GDBus 2.64.6 -->
<node>
[...]
<interface name="org.gnome.Terminal.Terminal0">
<method name="Exec">
<arg type="a{sv}" name="options" direction="in"/>
<arg type="aay" name="arguments" direction="in"/>
</method>
<signal name="ChildExited">
<arg type="i" name="exit_code"/>
</signal>
</interface>
</node>
If you run dbus-monitor and open and close a Gnome Terminal tab, you can see the D-Bus communication in action.
The X Window System is not aware of what goes on in the D-Bus realm, and as far as I know Gnome Terminal does not expose any X specific information through D-Bus.
I have found one way to tie a process to the X window of a Gnome Terminal in which it is running, but it is less than ideal. Nonetheless, it may suffice for your purposes.
The idea as that when opening a Gnome Terminal window, we will generate an identifying value, and store it both in an X property of the Gnome Terminal window, and in an environment variable.
We can then later get the environment variable from the environment of the process (via /proc/<pid>/environ if needed), and scan the windows for the one which has our value in the X property.
As the window does not exist yet when opening a new Gnome Terminal, we can not set a property ourselves, but the gnome-terminal command accepts an option --role, and stores its value in the WM_WINDOW_ROLE X property of the Gnome Terminal window.
The purpose of the WM_WINDOW_ROLE X property is to uniquely identify windows belonging to the same client.
Without --role, Gnome Terminal assigns it a unique value, but you can do this yourself.
So here is a start-gnome-terminal wrapper, which you could invoke from the key binding which would normally start gnome-terminal:
#!/bin/sh
FINDWIN_ROLE=findwin-role-$(xxd -p -l 16 < /dev/urandom)
export FINDWIN_ROLE
exec gnome-terminal --role "$FINDWIN_ROLE" "$#"
To look through the windows for the property later, you could use wmctrl -l and xprop.

How do I resolve a permission error with django?

I am using Django to display my code in an html format using class based views. My code reads a log file and displays stats based on what is in there. When I try to access the log file from my computer this error message is displayed:
[Errno 13] Permission denied: 'C:/Users/bhattaar/Downloads/access.log'
I first tried going through the properties of the folder to make sure everything was set to read only (which it already was) and then I tried running the command prompt as an administrator and it still would not work.
The line the error appears on is this:
log = open('C:/Users/bhattaar/Downloads/access.log', 'r')
Does anyone know how I can resolve this issue?
Does this work?
Taken from here
log_file = r'C:/Users/bhattaar/Downloads/access.log'
with open(log_file) as f:
f = f.readlines()

Sybase 16 startserver failed due to missing libsapcrypto.so

We've installed Sybase 16 Express in our Linux box, it was able to startup right after the installation. When we recently try restarting it with the startserver -f RUN_FILE command, it failed to find the libsapcrypto.so file.
~/sap/ASE-16_0/bin> ../sap/ASE-16_0/bin/dataserver: error while loading shared libraries: libsapcrypto.so: cannot open shared object file: No such file or directory
We searched this file, multiple matches presented in the following paths:
./DM/OCS-16_0/lib3p/libsapcrypto.so
./DM/OCS-16_0/lib3p64/libsapcrypto.so
./DM/OCS-16_0/devlib3p64/libsapcrypto.so
./DM/OCS-16_0/devlib3p/libsapcrypto.so
./DM/REP-16_0/lib64/libsapcrypto.so
./DataAccess/ODBC/lib/libsapcrypto.so
./DataAccess64/ODBC/lib/libsapcrypto.so
./OCS-16_0/lib3p/libsapcrypto.so
./OCS-16_0/lib3p64/libsapcrypto.so
./OCS-16_0/devlib3p64/libsapcrypto.so
./OCS-16_0/devlib3p/libsapcrypto.so
Since this hasn't been answered yet, running this command worked for me:
. /opt/sap/SYBASE.sh
Note the different syntax to make sure the environment variables are set in the terminal session, as opposed to using this syntax:
/opt/sap/SYBASE.sh

Does Firefox disable plugins that failed to initialize?

I am trying to test a Mozilla plugin (developed using FireBreath) in the form of an .so shared object file. The plugin was developed on Ubuntu, where it works fine.
I am now trying it under OpenSUSE - so I first symlinked the .so file in ~/.mozilla/plugins:
> ln -s /path/to/npXXX.so ~/.mozilla/plugins/
... and then ran Firefox (7) from command line:
> /path/to/firefox -P myprofile
...
LoadPlugin: failed to initialize shared library libXext.so [libXext.so: cannot open shared object file: No such file or directory]
LoadPlugin: failed to initialize shared library /path/to/npXXX.so [/path/to/npXXX.so: undefined symbol: gtk_widget_get_mapped]
# and the LoadPlugin messages do NOT show a second time - probably because plugin is disabled (via about:addons).
And so I thought to try different stuff to look into this - but first, I restarted Firefox, and realized that on the second run I do not get the "LoadPlugin: failed to initialize" messages anymore! Then I tried removing the plugins symlink, and restarting FF; and adding it again, and restarting FF - still no error messages!
So, this tells me that probably Firefox somehow disabled/blacklisted the plugin (but which one: libXext, npXXX or both?) , but searching (grepping) for (np)XXX in '/path/to/myprofile/blocklist.xml' returns nothing (the plugin should use a email-like id, not those number GUIDs, so I'd expect that string to show in blocklist.xml if it's there).
Does anyone know: is the default behavior of Firefox to disable/blocklist plugins, that fail to load at first? If so, is there a way to force Firefox to load them again (and spit out error messages)? If you'd also have links to where this behavior is documented, it will be much appreciated :)
Many thanks in advance for any answers,
Cheers!
Note: after I stopped seeing the error messages, I did the following:
I am trying "about:plugins": "No enabled plugins found";
then trying "about:addons", and clicking under Plugins: "You don't have any add-ons of this type installed";
This plugin is not embedded in an extension, so nothing new should be added in "about:addons" under "Extensions" - and as expected, nothing new shows there. Under Ubuntu (where all works), just by symlinking the plugin to ~/.mozilla/plugins, the above two locations/screens start showing the plugin info.
This one of the things that puzzle me - if it just showed the plugin as "disabled", maybe I would have had a chance to re-enable it again (to get a new batch of error messages) - however, "about:plugins" and "about:addons" simply show nothing - so there's nothing I can use to enable from there. Which tells me Firefox has used a different method to disable the plugin(s) - but I cannot tell what it is...
Firefox has a cache for XPCOM modules ("fastload cache"), if a module fails to load Firefox won't try again. The cache is reset automatically if an extension is installed or if the application is updated. Starting with Firefox 4 you can also use -purgecaches command line flag to discard the cache.

Resources