teleren/devto huggingface dataset:
I built a popular open source API project, Ask Me Anything!
Tags: ama
Published: 2020-02-19 22:54:44

I recently blogged about how I built [PokeAPI](https://dev.to/phalt/a-retrospective-on-pokeapi-2jme), a very popular open source API. A lot of new developers often encounter this early on in their career.

I want to give people a chance to ask me questions about it, or about running open source projects, or programming in python/django.

So...AMA?
are you using WSL1 or WSL2 ?
Tags: wsl, windows10, cygwin
Published: 2020-02-19 22:33:24

you may not have a choice !

it seems you need windows 10 build 18917 or higher to run WSL2 for example i dont have a choice because im running windows 10 ver 1809 build 17763 and windows 10 ver 1909 build 18323 asap

* https://devblogs.microsoft.com/commandline/announcing-wsl-2/

WSL top is interesting 

```
top - 22:45:19 up 0 min,  0 users,  load average: 0.52, 0.58, 0.59
Tasks:   6 total,   1 running,   5 sleeping,   0 stopped,   0 zombie
%Cpu(s):  7.6 us,  4.3 sy,  0.0 ni, 88.1 id,  0.0 wa,  0.1 hi,  0.0 si,  0.0 st
KiB Mem : 16726340 total, 13060072 free,  3436916 used,   229352 buff/cache
KiB Swap: 34617724 total, 34584156 free,    33568 used. 13155692 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
    1 root      20   0    8324    152    128 S   0.0  0.0   0:00.06 /init
    3 root      20   0    8328    152    116 S   0.0  0.0   0:00.00 /init
    4 cdarra    20   0   16892   3436   2036 S   0.0  0.0   0:00.07 -bash
   16 root      20   0    8328    152    116 S   0.0  0.0   0:00.00 /init
   17 cdarra    20   0   16892   3448   3316 S   0.0  0.0   0:00.06 -bash
   30 cdarra    20   0   17620   2236   1576 R   0.0  0.0   0:00.03 top
```

are there any advantages apart from (hyperv) speed by switching to wsl2 ?
When your docker-compose build outs error, try it with --no-cache option.
Tags: docker
Published: 2020-02-19 22:31:00

It's a simple problem but I've spent about 30 min. so, I leave a note for anyone who is into same hole with me.

## 2020 Feb 20th
I met an error like these. I'm sorry I forgot to take the logs completely. But anyway, it's like this.


```sh
GPG error: https://dl.yarnpkg.com/debian stable InRelease: The

Errno::ENOENT: No such file or directory - the ffprobe binary could not be found

The repository 'https://dl.yarnpkg.com/debian stable InRelease' is not signed
```

## Perhaps, the pubkey is expired
Maybe you have this line in your Dockerfile.

```sh
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
```

Docker uses cache when you run `docker-compose build`.

## 👍 Solution
```sh
docker-compose build --no-cache
```
A chill interview: Abolishing notification mess with a browser extension
Tags: sideprojects, design
Published: 2020-02-19 22:15:47

Hi all! I recently started to interview some developer/designer/indie hacker friends of mine to learn more about their stories, projects and side-projects.

Next to more serious and ambitious interview websites, I'll mostly be trying to focus on chill and feel-good readings. A big goal is also to make the interviewees look approachable: don't hesitate to contact them :)

The last one was with my ex-coworker at JustWatch, co-organizer of the Ionic Berlin Meetup and Vue.js expert. He built a Chrome extension to centralize all your web notifications. I hope you'll enjoy it!

"We aren't okay anymore to grant permission to a Chrome extension to read all our cookies. Notyfy wants to pick up where Chime for Chrome left off."
Simon Wicki
https://www.frenl.com/interview/abolishing-notification-mess-with-a-browser-extension

If you enjoyed reading it, see also:

"I’d learned to use Zapier while running a previous business so I went for it. The demand surprised me and I found my first project the next day."
Andrew Davison
https://www.frenl.com/interview/founding-a-zapier-agency-before-no-code-was-cool

And:

"One day I had to convert a XD file myself and I found out that there was no converter out there whatsoever. One full moon night, I decided to start building it. Many many nights later, it launched ;-)"
Kevin Goedecke
https://www.frenl.com/interview/how-i-built-a-profitable-tool-with-only-one-landing-page
Zero Hardcoded Values
Tags: blender, gamedev
Published: 2020-02-19 21:54:18


