teleren/devto huggingface dataset:
Focused Coding Playlist
Tags: music, programming, productivity, discuss
Published: 2022-03-13 16:54:25

I wanted to share a coding playlist I've just created and will continue to add to as time goes, but it's mostly of Post-Rock and Electronic Instrumental music that contains sounds which allow you to forget the world and just focus on coding or any other focus activity. The songs truly are relaxing and will allow you to get in a zone for extended periods of time. Feel free to follow the playlist if you're on Spotify.

{% spotify spotify:playlist:3tLx7gewQRuHOE3dpGGKgQ %}

[Focused Coding](https://open.spotify.com/playlist/3tLx7gewQRuHOE3dpGGKgQ?si=b3e94ee3a1524cc5) Playlist on Spotify

**Here is a nice resource for finding other similar songs to songs you already enjoy**
https://tunebat.com/

I hope you enjoy this playlist! Feel free to drop a comment if you find this useful or the type of music you enjoy listening to to get in a solid coding session.

Happy Coding!
Brian
サバイバル TypeScript サバイバル TypeScript 値・型・変数の概念
Tags: typescript
Published: 2022-03-13 16:52:08


## 参考

https://typescriptbook.jp/reference/values-types-variables

サバイバル TypeScript 
値・型・変数

## 環境構築

typescript はインストール済み

```
npm i -g ts-node

added 17 packages, and audited 18 packages in 2s
```

ts-node をグローバルインストールする

作業用の tsnode ディレクトリを作成

app.ts を作って console.log するだけのファイルにする

ts-node app.ts で実行して動けば OK.

---

主に js との違いで話す

## 値なしの初期化

```ts
const dog;
```

> 'const' declarations must be initialized.

js できた値なしの初期化も、ts だとエラーになる。


##　存在しないプロパティへのアクセス

```ts
const dog = 2
dog.name = 3
```

これを書くと

> Property 'name' does not exist on type '2'.ts(2339)

このエラーが出る。

js では存在しないプロパティにアクセスすると新しく作られるが
ts ではエラーになる。

```ts
type animal = {
  name: string,
  age: number,
}

const dog:animal =  {
  name: 'pochi',
  age: 3
}
```

事前に型を用意して、その型を使っての初期化が必要。

---

## 型推論を使った自動型宣言

型を明示しなくても、実は型が入る。

```ts
let age = 30 
age = 10
```

実はこれは　number として型が勝手に入っているので数字なら上書きできるが

```ts
let age = 30 
age = '10'
```

こうやって string を入れると

> Type 'string' is not assignable to type 'number'.ts(2322)

number の型には入らないとエラーが出る。

---

## 静的な型付けとは

https://typescriptbook.jp/reference/values-types-variables/difference-between-type-inference-and-dynamic-typing

静的、難しい言葉だが、先に型を決めて、それ以降は静かなので動かないということらしい。

ts では先ほどのコードはすでに number に定まっているので static に number のままだが

js では型が動くので、string が入ってしまい、dynamic に string に置き換わる。

変更されないのが静的、変更されるのが動的と解釈する。

---

## シングルクォート と ダブルクォートと 文字列リテラル

```ts
let ageDoubleQuote = "age"
console.log(typeof ageDoubleQuote);

let ageSingleQuote = 'age'
console.log(typeof ageSingleQuote);

let ageLiteral = `age`
console.log(typeof ageLiteral);
```

これらは厳密な ts さんだから分けるかと思いきや

```
ts-node app.ts 
string
string
string
```

実行すると全部 string になる。

Java は シングルだと char になるらしい。

---

## null は人工的

https://typescriptbook.jp/reference/values-types-variables/undefined-vs-null

存在しないものにアクセスしたときには入れてない undefined が返ってくるが

null は自分から入れない限り返ってくることはないらしい。

ts では null を使わないのが推奨らしい。

null は型がないから分岐ができないからやめて欲しいのだと予測する。

---

## 大文字から始まる　ラッパーオブジェクト型もあるらしいが　ts で使わないべき

https://typescriptbook.jp/reference/values-types-variables/boxing

型として使えるが、計算できないし使うべきではないらしい。

---

## それ単体しか入らないリテラル型

https://typescriptbook.jp/reference/values-types-variables/literal-types

1 位しか処理しないプログラムなど、数値全般ではなくて、決まった数値でしか動作してほしくないプログラムがある

それはリテラル型を使うことで実装できる

```ts
let normalOrder:number 
normalOrder = 3059
```

普通に number だとなんでも数値が入るが

```ts
let literalOrder:1 
literalOrder = 3059
```

リテラル型で指定すると

> Type '3059' is not assignable to type '1'.ts(2322)

違う数値は入らなくなる。

```
let awardRanking : 1 | 2 | 3
awardRanking = 4
```

> Type '4' is not assignable to type '1 | 2 | 3'.ts(2322)

ユニオン型も組み合わせれば、1位から3位までしか入らない表彰変数が作成できる。

```ts
let sns : 'FB' | 'TW' | 'ig'
sns = 'yahoo'
```

> Type '"yahoo"' is not assignable to type '"FB" | "TW" | "ig"'.ts(2322)


string でも同じことができる。

---

## optionalName? で | undefined にすると厳密な型へ使えなくなる。

ユニオン型に似たもののに optional がある。

```ts
type options = {
  name: string[]
}
```

これは見ての通り　string[] だが

```ts
type optionalOptions = {
  optionalName?: string[]
```

型の名前の最後に　？　をつけるとこれは optional になり

与えた型 | undefined として処理される。

なのでこれでゆるくしてしまうと、その値は厳密な string[] で定められている変数には入れることができない。
test2: freelancers validations in posting
Tags: testing
Published: 2022-03-13 16:49:44

Yourself off its pleasant ecstatic now law. Ye their mirth seems of songs. Prospect out bed contempt separate. Her inquietude our shy yet sentiments collecting. Cottage fat beloved himself arrived old. Grave widow hours among him no you led. Power had these met least nor young. Yet match drift wrong his our.


Why end
might ask civil again spoil. She dinner she our horses depend. Remember at children by reserved to vicinity. In affronting unreserved delightful simplicity ye. Law own advantage furniture continual sweetness bed agreeable perpetual. Oh song well four only head busy it. Afford son she had lively living. Tastes lovers myself too formal season our valley boy. Lived it their their walls might to by young.

Domestic
confined any but son bachelor advanced remember. How proceed offered her offence shy forming. Returned peculiar pleasant but appetite differed she. Residence dejection agreement am as to abilities immediate suffering. Ye am depending propriety sweetness distrusts belonging collected. Smiling mention he in thought equally musical. Wisdom new and valley answer. Contented it so is discourse recommend. Man its upon him call mile. An pasture he himself believe ferrars besides cottage.

One advanced diverted domestic sex repeated bringing you old. Possible procured her trifling laughter thoughts property she met way. Companions shy had solicitude favourable own. Which could saw guest man now heard but. Lasted my coming uneasy marked so should. Gravity letters it amongst herself dearest an windows by. Wooded ladies she basket season age her uneasy saw. Discourse unwilling am no described dejection incommode no listening of. Before nature his parish boy.
Import error: cannot open shared object file:no such file or directory
Tags: tensorflow, cuda, ubuntu18, 404error
Published: 2022-03-13 16:48:44

I have installed Cuda 10.1 and cudnn on Ubuntu 18.04 for the first time and it seems to be installed properly as when I type nvcc and nvidia-smi I am getting proper response. "Import error: cannot open shared object file:no such file or directory"

I have also installed TensorFlow using following command:

user:~$ sudo pip3 install --upgrade tensorflow-gpu
But when I am trying to import tensorflow I am getting following error about libcublas.so.10.0:

ImportError : libcublas.so.10.0: cannot open shared object file: No such file or directory Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/errors for some common reasons and solutions. Include the entire stack trace above this error message when asking for help.

Am I missing something? How to resolve this issue?


Solution :
This error generally occurs when the version of your cuda and tensorflow installed are not compatible. "Import error: cannot open shared object file:no such file or directory"

I also encountered the same Import Error while I was running tensorflow version 1.13.0 with my cuda 9. As I had installed tensorflow on a virtual environment with pip,
I just had to uninstall the tensorflow 1.13.0 and install tensorflow 1.12.0 using following commands :

pip uninstall tensorflow-gpu tensorflow-estimator tensorboard pip install tensorflow-gpu==1.12.0
Now everything is working for me.

OR

You can fix the error by adding the following command to your '.bashrc' file.

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.0/lib64/

System configuration:

Ubuntu :- 16.04 LTS Tensorflow :-GPU 2.0beta1 Cuda:- 10.0 cuDNN :-7.6.0 for Cuda 10.0

Here I used the conda to configure my system.
Server has a weak ephemeral diffie-hellman public key err_ssl_weak_server_ephemeral_dh_key
Tags: googlechrome, sslcertificate, ssl, diffiehellman
Published: 2022-03-13 16:46:44

"Server has a weak ephemeral diffie-hellman public key err_ssl_weak_server_ephemeral_dh_key"
I guess Chrome have released an update over the past week.
And this update has caused at least 100 of our internal applications to throw the exception shown below. The solutions I have found over the Internet, talk about updating the application server with a stronger cipher.
But, our applications are spread out over various different servers like IIS, tomcat, jboss, weblogic and websphere. So it is not practical solution for me to expect all of these application servers to be updated. Is there any way to get Chrome to allow an
"exception" for these sites ? As these sites are all our internal sites, so the security is not really a concern for us.

Firefox also throws the same exception but there is a documented fix for that by simply changing some settings in Firefox. Is there anyone who is aware of a similar fix in Chrome?

Error

Server has a weak ephemeral Diffie-Hellman public key

ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY


Solution :
Of "Server has a weak ephemeral diffie-hellman public key err_ssl_weak_server_ephemeral_dh_key"
I had also faced the same issue recently.
After doing research I found the solution on it.

I have solved this problem without upgrading jrockit but by simply configuring the ssl section like follows :

`

<enabled>true</enabled>

<hostname-verifier xsi:nil="true"></hostname-verifier>

<hostname-verification-ignored>false</hostname-verification-ignored>

<export-key-lifespan>500</export-key-lifespan>

<client-certificate-enforced>false</client-certificate-enforced>

<two-way-ssl-enabled>false</two-way-ssl-enabled>

<ssl-rejection-logging-enabled>true</ssl-rejection-logging-enabled>

<inbound-certificate-validation>BuiltinSSLValidationOnly</inbound-certificate-validation>

<outbound-certificate-validation>BuiltinSSLValidationOnly</outbound-certificate-validation>

<allow-unencrypted-null-cipher>false</allow-unencrypted-null-cipher>

<use-server-certs>false</use-server-certs>

<jsse-enabled>true</jsse-enabled>
`

It solved many different problems on SSL with chrome. I hope it will help you too in resolving your issue.
How to fix unverified commits on GitHub
Tags: git, github, verified, commits
Published: 2022-03-13 16:46:04

---
title: How to fix unverified commits on GitHub
published: true
description: 
tags: git,GitHub,verified,commits
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oj6fdut8kwam76ehflh2.png
---
Is today the day you are signing your commits but still experienceing the dreaded amber "unverified' tag on them? I have a solution that worked for me to fix that issue.

First run this command via the command line to see which keys already exist:  `gpg --list-secret-keys --keyid-format=long`

You should get a list of the keys that you have previously generated.

Make sure the email that is being used in your key on GitHub is the correct email in git by running this command: `git config --list`

The output of user name, email and key should match what is in your GPG key on GitHub:
 
user.name=Margeaux Spring
user.email=youremailhere
user.signingkey=yourgpgkey

If there is an email mismatch, your signed commits are still being tagged as “unverified” on GitHub, and you will need to add the correct email found  via the step above with this command: 
`git config --global user.email youremailhere`

You cannot assume that git will use the same email for storing and signing the commit.

You can also add more than one email to a key like this:
	1. `gpg --list-secret-keys --keyid-format=long`
	2. `gpg --edit-key YOURKEYTOEDITHERE`
	3. a gpg prompt should appear, then you type `adduid` and press enter
        4. add the email you need to when prompted
	5. after you have followed all the prompts, enter `save` at the gpg prompt
	6. now enter `gpg --armor --export YOUREDITEDKEY`
	7. copy and paste the entire block that appears in your terminal, from and including:
``` -----BEGIN PGP PUBLIC KEY BLOCK-----  to -----END PGP PUBLIC KEY BLOCK----- ```

Next, go to GitHub and click on *Settings->SSH & GPG Keys*, delete the old key, click the green *New GPG Key* button, paste in the key you have copied from your terminal output previously and click save.

Your commits should now be automagically verified.
How to take a screenshot in windows
Tags: windows10, screenshots
Published: 2022-03-13 16:43:14

The screen capture is possibly one of the most classic functions in computing along with the copy and paste function or the possibility of saving a document while you are writing it. So old is the screenshot that on keyboards we still find a specific key for that function. But there are many ways to take a screenshot in Windows 10.

But in this article, we are going to go to the basics. Because if something is simple, better. Let's see three ways to take a screenshot in Windows 10 thanks to the tools that the operating system itself already brings. You will not need to install anything else and you will get screenshots instantly.

Method 1: The Print Screen key
We said that current keyboards include a key called Print Screen. Its function is precisely to take a screenshot. You only have to press it once and it will make the corresponding capture. It's that simple.

This is the most minimalist option possible. The bad thing is that although a screenshot is generated, it will remain in the Windows Clipboard until you copy or cut something new. So if you want to save the screenshot in Windows 10 you will have to do it by hand.

The good thing is that you can paste the screenshot into any Windows program, be it a blank image or an already created text document where you want to embed an image.

Windows 10 lets you spice up the Print Screen key. From Start > Settings > Accessibility > Keyboard you can make pressing the Print Screen key take a screenshot and/or open the snipping bar Windows.

Method 2: Print Screen + Windows key
If you press the Print Screen key on your keyboard next to the Windows key, you will be able to take a screenshot in Windows 10 that will be saved automatically. You will find the screenshots inside the Pictures folder of your user folder. That is, if you go to Libraries < Images > Screenshots you will find the screenshots made with this keyboard shortcut.

Every time you press Windows Key + Print Screen you will take a full screenshot of the entire screen. And, by default, the screenshots are saved in PNG image format, which is ideal for this type of image.

Thanks to this method you can make the captures you want in a matter of seconds without having to worry about them. When you finish, just go to the corresponding folder to check if you need to delete some of those captures, copy them, share them or edit them with another application.

Method 3: The Windows 10 Snipping app
The third method to take a screenshot in Windows 10 is to go to the Snipping tool, one of the default ones in Windows 10 and that allows you to take custom screenshots.

You'll find the Snipping app along with the other tools on the Start menu. Also from the Windows 10 search engine or by pressing the Windows + Shift + S keys.

Among its advantages, the possibility of making a capture with a rectangular shape, freely or full screen, stands out. It is also possible to make a capture where only the window or dialogue box that you have selected appears. All of these options are in the Snipping app's Mode drop-down menu .
How many passes does disk defragmenter do
Tags: defragment, windows
Published: 2022-03-13 16:41:36

Defragmenting the disk is removing all random free spaces, then collecting all the files and storing them in contiguous blocks of memory. It makes the recovery of files much faster.


A hard drive consists of a head from which it reads data. The operating system has a map of all files and is saved. Direct your head to a specific location and access the data stored there. The head should traverse the disk to that location and read the data.

Now imagine if your computer's disk had files saved with many spaces in between. The main head would have to change its location repeatedly to read a file. It will effectively increase the access time to the file. Disk defragmentation attempts to eliminate this extra time.

How many passes does it take to Defragment?
Defragmentation depends on the hardware being used. If the drive is larger, the longer it will take; If their are more files stored, the longer it will be for the computer to defragment all of them. The time varies from one computer to another since each has its box.

The time can be from several minutes to several hours to finish. Of course, you can continue to use your computer when the process is running, but it is recommended to avoid copying or to move files as it will only make the process much longer. The time can even be as long as 24 hours if you have a substantial hard drive full of all sorts of things.

Defragmentation also does the tasks in passes. He makes a rough pass at first and refines it next time. After each pass, the hard drive becomes more organized and faster to access.

What are the additional commands that we can pass to the module?
There are a few command-line options for you to declare that will make the defrag process change to your liking. The central command on the command line is "defrag C:", where "C:" is the drive you are trying to defragment.

(r)This is the default defragmentation setting and only defragments file segments smaller than 64MB
(c) The command defragments all volumes on the computer. You do not need to specify a drive letter when using this command.
(w) Performs a full defragmentation of files of all sizes on a specified disk, regardless of their size.
(I) In this way, defragmentation is only carried out when the computer is idle.
(v) This command ensures that the defragmentation modules display full reports at the end.
(b) Optimize startup files only.
(a) This command will analyze the selected drive and display a report including the scan and all defragmentation reports.

Anyone can easily pass the command lines by using the command line when you launch the disk defragmenter manually.

Hope this post helped you, like, comment and share! :)
Hosting a REST API using Impart
Tags: api, csharp
Published: 2022-03-13 16:26:14

