teleren/devto huggingface dataset:
The Diamond problem - C# Multiple inheritance

Tags: csharp, diamondproblem, multipleinheritance
Published: 2022-01-25 12:30:17

Since the day i started learning C#, i knew

>  Multiple inheritance is NOT supported through classes, but, the same can be achieved through interfaces
.

But i never bothered to explore the reason behind this.

Glad that it came up in my mind last week and i started looking for an answer - the reason behind C# NOT supporting Multiple inheritance is because of **the diamond problem**.

For a moment, assume C# support Multiple inheritances through classes and see the below class diagram

![class diagram](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c6t7ciq480v2p42ui8yq.png)

As you can see above :

1) Class A  has a method named 'Test' marked as Virtual

2) Class B  inherits Class A  and Overrides 'Test' method

3) Class C  also inherits Class A  and Overrides 'Test' method

4) Class D  inherits both Class B and Class C

Now, can you guess which _Test_ method does Class D inherit ?  The one from Class B or the one from Class C ? CAN'T tell right? This is called as The Diamond Problem. 

If above class diagram is not clear, see code below :

```

using System;

public class A
{
	public virtual void Test() { Console.WriteLine("This is class A"); }
}

public class B : A {
	public override void Test() { Console.WriteLine("This is class B"); }
}

public class C : A
{
	public override void Test() { Console.WriteLine("This is class C"); }

}

public class D : B, C {

}

public class Program
{
	public static void Main()
	{
		new D().Test();      // What will be the output ?
	}

}
```

But, how come it supports Multiple inheritance through Interfaces ? you might ask.

That's because, Interface methods are abstract by default, they don't have implementation. And since interfaces does NOT have implementation, any class that inherits more than one interface will implement the interface methods through Explicit interface implementation. 

You might be thinking that C# 8 has default interface implementation and that might cause the diamond problem. It DOESN'T.  You can try it.

Your comments are always welcome :)
Cookies Vs Local storage Vs Session storage
Tags: webdev, codenewbie, discuss, tutorial
Published: 2022-01-25 12:12:19

## Cookies

- Has only 4kb of holding capacity
- Supported in both HTML4 and HTML5
- Accessible from any window inside the browser
- Expiration date can be manually set
- Can be stored on both browser and server
- Can be sent with API Requests

```
>document.cookie = "username=John Doe; expires=Thu, 18 Dec 2013 12:00:00 UTC; path=/";
<'username=John Doe; expires=Thu, 18 Dec 2013 12:00:00 UTC; path=/
```

## Local storage

- Has 10mb of holding capacity
- Supported in HTMLS only
- Accessible from any window inside the browser
- No expiration date
- Can be stored on browser only
- Cannot be sent with API Requests
```
>LocalStorage.setItem("name ', "san')
<undefined
>localStorage.getItem('name')
<"san
>LocalStorage.removeltem( "name )
<undefined
>LocalStorage.getItem('name')
<null
```
## Session storage

- Has 5mb of holding capacity
- Supported in HTML5 only
- Accessible only in same tab inside the browser
- Expires on tab close
- Can be stored on browser only
- Cannot be sent with API Requests

```

> sessionStorage.setItem('name, rock)
< undefined
> sessionstorage.getItem('name)
<rock
> sessionstorage.removeltem('name)
< undefined
> sessionStorage.getItem('name')
```

What do you think is the best and more secure to use ? 
Share your ideas and feedbacks in the commetns section, I'll be waiting for your great insights !!
Using MLflow on google colaboratory with github to build cosy environment: design
Tags: mlflow, machinelearning, python, mlops
Published: 2022-01-25 12:11:21

(Updated on 19, March 2022)
(Updated on 6, February 2022)
(Updated on 28, January 2022)

# What do I want to do?
It's so troublesome to manage all settings (e.g., epochs, optimizer, etc) for building a certain model and I'd be interested in Kaggle these days. Before I join the competitions, I build a cosy environment.

# Pieces of my cosy environment
I'll use the following one library and four services.
- MLflow Tracking
- Google Colaboratory
- Google Drive
- Github
- ngrok

