Pages

Saturday, November 28, 2020

Fedora 33 : Install and test with MonoGame .NET library .

MonoGame is a simple and powerful .NET library for creating games for desktop PCs, video game consoles, and mobile devices.
Today I tested with Fedora 33.
First let's install this templates for .NET Core CLI and the Rider IDE.:
[mythcat@desk ~]$ dotnet new --install MonoGame.Templates.CSharp

Welcome to .NET Core 3.1!
---------------------
SDK Version: 3.1.109

----------------
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Find out what's new: https://aka.ms/dotnet-whats-new
Learn about the installed HTTPS developer cert: https://aka.ms/aspnet-core-https
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs
Write your first app: https://aka.ms/first-net-core-app
--------------------------------------------------------------------------------------
Getting ready...
  Restore completed in 2.76 sec for /home/mythcat/.templateengine/dotnetcli/v3.1.109/scratch/restore.csproj.
...
Install MGCB Editor is a tool for editing .mgcb files:
[mythcat@desk ~]$ dotnet tool install --global dotnet-mgcb-editor
You can invoke the tool using the following command: mgcb-editor
Tool 'dotnet-mgcb-editor' (version '3.8.0.1641') was successfully installed.
[mythcat@desk ~]$ mgcb-editor --register
Installing icon...
Installation complete!
Installing mimetype...
gtk-update-icon-cache: No theme index file.
Installation complete!
Installing application...
Installation complete!

Registered MGCB Editor!
Install C# extension for code editor:
[mythcat@desk ~]$ code --install-extension ms-dotnettools.csharp
Installing extensions...
Extension 'ms-dotnettools.csharp' is already installed.
The next step is to create new MonoGame projects:
[mythcat@desk ~]$ cd CSharpProjects/
[mythcat@desk CSharpProjects]$ dotnet new mgdesktopgl -o MyGame001
The template "MonoGame Cross-Platform Desktop Application (OpenGL)" was created successfully.

An update for template pack MonoGame.Templates.CSharp::3.8.0.1641 is available.
    install command: dotnet new -i MonoGame.Templates.CSharp::3.8.0.1641 
I run the default template and working well:
[mythcat@desk CSharpProjects]$ cd MyGame001
[mythcat@desk MyGame001]$ ls
app.manifest  Content  Game1.cs  Icon.bmp  Icon.ico  MyGame001.csproj  Program.cs
[mythcat@desk MyGame001]$ dotnet run Program.cs 
The default source code from Program.cs file is this:
using System;

namespace MyGame001
{
    public static class Program
    {
        [STAThread]
        static void Main()
        {
            using (var game = new Game1())
                game.Run();
        }
    }
} 

Tuesday, November 17, 2020

Fedora 33 : Smokeping tool.

Smokeping is a latency measurement tool. It sends test packets out to the net and measures the amount of time they need to travel from one place to the other and back. SmokePing consists of a daemon process which organized the latency measurements and a CGI which presents the graphs. 
You can install it like a webpage, see a demo on this webpage with Customers.SALAG.
[root@desk mythcat]# dnf search SmokePing
Last metadata expiration check: 0:12:18 ago on Tue 17 Nov 2020 08:45:57 PM EET.
=============================== Name Matched: SmokePing ===============================
smokeping.noarch : Latency Logging and Graphing System
[root@desk mythcat]# dnf install smokeping.noarch
Last metadata expiration check: 0:12:24 ago on Tue 17 Nov 2020 08:45:57 PM EET.
Dependencies resolved.
=======================================================================================
 Package                    Architecture  Version                  Repository     Size
=======================================================================================
Installing:
 smokeping                  noarch        2.7.3-2.fc33             fedora        564 k
Installing dependencies:
 fedora-logos-httpd         noarch        30.0.2-5.fc33            fedora         15 k
 fping                      x86_64        5.0-1.fc33               fedora         38 k
 httpd                      x86_64        2.4.46-1.fc33            fedora        1.4 M
 httpd-filesystem           noarch        2.4.46-1.fc33            fedora         14 k
 httpd-tools                x86_64        2.4.46-1.fc33            fedora         83 k
 libdbi                     x86_64        0.9.0-16.fc33            fedora         50 k
 mod_fcgid                  x86_64        2.3.9-21.fc33            fedora         77 k
 mod_http2                  x86_64        1.15.14-2.fc33           fedora        152 k
 perl-CGI                   noarch        4.50-4.fc33              fedora        198 k
 perl-CGI-Fast              noarch        2.15-6.fc33              fedora         18 k
 perl-Config-Grammar        noarch        1.13-6.fc33              fedora         29 k
 perl-FCGI                  x86_64        1:0.79-5.fc33            fedora         47 k
 perl-Net-DNS               noarch        1.21-5.fc33              fedora        356 k
 perl-Net-Telnet            noarch        3.04-15.fc33             fedora         62 k
 perl-Path-Tiny             noarch        0.114-3.fc33             fedora         67 k
 perl-SNMP_Session          noarch        1.13-25.fc33             fedora         67 k
 perl-Unicode-UTF8          x86_64        0.62-13.fc33             fedora         26 k
 rrdtool                    x86_64        1.7.2-14.fc33            fedora        569 k
 rrdtool-perl               x86_64        1.7.2-14.fc33            fedora         43 k

