teleren/devto huggingface dataset:
Introduction to Ansible Part 5
Tags: ansible, digitalocean, ubuntu, linux
Published: 2019-09-17 06:28:35

In this last post of the 5 part blog post series I'll give you a quick introduction to the Ansible Facts, some useful tips and a quick overview of the Ansible handlers.

As always for the hands-on part, I'll be using a few @digitalocean droplets!


Part 5:

https://bobbyiliev.com/blog/introduction-to-ansible-part-5

Let me know if you have any questions!
About React code structure
Tags: javascript, react, nextjs
Published: 2019-09-17 07:43:24

Hello,
I started learn Next JS. But there's one thing I don't understand.
There are many types of writing in React. I don't know which one is better to use.

For example;

_____________________________________________

function Test() { return <div>test</div> }
_____________________________________________

export default () => <div>test</div>
_____________________________________________

class Prices extends React.Component { 
 // some code
} 

export default Prices;
_____________________________________________
Making Maps with Markers
Tags: javascript
Published: 2019-09-17 15:51:04

Getting started with Google Maps is a walk in the park if you have the right tools. Firstly, you will need to add the Google Maps Geocoding API to your project. You can obtain an API key here:

https://developers.google.com/maps/documentation/geocoding/get-api-key

Geocoding is the process of converting addresses (like a street address) into geographic coordinates (like latitude and longitude), which you can use to place markers on a map, or position the map. To obtain your desired coordinates, first you will need to create a simple search bar with an event listener. You'll want the event listener to fire off a function similar to the following:

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/knkhqy13u2oul7pdqcon.png)

Here, we are taking the string of what the user entered into the search bar and replacing any spaces that would exist between words with plus signs. This is done to format the search term in a way that will allow you to interpolate it directly into the url. With a bit if digging, you can extract latitude longitude coordinates out of the json object that this API call will result in.

Well, great! What's next, you might ask? To render the map itself, we can use the initial results from out search to center the map around our first lat-lng coordinates. Firstly, we will have to create the div tag where our map will live.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/dac2ne6hdny0m2la0mnd.png)

We add the ID "map" here so that we can target this div to populate it with our map, as such:

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/dyaa3jux413hbtfwovli.png)

Here, we create the new map centered on the lat-lng coordinates we received from our prior search, set at a default zoom of 9. If we were to center our map on Seattle, WA, we would expect to see a result that looked like this:

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/oh984od3g31msmkodu4s.png)

From this point, it's a small step to populating your map with markers. Utilizing our prior search method, we can obtain a set of geocoded coordinates and store them into an array. We can pass this array of markers into the function below to populate our map with markers.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/glo39j22knicqiid9pob.png)

This function is doing a few things. Firstly, we iterate through our markers array to create a marker at each geo coordinate saved under the 'position' property. We also designate the map to which we are adding the markers. For a bit of added flair, you can set custom animations, titles, and images to your markers. In this case, each of my markers will look like a camping tent and will drop from the top of the map when populated. The name of the location will also appear as a tool tip on the map if you hover over it with your mouse.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/3f08tocfe5xbpz34sg6a.png)

And there you have it! Using these methods, you can start venturing into creating maps to polish up any application that could make use of them.
Code Story E7: Jonathan Campos on Determining Priorities
Tags: codestory, podcast
Published: 2019-09-18 19:10:42

{% youtube VIKWAs2VEus %}

After getting his masters, Jonathan Campos found himself working with clients, listening to their pain points, and creating software to meet those needs. He worked his way through a handful of startups and agencies, before landing at Bottle Rocket as the chief architect, growing their web and backend practice. Not too long after, a former boss reached out about an opportunity to up-level the ride-sharing experience, focusing on simple billing, safety, and control over the experience. This opportunity was to become the CTO of Alto.

In the clip above, Jonathan Campos discusses how he and his team at Alto determine what to prioritize. If you like what you hear, check out the full episode below.

