teleren/devto huggingface dataset:
Java 10 — migration story
Tags: softwaredevelopment, springboot, java, java10
Published: 2018-03-27 06:19:32

---
title: Java 10 — migration story
published: true
tags: software-development,spring-boot,java,java10
canonical_url: 
---

As you probably know [**Java 10**](http://jdk.java.net/10/) was recently released. Not so many new features. At least for [**Kotlin**](http://kotlinlang.org) developers… But there are [several improvements](http://www.oracle.com/technetwork/java/javase/10-relnote-issues-4108729.html) to **JVM** itself. And, I guess, there will be more in upcoming versions. Which we will get twice a year from now! So, I think it is better to take some time and sync your projects to make it easier in future to migrate with the same speed.

The main project I’m involved into is **SpringBoot** 1.5.X based service made with **Kotlin** and it uses **Postgres** as a data base. At this moment it uses **Java 8**. Such a great chance to skip **Java 9** and jump directly to 10! Being inspired by this thought I have opened my laptop.

I use [**SDKman**](http://sdkman.io) to install Java but for **Java 10** it delivers broken version for some unknown reason. So this time I had to download bundle from the official [website](http://jdk.java.net/10/) manually.

The biggest issue is that some libraries are no longer part of **JDK**. That is good news — it is getting cleaner. But as a result, you need to define additional dependencies for your project. You can also include them with command line parameters since they are actually still in **JDK** but I think it is better to move them into dependencies because as far as I’ve understood they gonna be removed in future releases completely. In my case it was:

![](https://cdn-images-1.medium.com/max/1024/1*SQ14w9r73jrD6tHWTt7d-w.png)

The second issue was [**Jacoco Gradle plugin**](https://docs.gradle.org/current/userguide/jacoco_plugin.html). If you use it to measure the code coverage there is good news— **Jacoco** itself supports **Java 10**. But to make **Jacoco Gradle plugin** work I had to specify the tool version like this in my gradle build file:

![](https://cdn-images-1.medium.com/max/1024/1*njwwVXG6jfxW7NDI3YtQnw.png)

And the last part that was broken — [**Mockito**](http://site.mockito.org/). That issue could be solved by adding a fresh version of [**Bytebuddy**](http://bytebuddy.net/) library like this:

![](https://cdn-images-1.medium.com/max/1024/1*VCu3z7x3Lm9b0WKn_czzLw.png)

After these modifications, I was able to build and run my project and all tests were green. Don’t be afraid to migrate! Next step would be to prepare **Dockerbuild** file. But that is a topic for the next article.
Vulkan Memory Allocator 2.0.0
Tags: vulkan, graphics, gpu, library
Published: 2018-03-26 22:12:38

---
title: Vulkan Memory Allocator 2.0.0
published: true
tags: vulkan,graphics,gpu,library
canonical_url: http://asawicki.info/news_1676_vulkan_memory_allocator_200.html
---

At Game Developers Conference (GDC) last week I released final version 2.0.0 of [**Vulkan Memory Allocator**](https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/) library. It is now well documented and thanks to contributions from open source community it compiles and works on Windows, Linux, Android, and MacOS. Together with it I released [VMA Dump Vis](https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/tree/master/tools/VmaDumpVis) - a Python script that visualizes Vulkan memory on a picture. From now on I will continue incremental development on "development" branch and occasionally merge to "master". Feel free to contact me if you have any feedback, suggestions or if you find a bug.
Let's Encrypt - Cloudflare
Published: 2019-03-28 20:00:42

---
title: Let's Encrypt - Cloudflare
published: true
tags: 
canonical_url: https://jasonbutz.info/2018/03/lets-encrypt---cloudflare?utm_source=dev.to&utm_content=lets-encrypt---cloudflare
---

[Let’s Encrypt](https://letsencrypt.org/) and [certbot](https://certbot.eff.org/) are wonderful and make it easy, and cheap, to get SSL certificates setup. But sometimes your application or site isn’t really set up in one of the common patterns. One set up that I use a lot is to have the application running on my server, but have the Cloudflare CDN setup in front of the application. The default [NGINX method][nginx-certbot] won’t work in that case.

The DNS methods of verification didn’t use to be very prominent on Certbot’s site, so it took me a while to figure out that you can very easily do the verification all with DNS. There is one big downside with the method that I am going to show you: you need to have your Cloudflare API key sitting in plain text on your server’s hard drive. In my case it is under the root account, but still. It is less than ideal.

To start off with create a `/root/.secrets` directory and then create the file `/root/.secrets/cloudflare.ini`. You’ll also want to make sure only the root user can access the file.

```
mkdir -p /root/.secrets
touch /root/.secrets/cloudflare.ini
chmod 600 /root/.secrets/cloudflare.ini
```

Now open the file in a text editor and add the following, replacing my example details with your real ones.Your API key is under your profile and I’m using my Global API Key.

```
dns_cloudflare_email = "cloudflare-user@example.com"
dns_cloudflare_api_key = "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed"

```

Next, you just have to run your certbot command. I have the locations of my certificate files configured for my web server so when I need to add a new domain or subdomain I can just use the command below, replacing `example.com` with whatever the domain is.

```
certbot certonly --dns-cloudflare --dns-cloudflare-credentials /root/.secrets/cloudflare.ini -d example.com
```

If you are using NGINX and want your site setup automatically you might use the following command:

```
certbot certonly -i nginx --dns-cloudflare --dns-cloudflare-credentials /root/.secrets/cloudflare.ini -d example.com
```

That’s really all it takes, you just have to tweak the commands you normally use a little bit.
What are some books where the reader learns by building projects?
Published: 2018-03-26 20:57:59

---
title: What are some books where the reader learns by building projects?
published: true
description: 
tags: 
---

A continuation of https://news.ycombinator.com/item?id=13660086 and an extension of https://github.com/tuvtran/project-based-learning which have both been incredibly useful in learning a new language or technology.

I recently finished a book called Progressive Web Apps with React which took the reader through building a PWA chat application using firebase with push notifications and such.

https://www.packtpub.com/web-development/progressive-web-apps-react

Also, this one for Vue:

https://www.packtpub.com/web-development/vuejs-2-web-development-projects

I just finished the first chapter which has you build a markdown editor with Vue.

Can we compile a list of books/resource where project based learning is the core tenant?
Android Studio strings.xml Parser
Tags: android, productivity, opensource, github
Published: 2018-03-26 19:54:44

---
title: Android Studio strings.xml Parser
published: true
description: Huge time saver
tags: Android, productivity, opensource, github
---

Hello all! Today I have a small blurb about a relatively basic, yet helpful tool I have recently created and used.  The idea of the program is to facilitate generating the strings.xml file so your app can support multiple languages. 

Currently, Google offers a $0.07 fee per word if you would like your app to be professionally translated for any language.  This may not seem like a lot, but if you have many strings in your resource file and want to support many languages, the price to get your app translated can easily grow into the hundreds.  If you are okay with paying that, then by all means.  Otherwise, if you are not okay with paying for something Google Translate can do (and want to speed up your efficiency with this progress), checkout my newest GitHub contribution: https://github.com/developer-dmp/Android-Studio-Strings-Parser.

There is some information at the GitHub link about usage, but here is a brief overview of how it works:  
Pull the project down to your local machine
Input your strings.xml file at input/strings.xml
Run the program to parse the file
Take content from output/strings_content.txt and paste in Google Translate
    * Translate the text to whatever language you want
Take the translated text and paste it in input/strings_content_converted.txt
Run the program again to rebuild the strings.xml file

Boom.  Now you have a newly formatted strings.xml file in output/ which you can copy and paste into your strings.xml file in Android Studio for whatever locale you were looking to support.

This process isn't fully automated, but that's because the Google Translate API isn't free -__-

The program I wrote (in Intellij if you were wondering) tremendously increased efficiency in the process of creating numerous strings.xml files for the different locales/languages you want to support.  I just used this program for the app I am nearing the release of and was able to go through 35 languages in 20 minutes.  My strings.xml file is over 100 lines long too, so I was able to perform thousands of translations and numerous rebuilds of the strings.xml file without ripping my eyes out.

Please let me know if the program was of any use to anyone reading the post, any potential improvements you can think of, and if there is a service out there that is 100 times better than mine and I just wasted my time re-inventing the wheel! xD
The Developer's state in Sweden (Question)
Tags: discuss
Published: 2018-03-26 18:37:08

---
title: The Developer's state in Sweden (Question)
published: true
tags: discuss
---

Hey everyone,

Just wanted to get some insight from people who most likely, reside in Sweden,
about the current state of developers there.
How is the market there? What about communities, conventions or gatherings? Is this a thing?

I have some people there that could help me, if i decided to move. Of course in the beginning I would work a "foreigner's" job, like in cleaning services or something. In the meantime, i could develop my programming skill at home, and possibly could consider studying in the near future(no budget yet).

I just had in mind that in developed countries i could expand my network with people in the IT field, cause i know it's a 'must' for every developer out there.

Are there "learn while working" jobs there, like an "Ausbildung" as they call it in Germany. (yes i have lived in Germany for 2 years as well)
Learning the language of course is something i would do too. I'm good with languages.

For anyone wondering, i am 24, from Greece.
Take what i said with a grain of salt ^
PhpUnitGen, simplify the writing of your unit tests !
Tags: showdev, php, testing, opensource
Published: 2018-03-26 17:37:36

---
title: PhpUnitGen, simplify the writing of your unit tests !
published: true
description: PhpUnitGen is a dev tool to generate your unit tests skeletons in PHP.
tags: #showdev, #php, #testing, #opensource
---

## This article is outdated. Check out the new one:

{% link https://dev.to/paulthebaud/phpunitgen-testing-the-new-way-3jf %}

------------

You are part of the very exclusive club of *PHP* developers and you inflict yourself swirls of copy/paste to satisfy *PHPUnit*?
Unit tests haunt you even in your nightmares?

__PhpUnitGen__ has been designed to make your nights sweater and your apps better tested!

<img src="https://raw.github.com/paul-thebaud/phpunit-generator-assets/master/logos/logo.svg?sanitize=true" width="200px">

__PhpUnitGen__ is an __online__ or __terminal__ development tool for generating your unit test skeletons for *PHP* code.

## Why PhpUnitGen?

Like everyone else, I have to work to eat, and eat to work (even if development is a passion, huh).
I already had a taste of loop in the mouth, and my job was to test a PHP application.
What is more boring and uninteresting than recreating another skeleton of tests for an umpteenth PHP file ? A Formula 1 race maybe...

Starting from this postulate, I found myself wanting to "congratulate" the genius that would automatically generate all my skeletons of unit tests and thus save me a lot of time.

I modestly created this tool.
__PhpUnitGen__ was born.

I then told myself that it might be better to take advantage of the time gained, rather than spend it in front of Netflix, and I published the tool in __open source__.

## What is PhpUnitGen?

__PhpUnitGen__ is a development tool, programmed in *PHP7.1*, which allows generating unit tests skeletons from a *PHP* source code.

The generated tests are written in *PHP7.1* and to work with *PHPUnit 6/7*.

Here are some of __PhpUnitGen features__:

* It automatically detects *classes*, *traits* or other formats and instantiates them appropriately.
* It allows to __generat tests automatically__ for *getter*/*setter* methods.
* It proposes many *PHP* annotations allowing to create simple tests, *mocks* or instantiations of *classes*.

## How to use it?

There are two ways to use __PhpUnitGen__.

Via the web application (__open source__): [phpunitgen.io](https://phpunitgen.io).

Via the *Composer* package that is used with a __terminal__ (also open source): [paulthebaud/phpunit-generator](https://github.com/paul-thebaud/phpunit-generator).

## How to help improve PhpUnitGen ?

You can help improve PhpUnitGen by sending all your comments / bugs via [Github issues](https://github.com/paul-thebaud/phpunit-generator/issues).

You can also share the link of this article, the package or the web application!

__Thank you for reading, and see you soon!__
Application Specific Metrics with Express Gateway
Tags: apigateway, microservices, expressgateway, node
Published: 2018-03-26 17:23:02

---
title: Application Specific Metrics with Express Gateway
published: true
description: Express Gateway is an API gateway that sits at the heart of any microservices architecture, securing your microservices and exposing them through APIs.
tags: #apigateway #microservices #expressgateway #nodejs
canonical_url: https://auth0.com/blog/application-metrics-with-express-gateway/
---

Unless you're building a proof of concept or an application that's not aiming to reach production, you definitely want to add monitoring and metrics to your system. In this installment, we're going to look how Express Gateway can help you to add application-specific metrics and expose them through an HTTP endpoint that can be queried by an external service, such as Prometheus.

[Read on 💪](https://auth0.com/blog/application-metrics-with-express-gateway/?utm_source=dev&utm_medium=sc&utm_campaign=apigateway_microservices)

![Application Specific Metrics with Express Gateway](https://thepracticaldev.s3.amazonaws.com/i/482bw156s5d5wdhxjzty.png)
What I Learned this Week (March 23, 2018)
Tags: discuss
Published: 2018-03-26 16:48:20

---
title: What I Learned this Week (March 23, 2018)
published: true
description: What I Learned this Week (March 23, 2018)
tags: discuss
---

This week's list will be a bit shorter, as I was caught up in a lot of administrative tasks this week.

## Docker: Service vs. Stack

When using Docker in Swarm Mode, a stack describes multiple "services" to run in your cluster.  As `docker-compose` is to `docker run`, so is a Docker stack to a Docker service.  Incidentally, stacks are also described in a very similar manner via YML as you would in a `docker-compose.yml` file.

A Docker service is a collection of homogeneous containers, that is, with the same `image:tag`.  Docker Swarm will replicate the service across multiple nodes according to the rules you set.
How do I repost a blog post from my personal blog?
Tags: help
Published: 2018-03-26 16:21:39

---
title: How do I repost a blog post from my personal blog?
published: true
tags: help
---

I did it once before where I posted on my original blog and posted a copy of it here. I think an admin/mod/whatever did the attribution back to my original post for me. How can I do it myself? Is it a front-matter thing?
Silicon Valley - 5x01 Discussion (spoilers)
Tags: discuss, siliconvalley
Published: 2018-03-26 15:23:42

---
title: Silicon Valley - 5x01 Discussion (spoilers)
published: true
description: A discussion thread for Silicon Valley Season 5 Episode 1.
tags: discuss, siliconvalley
cover_image: https://cl.ly/39373r0o0P0j/Image%202018-03-26%20at%2011.23.19%20AM.png
---

What did you think of the Season 5 Premiere??  Any predictions for this upcoming season?

[![Rodney Dangerfield climbing up on top of a mountain in lederhosen and calling out "Yodel-hey"](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mdzknnsbn24ovrhfx3fn.gif)](https://google.com)
The 7 Most Popular DEV Posts from the Past Week
Tags: top7
Published: 2018-03-26 14:43:21

---
title: The 7 Most Popular DEV Posts from the Past Week
published: true
description: A round up of the most-read and most-loved contributions from the community this past week.
tags: icymi
cover_image: https://thepracticaldev.s3.amazonaws.com/i/xsr1z6iqv0pd7p3s6ns3.png
---

#1. All the tools 🛠

From command line utilities to productivity tools, Bruno shares his entire linux setup as it relates to programming.

{% link https://dev.to/brpaz/my-linux-development-environment-of-2018-ch7 %}

#2. DuckDucking It!

Instead of google, Jaime uses DuckDuckGo as their search engine because the company focuses on privacy, doesn't store personal information, and prioritizes Stack Overflow solutions. 

{% link https://dev.to/jjaimelr/im-developing-software-and-i-dont-google-any-more-3ecb %}

#3. Less Mythical

JavaScript has made being a full-stack developer much more attainable. Siwalik shares his strategy towards mastery. 

{% link https://dev.to/siwalik/mastering-full-stack-with-javascripts-superpowers-oin %}

#4. Ask Tracy Lee anything!

The community asked Tracy a bunch of questions and they got fun stories and practical advice in return. From thoughts on funding to public speaking to open source. 

{% link https://dev.to/ladyleet/im-tracy-lee-a-rxjs-core-team-member-and-google-developer-expert-ask-me-anything-42jo %}

#5. Six programming languages you should know

After research from renowned computer programers, Douglas shares the six programming languages you should know, and why. 

{% link https://dev.to/drminnaar/choosing-a-programming-language-493h %}

#6. Live stream listicle

>From PHP to game development, from Java to Webpack, from React.js to 3d printing!

Iren put together a list of awesome developers to learn from, while they live stream. 

{% link https://dev.to/iriskatastic/learn-to-code-with-live-streams-from-the-best-developers-5fk4 %}

#7. The best of the best

Do you have what it takes?

{% link https://dev.to/rkoutnik/wanted-ninja-rockstar-code-monkey-hacker-unicorn-3nnl %}


_That's it for our weekly wrap up! Keep an eye on dev.to this week for daily content and discussions...and if you miss anything, we'll be sure to recap it next Monday!_
var var = var().var.var()
Tags: java
Published: 2018-03-26 14:18:14

---
title: var var = var().var.var()
published: true
description: Played with `var`
tags: #java
---

`var` was introduced in Java10. It's interesting!

```java
jshell> Var var(){return new Var();}
|  created method var(), however, it cannot be referenced until class Var is declared

jshell> class Var{Var1 var = new Var1();}
|  created class Var, however, it cannot be referenced until class Var1 is declared

jshell> class Var1{Var var(){return new Var();}}
|  created class Var1

jshell> var var = var().var.var();
var ==> Var@58651fd0
```
How do you feel about braces and semicolons?
Tags: discuss, language, compiler
Published: 2018-03-26 14:08:52

---
title: How do you feel about braces and semicolons?
published: true
tags: discuss, language, compiler
---

I'm (slowly) working my way through [Crafting Interpreters](http://craftinginterpreters.com/), and trying to put together a design for my little interpreted language. Thinking about the syntax has got me curious - do you prefer for a language to have:

1. Braces and semicolons *(C, JavaScript, Rust)*
2. Braces and no semicolons *(Go, Wren)*
3. Semicolons and no braces *(I'm not actually sure anyone does this?)*
4. No braces and no semicolons, with significant whitespace *(Python)*
5. No braces and no semicolons, with no significant whitespace *(Lua)*
6. Some other wacky design I've not thought of...

Personally, I tend to prefer the explicitness of option 1, but at the same time I don't really like that `{}` has a double meaning (is it a scope, or is it an object literal?). How about everyone else?
Vagrant MySQL Port Forwarding Configuration
Tags: vagrant, mysql
Published: 2018-03-26 12:21:57

---
title: Vagrant MySQL Port Forwarding Configuration
published: true
description: 
tags: vagrant, mysql
---

- Ubuntu 16.04
- MySQL 5.7
- Vagrant 2.0.2

## VAGRANT
### EDIT Vagrantfile

```Vagrantfile
Vagrant.configure("2") do |config|
  config.vm.network "forwarded_port", guest: 3306, host: 3306
end
```

## MySQL (guest)
### EDIT /etc/mysql/mysql.conf.d/mysqld.cnf

```/etc/mysql/mysql.conf.d/mysqld.cnf
bind-address            = 0.0.0.0
```

### GRANT PRIVILEGES

On the guest machine, login to local mysql server and execute the following sqls.

```sql
GRANT ALL PRIVILEGES ON *.* TO 'root'@'10.0.2.2' IDENTIFIED BY 'your_password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
```

## TEST

```
mysql -uroot -p
```
Mock Multiple Calls To The Same Method With FakeItEasy, Moq and NSubstitute
Tags: testing, dotnet, tutorial
Published: 2018-06-08 16:32:22

---
title: Mock Multiple Calls To The Same Method With FakeItEasy, Moq and NSubstitute
published: true
tags: testing,dotnet,tutorial
canonical_url: https://www.matheus.ro/2018/03/26/mock-multiple-calls-to-the-same-method-with-fakeiteasy-moq-and-nsubstitute/
---

You can download this article project on [GitHub](https://github.com/mrodrigues1/MockMultipleCalls).

Sometimes when doing unit test, we encounter subsequent calls to the same method. When mocking a method the default behavior is to always return the same result.

In this post, I will show how you can mock multiple calls to the same method with the mocking frameworks [FakeItEasy](https://fakeiteasy.github.io/), [Moq](https://github.com/moq/moq4) and [NSubstitute](http://nsubstitute.github.io/).

[Continue Reading...](https://www.matheus.ro/2018/03/26/mock-multiple-calls-to-the-same-method-with-fakeiteasy-moq-and-nsubstitute/)
TIL: Reduce breakpoints in Bootstrap4
Tags: scss, bootstrap, css, todayilearned
Published: 2018-03-26 11:23:43

---
title: TIL: Reduce breakpoints in Bootstrap4
published: true
description: 
tags: scss,bootstrap,css,todayilearned
---

Bootstrap4 has 5 breakpoints (xs, sm, md, lg, xl) by default.

But it's so hard that to control all breakpoints.

I found it can reduce this to 2 breakpoints with [Grid tires](https://getbootstrap.com/docs/4.0/layout/grid/#grid-tiers) customize.

```scss

$grid-breakpoints: (
  xs: 0,
  sm: 576px,
  md: 576px,
  lg: 992px,
  xl: 992px
);

$container-max-widths: (
  sm: 540px,
  md: 540px,
  lg: 960px,
  xl: 960px
);

@import "bootstrap";
```
My first asciinema
Tags: terminalrecording, repl, asciinema, picolispbasics
Published: 2018-03-26 10:32:17

---
title: My first asciinema
published: true
description: Someone recommended asciinema and it looked nice so I tried it. 
tags: terminal recording, REPL, asciinema, picolisp basics
---

Earlier today I found out about an alternative to screen recording, asciinema. 

It was quite easy to install under Debian by grabbing the package python3-pip and and using it for fetching the application. 

```
$ sudo apt-get install python3-pip
...
$ pip3 install asciinema
```

It's about 20 minutes back and forth in the REPL showing how to reach text files and the shell commands. 

[Here's the recording](https://asciinema.org/a/oEnczUEDjkkVRM0z5yzggFIPc).