teleren/devto huggingface dataset:
100 Days of SwiftUI — Day 14
Tags: 100daysofswiftui
Published: 2020-06-04 21:13:43

---
title: 100 Days of SwiftUI — Day 14
published: true
date: 2020-06-04 21:13:18 UTC
tags: 100daysofswiftui
canonical_url: https://zeitschlag.net/100-days-of-swiftui-day-14/
---

I skipped yesterday's part of 100 Days of SwiftUI, as I had a very stressful day at work and afterwards, it was pretty late and there wasn't much energy left.

So, today was my [14th day](https://www.hackingwithswift.com/100/swiftui/14). It was the second review day of the basics. Again, I didn't learn very much, but I really like how Paul explained the main differences between structs and classes:

- No automatically generated memberwise initializers, but DIY ones are required instead
- inheritance
- reference type instead of value type.

Oh, and then there was this `@objcMembers`-attributes. I didn't hear of it before, but it might come in handy, when it comes to Objective C-y legacy code. At least, [in some cases, sometimes](https://stackoverflow.com/questions/50084765/objc-redundancy-when-having-objcmembers-private-dynamic-var).

One important thing's still missing in the review-part: Closures. I guess, that'll be part of Day 15, then.

<!--kg-card-end: markdown-->
WSL+UBUNTU
Tags: wsl, ubuntu
Published: 2020-06-04 20:58:35

\#WSL+UBUNTU

## Enable Virtual Machine Platform

```cmd
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
```

## Enable Windows Subsystem Linux

```cmd
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
```

## Update Windows Subsystem Linux

```cmd
Invoke-WebRequest -Uri https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi -OutFile WSLUpdate.msi -UseBasicParsing
```

```cmd
msiexec.exe /package WSLUpdate.msi /quiet
```

## Set Default Version

```cmd
wsl --set-default-version 2
```

## Download And Import Ubuntu 20.04

### Create Folder For ROOTFS

```cmd
mkdir -p $env:userprofile/Ubuntu/Focal/Ubuntu-20.04
```

### Download ROOTFS Image For WSL

```cmd
Invoke-WebRequest -Uri https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64-wsl.rootfs.tar.gz -OutFile $env:userprofile/Ubuntu/Focal/Ubuntu-20.04.tar.gz -UseBasicParsing
```

### Import ROOTFS Image For WSL

```cmd
wsl --import Ubuntu-20.04 $env:userprofile/Ubuntu/Focal/Ubuntu-20.04 $env:userprofile/Ubuntu/Focal/Ubuntu-20.04.tar.gz
```

### List Distributions

```cmd
wsl --list --all
```

### Set Default Distribution

```cmd
wsl --setdefault Ubuntu-20.04
```

### List All Distributions And Version

```cmd
wsl --list --all
```

### Run Distribution

```cmd
wsl --distribution Ubuntu-20.04
```

OR

```cmd
wsl
```

Sources:
<https://docs.microsoft.com/pt-br/windows/wsl/install-win10>
<https://docs.microsoft.com/en-us/windows/wsl/install-manual>
<https://wiki.ubuntu.com/WSL>
How to generate a debug apk in react-native
Tags: reactnative, android, apk, build
Published: 2020-06-04 20:17:48

#### What is an .apk file?
An Android Package Kit (APK) is the package file format used by the Android OS for distribution and installation of mobile apps. It is similar to the .exe file you have on Windows OS, a .apk file is for android.

#### What can I use it for?
A debug .apk file will allow you to install and test your app before publishing to app stores. Mind you, this is not yet ready for publishing, and there are quite a few things you'll need to do to before you can publish. Nevertheless, it'll be useful for initial distribution and testing.

You'll need to enable debugging options on your phone to run this apk.

#### Prerequisite:
- react-native version > 0.57

#### How to generate one in 3 steps?
*Step 1:* Go to the root of the project in the terminal and run the below command:  
```react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res```

*Step 2:* Go to android directory:  
``` cd android```

*Step 3:* Now in this `android` folder, run this command  
```./gradlew assembleDebug```

There! you'll find the apk file in the following path: 
 `yourProject/android/app/build/outputs/apk/debug/app-debug.apk`

**Now you have your .apk file generated, install it on your android phone and enjoy!**

**Thank you.**
Launched my Yotube Channel
Tags: tutorial, showdev, video, nocode
Published: 2020-06-04 20:16:06

Three weeks ago I launched my first Youtube channel called Make Something which shows nocode tutorials weekly which you can do in less than an hour.

I’m not a coder, I’m not a designer, and I have never done either for a living. I've taught myself how to code and realized that you don't need to learn how to code to make things. Personally, I am at my stage of transition where I want to do my own thing next, but haven’t found the right idea or the co-founders. That’s why I decided – instead of just sitting around, and waiting for things to happen this year, I want to commit to becoming really good at making stuff.

It's been unnerving to see myself on video and took a hard time to hit publish :) Also I write a lot, somehow video is more difficult. I have a new appreciation for people who post video content.

All and any feedback is more than welcome. Also please subscribe if you like the content to be notified of new ones, that would mean the world to me. Anything you want to help automate/cover just let me know. Thanks for watching!
Ruby vs Elixir
Tags: ruby, healthydebate, elixir
Published: 2020-06-04 20:08:24

Ruby and Elixir are clearly very different _languages_, but they share a lot of community dynamics and principles.

Let's compare and contrast the details of each language and the contexts surrounding each.

I also want to take this moment to plug our latest DevDiscuss podcast episode, which was a really fun conversation diving into Ruby's place in the world.

{% podcast devdiscuss/s1-e4-should-ruby-still-be-a-thing-in-2020 %}
Elementor Theme and Library KILLING my load time. HELP!
Published: 2020-06-04 20:06:46

Hey there everyone! I am working on a site that uses Wordpress + Elementor, and when I run page speed audits, I get a mountain of default files that are blocking load!
```
.../block-library/style.min.css... 
.../hello-elementor/theme.min.css...
.../hello-elementor/style.min.css...
...css/elementor-icons.min.css...
...animations/elementor-animations.min.css...
```
How can I get rid of this mountain of blocking code? Optimization plugins that promise to defer/inline don't seem to actually do anything and I can't get my speed up. 

Any suggestions?
Javascript(ES6) Arrow Functions in a simple way:
Tags: javascript
Published: 2020-06-04 16:29:11

Before digging into the code, we will start with the pros and cons of arrow functions.
## Pros:
- Keeping track of this keyword without using `bind` method
- Making code concise
- Shorter Presentation: what We mean by it is the fact that the Presentation of the code is shorter in volume, and for readability, it's a fantastic add-on to javascript.

## Cons:
- Confusing Rules and Syntax
- Make code difficult to read
Let's talk about the choice of const over let in the definition of a variable or function. Why? The simple reason is that with `const` we keep the value of the function untouchable.
We will begin the discussion with the first example by creating an anonymous function(which has no name) in the old javascript syntax:
```js
const sayHello = function(firstName,lastName){
return "Hello, " + firstName + " " + lastName }
console.log(sayHello("HoussameEddine","WARDI")) //Hello, HoussameEddine WARDI
```
Now, let's talk about Arrow Functions ES6 syntax with this example:
- The first rule when we work with arrow functions, we remove the `function` keyword.
- The second rule, we add the fat arrow symbol `=>` between the function arguments and the body.
- The third rule, if we have one line only in the body we can remove the curly braces and the "return" keyword.
So, the final result will be as this:
```js
const sayHello = (firstName,lastName) => "Hello, " +firstName+ " " +lastName
```
It gives us the same result, but you guessed that the code was concise and short.
Example 2:
```js
const getStudentInfos = () => ({ age : 28,
fullName: "WARDI HoussameEddine"
})
```
We wanted in this example to return an object in the **ES6 syntax** , so, we conclude that we must add parentheses to the returned object as we saw in the last example.
## Conclusion:
We saw in this article a great extent to javascript(ES6) that is Arrow functions and its pros and cons also;
some real examples of this new feature.
Thanks for reading the article, and if you have any questions related to the subject, LEAVE A COMMENT!
swapp - A CLI for managing App Settings in Azure Static Web Apps
Tags: javascript, webdev, frontend, html
Published: 2020-06-05 16:22:40

---
title: swapp - A CLI for managing App Settings in Azure Static Web Apps
published: true
date: 2020-06-04 19:10:06 UTC
tags: javascript,webdev,frontend,html
canonical_url: https://burkeholland.github.io/posts/swapp/
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/98vm5yrmopm4slgel1ov.png
---

“swapp” is a command line utility (CLI) for managing Application Settings in Azure Static Web Apps.

Application settings are settings that are stored in Azure and can be consumed by Static Web App API’s via the `process.env` variable. This is ideal for sensitive information like database connection strings, application keys, ect. Currently, these application settings have to be managed from the Azure Portal or with a rather cryptic Azure CLI REST command. Swapp abstracts this REST command into a simple command line interface.

Swapp only does two things - upload your application settings and list your application settings.

## Batch upload of app settings

Swapp assumes that you have a `local.settings.json` file in the directory where you run the “swapp” command. To upload all of your application settings in one go, run `npx swapp upload` from the same directory where your `local.settings.json` file is. You will need to select your subscription, enter your resource group and application name. Then swapp will do it’s thing…

{% youtube BXYpXNSN5rI %}

## Listing app settings

Sometimes you just wanna know what app settings your app currently has in Azure. Perhaps you just want to check and make sure the app settings you just uploaded are actually there. To do that, run `npx swapp list`. This command can be run from any directory.

{% youtube KoH67703CrY %} 

For more information on app settings in Azure Static Web Apps, see [this article](https://docs.microsoft.com/azure/static-web-apps/application-settings?WT.mc_id=staticwebapps-personal-buhollan). Also, the [VS Code extension for Static Web Apps](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurestaticwebapps&WT.mc_id=staticwebapps-personal-buhollan) will upload your app setttings automatically as well.
Genetic algorithms for brute forcing
Tags: cpp, security, bash
Published: 2020-06-04 19:04:04

---
title: Genetic algorithms for brute forcing
published: true
description: Using C++ for creating brute forcing pass lists using a genetic algorithm.
tags: cplusplus, security, bash
cover_image: https://images.unsplash.com/photo-1563705883268-eb58ab6f505d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1352&q=80
---

Due to my work I tend to use brute force lists a lot, mostly to test incorrect login management. Sometimes I feel I get really close to correct passwords either guessing or using profiling tools. I don't know if some of you, when it comes to change the default or old passwords you just take your old one and change it a bit. That's mostly wrong btw. 

In any case recently I felt like hand-writing customized lists out of guessing on a text file was a poorly decision, so I decided to create a command that creates fitted guessing options from a fitting range using a genetic algorithm. I created a [gitlab repo](https://gitlab.com/terceranexus6/jock_pass/-/tree/master) in order to share it and I'd like to improve it, mostly because I know C++ might not be the best option and also because I'm open to suggestions, in general.

If you are curious please check and merge request your ideas!

Example of use with a sample guessed password and the desired fitness 2:

```
$ ./jockpass myPasswordGu3ss 2
```
![](https://user-content.gitlab-static.net/66fd7491b74750884c3fb5c013d6e4426df57234/68747470733a2f2f6d656469612e67697068792e636f6d2f6d656469612f323048486b4a335570465a4374346e51775a2f67697068792e676966)
A Simple Method To Finding Prime Numbers.
Tags: computerscience, beginners, codenewbie
Published: 2020-06-04 18:59:45

#Intro
In this post I'm going to go over how to create a function that will  determine whether a number is prime and a function that prints all the prime numbers under it(and the number itself if it's a prime number). 

#Okay Prime Numbers
This task might seem a little difficult for beginners to programming, but it actually just requires a  little thinking and that's it, and a teeny tiny bit of math.

>I'm not a math genius so I might not get it.

Trust me, it's a lot easier than you think.

#How Do we Do This?
Every prime number except for 2 and 3 follow a specific pattern. the number above or below it is divisible by 6.

>Yeah, but can't normal numbers fall under this?

Sadly, yes.

>So not all prime numbers follow this rule?

No, all prime numbers do follow this rule, but every once in a while other numbers that aren't prime can have this trait.

>Which ones?

Well, 25 isn't a prime but 24 is divisible by 6. So that's one that's early on.

>So, how do we get rid of them?

Based on my math it seems that all of these stragglers are powers of 2, 3, 5, 7, and 11.

>What about the other prime numbers?

We don't need to worry about them, the cross filtering of the 6 rule and the power rule will create an exact method.

>I don't understand.

In simple terms all we have to do is make two functions, one for the 6 rule and another for the power rule(there are other ways to get prime numbers, this isn't the only way).
Let me show you what it'd look like in a few languages.

{% gist https://gist.github.com/OreOlad/32ff7ae093933fe2c36239d29f55553a %}

>Wow, that was ***easy***!

I know!

#Generating prime numbers
So, now that we know know how to determine whether the input is a valid prime number we can use the functions just presented to generate prime numbers. 

>Hold on, our functions only return a boolean value how does that help?

Quick recap: boolean logic is for making decisions(that's how if statements work), so if a number is prime both functions will return true.

> So?

So we can iterate it over each number in the given range and add it to a list. Once that's done we can print each number to see the results.

>Okay, but how do we do that?

I'll show you.

{% gist https://gist.github.com/OreOlad/d27aa85f5662dc127ecebb1bddd88d4b %}

>Okay what's going on?

I used two different methods for the all 4 languages. In python, ruby, and javascript I made a list using a range from 1 to the given number and for each number i checked if it was prime, if findingPrime/findprime/finding_prime returns true and is_power/isPower/ispower returns true then the number is printed. If not it's skipped.

>Okay, what about the second method?

For C++ I made a while loop and called the findingprimes function and the ispower function on the given number, if it's prime it gets printed if not it is skipped. Then "num" is decreased by one and the proccess repeats untill num is equal to zero.

Hope you learned something!
Integrating Web Monetization with Musicoin
Tags: gftwhackathon, webmonetization, react, javascript
Published: 2020-06-04 18:40:23

When presented with this hackathon our team talked about what we can build using web monetization with our existing platform. 

We were excited to learn about this new web monetization api and what impact it can have on the future of the web.

Our basic understanding of the concept:

* Payment pointer is added to a meta tag in an html document.
* Payment pointers can also be set up in a more dynamic way on the servers. 
* Web Apps can set up payment pointers and receive micro payments for users browsing app.
* Content Creators can set up payment pointers and receive micro payments for access to their music.


With some research and more understanding we noticed that web monetization would help us create a separate income stream to then increase our benefits for our users(Musicians). Not only helping our users but helping the web monetization community.

## Initial Idea's

## 1. Open another revenue stream to Musicians from Musicoin

The way we deciding to integrate web monetization is allow wm users to automatically get our premium content with out having to be interrupted by preview limits and or track limits.

## 2. Directly Monetize Stream to Musician(If Signed up with Coil)

Secondly was to allow users to submit a song with payment pointer and or sign up with coil to allow for direct streaming of money while users are playing their music.


We can't wait to continue implementing and learning web monetization and the future of the web!!
Ideal GitHub Pull Request Labels?
Tags: discuss, github
Published: 2020-06-04 18:34:07

---
title: Ideal GitHub Pull Request Labels?
published: true
description: 
tags: #discuss #github
---

Im currently working on a GitHub bot that uses a machine learning model that can read info from a pull request (via graphql) and automatically tag the PRs with labels like author_confidence (high/low), pr_complexity (high/low), stackoverflow_tag (python , aws, etc...)

What other types of label information would add value to a PR?
wasm-pack access denied
Tags: help, rust, webassembly
Published: 2020-06-04 18:22:16

I am wanting to start using rust as wasm in a preact application.

I am running on a Windows 10 machine with the latest versions of both rust and wasm-pack installed.

When I run `wasm-pack --version`, I get the version print out as expected.

When I try and run any other wasm-pack (i.e. `wasm-pack build`) command I get `OS Error 5 Access Denied`.

[Related GitHub issue](https://github.com/rustwasm/wasm-pack/issues/803)

Has anyone else encountered a similar problem or have some places I could look for a solution?

I have tried re-installing wasm-pack (both using the windows installer [found here](https://rustwasm.github.io/wasm-pack/installer/) and using `cargo install wasm-pack`). I have also tried changing the permissions on both the cargo/bin folder and the application directory.
Apache Spark and Databricks 101 pt. II - Some DataFrames
Tags: databricks, spark, datascience
Published: 2020-06-04 18:19:51

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

One of the core API's of Apache Spark is the DataFrame.
It represents a table of data with rows and columns.

The list of columns and the respective datatypes are what's called the schema.
Like an Excel spreadsheet with named columns.

DataFrames are powerful and can be partitioned across thousands of computers at the same time.

They make parallel processing of big data possible:

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

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/0j9zf23sp1qplnmj26fd.PNG)

1 Creating a Sample Spark DataFrame:

The 'inferSchema' option means Spark will automatically detect the schema for us.

2 Take a Glimpse into the DataFrame:

With the 'display()' function we can see our DataFrame in a nice table format:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/4lhhvmr23yvhws9f6p8n.PNG)

If just so happens that you only want to take a look to the first x rows use the '.take(x)' function:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/0nvdbs3z6gt3d5i5pwyu.PNG)

Remember, this is Spark and not Python.

3 Final Thoughts and Conclusions:

Spark DataFrames are completely separate from Pandas DataFrames. That's something for another lecture, and I will show you how to convert one into the other and the differences and benefits of each.
Use Tailwind On A Template - Building SaaS #43
Tags: python, django, saas
Published: 2020-06-04 18:05:51

{% youtube rXdYhEjYgzo %}

In this episode, we worked on the template styles of a tabular view.  We also made some context data adjustments to include header rows and column highlighting.

I started by showing the template that I already created.  It was rough.

Before changing anything, I took the time to explain the modeling in use for this project and the context passed to the view.  The models mostly form a tree in the a hierarchy.  Here is the top to bottom list of the models in use:

```text
SchoolYear -> GradeLevel -> Course -> CourseTask -> Coursework
```

The view is showing a lot of data in a tabular structure so I walked through the logic to put that together in the view.

After explaining the data, I added week date headers to the table.  Then we used Tailwind to set some styling on them.

The next task was to make the table aware of week dates to show column highlighting of the current day.  We added the date to each cell to make it possible to test if it should be highlighted.  I also made some style changes to round off the corners of the columns.  This small detail actually required a suprising amount of template adjustment.

At the end, I discussed the next pieces that will be going into the app.

This article first appeared on [mattlayman.com](https://www.mattlayman.com/building-saas/tailwind-template/).