While developing the code analyzer PVS-Studio intended for searching issues in 64-bit and concurrent software, we came to the need of collecting fresh information on the Internet on some topics. For example, it is always useful to answer the questions of programmers who may be interested in our tool on various forums and blogs. While collecting the data we found out that there is much information on the Internet and therefore manual search might be very long and tiresome. Thus the task of automating the process of searching for fresh data appeared. In this post we will tell you how we do this.
But I bet you have said right now: "Ha-ha! The guys are reinventing the wheel and are not aware of Google Alerts". Well, we are aware of Google Alerts. And it is almost the thing we need but not quite :-). We have been using Google Alerts for more than half a year and did not manage to get what we needed. And here is what we need:
The PHP blog touts more often the examples of bad code and anti-patterns. Well, someone else is criticizing the Hindus for the code ...
The code quality is something that should not be ignored or put aside for later. Such a delay is technical debt or code debt that will backfire for sure. You have to spend more time creating quality code and application architecture.
It is highly recommend to read Uncle Bob's principles of SOLID: butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod.
This text can greatly improve your ability to build scalable systems, particularly the principle of SRP.
When I had been implementing a project on Yii framework, I got the task to make the registration and authorization of users through the different services (Google, Facebook, Twitter, etc).
This task has two ways of solution:
• Using an authorization service, such as Loginza;
• Implementing an authorization of functions independently for each service.
Here are benefits to use the authorization service:
1. Simplicity and speed of installation;
2. There is no need to learn the details of authorization through each provider.
However, a self-authorization has other advantages:
1. Full control over the process of authorization: what we will write in the authorization window of provider, what information we will receive and so on;
2. Ability to change appearance of the authorization widget in compliance with a design of the website;
3. Ability to invoke methods of API when we authorize over OAuth, if the service provider provides them;
4. There is less dependency from the different services and it is more reliable.
I chose the second option, because I did not have the ready extensions for yii, and I was wondering how such authorization system looks like from the inside. It was part of a module to manage the users at first, but later this functional has been extracted in a separate extension, which can be used easily in any project.
Smarty is one of the oldest template engines for the PHP development language. If you are programming in PHP, likely you have worked with it. A third version of this template was released in 2010. Smarty 3 was written from scratch with the active use of PHP5. At the same time Smarty got an updated syntax and modern features including inheritance, sandbox (computer security) and etc.
Twig is a modern template engine from developers of the Symfony. The authors have positioned it as the fast and functional template. It looks like Smarty 3 a lot in terms of features. Twig features a slightly different syntax, as well as the stated performance. Let us verify it!
We purposely is going to use quite complex templates during testing that the processing time would be noticeable. Actually, we will evaluate this time, so we will prepare the relevant scripts.
Code for Smarty turned out very simple:
$data = json_decode(file_get_contents('data.json'), true);
$smarty = new Smarty();
$smarty->compile_check = false;
$start = microtime(true);
Let us learn how to scale your application without having any
Experience, it is very difficult. Now there are many websites that are devoted to these issues, unfortunately, there is no solution that is suitable for all cases. We still need to find solutions ourselves, which are suitable for our requirements. Just as I do.
Several years ago, my boss came to me and said: “We have a new project for you, namely to transfer a website, which already has 1 million visitors per a month. You need to move this website and make sure that traffic could grow in the future without any problems”. I was already an experienced programmer, but I did not have any experience in the field of scalability. I had to learn scalability in the hard way.
I have never met a programmer during my short life, who would not love the games. Moreover, a programmer that has never written them.
Someone begins with “Tetris”, the other one with the “Snake”. Someone loses the interest, and the other one gets “sick” and turns that illness in a favorite work or entertaining hobby.
In the era of the Internet and social networks to play alone is boring, we want to communicate and play with friends.
We do not want just to communicate, but to go underground with the group or to show who is boss at the arena.
In this article I would like to tell about my approach to the server implementation of such interaction.
Let us consider the example of a simple game application in which the player controls a character, which can buy \ sell items, fight at the arena, and go alone underground or with the friends.
For example, a player creates a group to go underground. The player sends a request to our server which adds a new group to the list of available groups to go underground, and then the other players are able to obtain this list and join it. When the group is formed by pressing a button, the creator sends it underground to meet the dangerous monsters.