teleren/devto huggingface dataset:
TIL: from cerberus import Validator
Tags: 100daysofcode, day1
Published: 2020-07-02 15:01:15

Today I learned about Validator, a class in the Python third-party module cerberus.

Here we go.

Let's import this bugger.

```
from cerberus import Validator
```

Dang that felt good.  Obviously we would need to have installed it first so let me back up and get my pip on.

```
py -m pip install cerberus
```

Oh yeah, that's the stuff.  Not sure why I call my Python py, but don't hate.  Or wait, this is the internet.  Proceed.

Alright so we're going, we're rolling, what's next.  Instantiate that Cool Hand Luke.

```
>>> v = Validator()
>>> v
<cerberus.validator.Validator object at 0x7fa7df93f760>
```

Boom, we got the goods.  Whatcha hiding in there, kitten?

```
>>> dir(v)
['_BareValidator__get_rule_handler', '_BareValidator__init_error_handler', '_BareValidator__init_processing', ... plus a billion more
```

Dang, you're not gonna make me read the documentation are you?   You, sonofa...

```
>>> list(filter(lambda i: not i.startswith("_"), dir(v)))
['allow_unknown', 'checkers', 'clear_caches', 'coercers', 'default_setters', 'document', 'document_error_tree', 'document_path', 'error_handler', 'errors', 'ignore_none_values', 'is_child', 'mandatory_validations', 'normalization_rules', 'normalized', 'priority_validations', 'purge_readonly', 'purge_unknown', 'recent_error', 'require_all', 'root_allow_unknown', 'root_document', 'root_require_all', 'root_schema', 'rules', 'rules_set_registry', 'schema', 'schema_error_tree', 'schema_path', 'schema_registry', 'types', 'types_mapping', 'update', 'validate', 'validated', 'validation_rules']
```

Aha, sucka!  What have we here, what have we here...

We're gonna validate some shtuff.  Let's do this.  I'm ready.

```
>>> shtuff_to_validate = {
...     "awesome": "effyeah",
...     "animal": "tiny turtle"
... }
```

Heck yeah I love turtles.

Let's validate that shtuff.

```
>>> v.validate(shtuff_to_validate)
```

False
False?  Get that out of my face.  False.  Turtles are awesome.

```
>>> v.errors
{'animal': ['unknown field'], 'awesome': ['unknown field']}
```

Unknown field?  Well dang, I'm sorry, let me introduce you.  Field, turtle.  Turtle, field.

Validator McGee likes a schema, so we'll give 'em a schemadema.

```
>>> schemadema = {"awesome": {}, "animal": {}}
```

Let's try this again.

Oh wait I gotta tell it the schema is the schema.  Lemme do that right quick here.

```
>>> v.schema = schemadema
```

Here goes.  Turtles, your time to shine.

```
>>> v.validate(shtuff_to_validate)
```

True

Boom.  Turtles are awesome.
Getting Started with Fornax
Tags: fsharp, fornax, static, dotnet
Published: 2020-07-02 15:00:23

---
title: Getting Started with Fornax
published: true
description: 
tags: fsharp, fornax, static, dotnet
series: Getting Started with Fornax
---

# What is Fornax?

