teleren/devto huggingface dataset:
Send slack messages with Java in 5 minutes
Tags: opensource, java, devops, slack
Published: 2019-06-20 22:43:56


## Introduction

In this tutorial, we will see how easy it is to send messages to a Slack channel in our Java application with [jslack framework](https://github.com/seratch/jslack).

## jSlack

jSlack is a Java library to easily integrate your operations with Slack. This library supports all the APIs listed in [Slack platform features and APIs](https://github.com/slackapi/slack-api-specs).


## Incoming Webhook with Slack

Webhook is a simple way to post messages from external sources into Slack via ordinary HTTP requests. See the Slack [Incoming Webhooks guide](https://api.slack.com/incoming-webhooks) for more details. 
 
## Getting started

### Getting the Webhook URL

The first thing we need to do is find out from Slack the correct URL it will use to post the messages.

- Go to https://YOUR_ALIAS_TEAM.slack.com/apps/manage/custom-integrations 

- Choose the **Incoming WebHooks** option.

- Access **Add configuration** and choose the channel to which you want to send messages and then **Add Incoming WebHooks Integration**.

- Slack gives you the URL to which you will be posting your messages. 
Similar to this: https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXX


### Create Demo App 

Go to https://start.spring.io/ and create a demo app with the **Web** dependency.

Import application in your IDE and follow steps below:

1 - Edit `application.properties` file.

```
server.servlet.context-path=/
slack.webhook=https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXX
```

2 - Edit `pom.xml` file and add jslack:
```xml
<dependency>
	<groupId>com.github.seratch</groupId>
	<artifactId>jslack</artifactId>
	<version>1.5.6</version>
</dependency>
```

3 - Add controller and service classes:

**Controller**
![controller](https://thepracticaldev.s3.amazonaws.com/i/b4jurbz3tsu4pfr8g22l.png)


**Service**
![service](https://thepracticaldev.s3.amazonaws.com/i/cg4qxe3lk2xiakz0dfq2.png)


### Run Demo App

- Start demo app just running a main class.

- Using any rest client, make the POST request:
   `http://localhost:8080/apps/my simple message here`

![request](https://thepracticaldev.s3.amazonaws.com/i/cqq6wqcz1jriwnc7eihp.png)


And Wow! Your message exposed in slack.

![slack_result](https://thepracticaldev.s3.amazonaws.com/i/re7kjogyxc4cmclk3hi5.png)

## Conclusion

In this post, we can see how its works slack webhook integration implemented in Spring Boot 2 with jslack. This framework also provides support to real-time Messaging API, events API, among other resources.

## Sources

{% github silviobuss/demo-jslack %}
Video: web architecture & streaming GraphQL
Tags: webdev, javascript, graphql, docker
Published: 2019-06-20 21:24:37

{% vimeo 324135436 %}

In this video, Rob Richard (Senior Director, Front-end Engineering) discusses the @defer directive in GraphQL (starts at 36:20) and Tim Whidden (VP, Engineering) discuss 1stdibs’s front-end architecture and how to mock it in development.

The talk took place in Vilnius, Lithuania on March 14th, 2019.

Find links to the slides below:
* [1stdibs’s Front-End Architecture](https://docs.google.com/presentation/d/1myEI-VVUUTpVy2D6_-sFW9so6n31jiAxJ_g7wbR7CZk/edit?usp=sharing)
* [Streaming HTTP and GraphQL](https://robrichard.net/jskongress-2019/)
Why do you teach?
Tags: discuss, javascript, beginners
Published: 2019-06-20 18:49:25

---
title: Why do you teach?
published: true
tags: discuss, javascript, beginners
---

This tweet from Ali Spittel stood out to me:

{% twitter  1141534634561458179 %}

I'm curious, if you're a teacher: why do you teach? What's the **real reason** behind that? For me it's not money.

I teach for almost the same reasons of Ali. I feel joy and pleasure when my students grab some hard concepts because of the way I explain them. 

I want to make the field more inclusive, empowering people to learn how to code and make their own projects. I failed a lot of technical interviews, I felt the pain, and I want to change things. The way I can do that is by teaching people and helping to demistify programming, jargon, and technology.

Also I've an addiction to learning. I need to feed my brain every single day with new stuff. And then I need to write, create tutorials, teach other people what I've learned. I can't seem to stop.

And you? Why do you teach?
Explicit Joins in SQLAlchemy
Tags: sqlalchemy, python, codinginenglish
Published: 2019-06-20 21:21:54

---
title: Explicit Joins in SQLAlchemy
published: true
description: 
tags: sqlalchemy, python, coding_in_english
---


Explicit joins in SQLAlchemy! What this means is that we are _showing_ what the join conditions are _within the ORM query itself_, rather than built into your model classes.

Here's the ORM query with explicit joins:

```python
    join_results = (
        db.session.query(TableA).filter_by(table_a_col=some_var)
            .join(TableB, TableB.table_a_id == TableA.id)
            .all()
    )
```
4 Aliases I Always Put on .zshrc/.bashrc
Tags: mac, ubuntu, productivity
Published: 2019-06-20 20:51:58

I'm using a couple of machines, Mac, Ubuntu, and Raspberry Pis and all of them have at least 3 aliases. In addition, basically, I use zsh since I love oh-my-zsh.


If you are not familiar with alias, this post will be useful.
https://wpshout.com/quick-guides/make-bash-alias/


#### My .zshrc/.bashrc have followings.

## reload
Sometimes I change settings, but I don't want to type source blah blah blah.
```zsh
alias reload="source ~/.zshrc"
```

## h
I use this heavily, especially to check ssh destination lol
```zsh
alias h="history"
```


## cl
Love to keep my iTerm screen clean as much as possible
```zsh
alias cl="clear"
```


## p
Sometimes I do typo like `pyhton` or `pythoo`, so this is to run my python scripts smoothly.
```zsh
alias p="python"
```


I also put aliases for my python virtual env since I'm lazy.
For Ubuntu and Raspberry Pis have `open` which Mac uses.
How should I go about setting myself up for my "dream job" at Mozilla?
Tags: help, rust, career
Published: 2019-06-20 17:46:02

###**Background/Lead Up**

I've got about 1.5 years left at university, so I wouldn't be applying for a position for a bit anyways, but I figure it'd be better to prepare for my dream job now rather than when I graduate.

I've been doing some research about working at Mozilla, I've come across some hacker news and quora threads about it, that seems to confirm that working there could likely be a dream job of mine. 

What I'm not sure about is how I need to go about planning for and getting the kind of job that I want. I'd love to work with either Firefox, Servo, or Rust directly, but I'm not sure which location to look for on the listings page or if it doesn't matter too much? It also seems that they're really good with remote work.

I'm working on getting my bachelor's degree in computer science right now, and have been considering going for my masters as well, especially if it'd help me get a foot in the door. 

I'm trying to learn Rust in my free time, and so far it's my favorite language, which is one of the things that got me looking into Mozilla (and yes, I know there's other places that use Rust, but I really like the feeling of altruism that Mozilla puts off). 

I've been chipping away at the Rust track on [exercism.io](https://exercism.io/tracks/rust), [reading the documentation](https://doc.rust-lang.org/book/index.html), and [the book published by O'Reilly](http://shop.oreilly.com/product/0636920040385.do), as well as trying out a few personal projects with it.

Once I feel confident with the language, I've got some open source projects that I am keen on contributing to, like Smithay (see below), that look fun and would also give some stuff I can show my abilities with. I could probably also start trying to contribute to Firefox, Servo, and Rust to get more familiar with the projects and improve my skills.

{% github Smithay/smithay %}

###**TL;DR**

- Working at Mozilla might be my "Dream Job" from what I've read on internet comments
- Want to work on Firefox, Servo, or Rust itself (could probably start now since they're open source?)
- I'm getting my bachelor's in CS soon, and maybe masters if it'd help, plus the classes look pretty fun
- Learning Rust in free time and trying to get into contributing to OSS as well

###**Actual Questions**

1. Do only certain offices work on the projects I want to do? (Like, is San Fransisco the main place for the projects I want to work on, or would it be likely that I could get in fresh out of college for a remote job on one of those projects?)

2. Is everything I'm doing/planning to do necessary for getting a job at Mozilla?

3. What else do I need to be doing?
Angular 9|8 Component Lifecycle Hooks
Tags: angular, angular98, angularcomponentlifecyclehooks
Published: 2020-02-01 19:41:14

---
title: Angular 9|8 Component Lifecycle Hooks
published: true
tags: Angular , Angular 9|8, Angular Component Lifecycle Hooks
canonical_url: https://www.positronx.io/angular-8-component-lifecycle-hooks/
---

The post [Angular 8 Component Lifecycle Hooks](https://www.positronx.io/angular-8-component-lifecycle-hooks/) appeared first on [positronX.io](https://www.positronx.io).

Today we are going to look at **Angular 8 Component Lifecycle Hooks** with real-world examples. A component in Angular has a lifecycle, and Angular 8 offers us Hooks. Hooks allow us to trigger actions by getting into the lifecycle of the components.
## What is Lifecycle Hook in Angular?

[Click here to read more](https://www.positronx.io/angular-8-component-lifecycle-hooks/)
Hylia - build a static site with built-in CMS
Tags: netlify, 11ty, blog, staticsite
Published: 2019-06-20 18:39:23

---
title: Hylia - build a static site with built-in CMS
published: true
description: Andy Bell has created a static site using 11ty and Netlify
tags: netlify, 11ty, blog, static-site
---

[Hylia](https://twitter.com/andybelldesign/status/1141633780408606720 ) is a new "static site" which you generate via [11ty](https://www.11ty.io/) and host on [Netlify](https://www.netlify.com/). You can create blogs, personal sites, or fansites for your own special topics. It was created to help you break free from Medium, Wordpress, and other sites by [Andy Bell](https://twitter.com/andybelldesign)

Check out the tweet above, and [visit the site](https://hylia.website/).
Here's the [Github Repo](https://github.com/andybelldesign/hylia). 

Make sure you check out the [Youtube video](https://www.youtube.com/watch?v=0hM_0BH-Y_A) to see how to get the CMS integrated. There's even a [style guide](https://hylia.website/styleguide/).
Cloud Build Dependency Graph
Tags: visualization, cloudbuild, gcp
Published: 2019-07-03 19:07:26

---
title: Cloud Build Dependency Graph
published: true
tags: Visualization,Cloud Build, GCP
canonical_url: http://thagomizer.com/blog/2019/06/14/cloud-build-dependencies.html
---

A couple of months ago, my coworker [Mark Mandel](https://twitter.com/Neurotic) asked if anyone had a way of visualizing dependencies in [Cloud Build](https://cloud.google.com/cloud-build/). As you’d expect, several of us jumped at the problem. I wrote my solution up in Ruby using the graph gem.

Cloud Build configuration files are in yaml. Each build step lists the container to run and some configuration options like arguments to pass and directories to use. Each step also has a `waitFor` field to specify dependencies between the steps. This is all the information you need to parse and understand to build the dependency graph.

Since I’d used it before I started with [Zenspider’s `graph` gem](https://github.com/seattlerb/graph). The graph gem uses a DSL to output the [`dot`](https://en.wikipedia.org/wiki/DOT_(graph_description_language)) file format used by Graphviz. Using the graph gem, you define edges with the syntax `edge "A", "B"`. An edge is just an arrow. In this case, the arrow is between A and B. If either A or B doesn’t exist yet, the gem automatically adds it.

The DSL makes creating the dependency graph pretty straightforward. All I had to do was parse the build config file and then use the `waitFor` field to draw edges between dependent steps. To make the graph easy to read, I chose to use the ID as the node label. If there was no ID field, I used the name. The only tricky bit is that Cloud Build config files don’t have to state all their dependencies using `waitFor`. If no dependency is given for a step, it is assumed to depend on all previous steps. This meant I had to keep track of the previous steps to get the edges correct. Putting it all together resulted in this code:


```
require 'graph'
require 'psych'

steps = Psych.load(File.read(ARGV[0]))["steps"]

previous_steps = []

digraph do
  steps.each do |step|
    id = step["id"] || step["name"]

    deps = step["waitFor"] || previous_steps
    deps.each do |dep|
      break if dep == "-"
      edge dep, id
    end

    previous_steps << id

  end

  save "buildgraph", "png"

end
```
[Gist here](https://gist.github.com/thagomizer/5bf613022e323a5134d22a4e4e8f026d)

Running that code against the build file Mark shared with the team leads to this dependency graph:

![Agones Build Dependencies](http://thagomizer.com/img/buildgraph.png)

All told it took about 30 minutes at hack night to code this up. Most of that time was reading about the Cloud Build configuration file format. If you’re curious, the dependency graph shown above is for [Agones](https://agones.dev/site/) an open source game server scaling and orchestration platform built on top of Kubernetes.
Learning Node.js - Recommendations?
Tags: discuss, node
Published: 2019-06-20 18:29:04

---
title: Learning Node.js - Recommendations?
published: true
tags: discuss, node.js
---

I'm interested in learning Node.js and am wondering if there are any recommendations for online resources?  I'm particularly interested in something engaging (practice problems and reviewed solutions) such as the courses offered on udemy. 

Does anyone have any recommendations on material that they found to be beneficial? There is so much content out there - looking for some personal insight before I go down the Google rabbit hole. 🐰

Thanks in advance!
Web Workers - Introduction
Tags: javascript, typescript, webworkers, webdev
Published: 2019-06-20 17:57:23

Some [pre-reading](https://dassur.ma/things/when-workers/) if you wish!

After reading the above post I started thinking more about web workers. Why are more people not talking about them. So many people seem to be worried about performance, so why is the worker discussion not more prevalent?

The [MDN Docs](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) for workers are quite extensive, discussing every aspect from API Specs to usage.

My initial reasoning for not using them was that I did not think that there really was a need for them. Second, the initialization methodology
```typescript
const worker = new Worker('/path/to/worker.js')
```
does not jive nicely with a full TypeScript environment. To use the base call method, you would need to create a separate `worker.ts` file to transpile over, and it would need to be in the correct location for the final application (which may be quite different from where app src is). I found this frustrating, so I decided at the time to not bother with them.

Then I saw [this post](https://dassur.ma/things/when-workers/) from Surma, and I started thinking more about them again. With a data vis dashboard as our primary app, we could definitely benefit from moving calculations from the main thread into a worker.

So I started looking through some of the worker wrappers mentioned the above post ([Comlink](https://github.com/GoogleChromeLabs/comlink) & [Workerize](https://github.com/developit/workerize)). I started with workerize, then quickly decided I wanted a more in depth approach with multiple methods, so I settled on using Comlink! Using webpack, I also found [webpack worker-loader](https://github.com/webpack-contrib/worker-loader).

Comlink does a good job at making you feel like working with your worker is working with a class. Methods are easy to use, and setup is pretty straight forward! If you are on the fence about adding workers to your app, I would suggest taking a look at Comlink, it makes the process of using a worker way easier, and pairing it with worker-loader takes the awkwardness of defining things as workers away.

The next post in the Workers series will be about my implementation!
CLI Starter says Hello World!
Tags: cli, node, boilerplate, javascript
Published: 2019-06-20 17:52:09

---
title: CLI Starter says Hello World!
published: true
description: 
tags: #CLI #Node.js #boilerplate #JavaScript
---

To the community,

Hi there! This short message to let you know _[cli-starter](https://github.com/Drozerah/cli-starter)_ boilerplate is born this sunny day! 

This material comes with the minimum settings and files that are required to start the creation of a new CLI utility with a Node.js and NPM environment...

Give it a try!

__Structure__
```
├───bin/
│   └───cli.js
├───.gitignore
├───licence
├───package-lock.json
├───package.json
└───README.md
```
__Install__

```bash
$ git clone https://github.com/Drozerah/cli-starter.git
```
Then install globally: 
```bash
$ npm install -g
```
Once you are done with this step, you need to:

```bash
$ npm link
```
This command will register your CLI project locally so you are now able to run the command below anywhere into the terminal:

```bash
$ cli-starter
```
This command will prompt a message into the terminal meaning that everything is fine with the installation of _[cli-starter](https://github.com/Drozerah/cli-starter)_:

![cli starter](https://raw.githubusercontent.com/Drozerah/MyGitHubStorage/master/gif/cli-starter/cli-starter.gif)

That's it!

Next step? 

Fork it & Be creative!

Thanks for reading!

See you next time!

Drozerah
Does the Discussion Around Diversity & Inclusion in Tech Include Age?
Tags: inclusion, diversity, career, discuss
Published: 2019-06-20 17:17:28

---
title: Does the Discussion Around Diversity & Inclusion in Tech Include Age?
published: true
description: 
tags: inclusion, diversity, career, discuss
---
I follow quite a few developers and tech people on Twitter, many of whom champion the causes of inclusion, diversity, and representation when it comes to gender, sexuality, race, and disabilities in Tech. But I don’t often hear or see much discussion around the subject of age in Tech, especially when it comes to “older” workers from the Baby Boomers and Gen X generations. I became curious as to why worker age seems to take a back seat to the other, more prominent, categories.

Earlier this month, the New York Times published an article by Patrica Cohen on age bias across all of working America and the challenges older workers face in finding employment or bouncing back from job loss: https://nyti.ms/31eZlQa. The challenges and biases for older workers who are unemployed are many and discouraging. After reading the article, and the resulting comments, one might agree that ageism is, as one commenter puts it, “...at or near the top of our current social issues, and near the bottom of our remediation efforts.” 

As someone who surely meets the definition of the “older worker,” the issue of ageism in development and tech is one of particular interest to me, just over a year into my web development career as of last month. As improbable as it might seem to me, I am now closer to retirement than I am to college graduation back in the early 90's. I don’t plan on retiring anytime soon though. I came to development later than most, but younger than some, and I absolutely love it. It feeds and nourishes the analytical and creative parts of myself at the same time. Hell, this may actually be what I want to do when I grow up! I hope I get that chance, ‘cause I'm not getting any younger. 

So with all that said, I'm curious to know thoughts and feedback on how age is considered when it comes to the discussion around diversity & inclusion in the Tech field/industry. Is age its own category for the discussion? Or is it a modifier for the other categories? Or is it simply outweighed entirely due to the heightened sensitivity of those other categories?  Does the "older" voice have a chance to speak in the discussion around diversity & inclusion?  Can Boomers and Gen X-ers be included in the “underrepresented” moniker if they are considered “too old” to be of value to Tech, regardless of other characteristics?

I know there’s no easy answers for these questions. I certainly don’t have any. I do know that I believe in the cause of diversity and inclusion in all walks of life, but I am unsure if the seasoned, experienced, or older worker is part of that cause and can only be included in the discussion if the worker falls into other underrepresented categories of gender, sexuality, race, or disability. Or am I off base in my curiosity and have missed part of the discussion. What do you think?
Implement an open source backup-restore system.
Tags: bash, python, butterflybackup
Published: 2019-06-20 15:26:10

### Intro

There are multiple open source backup/restore solutions, but almost all have an agent/server approach.

The disadvantage of such an approach is that the consumption of hardware resources exists on both the client and server side.

**rsync**, is a very simple tool with many very useful options. Unfortunately, this utility does not provide a backup/restore method, but only synchronization from point A to point B.

However, a somewhat more complex logic can be implemented on it so that multiple backups can be managed, maintaining a sort of historicity.
At this point, rsync becomes the core of something much more complex.

[Butterfly Backup](https://matteoguadrini.github.io/Butterfly-Backup/) is a rsync wrapper, which increases its capacity, becoming a real backup/restore/archive tool. *Butterfly Backup is a simple command line wrapper of rsync for complex task, written in python.*

In a few simple steps, without repository configurations, particular settings and third-party software or plugins, you can implement an automatic enterprise backup/restore/archive system.

### Deployment

Such as? In four steps:

**1) INSTALLATION**
```bash
git clone https://github.com/MatteoGuadrini/Butterfly-Backup.git
cd Butterfly-Backup
sudo python3 setup.py
```

**2) EDIT LIST OF COMPUTER/SERVER UNDER BACKUP**
```bash
cat << EOF > /mnt/san/bck_list
server01.local
server02
10.0.0.1
192.168.2.42
EOF
```

**3) DEPLOY CONFIG SSH KEY**
```bash
bb config --new
bb config --deploy server01.local
bb config --deploy server02
bb config --deploy 10.0.0.1
bb config --deploy 192.168.2.42
```

**4) SETUP CRONTAB**
```bash
CMDBB="bb backup --list /mnt/san/bck_list --destination /mnt/san --data User Config --type Unix"
echo "00 12 * * * $CMDBB" | crontab -
```

_Et Voilà!_

In 5 minutes, you have implemented an automatic backup system that saves the User folders and configuration folders (`/etc`) of four servers, every 12:00 PM, every day.

All the backups performed can be consulted in a catalog that is easy to read and consult, in this way:
```bash
bb list --catalog /mnt/san
```

### Conclusion
Sometimes the simplest solution is the best possible choice.

For more information on this tool, follow the links below:

WEBSITE: [https://matteoguadrini.github.io/Butterfly-Backup/](https://matteoguadrini.github.io/Butterfly-Backup/)
GITHUB: [https://github.com/MatteoGuadrini/Butterfly-Backup](https://github.com/MatteoGuadrini/Butterfly-Backup)
DOCS: [https://butterfly-backup.readthedocs.io/en/latest/](https://butterfly-backup.readthedocs.io/en/latest/)
Overriding the leading property on Appbar in Flutter 
Tags: flutter, dart
Published: 2019-06-20 16:50:09

---
title: Overriding the leading property on Appbar in Flutter 
published: true
description: How to remove the leading property on Appbar in Flutter
tags: flutter, dart
---



To override or remove the left leading property in Flutter, simply pass a Container() widget as the leading value.

# Example 

![](https://thepracticaldev.s3.amazonaws.com/i/cxd0m5zg9nn095f23k9z.png)