Last visit 7 hours ago

Evgenij Legotskoj

EVILEG

  • 25
  • 0
Donate
Evgenij LegotskojJuly 21, 2020, 2:31 a.m.

C++Method call on nullptr

UB, nullptr, cpp

Let's take a look at a small code example when a method is called on an object that is initialized with nullptr .

Evgenij LegotskojJune 3, 2020, 5:30 p.m.

QtQt/C++ - Tutorial 091. How to write a custom delegate controlling the highlighting of a row in a table

QTableView, Qt, Delegate

And now a short article on customizing cell behavior using delegates in a QTableView.
This article is a modification of the table behavior in one old article, namely Qt/C ++ - Tutorial 039. How to fill a row in QSqlTableModel by the value in the column . In fact, that old article has no effect on the contents of this article, but the table for an example will be taken from that lesson.

As the task, the color of the line was selected when the mouse cursor was over.

It will look as follows

Evgenij LegotskojMay 13, 2020, 5:42 a.m.

Python 3Распознавание изображений на Python с помощью TensorFlow и Keras

RuCaptcha, TensorFlow, python, Keras

Введение

Одним из наиболее распространенных применений TensorFlow и Keras является распознавание и классификация изображений. Если вы хотите узнать, как использовать Keras для классификации или распознавания изображений, эта статья научит вас, как это делать.

Определения

Если вы не понимаете основных концепций распознавания изображений, вам будет сложно полностью понять основную часть этой статьи. Поэтому, прежде чем мы продолжим, давайте определимся с терминологией.

Evgenij LegotskojMay 11, 2020, 5:38 a.m.

QtQt WinAPI - Lesson 010. How to check if file writing is prohibited by another process.

WinAPI, Qt, QFile

Surprisingly, in the course of my professional activity, I stumbled upon one interesting feature of QFile. With it, you can check whether it is possible to read or write information to a file. But at the same time, QFile ignores read and write permissions of the file if the file is opened by several instances of the same program. This means that if the file is opened in another instance of the program, then QFile will determine this file as readable or writable, and will also be able to write to the file successfully.

Evgenij LegotskojMay 9, 2020, 6:09 a.m.

DjangoDjango - Tutorial 054. How to create a polymorphic system of dynamic widgets

dynamic, django

The other day, I solved the problem of adding dynamic widgets on the site with the ability to add different types of widgets, as well as with the possibility of further unlimited expansion of the widget set by adding models of specific implementations.

The system is such that there is one class Widget , which, depending on the type selected when creating it, refers to a specific implementation model, for example HTMLWidgetImpl , which contains some special parameters, and also knows about its template for rendering. Widget in the site template when calling the render() method refers to the specific implementation and its method render()** through the type.

This approach allows you to write an extremely simple code for the template, as well as organize the code so that adding new widgets will consist in adding a new data model, as well as correcting a number of places in the code, or rather updating them. Which in essence will become a routine task and will remove from the programmer the need to come up with something new.

That is, in this article I want to show not only the solution to some problem at the level of program code, but also to show the approach to architecture planning when solving such problems.

Evgenij LegotskojMay 4, 2020, 2:21 p.m.

DjangoDjango - Tutorial 053. Adding Counters to Models in the Django Admin Panel

admin, Django, python

The other day, I started working on a content moderation application on the site and solved the problem of adding counters in the administrative panel.

It looks like this now

The task itself is trivial, but as it turned out there is a nuance, without knowing which, this task will not work right away.

Evgenij LegotskojApril 26, 2020, 3:08 p.m.

DjangoDjango - Tutorial 052. Redefining a User Model

Python, QuerySet, django, Model

There are various options for working with a user model for creating a user profile and adding some specific information, for example, a profile photo. One way is to add a profile model with the OneToOneField field for the user. This option is simpler than a proxy model or overriding a user model. But for me personally, redefinition of the user model turned out to be more effective in terms of organizing code and writing various methods that allow you to extract the necessary information from the user object in templates without resorting to writing template tags.

Therefore, let's consider exactly the option of redefining the user model in a project in Django

Evgenij LegotskojApril 22, 2020, 5:15 p.m.

EVILEGRefusal of advertising networks online EVILEG (Google Adsense, YAN Yandex, etc.)

EVILEG

So, perhaps the most joyful moment has come for many users of the EVILEG website. Namely, disabling advertising networks on the site.
Perhaps you would like to know the reasons for such an interesting behavior of the site owner, who, it would seem, was supposed to bring some kind of income through advertising networks.

In fact, the stars came together, and several reasons came out, and here they are.

Evgenij LegotskojMarch 9, 2020, 7:41 p.m.

AndroidAndroid and QML - Adding Splash Screen

manifest, QML, Splash, Android

Let me show you a small example of adding Splash Screen to an application written in Qt. In this case, the Splash Screen will be added to the application using the Android ecosystem, that is, through its manifest. Adding a manifest has been described here.

One option for creating a Splash Screen in Qt/QML is to write code in QML/C++, but the disadvantage of this way is that you will see a black screen of the application until the application is fully loaded. Therefore, you must load the application using Java, through its manifest.

Let's make such a splash

Evgenij LegotskojJan. 31, 2020, 3:50 a.m.

DjangoDjango - Tutorial 051. How to change queryset and editing ability in ModelAdmin depending on the user

Model, Django, UserAdmin

A short note on how to fix the queryset administration form admin.ModelAdmin or UserAdmin . Actually, there is no difference, since the form UserAdmin is inherited from admin.ModelAdmin . Nevertheless, I will show UserAdmin as an example.

The task is as follows. The site has superusers and users from the administration. Superusers can see all users and edit as they like. And administration users can see all user records except superusers, and also can not appoint other users as superusers.

Timeweb

Let me recommend you the excellent hosting on which EVILEG is located.

For many years, Timeweb has been proving his stability.

For projects on Django I recommend VDS hosting

View Hosting