Image for post
Image for post

I’ve been dabbling in Game Theory recently and had to re-visit the Minimax algorithm. The algorithm was already familiar to me but I never took the time to actually implement it. It seemed like a good opportunity to implement it for a simple game such as Tic-Tac-Toe and explain its basics. Full source is available here. Without further ado, let’s get into it!

Minimax Algorithm

Minimax is a type of adversarial search algorithm for generating and exploring game trees. …


Image for post
Image for post

Crashlytics is a popular crash reporting tool originally developed by Fabric that allows you to both remotely and locally monitor your software and generate detailed reports in case something goes wrong. Using such a tool reduces debugging time significantly as you get notified immediately when a crash occurs, along with a customized report.

Google acquired Fabric from Twitter in 2017 and recently decided to shut it down. Fortunately, all Crashlytics functionality is being merged to Firebase and starting from May 4, 2020 (extended due to Coronavirus), Fabric Crashlytics will no longer be available. …


Image for post
Image for post

Collections is a Java Framework that provides a variety of utility classes that implement some of the well-known data structures such as maps, lists, and sets. Nearly all high-level programming languages provide some sort of implementation of these data structures and Java is no exception. Familiar classes such as ArrayList, HashMap and HashSet are part of this framework.

Using them in a single-threaded environment is trivial but we need to be careful in multi-threaded applications since most of these classes do not have internal synchronization, which means they are not thread-safe by default.


Image for post
Image for post

Change is inevitable, therefore it’s very rare that you would write some piece of code and never touch it again. As the requirements change, so will your code.

Testing your software is a great way of knowing whether or not your code behaves as expected. Tests are there to ensure you will catch unintended results of future modifications as you continue down the development process. But tests are also written by people and people make mistakes. …


Image for post
Image for post

Recently, I wrote an article about JNI (Java Native Interface) and demonstrated how it’s used to call native code from Java. While JNI is a popular choice, it’s somewhat difficult to use and requires you to generate its stubs (JNI header files required for binding) every time you make a slight difference to your native code. More importantly, you might just not have access to source code of the shared library you want to use. In that case, unless that library was written to support JNI, there’s not much you can do to make it work. …


JNI (Java Native Interface) is a foreign function interface that allows code running on JVM to call (or be called by) native applications. Using JNI, one can call methods written in C/C++ or even access assembly language.

JNI comes in handy when you need to do something that cannot be accomplished by Java alone (low-level code may be needed to talk directly to OS/Hardware which cannot be accomplished by Java alone). It’s also possible that your company developed some software that is now considered legacy and you need to continue development using Java. …


Image for post
Image for post

A couple of weeks ago, Google announced a new version called Android 11. As you’ve probably noticed, starting with Android 10 Google abandoned its convention of naming Android versions after desserts, so the new version is simply Android 11, or Android R.

Along with the new release, Google introduces a new release milestone called Platform Stability. Upon reaching this milestone, the platform’s internal and external APIs are expected to be finalized, so developers can reliably test their applications, knowing that their app will continue to work after release.

Android R is expected to be released in the third quarter of this year, so there’s still a lot of time to get accustomed to what it brings to the table. …


Anyone who needs a publish/subscribe architecture would find EventBus to be a great tool. It’s easy to use and there are many implementations of it. But we should be cautious, as abusing such libraries might lead to unintended consequences.

In this article, I will focus on Greenbot’s implementation of EventBus. Guava provides its own solution as well but no matter which library we’re looking at, they are pretty similar to use.

What is EventBus?

Image for post
Image for post
EventBus provides a simple API to deliver events to registered subscribers.

EventBus is a software bus that allows you to register certain events and get notified when something related to that event is published. Events are in the form of classes. First, you register your class to the bus and then define methods that use the Subscribe annotation in order to register to an event. …


Image for post
Image for post

Sometimes you need to trigger an init service while the system is running. Since init services may be customized to have special privileges, it‘s suitable to move some logic to such service and trigger it later on in case it’s needed (This way you won’t need to extend/break your security policies and give too much permission to applications). For example, executing some network-related operations such as changing the ethernet mac address may not be possible due to SELinux/User group, even if you are attempting to do it from system_server context (system_server runs shell commands as system, rather than root). …


Image for post
Image for post

OTA (Over The Air) updates, while not specific to Android, are a popular way of updating remote devices over the internet. Update packages are directly downloaded to your device, but how are these updates actually applied in the Android world? Before we dive in, let’s talk a little bit about different types of OTA updates.

At the moment, Android supports two different update mechanisms:

  • Non-A/B OTA Updates
  • A/B OTA Updates

Non-A/B OTA Updates

Non-A/B systems store only one copy of each partition. For devices with limited flash size, this older update mechanism may still be used. Applying this type of update is quite straightforward. Update package is simply downloaded to /cache or /data partitions and using RecoverySystem API, update is initiated. This is a system API and requires the caller to have android.permission.RECOVERY

About

Yiğit PIRILDAK

A curious Software Engineer who is interested in Embedded Systems and ML. Wastes time by playing video games, watching TV Shows and reading fantasy novels.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store