April 13, 2021
Been busy reviewing a few books
I'm grateful for the opportunity to review a few books (draft, partial) recently. It is amazing how much time and effort the authors put in for a book.
This year, I reviewed a couple machine learning books and a programming book. They are all great. I have to point out what needs to be improved, and that's sometimes painful when the writing is just perfectly good. And unfortunately, the publisher always give tight deadlines for review.
Anyways, I can't wait until the books get finished and published.
One of the books I reviewed is being sold as an early access book - Unsupervised Learning with Python: https://www.manning.com/books/unsupervised-learning-with-python
It's a great reading -- a bit long in some sections but you can read like a novel. I really enjoyed the book.
I haven't posted about this book, another one I reviewed in 2019 (published in 2020), Learn Docker in a Month of Lunches: https://www.manning.com/books/learn-docker-in-a-month-of-lunches
I used to enjoy reading computer books a lot, until some years ago, many authors just list source code and diagrams, putting labels on them, and put the description below, that spans through pages. This makes the reader to go back and forth between the diagram/code and the description.
However this book and the books I recently reviewed -- they are very easy reading I can just read through without flipping pages back and forth.
[Note] Linux Bi-lingual system and file name sort issue
I downloaded NLP related files from Korean sites. Many file names are in Korean, and I noticed that when I did ls -l, or viewed the files in GUI, the files weren't sorted properly.
This is probably because English (UTF-8) is the system default, and added Korean IME only.
I did some research and found only one solution -- change the system locale:
In /etc/default/locale, add this line and reboot:
LC_COLLATE="ko_KR.UTF-8"
(reference, https://stevencval.kr/258)
I rarely have to deal with file names in Korean, so didn't want to make it as default. But I did need to sort the files properly.
The solution is using mc - Midnight Commander (https://en.wikipedia.org/wiki/Midnight_Commander) sorts the files properly, and organizing files is easier than doing it using plain CLI or GUI.
(image of MC, borrowed from the internet)
April 10, 2021
[Note] convert, memory allocation failed, attempt to perform an operation not allowed
Trying to convert multiple image files to a PDF file:
$ convert *.gif output.pdf
Then I got bunch of errors such as:
convert-im6.q16: memory allocation failed `302.gif' @ error/gif.c/ReadGIFImage/1303.
This is due to insufficient memory, and can be fixed in ImageMagick policy file.
First, find where the policy file is by running this command:
$ identify -list policy | more
Mine is in /etc/ImageMatick-6/policy.xml
$ identify -list policy | more
Path: /etc/ImageMagick-6/policy.xml
Policy: Resource
name: disk
Edit the file and allocate more memory:
$ sudo vi /etc/ImageMagick-6/policy.xml
Find this line and change its value. I have 64GB memory, allocated 32GB:
<policy domain="resource" name="memory" value="32GiB"/>
I ran, but encountered another error:
$ convert *.gif output.pdf
convert-im6.q16: attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/408.
Again, this is due to the policy. Edit the file again and remove or comment out these lines:
<!--
<policy domain="coder" rights="none" pattern="PS" />
<policy domain="coder" rights="none" pattern="PS2" />
<policy domain="coder" rights="none" pattern="PS3" />
<policy domain="coder" rights="none" pattern="EPS" />
<policy domain="coder" rights="none" pattern="PDF" />
<policy domain="coder" rights="none" pattern="XPS" />
-->
Then it worked fine.
Resources
- https://bigbinary.com/blog/configuring-memory-allocation-in-imagemagick
- https://www.itechlounge.net/2020/09/web-imagickexception-attempt-to-perform-an-operation-not-allowed-by-the-security-policy-pdf/
April 2, 2021
Learning Quantum Computing, Qiskit
Quantum Computing courses
The Introduction to Quantum Computing
https://www.coursera.org/learn/quantum-computing-algorithms/home/welcome
Physical Basics of Quantum Computing
https://www.coursera.org/learn/physical-basis-quantum-computing/home/welcome
Quantum Computing. Less Formulas - More Understanding
https://www.coursera.org/learn/quantum-computing-lfmu/home/welcome
Quantum Mechanics & Quantum Computation - Umesh Vazirani - Coursera 2021
https://www.youtube.com/playlist?list=PLnhoxwUZN7-6hB2iWNhLrakuODLaxPTOG
CS191x MOOC lectures
https://www.youtube.com/playlist?list=PLDAjb_zu5aoFazE31_8yT0OfzsTcmvAVg
Qiskit
https://qiskit.org/textbook/preface.html
https://www.youtube.com/c/qiskit/playlists
[Old Tech] Alpine mail client, Spreadsheet Calculator
Terminal Email Client
Long time ago, when I used Solaris -- I used mail, then elm, then pine. I really liked elm for its simplicity, lightweight.
I couldn't find elm for Linux or its clone, but found Alpine which is Apache License Pine.
- elm - https://en.wikipedia.org/wiki/Elm_(email_client)
- pine - https://en.wikipedia.org/wiki/Pine_(email_client)
- alpine - https://en.wikipedia.org/wiki/Alpine_%28email_client%29
- mutt - https://en.wikipedia.org/wiki/Mutt_(email_client)
There are plenty of web sites showing how to set up Alpine for Gmail, so won't put another step here. Just visit this page, for example - https://www.xmodulo.com/gmail-command-line-linux-alpine.html
Terminal Spreadsheet
There is a terminal version of spreadsheet -- feels like VisiCalc or Lotus 1-2-3. It's called Spreadsheet Calculator (SC), https://en.wikipedia.org/wiki/Sc_(spreadsheet_calculator)
It's pretty useful sometimes when you are stuck in terminal, or want to do quick calculation.
See these pages for usage,
- https://www.linuxjournal.com/article/10699
- https://www.maketecheasier.com/linux-command-line-spreadsheets/