After finishing up my REST API class in Impart, I thought I should share how to easily host a REST API using it. Disclaimer: All code in this post is subject to change as I update and rework the library.

First, we need to add Impart to our project. Find out how in the README here: https://github.com/PixelatedLagg/Impart

Next, we will add our `using` statements:
```cs
using Impart;
using Impart.API;
```

Now, we can jump to `Main()` and write the following:
```cs
static void Main(string[] args)
{   
    Rest r = new Rest();
    r.OnRequest += OnRequest;
    r.Start();
}
```

But wait! What is `OnRequest()`?

That is the method I made for handling requests:
```cs
static void OnRequest(APIEventArgs e, RestContext c)
{

}
```

The `Rest` class in Impart is using JSON formatting for responses, so let's use the convenient `Json` struct to handle response creation. Now, I hear your sighs behind the monitor, but this stays easy - trust me.

In this line, I create a simple JSON document titled 'Impart':
```cs
Json j = new Json("Impart", ("Developer", "William Olsen"), ("Current Downloads", 519), ("Current Stars", 8));
```

Next, we can respond to the request with the `RestContext` class.
```cs
c.Respond(j);
```

Putting it all together:
```cs
using Impart;
using Impart.API;

public class Program
{
    static void Main(string[] args)
    {
        Rest r = new Rest();
        r.OnRequest += OnRequest;
        r.Start();
    }
    static void OnRequest(APIEventArgs e, RestContext c)
    {
        Json j = new Json("Impart", ("Developer", "William Olsen"), ("Current Downloads", 519), ("Current Stars", 8));
        c.Respond(j);
    }
}
```

