• How to write Palindrome Polyglot Quines

    • Translation
    PalidromePolyglotQuine

    I offer a solution to one beautiful task — writing code that outputs its text is valid for interpreters and compilers of different languages and is correctly executed when reversing its sources.


    Not so long ago I learned about code that can be both interpreted in PHP and compiled to Java: PhpJava.java. As it turned out, this idea is not new: code which is valid for several compilers or interpreters is called a polyglot. It is possible to write such code because of the peculiarities of processing strings and comments in different interpreters or compilers.

    Read more →
  • Checking the Code of XMage, and Why You Won't Be Able to Get the Special Rare Cards of the Dragon's Maze Collection

      image1.png

      XMage is a client-server application for playing Magic: The Gathering (MTG). XMage's development was started in early 2010. Since then, it has seen 182 releases, attracted an army of contributors, and it's still being actively developed even now. All that makes it a good reason for us to contribute to its development too! So, today the PVS-Studio unicorn is going to check the code base of XMage and maybe even get into a fight with some entities.
      Read more →
    • Delayed queue in Java and Redis

      • Translation

      Several years ago we had to solve how to enqueue events with an arbitrary delay, e.g. check a status of a payment 3 hours later, or send notification to a client in 45 minutes. At that point of time, we didn't find suitable libraries to accomplish this task, which didn't require us to spend time on configuration and maintenance. After analysing possible solutions we ended up building our own small library delayed queue in Java language on top of Redis storage engine. In this article I'll explain capabilities of this library, alternatives and problems we solved during creation process.

      Read more →
    • 7 Ultimate Programming languages For Mobile App Development

        "image"

        Do you know that 21% of people open an app 50+ times per day? Yes, you heard that right. With the rapid development of technology, the mobile app now made many things possible, which was previously unthinkable.

        And that's why there is an incredible increase in the number of mobile users. According to a recent mobile app development stat, the number of mobile users worldwide is projected to increase to 6.95 billion by the end of 2020.

        In the last couple of years, the mobile app development industry has grown manifold, changing how businesses function around the world. If you are planning to jump into mobile app development, then choosing the right programming language will be the most significant challenge.

        There are more than 600 programming languages, and each one has its own perks and popularity. Are you pondering which language would be best for developing a stunning app?

        Several factors come to mind when making this choice, but the most important one is the language's demand. Here in this blog, I have listed the best programming language for mobile apps in terms of popularity and demand. Let's start!
        Read more →
      • Under the Hood of PVS-Studio for Java: How We Develop Diagnostics


          To keep it interesting, this time I'd like to tell about our approach to developing and polishing diagnostic rules for PVS-Studio Java. You will learn how we keep existing warnings consistent across releases and why the new ones aren't too weird. I'll also share a bit of inside information on what plans we, the Java team, have for the future, and show you a few interesting (and a few plain) bugs we found using the diagnostics from the upcoming release.
          Read more →
        • Spring transaction management. Isolation and propagation

            Introduction


            In my opinion transaction management is a really important topic for each backend developer. In general, people don’t pay attention to it while using Spring framework.


            But I think, it is important to know how to use transactions properly. Because sometimes can happen that there was an exception thrown inside your method, but transaction was not rolled back and it is not clear why? Or some other “strange” cases.

            Read more →
          • The Testcontainers’ MongoDB Module and Spring Data MongoDB Reactive in Action

            1. Introduction


            How can I easily test my MongoDB multi-document transaction code without setting up MongoDB on my device? One might argue that they have to set it up first because in order to carry out such a transaction it needs a session which requires a replica set. Thankfully, there is no need to create a 3-node replica set and we can run these transactions only against a single database instance.

            Read more →
          • AdBlock has stolen the banner, but banners are not teeth — they will be back

            More
            Ads
          • IntelliJ IDEA: Structural Search and Replace

            • Translation
            • Tutorial

            Modern IDEs are very powerful tools that can help developers in all kinds of situations. Unfortunately, much of this power is often lost because many functions remain unknown to developers, hiding in the shadows.


            Simple example of the one of the such functions

            Did you know that when you press F2 in IntelliJ IDEA, the cursor will jump to the nearest error in the file? And in the absence of an error – to the nearest warning? It seems that this is a secret only a few people know about.


            Structural search and replace is one such pair of features. They can be extremely useful in situations where a whole variety of other functions can’t quite get the job done.


            In this post, I will present some of these situations and go beyond artificial cases by demonstrating examples of real code from two projects:


            1. 3D-engine for game development, jMonkeyEngine, which is an example of a big, interesting project.
            2. My own pet project, plantuml-native-image, where I experiment with compiling PlantUML into native executable code using GraalVM Native Image.

            In fact, it is this second project that encouraged me to write this post but I’m getting ahead of myself. First things first...

            Read more →
          • Small things that pollute your code

              I'm not going to discuss global things like design patterns and so on, as there's enough literature on that topic. Instead, I'd like to attract your attention to some small things that still affect lucidity and maintainability of a code.

              Polluting code with 'test-only' methods or access modifiers


              First of all, if you give access to something that shouldn't be used in production code, it gets used sooner or later. Just because it exist. The argument that it's an internal stuff doesn't work as it absolutely shouldn't be matter, writing you a library or isolated project! Treat people who will add anything to your internal codebase the same way as if they use your existing code as a different library.

              Thus, if for some reason in test, you need to call something that should not be called on prod — use reflection or whatever else but do not expose it in production code! And there's no reason to afraid of reflection for test proposes, at the end, you using Mockito, shouldn't it be bad in that case as well?
              Read more →
            • The PVS-Studio analyzer: detecting potential compatibility issues with Java SE API

                Рисунок 9

                2019 was a very busy year in terms of conferences. Our team could leave for whole weeks on business trips. As you know, the conference is perfect time to share knowledge. In addition to giving talks and telling many interesting things at our booth, we also learned a lot from communicating with conference participants and speakers. So at the Joker 2019 conference in fall, a talk from Dalia Abo Sheasha «Migrating beyond Java 8» inspired us to implement a new diagnostic rule that allows us to detect incompatibilities in the Java SE API between different versions of Java. This is what we will talk about.
                Read more →
              • Java vs .Net: Who will Reign in the Future?

                As the time is changing, technologies are expanding and with that, the priority and the importance of the technical languages are also changing. So, usually, it becomes difficult to pick when we have to choose between two languages.

                 

                 

                java vs .net


                 

                Here we will see the battle between Java and Microsoft .Net in order to make this clear which language is better to choose. For that, you may also have a quick look at this short video:
                Read more →
              • NSA, Ghidra, and Unicorns

                  NSA, Ghidra, and Unicorns

                  This time, the PVS-Studio team's attention was attracted by Ghidra, a big bad reverse-engineering framework allowing developers to analyze binary files and do horrible things to them. The most remarkable fact about it is not even that it's free and easily extensible with plugins but that it was developed and uploaded to GitHub for public access by NSA. On the one hand, you bet NSA has enough resources for keeping their code base clean. On the other hand, new contributors, who are not well familiar with it, may have accidentally introduced bugs that could stay unnoticed. So, we decided to feed the project to our static analyzer and see if it has any code issues.
                  Read more →
                • Annotations for Concurrency in Java. Our approach to coloring threads

                    At Miro, we always try to improve the maintainability of our code by using common practices, including in matters of multithreading. This does not solve all the issues that arise because of the ever-increasing load, but it simplifies the support: it increases both the code readability and the speed of developing new features.

                    Today (May 2020) we have about 100 servers in the production environment, 6,000 HTTP API requests per second and more than 50,000 WebSocket API commands, and daily releases. Miro has been developing since 2011; in the current implementation, user requests are handled in parallel by a cluster of different servers.

                    image
                    Read more →
                  • Traps and pitfalls in modernization of enterprise application using «supersonic subatomic java»

                    This is a post about first steps and first pitfalls in modernization of old enterprise application using "supersonic subatomic java" quarkus as it is positioned by RedHat.


                    Initial setup


                    In the end of 2019 I was invited to work in a project in our company, where an old monolithic application should be split into micro-services. Basic reasoning behind this decision was, that framework which is used in application is near to it's end-of-life. The application should be rewritten in any case. If it should be rewritten in any case, why not to split it into micro-services?


                    Since last 10 years, I was working mostly with java and we had in the project specialists with java knowledge, we have decided to give java-based frameworks a try for back-end functionality.
                    OK, let's use spring-cloud for that purpose, was our first thought. But then, we have had a look onto quarkus, which has been released in the end of 2019. We have decided to give it a try, keeping in mind building of native applications using GraalVM.


                    Native applications from our perspective could give us following benefits:


                    • shorten start time of container
                    • reduce resource consumption of container and application

                    We were aware about possible drawbacks of this solution:


                    • no experience in our team with quarkus framework
                    • significantly less amount of available feedback from community, since this is very young framework
                    Read more →
                  • Discover Unmatched Potential of Java for Your Next App



                      One of the most popular programming languages for a decade, Java has been the top choice and preference of most software application development companies. More and more businesses are looking forward to leveraging the potential of the Java language. How can they not? The websites, web apps, mobile apps all could be developed easily using the language. From small, easy to complex apps, Java is the best-suited as it is robust, reliable, and user-friendly programming language.
                      Read more →
                    • Zero, one, two, Freddy's coming for you

                        Рисунок 1

                        This post continues the series of articles, which can well be called «horrors for developers». This time it will also touch upon a typical pattern of typos related to the usage of numbers 0, 1, 2. The language you're writing in doesn't really matter: it can be C, C++, C#, or Java. If you're using constants 0, 1, 2 or variables' names contain these numbers, most likely, Freddie will come to visit you at night. Go on, read and don't say we didn't warn you.
                        Read more →
                      • Introducing One Ring — an open-source pipeline for all your Spark applications

                          If you utilize Apache Spark, you probably have a few applications that consume some data from external sources and produce some intermediate result, that is about to be consumed by some applications further down the processing chain, and so on until you get a final result.


                          We suspect that because we have a similar pipeline with lots of processes like this one:


                          A process flowchart with more than 50 applications and about 70 datasets
                          Click here for a bit larger version


                          Each rectangle is a Spark application with a set of their own execution parameters, and each arrow is an equally parametrized dataset (externally stored highlighted with a color; note the number of intermediate ones). This example is not the most complex of our processes, it’s fairly a simple one. And we don’t assemble such workflows manually, we generate them from Process Templates (outlined as groups on this flowchart).


                          So here comes the One Ring, a Spark pipelining framework with very robust configuration abilities, which makes it easier to compose and execute a most complex Process as a single large Spark job.


                          And we just made it open source. Perhaps, you’re interested in the details.

                          We got you covered!
                        • Glean Insights About 18 Best Java Frameworks To Use in 2020

                            image


                            Who doesn’t know about Java today? You can hear its mention in every nook and corner of the world. A significant majority of IT companies provide Java-based applications, while businesses are still driven to secure java applications due to robustness and stringent security facilities. However, Java frameworks are a matter of chaos for a variety of business owners that want their application to be standout.


                            The fact is that there is no dearth of java frameworks that makes application development simple and efficient. However, a number of people have a query regarding the selection of java framework on the basis of features, ease-of-use, cost, and many more. Businesses hire programmers in India, though they stay confused on which platform they want their app to be created.

                            Read more →
                          • Introducing Java 13: Let's dive Into JDK's New Features



                              Java has been a programmer’s dream and what’s the better way to quantify Java’s popularity with the new version release Java 13. After the initial Java enhancement proposal, there have been advancements in JDK features that will blow up Java developer’s mind with a new range of features after the official release on September 17, 2019.

                              But Why do you think Java is so popular?

                              Java has been a craze among programmers due to its platform independence and the ability to run on different computers. It has been there for so long that it has been adopted by organizations like banks, insurance companies, enterprises, agencies and mostly by software outsourcing companies.

                              Java has been there in the business to develop android apps, java web applications, software tools, and scientific applications.

                              Let us delve into the stats and gauge the popularity ratio of Java applications among other competing programming languages.
                              Read more →
                            • Top programming languages for Android App development in 2020

                                Do you have any idea how many Android apps are there in the world? As of 2019’s first quarter, there were approximately 2.6 million android apps around the globe. That’s a huge number which leads to stiff competition in the market.

                                There is no other option other than offering a robust and efficient Android app to survive in this flourishing industry. The selection of the right tech-stack is highly important if you want to get a flawless development of your Android app.
                                Read more →