I once met the problem where one number appears once in an array and all others appear twice, asking for that single number — solved with XOR in O(1) space and O(n) time. Today while browsing other blogs I happened upon another variant; sharing the solution strategy here.
Handling JSON Strings Containing Chinese in Python
Following the last encoding-issues post, I recently met json + Chinese string handling problems in a program again. If things weren't unified at the project's start, the pitfalls of Chinese encoding in Python are numerous. Here I summarize my experiments and final results, hoping to inspire everyone.
DevOps pains and the use of Termux
In my company I have been responsible for the development and maintenance of a PaaS platform, which can be understood as the user writes the code and then deploys it into our machines. The developer doesn't need to care about the platform details and deploy hosts. But in fact, a lot of the maintenance tasks are transferred to the PaaS platform administrator.
Docker base image tag meaning and selection
When I want to optimize the Dockerfile, I need to know the meaning of the base image tag. Like: `3.8.0a4-stretch`, `3.7.3-alpine3.8`, `2.7.16-slim-jessie`. I do some research, and make a summary of the meaning of the base image tag, and I'll give you advice about choosing the proper base image.
asyncio Combined with Threads and Processes (Translation)
Recently while learning asyncio I found many libraries still don't support asyncio, yet must be used. That led me to this document: use asyncio to call a thread or process executor, then await the task's end — simulating a non-blocking call form.
Thoughts on a Telemarketed Insurance Call
Recently a young lady called to push insurance. I think as a normal person, one should be responsible for one's own and one's family's safety — buying insurance is reasonable. But no matter what is said on the phone, without black-and-white terms, or even complete clauses, nothing counts. So instead of hanging up rudely, I patiently listened to her product introduction and asked for a coverage plan document. Below are my thoughts on that document.
Win10 Shared Network Fails to Connect After Reboot
At work I use Windows network sharing to give my laptop internet, but I found that after every machine reboot the shared network breaks — I have to cancel the sharing and share again. Doing this every morning is really tedious. Today I finally found a solution and share it here, hoping to help those who come after.
My Office Environment Setup
I actually didn't plan to write this article, but to write the other one about solving the shared-network problem, it's necessary to first describe my environment setup. Please treat it only as a reference and follow your own company's rules.
A Little Discussion on Proving Euler's Theorem
Today I was reading about HTTPS, then followed public/private keys to RSA, and then saw Euler's theorem. Noticing Ruan Yifeng's blog has no proof of Euler's theorem, I wondered whether I could prove it, and spent a long while working out a proof scheme. I hope attentive readers will point out any problems.
Some Debugging of YouCompleteMe (Python)
YouCompleteMe is a Vim completion plugin that also uses a client-server mechanism. I recently spent time debugging and examining its code; I'll share some of the patching process as a small note, to be improved if needed.