Wednesday, September 30, 2020

Fedora 32 : Can be better? part 014.

The GTK documentation for C # is not very up to date, I tried to use a button to change a label and I failed first time. The Fedora team could improve this to develop the development side. Here's what I've managed to do so far with GTK.

I fixed the source code with this, but I would have preferred a better method:

my_Button.Clicked += delegate {
my_Label.Text = "Use delegate!";

Mono is a free and open source implementation of the .NET Framework.

The most popular build tool for Mono is NAnt.

NUnit is very useful for test driven development.

[root@desk mythcat]# dnf install mono-devel
Last metadata expiration check: 0:15:26 ago on Wed 30 Sep 2020 09:04:30 PM EEST.
Package mono-devel-6.6.0-8.fc32.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
[root@desk mythcat]# dnf install nant
  log4net-2.0.8-10.fc32.x86_64            nant-1:0.92-25.fc32.x86_64           

[root@desk mythcat]# dnf install nunit nunit-gui
Last metadata expiration check: 0:02:09 ago on Wed 30 Sep 2020 09:27:18 PM EEST.
No match for argument: nunit-gui
Error: Unable to find a match: nunit-gui

Installing MonoDevelop:

[root@desk mythcat]# dnf install monodevelop


Install the .NET Core. This is a general-purpose, modular, cross-platform and open-source development Platform.

[root@desk mythcat]# dnf copr enable @dotnet-sig/dotnet
Enabling a Copr repository. Please note that this repository is not part
of the main distribution, and quality may vary.
Do you really want to enable [y/N]: y
Repository successfully enabled.
[root@desk mythcat]# dnf install dotnet
Copr repo for dotnet owned by @dotnet-sig             5.4 kB/s | 3.3 kB     00:00    
Package dotnet-3.1.108-1.fc32.x86_64 is already installed.
Dependencies resolved.
Nothing to do.

Let's start with a GTK project using the MonoDevelop I.D.E.

[mythcat@desk ProjectsCSharp]$ monodevelop 
I use a new solution from .NET with GTK# 2.0 Project template. The default source code is this:
using System;
using Gtk;

namespace MonoDevelopGTK_001
	class MainClass
		public static void Main (string[] args)
			Application.Init ();
			MainWindow win = new MainWindow ();
			win.Show ();
			Application.Run ();
The result is an simple window form. For a complex form with entry ,label and one button, you can see the next example:
using System;
using Gtk;

namespace MonoDevelopGTK_001
	class MainClass
		public static void Main (string[] args)
			// define here Entry and Button 
			Entry name;
			Button my_Button;

			Application.Init ();
			MainWindow win = new MainWindow ();
			// change the size of window
			win.SetDefaultSize (640, 480);
			// this will close application
			win.DeleteEvent += new DeleteEventHandler (Window_Delete);

			// use of VBox or HBox
			VBox global_vbox = new VBox();
			name = new Entry();
			global_vbox.PackStart(name, false, false, 0);

			VBox label_vbox = new VBox();
			global_vbox.Add (label_vbox);
			//Define here a label and put some text in it.
			Label my_Label = new Label();
			my_Label.Text = "Hello World!";
			label_vbox.PackStart(my_Label, false, false, 0);
			//Add the label to the form

			VBox button_vbox = new VBox();
			global_vbox.Add (button_vbox);
			my_Button = new Button("Ok!");
			my_Button.Clicked += OnButtonClicked;
			button_vbox.PackStart(my_Button, false, false, 0);
			// ShowAll is used to see all labels, buttons
			//win.Show ();
			Application.Run ();


		public static void OnButtonClicked (object obj, EventArgs args)
			//Label my_Label = obj as Gtk.Label;
			Console.WriteLine ("Button Clicked !");


		static void Window_Delete (object obj, DeleteEventArgs args)
			Application.Quit ();
			args.RetVal = true;

Tuesday, September 29, 2020

Fedora 32 : Can be better? part 013.

I would say that I always have a problem with accessing the knowledge base related to errors, errors and configurations in Linux and Fedora distro.

I think it would be very necessary to have as up-to-date documentation as possible in the Fedora distribution system and possibly a database based on questions and answers.

That makes me think of the pilots' manuals ... where all the possible problems are listed.

It would be useful for anyone and especially saves users' memory.

In the age of artificial intelligence, a flow chart for each possible problem generated by Xorg, Network, services that indicate the areas of interaction and possibly the basic checks that a user should make, possible settings depending on the problem or the desired change would be a fantastic map for both a beginner and an advanced user.

After doing some SELinux configurations, my browser did not want to access the internet.

Until the deactivation, the number of SELinux alerts increased dramatically.

The written SELinux policies were not exactly correct.

Obviously I tried to fix the problem by disabling SELinux.

The ping utility sent and received packets to the internet, my browser does not connect to it.

Sometimes a symbolic link or incorrect setting can block your internet access.

I think the problem was generated when disabling SELinux by restarting and shutting down a useful service.

ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
Although attention was paid to the possibility of incorrect SELinux settings, a simple check and a restart of the systemd-resolved.service service solved the problem.
[root@desk mythcat]# systemctl status systemd-resolved.service 
● systemd-resolved.service - Network Name Resolution
     Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; disabled
     Active: inactive (dead)
       Docs: man:systemd-resolved.service(8)
[root@desk mythcat]# systemctl start systemd-resolved.service 
[root@desk mythcat]# systemctl status systemd-resolved.service
● systemd-resolved.service - Network Name Resolution
     Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; disabled
     Active: active (running) since Tue 2020-09-29 22:25:32 EEST; 8s ago

Now I've fixed it.

Sunday, September 27, 2020

Fedora 32 : Can be better? part 012.

Pidgin is a chat program which lets you log into accounts on multiple chat networks simultaneously. Pidgin can be install on multiple operating systems and platforms. Pidgin is compatible with the following chat networks out of the box: I.R.C., Jabber/XMPP, Bonjour, Gadu-Gadu, IRC, Novell GroupWise Messenger, Lotus Sametime, SILC, SIMPLE, and Zephyr. Can it be better? The only problems a user in need of help may have are in the command line environment. Obviously, in this case, this application cannot be used. I would suggest building a terminal application like WeeChat dedicated to Fedora users and including I.R.C channels. Now, let's install this application.
[root@desk mythcat]# dnf install pidgin.x86_64
Last metadata expiration check: 0:45:32 ago on Sun 27 Sep 2020 04:21:51 PM EEST.
Dependencies resolved.
 Package                     Architecture    Version                   Repository        Size
 pidgin                      x86_64          2.13.0-18.fc32            updates          1.4 M
Installing dependencies:
 cyrus-sasl-md5              x86_64          2.1.27-4.fc32             fedora            41 k
 cyrus-sasl-scram            x86_64          2.1.27-4.fc32             fedora            27 k
 farstream02                 x86_64          0.2.9-1.fc32              fedora           239 k
 gtkspell                    x86_64          2.0.16-20.fc32            fedora            43 k
 libgadu                     x86_64          1.12.2-10.fc32            fedora           110 k
 libnice-gstreamer1          x86_64          0.1.17-2.fc32             updates           20 k
 libpurple                   x86_64          2.13.0-18.fc32            updates          5.2 M
 meanwhile                   x86_64          1.1.0-28.fc32             fedora           106 k

Transaction Summary
Install  9 Packages

Total download size: 7.2 M
Installed size: 31 M
Is this ok [y/N]: y
Downloading Packages:

Tuesday, September 22, 2020

Fedora 32 : Testing the Bookworm software.

The current version of Bookworm (v1.1.2) supports eBooks in the following file formats: EPUB, PDF, MOBI, FB2, CBR, CBZ.

First, I install this software with dnf tool:

[root@desk mythcat]# dnf install bookworm.x86_64 


I tested with some old EPUB and PDF files and I'm not very happy with formatting text on the page.

HI tested with some old EPUB and PDF files and I'm not very happy with the formatting for certain texts on the page, like source code in programming.

Bookworm does one thing and does it well for this simple reader.

You can help this project on GitHub.

Monday, September 21, 2020

Fedora 32 : Can be better? part 011.

Four days ago, the well-known Gnome environment came with a new release.

I guess it will be implemented in Fedora distro soon. 

Sunday, September 20, 2020

Fedora 32 : Can be better? part 010.

In this tutorial I will show you how can easy learn with a simple example to have a better Fedora distro with SELinux. 

SELinux uses a policy store to keep track of its loaded policy modules and related settings. 

You can see my active policy store name is MLS.

[root@desk mythcat]# sestatus | grep Loaded
Loaded policy name:             mls

I want to create policy in the most easy way to denny memory. 

I can use many way to do that or find it on SELinux. 

If you want to deny user domains applications to map a memory region as both executable and writable you can use deny_execmem

This is dangerous and the executable should be reported in bugzilla and is is enabled by default. 

You must turn on the deny_execmem boolean.

setsebool -P deny_execmem 1
Let's use it:
[root@desk mythcat]# setsebool -P deny_execmem 1
[root@desk mythcat]# ausearch -c 'Web Content' --raw | audit2allow -M my-WebContent
******************** IMPORTANT ***********************
To make this policy package active, execute:

semodule -i my-WebContent.pp

[root@desk mythcat]# semodule -X 300 -i my-WebContent.pp
Let's see if this SELinux is currently loaded:
[root@desk mythcat]# semodule -l | grep Web

Tuesday, September 15, 2020

Fedora 32 : Can be better? part 008.

The Fedora development is not very active in the last programming language.
The main reason is the build new packages and put on the repository.
I think this can be improved with a good tool to solve all dependencies and link all into a good package.
Today I tested the new Python version 3.5.10 released on September 5th, 2020.
I download an unzip the archive and I use these commands to build this python version
[mythcat@desk ~]$ cd Python-3.5.10/
[mythcat@desk Python-3.5.10]$ ./configure
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for python3.5... no
checking for python3... python3
checking for --enable-universalsdk... no
The next command is make:
[mythcat@desk Python-3.5.10]$ make
gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes
   -Werror=declaration-after-statement   -I. -I./Include    -DPy_BUILD_CORE -o Programs/python.o 
# On Darwin, always use the python version of the script, the shell
# version doesn't use the compiler customizations that are provided
# in python (
if test `uname -s` = Darwin; then \
 cp python-config; \
Then I used make test.
[mythcat@desk Python-3.5.10]$ make test
running build
running build_ext
INFO: Can't locate Tcl/Tk libs and/or headers

Python build finished successfully!
For the last part I used this command:
[mythcat@desk Python-3.5.10]$ sudo make install
The result of this is ...
[mythcat@desk Python-3.5.10]$ ls
aclocal.m4     config.sub    Include          Mac              Modules  platform        python            README
build          configure     install-sh       Makefile         Objects  Programs        Python  
config.guess  Lib              Makefile.pre     Parser   pybuilddir.txt  python-config     Tools
config.log     Doc           libpython3.5m.a  PC       pyconfig.h
config.status  Grammar       LICENSE          Misc             PCbuild
[mythcat@desk Python-3.5.10]$ ./python 
Python 3.5.10 (default, Sep  6 2020, 22:32:07) 
[GCC 10.2.1 20200723 (Red Hat 10.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.