teleren/devto huggingface dataset:
iOS StackOverflow Deep Dive: How to get two VC's to talk to each other
Tags: ios, beginners
Published: 2020-01-27 00:33:09

This is a new series where I will go into depth on interesting iOS StackOverflow questions:

This one [starts out](https://stackoverflow.com/questions/59923590/how-to-pass-a-reference-between-two-unrelated-viewcontrollers-for-a-main-and-an):

> What is the most “Swiftian” way of passing a reference between two unrelated ViewControllers (e.g., two ViewControllers that are independently instantiated at different times)?

The gist of the question is that there are two totally unrelated View Controllers that need to show the same information at the same time. The questioner wants to know how they can get references to each other.

My suggestion: Remember that iOS's default architectural pattern is MVC -- or Model-View-Controller. Introducing a model makes this easy.

Now, the default way of doing this (with a delegate) is actually not appropriate because the standard way of implementing that assumes that you have just one, but in this case, we have two (the two VCs).

There are several ways you could go from here.

1. Use `NotificationCenter` and have the model publish onto it and the VC's subscribe to it
2. Use KVO (Key-Value-Observing) on model properties. This is a simple way to go if the model is mostly just properties that change. This is more likely to be the case for simple data, but for this specific problem it probably won't work well.  One idea is to have an every increasing `Int` value, and when you get a KVO update on it, you ask the model for it's current information. The model just does `+= 1` on it when it updates itself.
2. If you are on iOS13, use `Combine` or (if not) consider using `RxSwift`. Both of these implement the `Observer` pattern and can let you do simple publish-subscribes.
3. Going the delegate route is still possible, but it involves an array of delegates -- but you need to implement some kind of array that holds elements weakly.  See this: https://www.objc.io/blog/2017/12/28/weak-arrays/. It's more complex than it seems, but possible.

I'll go into more detail in a future article.
The Second Step: An Ongoing Journey to a Career in Coding.
Tags: bootcamp, webdev, careerchange
Published: 2020-01-27 01:01:26

About two and a half millennia ago, Laozi wrote that “the journey of a thousand miles begins with a single step”. This is surely uplifting advice for anyone standing at the precipice of a daunting journey, but I can’t help but wonder what wisdom does he offer those of us on the second step? This is the thought that continues to bubble up above the rest as the sun sets on my first week of the Juno College bootcamp. The road ahead appears as formidable as it ever did but now there is also a gaping chasm behind. And here I stand in the middle, two feet firmly in the undiscovered country from whose bourn no traveller returns. 

Or perhaps I’m being a touch dramatic. I admit there is some comfort in dressing my feelings with quotes from the bard and ancient philosophers. It offers a whimsical perspective on my endeavours as though I were the subject of some great epic that would be told for generations to come. The reality, of course, is not quite so grandiose. I am a middle-aged man who quit his modest but stable full-time job in order to pursue a new career in a completely different field: front-end web development.

To read the rest of this post, visit the Juno College Blog: https://junocollege.com/blog/an-ongoing-journey-to-a-career-in-coding
Quick Python: Abstract Classes
Tags: python
Published: 2023-01-06 01:42:07

---
title: Quick Python: Abstract Classes
published: true
date: 2020-01-26 23:40:03 UTC
tags: Python
canonical_url: https://brandonrozek.com/blog/pythonabstractclass/
---

You can create an abstract class in Python by inheriting Abstract Base Class (`ABC`) and declaring relevant methods abstract.

First import the following from the standard library,

```
from abc import ABC, abstractmethod

```

Then create an abstract class, making sure to add the decorator `@abstractmethod` to the constructor. This prevents the user from instantiating the class.

```
class Animal(ABC):
    @abstractmethod
    def __init__ (self, name):
        self.name = name
    @abstractmethod
    def is_bipedal(self):
        pass
    def speak(self):
        return "Hello my name is " + self.name + " and I am a " + type(self). __name__

```

In the example above:

- A constructor is made, however, the class Animal cannot be instantiated. Do note that child classes can call the constructor.
- `is_bipedal` is an abstract method that needs to be defined in child classes. `pass` indicates that it is not implemented.
- `speak` is a normal method that will be inherited by child classes.

Now let’s look at a class that inherits `Animal`.

```
class Dog(Animal):
    def __init__ (self, name, owner):
        super(). __init__ (name) # Calls Animal constructor
        self.owner = owner
    def is_bipedal(self):
        return False

```
Moving the needle forward: mass-upgrading 30 Java games to JDK 11
Tags: gamedev, java, upgrade
Published: 2020-01-26 23:32:21

This has been a much larger undertaking than I thought it would be... I've completed the first 3 of the 7 phases:

* Set the SDK for all projects to JDK 11 [DONE]
* Migrate core dependencies to their Java 11 equivalents [DONE]
* Fix all compiler errors caused by the previous two phases [DONE]
* Make sure all projects declare a module and dependencies
* Migrate project-unique dependencies to Java 11
* Fix MORE compiler errors and various warnings left until now
* Test the results of the changes!

Making matters slightly harder is that the original projects were compiled in a number of different Java versions, exactly zero of which are 11. Also, some of the projects needed code specific to them upstreamed into the shared dependencies to work - this obviously benefits all the other projects too. More of this will happen when the project-unique stuff is tackled. The one bit of good news is that the required changes so far to make the code compile are highly similar across all 30 projects, turning that part into a copy/paste job. Love those. 😀

You may be curious why I'm doing this now, in light of my LOVE2D efforts. The reason is that all of these games need to be rewritten in LOVE2D at some point, and doing that is a LOT easier if they're all first moved to a common baseline. As for the code itself... [that's here](https://github.com/wrldwzrd89/older-java-games).
Metronome PWA using LitElement, RxJS and WebWorker
Tags: typescript, rxjs, webworker, showdev
Published: 2020-01-26 23:12:06

Hi folks,
I've created a small PWA metronome to learn LitElement and web-components better(and do not forget RxJS, which I'm not using much at work now).
I've used WebWorker for better timer performance on mobile devices and WebAudio API to generate sound.
Maybe it will be interesting for someone.
If you any suggestions or comments will be very glad to read them.

GitHub: https://github.com/ydubinskyi/rx-metronome
Demo: https://rx-metronome.web.app/
Create an amazing looking form using just html and css...css dark mode covered 
Tags: css, html, beginners
Published: 2020-01-26 23:06:30

Hello guys today we will be learning how to create this amazing form using just html and css

Learn how to by clicking the link below
<a href="https://youtu.be/HvHYs-fZYyw">Youtube video link <a/>

Don't forget to come drop comments when done viewing
Microsoft: Fluent UI vs UI Fabric
Tags: help, discuss, design, react
Published: 2020-01-26 22:53:16

Microsoft has its own design language which is called <a href="https://www.microsoft.com/design/fluent/#/">Fluent Design System</a>. There is also <a href="https://github.com/microsoft/fluent-ui-react">Fluent UI</a> which is a component library. To my understanding, it's based on Fluent Design System (please correct me if I am wrong). Moreover, Microsoft has one more component library called <a href="https://github.com/OfficeDev/office-ui-fabric-react">UI Fabric</a>. It is a part of the Fluent Design System as well.

If they both are based on the Fluent Design System, what is a difference between them? Will the Fluent UI library and the UI Fabric library be merged in the future? When developing a web app/site, which library to use?
Machine Learning - Data preprocessing
Tags: machinelearning, datascience, data, preprocessing
Published: 2020-01-26 22:20:10


As part of my trying to complete [Machine Learning A-Z Udemy](https://www.udemy.com/course/machinelearning/) course, this series of posts, starting with this one, will contain note I gather from it.
### Dependent vs independent variables
- Dependent – variable being tested and measured – predicted result
- Independent – variable being changed or controlled – features

Used libraries(python):
- numpy, a library containing mathematical tools
- matplotlib.pyplot, plotting library
- pandas – importing datasets
- sklearn.preprocessing – library for processing data

Importing dataset with pandas:
```
import pandas as pd
pd.read_csv(FILE_NAME)
```

### Missing data
Option 1:
- remove rows with missing data
- dangerous because we might be losing valuable information
Option 2:
- set missing values to mean of that feature

Library used:
```
sklearn.preprocessing.Imputer
```

### Categorical data
Labels need to be converted into numbers - Euclidean distance can’t be calculated on labels
Library: 
```
sklearn.preprocessing.LabelEncoder
```
Problem with LabelEncoder: converting labels into numbers can lead to problems as numbers can be ordered. Labels not necessary
Solution: Creating feature per label
Library: sklearn.preprocessing.OneHotEncoder

### Splitting data
For creating a model, data needs to be split into two sets, train and test. The train set is the one we use for creating a model, and the test is one we use to evaluate that mode's correctness.
Library: sklearn.model_selection.train_test_split
Usual ration: 70-80% for train data

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


### Feature scaling
One feature, because of large values, can dominate the smaller number value feature. This is why all features should be scaled to the same scale.
Option 1, standardization:
Each value is reduced by the mean and divided by the standard deviation.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/6d5wf537rjg3lyho5fs8.PNG)

Option 2, normalization:
Reduce each x by minimal x value. Ather that, divide by the difference of the maximum and minimum value of x.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/9p39kjnu53nxbfv7y974.PNG)

