]> pere.pagekite.me Git - homepage.git/blob - blog/archive/2023/01/01.rss
Converted pages to actually temp site.
[homepage.git] / blog / archive / 2023 / 01 / 01.rss
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/'>
3 <channel>
4 <title>Petter Reinholdtsen - Entries from January 2023</title>
5 <description>Entries from January 2023</description>
6 <link>http://www.hungry.com/~pere/blog/</link>
7
8
9 <item>
10 <title>Is the desktop recommending your program for opening its files?</title>
11 <link>http://www.hungry.com/~pere/blog/Is_the_desktop_recommending_your_program_for_opening_its_files_.html</link>
12 <guid isPermaLink="true">http://www.hungry.com/~pere/blog/Is_the_desktop_recommending_your_program_for_opening_its_files_.html</guid>
13 <pubDate>Sun, 29 Jan 2023 11:00:00 +0100</pubDate>
14 <description>&lt;p&gt;Linux desktop systems
15 &lt;a href=&quot;https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html&quot;&gt;have
16 standardized&lt;/a&gt; how programs present themselves to the desktop
17 system. If a package include a .desktop file in
18 /usr/share/applications/, Gnome, KDE, LXDE, Xfce and the other desktop
19 environments will pick up the file and use its content to generate the
20 menu of available programs in the system. A lesser known fact is that
21 a package can also explain to the desktop system how to recognize the
22 files created by the program in question, and use it to open these
23 files on request, for example via a GUI file browser.&lt;/p&gt;
24
25 &lt;p&gt;A while back I ran into a package that did not tell the desktop
26 system how to recognize its files and was not used to open its files
27 in the file browser and fixed it. In the process I wrote a simple
28 debian/tests/ script to ensure the setup keep working. It might be
29 useful for other packages too, to ensure any future version of the
30 package keep handling its own files.&lt;/p&gt;
31
32 &lt;p&gt;For this to work the file format need a useful MIME type that can
33 be used to identify the format. If the file format do not yet have a
34 MIME type, it should define one and preferably also
35 &lt;a href=&quot;https://www.iana.org/assignments/media-types/media-types.xhtml&quot;&gt;register
36 it with IANA&lt;/a&gt; to ensure the MIME type string is reserved.&lt;/p&gt;
37
38 &lt;p&gt;The script uses the &lt;tt&gt;xdg-mime&lt;/tt&gt; program from xdg-utils to
39 query the database of standardized package information and ensure it
40 return sensible values. It also need the location of an example file
41 for xdg-mime to guess the format of.&lt;/p&gt;
42
43 &lt;pre&gt;
44 #!/bin/sh
45 #
46 # Author: Petter Reinholdtsen
47 # License: GPL v2 or later at your choice.
48 #
49 # Validate the MIME setup, making sure motor types have
50 # application/vnd.openmotor+yaml associated with them and is connected
51 # to the openmotor desktop file.
52
53 retval=0
54
55 mimetype=&quot;application/vnd.openmotor+yaml&quot;
56 testfile=&quot;test/data/real/o3100/motor.ric&quot;
57 mydesktopfile=&quot;openmotor.desktop&quot;
58
59 filemime=&quot;$(xdg-mime query filetype &quot;$testfile&quot;)&quot;
60
61 if [ &quot;$mimetype&quot; != &quot;$filemime&quot; ] ; then
62 retval=1
63 echo &quot;error: xdg-mime claim motor file MIME type is $filemine, not $mimetype&quot;
64 else
65 echo &quot;success: xdg-mime report correct mime type $mimetype for motor file&quot;
66 fi
67
68 desktop=$(xdg-mime query default &quot;$mimetype&quot;)
69
70 if [ &quot;$mydesktopfile&quot; != &quot;$desktop&quot; ]; then
71 retval=1
72 echo &quot;error: xdg-mime claim motor file should be handled by $desktop, not $mydesktopfile&quot;
73 else
74 echo &quot;success: xdg-mime agree motor file should be handled by $mydesktopfile&quot;
75 fi
76
77 exit $retval
78 &lt;/pre&gt;
79
80 &lt;p&gt;It is a simple way to ensure your users are not very surprised when
81 they try to open one of your file formats in their file browser.&lt;/p&gt;
82
83 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
84 activities, please send Bitcoin donations to my address
85 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
86 </description>
87 </item>
88
89 <item>
90 <title>Opensnitch, the application level interactive firewall, heading into the Debian archive</title>
91 <link>http://www.hungry.com/~pere/blog/Opensnitch__the_application_level_interactive_firewall__heading_into_the_Debian_archive.html</link>
92 <guid isPermaLink="true">http://www.hungry.com/~pere/blog/Opensnitch__the_application_level_interactive_firewall__heading_into_the_Debian_archive.html</guid>
93 <pubDate>Sun, 22 Jan 2023 23:55:00 +0100</pubDate>
94 <description>&lt;p&gt;While reading a
95 &lt;a href=&quot;https://sneak.berlin/20230115/macos-scans-your-local-files-now/&quot;&gt;blog
96 post claiming MacOS X recently started scanning local files and
97 reporting information about them to Apple&lt;/a&gt;, even on a machine where
98 all such callback features had been disabled, I came across a
99 description of the Little Snitch application for MacOS X. It seemed
100 like a very nice tool to have in the tool box, and I decided to see if
101 something similar was available for Linux.&lt;/p&gt;
102
103 &lt;p&gt;It did not take long to find
104 &lt;a href=&quot;https://github.com/evilsocket/opensnitch&quot;&gt;the OpenSnitch
105 package&lt;/a&gt;, which has been in development since 2017, and now is in
106 version 1.5.0. It has had a
107 &lt;a href=&quot;https://bugs.debian.org/909567&quot;&gt;request for Debian
108 packaging&lt;/a&gt; since 2018, but no-one completed the job so far. Just
109 for fun, I decided to see if I could help, and I was very happy to
110 discover that
111 &lt;a href=&quot;https://github.com/evilsocket/opensnitch/issues/304&quot;&gt;upstream
112 want a Debian package too&lt;/a&gt;.&lt;/p&gt;
113
114 &lt;p&gt;After struggling a bit with getting the program to run, figuring
115 out building Go programs (and a little failed detour to look at eBPF
116 builds too - help needed), I am very happy to report that I am
117 sponsoring upstream to maintain the package in Debian, and it has
118 since this morning been waiting in NEW for the ftpmasters to have a
119 look. Perhaps it can get into the archive in time for the Bookworm
120 release?&lt;/p&gt;
121
122 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
123 activities, please send Bitcoin donations to my address
124 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
125 </description>
126 </item>
127
128 <item>
129 <title>LinuxCNC MQTT publisher component</title>
130 <link>http://www.hungry.com/~pere/blog/LinuxCNC_MQTT_publisher_component.html</link>
131 <guid isPermaLink="true">http://www.hungry.com/~pere/blog/LinuxCNC_MQTT_publisher_component.html</guid>
132 <pubDate>Sun, 8 Jan 2023 19:30:00 +0100</pubDate>
133 <description>&lt;p&gt;I watched &lt;a href=&quot;https://yewtu.be/watch?v=jmKUV3aNLjk&quot;&gt;a 2015
134 video from Andreas Schiffler&lt;/a&gt; the other day, where he set up
135 &lt;a href=&quot;https://linuxcnc.org/&quot;&gt;LinuxCNC&lt;/a&gt; to send status
136 information to the MQTT broker IBM Bluemix. As I also use MQTT for
137 graphing, it occured to me that a generic MQTT LinuxCNC component
138 would be useful and I set out to implement it. Today I got the first
139 draft limping along and submitted as
140 &lt;a href=&quot;https://github.com/LinuxCNC/linuxcnc/pull/2253&quot;&gt;a patch to the
141 LinuxCNC project&lt;/a&gt;.&lt;/p&gt;
142
143 &lt;p&gt;The simple part was setting up the MQTT publishing code in Python.
144 I already have set up other parts submitting data to my Mosquito MQTT
145 broker, so I could reuse that code. Writing a LinuxCNC component in
146 Python as new to me, but using existing examples in the code
147 repository and the extensive documentation, this was fairly straight
148 forward. The hardest part was creating a automated test for the
149 component to ensure it was working. Testing it in a simulated
150 LinuxCNC machine proved very useful, as I discovered features I needed
151 that I had not thought of yet, and adjusted the code quite a bit to
152 make it easier to test without a operational MQTT broker
153 available.&lt;/p&gt;
154
155 &lt;p&gt;The draft is ready and working, but I am unsure which LinuxCNC HAL
156 pins I should collect and publish by default (in other words, the
157 default set of information pieces published), and how to get the
158 machine name from the LinuxCNC INI file. The latter is a minor
159 detail, but I expect it would be useful in a setup with several
160 machines available. I am hoping for feedback from the experienced
161 LinuxCNC developers and users, to make the component even better
162 before it can go into the mainland LinuxCNC code base.&lt;/p&gt;
163
164 &lt;p&gt;Since I started on the MQTT component, I came across
165 &lt;a href=&quot;https://yewtu.be/watch?v=Bqa2grG0XtA&quot;&gt;another video from Kent
166 VanderVelden&lt;/a&gt; where he combine LinuxCNC with a set of screen glasses
167 controlled by a Raspberry Pi, and it occured to me that it would
168 be useful for such use cases if LinuxCNC also provided a REST API for
169 querying its status. I hope to start on such component once the MQTT
170 component is working well.&lt;/p&gt;
171
172 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
173 activities, please send Bitcoin donations to my address
174 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
175 </description>
176 </item>
177
178 </channel>
179 </rss>