{% podcast https://dev.to/codestorypodcast/e7-jonathan-campos-alto %}
Programming Parody Songs that Need to be Written
Tags: music, goof, programming, parody
Published: 2019-09-17 18:06:31

If there's anything I like, it's a good parody. There's just something about the deconstructive nature of a parody that appeals to me for some reason. Maybe, it's for the satirical nature of some parodies that use humour to get across points that would be difficult to communicate otherwise. Perhaps it's because it can be hilarious to hear a familiar song with different words, or a familiar movie scene with a twist. Then again, I think part of the fun of a parody is being able to blend worlds, to communicate concepts in ways traditionally thought impossible.

To that end, I like listening to parody songs. There are a number of Weird Al's gems that have found their way to my playlist, and try as I might I can't seem to get "Revenge" by Captain Sparkles out of my head - not that that's necessarily a bad thing...

{%youtube cPJUBQd-PNM %}

Anyway, I especially enjoy parody songs that involve programming, computer science, and the concept of software development. It's a weird niche, I know, but I've found myself in it.

Some of my favourite parodies along this line are from [Dylan Beattie](https://www.youtube.com/channel/UCjJjavV8vOmu49a3vxPaWtQ), the underrated producer of such bangers as "We're Gonna Build a Framework" and "DMCA."

{%youtube mQnF1BBBtXs %}

SUSE's official YouTube channel has a [parody playlist](https://www.youtube.com/watch?v=SYRlTISvjww&list=PL6sYHytyKN2-X93TurF3JptW8qSVm0DzA) that includes tunes like "Uptime Funk," "Code Together," and "Can't Stop the SUSE."

{%youtube SYRlTISvjww %}

I also like Java's parodies/original songs as well.
{% youtube b-Cr0EWwaTk %}

Introduction aside, here are my picks for parodies that need to be covered next. Feel free to take these ideas and run with them, as well as commenting below with your own ideas.

#### What I like about Vue (A parody of "What I like about You" by the Romantics)
#### Old Repo (A parody of "Old Town Road" by Lil Nas X)
#### Deprecated (A parody of "Complicated" by Avril Lavigne)
#### .NET Gonna Give it to Ya (A parody of "X Gonna Give it to Ya" by DMX)
#### We're Coding (A parody of "Jammin'" by Bob Marley)
#### The JavaScript I Used to Know (A parody of "Somebody that I Used to Know" by Gotye)

Happy parodying!
How would you teach a CompSci class?
Tags: discuss, advice, swift
Published: 2019-09-17 18:39:27

---
title: How would you teach a CompSci class?
published: true
description: 
tags: discuss, advice, swift
---
I'm teaching an adult/continuing education class on Swift using the Pearson Certification course, and I'm in a jam - it's designed to be a ~46 hour certification, but we only have 14 hours of class time. I'm not sure of people's level coming in, but I do recognize that we're short on time. Given that, I have some questions that I think you folks would be well equipped to help me out with:

- What are some things that you wish you had learned as a beginning programmer? 
- What teaching style do you think is the best way to learn?
- Do you think having students pair program would be beneficial?

I'd love to know the thoughts of the masses! Any nugget of guidance would help me out :)
Azure Cloud Shell | PowerShell Core | Microsoft Docs 📚
Tags: azure, powershellcore, azurecloudshell
Published: 2019-09-23 03:05:34

#Utilizando o Azure Cloud Shell direto do Microsoft Docs.

E ae, beleza, pessoal? Trazendo hoje uma ótima forma de utilizar o **Azure Resource Manager** (Através do módulo PowerShell Az), pra quem quer aprender a utilizar o módulo, ou aquele dia que a memória não nos ajuda 😅. É possível iniciar uma sessão do Azure Cloud Shell diretamente da documentação oficial do módulo, de forma rápida e descomplicada. 

Para essa demo preciso de uma conta no Azure, você pode [iniciar gratuitamente](https://azure.microsoft.com/pt-br/free/) e uma conta de armazenamento [Storage Account](https://docs.microsoft.com/en-us/azure/storage/common/storage-account-overview). O **Azure Cloud Shell** é uma estação pré-configurada com algumas ferramentas,az cli, termux, vim, nano, kubectl, etc. Através dessa estação consigo gerenciar meus recursos através do portal ou aplicativo* utilizando linha de comando para isso.

Agora vamos acessar o [Microsoft Docs](https://docs.microsoft.com/en-us/powershell/module/?term=Az.), no Module Browser consigo listar os módulos Az.* disponíveis e as descrições. 

Como exemplo vou utilizar o módulo Az.Accounts.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/ujvoqiwbaqgfxdo7mgm7.png)

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/lyg4ewh66jk17tcyfnvg.png)

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/0sty1ahh98j0d5x9qnlm.png)

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/1q3o1ip8fo5apn1gjoi7.png)

Vale lembrar que o que for executado no Azure Cloud Shell, será provisionado no Azure, ou seja, se for um comando de exclusão/alteração e não nos atentarmos ao Contexto podemos afetar aplicações em produção. 