MLflow and google drive are for managing settings for building models, google colaboratory is for building models, github is for managing the source codes, and the result of mlflow is seen through ngrok.

# Concept
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q7q88ntoj8cf0q8yxa82.png) 

Apparently, MLflow Projects can connect to gitlab and manage the source codes, but at first, I just directly clone a repository and push new changes from google colaboratory notebook. Because of that, I have to add the commit number information to MLflow information after pushing new source codes on a remote repository.
How i use chunking to improve the import speed.
Published: 2022-01-25 12:04:36

##Intro
Yesterday, i talked about chunking the record before insert to the database in [Improve Speed Of Importing Data from Third Party with HTTP Request](https://dev.to/chengkangzai/improve-speed-of-importing-data-from-third-party-with-http-request-efa). Today, i want to show how does it works and what is the differences in speed.

##TLDR;
Always chunk your record before insert into database to get 3x speed.

###Import Console Command
In this Console code, we iterate each model, get the latest collection from GitHub and try to inject it.
```php
public function handle(): int
{
    //...
    foreach ($this->models as $model) {
        $record = $service->factory($model);
        $injectStation->inject($record, $model);
    }
    //...
}
```

### Inject Station
In the Inject station, we chunk the record to 500 each and insert it into database.
```php
public function inject(?Collection $records, string $modelName): void
{
    $tableName = (new $modelName)->getTable();

    DB::table($tableName)->truncate();

    $chunks = $records->chunk(500);
    
    foreach ($chunks as $chunk) {
        DB::table($tableName)->insert($chunk->toArray());
    }
}
```
The import speed is around 8 second, cool speed for 70k records.
![Import Speed using chunks](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/owgzxq7fy9nf32dlha05.png)

###What if ...
So, for the sake of science ... we remove the chunking and insert it one by one ... (notice how few lines of code have changed).
```php
public function inject(?Collection $records, string $modelName): void
{
    $tableName = (new $modelName)->getTable();

    DB::table($tableName)->truncate();

    foreach ($records as $record) {
        DB::table($tableName)->insert($record);
    }
}
```
The import speed dropped to ~28 seconds, 3x slower compare to the chunked version!
![Import Speed without chunks](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5pztlxxbnm3xszfjexq9.png)
 
## Moral of the Story
If you want to insert a large amount of data into the database, remember to chunk it!
Create a row and column container with HTML and CSS only.
Published: 2022-01-25 11:46:00

To create a well shaped container using HTML and CSS only (no boostrap require ) you can use the following method (i will illustrate an example of 3 columns):


## HTML CODE

```html
<div class="container grid grid--3-cols">
    <div class="div-one">
        <p>Lorem ipsum tbum</p>
    </div>
    <div class="div-two">
        <p>Lorem ipsum tbum</p>
    </div>
    <div class="div-three">
        <p>Lorem ipsum tbum</p>
    </div>
</div>
```


## CSS CODE

```css
.container {
  max-width: 120rem;
  padding: 0 3.2rem;
  margin: 0 auto;
}
/* the gap gives the space between the columns */
.grid {
  display: grid;
  column-gap: 6.4rem;
  row-gap: 9.6rem; 
}

/* for 2 columns*/
.grid--2-cols {
  grid-template-columns: repeat(2, 1fr);
}

/* for 3 columns*/
.grid--3-cols {
  grid-template-columns: repeat(3, 1fr);
}

/* for 4 columns*/
.grid--4-cols {
  grid-template-columns: repeat(4, 1fr);
}
```
Problems with create react app
Tags: react
Published: 2022-01-25 11:39:19

Hi everyone. I used create react app some months ago. I used the comand "npx create-react-app my-app" in a new folder in the desktop. Now I'm trying to run again the same command in another folder and it gives an error and npm cancel the installation. 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sw2fuh8r5vtsl7hgflam.PNG)

I run the command "npm uninstall -g create-react-app" but it doesn't work.

I have node v16.13.2 and npm 8.3.1

What can I do? Thanks in advance.

Regards :)
Function Currying In Javascript Get it simple 🍲
Published: 2022-01-24 14:07:04