The default port for hosting is 8080, however you can specify a custom one in the constructor of `Rest`.

Visiting `localhost:8080`, we are greeted with this:

![Result](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yx50nw4pnyhc23ccg9o8.png)

In short, it worked!

As I continue to rework Impart, I will be adding an easy way to host SOAP APIs and make JSON/XML formatting simpler.

Stay posted to see all new updates to the internet's simplest website/networking library, Impart.
Fontes para pessoas desenvolvedoras
Tags: braziliandevs, womenintech
Published: 2022-03-13 16:18:23

## Para quê usar fontes específicas para pessoas desenvolvedoras?

Nós passamos muito tempo lendo códigos e textos em nossos editores de texto e *IDE's*, algo que pode se tornar muito estressante, por causa disso que existem tantos temas e fontes que podem tornar esse trabalho mais confortável, e vamos mostrar alguns exemplos nesse artigo.

## Fira Code

[Fira Code](https://github.com/tonsky/FiraCode) é uma das fontes mais utilizadas por pessoas desenvolvedoras, tendo um **formato mais arrendado**, e com **letras que tem uma clara diferenciação.**.

A principal vantagem da Fira Code são as *ligatures*, símbolos que simplificam expressões de um código, como => e ++

![ligatures](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0hihg8xn3cbev2tgf0dc.png)

## Hack

[Hack](https://github.com/source-foundry/Hack) é uma outra fonte também muito utilizada, principalmente em terminais, **tendo uma grande proximidade com fontes comuns de interfaces Linux.**

![hack](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y38611acjwh7m73uqzez.png)

## JetBrains Mono

A [JetBrains Mono](https://www.jetbrains.com/lp/mono/) é a fonte padrão de todas as *IDE's* da [JetBrains](https://www.jetbrains.com/). A JetBrains Mono é uma fonte alta, **criando uma mesma linha de leitura por todo o texto**, e também tendo diversas ligatures como a Fira Code.

Essa é a minha fonte favorita, e também a que eu uso atualmente.

![JetBrains Mono](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6egoprug40jom6jbxrpg.png)

## Source Code Pro

[Source Code Pro](https://github.com/adobe-fonts/source-code-pro) é uma fonte criada pela Adobe para utilizar dentro de suas interfaces, combinando com uma outra fonte chamada [Source Sans Pro](https://fonts.google.com/specimen/Source+Sans+Pro). Como as outras, também é uma fonte muito confortável, mas que se segue um formato um pouco mais tradicional. 

![Source Code Pro](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ts139l4d82zobsbmd0mk.png)

## Finalização

Nesse curto artigo, mostrei 4 fontes que considero muito boas, e que recomendo caso você queria ter uma melhor experiência como pessoa desenvolvedoras.

Muito obrigada por ler ❤️🏳️‍⚧️ e me segue nas redes, é tudo [@lissatransborda](https://twitter.com/lissatransborda) 👀