teleren/devto huggingface dataset:
Merge Sort
Tags: javascript, programming, algorithms
Published: 2022-05-11 08:51:03

What do we understand about Merge Sort?
 - This is a Divide & Conquer algorithm
 - It usually comprises of 2 functions
    - main function recursively splits the Array into 2 halfs before merger
    - 2nd function is the actual merge function where it compares the left Array values with the right Array values
        - there should be a counter that acts as the pointer for the 2 half Arrays
        - returns a new Array instead of mutating the original Array
 - Good resource to continue reading up on:
    - https://stackoverflow.com/questions/60288089/javascript-merge-sort-and-recursion

 - Time Complexity:
    - Height of the tree refers to the recursion part of the function - O(logn)
    - Merge helper function - O(n)
    - MergeSort worst - O(nlogn)
 - Space Complexity:
    - O(n)

```js
    function merge (left, right) {
        let x = 0;
        let y = 0;
        let output = [];

        //! we check both the left and right pointers
        //! if they have reached the end of their respective Arrays
        while (x < left.length && y < right.length) {
            //! COMPARE
            if (left[x] < right[y]) {
                output.push(left[x]);
                x++;        // next value to check if it is also smaller
            } else {
                output.push(right[y]);
                y++;        // bigger values comes in here
            }
        }

        // left side leftovers from first loop
        while (x < left.length) {
            output.push(left[x]);
            x++;
        }

        // right side leftovers from first loop
        while (y < right.length) {
            output.push(right[y]);
            y++;
        }

        return output;
    }

    function MergeSort(arr, start = 0, end = arr.length) {
        const arrayLength = arr.length;
        if (arrayLength < 2) return arr;

        const midindex = Math.floor(arrayLength / 2);
        const left = MergeSort(arr.slice(start, mid));
        const right = MergeSort(arr.slice(mid + 1, end));

        return merge(left, right);
    }
```
Why aren't you on Neovim yet?
Tags: discuss, opensource, vim
Published: 2022-05-11 08:47:02

Just discovered Neovim today. I can't believe how much I've been missing out!

- Exactly like VIM, but faster
- Better performances
- Works out-of-the-box with my extensive VIM configuration
- Installation and configuration was a breeze, don't need to change anything
- Did I mention that it was faster?

And obviously it's free and open-source.

Here's a quick installation guide if you want to get started: just copy-paste this in `~/.config/nvim/init.vim`

```
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vimrc
```

This will make Neovim pick up your current VIM config. So if you end up not liking Neovim for some reason, your VIM config is still intact. You can even have both installed at the same time.

So, why aren't you on Neovim yet?
Error 405 : ASP.NET Core Web API PUT and DELETE Methods not allowed
Tags: csharp, dotnet, api, programming
Published: 2022-05-11 08:44:15

---
published: true
title: 'Error 405 : ASP.NET Core Web API PUT and DELETE Methods not allowed'
cover_image: 'https://raw.githubusercontent.com/sandeepkumar17/td-dev.to/master/assets/blog-cover/tips_tricks.png'
description: 'PUT and DELETE Methods not allowed in ASP.NET Core Web API (405 Error)'
tags: csharp, dotnet, api, programming
series:
canonical_url:
---

#### Reason:
The `WebDAVModule` set PUT and DELETE request methods disabled by default and due to that PUT and DELETE throw 405 errors.

#### Solution:
To make the PUT and DELETE requests work, we need to override the `WebDAVModule` setting in `web.config` file by adding the below settings under the `system.webServer`.

```
<system.webServer>
  <modules runAllManagedModulesForAllRequests="false">
    <remove name="WebDAVModule" />
  </modules>
</system.webServer>
```

> There may be 2 web.config files in your project, if that is the case then update the one that is inside the wwwroot folder.

> Also with the latest version of .Net CORE (2.0 and above), there might be a case of no web.config file available at all, if that is your case then add a web.config file on your own.

#### Note:
If you are facing the same issue with multiple APIs hosted on the same server, then either you can add the above entries under `web.config` file of all the affected API’s or you can remove the below entry of `WebDAVModule` from `ApplicationHost.config` file under the module section:

