teleren/devto huggingface dataset:
How to debug Node.js Application with VSCode without any configuration
Tags: vscode, javascript, webdev, node
Published: 2020-06-01 12:50:32

---
title: How to debug Node.js Application with VSCode without any configuration
published: true
description: How to debug Node.js Application with VSCode without any configuration
tags: VSCode, JavaScript, WebDev, Node
---

In this video, I'm going to show a quick tip about debugging Node.js application with Visual Studio Code without any configuration.

In the earlier version of Visual  Studio Code, We can also debug the Node.js application but at that time we have to create launch settings and there are some parameters for that. But now with Javascript debug terminal we can directly attach node.js application with visual studio code and even it can also able to debug node.js express files.

You just need to do CMD+ SHIFT + P on mac or CTRL + SHIFT + P on Visual studio code and select Create: Javascript debug terminal. That's it rest it will do all the stuff automatically.

Following is video for the same.

{% youtube G47lZR3XzKc%}

If you like this video and wanted to see a similar kind of video then, please subscribe to my youtube channel at - https://bit.ly/codewithjv.

Also, Do let me know what more content you wanted to see in for node.js.
The taco_tuesday gem, cause Tacos
Tags: ruby, showdev, jokes, watercooler
Published: 2020-06-01 13:08:20

For _years_ I've had to add:

```ruby
class Date
  def taco_tuesday?
    tuesday?
  end
end
```

to my ruby projects so I could easily check if it was __Taco Tuesday__.

__But No More!__

# Introducing the taco_tuesday gem!

Simply add this line to your application's Gemfile:

```ruby
gem 'taco_tuesday'
```

And then execute:

    $ bundle install

Now you can easily check if it's taco tuesday.

### With the Date class:

```ruby
require 'taco_tuesday'

# May 26th 2020 is a Tuesday
tuesday = Date.new(2020, 5, 26)
tuesday.taco_tuesday? #=> true

# May 25th 2020 is a Monday
monday = Date.new(2020, 5, 25)
monday.taco_tuesday? #=> false

# Check if today is Taco Tuesday
Date.today.taco_tuesday? #=> Same result as Date.today.tuesday?
```

### With the Time class:

```ruby
require 'taco_tuesday'

# May 26th 2020 is a Tuesday
tuesday = Time.new(2020, 5, 26)
tuesday.taco_tuesday? #=> true

# May 25th 2020 is a Monday
monday = Time.new(2020, 5, 25)
monday.taco_tuesday? #=> false

# Check if today is Taco Tuesday
Time.now.taco_tuesday? #=> Same result as Time.now.tuesday?
```

