teleren/devto huggingface dataset:
How to make Jenkins do the heavy lifting 
Tags: jenkins, devops, automation
Published: 2020-06-29 16:17:27

---
canonical_url: https://www.jamalx31.com/tech-posts/how-to-make-jenkins-do-the-heavy-lifting
---

Hi everyone 👋🏼 I'm [@jamalx31](https://twitter.com/jamalx31), a JS full-stack developer. This is my first post here, I've decided to start sharing what I've learned while working with different startups throughout my career. I mainly focus on React, React Native.

In this post, I will share how to really take advantage of [Jenkins](https://www.jenkins.io/) to automate the most time-consuming part of any mobile app development process. 

The usual/hard way to configure Jenkins is to create projects manually, maybe one for staging, one for production, etc. The easier way, which I will be showing here is by using a Pipeline.

All your Jenkins configuration will be in one simple file that lives alongside your source code means it will be easier to change and maintain and you won't have to go to Jenkins to change your settings every time you change your code.

# Flow
I've been working with a startup on 2 React Native apps for the past 2 years and here's our development process:
1. implement a new feature or fix a bug
2. commit changes to the Staging branch 
3. Jenkins will be notified thanks to Github webhooks
4. Jenkins sends a slack message to confirm and a new build starts
5. Jenkins fetches the app repo, builds, uploads to [App Center](https://appcenter.ms/), and then sends a final message to slack with download links so everyone in the team can install the new staging version and test it.

The same flow happens when we merge the changes into the master branch except for this time Jenkins treats the build as a production build. So steps 1,2,3,4 will be the same but then:
5 - Jenkins runs [Wix/Detox](https://github.com/wix/Detox) e2e testing
6 - Jenkins starts a production build.
7 - upload a new release to both App Store and Play Store
8 - add a release tag on Github to track version number
9 - Send tests report back to slack with download links

here's how it looks like in slack
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/bvkn2wbmhd5eaox84wk6.png)


As you can see the only action required from the developer side is just to push changes to GitHub and Jenkins will take care of the rest ✌️ 

# JenkinsFile
Now let's see how to we tell Jenkins to do all of this. In one word JenkinsFile, and in code: 
{% gist https://gist.github.com/jamalx31/345fe46f9f582a5433d358bc8a612962 %}

# Where to go from here?
Here, we are just scratching the surface. Of course, to make this fully work you need to do a one-time Jenkins configuration to add your API keys, install some plugins like slack, and maybe add Groovy function to your Jenkinsfile to customize things.

I also want to cover more specific topics for React Native and how to automate e2e testing, especially when you want to test 2 separate apps that communicate with each other.

Please let me know down in the comments which part I should focus on next. See you in the next post! 🚀
My first post is just simply...the PerfBytes Podcast.
Tags: podcast, webperf, perfmatters, beer
Published: 2020-06-29 16:07:03

In 2012 we started the PerfBytes Podcast and it's grown up to be more of a community of support for learning about performance engineering and testing. 

You can find our main podcast on Spreaker: https://www.spreaker.com/user/perfbytes

Or visit us on our website at https://perfbytes.com
Road to Genius: advanced #34
Tags: javascript, beginners, computerscience, codenewbie
Published: 2020-06-29 15:54:06

Each day I solve several coding challenges and puzzles from Codr's ranked mode. The goal is to reach genius rank, along the way I explain how I solve them. You do not need any programming background to get started, and you will learn a ton of new and interesting things as you go.

![coding challenge](https://dev-to-uploads.s3.amazonaws.com/i/08s14vvwrxd402y8ctap.png)

In this challenge we need to figure out `A`'s value, which is the output of an unknown function `LGC` that takes an array of numbers as single argument.

From the first line we notice that this function is only interested in unique numbers (no duplicates), because it converts the array into a set:
```JS
nums = new Set(nums)
```

Then it iterates over each item in the set using the `forEach` method, where `x` is the number.

It checks if `nums` contains `x-1`, if it doesn't then it sets `y=x+1`. Next there's a while loop that iterates as long as `nums` contains `y`, it then increments `y` by 1. Finally it sets `max`:
```JS
max = Math.max(max, y-x)
```

You can solve this problem in two ways, either you work it out on paper/spreadsheet for each number. This is a doable method because you only need to iterate 6 numbers, so it'll only take you a minute or two.

But what if this array contained 50 random numbers, then you'll need a smarter approach. The trick is to figure out what this algorithm is doing first.

Here are a few things that I notice: we have variables `x` and `y`, where `x` remains static, but `y` is being incremented by 1. It looks like `x` is a starting point and `y` the end point.

Then we have the line:
```JS
max = Math.max(max, y-x)
```
This keeps track of the max distance from `x` to `y` across all numbers of `nums`. Notice that the while-loop's condition is to increase `y` by 1 as long as `nums` contains `y`. Apparently this algorithm is designed to find the max length/distance of consecutive numbers in `nums`.

Example: `nums = [1,2,6,7,8,9]`
The largest length of consecutive numbers is 4 (`6 -> 9`).

Back to our challenge, the max length is 2, the only longest consecutive sequence is `1 -> 2`.

![coding challenge answer](https://dev-to-uploads.s3.amazonaws.com/i/enjywpzagitcz7xppsmy.png)

Notice that this algorithm doesn't require the input array (nums) to be sorted, because if it was sorted the algorithm could've been written differently and simpler.

By solving these challenges you train yourself to be a better programmer. You'll learn newer and better ways of analyzing, debugging and improving code. As a result you'll be more productive and valuable in business. Join me on the Road to Genius and upgrade your programming skills, at https://nevolin.be/codr/
#026 What is Kubernetes
Tags: kubernetes, devops, tutorial
Published: 2020-06-29 16:03:58

# Introduction

this is part 26 from the journey it's a long journey(360 day) so go please check previous parts , and if you need to walk in the journey with me please make sure to follow because I may post more than once in 1 Day but surely I will post daily at least one 😍.

And I will cover lot of tools as we move on.
***
# Motivation 
![orchestra](https://wpmedia.garritan.com/wp-content/uploads/2019/03/Francesco-Marchetti-700.jpg)
we learned how to use docker run, then we see docker-compose up. And we convert all our work to an docker-compose.yml.
And later we see that containers should not be run directly. We should use a container scheduler.
***
# What is Kubernetes

![kuber](https://dev-to-uploads.s3.amazonaws.com/i/o22ysmvw761mcbb9rlce.jpeg)

Kubernetes is an open-source container-orchestration system for automating application deployment, scaling, and management. It was originally designed by Google and is now maintained by the Cloud Native Computing Foundation. -- [source](https://kubernetes.io/docs/concepts/overview/what-is-kubernetes/)
***
# Why Kubernetes

1. Control communication between containers
2. Scaling of the software so if the number of requests increase , I can replication or scale the entire app or just a specific container
3. Monitor of containers
4. High availability of servers , so if A server down , I can make sure that another server is On.
5. That's not all we are going to explain later , Also I like to mention it's impossible to cover all the details in every tool because it came with practice and work in real world example , but I will make sure that we gain the necessary knowledge of every tool :)

***
# Advice
I highly recommend [this series](https://dev.to/aurelievache/kubernetes-sketchnotes-pods-4ib0) it's a sketch note based series , go and check it :)
A Dinosaur Rest API with Dactyl and denoDB
Tags: deno, nestjs, node, tutorial
Published: 2020-06-29 15:51:28

In this video, I try out deno by creating a simple REST API with database crud operations using the Dactyl web framework as well as the denodb library. Dactyl aims to be the NestJS of deno and built on top of Oak.

{% youtube feNNPKHCYFg %}

## Included in video
- Creating a deno project from scratch
- Adding a custom tsconfig for deno
- Dependency management with file architecture
- Connecting to a postgres database with denodb
- Serving api endpoints with dactyl

## Resource Links
- [Source code](https://github.com/kelvin-mai/deno-dactyl-example)
- [deno](https://deno.land/)
- [Dactyl Framework](https://deno.land/x/dactyl)
- [denoDB](https://eveningkid.github.io/denodb-docs/)

## Follow and support me
- [YouTube](https://www.youtube.com/c/kelvinmai)
- [Twitter](https://twitter.com/kelvinmai)
Github Package Registry
Tags: github, webdev, productivity, tech
Published: 2020-06-29 15:50:43

Github has created their own package registry option. It is compatible with JavaScript, Java, Ruby, .NET, and Docker.

Of course, people are wondering if this means that they're trying to compete with NPM and other public registries like RubyGems.

Github has stated that they're not trying to do that, but the purpose is basically threefold:

1) You can now easily generate packages from your Github repo (admittedly this was already the case, but it's a bit simpler now) and then post them to something like NPM.

2) Organizations can now create simple private package registries for internal code. This means that you can easily take code from a private Github repo (or another source if you want) and add it to a private registry on Github, and your organization can install packages from there for internal application usage. This lets you do things like publish all of your custom UI widgets to Github privately, and other teams in your org can use them in their apps, and everything stays private.

3) Organizations can now publish things like pre-release versions of packages before publishing them to public package managers like NPM.

It seems at the current time that these features on Github will be mostly used by larger organizations or special use cases, but it'll be interesting to see where this leads.

Happy coding!

Signup for my newsletter [here](https://thinkster.io/?previewmodal=signup?utm_source=devto&utm_medium=blog&utm_term=githubpackageregistry&utm_content=&utm_campaign=blog).

Visit Us: [thinkster.io](https://thinkster.io?utm_source=devto&utm_medium=blog&utm_term=githubpackageregistry&utm_content=&utm_campaign=blog) | Facebook: @gothinkster | Twitter: @GoThinkster
⚡️No Time for Learning or Coding? JSNation 2020 | Eleftheria Batsou
Tags: talk, conference, motivation, productivity
Published: 2020-06-29 15:42:11

⬇️In this lightning talk (When you think there is no time for learning or coding) we will talk about: 
a) How I got into coding and how you can do it too
b) How to build habits to be a better coder
c) How to find time to code.study and learn!


Conference: [JSNation](https://live.jsnation.com)
Where: Online
When: 18 and 19 June 2020



Original [video](https://youtu.be/YAL0L6POSVU) | 
JSNation's [Twitter](https://twitter.com/thejsnation) | 
JSNation's [Youtube](https://www.youtube.com/JSNation) 

~ Thank you for the invitation and the beautiful organization~
~ Thanks everyone for watching 💓 ~

************************************

👋Hello, I' m Eleftheria, an app developer, master student, public speaker, and chocolate lover.

🍩Would you care about buying me a coffee? You can do it here: [paypal.me/eleftheriabatsou](paypal.me/eleftheriabatsou) but If you can't that's ok too!

**************************************

🙏It would be nice to subscribe to my [Youtube](https://www.youtube.com/c/EleftheriaBatsou) channel. It’s free and it helps to create more content.

🌈[Youtube](https://www.youtube.com/c/EleftheriaBatsou) | [Codepen](https://codepen.io/EleftheriaBatsou) | [GitHub](https://github.com/EleftheriaBatsou) | [Twitter](https://twitter.com/BatsouElef) | [Site](http://eleftheriabatsou.com/) | [Instagram](https://www.instagram.com/elefintech)
Programmer's first principles
Tags: firstprinciples, foundations
Published: 2020-06-29 15:40:18

[Original article](https://borislav.netlify.app/articles/pfp/)

Our job as developers is to **solve problems**. It's the programmer's axiom.

Thus everything we do that contributes to the realization of this goal is good (productive). Everything that contradicts and interferes with it - is bad (unproductive). At the end of the day we must ship solutions.

A fair question that arises is: How do we do this?

**By observing objective truths from the reality in regards of your specific case and then implementing as much of the productive things (for that specific case) in your process as possible.**

And how do we know if something is productive or not? Based on reasoning. In order to reason about something, one should have a solid foundation on top of which to build up and take logical decisions.

Here are some of the solid foundations that I use as a guiding light in my practice as a developer (and some of those to some extend as a human being in my life).

1. Simplicity over complexity. Always.
2. Automation over manual work - if machine can do it, it must do it.
3. If writing code can be avoided, avoid it. Remember the programmer's axiom - solve problems. It's not "write code".
4. Single point of failure is always preferable.
5. Remove what's not needed. It rots.
6. Duplicating code IS OK. Duplicating knowledge in separate modules IS NOT.
7. If it can be reused, reuse it. (Note: keep in mind simplicity)
8. Name things properly.
9. Do not succumb to the falacy that "there's no right or wrong approach". NO! There is! There always is. This fallacy is just an excuse. You should be aware of this and not allow it to influence your decisions.
10. No one knows better than you. Do not accept authorities telling you what's right and what's wrong. Figure it out yourself. Do not make the mistake to hand over your responsibility to some vague, anonymized authority. Make sure that the decisions you make (in your code and in life in general) are closed for the opportunity to blame others. You are the responsible one and you should be proud of it. That's what makes you a rational being.

Share some of the truths that guide YOU in your day-to-day problem-solving career.
Hi everyone today I wrote my first medium post on "Machine Learning Model Deployment using Flask".
Published: 2020-06-29 15:37:56

please have a look and if possible share your valuable feedback and opinion about it. 
https://medium.com/@bharatchoudhary817/deployment-of-machine-learning-project-using-flask-bf6e5a750319
#datascience #machinelearning #apis #flask #python
API versioning in golang ECHO
Tags: go, api, rest, version
Published: 2020-06-29 15:34:07

```golang
package main

import (
    "net/http"

    "github.com/labstack/echo"
)

func main() {
    e := echo.New() 

    v1 := e.Group("/v1")
    groupV1Routes(v1)
    
    v2 := e.Group("/v2")
    groupv2Routes(v2)

    e.Logger.Fatal(e.Start(":8090"))
}

func groupV1Routes(e *echo.Group) {
    grA := e.Group("/groupa")
    grA.GET("/event", handlerGet1)
    
    grB := e.Group("/groupb")
    grB.PATCH("/:id", handlerPost)
}

func groupv2Routes(e *echo.Group) {
    grA := e.Group("/groupa")   
    grA.GET("/event", handlerGet2)
    
}

func handlerGet1(c echo.Context) error {
    return c.String(http.StatusOK, "THIS IS VERSION 1!")
}

func handlerGet2(c echo.Context) error {
    return c.String(http.StatusOK, "THIS IS VERSION TWO")
}

func handlerPost(c echo.Context) error {
    return c.String(http.StatusOK, c.Param("id"))
}
```
How to create piconet in android?
Tags: android, java, bluetooth, piconet
Published: 2020-06-29 15:27:44


I am writing this blog because I found it quite to difficult to find any resource to create a piconet for android devices.

## What is a piconet?

A piconet is a Bluetooth ad-hoc network. It can consist of one master device and a maximum of seven slave devices.

## TL;DR

We will create a class named Piconet. It will have the required methods needed to connect multiple devices. For this, we will need a UUID (There are many online UUID generators available online).

## How will the device connect?

For the devices to connect the app needs to be running on all the devices. Since the Bluetooth socket needs to be open on all the devices.

Once the app is running we will click the discover button so that all the paired devices are listed on the drop-down list. from the drop-down list we can select a mobile Bluetooth device to connect. Once the devices are connected then it will show a toast and we can send "Hello World" text to the other Bluetooth devices.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/52nmkemxe6219m6n4q0m.jpg)

The Bluetooth device that starts the connection is the master Bluetooth device. It can connect up to a maximum of 7 devices (Theoretical limit. Practical limitations depends on the hardware). If the send message button is clicked on the master device then it will broadcast the message. But it is not same for the slave devices when the send message button is pressed on the slave devices then it will send the text messages only to the master device.

The code for this blog is in this [Github Repo](https://github.com/mritunjaysaha/-Blog-Piconet)
What tools and flows do you use to organize your life
Tags: discuss
Published: 2020-06-29 15:17:50

Hey!

What flow do you use to organize your life? For me, I use a combo of tools `Todoist + Notion`.

At Notion I use the following flow:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/k1bt63l0iafjmm6gpqqv.png)

---

At Todoist I use the following flow:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/1ona6k8km779f0mnme5k.png)

---

Let's share our experiences with organizing life tools and how they work for us.
Hardening Server Security By Implementing Security Headers
Tags: security, devops, tutorial
Published: 2020-06-29 15:17:10

Most of the security vulnerabilities can be corrected by implementing specific headers in the server response header. HTTP security headers present yet another tier of security by helping to mitigate intrusions and security vulnerabilities.
We will examine some of them to help you better know their purpose and how to implement them.
##What are HTTP security headers?
Whenever a browser requests a page from any web server, the server responds with the content along with HTTP response headers. These HTTP security headers tell the browser how to behave while handling the website content.

###Content Security Policy
The Content Security Policy header implements an additional layer of security. This policy helps prevent attacks such as Cross-Site Scripting (XSS) and other code injection attacks by limiting content sources that are approved and thus permitting the browser to load them.
###X-Frame-Options
The X-Frame-Options HTTP response header is used to indicate if a browser is permitted to execute a page in a “frame”, “iframe” or “object” HTML tag. Sites and applications can use this to dodge clickjacking attacks, by ensuring their content cannot be embedded into other sites.
###X-XSS-Protection
X-XSS-Protection header is intended to protect against Cross-Site Scripting attacks.
###X-Content-Type-Options
The X-Content-Type-Options header is used to indicate that the MIME types recorded in the Content-Type headers should not be changed. This protects you from MIME type sniffing.
###HTTP Strict Transport Security
A Strict Transport Security header (HSTS) enables the application to inform browsers that it should be only accessed using HTTPS instead of HTTP.
If the website or application allows connection through HTTP before redirecting to HTTPS, visitors can communicate with the non-encrypted version of the site before the redirect which creates an opportunity for man-in-the-middle attacks.
Upon the first interaction with a website, the browser won’t be aware of an HSTS Policy for the host, therefore the initial communication is taking place over HTTP.
To resolve this problem, browsers contain a preloaded list of sites that are configured for strict transport security. HSTS is generally set to a “max-age” value that is high enough to keep the website cached in the HSTS account for the entire duration that is specified.

*A more detailed version with implementation on different servers with graphical representation is published at :* *https://beaglesecurity.com/blog/blogs/2020/06/27/Hardening-server-security-by-implementing-security-headers.html*
WHY JOIN CODERSRANK
Tags: career, codersrank101, jobsearch, remote
Published: 2020-06-29 15:02:40



<a href="bit.ly/2NbSVLS">CodersRank</a> is a platform made to help developers in job-seeking and professional growth. Find a developer job on <a href="bit.ly/2NbSVLS">CodersRank</a>: Your CodersRank profile serves as a proven track record of your coding knowledge. Just connect your private and public repositories to generate your true profile.

If you are looking for a #remote 🌴 developer job, check this out:

<a href="bit.ly/2NbSVLS">CodersRank</a> can help you get matched with a relevant job: just add your job preferences to your profile! 👨‍💻👩‍💻

Login/register here: <a href="bit.ly/2NbSVLS">Coders Rank</a>
#codersrank101 #jobsearch #remote


#codersrank101: The more info you provide on your profile, the better your chances of finding your dream job! 💼

Add YOUR Tech Stack today! <a href="bit.ly/2NbSVLS">Add Your Stack</a>

Create your always up-to-date 360-degree coder profile and let your work speak for itself!
Join CodersRank now!  <a href="bit.ly/2NbSVLS">Coders Rank</a>
Top 5 Books Each Programmer Must Read During Their Entire Life. Part 4
Tags: webdev, books
Published: 2020-06-29 14:47:50

“Clean Code” by Robert C. Martin.

The main idea of this book is make a [developer](https://websailors.pro/) follow the principle of “Leave the code cleaner than you found it”.

This relatively big book of over 300 pages describes the problem of writing the so-called “Clean Code”. It is written very involving, so reading it will take only several days, but the effect will last for life.

The book is rich of clear theoretical statements and code examples. The principles of developing a clean and qualitative code described by the author can be easily applied on practice, making a significant addition to the knowledge obtained from other books. The reason is that the book contains many practical advices for code improvement, as well as technique for assessment of quality of libraries and apps.

The book has several parts that describe both the beginning of professional programmer’s path (techniques, patterns, general principles) and its peak — debugging the existing code, and developing new software.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/8ib1l869xlrspx5tl3ue.png)

We also would like to mention the paragraph about multi-threaded applications, which is not common for that type of books.

From the programmer’s point of view, this book’s context is its orientation towards Java software. It has examples of software in this language, as well as signs of both “clean” and “dirty” code. 

That makes it somewhat difficult for those unfamiliar with this language but does not depreciate the benefit of reading it.

Stay tuned! In the Next and Final Part of this Series of Articles, we at [WebSailors] (https://websailors.pro/) will tell you about the last book in our Top 5 — “The Art of Computer Programming” by Donald E. Knuth.



Source - https://websailors.pro/