Online ‘learning-by-doing’ courses I attended – was it worth the money?

22 10 2016

There are more and more online courses available. The ‘Learning by doing’ are in my particular interest. Here I want to:

– list the courses or sites I attended and write a short summary

– know the same from your side – feel free to add your thoughts on online courses.

 

Where I have been

Znalezione obrazy dla zapytania linux academy

About: Linux Academy is about the Ops part of software development. It teaches basics and advanced concepts of clouds, infrastructure automation, containers and so on.

Good? yes. Currently I am during the Ansible course and I recommend it.

Why? There are short lectures and so called ‘server lab’ where you can create up to six cloud servers and do all the exercises on them.

Why not? n/a

 

Code School

About: For learning web development (HTML, JS, CSS). Starting from real basics to advanced Topics.

Good? yes. I did HTML, JS and CSS (partially also git). JS starts from real basics but ends with quite important advanced topics.

Why? You have code editor online, so you do all the exercises online, have instant feedback

Why not? Maybe first you’d like to try CodeAcademy (below) which is free.

 

About: For web development basics

Good? yes, as a starting point. If you need more advanced topics, go to CodeSchool

Why? Its free and good. Exercises and course is held in a browser

Why not? if you need advanced topics, go to CodeSchool.

 

Znalezione obrazy dla zapytania industrial logic

About: Courses teaching Design Patterns, Refactorings, Code Smells detection for Object Oriented Languages. Advanced topics for practitioners.

Good? yes. The exercises you do on your IDE with their plugin installed. Plugin traces all your steps on doing the exercises and provides you with the feedback assessing not only your result but also the style you’ve reached it – I liked the feedback

Why? Practical application of refactoring techniques, Design Patterns with automated IDE refactorings / shortcuts

Why not? very expensive!

 

Znalezione obrazy dla zapytania coursera

About: various set of courses, not only for developers. I did only the Scala course there.

Good? yes, but probably depends on course. Scala course was well prepared, with practical exercises in your IDE

Why? free site, with a lot of courses. You can always start doing one. Coursera has schedule so encourages you to regular attendance

Why not? n/a

 

Where I haven’t been

Treehouse, lynda, pluralsight, edX. But are they even interactive courses or just a set of video tutorials? Let me hear from you!





Recent ThoughtWorks Tech Radar

7 05 2016

If you were wondering whether the technology, trend or tool is worth investing your time and effort, the Tech Radar by ThoughtWorks may help you making the decision.

The analysis is based on observations and predictions. New editions come periodially and here is always the recent one: https://www.thoughtworks.com/radar

Some highlits that interested me the most in that edition:

Tools

  • Jenkins 2.0 as deployment pipeline is on hold – still the build pipeline generation is not a first-class-citizen since it is still based on plugins. Authors says that it could be done better. I suppose that it recommendation considers only the pipeline, not the CI itself
  • Apache Kafka is on trial – although quite widely used in industry. Authors have a pragmtic approach building the report

Languages & Frameworks

  • Spring Boot to adopt – seems to be obvious choice right now, so those who bet on it few years ago were right (lucky me!)
  • React.js to adopt – as a JS framework with one-way binding, providing the loose coupling on the front side

Platforms

  • Docker! Docker! Docker!

Techniques

  • GitFlow on hold! That’s right. Authors noted that feature branches tend to stand away from master / develop branch for too long. That causes the merge / integration problems. So the point is to use GitFlow wisely. Feature branch and merge request that have 2 days of coding in it are far too big.




How to run jMeter tests on Jenkins

24 04 2016

If you monitor your system performance with Apache jMeter test suite, you can easily make it a part of your Continuous Integration and monitor the performance on a regular basis. You need to do three things:

  1. Put your Apache jMeter binary files on Jenkins machine
  2. Run jMeter tests in headless mode from Jenkins job, generating the xml test report
  3. Analyze reports with Jenkins Performance Plugin

Let’s get into details!

