teleren/devto huggingface dataset:
Group Anagrams
Tags: leetcode, dsa, theabbie
Published: 2022-06-10 11:30:34

Given an array of strings `strs`, group **the anagrams** together. You can return the answer in **any order**.

An **Anagram** is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.

**Example 1:**

**Input:** strs = \["eat","tea","tan","ate","nat","bat"\]
**Output:** \[\["bat"\],\["nat","tan"\],\["ate","eat","tea"\]\]

**Example 2:**

**Input:** strs = \[""\]
**Output:** \[\[""\]\]

**Example 3:**

**Input:** strs = \["a"\]
**Output:** \[\["a"\]\]

**Constraints:**

*   `1 <= strs.length <= 104`
*   `0 <= strs[i].length <= 100`
*   `strs[i]` consists of lowercase English letters.

**SOLUTION:**

    class Solution:
        def groupAnagrams(self, strs: List[str]) -> List[List[str]]:
            buckets = {}
            for word in strs:
                key = "".join(sorted(word))
                buckets[key] = buckets.get(key, []) + [word]
            return list(buckets.values())
Unhandled exception: ProcessException: No such file or directory, Command PhaseScriptExecution failed with a nonzero exit code
Tags: flutter, dart, beginners, ios
Published: 2022-06-10 11:28:00


