teleren/devto huggingface dataset:
1598. Crawler Log Folder
Tags: php, leetcode, algorithms, programming
Published: 2024-07-10 18:10:26

1598\. Crawler Log Folder

Easy

The Leetcode file system keeps a log each time some user performs a _change folder_ operation.

The operations are described below:

- `"../"` : Move to the parent folder of the current folder. (If you are already in the main folder, **remain in the same folder**).
- `"./"` : Remain in the same folder.
- `"x/"` : Move to the child folder named `x` (This folder is **guaranteed to always exist**).

You are given a list of strings `logs` where `logs[i]` is the operation performed by the user at the <code>i<sup>th</sup></code> step.

The file system starts in the main folder, then the operations in `logs` are performed.

Return _the minimum number of operations needed to go back to the main folder after the change folder operations_.

**Example 1:**

![sample_11_1957](https://assets.leetcode.com/uploads/2020/09/09/sample_11_1957.png)

- **Input:** logs = ["d1/","d2/","../","d21/","./"]
- **Output:** 2
- **Explanation:** Use this change folder operation "../" 2 times and go back to the main folder.

**Example 2:**

![sample_22_1957](https://assets.leetcode.com/uploads/2020/09/09/sample_22_1957.png)

- **Input:** logs = ["d1/","d2/","./","d3/","../","d31/"]
- **Output:** 3

**Example 3:**

- **Input:** logs = ["d1/","../","../","../"]
- **Output:** 0

**Constraints:**

- <code>1 <= logs.length <= 10<sup>3</sup></code>
- `2 <= logs[i].length <= 10`
- `logs[i]` contains lowercase English letters, digits, `'.'`, and `'/'`.
- `logs[i]` follows the format described in the statement.
- Folder names consist of lowercase English letters and digits.

**Solution:**


```
class Solution {

    /**
     * @param String[] $logs
     * @return Integer
     */
    function minOperations($logs) {
        $depth = 0;

        foreach ($logs as $log) {
            if ($log == "../") {
                if ($depth > 0) {
                    $depth--;
                }
            } elseif ($log != "./") {
                $depth++;
            }
        }

        return $depth;
    }
}
```



**Contact Links**

If you found this series helpful, please consider giving the **[repository](https://github.com/mah-shamim/leet-code-in-php)** a star on GitHub or sharing the post on your favorite social networks 😍. Your support would mean a lot to me!

If you want more helpful content like this, feel free to follow me:

- **[LinkedIn](https://www.linkedin.com/in/arifulhaque/)**
- **[GitHub](https://github.com/mah-shamim)**
HIRE A HACKER
Published: 2024-07-10 18:44:06

The cryptocurrency market has seen a surge in demand for recovery assistance services. As more people enter the exciting yet unpredictable world of cryptocurrency, the need for specialized help in recovering lost investments has become increasingly apparent. And that's where INTELLIGENCE CYBER WIZARD comes into play - your knight in shining code, dedicated to helping you regain what's rightfully yours. So, who exactly is this INTELLIGENCE CYBER WIZARD, you ask? Well, they're a team of experienced professionals who have mastered the art of recovering lost investments in the cryptocurrency realm. With their extensive knowledge and expertise, they've helped countless individuals like us reclaim what they've lost. Reach out to INTELLIGENCE CYBER WIZARD.

E-mail: intelligencecyberwizard@gmail.com

WhatsApp: +216 53 126 882

Zangi: 1036577840
HIRE A HACKER
Published: 2024-07-10 18:54:49

The cryptocurrency market has seen a surge in demand for recovery assistance services. As more people enter the exciting yet unpredictable world of cryptocurrency, the need for specialized help in recovering lost investments has become increasingly apparent. And that's where INTELLIGENCE CYBER WIZARD comes into play - your knight in shining code, dedicated to helping you regain what's rightfully yours. So, who exactly is this INTELLIGENCE CYBER WIZARD, you ask? Well, they're a team of experienced professionals who have mastered the art of recovering lost investments in the cryptocurrency realm. With their extensive knowledge and expertise, they've helped countless individuals like us reclaim what they've lost. Reach out to INTELLIGENCE CYBER WIZARD.

E-mail: intelligencecyberwizard@gmail.com

WhatsApp: +216 53 126 882

Zangi: 1036577840
benefits of parcel as a bundler
Tags: systemdesign, webdev, javascript, programming
Published: 2024-07-10 19:12:37

## benefits of parcel 
  - dev tools
  - HMR - hot modules replacement <basically refreshes the file as we save the file> 
  --->> how - by using file watching algorithms made in c++ which keep track of your code and as soon as 
        you try to save the file it refreshes the server with new code
  - local server <http://localhost:1234>
  -  cache memory mang. ---> makes its fast
  - image optimization
  - compresses the file <minify>
  - bundling
  - content hashing
  - differential bundling **babel** 
  - can also run on ssl https
  - tree shaking ---> removing the extra code or function which are not used 



    **content hasing :** -Content hashing in Parcel involves generating unique SHA-256 hashes for each file based on its content. Before deploying the application, Parcel compares these hashes with those stored in its cache directory ( .parcel-cache). If a file's hash matches its cached version, Parcel uses the cached file, avoiding unnecessary rebuilds and optimizing deployment speed. When a file's content changes, its hash updates, prompting Parcel to rebuild only the modified files and update them on the server. This approach not only improves build performance by reusing unchanged files but also ensures that browsers receive updated content reliably through unique filenames based on file hashes, preventing caching issues during deployment.



     **hmr in detail** - so basically when file is modified i.e its hash is now different that of older version the modified file is only updated in the browser and all the other file whose hash are same of older hash uses the .parcel-cache file which reduce the time and avoid the rebuilding the whole application from scratch and this all thing is triggered every time when the programmer save the file && the browser is running that application (live) 



     **differential bundling :** since babel is used for bundling in parcel -- it perform several task 
     - babel convert the es6+ js code into the es5 code which necessary for you application to run in older browser 
     - It convert the jsx code of react into the js code (jsx into js object (ast)) as we all know browser's v8 engine is unable to understant the jsx code 
     - It also convert typescript in JavaScript as TS is superset of js that add static type to js
Discover Advanced Facial Tightening Treatments for a Youthful Glow
Published: 2024-07-10 19:27:09

Discover advanced facial tightening treatments designed to rejuvenate your skin and reveal a youthful glow. Experience the latest in non-invasive technology for a firmer, radiant complexion.

[Facial Vaughan](https://bfancy.ca/facial-vaughan/
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j0jzps7zhmj6icqizwei.jpg))
Motoring Offence Solicitors
Published: 2024-07-10 19:30:11

Need expert legal help for motoring offences? Look no further than Motoring Defence, your trusted UK-based firm with dedicated [motoring offence solicitors](https://www.motoringdefence.co.uk/). They specialise in providing strategic defence and expert advice tailored to your case. Whether it's speeding, DUI, or traffic violations, their team is here to protect your rights and secure the best possible outcome. Count on Motoring Defence for reliable representation and a commitment to achieving justice for you.
Tutorial: SwiftUI Character Limit in a TextField
Tags: swiftui, swift, textfield
Published: 2024-07-10 23:07:10

Here is a simple, but handy tutorial for limiting the number of characters in a TextField. I use this in my app [Recitation](https://www.recitation-app.com/) to limit the number of characters that the user can have for different tags.

Validated for Swift Version 5.9

## Step 1: Combine & Just()

```
import Combine
```
Per Apple's documentation, the Combine framework ["provides a declarative Swift API for processing values over time. These values can represent many kinds of asynchronous events. Combine declares publishers to expose values that can change over time, and subscribers to receive those values from the publishers."](https://developer.apple.com/documentation/combine) It's use for us today is the Just() function, which is a publisher used to return a result a singular time.

## Step 2: Limit Text Function

```
func limitText(_ limit: Int) {
    if subTaskText.count > limit {
        subTaskText = String(subTaskText.prefix(limit))
    }
}
```
This function uses the parameter limit to determine if subTaskText (the string holding the user's typed text) is greater than the imposed character limit. If the user attempts to type additional characters beyond the limit, the subTaskText will be truncated to the limit.

## Step 3: Implementation

```
VStack {
    TextField("The next thing to do...", text: $subTaskText)
        .font(.custom("Quicksand", size: 20))
        .focused($isFocused)
        .onReceive(Just(subTaskText)) { _ in limitText(textLimit) }
}

```
To implement the character limit function, we simply add the .OnReceive modifier to the TextField.
"Innovative Ecosystem for AI-Powered Art and NFTs"
Tags: sacrediamondgeometrynfts, nfts, blockchain, polygon
Published: 2024-07-10 19:50:44

"Empowering artists and developers with AI, blockchain, and web development tools."

Introduction
We're excited to introduce our groundbreaking project, an innovative ecosystem designed to merge AI-powered art generation, blockchain technology, and web development tools. 

Our platform aims to empower artists, developers, and enthusiasts by providing a comprehensive suite of applications for creating, sharing, and 
Project Overview
Our ecosystem consists of five interconnected applications:

1:Art Generation Tool Use AI to create stunning digital art based on user inputs.

2:Payment Processing System:
Handle cryptocurrency transactions securely and efficiently.

3:NFT Crafting Platform: Combine unique art elements to create and mint NFTs on the blockchain.

4:Social Network Share your creations, interact with other artists, and build a vibrant community.

5: Web Development Assistant: Streamline web development workflows with advanced tools and automation.

Who is This For?
Our platform is designed for:NFT Artists: Easily create and mint unique digital art and NFTs.

Developers: Access powerful tools to streamline your development workflows.

Art Enthusiasts: Discover and share amazing digital art within a supportive community.

Benefits
Innovative Tools: Leverage AI and blockchain technology to enhance your creative process.

Secure Transactions: Handle payments with ease and confidence using our integrated payment system.

Community Engagement: Connect with like-minded individuals and showcase your work.

Key Features:AI-Powered Art Generation: Create beautiful digital art with just a few clicks.

NFT Minting: Mint your creations as NFTs on the blockchain seamlessly.

Secure Payments: Process cryptocurrency transactions with top-notch security.

Community Platform: Share your work and connect with other artists and developers.

Development Tools: Access a suite of tools to optimize your web development projects.

Join me
us we invite you to join our growing community of artists, developers, and enthusiasts. Stay tuned for updates, or participate in our beta testing, and be among the first to experience the future of digital art and NFTs.

For more information about beta testing or to receive updates of the project email:
denissesanchezds@yahoo.com
How to Invoke AWS Lambda Functions from Amazon SQS Message
Tags: aws, cloud, architecture, cloudcomputing
Published: 2024-07-10 20:06:02


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

**To invoke AWS Lambda functions from an Amazon SQS (Simple Queue Service) message, you need to create an event source mapping that connects the SQS queue to the Lambda function.**

**I have used this code :**
import json

def lambda_handler(event, context):
    for record in event['Records']:
        # SQS message body
        body = record['body']
        print(f"Message Body: {body}")
        # Process the message here
        # ...
    return {
        'statusCode': 200,
        'body': json.dumps('Success')
    }




1. Create an SQS Queue
2. Create an AWS Lambda Function
3. Set Up Event Source Mapping
4. Grant Permissions



**Summary:**
By following these steps, your Lambda function will be invoked whenever a new message is sent to your SQS queue. The Lambda function will process the messages as they arrive, allowing you to handle them asynchronously.

If you have specific requirements or configurations, feel free to share, and I can provide more detailed guidance.
Slack chatGPT AI bot
Tags: aitools, slackchatbot, chatgpt, aibot
Published: 2024-07-10 20:41:40

## Features

> 1. OpenAI chatGPT bot for [Slack app](https://app.slack.com/) mostly used in corporate  
> 2. This bot is another app to be used as a chatGPT integrated there  
> 3. .env file for all generated tokens  

---

## Working


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

---

## Tokens used

1. SLACK_BOT_TOKEN
2. SLACK_APP_TOKEN
3. OPENAI_API_KEY

---

## Applications used 

1. [Slack web app](https://app.slack.com/)  
2. [Chat GPT](https://platform.openai.com/)
 
---

## How to's 

### 1. generate OpenAI token 

Step 1: Navigate to [openAI web app](https://platform.openai.com/settings/profile?tab=api-keys)  
Step 2: Login and click on **Create new secret key** button  
Step 3: Provide a name to the token to be generated & click on **Create secret key** button  
Step 4: Paste the token hence generated

### 2. Create & configure app in slack 

Step 1: Navigate to [Slack API web app](https://api.slack.com/apps?new_app=1)  
Step 2: Click on **Create New App** button  
Step 3: Click **from scratch** >> provide App name >> Select the workspace from your profile >> Click on **Create App**  
Step 4: Go to **OAuth & Permissions** from left menu bar >> Add Bot token scopes (chat:write & chat:write.public)  
Step 5: Click on **Install to workspace**  >> Click **Allow** button  
Step 6: Copy the **Bot User OAuth Token** hence generated  
Step 7: Go to **Basic Information** >> App-Level Tokens >> Generate Token and Scopes >> Provide any token name >> Add Scope (connections:write) >> Click on **Generate**  
Step 8: Copy the token hence generated
Step 9: Go to **Socket Mode** & enable socket mode
Step 10: Go to **Interactivity & Shortcuts** & enable it(if not already)  
Step 11: Go to **Event Subscriptions** >> enable **Enable Events** >> Click on **
Subscribe to bot events** >> Add Bot user events (message.im & app_mention) >> Click on **Save Changes**  
Step 12: Now, reinstall the app (As we've done in step 5)  
Step 13: Go to **App Home** >> Enable **Allow users to send Slash commands and messages from the messages tab**  

---

## How to run

1. First run the python script
2. Then, navigate to the slack web app and type the prompt  
3. You'll get response in slack web app  

---

## Bibliography

[Linkedin post](https://www.linkedin.com/posts/nitin30kumar_connections-streamline-communication-activity-7216512913161781248-er-Z?utm_source=share&utm_medium=member_desktop)  
[GitHub Repo](https://github.com/nitinkumar30/slack_chatBot/)  
[Reference YouTube Link](https://youtu.be/Luujq0t0J7A?si=4Eqm3vjPnXSmmftn)

---

## Author

[Nitin Kumar](https://linkedin.com/in/nitin30kumar/)  

---

Keep building bots !!
United Constructors Inc.
Published: 2024-07-10 20:26:18


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


United Constructors, Inc. is a family-inspired company. The family business of construction started generations ago with grandpa building his own house. Cash’s father, Jerry, started serving the Bay Area doing kitchen and bathroom remodeling in 1989 and has passed the torch to his sons and they are following in the family footstep!We are proud to say that we have had three generations of the Payne family in this industry and have since the beginning. United enjoys the privilege of many talented people with appropriate licenses, providing us the ability to accomplish multiple tasks within one company. We are a personable and diverse team. Being family owned we are empathetic to the value of quality customer service; therefore, this is our number one aspect and concern, and it is the foundation on which we have built our company. United has grown into a large force in the construction industry here in the Bay Area. We follow the motto of “Do the right thing”. United Constructors Inc. has been constructing for over 40yrs, and has the knowledge and experience in adu remodels, kitchen and bathroom remodeling, and sveral emergency services such as plumbing, electrical and roofing. The job is not to small or too big for the team at United Constructors Inc. Cash is motivated and looks forward to keeping the family tradition going for many years to come. Providing excellent service and dedication to our many valued happy customers. We value the people that work with us at United Constructors Inc, and we welcome all of our clients into our big family of happy clients.

United Constructors Inc.
Address: 1251 Stone Valley Rd, Alamo, California 94507, US
Phone: 925-487-2623
Website: [https://www.unitedconstructorsinc.com/](https://www.unitedconstructorsinc.com/)
Contact email: theunitedconstructorsinc@gmail.com

Visit Us:
[United Constructors Inc. Facebook](https://www.facebook.com/people/United-Constructors-Inc/61557943663194/)
[United Constructors Inc. YouTube](https://www.youtube.com/@unitedconstructorsinc)
[United Constructors Inc. LinkedIn](https://www.linkedin.com/in/cash-payne-389a07aa/)

Our Services:
Kitchen Remodeling
Bathroom Remodeling
ADU Construction
Landscaping
Plumbing
Emergency plumbing and electric
Properties and attributes in Python
Tags: python, properties, attributes
Published: 2024-07-11 19:17:30

When writing code in Python there are many different functions you can write. In these functions you can create attributes and property.

The definition of attributes are variables that belong to an object. The definition of properties are attributes that are controlled by methods.

An example of attributes and properties are below. 

**Attributes:**

    class Traveler:
        some attribute= "All members of this class will have this attribute."
        def __init__(self, name):
             self.name = name

name is an attribute of the traveler class. Since it is inside the function it is instance attribute. 

Some attribute will be same for all the travelers while the name can change for each traveler. 

The traveler class can have many attributes like age, height etc... These attributes provide more information about the class. Similar to props in React. 

**Properties:**
In adding to the code above you can get and set the name using some parameters. Then you would have a property for the name. 

    def get_name(self):
        return self._name

    def set_name(self, name):
        if type(name)==str and len(name) > 0:
             self._name = name
        else:
             print("Name needs to be a string and longer than 0 characters.")

name = property(get_name,set_name)

get_name gets the name and then set name sets the name with the parameters in the code. When the name is input not following those parameters the console prints out an error message on what the requirements are. Then the property calls get_name and set_name when the property is called. See below for a way to call the property for name. 

some_traveler = Traveler(name="Spencer")

name equaling Spencer is passed into the Traveler class and the property name is called. It gets the name and then sets it. Since it is a string and greater than 0 characters it is able to set it without an error message. Now when some_traveler.name is called it will be Spencer.
How to install the most recent Python in your Synology diskstation
Tags: python, anaconda, synology, nas
Published: 2024-07-10 20:50:35

Synology, the taiwanese manufacturer of the best NASes in the world, deliveres its devices with a [RTD1619B](https://gadgetversus.com/processor/realtek-rtd1619b-specs/) processor, which is based the in ARM-64 architecture (also known as aarch64). I possess a [NAS DS223j](https://www.synology.com/en-br/products/DS223j#specs), after owning a DS212j for 11 years since 2012.
Being a Python-savyy developer, it is unfortunate that Synology does not ship its NASes with Python support built-in, so I have to download its Python distribution using the Package Center for the Diskstation. THe problem is that it is a old version of Python: 3.8, which was shipped more than 4 years ago. I need to use the most recent features of Python, so it is an handicap had to use and old Python.
The alternative to use the most recent Python (at the time of this article is 3.21), you can use the Python shipped by Anaconda, which provides a package manager compiled statically available for download called **micromamba**, which you can download by following the instructions at [mamba.readthedocs.io](https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html#mamba-org-releases).
Here are the steps:

1. In a bash shell, execute `curl -Ls https://micro.mamba.pm/api/micromamba/linux-aarch64/latest | tar -xvj bin/micromamba`
2. This will download the `micromamba` binary into the `bin` subfolder
3. Then, execute `./bin/micromamba shell init -s bash `. This will add a initialization snippet into the `.bashrc` file.
4. Then, do a `source ~/.bashrc` and `micromamba activate && micromamba config append channels conda-forge`
5. The last command will configure micromamba to download the last releases of a python basic development environment which can started by `micromamba install`
6. Once there, execute the `python` executable and voila, you have a very recent compiled python, perhaps no more than 1 month old ! The basic installation also installs `pip`, so you have all the power of Python on your hands!

References:

- <https://avivleemann.github.io/blog/blog/posts/2023-12-07-micromamba/micromamba-guide.html>
- <https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html#mamba-org-releases>


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aahienvm6l2beiat2gdv.jpg)
Most In-Demand Programming Languages in Europe and Worldwide: A Discussion
Tags: beginners, career, discuss, programming
Published: 2024-07-10 21:27:23

🌍 What programming languages do you think are most in demand in Europe and worldwide?

💬 Share your thoughts and experiences in the comments!

🤔 We’re curious to hear your perspectives on which languages are leading the job market and why they are so sought after. 

📊📱💻 Whether it's for web development, mobile apps, data science, or other fields, let's discuss the trends and factors driving the demand for different programming languages. 👋🏼