PVS-Studio for Visual C++
Written by Andrey Karpov
Many of our articles are concentrated on anything but the PVS-Studio analyzer itself. We tell our readers about projects we have checked, nuances of C++ language, creation of plugins in C#, running PVS-Studio from the command line… But PVS-Studio was first of all designed for Visual Studio users. We have done a lot to make their work with the tool as comfortable as possible. But this particular fact is very often left outside the frame. I've decided to improve the situation and tell you about the PVS-Studio plugin from scratch. If you work in Visual C++, this article is for you. What Static Code Analysis Is and Why Do We Need It Static code analysis is the process of detecting errors and defects in software's source code. Static code analysis can be treated as an automated code review process. Code review is a wonderful technique but it has oneJulia Set
Written by Pavel Nesterov
I always wanted to learn more about complex numbers. Not just the fact that the root of -1 was equal to i . I was particularly interested in figures with fractal structure. I wanted to understand what this meant and how to make such visualization. Having some time from work, I found a book on the theory of functions of a complex variable on the shelf and decided that it was time to start. Iterated Function Before writing an algorithm, we’ll have to learn a few basic notions. We’ll start with the concept of the iteration of function f . Let’s introduce the following notion of the n -th iteration of function f : in which ○ is a function composition . We’ll take the following identity map as the zero iteration: There are plenty of fixed-point theorems of certain types of maps. Let’s recall what a fixed pointSocial Network Analysis. Spark GraphX
Written by Alex Krot
Today we will learn more about the tasks of social network analysis ( SNA ), and review the Apache Spark library designed to analyze Big Data. We will also consider one of the components of Apache Spark, designed for the analysis of graphs — GraphX . We’ll try to understand how this library has implemented the distributed graph storage and computations on them. The provided examples will show how we can use this library in practice. For instance, to search for the spam, rank search results, determine communities in social networks, or search for opinion leaders, and it’s not a complete list of applying methods for analyzing graphs. Let’s start with recalling the main objects we’ll work with in the given article. Graph Theory, Random Graphs and Webgraphs A graph is an ordered pair G = (V,E) , in which V is a set of vertices (say, websites onA Non-Obvious Feature in the Syntax of Variable Declaration
Written by Maxim Razin
Take a look at this innocent looking piece of code in C++. There are no templates, no virtual functions or inheritance, but the creators of this beautiful language hid a gift right in front of us. struct A { A (int i) {} }; struct B { B (A a) {} }; int main () { int i = 1; B...
The Night of Fractals
Written by Matvey Kotov
It was a late Sunday night, and I was thinking to go to sleep, when a friend of mine sent me a picture from some website and wrote: “Beautiful!”. I drew such pictures five years ago by using the so-called escape-time algorithm. But to apply this algorithm, it was necessary to know how to partition the plane into regions for a given set of transformations. I couldn't figure it out, and did not get back to this algorithm anymore. But now I knew exactly what should I do and wrote him back: “Random IFS first, then kNN, and then the Escape-Time Algorithm!” I had an old netbook at hand, as my laptop was under repair. My friend was saying something to me, and I was answering him, but in my mind I was already writing code, and was searching for at least some compiler on the netbook. And ILock-Free Data Structures. Yet Another Treatise
Written by Max Khiszinsky
As you might have guessed, this article focuses on lock-free queues. Queues can be different. They can differ in the number of producers and consumers (single/multi producer — single/multi consumer, 4 variants). They can be bounded, on the basis of a pre-allocated buffer, and unbounded, on the basis of a list. They can either support priorities, or not. They can be lock-free, wait-free or lock-based, with the strict (fair) and not strict (unfair) conformance to FIFO, etc. These types of queues are described in detail in the article by Dmitry Vyukov . As a rule, the more specialized requirements to a queue are, the more efficient its algorithm is. In this article, we will consider the most common version of queues – multi-producer/multi-consumer unbounded concurrent queues without the support of priorities. I guess the queue is the favorite data structure for researchers. On the one hand, it’s really simple;A MIDI Player on Eight Floppy Drives
Written by Vlad_RT
Some times ago, I watched a video about singing floppy drives and a heap of written off computers, and decided to make something of the kind. Make it on Arduino like the rest? Seriously? As they say, f*ck the system! I decided to make it on Atmega8A , as that’s what I had at hand. I also decided that wires were unnecessary, and found HC-05. Let’s go! The Circuit As usual, the first stage is the circuit. No problem with that. It is simple, without unnecessary bells and whistles. The Board It was no problem to make it with the help of the photoresist. Scattered everything in 1o minutes and produced it in an hour. The Code Now, the fun part begins — programming. To save some time, I decided to write in C. But I made the same mistake at the very beginning. It was about controlling floppyReal-time notifications on Django using gevent-socketio and RabbitMQ
Written by eandrawos
This time we’ll be replacing Node.js with a 100% Python implementation using gevent-socketio and Redis with RabbitMQ, but we also didn’t want to bore you with the same vanilla notifications site, so we’re going to build something different. Something useful. This time we’re going to build a complete GeoDjango-based site to report geo-located incidents in real-time using Google Maps. The Application The application is a Django 1.7 site that uses GeoDjango (backed by PostGIS) to track and report in real-time geo-located incidents that occur in certain areas of interest around the world. It provides views to manage incidents and areas of interest, a view to monitor the occurrence of incidents in real-time and a view to report incidents that uses geolocator to detect the user’s location. Whenever an incident is saved (or updated), a message is sent to a RabbitMQ broadcast queue. At this time, the system checks whetherDo Not Wake the Programmer Up!
Written by Alex Hunder
Hey there! I’m back from the first vacation in my life… and I guess that some people have not been on vacation in their entire life. I’m not sure that it’s useful to take a break from work for almost a month. I haven’t realized what effect it would have on productivity. But during the holidays, I understood something about things I’ve been thinking about for a while, but couldn’t realize them. I was always tormented by the following question. How to explain to people who have never done the kind of work I do, the idea of what happens in my head and heads of others like me when we work? How a NON programmer can imagine a programmer’s work and finally understand what happens there and what to do about it? I think I understand it now. Maybe because I’ve been out of this process for almostHow I built my first Android Game and realized creativity is all about iterations
Written by Afsar Ahmad
Last week, on 27th February 2015, I released my first android game Rocket Romeo. As I started to spread the message to my friends, the game built traction. The graphics, mechanics and experience of the game has been greatly appreciated so far. In the midst of appreciation, I found that most of the people recognized my attempt to be creative. I have been wondering what creativity really is because for the past 45 days all I have done is tried to build a game which is loved by masses. The process was full of experimentation and iterations. To elucidate my iteration cycle, I am sharing the story of building Rocket Romeo. Here’s how the game now looks. Like I have said, I have been appreciated to be really creative while building this game. But on the other hand in my opinion — I was not creative, but iterative. Why I startedUSB Killer
Written by Dark Purple
It was a usual gloomy winter morning. My colleagues and I were drinking our morning coffee, sharing the news and there were no signs of trouble. But then a friend told about… (a quote from a chat in Skype): I read an article about how a dude in the subway fished out a USB flash drive from the outer pocket of some guy’s bag. The USB drive had “128” written on it. He came home, inserted it into his laptop and burnt half of it down. He wrote “129” on the USB drive and now has it in the outer pocket of his bag… A Picture to Attract Attention: Since I work in the company engaged in the development and manufacture of electronics, my colleagues and I are began to discuss options for creating a USB flash drive, that «would burn half a laptop down.» We had plenty ofQuantum Search Using Grover’s Algorithm
Written by Roman V. Dushkin
Following the first quantum algorithms we have already reviewed ( Deutsch’s algorithm and the Deutsch-Jozsa algorithm — it's better to read these articles first, otherwise all the things mentioned here will be quite vague), let’s analyze Grover’s algorithm for the unstructured quantum search. An American mathematician Lov Grover formulated the algorithm in 1996 (it was long after the model of quantum computations had become popular). The algorithm uses a feature of quantum interference in order to solve an extremely demanding task of searching the value of some parameter, at which a defined function returns certain results. The given algorithm does not show the exponential advantage of the task in contrast to the classical computational model, but the advantage (quadratic) is quite essential for big values. However, it’s a general algorithm for solving quite a generalized problem. It has been proved that we cannot get a better result within theSecrets of the Conditional (ternary) Operator
Written by Alex Kulikov
Every self-respecting C/C++ programmer knows what the ternary operator is, and most everyone used it at least once in their programs. But do you know all the secrets of the ternary operator? What potential dangers are associated with its use and what features, seemingly not related to its direct purpose, it has? This article gives you the opportunity to test your knowledge and maybe learn something new. Let's start with a small test. Test Will the following code compile? Explain why. 1. int i; int j; (false ? i: j) = 45; 2. int i; int j; (true ? i: j) = 45; 3. short i; int j; (true ? i: j) = 45; 4. return true ? 0 : 1; 5. true ? return 0 : return 1; 6. What will be the output of the following piece of code? Why? std::coutA Short Course in Computer Graphics. How to Write a Simple OpenGL. Article 2 of 6
Written by Dmitry Sokolov
Hi, everyone. It’s me. It’s a model of my head rendered in the program we will create in the next hour or two. Last time we drew the wire mesh of a three-dimensional model. This time, we will fill polygons, or rather triangles, as OpenGL triangles almost any polygon, so there's no need to consider a complex case. Reminding you, that this series of articles is designed for your own programming. The time that I provide here is not for reading my code. It’s time for writing your code from scratch. My code is provided here just to compare your (working) code with mine. Any comments and questions are welcome. If you’re following this tutorial and writing your own code, upload it to github.com/code.google.com and other similar websites and provide links in comments. This can help you (other people will give advice), as well as other readers. Drawing aUndefined Behavior and Fermat’s Last Theorem
Written by Tyomitch
In accordance with the C and C++ standards, if the program leads to an integer overflow or any other “undefined behavior” (UB), the result of the program performance can be anything: it can post obscenities to Twitter or format your disk… Unfortunately, “Easter eggs” that would make the program...
Multitasking in the Linux Kernel. Workqueues
Written by Vita Loginova
Let’s go on talking about multithreading in the Linux kernel. Last time I told you about interrupts, the ways to process them, and tasklets. Since I’ve wanted it to be one article, I will refer to tasklets in the story about the workqueue, and assume that the reader is already familiar with them. Just like the last time, I will try to make my story as detailed as possible. Articles of the Series: Multitasking in the Linux Kernel Interrupts and Tasklets Multitasking in the Linux kernel. Workqueues Workqueue Workqueues are more complex and heavy entities, than tasklets. I will not even try to describe here all the implementation details, but I hope to review the most important things in some detail. Workqueues, just like tasklets, serve for the deferred processing of interrupts (but we can also use them for other purposes), but, unlike tasklets, they are run in theI Do Not Know C
Written by Dmitri Gribenko
The purpose of this article is to make everyone (especially C programmers) say: “I do not know C”. I want to show that the dark corners of C are much closer than it seems, and even trivial code lines may contain undefined behavior . The article is organized as a set of questions and answers. All the examples are separate files of the source code. 1. int i; int i = 10; Q: Is this code correct? (Will there occur an error related to the fact that the variable is defined twice? Reminding you that it’s a separate source file and not a part of the function body or compound statement) Answer A: Yes, this code is correct. The first line is the tentative definition that becomes the «definition» after the compiler processes the definition (the second line). 2. extern void bar(void); void foo(int *x) { int y =Introduction to Machine Learning with Python and Scikit-Learn
Written by Alex Krot
Hello, %username%! My name is Alex. I deal with machine learning and web graphs analysis (mostly in theory). I also work on the development of Big Data products for one of the mobile operators in Russia. It’s the first time I write a post, so please, don’t judge me too harshly. Nowadays, a lot of people want to develop efficient algorithms and take part in machine learning competitions. So they come to me and ask: “Where to start?”. Some time ago, I led the development of Big Data tools for the analysis of media and social networks in one of the institutions of the Government of the Russian Federation. I still have some documentation my team used, and I’d like to share it with you. It is assumed that the reader has a good knowledge of mathematics and machine learning (my team mostly consisted of MIPT (the Moscow InstituteA Short Course in Computer Graphics. How to Write a Simple OpenGL. Article 1 of 6
Written by Dmitry Sokolov
Describing the Task In this series of articles, I want to show the way OpenGL works by writing its clone (a much simplified one). Surprisingly enough, I often meet people who cannot overcome the initial hurdle of learning OpenGL / DirectX. Thus, I have prepared a short series of six lectures, after which my students show quite good renderers. So, the task is formulated as follows: Using no third-party libraries (especially graphic ones), get something like this picture: Warning you, that it is training material that will generally repeat the structure of the OpenGL library. It will be a software renderer. I do not want to show how to write applications for OpenGL . I want to show how OpenGL is built. I am deeply convinced that it is impossible to write efficient applications using 3D libraries without understanding this. I will try to make the final code notLock-Free Data Structures. The Evolution of a Stack
Written by Max Khiszinsky
In the previous articles I described the basis, on which lock-free data structures and basic algorithms of the lifetime management of elements of lock-free data structures are built. Actually, it was a prelude to the description of lock-free containers. But then I faced a problem of how to build the story. Describing the known algorithms would be quite boring, as there would be a lot of [pseudo-]code, plenty of details that are important but quite specific. After all, you can always find them in the references I provide in articles. What I wanted was to tell you an interesting story about exciting things. I wanted to show the development of approaches to designing concurrent containers. Then the method of presentation should be the following: take some container type – a queue, map, hash map – and make a review of the currently known original algorithms for this container type.How I Got to the App Store Top With a Simple Currency App
Written by Valentin Shamardin
I will tell you how I’ve created quite an ordinary and not at all innovative application that has become objectively the best of its kind and even has been at the very top of the top for some time. It’s not a success story and not a guide for action. I just want to tell you how I developed the...
How to Implement the Deutsch-Jozsa Algorithm in Haskell
Written by Roman V. Dushkin
We have already mentioned this algorithm when solving the simplest tasks in quantum computations . Let’s go on developing the framework and review the initial algorithm enhancement, named the Deutsch-Jozsa algorithm. It is another article in the series about the model of quantum computations. That’s why you’d better read the previous articles, as they will help you to understand all the things here. You should refer to the first three articles: A Few Words About Reversible Computing How to Implement Deutsch’s Algorithm in Haskell Quantum Circuit Design: Methods and Techniques Today you will find out about the way to build an oracle on the basis of the given definition of a binary function. We will build it not manually, like we used to before, but automatically. You will also learn how to understand the function type with the help of the only one oracle call. We will also carryClojure. Transducers, Reducers and Other Stuff
Written by Andrei Zhlobich
Transducers have become quite popular recently. It’s a new feature of the non-released Clojure 1.7. As of writing this, Сlojure 1.7-alpha5 version is the latest development release, but there also appeared a fair number of ports of transducers for such languages as Python , Ruby , JavaScript , PHP , Java , C++ , Lua , Erlang . To tell the truth, it’s a bit disconcerting, the library of reducers was added long ago (in Clojure 1.5). But no one said anything about them; nothing was ported, though they seem to be performing similar things. Or not? Let’s find out what these reducers & transducers are made for (do we really need them?), how they work and how we can use them… Finally, we will decide whether it’s time to throw reducers away. It would be wrong to describe concepts emerged in Clojure outside the context of the givenMeteor. How to Build a TODO List
Written by Max Ovcharik
In this tutorial I don’t want to discuss why Meteor is the killer of the web, especially because I don’t think so and even like this framework. That’s why I want to show what to start with when developing applications on it. I’ll tell you about what packages there are and what Meteor is. I don’t have much experience in developing Web applications. I’ve been doing it for two years only, and I got to know Meteor only a few months ago. I should also warn you that the text is quite long, but the code is twice shorter than the text. I just want to share my experience with Meteor not for creating a simple example, but focus your attention on important things. Therefore, we are going to use plenty of external packages that simplify the process of development. And another warning: I used the following techniques forWhy Pay-per-Word Just Doesn’t Work for Tech Blogging
Written by Rockin'Robin
Tech blogging is on the rise though most of startups see it as a secondary thing. They’re totally right but there’s one condition to it — it requires skill as well as time. A lot of companies are comfortable with solving this problem by outsourcing content creation and hiring agencies or...
or