Library: 
```
sklearn.preprocessing.StandardScaler
```

---

For more, you can follow me on [Twitter](https://twitter.com/hi_iam_chris_), [LinkedIn](https://www.linkedin.com/in/kpajtasev/), [GitHub](https://github.com/kristijan-pajtasev/), or [Instagram](https://www.instagram.com/hi_iam_chris_/).
New features in Cypress 3.8.3
Tags: cypress, javascript, productivity, testing
Published: 2020-01-26 21:47:19

---
published: true
title: "New features in Cypress 3.8.3"
cover_image: "https://raw.githubusercontent.com/gabbersepp/dev.to-posts/master/blog-posts/cypress-versions/cypress-3.8.3/assets/header.jpg"
description: "What's new in Cypress 3.8.3? I show you the relevant (at least what is relevant for me) changes."
tags: cypress, javascript, productivity, testing
series: Cypress Release
canonical_url:
---

>**Note:** In this series I show you changes that are relevant for my private projects and my projects at work. Please go to [Cypress.io](https://docs.cypress.io/guides/references/changelog.html) for a full reference.

In [Cypress 3.8.3](https://docs.cypress.io/guides/references/changelog.html#3-8-3) following changes are most valuable for my usecases:

+ truncate messages from `cy.get` at 50 lines in the command log.
+ `file` property is now available in custom reporters

# Truncate at 50 lines
Imagine a selector that is very long:

`.get("#page-content > div:nth-child(2) > div > main > section.index-hero.Hero__StyledHero-sc-15j8hrl-2.kegIwW.gatsby-image-wrapper > div > h1 > div")`

If the `get` fails, you see this in the command log:

![before](https://raw.githubusercontent.com/YOUR-USERNAME/YOUR-REPO/master/blog-posts/cypress-versions/cypress-3.8.3/assets/50-before.png)

Unfortunately from this screen you will never be able to determine the full selector. This may be irrelevant in many cases but at work we have very complex and nested selectors and there it matters how the full selector looks like.

Now, after upgrading to `3.8.3` you see this:

![after](https://raw.githubusercontent.com/YOUR-USERNAME/YOUR-REPO/master/blog-posts/cypress-versions/cypress-3.8.3/assets/50-after.png)

This will helps us a lot with our work!

# `File` property

We use Jenkins to collect test results from cypress and jest. A custom script generates a HTML report for us. Unfortunately a failed tests looks like this:

![failed test without filename](https://raw.githubusercontent.com/YOUR-USERNAME/YOUR-REPO/master/blog-posts/cypress-versions/cypress-3.8.3/assets/html-before.jpg)

If you now want to check your spec file, you have to do a full text search with the spec name. This is annyoing and costs time.

**Now** you can access the `file` attribute within the reporter. And after applying the change, your html report looks like this:

![html report after](https://raw.githubusercontent.com/YOUR-USERNAME/YOUR-REPO/master/blog-posts/cypress-versions/cypress-3.8.3/assets/html-after.jpg)

----

# Found a typo?
As I am not a native English speaker, it is very likely that you will find an error. In this case, feel free to create a pull request here: https://github.com/gabbersepp/dev.to-posts . Also please open a PR for all other kind of errors.

Do not worry about merge conflicts. I will resolve them on my own.
Increasing the privacy of Firefox and Ubuntu
Tags: firefox, ubuntu, privacy
Published: 2020-01-26 21:24:35

## about:config

Change the following entries through about:config:

| name                                                                      | changed     |
|---------------------------------------------------------------------------|-------------|
| browser\.safebrowsing\.blockedURIs\.enabled                               | false       |
| browser\.safebrowsing\.downloads\.remote\.enabled                         | false       |
| browser\.safebrowsing\.malware\.enabled                                   | false       |
| browser\.safebrowsing\.phishing\.enabled                                  | false       |
| browser\.search\.geoip\.url                                               | leave blank |
| browser\.startup\.homepage\_override\.mstone                              | ignore      |
| dom\.push\.enabled                                                        | false       |
| dom\.webnotifications\.enabled                                            | false       |
| extensions\.blocklist\.enabled                                            | false       |
| extensions\.getAddons\.cache\.enabled                                     | false       |
| network\.captive\-portal\-service\.enabled                                | false       |
| network\.dns\.disablePrefetch                                             | true        |
| network\.dns\.disablePrefetchFromHTTPS                                    | true        |
| network\.http\.speculative\-parallel\-limit                               | 0           |
| network\.prefetch\-next                                                   | false       |
| privacy\.trackingprotection\.pbmode\.enabled                              | false       |
| services\.sync\.prefs\.sync\.privacy\.trackingprotection\.enabled         | false       |
| services\.sync\.prefs\.sync\.privacy\.trackingprotection\.pbmode\.enabled | false       |

## hosts

sudo nano /etc/hosts

```
127.0.0.1       connectivity-check.ubuntu.com
127.0.0.1       content-signature-2.cdn.mozilla.net
127.0.0.1       firefox.settings.services.mozilla.com
```

## Links
- [How to stop Firefox from making automatic connections](https://support.mozilla.org/en-US/kb/how-stop-firefox-making-automatic-connections)
- [How to Disable Network Connectivity Checking in Ubuntu 17.10](https://www.omgubuntu.co.uk/2017/09/disable-network-connectivity-checking-ubuntu-17-10)
Do you know what a productivity system is? 🤔
Tags: discuss, productivity
Published: 2020-01-26 21:16:22

Hello everybody! I have seen this term quite a few times now and not long ago I realized that this is exactly what I had been doing for the past few years — organizing my time and efforts on a habitual basis in such a way that I know what to do today in order to reach my goals.

I am curious to know what you think about this term and how does it sound to you :D
What project-based tutorial would you recommend to React beginners?
Tags: discuss, react, beginners, tutorial
Published: 2020-01-26 21:12:18

---
title: What project-based tutorial would you recommend to React beginners?
published: true
tags: discuss, react, beginner, tutorial
---

I've started learning React and I'm trying to find a few project-based tutorials for React beginners. I followed the official React tutorial - the Tic-Tac-Toe game -, which is good, but I was wondering what other tutorials are there. I'm looking for tutorials that go through building something from scratch.

Thanks!
Did your end users ever noticed missing translations on the production version of your app? Here's how I prevent this.
Tags: i18n, typescript, testing
Published: 2020-01-26 21:08:35

Forgetting to add translations are stupid things that happen. If you test manually, it's easy to miss them because you probably won't test all functionality in every language you support.

It can result in embarrassing complaints from end users like below:
![Missing translation in Dutch version of blindpool.com](https://thepracticaldev.s3.amazonaws.com/i/nvt672m9ydnj0owlr7ji.png)

Here's an example of how you can write a simple test in TypeScript to verify that every key that I added to the English message bundle has also been added to the Dutch one.

```typescript
describe('Test', () => {
    const englishMessageBundle = {
        "KEY1": "VALUE1",
        "KEY2": "VALUE2",
        "KEY3": "VALUE3",
    };
 
    const dutchMessageBundle = {
        "KEY1": "WAARDE1",
        // We forgot to add KEY 2, the test should notice this and fail.
        "KEY3": "WAARDE3",
    };
 
    test('Verify if all keys in the english bundle also exist in the dutch bundle', () => {
        for (const [key] of Object.entries(englishMessageBundle)) {
            expect(Object.prototype.hasOwnProperty.call(dutchMessageBundle, key)).toBeTruthy();
        }
    });
});
```

Here's how it looks running from my IDE (IntelliJ):
![Test that verifies that the dutch bundle has defined all keys that are in the English translation file](https://thepracticaldev.s3.amazonaws.com/i/07cw1zmuvkmhfdham2q1.png)

If you do CI/CD and have a build server that runs all tests after every commit, you should notice missing translations before deploying to production.
Compiling external .scss files when changed ?
Tags: svelte
Published: 2020-01-26 21:00:37

Does anyone know how to setup `Parcel` and `Svelte` so that when you save external `.scss` that are imported into components, that it forces a recompile of all components that use that `.scss` ? 

So I have something like this in lots of different components, but saving the `.scss` file doesn't update anything, only resaving the actual component will update the view :(

`<style lang="scss">`
  `@import 'src/css/variables.scss';`

  `.app-wrapper {`
    `background-color: $background-color;`
  `}`
`</style>`
Front End architecture questions 
Tags: architecture, angular, react, vue
Published: 2020-01-26 20:43:38

#frontend #architect  is a person who knows the answers to these questions: 

When can I use this technology? 

What are the impacts of using this technology? 

What are the impacts after scaling the project with this technology? 

Is the current developers will support this technology? 

Is the technology will upgrade the developer's skills? 

 Does technology have good community support? 

Is the technology best fit with business needs? 

Do you have other questions? 
Write it on comments.
How to survive junior Golang developer?
Tags: go, beginners, career, webdev
Published: 2020-01-26 20:35:52

Hi, for Gophers and everyone else!
Hope, I am not alone in such question. How to be in demand in industry if you like write in Golang, but haven't enough experience. What I mean.
Golang is cool language that can be useful for big company because it's solve problems of productivity. But for big clients (if you're frelancer) and for big companies, who really needed in Golang you'are not interested if you'are a "junior" in this language because that parts of project where Golang can be used very important and need be experienced engenieer to be useful. Same for small clients - you'are also not interested, because why use "ferrari in village". 
Who have similar cycle's problem, how you've broken this?
favorite twitter jokes ! "twitter HAS bookmarks" is one of my favs
Tags: watercooler, smn, bookmarks, bookmarking
Published: 2020-01-26 20:31:46

now that del.icio.us has gone, retaggr has ??? and "NOONE" uses twitter bookmarks i urgently need a new bookmarking repo (and cross browser plugins) 

it's got me thinking how about a github based one ! has anyone writen / is writing one (in node) and would like to join me ?
I've created a free website to help musicians learn how to play every possible scale. I'd love your feedback!
Tags: showdev, music, javascript, react
Published: 2020-01-26 20:10:16

---
title: I've created a free website to help musicians learn how to play every possible scale. I'd love your feedback!
published: true
description:
tags: #showdev, #music, #javascript, #react
cover_image: https://thepracticaldev.s3.amazonaws.com/i/7sfu3tj2ohju5ife61mr.png
---

Hi all!

I've spent a good chunk of this month compiling a list of scales and making them searchable on my website.

Once you find a scale the individual scale pages will have: guitar fingerings/intervals, piano fingerings/intervals, notes, intervals, chords (diatonic chords), and audible examples for the scale.

Check it out and let me know what you think:

https://www.solfej.io/scales