Developers Club geek daily blog

memset — the party of darkness

1 year, 1 month ago

Read more »


Access to tables of Xi of expansions for Postgres

1 year, 1 month ago

Hi everyone!


This time I will tell not about use Python or the next trick with CSS/HTML and, alas, not how I ported 5 years Vangera, and about one important aspect of writing of expansions for remarkable PostgresSQL DBMS.

Actually, there are already many articles about how to write expansion for Postgres on Xi (for example, this) including in Russian. But, as a rule, in them rather simple cases are described. In these articles and instructions authors implement functions which obtain data on an input, somehow process them, and then return one number, a line or the user type. In them there are no explanations what to do if from Xi of a code it is necessary to be run according to the normal table existing in base or an index.

It is possible to get access through well described but slow SPI (Server Programming Interface) to tables of Xi, there is also very difficult method, via buffers, and I will tell about compromise option. Under a cat I tried to give code samples with detailed explanations.

Read more »


The most dangerous function in the world With/with ++

1 year, 1 month ago
memset()
Checking many years different C/C ++ projects, I declare: the most unsuccessful and dangerous function — memset (). When using memset function () allow the greatest number of errors, in comparison with use of other functions. I understand that my output will hardly shake bases of the universe or is incredibly valuable. However I think, it will be interesting to readers to learn why I came to such conclusion.

Hello


My name is Andrey Karpov. I combine many positions and occupations. But the basic that I do, I tell it to programmers about advantage which static analysis of a code can bring. Naturally I do it with a mercenary motive, trying to interest readers in the PVS-Studio analyzer. However, it does not reduce an interesnost and usefulness of my articles.

The only type of advertizing which can punch scaly armor of programmers is demonstration of examples of errors which PVS-Studio is able to find. For this purpose I check a large number of open projects and I write articles about results of researches. General benefit. Open projects become a little better, and our company has new clients.

Now it will become clear to what I conduct. Being engaged in verification of open projects, I saved up big base of examples of errors. And now, based on it, I can find interesting patterns.

For example, one of interesting supervision was that programmers make mistakes at Copy-Paste most often right at the end. On this subject I bring to attention the article "Effect of the Last Line".

Read more »


Get acquainted, loop fracking

1 year, 1 month ago
image
The purpose of this work is designation of one more technology of optimization of cycles.
At the same time there is no task to be guided by any existing architecture, and, on the contrary
let's try to act whenever possible abstractly, relying mainly on common sense.

The author called this equipment "loops fracking" by analogy with, for example, "loops unrolling"
or "loops nesting". Especially as the term reflects sense and is not occupied.

Read more »


Linux, the postponed loading of drivers and idle interruptions

1 year, 1 month ago
Today I will tell about unexpected problems which arose at connection of the matrix keyboard to ARM борде under control of Linux. And it is specific about why the adp5589 driver did not want to receive interruptions and as we could force it to do it.

To whom it is interesting — welcome under kat.

Read more »


Atomic processing of data units without blocking

1 year, 1 month ago
Use of algorithms without blocking always was something frightening for the developer. It is very difficult to imagine data access arrangement without blocking so that two or more flows could not process the same data unit at the same time. Most of developers use standard containers like stacks or chained lists without blocking, but no more than that. In the same article I would like to tell how to organize data access in the multithreaded environment without blocking.

The main idea of such method is that each flow uses the separate buffer in which it copies data from the main buffer, processes them and then interchanges the position of the pointer on the buffer with the pointer on the main buffer.

Read more »


Dig only down

1 year, 2 months ago
Hello, dear readers.

Recently we were interested in Zed's series of the Show "The Hard Way" which it would be desirable to translate into Russian at least partially. As occasionally we really do not look for easy ways, it would be desirable to begin with the book about language C:



A series is oriented first of all to beginners. For those who love language C and also for their opponents believing that it is better to start with something more simply we publish a little reduced Evan Miller's article written at the end of last year. Perhaps, depending on reaction to this article, we will decide to translate and publish in addition a fragment from the book of Mr. Shaw or even his answer to the criticism stated by Tim Hentenaar for now we invite you under kat where, from our point of view, the most general reasons for benefit of relevance of this book are stated.

Read more »


Flytouch 2/Superpad III and attempt to save bytes in a kernel Linux

1 year, 2 months ago
I was going to write this article for a long time, but in recent months could not find enough time in any way. While I reflected over article, did examples and checked the guesses, on Habré already discussed a konstantnost — [1][2].

For the sake of an entertainment we will try to do similar economy not with the spherical project in vacuum, and with the most live and grandiose project — with a kernel Linux!

Read more »


We pass from STM32 to the Russian K1986BE92QI microcontroller. Practical application: We poll keys, we manage the LED brightness (we generate tension on an output) by means of PWM (PWM+TIM+PORT)

1 year, 2 months ago

Introduction.

In two previous articles we generated a clock signal of the frequency necessary to us by means of PWM, receiving on a LED equal intervals of a luminescence and its absence. This task takes place to be in practice (in one of the subsequent articles we will precisely face it). But most often PWM is used for other designated purpose. One of the most widespread — management of brightness of LEDs or the rotational speed of motors. Also by means of PWM it is possible to generate a sound (about what there will be following article). And in this article I would like to tell how on our controller it is possible to implement management of LED brightness.

Read more »


We pass from STM32 to the Russian K1986BE92QI microcontroller. Practical application: We poll keys, we generate PWM. Comparison of a code on CMSIS and SPL (PWM+TIM+PORT). Part second

1 year, 2 months ago

Introduction.

In the previous article we repeated the general structure of the timer and in details considered manual method of adjusting PWM of the channel with use of CMSIS. But much do not like "to dig in registers" and they prefer essentially other abstraction layer allowing as it seems to them, to simplify a task. I will try to show in this article to you all pluses and minuses of this approach.

Read more »