![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/4yf3czfvr1hpn3ktbaa4.png)

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/tiss72kahlmiqri76mxj.png)



É isso, pessoal. Essa é uma demonstração de como é fácil utilizar o Azure Cloud Shell e módulo PowerShell Az.*, direto do Microsoft Docs.



*O post do meu amigo fala sobre como utilizar o Azure Cloud Shell em um celular [Renato Groffe](https://medium.com/@renato.groffe/microsoft-azure-app-gerenciando-do-seu-celular-recursos-na-nuvem-32b5494eaa58) nesse artigo ele demonstra como realizar o deploy de um cluster kubernetes diretamente do aplicativo do Azure.



**(☞ﾟヮﾟ)☞ Não se esqueça, PS é vida ☜(ﾟヮﾟ☜)**
Bootstrap Vertical, Horizontal, and Inline Form
Tags: bootstrap, form, layout, html
Published: 2019-09-18 06:48:35

Bootstrap form layout vertical form, horizontal form, and inline form will be discussed in this article. Forms are an essential part of almost every website to collect user input data. In <a href="https://speedysense.com/bootstrap-vertical-horizontal-inline-forms-example/">this article</a>, we will learn how to create a form using the Bootstrap CSS framework. We are cover both Bootstrap 3 and bootstrap 4 forms layout.

<b>Bootstrap 4 Form Layouts</b>
Bootstrap provides two types of form layouts. Moreover, you can create a horizontal layout using Bootstrap 4 helper class:

1. <a href="https://speedysense.com/bootstrap-vertical-horizontal-inline-forms-example/#bt4_stacked_form">Stacked form (full-width form)</a> - Use form-group class in wrapper element and each form elements add .form-control class to create stacked structure.
2. <a href="https://speedysense.com/bootstrap-vertical-horizontal-inline-forms-example/#bt4_inline_form">Inline form</a> - To create inline form add form-inline class to the <form> element. Moreover, all form elements are left-aligned with screen view-ports at least 576px wide. Below 576px screen, it will be stacked automatically.
3. <a href="https://speedysense.com/bootstrap-vertical-horizontal-inline-forms-example/#bt4_horizontal_form">Horizontal Custom Form</a> - All labels and form controls use col-md-* to make a two-column horizontal layout. And it will wrap between between form-group and row class &lt;div&gt; container. All labels and input fields are left-aligned in single row.

<b>Bootstrap 3 Form Layouts</b>
Bootstrap provides three types of form layouts:

1. <a href="https://speedysense.com/bootstrap-vertical-horizontal-inline-forms-example/#bt3_vertical_form">Vertical form</a> (this is the default) - This is the default Bootstrap form layout in which all input fields and labels are vertically aligned. There is no need any extra Bootstrap class applied on form and their child elements. Let’s create a simple Vertical form layout.
2. <a href="https://speedysense.com/bootstrap-vertical-horizontal-inline-forms-example/#bt3_horizontal_form">Horizontal form</a> - To create a horizontal form, all labels and input fields are left-aligned in a single row. Only you need to add a form-horizontal class in &lt;form&gt; element. And all labels and form controls use col-md-* to make a two-column horizontal layout. Quickly check the horizontal form layout.
3. <a href="https://speedysense.com/bootstrap-vertical-horizontal-inline-forms-example/#bt3_inline_form">Inline form</a> - All form elements are left-aligned with screen view-ports at least 768px wide to applies. You need to add additional class form-inline to the &lt;form&gt; element. Let’s see the Bootstrap 3 inline form layout.

<b>Notes:</b>
1. Bootstrap control-label and form-control classes are used to style the labels and form elements respectively.
2. To control the textbox sizes you can use input-lg and input-sm classes.
Rewind Files Before Reading
Tags: rails, ruby
Published: 2019-09-18 20:50:32

Suppose you have a form with a file input and you need to forward that file to an external service through your Rails app. Params will look like this:
```ruby
{ "file"=> #<ActionDispatch::Http::UploadedFile:0x00007fce9a8af140 @tempfile=#<Tempfile:/path/to/the/file.xlsx>, ... > }
```
The external service can not be reached for the first time sometimes, so you decided to set some retry count.
```ruby
retry_count = 5
while retry_count > 0
    begin
        HTTPClient.new.post(url, params, headers)
    rescue ExternalServiceUnavailable => e
        retry_count -= 1
    end
end
```
The code above uses HTTPClient gem for making http requests and it will raise the following error in case there will be at least one retry:
`ArgumentError: Illegal size value: #size returns 154139 but cannot read`
The thing is that `HTTPClient` uses `IO#read` to read the file by chunks for making POST request. The `lineno` pointer reaches the end of the file after `read`, and you can not read bytes from the I/O stream anymore:
```ruby
params['file'].tempfile.eof? # => true
```
To fix that, use `IO#rewind` – it positions `IO` to the beginning of input, resetting `lineno` to zero. Just add checking the file for `eof` before each request and `rewind` it if needed:
```ruby
retry_count = 5
while retry_count > 0
    begin
        params['file'].tempfile.rewind if params['file'].tempfile.eof? # check eof
        HTTPClient.new.post(url, params, headers)
    rescue ExternalServiceUnavailable => e
        retry_count -= 1
    end
end
```
Pushing Left, Like a Boss - Part 6: Threat Modelling
Tags: applicationsecurity, tutorial, beginners, appsec
Published: 2019-09-19 18:19:20

---
title: Pushing Left, Like a Boss - Part 6: Threat Modelling
published: true
description: This article delves into the basics of threat modelling, also known as evil brainstorming.
series: Pushing Left Like a Boss
tags: applicationsecurity, tutorial, beginners, appsec
---
###This series, and my blog, have moved! [Check it out](https://wehackpurple.com/g8tg)!
---
The last security-related part of the Design Phase of the System Development Life Cycle (SDLC) is threat modelling, affectionately known as “evil brainstorming”.

![Threat modelling happens during the design phase of the system development lifecycle.](https://thepracticaldev.s3.amazonaws.com/i/yn34jhp0ctdoy6r1sqj6.png "Threat modelling happens during the design phase of the system development lifecycle.")

The purpose of threat modelling is to discuss the possible threats to your system, then to do your best to mitigate them, and if not, to manage or accept the risks. There are multiple formalized methods for doing this, which I will not discuss here, each one already has its’ own book, advocate or dedicated blog, likely doing a better job detailing it than I ever could. In fact, Microsoft (my employer) [basically invented threat modelling](https://docs.microsoft.com/en-ca/azure/security/develop/threat-modeling-tool?WT.mc_id=devto-blog-tajanca), and you can read much more about it [here](https://docs.microsoft.com/en-ca/azure/security/develop/threat-modeling-tool?WT.mc_id=devto-blog-tajanca).

That said, dear reader, I want you to understand why threat modelling is important, who needs to do it, as well as when and how you can start.

###[Read the rest on my NEW blog!](https://wehackpurple.com/xfxk)!
Features of cursor setting to input
Tags: javascript, html, webdev
Published: 2019-09-20 08:49:23

Hello every one 👋🙋‍♂️

I would to share some experience about different behavior position cursor of input when use function focus().

* if value for input element is set across attribute, then when function focus() is called then cursor will set in start.

* if value for input element is set across property of value, then when function focus() is called then cursor will set in end of input.

![example different of behavior cursor of input](https://thepracticaldev.s3.amazonaws.com/i/zux8bzge38tlxxbcqsm8.gif)


here you could try this example https://jsfiddle.net/g1nfcv98/
Running app on iOS13/13.1.1 Device from XCODE 10.2
Tags: ios, xcode, swift
Published: 2019-09-21 11:43:31

iOS 13 is here along with XCODE 11. *Hurrah!!!!!!*
![](https://media.giphy.com/media/11sBLVxNs7v6WA/giphy.gif)
With exciting dark theme on iOS and got full blown [SwiftUI](https://developer.apple.com/documentation/swiftui) within hand, I just pumped up and went to get Xcode 11. But wait!! You need macOS Catalina(10.15) and it's on beta. I don't want to make my hand down to beta version. So I just retain myself from that and went back to my old Xcode 10.2.
When I plug my device and build one of my current project, Xcode starts screaming with "Could not locate device support files".
![](https://i.imgur.com/Vt1KsQB.png)
*Hmmm, bummer.* Now should I download [Xcode 11 GM seed 2] (https://developer.apple.com/download/)? It's nearly 7.1GB and it will take hours to download with my slow internet. So I start looking for any solution on [SO](https://stackoverflow.com) and found one to run app into my iOS 13 device with Xcode 10.2.

  * Download DeviceSupport file for 13.0 from [this repo](https://github.com/iGhibli/iOS-DeviceSupport/blob/master/DeviceSupport/13.0.zip).

  * Download DeviceSupport file for 13.1/13.1.1 from [this repo](https://github.com/filsv/iPhoneOSDeviceSupport/blob/master/13.1%20(17A5821e).zip).

  * Unzip and rename the folder with `13.0 (17A5508m)` (`13.1` for `13.1`/`13.1.1`).

  * Go to DeviceSupport folder of Xcode 
(open finder -> press cmd+shift+G -> `/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport`)

  * Paste `13.0 (17A5508m)` folder there.

  * Restart Xcode.

Now run your project and *Voilà!!* it's running on your iOS 13 device. 
![Yey](https://media.giphy.com/media/6s1hcLp1VQzTSRu7Jl/giphy.gif)
Show me your Bash Functions / Aliases!
Tags: linux, bash, showdev, discuss
Published: 2019-09-21 23:19:11

Do any of you have your favorite bash functions or aliases?  I've always been a fan of quick "lightning tips" that you can show maybe on one line, and do something specific.  

Here are some of mine!

```bash

## timestamp dmesg with the current date, this sudo doesnt require password
alias datemsg='date | sudo tee /dev/kmsg'

## how many ms since the epoch?
alias epocms='date +%s%3N'

## ksm is kernel same-page merging for virtual machines,
## this allows me to keep tabs on performance and metrics
alias ksm-info='~/opt/ksm-info.sh'

( ksm-info is just a one-liner ...
for ki in /sys/kernel/mm/ksm/* ; do echo -n "$ki: " ; cat $ki ; done
...)

## normal mutt is gmail, mm == local mail
alias mm='mutt -f ~/Mail/fredr'

## python pretends to be jq sometimes
alias pj='python -m json.tool'

## run a lot of ansible playbooks ... plans == play ansible
alias plans='ansible-playbook'

### .bashrc functions

## check on kernel entropy for ssh, vpn, encryption
entropy () { cat /proc/sys/kernel/random/entropy_avail; }

## pipe colorfied jq to less while keeping colors
jql () { jq -C . $1 | less -R ; }
```

Many other minor stuff too, like loading environment vars for Go or BC.
So what are some of yours?
EP24: Special Developer Conference Zambia 19' Episode
Published: 2020-01-20 13:56:48

---
title: EP24: Special Developer Conference Zambia 19' Episode
published: true
tags: 
canonical_url: https://anchor.fm/code-cast-zm/episodes/EP24-Special-Developer-Conference-Zambia-19-Episode-e5g6a0
---

On this episode, we interview speakers from this years [Developer Conference Zambia](https://www.devcon.co.zm/).

DevConZM is an annual platform elected by Agora Code Community and  collective members of the technology community in Zambia. It is  specifically crafted with Software Developers and Tech Enthusiasts in  mind. Its aim is first of all, to raise the quality of the craft,  secondly, to raise awareness of the industry which is still in its  infancy in Zambia. We believe that providing a platform for developers  to level up is key to a progressive approach to building products and  communities.

DevConZM brings exposure that will prove useful to  innovation in various industrial sectors leading to direct economic  value addition. Apart from the technical opportunities available, Devcon  will also give developers access to networking and investment  opportunities which is critical to growth.

Leave us a review on[iTunes](https://podcasts.apple.com/us/podcast/codecast-zambia/id1442693166?mt=2) to let us know what you think about the show.

Also, join our growing community on [Slack](https://join.slack.com/t/codecastzm/shared_invite/enQtNzA4NjczOTQ4MTkyLTE4NDVhMTQ4NTYxMGMyZTQzYTYxMDI4ZDJkZWUwYjZmNTI1NmQ2NzJiMzdkMDVlNGRhYzdiZWM5ZjgwNGMwYmE)for in depth conversations regarding community and other topics on the podcast.

**Hosts/Guests**

Rahul Sharma- [Twitter](https://twitter.com/RahulSh13)

Dennis Mubamba- [Twitter](https://twitter.com/Iambigd50)

Mwaaba Mugala- [Twitter](https://twitter.com/EpicCredos)

Gilbert Mwale - [LinkedIn](https://www.linkedin.com/in/gilbert-mwale-5615a252/)

Ngosa Chungu- [Twitter](https://twitter.com/whoops_c)

Daniel Phiri- [Twitter](https://twitter.com/malgamves)

Elias Phiri- [Twitter](https://twitter.com/Jor_Eli360)

Mukuma Musenge - [Twitter](https://twitter.com/sour_bones)

--- Send in a voice message: https://anchor.fm/code-cast-zm/message