teleren/devto huggingface dataset:
Set your laptop into energy save mode with KDE Plasma manually
Tags: tutorial, linux, bash
Published: 2020-10-06 13:37:48

## Summary

- KDE Plasma often does not detect when I unplug my X1 Extreme Gen 2 (X1E2) recently. I don't know why.

- And I noticed Docker eats up all the battery by the time I wake up if I did not keep it plugged before going to bed.

- So I created a shell script to turn things off so that I can run it manually when I unplugged the AC adapter.

## Script

- The important part is the last bit. That bit seems to make KDE Plasma see the state of AC (So the actual cause would be `upower.service`, not KDE Plasma).

- Your situation would be different from mine so you can just copy everything at first and then add/remove/amend the lines to suit you.

```shell
/usr/local/bin/savebattery
==========
#!/bin/bash

#
# Lower the brightness on monitor
#
echo
echo 2909 > /sys/class/backlight/intel_backlight/brightness
echo -n "Brightness: "; cat /sys/class/backlight/intel_backlight/brightness
echo

#
# Stop and disable the services for Docker
#
systemctl stop docker.service
systemctl disable docker.service
echo
systemctl --no-pager status docker.service | egrep "Loaded:|Active:" | tr -d ' '

systemctl stop docker.socket
systemctl disable docker.socket
echo
systemctl --no-pager status docker.socket | egrep "Loaded:|Active:" | tr -d ' '

echo

#
# Stop and disable the services for Avahi
# - The solution may be "aptitude purge avahi-daemon", but I am disabling it
#   in case I actually need this somehow
#
systemctl stop avahi-daemon.service
systemctl disable avahi-daemon.service
echo
systemctl --no-pager status avahi-daemon.service | egrep "Loaded:|Active:" | tr -d ' '

systemctl stop avahi-daemon.socket
systemctl disable avahi-daemon.socket
echo
systemctl --no-pager status avahi-daemon.socket | egrep "Loaded:|Active:" | tr -d ' '

echo

#
# Disable the network interfaces
#
ip link set docker0 down
ip address | egrep "docker0:"

interface=$(ip address | egrep ": br-" | sed -E 's/^[0-9]: ([^\s:]+).+/\1/')
ip link set $interface down
ip address | egrep ": br-"

echo

#
# Make sure KDE Plasma see AC state properly
#
systemctl restart upower.service
```
🤦‍♂️ Weekly fail (41/2020)
Tags: fail, lessonlearned, node, jamstack
Published: 2020-10-06 13:20:15

