Category Archives: Development

Learning Kotlin

Kotlin is, as described on the official website, a

Statically typed programming language for modern multiplatform applications

Programiz has a great infographic that explains the interest of learning Kotlin.


The Kotlin website has a well written documentation, with a complete language reference, as well as different tutorials.

If, like me, you have some experience in Java development, a good starting point are the Kotlin Koans. The Koans are a series of TDD exercises, each of them introducing an element of the Kotlin syntax. It starts slowly, with the basic Kotlin syntax and the differences with Java, but then goes to specific collections handling concepts that can remind you of the new Java 8 or Scala transformation methods.

To start working on the Koans, you can either fork the project on GitHub (here) or clone it directly. I’ve forked it, and created a new branch for my work (git@github.com:RemyG/kotlin-koans.git).

Then open the project in IntelliJ (Kotlin is supported and developed by JetBrains).

You can see that the project provides failing unit tests, as well as the skeleton for the classes to implement. All you need to do is implement the methods so the unit tests pass.


After having familiarized yourself with the basic Kotlin syntax, you can move to more practical experiments.

You can find good tutorials on how to integrate Kotlin with Spring Boot: Creating a RESTful Web Service with Spring Boot, Spring Boot and Kotlin.

Kotlin is also fully supported for Android development (see this blog post), but that’s not an area I’m working in.

Training program

For the last 3 years, I’ve been working as a technical team leader for IBM Client Innovation Center.

Although this experience has brought me a lot (team management, project management…), I’ve lacked the time to really stay up-to-date with the more recent technologies.

That’s why I’ve decided to compile a list of a few technologies I’d like to learn or improve on during the next few months:

  • Kotlin
  • Spring 5
  • NoSQL
  • Docker
  • Angular

I’ll update this list if needed, and try to write on the different items, with the sources I find and use.

Moving a PHP project to Composer

A few months ago, I’ve discovered Composer, which is a dependency manager for PHP (you can compare it to Maven, for Java). With Composer, you can simply checkout the main project, and install the dependencies.

The transition to a Composer project is very easy, so I decided to start using Composer in my ComicsCalendar project. In this post, I’ll explain how you can migrate to Composer for a very simple project (in this case, using PropelORM to access your databases).

The project structure at the start of this work is:

- comicslist
    - application
        + build
        + config
        + controllers
        + helper
        - plugins
            + propel
              recaptchalib.php
        + views
          build.properties
          propel-gen
          runtime-conf.xml
          schema.xml
    + static
    + system
      .gitignore
      .gitmodules
      .htaccess
      index.php

1. Install Composer

It’s really easy to install Composer. Just follow the instructions on the official documentation.

In the following commands, I’ll assume that you’ve installed Composer so you can run it with:

$ composer

2. Create the setup file

Each Composer project requires a composer.json file. This file (equivalent to the pom.xml file for Maven), contains a list or the project dependencies (and lots of other things I won’t mention here).

Create a composer.json file at the root of your project:

{
    "require": {
        "propel/propel1": "1.7.1"
    }
}

As you can guess, this will install version 1.7.1 of PropelORM.

This is the only dependency you will install right now (Composer automatically installs the dependencies of your dependencies).

3. Install the dependencies

To install the dependencies, run from the project root:

$ composer install

This command created the vendor folder (if it doesn’t exist), and the vendor/autoload.php file, which contains the list of files to include into the project.

4. Include the dependencies in the project

The work is almost done, you just need to include the dependencies in your project. As I just explained, the file vendor/autoload.php contains the dependencies you need to include.

Just include this file in any “global” PHP file:

<?php
require_once('vendor/autoload.php');

5. Clean-up the project

The last action is to clean-up the project from the previous Propel installation. Remove the application/plugins/propel folder (which contains the old Propel classes), the .gitmodules file (which contains references to the Git sub-modules), as well as the reference to the main Propel script (which is now referenced in the autoload.php file).

6. Configure Git

If you’re using Git to track your sources, you’ll need to add a few changes to your project.

Add a .gitignore file at the root of the vendor folder, containing:

*
!.gitignore

This will allow you to commit the vendor folder, without any sub-folders (those will be re-created when running $ composer install).

You also need to add the composer.json and composer.lock files. The composer.lock file contains the actual versions of all your dependencies (since you can specify ranges in the versions), so someone who installs the dependencies will have the same versions as you do.


You’re now ready to keep using PropelORM, and add new dependencies that could help you (yes Monolog, I’m looking at you…).

No tips yet.
Be the first to tip!

Like this post? Tip me with bitcoin!

16XaKtprp6XZkfnND1cFRxqewmpEvahiLz

If you enjoyed reading this post, please consider tipping me using Bitcoin. Each post gets its own unique Bitcoin address so by tipping you're not only making my continued efforts possible but telling me what you liked.

Customer

Good customer relation – Snipt

Some time ago, I signed up on Snipt, a website that allows you to store snippets. It was a free account, that I probably used once, to test the service (only because this was not something I needed).

But yesterday I received an email from them, announcing that they will move away from free accounts. This is a fair enough decision, I can understand the need for a stable income.

Lots of services start with free accounts, and then cancel them (see my recent post on DynDNS). But the email I received from Snipt was written to keep good relations with all users, the ones that will upgrade to a paying account, and the ones that don’t have the need or the will to do it:

I’m an existing user. What happens to my data?

Nothing. As an existing user, your snipts will remain intact and usable even if you decide not to upgrade. You can edit your existing snipts, delete, embed, etc. If you would like to create new Snipts, you’ll need to upgrade to the paid plan.

That’s a very good decision. You don’t lose anything that you’ve stored with them, you don’t need to save everything before it’s deleted… Other companies should have a look and learn something…

But what made my day was this part:

Can you suggest an alternative to Snipt?

Gist is an excellent alternative to Snipt.

For me, this is the sign that this company wants what’s best for its users. It’s not only about the money, it’s about allowing users to get the best service for what they’re ready to pay. “We could say that no free service is any good, but we won’t. We’re moving to paying accounts, but if you don’t want to, you can use this other good service.”

Thank you Snipt!

Photo: Customer, by 10ch via Flickr (CC BY)

No tips yet.
Be the first to tip!

Like this post? Tip me with bitcoin!

19E63z6v5d8mrbMD7NMSmhBizYnf1AfWf8

If you enjoyed reading this post, please consider tipping me using Bitcoin. Each post gets its own unique Bitcoin address so by tipping you're not only making my continued efforts possible but telling me what you liked.

RSSReader 0.3

I’ve released a new version of my RSS reader.

You can find all the information about this release here.

No tips yet.
Be the first to tip!

Like this post? Tip me with bitcoin!

1LgT3P9b6cemk4cZ53NFY5eiFNaAWhYv7H

If you enjoyed reading this post, please consider tipping me using Bitcoin. Each post gets its own unique Bitcoin address so by tipping you're not only making my continued efforts possible but telling me what you liked.