Browsed by
Tag: Python

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

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

[Python,Algorithms] Fast Modular exponentiation script

[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 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.

[Python] Updater/archiver/synchronizer of directories

[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 decided to write program, which would help me to update data directory on another machine.