• Diving Into Angular Services

      When building any kind of application, it is often seen that a certain functionality is needed again and again at different points. It could be the functionality to display something in a certain way or retrieve data from a source, to name a few examples. Such a common case like this can appear in all kinds of development, be it front-end or back-end. A robust front-end development framework like Angular handles such a case by allowing the development of objects that can be imported by any part as needed. These objects can extract some common logic or data are known as services.

      This article helps you understand what Angular services are and what are the different kinds of use-cases they can be used in. Angular services are not limited to one particular type of job and can contain methods that are repeatedly required by different components of the application. Afterward, this article will show what it is like to code service and what makes it accessible to any of the components.

      The Gist Of What Angular Services Are

      Given how fundamental components are to Angular applications, it is important to briefly go through them to further understand any other concept, like services. Apart from that, components and services are often confused with each other as well. Hence, it is necessary to refresh our understanding of components.

      Components are the very backbone of Angular applications. All the different functionalities or visual elements of the application are attributed to a component. Every component contains the working logic for the functionality or visual element and the instructions for its visual rendering. Every Angular application is based on a tree of components. In the component tree, every component working is dependent on or consists of, other component(s).

      Читать далее
    • A Quick Guide To Angular Pipes

        Impressive web development is the result of a successful synergy of robust back-end and an appealing front-end. Usually, the back-end is thought to be the ‘brains’ of a webpage and the front-end is merely the shiny exterior. However, with the right front-end development framework, powerful computations can happen directly on the front-end as well. Angular happens to be one of such impressive front-end development frameworks. Through its templates, Angular offers the opportunity for data to be processed and formatted in a certain way right there in the HTML code. This is made possible through functions with easy-to-understand syntax and usage, and they are called pipes.

        This article will serve as a quick guide to tell you all the meaty stuff to know about pipes and how to effectively use them. Pipes come in various types and can significantly simplify data collection and processing in use cases where the front-end is the main gateway of obtaining the data. The article will also discuss how pipes are tested during the unit testing of Angular applications (which is not as difficult as it may seem for some).

        The Ins And Outs Of Angular Pipes

        Before moving on to discussing Angular pipes, it is imperative to understand what Angular components and templates are. Pipes are present in the template part of the component, making it necessary to understand the former to grasp the utility of the latter.

        Angular applications are fundamentally made up of units called components. Each component is centered around a certain functionality or visual aspect of the application. These components are self-contained and consist of both its working logic along with instructions about its visual rendering. The latter is stored in what are called templates. Templates are simply HTML code that can be in the form of a separate file or inline code within the @Component decorator (which is written in TypeScript). An example of an Angular component can be seen below.

        Читать далее
      • Knowing All About Angular Templates

          All the popular frameworks used in the world of front-end development have different approaches to the tools offered for development. However, almost all frameworks focus on providing as much encapsulation as possible. More encapsulation would mean that the developer does not need to worry about nitty-gritty details and the client does not see what they don’t need to see. This leads to a smoother development and an easy-to-understand view of the application to the client. The popular front-end development framework Angular exhibits this principle in many different ways. One of the most prominent examples being through the use of templates.

          This article explains what templates are and how Angular uses them to further streamline the front-end development process. Through templates, a developer is able to keep the graphical layout of an aspect of the Angular application separate from its working logic. However, communication between the graphical and logical parts is still possible. This article will take you through to make use of these templates and some of the more advanced functionality they can offer.

          Understanding Angular Templates

          Before moving on to discussing templates, it is important to grasp what Angular components are. After all, a template is an integral part of a component. Through components, we will be able to better understand the purpose and workings of a template.

          At the fundamental level of any Angular application lies a tree of components. Each bigger component is connected to a child component(s) that it can pass data on to and invoke the creation of. Each component is associated with a certain functionality of the application and this modular nature helps with a more sophisticated development process. The Angular component is self-contained, in the sense that it consists of the working logic for the functionality and its visual representation. While the former is defined through a class, the latter is done through a template.

          Читать далее
        • PVS-Studio's New Website: How We Designed It

            The PVS-Studio website turns 15 this year. This is quite significant for any internet resource. Back then, when our website was born, Russia announced 2006 as a year of humanities. That same year, in June, Denis Kryuchkov established a new platform, "Habrhabr" (now known as Habr). In November, Microsoft officially completed OS Windows Vista. That same month we registered the viva64.com domain.

            We celebrated our domain's 10th anniversary with the website's redesign. After that, we would only change the resource capacity and features, but we'd never touch the design in any way. During this time, the number of articles grew so much that we needed to add tags to facilitate navigation. Right now we are also working on our YouTube channel. This means, you will see more and more new videos on our website as well. We keep adding new web pages at a tremendous rate, while the website's usability stays the same.

            Time has come for big changes!

            Читать далее
          • Ads
            AdBlock has stolen the banner, but banners are not teeth — they will be back

            More
          • Application performance monitoring and health metrics without APM

            • Translation

            I have already written about AIOps and machine learning methods in working with IT incidents, about hybrid umbrella monitoring and various approaches to service management. Now I would like to share a very specific algorithm, how one can quickly get information about functioning conditions of business applications using synthetic monitoring and how to build, on this basis, the health metric of business services at no special cost. The story is based on a real case of implementing the algorithm into the IT system of one of the airlines.

            Currently there are many APM systems, such as Appdynamics, Dynatrace, and others, having a UX control module inside that uses synthetic checks. And if the task is to learn about failures quicker than customers, I will tell you why all these APM systems are not needed. Also, nowadays health metrics are a fashionable feature of APM and I will show how you can build them without APM. 

            Читать далее
          • How to choose the appropriate level of statistical significance for an AB-test

              Nowadays a lot of product managers have to confirm most of their decisions with AB-tests. Yet, it is far not always clear how to choose the parameters for the test. A particularly difficult parameter to tune is often the level of statistical significance. If we choose too high level - tests will fail even though improvements do exist. If we choose too low level - we'll be getting lots of "confirmations" of false improvements.

              When we make decisions based on AB-tests, once in a while we'll be making mistakes. We can limit the losses caused by such mistakes by choosing the appropriate level of statistical significance.

              Read more
            • Dictionary/Map

                A basic data structure in computer science is the “associative array” known as a “map”. This structure is called a “dictionary”. Dictionaries are being used when you have key-value pairs of the information. Inputs are called keys, and outputs are called values. A dictionary is the abstract data type that can store elements so that they can be positioned quickly by using keys. Dictionary is like a container that will have a searchable assortment of items. Each item in the dictionary is stored as a key-value pair. In a dictionary, we can store multiple items with the same key.

                Dictionary consists of multiple elements in terms of key and value pair. Both key and value are considered as one single pair. This is called mapping. Elements of the dictionary are enclosed in curly brackets in terms of key and value pairs. Dictionaries enable us to work with key-value pairs. Key-value pairs are two linked values where the key is the unique identifier where we can discover our data and the value is that the information.

                Dictionary maps key-value pairs. It is a collection data type that has key-value pairs. A dictionary does not contain any duplicate members.

                It is unordered and stores data values like a map. Thus, it is similar to the real-life dictionary with distinct key values. In a dictionary, we use keys as indexes to access elements.

                The dictionary helps us to organize the collection of data. It is a special data type. Its syntax is:

                Читать далее
              • OWASP, Vulnerabilities, and Taint Analysis in PVS-Studio for C#. Stir, but Don't Shake

                  0831_TaintAnalysis_Cs/image1.png


                  We continue to develop PVS-Studio as a SAST solution. Thus, one of our major goals is expanding OWASP coverage. You might ask, what's the use when there's no taint analysis? That's exactly what we thought — and decided to implement taint analysis in the C# analyzer. Curious about what we accomplished? Read on!

                  Read more →
                • Getting To Know Angular Components

                    Angular is one of the most popular front-end development frameworks out there. It is a leading choice for personal as well as industry-level development of web applications due to its robust capabilities. While Angular is popular for many different reasons, one of the main ones is its modular nature. Modularity makes it easy for the developer to keep track of all the different elements being used to program functionalities. It also helps in keeping consistency and even reusing a block of code or functionality multiple times.

                    This modularity lies at the heart of Angular in the form of elements called components. This article will quickly take you through all the important bits to know about Angular components, their usage, how they are useful, and some code examples. Components make Angular easy to learn and applications easy to structure. Through this article, you’ll get to see how Angular components make all of this possible.

                    What Are Angular Components Exactly?

                    Components lie at the foundation of Angular applications. They interact similar to how HTML elements do in terms of passing data between elements and emitting events. Each of the components has some behavior attached to it that tells what data to render or load and a template that tells it how to render the data. An Angular application is based on a component tree structure where different components have child components and so on. Data is shared from parent to child components through an ‘input binding.’ Similarly, it can be shared the other way around through outputs.

                    Читать далее
                  • PVS-Studio Team: Switching to Clang Improved PVS-Studio C++ Analyzer's Performance

                      From the earliest days, we used MSVC to compile the PVS-Studio C++ analyzer for Windows - then, in 2006, known as Viva64, version 1.00. With new releases, the analyzer's C++ core learned to work on Linux and macOS, and we modified the project's structure to support CMake. However, we kept using the MSVC compiler to build the analyzer's version for Windows. Then, in 2019, on April 29th, Visual Studio developers announced they had included the LLVM utilities and Clang compiler in the IDE. And just recently we've gotten around to try it.

                      Read more
                    • Binary Tree

                        Data structures are classified into linear and non-linear data structures. A tree is a non-linear data structure. Data is stored hierarchically in a non-linear data structure. So the tree is a way of organizing data hierarchically. A tree grows from top to bottom. In a tree, there are different kinds of nodes that are linked with each other. A tree consists of the following elements:

                        Читать далее
                      • Graph

                          It is a collection of edges and vertices. It can be used to display any form of network.

                          The following graph contains a total of 4 vertices and 5 edges. In this graph, vertices are A, B, C and D while edges are AB, BD, DC, CA and AD. Vertices are also known as nodes. The line connecting these vertices is the edge. Vertices are like objects and edges indicate the relation between those vertices. Data is stored in nodes. This data can be of numerical data type or any other data structure.

                          Читать далее
                        • Recursion

                            Recursion is a strategy that algorithms use to solve specific problems. A recursive algorithm is an algorithm that solves the main problem by using the solution of a simpler sub-problem of the same type. Recursion is a particular way of solving a problem by having a function calling itself repeatedly. It is always applied to a function only. By using recursion, we can reduce the size of the program or source code. In recursion, a function invokes itself. And the function that invokes itself is referred to as a recursive function.

                            Suppose we have a user-defined function named ‘recursion’, and it will be written in the main function. The compiler will execute the recursion function automatically, and it will search for a particular function definition. This function definition will be executed, and control will go back to the main function. If we call the same function inside the function definition, then the compiler will move on to function definition first. When the compiler executes the recursion function, we will be calling the same function.

                            Читать далее
                          • The Implementation of a Custom Domain Name Server by Using С Sockets

                            We describe the implementation of a custom Domain Name System (DNS) by using C socket programming for network communication, together with SQLite3 database for the storage of Internet Protocol (IP) for Uniform Resource Locator (URL). Then we provide a performance analysis of our implementation. Our code is available publicly [1].

                            Read more
                          • Overview of Morris's counters

                              On implementing streaming algorithms, counting of events often occurs, where an event means something like a packet arrival or a connection establishment. Since the number of events is large, the available memory can become a bottleneck: an ordinary n-bit counter allows to take into account no more than 2^n - 1events.
                              One way to handle a larger range of values using the same amount of memory would be approximate counting. This article provides an overview of the well-known Morris algorithm and some generalizations of it.

                              Another way to reduce the number of bits required for counting mass events is to use decay. We discuss such an approach here [3], and we are going to publish another blog post on this particular topic shortly.

                              In the beginning of this article, we analyse one straightforward probabilistic calculation algorithm and highlight its shortcomings (Section 2). Then (Section 3), we describe the algorithm proposed by Robert Morris in 1978 and indicate its most essential properties and advantages. For most non-trivial formulas and statements, the text contains our proofs, the demanding reader can find them in the inserts. In the following three sections, we outline valuable extensions of the classic algorithm: you can learn what Morris's counters and exponential decay have in common, how to improve the accuracy by sacrificing the maximum value, and how to handle weighted events efficiently.

                              Read more