Improved Bubble Sort
Almost every developer know how to implement the bubble sort for a simple array. We just need to travel over the array in two levels and swap the adjacent elements in the second level if their values’ order is not Read more…
Almost every developer know how to implement the bubble sort for a simple array. We just need to travel over the array in two levels and swap the adjacent elements in the second level if their values’ order is not Read more…
Shun is the last king of five emperors, his father is blind, but he has two pupils for every single eye, so the man is also named ChongHua. Shun lost her mother since he was very young, his father married Read more…
Many git commands have a interesting option –patch or -p for short, it allows a user to go through every change and asks what to do instead of adding all changes in the file to a new index. git add Read more…
Read a single txt file and indent every paragraph. myReader.py def getText( filePath ): with open( filePath ) as file: content = file.read() paragraphs = content.split( ‘\n’ ) file.close() newContent = “” for para in paragraphs: newContent = newContent + Read more…
The article shows a few simple examples which use python to edit PDF. Copy And Encrypt PDF Just copy an existing PDF and generate a new file which is encrypted import PyPDF2 fileName = “/Users/weiyang/Desktop/Test.pdf” newFileName = “/Users/weiyang/Desktop/NewTest.pdf” file = Read more…
Development environment: VTK-8.1.1 To observe all details during rotating the cone, I put a axes actor and another same size cone on the same initial position. So it looks that there is only one cone but that’s not the truth. Read more…
I want to put a spline widget on a plane and move the control points to show scalar on different position dynamically. It will be convenient for user to check the change of scalar on the model. It’s easy to Read more…
A few macros we need in our project are in the following code snippet. They can make our project cleaner. #define vtkPtr( var, className ) vtkSmartPointer<className> var = \ vtkSmartPointer<className>::New() #define CPP_SET_MACRO(name,type) \ void Set##name(type _arg) \ { \ if Read more…
Let’s read the history of user’s commitment by $ git log firstly. @{ } We can find details information about these commits by order with syntax @{ }. $ git show HEAD@{0} $ git show HEAD@{1} $ git show HEAD@{2} Read more…