teleren/devto huggingface dataset:
Behind The Scenes Of The Linode Object Storage Service - Episode 125
Published: 2020-03-23 14:17:34

<p>There are a number of platforms available for object storage, including self-managed open source projects. But what goes on behind the scenes of the companies that run these systems at scale so you don't have to? In this episode Will Smith shares the journey that he and his team at Linode recently completed to bring a fast and reliable S3 compatible object storage to production for your benefit. He discusses the challenges of running object storage for public usage, some of the interesting ways that it was stress tested internally, and the lessons that he learned along the way.</p><p><a href='https://www.dataengineeringpodcast.com/linode-object-storage-service-episode-125/'>Listen Now!</a></p>
I built a discord bot for freecodecamp's code radio
Tags: showdev
Published: 2020-03-23 13:49:59

Hey everyone, today I want to share a project I decided to make today. 

If you don't already know, [code radio](https://coderadio.freecodecamp
.org) is freecodecamp's music stream that plays ambient music for coding 24/7.

What I did is, I brought that music stream into a discord bot, so that you can listen to code radio within a discord server.

You can add this bot to your own discord server. Click [here](https://discordapp.com/api/oauth2/authorize?client_id=691360591507619881&permissions=3147776&scope=bot) to do so.

You can find instructions on how to use the bot on its [official home page](https://coderadio.jaeheonshim.dev).

Finally, you can find the source code [here](https://github.com/jaeheonshim/coderadio-bot). Stars on the GitHub repository would be really appreciated!

Thanks for checking my project out
Jaeheon Shim
What have you always wanted to know about publishing a tech book? 🤔
Tags: discuss, writing, career
Published: 2020-03-23 13:49:21

Hey DEV Community friends 👋🏽

I'm currently [writing a book for developers about tech publishing and self-publishing](https://bit.ly/DGTBP). I have experience with both; I served as an editor for three books from three different tech publishers and have self-published my first book.

**What have you always wanted to know about publishing a tech book?** If you're thinking of writing a book (any kind of book for tech audiences of any length) what are some areas of confusion in the traditional publishing process and with self-publishing that can be clarified? I'm currently halfway through writing but I want to make sure I answer any common questions people may have. 

Thank you!
LETS Try REDWOODJS
Tags: redwoodjs, jamstack, fullstack, javascript
Published: 2020-03-23 13:44:52

I came across this new [JAMStack](https://jamstack.org/) framework which you can try out. 

[REDWOODJS](https://redwoodjs.com/) is known to bring Full-stack development with the JAMStack approach.

*This framework uses React, GraphQL, and Prisma behind the scene to build a full-stack app with the ready to use tools.*

Well-written [documentation](https://redwoodjs.com/docs) will help you to get started with building an application.

Let me know what you think of this framework and share your ideas.

**Happy Learning!!**
Getting Started with Vue 3: Composition API
Tags: vue, api, javascript
Published: 2020-03-23 13:26:29

---
title: Getting Started with Vue 3: Composition API
published: true
description: Learn about the new Composition API in Vue 3 and how it compares to the Options API
tags: #vuejs #API #javascript
canonical_url: https://auth0.com/blog/amp/getting-started-with-vue-3-composition-api/
---
The long-awaited Vue.js 3 is scheduled for release in the 1st quarter of 2020. The announcement of a new API, the Composition API, resulted in some controversy in the Vue community. It has since simmered down, but what is the Composition API anyway?

Although Vue 3, in its entirety, hasn't been released yet, the Composition API is already out and ready to use. In this article, we'll take a look at why the Composition API was introduced, how it works, and how it compares to the options-based API. At the end, we'll build two versions of the same component: one with the Composition API and one with the options-based API!
[Read on 📖](https://auth0.com/blog/amp/getting-started-with-vue-3-composition-api/?utm_source=dev&utm_medium=sc&utm_campaign=vue_compapi)
What is your preferred way to handle authentication in SPA?
Tags: discuss, spa, jwt, auth
Published: 2020-03-23 13:15:15

---
title: What is your preferred way to handle authentication in SPA?
published: true
description: 
tags: discuss,spa,jwt,auth
---

Almost all SPAs use JWT for authentication. I was answering a [question of an Indian student in Stack Overflow](https://stackoverflow.com/questions/60812763/how-to-redirect-after-successful-login-in-react-js/60813526#60813526). The flow is typical. If a user is logged in it will redirect to dashboard page. Otherwise, the default page will be displayed.

I have implemented this flow for a number of times. So I have my own way and I'm kinda stuck on it. So I asked myself: "Hey, how the other guys (in **DEV**) are doing this? What is the best practice?"

There are multiple choices and ways to handle JWT authentication in an SPA. Let me recall some of them:

We can store jwt tokens in `Cookie`, `sessionStorage` or `localStorage`.

For redirect, we can simply use `location.href` in vanilla JS. or use `redux` to susbscribe login state in `App` component and let it redirect after a state change with `Redirect` component.

To get login state again, we can get token from `localStorage`(or other "local" storages). We might also go further to ask a server if this is a valid token. Or simply we assume this is a valid token and handle 403 errors from api calls later.

Some devs like `localStorage` and [others don't](https://dev.to/rdegges/please-stop-using-local-storage-1i04). Some devs prefer `redux` to handle login state globally. Some guys would love to call `/me` to see if the provided token is a valid one.

I normally use `localStorage` to store JWT tokens, use `location.href` after a successful login and handle 403 errors in all api calls that require authentication/authorization.

What is your preferred way to handle authentications in SPAs? Please share.

Store JWT token in:
- Cookie
- sessionStorage
- localStorage

Handle redirect after successful login with:
- vanilla Javascript
- `Redirect` component

Manage login state with:
- Redux (react-redux, vuex, rxjs etc.)
- Call a helper function whenever necessary

Verify provided token with:
- Call `/me` (or something like that) whenever necessary
- Trust it first and handle 403 later
Laravel Mock Services in order to test your code resolving it.
Tags: laravel, services, mock, phpunit
Published: 2020-03-23 13:14:46

Sometimes I need to resolve a service via `resolve` function for example let suppose we have the following service provider:

```
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
// A dummy service to reguister
use App\Services\MyService;

class DummyServiceProvider extends ServiceProvider
{
  public function register():void
  {
    $config=config('myconfig');
    //Hyptothetical class
    $service=new MyService($config);
    
    $this->app->bind('myservice',$service);
    // Alternatively $this->app->bind(MyService::class,$service);
  }
}
```
And I resolve it via:

```
$service=resolve('myservice');
```

Or in case you used a class name for the service:

```
$service=resolve(MyService::class);
```

But you want during testing to mock the `MyService` for example:

```
$mockedService=Mockery::mock(MyService::class);
``` 

So in order to test that your code (either job or route or console or queued job) retrieves the mocked service then use:

```

namespace Tests\Unit;

use Tests\TestCase;

class MyTest extends TestCase
{
   public function tetMyTest()
   {
      $this->app->instance('myservice',$mockedService);
      //Rest of test here
   }
}
```
Hope it helps. Keep in mind that this is better because instead of stubbing the `resolve` you actually implement into your test and the service resolving that it may be part of its logic.
The Building an Indie Business Podcast- How Storytelling Can Improve Your Podcast
Tags: podcast
Published: 2020-03-23 13:08:12

In this episode I discuss how learning to tell a story can improve a podcast. In this episode I go how how to tell a story, comedians and storytelling,  why focus on storytelling, the benefits, and problems.

https://overcast.fm/+RG5gje57c
[Revenue Research](https://revenueresearch.co/)
[Episode Page](https://baib-podcast.com)
7 tips & tools for effective "teamwork from home"
Tags: productivity, workfromhome, teamwork
Published: 2020-03-23 13:02:04

---
title: 7 tips & tools for effective "teamwork from home"
published: true
description: My learning as a developer & community builder working from home since 2016
tags: productivity, WorkFromHome, teamwork, discuss
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/42kezggaakdh9k57na2e.jpeg
canonical_url: https://blog.invidelabs.com/tips-to-work-from-home/
---

My learning of running a community of 15000 highly productive developers working from home. I have been working from home since 2016. I know some things about "work from home" and "teamwork" that you can trust. I condense my learning in 7 important and easy to follow practices.

> While many of us are confident to work from home effectively as an individual. It is  effective **teamwork** that drives output and keeps the organizations running. Ineffective teamwork leads to stress.

So how can you be a great team player when working from home? Follow these 7 simple tips

1. **Have a dedicated space for work** - define boundaries between your work space and family space
2. **Communicate proactively** - when you're working remotely, you need to communicate more effectively to make sure your team knows how you're progressing/thinking to achieve your work goals. Communicate more and be more transparent. Quick messages on team chat such as "hi, starting my work for the day" or communicating about status proactively even if it's not good e.g. "I didn't achieve today's goals, did some research on__" are example of an awesome remote team member
3. **Always be on time** for planned team calls, even 2 min late is LATE and can impact team morale negatively faster than coronavirus
4. **Have some overlapping time with team** - agree to have a fixed overlapping work time(at least 1-2 hrs everyday) with your team members so you can resolve those quick queries, brainstorm and move forward fast
5. **Decide your work timings, break timings and family time**; communicate the same with your family members, clearly ask them to not disturb and wait till your work time is over
6. **Have an exercise routine** - it can be running or workout at home or at gym. Do it for at least 10 mins everyday
7. **Add some reliable tools in your toolbox**- To make your life easier, here's a list of essential tools for the best "work from home" experience

* [Zoom](https://zoom.us/) for online face to face meetings
* [Google calendar](https://calendar.google.com/) to block your work and family time
* [Calendly](https://calendly.com/) to make meeting scheduling easier
* [Developer Diary](https://flow.invidelabs.com) every person is different and the best productivity advice is the one that comes from yourself. **You can accelerate your awareness using this tool by understanding your work habits. This will help you take the right decisions to boost your and team's productivity.**

Would love to hear your experience of working from home
Daily Developer Jokes - Monday, Mar 23, 2020
Tags: jokes, dailydeveloperjokes
Published: 2020-03-23 13:00:03

---
title: "Daily Developer Jokes - Monday, Mar 23, 2020"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Monday%2C%20Mar%2023%2C%202020"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e12589f412c5.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit.*

<!-- 
Joke text:
___Q:___ Why did the angry function exceed the callstack size?

___A:___ It got into an Argument with itself
 -->
Not well known attributes for ordered list in HTML
Tags: html
Published: 2020-03-23 12:41:46

In html exist the **ol** tag that allow you to show an ordered list.

```html
<ol>
    <li>Banana</li>
    <li>Strawberry</li>
    <li>Peach</li>
    <li>Orange</li>
    <li>Lemon</li>
</ol
```

and for the above code the result is the following:

![Ordered list showing name of fruits from 1 to 5](https://eperedo-blog.s3.amazonaws.com/html/ol/ol-1.PNG)

But what about if you want to change the order number? You can use the value attribute for the **li** tag.

```html
<ol>
    <li value="5">Banana</li>
    <li value="4">Strawberry</li>
    <li value="3">Peach</li>
    <li value="2">Orange</li>
    <li value="1">Lemon</li>
</ol
```

and the result will be:

![Ordered list showing name of fruits from 5 to 1](https://eperedo-blog.s3.amazonaws.com/html/ol/ol-value-li.PNG)

Great, but there is another attribute that may be useful and give you the same result with less code. I am talking about the **reversed** attribute

```html
<ol reversed>
    <li>Banana</li>
    <li>Strawberry</li>
    <li>Peach</li>
    <li>Orange</li>
    <li>Lemon</li>
</ol
```

much better because of the "less code" part!

![Ordered list showing name of fruits from 5 to 1 using the reverse attribute](https://eperedo-blog.s3.amazonaws.com/html/ol/ol-reversed.PNG)

Ok but now you have a section where you need to show the **Top Ten Fruits**. I know! You are thinking in an easy solution, just mix the **reversed** attribute with the **value** attribute, right?

```html
<ol reversed>
    <li value="10">Banana</li>
    <li>Strawberry</li>
    <li>Peach</li>
    <li>Orange</li>
    <li>Lemon</li>
</ol
```

![Ordered list showing name of fruits from 10 to 5 using the reverse and value attribute](https://eperedo-blog.s3.amazonaws.com/html/ol/ol-reversed-value-li.PNG)

Sure, that get the job done, but in this case there is other way using the **start** attribute. 

```html
<ol reversed start="10">
    <li>Banana</li>
    <li>Strawberry</li>
    <li>Peach</li>
    <li>Orange</li>
    <li>Lemon</li>
</ol
```

Good now you can have the same behavior but using only attributes for the **ol** tag.

![Ordered list showing name of fruits from 10 to 5 using the reverse and start atrribute](https://eperedo-blog.s3.amazonaws.com/html/ol/ol-reversed-start.PNG)

### Browser Support

All these examples will work fine in basically every browser, but worth mentioning a couple of things:

- **start** attribute for the **ol** tag was deprecated in html 4, but still supported in html 5.
- **value** attribute for the **li** tag was deprecated in html 4, but still supported in html 5.

Hope it helps!
How to Shuffle a List in Python
Tags: python
Published: 2020-03-25 05:25:41

---
title: How to Shuffle a List in Python
published: true
date: 2020-03-23 12:38:00 UTC
tags: Python
canonical_url: https://coderscat.com/how-to-shuffle-a-list-in-python
---

## Shuffle a List with Random

`random` is a [Python module](https://docs.python.org/3/library/random.html) that implements pseudo-random number generators. `random.shuffle` can shuffle a list in-place.

```
random.shuffle(x[, random]): Shuffle the sequence x in place.

The optional argument random is a 0-argument function returning 
a random float in [0.0, 1.0); by default, this is the function random().
```

Let’s run a simple usage example. From the output we can see the list is modified after shuffling, this is called `in-place` strategy:

```python
import random
numbers = [71, 1, 21, 22, 35, 41, 49, 56, 63, 70]
print ("Original: ", numbers)
> ('Original: ', [71, 1, 21, 22, 35, 41, 49, 56, 63, 70])

random.shuffle(numbers) #shuffle method
print ("Shuffled: ", numbers)
> ('Shuffled: ', [49, 22, 63, 70, 56, 21, 1, 71, 41, 35])

```

We can also use `random.shuffle()` to shuffle a list with strings.

```python
a = ["hello", "coder", "cat"]
random.shuffle(a)
print(a)
> ['coder', 'hello', 'cat']
```

## Shuffle a list with not-in-place

If we don’t want to modify the original list, we can use another function called `random.sample`, it will return a new list and keep the original list un-touched.

This is called `not-in-place` strategy:

```python
import random
numbers = [71, 1, 21, 22, 35, 41, 49, 56, 63, 70]
new_numbers = random.sample(numbers, len(numbers))
print ("new_numbers: ", new_numbers)
> ('new_numbers: ', [56, 35, 49, 41, 71, 70, 22, 63, 1, 21])
```

## Implement it by yourself

> Challenge:
> 
> Implement a Python function which will shuffle a list, return a new list.

If this is an interview question, can you finish it bug-free in 15 minutes?

Have a try now, :)

A simple algorithm for shuffling array or list is [Fisher-Yates](https://coderscat.com/random-number-and-card-shuffling-algorithm):

```python
from copy import deepcopy
from random import randint

def shuffle(lst):
    tmp = deepcopy(lst)
    m = len(tmp)
    while(m):
        m -= 1
        i = randint(0, m)
        tmp[m], tmp[i] = tmp[i], tmp[m]
    return tmp

foo = [1,2,3]
shuffle(foo) # [2,3,1] , foo = [1,2,3]
```

The post [How to Shuffle a List in Python](https://coderscat.com/how-to-shuffle-a-list-in-python) appeared first on [CodersCat](https://coderscat.com).
Streaming data from Kafka to a Database - video walkthrough
Tags: apachekafka, java, database, tutorial
Published: 2020-03-23 12:34:03

Check out [this tutorial](https://rmoff.dev/kafka-jdbc-video) on how to get data from Apache Kafka into a database using the JDBC Sink. The demo is based on MySQL but the connector works for any common database with a JDBC driver - Oracle, Postgres, MS SQL, DB2, etc etc.

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

Topics covered (click to go directly to that section): 
* [Populating some data into a test topic](https://www.youtube.com/watch?v=b-3qN_tlYR4&t=44s)
* [Creating the JDBC Sink](https://www.youtube.com/watch?v=b-3qN_tlYR4&t=175)
* [Putting the JDBC driver in the correct place](https://www.youtube.com/watch?v=b-3qN_tlYR4&t=287)
* [JDBC Sink connector in action](https://www.youtube.com/watch?v=b-3qN_tlYR4&t=465)
* [Debugging the JDBC Sink connector](https://www.youtube.com/watch?v=b-3qN_tlYR4&t=532)
* [INSERT vs UPSERT](https://www.youtube.com/watch?v=b-3qN_tlYR4&t=627)
* [Dropping fields, adding metadata](https://www.youtube.com/watch?v=b-3qN_tlYR4&t=746)
* [Evolving the target table schema](https://www.youtube.com/watch?v=b-3qN_tlYR4&t=872)
* [JDBC Sink and schemas](https://www.youtube.com/watch?v=b-3qN_tlYR4&t=981)
* [Working with JSON data and the JDBC Sink](https://www.youtube.com/watch?v=b-3qN_tlYR4&t=1098)
* [Applying a schema to JSON data with ksqlDB](https://www.youtube.com/watch?v=b-3qN_tlYR4&t=1683)
* [Working with CSV data and the JDBC Sink](https://www.youtube.com/watch?v=b-3qN_tlYR4&t=2041)

You can see the instructions and demo code to try yourself [here](https://rmoff.dev/kafka-to-jdbc).

👇 Leave a message in the comments with any suggestions for which Kafka Connect question or connector I should walk through next :)
Covid19 REST API's
Tags: showdev, python, redis
Published: 2020-03-23 12:22:18

The team at [Johns Hopkins University CSSE](https://systems.jhu.edu/) has been maintaining a [database](https://github.com/CSSEGISandData/COVID-19) of cases across the globe in CSV files. [Pomber](https://github.com/pomber/covid19), a user on Github has recently converted the same dataset into a [JSON file](https://pomber.github.io/covid19/timeseries.json).

My friends - [Harsh Jain](https://www.linkedin.com/in/hrkj-18), [Girisha Navani](https://www.linkedin.com/in/girisha-navani-87065215b/) and [I](https://www.linkedin.com/in/saiprasadbala/) took it up as a learning opportunity and decided to work on the data instead of building yet another dashboard. We took the initiative of building a heavily cached, blazingly fast REST interface on top of the data to enable other developers.

{% github https://github.com/backtrackbaba/covid-api %}

Our endpoints are capable of the following:

**Country specific historic data:** Right from 22nd January to the latest updated day.

**Country specific data for a particular date:** This gives you an insight into the spread of the virus in a country on a particular date.

**Latest Global Count:** Gives you the latest updated count of the virus globally

**Global count on a particular date:** This data gives you a count of the virus globally, on a particular date

**Global count in a date range:** This gives you the number of cases in a date range 

Our project internally consumes Pomber's JSON data and cleans it a bit by changing all the references of Country names to their respective three-character ISO codes and the dates have been standardized to adhere to ISO-8601 specs of `yyyy-mm-dd`

Additionally, we have taken care to ensure that our APIs are versioned so that they do not affect any downstream users if our upstream data changes. 
Johns Hopkins, has yesterday said that their data is going to change a bit which means we too would move on to v2 of our API's by adapting to changes at the same time still maintaining the v1 endpoints.

{% github https://github.com/CSSEGISandData/COVID-19/issues/1250 %}

These are the endpoints that have already been deployed. A few more are in the pipeline and we would love to get the help of open source community in taking initiative this forward!

As Software Developers, there isn't much that we could do on the field to help combat the virus, but the geeks inside us made us take us this initiative to help curtail the spread of false information and rely on the data provided by global experts such as John Hopkins

Github Repository: [https://github.com/backtrackbaba/covid-api](https://github.com/backtrackbaba/covid-api)

Documentation: [Postman Docs](https://documenter.getpostman.com/view/2568274/SzS8rjbe?version=latest)

Website: https://covidapi.info

#P.S: Here's our tech stack
- Python

- Flask

- Redis

- Gunicorn

- Nginx

- PostgreSQL

- Hosted on DigitalOcean
 

Do let us know if you have any suggestions or feedback or any other endpoint which could make your life easier. Contributions are always welcome and encouraged!

Hack on!
Check out Android Docs Dark color scheme for your IDE
Tags: android, theme, intellij
Published: 2020-03-23 12:11:43

Hello, guys! If you're interested in creating mobile apps for Android, you probably checked out Android Dev web site and you saw their color scheme. I created the dark color scheme for your IDE based of their web site.  It's free, you can get the theme on my GitHub repo by the url below.
https://github.com/ochagovdanil/AndroidDocsDark
Building Web Map application using Node JS, MongoDB and Leaflet js
Tags: node, mongodb, webdev
Published: 2020-03-23 11:56:20

trying to query a specific point from geojson data being stored in mongodb. im using mongoose to do the operations. So far all i can achieve is getting the file which is a feature collection of all the points in the database. my goal is to query a specific point in that feature collection file and update its values.