Hai what is function Currying , Curried Functions 😳 ya ... it's sound like spicy 💁 ,there are actually some useful .


> oke .. We will start from the basics what are functions 

Function is something they simply take input from  one side processes inside give output from another side 
```javascript
                input ->([processes])-> Output
```

Consider a simple function add two number
```javascript
let add = (x,y)=>x+y
console.log(add(1,2))

3
```
Let's curve the function add()

> Using currying, a function is transformed from being callable as f(a, b, c) to being callable as f(a)(b)(c).

__Is it correct that add(x,y) should be transformed into add(x)(y)? 🥸__

Yes 👍  __Currying is when you break down a function that takes multiple arguments into a series of functions that each take only one argument.__

Lets Code ..

```javascript
function curry(f) { // curry(f) does the currying transform
  return function(x) {
    return function(y) {
      return f(x, y);
    };
  };
}

function add(x,y){
return x+y;
}

let curriedAdd=curry(add)

console.log(curriedAdd(1)(2))

3
```

😳 why it called Curried 
Maybe fist method you added some salt second one added some spice third some water ..  😂 ya it helps to call a method as multiple parts like 

```javascript
let c =curriedAdd(5)
c(3)
8
```
You can see that the implementation is straightforward: it's just two wrappers.

1. The result of curry(func) is a wrapper function(x)
2. When it is called like curriedSum(1), the argument is saved in the Lexical Environment, and a new wrapper is returned function(y).
3. The wrapper is then called with 2 as an argument, and it passes the call to the original sum.

**Uses of currying function**
  a) It helps to avoid passing same variable again and again.
  b) It is extremely useful in event handling.
We're looking for freelance technical content writers - $400 per article
Tags: writing, opensource, freelance
Published: 2022-01-25 11:22:04

---
title: We're looking for freelance technical content writers - $400 per article
published: true
description: We're looking for freelance technical content writers to help us educate the world about low-code, open-source, and internal applications
tags: #writing #opensource #freelance
//cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p9e5r3wquwuao5chs8e1.png
---

