Skip to main content

Archive

I’ll admit, my blog’s Archive section is showing its age. While those older posts were relevant when written, many are now outdated and less useful. I keep them for completeness, but readers looking for the latest info are better off checking out my newer articles outside the Archive.

Monitoring your application locally with NewReclic

The New Relic Digital Intelligence Platform provides actionable insights to drive digital business results. You can monitor your application and infrastructure performance so you can quickly resolve issues and improve digital customer experiences.

Following instruction should help you to connect your application to NewRelic platform and customize application events sent to the platform.

Selenium Tests with Maven and Selenide

The article explains how to use Selenide, a wrapper around Selenium WebDriver, to simplify writing UI tests in Java. It provides a sample Maven POM file with configuration options for running tests in different browsers, locally or on a CI server, and leaving the browser open after tests.

Java Application Development Tutorial

I’ve been meaning to write a small tutorial for building web applications. Now it’s time! Let’s define the steps and choose some solutions for developing back-end java web application.

I will give my design recommendations and list a technologies I would use. You may have your own opinion, and you may share it in comment. Over time, this post may change since my favourites are also changing over time.

Booting Spring Webapp

Spring Boot is an excellent tool to bootstrap java application. Most of the references mention how to create a standalone java application, optionally with embedded web server (tomcat or jetty). But Spring Boot supports also creating web applications intended to run within servlet container.

Syncing iTunes Library Between two Computers

Given:

  1. Two family Macs with iTunes 12 installed
  2. More than 10GB of audio files

I want to share my media library between these two computers and keep them synchronized. When I add new file on one computer, it should apear on another. When I delete a file on second computer - it should be deleted pn first. When I change iTunes playlists on one computer it should be changed on another. I don’t want to keep my media on Network storage (NAS) or External drive (USB), because it will be impossible to listen to the music on the go, when NAS or external drive is disconnected (e.g. in cafe).

To be able to use the same iTunes media library database on two computers I need to make my media files available by at the same path on disk. Normally, media files are under the user account folder. But it is possible to move them to the location common for all user accounts.

Next, I need to keep iTunes media file in sync.

After some research in the Internet I come to following solution.

  1. Backup tour iTunes media folder /Users/user/Music/iTunes
  2. Move iTunes media files to the /Users/Shared/iTunes Media folder. Set new media files location:
    iTunes Media Settings
    Then run File > Library > Organize Library and select “Consolidate Files” to copy your files to new location.
    Consoludate Files
  3. Remove your old Original files were copied, not moved. You need to remove them (if you have made a backup on step 1):
rm -rf /Users/user/Music/iTunes/iTunes\ Media
  1. Close iTunes and copy your /Users/user1/Music/iTunes to /Users/user2/Music/iTunes on second compuler
  2. Copy /Users/Shared/iTunes Media from first to second computer to the same location.
  3. Setup media folder synchronization between two computers using BitTorrent Sync. If you have smaller media library that fits into DropBox – then go for it. It is possible to use any cloud solution, e.g. at the moment (February 2015) Yandex Disk offers 10GB for free.
  4. Wait for synchronization complete.

You may start using iTunes on both computers. Keep in mind, that if you modify your media library from both computers simultaneously, you will have only recent changes. You may want to setup one-way synchronization: one computer will be the Master where you will manage your library and the second one is for listening only.

Base64 Variants in Java 8

You most likely used Base64 encoding. It’s about encoding any sequence of data as a printable string (digits, lower case and upper case letters). But Base64 has variations. E.g., not every Base64 variant allows safe transfer of any data as URL parameters. For that purpose there is a special dialect of Base64: Url-safe encoding.

Conditional Java Configurations in Spring Framework

Spring Framework offers very flexible means for binding application components. Externalizable properties, composite configuration, nested application contexts and profiles.

Sometimes, it is necessary to control whether particular beans or @Configuration will be loaded or not. Spring Framework v.4.1.x does not provide that feature out of the box. But, hopefully, Spring allows conditional bean initialization (see @Profile implementation and @Configurable). So, I created the annotation @Enabled which allows me to control bean instantiation via properties.

@Enabled indicates that a component is eligible for registration when evaluated expression is true. This annotation should be used in conjunction with Configuration and Bean annotations.