I want to present my code in Python solving Senate Bus Problem from The Little book of Semaphores (page 211). I’ve used several synchronizing objects such as Lock, Thread, Condition and Semaphore. Here is link to Python threading library.
I’ve created a Django model using FileField: class Car(models.Model): … car = models.FileField(upload_to=’upl/%Y/%m/%d’) …class Car(models.Model): … car = models.FileField(upload_to=’upl/%Y/%m/%d’) … I wanted to upload files named using polish characters (for example: “auto-żółw”). Unfortunately, Django erease polish letters (“auto-żółw” -> “auto-w”).
If we want to know the last ten digits of number an – we have to evaluate expression an mod 1010. Using brute force approach, we have to do O(n) ( If you don’t understand big „O” notation, visit: Big O notation – it’s VERY important) multiplications and modulo divisions. When n is greater than 109, it will take a lot of time. Fortunately, we can use more „mathematical” approach, which has O(log n) complexity.
I have directory with data (music, photos, ebooks etc.) on my two computers. I wanted to have exactly same files in my data directory on both machines, but sometimes I changed content of the directory on one of computers. I’ve decided to write program, which would help me to update data directory on another machine.