![We're looking for content writers](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p9e5r3wquwuao5chs8e1.png)

Hello dev.to, and writers!

[Budibase](https://github.com/Budibase/budibase) is an open-source low-platform that helps IT professionals build internal apps in minutes.

We're one of the fastest growing [open-source repos](https://github.com/Budibase/budibase), and we're hoping to continue our growth by paying technical writers to help us produce content that sparks joy in developers.

We're happy to pay up to $400 per article. All articles are targeted at developers.

If you are interested, or know anyone, please feel free reach out using the following form:
https://bb.budibase.app/app_bb_f832f44413ec455cb4cc25c9df3d1ee5

Cheers
Joe
Deploy a website on AWS S3 in 5 minutes
Published: 2022-01-25 11:10:35

Here's a simple automation pipeline template that will deploy a static website to an Amazon S3 bucket.

This pipeline uses the AWS CodeBuild plugin, creates a pipeline using the AWS Codepipeline plugin and deploys it to an AWS S3 bucket. The AWS Codebuild plugin will pull the code from the Github repository and do the necessary build process and the Codebuild process will then push the resulting artifacts to the S3 bucket. The AWS S3 Bucket policy in this pipeline will make the bucket accessible to the public.

You can add a Github trigger that listens to your repo for a push to trigger this pipeline.

[](https://kaholo.io/templates/website-deployment-on-aws-s3/)
New ECS Instance registration with ECS cluster Using CMD and Console
Tags: aws, ecs
Published: 2022-01-25 11:09:16

Amazon ECS makes it easy to deploy, manage, and scale Docker containers running applications, services, and batch processes. Amazon ECS places containers across your cluster based on your resource needs and is integrated with familiar features like Elastic Load Balancing, EC2 security groups, EBS volumes and IAM roles

Step-1: Go to the ecs service and click on the cluster.

![Createe cluster](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r874dvdi1oap300my7bo.png)


Step-2: select the create cluster option and select Ec2 linux + networking

![Select clster type](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ioncz78y7728d0ancyj2.png)

Step-3: configure the details as below


![Configure the cluster](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hgufwbx3wqr227hzjt2o.png)

Step-4: Cluster is createed as below.


![Cluster is created succesfully](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z7bwp1jqkn3vzgafqm6u.png)

Step-5: Go to the view cluster.


![Cluster is created](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5g22c06pss4i2ehzbep3.png)

Step-6: Go to the ECS-Instances

As per the ECS configuration, Auto scalling group is created and one ECS instance is launched from Autoscalling group.


![ECS-instance created](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lyq09qkvmdih5pnb3d39.png)

Step-7: Move to the Launch configuration of autoscalling group.


![ECS launch configuaration](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1c52zlddj4uqh74zsz9b.png)

Step-8: Under the details tab view the userdata script.


![Userdata script](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w6ceasxwoc0r3cot5xag.png)

Variable ECS_CLUSTER attach the ecs-instance to the define cluster.

Step-9: ssh into the created instance


![SSH using private key](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aftsaxm8rlu36orkeiv7.png)

Step-10: View ecs.config file for the configuration. Path for file is /etc/ecs/ecs.config

![ecs.config](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/plhpl774m9z8jvhf9zmb.png)

It is very useful when we work with multi cluster environment.

These is done by docker agent.

For verify these follow the below steps.

Step-11: Run the Docker ps command which gives the whole information.


![docker ps](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6r2982h28ep723nnjt1b.png)

Registration details can be also find from docker log as below.

Step-12: Docker Log

Command for docker log

docker logs container-id

![Docker log](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xdvz1luv9i9zmknhga8d.png)
AMP analytics error
Tags: amp, google, analytics
Published: 2022-01-25 11:07:18

Hi, I’m not an html développer but manage a website. We ask a developer to create the web site an now, I only do some adjustment. I try to put some tap to be able to follow the list on my web site. After adding some line I have a lot of trouble site the google inspection AMP.

Custom Java Script not allow,
Tag is only allow in the body section
only amp-boilerplate and amp-custom style tag are allowed and only in the document head
I believe that was only like on the place were I put my amp analytic attribute, but can understand were to put what

Can some body help me by checking the html code on www.viafelica.ch (main page)

Thank in advance
The Ultimate Guide to best Text Analytics solutions.

Tags: sentimentanalysis, emotionanalysis, textmining
Published: 2022-01-25 11:07:17

As a budding marketing professional, I always wondered if all the text analysis solutions are created equal? I got an empathetic ‘’NO’’as the answer.

I got to know that each text analytics platform has a specific offering and an ideal client for their technology. The text analytics market is well established, but with so many options to choose from, how will you get to know which platform is most suitable for your organization? This short article aims to help you decide.

In no particular order -other than to put my favorite first- here are the best text analytics tool in the market….

**Bytesview**

[Bytesview](https://www.bytesview.com/) is a ready-to-use comprehensive text analytics solution. However, you can also choose from the various custom integration options if needed. It also enables easy integration of data with various in-built integrations such as Zendesk, Zapier, Excel, and Google sheets.If you have the resources and time to code, you can use the BytesView API to build your own custom sentiment analysis model.

**Rapidminer**

RapidMiner markets itself as a machine learning company for enterprise-level clients looking to “drive revenue, reduce costs, and avoid risks.” With a focus on data science teams, their platforms offer customization and specialization equivalent to the IBM Watson suite, but with a scope well beyond text analytics.

RapidMiner’s platform consists of two main elements: the core engine RapidMiner Server and the visualization suite, RapidMiner Studio.


**MeaningCloud**

MeaningCloud Sentiment Analysis API program does aspect-based sentiment analysis on the user’s input to find out if a specific topic draws positive, negative, or neutral sentiments.

Some of MeaningCloud’s best features include global sentiment detection understanding which elements are opinion and which are facts and determining how the customer felt about every individual sentence in the text

**MonkeyLearn**

Monkeylearn is another excellent text analysis tool that offers a ready-to-use sentiment analysis solution. It offers plugins for Zendesk, Google Sheets, and more for easy integration of data.

Additionally, if you know how to code, you can use the MonkeyLearn API to build your custom sentiment analysis model. You can use data related to your industry or business organization to train the model and increase accuracy.

[](url)
**Takeaway**

Text analytics extracts cutting-edge data that can be translated into insights on consumer intent, social media sentiment, employee satisfaction, competitor intelligence… the list goes on, access your requirements before you choose one to get started.
How to deploy Google Cloud Functions with GitHub Actions
Tags: google, cloud, github
Published: 2022-01-25 10:51:10

---
title: How to deploy Google Cloud Functions with GitHub Actions
published: true
description: Google Cloud Functions with GitHub Actions
tags: google, cloud, github
cover_image: https://assets.mkdev.me/posts/covers/000/000/012/original/mkdev_article.png
---
Cloud Functions is the serverless compute platform created by Google to be used in the Google cloud. Is an event-driven model and in our example, we are going to use an HTTP call to trigger our function example.

GitHub Actions is the way used by GitHub to deploy CICD pipelines. AS we can imagine is deeply integrated into GitHub and we only need to create a YAML file in the .github/workflows folder to start our pipeline. Easy and graphically ideal.:

{% youtube B2VhvYZDXvM %}

***

*You can always hire [our mentors](https://mkdev.me/en/specializations) and learn directly from them!*
Embed a file from Github repository just like Github Gist Using EdGitHub
Tags: javascript, github, sh20raj, edgithub
Published: 2022-01-25 10:42:48


{% youtube Dd2Mrkwo5fY %}

---

# EdGitHub :- [https://edgithub.vercel.app/](https://edgithub.vercel.app/)

---


![See the homepage
](https://1.bp.blogspot.com/-M3717Y_hBBs/YLsp6XnwZFI/AAAAAAAAAu4/x2ksdTY37UQEOrRNOzXIAXGniqXJtq8WACLcBGAsYHQ/w640-h312/embed%2Bgithub%2Bfiles%2Blike%2Bgist.PNG)
See the homepage

![Copy your GitHub File Link](https://1.bp.blogspot.com/-ZUSt_lKYeJk/YLsqk1_FDQI/AAAAAAAAAvA/Cza5DMWXxpITIPnzjnAYQPd5m0xWEnk-QCPcBGAYYCw/w640-h320/embed%2Bgithub%2Bfiles%2Blike%2Bgist%2B-%2Bcopy%2Bit.PNG)
Copy your GitHub File Link


![See the homepage
](https://1.bp.blogspot.com/-M3717Y_hBBs/YLsp6XnwZFI/AAAAAAAAAu4/x2ksdTY37UQEOrRNOzXIAXGniqXJtq8WACLcBGAsYHQ/w640-h312/embed%2Bgithub%2Bfiles%2Blike%2Bgist.PNG)
See the homepage

![Paste it and Choose your Theme - See Preview Also
](https://1.bp.blogspot.com/-DPIY0AewcQ8/YLsqkwyIZ6I/AAAAAAAAAvI/QPEUFI5_8E0RDuyeX_aGkdhgvhKg6s3qgCPcBGAYYCw/w640-h300/embed%2Bgithub%2Bfiles%2Blike%2Bgist%2B-%2Bchoose.PNG)
Paste it and Choose your Theme - See Preview Also


![See Preview - and Copy paste the embed code generated to your website](https://1.bp.blogspot.com/-WQUeiWr3J0U/YLsqk1e4h7I/AAAAAAAAAvE/U-r7VXPJnv0WTZHSCl4KKCUiQ06QGkVrACPcBGAYYCw/w640-h306/copy%2Bthe%2Bcode%2B-%2Bembed%2Bgithub%2Bfiles%2Blike%2Bgist.PNG)
See Preview - and Copy paste the embed code generated to your website

Website Link :- https://edgithub.vercel.app/ (EdGitHub)

---

# EdGitHub :- [https://edgithub.vercel.app/](https://edgithub.vercel.app/)

---

{% user sh20raj %}