ssh to a remote server and run programs inside a terminal is not a big deal for major operating systems. However if the remote program requires graphics display, it will be a little bit tricky. macOS does have a powerful terminal that can automatically create an X window for the remote application. Windows could do that too, with some sort of hacking. Thanks to the great bash on windows, the effort to run remote X applications is now minimized. The detailed steps are shown below.
Blue Screen of Death (BSoD) is a famous but annoying symbol of windows operating system. It indicates that there are some fatal errors such that the system can't work safely. General applications don't have the ability to trigger the blue screen, so there should be something wrong with either hardware or drivers, if windows itself is not corrupted. In whatever case, you need to take actions because the blue screen will appear from time to time if the root cause is not found and properly handled.
So how to investigate the root cause of a blue screen failure?
Dynamic programming (DP) is a group of very useful algorithms to solve searching problems. In many cases, it is easy to realize that a particular problem can be solved in DP, but you may spend a lot of time on finding the iterative equations. Distinct Subsequences is one such problem.
Here is the description from leetcode.
Given a string S and a string T, count the number of distinct subsequences of T in S.
A subsequence of a string is a new string which is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (ie, "ACE" is a subsequence of "ABCDE" while "AEC" is not).
Partial function is a function partially complete. As a transformer, it is a way to create new functions from existing functions, meanwhile adding your own things. It can be named whatever you want, but I call it partial to keep consistency with the concept.
Here is a typical implementation of partial function.
1 2 3 4 5 6 7 8
defpartial(method, name, **specified): @functools.wraps(method) defwrapper(self, *args, **kwargs): final = dict(specified) final.update(kwargs) returngetattr(self, method.__name__)(*args, **final) wrapper.__name__ = name return wrapper
It seems to be pretty complex. This article will help you understand this function.
I believe most of you won't like to see the following question on your exam paper.
If you choose an answer to this question at random, what is the probability that you will be correct? A) 25% B) 50% C) 0% D) 25%
This is actually a very hard question. To fully understand the question we need to make some assumptions and see what we can infer from them. Let's start from an "obvious" one.
Assumption 1: this question has a unique correct answer.
我相信现在同时喜欢读博客并且喜欢数学的人已经不多了。如果你恰好在这个圈子里面,你或许听说过 matrix67 这个人。他的博客 The Aha Moments 用简单易懂的语言讲述了许多有趣的数学问题。你或许不知,matrix67 还开发了一个叫 ideagen 的神秘板块,专门用来启发思维。这个 idea generator 的工作机制十分简单,每当你刷新页面的时候,它就会返回一个新的短语。只要稍加测试即可发现,这个东西返回的大部分结果都很无厘头,一小部分结果如果脑洞够大,还是有些意义的。这是我在五次测试中拿到的短语:
Today when I want to copy a project from my Linux machine to Windows, I get a very unusual error.
1 2
cp: cannot create regular file ‘Share/bookrepo/target/guestbook-java-1.0-SNAPSHOT/js/aux.js’: Operation not permitted cp: cannot create regular file ‘Share/bookrepo/src/main/webapp/js/aux.js’: Operation not permitted
It says that we can't copy a file named aux.js to the destination. However the file has exactly the same permission as others, so why it is handled separately? After googling for a while I get the astonishing answer: AUX, with all possible extensions, are invalid file names in Windows! WAT??
According to the MSDN documentation, the following names are reserved and could not be used to name a file.
CON
PRN
AUX
NUL
COM[1-9]
LPT[1-9]
Since file names are case insensitive in Windows, aux.js accidentally fails into the range, and thus cause the error. I would say it is a terrible design because no one knows that before he/she encounters the problem!
Here is an article talking about the history behind those invalid files names. It is hard to believe that the idea can be traced back to 1973 CM/P OS, even before the DOS. All the new things build on it, including DOS, Windows NT, and .NET, are suffering the same problem just for COMPATIBILITY!
Programmers are warned by the following statement: never modify a container itself while using an iterator that goes through it. It makes sense because it is usually hard to track what is going on. Even worse, different programming languages have different implementation on iterators, so the same logic may not work everywhere.
In this article I will demonstrate how Python iterator works by exploiting it, namely modify the container while accessing elements.