Some solutions to this problem involve graph or block based programming interfaces, they let the user safely change values in logic without having to worry about syntax errors.  But these solutions like Unreal Engine Blueprints, are not simple for programmers to automate and setup the initial logic for the users.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/7l9pmosty68rq523tc6t.gif)

Above is the solution used in Blender-On-Acid, the script contains zero hardcoded values. Values are abstracted by single letter Latin variable names, these are mapped to the text editor UI, where they can be edited at runtime and saved as metadata in the blender file.  In the example above i'm editing the variable `Ƹ`, which is linked to the material diffuse color.

Setting default values for the UI is done in the script used to setup the blender scene, see below.

```python
import bpy

world = bpy.data.worlds[0]
script = bpy.data.texts.new(name='myscript')
world.blender_script = script
## default material color ##
script.clr_slot0 = [1,0,0, 1]
## default material add random ##
script.num_slot5 = 0.1
script.num_slot6 = 0.3
## default drop point x,y,z ##
script.num_slot0 = 0.0
script.num_slot1 = 0.0
script.num_slot2 = 10.0
## default size ##
script.num_slot3 = 2.0
## default random threshold ##
script.num_slot4 = 0.98
## default cube to copy mesh data from ##
script.obj_slot0 = bpy.data.objects['Cube']

src = '''
import bpy, _bpy
from random import *

if random() > №:
	mat = bpy.data.materials.new(name='mymat')
	mat.use_nodes = False
	mat.diffuse_color = Ƹ
	mat.diffuse_color[1] += uniform(Ω, Å)

	ob = bpy.data.objects.new(name='myob', object_data=Ƃ.data.copy())
	ob.data.materials[0] = mat
	bpy.context.collection.objects.link(ob)
	ob.location = [₦, €, ₴]
	ob.ode_size[0] = ₵
	ob.ode_size[1] = ₵
	ob.ode_size[2] = ₵

	ob.rotation_mode = "QUATERNION"
	_bpy.ode_add_object( ob )


'''

script.from_string( src )
```
Parse a CSV with Python
Tags: python, beginners
Published: 2020-02-19 21:43:50

A CSV (Comma Separated Values) file is a plain text file where each value is separated by a comma. 

Excel can open CSV Files. This is really cool because it means you can output your data into csv from Python and then open it in Excel.

In this article you will learn how to read a CSV file in Python.

Before playing with csv data, you should <a href="https://gumroad.com/l/dcsp">learn Python</a>

## Introduction

Each line of the CSV file is called a record, every record has values that are separated by commas. 

It is separated by a *delimiter*, the default delimiter is the comma. You can choose to use another delimiter such as a semicolon (;) or a pipe (|).

Shown below is the structure of a regular CSV File.

    1,Alice,Cook,32
    2,Bob,Doorman,34
    3,Chris,Electrician,24
    4,Dave,Fieldworker,44

Copy the data and save it as `example.csv`

## Why CSV?

CSV format is a simply plain-text file. That means you can open it with any text editor, but also that it can be opened by any software application.

You can import a csv into a spreadsheet or database storage without any problems. It's data-interchangeable.

Any programming language that can work with files and strings, can work with csv file data. 

## CSV module

You don't need to write parsing code yourself, as every so often, Python has a module available.

The module we'll talk about is the `csv` module. It is already installed, because it's part of the Python standard library.

You can <a href="https://pythonspot.com/reading-csv-files-in-python/">read csv files</a> with the `csv` module, but also write them.

To load the module type:

```python
import csv
```

Then create your program (read.py)

```python
import csv

# Open the csv file in read mode 'r'                                                                                                                                              
with open('example.csv','r') as f:
    # read the file                                                                                                                                                               
    csvReader = csv.reader(f)

    # output every line in a loop                                                                                                                                                 
    for line in csvReader:
        print(line)
```

If you run the program you'll see:

    ➜  ~ python3 read.py 
    ['1', 'Alice', 'Cook', '32']
    ['2', 'Bob', 'Doorman', '34']
    ['3', 'Chris', 'Electrician', '24']
    ['4', 'Dave', 'Fieldworker', '44']
    ➜  ~ 

Successfully parsed!


**Related links:**
* <a href="https://docs.python.org/3.8/library/csv.html">Pythons csv module documentation</a>
* <a href="https://pythonprogramminglanguage.com/read-csv/">Read CSV with Python Pandas</a>
Do we really need to minify everything?
Tags: webdev, discuss, javascript, seo
Published: 2020-02-19 21:01:04