```
<add name="WebDAVModule" />
```

`ApplicationHost.config` can be found at

> C:\Windows\System32\inetsrv\config

Hope that helps !!!

---
_Originally published at [http://diary-techies.blogspot.com](https://diary-techies.blogspot.com/2019/01/error-405-aspnet-core-web-api-put-and.html) on 
January 07, 2019._
Quiz App with flutter x Appwrite
Tags: appwritehack
Published: 2022-05-11 08:33:39

### Overview of My Submission
It is Simple trivia app, you can take quiz with your favourite category, get the score check the answers. 


### Submission Category: Mobile Moguls

[Note]: # (Web2 Wizards, Web3 Wunderkinds, Mobile Moguls, Wacky Wildcards)


### Link to Code

{% embed https://github.com/whimsyy/trivia %}


### Additional Resources / Info

This app is built using appWrite and Flutter

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

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

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

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

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

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


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4je1yafh0bxw4f14spyv.png)
System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException: Operation is not valid due to the current state of the object.
Tags: csharp, dotnet, linq, programming
Published: 2022-05-11 08:33:03

---
published: true
title: 'System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException: Operation is not valid due to the current state of the object.'
cover_image: 'https://raw.githubusercontent.com/sandeepkumar17/td-dev.to/master/assets/blog-cover/tips_tricks.png'
description: 'System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException: Operation is not valid due to the current state of the object.'
tags: csharp, dotnet, linq, programming 
series:
canonical_url:
---

You might have sometime faced the below exception while attempting to update an entity property:

> System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException: Operation is not valid due to the current state of the object.

#### Reason:
After looking into the issue I found that this error occurs when an attempt is made to change a foreign key when the entity is already loaded.
In this case, I was trying to assign a value to the foreign key property, and an exception is thrown as foreign key fields and association properties don’t match, when changes are submitted.

In such a scenario there are two values, one in the foreign key field or the one on the other side of the relationship and it doesn’t know which value is correct, and as a result exception is thrown.

#### Solution:
To avoid the exception the best way to update the relationship is by changing the association property and not the foreign keys. And then it will automatically keep the foreign keys in sync when you assign the association property a value.

The foreign key field value is changed only when there is either no association property defined on the object or the association property was never assigned a value.

**For Example** we have Address object and Country as it's child object, with foreign column is CountryId:

Then if we do

```
dbContext.Address.CountryId = newCountryId;
```

it'll raise exception, to avoid this update the relationship by changing the association property as:
```
dbContext.Address.Country = db.Country.Single(c => c.Id = newCountryId);
```

---
_Originally published at [http://diary-techies.blogspot.com](https://diary-techies.blogspot.com/2014/03/systemdatalinqforeignkeyreferencealread.html) on 
March 20, 2014._
Google Logo using HTML & CSS
Tags: html, css, codenewbie, beginners
Published: 2022-05-11 08:31:09

Recently, I started my **Instagram** Page named _coding_dev__
[Visit](https://www.instagram.com/coding_dev_/)
On this page, I post articles on HTML, CSS , JavaScript and stuff related to Web Development.
Below you can see one of my posts based on making Google logo using **HTML** and **CSS**!

{% instagram https://www.instagram.com/p/CcxlVNDLpXg/ %}

Follow [coding_dev_](https://www.instagram.com/coding_dev_/) for more stuff like this!
Btw you can call me Code Hunter👨🏻‍💻 too on Instagram.
:>
That is it!
Thanks for stopping by!
See you again. Bye....
Listen the "I want to buy the COVID-19 test kit" website with Appwrite!
Tags: appwritehack, appwrite
Published: 2022-05-11 08:24:00

---
title: Listen the "I want to buy the COVID-19 test kit" website with Appwrite!
published: true
description: My submission to the Appwrite Hackathon on DEV!
tags: appwritehack, appwrite
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lijug1qvj8x7gqf1sckd.jpg
---

## Instructions

Since one month ago, the Omincron epidemic is outbreak and the local cases are increased every day in Taiwan.

To detect the Omincron, the COVID-19 test kit is more and more important. However, the test kit in Taiwan is not cheap enough for people. To solve the above problem, the government decides to expropriate the test kit.

And it can let them be cheap for people to be available to buy. These expropriated test kits will let some pharmacies sell and each pharmacy can get 78 test kits from government every day. 

People who have the last number of their ID number is odd can go to the pharmacy and buy the 5 test kits at most on Monday, Wednesday, Friday and Sunday. And the people who have the last number of their ID number is even can go to the pharmacy and buy the 5 test kits at most on Tuesday, Thursday, Saturday and Sunday.

To let people realize where pharmacy is available to buy the test kit, I fetch the open data about pharmacy test kits that is generated by Taiwan CDC. And develop the simple website to let people type keywords to search the pharmacy and test kit numbers.

### Overview of My Submission

The website is simple, and I use the jQuery to develop the front-end.

Then using the [pharmacy test kit data](https://data.nhi.gov.tw/resource/Nhi_Fst/Fstdata.csv) to be the source data and let the jQuery parse the CSV data then present them in the web page finally.

![Website screen](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ibjqpjv2i29q9426q8c.png)

![Appwrite dashoboard](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l7lwfwh53sin6thifywa.png)

I provide the website for people to browse and the available links are as follows:

- [My Appwrite dashboard](https://pharmacy-test-kit.peterli.website)
- [GitHub page](https://peter279k.github.io/pharmacy-test-kit)

### Submission Category: 

It belongs to the Web2 Wizards category.

### Link to Code

{% embed https://github.com/peter279k/pharmacy-test-kit %}


### Additional Resources / Info

Here are some references are about developing above website:

- [jQuery](https://jquery.com)
- [Taiwan NHI Open Data](https://data.nhi.gov.tw)
Intro to RegEx
Tags: beginners, programming, productivity, tutorial
Published: 2022-05-11 08:20:56

Regular expressions, or RegEx, are versatile and powerful string patterns that are often used to match against strings for operations such as find, find and replace, and input validation. Another crucial aspect is that RegEx is widely supported by many languages.

However, it's infamous for its crazy syntax.

For example, this is the RegEx for a valid email address:

```
/^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/
```

Almost enough to make Siri wince   ._.'

Good thing this is an intro!

RegEx uses '/' as delimiters, so /a/ would detect all of the 'a's in a string for you to then manipulate further. Note that it is case-sensitive.

If you wanted to look for multiple characters, then simply wrap them in brackets like so: /[abc]/

Or perhaps you want to look for a specific order of characters instead, then the RegEx would be like: /[h][i]/ for all instances of an 'h' followed by an 'i'. 

To cast a wider net: /[abc][def]/ for any 'a', 'b', or 'c' that is then followed by any 'd', 'e', 'f'. 

You can put in a range like so: /[a-c][1-3]/

For multiple consecutive characters try: /[abc]{2}/  which is the same as /[abc][abc]/

Which you can also put in a range: /[abc]{2-5}/ for [abc] 2-5 consecutive times, or simply {2,} for 2 or more occurrences.

There is a lot more you can do to build RegEx's as you can tell from the email example, but now what do we actually do with them?

Typically, they are paired with methods like .match, .replaceAll, and .search. 

You can find more information here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions

Also, this site is a great interactive resource if you would like to dive right in: https://regexr.com/
[Appwrite + node-red]
Tags: appwritehack, nodered, javascript, iot
Published: 2022-05-11 08:14:48

series: [“appwrite +node-red”]

### Overview of My Submission
I created a collection of "appwrite nodes" for the node-red IDE.

Node-RED (https://nodered.org/) is a programming tool for wiring together hardware devices, APIs and online services in new and interesting ways.

It provides a browser-based editor that makes it easy to wire together flows using the wide range of nodes in the palette that can be deployed to its runtime in a single-click.

You can easy integrate node-red flows with the appwrite API.

repo: https://github.com/autanalabs/node-red-appwrite


### Submission Category: 
Wacky Wildcards


### Link to Code
{% embed https://github.com/autanalabs/node-red-appwrite %}


### Additional Resources / Info


![image](https://www.autanalabs.com/img/nodered/appwrite_client_config.png)

![image](https://www.autanalabs.com/img/nodered/appwrite_list_document_config.png)

![image](https://www.autanalabs.com/img/nodered/node-red-appwrite.png)
A Nice Developer Joke For Today
Tags: jokes, dailydeveloperjokes
Published: 2022-05-11 08:00:09

---
title: "A Nice Developer Joke For Today"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
published: true
tags: #jokes, #dailydeveloperjokes
---

Hi there! Here's today's Daily Developer Joke. We hope you enjoy it; it's a good one.

![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e12595d30baa.png)

---

For more jokes, and to submit your own joke to get featured, check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/). We're also open sourced, so feel free to view [our GitHub Profile](https://github.com/dailydeveloperjokes).

### Leave this post a ❤️ if you liked today's joke, and stay tuned for tomorrow's joke too!

_This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit._

<!--
Joke text:
___Q:___ How does a programmer open a jar for their significant other?

___A:___ They install Java
 -->
Should You Learn Bootstrap In 2022? 🤔 - Honest Opinion 🤯
Tags: webdev, css, javascript, html
Published: 2022-05-11 07:53:45

{% embed https://youtu.be/_ucITVxyJbE %}

**Should You Learn Bootstrap In 2022?** Watch my latest **[Youtube Video](https://youtu.be/_ucITVxyJbE)** to find out whether you should Learn Bootstrap or not and if it's still worth it or not? 🤔

Make sure to watch the **[Youtube Video](https://youtu.be/_ucITVxyJbE)** and also make sure to **Like** the **[Youtube Video](https://youtu.be/_ucITVxyJbE)** & **Subscribe** to my **[Youtube Channel](https://www.youtube.com/channel/UCIb8_J9lqtiWGMIOdQ5DVsg)** for more **Amazing** content related to **Web Development** and **Self Taught Developer** Journey 🙌

---

Please do me a favour by **Reacting** to this post with 
❤️ + 🦄 and also bookmark 🔖 it for your future reference ✅

---

**Connect/Follow** me on Social platforms like Twitter, Linkedin where I regularly post Tips💡+ Guides📜 + Resources 🌟 related to Web Development and Programming 👨‍💻


![RammCodes Social Follow Request Banner](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8a5vzbe9atsgmoll0oih.png)

### 🐦 **[My Twitter](https://twitter.com/rammcodes)**
### 👨‍💼 **[My Linkedin](https://www.linkedin.com/in/rammcodes/)**
### 🌐 **[My Website](https://rammaheshwari.com)**

---

Press the **Follow** button to stay updated with my content 🚀

Thanks for your **Support** ❤️
Babel Node + Typescript minus TS Node
Tags: typescript, babel, node, productivity
Published: 2022-05-11 07:46:13

If you want to use `typescript` with `babel-node`, here is how you do it:

install dependencies
```bash
npm i -D @babel/core @babel/node @babel/preset-env @babel/preset-typescript typescript
```

setup npm script
```json
"scripts": {
  "start": "babel-node -x .ts -- src/app.ts",
}
```

create a `babel.config.js`
```json
module.exports = {
	presets: [
		'@babel/preset-typescript',
		[
			'@babel/preset-env',
			{
				targets: {
					node: 'current',
				},
			},
		],
	],
}

```

create a `src/app.ts`, in this example I use `koa`
```ts
import Koa from 'koa'
const app = new Koa()

// response
app.use(ctx => {
	ctx.body = 'Hello Koa'
})

app.listen(3000)
```

finally `npm start` and boom, it just works.

This solution comes in handy when you are tight on memory and you want to avoid `ts-node`
Why do you think your app is better than other similar apps?
Tags: beginners, programming, webdev, tutorial
Published: 2022-05-11 07:45:52

[Mobile applications](https://codeares.com/) have become very popular due to their easy accessibility and user-friendly interface. The developers of Android or iPhone apps have made sure that they can be used by people belonging to any age group and profession as well. They are now available for use by doctors, lawyers and other professionals who may require some information at their fingertips during meetings or consultations with clients. Also, there is no need to connect a laptop or desktop computer to access.
[Mobile application development companies](https://codeares.com/) in usa are leading software development firms in the industry. The companies have a team of highly qualified and skilled professionals who have expertise in developing various types of mobile applications. The company offers extensive services in the field of custom mobile application development, mobile app development and mobile game development services to cater the needs of the clients.

The [mobile app development services](https://codeares.com/) offered by these companies include mobility solutions for businesses, software for handset manufacturers, enterprise mobility management and enterprise mobility applications. The operations of the companies are overseen by their highly experienced team of professionals that are engaged in providing innovative software solutions and consultation for businesses. The ios app, android app developers and windows phone app developers have developed numerous popular apps for their customers.

The company follows a systematic approach to develop high quality applications for its clients. The experts use various techniques that help them develop dynamic and appealing mobile applications. The company's skilled professionals who are expert at designing attractive layouts design captivating layouts that help create a positive impression among users.
My Google Warsaw(Poland)SDE university Grad Role Experience
Tags: interview, google
Published: 2022-05-11 07:32:30

Hi everyone 👋

I got the opportunity to interview with Google Warsaw(Poland) for Software Engineer Role(University Grad), off campus. The story is quite dramatic 🙈. Hope you enjoy it.

Selection Status : ❌

Interview Experience: ✔️

Recruitment Experience: ✅(OK)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/01n4hmrgcqtzjzkesoza.png)
 
####How I applied?
It was on around of end of February when I received this mail from a Google Recruiter, which said that my resume had been shortlisted for the Google SDE university Grad role 2022, and I was asked for preferred dates for the Interview.
As soon as I received the mail, I replied to the Recruiter within 2 days about me.

####Interviews

The phone call with the recruiter was 1st interview. I attended the phone call, wherein she informed me that I was shortlisted for the Interview Round 🥳 (this call happened after my mail response to the recruiter).
What my recruiter asked during an interview, I will say nothing, just my past experience, where and how I interned. It was easy, after this, I was shortlisted for the next technical interviews, she made me aware of what and how many rounds will be there.
I asked can I take around 1 month time to prepare, and the answer was simple it depends on much time the role is opened, I was lucky I got 1 month time to prepare.
then in the 1st week of April, my interview was scheduled, and I did whatever was possible to prepare in-between times,
now interview came and the interviewer was good but he speaks less directly and jumped to questions, then he explained the question.
I gave the brute force solution to him after thinking for 5 mins. then we discussed the time complexity of the solution, he told me to optimize my solution, I have taken much time in optimizing it (negative point) then he said me to write my brute force solution, I explained him, and the interview ended with the last question about I asked him his experience at Google.
It, within a week I got a mail from the recruiter that we are not moving forward just because an optimized solution is needed.

####Suggestion

Try to optimize the solution as soon as you can. I can't disclose the solution due to google policy but yes it was from array/string.
Thanks
How to find your next remote job as a developer
Tags: career, webdev, programming, tutorial
Published: 2022-05-11 07:22:47

Developers don't want to work at the company office anymore ! And it's one of the jobs where it's the easiest to find a remote job, so here's some tips in order to help you !

## Linkedin
[Linkedin](https://linkedin.com) is full of bullshitter but it's also a great place to find a job as a remote developer. If you don't have a profile yet, just create one and fill it with all your programming skills. And then... just wait for recruiter, I receive like 5/10 job offers per day and I never post on it ! 

## Job boards
There are many job boards for remote positions. Companies pay to list their jobs and they are waiting for applicants !
Here's a list :

- [Remotejobsfordevs.com](https://remotejobsfordevs.com), specially built for remote developers
- [Remoteok.com](remoteok.com)
- [remote.co](remote.co)

## Meetup
[Meetup](https://www.meetup.com/) a platform to find events, and many are for developers, there are bound to be some around you and you can meet people whose companies are hiring!

## Personal website
A personal website can help you to find a job if it's well indexed on Google ! It can be a good strategy for front-end developers, you can show your skills directly on your website ! Don't forget a link to your github ;)