[HOW TO] dash_bootstrap_components installed succesfully but no recognised

tphack:master !2 ?2 > python3 app.py                                                                                                                            
Traceback (most recent call last):
  File "/Users/tien.phan/Documents/github/dashboard/app/app.py", line 7, in <module>
    import dash_bootstrap_components as dbc
ModuleNotFoundError: No module named 'dash_bootstrap_components'

It was perfectly installed 
tphack:master !2 ?2 > pip install dash-bootstrap-components                                                                                                      

Requirement already satisfied: dash-bootstrap-components in /usr/local/lib/python3.11/site-packages (1.4.1)

However, when I run the app, I still got this error:
tphack:master !2 ?2 > python3 app.py                                                                                                                            
Traceback (most recent call last):
  File "/Users/tien.phan/Documents/github/dashboard/app/app.py", line 7, in <module>
    import dash_bootstrap_components as dbc
ModuleNotFoundError: No module named 'dash_bootstrap_components'

How to fix? 
I install that package to user folder 
tphack:master !2 ?2 > python -m pip install --user dash-bootstrap-components

python -m explaination: it will locate the module and execute its content as the __main__ module. This allows you to run a module directly from the command line.

tphack:master !2 ?3 > source ./env/bin/activate
tphack:master !2 ?3 > python -m pip install dash-bootstrap-components 

Now it works
tphack:master !2 ?3 > python3 app.py                                                                                                                      py app at 16:00:37
Dash is running on http://0.0.0.0:8050/

INFO:dash.dash:Dash is running on http://0.0.0.0:8050/

[HOW TO] ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

Hello,

I wanted to export the csv file from MySQL command line. And used the guide following the article [HOW TO] Export mysql result to csv file

All are good if there is no any issue.
mysql> select * from devices where status = '2' INTO OUTFILE '/tmp/PLC_active.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

It means that my MySQL server has been started with --secure-file-priv option which basically limits from which directories you can load files using LOAD DATA INFILE

so I have two options
1. Move the file to specified directory
2. Disable --secure-file-priv

Now, I choose option 1.

mysql> SHOW VARIABLES LIKE "secure_file_priv";
+------------------+-----------------------+
| Variable_name    | Value                 |
+------------------+-----------------------+
| secure_file_priv | /var/lib/mysql-files/ |
+------------------+-----------------------+
1 row in set (0.00 sec)
mysql> select * from devices where status = '2' INTO OUTFILE '/var/lib/mysql-files/PLC_active.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';
Query OK, 769 rows affected (0.00 sec)

mysql> select * from devices where status != '2' INTO OUTFILE '/var/lib/mysql-files/PLC_inactive.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';
Query OK, 113 rows affected (0.01 sec)

These files can export without any issue.

Tiến Phan - R0039

Knowledge is Endless
Sharing for Success 

[HOW TO] install Visual Studio Code in Arch Linux

I am moving Linux working environment from Ubuntu to Antergos. And I need to install Visual Studio Code for working with Git. 

Also saw something on this progress that is needed for newbie. So I write down this article. Hope it can be help you faster. 

This article follows step-by-step theory, so it is easy to do. 

Step 1:
You must download git repository 
[root@cliff Downloads]# git clone https://AUR.archlinux.org/visual-studio-code-bin.git

Step 2:
Then go inside 
[root@cliff Downloads]# cd visual-studio-code-bin/
[root@cliff visual-studio-code-bin]# ls
PKGBUILD  visual-studio-code.desktop  visual-studio-code-url-handler.desktop

Step 3:
And make a pacman package
[cliff@cliff visual-studio-code-bin]$ makepkg -s
==> Making package: visual-studio-code-bin 1.33.1-1 (Mon 29 Apr 2019 03:59:40 PM +07)
==> Checking runtime dependencies...
==> Installing missing dependencies...
...
==> Finished making: visual-studio-code-bin 1.33.1-1 (Mon 29 Apr 2019 04:00:34 PM +07)

makepkg should download *.tar.gz from Visual Studio Code and convert it to pacman package 
==> Finished making: visual-studio-code-bin 1.33.1-1 (Mon 29 Apr 2019 04:00:34 PM +07)

Step 4:
Then install 
[cliff@cliff visual-studio-code-bin]$ sudo pacman -U visual-studio-code-bin-1.33.1-1-x86_64.pkg.tar 

Step 5:
Finally, you can start it for now. I am using i3, so can take it via Ctrl + D and type "visual studio code" and press. 

Tiến Phan - R0039

Knowledge is Endless
Sharing for Success 

[HOW TO] fix ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

Hey guys,

I am working with MySQL, then want to export the data to csv file. 
mysql> select name,address from devices into outfile '/tmp/devices.csv' fields terminated by ',' enclosed by '"' lines terminated by '\n';ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

Oops! unlucky, it returns the error. Before me, someone started MySQL with --secure-file-priv
mysql> SHOW VARIABLES LIKE "secure_file_priv"; 
+------------------+-----------------------+| 
Variable_name    | Value                  
|+------------------+-----------------------+| 
secure_file_priv | /var/lib/mysql-files/ | 
+------------------+-----------------------+ 
1 row in set (0.00 sec)

it looks like that all of files store at /var/lib/mysql-files/ as declared. Then I try to export again.
mysql> select name,address from devices INTO OUTFILE '/var/lib/mysql-files/orders.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';Query OK, 891 rows affected (0.01 sec)

it works!!!


Tiến Phan - R0039

Knowledge is Endless
Sharing for Success