teleren/devto huggingface dataset:
Welcome Thread - v88
Tags: welcome
Published: 2020-08-26 17:24:42

---
title: Welcome Thread - v88
published: true
description: Welcome to DEV! A thread of hellos and intros.
tags: welcome
---

![ladybug hello](https://media.giphy.com/media/3o7aCUQ7TsQ3cndExq/giphy.gif)

### Welcome to DEV!

1. Leave a comment below to introduce yourself! You can talk about what brought you here, what you're learning, or just a fun fact about yourself.

2. Reply to someone's comment, either with a question or just a hello. 👋 

**Great to have you in the community!**
Convert to Boolean
Tags: javascript, webdev, beginners
Published: 2020-08-26 17:21:30

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

**Thanks for reading 💙**  
Follow **@codedrops.tech** for daily posts.  
[Instagram](https://www.instagram.com/codedrops.tech/) ● [Facebook](https://www.facebook.com/codedrops.tech/)

Micro Learning ● Web Development ● Javascript ● MERN stack  
**www.codedrops.tech**
HTML multi-select listbox
Tags: html, javascript, beginners
Published: 2020-08-26 17:14:00

Hello, it seems that I am have having challenges in implementing a multi-select listbox for a form. I dont know if it must be used alongside a JavaScript?

I found the link below but it has not helped yet.

https://www.w3.org/TR/wai-aria-practices-1.1/examples/listbox/listbox-rearrangeable.html
Future of C# Event: Submit your questions here!
Tags: csharp, ama
Published: 2020-08-26 17:10:34

##**About the Event**
Join us for a fantastic session with Mads Torgersen as we cover the new features of C#9.0, the future of the language and some of the amazing features built for you. 

We have limited time, but we'd love to get your questions answered. If you see a question already posed below you want to see answered, please help us prioritize by adding a heart.

##**What now?**
1. 🗓 Register [here](powerafrica.splashthat.com) for the event and review our Code of Conduct.
2. 📬 Post your questions now in the comments to hear Mads' answers during the event.
3. 📺 Join us [here](powerafrica.splashthat.com) at 2:00PM GMT on September 17th to see the live event!

{% youtube vfkKfzHByQc %}
Error fixing and Debugging React Native as a job
Published: 2020-08-26 16:52:17

Have been working with React Native Intensively for about a year and half now. Everyone conversant with the React ecosystem, especially React Native must acknowledge having made terms with the Mountain lump of errors that may arise in the process.
     Most of these errors always arise due to the limitations that the React native bridge has in porting Javascript modules with/to native modules. Many times I've had myself trans night trying to look up a solution at GitHub, StackOverflow to no avail, this is always the least you want to see happening as a freelancer working under strict datelines and for a client who might not really get what the whole process entails.
     So today I set out to offer a quick solution by offering to debug as a service. Mainly Targeting React and React Native issues/errors, which might include writing own custom native modules to port to the React side of the app successfully, this isn't really a bug, but a good recipe for the strenuous bugs.
     I know there exist some people already doing this, but I want to dedicate myself to the venture with the aim of honing my skills further and prepare adequately for future projects.
     If you use React/React Native often. You can show some love by saving my gig [https://www.fiverr.com/share/QrYqo1] so you can easily reach out upon need.

Thanks for the read, please leave your comments and feedback below.
PcapPlusPlus v20.08 released!
Published: 2020-08-26 16:38:51

I'm very excited to share that v20.08 (August 2020) of [PcapPlusPlus](https://pcapplusplus.github.io/) has just been released!

https://github.com/seladb/PcapPlusPlus/releases/tag/v20.08

[PcapPlusPlus](https://pcapplusplus.github.io/) is a multiplatform C++ library for capturing, parsing and crafting of network packets. It is designed to be efficient, powerful and easy to use.

PcapPlusPlus enables decoding and forging capabilities for a large variety of network protocols. It also provides easy to use C++ wrappers for the most popular packet processing engines such as libpcap, WinPcap, Npcap, DPDK and PF_RING.

If you like this project and want to support it please add a GitHub star ⭐⭐

Feel free to reach out to me for any question or suggestion you might have. You can open a [GitHub issue](https://github.com/seladb/PcapPlusPlus/issues), post on [PcapPlusPlus Google Group](https://groups.google.com/d/forum/pcapplusplus-support) or shoot me an email to pcapplusplus@gmail.com
TypeScript: Nullish Coalescing
Tags: typescript, angular, javascript
Published: 2020-08-26 16:37:23

The nullish coalescing operator is another upcoming ECMAScript feature that goes hand-in-hand with optional chaining.

You can think of this feature - the `??` operator - as a way to “fall back” to a default value when dealing with null or undefined. When we write code like
```
let x = foo ?? bar();
```
Again, the above code is equivalent to the following.
```
let x = foo !== null && foo !== undefined ? foo : bar();
```
The `??` operator can replace uses of `||` when trying to use a default value.

For example, the following code snippet tries to fetch the volume that was last saved in localStorage (if it ever was); however, it has a bug because it uses `||`.
```
function initializeAudio() {
  let volume = localStorage.volume || 0.5;
  // ...
}

0 || 0.5 = 0.5 //wrong
0 ?? 0.5 = 0 //correct
```
When localStorage.volume is set to 0, the page will set the volume to 0.5 which is unintended. `??` avoids some unintended behavior from 0, NaN and "" being treated as falsy values.
Difference between innerText, textContent, innerHtml and outerHtml
Tags: javascript, css, html
Published: 2020-08-26 16:21:21

Often we need to extract the text from Html elements. but 
sometimes we are puzzled about the difference between them. let's tackle them now. this is our html element: 
```html
<h2>
   Sub Div
   <span>I am hidden</span>
</h2>
```

we want to, extract the text part of the above element. let's write some javascript(basically dom-manipulation),
```js
const heading = document.querySelector('h2');
console.log(heading.textContent);
console.log(heading.innerText);
```
You can see in the browser console. both outputs are almost the same (the one which uses '*textContent*' is not trimmed properly)

<a href="https://imgbb.com/"><img src="https://i.ibb.co/wR95q3Y/screenshot.png" alt="screenshot" border="0"></a>



So, what is the difference between them? For example, we add a style tag inside h2 element.

```html
<h2>
   Sub Div
   <style>
      h2 {
      background-color: orangered;
      }
   </style>
   <span>I am hidden</span>
</h2>
```
now if you console.log again. you will get this as output

<a href="https://imgbb.com/"><img src="https://i.ibb.co/bFm14c1/screenshot-1.png" alt="screenshot-1" border="0"></a>

We are seeing that the *textContent* is giving the whole style element along with text and *innerText* is giving us the human-readable text.

There is another useful difference between them. suppose we hidden the visibility of an element by applying css rules and then try to extract them.

```html
<head>
   <style>
      h2 span {
      display: none;
      }
   </style>
   <head>
<body>
   <h2>
      Sub Div
      <span>I am hidden</span>
   </h2>
</body>
```
Now let's take a look what console.log gives us:

<a href="https://ibb.co/hM3WHzP"><img src="https://i.ibb.co/mBfqtWL/screenshot-2.png" alt="screenshot-2" border="0"></a>

We are seeing that *textContent* does not care about the css rules but *innerText* does. So, *textContent* would be handy If we need to get the text of an element that is hidden by CSS. :wink:

The other two techniques are *innerHtml* and *outerHtml*. I think if we see the output in browser console we will understand them easily as they are pretty self-explanatory.

```js
const heading = document.querySelector('h2');
console.log(heading.innerHTML);
console.log(heading.outerHTML);
```

let's see the output in the browser cosnole

<a href="https://imgbb.com/"><img src="https://i.ibb.co/HFPjYq4/screenshot-4.png" alt="screenshot-4" border="0"></a>
What are reasons you're not using Svelte in production?
Tags: discuss, svelte, production, webdev
Published: 2020-08-26 16:14:03

We know there are a lot of perks using Svelte:
1. less code to write, less bugs to chase
2. smaller bundle size, fast performance
3. compiler only, no big run-time library or virtual DOM
4. typescript-friendly 
5. built-in easy-to-use transition and animation 
6. easy to use state management 
7. friendly for juniors to learn 

There are a few reasons as cons as well:
1. small community, less support for solutions 
2. eco-system is not as diverse as others, such as React's
3. might not support vintage browsers such as pre-IE 11
4. no big well-known application as examples to demonstrate the scalability of the apps

Are there any other reasons you're not using it in production? Especially if you're a tech lead, CTO or senior developer who has a say about what tech stack to use for projects, I'd really love to hear your perspectives! I understand it takes time time to rewrite things if you already have an app to maintain, but if you are given a chance to select tech stack to build new apps, will you choose Svelte? Why or why not?
[Solved] 2020: Pure Vanilla Javascript Smooth Scroll to Element on anchor tag click #id
Tags: javascript, smoothscroll, vanilla, trick
Published: 2020-08-26 16:11:06

It took me half an hour and countless of stackoverflow pages to find a perfect solution for a smooth scroll for `<a>` anchor links. 

So I'm adding here it as a snippet for future googlers. 

```js
document
    .querySelectorAll('.nav__item a[href^="#"]')
    .forEach(trigger => {
        trigger.onclick = function(e) {
            e.preventDefault();
            let hash = this.getAttribute('href');
            let target = document.querySelector(hash);
            let headerOffset = 100;
            let elementPosition = target.offsetTop;
            let offsetPosition = elementPosition - headerOffset;

            window.scrollTo({
                top: offsetPosition,
                behavior: "smooth"
            });
        };
    });
```
Plain Contact Us Form In HTML and CSS
Tags: html, css, webdev, weeklyui
Published: 2020-08-26 15:49:02

Contact us is really important for a website owner form to get feedback from users. So here we designed Plain Contact Us Form In HTML and CSS with fully responsive till mobile view.

In this contact us form we used simple HTML tags and CSS properties. Here we used flex properties to make this element center and also we used form fields to fill the form from users. Also, we used media quires to make this element responsive and attractive.

Make it yours now by using it, downloading it, and please share it. we will design more elements for you.

[Download Source Code](https://w3hubs.com/plain-contact-us-form-in-html-and-css/)
or
[Github Clone](https://github.com/w3hubs/Plain-Contact-Us-Form-In-HTML-and-CSS)
Quick Tips & Resources To Improve Your Github ReadMe
Tags: webdev, github, productivity
Published: 2020-08-26 15:48:13

Unless you have been living under a rock for the past few months, you are probably aware that Github has a cool new feature where you can create a custom markdown README intro for your Github profile page.

I finally got around to creating my initial implementation and wanted to share some quick tips and resources I came across while doing it.

## Getting Started? :construction:
For getting started or finding new ideas and inspiration, you can't go wrong with an awesome-* repository!

Repository: [awesome-github-profile-readme](https://github.com/abhisheknaiidu/awesome-github-profile-readme)

I highly recommend going through various examples and gathering inspiration from multiple sources.

To see the markdown implementation of a profile click into the README.md file and click the "Raw" version shown in the image below:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/5ll4avqzhkfj4ipxtrdz.png)
Once you have an idea of the direction you want to go you can get started!
## Emojis :thinking:
You will quickly notice that emojis are all over the place in almost all the examples you will find.

Most emojis are supported in markdown and you can find a full reference list:

[Markdown Emojies Cheat Sheet](https://github.com/ikatyang/emoji-cheat-sheet)

P.S. You can also use these same emojis in your Dev.to posts since it is also using markdown.:wink:
## Displaying Your Dev.to Blog Posts :closed_book:
Luckily there is already a great blog post that goes over this:

[Show your latest dev.to posts automatically on your GitHub profile readme](https://dev.to/gautamkrishnar/show-your-latest-dev-to-posts-automatically-in-your-github-profile-readme-3nk8)

## Video Resources :film_projector:
[Next Level GitHub Profile README](https://www.youtube.com/watch?v=ECuqb5Tv9qI)

[UPDATE: Next Level GitHub Profile README](https://www.youtube.com/watch?v=n6d4KHSKqGk)

These videos go over various features that can be added to your README including displaying blog posts, YouTube videos, Github stats, icons, badges, currently playing Spotify songs, and more!
## Bonus :heavy_plus_sign:
You might notice that a lot of examples will have no space in between the emoji and the text:

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

To manually inject spaces in between the two you can add `&nbsp;` spaces:

```
- :computer: &nbsp;&nbsp; I'm a full-stack software developer.
- :briefcase: &nbsp;&nbsp; Currently working on...
```
My job path for my first job as a self-taught developer
Tags: webdev, career, beginners, learning
Published: 2020-08-26 15:38:49

This month marks my first 6 months as a front end developer and I'm glad I'm doing so at [Coletiv](https://coletiv.com/). As a self-taught developer, I would like to share some reflections and thoughts on the job path!
(I'll leave my specific coding experience to another post)

## Starting Out 💭
I started at a sort of dev job at a marketing agency with WordPress but I really wasn't feeling like a dev (I'm not bashing on WordPress developers; I like WordPress but all I was doing was working with Elementor and mixing it up with my own CSS). It was, however, an entry job and I took it so I could get some work experience while I honed my skills.
It wasn't perfect but at least I wasn't idle!

## Job Seeking 💭
I did a lot of interviews while I was working and I did it for 6 months. I even had to create a sheet file to track every IT company I talked with :laugh:
The 1st wave of interviews taught me that I didn't know enough so I worked harder although I was really on the downslope (my self-confidence was taking a toll with so many interviews, denials and _"We need someone with more experience"_)

## My Skills 💭
I knew that I had to get a dev job to properly learn. I had to get in touch with the field. And I was honest about that in the interviews.
I didn't have much on my favor but I did have my willingness to learn and I knew what skills I actually knew!

## Career Path 💭
I needed a backup plan, tho, and I knew I enjoyed design so I worked on both skills: developing and designing. I was great at none but one helped the other and they gave me a slight advantage since front end and design go hand in hand

## End Result 💭
I believe that my personality, willingness to learn, design+code skills, and job experience got me the job. I knew I would enter the field by
1. having great coding skills
2. combining all I know and do.

And I'm actually glad that **2.** was the winner since life is more than code!

## Conclusion
Be human 🙋‍♂️ You're not just your coding skills and if you want a good working environment you don't want a job that sees you just as a developer. Be honest and resilient and hone all your skills that you actually want to carry with you

Thank you for reading 🤘 If you want you can follow me on [Twitter](https://twitter.com/HeyItzaMi) or maybe [Youtube](https://www.youtube.com/channel/UCwnDdBqfYvxIzDXXtyQ75fg)
Hide RED console.error LOG WALL while testing errors with jest
Tags: javascript, tutorial, snippet, jest
Published: 2020-08-26 15:34:42

While provoking errors on purpose during tests the red error logs can get really annoying and hide potential crucial information from your eyes.

Following a discussion on this [issue](https://github.com/facebook/jest/issues/5785) leads to a nice solution by Kent C. Dodds.

{% github https://github.com/facebook/jest/pull/5267#issuecomment-356605468 %}

---

**tl;dr;** A snippet to hide `console.error` logs during testing error messages.

```typescript
beforeEach(() => {
  jest.spyOn(console, 'error')
  // @ts-ignore jest.spyOn adds this functionallity
  console.error.mockImplementation(() => null);
});

afterEach(() => {
  // @ts-ignore jest.spyOn adds this functionallity
  console.error.mockRestore()
})
```

---
<span>Cover Photo by <a href="https://unsplash.com/@markusspiske?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Markus Spiske</a> on <a href="https://unsplash.com/s/photos/code-error?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></span>
How bot/troll network works on Linkedin
Published: 2020-08-26 15:32:46

Building bot/troll network is becoming more and more sophisticated. Below
are some findings on Linkedin, but similar scheme is probably used on other social networks.

####Disclaimer:
######1. Findings and interpretation reflect our opinion, and may not 100% accurate represent real scenario or actual facts.
######2. Tools are provided by 3-rd party, and accuracy is guaranteed to the level that 3-rd service generally provides.
######3. We did not use Linkedin API.
######4. No PII or any other personal information is stored after analyzes


###Steps which are used to build bot/troll network:
1. There are several accounts created daily from different geographical locations.

2. Those accounts are using either some dummy company names - when account's country claimed is not in ANZ, NA and EU regions, or associating themselves with big company names where active monitoring of Linkedin membership is not implemented.

3. Accounts are forming interconnected network - to present themselves as real persons accounts.

###Methods used to analyze accounts:
1. API calls  on reaction to owned posts (Not Linkedin API)
2. Account analyzes on 3rd party posts.
3. Comments analyzes in AWS Comprehend

######Note: "Country" refers to country claimed in account profile.

###Findings
1. Accounts have the highest chance to be  bots/trolls mostly active on 3rd party posts, without any or very low personal activities.

2. Bots/trolls which are active on racial, gender, diversity posts are mostly standalone accounts. Those accounts usually do not provide company name, much personal info. This finding is based on USA, Canada accounts analyzes.

3. Politically motivated bot/troll accounts usually form network before starting activity.

4. Politically motivated groups usually do not use all networks at once, but there are periodic activities on 1 network at a time to avoid much attention

5. Posts by bots/trolls usually return about 40%+ Negative sentiment score in AWS Comprehend.

6. Accounts from countries where Linkedin is banned have very high chance of being bots/trolls, except Russia, where having Linkedin account is not prosecuted as long as one does not touch politics.


I hope this quick introduction will help to recognize bot/trolls accounts.
Reading a datetime with miliseconds into an Oracle DATE
Tags: database, sql, oracle, tips
Published: 2020-08-26 15:54:04

---
title: Reading a datetime with miliseconds into an Oracle DATE
description:  "PL/SQL for course completion from Instructure Bridge's API"
published: true
date: 2020-08-26 15:00:00 UTC
tags: databases,sql,oracle,tips
canonical_url: https://katiekodes.com/plsql-miliseconds-date/
---

While fetching information from [Instructure’s Bridge learning management system](https://www.instructure.com/bridge/) API, I noticed that their course completion timestamps include miliseconds _(e.g. `2020-06-30T08:19:16.413-07:00`)_. I needed to load this value into a `DATE`-typed column in an Oracle database table.

With `the_completion_date_string` representing my incoming datetime from Bridge, at first I tried to use `TO_DATE()`:

```sql
TO_DATE(
	the_completion_date_string
	, 'yyyy-mm-dd"T"hh24:mi:ss.FF3TZH:TZM'
)

```

Unfortunately, that produced an `ORA-01821` error of `date format not recognized`.

[Justin Cave pointed out on StackOverflow](https://stackoverflow.com/a/9180233) that since Oracle’s `DATE` data type doesn’t store miliseconds, its [`TO_DATE()` function doesn’t recognize format strings that mention miliseconds](https://www.techonthenet.com/oracle/functions/to_date.php).

I checked to see what would happen if I just cut off `.FF3` _(which represented the period and the miliseconds)_ and `TZH:TZM` _(which represented the negative or positive timestamp indicating offset from UTC time)_ from my format string:

```sql
TO_DATE(
	the_completion_date_string
	, 'yyyy-mm-dd"T"hh24:mi:ss'
)

```

No dice. That procduced an `ORA-01830` error of `date format picture ends before converting entire input string`.

---

Combining Justin’s advice with [Peter Nosko’s tip on a different StackOverflow question](https://stackoverflow.com/a/44789541), it turns out that the correct fragment of code is:

```sql
CAST(
	TO_TIMESTAMP_TZ(
		the_completion_date_string
		, 'yyyy-mm-dd"T"hh24:mi:ss.FF3TZH:TZM'
	)
	AS DATE
)

```

---

My entire solution for parsing the JSON from a Bridge HTTP REST API response into an Oracle `VARCHAR2` as implied by my use of `the_completion_date_string` involved other function calls:

- Functions in the PL/SQL `UTL_FILE` package _([official documentation](https://docs.oracle.com/en/database/oracle/oracle-database/19/arpls/UTL_FILE.html))_
- `JSON_OBJECT_T.PARSE()`, [available since 12.2 per Carsten Czarski](https://blogs.oracle.com/apex/tips-for-parsing-json-in-apex) _([official documentation](https://docs.oracle.com/en/database/oracle/oracle-database/19/arpls/json-types.html))_
- The `.get_String()` function built into `JSON_OBJECT_T`-typed data _([official documentation](https://docs.oracle.com/en/database/oracle/oracle-database/19/arpls/json-types.html) & [examples](https://oracle-base.com/articles/12c/plsql-object-types-for-json-12cr2))_

I’ll have to save all that for another post.
Get the upstream distro name in Rust
Tags: rust, linux
Published: 2020-08-26 14:58:08

The other day we were chatting with a colleague of mine about retrieving the OS name of the distribution. I don't recall exactly the details, but it was something about always getting the actual distribution name and not the upstream one, and he could not sort that out (I have my suspicions that he didn't try very hard). 

Fast forward 2 weeks, I'm sipping coffee and installing updates on my laptop and suddenly this appears on the screen:

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

Oh, that's interesting 🤔, let's google "rust distribution id_like"? [LMGTFY](https://lmgtfy.com/?q=rust+distribution+id_like)

BOOM! first result: https://docs.rs/os-release/0.1.0/os_release/struct.OsRelease.html

Looks good, let's give it a try:

```sh
> cargo new guess_os
> cd guess_os 
> cargo add os-release
> vim src/main.go
```

very well now let's add the code 

```rust
extern crate os_release;

use os_release::OsRelease;
use std::io;

pub fn main() -> io::Result<()> {
    let release = OsRelease::new()?;
    println!("You say '{}', I say '{}'", release.name, release.id_like);
    Ok(())
}
```

And now the moment of truth 🥁

[![asciicast](https://asciinema.org/a/356037.svg)](https://asciinema.org/a/356037)

🏆