Yes, this is a [real gem](https://rubygems.org/gems/taco_tuesday) and yes, you can [contribute](https://github.com/drbragg/taco_tuesday) (though I'm not sure what we could add... ideas?).

I hope this post and gem gives you as good of a chuckle as it did for me.
Tip: Using the latest TLS version with Azure Cache for Redis
Tags: redis, nosql, azure, database
Published: 2020-06-01 13:06:04

[Azure Cache for Redis](https://docs.microsoft.com/azure/azure-cache-for-redis/cache-overview?WT.mc_id=devto-blog-abhishgu) provides an in-memory data store based on the open-source software Redis.

As a part of the industry-wide push toward the exclusive use of Transport Layer Security (`TLS`) version `1.2` or later, Azure Cache for Redis will not support `TLS` versions 1.0 and 1.1 i.e. your application will be required to use `TLS` 1.2 or later to communicate with your cache

> To read the details, [please refer to this page from the product documentation](https://docs.microsoft.com/azure/azure-cache-for-redis/cache-remove-tls-10-11?WT.mc_id=devto-blog-abhishgu)

It might be helpful to know how will this might manifest in your Go apps (I am using [`go-redis` client](https://github.com/go-redis/redis) as an example)

### If you don't specify `TLS` at all

e.g.

```go
c := redis.NewClient(&redis.Options{Addr: endpoint, Password: password})
err := c.Ping().Err()
    if err != nil {
        log.Fatal(err)
    }
defer c.Close()
```

.. you will encounter this error `i/o timeout` (probably not that helpful)

### If the specified `TLS` version is less than `1.2`

e.g.

```go
tlsConfig := &tls.Config{MaxVersion: tls.VersionTLS11, MinVersion: tls.VersionTLS10}
c := redis.NewClient(&redis.Options{Addr: endpoint, Password: password, TLSConfig: tlsConfig})

err := c.Ping().Err()
 if err != nil {
    log.Fatal(err)
 }

defer c.Close()
```

..you will end up an `tls: DialWithDialer timed out` error (again, not that obvious)

### The solution is obvious though

If you don't set `MaxVersion` or `MinVersion` i.e. use `tlsConfig := &tls.Config{}` it will work since `MaxVersion` defaulta to `TLS1.3` (see https://golang.org/pkg/crypto/tls/#Config)

For sake of clarity, it's better to be explicit i.e. 

```go
tlsConfig := &tls.Config{MinVersion: tls.VersionTLS12}
```

I hope this proves helpful if you stumble across any issues while connecting to Azure Cache for Redis with Go

Cheers!
asd
Tags: css
Published: 2020-06-01 12:59:48


# scrcpy-gui
GUI for SCRCPY

## Requirements
[scrcpy](https://github.com/Genymobile/scrcpy)

## Install
Download [scrcpy-gui](https://github.com/edsulaiman/scrcpy-gui/archive/master.zip)

## Run
Open `src` folder and copy `scrcpy_GUI.exe` to `scrcpy` folder

don't forget to set up **scrcpy** on the `Settings button` for first time use
Angular 9 Upgrade - Thoughts
Tags: angular, webdev
Published: 2020-06-01 12:56:14

I got to upgrade one of our Angular projects from v8.3.23 to latest v9. Just like my previous experience, I used Angular's [update guide](https://update.angular.io/#8.2:9.0l3) which will list out all details specific to the source version.

> **Note**: Angular will not proceed to execute `ng update` if there are pending commits on your branch.

#Before

- Since the project uses lazy loaded modules, I had to update all [module string import to dynamic import](https://angular.io/guide/deprecations#loadchildren-string-syntax).

- Upgraded angular cli/core from v8.3.23 to v8.3.26


#During

- When I encountered the error `× Migration failed: Incompatible peer dependencies found.`, I just followed the suggestion stated on the error message and ran the `ng-update` with `--force` parameter. It should look like: `ng update @angular/core @angular/cli --force`


#After

- Removed deprecated `entryComponents` from modules.

- Ran `ng add @angular/localize` since we used `ngx-translate`.

- Removed static text on `ngx-translate` elements.

```html
<!-- OLD -->
<span translate="Profile.Save">Save</span>

<!-- NEW-->
<span translate="Profile.Save"></span>
```

- Removed `{ read: false }` params for `@ViewChild`.

- For dynamic components, I had to place `<template>` inside a div to prevent them in appending at bottom of parent div.

```html
<!-- OLD -->
<div class="parent">
   <div>Sibling 1<div>
   <template #host></template>
   <div>Sibling 2<div>
<div>

<!-- NEW -->
<div class="parent">
   <div>Sibling 1<div>
   <div>
      <template #host></template>
   </div>
   <div>Sibling 2<div>
<div>
```

##ngx-charts

- Ran `ng update @swimlane/ngx-charts`. This will also update `@angular/cdk` 

- The upgrade will remove `d3` folder from `node-modules`. All references to `d3` will have an error.

- Ran `npm install d3 --save` and `npm install @types/d3 --save-dev` to fix `d3` references errors

- Updated reference from `@swimlane/ngx-charts/release` to `@swimlane/ngx-charts` on imports.

#Final Thoughts

Don't forget to `ng build --prod` to ensure safe build.
In summary, upgrading our project to version 9 is straightforward if you don't have conflicting packages. `ng update` had been helpful in updating deprecated items from older versions. My experience may not be the same with others that have larger projects or have too many package dependencies.
Right way store datetime to database.
Tags: javascript, ruby, go
Published: 2020-06-01 12:42:59

---
title: Right way store datetime to database.
published: true
description: The right way use datetime
tags: Javascript, Ruby, Golang
---
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/idzla2qi8j76m1pohkli.jpg)

In javascript date api 

```javascript
new Date() // Mon Jun 01 2020 20:25:36 GMT+0800 (中国标准时间)
```
you can see string with timezone with `+0800` but should we store into database with timezone? i don't think so.

Database has timezone settings also os system has timezone settings too. if we database set timezone with other value after read records from db we maybe got wrong value with different timezone.

The best way store datetime to database can store absolut time value to database. absolut time if number with from 1970-01-01 00:00:00 to 
now and get seconds. 

> PS: `Java` and `Javascript` will return milliseconds different other language 

Stroe absolut time in database benefit:

* we can render time string with different timezone and right value.
* we can caculation two datetime range value, got two time pass away 

Also have bad side:

* we can't direct know database field datetime just can see `1591015260` not readable.
🔥 Quick Tip: Understanding the difference between operators "in" and "hasOwnProperty"
Tags: javascript, tutorial, showdev, devtips
Published: 2020-06-01 12:28:39

On this simple trick, I'll show the difference between operators `in` and `hasOwnProperty`.

```js
class Validator {
  static isValid() {
    return true;
  }
}

class EmailValidator extends Validator {
  static checkEmail(email) {
    return true;
  }
}

console.log('isValid' in EmailValidator); // => true
console.log(EmailValidator.hasOwnProperty('isValid')); // => false
```

## The operator "in":
It enables us to check inheritance keys like in the example above.


## The operator "hasOwnProperty":
It only returns true if the object that property directly and not from parents.

---

Did you like it? Comment, share! ✨
using useState to initialise the state with the props -using map function for rendering data initially
Tags: react, javascript
Published: 2020-06-01 12:27:03

import React, { useEffect, useCallback } from 'react';
import MaterialTable from 'material-table';

export default function MaterialTableDemo(props) {
  const {todos} = props;  
  console.log('hurray',todos);
  const [state, setState] = React.useState({
    columns: [
      { title: 'Topic', field: 'topic' },
      { title: 'Start Date', field: 'startDate' , type: 'date'},
      { title: 'End Date', field: 'endDate', type: 'date' },
      {
        title: 'Level', field: 'level', type: 'numeric'
      },
      {
        title: 'Comments', field: 'comments' 
      }
    ],
   // having problem HERE !!!!! NOT RENDERING THE DATA INITIALLY
    data: todos.map((row)=>{
            return row
        })
    
  });


//Table data is  WORKING WITH useEffect and useCallback hooks
//   const dataNeeded =useCallback(()=> props.todos.map((row,index)=>{
//       return  row;
//   }),[props.todos]);

//   useEffect(()=>{
//      setState({
//          ...state.columns,
//          data: dataNeeded()
//      })
//   }, [dataNeeded])

  return (
    <MaterialTable
      title="Editable Example"
      columns={state.columns}
      data={state.data}
    />
  );
}
New console sneak peek 
Tags: showdev, questdb, database
Published: 2020-06-01 12:14:53

We are working on something special which will be shared in a couple weeks on [Github](www.github.com/questdb/questdb). Part of the project required a complete overhaul of the web console used to make it easier to interact with the database. We wanted to do that for a long time so we are happy we finally did this. So happy that we couldn't wait any longer to share a sneak peek for feedback and ideas.

![questdb console new](https://i.ibb.co/zhx3vyW/questdb-console-new.png)

This was quite a project because the old console was... old. Meril worked his magic and migrated from bower to nmp, and is finishing a complete migration to react.

As you can see, it has come a long way since the last version

![questdb console old](https://i.ibb.co/FgNf6Wh/questdb-console-old.png)

Here is some of the new stuff we added. 

:vampire: Dracula theme
![questdb dracula theme](https://i.ibb.co/gTbQk8J/dracula-theme.png)


:mag_right: Table and columns explorer
![questdb explorer](https://i.ibb.co/ZMYcCKv/table-explorer.png)


:watch: Improved and detailed execution time reporting
![questdb exec time](https://i.ibb.co/bzhkRPY/questdb-exec-time.png)


:chart_with_upwards_trend: Toggle between chart view and table view, and improved charts
![questdb improved charts](https://i.ibb.co/dphd7bN/Screenshot-2020-05-29-at-13-27-29.png)

We also built the results grid to be responsive, no matter the amount of data you get back. This means that you have the same responsiveness if your result is 10 rows or 1 billion.

We would love to hear feedback and ideas to make this console better and more helpful. Feel free to fire ideas or to submit issues on [Github](www.github.com/questdb/questdb).
sentry docker run notice
Tags: sentry
Published: 2020-06-01 12:12:58

I have the same problem with the version 8.8.0
I did the same that cuirongqing but it doesnt work. also beat is not any more in sentry?
celery is deprecated?, I put enviroment variables and links to redis and postgres contairnes with worker and cron, also in website of sentry in Queue sentry.tasks.email.send_email shows changes but in the part of the email test shows this "STARTTLS extension not supported by server"

I am using the smtp of gmail
docker run -d --name my-sentry -e SENTRY_SECRET_KEY='the generate secret key' -e SENTRY_SERVER_EMAIL=r.....k@gmail.com -e SENTRY_EMAIL_HOST=smtp.gmail.com -e SENTRY_EMAIL_PORT=587 -e SENTRY_EMAIL_USER=r.....k@gmail.com -e SENTRY_EMAIL_PASSWORD=xxxxxxx -e SENTRY_EMAIL_USE_TLS=True --link my-redis:redis --link my-postgres:postgres --restart always -p 8080:9000 sentry

The same with the worker and cron.

PD: sorry for my english.
Vim to the rescue: PDF Preview
Tags: vim, todayilearned, tutorial, productivity
Published: 2020-06-01 12:07:33

## Introduction

Some time ago, I was writing my resume. People suggested writing it in [LaTeX](https://www.latex-project.org/get/). So I started reading up on it. Then I stumbled upon a tool called [groff](https://www.gnu.org/software/groff/) and found it much easier, faster and less bloat than LaTeX. 

Both of these tools are used to write documents that can be converted into PDFs. I wanted a solution in vim so that I could live preview these PDFs as I was writing them. So I decided to make a vim plugin that does so:

{% github L04DB4L4NC3R/texgroff.vim %}

It supports LaTeX, groff, as well as markdown.

---

## What we are going to use

* **Zathura**: It is a very minimalist PDF reader for vim users.
* **Groff**: The GNU document parser. It is installed by default on most linux systems
* **Pandoc**: It is the general purpose document conversion tool. See my blog on pandoc:

{% link https://dev.to/l04db4l4nc3r/presentable-dev-posts-with-pandoc-56pc %}

All of these tools are already available in most official linux repositories and can be downloaded using your vanilla packet manager:

```sh
sudo apt install groff pandoc zathura
```

On Arch based distros, `zathura-pdf-poppler` needs to be downloaded in addition. 

---

## What we want

We want that the `\ + q` keybinding to compile the document we are working on into a PDF and the `\ + p` keybinding to preview the PDF in zathura after compiling it.


```sh
# Compiling Markdown to PDF:
pandoc curr.md -s -o /tmp/op.pdf

# Compiling LaTeX to PDF: 
pandoc -f latex -t latex curr.tex -o /tmp/op.pdf

# Compiling Groff (ms macro) to PDF:
groff -ms curr.ms -T pdf > /tmp/op.pdf
```

---

## Getting to the vim script

The following code divides the process into 2 functions, namely `Compile` and `Preview`. The former checks our current file type and applies the appropriate compilation command to it. The latter opens up the output PDF in zathura. Add the following code in your **~/.vimrc**:


```vimscript
let mapleader="\\"

" Call compile
" Open the PDF from /tmp/
function! Preview()
		:call Compile()<CR><CR>
		execute "! zathura /tmp/op.pdf &"
endfunction

" [1] Get the extension of the file
" [2] Apply appropriate compilation command
" [3] Save PDF as /tmp/op.pdf
function! Compile()
		let extension = expand('%:e')
		if extension == "ms"
				execute "! groff -ms % -T pdf > /tmp/op.pdf"
		elseif extension == "tex"
				execute "! pandoc -f latex -t latex % -o /tmp/op.pdf"
		elseif extension == "md"
				execute "! pandoc % -s -o /tmp/op.pdf"
		endif
endfunction

" map \ + p to preview
noremap <leader>p :call Preview()<CR><CR><CR>

" map \ + q to compile
noremap <leader>q :call Compile()<CR><CR>
```

When we press preview, our zathura instance opens up. Now the best thing about zathura is that it watches the opened file. So after you press preview for the very first time, you don't have to press it again. Simply compile to view the changes in the PDF. Here is what our extension looks like:

{% youtube s4gVmJafKf0 %}
Azure demystified
Published: 2020-06-01 12:07:28

Cloud got you Stumped? 😖

Let me demystify Azure, Devops and even Online IDEs (VS Code spaces) with this short and simple webcast as part of the Remote Resilience Hackathon Month🎉🥳

https://remoteresilience-platform.bemyapp.com/#/conference/5ecf805e9a34b9001b5352ff
What tips can you give on staying in the "Coding Flow"? 
Tags: beginners, codenewbie, discuss
Published: 2020-06-01 12:03:20

---
title:What tips can you give on staying in the "Coding Flow"? 
published: true
description: Question and answers from the Code Connector community
tags: #beginners #codenewbie #discuss
---

1. If interrupted, take a second to dump your train of thought in some notes. Your team/interrupter should respect you enough to let you get the thoughts out of your head before beginning the conversation.

2. Implement solid blocks of time when you aren't to interrupt your team or you can develop an understanding that when someone needs help that they send a Teams/Slack message so that you can read it when you are ready to come out of the flow.

3. Getting a notification doesn't mean that you have to answer it immediately. Finish what you are doing and come to a stopping point or dump your thoughts into notes so you can easily context switch back into the flow.

4. If you ever get stuck, instead of freaking out, break the problem into bite-sized pieces and do what you can. This way, when the time comes to get help, you and your potential mentor can easily have an intelligent conversation over more than just the problem itself.

5. My tip is to listen to soft quiet music in the background to block out distractions. Have a list of tasks you want to complete so you are not wasting time finding whats to do next.

Shout out to the Code Connector Contributors: Corey McCarty Athena Baker

[Code Connector](https://codeconnector.io/) is a non-profit that's organized tech meetups to help people start their journey into tech. You can join our daily conversations by joining the [Code Connector slack channel](https://bit.ly/2Ywnzqc).
Daily Developer Jokes - Monday, Jun 1, 2020
Tags: jokes, dailydeveloperjokes
Published: 2020-06-01 12:00:26

---
title: "Daily Developer Jokes - Monday, Jun 1, 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%20Jun%201%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/5e125997196ca.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 are keyboards always working so hard?

___A___: Cause they have two shifts!
 -->
Building my first Django project
Tags: python, django
Published: 2020-06-01 12:00:26

I'm working through [Django for Beginners by William S. Vincent](https://djangoforbeginners.com/). The second chapter gets us into developing our first app. It simply displays a single page with an unformatted Hello World on it, but I really appreciated how the project is so fully fleshed out end to end. You start a project with a clean `pipenv`, and make the files and folders through the CLI. The django framework provides some really nice methods to 'boilerplate' the multiple files needed in each project, and having this introduced at the start and then fill in the details later when you are hands on is definitely the best way to go.

Introducing migrations and the url-view-model[-template] core concepts was pretty simple in practice, though a little confusing initially. "I've just made a bunch of files with this single `startapp` command, what do they all do?" was admittedly my first reaction. 

The best part of the way this book is set up is the definition of done used in the core workflow. A project isn't done unless it has a commit history, is hosted on GitHub and deployed on Heroku. I'm really a fan of approaching deployment in Chapter 2, just like version control and dev environments in Chapter 1. These concepts are your friends, not your monsters :)

Incidentally, having only been aware of Heroku in passing, I really like the PAAS set up. Very usable, the cli tools make the whole thing a doddle and the end satisfaction of being able to point at something that's actually on the web and say 'I did that!' is always a little more satisfying than 'It works on my machine?'.
Comparar similaridade de strings com PHP
Tags: php, string, ptbr
Published: 2020-06-01 11:58:13

Para você que necessita comparar duas strings e verificar o quão parecidas estas são, no PHP temos a função [similar_text](https://www.php.net/manual/pt_BR/function.similar-text.php).

Esta função compara duas strings e pode retornar a quantidade de caracteres similares ou a porcentagem de similaridade das strings.

Abaixo segue um modelo de utilização!

{% gist https://gist.github.com/mayronceccon/60195584f29dea838f3c221700eebb0d %}
How to Create a One Page Website with TYPO3?
Published: 2020-06-01 11:36:46

Many successful websites are large, complex affairs with lots of pages and content.

However, sometimes more truly is less in the world of web design. And that’s why, instead of taking a traditional approach, it may be worth your while to create a one-page website on TYPO3.

In this blog, we’ll go more in-depth about the benefits and usage of the Landing page TYPO3 template. Then we’ll show you how to create a one-page website on TYPO3 with some easy steps. Let’s begin!

- What is a One Page TYPO3 Template?
- Why One Page TYPO3 Template?
- Some basic must-have essential elements in one page TYPO3 Template
- How to create One Page TYPO3 Template
- Should You Use a One-Page Website for your business website?

Explore complete article in depth at - https://t3terminal.com/blog/one-page-typo3-template/