teleren/devto huggingface dataset:
Failed deploy to dokku
Tags: scala, dokku, heroku
Published: 2020-10-12 02:58:16

I've got this Scala Play app that I develop on my laptop and deploy to a Dokku on a small Linode VPS.

These days, when I deploy, I get these failures:

```
$ git push dokku master
Counting objects: 72, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (70/70), done.
Writing objects: 100% (72/72), 10.72 KiB | 731.00 KiB/s, done.
Total 72 (delta 45), reused 0 (delta 0)
-----> Cleaning up...
-----> Building yt from herokuish...
-----> Adding BUILD_ENV to build environment...
-----> Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
       Detected buildpacks: multi scala
-----> Multipack app detected
=====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-scala
=====> Detected Framework: Play 2.x - Scala
-----> Installing JDK 1.8... done
-----> Running: sbt compile stage
       [info] Loading global plugins from /tmp/scala_buildpack_build_dir/.sbt_home/plugins
       [info] Loading settings for project scala_buildpack_build_dir-build from plugins.sbt ...
       [info] Loading project definition from /tmp/scala_buildpack_build_dir/project
       [info] Loading settings for project root from build.sbt ...
       [info] Set current project to play-ytdl (in build file:/tmp/scala_buildpack_build_dir/)
       [info] Executing in batch mode. For better performance use sbt's shell
       [info] Compiling 21 Scala sources and 1 Java source to /tmp/scala_buildpack_build_dir/target/scala-2.13/classes ...
remote: .sbt_home/bin/sbt-extras: line 241:   480 Killed                  "$@" < /dev/null

       !     ERROR: Failed to run sbt!
       We're sorry this build is failing. If you can't find the issue in application
       code, please submit a ticket so we can help: https://help.heroku.com
       You can also try reverting to the previous version of the buildpack by running:
       $ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-scala#previous-version

       Thanks,
       Heroku

To MYDOMAIN.com:yt
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'dokku@MYDOMAIN.com:yt'
```

The `.sbt_home/bin/sbt-extras: line 241:   480 Killed` is the important part. Searching the web about it, this is not a Dokku issue. I can reproduce by checking out my source code on the VPS directly and trying to `sbt stage` to build the project myself. I get the same `Killed` message eventually.

The problem is I don't have enough RAM to build the project :-O

My options are to get more RAM, or compile the project locally and deploy an artifact. I'll look into the second option, but I might get lazy and buy a larger VPS. It will depend on my free time.

I make this post in case someone else is putting this error message into google and needs a hint on what is happening.
Conflict resolved 
Tags: opensource, git, github
Published: 2020-10-12 01:52:02

# How everything starts

For this week's lab(3),  I practiced merging with conflict. I chose to add two features on my [goURL](https://github.com/yzwdroid/goURL) program. Then, I filed two issues on Github.

