This blog is just to solve some bugs while using MySQL as a server. Assuming you've
already installed mysql-server,
mysql-server-5.7, and
mysql-server-core-5.7.
1. Errors
1.1
Failed to start mysql.service: Unit mysql.service not found.
1 2 3 4 5 6 7
➜ ~ sudo service mysqld start [sudo] password for jiapei: Failed to start mysqld.service: Unit mysqld.service not found. ➜ ~ /etc/init.d/mysql stop [ ok ] Stopping mysql (via systemctl): mysql.service. ➜ ~ /etc/init.d/mysql start [ ok ] Starting mysql (via systemctl): mysql.service.
Conclusion: use /etc/init.d/mysql start
instead of service mysqld start.
1.2
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using
password: YES)
1 2 3
➜ ~ mysql -u root -p Enter password: ERROR 1698 (28000): Access denied for user 'root'@'localhost'
We FIRST list all existing MySQL processes and kill
them all.
1 2 3
➜ ~ ps aux | grep mysql ... ➜ ~ sudo kill PID
Util now, there should be NO MySQL process
running.
1.3
ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock'
Since there is NO MySQL process running, of course
we cannot connect to MySQL server.
1 2 3 4 5 6 7
➜ ~ mysql -u root -p Enter password: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) ➜ ~ /etc/init.d/mysql start [....] Starting mysql (via systemctl): mysql.serviceJob for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details. failed!
Then, we will have to have these 3 packages reinstalled:
mysql-server, mysql-server-5.7, and
mysql-server-core-5.7.
/var/run/mysqld/mysqld.sock is NOW
back, and MySQL seems to run automatically.
1 2 3 4 5
➜ ~ ls -ls /var/run/mysqld/mysqld.sock 0 srwxrwxrwx 1 mysql mysql 0 Nov 30 03:08 /var/run/mysqld/mysqld.sock ➜ ~ ps aux | grep mysql mysql 13785 0.1 0.3 1323300 172680 ? Sl 03:08 0:00 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid jiapei 14453 0.0 0.0 21556 2560 pts/0 R+ 03:16 0:00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn mysql
Then, use chown and chmod to set up
the owners and permissions suitably as follows.
1 2 3 4 5 6 7 8 9 10 11 12 13
➜ run pwd /var/run ➜ run sudo chown mysql:mysql -R mysql ➜ run sudo chmod 755 -R mysql ➜ run ls -lsd mysql 0 drwxr-xr-x 2 mysql mysql 100 Nov 30 02:38 mysqld ➜ run cd ../lib ➜ lib pwd /var/lib ➜ lib sudo chown mysql:mysql -R mysql ➜ lib sudo chmod 755 -R mysql ➜ lib ls -lsd mysql 4 drwxr-xr-x 6 mysql mysql 4096 Nov 30 02:38 mysql
1.4 ERROR
1698 (28000): Access denied for user 'root'@'localhost'
➜ ~ mysql -u root -p Enter password: ERROR 1698 (28000): Access denied for user 'root'@'localhost' ➜ ~ sudo mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.7.24-0ubuntu0.18.04.1 (Ubuntu)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h'forhelp. Type '\c' to clear the current input statement.
mysql> USE lvrsql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A
Database changed mysql> CREATE USER 'YOUR_SYSTEM_USER'@'localhost' IDENTIFIED BY 'YOUR_PASSWORD'; mysql> GRANT ALL PRIVILEGES ON *.* TO 'YOUR_SYSTEM_USER'@'localhost'; mysql> FLUSH PRIVILEGES; mysql> exit;
➜ ~ service mysql restart ➜ ~
1.5 [ERROR]
InnoDB: Unable to lock ./ibdata1 (Additional)
If you meet the above ERROR message, what you can do
is to restart MySQL by:
1 2 3
➜ ~ /etc/init.d/mysql restart [ ok ] Restarting mysql (via systemctl): mysql.service. ➜ ~
var view = new SceneView({ map: map, container: "viewDiv" });
var osmLayer = new OpenStreetMapLayer(); map.add(osmLayer); }); </script> </head>
<body> <div id="viewDiv"></div> </body>
</html>
Please click on the following image and have a try.
ArcGIS is like the
CROWN of GIS. Its SDK/API seems
NOT fully open source but commercial. Therefore, I'd
love to breifly test out some other open source.
"OpenGlobus is a javascript
library designed to display interactive 3d maps and planets with map
tiles, imagery and vector data, markers and 3d objects. It uses the
WebGL technology, open source and completely free." (Cited from OpenGlobus Github).
Let's just take the very FIRST example Og -
examples: Attribution as our example. Code is cited as follows:
OpenStreetMap may be
covered by different tiles in order to show different maps. For
instance, Google map vs Google satellite
map. Let's take a look at Home Page of WebGLEarth, you'll
notice MapTiler at the left
bottom corner. Here, we summarize 3 widely used tiles in the
following:
Besides tiles, there might be several layers (including one layer of
tile) upon OpenStreetMap,
here comes OpenLayers: "OpenLayers
makes it easy to put a dynamic map in any web page. It can display map
tiles, vector data and markers loaded from any source." (cited from https://openlayers.org/)
Yesterday, we briefly introduced Quantopian and how to ingest Quandl WIKI Bundle
data. Today, we are going to briefly summarize the financial data
source and how to retrieve Google and
Yahoo finance data using pandas_datareader.
# Define the instruments to download. We would like to see Apple, Microsoft and the S&P500 index. tickers = ['AAPL', 'MSFT', '^GSPC']
# We would like all available data from 01/01/2017 until 12/31/2017. start_date = '2017-01-01' end_date = '2017-12-31' df = data.DataReader(tickers, data_source='google', start=start_date, end=end_date)
Exception has occurred:
pandas_datareader.exceptions.ImmediateDeprecationError Google finance
has been immediately deprecated due to large breaks in the API without
the introduction of a stable replacement. Pull Requests to re-enable
these data connectors are welcome. See
https://github.com/pydata/pandas-datareader/issues File
"....../test.py", line 16, in df = data.DataReader(tickers,
data_source='google', start=start_date, end=end_date)
On the other hand, from the following 3 finance data
resource, the following printed tables and generated pictures
demonstrate that stock data can be successfully loaded.
# Define the instruments to download. We would like to see Apple, Microsoft and the S&P500 index. tickers = ['AAPL', 'MSFT', '^GSPC']
# We would like all available data from 01/01/2017 until 12/31/2017. start_date = '2017-01-01' end_date = '2017-12-31' df = data.DataReader(tickers, data_source='yahoo', start=start_date, end=end_date)
# Define the instruments to download. We would like to see Apple, Microsoft and the S&P500 index. tickers = ['AAPL', 'MSFT', 'SPY']
# We would like all available data from 01/01/2017 until 12/31/2017. start_date = '2017-01-01' end_date = '2017-12-31' df = data.DataReader(tickers, data_source="iex", start=start_date, end=end_date)
# We would like all available data from 01/01/2017 until 12/31/2017. start_date = '2017-01-01' end_date = '2017-12-31' df = data.DataReader('AAPL', data_source="quandl", start=start_date, end=end_date, access_key="your-quandl-api-key") # df = data.DataReader('MSFT', data_source="quandl", start=start_date, end=end_date, access_key="your-quandl-api-key")
Today, let's have some fun of AI in finance. We are going to use a
tool named Quantopian. As far
as I know, functional programming language Haskell has been widely used in quantitative
analysis. That's possibly why a dependent package of Quantopian, namely pandoc, requires The Haskell Tool
Stack for its installation. Therefore, Haskell and pandoc need to be installed before Quantopian installation.
As known, Quantopian is a
Python collections of various quantitative
analysis algorithms. However, where can we obtain the stock data for
our testing? Either the real-time data, or the historical data will
do.
➜ quantopian QUANDL_API_KEY=<yourkey> zipline ingest -b quandl [2018-11-07 05:18:37.895463] INFO: zipline.data.bundles.quandl: Downloading WIKI metadata. Downloading WIKI Prices table from Quandl [####################################] 100% [2018-11-07 05:18:54.369791] INFO: zipline.data.bundles.quandl: Parsing raw data. [2018-11-07 05:19:24.118879] INFO: zipline.data.bundles.quandl: Generating asset metadata. Merging daily equity files: [-----------------------------#------] 1731~/.local/lib/python3.6/site-packages/zipline/data/us_equity_pricing.py:417: UserWarning: Ignoring 1 values because they are out of bounds for uint32: open high low close volume ex_dividend split_ratio 2011-04-11 1.79 1.84 1.55 1.7 6.674913e+09 0.0 1.0 winsorise_uint32(raw_data, invalid_data_behavior, 'volume', *OHLC) Merging daily equity files: [####################################] [2018-11-07 05:21:34.367628] INFO: zipline.data.bundles.quandl: Parsing split data. [2018-11-07 05:21:34.572459] INFO: zipline.data.bundles.quandl: Parsing dividend data. ~/.local/lib/python3.6/site-packages/zipline/data/us_equity_pricing.py:931: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`. if not issubdtype(actual, expected): ➜ quantopian
And, Happy Birthday To Myself. Such an old
NOBODY... DON'T ask my age. Anyway,
enjoy life...
Today, we are testing out some pose estimation open source, based on
various open source AI frameworks, including: * PyTorch * Tensorflow * Caffe2 * Caffe
Hi, everyone... I've been so busy and haven't written anything for a
bit. My previous boss at Lenovo is
now in Vancouver for annual executive meeting. She brought me a HuaweiHiSiliconHikey 970.
However, it seems Linux support for uPyCraft is NOT
very good. My working environment:
1 2 3 4 5 6 7 8 9 10 11 12 13
$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.1 LTS Release: 18.04 Codename: bionic $ uname -a Linux jiapei-GT72-6QE 4.18.7-041807-generic #201809090930 SMP Sun Sep 9 09:33:16 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux $ python --version Python 3.6.5 $ qmake --version QMake version 3.1 Using Qt version 5.11.1 in /opt/Qt/Current/gcc_64/lib
PART A: Test Built uPyCraft
1. Try the Executable
In fact, there is one executable Linux
version for uPyCraft. However, to run it after downloading, I
obtained the following ERROR messages:
1 2 3 4 5 6
$ ./uPyCraft_linux_V1.0 Traceback (most recent call last): File "uPyCraft.py", line 2, in <module> File "/usr/local/lib/python3.5/dist-packages/PyInstaller/loader/pyimod03_importers.py", line 714, in load_module ImportError: /tmp/_MEIoq8Xi8/libz.so.1: version `ZLIB_1.2.9' not found (required by /usr/lib/x86_64-linux-gnu/libpng16.so.16) [324] Failed to execute script uPyCraft
It's been quite a while before I write down this
similar blog as my previous Single Board
Computer blogs. Banana
Pi Pro is a SBC with AllWinner
A20 ARM CPU, which is also just of card size (Cited from LeMaker
Official website).
PART
A: Install Ubuntu Desktop Built By Armbian onto Banana Pi Pro
1. Download
Armbian Ubuntu Desktop for Banana Pi Pro
We FIRST go visiting the website https://www.armbian.com/banana-pi-pro/
and click Armbian Bionic icon, a file named
Armbian_5.59_Bananapipro_Ubuntu_bionic_next_4.14.65.7z
will be automatically downloaded.
2. Install
Armbian Ubuntu Desktop for Banana Pi Pro
After the extracted image file is prepared, it's the time to install
the Armbian Ubuntu Desktop onto our TF card. We FIRST
format the TF card:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
$ sudo umount /dev/mmcblk0p1 [sudo] password for jiapei: $ sudo mkfs.ext4 /dev/mmcblk0 mke2fs 1.44.1 (24-Mar-2018) Found a dos partition table in /dev/mmcblk0 Proceed anyway? (y,N) y Discarding device blocks: done Creating filesystem with 7791744 4k blocks and 1949696 inodes Filesystem UUID: 4e7bb315-0db1-4b62-a9d5-40c0ba78c7f0 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000
Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done
Afterwards, use dd to install the downloaded Armbian
Ubuntu Desktop image.
1 2 3 4 5
$ cd Armbian_5.59_Bananapipro_Ubuntu_bionic_next_4.14.65/ $ sudo dd bs=4M if=Armbian_5.59_Bananapipro_Ubuntu_bionic_next_4.14.65.img of=/dev/mmcblk0 conv=fsync 211+0 records in 211+0 records out 884998144 bytes (885 MB, 844 MiB) copied, 123.525 s, 7.2 MB/s
PART
B: Boot Into Armbian, Network Configuration, Locale Configuration and
Armbian Upgrading
NOTE: Whenever you met some
unsolvable issue after you boot into Armbian, please use the command
armbianmonitor -U to log the issue.
1. Boot Into Armbian
We now unplug the TF card from the host and put it into the Banana
Pi Pro board, Armbian Ubuntu Desktop boots successfully. The default
username and password are respectively: root and
1234.
1 2 3 4 5 6 7 8 9 10
Ubuntu 18.04.1 LTS bananapipro tty1
bananapipro login: root password: You are required to change your password immediately (root enforced) Changing password for root. (current) UNIX password: Enter new UNIX password: Retype new UNIX password: ...
And, for the FIRST boot, we'll be asked to create a
NEW user besides root:
Creating a new user account. Press <Ctrl-C> to abort
Please provide a username (eg. your forename): bananapipro Trying to add user bananapipro Adding user 'bananapipro' ... Adding new group 'bananapipro' (1000) ... Adding new user 'bananapipro' (1000) with group 'bananapipro' ... Creating home directory '/home/bananapipro' ... Copying files from '/etc/ske1' ... Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully Changing the user information for orangepiplus2 Eter the new value, or press ENTER for the default Full Name []: Room Number []: Work Phone []: Home Phone []: Other []: Is the information correct? [Y/n] Y
Dear bananapipro, your account bananapipro has been created and is sudo enabled. Please use this account for your daily work from now on. ...
Then, Banana
Pi Pro now boots into text mode with account root.
1
root@bananapipro:~$
We may now re-login with the newly created account
bananapipro:
bananapipro@bananapipro:~$ sudo vim /etc/network/interfaces source /etc/network/interfaces.d/* # Network is managed by Network manager auto lo iface lo inet loopback
Afterwards, a reboot (meanwhile, you may have to set up your own
router for a fixed IP) will bring your Banana
Pi Pro a fixed IP address. Here in my case:
192.168.0.82.
bananapipro@bananapipro:~$ sudo dpkg-reconfigure tzdata [sudo] password for bananapipro: perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = "en_US.UTF-8", LC_ALL = (unset), LC_MEASUREMENT = "en_CA.UTF-8", LC_PAPER = "en_CA.UTF-8", LC_MONETARY = "en_CA.UTF-8", LC_NAME = "en_CA.UTF-8", LC_ADDRESS = "en_CA.UTF-8", LC_NUMERIC = "en_CA.UTF-8", LC_MESSAGES = "en_US.UTF-8", LC_TELEPHONE = "en_CA.UTF-8", LC_IDENTIFICATION = "en_CA.UTF-8", LC_TIME = "en_CA.UTF-8", LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to a fallback locale ("en_US.UTF-8"). locale: Cannot set LC_ALL to default locale: No such file or directory /usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory
Current default time zone: 'America/Vancouver' Local time is now: Tue Sep 4 15:33:36 PDT 2018. Universal Time is now: Tue Sep 4 22:33:36 UTC 2018.
During the above process, you'll set the following 2 pages
correspondingly:
If we logout and login Banana
Pi Pro again, we'll see the timezone has been successfully reset.
Welcome to ARMBIAN 5.59 stable Ubuntu 18.04.1 LTS 4.14.65-sunxi System load: 0.16 0.20 0.18 Up time: 53 min Memory usage: 6 % of 992MB IP: 192.168.0.82 CPU temp: 46°C Usage of /: 3% of 29G
Last login: Tue Sep 4 14:58:03 2018 from 192.168.0.60
It seems Tensorflow evolves
pretty fast. Today we are testing object tracking based on Tensorflow.
1. Environment
1 2 3 4 5 6 7 8 9 10
➜ ~ python Python 3.6.6 (default, Sep 12 2018, 18:26:19) [GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux Type "help", "copyright", "credits" or "license"for more information. >>> import tensorflow as tf >>> tf.__version__ '1.12.0-rc0' >>> import cv2 >>> cv2.__version__ '3.4.3'
2. Object Tracking
2.1 Concepts
There are several fundamental concepts to be re-emphasized (Here, we
took one single concerned object as our example. There might be
multiple concerned objects): -
detection: You don't know whethere there is a concerned
object in the field of view or not, which you will know after the
detection. And, if there is such a concerned object in the view, the
object location is to be given. - tracking: You know
where the concerned object was. Based on the prior knowledge, you are to
determine where this object is going to be next? -
location: Both detection and tracking are looked on as
locating the concerned object. - recognition: Only
after the concerned object has been located, more detailed information
may be recognized afterwards.