Transaction Summary
=======================================================================================
Install  20 Packages

Total download size: 3.8 M
Installed size: 11 M
Is this ok [y/N]: y
Downloading Packages:
...
Complete!
[root@desk mythcat]# dnf install lighttpd
...
Complete!

[root@desk mythcat]# dnf install lighttpd-fastcgi
...
Complete!
Most users use the smokeping service:
sudo service smokeping start
sudo service smokeping status
You can set your configuration file using this file:
[mythcat@desk ~]$ sudo vi /etc/smokeping/config
I let this file unchanged and I run these commands:
[mythcat@desk ~]$ sudo smokeping --check
Configuration file '/etc/smokeping/config' syntax OK.
[mythcat@desk ~]$ sudo smokeping --debug
### Compiling alert detector pattern 'someloss'
### >0%,*12*,>0%,*12*,>0%
...
Smokeping version 2.007003 successfully launched.
Not entering multiprocess mode with '--debug'. Use '--debug-daemon' for that.
FPing: probing 3 targets with step 300 s and offset 118 s.
FPing: Executing /usr/sbin/fping -C 20 -q -B1 -r1 -4 -i10 planet.fedoraproject.org fedoraproject.org 
docs.fedoraproject.org
FPing: Got fping output: 'planet.fedoraproject.org : 165 166 167 167 165 172 165 165 165 164 168 165 166 165
165 164 165 164 171 165'
FPing: Got fping output: 'fedoraproject.org        : 77.8 75.6 75.0 68.3 69.1 73.6 71.1 71.1 69.0 67.5
69.9 69.5 70.6 70.8 76.9 76.0 70.8 70.6 72.1 68.3'
FPing: Got fping output: 'docs.fedoraproject.org   : 171 165 165 165 180 164 170 164 164 165 163 171 
169 160 170 167 166 166 166 164'
Calling RRDs::update(/var/lib/smokeping/rrd/Ping/FedoraprojectOrg.rrd --template uptime:loss:median:
ping1:ping2:ping3:ping4:ping5:ping6:ping7:ping8:ping9:ping10:ping11:ping12:ping13:ping14:ping15:
ping16:ping17:ping18:ping19:ping20 1605642550:U:0:7.0800000000e-02:6.7500000000e-02:
...
1.6700000000e-01:1.6800000000e-01:1.7100000000e-01:1.7200000000e-01)

Saturday, November 7, 2020

Fedora 33 : Install PyGame 2.0 on Fedora.

Today I will show you how to install the python PyGame version 2.0 package with python version 3.9 in Fedora 33 distro. Let's install all Fedora packages need for this python package:
[root@desk pygame]# dnf install SDL2-devel.x86_64 
...
Installed:
  SDL2-devel-2.0.12-4.fc33.x86_64                                               

Complete!
[root@desk pygame]# dnf install SDL2_ttf-devel.x86_64
...
Installed:
  SDL2_ttf-2.0.15-6.fc33.x86_64       SDL2_ttf-devel-2.0.15-6.fc33.x86_64      

Complete!
[root@desk pygame]# dnf install SDL2_image-devel.x86_64
...
Installed:
  SDL2_image-2.0.5-5.fc33.x86_64      SDL2_image-devel-2.0.5-5.fc33.x86_64     

Complete!
[root@desk pygame]# dnf install SDL2_mixer-devel.x86_64 
...
Installed:
  SDL2_mixer-2.0.4-7.fc33.x86_64      SDL2_mixer-devel-2.0.4-7.fc33.x86_64     

Complete!
[root@desk pygame]# dnf install SDL2_gfx-devel.x86_64 
...
Installed:
  SDL2_gfx-1.0.4-3.fc33.x86_64        SDL2_gfx-devel-1.0.4-3.fc33.x86_64       

Complete!
[root@desk pygame]# dnf install portmidi-devel.x86_64 
...
Installed:
  portmidi-devel-217-38.fc33.x86_64                                             

Complete!
Use this command to clone it from GitHub and install it:
[mythcat@desk ~]$ git clone https://github.com/pygame/pygame
Cloning into 'pygame'...
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 38509 (delta 0), reused 0 (delta 0), pack-reused 38505
Receiving objects: 100% (38509/38509), 17.78 MiB | 11.66 MiB/s, done.
Resolving deltas: 100% (29718/29718), done.
[mythcat@desk ~]$ cd pygame/
[mythcat@desk pygame]$ python3.9 setup.py install --user


WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using UNIX configuration...


Hunting dependencies...
SDL     : found 2.0.12
FONT    : found
IMAGE   : found
MIXER   : found
PNG     : found
JPEG    : found
SCRAP   : found
PORTMIDI: found
PORTTIME: found
FREETYPE: found 23.4.17

If you get compiler errors during install, double-check
the compiler flags in the "Setup" file.
...
copying docs/pygame_tiny.gif -> build/bdist.linux-x86_64/egg/pygame/docs
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying pygame.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pygame.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pygame.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pygame.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pygame.egg-info/not-zip-safe -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pygame.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt
creating dist
creating 'dist/pygame-2.0.1.dev1-py3.9-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing pygame-2.0.1.dev1-py3.9-linux-x86_64.egg
creating /home/mythcat/.local/lib/python3.9/site-packages/pygame-2.0.1.dev1-py3.9-linux-x86_64.egg
Extracting pygame-2.0.1.dev1-py3.9-linux-x86_64.egg to /home/mythcat/.local/lib/python3.9/site-packages
Adding pygame 2.0.1.dev1 to easy-install.pth file

Installed /home/mythcat/.local/lib/python3.9/site-packages/pygame-2.0.1.dev1-py3.9-linux-x86_64.egg
Processing dependencies for pygame==2.0.1.dev1
Finished processing dependencies for pygame==2.0.1.dev1
Let's test it:
[mythcat@desk pygame]$ ls
build	     dist  examples	    README.rst	setup.cfg  src_c   test
buildconfig  docs  pygame.egg-info  Setup	setup.py   src_py
[mythcat@desk pygame]$ python3.9
Python 3.9.0 (default, Oct  6 2020, 00:00:00) 
[GCC 10.2.1 20200826 (Red Hat 10.2.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
pygame 2.0.1.dev1 (SDL 2.0.12, python 3.9.0)
Hello from the pygame community. https://www.pygame.org/contribute.html
>>> 

Saturday, October 31, 2020

Fedora 33 : Upgrade from Fedora 32.

It is recommended to put SElinux in the disabled ... Use the following commands for this operation Edit the /etc/selinux/config file, run:
sudo vi /etc/selinux/config
Set SELINUX to disabled:
SELINUX=disabled
These commands will prepare the Fedora 32 for update
[root@desk mythcat]# dnf config-manager --set-disabled "*"
[root@desk mythcat]# dnf repolist 
[root@desk mythcat]# dnf config-manager --set-enabled updates
[root@desk mythcat]# dnf repolist 
repo id                                       repo name
fedora                                        Fedora 32 - x86_64
updates                                       Fedora 32 - x86_64 - Updates
[root@desk mythcat]# dnf upgrade --refresh
...
[root@desk mythcat]# dnf install dnf-plugin-system-upgrade
...
Let's upgrade with new Fedora 33 packages:
[root@desk mythcat]# dnf system-upgrade download --releasever=33 --allowerasing
Before you continue ensure that your system is fully upgraded by running "dnf --refresh upgrade". 
Do you want to continue [y/N]: y
...
  file /usr/bin/ocamlprof.byte conflicts between attempted installs of ocaml-4.11.1-1.fc33.i686 
  and ocaml-4.11.1-1.fc33.x86_64
...
[root@desk mythcat]# dnf remove ocaml
...
I try again to update:
[root@desk mythcat]# dnf system-upgrade download --releasever=33 --allowerasing
...
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Complete!
Download complete! Use 'dnf system-upgrade reboot' to start the upgrade.
To remove cached metadata and transaction use 'dnf system-upgrade clean'
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
[root@desk mythcat]# dnf system-upgrade reboot
After reboot and system upgrade the new Fedora 33 is ready to use.
If exist another upgrade then use dnf tool command:
[sudo] password for mythcat: 
[root@desk mythcat]# dnf upgrade
Last metadata expiration check: 1:58:19 ago on Sat 31 Oct 2020 04:06:13 PM EET.
Dependencies resolved.
================================================================================
 Package                   Arch        Version               Repository    Size
================================================================================
Upgrading:
 dnf                       noarch      4.4.0-3.fc33          updates      445 k
 dnf-data                  noarch      4.4.0-3.fc33          updates       46 k
 libdnf                    x86_64      0.54.2-3.fc33         updates      604 k
 php-symfony-polyfill      noarch      1.19.0-1.fc33         updates       57 k
 python3-dnf               noarch      4.4.0-3.fc33          updates      410 k
 python3-hawkey            x86_64      0.54.2-3.fc33         updates      112 k
 python3-libdnf            x86_64      0.54.2-3.fc33         updates      775 k
 unixODBC                  x86_64      2.3.9-1.fc33          updates      460 k
 yum                       noarch      4.4.0-3.fc33          updates       43 k

Transaction Summary
================================================================================
Upgrade  9 Packages

Total download size: 2.9 M
Is this ok [y/N]: y
...
Upgraded:
  dnf-4.4.0-3.fc33.noarch             dnf-data-4.4.0-3.fc33.noarch             
  libdnf-0.54.2-3.fc33.x86_64         php-symfony-polyfill-1.19.0-1.fc33.noarch
  python3-dnf-4.4.0-3.fc33.noarch     python3-hawkey-0.54.2-3.fc33.x86_64      
  python3-libdnf-0.54.2-3.fc33.x86_64 unixODBC-2.3.9-1.fc33.x86_64             
  yum-4.4.0-3.fc33.noarch            

Complete!
[root@desk mythcat]# uname -a
Linux desk 5.8.16-300.fc33.x86_64 #1 SMP Mon Oct 19 13:18:33 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
A job very well done by Fedora team.

Thursday, October 22, 2020

Fedora 32 : Can be better? part 016.

Today I tested the Unity 3D version 2020 on Linux Fedora 32.
Maybe it would be better to integrate Unity 3D or Unity Hub in Fedora repo just like other useful software like Blender 3D, GIMP.
It will improve the user experience and attract new users and developers for this distro.
I download the AppImage from Unity website and I run with these commands:
[mythcat@desk Downloads]$ chmod a+x UnityHub.AppImage 
[mythcat@desk Downloads]$ ./UnityHub.AppImage 
r: 0
License accepted
...

Sunday, October 18, 2020

Fedora 32 : About positive and negative lookahead with Bash commands.

Today I will talk about something more complex in Linux commands called: positive and negative lookahead.
This solution can be found in several programming languages including Bash
The lookahead process is part of regular expressions.
The lookahead process looks ahead in the string and sees if it matches the given pattern, but then disregard it and move on.
It is very useful when we want to go through the strings.
The lookahead process can be both positive and negative depending on the purpose.
Negative lookahead is indispensable if you want to match something not followed by something else and looks like this:
q(?!s).
The string is the question q is analyzed and if it does not match and is not followed by s returns the result.
The positive lookahead it works the same way only now it is parsed if it corresponds to s.
The positive lookahead looks like this:
q(?=s)
Let's look at a simple example of detecting the PAE option for the processor.
We can use this command but we will find a lot of information ...
[root@desk mythcat]# cat /proc/cpuinfo
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 58
model name	: Intel(R) Celeron(R) CPU G1620 @ 2.70GHz
stepping	: 9
...
In some cases, the resulting information can be taken using pipe and grep but they will be increasingly fragmented.
I will use the same command cpuinfo and we will look for the pae information in the flags.
All CPU flags can be found here.
Let's prove with internal lookahead to find the pae flag.
[root@desk mythcat]# cat /proc/cpuinfo | grep -oP '(?='pae')...' 
pae
pae
This result gives me additional information, namely that there are two cores.
Do you have a question?

Saturday, October 17, 2020

Fedora 32 : Visual Code and C# on Fedora distro.

Today I will show you how to use Visual Code with C#.
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/
vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > 
/etc/yum.repos.d/vscode.repo'
Then use dnf to check and install this editor.
#dnf check-update
#dnf install code
Use Extensions button or Ctrl+Shift+X keys to open in the left side area and intall the C# extension from Microsoft by pressing the Install button, see:

Created a folder named CSharpProjects and using the linux terminal execute the following command:
[mythcat@desk CSharpProjects]$ dotnet new mvc -au None -o aspnetapp
The template "ASP.NET Core Web App (Model-View-Controller)" was created successfully.
This template contains technologies from parties other than Microsoft, 
see https://aka.ms/aspnetcore/3.1-third-party-notices for details.

Processing post-creation actions...
Running 'dotnet restore' on aspnetapp/aspnetapp.csproj...
  Restore completed in 112.76 ms for /home/mythcat/CSharpProjects/aspnetapp/aspnetapp.csproj.

Restore succeeded.

[mythcat@desk CSharpProjects]$ cd aspnetapp/
[mythcat@desk aspnetapp]$ code .
This command will open the Visual Code. At this point, in the aspnetapp folder is an ASP.NET project open in Visual Code. You can run this project with command:
[mythcat@desk aspnetapp]$ dotnet run
warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
      No XML encryptor configured. Key {4c284989-9a5d-4ea7-89e2-a383828fd7ab} may be persisted 
      to storage in unencrypted form.
info: Microsoft.Hosting.Lifetime[0]
      Now listening on: https://localhost:5001
info: Microsoft.Hosting.Lifetime[0]
      Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /home/mythcat/CSharpProjects/aspnetapp
You can open the https://localhost:5001/ and see the default Welcome page from ASP.NET.