teleren/devto huggingface dataset:
Web Analytics for pet projects
Tags: webdev, database, go, html
Published: 2020-05-25 18:13:00

Some time ago I just used Google Analytics for my pet projects. But now with the DSGVO I don't know exactly how that is supposed to work. After some reading about that I came to the following conclusion: We need some quick and dirty way to just have basic tracking of users in web projects.

So here it is, a Cookieless, Free (*not* Freemium) service to track users. There is no user id assigned to traffic and I don't save IP addresses. Does this make it "DSGVO-Compliant"? I honestly don't know, but think it's pretty cool: [https://simple-web-analytics.com/](https://simple-web-analytics.com/)

The server is written in Go, there's some vanilla JavaScript and Bootstrap on the frontend, also Chart.js. And the database is redis. On my Cheap 5 Dollar Linode VPS it can handle ~ 2000 requests per second to track users. There is geolocation, referrer and top pages tracking and everything you would expect. HTTP Caching is used to ensure every user only (mostly) hits the server once per day per site being tracked.

[Check it out](https://simple-web-analytics.com/) :-)
Spinning up a free IPFS webrtc-star discovery server with Heroku
Tags: ipfs, webrtc, jsipfs, heroku
Published: 2020-05-25 18:10:34

---
title: Spinning up a free IPFS webrtc-star discovery server with Heroku
published: true
date: 2020-05-25 18:03:52 UTC
tags: ipfs,webrtc,js-ipfs,heroku
canonical_url: https://suda.pl/free-webrtc-star-heroku/
---

 ![Spinning up a free IPFS webrtc-star discovery server with Heroku](https://suda.pl/content/images/2020/05/Screenshot-from-2020-05-25-17-33-21.png)

While building the **[Web Microphone](https://webmic.suda.pl/)** app with IPFS I sumbled upon an error when trying to use older examples but using the latest `js-ipfs`:

`Error: no valid addresses were provided for transports [WebSockets,WebRTCStar,Circuit]`

It got me puzzled but Vasco cleared it out in this thread:

{% twitter 1262769647482482689 %}

It turns out that it's necessary to use a new discovery mechanism, [`webrtc-star`](https://github.com/libp2p/js-libp2p-webrtc-star). This seemed like an easy way to fix it, just change the server to the hosted randezvous server mentioned in readme and we're done! But nothing is ever that easy. It was failing for me with a 500 error and I shouldn't be surprised as the documentation clearly states:

> it **should not be used for apps in production**

The recommended route is to deploy it on your own. So I tried to get it done in shortes amount of time and preferably without a need to pay for the whole server. Fortunately, Heroku supports Docker containers now and they can be deployed literally with couple of lines! Here's how you do it:

### Instructions

First install the [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli) and then run:

```sh
# Login to Heroku
$ heroku login
# Login to the Container Registry
$ heroku container:login
# Clone the webrtc-star repo
$ git clone https://github.com/libp2p/js-libp2p-webrtc-star.git
$ cd js-libp2p-webrtc-star
# Create a Heroku app
$ heroku create
# Build and push the image
$ heroku container:push web
# Release the image to your app
$ heroku container:release web
# Scale to one free worker
$ heroku ps:scale web=1
# Open the app in the browser
$ heroku open

```

Now the server should welcome you with its address:

![Spinning up a free IPFS webrtc-star discovery server with Heroku](https://suda.pl/content/images/2020/05/Screenshot-from-2020-05-25-17-25-25.png)

Use this address in your IPFS app and you're done!

<!--kg-card-end: markdown-->
How to search for terms within a particular location via Twitter
Tags: codenewbie, network
Published: 2020-05-25 18:02:00



Let's take for example, you want to search for software developer job vacancies in an area. Or maybe you just want to network with developers within your community. Good news is you can do that via Twitter. I'll teach you how to do that in this brief article.

The process requires three vital information: 
(i) the geocode/coordinates of a location within the area, 
(ii) the radius distance, and 
(iii) the key words or phrase.

<u>Geocode/Coordinates</u>:- this a number representing the position of a point on the earth surface.

<u>Radius distance</u>:- this is needed to specify the area to be covered around the selected location.

Once you've gotten that. Enter the information into Twitter search bar in this format:

_geocode:latitude,longitude,radius "terms0" OR "terms1" OR "terms2"_

For example:

_geocode:6.508840,3.376287,10km "coding" OR "web developer" OR "mobile app developer" OR "Software developers"_

By default, Twitter will first show you the top result. You can also navigate to see the latest, people, photos and videos.

Below is the process of getting the coordinates of a location using Google Maps on different devices

**On Android Google Maps**

1. On your Android phone or tablet, open the Google Maps app.

2. Touch and hold an area of the map. You'll see a red pin appear.

3. You'll see the coordinates in the search box at the top.


**On iPhone Google Maps**

1. On your iPhone or iPad, open the Google Maps app .

2. Touch and hold an area of the map. You'll see a red pin appear.

3. At the bottom, tap _Dropped pin_. You'll now see the coordinates.


**On a computer via Google Maps web**

1. On your computer, open Google Maps. If you're using Maps in Lite mode, you’ll see a lightning bolt at the bottom and you won't be able to get the coordinates of a place.

2. Right-click the place or area on the map.

3. Select _What's here?_

4. At the bottom, you’ll see a card with the coordinates.

Ok, that's all. Good luck.
Reducing Jest Memory Usage
Tags: jest, testing, javascript, node
Published: 2020-05-25 18:01:02

---
title: Reducing Jest Memory Usage
published: true
description: 
tags: jest,testing,javascript,node
---

Sometimes this problem occurs on the CI:

```bash
Summary of all failing tests
  ● Test suite failed to run

    ENOMEM: not enough memory, read

      at Runtime.readFile (node_modules/jest-runtime/build/index.js:1880:21)

```

Environment
```
node 12.16.3
yarn 1.22.4
jest 26.0.1

Circle CI container 2 CPU / 4 GB RAM
```

Earlier tests were run by this command
```
yarn jest app/javascript --forceExit --ci -w=2
```

for debugging, run the tests in one thread:
```
node ./node_modules/.bin/jest app/javascript --forceExit --ci -w=1

Test Suites: 100 passed, 100 total
Tests:       1163 passed, 1163 total
Snapshots:   186 passed, 186 total
Time:        89.236 s
```

Maximum RAM usage ([full log](https://gist.github.com/pustovalov/430f5af07e50c3702bf773cc1abc51eb)):
```bash
[56660:0x103fe3000]    91511 ms: Scavenge 1465.3 (1535.5) -> 1459.2 (1539.8) MB, 12.4 / 0.0 ms  (average mu = 0.974, current mu = 0.951) allocation failure 
```

If run specs with `expose-gc` and `logHeapUsage` parameters, you will see a decrease in RAM usage:
```
node --expose-gc ./node_modules/.bin/jest app/javascript --forceExit --ci -w=1 --logHeapUsage

Test Suites: 100 passed, 100 total
Tests:       1163 passed, 1163 total
Snapshots:   186 passed, 186 total
Time:        95.85 s
```

Maximum RAM usage ([full log](https://gist.github.com/pustovalov/52b5387dd417cada0454956c1dd49823)):
```bash
[57108:0x103fe3000]    18741 ms: Scavenge 533.1 (552.0) -> 524.6 (555.7) MB, 5.1 / 0.0 ms  (average mu = 0.988, current mu = 0.979) allocation failure 
```

With these two parameters Jest will run garbage collection ([source](https://github.com/facebook/jest/blob/v26.0.1/packages/jest-runner/src/runTest.ts#L291)):

```js
if (globalConfig.logHeapUsage) {
  if (global.gc) {
    global.gc();
  }
  result.memoryUsage = process.memoryUsage().heapUsed;
}
```

## Conclusion

Run node with `expose-gc` and jest with `logHeapUsage` parameters, can decrease maximum memory consumption without increasing tests execution time, in my case:
```
1539.8 MB -> 555.7 MB
```
[updates] Earned my dev.to badge - Thank you - My Top 5
Tags: motivation, webdev, codenewbie, watercooler
Published: 2020-05-25 17:52:34

## Earlier today

Earlier today I received a mail and a notification that I've been awarded a badge for writing consistently. It is for a 4-week streak 🦄. Many of you would have earned it already. Some of you will earn it soon, and others are here to gain knowledge by reading dev.to posts, and I totally respect that.

![Thank you](https://dev-to-uploads.s3.amazonaws.com/i/hp027f6j7emtv690pkjg.png)

## My Top 3 posts [ most reacted ]

{% link https://dev.to/tharunshiv/pwa-why-should-you-use-it-and-not-use-it-447 %}

{% link https://dev.to/tharunshiv/convert-any-website-into-a-pwa-in-just-3-simple-steps-35pp %}

{% link https://dev.to/tharunshiv/9-things-to-learn-from-facebook-s-new-tech-stack-2020-in-terms-of-atomic-css-javascript-2d5e %}

## My Ongoing series

{% link https://dev.to/tharunshiv/javascript-dom-part-1-what-is-it-and-what-can-we-do-with-it-video-article-3gim %}

I'm loving consistency on dev.to, as the community here is very encouraging. I will try my level best to keep up my streak and provide as valuable content as possible. 

Thank you all 🥇 
You Rock! Keep up the positivity.

{% user tharunshiv %}
Netlify reload 404 error resolved
Tags: netlify, deployment, webdev, tips
Published: 2020-05-25 17:50:58

Netlify is a popular website that can be used to host your websites/web apps. 

However, here is a possible error that you might see when you happen to reload your netlify page. 

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

Here's an easy hack: 
- Go to the folder which is published to netlify. 
- Create a new file called netlify.toml. 
- Copy and paste the following code:
  ```
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
```

Note here, it doesn't matter if you don't have an index.html page in your web app. This just works. 

Cheers, and happy coding.
Örnek GSettings Şeması oluşturma
Tags: gtk, gnome, gsettings
Published: 2020-05-25 17:37:46

GSettings şemaları, Gnome masaüstü ortamı ile kullanılan ve dconf düzenleyici ile de düzenlenebilen, Microsoft Windows sistemlerde yer alan Registry'ye benzeyen yapıya verilen ad.

## GSettings Şeması oluşturma

Örnek bir GSettings şeması için örneğin **apps.gsettings-ornekuygulama.gschema.xml** isminde bir dosya oluşturmanız gerekmektedir.

```xml
<?xml version="1.0" encoding="UTF-8"?>
<schemalist>
  <schema id="apps.gsettings-ornekuygulama" path="/apps/gsettings-ornekuygulama/">
    <key type="b" name="ornekozellik">
      <default>false</default>
      <summary>Mantıksal bir özellik</summary>
      <description>Mantıksal bir ayar içeren özellik.</description>
    </key>
  </schema>
</schemalist>
```

Daha sonra bu dosyayı yönetici olarak **/usr/share/glib-2.0/schemas/** klasörüne koyup, şemaları tekrar compile etmeniz gerekmektedir.

```bash
cp apps.gsettings-ornekuygulama.gschema.xml /usr/share/glib-2.0/schemas/
glib-compile-schemas /usr/share/glib-2.0/schemas/
```

Bu işlemi yaptığınızda "**dconf-editor**" uygulaması ile baktığınızda **apps>gsettings-ornekuygulama** ağaç hiyerarşisi altında **ornekozellik** isminde bir değer gözükmesi gerekmektedir.

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

Dosya içerisinde belki de en önemli kısım anahtar tipleri olarak düşünülebilir. Key type="b" olarak belirtilmiş kısım boolean tipi yani mantıksal true-false olarak belirtilmektedir. Örnek bazı alternatfi anahtar tiplerini aşağıda bulabilirsiniz.

```
b : boolean : true-false
s : string : düzmetin
i : integer : sayı
d : decimal : ondalık sayı
as : array string : örneğin ['bir','iki','uc']
(ii) : : çoklu sayı. Varsayılan değer olarak (12,14) gibi bir değer alabilir.
```

Qui nescit dissimulare, nescit regnare
Bringing an old code base to modern JavaScript

Tags: javascript, webpack, babel
Published: 2020-05-25 17:30:03

Moving code from an old codebase to modern JavaScript presents interesting challenges. We want to take advantage of minification and modularisation of our code and make use of new and modern techniques. But we wouldn't want to have to rewrite everything before we can see any results.

One of the problems is making sure `<script>` tags with JavaScript code don't break when we convert them into modules for lack of access. As a temporary solution, we can export the function used by those `<script>` tags to the `window` object. Using Webpack to add our exported functions to `window` would be the same as putting them in the global scope (As they were before). But now we can begin working with each script file and work our way to converting our whole codebase.

If you are interested here are my notes on it:

https://rderik.com/notes/migrating-an-old-javascript-codebase-to-modern-javascript/
CLOCKS in Linux
Tags: todayilearned, opensource, github, security
Published: 2020-05-25 17:22:53

# Type of clocks in linux
There are roughly two type of clocks in most OS.
1. CLOCK_MONOTONIC
2. CLOCK_REALTIME

## CLOCK_MONOTONIC
It is a Clock that cannot be set and represents monotonic time since some unspecified starting point. This clock should be used for calculating elapsed time.

## CLOCK_REALTIME
It is a Clock that is more human readable. It keeps on adjusting itself to offset for physical errors in machine's clock with NTP servers. One flaw with these clocks is that it can jump forward and if used to compute elapsed time you might get negative time. (Future has gone).

## Usage
If your application is time difference sensitive you might want to use monotonic clock else realtime one.
> In JAVA `System.nanoTime()` resembles monotonic clock and `System.currentTimeMillis()` resembles realtime clock.

> In python you can use `time.clock_gettime(time.CLOCK_MONOTONIC)` or `time.clock_gettime(time.CLOCK_REALTIME)`

- Visit [github](https://github.com/jayeshathila/til) for more
Okay lets discuss the future of SWE in the present of all kind of AI and ML
Tags: discuss
Published: 2020-05-25 17:17:49

---
title: Okay lets discuss the future of SWE in the present of all kind of AI and ML
published: true
description: 
tags: discuss
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/qtqa3bycsiwbqbf3yoa4.jpg

---
we all can say that in last two decades or more the need of SWE engineers ,web developers , DB engineers and all sort of software related fields has been increasing significantly , it might be the result of what web/mobile based big tech companies have achieved (gafa e.g) , now all the hype is about artificial intelligence  , and machine learning and how it can influnce every one of us in his daily life , so as a back-developer i wonder how my life is going to be like in the near future ,other way said am i gonna be useful with all of my technical knowledge that i have or a simple ML algotithm can replace me
🛑🛑 How to Perform Security Testing of APIs? (with Checklist) | 30 Days of API Testing | Day 25
Tags: testing, tutorial, webdev
Published: 2020-05-25 17:11:38

> 🚀 Day 25 Task:  Security Testing of APIS

In this video of 30 Days of API Testing Challenge, I am going to discuss How to Perform the Security Testing of APIs (with Checklist)?

🚀Link 
- https://github.com/shieldfy/API-Security-Checklist
- https://owasp.org/www-project-api-security/


[![30 Days of API Testing](https://i.imgur.com/tXN4sh5.png)](https://youtu.be/bNCZzfBMkcc "30 Days of API Testing")


🚀 Thread:  https://scrolltest.com/api/day25

🚀 All Task List: https://scrolltest.com/api/task

🚀 Watch Full Playlist: https://apitesting.co/30days

### Mastering API Testing -  https://www.learnapitesting.com

--
Be sure to subscribe for more videos like this!

[![ TheTestingAcademy](https://dev-to-uploads.s3.amazonaws.com/i/r7vcy6wbvyjbk1y1uu0o.png
)](https://www.youtube.com/TheTestingAcademy?sub_confirmation=1 "TheTestingAcademy")
💙 #Flutter: Why should you use WireDash.io for your user feedback ?
Tags: flutter, dart, tutorial, beginners
Published: 2020-05-25 17:02:39

Every time I publish a new application on the PlayStore or on the AppStore, I have the same problem:
Most of the users don't leave feedback for my app, and when they do, it's mostly because they want to request a feature, or report a bug directly with the store review system !

And it's very bad for your app for multiple reasons: 

1) The ratings are mostly people putting 3/5 stars for requesting features, or reporting a bug and it give lesser visibility to your app.

2) The user is forced to go back to store to leave a review, and can be tempted to download a concurrent / similar app and uninstall yours later

## Introducing WireDash.io

[WireDash](https://wiredash.io/) is the solution to all the problems above !
The user will have the possibility to report a bug, ask for a feature and even more without leaving your app !

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


It's almost black magic: you probably can't do better for UI/UX since the user take part of the testing process without leaving the app. It also gives the user a feeling of important duties and a close contact with the developers, all of this will result as a higher chance of keeping your user even if your app has major bugs or missing features.

## Installing WireDash

Firstly, you need to register on the website of [WireDash.io](WireDash.io) and create a project, so you can later use the `ProjectId` and `SecretId` that are provided.

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

Even a child can install WireDash, you need to add only 3 lines of code, but before this, don't forget to add the dependency in your pubspec.yaml:
`wiredash: ^0.1.0`

After this, you can start implementing WireDash by wrapping your `MaterialApp` with the `WireDash` widget and add your `ProjectId` and `SecretId` that you got from the previous steps.

And you're good to go !
WireDash is already working and you can start making your first bug report or feature request using the FAB.

![ReportABugWithWireDash](https://dev-to-uploads.s3.amazonaws.com/i/3aac8xqxwtc4yxvr1iuf.gif)

And you can consult your new bug report instantly on WireDash.io

![BugReportOnWebsite](https://dev-to-uploads.s3.amazonaws.com/i/12rrzm9fsoxxl5vgk26o.png)

WireDash support theming and dark mode, as well as most platforms:

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

![DesktopVersion](https://dev-to-uploads.s3.amazonaws.com/i/du44f53cb26k5ikrid8d.png)
You set up a new dev team. What are the first things you would do to make things go as smoothly as possible?
Tags: watercooler, discuss, leadership
Published: 2020-05-25 16:52:58

Imagine you are setting up a new dev team. Either to your current company or to a new one.

What are the first things you would do to safeguard the quality of your day to day life? Those could be technical or more procedural like:

Setting up CI/CD, coding standards, remove technical debt, etc
Setting out a clear process the various recurring meetings, ground rules like "leave the meeting if it is not valuable to you", evaluation processes, 1-1s, etc
Beginner CSS: Center Content with Flexbox
Tags: css, beginners, html
Published: 2020-05-25 16:43:24

The firehose of web development information out there can overwhelm even the smartest of people. If you're a beginner web developer, it can feel like there is no way to learn everything. But, try and keep things in perspective! The best steps are to start simple and continuously build on that foundational knowledge. 

So let's start simple! Centering content with CSS Flexbox.

## CSS properties to learn

`display: flex;` - [Flexbox overview](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox)
`justify-content: center;` - [Overview](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content)
`align-items: center;` - [Overview](https://developer.mozilla.org/en-US/docs/Web/CSS/align-items)

## HTML/CSS Example
```html
<section class="hero">
  <h1 class="hero__heading">Hi</h1>
</section>
```

```CSS
.hero {
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero__heading {
  display: inline-block;
}
```

The important aspects from the code above that you should note is that we are using the parent element `<section class="hero">` to center the content within it. Honestly it's that simple.

### justify-content
`justify-content: center;` tells all child elements to align themselves center on the [main axis](https://developer.mozilla.org/en-US/docs/Glossary/Main_Axis).

### align-items
`align-items: center;` tells all child elements to align themselves center on the [cross axis](https://developer.mozilla.org/en-US/docs/Glossary/Cross_Axis).

Have fun using this in your applications and I highly encourage you to master Flexbox and CSS Grid. These two CSS skills will be the foundation of app layout for many years to come.

## Resources
- Codepen Example: {% codepen https://codepen.io/Ctannerweb/pen/gOajmBB %}
- YouTube:
{% youtube IyWku83os8Q %}
Coffee Companion App LS:004
Tags: swift, ios, coffee
Published: 2020-05-25 16:24:34

---
title: Coffee Companion App LS:004
published: true
description: In this stream, I'm going to implement the edit screen to adjust the ratio for coffee and other important brewing options.
tags: Swift, iOS, Coffee
canonical_url: https://ko-fi.com/post/Coffee-Companion-App-LS-004-R6R81R1SO
series: Coffee Companion App
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/t5qp1m3b3a3ci523p0dl.png
---

Thanks for all that joined me on the live stream! Make sure to tune in next week same time (1pm CDT on Monday) and [same place](https://twitch.tv/appsbymw)!

{% youtube ILBy6kgfcu8 %}

# What did I do on May 25th?
I made the edit page! Here's the sketch of what I was going for.

![](https://cdn.buymeacoffee.com/uploads/project_updates/2020/05/b26098324a06c95ccf4302b28fdf6e8f.jpeg)

Here's how the edit view looks right now.

![](https://cdn.buymeacoffee.com/uploads/project_updates/2020/05/0202a59939e6ff82955d35215f1cdab5.png)

I also added in UserDefaults to store the coffee to water amount, blooming time, blooming ratio, and coffee ground amount. Believe it or not, it also influences all the views.

# What am I planning on June 1st?

In the next stream, I need to make the coffee ground button more apparent that it's a button. It's kinda hard to know that you push it and the amount can change.

I also am going to add a log of past brews.

# Looking for more about the project?

Want to know what tasks need to be done or what’s being planned for the app? Check out the Trello board

Want to see the code? Dig through the [GitHub repo](https://github.com/appsbymw/coffee-app) and star, watch, or sponsor it!

Want to help fund the app and get your name listed at the end of the stream?

- [Buy me a Coffee](https://ko-fi.com/appsbymw)
- [Become a Patron](https://www.patreon.com/appsbymw)