[Photo by eberhard grossgasteiger](https://www.pexels.com/photo/view-of-snowy-mountains-12365573/)

As at the time of writing this article, I had already told my parents to prepare a farmland for me, as tech is not my calling again 😂😂😂😂.

##
    This is going to be a different pattern of writing my 
    articles.

So if you come across this article as being a solution to a similar problem as the title, well, leave a thumbs up.

So I cloned a flutter project to work on, started off with installing my flutter SDK and the xcode version that the project was created with.

First ran for the android, which worked without issues, but when it got to the iOS, everything went south in split second.

I reached out to the Engineer handling the project initially, we went through installations and codes again, found nothing, I was advised to downgrade my xcode and try again... Long story short, I currently have xcode 13.4, 13.3, 13.3.1, 13.2.1 in my mac 😂.

### An image of my error message: 
![An image of my error message:](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/av2mzsbhfwy0zwzwkctx.png)

Well, none of the solutions found on stackoverflow and github issues worked for me. Which included the following:

#
    Open the terminal On the root directory of your project, run:

```javascript 
   $ flutter clean
   $ flutter pub get

   // cd into your ios directory
   $ cd ios
   $ pod deintegrate
   $ pod install

   // cd out of your ios directory
   $ cd ..

   // try running the project on your ios simulator
   $ flutter run
   // Be sure your ios simulator is active

```

Having done all of the above, and even did flutter doctor, just to confirm if I had issues with my installations and setup, nothing worked for me.


The most confusing thing was that, a dummy flutter project I created worked just fine, same as a flutter project I had created with my windows some months back and cloned into my mac, all worked out just fine for both Android and iOS.

I found a regex code
#
    grep -riL "<path to your flutter sdk>" "<path to your project>" 

this searches through your project for instances of the flutter sdk in that project. I saw logs for the dummy project and that of the flutter project created with my window, but for this current project, it was showing **'No such directory found'**.

Well, my last resort was to open an issue on github, which I reluctantly did, as I saw thousands of opened issues, didn't even expect anyone to look at mine...

Well let's say someone did, and instantly noticed the problem.

# Solution

    The URL of the cloned project, had a space after the name, 
    and git used same pattern to create the directory on my 
    machine and this caused the whole problem.

Below is a link to the issue I opened and closed 💁🏽.

[Link to Github Issue](https://github.com/flutter/flutter/issues/105762)

Hope it helps.
Laravel Accessor and Mutator Example
Tags: laravel, php, laravel8, beginners
Published: 2022-06-10 11:24:56

In this article, we will see laravel accessor and mutator examples. here we will see what is accessor and mutator, how to use the accessor and mutator with example. laravel mutator is used to set attribute, laravel accessor is used to get attribute in laravel, below I have added more information of accessor and mutator with example

So, let's see laravel 8 mutator, laravel 8 accessor, laravel accessor with parameter.

What are Accessors? 

Accessors create a dummy attribute on the object which you can access as if it were a database column. So, if your database has a user table and it has FirstName and LastName column and you need to get your full name then it will be like.

Syntax of Accessors :

```
get{Attribute}Attribute
```

Example :

```
public function getFullNameAttribute()
{
  return $this->FirstName. " " .$this->LastName;
}
```

After that, you can get the full user name with the below accessors.

```
{{ $user->full_name }}
```

---
 
**_[Read Also : Laravel 8 Form Class Not Found](https://techsolutionstuff.com/post/laravel-8-form-class-not-found)_**

---
 
What is Mutator?

Mutator is used to set the value of the attribute. A mutator transforms an Eloquent attribute value when it is set.

How to define a mutator,

```
set{Attribute}Attribute
```
above method on your model where {Attribute} is the "studly" cased name of the column you wish to access.

Example : 

```
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Register extends Model
{
    /**
     * Set the user's first name.
     *
     * @param  string  $value
     * @return void
     */
    public function setNameAttribute($value)
    {
        $this->attributes['name'] = strtolower($value);
    }
}
```

Now you can use this in your controller.

```
use App\Models\Register;

$register= Register::find(1);

$register->name = 'Techsolutionstuff';
```
 
---

You might also like :

- **_[Read Also : Laravel REST API CRUD Tutorial](https://techsolutionstuff.com/post/laravel-rest-api-crud-tutorial)_**

- **_[Read Also : Laravel 8 Generate PDF Using DomPDF](https://techsolutionstuff.com/post/laravel-8-generate-pdf-using-dompdf)_**

- **_[Read Also : How To Create Cron Job Schedule In Laravel 7/8](https://techsolutionstuff.com/post/how-to-create-cron-job-schedule-in-laravel-7-8)_**
20 Array methods in Typescript you need to know with examples
Tags: array, methods, typescript, programming
Published: 2022-06-10 11:21:21

We, [programmers](https://blog.canopas.com/9-lessons-a-developer-can-learn-from-gym-262fd817494b), play with Arrays all the time, and yet most of the time we don’t know all helper functions provided by the TypeScript.

Pre-built functions have always been proved time-savers. Find the list of utility functions in typescript with demonstrations.

I have listed out 20 methods that you need to know, with fun emojis.

indexOf()
lastIndexOf()
concat()
join()
push()
pop()
reverse()
shift()
unshift()
slice()
splice()
toString()
filter()
map()
every()
reduceRight()
reduce()
some()
sort()
fill()
Full article with example available an on [canopas blog](https://blog.canopas.com/typescript-array-methods-and-their-usages-daa8d498b4fd).

The full source code is available on [Github](https://gist.github.com/nidhi-canopas/30b9a35533d0d2161e56f5d7ae642616).
The way up is down
Tags: beginners, programming, webdev, javascript
Published: 2022-06-10 11:13:17

Dumb yah!

After a careful long observation of life in my little life time I have Lived, I have found out that many people don't grow because they think people grow from the outside in rather then inside out. Like they want to be popular before they perfect the skills.
Many have made that mistake leading to short lived fame and some never got to the stage at all.
Growing from the inside out is burning the midnight candles, like putting yourself through all the necessary trainings before seeking for the spotlight. Normally, the spotlight will seek you when you are exceptional. 
Keep building yourself and helping others while doing so and the spotlight will seek you.
hostname Command in CLI
Tags: beginners, tutorial, cli, linux
Published: 2022-06-10 11:12:56

---
canonical_url: https://baransel.dev/post/cli-hostname-command/
---

> [Sign up to my newsletter for more tutorials!](https://baransel.dev/newsletter/).

You can find and set the name of your computer to make it easier for people to discover on a network using the `hostname` command.

### `hostname`

You will get a result saying your computer name and in my case it says `baransel.local`

The first part of the result is the name of the computer and the second part is the name of the domain.

### `hostname -s`

You can run the command above to return just the computer name.

The result will be simply `baransel` this time.

### `hostname -d`

Similarly, just use the command above to find out which domain you are on.

### `hostname -i`

You can find the IP address for the `hostname` using the command above.

### `hostname -a`

A hostname can be given a name, and you can find all the aliases of the computer you are using by typing the command above.

> If there are no aliases, your real hostname will be returned.

## How to Change `hostname`

You can change the `hostname` of the computer by typing the following command:

```commandline
hostname baranseldev
```

Now when you run the `hostname` command it will only show `baranseldev`.

> This change is temporary and not particularly helpful.

To permanently change your hostname, use the `nano` editor to open `/etc/hosts`.

```commandline
sudo nano /etc/hosts
```

You will need elevated privileges to edit the hosts file, and you can use the `sudo` command as shown above or switch users to root using the `su` command.

The `/etc/hosts` file has details about your computer and other machines on your network or other networks.

By default, your `/etc/hosts` file will contain something like:

```
127.0.0.1 localhost.localdomain localhost
```

The first item is the IP address to resolve for the computer. The second item is the computer's name and domain, and each subsequent field provides an alias for the computer.

To change the hostname, you can simply replace `localhost.localdomain` with the computer name and domain name.

Example:

```
127.0.0.1 baranseldev.mydomain localhost
```

After saving the file, run the `hostname` command, and you will get the following result:

```
baranseldev.mydomain
```

> Similarly, `hostname -d` is shown as `mydomain` and `hostname -s` is shown as `baranseldev`.
Salary report: What remote developers who earn $100K+ do differently
Tags: salary, career, news
Published: 2022-06-10 11:10:39

Developer jobs consistently rank in the top 10 highest paying professions. Still, not every developer around the world gets paid sky-high salaries. So, we analyzed salary data of 3,070 global remote software developers to find out what developers earning over $100,000 (USD) per year do differently.

We found some interesting insights. Developers who earn $100,000 or more per year tend to work in certain disciplines, roles, and companies. Here's what you need to know if your goal is earning a six-figure salary in the near future:

**Discipline: **
Remote devs with $100K+ salaries are less likely to be front-end developers than those earning less than $100K. 

![Graph showing remote developers with $100K+ salaries are less likely to be front-end developers than those earning less than $100K](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9ufn0muiix22i4m58jzl.png)

So, if you are a junior or aspiring developer still deciding what to specialize in, you may benefit from looking at other higher-paying disciplines. However, if you are passionate about frontend development, you can still earn a higher salary by being strategic about other things such as the business stage, country of the employer headquarter, or role titles.

**Business stage: **

a. Remote devs with $100K+ salaries are significantly more likely to work in public companies than those earning less than $100K.
b. Remote devs with $100K+ salaries are significantly less likely to work in early-stage startups than those earning less than $100K.

![Graph showing remote devs with $100K+ salaries are significantly more likely to work in public companies than those earning less than $100K](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/no9bpwtn2m4tkces6xxq.png)

Working for a public company might also be a safer choice in the current environment of economic downturn and funding slowdowns.

**Country of employer HQ:** 
Remote devs with $100K+ salaries are significantly more likely to work with US employers.
This is good news because many US employers now hire globally with the rise in remote work. So, working for employers in America may be an option worth considering if you are a non-US-based developer.

[Check out the full report here.](https://arc.dev/developer-blog/what-remote-developers-earning-100k-do-differently/)
Sum of Digits of String After Convert
Tags: leetcode, dsa, theabbie
Published: 2022-06-10 11:00:46

You are given a string `s` consisting of lowercase English letters, and an integer `k`.

First, **convert** `s` into an integer by replacing each letter with its position in the alphabet (i.e., replace `'a'` with `1`, `'b'` with `2`, ..., `'z'` with `26`). Then, **transform** the integer by replacing it with the **sum of its digits**. Repeat the **transform** operation `k` **times** in total.

For example, if `s = "zbax"` and `k = 2`, then the resulting integer would be `8` by the following operations:

*   **Convert**: `"zbax" ➝ "(26)(2)(1)(24)" ➝ "262124" ➝ 262124`
*   **Transform #1**: `262124 ➝ 2 + 6 + 2 + 1 + 2 + 4 ➝ 17`
*   **Transform #2**: `17 ➝ 1 + 7 ➝ 8`

Return _the resulting integer after performing the operations described above_.

**Example 1:**

**Input:** s = "iiii", k = 1
**Output:** 36
**Explanation:** The operations are as follows:
- Convert: "iiii" ➝ "(9)(9)(9)(9)" ➝ "9999" ➝ 9999
- Transform #1: 9999 ➝ 9 + 9 + 9 + 9 ➝ 36
Thus the resulting integer is 36.

**Example 2:**

**Input:** s = "leetcode", k = 2
**Output:** 6
**Explanation:** The operations are as follows:
- Convert: "leetcode" ➝ "(12)(5)(5)(20)(3)(15)(4)(5)" ➝ "12552031545" ➝ 12552031545
- Transform #1: 12552031545 ➝ 1 + 2 + 5 + 5 + 2 + 0 + 3 + 1 + 5 + 4 + 5 ➝ 33
- Transform #2: 33 ➝ 3 + 3 ➝ 6
Thus the resulting integer is 6.

**Example 3:**

**Input:** s = "zbax", k = 2
**Output:** 8

**Constraints:**

*   `1 <= s.length <= 100`
*   `1 <= k <= 10`
*   `s` consists of lowercase English letters.

**SOLUTION:**

    class Solution:
        def getLucky(self, s: str, k: int) -> int:
            op = ""
            for c in s:
                op += str(ord(c) - ord('a') + 1)
            for i in range(k):
                op = str(sum([int(d) for d in op]))
            return int(op)
Flask: convert an existing app to Application Factory pattern
Tags: discuss, flask, python, refactoring
Published: 2022-06-10 10:54:54

---
title: Flask: convert an existing app to Application Factory pattern
published: true
description: 
tags: ["#discuss", "#flask", "#python", "#refactoring"]
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mtk102pzkn6rwwjdyzxa.jpg
---

I'm on the path to convert a big existing app to Application Factory pattern. The current state is import orders (you know with at the end of the app file stuff like : 

```
from . import models
from .api import ep as ep_blueprint
```

Or import app in some functions which create circular imports etc .. 

Before I jump in it, do you have some advices or strategy in mind ? A plan maybe ?
Middle Number of Linked List.
Tags: c, linkedlist, beginners
Published: 2022-06-10 10:47:46

Given a non-empty singly linked list, let us find the middle number.

If there are even nodes in the linked list, then there would be two middle nodes so out of two we need to print the second node number.

Example - 1
Input : Linked list : 1 2 3 4 5
output : Middle number : 3 

Example - 2
Input : Linked list : 6 7 8 9 2 1
output : Middle number  : 9 

## Steps :

* Create two pointers of type struct node and point both pointers to `head` initially say,
`* fast` = `head`  and
 `* slow` = `head`

* Make the pointer `fast` twice as fast as pointer `slow` by incrementing pointer `fast` by two positions and pointer `slow` by one position until pointer `fast` and `fast->next` is not NULL.

* When the pointer `fast` reaches to the end of the linked list, pointer `slow` would still be at the middle, thereby pointing to the mid of the linked list. 

* Return the value at pointer `slow`. 
i.e., return `slow->data`.

## C program that finds the middle number of the given linked list.


```
#include <stdio.h>
#include <stdlib.h> 
 
struct node
{
    int data;
    struct node * next;
};  
  
void displayLL(struct node * head)
{
    int num = 0;
    struct node * temp;
    temp = head;
    temp=head;
    while(temp!=0)
    {
       printf("%d ",temp->data);
       temp = temp->next;
       num++;
    }
} 
 
void middleNode(struct node *head) 
{ 
    struct node *slow = head; 
    struct node *fast = head; 
    
    if (head!=NULL) 
    { 
        while (fast != NULL && fast->next != NULL) 
        { 
            fast = fast->next->next; 
            slow = slow->next; 
        } 
    }
    printf("\nMiddle number : %d", slow->data);
} 
 
int main()
{
   struct node *head = 0, *newnode, *temp; 
   int n, choice, newdata;
  
// Create Linked List //
  
   printf("Enter the number of nodes in the list : ");
   scanf("%d", &n);
   for(int i = 1; i<=n; i++)
   {
   newnode = (struct node *)malloc(sizeof(struct node));
   printf("Enter the data%d : ", i);
   scanf("%d", &newnode->data);
   newnode->next = 0;
   if(head == 0)
    {
        head = temp = newnode;
    } 
    else
       { 
        temp->next = newnode;
        temp = newnode;
       }
 }
   printf("--------------------------------\n");
   printf("Linked list : ");
   displayLL(head);
   middleNode(head);
}
```

I own a website www.coderlogs.com where in I write similar blogs so do visit the website for more such blog posts.
Gorge on to some scrumptious Bengali sweets at the Cultures of Dubai only at KALEVA.
Published: 2022-06-10 10:24:29

A foodie's paradise is located in the heart of the city that never sleeps, yet far from the clamour and bustle of DUBAI. It's a place where the atmosphere is always lively, the vibrations are palpable, and the feel is easily unpretentious. This is KALEVA- KALEVA, the real taste of India
KALEVA's menu is a fusion of Indian cuisine with modern innovation. We serve Bengali sweets that are expertly produced but strong in flavour, anchored in heritage while exploring the contemporary Indian palate. KALEVA creates contemporary dishes by combining the earthy flavours of India with Indian ingredients and inventive culinary techniques.
KALEVA delivers mouth-watering cuisine with an Indian flair. Prepare to fall in love with our 100% vegetarian menu, as well as robust flavours that are as authentic as those found in any Indian restaurant in Dubai.
While KALEVA is proud of its internal family for sticking with the brand through the highs and lows, the patrons who believed in the brand and trusted us to always provide them clean, safe, and undisturbed food are the reason for the company's success.
KALEVA- KALEVA the real taste of India.
https://orders.kaleva.ae/order-online/
Suggest some project ideas..
Tags: webdev, beginners, help, discuss
Published: 2022-06-10 10:14:02

I have learned and applied NodeJS, ExpressJs and MongoDB in building a simple video rental application.
It involves basic CRUD operaions and also includes user authorization and authentication using JsonWebTokens(JWTs).

Currently learning SQL and PostgreSQL. What other skills should I get familiar with to become a better backend developer?
Add Two Numbers
Tags: leetcode, dsa, theabbie
Published: 2022-06-10 10:00:47

You are given two **non-empty** linked lists representing two non-negative integers. The digits are stored in **reverse order**, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.

You may assume the two numbers do not contain any leading zero, except the number 0 itself.

**Example 1:**

![](https://assets.leetcode.com/uploads/2020/10/02/addtwonumber1.jpg)

**Input:** l1 = \[2,4,3\], l2 = \[5,6,4\]
**Output:** \[7,0,8\]
**Explanation:** 342 + 465 = 807.

**Example 2:**

**Input:** l1 = \[0\], l2 = \[0\]
**Output:** \[0\]

**Example 3:**

**Input:** l1 = \[9,9,9,9,9,9,9\], l2 = \[9,9,9,9\]
**Output:** \[8,9,9,9,0,0,0,1\]

**Constraints:**

*   The number of nodes in each linked list is in the range `[1, 100]`.
*   `0 <= Node.val <= 9`
*   It is guaranteed that the list represents a number that does not have leading zeros.

**SOLUTION:**

    # Definition for singly-linked list.
    # class ListNode:
    #     def __init__(self, val=0, next=None):
    #         self.val = val
    #         self.next = next
    class Solution:
        def addTwoNumbers(self, l1: Optional[ListNode], l2: Optional[ListNode], carry=0) -> Optional[ListNode]:
            if l1 or l2:
                l1val = l1.val if l1 else 0
                l2val = l2.val if l2 else 0
                currval = l1val + l2val + carry
                curr = ListNode(val = currval % 10)
                curr.next = self.addTwoNumbers(l1.next if l1 else None, l2.next if l2 else None, carry = currval // 10)
                return curr
            else:
                if carry > 0:
                    return ListNode(val = carry)
                return None
Tip for evaluating file size with linux command
Published: 2022-06-10 09:51:52

---
title: Tip for evaluating file size with linux command
published: true
description: I wanna just know the code size of current folder and wanna share this cod snippet with u. Give a try in your src folder 
tags: 
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
---

I wanna just know the code size of current folder and wanna share this cod snippet with u. Give a try in your src folder . You will see there are some candidates, which might be too large and need to be refactored in the future. 
> For example: Service/Import.php with 1185 lines, and it does definitively too much and should be refactored.

```php
cd src
find . -name '*.php' | xargs wc -l | sort -nr

20844 total
    1791 ./Service/PageGenerator.php
    1185 ./Modules/Importer/Service/Import.php
     542 ./Entity/Base/Area.php
     447 ./Entity/PublicInfo.php
     363 ./Controller/FrontendController.php
     339 ./Modules/MyAPI/Provider/Dto/AreasDto.php
     307 ./Entity/Base/OpeningTime.php
     298 ./Entity/Opening.php
     290 ./Entity/SpecialSale.php
     289 ./Modules/Exporter/Model/ExportStoresModel.php
     258 ./Entity/User.php
     232 ./Modules/MyAPI/Provider/Dto/PublicInfoDto.php
     230 ./Repository/StoreRepositoryDBAL.php
     221 ./Repository/StoreRepository.php
     214 ./Entity/Base/TemporaryClosing.php
     205 ./Controller/OpeningController.php
     196 ./Entity/Base/Competitor.php
     178 ./Form/PublicInfoType.php
     177 ./Modules/Exporter/Api/Bing/Stores.php
     177 ./Form/OpeningType.php
     173 ./Form/SpecialSaleType.php
     166 ./Entity/Base/StatusDevelopment.php
```

[UPDATED] for the users, who is using `zsh`, can just use this shortcut:
```sh
$ cd src
$ wc -l **/*.php | sort -nr
```

Sure, there are lots of code static tools that can do the same job. But this command is just handy 💫