DIY. An Astro Tracker in Two Nights Written by Alex Kuzmuk After reading an article about amateur astronomy, I decided to take pictures of stars with the help of a common camera using no telescope. In the mentioned article I learnt about Astro Trackers. An Astro Tracker is a device that is used to compensate rotation of the sky of stars in long-exposures. Googling for a while, I found out that it’s no problem to buy them, but the price was a bit high. For example, the cheapest Vixin Ploarie Star Tracker costs $400 plus delivery charges. Its carrying capacity also raised doubts. Instead of the wide-angle lens, I was planning to use 70-200/2.8. Together with the camera they weigh around a 3-3.5 pounds. When I was looking for the necessary information, it turned out that people make the so-called Barn Door Trackers, for example: this one , that and other . The operating principle is simple. It consists of
Java 8 vs Scala. The Difference in Approaches and Mutual Innovations Written by Ruslan Shevchenko I was really glad to find out that my presentation about Scala and Java 8 was retweeted more than other similar content. That’s why I decided to make some notes and tell you about it. We are going to talk about the difference between Scala and Java and say why each of them is important. There are mutual innovations. Each language has borrowed something from each other. The question is: do you have to learn Scala if there is Java available? Definitely! The more languages you know, the more professional you are. If we ever ask a Scala engineer about the principal differences between Scala and Java, he will not tell you all the nuances of lambda functions and traits. Instead, he will provide the following example: Java public class Person { private String firstName; private String lastName; String getFirstName() { return firstName; } void setFirstName(String firstName) { this.firstName
YAWNDB. Time Series Database Written in Erlang Written by Pavel Abalihin I work at Selectel and a lot of our clients, who are leasing dedicated servers, require the information about traffic consumption. Cloud server users need statistics of hardware and network resources use. As for cloud storage users, they need downloads statistics. The simplest way to provide statistic data is plotting. There are plenty of software solutions for analyzing statistic data with further visualization. We have been looking for an appropriate tool with high performance as a basic requirement. But let’s begin with some theoretical information first. Some Theory Each chart of online activities reflects changes of some parameters within defined period of time (a month, a week, a day, etc.). To create a chart we should process some statistic material representing a set of “time-value” pairs in a defined time period. Such material is called time-series. There are quite many software tools for analyzing time series. They have one
Meet Kukuruku Hub v2.0 Written by Kukuruku Hub We are happy to announce a new, redesigned version of Kukuruku Hub! First of all, we would like to say «Thank you!» to the whole team, who worked really hard to get this project off the ground. We have redesigned most of the web site and hope the UI/UX is more smooth and sleek now. Please let us know what you think and how we can improve. Really! Your opinion is super important. There is a comments section below the article. Otherwise, simply shoot us an email at [email protected] . In addition to redesign, we rolled out a new Companies feature. As you may or may not know, Kukuruku is based on hubs. A hub is a type of weblog in which posts are written and published by more than one author. Every hub is dedicated to a specific topic. It helps us to keep the information categorized and
A Point Localization in a Polygon Written by Nikolai Ershov I have recently come across a post dedicated to solving the task of locating a point in a polygon: there is a polygon (a closed broken line with no self-intersections) and we are to determine, whether the given A point is inside the polygon or not. You may wonder, how such purely mathematic task can be related to the theory of algorithms. But it actually can. Localization is a classic task in computational geometry (do not confuse with computer graphics). To begin with, look at the picture on the right that depicts a polygon of Peano curve type [1]. Try to tell, whether the red point is inside or outside the polygon. We are going to review a simple variation of the given task, when the given polygon is convex. (adsbygoogle = window.adsbygoogle || []).push({}); It is clear that if a polygon is a triangle or a quadrangle, there
How to Analyze Distributed Denial-of-Service (DDos) Attack Written by Kukuruku Hub What is DDoS Attack? As per Wikipedia, denial-of-service ( DoS ) or distributed denial-of-service (DDoS) attack is an attempt to make a machine or network resource unavailable to its intended users. (adsbygoogle = window.adsbygoogle || []).push({}); In this small post I would like to show a few useful commands to use if someone is experiencing a DDoS attack. In my case, there is an nginx as a front-end server. The access log format looks like this: log_format main '$remote_addr — $remote_user [$time_local] "$host" "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for" -> $upstream_response_time'; In the log file we’ll see something like this: 188.142.8.61 — - [14/Sep/2014:22:51:03 +0400] «www.mysite.com» «GET / HTTP/1.1» 200 519 «6wwro6rq35muk.ru/» «Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.191602; .NET CLR 3.5.191602; .NET CLR 3.0.191602» "-" -> 0.003 Analyzing DDoS Attack tail -f /var/log/nginx/nginx.access.log | cut -d ' ' -f 1
Erlang for the Little Ones. The Basic Syntax of Functions Written by Victor Pikaev Dear %username% , Let’s continue learning Erlang for the little ones. In the previous post we’ve reviewed the way of declaring functions and uniting them into modules. In this post we’ll consider the syntax of functions in details. The source code of all the examples in this post is here . Pattern Matching To begin with, let’s write a function that will greet a user and the welcome text will depend on user's gender. In the form of the pseudo code our function will look like the following: function greet(Gender,Name) if Gender == male then print("Hello, Mr. %s!", Name) else if Gender == female then print("Hello, Mrs. %s!", Name) else print("Hello, %s!", Name) end If we use pattern matching instead of the classic if then else construction, we can save plenty of the template code. That’s how this function will look in Erlang when using pattern matching: greet(male, Name)
Copyright and a Bit of Porn Written by Art Afian The basic thesis of the traditional copyright system protection lies in the following postulate: if we allow to steal everything, films will no longer be shot, music will no longer sound and poems will no longer be made. Devoid of the state machinery protection, the flow of intellectual products will run low and leave the mankind lead an aimless life beyond the progress. The pictures depicted in regular plots about intellectual piracy often use the image of a starving poet who can not get an adequate fee for his work and talent. This image is extremely emotionally strong, especially considering the fact that not only right-holder representatives of big labels and corporations (though they definitely do not get a chicken feed) stand this position, but also actual authors and actors. The latter proved their right for own judgement. But I think that this point of view is wrong. By the
Something About Cats, Dogs, Machine and Deep Learning Written by Artem Hurshudov Deep Blue beat Kasparov at chess in 1997. Watson beat the brightest trivia minds at Jeopardy in 2011. Can you tell Fido from Mittens in 2013? The picture and quote are taken from the challenge at Kaggle that took place in autumn last year. Looking ahead, we can fairly enough reply “Yes” to the question. The ten leaders coped with the task by 98.8%, which can not but impress. But where does such question come from? Why have classification tasks been (and still are) beyond programs’ capacity, though a four year old child can cope with them? Why is it more difficult to identify objects of the world than to play chess? What is deep learning and why are cats mentioned so often in related posts? Let’s talk about it. What Does “Detect” Mean? Suppose there are two categories and a great number of pictures to be apportioned to
Radix Trees Written by Nikolai Ershov Having read some articles about tries (aka prefix trees aka radix trees), I decided to write one of my own. Today we are going to talk about a trie implementation in C++. We will also compare a string search with AVL and Radix tree. Intro A trie is an ordered tree data structure that is used to store a dynamic set or associative array where the keys are usually strings. We are going to take a look at the implementation of prefix trees for storing ASCII strings. Each string ends with a terminal symbol that will never repeat in a string again. To indicate terminal symbols in pictures and examples, we will use the dollar sign. To indicate them in the code, we’re going to use the null symbol. Thus, in our implementation the strings will be standard C ones, which allows to use the standard string.h library. All the mentioned above should
Are Time Travels Possible? Written by forgotten Being a fan of scientism , I am going to tell you about the nature of time, causality and time travels. Time According to classical mechanics, time is absolute and invariable in the sense that when moving from one reference system to another one, time frames do not change: (x, y, z, t) are coordinates in the old frame, while (x', y', z', t') are coordinates in the new one. It is expected that one system moves in-parallel along x axis at v speed. (adsbygoogle = window.adsbygoogle || []).push({}); It’s the so-called Galilean transformation , which is what happens to coordinates when reference systems are changed. In the Galilean sense, there’s just one “time flow” in the Universe and time coordinates are the same for all objects. At that, classical mechanics does not treat the time arrow originality in any way. Moreover, the concept of the flow of time
Reactive Actors in Java Written by harati There are plenty of technologies to organize parallel computing. One of the most promising and simple ones is the model of actors. It allows to partially get rid of such major problems of parallelism as race conditions, locking waits of operations termination, endless mutual exclusions and synchronizations, and so on and so forth. This approach also simplifies the code paralleling. We are going to review it by the example of akka framework using Java language. As for akka, it is written in Scala. (adsbygoogle = window.adsbygoogle || []).push({}); Theory and Principles Actor is an isolated object, meaning that there are no direct references to an instance. It deals with asynchronous processing of incoming messages. A message is any invariable object implementing Serializable interface. They are stored in a queue, and when the system passes control to the actor (we’ll talk more about it soon), objects are extracted from the
AVL Trees Written by Nikolai Ershov In the previous article we’ve reviewed Randomized Binary Search Trees . Today we are going to review the implementation of AVL Trees . They must be the first type of Balanced Binary Search Trees. They were invented by two Soviet inventors, G. M. Adelson-Velskii and E. M. Landis in 1962. There are plenty of AVL trees implementations, but, to my mind, none of them is good enough when you try to make sense of it all from scratch. They say that AVL trees are simpler than Red-Black trees , but when looking at the code, we can not believe it. Thus, I have decided to explain the structure of AVL trees step by step. I’ll also provide the code in C++. AVL Tree Notion First of all, an AVL Tree is a Binary Search Tree (BST), the keys of which meet standard requirements: a key of any tree node
Crowdfunding an Open Source Science for Our Complex World Written by Shaun Swanson In short, the crowdfunding campaign to launch the new physics discipline of Complex Thermostatistics ends this weekend, and we could really use your support to get us over our reach goal! Help us grow a community of researchers and science-lovers who are passionate about understanding complex systems. We will be working on an adaptation of Thermostatistics together for this purpose! Your contributions will provide a year-long runway for a collaborative infrastructure as well as educational materials for this emerging field. What is Thermostatistics? In the late 1800s, a growing belief in the atomic theory of matter solidified the importance of Statistical Mechanics as a means of deriving Thermodynamics . Thermostatistics focuses on this connection between the “microscopic” Statistical Mechanics of atoms, molecules, consumers, and firms and the “macroscopic” Thermodynamics of the behavior of systems at our scale and beyond. Thermodynamics was originally developed during the industrial revolution to better understand
Randomized Binary Search Trees Written by Nikolai Ershov I have always been surprised by the contrast between the grace of the main concept of binary search trees and implementation complexity of balanced Binary Search Trees ( Red-Black Trees , AVL Trees and Treaps). I have recently looked through the “Algorithms” by Robert Sedgewick [1] and found a description of randomized search trees (I’ve also found the original [2]). It is just one third of a page long (nodes insertion, and one more page for deletion). There’s also a nice implementation of the operation on deleting nodes from a search tree. Here we'll talk about randomized search trees, their implementation in C++ and also results of a small author’s research as for these trees balance. Let’s Go Step by Step Since I am going to describe a complete implementation of a tree, we’ll have to start from the very beginning (professionals can skip several paragraphs). Each node of
A Little Lisp Interpreter in Python Written by Basic Wolf When reading the “Binary trees” chapter in Programming Interviews Exposed by John Mongan, I thought about the ways recursion is explained to beginners. For example, via sorts, traversing binary trees, building Fibonacci sequence and so on and so forth. But is it really that difficult to find a more interesting example? That’s when Lisp came to my mind, as it is inseparable from the notion of recursion. Moreover, a little Lisp interpreter is a great example to study recursion. What would be a minimal Lisp interpreter written in Python? To my surprise, the solution was seven lines long! Python expressiveness and Lisp beauty and simplicity served their purpose. To start with, let’s define the grammar and the way to evaluate expressions: list := (item0, item1, ...) item := list | atom atom := stringliteral | numliteral Evaluation rules are just like in any other Lisp dialect. The first element
What is grep and How do We Use It? Written by Simple Admin When reading some articles about Unix commands, I noticed that the examples provided in them were not practically useful. It turns out that we do not know how to use tools that are actually useful. Before that Three years ago I was asked to hold an interview with applicants for the position of unix system administrator. There were eight applicants, and two of them were top-rated at the freelance marketplace. I never require sysadmins to know configs by heart. I think that we can always become familiar with the necessary software when needed. Of course, if we are ready to read much and want to use system tools properly. Therefore, I asked the applicants to solve the following tasks: create a cron job, that will be executed every even hour and at 3 o’clock; print the processor information from /var/run/dmesg.boot file. To my surprise, none of them coped with
Working for Google. A Rotten Apple Written by Larysa Aharkava Disclaimer : I’ve been working at Google as an engineer for almost 4 years. Google is really a great company for programmers, but it is not perfect anyway. There are also some drawbacks and we are going to talk about them today. I guess everything mentioned here can also be applied to similar companies. Therefore, I am going to use “Company” instead of Google. I do not guarantee, but do think that it’s the same for Microsoft, Facebook, Amazon and other big companies. Sphere of Influence Several tens of thousands of programmers work for the Company. But how many of them can influence the Company development in this or other direction? Some really small number, actually. It is vital for a big Company to have interchangeable employees. Just imagine that the Company business depends on each employee. Suddenly, 10% of them decided to quit the job. Nothing good will
Cellular Automata Using Comonads Written by Curly Brace I have recently come across an article about implementing a one-dimensional cellular automaton using comonads. But this material is a bit outdated. Therefore, I’ve decided to write an article of my own and consider two-dimensional cellular automata by the example of The Game of Life: Universe Let’s take a look at Universe data type that is defined the following way: data Universe a = Universe [a] a [a] It’s a doubly infinite list focusing on some element that we can shift using the following functions: left, right :: Universe a -> Universe a left (Universe (a:as) x bs) = Universe as a (x:bs) right (Universe as x (b:bs)) = Universe (x:as) b bs It’s basically a zipper , but we can consider it as a constant C-pointer to the infinite memory area as all increment and decrement operations are applicable to it. But how do we dereference it? Let’s
KernelCare: Patching the Kernel On-the-Fly Written by Andrey Yemelianov As for today, we do not have to turn off and reboot a server with Linux operating system for months. But sooner or later, we’ll have to do it anyway. For example, to install kernel updates. As a rule, this procedure is a real pain for sysadmins. First of all, they have to choose time of the minimal user activity. They should also send out warning emails to all users in advance. Besides, there’s always a risk of an emergency when the server downtime can last for too long. There are also special programming solutions, with the help of which we can install patches and kernel updates without rebooting. As an example, we should name Ksplice – a product by Oracle Company, which is distributed under GPL v.2 license. It supports the following Linux distributives: Oracle, Linux, RHEL, Ubuntu (the desktop versions only) and Fedora. On the whole, Ksplice
or