In Midnight Commander when you press ctrl + \ you can access directory hotlist and you can quickly choose connection you want to establish.

The problem is – you cannot by default save passwords, so every time you select this connection you need to input it. Sure, it’s safe to do so, but if using them in your desktop and you’re the only user of it – you can expect a bit more pragmatic approach.

You can define your site’s password explicitly in the MC configuration file which, by default, resides in ~/.config/mc/hotlist.

Just edit this file and you’ll see entry similar to below:

Continue reading

Maven has some really great features. One of them is filtered resources.

Basically, if you use Maven for some time, I’m sure you know what by default everything you put in src/main/resources will be added to the classpath in the resulting artifact (e.g. in the WEB-INF/classes for a *.war archive.) Putting resources in this location is a common way of adding Java properties file to your project.

Now what is interesting: you can use Maven variables in those resource files and they can be swapped into final value during the process-resource phase. You just need to tell Maven that it is not a “regular” resource and that it should be filtered.

Continue reading

You can easily create a fully functional, basic Maven repository on your web hosting provider’s account. It will give others the possibility to access your released artifacts using clean URLs (like yoursite.com/maven or maven.yoursite.com) or use it as a repository straight from the Maven.

To achieve it, you’ll need to:

  1. create Maven FTP user,
  2. create a subdomain (optional),
  3. add Maven server configuration,
  4. add distribution management to your pom.xml,
  5. add Maven FTP wagon provider,
  6. use your repository in client projects.

Continue reading

If you want to remotely access your SSH account (e.g. NAS in home) and listen to the music or watch some movies without downloading them in the first place, you can use the following command:

ssh user@your.host.com cat mediaFile.avi | mplayer - 

It will connect to your.host.com, log into the user account, invoke the cat command on the given mediaFile.avi and transfer the output (stream of bytes) to your local mplayer.

The mplayer - says that it should read the data from the standard input — which in this case is the result of the cat command.
When you finish watching or listening — just break the connection and no traces are left on your local device.

Alternatively, you can also mount your remote ssh location using the sshfs.

If you’re interested in getting some basic information about Git, surely you already know about the Git Community Book – it’s undoubtedly a source of great knowledge. However, if you prefer the visual presentation and want to listen about the Git, I will highly recommend Scott Chacon’s “Introduction to Git”. It is great, compact and fast-paced talk about the basics of Git.

So, either you know nothing about Git or you already know something and just want to summarize your knowledge – I would highly recommend you to spend this 1,5 h on watching this video.

By the way, in this video Scott showed pretty nice feature of aliasing. Despite that sometimes it might be confusing for others what magic is your alias doing, it can be very helpful in some cases (e.g. to save you some time typing long commands):

git config --global alias.lol "log --oneline --graph --decorate"

This command creates a lol alias for git, so invoking git lol will invoke the above log ... command.

The Git learning curve is steep, but after working with it for just a few days – I already like it :-)

I’m currently under the process of moving all my workplace repositories from SVN to Git (configured to work with Gerrit). As a side not, I already found it to be a great tool for code review, line-precise commenting of the artifacts and for reviewing new employees code before pushing the changes to the repository.

But, back to my point. Recently I’ve stumbled upon a problem with commiting an empty directory in Git. If the directory consists of some files and you stage those files, the directory will be commited automatically. However, if the directory is empty, you cannot commit it.

It’s very reasonable way of thinking, but it also creates a few problems e.g. with Eclipse which requires you to use some Maven defined directories (src/test, src/java, etc.). More precisely, if you don’t have e.g. src/test/resources directory, it will throw an ugly project-wide error at your face.

The solution, can be found on StackOverflow, so basically all you need to do is provide a .gitignore file which forbids content other than the .gitignore file itself. However, in my case I ended up with putting a README file which describes why it’s there and that it should be removed as first real resource will be uploaded.
I found it more informative for other team members than an empty .gitignore file.

Some time ago I’ve had a problem with SVN on my VirtualBox guest Ubuntu machine. When the machine was hibernated (it’s state was saved – without shutting it down) there was a time synchronization issue.

When I checked out the SVN repository on the guest machine, I couldn’t see any actual changes or new files which I was 100% sure I committed before (because I did it from my host machine just a minute ago).

It occurred that the guest machine clock was not synchronized with the host’s. So, the guest clock stopped when it was suspended and, after resuming, the time just continued to flow. The time difference was so big that the SVN checkout was working on some weird past revisions (relative to the guest clock) instead of the actual ones.

It was all solved by installing the Guest Additions.

If you’ve cloned a GitHub repository from the original one and not from your forked version and you would like to change it, you can just edit the .git/config file in your project and change the URL of the origin remote:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = VALUE_WHICH_SHOULD_BE_ADJUSTED

Simple, easy, and most importantly – it works.

If you want to execute a GUI based application on the remote server through SSH, you can achieve it quite easily using the ssh command. Just type

ssh -X username@server

The -X flag is used to define the DISPLAY environmental variable on the remote host, so each X11 executed application will be forwarded to your machine.

If you’re using BASH find and want to find files which are named differently than the given pattern, you can use the following syntax:

find . -type f ! -iname "*.class"

The above command will find all files in the current directory (and subdirectories) which have the extension different (exclamation mark) from “class” (case insensitive).

You can also use conditional operations to build slightly more complicated commands, like:

find . -type f ! \( -iname "*.class" -o -iname "*.jar" \)

The above command uses the OR operation to find all files in the current directory (and subdirectories) which have extension different than “class” or “jar”. Don’t forget about the parentheses escaping!

Didn’t need this feature before today, but I guess it might be quite handy.