teleren/devto huggingface dataset:
Manipulações em Estruturas Homogêneas - Vetores.
Tags: vetor, iniciante, c, algoritmos
Published: 2020-04-20 07:38:52

---
title: Manipulações em Estruturas Homogêneas - Vetores.
published: true
description: Nesse artigo veremos uma maneira de percorrer um vetor e manipular seu conteúdo.
tags: vetor, iniciante, c, algoritmos
---

Vetores são grandes aliados quando o assunto é armazenamento e tratamento de dados homogêneos. Há varias formas de preencher, armazenar, percorrer e organizar seu conteúdo. 

Veremos a seguir uma forma de extrair informações de vetores.

Como poderíamos após termos lido dois vetores, obter um terceiro vetor com a intersecção deles? 
Exemplo: Dado um vetor A[5] = {7, 2, 4, 6, 8} e um outro vetor B[3] = {8, 12, 2}. Obtermos como saída o vetor C[2] = {2, 8}. 

É simples. Você pode simplesmente escolher um dos vetores e utiliza-lo para comparar com os elementos do outro. E não, não importa qual é o maior, o número de comparações será o mesmo. 
A grande sacada do exercício estará dentro do seu laço de comparação. 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/dmdwk37647xm0ve59ca6.png)

Uma parte do seu programa deve se preocupar em realizar a comparação de um elemento do vetor, com todos os elementos do outro, dessa forma:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/83hpz51ctkv7wzx15yhf.jpg)

Dito isso, devemos observar alguns parâmetros que estarão inseridos no código, mais precisamente, na variável que ficará responsável por essas comparações. 
Uma possibilidade é, quando estiver lendo ambos vetores, criar variáveis que guardem o seu tamanho e que posteriormente no seu código, sirvam de “pontos de parada”.  
Pense da seguinte forma, cada i do vetor A fará N comparações antes de seguir ao elemento seguinte. 
No nosso exemplo, o A[i] será comparado com B[i] até B[i-1], ou seja, percorrerá todo o vetor. A repetição só deve ser encerrada quando o primeiro índice de um vetor for comparado com todos do outro a fim de encontrar uma igualdade. 
Se essa condição for satisfeita, então o vetor é incrementado com o conteúdo. 

No final dessas comparações, o vetor C terá os elementos {2, 8}, como na imagem a seguir:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/pfhfxbm06g7lk3z921uo.png)

E assim chegamos ao resultado esperado! Espero ter ajudado você, até mais!
An interesting Javascript interview question
Tags: javascript
Published: 2020-04-20 00:08:28

Recently, I had been given a mock interview by someone in the industry for a longtime. In this interview, I was posed a question about javascript's **setTimeout** function. I was given a setTimeout function inside of a for loop, as shown here:

```js
for (var i = 0; i < 5; i++) {
  setTimeout(() => {
    console.log(i);
  }, 0);
}

//What is the expected output?
```

Here is MDN's definition of setTimeout: *The setTimeout() method of the WindowOrWorkerGlobalScope mixin (and successor to Window.setTimeout()) sets a timer which executes a function or specified piece of code once the timer expires.*

So we pass in a callback function to be executed after the timer is finished. If you haven't already noticed, the setTimeout function has a delay of **0** milliseconds. Think about the results before looking at the expected output.

```js
for (var i = 0; i < 5; i++) {
  setTimeout(() => {
    console.log(i);
  }, 0);
}

//expected output:
//5
//5
//5
//5
//5
```

Are you surprised?

I sure was!
 
Here's why it didn't print 0,1,2,3,4: setTimeout, while having a timer as a delay, still schedules the callback to run **asynchronously**.This means that even though the timer argument is 0, it still waits for the for loop to finish before invoking each callback. 

