teleren/devto huggingface dataset:
Python Generators: The Magic of On-Demand Delivery
Tags: webdev, tutorial, programming, python
Published: 2023-12-15 09:40:32

**Prerequisites**

Before diving into Python generators, understanding Python fundamentals—variables, functions, and iteration—is recommended. Basic concepts like loops, data types, and function calls will aid in grasping how generators operate within Python

**How generators work**

Imagine entering a mystical bakery where the pastry chef prepares every delicious dessert fresh, just for you, instead of prebaking them all. This is similar to how Python generators operate in that each item is generated precisely when needed rather than creating everything at once.

It's like ordering a set meal in standard Python functions—everything is provided to you at once. Generators, meanwhile, are like being at a buffet where the chef is preparing food as you are pointing to it. A generator function does not execute all of the stages at once when you call it. Instead, it uses the 'yield' keyword to begin creating objects when you ask for them.

```
def infinite_sequence():
    num = 0
    while True:
        yield num
        num += 1

gen = infinite_sequence()

print(next(gen))  # Outputs: 0
print(next(gen))  # Outputs: 1
print(next(gen))  # Outputs: 2
# ...and so on

```
The code snippet demonstrates a generator function infinite_sequence() that generates an infinite sequence of numbers. Instead of creating a massive list of numbers upfront, it generates them one by one as needed. Each time next() is called on the generator object, it yields the next number in the sequence.

Generators are indispensable in several programming scenarios, serving as invaluable tools in data-intensive tasks. They find frequent application in:

1. Working with Large Datasets: Generators are excellent for processing large datasets that can't fit entirely into memory.

2. Stream Processing: Real-time data streams from sensors, network connections, or continuous log files can be efficiently handled using generators.

3. Efficient Iteration: Generators offer memory-efficient iteration when dealing with collections like lists, sets, or dictionaries.

4. Parallel Processing and Pipelining: They allow the creation of data processing pipelines, ideal for complex workflows.

5. Memory Optimization: Generators significantly reduce memory usage by generating values on-the-fly.

Generators let you work with enormous volumes of data or infinite sequences without taxing the memory of your system, much like magicians creating objects out of thin air. Programming becomes a bit more magical and a lot more efficient with Python's generators, which provide an amazing way to manage resources efficiently and complete complicated jobs with ease!
variable declaration in typeScript
Published: 2023-12-15 09:37:38

let-const-var

let variableName: type
const constantName: type = value
var oldStyleVariableName: type

normal function 

function functionName(params1: type, params2: type): returnType {
   
}

arrow function
const arrowfunction =(param1:type,param2:type):returntype=>{
}


enum
enum EnumName {
    VALUE1,
    VALUE2,
    VALUE3,
}


any new knowedge please let me know in comment section
Setup Docker Development for Frontend
Tags: webdev, javascript, devops, aws
Published: 2023-12-15 09:20:03

