New endeavor

Long time no see! It’s been a long while since I have posted anything on my blog.

Now, however, is a time to come back. I’ve been busy the past three years – here’s what I’ve been doing:

  • I’ve started writing a book for beginners about software development in Java – it is available for free on my other site: https://kursjava.com – up to date there are 9 chapters ready, contributing to over 450 pages, and about 7 more chapters are yet to come. The book is in Polish language.
  • I’ve written a document titled Craftsmanship of Software Development – it is a collection of my thoughts about what it means (and what it takes) to be a successful developer. It is available here (in English): https://craftsmanshipof.software
  • I have successfully taught a person who had no prior experience with software development to do programming in Java, and to use SQL and Git. That person has now been working for almost 2 years as a happy Java developer.

This last item is the most important to me – since the day I’ve proven to myself that I can do it, I wanted to do it on daily basis. I’ve quit my job a few months ago and, step by step, I will by trying to find more people who would like to learn programming and teach them.

I also have many other ideas related to teaching software development and I will try to bring them to life – first of those is a Git training. Stay tunned to learn when the first one will take place (most probably in July).

GitBlit Pre Hook to Prevent Pushing Certain Commit

There are many different Git workflows and it is very likely that the one you are using relies heavily on Git’s outstanding branch management.

If you have many branches, some of which may be release branches, you surely don’t want anyone to merge a feature branch branched off of develop into it (which already probably is dozens of commits ahead).

This is extremely important in teams formed by many developers – if one of them makes the mistake, and the others start branching off of the release branch, all of them will have the „corrupted” version of the branch, and then it takes a lot of effort to undo all of the damage.

Git doesn’t provide a way to deal with this problem out of the box – a pre hook is required, or some third-party software.

If you are using GitBlit, however, writing a pre hook which guards a branch from being flooded with commits from a branch which should never be merged into it, is quite easy.

Below simple groovy script achieves just that: Czytaj dalej

GitBlit – Handling a File Rename in Pre Hooks

I’ve been recently writing a pre hook for Git to check if any of the committed files violate any policies. I’m using GitBlit and it’s using JGit (an implementation of Git written in Java). You can’t use normal Git pre hooks with GitBlit, but you can write them in Groovy.

GitBlit’s author created an API to ease the use of JGit in pre hooks. I needed to detect if a file was renamed, and have access to its old path, as well as the new one.

Unfortunately, the documentation of PathChangeModel (which corresponds to a file in a commit) doesn’t state how to obtain the old path – the renamed file object’s path property contains the new path.

Luckily, it’s open source! I’ve had a look into the source code of the mentioned class and it turned out that, in case of a rename, the old path is stored in the name property. Take a look at the following example. Czytaj dalej

Git – Local Commands

Git is an extremely powerful Distributed Version Control System. And by saying that, I’m getting straight to business.

The „Distributed” part means that there is no central repository on which all developers are working. On the contrary – every developer has a clone of some publicly available (whether on the internet, or at work) repository. The „central” becomes just a place to share your work and pull others’ changes.

This is one of the features that make working with Git very handy. It is also one that people often don’t realize. Czytaj dalej

MERGE Alias Bug – No Error Thrown When Using Wrong Alias

Back in the days, when I was just beginning working as an Oracle developer, I used to view Oracle Database Server as such a great piece of software to the extent where I wouldn’t even consider that a problem which I’ve just encountered wasn’t my fault, but Oracle’s bug!

Why am I bringing this up, you might ask? Well, a few weeks ago I’ve stumbled upon a weird bug in Oracle. I was using Oracle 11.2.0.1.0. Take a look at the below example: Czytaj dalej

Searching in the source of a view

Once upon a time… I needed to check in the source of which objects a particular character string was included.

LONG (the pun!…) story short, non of the {USER|ALL|DBA}_SOURCE views give you a chance to search in the source of the views.

„Well, why is that a problem?!” – I hear you saying – „Don’t you know the {USER|ALL|DBA}_VIEWS views views (wait, one views too many)?”

O my, but of course! There’s a column named TEXT in them with the source of the views! Let’s try that: Czytaj dalej

Answer to Quiz #2: NULL in Aggregate Functions

1 Quiz #2 – NULL in Aggregate Functions

Hello again! It’s due time to provide the answers for my second quiz – the one about NULL in aggregate functions.

In this particular quiz, it wasn’t the point to pick the correct choices, but rather figure out what will be the result of running each of the SELECTs. Czytaj dalej

Quiz #2: NULL in Aggregate Functions

Impact of NULL in Aggreaget Functions

Aww. So dusty in here. Where have I been for the past seven months?!

Either way, it’s that time. Yep, you know what I mean – it’s the QUIZ TIME!

I’ve got a new quiz for you today:

What will be the result of running each of the SELECTs? Czytaj dalej