Month: November 2014

Basics of Git

2014-11-27 Git No comments

Introduction

Git is very popular Version Control System used in many software projects today. In my opinion, it’s the best VCS available today.
In order to start your adventure with this tool, you should know its basic commands and features.
There are graphical tools, which allows to use Git without terminal, but I recommend you to use terminal. With CLI you can work faster, you can understand Git better and you have more control over your repository.

Basic commands

In my opinion, list presented below contains commands, which are used on daily basis and you should start journey with them.

Git hist

There is one more fancy feature, which allows you to display colorful and graphical representation of branches and commits.

You can assign this command to hist alias in your .gitconfig file. After that, you can type: git hist and this command will be executed.

You should see something similar to the log on the screen below.

git_hist_example

It’s a history of commits to AndEngine repository.

More advanced commands and features can be mastered after some work with basic Git stuff.

Resolving conflicts

It may happen that someone modified file and pushed changes into repository and after that we modified the same file in the same place and want to push our changes. In such case, we have to resolve conflicts and merge changes. Sometimes, its more convenient to resolve conflicts with graphical tools than editing raw files modified by Git. If you are using IDE provided by JetBrains (e.g. IntelliJ IDEA or Android Studio) you can use VCS tools built-in IDE. Just choose option VCS -> Git -> Merge changes... for program menu and you can merges via graphical interface. There are also other tools like Kdiff3 or Meld, but I personally prefer JetBrains tools.

Git flow

Last, but not least, remember to read about Git workflow and familiarize yourself with that concept:

Further learning

There are many Git tutorials and materials worth reading, which can help with extending knowledge about this VCS:

7 Rules for Creating Gorgeous UI

2014-11-23 Design, UI No comments

Rules

When we start creating good, clear and consistent UI, we should make some assumptions.
We can follow such rules:

  1. Light comes from the sky
  2. Black and white first
  3. Double your whitespace
  4. Learn the methods of overlaying text on images
  5. Make text pop and un-pop
  6. Only use good fonts
  7. Steal like an artist

Reference

There is quite interesting article about creating gorgeous UI, which describes mentioned rules in details and is divided into two parts:

Some aspects are obvious, but it’s good summary.
mobile-design-cards-01

How to update forked GitHub repository?

2014-11-07 Git No comments

When you fork GitHub repository, you usually want to have your fork up to date with the original repository.
You can update your fork in a few easy steps. Just look at the following example of the Git commands:

Original StackOverflow post with this solution can be found here: http://stackoverflow.com/a/7244456.

How to switch Java version on Linux?

2014-11-02 Java, Linux No comments

Sometimes we need to run specific program with a concrete version of JVM. We can also work with Java 7, but we want to try Java 8. In such cases, we can have installed both Java 7 and 8 on our system and easily switch between them.

In order to show current java version, we can simply type: java -version in terminal.
On my computer I received the following response:

Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

We can see that I am using Java 8. If we want to switch to Java 7, we can use the following command:
sudo update-alternatives --config java

I am using Polish lanugage version of Ubuntu, so I received response, which you can see below.
If you are using another language version, you will see messages in your language.

Są 3 dostępne alternatywy dla java (dostarczające /usr/bin/java).

  Wybór       Ścieżka                                       Priorytet  Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-8-oracle/jre/bin/java          1075      tryb auto
  1            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      tryb ręczny
  2            /usr/lib/jvm/java-7-oracle/jre/bin/java          1074      tryb ręczny
* 3            /usr/lib/jvm/java-8-oracle/jre/bin/java          1075      tryb ręczny

Proszę wcisnąć Enter, aby pozostawić bieżący wybór[*]; albo wpisać wybrany numer:

Basically, we can just type number of a concrete version of JVM and press Enter. Currently, I have Oracle Java 7, Oracle Java 8 and Open JDK 7 installed in the system. When we type 2, we will switch to Java 7. After that, when we type: java -version, we will see the following message:

Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
java version "1.7.0_72"
Java(TM) SE Runtime Environment (build 1.7.0_72-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.72-b04, mixed mode)

If we want to switch back to Java 8, we can do it in the same way.