Páginas

viernes, 22 de noviembre de 2019

Python, Qt and MariaDB

Hi everyone, I'd like to share the next code for beginners in Python, Qt and MariaDB with a little explanation, the code is available in GitHub https://github.com/gerasua/openwindows. When you try to create one app for Windows desktop you think in Java, .Net but this time I want to show you how to create a Desktop App with Python and Qt for Windows, this App have a login authentication and help to you to understand how works Python and Qt, for this we need to use PyQt5. We build windows with Qt Designer 


You need create your database, here I show you how to install XAMPP

When you have your windows designs you need code in Python, but first install dependencies, pyqt5 and mysql-connector, open a terminal and install
$ pip install pyqt5
$pip install mysql-connector

Open you editor, I like Pycharm Community Edition


but how works?
You Login with the next users and passwords
Level 1
user: operator
password: operator


You're available to send value to another window


You can read the value from the previous window


Finally you logout closing the window or press the scape key





Level 2
user: supervisor
password: supervisor






Level 3
user: admin
password: admin




viernes, 6 de septiembre de 2019

How to install XAMPP

The first we need is install net-tools
$ sudo apt install net-tools
Download XAMPP
https://www.apachefriends.org/es/download.html
$ sudo chmod +x xampp-linux-x64-7.3.9-0-installer.run
$ sudo ./xampp-linux-x64-7.3.9-0-installer.run



Change the MySQL/MariaDB root password, follow these steps:
$ cd /opt/lampp/
$ /opt/lampp/bin/mysqladmin --user=root password "ChooseOne"
$ /opt/lampp/bin/mysql -u root -p -e "FLUSH PRIVILEGES;"

For log in phpmyadmin edit config.inc.php
$ cd /opt/lampp/phpmyadmin
$ sudo vim config.inc.php
Search this lines
$cfg['blowfish_secret'] = 'xampp';
change for
$cfg['blowfish_secret'] = 'ForSomeThingElse';

Now we need the password 
$cfg['Servers'][$i]['password'] = '';
and change that with your password
$cfg['Servers'][$i]['password'] = 'ChooseOne';

Now, for enviroments in production we need to change this line
$cfg['Servers'][$i]['auth_type'] = 'config';
To
$cfg['Servers'][$i]['auth_type'] = 'cookie';

Change this too
$cfg['Servers'][$i]['AllowNoPassword'] = true;
To
$cfg['Servers'][$i]['AllowNoPassword'] = false;

open a browser, go to http://localhost/phpmyadmin and log in.

Stop, start the service:
$ cd /opt

$ sudo ./xampp start
[sudo] password for user:          
Starting XAMPP for Linux 7.3.9-0...
XAMPP: Starting Apache...ok.
XAMPP: Starting MySQL...ok.

XAMPP: Starting ProFTPD...ok.

jueves, 5 de septiembre de 2019

How to install SAP GUI Linux

If you need install SAP GUI in your linux mint 19, you need to do this:

First, uninstall java from your system
$ sudo apt-get update && sudo apt-get remove openjdk*

Next we need a place for java
$ sudo mkdir /opt/java
$ cd /opt/java

$ sudo tar zxvf ~/Downloads/jdk-8u221-linux-x64.tar.gz
$ sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/jdk1.8.0_221/bin/java" 1
$ sudo update-alternatives --set java /opt/java/jdk1.8.0_221/bin/java
$ java -version
java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)

Download SAP JAVA from marketplace
$ cd 50144807_7/BD_NW_7.0_Presentation_7.50_Comp._2_/PRES2/GUI/JAVA
$ sudo java -jar PlatinGUI750Linux_1.JAR
$ cd /opt/SAPClients/SAPGUI/bin
$ ./guilogon

You can create a new launcher with the next information.

Name: SAP
command: /bin/sh "/opt/SAPClients/SAPGUI7.50rev1/bin/guilogon"


How to install xrdp Linux Mint 19

You want connect your linux machine from windows? You need install xrdp. The easy way is:

$ sudo apt install -y xrdp xorgxrdp
$ sudo apt install -y freerdp-x11
$ sudo apt install -y xrdp tigervnc-standalone-server
$ sudo systemctl enable xrdp
$ sudo systemctl restart xrdp

You need to log out from linux and connect your session from windows, log out from your session its going to help you to avoid a black screen from windows.

miércoles, 4 de septiembre de 2019

How to install Qt Designer for Python Linux Mint 19

First, we need update our Linux Mint

$ sudo apt-get update
$ sudo apt-get upgrade

And then PIP

$ sudo apt install python3-pip
$ sudo pip3 install PyQt5

Install Qt Designer
$ sudo apt-get install qtcreator pyqt5-dev-tools qttools5-dev-tools