So now the question is, why all 5's? Shouldn't it have received the variable in each loop? Because of [closures](https://dev.to/danimal92/javascript-closures-keg) in javascript, the callback function only had access to the **i** variable after the for loop was finished, which was **5**. This is in part due to the **var** in the for loop, which I personally detest. The scope of the variable was **function scoped**.

How do we fix this?

##Solution 1

```js
for (let i = 0; i < 5; i++) {
  setTimeout(() => {
    console.log(i);
  }, 0);
}
//expected output:
//0
//1
//2
//3
//4

``` 

The **let** keyword allows the variable to be **block scoped**.We change the **var** to **let** inside of the for loop in order to create a separate scope in each loop, giving the setTimeout callback function access to each local **i** value in their respective **closure**.

##Solution 2 

```js
let log = (x) => {
  setTimeout(() => {
    console.log(x);
  }, 0);
}
for (var i = 0; i < 5; i++) {
  log(i)
}
//expected output
//0
//1
//2
//3
//4
```

In this solution, we pass the variable into a defined function and immediately invoke it.
How to apply GKE config map changes
Tags: kubernetes, gcp
Published: 2020-04-20 07:35:19

I'm a developer by job title, but recently my tasks have been looming on the edge of being a devops. And my latest adventure involved modifying a GKE config map (setting environment variables). Let me share how I applied the changes to the affected pods.

## Scale your deployment

Once you've saved your changes in the config map, the trick is to scale down your deployment to 0. WARNING: Make sure you're aware of the current replica set count before proceeding.
```bash
kubectl scale deployment service_name --replicas=0
```
A quick `kubectl get pods` will tell you the deployment is currently scaling down and existing pods are being terminated.
```bash
service_name-6bc55776bb-ncpsg           0/1     Terminating   0          9m45s
```
This should at most take a minute. In my case, it took just under 30secs to fully terminate the pod. Once the pod isn't listed anymore, scale it back to your original number (in my case it was 1).
```bash
kubectl scale deployment service_name --replicas=1
```
`kubectl get pods`
```bash
service_name-6bc55776bb-ncpsg           0/1     ContainerCreating   0          9m45s
```
That's it! Any modifications in your config map should now be reflected in the pod. If you know a more efficient way, please don't hesitate to share it!
Fluid range slider using SVG
Tags: dropinks, webdev, svg, rangeslider
Published: 2020-04-20 07:26:59

Here is the fun interaction for the range slider using SVG with gooey effect. 

Check live demo: http://demos.dropinks.com/fluid-slider-svg/
Codepen Demo: https://codepen.io/dropinks/pen/aqEooo

Some more interactions: http://www.dropinks.com/
Twitter: https://twitter.com/dropinksblog
Hello Terraform, Part 1: เตรียมเครื่องมือกันก่อน
Tags: terraform, iac
Published: 2020-04-20 07:25:03

พึ่งได้มีโอกาสแตะ Terrafrom ก็เลยอยากจะมาเขียนบันทึกเอาไว้อ่านทีหลังครับ แต่.. ก็คิดว่าอาจจะพอมีประโยชน์สำหรับผู้ที่สนใจ แต่ก็ไม่รู้ว่าจะเริ่มศึกษายังไงดีเลยเอาเป็นว่ามาแชร์ดีกว่า มาเริ่มกันเลยดีกว่า

ก่อนอื่นในบทความนี้จะใช้งาน Terraform ร่วมกับ Azure นะครับ ซึ่งถ้าจะใช้งานร่วมกับ cloud ตัวอื่นก็อาจจะต้องตรวจสอบข้อมูลของ Cloud ที่จะใช้งานก่อนนะครับ และในบทความนี้จะเป็นการเตรียมความพร้อมของเครื่องก่อนจะใช้งาน Terraform ครับ

เริ่มแรกก็ต้องไปสมัครใช้งาน Azure ก่อน โดยสามารถใช้งานแบบ Free Account หรือจะแบบเสียเงินก็ได้ครับ และสำหรับ Free Account ก็จะได้ $200 จะสามารถใช้งานได้ 30 วัน ส่วน service อื่นๆ สามารถใช้งานได้ 1 ปีครับ สำหรับวิธีการสมัครสามารถหาได้ใน Google ครับ

ขั้นตอนต่อไปก็จะติดตั้ง Terraform โดยใช้ Chocolatey เป็นตัวช่วยครับ โดยเราจะใช้ powershell ในการติดตั้ง โดยจะต้องเปิด powershell ด้วย Administrator และใช้คำสั่ง

```
c:\> Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
```
สำหรับคำสั่งนี้สามารถดูได้จากหน้าเว็บนี้ ในกรณีที่อาจจะมีเปลี่ยนแปลงครับ
https://chocolatey.org/install

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

จากนั้นใช้คำสั่งนี้ เพื่ออัพเดท env ของ powershell หรือปิด powershell แล้วเปิดใหม่ด้วย Administrator ก็ได้
```
c:\> refreshenv
```

หลังจากนั้นก็จะเป็นการติดตั้ง Terraform โดยใช้คำสั่ง
```
c:\> choco install terraform -y
```
หากเครื่องใครติดตั้งแล้วก็อาจจะมีข้อความเหมือนเครื่องผมครับ
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/v0xbntfxrd7yg4onv8oy.png)

ลองใช้คำสั่งนี้เพื่อตรวจสอบ version ของ Terraform
```
c:\> terraform --version
```

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

