teleren/devto huggingface dataset:
OMG, this was not supposed to be merged, how do i revert?
Tags: git
Published: 2022-04-12 17:01:00

Have you merged that branch from that PR that not supposed to be merged? Well, i already once, and i want to show how i got out of it.

##What really happened?
On the project that this happened, there was two branches, that we will call here as **main** and **parallel**. Only changes from **main** can merge to **parallel**, and not the other way around. But, on that day, i have merged changes from **parallel** to **main**.

##What do next?
So on the **main** branch, it had a last commit, that looks like:
`8f937c683929b08379097828c8a04350b9b8e183`

So i search _"Git merge commit revert"_ and with all the things that i read, and the commit id that i got it, i had executed the bellow command:
`git revert <commit_id>`

And an error message was shown:
`git revert <commit_id> alone won't work. -m must be specified`

##What is this '-m must be specified'?

So i searched deeper, and i found out this link on **StackOverflow**, that helped me a lot:
[How to revert a merge commi thats already pushed to remote branch](https://stackoverflow.com/questions/7099833/how-to-revert-a-merge-commit-thats-already-pushed-to-remote-branch)

if you run _git log_ you will see the parents of the merge commit on the _Merge_ prop, like this:
`commit 8f937c683929b08379097828c8a04350b9b8e183
Merge: 8989ee0 7c6b236
Author: Ben James <ben@example.com>
Date:   Wed Aug 17 22:49:41 2011 +0100`

When you run:
`git revert <commit_id> -m 1`
You are saying that you want to come back like it was on _8989ee0_.

And if you run:
`git revert <commit_id> -m 2`
You want to come back on _7c6b236_ tree.

Thanks for the reading, and i hope that this can help you like it helped me.
Ionic Framework E2E (End To End) Testing React Application Using Appium and WebdriverIO
Tags: react, ionic, testing, webdev
Published: 2022-04-12 16:57:31

Just a quick walkthrough video explaining the starter project for an [Ionic Framework](https://ionicframework.com/) & [Capacitor](https://capacitorjs.com/) App written in reactjs demonstrating end to end testing.

Looking to integrate e2e testing an ionic-framework application and the [sample provided by Ionic](https://github.com/ionic-team/ionic-e2e-example) is written in Angular and it is based on Cordova and not capacitor so I have started this project to figure things out  

### What's Here  
- The Sample is based on the list template provided by ionic 
- The Source code is in react js 
- Tests currently work in the android emulator, ios emulator, and in the web browser 
- This is still a work in progress but it is based on the latest versions of Ionic and Capacitor so it should get on started better than the other sample 
- The project hasn't been cleaned up, there are still some artifacts from the original Ionic Project

{% youtube https://youtu.be/kGcs2Ah7LuU %}

#### IOS Quirk
For the application path for the IOS application, you will need to manually set that based on the specific device/emulator that you are deploying to. unlike Android, it appears that the IOS build is deployed directly to the device.

If you look at line 32 in the `wdio.ios.config.ts` you will see the property that you will need to change. To get the specific path, I have run the build command with the `--verbose` flag to output the appropriate information

```
ionic capacitor run ios --target 1DB27F13-4EF3-4D45-A67B-88C69B53EF84 --verbose 
```
### Links
- Original Ionic Code Using Angular and Cordova - https://github.com/ionic-team/ionic-e2e-example 
- Appium Documentation - https://appium.io/  
- WebdriverIO Documentation - https://webdriver.io/docs/api   
- Source Code - https://github.com/aaronksaunders/ionic-e2e-react-webdriverio-appium

---
Looking for support with your cross-platform mobile solution using Ionic Framework? Contact Me at my company Clearly Innovative Inc for a free 30-minute Consultation
www.clearlyinnovative.com
778. Swim in Rising Water
Tags: 100daysofcode, algorithms, cpp, programming
Published: 2022-04-12 16:45:28

# **778. Swim in Rising Water**

# Description

You are given an `n x n` integer matrix `grid` where each value `grid[i][j]` represents the elevation at that point `(i, j)`.

The rain starts to fall. At time `t`, the depth of the water everywhere is `t`. You can swim from a square to another 4-directionally adjacent square if and only if the elevation of both squares individually are at most `t`. You can swim infinite distances in zero time. Of course, you must stay within the boundaries of the grid during your swim.

Return *the least time until you can reach the bottom right square* `(n - 1, n - 1)` *if you start at the top left square* `(0, 0)`.

## Example 1:

![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/c2fcf90f-fa50-4efc-8c47-8bf964d26d30/Untitled.png)

```
Input: grid = [[0,2],[1,3]]
Output: 3
Explanation:
At time 0, you are in grid location (0, 0).
You cannot go anywhere else because 4-directionally adjacent neighbors have a higher elevation than t = 0.
You cannot reach point (1, 1) until time 3.
When the depth of water is 3, we can swim anywhere inside the grid.
```

## Example 2:

![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/26315f85-9d57-4e3d-8882-fe42dbed5e68/Untitled.png)

```
Input: grid = [[0,1,2,3,4],[24,23,22,21,5],[12,13,14,15,16],[11,17,18,19,20],[10,9,8,7,6]]
Output: 16
Explanation: The final route is shown.
We need to wait until time 16 so that (0, 0) and (4, 4) are connected.
```

## Constraints:

- `n == grid.length`
- `n == grid[i].length`
- `1 <= n <= 50`
- `0 <= grid[i][j] < n2`
- Each value `grid[i][j]` is **unique**.

---

# Solutions

## Solution 1

### Intuition

1. binary search
2. dfs to check if go from top left to bottom right?

### Code

```cpp
class Solution {
public:
    int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
    int n;
    vector<vector<int>> g;
    vector<vector<bool>> visited;

    bool dfs(int x, int y, int elevation) {
        if (x == n - 1 && y == n - 1) return true;
        visited[x][y] = true;
        for (int k = 0; k < 4; k++) {
            int i = x + dx[k], j = y + dy[k];
            if (i >= 0 && i < n && j >= 0 && j < n && g[i][j] <= elevation && !visited[i][j] && dfs(i, j, elevation))
                return true;
        }
        return false;
    }

    bool check(int elevation) {
        if (g[0][0] > elevation) return false;
        visited = vector<vector<bool>>(n, vector<bool>(n, false));
        return dfs(0, 0, elevation);
    }

    int swimInWater(vector<vector<int>>& grid) {
        g = grid;
        n = grid.size();
        int l = 0, r = n * n;
        while (l < r) {
            int mid = l + r >> 1;
            if (check(mid))
                r = mid;
            else
                l = mid + 1;
        }
        return l;
    }
};
```

### Complexity

- Time: O(nlogn)
- Space: O(n)

---

## Solution 2

### Intuition

### Code

```java

```

### Complexity

- Time:
- Space:

---

# Similar Questions
Unable to Login Django Admin after Update : Giving Error Forbidden (403) CSRF verification failed. Request aborted.
Tags: django, python, shriekdj, programming
Published: 2022-04-12 16:40:29

## Problem

> Unable to Login Django Admin after Update : Giving Error Forbidden (403) CSRF verification failed. Request aborted.

>> This Issue Can happened suddenly after updating to Newer Version Of Django which looks like below image.


![Forbidden (403) CSRF verification failed. Request aborted error image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eqonmejprzul876h8uww.JPG)

---

## Details

> Django Project Foundation team made some changes in security requirements for all Django Version 4.0 and Above. In Which they made mandatory to create an list of urls getting any type of form upload or POST request in project settings named as **CSRF_TRUSTED_ORIGINS**.

>>  They did not updated the details in latest tutorial documentation but they published the Changes Notes at <https://docs.djangoproject.com/en/4.0/releases/4.0/#csrf-trusted-origins-changes-4-0>.

---

## First Solution

> For `localhost` or `127.0.0.1`.

>> Goto `settings.py` of your django project and create a new list of urls at last like given below

```python
CSRF_TRUSTED_ORIGINS = ['http://*', 'https://*']
```

> if Your running an project in localhost then you should open all urls here `*` symbol means all urls also there is `http://` is mandatory.

---

## Second Solution

> This is Also for Localhost and for `DEBUG=True`.

>> Copy the list of ALLOWED_ORIGINS into CSRF_TRUSTED_ORIGINS like given below.

```python
ALLOWED_ORIGINS = ['http://*', 'https://*']
CSRF_TRUSTED_ORIGINS = ALLOWED_ORIGINS.copy()
```

---

## Third Solution

When Deploying you have to add urls to allow form uploading ( making any POST request ).

I Know this maybe tricky and time consuming but it's now mandatory.

Also this is Mandatory to Online IDEs also like Replit, Glitch and Many More.

***

## Conclusion

If you found this useful then please share this and follow me! Also check out Buy Me A Coffee if you want to support me on a new level!

[![Buy me a coffee](https://cdn.buymeacoffee.com/buttons/default-yellow.png)](https://www.buymeacoffee.com/shriekdj)

Give an reaction if any solutions helped you for algorithm boost to my content.

bye 👋.
Melhores casas de apostas
Published: 2022-04-12 16:33:52

[Casas de Apostas](https://br.odds.dog/blog/casas-de-apostas-esportivas-brasil/)
[Betano](https://br.odds.dog/blog/analise/betano-brasil-analise/)
[Bet365](https://br.odds.dog/blog/analise/bet365-brasil-analise/)
Convert to HTML, My First Website
Tags: javascript, csharp, programming
Published: 2022-04-12 16:32:40


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l25xutm50uhm2j8io0qv.png)
I'm been learning about the asp.net core for the past few weeks. During the study, I created some sample projects in .net core
Then I created a web application to design web-forms using jquery formbuilder plugin. We can convert the designed web-forms in to responsive bootstrap HTML codes. This web app will also generate jquery client-side validation codes for the web-form.
Then I implemented the functionality to convert the designed web-forms in to CSHTML codes. Also the web app will generate C# model class from the designed web-forms. We can download the designed web-forms as HTML page.

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

We can also convert the C# model class into HTML web-form or HTML table using this web application 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vockn2ydf3je79v05uum.png)
Then I hosted this web application. Yes, now this web application is live. 

You can check the web site by clicking the following link [Convert2Html](https://www.convert2html.in/)
Video Tutorial: https://youtu.be/9svf7O-bzso
Python, Celery, Kubernetes, and Memory
Tags: discuss, python, celery, kubernetes
Published: 2022-04-12 16:26:26

I've been thinking about Python and Kubernetes and long-lived pods (such as celery workers); and I have some questions and thoughts.

When you use memory-intensive modules like pandas, would it make more sense to have the "worker" simply be a listener and fork a process (passing the environment, of course) to do the actual processing using memory-intensive modules? The thought process here is that, by launching a subprocess, the memory utilization should go down once that subprocess exits. Therefore memory should be freed and any chance of memory leaks should be circumvented.

Secondly, with kafka and [faust](https://faust.readthedocs.io/en/latest/introduction.html#introduction), is celery even relevant for high-availability microservice applications?

I would really like to hear some real-world experience with any of these.
Appwrite x DEV Hackathon Help Thread
Tags: appwritehack, appwrite, help
Published: 2022-04-12 16:11:33

---
title: Appwrite x DEV Hackathon Help Thread
published: true
description: Comment here if you need any help during the Appwrite Hackathon on DEV!
tags: appwritehack, appwrite, help 
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/62k4dnq8se1hqz57c91c.png
---

**If you're participating in the [Appwrite x DEV hackathon](https://dev.to/devteam/announcing-the-appwrite-hackathon-on-dev-1oc0) and you need some help with your submission, you've come to the right place! 

If you have any questions about how this contest works (_ex: due dates, how to post your submission, picking a category, etc._) the DEV team will be happy to assist you.

> **If you are running into issues or get stuck when it comes to Appwrite's self-hosted backend-as-a-service platform, please leave those questions here as well.**

Comment below if you need asynchronous assistance with the Appwrite x DEV Hackathon ❤️ 

_P.S. If you'd like to share an update on the progress you're making on your project or if you'd like to connect with other participants, please do so in the [community discussion thread](https://dev.to/devteam/community-discussion-thread-appwrite-x-dev-hackathon-13aj)!_
Community Discussion Thread — Appwrite x DEV Hackathon
Tags: discuss, appwritehack, appwrite
Published: 2022-04-12 16:11:10

---
title: Community Discussion Thread — Appwrite x DEV Hackathon 
published: true
description: A place to discuss your progress with the Appwrite Hackathon on DEV — and lend encouragement to one another!
tags: discuss, appwritehack, appwrite
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s0mfxc4ecpnm9f86dhlo.png
---

### **This thread is your place to share progress with your fellow [Appwrite x DEV Hackathon](https://dev.to/devteam/announcing-the-appwrite-hackathon-on-dev-1oc0) participants and encourage one another throughout the month!**

> In this thread, you can post...
- Positive encouragement for other participants
- Milestones you've achieved or things you've learned throughout the hackathon
- Links to DEV posts related to your official submission (especially if you've written multiple reflections/progress posts). Don't forget to utilize the DEV article embed tag when sharing a link! 


If you need help throughout the Appwrite x DEV Hackathon, head over to the [help thread](https://dev.to/devteam/appwrite-x-dev-hackathon-help-thread-4jfj)

#### _Comment Below_ 👀
Front End First Step
Published: 2022-04-12 16:09:12

---
title: Front End First Step
published: true
description: 
tags: 
//cover_image: 
---
The beginning of every journey is full of challenges and barriers that _need to be overcome._ There is always that fear of the unknown and the feeling that everything will be very difficult, but you always feel that when you start a project and the feeling of growth always rewards the effort.

As you are not the first to go through this trail, take the opportunity to learn from those who have gone before and left several ways to facilitate the process.


I will leave here a small step by step of what is most important so that your learning is optimized and you make the most of your time.

### Internet

HTTP
what is DNS
Browsers and Hosting

### HTML

Semantic HTML
SEO
Accessibility

### CSS

Responsive Design
Layouts (floats, position, display, css grid)

### Javascript

Syntax
DOM (learn to manipulate)
ES6
Fetch API

### Git e Github

### Build Tools

NPM Scripts
Webpack

### Choose a Framework

React js (redux)
Angular
Vue js


Follow this model, it's the basics to really understand and not just replicate. Dedicate yourself and see the results.
How to connect electronic boards to the outside world
Tags: electronic, opensource, tutorial, luos
Published: 2022-04-12 16:03:39

Who never complains about unstable software that needs to be installed to communicate with an electronic board?
⏩ https://www.luos.io/blog/how-to-connect-electronic-boards-to-the-outside-world

In this blog post, Nicolas (Nico 🤙1209 on Luos Discord) will talk about his experience connecting electronic devices to the “outside world”.

By sharing his experience, he will evaluate the pros and cons we were/are facing and how we are working towards a universal solution with Luos Engine.
Middleware in ExpressJS
Published: 2022-04-12 16:01:00

# What are middlewares(hoping that this is the plural of middleware)?

In the simplest of words, a middleware function is that function that gets executed between a request coming in and a response going out. We use middlewares to modularize our code, make it readable, increase reusability and much more.

# Types of middleware in express

There are 5 types of middleware:

**1. Application-level middleware**: These middlewares are bound to the app object and called inside the main application file which means that they are executed after every new request.


![carbon (2).png](https://cdn.hashnode.com/res/hashnode/image/upload/v1649765999629/fD1_FX2c7.png)

**2. Router-level middleware**: These middlewares are bound to a certain router (instance of express.Router) and are then merged with the main application

![carbon (3).png](https://cdn.hashnode.com/res/hashnode/image/upload/v1649766251357/4vpmv1g1E.png)

**3. Error-handling middleware**: These middlewares accept 4 arguments, of which the first argument refers to the error that is coming in, also to call these middlewares you have to call the next parameter with a parameter like next which actually is the error that has to be handled in the error handling middleware

![carbon (4).png](https://cdn.hashnode.com/res/hashnode/image/upload/v1649766651663/uU6B2Cu1X.png)

**4. Built-in middleware.**: These are middlewares that are provided with expressjs and don't need any third-party packages to be downloaded

![carbon (5).png](https://cdn.hashnode.com/res/hashnode/image/upload/v1649767358726/3AKln160U.png)

**5. Third-party middleware.**: These middlewares require some third-party packages to be installed first. For example, express session:

![carbon (6).png](https://cdn.hashnode.com/res/hashnode/image/upload/v1649767637010/vg7yWbw5z.png)

> - If the current middleware function does not end the request-response cycle(redirecting to another request or sending a response), it must call next() to pass control to the next middleware function. 

> - For more in-depth reading visit [express middlewares](https://expressjs.com/en/guide/using-middleware.html)
New Things Added - Laravel 9.7 Released
Tags: php, laravel, webdev, performance
Published: 2022-04-12 15:56:43

Let's get started quickly I found new things in Laravel 9.7 Released I wanted to share with you.

- Query Builder whereBelongsTo() Accepts Collections
https://github.com/laravel/framework/pull/41733

```php
// Previously
$query
    ->whereBelongsTo($category[0])
    ->orWhereBelongsTo($category[1])
    // ...
 
// Or...
$query->whereIn('category_id', $categories->modelKeys());
 
 
// >=9.7 can use collections:
$query->whereBelongsTo($categories);
$query->whereBelongsTo($categories, 'category');
```

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

- Database Queries Containing Json Paths Support Array Index Braces

```php
DB::table('json_table')
    ->where('column->json_option[0]', 'foo')
    ->update(['column->json_option[0]', => 'bar']);
```

- Route whereIn() Parameter Constraint Method
https://github.com/laravel/framework/pull/41794

```php
Route::get('/foo/{bar}')->whereIn('bar', $values);
```

- String Squish Helper
https://github.com/laravel/framework/pull/41791

```php
$this->assertSame(
    'laravel php framework',
    Str::squish(' laravel php framework '));
 
$this->assertSame(
    'laravel php framework',
    Str::squish("laravel\t\tphp\n\nframework")
);
 
$this->assertSame(
    'laravel php framework',
    Str::squish('
        laravel
        php
        framework
    ')
);

use Illuminate\Support\Str;
$string = Str::squish('    laravel    framework    ');
// laravel framework
```

- Query Builder "whereJsonContainsKey()" Method
https://github.com/laravel/framework/pull/41802

```php
DB::table('users')
    ->whereJsonContainsKey('options->languages')
    ->get();
 
DB::table('users')
    ->whereJsonDoesntContainKey('options->language->primary')
    ->get();
 
DB::table('users')
    ->whereJsonContainsKey('options->2fa[0]')
    ->get();
 
DB::table('users')
    ->whereJsonDoesntContainKey('options->2fa[0][1]')
    ->get();
```

- Enable batch jobs delay for database queue
https://github.com/laravel/framework/pull/41758

```php
use App\Jobs\ImportCsv;
use Illuminate\Bus\Batch;
use Illuminate\Support\Facades\Bus;
 
$batch = Bus::batch([
    (new ImportCsv(1, 100))->delay($delay),
    (new ImportCsv(101, 200))->delay($delay)
])->dispatch();
```

- Add whenNotNull method
https://github.com/laravel/framework/pull/41769

```php
DB::table('users')->whereNotNull('name')->get();
```

I hope you enjoyed with me and to learn more about this release visit the sources and search more. I adore you who search for everything new.
Source :- https://laravel-news.com/laravel-9-7-0
Source :- https://www.youtube.com/watch?v=tQ2DG-qP6ik
Deep copy Vs Shallow copy
Published: 2022-04-12 15:55:52

When assigning values to variables it is handy to be able to able to make a copy of an existing variable. In order to avoid modifying any existing data it is important to know that there are different types of copies, and when to use each.


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

Making a copy means creating a new variable and assigning it the same values as the copied variable. But there is an important concept to consider, do you want to make a deep or a shallow copy? Both copies contain the same values, but deep copies have their own space in memory while shallow copies point to the same space as the original variable. The consequence of this is that any modifications made to a shallow copy will affect the original, but any modification made to a deep copy are independent of the original variable.

There are multiple ways to make copies of objects such as using a spread operator, assignment, etc. 

When making copies make sure to take into consideration whether your clone will cause unwanted changes to the original. 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0rv46ru2vc00x1ggeo3s.png)
React-spring animator of the year
Tags: react, javascript, webdev
Published: 2022-04-12 15:50:18

I was searching for a framework of React.Js to animated my banner sections of my website. After searching for a long time finally I found a video in YouTube which is tell about 5 npm packages for website design
That video is also included react-spring. Then I go to the react-spring website and read their documentation. I implement some of their animations and now I am happy