cbake

Introduction I was recently looking for an easy to use build tool for my C/C++ projects and found out that there are so many build tools, but all of them are so complicated for a beginner. Since there are already too many of them and I got confused on what to use, I just thought of writing one of my own, with simplicity in mind. Since it was supposed to be a simpler version of cmake, I named it cbake. The project can be found on Github here: github.com/manparvesh/cbake Features Some features of this tool are: Easy-to-write build files using...…

Protocol buffers, an introduction

Introduction Protocol buffers are Google’s language-neutral, platform-neutral, extensible mechanism for serializing structured data. Some advantages are: Cross platform and language independent Backwards-compatible and future-proof Focused. Proto schemas describe your data models. Protobuf was invented by Google, and is a lot smaller and faster than other alternatives like XML. Example message Person { required string name = 1; required int32 id = 2; optional string email = 3; } While using with Java, this can be used like this: Person john = Person.newBuilder() .setId(1234) .setName("John Doe") .setEmail("[email protected]") .build(); output = new FileOutputStream(args[0]); john.writeTo(output); Seems easy, right? Advantages The Builder notation can...…

Writing tests using CMake

Introduction There are several articles that show how important software testing is. I recently learned about writing tests for C/C++ projects using CMake. I googled about various frameworks that people use for testing their projects, like googletest, etc., but since CMake is very widely used and trusted, I decided to use it to write tests. I found out that testing is integrated inside CMake as CTest. The CMakeLists.txt file In case of CMake, the most important element is the CMakeLists.txt file, that contains all the build instructions related to the project. Simple version Let’s see how a simple CMakeLists.txt file...…

Android development

Being from a non-CS background, Android was the first thing I learned when I started to learn how to code. At that time, I was not familiar with Java either. Learning Android for the first time I remember learning Java first and then proceeding with Android development. I learned from the book Learn Java for Android Development by Jeff Friesen. This is a good book that taught me a lot of basics related to Java and Computer Science. After that, I started to learn from the Android developers’ website, which was very thorough and up-to-date. Revisiting Android It had been...…

Deadlock prevention

Introduction Concurrent computing[1] has become an essential form of computing that has evolved a lot over the years. Concurrent programming refers to a type of programming in which several processes (threads) are executed at the same time (concurrently) instead of sequentially. However, there are a lot of complications that come into the picture while implementing such programs. One of these problems is known as deadlocks. What is a deadlock Deadlock[2][3] is a condition in the execution of a concurrent program when there occurs a permanent blocking of a set of processes that either compete for the system resources or communicate...…

Writing a CLI in C

The first time I learned C was when I was in the first year of my undergrad studies at IIT Guwahati, India. After learning many other languages like C++ and Java, I wanted to try something out in C. So, I wrote a simple time reminder for my Ubuntu PC that notifies me of the time after every 30 minutes. Currently, this is a simple limit, but this can be changed easily. …

Playing around with maven

Today I played around with maven while working on a personal project and it turned out to be a great decision. What I learned What I learned in the process: Using maven plugins Maven plugins can reduce a lot of work when it comes to automating things. I used maven-assembly-plugin to create an executable jar file, which includes all the resources and dependencies of the project as well. In my project, I added this part to my plugins: <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <archive> <manifest> <mainClass>path.to.MainClass</mainClass> <addClasspath>true</addClasspath> </manifest> </archive> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> <executions> <execution> <id>make-assembly</id> <!-- this is used for inheritance...…

Hacktoberfest 2017

Hacktoberfest 2017

Hacktoberfest is an initiative by DigitalOcean and Github that is held every year in October to promote Open Source software development. To win a T-Shirt and some goodies, one had to submit four pull requests for any project on Github and get it merged. I contributed by adding 3 of my projects to this challenge as I wanted to help the people who were new to the open source world. These were: stlmp: Implementation of data structures and algorithms in C++, like the Standard Template Library (STL). I added this because I hoped the newer people who did not have...…