teleren/devto huggingface dataset:
What Cache-Control headers do I need?
Tags: http, caching, flowchart
Published: 2020-05-19 06:38:54

[Understanding caching](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching) is an important part of web development. From a performance point of view, you don’t want a client to be downloading the same large file again and again. But from a security point of view, you don’t want sensitive data, such as users’ personal details, cached by shared web proxies and served to other users. 

There are many aspects to HTTP caching, but the one that’s always confused me the most is the [Cache-Control](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control) header. There are so many options! When should I use each one? Why does `no-cache` not mean “disable caching”??!

To help myself remember what all the options do I made this little flowchart. Hopefully you’ll find it useful too. If you spot an error, please [contribute on GitHub](https://github.com/NeilMadden/cache-control-flowchart). And if somebody wants to make a prettier version, please do! (Just [credit me](https://creativecommons.org/licenses/by/4.0/)). 

![A flowchart of Cache-Control header options](https://dev-to-uploads.s3.amazonaws.com/i/0wxyx8li2tzfg6x41xy7.png)

[PDF version](https://github.com/NeilMadden/cache-control-flowchart/raw/master/cache-flowchart.pdf)
My first DEV post!!!! 😀😀😀😁😁😁
Tags: ubuntu, bash, shell, debian
Published: 2020-05-19 06:40:48

# Hello to DEV community!
---------------------------------------------------------------------------------
##### My first DEV post!
My GitHub: http://github.com/asiawin
My Twitter: http://twitter.com/hypercreeck
My Instagram: http://instagram.com/hypercreeck
My Open-Source organization on GitHub: http://github.com/opencreeck
My Facebook page: http://facebook.com/hypercreeck
My Website: http://hypercreeck.cf/
My Blog: http://codersring.rf.gd/wordpress
My Forum: http://codersring.rf.gd/forum
My YouTube channel: https://www.youtube.com/channel/UCKWKXQOMdb6xEJ1Gx7-340g?view_as=subscriber
Scrapping google images to create Mask,No-Mask Dataset using Selenium
Tags: selenium, scrapping, dataset, beautifulsoup
Published: 2020-05-19 06:34:11

In this tough time and each of us should share knowledge and collaborate. I was trying to make a dataset of People wearing mask and without mask,I have collected a little data. But I am sharing,how can you scrape google images and do this task. Here is my video explaining the concept.
First of all we need to have Selenium and a webdriver, e.g. chromium webdriver.


Here is the code:
```python
import os
import time
import urllib.request
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Chrome("C:\\Users\\Sourabh\\chromedriver.exe")
driver.get('https://www.google.com/') #opens up google
search = driver.find_element_by_name('q') # the name of the searchbox
search.send_keys('people wearing mask',Keys.ENTER)
```
Now, we need to go to the images section
```python
elem = driver.find_element_by_link_text('Images')
elem.get_attribute('href')
elem.click()
```
Now, We need to scroll the page to collect more and more values of src from <img src>
```python 
value = 0
for i in range(50):  #Scrolls the page 50 times
 driver.execute_script('scrollBy("+ str(value) +",+100);')
 value += 100
 time.sleep(4)
```
Now we need to find the class/id of img tag to get the src attribute from there.As of now there are three classes in google images img tag.Keep in mind that google changes it periodically ,So, It might not work after weeks.
```python
elements = driver.find_elements_by_xpath('//img[contains(@class,"rg_i") and contains(@class, "Q4LuWd") and contains(@class, "tx8vtf")]')
try:
    os.mkdir('peoplewithmask')
except FileExistsError:
    pass
```
Finally we need to retrieve and download the links
```python
count = 0
for i in elements:
    src = i.get_attribute('src')
    try:
        if src != None:
            src  = str(src)
            count+=1
            urllib.request.urlretrieve(src, os.path.join('withMask','image'+str(count)+'.jpg'))
            if count%10 == 0: print("downloaded",count,"images")
        else:
            raise TypeError
    except TypeError:
        pass
```
Done, This was all for today. Feel free to reach out if you need help.
I did not explain how to inspect and find out the class,id,etc because I feel that most developers know,Still if you find problem please refer to this video tutorial.
{% youtube m32M5Qfc4-I %}

Thanking You 
Sourabh
AWS Vs GCP- Secret Tips To Choose For Your Business

Published: 2020-05-19 06:27:53

We already know that cloud computing has taken the whole world. Those struggling days are gone when businesses and enterprises deal with the complicated on-premise server rooms and complicated networking. In the past decade cloud computing has become the ideal choice of businesses and enterprises because of its features like secure, cost-efficient and reliable. The major providers of the industry are now investing in their hardware, software and global networking infrastructure to obtain higher market share and it results in unparalleled performance. Healthy competition is always better for users and partners because it reduces the cost and requires them to continuously develop to stay ahead. And same is applicable for AWS Vs GCP too.

When we think about cloud computing providers, three leaders come to mind- Azure, Google Cloud, and AWS. Here we are going to compare google cloud vs aws. There are some advantages and disadvantages of both the providers. Also here we will discuss the issues and challenges that you may face while choosing AWS or GCP. 

**What Is AWS? And What Is GCP?**
*Amazon Web Services(AWS)-*
AWS is a daughter company of Amazon. It is one of the oldest and widely used cloud platforms. This platform offers easy to use, flexible, reliable, scalable and cost-effective cloud computing solutions. AWS cloud computing platform offers a collection of cloud services that build up a fully-fledged platform. It is also known as a powerhouse of databases, analytics, networking, storage. It’s billing feature is so simple and cost effective- You have to only for you’ve used.

*Features of AWS-*
Total Cost of Ownership is very low compared to any private/dedicated servers.
Offers Centralized Billing and management
Offers Hybrid Capabilities
Allows you to deploy your application in multiple regions around the world with just a few clicks
**Google Cloud Platform-**

Know more at- [https://solaceinfotech.com/blog/aws-vs-gcp-secret-tips-to-choose-for-your-business/]
Try It Online
Tags: todayilearned, scripting, languages
Published: 2020-05-19 06:13:44

I just stumbled over [Try It Online](https://tio.run/#) which describes itself as 
> a family of online interpreters for an evergrowing list of practical and recreational programming languages.

> To use TIO, simply click the arrow below, pick a programming language, and start typing. Once you click the run button, your code is sent to a TIO arena, executed in a sandboxed environment, and the results are sent back to your browser. You can share your code by generating a client-side permalink that encodes code and input directly in the URL.

There's a large selection of languages both recreational, code-golfy, and serious (like C#). Enjoy!
Time based log file rotation with zap
Tags: go
Published: 2020-05-19 05:48:24

[zap](https://github.com/uber-go/zap) is one of the nicely maintained, well-written and [nicely performing](https://github.com/uber-go/zap#performance) open source logging libraries in Go. Unfortunately, not all apps in our organization are 12-factor apps and thus we still log to physical files. So, I needed a way to rotate log files while using zap. I come from Java background, and [log4j](https://logging.apache.org/log4j/2.x/) has a very vast array of log rotation options. But I found it lacking in zap, clearly because in the world of containers, logging to stdout (treating logs as event streams - [12-factor logs](https://12factor.net/logs)) is very common.

To be specific, I was looking to do time based rotation (one log file per hour, helps in debugging) and not size based. On [zap's FAQ](https://github.com/uber-go/zap/blob/master/FAQ.md#does-zap-support-log-rotation), they've shown integration with [lumberjack](https://godoc.org/gopkg.in/natefinch/lumberjack.v2), which only supports size based rotation.

I found another library [file-rotatelogs](https://github.com/lestrrat-go/file-rotatelogs) which does support time based rotation. So I used it along with zap.

The good thing about zap is that it takes any `io.Writer` interface as a `WriteSyncer` and `file-rotatelogs` returns `*RotateLogs` which implements the `io.Writer` interface.

Here the `rotatelogs.WithRotationTime(time.Hour))` indicates hourly rotation. `rotatelogs.WithMaxAge(60*24*time.Hour)` indicates the files are cleaned up after 60 days.
```go
package main

import (
	"encoding/json"
	"time"

	rotatelogs "github.com/lestrrat-go/file-rotatelogs"
	"go.uber.org/zap"
	"go.uber.org/zap/zapcore"
)

func main() {
	// initialize the rotator
	logFile := "/var/log/app-%Y-%m-%d-%H.log"
	rotator, err := rotatelogs.New(
		logFile,
		rotatelogs.WithMaxAge(60*24*time.Hour),
		rotatelogs.WithRotationTime(time.Hour))
	if err != nil {
		panic(err)
	}

	// initialize the JSON encoding config
	encoderConfig := map[string]string{
		"levelEncoder": "capital",
		"timeKey":      "date",
		"timeEncoder":  "iso8601",
	}
	data, _ := json.Marshal(encoderConfig)
	var encCfg zapcore.EncoderConfig
	if err := json.Unmarshal(data, &encCfg); err != nil {
		panic(err)
	}

	// add the encoder config and rotator to create a new zap logger
	w := zapcore.AddSync(rotator)
	core := zapcore.NewCore(
		zapcore.NewJSONEncoder(encCfg),
		w,
		zap.InfoLevel)
	logger := zap.New(core)

	logger.Info("Now logging in a rotated file")
}
```
This will create the file `/var/log/app-2020-05-18-15.log`, which is exactly how we wanted it. It will automatically start logging to the next file during the start of the next hour.
New trailer after 6 months of development
Tags: gamedev, game, indie, dev
Published: 2020-05-19 05:47:18

🎞 Watch HD video:
http://youtu.be/8WuEgaJHGM0

🙏🙏🙏 Add to wishlist 🙏🙏🙏
http://store.steampowered.com/app/1213020/PAPER_TANKS
Next game you are eagerly waiting for!
Tags: watercooler, gaming
Published: 2020-05-19 04:07:04

### What is the next game you are eagerly waiting for?
--------------------------------------------------

When I have some time to spare, I usually play some games on my PS4 (🖤no hate for Xbox users). Currently I am playing 'The Spiderman' and so far I am loving it!

I am pretty excited about the 'Ghost of Tsushima'!

{% youtube fxHTk_aQo7o %}

Let me know what game you are waiting for eagerly.

PS: Has anyone watched the Unreal Engine 5 Reveal (PS5), oh man this looks gooooood!

{% youtube qC5KtatMcUw %}
Category: Bitcoin
No 1 BTC to INR Converter | Instant Bitcoin to Indian Rupees
Tags: btctoinr, bitcoin, india
Published: 2020-05-19 03:40:20



Bitcoin is a world popular cryptocurrency. It is a virtual currency. Millions of traders, trade with Bitcoins daily. Among them, there are a considerable amount of bitcoin traders in India as well. Because there was a high population in the country and there are rapidly developing information and communication technology. 

However, more Indians may seek to enter this cryptocurrency market. Following descriptions will be a great support to seekers, beginners and all. Let’s get know about, converting, exchange, rates, transfers bitcoin to Indian rupees (BTC to INR) and other topics related to it.

IS BITCOIN ( BTC TO INR ) BANNED IN INDIA?

By responding to a petition filed by the Internet and Mobile Association of India (IAMAI), the Reserve Bank of India (RBI), Mumbai said, Cryptocurrencies such as bitcoin are not banned in India. But it not accepts as a currency in India yet. So, Indians bank also can’t handle or exchange bitcoin or accounts with bitcoin earnings. RBI is under the supervision of these policies under the policies of RBI.

However, anyone can trade and earn with cryptocurrencies like bitcoin without any other limitation. And, bitcoin trading platforms provide options to Withrow Bitcoins as Indian Rupees. This response to the petition filed by the IAMAI was in 2018. It’s clear to everyone. Cryptocurrency mining such as bitcoin is not prohibited, banned or illegal in India. 

Read More: https://cryptoze.com/bitcoin/btc-to-inr
Angular TestBed considered harmful!
Tags: angular, javascript, unittesting, programming
Published: 2021-04-27 07:10:36

---
title: Angular TestBed considered harmful!
published: true
date: 2020-05-19 03:31:28 UTC
tags: angular,javascript,unittesting,programming
canonical_url: 
---

[![](https://cdn-images-1.medium.com/max/1920/1*zRrWMheynuR0VHmmepHr5A.jpeg)](https://medium.com/@gparlakov/angular-testbed-considered-harmful-3f91f647d1fd?source=rss-8b336464cb11------2)

Why I don’t use Angular TestBed and perhaps you shouldn’t either

[Continue reading on Medium »](https://medium.com/@gparlakov/angular-testbed-considered-harmful-3f91f647d1fd?source=rss-8b336464cb11------2)
Snooze to Save Money
Tags: linux, aws, bash, beginners
Published: 2020-05-19 03:08:07

Cloud instances bill by the hour (or the minute) – and right now you're burning money.   Use `snooze` to auto-shutdown your instances in 45 minutes. 


Add `snooze` to your `~/.bashrc`
```
alias snooze='sudo shutdown -c ;  sudo shutdown -h +45 &'
snooze
```

When you want to extend your session, run `snooze` 
```
Broadcast message from ec2-user@ip-172-31-43-250
	(/dev/pts/1) at 2:50 ...

The system is going down for halt in 45 minutes!
```

### How does this work?
`shutdown -c` cancels the shutdown, and `shutdown -h +45` schedules a shutdown in 45min.  


### How can we automate this?
Stay tuned !
Personal Website Critique
Tags: node, angular, webdev
Published: 2020-05-19 02:41:11

Hello everyone in the Dev.to community. I recently created a personal website to share basic information about myself including the books I am reading. 

I am early into my software career and know that feedback is the best way to improve. If you have a moment to look at the site and/or the two repositories I would appreciate any feedback, improvements, or mistakes. Thank you in advance.

Site: http://devinwagner.tech
Front End Repo: https://github.com/dwagner003/wagner-website-backend
Back End Repo: https://github.com/dwagner003/wagner-website

The site uses Angular and Bootstrap for the front end. Node.js for the back end with Sequelize to communicate to the MySQL database. Authentication is done via Auth0 and allows a logged in user to add, edit, or remove books. Currently I am the only user than can login for this functionality.

I hosted the app with Heroku and set up Kaffeine to ping the repo's every 30 minutes to keep them from going to sleep during the day.
The Price of using AndroidX.
Tags: android
Published: 2020-05-19 01:53:27

Currently, It is recommended by Google to use AndroidX in our project to make it compatible with many Android versions.

> "AndroidX is a major improvement to the original Android Support Library, which is no longer maintained. `androidx` packages fully replace the Support Library by providing feature parity and new libraries." ([link](https://developer.android.com/jetpack/androidx))

Is there a price for that? Let's consider the following points...

### Simple Hello World with 'androidx"
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/uy2bmrtklras1ngtngb6.png)
- APK Size: 1.6 MB;
- AndroidX Size has ~1.5 MB;
- It has >10K methods (remembering in enabling the multi-dex if your app exceeds over 64K methods).

### Simple Hello world without 'androidx'
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/sv07esc6hsnxx4c7r6cl.png)
- APK Size has 102.7 KB.

**Keep in mind:** A dependency always has a price in a project and I think this should be taken into consideration before using it.

Just think about!
Opt-in TransparEvancy
Published: 2020-05-19 01:34:23

# HI EVAN IT'S MIKE

Explaining Opt-in Transparency in our texts would have definitely taken up wayyyyyyyyyyyyy too much space, not because it's complex, but because texts have a way of getting HUGE. Anyway, I figured I'd chuck this together  quickly and just link to it in our text exchange :) 

## mmmm okay so what is it then? 

Opt-in transparency is a technique for managing asynchronous communications so that people can kind-of manage their own level of participation in an internal decision, project, task, or whatever. 

By using certain tools, which you may already be using, you can document the context in which designs and decisions are made. Moreover, if this documentation is made widely accessible within an organisation, people with an interest in the design or decision, can view the contextual information surrounding it. 

tbh, that's really it; however, it's probably worth adding that certain ways of doing opt-in transparency - or certain tools you might use to implement it, allow people to participate more actively, in the process by which the designs and decisions are made, rather than simply understand the context behind them. 

## Hope that helps! If not tho...

Zach Holman wrote a [lil article](https://zachholman.com/posts/opt-in-transparency/) about this in 2015. In this article, Zach mentions that Opt-in transparency was created to allow a company to be "fully open as an organization, but not force that openness upon everyone by default".
Chrome 83 Stable is Shipping Any Moment and It's Bolder Than Ever 🎉
Tags: news, chrome, html, webdev
Published: 2020-05-19 01:15:08

I don't normally get so excited about _the day_ a new browser version comes out, except the prior version of Chrome [broke the ability to bold system fonts on Macs](https://www.coywolf.news/webmaster/chrome-81-breaks-system-fonts-bold/).

When this happened, the DEV team was really busy and we just sort of accepted not bothering any fancy workarounds, and we just waited for the next browser version. Bold temporarily not working all of a sudden is just not a scenario we prep for in our tech plannings. Not all sites use system fonts—we prioritize performance and don't load custom fonts.

Stable is set for [release on May 19th](https://www.chromestatus.com/features/schedule).

There are some other good features shipping in Chrome 83, like [Trusted Types for DOM Manipulation](https://blog.chromium.org/2020/04/chrome-83-beta-cross-site-scripting.html), but fixing bold is definitely what I'm looking forward to the most. 😭

Thank you to the hard working developers behind Chrome, everyone makes mistakes and I hope you all learned a lot in dealing with the issue.

Happy coding ❤️
Bash | How to show the external IP of your server
Tags: bash, linux, IP
Published: 2020-05-19 00:52:38

When I was deploying a new instance on Google Cloud Platform, I often forgot the IP of it. Usually, I have to go back to Google Cloud Console and find it out in the list. 

For a easier management in the future, I wanna let the instance know its IP and write it down in a txt file:

```bash
curl icanhazip.com > /usr/business/extIP
```

Now, each time the instance generate a daily report, it could `cat /usr/business/extIP` and get the IP.

Hope this helps! Cheers! 🍻
Oportunidades? Sim!
Tags: vagas, emprego, carreira, empreendedorismo
Published: 2020-05-19 00:16:30

O assunto do momento é a crise, a #covid19, o #coronaVírus. Frente as incertezas, pessoas estão preocupadas com carreira, emprego. Isso não está errado. Mas, o cenário acelerou processos principalmente na área de TI. Com pessoas dando aulas, cantores fazendo lives, na TV entrevistas, reportagens por vídeo conferencia. Os poderes do governo fazendo reuniões online. E todos falando do "novo normal". Toda essa estrutura foi acelerada e a tecnologia é o carro chefe de tudo isso. A aplicação do governo que distribui é um chatbot e oportunidades.



No meio da crise a Picpay e Itaú estão contratando, assim como outras empresas.

[Link Picpay vagas](https://picpay.gupy.io/)
[Link Itaú vagas](https://trabalheconosco.vagas.com.br/itauunibanco/oportunidades)
[Link outras vagas](https://docs.google.com/spreadsheets/d/1Ga2Ov9U3T6RMguJtxyrLcwskpqqmnUJUOB4b0E1krLw/edit#gid=1712287500)
Dice rolling game using python
Tags: python, games
Published: 2020-05-19 00:02:07

hello , today we will make a simple dice roll game .
first we will import random , and make two new variables :
minimum = 1
maximum = 6
then we will make a third variable called again and assign it to "yes".
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/4h040lavc8oqwuixjbzd.png)
second, we will make a while loop 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/429mxzpx00foru0as54a.png)
in while loop we will print a statement "dice is rolling . . ."
then we will make a variable called x and assign it to :
x = random.randint(minimum,maximum)
and print x 
after that we will change again to no :
again = "no"
and change it again to an input :
again = input("play again y/n\n")
to allow the player to play again .
the final code will be like :
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/9nexrlvz4on8rly9cqp7.png)
thanks for reading.
It's okay to still write REST APIs
Tags: projects, languages, clojure, graphql
Published: 2020-05-19 00:01:38

*Disclaimer:* This is pretty much a message to me. 

The forever-changing Web world impacts directly how we build things, usually in a good way. No more advanced Apache setup, or grasping SQL to be able to store data. Today, almost everything is possible with a simple `cli init` and signing in with a SaaS.

Personally, *I love that.* I always get excited saying to someone *"You can create that with a PWA and Firebase"*, and, in fact, we can. Trade-offs are easier to decide, and I almost can't believe how much is possible with free tier today...

As nice as all of this sounds, in the past year it has put me in tough spots. **It's hard to learn something new when it's so easy/good to do it like everyone is doing**. And that's not about comfort, trust me on that! The *React + Typescript + Firebase + Node.js + GraphQL* combo, for me, has been so great that I always get second thoughts when trying to learn a new technology.

It always goes like this: *"I really want to learn this new language. Let's find out how to create a GraphQL service with it"*. After some googling, I realize that it's hard to accomplish that "simple thing". Sometimes, not even "hard", but way less easy than using Node. Same for frontend: *React Hooks, Apollo, and async/await* have spoiled me into thinking it's not worth learning something like ReasonML because my Typescript environment is so safe and cool that has features not yet implemented in other languages.

*"Why would I still create a REST API?"*, it's what I ask myself after searching for the standards for a new language, like Clojure or F#, and for a long time, it has stopped me. But really, why? Just because it's not what Facebook is using?

Learning new things will never be easy, not always because of what you don't know, but what you already do.

That pet project you have in mind, create it with a toolset you've only heard of and was interested! The extra lines you may have to write might teach you what the easy way has always hidden.