- [CLICOLOR environment variable](https://github.com/yzwdroid/goURL/issues/5)
- [json output](https://github.com/yzwdroid/goURL/issues/6)

## Make two branches

Before this lab, all the coding happens on the master branch. So I made two more branches. These two branches all based on the current state of master.
```
git branch issue-5
git branch issue-6
```

## Fast-forward merge

Then I started work on issue-5 branch `git checkout issue-5`. After I finished all the coding `git commit -m "issue-5 finished"`. Then, I merged this branch to master 
```
git checkout master
git merge
```
This is a `Fast-forward` merge. Because the commit pointed to by the branch issue-5 was directly ahead of the commit on the master branch.

## Conflict happens

After the Fast merge, I started work on [issue-6](https://github.com/yzwdroid/goURL/issues/6) `git checkout issue-6`. The coding part goes smoothly. 

```
git commit -m "issue-6 finished"
git checkout master
git merge issue-6
```
Automatic merge failed.

```
# aborting a merge
git merge --abort
```

## Resolving a merge conflict

Git adds standard conflict-resolution markers to the files that have conflicts. 

```
<<<<<<< HEAD:index.html
aaaaaaa
=======
bbbbbbbbbbb
>>>>>>> issu-6:index.html
```
After you’ve resolved each of these sections in each conflicted file, run `git add` on each file to mark it as resolved. Staging the file marks it as resolved in Git.


## Advanced merge

In my situation, too many markers on my main.go. So I found another way to solve the conflict. I am a vim user, and git can specify the mergetool.
```
git config --global merge.tool vimdiff  
```
After I run `git mergetool`, vimdiff was executed.

![Screenshot 2020-10-10 3_23_31 PM](https://dev-to-uploads.s3.amazonaws.com/i/inizuq3a5oakesdea9xd.png)

Local changes (master branch in this case) are in the upper-left window, followed by a closest common ancestor and the issue-6 branch in the upper-right corner. The result of the merge is in the bottom window.

- LOCAL: This is the file from the current branch (or whatever you're merging into)
- BASE: The common ancestor—how the file looked before both changes took place
- REMOTE: The file you are merging from another branch (issue-6)
- MERGED: The merge result—this is what gets saved as output

Inside vim, `:diffget REMOTE or :diffg R` to get the REMOTE version. Same as `:diffget BASE :diffget LOCAL`. `]c [c` move by changes. Repeat for every conflict and then run `:wqa`

## Commit the merge result

```
git commit -m "issue 5 and issue 6 conflict resolved"
```

## Conclusion

It's a long and fun journey to create and deal with the conflict. It simulates the methods when we all work parallel in the opensource world.
How to Get Device Lat Long in Flutter - fluttercorner.com
Tags: flutter
Published: 2020-10-12 01:41:34

Hello Guys, How Are You All? Hope You All Are Very Well. Welcome to fluttercorner.com As a Flutter developer Sometimes you need device current lattitude and Longitude. So in This tutorial we are going to learn how to get device lat long in flutter.

How to Get Device Lat Long in Flutter
First of all. All You Need is GeoLocation package. So define on pubspec.yaml file and then get that dependencies. Same like below.

```
dependencies:
  flutter:
    sdk: flutter
  geolocation: ^1.1.2
```

Now. For Android Users, you Must have to define below both line in your Flutter_project_path/android/app/src/main/AndroidManifest.xml File Exactly Like below.

```
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
```

For iOS users, You need to declare the description for the desired permission in ios/Runner/Info.plist:

```
<dict>
  <!-- for iOS 11 + -->
  <key>NSLocationWhenInUseUsageDescription</key>
  <string>Reason why app needs location</string>
  <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
  <string>Reason why app needs location</string>

  <!-- additionally for iOS 9/10, if you need always permission -->
  <key>NSLocationAlwaysUsageDescription</key>
  <string>Reason why app needs location</string>
  ...
</dict>
```

Now, import geolocation.dart in your file where you want lat and long.

```
import 'package:geolocation/geolocation.dart';
```

Define latitude and longitude that you want to use. In my case i need lat long in String Formate so i am defining String.

```
  String latitude = '00.00000';
  String longitude = '00.00000';
Now Create Method named _getCurrentLocation with async Like Below.
  _getCurrentLocation() async {
    Geolocation.enableLocationServices().then((result) {
      // Request location
      // print(result);
    }).catchError((e) {
      // Location Services Enablind Cancelled
      // print(e);
    });

    Geolocation.currentLocation(accuracy: LocationAccuracy.best)
        .listen((result) {
      if (result.isSuccessful) {
        setState(() {
          latitude = result.location.latitude.toString();
          longitude = result.location.longitude.toString();
        });
      }
    });
  }
```

Now Trigger This Method where you wanna use. If users allow for location it will give you lat long

also you can customize accuracy: LocationAccuracy.best by refering its Documentation file.

i am giving my source code here that will help you to understand.

Full Source Code At Here https://fluttercorner.com/how-to-get-device-lat-long-in-flutter/
Refactoring in C# using NDepend
Tags: csharp, dotnet, ndepend
Published: 2020-10-12 01:28:48

---
title: Refactoring in C# using NDepend
published: true
description: Try NDepend for making refactoring in C#
tags: csharp, dotnet, NDepend
//cover_image: https://direct_url_to_image.jpg
---

One of the activities that I love to do in legacy projects is to make a refactoring in the code. We have to be careful because finally, we are updating code that is working fine in production. In the ideal scenario, we have Unit tests and Automation tests to avoid issues during refactoring.

We have many tools like CodeMaid, Resharper, and even Visual Studio have good tools to do this job or activity but in this article, I will talk about [NDepend](https://www.ndepend.com/).

NDepend has a lot of tools to analyze a piece of code, a project, or a whole solution. It will show a report including warnings and issues found, there are many rules that NDepend has in order to validate our code. 

Here an example:

![Report NDepend](https://dev-to-uploads.s3.amazonaws.com/i/kp6pyjzp5k9jjxkwo1hj.png)

We can analyze the issues reported and update our code properly, finally, we can run the analysis once again and see the results. Even this is the general propose of NDepend I want to keep the focus on the Power tools because for me are the most useful functionalities that we can find in NDepend. 

Go to Tools -> Start Power Tools and it will show a new terminal with some options that we can perform on our projects.

![NDepend Power Tools](https://dev-to-uploads.s3.amazonaws.com/i/quwpzurc02af4oi65qnp.png)

All tools are great and useful for refactoring, But I will want to mention my favorites.

####Search for duplicate code

This tool helps to find duplicated code where we can make refactoring creating functions or removing some lines. 

![NDepende code duplicated](https://dev-to-uploads.s3.amazonaws.com/i/3qdow0zk02ghn1zjy3rh.png)

####Find Potential Death Code
With this tool, you can find potential death code in your projects. For example, a type that is never used or function that is never called.  
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/jt10e2l5czt0t4jy6pa9.png)

####Detect Assemblies Versionning and Deployment Issues
With this tool, we can detect the difference in the assemblies' version into the project and target framework. 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/3g6r2xpnqz6s5k74qdv4.png)

You can try NDepend for 14 days: https://www.ndepend.com/download
Three methods that you should know - JavaScript
Tags: javascript, es6, webdev
Published: 2020-10-12 01:16:14

If you are a web developer, there are three useful methods that you should know about.

### find()
The find() method returns the value of the first element in the provided array that satisfies the provided testing function.
![findJS](https://dev-to-uploads.s3.amazonaws.com/i/j0oesbqdxb8y07kr8kxn.png)
 
### filter()
The filter() method creates a new array with all elements that pass the test implemented by the provided function.
![filterJS](https://dev-to-uploads.s3.amazonaws.com/i/8cb35e4awmny3xqrk87b.png)
 
### reduce()
The reduce() method executes a reducer function (that you provide) on each element of the array, resulting in single output value.

 ![reducev2](https://dev-to-uploads.s3.amazonaws.com/i/rrlljejb397xmn8ayvq2.png)
 
###### References
* [developer.mozilla.org](https://developer.mozilla.org/)
Static bloge with no code because i dont have experience in coding 
Published: 2020-10-12 00:42:53

So I'm beginner and I don't have experience in coding and I really love static site very fast reaction and it's good for user experience so my question is how can I build my static bloge without coding and is there any way to use like content management systems like wordpress to add content post and images easy way ?? Please answer 
Thanks dev community
State of Technical Interviews - Initial Data!
Tags: showdev, career, interview
Published: 2020-10-12 00:26:48

---
title: State of Technical Interviews - Initial Data!
published: true
description: Having received 20 responses so far (thank you) I break down some of the data
tags: showdev, career, interview
//cover_image: https://direct_url_to_image.jpg
---

# What is this?

In case you're not sure what this is, I created a questionnaire and pleaded for fellow programmers and technical people to fill it out. I intend for this data to be used in a way that helps the community tackle technical interviews in a way that benefits *everybody* including the employers.

I think there's a win-win scenario here but I still need your help! 20 responses isn't enough. Please help by filling out the questionnaire.

The original article is [here](https://dev.to/spirodonfl/state-of-technical-interviews-need-your-help-2beg)

# The data so far

Even though there are only 20 responses, it seems that some trends are already forming. Here are just a few tidbits.

## Algorithms

It seems a decent majority of you are getting asked algorithm questions during interviews. At least 55% of respondents got asked algorithm questions very often or almost all the time.

However, when asked how many of the respondents felt they got the job because of their ability to answer algorithm questions, approximately 57% of them answered with almost never to not very often!

## Whiteboard

Approximately 55% of respondents said they almost never or not very often get asked whiteboard questions during interviews.

Over 50% of the respondents *also* said they don't think they got the job because of their ability to work through whiteboard questions.

## Feedback on failure

A whopping 75% of respondents said they almost never or not very often get feedback on why they failed an interview.

To me, that's quite sad. It's in the best interest of an employer to provide this feedback. It helps nurture and guide people to do better which means better employees the next time around.

## Training opportunities

It seems that most respondents felt they could accept a lower paying job if they knew the job would offer them opportunities to learn and expand their skills. That's actually quite valuable for employers to know because it's a win-win investment for everybody involved.

# Thank you for participating

So far it's been really interesting to see what the answers are like. I really truly appreciate everyone who has participated thus far.

I intend to do a full, in depth, write up after I have enough respondents.

Please share the questionnaire, tweet it, whatever you can do to bring people to it. The more data we have, the better we can make our technical interview process and, ultimately, the better opportunities we can offer and get.
How to get the last child of a parent DOM element in JavaScript?
Tags: javascript
Published: 2020-10-12 00:00:00

---
  title: How to get the last child of a parent DOM element in JavaScript?
  published: true
  tags: JavaScript
  date: Mon Oct 12 2020 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/get-last-child-element-dom-javascript
  cover_image: https://melvingeorge.me/_next/static/images/main-16a9ca513950bd66d8fd99c0a08ca212.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/get-last-child-element-dom-javascript)
  
To get the last child of a parent element, you can use the `lastElementChild` property in the DOM element in JavaScript.

Let's say we have a parent element `div` and three `paragragh` tags inside it like this,

```html
<div id="container">
  <p>Paragraph 1</p>
  <p>Paragraph 2</p>
  <p>Paragraph 3</p>
</div>
```

Now let's get the last `paragraph` element from the `div` tag.

To get the last `paragragh` element, last we have to get a reference to the `div` tag and then use the `lastElementChild` property like this,

```javascript
// get refernece to tht div tag
const div = document.querySelector("#container");

// ge the last child element
const lastChild = div.lastElementChild;

console.dir(lastChild); // last p tag properties and methods
```

See this example live in [JSBin](https://jsbin.com/kuvecezeyi/1/edit?html,js,console).

### Feel free to share if you found this useful 😃.

---
Upload files using NodeJS + Multer
Tags: node, express, multer
Published: 2020-10-23 12:10:35

---
title: Upload files using NodeJS + Multer
published: True
date: 2020-10-12 00:00:00 UTC
tags: NodeJS,Express,Multer
canonical_url: https://www.loginradius.com/engineering/blog/upload-files-with-node-and-multer/
---

Introduction When building APIs, the need to upload files is expected, which can be images, text documents, scripts, pdfs, among others. In the development of this functionality, some problems can be found, such as the number of files, valid file types, sizes of these files, and…

   
[Read On](https://www.loginradius.com/engineering/blog/upload-files-with-node-and-multer/)
Optimal clusters for KMeans Algorithm
Tags: machinelearning
Published: 2020-10-23 12:10:17

---
title: Optimal clusters for KMeans Algorithm
published: True
date: 2020-10-12 00:00:00 UTC
tags: MachineLearning
canonical_url: https://www.loginradius.com/engineering/blog/Optimal-Clusters-KMeans/
---

Before we get into details of finding out optimal clusters, let's first see what the KMeans clustering algorithm is and some basics about it. What is Clustering? Clustering is an unsupervised ML technique wherein we cluster the data to get insights from it. Clustering the data is…

   
[Read On](https://www.loginradius.com/engineering/blog/Optimal-Clusters-KMeans/)
Ways to Make Money as a Developer — Selling and Promoting
Tags: career, productivity
Published: 2020-10-11 23:58:56

**Check out my books on Amazon at https://www.amazon.com/John-Au-Yeung/e/B08FT5NT62**

**Subscribe to my email list now at http://jauyeung.net/subscribe/**


Software development is a great skill to have in the modern world.

We can take advantage of it by making money in multiple ways.

In this article, we’ll look at some ways we can make money as a developer.

### Sell Swag

You can sell swag to customers.

If they’re interesting, then people may buy it.

### Newsletter

A newsletter is something that lets you keep in touch with your audience.

You collect emails from people that are interested in you and you can send out newsletters regularly to keep them looking at useful information and promotions you send out.

### Coaching

Software development is an expertise that not everyone has.

Therefore, there’s a market for people that needs your help.

They may need help with some programming problems and other things.

If you can help people and they know you exist, then you will get the opportunity to make money with coaching.

### Trading Bot

If you’re interested in trading various securities, you can automate trading with your own bot.

If you’re confident about it, then you can let it sit and make money for you.

Of course, trading always has risks, so you don’t want to let it run without watching it.

### Paid Coding Challenges

If you’ve mastered programming, then you can join coding challenges like hackathons, bug hunts, and more and make money.

Of course, to make money, you have to win.

So this isn’t the most reliable source of income out there.

But if you like to solve hard problems, the paid coding challenges are what you’re looking for.

### Investing

With the income you get from programming, it’s a good idea to invest them since accruing interest means you get more income.

Now you can buy and sell various things like ETFs, mutual bonds, stock, etc. without a broken.

However, now you have to be informed of their risk and potential reward before putting money on them.

### Sell Templates and CMS Plugins

You can sell templates for popular content management systems like WordPress or Joomla.

Many people can’t code and want a customized website.

They’ll buy WordPress themes put them on their site.

If your theme does what they want, then you’ll get their business.

You can sell your theme on Theme Forest.

Also, you can sell WordPress plugins in the same way.

### Sell Development Services

You can sell development services.

It’s probably easier to have a web presence and promote yourself wherever you can.

This way, people know you exist.

The best way to promote is to help people online.

You can put up free content online to help people.

They’ll appreciate you and will find you.

If you have lots of money, you can also promote your services with ads.

However, the risk of this is bigger since the cost per click of an ad that promotes your service will probably be high.

### Conclusion

You can sell stuff online, promote your services, and sell CMS themes and plugins to make money as a developer.
Leetcode: Reverse Integer
Tags: javascript
Published: 2020-10-11 23:24:20

Today I will be walking through the Reverse Integer Leetcode coding challenge.

#Instructions

Given a 32-bit signed integer, reverse digits of an integer.

Note:
Assume we are dealing with an environment that could only store integers within the 32-bit signed integer range: [−231,  231 − 1]. For the purpose of this problem, assume that your function returns 0 when the reversed integer overflows.

##Overview

```
const reverseInteger = num => {
     // CODE GOES HERE
}
```

###Example 1

```
Input: x = -4253
Output: -3524
```

###Example 2

```
Input: x = 721
Output: 127
```

# Let's Play

Step 1

There were 2 exponent expressions that I evaluated first. 1 - (-2 ^ 31) and 2 - (2 ^ 31 - 1). I used the Math module to handle those exponent expressions.

```
let startPoint = Math.pow(-2, 31)
let endPoint = (Math.pow(-2, 31) - 1)
```

Step 2

I converted the passed in number into a sting using the toString() method.

```
let numToString = num.toString()
```

Step 3

Split the string, reversed it, and then joined it back together.

```
let numSplitReversedJoined = numToString.split('').reverse().join('') 
```

Step 4

Check if there is a hyphen at the beginning of the string, split the string, then use the shift method to remove and return the hyphen. Otherwise, we do nothing.

```
let hyphen = numToString.includes('-') ? numToString.split('').shift() : null
```

Step 5

If there is a hyphen, concatenate it to the numToString then parsing it back into a number

```
let numValueWithHyphen = parseInt(hyphen + (numSplitReversedJoined))
let numValueWOHyphen = parseInt(numSplitReversedJoined)
```

Step 6

Return either the number if it has a hyphen, or the number without it.

```
let numValue = hyphen !== null ? numValueWithHyphen : numValueWOHyphen
```

Step 7

Lastly, check if the number reversed is within range of the startPoint and endPoint that we defined in the beginning. If it's out of range I return 0, otherwise I return the number.

```
if (numValue <= startPoint || numValue >= endPoint || numValue === 0) {
     return 0
}
return xValue
```

###All together

```
const reverseInteger = num => {
     let startPoint = Math.pow(-2, 31)
     let endPoint = (Math.pow(-2, 31) - 1)

     let numToString = num.toString()
     let numSplitReversedJoined = numToString.split('').reverse().join('') 

     let hyphen = numToString.includes('-') ? numToString.split('').shift() : null

     let numValueWithHyphen = parseInt(hyphen + (numSplitReversedJoined))
     let numValueWOHyphen = parseInt(numSplitReversedJoined)

     let numValue = hyphen !== null ? numValueWithHyphen : numValueWOHyphen
     if (numValue <= startPoint || numValue >= endPoint || numValue === 0) {
          return 0
     }
     return numValue
}
```

And, there we have it.