Similar Posts
Tutorial: How to trace a function in OCaml
Tutorial: How to trace a function in OCaml. Use #trace. For example, to trace function f: # let rec f n = if n = 0 then 1 else f (n – 1) * n;; val f : int -> int = <fun> # #trace f;; f is now traced. # f 4;; f <–…
How to process a file line by line in Python?
In Python, how to process read a file line by line to process it? Like those lines in Bash: while read line ; do echo $line done < ./input.txt In Python, you can process a file line by line by a for in the file like with open(“./input.txt”, “r”) as thefile: for line in thefile:…
How to pipe the stderr to less
For example, try to less the error messages generated by the compiler with make | less Use this command: make 2>&1 | less or, if you want stderr only: make 2>&1 >/dev/null | less Read more: How to judge whether its STDERR is redirected to a file in a Bash script on Linux? How to…
Cannot start VM with error “no network with matching name ‘default'”
I update libvirt version and want to start VM with the new libvirt tools but I failed as follows. > sudo virsh start kvm1 error: Failed to start domain kvm1 error: Network not found: no network with matching name ‘default’ It seems that the default ‘virbr0’ is missing after I update libvirt so I solve…
Git diff with long lines
I find git diff output is not easy to read when the text file contains long lines that is long enough to exceeds the screen size. We may not forbid the using the long lines for all files. How to handle lone lines in git diff better? Two possible methods to make git diff with…
How to transfer text messages from android to computer?
How to transfer text messages from android phone to computer? One solution is to use the SMS Backup & Restore app. The app will backup your messages to a microSD card and then you can copy it out to a PC by connecting your Android phone to your PC with the USB cable. Read more:…