ลำดับต่อไปก็ IDE ซึ่งเราจะใช้ VS Code ในการเขียนคำสั่ง (สำหรับการติดตั้งขอข้ามนะครับ) และเราจะทำการติดตั้ง extension ชื่อ Terraform ตามลิงค์นี้ https://marketplace.visualstudio.com/items?itemName=mauve.terraform

เท่านี้ก็พร้อมที่จะใช้งาน Terraform เพื่อสร้างระบบบน Azure แล้วครับ
OptiSol Business Solutions gets accolades for Cloud Solutions at the Express IT Awards 2019
Tags: azure, angular, devops, techmodernization
Published: 2020-04-20 06:55:58

OptiSol Business Solutions has been recognized under the Cloud Solutions category for 2019 at the 7th edition of Express IT awards as a runner-up. The award was presented by S.Ramadorai – former Vice Chairman of Tata Consultancy Services at Mumbai. Express India Group (reputed group in the field of journalism that runs Indian Express, Financial Express etc.) has been awarding IT companies under different categories and we feel excited to have been recognized by them for our Cloud based service offerings. OpitSol congratulates other winners like Tata Consultancy Services, Infosys, TechMahindra, etc for the accomplishments in respective categories.

The panelist for this year Express IT award comprised of eminent members with support from PWC. The members of the panel include, V. Mohandas Pai, Chairman, Manipal Global Education; Sharad Sharma, Co-founder iSPIRT Foundation; Siddharth Pai, Founder & Managing Partner, Siana Capital; Professor Sadagopan, Director, IIIT Bangalore; Gopichand Katragadda, Founder and CEO, Myelin Foundry.

On account of the recognition, Prem Kumar Pandi – Director, OptiSol Business Solutions said, “A great recognition for our digital transformation initiatives and adds more responsibility to deliver excellence in the days to come. This recognition is for the Team OptiSol Business Solutions and would not have been possible without the support and dedication of everyone”

About OptiSol: OptiSol Business Solutions, an IT services firm offering Digital solutions for Startups and Enterprises. OptiSol are experts in custom web and mobile application design & development, Cloud solutions, Artificial Intelligence and product implementations. OptiSol – a team of about 200+ employees with development center in India and global offices in US, Ireland, Sweden, Dubai and UK.

The company is recognized as AWS Select Tier Partner, Microsoft Azure partner and Google Cloud Platform (GCP) service provider and assists its clients with cloud-enabled application as part of digital transformation journey to optimize process efficiency and productivity. The company has a team of experts who can provide consultation to leverage and implement services on #cloud-native applications and #techmodernization along with usage of appropriate #DevOps tools and frameworks to automate client’s business operations.

About Express IT Awards: Financial Express has always believed in recognizing excellence and best practices amongst organizations and individuals. It has served as a platform for the exchange of progressive ideas and established itself as business daily embraced by more profound thinkers, leaders and communicators.

Taking the same spirit forward, Financial Express presents another unique initiative from the business publication – Express I.T. Awards. Unique, because it will honor both, companies who are at the cutting edge of technology innovation, and leading professionals across the I.T. industry.
Day 5 of #100DaysOfCode: Dev.to Cover Image Generator
Tags: javascript, codepen, meta, html
Published: 2020-04-20 06:45:41

Tonight I created this cover image generator: 