Also,

- Is Node.js essential for frontend dev (or fullstack), nowadays?
- How do non-Node (e.g. PHP, Python, Ruby, Go) optimize for SEO?
- Even if I use Node.js bundlers, how do I audit / optimize other aspects of SEO?
Solve Sinatra helpers not found, one reason
Tags: sinatra, ruby
Published: 2020-02-19 20:56:29

---
title: Solve Sinatra helpers not found, one reason
published: true
description: When doing modular Sinatra apps, helpers declared out of scope be reported as missing
tags: Sinatra,Ruby
---

This code is wrong because access_db is declared outside of a Sinatra::Base block. app in self.registered is a Sinatra base class with functions. helpers cannot exist outside of those functions.

```
 # require_relative '../helpers/models'

        def self.registered(app)
          clients_db = access_db(Archcare::Logbook::Model::Client)
          clients_for_privilege_level = is_admin? ? clients_db.get_all_documents : get_clients_for_user(current_user_id)
          app.get '/client-report' do
            if logged_in?
              erb :creport,locals: {:title => "New Client Report" ,
                                    :cookie => has_agreed?,
                                    # get all clients from the database
                                    :clients => clients_for_privilege_level}
            elsif !logged_in?
              redirect '/login'
            end
            end

```

this code produced this error.
```
C:\Ruby26-x64\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) C:/Users/Jason/source/ArchcareLogbook/app.rb
Models is loaded
C:/Users/Jason/source/ArchcareLogbook/routes/client_report.rb:18:in `registered': undefined method `access_db' for Archcare::Logbook::Routes::ClientReport:Module (NoMethodError)
	from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/sinatra-2.0.7/lib/sinatra/base.rb:1415:in `block in register'
	from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/sinatra-2.0.7/lib/sinatra/base.rb:1413:in `each'
	from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/sinatra-2.0.7/lib/sinatra/base.rb:1413:in `register'
	from C:/Users/Jason/source/ArchcareLogbook/app.rb:50:in `<class:Logbook>'
	from C:/Users/Jason/source/ArchcareLogbook/app.rb:30:in `<module:Logbook>'
	from C:/Users/Jason/source/ArchcareLogbook/app.rb:4:in `<module:Archcare>'
	from C:/Users/Jason/source/ArchcareLogbook/app.rb:3:in `<top (required)>'
	from -e:1:in `load'
	from -e:1:in `<main>'

Process finished with exit code 1
```

hope this helps!
moreInfoCandyForTheBrain
Tags: theworksinaction
Published: 2020-02-19 20:51:15

Arrays and Loops

1. Why do you think arrays in Swift only support a collection of 
        objects of the same type?
         a. Because the array type only refers to the elements in the 
            array

2. How can you access objects within an array one at a time?
         a. Use a “for in” loop to move around in the array.

3. How might you check if an array is empty?
         a. Use an isEmpty function
Tell Your Story
Tags: career, advice, beginners
Published: 2020-02-19 20:25:31

A junior developer we had to let go approached me.
She was starting her job search and was very anxious about all the upcoming interviews.

"Most people don't write good resumes", I found myself saying.
She looked baffled.
"People write these long list of technologies. They may have only touched once and expect the interviewer to figure out what they know", I explained.
"Can you fix it?", she asked, puzzled.

 \- "Write your accomplishments and learn how to tell them as stories."
 \- "Stories?"
 \- "Yes. This is your story so you'll know best how to tell it. It'll be interesting, relevant and engaging."
theWorksInAction
Tags: theworksinaction
Published: 2020-02-19 20:20:09

Lesson 11 Discussion


1. Why do you think conditionals are important?
    a. Conditionals give the operation something to do after interaction 
    with the user. 
    b.	Conditionals allow the internal workings of a function to be 
    hidden. 

2. Give a set of instructions on how you thing a thermostat program should work and “bold/underline” the conditionals.

 var bestRoomTemp = 70
  if bestRoomTemp < 70 {"its a lil chilli in here"}
   else if bestRoomTemp > 70{"its hot as Hell in here"}
   else {"its just right in here"}
Fira Code - Font with programming ligatures 〽️
Tags: fonts, beginners, webdev, productivity
Published: 2020-02-19 20:17:23


## Source

