teleren/devto huggingface dataset:
Mapa do COVID-19 no Brasil
Tags: covid, covid19, php, brasil
Published: 2020-03-24 20:24:16

Tive a ideia de lançar o [Mapa do Coronavírus no Brasil (MCB)](https://mapacoronavirus.github.io/) no sábado (23mar2020). Após pesquisar acabei encontrando [alguns sites](https://sigageomarketing.com.br/coronavirus/) com mapa do COVID-19 no Brasil, inclusive alguns com os municípios.

Queria criar um site com dados atualizados e com uma interface leve. O site mais completo e atualizado que encontrei foi o do https://labs.wesleycota.com/sarscov2/br/ criado pelo [Wesley Cota](https://github.com/wcota/). 

## Parte técnica
Como o trabalho de coleta de dados do Wesley Cota foi excelente e estava [disponível no Github](https://github.com/wcota/covid19br) resolvi aproveitar os dados atualizados por ele para alimentar o MCB. Aproveito aqui para deixar o meus parabéns pelo trabalho e meu muito obrigado ao Wesley Cota.

Usei o plugin [jquery-csv](https://github.com/typeiii/jquery-csv) para processar os dados CSV em client side, [Leaflet](https://leafletjs.com/) para exibir o mapa, [DataTables](https://www.datatables.net/) para exibir os dados e [jquery-loading](http://carlosbonetti.github.io/jquery-loading/) para status do carregamento. 

O domínio foi registrado no https://porkbun.com/ e o site está hospedado no Github Pages.

## Contribuições
Quem estiver afim de contribuir com o projeto basta abrir uma [issue no Github](https://github.com/MapaCoronavirus/mapacoronavirus.github.io/issues). Quem quiser aproveitar o código fonte do site também sinta-se a vontade.

## Atualização 21:13 24mar2020
Como não foi possível configurar corretamente o CNAME do http://mapacoronavirusbrasil.com/ usando os nameservers do http://porkbun.com mudei para os nameservers do http://cloudflare.com.

Ocorreu uma espécie de conflito entre redirecionamentos https do Github e do CloudFlare, por essa razão desativei o redirecionamento. O endereço http://mapacoronavirusbrasil.com/ parece estar funcionando corretamente agora.

## Atualização 07:36 25mar2020
O conflito de redirecionamento https aconteceu pois o proxy reverso do CloudFlare acessava o Github Pages (GP) no modo "Flexible" padrão sem usar https e o GP redirecionava para o endereço http://mapacoronavirusbrasil.com/ também sem https gerando um loop de redirecionamento e consequentemente um erro ao carregar a página. 

Corrigi esse erro habilitando o https no modo "Full" través do CloudFlare, assim o GP não precisa redirecionar novamente, haja vista que todo o tráfego agora passa através do CloudFlare até o GP via https.

## Atualização 11:18 11abr2020
<center><img src="https://i.imgur.com/aZGXaBv.png"></center>Adicionei os campos "casos supeitos" e "recuperados" usando [dados](https://twitter.com/CoronavirusBra1/status/1247194769517928448) do perfil "Coronavírus Brasil" no Twitter.
Changing a constant in Java at runtime (WHAT?!)
Tags: java, beginners
Published: 2020-03-24 20:08:55

When learning Java, you were told that constants can be created by using the *final* keyword and that the value (or the object reference) they hold can never be changed, otherwise, they wouldn't be known as constants, right?

That's almost true. In fact, you can change the value of a constant with the use of a technique called Reflection. With reflection, you are able to programmatically access and change information about fields, methods, and constructors of loaded classes at runtime.

In this example, we are changing the private constant AGE from 50 to 15:

```java
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;

public class ModifyConstant {
    public static void main(String[] args) throws Exception {
        OldPerson fakeYoungPerson = new OldPerson();
        changePrivateConstant(fakeYoungPerson, "AGE", 15);
        fakeYoungPerson.sayYourAge();
    }

    public static void changePrivateConstant(Object instance, String constantName, Object newValue) throws Exception {
        // gets the Field object which represents the constant
        Field field = instance.getClass().getDeclaredField(constantName);

        // need this because AGE is 'private'
        field.setAccessible(true);

        Field modifiers = field.getClass().getDeclaredField("modifiers");

        // need this because modifiers of any Field are 'private'
        modifiers.setAccessible(true);

        // this kind of removes the 'final' keyword.
        // it actually turns off the bit representing the 'final' modifier
        modifiers.setInt(field, field.getModifiers() & ~Modifier.FINAL);

        // and now we are able to set the new value to the constant
        field.set(instance, newValue);
    }

}

class OldPerson {
    private static final Integer AGE = 50;

    public void sayYourAge() {
        System.out.println("I'm " + AGE + " yo only!");
    }
}

```

The resulting output after compiling and running this class is:
```
I'm 15 yo only!
```

Of course that changing a constant is a completely weird use case, although I think that might have caught your attention to this (right?). Nevertheless, reflection is a powerful technique that helps developers to create dynamically configurable components. You also need to be aware that reflection costs a lot in terms of performance, so use it wisely and only when really needed.

The last thing that I would like to mention, is that this particular example wouldn't work if the constant is of type *String* because of the *Java String Constant Pool*, but this is a different story which I will leave for later...
Copy-paste in tmux
Tags: tmux, linux, macos, ssh
Published: 2020-03-24 20:00:16

---
title: Copy-paste in tmux
published: true
description: An essential tmux trick
tags: tmux, linux, macos, ssh
---

tmux is a great tool if you live in the shell. Sometimes you'll need to copy-paste between windows & panes. If you have a vertically split window, you can't use the mouse to copy text from one side to the other.

Here's how to copy-paste between tmux windows or panes:

1. `ctrl+b,[` allows you to move your cursor around
2. `ctrl+space` starts copying from where the cursor is
3. `ctrl+w` grabs the selection to the tmux clipboard
4. `ctrl+b,]` pastes the clipboard out to the current window / pane

That's it, hope it helps you!

---

If this helped you, follow me on dev.to for more tips. I use dev.to as a journal, where I record any tricks that I see myself using regularly. You'll probably find it useful too!
Simple Weighted Random Number
Published: 2020-03-24 19:51:56

#Flatiron Student

I am currently on my 6th week at Flatiron School and I've it has been a roller coaster for sure. It is project week for us and a problem that I was facing in my project was working with probability. Now probability when working with Ruby (or from my research ANY language) can be either simple..or complicated enough to make you want to throw your laptop..needless to say..I almost threw my laptop.

#Simple Stupid

I want to share with you my simple way to work with weighted random numbers (probability). Now as a disclaimer this is **NOT THE MOST EFFICIENT METHOD TO WORKING WITH WEIGHTED RANDOM NUMBERS**. This post is for a simple solution that has limited application.

#More Than One Means
The basis of this solution to working with weighted probability is the following:
**The more the are, the more likely it will get picked**
If I had the following array:
`arr = ["test1", "test2", "test1", "test1"]`
and were to run the following method:
`arr.sample`
There would be a greater chance that `test1` will be chosen from the `.sample` method.

#Not DRY at all
This can lead to a lot of repetition in your code so to be honest I'd stay away from using something like this unless you were:
- Working with a very small amount of data

That's it. Don't use this unless you're working with a small amount of data.

I will definitely continue to do more research in working with this and come back with a more advance way of working with weighted probability and make it as understanding as I can. Until then..
Should I call Mongoose from the Express middleware?
Tags: discuss, node
Published: 2020-03-24 19:50:02

---
title: Should I call Mongoose from the Express middleware?
published: true
description: 
tags: discuss,node
---

When you look for tutorials about building a REST API with Express and Mongoose, the vast majority includes snippets like this:

```javascript
router.get('/users', async (req, res) => {
  res.json(await User.find())
}
```

Is it a good practice to directly access Mongoose Models from the Express middleware without any abstraction?
Deploying a static website on NGINX under 2min & single command
Tags: webdev, showdev, tutorial, codenewbie
Published: 2020-03-24 19:10:11

&thinsp;

<img src="https://miro.medium.com/max/560/1*pNMQoKkOt4DnHW99poXSPQ.png">

&thinsp;

Nginx Simple Webserver can awesomely serve static web assets -- Deploying one shouldn't be hard and time-consuming.



Nginx-Auto Automates this for you :) https://github.com/chinyasuhail/nginx-auto

<hr>

### Note
⚠️ Remember to Point your domain (FQDN) to the server’s IP by adding an A record before proceeding further <br/> (example.com in “A” 192.168.0.1)

⚠️ Add a www CNAME pointing to your root domain (www.example.com → example.com)

&thinsp;

### 🙌 SSH into your instance and run the Installer; As simple as that!
&thinsp;

```
wget -N https://raw.githubusercontent.com/chinyasuhail/nginx-auto/master/install.sh; sudo chmod +x install.sh; sudo ./install.sh
```
&thinsp;

### 🧙 Now FTP/ SFTP or Use a magic wand to move your assets into

&thinsp;
```
/var/www/<your-domain-name-used-for-installation>
```

&thinsp;

### 🆘 Ran into trouble? Need a fresh restart? Use the Uninstall Command.

&thinsp;
```
wget -N https://raw.githubusercontent.com/chinyasuhail/nginx-auto/master/uninstall.sh; sudo chmod +x uninstall.sh; sudo ./uninstall.sh
```

&thinsp;
How to build your habits and manage your time | Eleftheria Batsou | Online Webinar at HackWeek PL
Tags: pubicspeaking, motivation, talk, conferene
Published: 2020-03-24 18:54:25

⬇️The video starts at 4:50

👋Hello, I'm Eleftheria, an app developer, master student, content creator, and chocolate lover

This video is my talk in HackWeek, Poland. 
[HackWeek](https://www.facebook.com/hackweekpl), an online webinar, was held on the 21st of March. 

~ Thank you Michal for the invitation ~ 
~ Thank you Maksymilian for the technical support ~ 
~ Thanks everyone for watching 💓🤗 ~ 




😎Top 3 list:
- How to stay motivated | A developer's edition | @BatsouElef: https://youtu.be/qMvEtb5OxNo
- How to be a Better Problem Solver | Tips and solutions: https://youtu.be/dELt7yKIxIA
- Simple Tips to Build a Personal Brand as a Developer (+ personal examples): https://youtu.be/7s0o1gi0iP0

🥰If you liked this video please share

🍩Would you care about buying me a coffee? You can do it here: [paypal.me/eleftheriabatsou](paypal.me/eleftheriabatsou) but If you can't that's ok too!


**************************************

🙏It would be nice to subscribe to my [Youtube](https://www.youtube.com/c/EleftheriaBatsou) channel. It’s free and it helps to create more content.

🌈[Youtube](https://www.youtube.com/c/EleftheriaBatsou) | [Codepen](https://codepen.io/EleftheriaBatsou) | [GitHub](https://github.com/EleftheriaBatsou) | [Twitter](https://twitter.com/BatsouElef) | [Site](http://eleftheriabatsou.com/) | [Instagram](https://www.instagram.com/eleftheriabatsou/)
A fix for ‘FirebaseCore/FirebaseCore.h file not found’ when using cordova-plugin-firebasex
Tags: cordova, firebase
Published: 2020-03-24 18:40:01

When building a Cordova application chances are that you might want to integrate Google Firebase, whether for push notifications, analytics or authentication. Chances also are that like me you would use [cordova-plugin-firebasex](https://github.com/dpa99c/cordova-plugin-firebasex) as it seems to be the most advanced and most actively maintained firebase plugin out there. In my case the extensive [Ionic Native](https://ionicframework.com/docs/native/firebase-x) wrapper is a plus as well.

As extensive and well-maintained cordova-plugin-firebasex is, there are some quirks that can drive you crazy. One of them is the `FirebaseCore/FirebaseCore.h file not found` issue on iOS. This issue occurs mostly when running `cordova prepare ios`, after a fresh checkout for example or if you had to delete the platforms and plugins folders for some other reason. For me the issue occurs literally every time, even so I made sure all pods are up to date (as the plugin docs and issues suggest).

The only thing that seems to work well all the time is removing and re-adding the plugin every time after `cordova prepare`. This can be a cumbersome task, as you might want to keep the plugins's exact version as well as all custom configuration (which will be removed from package.json on `cordova plugin rm`).

Recently I just had enough (and sometimes I'am super lazy), so I wrote a script to automate the removing and re-adding of cordova-plugin-firebasex with all it's configuration from package.json.

To hopefully make someone else’s life a little easier as well, I decided to share my script with you, have fun!

```javascript
const packageJson = require('../package.json');
const { spawn } = require('child_process');

function reinstallFirebase() {
  console.log(`Starting to re-install cordova-plugin-firebasex... Go grab some ☕️ or 🍔 while I'm at it. I will get back to you, as soon as I'm done!`);

  const firebaseVersion = packageJson.dependencies['cordova-plugin-firebasex'];

  let command = `ionic cordova plugin remove cordova-plugin-firebasex && ionic cordova plugin add cordova-plugin-firebasex@${firebaseVersion}`;

  const firebaseOptions = packageJson.cordova.plugins['cordova-plugin-firebasex'];

  for (const option in firebaseOptions) {
    if (firebaseOptions.hasOwnProperty(option)) {
      const value = firebaseOptions[option];
      
      command += ` --variable ${option}=${value}`;
    }
  }

  const npm = spawn(command, {
    cwd: process.cwd(),
    env: process.env,
    shell: true,
  });

  npm.stdout.on('data', (data) => {
    console.log(data.toString());
  });

  npm.on('close', (code) => {
    console.log(`🎉 Fixed firebase for you! 🔥`);
  });
}

reinstallFirebase();
```

(I put this script in `scripts/reinstall-firebase.js` and added `”rf”: “node scripts/reinstall-firebase.js”` to `scripts` in `package.json`.)
How to run Google Chrome without CORS
Tags: misc, cors, webdev
Published: 2020-03-24 17:23:22

---
title: How to run Google Chrome without CORS
published: true
tags: Misc, CORS, webdev
canonical_url: https://www.code4it.dev/blog/run-google-chrome-without-cors
cover_image: https://res.cloudinary.com/bellons/image/upload/t_dev-to/Code4IT/Covers/google-chrome-no-cors.jpg
---

A few days ago I came across a problem: while developing a page I was integrating some external APIs. Those APIs were misconfigured, so running the application on localhost brought me a CORS error.

## CORS: a reminder

Just a reminder of what CORS is (taken from [MDN web docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS "MDN documentation on CORS")):

> **Cross-Origin Resource Sharing** (CORS) is a mechanism that uses additional HTTP headers to tell browsers to give a web application running at one origin, access to selected resources from a different origin. A web application executes a cross-origin HTTP request when it requests a resource that has a different origin (domain, protocol, or port) from its own.

In short: let's say that my site is running on _my-site.com_, and I need access to a resource from another domain (eg: _ext-site.com_). If the creators of ext-site.com want to allow my-site to use their resources on the browser, they must add an **HTTP header** that tells the browser that my-site is "authorized" to use their resources.

## Running Google Chrome without CORS

Of course, I couldn't update the configurations on API's server, so I was stuck.

Then, after some research, I came across an [article by Aleksandr Filatov](https://alfilatov.com/posts/run-chrome-without-cors/ "Run Chrome without CORS on other OSs") where the author suggests a way to open Google Chrome without CORS.

You can create a shortcut, as explained in his article. Otherwise, if running Windows 10, you can open a console and run

```
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-web-security --user-data-dir=~/chromeTemp
```

This command opens a new Google Chrome window and allows you to continue with your development.

![Google Chrome without CORS screenshot](https://res.cloudinary.com/bellons/image/upload/Code4IT/Chrome%20without%20CORS/google-chrome-no-cors.png "Google Chrome without CORS screenshot")<figcaption>Google Chrome without CORS</figcaption>

As you can see, there is a warning stating that the flag `--disable-web-security` can bring security issues. You can just ignore it for local development.

Also, as you can see from the screenshot above, the bookmark bar is empty (because there is no associated user).

If you don't want to work on terminal each time, you can put the script directly into a .bat file, and run it as if it was a simple program.
Open GitExtensions from Visual Studio
Tags: gitextensions, visualstudio, externaltools, git
Published: 2020-03-24 16:13:06

---
title: Open GitExtensions from Visual Studio
published: true
description: Add GitExtensions to Visual Studio Tools Context Menu using External Tools
tags: GitExtensions,Visual Studio,External Tools,Git
---

If you haven't used [GitExtensions ](http://gitextensions.github.io/) as your Git GUI, I highly recommend it. Unlike other Git GUIs, it does not attempt to hold your hand. It is feature rich, under [**very** active development](https://github.com/gitextensions/gitextensions/commits/master).

---

I try and automate or script everything I can. Something I find myself doing a lot is opening a solution using a shortcut, and then having to open a CLI or explorer and having to navigate to my solution dir and open GitExtensions.

I recently learned about ["External Tools" in Visual Studio](https://docs.microsoft.com/en-us/visualstudio/ide/managing-external-tools?view=vs-2019).

It is as simple as it sounds:
> You can call external tools from inside Visual Studio by using the Tools menu. A few default tools are available from the Tools menu, and you can customize the menu by adding other executables of your own.

For GitExtensions, open "Tools" -> "External Tools..." and then enter the following info in the dialog:

![External Tools Dialog - Visual Studio](https://dev-to-uploads.s3.amazonaws.com/i/erhlu71rh5x2mp4uiots.png)

And when youre done, click the Tools menu, and you should see this:

![Tools Menu - Visual Studio](https://dev-to-uploads.s3.amazonaws.com/i/v3ualqf8xosez4fzzcvr.png)
Pure CSS & SVG text cursor 
Tags: css, html, webdev
Published: 2020-03-24 17:11:44

Hello friends 👋,

I just made this little tutorial on how to create a custom cursor with text using only CSS and SVG.

### Check it out:
{% youtube 7FYyJxLQgvI %}
{% codepen https://codepen.io/astrit/pen/QWbZgpR %}
First Post Follow-Up
Tags: secondpost, interview, update
Published: 2020-03-24 16:50:22

To follow-up on my first post, the interview went well! The team really liked me and now I'm just waiting for the next steps!

Update:
So I made ^this^ tiny post already knowing the outcome of the the interview. I GOT THE JOB!! I didn't post it just yet as I didn't have a start date at the time as, you know, #WFH, #CoronaVirus and all that. However, I have my start date and I am freaking out already, but still very excited.

My apologies to anyone I left wondering what was up.

I suppose my next post will likely be about my first day
Covid-19 Live Insights - Hard rework
Tags: javascript, covid19
Published: 2020-03-24 16:49:59

I want to republish the coronavirus analytics platform 

https://coronavirus.davidb.dev/


![Covid-19 image](https://raw.githubusercontent.com/bumbeishvili/Assets/master/Other/Screen%20Shot%202020-03-24%20at%2020.31.45.png)

New features :

**Live analytics** - data updated in every 15 m. It comes from John Hopkins university repo and Worldometers.

**Location-based content** - based on your location, the corresponding country will be highlighted and corresponding language will be set.

**Predictions** - Predictions are made using polynomial regression function. 1,2,3 orders of regressions are applied, with rSquared more than 0.9.  It lets you see what will happen in one week.

**Mobile-Friendly** - 50% of viewers were using mobile phones.

It does have one weak point, which is translation. I translated words in different languages using google translate, so they won't be perfect. Here is the translation file

[Translate.csv on Github](https://github.com/bumbeishvili/coronavirus.davidb.dev/blob/master/translate.csv) (Pull requests welcome)


As before, you can again check the country and continent level statistics and travel through time.

I don't usually like to republish things, but I spent so much time on this, I can't just let it go unnoticed.

I would appreciate your feedback
Is such a package of illustrations needed?
Tags: design, webdev, opensource
Published: 2020-03-24 16:47:56

Hello everyone, my name is Nikolai, I am creating lowpoly illustrations in
blender, my work can be found here: https://www.instagram.com/nsobolewart/
I decided to try open source set
of isometric illustrations, and decided to ask you, web developers and designers as future potential users of such a pack, what do you think about the illustrations that I have already made?
Here is a link to them https://imgur.com/a/0LhZdYb
Thanks in advance!
Flywheel Web Hosting review and tutorial – with Pros and Cons
Tags: flywheel
Published: 2020-03-24 16:39:27

 
Flywheel Web Hosting was begun in 2012. It is a headmost WordPress hosting company in the vast web development industry. It was established to afford a better experience with good and quality web hosting services for WordPress designers and developers all over the world.

<a href="https://mythemeshop.com/blog/flywheel-hosting-review/">Flywheel Web Hosting </a> is very fast loading, descent, ruling, ascendable, and strong platform that is helpful to do better than most competitors.

This Web Hosting has got rave reviews from both developer and designers. Flywheel Web Hosting providing a fine design which is friendly with the users. It consists of all the settings such as features, plans  & pricing, product & other features which you would need from any Web Hosting Service provides.

To get started with the Flywheel you first have to sign up, read thoroughly the terms of services to knowing about what the Hosting service has the offer. To understand the working of Flywheel Hosting you can read and understand other sections of the site. After sign up, it is essential to make a new website and do payments for it. If it is your first website then set up your details of payment. It is used to add your credit card details or another mode of payment.

The cheapest and starting plan given by Flywheel is $23. The features of Flywheel Web Hosting are free migrations, CDN, Collaborators, password protection, enable/disable the cache cloning, create & restore backups, Demo sites.

Flywheel contributes an uptime of about 99.99 % which means that your site will be available for about  99.99 %  of the time. You can easily contact their support team from 9:00 AM to 7:00 PM.  It provides great service response times of less than 400ms, even in the extremely high traffic time. Flywheel offers your websites loading speed a consequential boost.
Flywheel supports its customer 24/7.
<a href="https://mythemeshop.com/wordpress-101/">wordpress tutorial
</a>
Convert Adobe XD Prototype Mockup to HTML, CSS Code
Tags: tutorial, css, html, flexbox
Published: 2020-03-24 16:32:48


Part 2/2 of the XD to CSS, HTML Tutorial.  Finishing the 'inner' parts with CSS Flexbox.
___
Please consider subscribing to the [YouTube Channel!](http://www.youtube.com/FollowAndrew?sub_confirmation=1)
___
{% youtube 5IxtX8qJdvo %}

Hope all are well and learn a trick or two. Happy quarantine to all!