[Fornax](https://github.com/ionide/Fornax) is a static site generator written in F#. I think it's pretty neat. Fornax generates static sites through a pipeline of F# scripts called **loaders** that inject content into a global context that is then consumed by more F# scripts called **generators** that mold the content its final form. The workflow is decidedly hands-on with a distinct code first approach. This gives Fornax incredible flexibility.

## Getting Started
Fornax is installed as a global .NET Core tool on the command line with:

`dotnet tool install fornax -g`

We can then create a new folder for our new Fornax site, move into it, then:

`fornax new`

This will create a new Fornax site using the default blog template.

Now that we have a default Fornax site set up we can run `fornax watch` which will spin up a little server that watches for changes to our project.

Let's take a look at the folder structure now that we have a working Fornax site.

- _lib
    - Any external libraries we might like to use go in here and can be referenced from the script files.
    - By default this contains:
        - Fornax.Core.dll
        - Markdig.dll
- _public
    - This is where the final production built files are created after a build.
- loaders
    - Contains all scripts that load data into the global context.
- generators
    - Contains all scripts that generate files in _public based on the global context created by **loaders**.
- images
    - Images used by our app
- js
    - JS used by our app
- posts
    - This is a domain specific folder used to hold blog posts written in markdown.
- style
    - CSS used by the app
- config.fsx
    - This script runs first, we use it to configure the behavior of our generators and add any additional data like secret keys or SQL connection strings.

Next time we'll take a look an in depth look at loaders and generators and what they can do.
ไกลแค่ไหน คือ ใกล้ (TP)
Tags: getsunova
Published: 2020-07-02 14:35:38

---
title: ไกลแค่ไหน คือ ใกล้ (TP)
published: true
description: แปลงเพลงเข้ากับการเทรด
tags: Getsunova
---
พยายามจะทำวิธีต่างต่าง ให้เธอนั้นรักฉัน
พยายามทุกวัน BuySellทุกอย่างที่เธอต้องการ
เหมือนเดินบนMA ที่มีปลายทางคือHiของเดิม
ยังคงคิดและหวัง จะนำเอาวิธีนี้ไปใช้

แต่ทำไม (แต่ทำไม) เข้ามาเนิ่นนานไม่ถึงสักที
แต่ทำไม (แต่ทำไม) มองดูเส้นเทรนเหมือนยังห่างไกล
อยากรู้ว่าฉันต้องทำตัวอย่างไร

อีกไกลแค่ไหน จนกว่าฉันจะใกล้ TP
อีกไกลแค่ไหน จนกว่าเธอจะให้ฉัน TP
มีทางใดที่อาจทำให้เธอขึ้นไปได้โปรด
บอกกับฉันให้รู้ที ว่าSTOPแล้วฉันยังมีความหมาย (ไม่อดตาย) ฮู้

ยังไม่คิดยอมแพ้ ฉันเพียงแต่อ่อนล้าก็เท่านั้น
ภายในใจยังคงรักเธอเหมือนเดิม ไม่เคยเปลี่ยน
คงจะดีไม่น้อย ถ้าเธอบอกให้ฉันได้รับรู้
ทิศทางวิ่งของเธอ Sidewayต่างต่างที่ยังซ่อนไว้

ว่าทำไม (ว่าทำไม) เข้ามาเนิ่นนานไม่ถึงสักที
แต่ทำไม (แต่ทำไม) มองดูเส้นเทรนเหมือนยาวออกไป
อยากรู้ว่าฉันต้องทำตัวอย่างไร
อีกไกลแค่ไหน จนกว่าฉันจะใกล้ TP…
Example recursion in Clojure
Tags: clojure
Published: 2020-07-02 14:28:53

## Recursion of the perimeter of a square
Given one side find the perimeter of each square
f(n) = 4 * n + f(n - 1)

    (ns recursion.core
      (:gen-class))

    (defn -main
      [& args]  
      (defn f [n]
        (if (= n 1)
          4
          (+ (* 4 n) (f (dec n)))))
      (println (f 4)))
Watchlist: Your New Movie Tracker
Tags: python, watchlist, cs50, html
Published: 2020-07-02 14:29:49

---
title: Watchlist: Your New Movie Tracker
published: true
date: 2020-07-02 14:20:16 UTC
tags: python,watchlist,cs50,html
canonical_url: 
---

![](https://cdn-images-1.medium.com/max/420/1*sxqkE11Immf-cdAkLSUyUA.png)

Watchlist is my final project for CS50’s Introduction to Computer Science, by Harvard University.

Watchlist is your new to-do list for movies. Instead of trying to remember what movies you’d like to watch, just add them to Watchlist, where you can view them anywhere with an internet connection.

Watchlist is super simple: register, and you’ll be taken to your watchlist, which will initially be empty. Click on the ‘Add’ button in the navbar to start adding movies. Type in the movie you’d like to search for, and it will be added to your list.

Can’t remember the name of that movie you wanted to watch? Just log into Watchlist!

Finally got around to watching that movie? Click the button at the end of the movie’s row to delete it.

### Watchlist was built with the following technologies:

- HTML
- CSS
- Bootstrap
- Python
- Flask
- SQL
- SQLite

Watchlist’s movie data is from iTunes via their API, which technically means that a movie has to be on iTunes in order to add it to your Watchlist. As of April 2020, there are 65,000 movies in the iTunes store, so hopefully you won’t feel too limited when searching.

Lastly, I’d like to thank the CS50 staff who have put together a tremendous course. I took an Intro to Computer Science course in college over two years ago, yet by the end of this course I realized I had learnt so many new things that I hadn’t previously learned in my CS degree. I’m looking forward to taking my next CS50 course.

You can check out Watchlist here: [https://gavischneider.pythonanywhere.com/login](https://gavischneider.pythonanywhere.com/login)
REACT DAHSBOARD AUTHENTIFICATION 
Published: 2020-07-02 14:11:56

Hello, I downloaded a dashboard template, it includes a login page but when I run my application on local server, it connected to an user who figures in fake database by default 
so I need to secure the application, even if we write localhost:8080 or localhost:8080 it will redirect to login page 
it's jwt authentification 



there is my router.js


const RouteConfig = ({ component: Component, fullLayout, ...rest }) => (
  <Route
    {...rest}
    render={props => {
      return (
        <ContextLayout.Consumer>
          {context => {
            let LayoutTag =
              fullLayout === true
                ? context.fullLayout
                : context.state.activeLayout === "horizontal"
                ? context.horizontalLayout
                : context.VerticalLayout
            return (
              <LayoutTag {...props} permission={props.user}>
                <Suspense fallback={<Spinner />}>
                  <Component {...props} />
                </Suspense>
              </LayoutTag>
            )
          }}
        </ContextLayout.Consumer>
      )
    }}
  />
)
const mapStateToProps = state => {
  return {
    //user: state.auth.login.userRole
  }
}

const AppRoute = connect(mapStateToProps)(RouteConfig)

class AppRouter extends React.Component {
  render() {
    return (
      // Set the directory path if you are deploying in sub-folder
      <Router history={history}>
        <Switch>
          <AppRoute exact  path="/" component={analyticsDashboard}/>
          
          <AppRoute exact
            path="/ecommerce-dashboard"
            component={ecommerceDashboard}
          />
Daily Challenge #264 - Digital Root
Tags: challenge
Published: 2020-07-02 14:11:04

---
title: Daily Challenge #264 - Digital Root
published: true
series: Daily Challenge
description: Take the sum of the digits of a number until a single-digit number is produced.
tags: challenge
//cover_image: https://direct_url_to_image.jpg
---

Digital root is the recursive sum of all the digits in a number. Given n, take the sum of the digits of n. If that value has more than one digit, continue reducing in this way until a single-digit number is produced. This is only applicable to the natural numbers.


###Examples
```
16  -->  1 + 6 = 7
942  -->  9 + 4 + 2 = 15  -->  1 + 5 = 6
132189  -->  1 + 3 + 2 + 1 + 8 + 9 = 24  -->  2 + 4 = 6
493193  -->  4 + 9 + 3 + 1 + 9 + 3 = 29  -->  2 + 9 = 11 --> 1 + 1 = 2
```

###Tests
`digital_root(456)`
`digital_root(16)`

Good luck!

***
_This [challenge](https://www.codewars.com/kata/541c8630095125aba6000c00) comes from user578387 on CodeWars. Thank you to [CodeWars](<https://codewars.com/>), who has licensed redistribution of this challenge under the [2-Clause BSD License](<https://opensource.org/licenses/BSD-2-Clause>)!_

_Want to propose a challenge idea for a future post?  Email **yo+challenge@dev.to** with your suggestions!_
https for PyLadies Dublin github page?
Tags: pyladies, githubpages
Published: 2020-07-02 14:03:26

{% link pyladiesdub/pyladies-dublin-new-landing-page-4m14 %}

It's all working except one thing. [Lynn Root](https://twitter.com/roguelynn) (who has been so awesome helping me out) pointed out that I should enable "**Enforce HTTPS**” field in the github settings that’s right below the adding of “Custom Domain”. 

I went to have a look and found that I was unable to, as it said unavailable for your site because your domain is not properly configured to support HTTPS. Which was kinda weird.

Long story short... Lynn suggested a workaround by adding the following in `<head>` section of my index.html and it worked.

```
<script>if (window.location.protocol != "https:" && window.location.host.indexOf('pyladies.com') > -1) {
            window.location.protocol = "https";
          }</script>
```

![](https://media.giphy.com/media/6vj5quVNRhoQw/giphy.gif)
An Open Source Master Data Management (MDM) / Product Information Management (PIM) Software
Published: 2020-07-02 14:00:43

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

Hi guys,

We have created an open source Master Data Management (MDM) / Product Information Management (PIM) software, hosted in [Github](https://github.com/tmjeee/fuyuko). 

Any feedback, comments or contributions are very much welcome.

Cheers guys! :)
Redoc Documentation to ExpressJS
Tags: express, redoc, node, apidoc
Published: 2020-07-02 13:56:35

Redoc is an OpenAPI/Swagger-generated API Reference Documentation.

To install the redoc into your expressjs application install their npm package

```
npm i redoc-express
```

After installing the package, add a route for your swagger file and redoc api documentation

```
const express = require('express');
const redoc = require('redoc-express');

const app = express();
const port = 3000;

// serve swagger.json file
app.get('/docs/swagger.json', (req, res) => {
  res.sendFile('swagger.json', { root: '.' });
});

// serve redoc
app.get(
  '/docs',
  redoc({
    title: 'API Docs',
    specUrl: '/docs/swagger.json'
  })
);

app.listen(port, () => console.log(`Express app listening on port ${port}!`));
```

Thats it now you can access the redoc documentation in the url http://localhost:3000/docs
Why postgresql does not return null values once filtered by not_in
Tags: help, postgres
Published: 2020-07-02 13:52:32

As I mention on https://dba.stackexchange.com/q/270265/118215

I noticed that `not in` fails to retrieve rows that have null values as this script says so:

```
CREATE temporary table if not EXISTS the_values (
 key SERIAL,
 value INTEGER NULL 
);

insert into the_values(value) values (null),(1),(null),(2),(3),(4),(5),(6),(10),(null),(null);


select * from the_values where value not in (1,2,3,4,5,6,10); 
```
Specifically the query:

```
select * from the_values where value not in (1,2,3,4,5,6,10); 
```

Therefore, do you have any idea why that happens? I am interested more about the technical aspect of this phenomenon rather that the obvious solution:

```
select * from the_values where value not in (1,2,3,4,5,6,10) or value IS NULL; 
```
How to integrate dev API to your portfolio website
Tags: beginners, webdev, tutorial
Published: 2020-07-02 13:49:43

---
description: In this article, I'll show you how to add posts you've created on dev.to into your portfolio website
---

A few days ago, while working on my portfolio I decided to have a page that would showcase posts that I made on this site. It took me a whole day trying to get it working, as I was new to using API and how to integrate them to a website, it was quite a challenge for me.

Here's how I made it work. I'm using gridsome, a static site generator for Vue to build my website. Also, keep in mind that the API is still in the beta stage.

First, install axios into your project file

```javascript
yarn add axios or npm i axios
```

In the gridsome.server.js file, we'll declare a variable called axios

```javascript
const axios = require('axios')
```

In the same file, we'll then configure the datastore API that lets us insert data into the graphql data layer.

```javascript
module.exports = function(api) {
  api.loadSource(async (actions) => {
    const collection = actions.addCollection("Post");

    const { data } = await axios.get(
      "https://dev.to/api/articles?username=chrissiemhrk"
    );
    }
  });
};
```

To get your API link go to https://docs.dev.to/api/#operation/getArticles

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

Copy the link highlighted in red and change the name at the end from ben to your dev username.

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

This section is where you'll see the content you can showcase. Personally, I chose the ID, title, description, and canonical_url.

```javascript
module.exports = function(api) {
  api.loadSource(async (actions) => {
    const collection = actions.addCollection("Post");

    const { data } = await axios.get(
      "https://dev.to/api/articles?username=chrissiemhrk"
    );

    for (const item of data) {
      collection.addNode({
        id: item.id,
        title: item.title,
        description: item.description,
        canonical_url: item.canonical_url,
      });
    }
  });
};
```

Once done, go to the page you want your blog posts to appear and write this code in the file. This will enable us to query the data in our vue component. <i>The content in the node will change depending on what you chose in the gridsome.server.js file</i>

```javascript
<page-query>
query {
  allPost {
    edges {
      node {
        id
        title
        description
        canonical_url
      }
    }
  }
}
</page-query>
```
At the beginning of the page, you'll add in code similar to this one below that will structure your posts the way you want.

```html
<template>
  <layout>
    <article
      v-for="edge in $page.allPost.edges"
      :key="edge.node.id"
    >
      <h1>{{ edge.node.title }}</h1>
      <p>{{ edge.node.description }}</p>
      <g-link :to="edge.node.canonical_url">Read more</g-link>
    </article>
  </layout>
</template>
```
&nbsp;

That's it the only thing left is to customize/style your page.
Why don't end products match exact UX design?
Tags: ux, javascript, css, beginners
Published: 2020-07-02 13:33:11

After being in UI development for a couple of years, recently I got to explore a designing tool. There by I got to know the reason end products don't match the exact UX. 

There is a process that UX designers follow. Starting with developing a component mock-up collections, defining definite set of colors/gradients, constraint alignments, resolutions and more. The UI developers also have to follow the same procedure from developing UI component library(or customizing the existing library according to design), create color constants and respectively.

__*Second, we should be able to read a design*__ which means some of the css properties are not mapped with the same name in the design. For example, in figma - border is named as stroke with the properties "inside & outside" which we need to map as padding & margin. Though figma gives a css translations to these, some times they need to be re-verified and also we might not use the exact styles. For example, left, top properties are rarely used in development when we are using column layout.

__*Third, careful observations.*__ Designers take a good amount of time in details. For example, just to see if the shadow settings are looking good. If we just copy the shadow color and ignore the opacity of the shadow, then it may give a totally different look.

__*Four, analysis of deviation from the CSS library.*__ Design tools are very handy as we all know. Some text might have totally different style applied(may be font), Or may be a random color button has pitched in between. In any such cases, we should discuss again with the designers. May be, it was placed by mistake or may be it was not thought in terms of development constraints. When we discuss with the designers, they have better suggestions or they may even alter the design. So, it is good to not ignore the deviations and to settle with a random alternative. It will be visible in the end product.

__*Fifth, to focus on view part separately from logic*__ The moment design is provided & there is a demand for estimation, we totally get into implementation details. Divide the estimations into view part(html/css/android look & feel) and logic part. If possible, develop it as two different phases. That convinces the entire team about the progress, also providing a good quality.

*This is all I got to share for today. Thanks for reading*
What do you ask when are applying to a job?
Tags: discuss
Published: 2020-07-02 13:20:24

Lately, I've been doing some interviews and there is always a part where you have the opportunity to ask questions, I'm personally not a person who asks a lot, but generally *I'm interested in knowing things of the daily work (methodologies, communication with teammates,  my responsibilities, etc.) and also technical things, what technologies do they use, what are they looking to achieve on a technical level ...*

What questions do you ask the people who are interviewing you when you are applying to a job?

If the interviews have multiple steps, what questions do you ask:
* Recruiters
* Technical leader or person who is more technical
* Product owner
* Human resources department
Build a Vocabulary Bot for WhatsApp using Twilio and Python
Tags: python
Published: 2020-07-02 13:17:10

My mother teaches English to visually impaired students. Due to the current situation with the Coronavirus, in-person classes had to be suspended, and now she is teaching through phone conference calls, with all learning material being exchanged on WhatsApp. I saw an opportunity to solve a problem here, so I decided to build a Vocabulary chatbot to assist her in her teaching.

This tutorial will show you how to create a WhatsApp chatbot that can help you in improving your vocabulary using the Twilio API for WhatsApp, Python and Flask. Below, you can see the conversation I had with the bot.





https://www.twilio.com/blog/build-vocabulary-bot-whatsapp-python-twilio
8 Projects with Designs you can do to Become FRONT-END developer
Tags: react, vue, javascript
Published: 2020-07-02 13:10:05

## Introduction

These are 8 projects with requirements and designs that you can do to become a Front-end developer. The order is from easy to intermediate

## 1. [Reusable Button](https://devchallenges.io/challenges/ohgVTyJCbm5OZyTB2gNY)

One best way to start learning React or Vue is to make small components. By making a reusable button, you will learn about basic states and the most basics syntax. 


## 2. [Reusable Input](https://devchallenges.io/challenges/TSqutYM4c5WtluM7QzGp)

Making a reusable is not that simple, especially the Input component. You have to make sure about different states: Error, Focus..., Accessibility, sizes,... But you will learn a lot from making them and it will be a big help in the journey of learning a library like React.


## 3. [Windbnb - Airbnb small version](https://devchallenges.io/challenges/3JFYedSOZqAxYuOCNmYD)

You will be making a small version of Airbnb. 

Given a simple JSON file, your task is to create a listing with filter functions. You will learn managing state in Front-end library in React or Vue.


## 4. [Todo App](https://devchallenges.io/challenges/hH6PbOHBdPm6otzw2De5)

Everyone knows Todo App, but did you ever try to make one? 

You will practices skills like Array methods and managing states. I think it's one of the best tasks to start learning a library as it is not too difficult or too easy.



## 5. [Quote generator](https://devchallenges.io/challenges/8Y3J4ucAMQpSnYTwwWW8)

A Front-end developer needs to know how to use an API. You will practice basic skills working with a simple API in this project.
 

## 6. [Country quiz](https://devchallenges.io/challenges/Bu3G2irnaXmfwQ8sZkw8)

Now a bit more challenging project, not only you have to use an API but also managing more complex states in your app. This project will definitely improve your skill as a Front-end developer.


## 7. [Weather app](https://devchallenges.io/challenges/mM1UIenRhK808W8qmLWv)

Surprise, Surprise :)) another weather app project. In this one, you have to understand an API, display different data, and checking user location. A lot of things to do and practice and a perfect challenge for a junior to practice a library.


## 8. [Job search](https://devchallenges.io/challenges/TtUjDt19eIHxNQ4n5jps)

In this one, you have to deal with different routes, different states, and an interesting API from Github. A good project to put to your portfolio.


### Conclusion

These projects are perfect for people who are starting learning Front-end library and want to practice it. Not only you have 8 projects to add to your portfolio but also, you will get a certificate after completed. 

In the end, best of luck to everyone who is studying and feel free to leave me a comment.