teleren/devto huggingface dataset:
AzureFunBytes Episode 18 - Combos! @JFrog and @Azure with @Dixie3Flatline
Tags: azure, beginners, tutortial, cicd
Published: 2020-10-22 19:05:25

**[JFrog Artifactory](https://jfrog.com/artifactory/jfrog-artifactory-free-trial-on-microsoft-azure/)** is a tool designed to store the binary output of the build process for **use in** distribution and deployment. **Artifactory** provides support for a number of package formats.

This week, [JFrog](https://jfrog.com/) Developer Advocate [Kat Cosgrove](https://twitter.com/Dixie3Flatline) sits down with me to show me how JFrog and Azure work together to deliver a DevOps experience for users.

{% youtube njWms4R0FQw %}

AzureFunBytes! - Byte-sized content with a live Twitch show!

Learn about Azure fundamentals with me!

Live stream is available on Twitch at 2 pm EDT Thursday. You can also find the recordings there as well.

https://twitch.tv/azurefunbytes
https://twitter.com/azurefunbytes

Join me, ask questions, and learn about Azure!

[Microsoft Learn: Azure Fundamentals](https://docs.microsoft.com/en-us/learn/paths/azure-fundamentals/?WT.mc_id=blog-devto-jagord)
[Microsoft Azure: $200 Free Credit](https://azure.microsoft.com/en-us/free/?WT.mc_id=devto-blog-jagord)
Go - Prevent Slack Event API retry call
Tags: go, slack
Published: 2020-10-22 18:55:45

Prevent Slack Event API retry call if the callback returns the error response.

```go
func handler(w http.ResponseWriter, r *http.Request) {
    // Process something...

    // Set "X-Slack-No-Retry: 1" if prevent retry.
    w.Header().Set("X-Slack-No-Retry", "1")

    w.Header().Set("Content-Type", "application/json")
    w.WriteHeader(http.StatusBadRequest)
    w.Write([]byte(""))
}
```

# Reference
https://api.slack.com/events-api#the-events-api__field-guide__error-handling__graceful-retries__turning-retries-off
Prevent phishing attack when open a new webpage from your project code
Tags: phishing, security, html
Published: 2020-10-22 18:51:46

When a link opens a URL in a new tab with `target="_blank"`, it is very simple for the opened page to change the location of the original page because the JavaScript variable window.opener is not null and thus "window.opener.location can be set by the opened page. This exposes the user to very simple phishing attacks.

Imagine a link posted on a comment of a popular web site (say: http://petssocialnetwork.io/) that opens a new tab that changes the URL of the original page to http://petssocialnetwork-pishing.io/. On "http://petssocialnetwork-pishing.io/" you land at a fake login page similar to the one at "http://petssocialnetwork.io/" but controlled by the hacker and asking the user to log in again, pretending that the session just timed-out.

To prevent pages from abusing window.opener, use `rel=noopener` on `<a href=>` to force its value to be null on the opened pages. With this in place, window.opener is null in Chrome 49+, Opera 36+, Firefox 52+, Desktop Safari 10.1+, and iOS Safari 10.3+. For older browsers, use `"noreferrer"`. Cumulatively, `rel="noopener noreferrer"` is the safest way to mitigate this vulnerability.

```
Noncompliant Code Example
<a href="http://dangerouswebsite.com" target="_blank"> <!-- Noncompliant; "window.opener" will be not null on the new tab/window and can be changed by http://dangerouswebsite.com -->

<a href="http://dangerouswebsite.com" target="_blank" rel="noopener"> <!-- Noncompliant; will not prevent the attack on old browsers -->

<a href="{{variable}}" target="_blank" rel="noopener"> <!-- Noncompliant  -->
```

```
Compliant Solution
<a href="http://dangerouswebsite.com" target="_blank" rel="noopener noreferrer"> <!-- Compliant -->
```

Exceptions
No Issue will be raised when href contains a hardcoded relative url as there it has less chances of being vulnerable. An url is considered hardcoded and relative if it doesn't start with http:// or https://, and if it does not contain any of the characters {}$()[]
```
<a href="internal.html" target="_blank" > <!-- Compliant -->
```
See
* https://mathiasbynens.github.io/rel-noopener/
How can Anyone Hire Dedicated WordPress Developers?
Published: 2020-10-22 18:41:44

As Wordpress is a popular platform for building website, several companies and individuals provide professional services. Before you hire a developer, you need to know your requirements for the project and website. Thereafter, you can narrow down a list of potential developers online and specify your requirements. 
If you are hiring a Wordpress developer for the first time, you can visit a freelancing website or a marketplace instead of looking up in the search engines. When you visit the websites or a service marketplace, you can view the real portfolio and the fields in which the developer has offers services before finalizing the deal for your project. Her are a few websites you need to search while looking for potential Wordpress developers.
Codeable
Codeable is one of the most popular marketplaces where you can hire a Wordpress developer. From this place, you can access the services of freelancing developers and covers all kinds of projects involving Wordpress, such as e-commerce stores, bug fixes, ad plugin development.
Freelancer
Freelancer is another outstanding platform from where to hire a Wordpress developer. From this platform, you can find skilled and experienced professionals working on different projects such as web development, marketing, design, and SEO. You can also find numerous Wordpress developers here willing to provide services. 
Fiverr
Fiverr is another place to find<a href="https://www.i-webservices.com/hire-wordpress-developer">Wordpress developers</a> , which focuses on trivial tasks, such as removal of white scree of death, bug fixes, and login issues.
Upwork
If you want to hire freelancers globally, Freelancer is the place to search. All you need is to post the job ad check the proposals that come from various freelancers. You can compare the bids on this site to select the best developer. Once you coordinate, it is easy to talk to the developer via live chat or video call to stay at par with the project.
Toptal
Toptal is one of the best networks where you can search freelancers. However, this site is good for those who are ready to pay high prices. You can discuss your requirements with the team of Toptal before finding the best developer.
You can search in the above-mentioned places and find Wordpress developers to suit the requirements of your project.
Throwback – Virtual World Education: Puzzle Fun
Tags: virtualeducation
Published: 2022-06-02 00:41:41

---
title: Throwback – Virtual World Education: Puzzle Fun
published: true
date: 2020-10-22 18:33:27 UTC
tags: VirtualEducation
canonical_url: 
---

Virtual education via Second Life certainly does provide many advantages.  In this short article I will share with you an educational game I created while living in Seoul, South Korea as an English teacher back in 2004-2009.

While in Seoul, I became fascinated of the ripe Gaming culture, and South Korean’s obsession with English Education.  Second Life seemed to be a natural fit – so I dove right in, and created my own Island called English Village, for educators around the World.  Below is one of the educational tools I programmed for educators in Second Life.  It is now fully open-source.

All the scripts for the game can be found on github here [https://github.com/firecentaur/lsl-scripts](https://github.com/firecentaur/lsl-scripts)

Your avatar in Secondlife can get the game for FREE here: [https://marketplace.secondlife.com/p/Single-Multi-Player-Puzzle-Fun-14-great-for-events/2766235](https://marketplace.secondlife.com/p/Single-Multi-Player-Puzzle-Fun-14-great-for-events/2766235)

<iframe id="_ytid_56943" width="850" height="478" data-origwidth="850" data-origheight="478" data-relstop="1" src="https://www.youtube.com/embed/YvDluOdScAc?enablejsapi=1&amp;autoplay=0&amp;cc_load_policy=0&amp;cc_lang_pref=&amp;iv_load_policy=1&amp;loop=0&amp;modestbranding=1&amp;rel=0&amp;fs=1&amp;playsinline=0&amp;autohide=2&amp;theme=dark&amp;color=red&amp;controls=1&amp;" title="YouTube player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen data-no-lazy="1" data-skipgform_ajax_framebjll=""></iframe>

 



The post [Throwback – Virtual World Education: Puzzle Fun](https://b3dmultitech.com/throwback-virtual-world-game-puzzle-game/) appeared first on [Paul Preibisch](https://b3dmultitech.com).
He refactored He's Dead, Jim while Rome burned
Tags: opensource, python, github, git
Published: 2020-10-22 18:16:32

Refactoring is great. So is optimization. In fact I'd say I enjoy it more than I enjoy actually writing code. It's fun to tear something down and build it back up. What is dead may never die, but rises again, harder and stronger. Though, I am Chris' complete lack of surprise over the ending of that show which will remain nameless.

___

Anyway, now that I've confused my only reader (Hi Humphd) with stupid Game of Thrones references, welcome to this week's OSD600 blogpost.

A little backstory before we begin:  this week we learned about rebasing in git, something that will confuse me for at least the foreseeable future. So here's a picture explaining it:

![enter image description here](https://miro.medium.com/max/1200/1*g48HJkKNsZwNlWEM6Z82ig.jpeg)

Essentially `rebase`, an alternative to merge, packs commits into a single commit for better organization, and merges one branch into another at a new starting point, whereas `merge` simply takes all the changes and merges them into another branch in one commit.

Confused? Me too.

Anyway. The previous week had another student work on our project to implement a feature. Unfortunately for me, that student ([who also will remain nameless](https://plamenvelkovtech.blogspot.com/2020/10/lab-4-more-python-nightmares.html)) also decided to tidy up my code while he was down there (*Down where, where is he exactly?*) This left me in a pickle because now I needed to find additional points to refactor. 

The first thing I wanted to do was add a `__main__` to my program. I didn't want to actually add a main to the script until I was ready to outsource some of the work to different files to make the program even more modular. Given this I jumped on the opportunity and separated the concerns as much as I could.

I split the new main into three separate files: a utility file, a fileio file, and a checker file. Now the project's code is split .

I used [this guide](https://docs.python-guide.org/writing/structure/) a lot, which is also thanks to @humphd as I believe he linked it to us Python users early in the semester. Really helped me learn more about structuring actual applications the Pythonic way rather than in a more scripting manner. [This](https://refactoring.com/catalog/) was exceeding useful too. And interesting. I'll have to bring it up on my next date, surely they'll find it fascinating too. And if not, well, I'll be separating my own concerns... and the bill.

___

Nonetheless, you can see the main commit [here](https://github.com/chrispinkney/He-s-Dead-Jim/commit/4dad0671092496decc1823f1562ea59d5ad07b86). The refactoring process was a lot of fun, and learning about how to use rebasing was interesting too. I broke the code a lot but was always able to fix it with just a few tweaks. The rebase with off without a hitch and fast-forwarded after fixing a slight merge conflict with the main file, which makes sense given how much of it was changed recently. I still need to get a better handle on merge conflicts, but all in due time I suppose.
Daily Challenge #298 - Find the Shortest Word
Tags: challenge
Published: 2020-10-22 18:32:31

---
title: Daily Challenge #298 - Find the Shortest Word
published: true
series: Daily Challenge
description: Given a string of words, return the length of the shortest word.
tags: challenge
//cover_image: https://direct_url_to_image.jpg
---

Given a string of words, return the length of the shortest word in the string.

###Examples
`find_short("bitcoin take over the world maybe who knows perhaps"), 3)`
`find_short("turns out random test cases are easier than writing out basic ones"), 3)`

###Tests
`find_short("let us talk about javascript")`
`find_short("i want to travel the world writing code one day")`
`find_short("Lets all go on holiday somewhere very cold")`

Good luck!

***
_This [challenge](https://www.codewars.com/kata/57cebe1dc6fdc20c57000ac9) comes from A.Partridge on CodeWars. Thank you to [CodeWars](<https://codewars.com/>), who has licensed redistribution of this challenge under the [2-Clause BSD License](<https://opensource.org/licenses/BSD-2-Clause>)!_

_Want to propose a challenge idea for a future post?  Email **yo+challenge@dev.to** with your suggestions!_
Optional Chaining / Force Unwrapping
Tags: todayilearned, swift, ios
Published: 2020-10-22 18:27:15

*Evitar* **Force Unwrapping** (Exclamação !) - Isso deixa o código inseguro, caso esqueça alguma verificação da crash no app

**Optional Chaining** (Interrogação ?) - Se for nil não faz nada, se existir faz (seguro em relação à crash), mas caso seja nil o usuário não recebe nenhuma notificação
2nd Time on Hacktoberfest
Tags: hacktoberfest
Published: 2020-10-22 18:22:17

## What I Learned From Hacktoberfest

In the previous year(2019) October, I learned git and GitHub because of the Hacktoberfest event. This year I also encourage to contribute open-source since this event. #FOSS #OpenSource #Hacktoberfest
The Home Stretch - Building SaaS #63
Tags: python, django, saas
Published: 2020-10-22 18:14:05

{% youtube PtixnbJyxWs %}

In this episode, we return to the homeschool application that I'm building.  I'm in the final stretch of changes that need to happen to make the product minimally viable. We worked on a template, wrote some model methods, and did a bunch of automated testing.

We started by adding students to the context of the students index page.  With the students in the context, we updated the index page to display the list of students.

After the students were available, we had to check their enrolled status in a school year.  That logic doesn't belong in the template so we worked out the changes needed for the view.

I updated the `Enrollment` model to include an `is_student_enrolled` class method.  This change let us set boolean state in the template to decide whether to show an "Enroll" button or not.

We updated the template again to show that button.  After creating the button, I proceeded to create a view called `EnrollmentCreateView` that we can connect to the button URL.  We wrote some tests for the view and ended the stream with an unfinished template for the view.

This article first appeared on [mattlayman.com](https://www.mattlayman.com/building-saas/home-stretch/).
SqlServer, EFCore, JSON 👀
Tags: efcore, sqlserver, json, dotnet
Published: 2020-10-22 18:10:35

Sometimes we have been forced to work with json stored on table columns, it will have happened to you too!.

In this post I want to show you how work with that using **EntityFramework Core** {% github dotnet/efcore no-readme %}

Clearly this is one of many possible ways.

We could talk for a long time about the choice to store JSON into RDBMS is a good or bad choice, but the intent of this post isn't make rant.

Ok, well. First of all take a look to JSON that we want to persist into table column

{% gist https://gist.github.com/binick/7c40dc3dcb74dae0485ebc95bbc4b015 file=metadata.json %}

Our application has a requirement that makes it necessary to query the database with the name of the retailer that has stored in the JSON.

The retailer is the one who has the car we want to rent.
The car is represented by the class

{% gist https://gist.github.com/binick/7c40dc3dcb74dae0485ebc95bbc4b015 file=Car.cs %}

The Car entity has a property `public string NameOfRetailer { get; }` that is computed by the [Computed columns](https://docs.microsoft.com/en-us/ef/core/modeling/generated-properties?tabs=data-annotations#computed-columns) functionality.

{% gist https://gist.github.com/binick/7c40dc3dcb74dae0485ebc95bbc4b015 file=Car.NameOfRetailer.cs %}

With this instruction **efcore** will inflate property with value returned by `JSON_VALUE(Metadata, '$.Retailer.Name')` expression, for more information about `JSON_VALUE` see at [JSON_VALUE](https://docs.microsoft.com/en-us/sql/t-sql/functions/json-value-transact-sql?view=sql-server-ver15)

To make it work, we need to persist the JSON into table column `Metadata`.

We can use the other usefull [Value conversions](https://docs.microsoft.com/en-us/ef/core/modeling/value-conversions) functionality of **efcore**.

{% gist https://gist.github.com/binick/7c40dc3dcb74dae0485ebc95bbc4b015 file=Car.Metadata.cs %} 

{% gist https://gist.github.com/binick/7c40dc3dcb74dae0485ebc95bbc4b015 file=JsonValueConverter.cs %}

Now, after that model configurations we are able to resolve this simple query `var car = await context.Cars.MaterializeAsync(car => car.NameOfRetailer == "Car Auto Orvieto").ConfigureAwait(false);` without materialize the entire dataset on the client. 🚀

If you want to learn more you can find the sample on my github repo [ef-core-json](https://github.com/binick/samples/blob/6b9a4676c4f7f243c73abd59fb6aec592fd9f543/src/ef-core-json)

Happy coding!🐱‍👤
Cheatsheet to React Lifecycle hooks Part-3
Tags: webdev, react, javascript
Published: 2020-10-22 18:08:01

So, here is the final blog of the series, hope you've learned something out it.

Anyway, links to my previous blogs:
- <a href="https://dev.to/lakshyabatman/cheatsheet-to-react-lifecycle-hooks-part-1-597d">Part 1</a>
- <a href="https://dev.to/lakshyabatman/cheatsheet-to-react-lifecycle-hooks-part-2-l1b">Part 2</a>

So, let's end with lifecycle hooks in **functional components** and they're pretty clean and easy to grasp.

To add these lifecycle hooks we'll use `useEffect` from `react` package.

```javascript
import React, {useState, useEffect} from 'react';
```
Now in our functional component, we can use it this way.

```javascript
useEffect(() => {
 console.log("Use effect go brrr!");
});
```
It's pretty easy to understand, that the callback function will be executed when the hook is trigged.
**But when will it be executed?**
In this case, in all events.

**How we can utilise to trigger on specific change ?**

In the previous example, if I add a second argument of array type then the hook will be triggered whenever the element placed in that array is changed and this element can be props, state or anything.

```javascript
useEffect(() => {
 console.log("Use effect go brrr!");
}, [props.a, state.b]);
```
Here, the hook will only be triggered whenever `props.a` and `state.b` updates.

**So, what about when we want the hook to trigger on mounting only**

We can place an empty array in the second argument and this will make sure the hook only runs on mounting.
This tells React that your effect doesn’t depend on any values from props or state, so it never needs to re-run. 

```javascript
useEffect(() => {
 console.log("Use effect go brrr!");
}, []);
```
> Okay! We can do this, don't give up!


**What about cleanup or when the component unmounts**

So, in our effect, we can return a function and it'll run **after** the **first execution of the effect** and **before** every other render cycle.

<img src="https://media.giphy.com/media/swrTFeuOt2v6g/source.gif"></img>

Yeah, **it is what it is**.

But we can utilise it in a lot of ways! Seriously!
In our previous explanation, this return function will be called before `useEffect` method except the first when `useEffect` is called, which means we can use it for cleanup work. ¯\\\_(ツ)\_/¯

**But what about the case when [] is passed in second argument**, which means in this case the return method will be executed when the component unmounts!

<img src="https://media.giphy.com/media/tlGD7PDy1w8fK/source.gif"></img>

So, this is the end! I'm tired now but yeah don't let my hard work fade away. Make sure you read the docs and try things out! <3 
Happy coding!
Convert array to object using reduce()
Tags: javascript, webdev, codenewbie, beginners
Published: 2020-10-22 18:06:59

```js
const list = [
  { label: "javascript", color: "blue" },
  { label: "html", color: "red" },
  { label: "css", color: "green" },
];

const initialValue = {};
const convertToObject = (result, item) => {
  const language = item.label;
  const color = item.color;

  return {
    ...result,
    [language]: color,
  };
};

const palette = list.reduce(convertToObject, initialValue);

console.log(palette); // { javascript: 'blue', html: 'red', css: 'green' }
```

---

**Thanks for reading 💙**  
Follow **@codedrops.tech** for daily posts.  
[Instagram](https://www.instagram.com/codedrops.tech/) ● [Twitter](https://twitter.com/codedrops_tech) ● [Facebook](https://www.facebook.com/codedrops.tech/)

Micro-Learning ● Web Development ● Javascript ● MERN stack ● Javascript  
**[codedrops.tech](https://www.codedrops.tech/)**
What is Elastic Compute Cloud? 
Tags: aws, ccp
Published: 2020-10-22 17:09:26

This week I tackled EC2 (Elastic Compute Cloud) here is what I learned! EC2 is an AWS service that allows businesses to run application programs in the computing environment. The EC2 can serve as a practically unlimited set of virtual machines!

Mainly, EC2 gives the business the capability to:
 - Rent virtual machines
 - Store data on virtual drives  
 - Distribute load across machines 
- Scale the services using an auto-scaling group

An EC2 instance is a virtual server in Amazon’s Elastic Compute Cloud (EC2) for running applications on the Amazon Web Services infrastructure. Network security in an instance is controlled by Security Groups. Security groups control how traffic can move into and out of your EC2 instance. Specifically, they regulate:
 - Access to ports
 - Authorized IP ranges
 - Control of inbound and outbound network

There are a few ways to connect to your EC2 instance. You can SSH into it or use the EC2 Instance Connect provided by AWS. EC2 Instance Connect allows you to connect to your instance within your browser, making it extremely fast and easy to connect. 
There are also a large variety of purchasing options for EC2 instances that allow businesses to choose based on what they need! The options are:
- On demand
- Reserved 
- Spot instances
- Dedicated Hosts

I hope you enjoyed this quick summary on EC2 basics that I learned this week, next week I’ll be getting into EC2 instance storage.