Setting up the frontend side is easier than the backend side because our client app does not depend on external services or packages. You can see the full code [here](https://github.com/akbarnafisa/aws-devops-fullstack/tree/5-setup-docker-development-for-frontend).

## Create Dockerfile

Since our client app does not import code from the `validation` or `libs` package, we only import our client app alone, unlike the server app.


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



## Update API URL

Because our `API URL` depends on the port in the server app, we need to move the `API URL` value to the environment variables. Make sure the variable value has the **`VITE_`** prefix; otherwise, the variable cannot be detected by Vite.

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

## Add Docker Compose File

For the client service, we need to import the Dockerfile, mount the local file to Docker, add the environment variables, and also make sure that we add **`--host`** to the command to ensure we can expose the port.


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



If you encounter an issue where the hot reload is not working, make sure you add the **`usePolling`** configuration in **`vite.config.ts`**.

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

To run the app, we need to execute the command **`yarn compose:dev up`**. This command will build and create a new container for us to run.
gdb的使用
Published: 2023-12-15 09:07:20

关于next和step的区别：next不会进入函数中，而step会进入

n有时也可以进入函数内部，如下
```c++
#include <iostream>
#include <vector>

// 函数用于计算向量元素的总和
int sum(const std::vector<int>& numbers) {
    int total = 0;
    for (int num : numbers) {
        total += num;
    }
    return total;
}

int main() {
    std::vector<int> numbers = {1, 2, 3, 4, 5};

    // 故意制造的错误: 应该是 <= 而不是 <
    for (size_t i = 0; i < numbers.size(); i++) {
        numbers[i] = i;
    }

    int result = sum(numbers);

    std::cout << "Sum of vector elements: " << result << std::endl;

    // 一个可能导致程序崩溃的错误
    int* ptr = new int(10);
    delete ptr;
    *ptr = 20; // 悬垂指针

    return 0;
}
```
我们在main 和sum处打断点，那么，当我们用c之后到了断电num处时，在使用n就会进入函数内部
C: Strings
Tags: c, cheatsheet
Published: 2023-12-15 08:53:03

```
char greetings[] = "Hello World!";
printf("%s", greetings);
```
access string
```
char greetings[] = "Hello World!";
printf("%c", greetings[0]);
```
modify string
```
char greetings[] = "Hello World!";
greetings[0] = 'J';
printf("%s", greetings);
// prints "Jello World!"
```
Another way to create a string
```
char greetings[] = {'H','e','l','l','\0'};
printf("%s", greetings);
// print "Hell!"
```
Creating String using character pointer (String Literals)
```
char *greetings = "Hello";
printf("%s", greetings);
// print "Hello!"
```
**NOTE**: String literals might be stored in read-only section of memory. Modifying a string literal invokes undefined behavior. You can't modify it.!
`C` **does not** have a String type, use `char` type and create an `array` of characters

> ## Useful links
> - [Create Online cheatsheet](https://simplecheatsheet.com/)
> - [C Cheatsheet](https://simplecheatsheet.com/c)
About Canvass Clinical Research Institute In India
Tags: clinicalresearch, clinicalresearchinstitute, clinical
Published: 2023-12-15 08:50:07

Canvass Clinical Research Institute In India has been providing clinical research courses since 2018. These courses are designed for different life science graduates.

We work as a [Clinical Research Institute In Nagpur](https://www.canvassacademy.com/[](url)) and provide our online learning services to students from pan India. We believe that for everyone courses should not be the same. Hence, for BSC students we have Masters in Clinical Research. For M.SC we offer Advance Diploma in clinical research. 

Also, students having backgrounds like BHMS, BAMS, BDS, B.pharma, M.pharma, Pharm D, B.tech(biotech), Nursing can enroll in a unique course of Post Graduate Diploma in Clinical Research.

Moreover, our online tutors of clinical research courses are highly experienced and are industry experts. Hence, we deliver comprehensive coaching of clinical research courses in India. In addition, our student-teacher ratio is very efficacious. 

Subsequently, that makes us able to pay heed to each and every student by conducting their one-on-one sessions. We also focus on the personality development of our students. Such sessions helps students to enhance their communication skills, interpersonal skills and soft skills.
Elevate Your Financial Success with Elite Financials in Dubai
Tags: managementconsultant, smallbusinessaccounting, elitefinancialsdubai, auditingservicesdubai
Published: 2023-12-15 08:45:58

Imagine this: you've created an awesome app, the code is excellent, and users are rushing to your spot in Dubai's busy tech world. But wait, there's a financial challenge coming! Taxes, rules, and paperwork could overwhelm your app with a bunch of complicated stuff.

No worries about numbers, [Elite Financials](https://elitefinancials.ae/) is here to help you through the financial desert. We're your guide, giving you the tools to confidently handle the financial challenges. Forget about confusing reports and tax codes, we offer:

**1. Management Consulting: Your Map to Making Money**

Think of experienced tech guides helping you:

- Plan your finances: Make a clear financial plan that matches your app's goals with Dubai's lively market.

- Improve your work: Make your development process smoother, turning chaos into a productive process.

- Handle paperwork: Manage your accounts efficiently, letting you focus on coding instead of crunching numbers.

- Navigate digital changes: Predict market shifts and adjust your strategy, so your app does well even during tough times.


**2. Small Business Accounting: Your Smart Hub**

Meet [financial experts](https://elitefinancials.ae/services/) sharing the secrets of clear finances:

- Track everything: Keep your finances clear, making sure every bit of code turns into useful information.
- Pay the right taxes: Navigate Dubai's tax maze easily, avoiding unnecessary fees and legal issues.
- Turn data into gems: Change financial data into helpful insights, guiding your investment decisions and helping your app grow.
- Plan for the future: Secure your financial future with good budgeting and investment strategies, so your code works well for years.


**3. Auditing Services: Your Tech Protection**


Think of digital guards, always watching:

- Check your oasis: Audit your financial systems well, finding and fixing problems before they become big issues.
- Find hidden opportunities: Discover ways to save money and improve, turning possible problems into helpful development resources.
- Follow the rules: Make sure your app follows all the rules, protecting you from legal issues and financial problems.
- Sleep well: With your finances strong, focus on what you do best – building the next big app that will change Dubai's tech world.


So, developers, don't let Dubai's financial challenges stop you. Elite Financials is your guide in the storm, ready to lead you to financial success and coding peace. Contact today and let them help you turn your app into a successful tech empire in Dubai!
Film industry and Cryptocurrency
Tags: cryptocurrency, web3, learning
Published: 2023-12-15 08:44:49

The world of film financing has seen a significant shift in recent years, with the emergence of cryptocurrency and blockchain technology. These new developments are changing the game by providing innovative ways to fund, produce, and distribute films. In this article, we will explore the impact of cryptocurrency on film financing, how it is revolutionizing royalties and revenue distribution in the industry, and how blockchain-based solutions are being explored for film production and distribution.

Cryptocurrency and the Future of Film Financing


Cryptocurrency has emerged as a game-changer in the film financing landscape. This new form of digital currency has the potential to revolutionize the way films are financed, produced and distributed. Cryptocurrency allows filmmakers to bypass traditional financing models and raise capital directly from investors around the world. This means that filmmakers can retain more creative control over their projects while also accessing a wider pool of funding. Furthermore, cryptocurrency provides a secure and transparent way to track revenue generated by films. It eliminates the need for intermediaries and ensures that all parties involved receive their fair share of profits. As such, it is no surprise that more and more filmmakers are turning to cryptocurrency as a viable alternative to traditional film financing methods.

Revolutionizing Royalties and Revenue Distribution in the Film Industry


Revolutionizing royalties and revenue distribution in the film industry is one of the significant changes brought by cryptocurrency and blockchain technology. With the traditional financing system, filmmakers have to rely on distributors to get their share of revenue. However, blockchain technology offers a transparent and decentralized system that eliminates intermediaries, allowing filmmakers to receive their fair share of profits. Blockchain-based platforms such as SingularDTV and FilmChain use smart contracts to ensure secure and automated revenue distribution among stakeholders. This innovative approach helps filmmakers to retain more control over their intellectual property, while also providing greater transparency for investors and other stakeholders. The use of blockchain technology in film financing is an excellent example of how new technologies can revolutionize traditional industries and bring about positive change.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bdjfc96jtx11hx94jv1q.png)
Laravel: Optimization
Tags: laravel, cheatsheet
Published: 2023-12-15 08:40:22

#### [#](#composer-s-autoloader-map)Composer's autoloader map
```
composer install --optimize-autoloader --no-dev
```
#### [#](#configuration-loading)Configuration Loading
Be sure that you are only calling the `env` function from within your configuration files.  
Once the configuration has been cached, the `.env` file will not be loaded and all calls
to the `env` function for `.env` variables will return `null`
```
php artisan config:cache
```
#### [#](#route-loading)Route Loading
```
php artisan route:cache
```
#### [#](#view-loading)View Loading
```
php artisan view:cache
```

> ## Useful links
> - [Create Online cheatsheet](https://simplecheatsheet.com/)
> - [Laravel Cheatsheet](https://simplecheatsheet.com/laravel)
Transmit: Window Menu
Tags: transmit, cheatsheet
Published: 2023-12-15 08:40:20

| Shortcut | Action |
| --- | --- |
| `Cmd` `M` | Minimize |
| `Cmd` `Opt` `M` | Minimize all |
| `Ctrl` `Tab` | Select next tab |
| `Ctrl` `Shift` `Tab` | Select previous tab |
| `Cmd` `Ctrl` `T` | Transcript |
| `Cmd` `Opt` `I` | Show inspector |

> ## Useful links
> - [Create Online cheatsheet](https://simplecheatsheet.com/)
> - [Transmit Cheatsheet](https://simplecheatsheet.com/transmit)
10 Impressive Automation Scripts You Need To Try Using Python
Tags: python, programming, productivity, datascience
Published: 2023-12-15 08:33:20

Automation allows the execution of certain tasks efficiently without or with less human intervention. Python is certainly the kind of automation when It comes to programming languages. It has many inbuilt functionalities with wide support of different packages that allow a developer to automate certain tasks efficiently with less effort. In this blog, We will look at 10 Fun automation scripts that you need to try using Python.

## Auto ProofRead:
**Description**: Correct spelling and grammatical errors in your text using the lmproof library in Python. This script can enhance the quality of your written content, making it error-free and polished.

## PseudoData:

**Description**: Generate realistic-looking artificial datasets using Python. This script is valuable for tasks such as testing database schemas, ML model development, and API testing.

## Notifo:
Description: Combat forgetfulness and boost productivity with this reminder script. Set custom reminders with messages, and the script will notify you after the specified time, acting as your digital memory aid.

## NATO Encryptions:
Description: Encode and decode messages using NATO phonetic alphabet encryption. This script adds a layer of fun or security to messages, making them readable only with the correct set of keys.

## Briefit:

Description: Summarize articles using neural networks and web scraping. This script generates abstract summaries of articles, making it easier to grasp the main points when time is limited.

## Image Exif:

Description: Extract and remove Exif data from images. This script helps protect your privacy by removing metadata such as camera settings, geolocation, and other details embedded in images.

## RemoveBG:

Description: Remove the background from images locally using the rembg Python package. This script is handy for writers and others who frequently work with images and need them without a background.

## FilterText:

Description: Use regular expressions to filter text data. This script includes filters for email addresses, HTML tags, web links, mentions, and hashtags, making it versatile for various text-processing tasks.

## EmailHeaders:

Description: Parse and display important information from email headers. This script provides insights into an email's origin, transmission, and content, helping identify potential issues or suspicious activity.

## TrendyStocks:

Description: Fetch and visualize Google Trends data for specified stocks. This script helps investors understand the current trends in the market, making it a valuable tool for decision-making.
investment decisions.

Check out the source code for all these scripts [here](https://medium.com/pythoneers/10-impressive-automation-scripts-you-need-to-try-using-python-bc9bc7563633).
ER graph tool, optimize your database design to the extreme!
Tags: er
Published: 2023-12-15 08:32:06

In today's data-driven world, database design plays a crucial role. In order to achieve effective and accurate data storage and retrieval, enterprises have begun to adopt Entity Relationship Diagram (ER Diagram) to optimize their database design process. Today we will introduce a powerful software called itBuilder, an online table structure design software that utilizes artificial intelligence to improve efficiency. It can generate CRUD code and push it to development tools; It covers almost all languages, such as Java, Python, JavaScript, etc., and supports team collaboration, real-time communication, and seamless collaboration. At the end, place a white prostitution channel and personally experience the power of combining AI and databases, in order to have a better understanding.

We need to understand two basic concepts in the ER model: entities and relationships. Entities are objects stored in a database, such as people, products, orders, etc. Relationship refers to the relationship between entities, such as the relationship between people, the relationship between people and products, etc. ItBuilder provides an intuitive visual interface, allowing you to easily design table structures and create ER diagrams. You can set colors according to personal needs, set field associations between tables, and make flexible layouts. No longer requires manual drawing of ER diagrams, and the generated ER diagrams can also be exported for easy distribution and sharing of user models.

In summary, ER diagrams play a role in connecting various entities and relationships in database design, helping us better organize and manage data. Through the ER diagram, we can clearly understand the relationships between entities, thereby designing a more reasonable and efficient database structure.

In system analysis and design, ER diagrams are widely used in database design. Database design refers to designing a reasonable database structure based on system requirements and business rules to store and manage data. ER diagrams, as a graphical tool, can help analysts and designers understand business requirements and transform them into actionable database models.

Softfactory is a powerful online table structure design software that utilizes AI technology to automatically generate table structures and code, and supports various functions such as team collaboration and version control, greatly improving development efficiency and reducing errors. If you need an efficient tool when designing database table structures, SoftFactory will be a good choice. https://www.softfactory.cloud/
Responsible Gaming While the thrill of Satta Matka.
Tags: webdev, gamedev, programming, opensource
Published: 2023-12-15 08:09:37

When it comes to playing Satta Matka online, [dpboss777.net](https://dpboss777.net/) stands out from the crowd. With its user-friendly interface, a wide variety of games, and stringent security measures, it has become the go-to platform for enthusiasts.
The "well-known" Symbols in JavaScript
Tags: javascript, discuss
Published: 2023-12-15 08:05:28

You might have stumbled upon the weird `@@thingies` in JavaScript before. Maybe you saw an `@@iterator` or an `@@match` somewhere

These aren't valid JavaScript (`@@iterator` would throw an error). They are actually internal Symbols used in
JavaScript. They are used to implement features like iteration, `instanceOf`, and such internally. [They actually might get removed or changed](https://github.com/tc39/ecma262/pull/1314)

For example: you can set `@@isConcatSpreadable` to stop `.concat` from spreading arrays.

```javascript
const customArray = [1, 2, 3];
customArray[Symbol.isConcatSpreadable] = false;

const concatenatedArray = [4, 5, 6].concat(customArray);
console.log(concatenatedArray); // Output: [4, 5, 6, [1, 2, 3]]
```

Another one, a more useful one, is `@@iterator` it is used internally to define iteration - ie in for loops.

```javascript
const customIterable = {
    [Symbol.iterator]() {
        return {
            next() {
                // Infinite loop
                return { value: 'anything', done: false }
                // return {done: true} when done
            }
        }
    }
}

for (const item of customIterable) {
    console.log(item);
}
```

`@@match` can also have potential use cases:

```javascript
class CustomDateMatcher {
    [Symbol.match](str) {
        // ...logic...
    }
}

const str = '21st of March';
console.log(str.match(new CustomDateMatcher('21/03'))); // Custom pattern matching result
```

More notable mentions:
- `@@toStringTag` for converting an object to a string
- `@@toPrimitive` for converting an object to a primitive
- `@@search` for `.search()`
- [Full list on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#static_properties)

Do you have any ideas / suggestions for how to make use of this in code? Leave a comment!
How To Install and Use Docker Compose on Ubuntu 20.04
Tags: docker, ubuntu
Published: 2023-12-15 07:31:07

## Step 1 — Installing Docker Compose
```
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
```

Next, set the correct permissions so that the docker-compose command is executable:
```
sudo chmod +x /usr/local/bin/docker-compose
```

To verify that the installation was successful, you can run:
```
docker-compose --version
```

You’ll see output similar to this:
```
Output
docker-compose version 1.29.2, build 5becea4c
```

## Step 2 — Setting Up a docker-compose.yml File

Start off by creating a new directory in your home folder, and then moving into it:
```
mkdir ~/compose-demo
cd ~/compose-demo
```

In this directory, set up an application folder to serve as the document root for your Nginx environment:

```
mkdir app
```

Next, create the docker-compose.yml file:

```
nano docker-compose.yml
```
Insert the following content in your docker-compose.yml file:

{% embed https://gist.github.com/comficker/7f163c315dc0bb81bebd14d963d0165d %}

## Step 3 — Running Docker Compose

```
docker-compose up -d
```

## References:

- [Docker Cheatsheet](https://simplecheatsheet.com/docker)
- [Linux Cheatsheet](https://simplecheatsheet.com/linux)