Last week, I spent the better part of [my Friday livestream](https://twitch.tv/developersgarage) working on solving a single problem. With a little more attention to detail, this wouldn't have been a problem at all.

I had just gotten done implementing a custom 404 handler for a static site I have been developing for a friend. I went to test the handler, but it wasn't working. I was still getting the generic 404 exception, `cannot GET \page`, when a page does not exist. I spent the next 1.5 - 2 hours trying to solve why the redirect wasn't working and just before I ended my stream, I figured it out.

I had been working on this site many times over the course of several weeks and I typically leave my working pages open in a browser window, including the site running on localhost, specifically localhost:8080. I also leave my command windows open because that's where the static site generator CLI is running and watches for changes in order to rebuild and reload the site.

At some point, the command window, or CLI, crashed and when it did it left a Node.js process running in the background. This process was still running and using localhost:8080 to serve up my site. On Friday, when I reran the CLI in a command window, it started up another Node.js process, this time serving it up on localhost:8081. 🤦‍♂️ And did I mention, the CLI tells you specifically where it is serving your site.

![Access URLs from BrowserSync](https://dev-to-uploads.s3.amazonaws.com/i/79ojy2d93s1givhfqe6t.png)

_Lesson learned:_ __Pay attention to what the CLI is outputting and when in doubt, restart everything, including your computer.__

I love the opportunity to post my fails in hopes of saving someone from the same fate, but also to show no matter how many years of experience you have, we all still struggle, and fail, from time to time. So don't get all down on yourself when it happens to you 😉. 

What was one of your fails last week?

Also, if you ever want to chat about it, or anything for that matter, drop in to [my stream](https://twitch.tv/developersgarage) where you'll find an amazing, supportive group ready to welcome you and share their wins and fails!
Opening Multiple Pull Requests
Tags: developer, tutorial, github, hacktoberfest2020
Published: 2020-10-26 10:03:34

---
title: Opening Multiple Pull Requests
published: true
date: 2020-10-06 13:27:51 UTC
tags: Developer,Tutorial,github,hacktoberfest2020
canonical_url: https://www.nexmo.com/blog/2020/10/06/opening-multiple-pull-requests-dr
cover_image: https://www.nexmo.com/wp-content/uploads/2020/10/Blog_Multiple-Pull-Requests_1200x600.png
---

‘Tis the season of many pull requests, so today I thought I’d share a tip for avoiding common pull request mistakes that arise from having an out of date master branch.  
Becoming a repeat contributor of a project is one of the best things that can happen to anyone taking part in Hacktoberfest – but there are some things to look out for when you’re making a pull request that isn’t the first on a freshly forked repo. Today I’ll share my tips for making sure that every pull request is as good as the first one!

## The Finish Is in the Preparation

To do more than a fly-by, one-off contribution, there’s one small addition to your usual workflow that can make a very big difference. When you get set up for contributing to a new repo, try this:

1. Fork the repo to your own account
2. Clone that repo to your computer
3. **Now add the original repo as an “upstream” remote**

That magical third step, before you start making changes or creating a branch or even setting up the project to work locally, will give you the link you need to collaborate with a project more than once.

## Sync Before Branching

With this upstream remote in place, it is easier to keep your local main or master branch in sync with the one on the upstream project.

> Remember that you should never commit to your local `master` or `main` branch directly. It should always follow the state of the main project, so that you can branch from it and not include any additional changes by mistake!

When you come to make the second contribution, update your local main or master branch before creating the branch you will be working on.

1. `git checkout main`
2. `git pull upstream main`
3. `git push`

That’s it! Check the GitHub URLs for the project and your own fork – and you will see that your main branch is up to date with the project one.

Now you can go ahead and make another change … and another … and another. Happy Hacktoberfest!

The post [Opening Multiple Pull Requests](https://www.nexmo.com/blog/2020/10/06/opening-multiple-pull-requests-dr) appeared first on [Vonage Developer Blog](https://www.nexmo.com).
Display Image from Internet in Flutter
Tags: flutter, dart
Published: 2020-10-06 13:25:46

{% youtube fnbNio7uh94 %}

Originally published at: https://easyflutter.com/display-network-image-in-flutter/

In our [flutter tutorial](https://easyflutter.com/flutter-tutorial) series, we're going to learn how to display image from internet using flutter.

Source code
```dart
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'EasyFlutter',
      home: Scaffold(
        body: Center(
          child: Image.network(
            "https://easyflutter.com/wp-content/uploads/2020/09/easy-flutter.png",
            height: 200,
            width: 200,
          ),
        ),
      ),
    );
  }
}
```
Getting the file name without extension in C# - #TIP
Tags: csharp, beginners, todayilearned, 100daysofcode
Published: 2020-10-06 13:22:00

These days I was asking myself how to get the file name without the extension. I confess I was tempted to use a regex to solve this problem :)

But no worries. There is a method in `System.IO.Path` specific for this situation.

```chsarp
using System.IO;

///
/// Get file name without extension
///
static string GetFileName(string path)
{
    return Path.GetFileNameWithoutExtension(path);
}

///
/// Get file name without extension
///
static string GetFileName(FileInfo fileInfo)
{
    return Path.GetFileNameWithoutExtension(fileInfo.Name);
}
```

Credits go for this answer in StackOverflow forum.

[Getting file names without extensions](https://stackoverflow.com/questions/4804990/getting-file-names-without-extensions)
Emotion Tracker AI
Tags: news, opensource, machinelearning, javascript
Published: 2020-10-06 13:13:19

Hi! I've just created a simple Emotion Tracker. You can track your mood during the job. Get notifications when you are sad or unsatisfied. The app is something like your private assistant.

✨ Online demo + binaries: https://emotion-tracker.n4no.com/
⚙️ GitHub: https://github.com/b4rtaz/emotion-tracker

![Emotion Tracker AI](https://dev-to-uploads.s3.amazonaws.com/i/y30bfzv0kyzgesa5x0b5.jpg)
Mixin Approaches for Media Queries with Sass 
Published: 2020-10-06 12:57:03


Sass mixins give us the ability to create reusable chunks of code they reduce repetition, promote dry code & allow for ease of maintenance. Writing media queries as mixins to inject into your stylesheets, wherever they’re required — makes a whole lot of sense! Lets take a look at an example..

Setup mixins

  @mixin for-size($size) {
    @if $size == phone-only {
      @media (max-width: 375px) { @content; }
    }@else if $size == mobile-small {
        @media (max-width: 480px) { @content; }
    }@else if $size == max-mobile {
        @media (max-width: 767px) { @content; }
    }@else if $size == tablet-landscape-up {
        @media (max-width: 991px) { @content; }
    }@else if $size == tablet-landscape-up {
        @media (max-width: 1024px) { @content; }
    }@else if $size == desktop-up {
      @media (max-width: 1200px) { @content; }
    } @else if $size == big-desktop-up {
      @media (min-width: 1600px) { @content; }
    }
  }

Using Mixin

.header-title {  
   font-size: 2rem;  
 
   @include for-size(phone-only) {    
      font-size: 1rem; 
   }
}
This is not totally My Major
Tags: discuss, beginners
Published: 2020-10-06 11:43:49

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

How to become a Programmer?
How do I get started?
Programming What language am I learning?
Where can I learn Programming?
I can not do it
It's hard for me
Why can't I learn this?
Maybe I chose the wrong major (Student).
I regret choosing this major
.
Surely everyone who has the above concerns when they are new to the IT world, especially in the programming world. Of course me too!

I myself also had a hard time getting started. But, I don't give up, I will never give up, because everything needs a process, we have to struggle, keep learning, keep practicing, and absolutely we pray we pray what we want can come true and run smoothly.

Throw away "I chose the wrong major, this is not my field, I can't afford this major". Throw away "that thing from our minds. The world of IT / programming is broad, there are Web Designers, Frontend Developers, Backend Developers, Mobile Developers, Software Engineers, Data Science and many more.

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

If we can't be in one field of programming, we can still explore / try other fields, so we can find IT fields that suit us. The point is to keep learning, keep practicing, keep improving skills and keep praying.
Hacktoberfest 2020 Rule Updates!
Tags: hacktoberfest, hacktoberfest2020
Published: 2020-10-06 12:49:11

Stop the presses! Just mere days after publishing my Youtube comeback video on how to [Signup for Hacktoberfest 2020](https://www.youtube.com/watch?v=cvLELspX-E8), the event organizers have changed the rules. The rule changes have been brought on to reduce the number of spammy pull requests that often go hand in hand with past Hacktoberfests. These new rules, many of which are setting the tone for future Hacktoberfests, will carry the torch in the future. 

This is important for anyone who plans to submit pull requests after October 3rd and expect them to count towards Hacktoberfest 2020. Let’s get down to brass tacks and review the situation. 

### Participation & Rules
I feel it is important to dive into the full set of both the participation details and rules to understand the expectations before partaking in the event. 

**Participation Information**
* Hacktoberfest is available to all, no matter your experience. This means whether you just created your Github account or your 87th repository, you’re welcome aboard!
* Public Github repository maintainers can have their repos be a part of the fun by classifying their projects with the `hacktoberfest` topic as shown in [this video](https://do.co/hfest-topics).
* There are two conditions that your pull requests need to follow to count towards your four pull request goal. One condition is that your pull request being made to any Github repositories need to have a `hacktoberfest` topic (see above) to count towards the event. The second condition is the PR needs to be merged/approved by a repo maintainer or have the `hacktoberfest-accepted` label applied to the PR. 
* It’s worth noting that any pull request with the `hacktoberfest-accepted` label applied to ANY public Github repository (with a `hacktoberfest` topic or not) will count towards your Hacktoberfest four pull request goal. 
Just be sure to sign up for Hacktoberfest 2020 before the end of October 31st. [This video](https://www.youtube.com/watch?v=cvLELspX-E8) can help ;) 

### Rules
* Have four pull requests labeled with `hacktoberfest-accepted` or merged by end of day October 31st to receive a prize of either a Hacktoberfest T-shirt or tree planted in your name!
* PRs done between October 1st and October 3rd can be counted towards any public Github repository.
* After October 3rd, all pull requests have to be merged, labeled with `hacktoberfest-accepted`, or approved by repository maintainers. These have to be approved as valid pull requests to be merged!
* 70,000 prizes will be awarded to participants.

That’s it! Other than the newly added label constraints not much has been changed. 

Have you found a Github project you’re passionate about collaborating on? Please share it below!

### Want to find out more?
A general notice has been shared by Hacktoberfest in regards to these changes that can be found [here](https://hacktoberfest.digitalocean.com/hacktoberfest-update).
My first week as an Elixir Engineer
Tags: elixir
Published: 2020-10-06 12:22:52

---
title: My first week as an Elixir Engineer
published: true
description: Finally, I am working as an Elixir Engineer at Zenloop. That’s a company focused on the customer experience where Elixir is a primary programming language. After my first week of work, I can say one important thing: the elixir ecosystem is not mature. 
tags: elixir
cover_image: https://patryk.it/img/blog/alchemy-3.jpg
---

> The post was originally published on my blog [patryk.it](https://patryk.it/my-first-week-as-an-elixir-engineer/). It's a part of **"From PHP to Elixir"** series.

Hi guys!
Finally, I am working as an Elixir Engineer at Zenloop. That’s a company focused on the customer experience where Elixir is a primary programming language. After my first week of work, I can say one important thing: the elixir ecosystem is not mature. Many times you’ll not find packages or libraries that can pass your expectations and you will be forced to create them from the scratch.

I’m still while onboarding process, but thanks to my buddy I have the first real Elixir task. A few days ago I got a task to do research of libraries that supports parsing CSV and XLSX documents. That's so generic thing to do in mainstream programming languages like Java, Python, or PHP but in this case, it was not obvious. I found a few packages on the Hexdocks (that's like packaging for PHP, but it's even better) - few of them were not looking stable for me or had not the best support from the creators. **That's important when you're looking for a tool for professional usage** - not for a home project.

In my case, I’ve needed tools that help me to define the encoding of the given file and something that could guess which delimiter for the CSV file was used. There is no package, library, or tool that meets my requirements exists in the Elixir ecosystem and I’ve needed to create them from the scratch. I feel sad.

Besides missing tools that have forced me to create my own is that - the Elixir is perfect for processing sets of the data. That’s not a great discovery - but for me, it was pretty cool to see how a functional approach helps to deal with file processing in a real project. The next things that are so fancy for me are protocols and behaviours. I’m interpreting them as a type of IoC (Inversion of Control), protocols are for data and the behaviours for modules. Do you think it’s a good topic to cover in the next post?
Running in the Cloud? Watch out for low port numbers!
Tags: aws, smtp, azure, googlecloud
Published: 2020-10-06 12:22:01

Every day we see more and more applications running in the Cloud. And I bet that at least 70% of them are sending some kind of email to its users.

Most of the email providers (SendGrid, SendInBlue, SES...) support sending emails using the SMTP protocol, and they expose a bunch of ports for us to do it (25, 587, 2525).

The big problem here is that most of the **cloud providers block or impose some sort of throttling on low port numbers to protect against abuse.** And this can cause big problems if we are not careful.

The other day we had a big queue of emails to be processed and we started seeing some **Connection Refused errors in our monitoring tool.** Weirdly, some of the emails were going through while others were going back to the queue and throwing errors.

As the queue grew bigger we found out that AWS throttles outgoing traffic on port 25 and other low port numbers. It was time for us to review some of the port numbers we were using for SMTP and change it to 587, which is the recommended value by SendGrid.

So just a heads up! **If you are running in the Cloud it's good to be careful with outgoing and incoming traffic on low port numbers** otherwise some users might never see receive your emails or messages ;)

References:
* [ec2-port-25-throttle](https://aws.amazon.com/pt/premiumsupport/knowledge-center/ec2-port-25-throttle/)
* [azure outbound-smtp-connectivity](https://docs.microsoft.com/pt-br/azure/virtual-network/troubleshoot-outbound-smtp-connectivity)
* [google cloud - sending emails](https://cloud.google.com/compute/docs/tutorials/sending-mail)
* [send grid docs](https://sendgrid.com/docs/API_Reference/SMTP_API/getting_started_smtp.html)
Things to Know About B2B Leads Before Making That Call
Published: 2020-10-06 12:09:31

Sales representative play a significant role in the success of various businesses. Through them, a company can make more sales, thus creating a profit in the process. If you are a sells rep, you know that it is always hustle when making the calls to potential clients. Some find it challenging to convince someone to purchase a given product.
Having information about the people you are about to call will be essential in increasing the chances of them making a purchase. Many sales reps don't have the time to look for information. 
The advances of technology have been crucial in solving many of the problems that different businesses face. Sales acceleration technology has been on the rise with many companies currently relying on getting the needed information about targeted customers. This type of technology utilizes data and enables sales reps to find relevant <a href="https://www.tropare.com/b2b-prospecting-tools-for-field-sales.html"> information about b2b prospects </a> quickly and is crucial. Below are some of the essential things that B2B sales reps should be aware of prospects before making a call.
Past Communication
It is essential to know If the prospect you are about to call was called before by someone from your company. This is vital, and the information can be found in logging call details. Through sales acceleration technology, you can find call records, and this will help you know if a given person was called before. Furthermore, you can listen to previous calls made to a given person. Through this, you can learn a few things about the person, thus finding ways to convince them to purchase a product from your company. Businesses need to keep call logs and recordings for future references.
Marketing Automation Data
There is still a sales rep who can know about a prospect even if he or she was not called before by the given company. There many other ways one can know if a prospect knows about the brand. As stated earlier, data is collected for the prospective online activity. A business can know if a person is interested in its brand through data from different social media platforms. This can be known by the content they read, watch, or download. Through various automation marketing tools, getting more information about prospects is easy and fast. Through information from marketing automation data, a sales rep can know the likes and dislikes of a prospect, which will be essential when conversing with them.
Company
It is important to have some background knowledge of what the prospect company you are targeting does. You should ensure that you do some research on the prospect before making that call. You can do this by visiting their social media platforms and reading their content. If it is a company, do some research on what they do and ensure you find ways to make them do it better.
Conclusion
Having some information about your prospects is essential before you start a conversation. As a sales rep, you need to know a few things on how you can get your prospects' attention and convince them to buy from your company.
Setting up Scala for Spark Development
Tags: apachespark, scala, sbt
Published: 2020-10-06 11:04:03

---
title: Setting up Scala for Spark Development
published: true
description: 
tags: 
  - ApacheSpark
  - Scala
  - sbt
//cover_image: https://direct_url_to_image.jpg
---

This post is merely a reference-like article to set up your Scala environment for Apache Spark development.

## Simplest Thing

Your `build.sbt` should looks like:

```scala
name := "My Project"

version := "0.1"

scalaVersion := "2.11.12"

libraryDependencies += "org.apache.spark" %% "spark-sql" % "2.4.6"
```

Your `Entry.scala`:

```scala
import org.apache.log4j.{Level, LogManager}

object Entry {
  def main(args: Array[String]) {

    val spark = SparkSession
      .builder()
      .master("local")
      .getOrCreate()
    LogManager.getRootLogger.setLevel(Level.ERROR)
      
    // use spark variable here to write your programs

  }
}
```

## Integrating with Azure Pipelines

Azure Pipelines has built-in support for **sbt**, therefore you can build and package with the following task (simplest version):

```yaml
- task: CmdLine@2
  displayName: "sbt"
  inputs:
    script: |
      sbt clean
      
      sbt update
          
      sbt compile
          
      sbt package
    workingDirectory: 'project-dir'
```

To pass version number, you can use a variable from your pipeline. Say it's called `projectVersion`, then pipeline task is:

```yaml
- task: CmdLine@2
  displayName: "sbt"
  inputs:
    script: |
      sbt clean
      
      sbt update
          
      sbt compile
          
      sbt package
    workingDirectory: 'project-dir'
  env:
    v: $(projectVersion)
```

which merely creates an environment variable called **v** for the sbt task. To pick it up, just modify version line for `build.sbt`:

```scala
version := None.orElse(sys.env.get("v")).orElse(Some("0.1")).get
```

You can create **uber JAR**, however they are relatively large (70kb grows into over 100Mb) therefore I'd try to avoid it.

This article was originally published [on my blog](http://www.aloneguid.uk/posts/2020/05/spark-scala-sbt-setup/).