This article is based on the official [Fira Code documentation](https://github.com/tonsky/FiraCode/wiki) on GitHub .

## Installing

#### MacOS

In the [downloaded TTF folder](https://github.com/tonsky/FiraCode/tree/master/distr/ttf):

1. Select all font files
1. Right click and select `Open` (alternatively `Open With Font Book`)
1. Select "Install Font"

*or*

- Use [brew](http://brew.sh) and [cask](https://caskroom.github.io): 

  *Not officially supported, might install outdated version*
  ```bash
  brew tap homebrew/cask-fonts
  brew cask install font-fira-code
  ```

#### Linux

- Install a package available for your distribution following [the instructions](https://github.com/tonsky/FiraCode/wiki/Linux-instructions#installing-with-a-package-manager)

*or*

- In the ttf folder double-click each font file and click “Install font”; see [“Manual Installation”](https://github.com/tonsky/FiraCode/wiki/Linux-instructions#manual-installation) if double-clicking doesn't work


#### FreeBSD

- Using pkg(8): `pkg install firacode`

*or*

- Using ports: `cd /usr/ports/x11-fonts/firacode && make install clean`

#### Windows

- In the ttf folder, double-click each font file, click “Install font”; to install all at once, select all files, right-click, and choose “Install”

*or*

- Use [chocolatey](https://chocolatey.org): `choco install firacode-ttf`

- Use [scoop](https://github.com/lukesampson/scoop):

  *Run as administrator*
  ```
  scoop bucket add nerd-fonts
  scoop install FiraCode
  ```

## How to enable ligatures

You need to explicitly enable ligatures support in following editors:

- [Atom](https://github.com/tonsky/FiraCode/wiki/Atom-instructions)
- [BBEdit](https://github.com/tonsky/FiraCode/wiki/BBEdit-instructions)
- [Brackets](https://github.com/tonsky/FiraCode/wiki/Brackets-Instructions/)
- [ChromeOS](https://github.com/tonsky/FiraCode/wiki/ChromeOS-Terminal)
- [Cloud9](https://github.com/tonsky/FiraCode/wiki/cloud9-instructions)
- [Emacs](https://github.com/tonsky/FiraCode/wiki/Emacs-instructions)
- [Jetbrains' products](https://github.com/tonsky/FiraCode/wiki/Intellij-products-instructions) (IntelliJ, etc)
- [LaTeX](https://github.com/tonsky/FiraCode/wiki/LaTeX-instructions)
- [LightTable](https://github.com/tonsky/FiraCode/wiki/LightTable-instructions)
- [MacVim](https://github.com/tonsky/FiraCode/wiki/MacVim-instructions)
- [Sublimetext](https://github.com/tonsky/FiraCode/wiki/Sublimetext-Instructions)
- [VS Code](https://github.com/tonsky/FiraCode/wiki/VS-Code-Instructions)

For other editors it must be enough to simply select Fira Code as your font of choice. [Full list of supported editors](https://github.com/tonsky/FiraCode#editor-support)

## Example in VSCode

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

## All ligatures included

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

Thanks for reading me. 😊
Location Data for Cities and Towns
Tags: opendata, sql, sparql, wikidata
Published: 2020-02-19 20:10:21

## Why might you want location data for cities and towns?

Have you ever wanted to geocode some address data, but only to the city/town level - say, for privacy reasons or entity resolution purposes?

Or maybe you just need to plot out all the major cities around the world on a map?

## There is no easy way of obtaining such data.

You could try:

- Google (or some other commercial) geocoding APIs on your lists of city names and towns, but that will probably cost you money.
- Open Street Maps (and APIs that support using OSM), but this isn't easy. Especially if you have a bulk data you are trying to geocode.

## WikiData has a very good source.

OSM is not the only open data available. WikiData also has quite a bit of such data.

This is how you would obtain the locations of cities and towns around the world.

Go to https://query.wikidata.org

and use the following sparql query:

```sparql
SELECT DISTINCT ?citytownLabel ?countryLabel ?loc
WHERE {
   ?citytown wdt:P31/wdt:P279* wd:Q7930989 .
   ?citytown wdt:P625 ?loc .
   OPTIONAL { ?citytown wdt:P17 ?country } .
   SERVICE wikibase:label {
      bd:serviceParam wikibase:language "en" .
   }
}

```

After about a minute, you should get something like:

![table](https://dev-to-uploads.s3.amazonaws.com/i/fc6m93ggsyd5892kijbm.png)

You can simply download the data as csv or json.

You can also take a look by displaying the data on a map (there should be a dropdown on the left.

![map](https://dev-to-uploads.s3.amazonaws.com/i/0qaax4j52sjpsk3un0w6.png)

Interesting to see which communities are more active in open data contribution.

![zoom](https://dev-to-uploads.s3.amazonaws.com/i/bfs1diizgucz955ihoqx.png)

And if you are interested in contributing the location data, or are a school teacher who can make such "data contribution" a geography class project, then the following query will give you a list of cities and towns without a location data, and the link to their wikidata pages.

```sparql
SELECT DISTINCT ?citytown ?citytownLabel ?countryLabel ?loc
WHERE {
   ?citytown wdt:P31/wdt:P279* wd:Q7930989 .
   ?citytown wdt:P17 ?country .
   FILTER NOT EXISTS { ?citytown wdt:P625 ?loc }.
   SERVICE wikibase:label {
      bd:serviceParam wikibase:language "en" .
   }
}
```

You will also realise that the towns that do not have location data tends to be missing a lot of other data too, like their English labels.

WikiData and the community of contributors are amazing.
WP Snippet #006 Conditionally loading a custom template.
Tags: wordpress, webdev, javascript
Published: 2020-02-19 20:07:56

---
title: WP Snippet #006 Conditionally loading a custom template.
published: true
description: A tutorial on how to conditionally load and display a different custom template file in your wordpress themes using functions.php.
canonical_url: https://since1979.dev/snippet-006-conditionally-loading-a-custom-template/
cover_image: https://since1979.dev/wp-content/uploads/2020/02/snippet-006-conditionally-loading-a-custom-template.jpg
tags: wordpress, webdev, javascript
---
[Originally posted on my website on February 19th 2020](https://since1979.dev/snippet-006-conditionally-loading-a-custom-template/)

How to conditionally load a different/custom template file.
-----------------------------------------------------------

Adding custom template files for specific pages can easily be done in WordPress by using special file headers. I [wrote an article](https://since1979.dev/wordpress-multiple-custom-templates-for-posts-and-custom-post-types/) about this a while back. But this will make these templates selectable in the WordPress admin for each page or post. Now if you have a single purpose template like a contact page, or if you need the template to change because of some other condition your better of using the *template_include* filter like shown in this snippet.

{% gist https://gist.github.com/vanaf1979/a3c02da99a194e8f2bfe7f228a61cfb2 %}

In the snippet above we add a filter to the *[template_include](https://developer.wordpress.org/reference/hooks/template_include/)* hook and register a callback function called *template_include_callback*.

Our new *template_include_callback* function receives a string containing the path to the currently selected template file and must return a path to a template file. In this example we determine if the current page is the contact page by checking the post id using the *is_page* function. If so we use the *[locate_template](https://developer.wordpress.org/reference/functions/locate_template/)* function to get a full path to the *contact.php* template file and return that path. if not we simply return the originaly selected template file.

**Note:** Checking for the post id is a bit crude but you can change this condition to whatever you need. You could check for tags, categories or maybe you have some Acf condition that needs a custom template.

#### Follow
Found this post helpful? Follow me on twitter [@Vanaf1979](https://twitter.com/Vanaf1979) or here on Dev.to [@Vanaf1979](https://dev.to/vanaf1979) to be notified about new articles, and other WordPress development related resources.

**Thanks for reading**
Free SEO Premium Tools
Tags: seo, spamscorechecker, padachecker, expireddomains
Published: 2020-02-19 19:58:35

Today i have come up with amazing online tools for SEO guys. The SEO guys always need to pay for these services and today you will get some awesome free premium tools.

As a professional developer, I was doing SEO on few of my websites on side projects. I always faced issues with Moz Page Authority (PA), Domain Authority (DA), Spam Score Checker & Expired Domains. 

To overcome these issue without paying extra charges for these services i have developed online tools, where i can easily search high pa, da and less spam score and expired domains. 

<h2>Tools:</h2>
<ul>
<li><a href="https://expiredomains.today">Expired Domains</a></li>
<li><a href="https://bulkdapachecker.com">Bulk PA/DA Checker</a></li>
<li><a href="https://spamscorechecker.net">Moz Spam Score Checker</a></li>
<li><a href="https://spamscorechecker.net/free-email-spam-score-checker">Email Spam Checker</a></li>
</ul>


I hope I was able to show some of the creativity Tools. There are countless great SEO related projects out there.