נזכרתי בזה במהלך המלחמה שלי בבניית בדיקות יחידה לאפליקציה לאנדרואיד בסביבת הבדיקה של API 24 והלאה.
I was reminded of this during my war of building unit tests for an Android application in the testing environment of API 24 and later.
The other day I found that:
The solution was to build a Docker image based upon Ubuntu 18.04, which does have Python 3.6. See the project https://gitlab.com/TDDPirate/heroku_on_debian in GitLab.
After I complained about flakiness of Selenium-based tests when the Selenium server is running outside of the Docker container while the application runs inside the container, Udi Oron suggested another way to run Python 3.6 on a Debian Stretch system: use pyenv.
Turns out that pyenv solves the pain point of running Python 3.6 on Debian Stretch without having to use a container. So Selenium-based tests are now stable.
The following is an excellent article about using pyenv:
Pyenv – Python Version Management Made Easier
And the following is a link to the GitHub repository:
I suspect that pyenv is the reason why people are not in a hurry to backport new Python versions to Debian.
When I asked the above question in a Telegram group, people proposed also other tools, which I am summarizing below.
Amiad Bareli, Amit Aronovitch, Meir Gil and Yehuda Deutsch – thanks.
>>> import matplotlib.testing.compare >>> matplotlib.testing.compare.comparable_formats() ['png', 'eps', 'svg', 'pdf']
I have an application written in Python, which uses the ReportLab package for exporting PDF files.
Of course, the application needs to be tested. Among other tests, the PDF export function needs to be tested to ensure that the visual rendering of PDF files did not unexpectedly change.
Since it is possible to create and save an expected-results PDF file using fabricated test data, the above implies the need to compare two PDF files. It turns out that two PDF files created from the same data at two different dates – are different, due to embedded timestamps.
Hence, the need to compare visual renderings of the PDF files. ImageMagick’s convert knows how to convert PDF files into PNG. However, one needs to set the background and remove the alpha channel.
convert knows also to perform bitwise XOR on two image files, but it must be told how to compute the bitwise XOR. This is documented in StackOverflow: Searching for a way to do Bitwise XOR on images.
The script in https://gitlab.com/TDDPirate/compare_pdfs implements all the above.
If you encounter the “Unable to locate WordPress root directory.” error when trying to update your WordPress installation and/or plugins, and your blog is running on a PHP 7 version, installing the SSH SFTP Updater Support plugin may solve your problem. It worked for me.
Do you use reportlab for creating PDF files from your Django application, as instructed in Outputting PDFs with Django?
Do you wish to add your own font files?
Do you need to render Hebrew text?
If yes, the following information will help you.
When installed in a virtualenv, as recommended by good working practices, reportlab searches for font files it uses in your virtualenv/lib/python3.x/site-packages/reportlab/fonts and it is not good idea to add your own font files there.
Instead, add your font files to your_project_root_directory/reportlab_extra_fonts where your_project_root_directory is where your project’s manage.py is located. Add the following to any Python script that uses reportlab (usually views.py), after all regular reportlab import and configuration statements.
# The following configures extra reportlab fonts.
from django.conf import settings
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
HEBREW_FONT_NAME = 'your_font_name'
# The above configures extra reportlab fonts.
If you want to properly display Hebrew in your PDF file (the probable reason why you needed to add your own fonts in the first place), you need to convert the text yourself from logical ordering to visual ordering, because reportlab (as of version 3.4.0) does not currently process BiDi text. For this purpose, install the python-bidi package in your virtualenv (using pip install python-bidi) and add the following import statement to your views.py script:
from bidi.algorithm import get_display
Now, get_display() will reorder your BiDi text.
The following are links to documents about notetaking in events in Israel. The documents are in Hebrew.
דלעיל מופיעים קישורים למסמכים על תמלול באירועים בישראל. המסמכים כתובים בעברית.
Hamakor – an Israeli nonprofit for Free Software and Open Code was founded at 2003 and one of its goals is to help deal with money when organizing various activities around Free Software.
Before founding Hamakor, people resorted to other solutions. In one exhibition, we wanted to distribute Linux installation CD-ROMs to the crowd. However, we wanted those CD-ROMs to reach only people who have a serious intent to install Linux. A way to ensure it was to require them to donate money in exchange for their CD-ROM. However, if we collect money, we must issue receipts and do bookkeeping.
Truly Yours had the brilliant idea of inviting other nonprofits to send a representative to collect the donations and issue receipts. It was a win-win-win solution. We get someone to issue receipts and sweat over the bookkeeping. The nonprofits get money for their operations. The people, who paid for their CD-ROMs, treat them seriously.
One of the nonprofits was the Association of the Deaf in Israel.
The 2010’s John Galt project – the most important technology to be developed this decade:
Technology for using solar energy to bind carbon dioxide with hydrogen from water, and convert them into carbohydrate fuels.
The technology will have the following benefits:
The biggest drawback: drastic change in the economic power structure worldwide, because countries and companies with coal, oil or gas deposits would no longer have power over their clients.
פרויקט ג’ון גאלט של שנות ה-2010 – הטכנולוגיה החשובה ביותר לפיתוח בעשור הנוכחי:
טכנולוגיה לשימוש באנרגיית השמש כדי לקשור פחמן דו חמצני עם מימן מהמים, ולהמיר אותם לדלקי פחמן-מימן.
לטכנולוגיה כזו יש שני יתרונות גדולים:
החסרון הגדול ביותר: שינוי דרסטי במבנה הכוחות הכלכליים בכל העולם, מכיוון שארצות וחברות שיש להן מרבצי פחם, נפט וגז, יאבדו את הכוח שלהן על לקוחותיהן.
There are several cases, in which a program has to do operations A,B,C. If an error occurs while doing A, the program needs to undo A. If there is an error while doing B, the program needs to undo B then A. Similarly, an error in C requires undoing of C,B,A in this sequence.
Continue reading “A proposed new language construct: do/undo”