1. Put your jMeter binaries on Jenkins

Apache jMeter does not require installation so you can just copy the files that you currently use to the Jenkins server. Thanks to it you will have all the plugins ready to use. Then make sure that user that runs jenkins has access rights to execute jMeter.

2. Run jMeter tests from Jenkins job

Create Jenkins job and, as a Build Step, Execute Shell commands:

#remove previous reports
rm jMeter/reports/*.jtl -f

#run tests
$JMETER_PATH/jmeter -n 
     -t jMeter/suites/sampleSuite.jmx 
     -l jMeter/reports/sampleSuiteReport.jtl 
     -p jMeter/properties/user.properties

where:

  • $JMETER_PATH is a path where you put jMeter binaries (for example /opt/apache-jmeter-2.13/bin/)
  • -n param means that jMeter will be run in headless mode
  • – t jMeter/suites/sampleSuite.jmx is a test suite that you are going to run
  • -l jMeter/reports/sampleSuiteReport.jtl is a result report file that will be generated. This file will be interpreted by Jenkins Performance Plugin
  • -p jMeter/properties/user.properties is a properties file where you configure the report file format to XML (interpreted by default in Jenkins Performance Plugin)

By default the .jtl report file is in the csv format. Jenkins Performance Plugin can read the csv, however the default format for it is xml. By the same token I use user.properties file with one line indicating that the jtl output should be xml:

jmeter.save.saveservice.output_format=xml

3. Analyze reports with Jenkins Performance Plugin

Install the Performance Plugin on your Jenkins instance. To use it, add the Post Build Action to your job, providing the path to .jtl report files:

shot_3

Jtl files will be interpreted each time the job is executed. Moreover in the job page on Jenkins you have new option in menu: Performance Trend, where you can find (on graphs) how your performance was changing over time at each build:

shot_1





Automate Jenkins job creation with DSL

28 02 2016

Jenkins job creation in Web UI is simple but still – manual creation takes time. Depending on your coding and testing practices you may find it acceptable or burdensome and costly.

Jenkins DSL allows you to define Jenkins job in groovy script file, put it on VCS and allow Jenkins to create and execute jobs based on it. The another advantage is that you get your jobs versioned along with codebase.

So… is that hard? Having Jenkins configured to build your code it requires few steps to build jobs from DSL:

1. Install Jenkins Job DSL plugin

Simple thing to begin: go to your Jenkins’ Management page, find the Job DSL plugin and install it (https://wiki.jenkins-ci.org/display/JENKINS/Job+DSL+Plugin).

2.Create the Seed Job

That is the job that will create other jobs. Do it like any other job creation: Select the ‘New Item‘, give it a name (in my case ‘dsl-demo’) and select type of ‘Build a free-style software project‘ (or ‘Freestyle project’).

Remember to configure the Code Repository url and credentials where this job will do the checkout and find the DSL script files.

3. Configure DSL scripts files location

Then in your job configuration add build step named: ‘Process Job DSLs’ (provided by Job DSL plugin). I am going to use the script files located in the filesystem (Jenkins’ workspace), versioned in my git repo. All of them will be located under the Jenkins/jobs/ directory in my VCS with the .groovy extension. So the path in my config is:

Jenkins/jobs/*.groovy

Where I have one file as for now, named:

Jenkins/jobs/demoJob.groovy

Remember to follow naming conventions for files: script names may only contain letters, digits and underscores, but may not start with a digit

4. DSL Script file content

First of all to simply make Jenkins create the job it is sufficient to have such content in DSL script:

job('simpliest-job-ever') {
    steps {
        shell('echo hello from your automated job!')
    }
}

Here I am creating the job with a name ‘simpliest-job-ever’ with one step inside. The step is using shell plugin and executing the echo command.

5. Run Seed Job

Now is the time to push the DSL file to the git server and trigger the Seed Job execution. The effect found in Jenkins console after running my Seed job was:

Processing DSL script demoJob.groovy
Added items:
    GeneratedJob{name='simpliest-job-ever'}

So my job was created from DSL file.

6. Run newly created Job

Now, coming back to the Jenkins’ job list the new job actually is there. I did not set the triggers on it yet so I have to fire it manually.

Here is the result of executing my newly generated job, printed in Jenkins console:

Started by user LooksOK!
Building in workspace /var/lib/jenkins/jobs/simpliest-job-ever/workspace
+ echo hello from your automated 'job!'
hello from your automated job!
Finished: SUCCESS

Lovely, isn’t it? :>

Enhance your DSL script

Such a basic configuration and script file prooves that the whole thing works. Now is the time to enhance the scripts and make them creating the fully useful jobs. The plugins supported in DSL and their full documentation is here: https://github.com/jenkinsci/job-dsl-plugin/wiki/Job-DSL-Commands.

A list of most useful plugins is:

    • SCM to connect your Job with code repository
scm {
  git('git@github.com:yacekmm/looksok.git')
}
    • Triggers to setup the schedule on your job execution
triggers {
  scm('*/15 * * * *')
}
    • maven to execute maven tasks
