Category Archives: Techniques

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.

Sort by moving elements to start or end with fewest moves

Getting started

You may be familiar with quick-sort, but when you stumble across this problem, it turns out to be a lot more complex. Since you need to determine the method that involves the fewest moves possible, you will have to take another approach. The given problem can be re-stated into this problem:

Problem statement

Hien is the class monitor and he wants his classmates to form a line, in which the height of every students is in ascending order. He needs to form that line by moving his classmates from the line to the start or end of it and it has to be a quick process, since Hien is very lazy and needs to play Age Of Empires right away. Write an algorithm to help him.

Input format

First line: n.

Second line: numbers indicating the height of every student in the class, each seperated by a space.

Constraints

n ≤ 100; H[i] ≤ 100000 (H[i] is the height of an individual).

Output format

An integer indicating the fewest moves possible.

Sample input

4

2 1 3 5

Sample output

1

Explanation

The student with height 1 is moved to the start of the line.

Let’s not pay attention to the ‘fewest moves’ for a while. Normally, when you see these types of ‘moving’ elements to start or end of an array, you can take a look at a basic approach.

Let’s take the Sample input as an example. With the basic approach, we search for the smallest element in the array, which is now 1. After that, we move it to the far right of the array. Then, we search for the next smallest element, which is 2, and we keep doing it until 5 is moved to the far right of the array. We come to the conclusion that for this approach, the number of moves that are taken is exactly equal to the number of elements present in the array itself. But let’s have a closer look. We can see that 2, 3 and 5 are contiguous, meaning that the relative order between them is not changed at all when sorting is completed. So, we can know that in the required algorithm, we need to conserve the order of contiguous integers. That is when std::pair comes to use.

Basic approach illustration

What is std::pair, exactly?

Std::pair is a pre-defined class in C++. A pair element is consisted of 2 other sub-elements, which can be classified as first and second. In the algorithm we are searching for, as stated earlier, we can utilise std::pair to get the job done by assigning the input elements to first and its index to second.

Get the job done

After that, quick-sort comes in handy. We then use it to sort the array in ascending order. Because std::pair is used, when sorting the elements, each index is carried along with the data. Then, we can just compare the indexes of every subsequent element. Job done!

Final approach illustration

Source code (C++)

List of free stock photos – Update 2019

A well-picked picture can play an important role to a blogpost or a document in general. However, the search for a good one requires effort (taking photos yourself, finding a good one on the internet) or money (stock market). Fortunately, there are free websites and nice people who are willing to provide their photos for free (or almost free), here is the update list of 2019 which I’m currently using: Continue reading List of free stock photos – Update 2019

Search in Windows

To be short: Searching files in Windows sucks.

I don’t understand why such a supposed-to-be-simple utility is poorly built in Windows system. I was hyped when upgrading from XP to 7, and 7 to 8, and 8 to 10. In the end, the feeling I have is disappointment.

At the beginning, when a fresh system is installed, everything seems smooth. Understandable! Reasons: Not many things to search, indexing is not a heavy job, and computer resource still has lots of room for software to run. Continue reading Search in Windows

Justify text automatically in wordpress blogpost

The new Gutenberg editor provided by WordPress is pretty neat. However, there are certain limits of the ability to align text as what we usually do in Microsoft Word, especially the nice-looking “justified text”.

In earlier version of the editor, we can open the extended editing bar and there would be a Justified Alignment option to click and apply on the paragraph. The current one doesn’t have it. To resolve this problem, there are several options: install the old editor plugin (which will be supported till 2022), or simply put the CSS code in the Additonal CSS section of the current theme setting:

p {text-align:justify}

Then all the paragraphs from now on will be formatted as Justified.

Abbreviations in daily business emails

In our daily work context, regardless of our industry or expertise, most of us will need to use emails for professional communication. The headache sometimes comes when we receive an email with what-the-heck-is-that abbreviations that no one taught at schools or no senior colleagues trained us. The list provided below comprises only some frequent text we may catch at work, excluding the terminologies as there would be plenty of them depending on different industries / sectors / business functions.

Continue reading Abbreviations in daily business emails

Từ LaTeX sang Word/PPT/Illustrator…

LaTeX là ngôn ngữ soạn thảo được nhiều người, đặc biệt là dân có ‘động chạm’ đến toán, thích và sử dụng. LaTeX mạnh hơn Word ở chỗ công thức toán có thể cho vào văn bản một cách đơn giản và đẹp (đẹp hơn Equation và MathType nhiều!) và làm việc ở môi trường nào cũng được: windows, linux, OSX….

Đó là để giới thiệu cho những người chưa biết Latex là gì, còn khi ai đó đã tìm đến câu hỏi ở đề bài thì dưới đây sẽ đi thẳng vào vấn đề luôn.

Continue reading Từ LaTeX sang Word/PPT/Illustrator…

The Best Programming Languages

Five of the Best Programming Languages and Frameworks for a Small Business

Choosing a programming framework for a small business can be overwhelming- there are so many. Here are a few of the best choices, to help you get started.

Ask a room of ten developers which programming framework is the ‘best on the market,’ and you’re liable to receive ten different answers. Each developer will sing the praises of a different language, and each one will very probably feel that theirs is the only logical choice. The most confusing thing, though? Each and every one of those developers will be correct.

Continue reading The Best Programming Languages