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.
2 years, 11 months ago 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.
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".
2 years, 11 months ago 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.
2 years, 11 months 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.
2 years, 12 months 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.
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.
3 years 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 — .
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!
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.
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.