maven('-e clean test')
    • shell to execute shell commands
shell('echo hello from your automated job!')
  • and more…

Thanks for reading, give it a try!

 





Migrate Mercurial hg repository to git keeping the whole history

5 12 2015

Although hg and git share the same idea of versioning files, git provides much more tools to help teams to maintain code, releases and fixes. That’s why I decided to migrate project repository from hg to git. The method I describe preserves the whole hg history, branches and tags.

Migration with fast-export tool

Fast-export is tool that processes each hg commit and migrates it to git. Tool has the python version that you can run on windows, but it didn’t work for me so i used .sh script on linux on VirtualBox. Steps to migrate are:

  1. clone the fast-export git repo
  2. init your target git repo in path of your choice
  3. run the hg-fast-export.sh script and wait until it finished (migrating 4k commits takes around 20 minutes)
  4. start using your new git repo (checkout HEAD, add remote, push)

In other words execute those commands:

git clone git://repo.or.cz/fast-export.git
git init your_git_repo
cd your_git_repo
~/fast-export/hg-fast-export.sh -r /path_to_old_mercurial_repo
git checkout HEAD

Which will be master branch?

As a default behaviour your default mercurial branch will become master in git.

Filenames containing special characters

If you have filenames with special regional characters (like ą, ó, €) make sure to rename them in your hg repo before migration since, depending on your OS, they may migrate to even more strange chars and you may have problems deleting them from your new git repo.

Nested .git repos in your mercurial codebase

If you have commited the whole git repo and versioned it on mercurial you will not be able to push to the remote git repo after migration. It will fail with error that your new git repo already contains nested .git repos:

remote: error: object a9ee490ac00987835de30bdbc851da5e8d45d28b:contains '.git'

You need to clean up any .git folders from your hg before running migration scripts. Fortunately there is a tool to do it: BFG repo cleaner. Download the bfg.jar and issue the command to delete all .git files from hg repo:

java -jar bfg.jar --delete-folders .git --delete-files .git --no-blob-protection my-repo.git

After the migration and solving all problems described above my new git repo works like a charm!





‘Git Happens’ by Jessica Kerr

10 10 2015

A perfect git introduction video for git beginners:

The most important git concepts are explained. That will help you to understand the way how merge, rebase or branching works.

Definetely a must watch – even if you are already a git user not understanding what actually is happening under the hood. That’s not a magic – it is well defined flow and idea behind it





Run gradle project as java application

18 07 2015

gradle run

is not a default task in gradle. To use it, you need to enable the ‘application’ plugin. To enable the plugin add this line to your build.gradle:

apply plugin: 'application'

This plugin requires one variable to be configured – the main class name:

mainClassName = "com.looksok.Main"

Now you can execute the

gradle clean build run

to run your app








%d bloggers like this: