teleren/devto huggingface dataset:
I'm Leaving a Job I Love, and I'm Ready 
Tags: career, codenewbie, 100daysofcode
Published: 2019-12-12 22:17:36

I'm a week out from leaving a perfect, full-time, dreamy remote work position. I've been with the company for a little under two years as a customer support specialist and it's entirely possible that I would've stayed in that position for the next ten years if they let me. 

But the thing is - it's time to move on. Sure, it took a bit of a push in the sense that I had to decide between leaving my expat life in France and moving back to the US or to say goodbye to my beloved job.

So I said goodbye, and I'm viewing it as a good thing.

Actually, it's a great thing. I love the company and the people there, but now I've been given the ol' nudge that means it's really time to get to the heart of what I truly want to be doing.

And right now, that's becoming a software engineer.

They say the perfect time to leave something behind is when you're both really sad about what you're leaving and really happy about what's to come. 

I've reached that point. 

I'll admit - I had moments over the past few months where motivation was at an all-time low and I was dragging myself around in self-pity.

But the moment I decided to actually STOP and view this entire period in my life as an opportunity was when I started climbing up and out of that pit of despair.

When my friends and family members ask me how the job hunt is going, it feels almost blasphemous to let them know that I'm actually *not* doing any hunting at the moment. 

Instead of desperately grasping for just any and every job posting I see, I'm choosing to take my time, commit to building my coding skills and portfolio projects, and trust that I'll be met with the perfect opportunity when the time comes. 

To me, there's so much power in going about it intentionally rather than reactively. 

Intentional is setting aside a few hours each morning to work on a coding project and to eventually have a record of all of the skills I've worked hard to build.

Reactive is applying to any and every odd job and not allowing myself to level up to the sort of career I truly want for myself. 

In terms of leveling up, I started to imagine myself with one foot in a docked boat and the other foot on the pier. Staying put would mean applying for jobs that are familiar, comfortable, and safe.

I'm choosing to set sail. I don't know what's located just beyond the horizon, but you'd better believe I'm hungry to find out.
Hello World
Tags: helloworld, blog
Published: 2019-12-13 01:12:26

Hello and welcome to my new blog! My name is Spencer Pollock and I'm an aspiring software developer. I find myself often reading up on new technology and working to use their best practices to make some new things. I jump from project to project, trying to expand my knowledge where possible. Follow me along on my journey, and I hope you can while I learn too! Knowledge is power, and sharing is caring.

My focus for this blog is to share my experience. Be it traveling, philosophy, programming or just updates on what I'm working on. I want to keep this and open forum and topic to discuss and learn. Keep an open mind too. Try and look from new perspectives. Keeping an open mind is a great way to expand it.

Follow me on this journey. Let me know what you think (you can find my contact information somewhere I'm sure, either my main website will have it, or one of my social sites). I encourage all forms of communication, only stating that if I don't get to it asap, it's on the list and I want to chat!

---

Thanks for taking the time to read this and get to know me a little bit. Looking forward to going on this journey with all of you. 

All the best - Spencer
List Comprehension in D
Tags: dlang, tutorial, ranges
Published: 2019-12-13 08:12:31

This post is a language comparison coming out of this great article on list comprehension. D does not have List comprehension.

{% link https://dev.to/dvirtual/list-comprehensions-om4 %}

Since D can generally operate on ranges rather than allocated arrays, if you need an array just add `.array` for more on arrays review 

{% link https://dev.to/jessekphillips/slicing-and-dicing-arrays-5akg %} 

My explanation will be limited to D specific differences, but please ask for further details if something is not clear. 

# List

```dlang 
import std;
void main()
{
    // arr = [i for i in range(10)]
    writeln(iota(10));
    // [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
} 
```

Iota is uncommon, but is the equivalent of range in Python. 


# Dictionary 

```dlang
// y = {i:v for i,v in enumerate(x)}
auto x = [2,45,21,45];
auto y = enumerate(x).assocArray;
writeln(y);
// [0:2, 3:45, 2:21, 1:45]
```

As mentioned D prefers unallocated range manipulation, this tends to mean no index, enumerate creates a tuple with a count and value, and `assocArray` takes a range of tuple to build an associative array (dictionary)

# Conditionals

```dlang
// arr = [i for i in range(10) if i % 2 == 0]
auto arr = iota(10)
    .filter!(i => i % 2 == 0);
writeln(arr);
// [0, 2, 4, 6, 8]
```

```dlang
// arr = ["Even" if i % 2 == 0 else "Odd" for i in range(10)]
auto arr2 = iota(10) 
    .map!(x => x % 2 ? "Odd" : "Even");
writeln(arr2);
//["Even", "Odd", "Even", "Odd", "Even", "Odd", "Even", "Odd", "Even", "Odd"]
```

# Nested for loop

```dlang
// arr = [[i for i in range(5)] for j in range(5)]
auto arr3 = iota(5)
    .map!(j => iota(5));
writeln(arr3);
// [[0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4]]
```

```dlang
// arr = [(i,j) for j in range(2) for i in range(2)]
auto arr4 = iota(2).cartesianProduct(iota(2));
writeln(arr4);
//[Tuple!(int, int)(0, 0), Tuple!(int, int)(0, 1), Tuple!(int, int)(1, 0), Tuple!(int, int)(1, 1)]
```

I find that D makes this behavior very clear. 

Tuples being a library provided type, their string representation is a little more verbose. 

# Flatten 2D Array

```dlang
// arr = [i for j in x for i in j]
auto x2 = [[0, 1, 2, 3, 4],
 [5, 6, 7, 8, 9]];

auto arr5 = x2.joiner;
writeln(arr5);
// 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
```

# Conclusion 

D is a typed language, since I did not convert everything back into an array a unique arr variable was needed for each. 

Personally I think D represents the behavior more clearly than Python's list comprehension. Even the conditional output selection, which was more consice in D was represented reasonably. 

This does not touch on the other algorithms D provides and can be applied to the ranges.

Python is praised on its clear syntax and readability, well I must be spoiled because it makes me cringe on most everything I see.
Guessing all of the passwords! Advent of Code 2019 - Day 4
Tags: challenge, adventofcode, javascript, video
Published: 2019-12-13 09:57:07

---
title: Guessing all of the passwords! Advent of Code 2019 - Day 4
published: true
description: JavaScript walkthrough of Advent of Code 2019 (day 4)
tags: challenge, AdventOfCode, javascript, video
series: Advent of Code 2019 in Javascript
---

{% youtube 8ruAKdZf9fY %}
Check Object equality in javascript
Tags: javascript, objects
Published: 2019-12-13 10:19:08

---
title: Check Object equality in javascript
published: true
description: 
tags: javascript, objects, js
---

Check whether two objects are equal or not in javascript

```
 function isDeepEqual(obj1, obj2, testPrototypes = false) {
  if (obj1 === obj2) {
    return true
  }

  if (typeof obj1 === "function" && typeof obj2 === "function") {
    return obj1.toString() === obj2.toString()
  }

  if (obj1 instanceof Date && obj2 instanceof Date) {
    return obj1.getTime() === obj2.getTime()
  }

  if (
    Object.prototype.toString.call(obj1) !==
      Object.prototype.toString.call(obj2) ||
    typeof obj1 !== "object"
  ) {
    return false
  }

  const prototypesAreEqual = testPrototypes
    ? isDeepEqual(
        Object.getPrototypeOf(obj1),
        Object.getPrototypeOf(obj2),
        true
      )
    : true

  const obj1Props = Object.getOwnPropertyNames(obj1)
  const obj2Props = Object.getOwnPropertyNames(obj2)

  return (
    obj1Props.length === obj2Props.length &&
    prototypesAreEqual &&
    obj1Props.every(prop => isDeepEqual(obj1[prop], obj2[prop]))
  )
 }
```
Connecting to ODBC databases from Python with pyodbc

Tags: odbc, software, python, driver
Published: 2019-12-13 10:37:43

Steps to connect to ODBC database in Python with pyodbc module

1. Import the pyodbc module and create a connection to the database
2. Execute an INSERT statement to test the connection to the database.
3. Retrieve a result set from a query, iterate over it and print out all records.

Key Features

- Direct mode
- SQL data type mapping
- Secure connection
- ANSI SQL-92 standard support for cloud services

Learn more at  [https://www.devart.com/odbc/python/](https://www.devart.com/odbc/python/)
smart contract machine learning DEV
Published: 2019-12-13 17:10:12

 good morning , 

i want to implement a new smart contract for clustering data over blockchain.
about the algorithme of clusterning i wat to start by the simple algorithme Kmeans for example.
the smart contract get data from un IPFS.

what architecture can my smart contract have? and with what I have to start? 

Cdlt.
How to test if an element is in the viewport
Tags: jquery, javascript, angular, browser
Published: 2019-12-13 17:41:52


This article was originally posted on [pelumicodes.com](https://pelumicodes.com)

There can be several scenarios that may require you to determine whether an element is currently in the viewport of your browser, you might want to implement lazy loading or animating divs whenever they show up on the user's screen.

> We will not be using jQuery :visible selector because it selects elements based on display CSS property or opacity.

To do this with jQuery, we first have to define a function `isInViewPort`  that checks if the element is in the browser's viewport
```javascript
$.fn.isInViewport = function() {
var elementTop = $(this).offset().top;
var elementBottom = elementTop + $(this).outerHeight();
var viewportTop = $(window).scrollTop();
var viewportBottom = viewportTop + $(window).height();
return elementBottom > viewportTop && elementTop < viewportBottom;
};

$(window).on(‘resize scroll’, function() {
  if ($(.foo).isInViewport()) {
    // code here
  }
});
```

The  `elementTop`  returns the top position of the element, `offset().top` returns the distance of the current element relative to the top of the [offsetParent](https://developer.mozilla.org/en-US/docs/Web/API/HTMLelement/offsetParent) node.

To get the bottom position of the element we need to add the height of the element to the `offset().top` . The [outerHeight]( https://api.jquery.com/outerheight/) allows us to find the height of the element including the border and padding.

The  ` viewportTop `  returns the top of the viewport; the relative position from the scrollbar position to object matched.

To get the ` viewportBottom ` too we add the height of the window to the  ` viewportTop `.

The ` isInViewport `  function returns ` true ` if the element is in the viewport, so you can run whatever code you want if the condition is met.

***

Plugins that do the job for you
* [Vanila Js helper function](https://vanillajstoolkit.com/helpers/isinviewport/).
* https://github.com/customd/jquery-visible
* http://www.appelsiini.net/projects/viewport



cc: [stackoverflow answer](https://stackoverflow.com/questions/20791374/jquery-check-if-element-is-visible-in-viewport/33979503#33979503)
Three Small Relational Efforts That Have Big Impacts
Tags: career
Published: 2019-12-13 20:35:18

The interactions we have with other people help form the environment we work in. If we treat people with respect, care, and interest, the environment will inevitably become an attraction.

There are a few things I try to do on my quest to be a better human to help others feel comfortable and cared for. I know these things will not resonate with everyone, but I have experienced better relationships with my peers due in part to these habits.

## 1. Physically take note of things people mention

When someone mentions something about themselves, I try to *write it down*. It's okay to study your relationships with others, and taking notes will make sure that you can follow up on their interests.

For example, if someone at work mentions they're leaving early on Friday because their daughter has a soccer game, I'll make a note and ask about it the following week.

## 2. Make sure everyone has a direct opportunity to speak

The opportunity part of this is important, because some people are more comfortable sitting back and listening, myself included. The issue is that some people inadvertently get pushed out of the conversation without a chance to get back in.

Be direct and supportive. If someone gets interrupted, address the original speaker immediately after and ask them what they were saying. If a story causes someone else to go down a tangent, make sure to loop back around to the original storyteller. If someone simply hasn't spoken in a while, try to steer the conversation to a place they'll feel more comfortable.

## 3. Show more excitement than expertise

If someone shares information with you about hobby or activity, give them your support in the form of excitement and questions rather than advice. Not every conversation needs to be a competition on who knows more about what. Even if you do know more, just enjoy the fact that you have something in common without intimidating them or belittling their interest and accomplishments.

Hopefully these short tips are helpful for building better relationships. They are subtle things but can be really powerful when they are applied with a mentality of care.
Do Stacked-PRs require re-review after merge?
Tags: ask, help, git, codereview
Published: 2019-12-14 06:06:17

---
title: Do Stacked-PRs require re-review after merge?
published: true
description: Is the sum of two approved PR's also an approved PR?
tags: ask, help, git, code-review
---

## Scenario

- I'm working on a big feature that I know can be broken into two parts
  - these parts are, as is often the case, dependent on each other.
- I branch off `master` and create branch `feat/part1`
- I finish coding part1, and create a PR with this branch
  - `feat/part1` -> `master`
  - this is `PR-1`
- While I'm still checked out in `feat/part1`, I create a new branch `feat/part2`
- I finish coding part 2 and create a second, "stacked" PR
  - `feat/part2` -> `feat/part1`.
  - this is `PR-2`

Let's say both PRs get reviewed and approved. I now merge PR-2.
- PR-1 now contains all the changes.

## Question

- Can I assume that PR-1 is now approved and merge-able or do I need to re-review it?

## Background

- As for why someone would do this, this technique of breaking up PRs is a way to breakup large changes into more manageable chunks
- That way the rest of the team can give feedback more easily.
- Can read more about it here: [Stacked PRs To Keep Github Diffs Small | graysonkoonce.com](https://graysonkoonce.com/stacked-pull-requests-keeping-github-diffs-small/)
Laravel 6 REST API with Passport Tutorial with Ecommerce Project
Tags: restapi, laravel, laravelpassport
Published: 2019-12-14 07:20:48

Rest Api Development
In this tutorial, we’ll explore the ways you can build—and test—a robust API using Laravel. We’ll be using Laravel 6, and all of the code is available for reference on GitHub. Now we are going to develop a ecommerce rest api where we have a product table and a review table. Using those two table we will make our ecommerce rest api. 

RESTful APIs
First, we need to understand what exactly is considered a RESTful API. REST stands for REpresentational State Transfer and is an architectural style for network communication between applications, which relies on a stateless protocol (usually HTTP) for interaction.

https://codechief.org/article/laravel-6-rest-api-with-passport-tutorial-with-ecommerce-project
Reading Snippets [10]
Tags: beginners, javascript
Published: 2019-12-14 12:31:21

Pure functions are functions that satisfy two conditions: 


- Deterministic
- No Side Effects 

They are deterministic which means that they will always return the same output for any given input. They also do not have side effects which means they cannot change global variables. 

Not only do pure functions not have side effects but also pure functions do not rely on code that has side effects. They always give the same return value for the same input parameters.
PHP form 20: input text textarea
Tags: php, form
Published: 2019-12-14 13:28:25

___

### <center>Happy Coding</center>

---

{% replit @antelove19/PHP-form-20 %}

---

[`Previous`](https://dev.to/antelove19/php-form-10-input-text-1ep8)

In **index.php**

```php
    <form method="post" action="process.php" >

        Firstname: <input type="text" name="firstname" />
        <br />

        Lastname: <input type="text" name="lastname" />
        <br />
```

Add input type **description**:

```php
        Description: <textarea name="description" rows="10" cols="50"></textarea>
```

---

```php
        <br />

        <hr />

        <input type="submit" name="submit" value="Submit" />

    </form>
```

---

In **process.php**

```php
    echo "<pre>";

    var_dump($_POST);
```

---

[`Source Code`]() [`Next`](https://dev.to/antelove19/php-form-30-input-text-radio-textarea-4kf4)

---

<center>Thank for reading :)</center>

---
PHP form 45: input text textarea select-multiple
Tags: php, form
Published: 2019-12-14 14:41:41

___

### <center>Happy Coding</center>

---

{% replit @antelove19/PHP-form-45 %}

---

[`Previous`](https://dev.to/antelove19/php-form-40-input-text-textarea-select-27mc)

We will create form with type **select multiple** input:

```php
    <form method="post" action="process.php" >

        Firstname: <input type="text" name="firstname" />
        <br />

        Lastname: <input type="text" name="lastname" />
        <br />

        Description: <textarea name="description" rows="10" cols="50"></textarea>
        <br />
```

Add input type **select** with: 
1. It name in array postfix *[]* 
2. Set attribute *multiple*
3. Set attribute *size*; default *size='4'* (options)

```php
        Programming Language (multi): (hold ctrl + click item)
        <select name="languages[]" multiple size="5" >
            <option value="c" >C</option>
            <option value="c++" >C++</option>
            <option value="java" >Java</option>
            <option value="javascript" >Javascript</option>
            <option value="php" selected >PHP</option>
        </select>
```

---

```php
        <br />

        <hr />

        <input type="submit" name="submit" value="Submit" />

    </form>
```

---

And, the process:

```php
    echo "<pre>";

    var_dump($_POST);
```

---

[`Source Code`]() [`Next`](https://dev.to/antelove19/php-form-50-input-text-textarea-checkbox-4gni)

---

<center>Thank for reading :)</center>

---
PHP form 55: input text textarea checkbox-multiple
Tags: php, form
Published: 2019-12-14 14:49:05

___

### <center>Happy Coding</center>

---

{% replit @antelove19/PHP-form-55 %}

---

[`Previous`](https://dev.to/antelove19/php-form-50-input-text-textarea-checkbox-4gni)

We will create form with type **checkbox multi** input:

```php
    <form method="post" action="process.php" >

        Firstname: <input type="text" name="firstname" />
        <br />

        Lastname: <input type="text" name="lastname" />
        <br />

        Description: <textarea name="description" rows="10" cols="50"></textarea>
        <br />
```

Add input type **checkbox** with all name are same and in array postfix *[]*:

```php
        Hobbies (multiple):
        <input type="checkbox" name="hobbies[]" value="studying" /> Studying
        <input type="checkbox" name="hobbies[]" value="reading" checked /> Reading
        <input type="checkbox" name="hobbies[]" value="writing" /> Writing
        <input type="checkbox" name="hobbies[]" value="sleeping" checked /> Sleeping
```

---

```php
        <br />

        <hr />

        <input type="submit" name="submit" value="Submit" />

    </form>
```

---

And, the process:

```php
    echo "<pre>";

    var_dump($_POST);
```

---

[`Source Code`]() [`Next`](https://dev.to/antelove19/php-form-60-input-text-textarea-file-4okj)

---

<center>Thank for reading :)</center>

---
Day 10 – Mastering EventEmitter - Learning Node JS In 30 Days [Mini series]
Tags: node, javascript, codenewbie
Published: 2019-12-14 18:09:29

Go to https://nodejs.org/dist/latest-v12.x/docs/api/fs.html then you can see oficial document of fs

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/1o844vmsn79m5j94rjnw.png)

Now, first we need to require the fs and store it on a const by writing `const fs = require('fs')`

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/mqsw2ss1xbzkg65s9tv4.png)

We are going to use `fs.readFileSync`

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/cx30ijdhdwg8sk73xmkj.png)

I am using a `song.txt` file on same folder and read file text using `readFileSync` and console log it

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/o031isdkr46q1eu5xknk.png)

Run it and see the magic

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/bm0j1obsjsr5k67dxmfe.png)

We are going to use writeFileSync for the writing in song.txt file

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/lb37wdqtfycxkanoar1j.png)

Using fs.writeFileSync(path, dataForWrite) we can write in the file, what we need to write.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/f6rbhjg8hr15dqdaozqc.png)

After write, we need to read the data so that we can see if are able to change - 

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/jk92pt1s4iptakraxcgd.png)

Did you used fs module before ?

You can see the graphical version here
{% instagram B6BF9-_AzXa %}

Originally it published on [nerdjfpbblog](https://blog.nerdjfpb.com/day10-nodejsin30days/). You can connect with me in [twitter](https://twitter.com/nerdjfpb) or [linkedin](https://www.linkedin.com/in/nerdjfpb/) !


You can read the old posts from here --

{% post nerdjfpb/day-1-learning-node-js-in-30-days-mini-series-55e7 %}

{% post nerdjfpb/day-2-learning-node-js-in-30-days-mini-series-5023 %}

{% post nerdjfpb/day-3-learning-node-js-in-30-days-mini-series-24i4 %}

{% post nerdjfpb/day-4-learning-node-js-in-30-days-mini-series-1koc %}

{% post nerdjfpb/day-5-learning-node-js-in-30-days-mini-series-21jm %}

{% post nerdjfpb/day-6-learning-node-js-in-30-days-mini-series-758 %}

{% post nerdjfpb/day-7-learning-node-js-in-30-days-mini-series-3023 %}

{% post nerdjfpb/day-8-var-vs-let-vs-const-learning-node-js-in-30-days-mini-series-1i72 %}

{% post nerdjfpb/day-9-mastering-eventemitter-learning-node-js-in-30-days-mini-series-2dfe %}