Tag Archives: Python

[Python] Synchronization and threading examples

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.

Posted in Python | Tagged , , | Leave a comment

[Python] Django FileField problem with polish/non-english letters

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”).

Posted in Django, Python | Tagged , , | Leave a comment

[Python,Algorithms] Fast Modular exponentiation script

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 … Continue reading

Posted in Algorithms, Python | Tagged , , , | 3 Comments

[Python] Updater/archiver/synchronizer of directories

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 … Continue reading

Posted in Python | Tagged , , , , | 3 Comments