All posts by admin

Put plots by Matplotlib to your standard

This post provide the modification for python script for plotting using matplotlib.

plt.rcParams['font.family'] = 'Myriad Pro'
plt.rcParams['font.serif'] = 'Myriad Pro'
plt.rcParams['font.monospace'] = 'PragmataPro Mono Liga'
plt.rcParams['font.size'] = 12
plt.rcParams['axes.labelsize'] = 12
plt.rcParams['axes.labelweight'] = 'bold'
plt.rcParams['axes.titlesize'] = 10
plt.rcParams['xtick.labelsize'] = 10
plt.rcParams['ytick.labelsize'] = 10
plt.rcParams['legend.fontsize'] = 10
plt.rcParams['figure.titlesize'] = 12

Lost Desktop icons after uninstalling Komorebi on Linux Mint

Komorebi is an application that enables animations for desktop wallpapers. When uninstall Komorebi, there is a possibility that desktop will become unresponsive: desklets are still displaying but no icons, right click doesn’t show anything. To fix it, run this code in Terminal:

gsettings set org.nemo.desktop show-desktop-icons true

Thing should be fine after this.

Best way to install Node.js and NPM

I’m writing this post as I need to install node.js and npm to install packages for reveal.js, I’m on Ubuntu 18.04 Bionic.

Normally we can install node.js via terminal by

sudo apt install nodejs

But this is not the best way since the version is outdated and some dependencies won’t meet. The best way to install the latest node.js and npm is via nvm.

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash

Note that the version number can be checked by going directly to the website and see. The above script will download all the package and put nvm into the Linux alias (so we can use the nvm command globally). After this, log out and log in to activate the alias.

Once you log in, run below script

nvm install node

To update:

nvm install node
nvm alias default nodenvm install node
nvm alias default node

From this answer: https://askubuntu.com/a/1009527

Math Tools

“Mathematicians do not recognize their discipline in such descriptions. We see arithmetic and algebra as tools used in doing mathematics, just as hammers and handsaws are tools used in carpentry. For professionals, mathematics is about curiosity, imagination, and solving problems. There are questions that are instinctive and natural for mathematicians that rarely occur to those looking in from the outside. There is such a thing as a mathematical view of the world. Sadly, it is a view that is too often hidden from those struggling to learn the subject.”
From the book Taking Sudoku seriously

Import mô hình 3D từ Blender vào YADE

Blender là phần mềm thiết kế 3D nguồn mở.

YADE là phần mềm mô hình phần tử rời rạc, cũng nguồn mở.

YADE có thể tạo một khối hình học 3D và hỗ trợ tương đối khiêm tốn: hình hộp, hình cầu, xi-lanh….

Tuy nhiên, những hỗ trợ căn bản của YADE nhiều lúc không phục vụ được nhu cầu thực tế của xây dựng dân dụng. Đặc biệt khi người dùng cần fill particles vào trong một khối có hình dạng ngẫu nhiên. Rất may là YADE có hỗ trợ định dạng GTS và có một công cụ giúp chuyển đổi file từ STL (một dạng file 3D thông dụng từ blender) sang GTS, đó là stl2gts. Câu lệnh để dùng rất đơn giản: ví dụ có một file cube.stl và bạn muốn đổi nó thành cube.gts, cú pháp cần gõ trong terminal như sau:

”’ stl2gts < cube.slt > cube.gts ”’

Thường thì quá trình convert diễn ra khá nhanh. Ngay khi có file gts bạn có thể import vào trong YADE bình thường vì YADE có hỗ trợ python-gts.

Some FEM-DEM coupling attempts

FEM and DEM are well-known for studying structural analysis and behavior of granular materials, respectively. There are some special cases that we wish to combine the two methods to profit all the strong points from both methods. Here  are a list of what I’ve found till the writing time of this blog post.

1. YADE – OOFEM

YADE is pretty well-known in Europe as an open-source DEM tool, written in C++ and PYTHON, and OOFEM is a FEM tool (latest version is 2017).

2. YADE – ESYS

Also from YADE document page, the link between FEM-DEM has been made using these two tools.

Very basic at the moment, lacks some serious development.

3. EDEM – ABAQUS

From version 2018, EDEM shows some supports for porting to ABAQUS. To some academic members, ABAQUS is their favorite numerical tool to do structural analysis.

4. YADE – COMSOL

There is a module developed by University of Ottawa, Canada to couple FEM-DEM using YADE and COMSOL based on JAVA linking.

Change Footer Text in Slide Master in Powerpoint 2016 and later

It is normal that we use a presentation more than one time for different conference. Anytime doing that, modifying the footer, where the conference’s name and the date are, is an important job to do to avoid embarrassing moment.

