Quantcast
Channel: Programmer's Blog
Browsing index pages (28 articles)
↧

How to Checkout a Specific Tag in Git

Here is a quick tip which shows how to checkout a specific tag in Git. $ git clone <repository-link> $ git checkout tags/<tag-name> -b <branch-name>The first command clones the whole...

View Article


Clone a Git Repository Into a Specific Folder

Let's take a look at a sample git repository URL:https://github.com/apolunin/java8-impatientIt can be cloned via the following command:git clone https://github.com/apolunin/java8-impatientThe contents...

View Article


Change File Type in Vim

Recently I had to write a few lines of code in assembly language. Vim and GAS were chosen as suitable tools to use. I downloaded vim-gas plugin, installed it using vim-plug (Vim plugin manager that I...

View Article

Convert InputStream to String in Java

Sometimes in Java world it is necessary to convert an InputStream to a String for further processing. There are several ways to do it, but here is a fantastic trick I recently discovered in this...

View Article

Create a GUID in Java

Some software development tasks need a way to generate unique identifiers. I saw several homegrown solutions, but Java 5 makes the process a breeze. It contains class UUID which can generate type 4...

View Article


Change Editor for Git Commit Messages

Git is a very powerful tool especially when used from a console. Obviously committing changes is a pretty common task which includes editing commit messages. If a message is short it is easy to specify...

View Article

Rename a Remote Branch in Git

In the previous post I described how to rename a local branch in Git. Now let's take a look how to rename a remote branch. The process is a bit more complicated than with a local one and consists of...

View Article

Rename a Local Branch in Git

From time to time I have typos crept in the names of Git branches I create. Certainly it is possible to delete a branch and create a new one with corrected name. However Git allows for combining two...

View Article


How to Avoid Null Checks in Java

I suppose every Java developer wrote checks similar to the following many times:if (obj != null) { // ... obj.doSomething(); // ...}Sometimes such code seems reasonable and its usage can be justified....

View Article


Image may be NSFW.
Clik here to view.

Create Web Application with Maven (Tomcat, WAR File)

This post is a step-by-step tutorial which shows how to create a simple Java webapp project using Maven - a popular Java build tool. The project will be packaged into a WAR file and deployed to a local...

View Article

Tomcat Administrator Login and Password

Tomcat web server has several web applications bundled with it which supply nice GUI to perform administrative tasks. In order to access them you need to authenticate with login and password. Where to...

View Article

Euclid's Algorithm in Java and Scala

Euclid's algorithm (a.k.a. Euclidean algorithm) is an efficient way of finding the greatest common divisor (gcd) of two numbers - the largest positive integer that divides both numbers without a...

View Article

LRU Cache in Java - Part 2

IntroductionIn the previous post I described LRU cache notion and showed how it can be easily implemented using LinkedHashMap data structure. But sometimes there is a requirement to implement LRU cache...

View Article


LRU Cache in Java - Part 1

IntroductionCaching is an optimization technique which can dramatically boost application performance when used appropriately. There are a lot of different approaches to implement caching ranging from...

View Article

Secret Way of Returning Array from Method in Java

IntroductionThis post is like a little travel in time. It is quite short and doesn't bring a lot of practical sense, but rather a small historical trick that was known better in the early days of Java....

View Article


Java 7 try-with-resources Statement

Introduction One of the most exciting features added in Java 7 is automatic resource management (a.k.a. try-with-resources or TWR). While basic TWR usage looks simple and straightforward there are...

View Article

Mystery of Collections.max() Declaration

Introduction I'm sure that every software developer who used Java for a while knows about Collections utility class. It contains a lot of useful methods which facilitate collection sorting, finding...

View Article


Get and Put Principle in Java Generics

Introduction It is hard to imagine modern Java development without using generics. While they look more simple and straightforward than C++ templates, it makes sense to invest some time to learn their...

View Article

"Observer" Design Pattern in Java

IntroductionThe Java Platform used to have support for Observer design pattern in the form of Observer interface and Observable class starting from its initial release. However a long time passed since...

View Article

"Singleton" Design Pattern in Java

Introduction Singleton design pattern is a very disputable issue. There are tons of discussions in the Internet about Singleton usage in application design, why to use it, why not to use it, why...

View Article
Browsing index pages (28 articles)


Latest Images