{% codepen https://codepen.io/audreyfeldroy/pen/rNOMxad %}

It uses JavaScript to draw on an HTML5 canvas.

To change the text:

1. Fork this on CodePen: https://codepen.io/audreyfeldroy/pen/rNOMxad
2. In the JS panel, change the lines with `ctx.fillText` to be the text you want.
3. Break any long lines into two lines, or shrink the fonts.

You'll probably also want to change:

* The colors
* The fonts
* The parameters of the fractal tree

Have fun! I'd love to see what you create, so please share your posts/forks in the comments below.
mirkan1 Twilio x Dev Hackathon submission #TwilioHackathon
Tags: twiliohackathon, node, python, flask
Published: 2020-04-20 06:24:55

---
title: mirkan1 Twilio x Dev Hackathon submission #TwilioHackathon
published: true
description: covid19_sms_info to the Twilio x DEV Hackathon!
tags: twiliohackathon, nodejs, python, flask
---

## What I built
You can get a country's fight against COVID-19; how many confirmed number of cases, recovered patients, deaths, etc. by sending a message: example input
```
    to: +12017628866
    message: "USA" 
```
example output
```
    In Italy confirmed number of cases are 159516.
        Recovered people are more than 35435.
        3260 people are still in critical condition and 20465 deaths
```
And/Or you can get a news article about COVID-19 by sending message: example input
```
    to: +12017628866
    message: "news" 
```
example output
```
    *India coronavirus: World's largest postal service turns lifesaver*
    India has the largest postal service in the world - and now it is stepping in to help deliver lifesaving medicines during a countrywide lockdown aimed at tackling the coronavirus pandemic. The BBC's Ayeshea Perera in Delhi reports. Red postal vans are a familiar sight in India. They make thousands of journeys every day, criss-crossing the ...
    from: YAHOO!,
    published on 13-4-2020
    https://news.yahoo.com/india-coronavirus-worlds-largest-postal-230159614.html
```
#### Category Submission: 
Interesting Integrations: an app that integrates Twilio with at least one other API.

Examples: appointment reminders app that uses a scheduling API, sports alert app that uses sports-stat APIs, location-based app that leverages geo-location APIs


## Demo Link
MESSAGING TO +12017628866 WILL BE AVAILABLE UNTIL THE HECATRON IS OVER, FEEL FREE TO TEST IT
![example input/output](https://github.com/mirkan1/covid19_sms_info/blob/master/example.PNG?raw=true)

## Link to Code
https://github.com/mirkan1/covid19_sms_info

## How I built it (what's the stack? did I run into issues or discover something new along the way?)
I learned how to use multitasking on python, and how to use Flask more efficiently

## Additional Resources/Info 
- twilioAPI (twilio.com)
    for SMS messaging
- rapidAPI (rapidapi.com)
    for information gathering

# I am thinking to develop it more, making a webpage, and adding some good front-end stuff but for now, I wanted to share my progress with you
What Is Gb WhatsApp?
Published: 2020-04-20 06:16:51


At its core, the idea behind it is very simple. This is a customized, enhanced mod of the regular app. It’s actually based on the WhatsApp Plus mod that was discontinued, and it does bring in front some really nice ideas. It’s a good tool for those people that want to make the most out of WhatsApp. Sometimes the feature list and set in the regular version are limited. 
Basically, if you’re looking to enhance some of the security and also gain more control over the WhatsApp experience, this can help you more than you imagine. It’s designed to be convenient and professional, it has all the tools you need, and it’s also very user-friendly. The true focus is on value and quality, while still allowing you to enjoy WhatsApp in a nice and fun way.

<a href="https://gbapkbyte.com/gb-whatsapp/">https://gbapkbyte.com/gb-whatsapp/ </a>
What Does "\K" Mean in Regex?
Tags: regex, bash, grep
Published: 2020-04-20 06:10:18

Since not all regex flavors support [lookarounds](https://www.regular-expressions.info/lookaround.html), Perl introduced the [match reset - `\K`](https://riptutorial.com/regex/topic/1338/match-reset---k) (bolded is mine):

> `\K` resets the starting point of the reported match. **Any previously consumed characters are no longer included in the final match**

To make the explanation short, consider the following simple Regex:

```
a\Kb
```

When "b" is matched, `\K` tells the Regex engine to *pretend* that the match attempt started at this position.

```bash
~$ echo 'hello world' | grep -oP 'hello \K(world)'
world
~$ echo 'hello world' | grep -oP 'hello (world)'
hello world
```
Web First or Mobile First UI Improvement?
Tags: webdev, beginners, css, uiimprovement
Published: 2020-04-20 05:29:34

*When you're asked to improve the UI of an already hosted/build Web Application, We always have this thought of should I go with Mobile First Design Improvement or Web First? What Breakpoints Should I use for better responsiveness?*

*__We'll be looking into it, in this post!__*

*__What I do is that, I always ask for analytics panel's credentials or permission to view the analytics console of the Web Application.__*

## **First:** Let's look into how to look for best possible Breakpoints for the Website?

One way is to go in Analytics Console, go to: **Audience** -> **Technology** -> **Browser & OS**  -> Click on **Screen resolution** Tab.

![alt text](https://github.com/iamawaisakram/Posts-Images/blob/master/Web-First-or-Mobile-First-UI-Improvement/Screenshot%202020-04-19%20at%2011.37.15%20AM.png?raw=true "breakpoints screen")

Here you'll get the screen resolutions of the devices, ordered accordingly to the number of users accessing this Website.
You can prioritise the breakpoint accordingly if you want here.


Second way is to go to this [link](https://www.w3schools.com/browsers/browsers_display.asp)
where you'll see the screen resolution statistics and you can plan accordingly as well.
![alt text](https://github.com/iamawaisakram/Posts-Images/blob/master/Web-First-or-Mobile-First-UI-Improvement/Screenshot%202020-04-20%20at%2010.27.40%20AM.png?raw=true "screen resolutions")


## **Secondly:** How to make a decision between Web First Design improvement and Mobile First Design improvement?

In Analytics Console, go to: **Audience** -> **Mobile** -> **Overview**

![alt text](https://github.com/iamawaisakram/Posts-Images/blob/master/Web-First-or-Mobile-First-UI-Improvement/Screenshot%202020-04-19%20at%2011.37.46%20AM.png?raw=true "First Image")


Here you'll be able to see three rows **Desktop**, **Mobile**, **Tablet**, you can make a decision on the basis of number of users as per device.
List of Cool Open Source DL/ML repos by the Giants
Tags: discuss, opensource, webdev
Published: 2020-04-20 05:25:31

I am trying to curate a list of interesting Github Repos and engineering blogs released by the Tech Giants!

Here, is what I have got so far.

1. Ludwig - Uber 
Ludwig is a toolbox built on top of TensorFlow that allows to train and test deep learning models without the need to write code. - [Read More](http://ludwig.ai)

2. Kraken - Uber 
Kraken is a P2P-powered Docker registry that focuses on scalability and availability. It is designed for Docker image management, replication and distribution in a hybrid cloud environment. With pluggable backend support, Kraken can easily integrate into existing Docker registry setups as the distribution layer. - [Read More](https://github.com/uber/kraken)

More Coming Soon.

### Do you have some interesting Repos, to add to the list?

Criteria:
* ML, DL Projects
* DevOps
* Experimental Repos not included
Deploy a Hugo Website to GitHub Pages
Tags: html, css, tutorial
Published: 2020-04-20 04:39:16

Originally Posted on My [Personal Blog](https://blog.athulcyriac.co/deploy-hugo/)


Due to the quarantine I thought of doing something good and useful for others. So I hacked up a theme for Hugo called [Archie](https://athul.github.io/archie). The design was inspired from https://blog.jse.li and was hacked from the Ezhil theme for Hugo. The main reason why I built it was due to the Hugo-Ink theme built by [knadh](https://github.com/knadh) since I'm totally a fanboy of him. So deploying Archie to GitHub Pages was quite fun and easily manageable. GitHub Actions made it a lot easier since I don't have to rely on any other platforms for deployment.

## Steps to Deploy the Hugo Site
There are a few steps to deploy the Hugo site to GitHub Pages and this is these steps are taken from a [Discussion Thread](https://discourse.gohugo.io/t/deploy-hugo-project-to-github-pages-with-github-actions/20725) in the Hugo Forum   
### Create the SSH Deploy Keys
A question arises here.... Why SSH keys? SSH keys are safe because they are secured with a SHA256 hash. It's also better to use the Deploy key than a GitHub API token as it should be confidential. 

```bash
ssh-keygen -t rsa -b 4096 -C "$(git config user.email)" -f gh-pages -N ""
```
Execute this command and it will generate 2 files:
- `gh-pages.pub` (public key)
- `gh-pages`     (private key)
  
Now we need to add these files to GitHub,for that go to repository setting and click on the Deploy Keys button, add your public key with the Allow write access
![](https://raw.githubusercontent.com/athul/blog/master/content/blog/deploy-hugo/dpl.png)

Next go to the Secrets button and add the Private key(`gh-pages`) as `ACTION_DEPLOY_KEY.`

To copy the public / private keys just run
```bash
cat gh-pages | pbcopy
``` 
and it will copy the private key to the clipboard

### Defining the Workflow
A workflow is a a file which runs your action on the GitHub Environment, the Workflow is a Yaml file and  it contains specific instructions on what to do and how to do it. 

For our purpose we'll be defining a workflow for deploying to GitHub Pages whenever we get a push to the `master` branch. Paste these in the `.github/workflows/gh-pages.yml` file
```yml
name: Github Pages
on:
  push:
    branches:
      - master
jobs:
  deploy:
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true

      - name: Setup Hugo
        uses: peaceiris/actions-hugo@v2
        with:
          hugo-version: '0.67.1'
      - name: Build
        run: hugo --minify
      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        with:
          deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
          publish_dir: ./public
``` 
> Note: Before deploying, just add the url to which you're going to deploy in the baseURL of the `config.toml` file with a trailing `/`

----
### What I learned?
With Archie too 😁,

- Hugo as a SSG
- CSS styling
- Hugo Templating syntax
- Deploying with Deploy Keys in GitHub
- Designing New Hugo Shortcodes