It is pretty obvious that you can simply open Slide Master and edit directly the footer text to whatever you want. However, for Powerpoit 2016 and later, when you do that and return to the slide, the old text content is still there and the modification you’ve done is applicable only for new slide.

In order to edit that, now what we should do is manually edit them. Not slide by slide but by Insert -> Header & Footer -> Modify the content, then click “Apply to All”.

It’s a nuisance but we can solve it by that trick.

Proper set-up of Zotero to manage your bibliography

Anyone who works in academy world would hear at least once about using Zotero to manage the reference. In this post I will show you how to install Zotero and set it up properly to max out its capacity by connecting increasing the storage size, connect with sci-hub, and how to grab a paper from a journal in just one click. I mention only Windows platform, but on Linux it is pretty similar.

Where to find Zotero and how to use them?

Well Google is your friend and installing Zotero is as easy as installing other software on a Windows computer. Here is the homepage of the Zotero we are talking about:

https://www.zotero.org/

(by the time I paste that link, I realize Zotero has just introduced a new tool called Zoterobib for fast crafting a abstract. Nice work Zotero!).

Just download the file and install on Windows platform, as well as the Firefox add-on because you will need that.

Download PDF to local computer using Zotero

If you installed Zotero on your lab computer, chance is it will be easy to grab a PDF when you are browser those journals website. If your institute has access to the source, just click the button of the add-on in Firefox while Zotero in running to let it connect to the database and make a copy on your local computer for you. Next time you can navigate inside Zotero and read the PDF however you like.

If you install on your personal computer or if you connect to a paper that your school does not have access, then you have few other choices to get the PDF: (a) message directly the corresponding author of the paper, normally they will reply you very fast if you have interest in their work (we are! we are really happy when there is someone want to read what we are doing!); (b) if you cannot wait, there is the site sci-hub where you can search and download the paper for free, then go to Zotero and attach the PDF to the paper query in Zotero; (c) or you can do the b step automatically by modifying a bit of how Zotero searching for the PDF, thanks to a great tip by Simon on medium. Using (b) and (c) may be illegal in some countries so prepare to secure your connection (tip: don’t worry much, people just don’t care).

Sync your file to your personal or 3rd party storage service (WebDav)

Zotero itself supports free user with 300MB to store and sync the paper they collect across all server and to be fair this is enough. However when you are working with a big database, it is advised to use a WebDav (Dropbox, GDrive…) to sync your files there. I advise you to use pcloud service because they offer 10GB and it is very easier to configure. Guys at Berkeley University wrote a clear instruction to do that. Enjoy your fast 10GB!

Sync file with your Android phone

Last info I want to share is bringing Zotero to Android phone. The situation we may encounter is there is possibility that you want to read again a paper from your library when you are in a seminar without your laptop, or you are on a bus and you cannot wait till home to open and grab the idea. So let us install a connector of Zotero on Android phone to make it work.

There are several apps who help us do that trick. Although they are still having limits, but basically they do the job: connect to Zotero, sync the library and download the PDF. I recommend ZotEZ², don’t let the rating fool you, it really depends on what you want, if you just want to look at the library the most simple way and want to download the PDF and read on your phone, this app deserves a 5-star rating. It is free and with some in-app purchases you can unlock other utilities which is probably useful for you with a rather OK price (~5 euros).

Conclusion

I shared what I am using for my research. Few free to add some more comments if you know Zotero can do more or there is better option to do those tasks (I know there is!). Hope the provided information helps you and your research work. May the force be with you!

Use conda package in Sublime Text to switch between Python Environment

More and more people are using Anaconda for their Python needs. One important thing to notice is that Python has two version 2.7 (supported till 2020) and 3.6. Some packages are still using Python 2.7, also, when you install a suite of program for certain purpose (data analysis, image processing…), creating one environment for each purpose is a wise move.

Sublime Text (ST) is a very fast and intuitive text editor, it supports Win/Linux/Mac. We can download and use it for free (with some notification about purchasing), or we can buy a license ($80) at the time I write this blog post.

Running a Python script in ST is simple. You edit the script, choose the build system as Python, then Ctrl + B or choose Build to run the script. However, this would work only when you define Python Path for the system. How about those environment you created in Anaconda? You can do that easily by the package in ST, named CONDA.

To install CONDA, you need Package Manager inside ST. The complete guide can be found here. Then in ST, you should choose the Build System as Conda instead of Python. Now every time to want to activate the right environment, in ST just press Ctrl + Shift + P (to open the Package Option Panel) then type in CONDA, all the possible options are there.