How to add keys to Python dictionary

Python has a strong feature to allow you to check availability of keys in a dictionary (AKA json string) on the fly and edit it. I recently, ran to a case that requires to check whether a particular keys are available in the dictionary. If keys are unavailable, add to …

Python in one post

Two years ago when I started learning Python I had made a small note for myself as a quick reference which turned out to be so handy. The time I made the note I did not consider about sharing it. Now, after two years when I was working with Python …

How to get rid of getter, setter in Java

One of the boring stuff to do in programming is to add getter, setter methods. Thanks to IDEs nowadays with few clicks or pressing shortcut keys you are able to add getters and setters to code. However, still much of coding space is wasted and besides that from my point …

IntelliJ IDEA shortcuts for Eclipse users

Introduction IntelliJ IDEA IDEs are very popular among developers, especially Java folks. In addition to that, they support multiple languages such as Java, Scala, C/C++, Python, etc. I have recently switched from Eclipse to IntelliJ for Java development. At first, I had very difficult time to give up Eclipse convenient …

How to create Ubuntu indicator with Python

For a long period of time, I wanted to make a simple Ubuntu unity indicator just to learn how they work. Finally in Christmas holidays I got a chance to search on the internet and came up with a simple idea of having a weather indicator. The result was great …

Difference between abstract and interface in Java

One of the most repetitive programming interview question is “what’s the difference between abstract and interface classes?”. To answer this question I have had search the internet to come with a complete answers in bullet points. I tried to cover as much as I can. Below is the end result …

Few hints about Apache Ant

Apache Ant is one of the most awesome automation tools, even though it is not as good as Maven. If nowadays I want to select an automation tool for a new project definitely I got with Maven, but before it existence Ant was rolling. Recently, I had to work with …

How to create RESTful web service in Spring

Spring provides many facilities to Java developers which ease the programming as well as reducing the complexity of the code. One of the most powerful features Spring supports is called invasion of control or dependency inject. In addition to that, throughout the years Spring framework has had tremendous growth and …

Transaction in JDBC

Java JDBC is a very simple and basic library to access to database data, but it is quite common and easy to setup that is why it is kind of popular. However, it has various shortages such as Object-relational mapping (ORM) and Transaction Management. The latter though can be done …

How to install Composer in Ubuntu

Composer is a dependency manager tool for PHP programming language which is quite useful for PHP programmers and make the coding process easier. Compose more or less likes Maven that manage dependencies automatically. Installation process of compose is quite easy and will not take more than 5 minutes to set …

The correct place of bracket in programming

Basically, the location of bracket ({}) in programming is a very old argument and up to now there is no absolute winner. For those that my words look like an alien language let me provide an example. In programming languages like C/C++, Java and so on bracket ({}) are used widely. …

Colorizing output of Git

Apart from various IDEs (including Eclipse) which provide you great Git features visually, accessing Git from command line also can be a new experience which is very useful and from my perspective is a must for any developer that pushes the code in Git (Github, BitBucket, etc.). Git in terminal …

Install Curl for PHP in Ubuntu

If you get similar error message like “Fatal error: Call to undefined function curl_init()”, means that your Curl lib/module is not installed for PHP. Fortunately, in Ubuntu installing Curl for PHP just requires two commands and it can be done so easily with the help of apt-get package installation. The …

How to print PHP error in browsers

By default if your PHP code has some errors, it just shows white dead page which is so confusing and for me personally so annoying. By contrast of languages such as Java which you can easily check about any compile or runtime error, in PHP this task is not so …

In-memory databases

Sometimes in programming need to hold many objects and classes into memory, however, this will cause shortage of heap memory or memory leakage eventually. In order to avoid this bad practise and also not using hard disk to save the data due to its low access speed, you can use …

Testing Postgres connection with PHP in Ubuntu

PHP is very powerful programming language to write different web application and that is the one of the most important reason I choose to learn it alongside with Python. However, database connection is getting troublesome in PHP specially for new programmers like me even though PHP is quite straightforward and …

Instantiate a class by name stores in String

For beginners like me that are not very familiar with object oriented concepts, it might be impossible to imagine that Java has a capability to instantiate a class by its name stored in a string variable. However, this is totally possible in Java or even in other programming languages with …

Multithreading example in Java

In the previous post I discussed about multithreading concepts and provided a case study to understand the principles better. In this post the solution of the case study is given with detailed explanation about it. As mentioned, the first thing that program should do is to categorize mails, this is …