teleren/devto huggingface dataset:
5 Essential EF Core Performance Tips
Tags: dotnet, csharp, efcore, tutorial
Published: 2024-01-26 22:14:41

Optimizing EF Core for better performance is crucial for developing responsive applications. Here are five key strategies, as highlighted by Milan Jovanović, to enhance your EF Core queries, complete with straightforward code examples.

## 1. No Tracking Queries

**Why**: EF Core's default behavior tracks changes to entities, which is unnecessary for read-only operations and can slow down performance.

**Solution**: Use `.AsNoTracking()` for queries where you don't need to track changes, reducing memory usage and improving query speed.

**Code Example**:
```csharp
var users = context.Users.AsNoTracking().ToList();
```

## 2. Selecting the Right Columns

**Why**: Retrieving all columns when you only need a few can lead to inefficient data transfer.

**Solution**: Use `.Select()` to specify exactly which columns to retrieve, minimizing data transfer and speeding up the query.

**Code Example**:
```csharp
var userNames = context.Users.Select(u => new { u.Id, u.Name }).ToList();
```

## 3. Leveraging Relationships Effectively

**Why**: Loading related data inefficiently can significantly impact performance.

**Solution**: Use `.Include()` carefully. Consider lazy loading or explicit loading to fetch related data as needed, rather than all at once.

**Code Example**:
```csharp
var usersWithOrders = context.Users.Include(u => u.Orders).ToList();
```

## 4. Using Split Queries

**Why**: Complex queries involving multiple joins can be more efficiently executed as separate queries.

**Solution**: For EF Core 5.0 and later, use `.AsSplitQuery()` for complex joins to break them into multiple queries, potentially reducing execution time.

**Code Example**:
```csharp
var orders = context.Orders.Include(o => o.Items).AsSplitQuery().ToList();
```

## 5. Implementing Pagination

**Why**: Loading large datasets in one go can overwhelm your application and lead to long load times.

**Solution**: Implement pagination to load data in manageable chunks, improving user experience and reducing server load.

**Code Example**:
```csharp
int pageSize = 10;
var page = context.Users.Skip((pageNumber - 1) * pageSize).Take(pageSize).ToList();
```

## Conclusion

By applying these EF Core performance tips, you can make your applications more efficient and responsive. Each strategy addresses a common performance pitfall, helping you to optimize data access patterns and improve overall application performance.
Everyone should understand before coding
Published: 2024-01-26 22:11:02

Intelligence services are the silent guardians of state security. Thanks to their vast networks of informants and cutting-edge surveillance technologies, they infiltrate organizations, intercept communications, and meticulously analyze this data. Their goal is to anticipate any terrorist threat, thwart foreign espionage, and preserve the country's stability.

This notion of proactive protection against invisible threats can be transposed to the world of IT. Companies today are targeted by sophisticated cybercrime, whether by hackers, digital mafias, or industrial espionage. Faced with these furtive attacks circulating on the web, they must equip themselves with a response equal to the stakes.

Let's take the analogy of a private property to protect. A wealthy businessman would invest in bodyguards, thermal cameras detecting any intruder, reinforced safes. In our case, logging and monitoring constitute the digital equivalent of an optimized security system.

Logging consists of a real-time recording of all the events in the IT system in audit logs that can be consulted later. Whether it's user connections, database queries, or network traffic, each interaction is scrupulously recorded with abundant technical details (IP addresses, protocols, etc.). In the event of a detected breach, these digital traces make it possible to replay the sequence of events and identify the chain of events that led to the incident. This allows the breach to be plugged and the robustness of the system to be improved.

Monitoring takes this proactive surveillance logic even further. Dedicated solutions analyze incoming and outgoing data flows in real time, searching for statistical anomalies that may reveal a potential cyberattack. For example, these tools can detect unusually frequent connection attempts to a server, interpreted as an intrusion attempt. Alerts are then automatically generated to block the attack before it can cause damage.

As we can see, logging and monitoring are two sides of the same coin in a comprehensive cybersecurity strategy. The first provides a posteriori traceability in the event of an incident, the second ensures proactive monitoring to prevent them. Together, they provide optimal protection against all types of digital attacks. At a time when cybersecurity has become the number one strategic issue for companies, such defense mechanisms are essential in the face of the ever-changing threats.

#Django #Python #monitoring #linkedin #Cybersecurity #Logging #IT #informationtechnology Image_source: https://lnkd.in/eZET-Na8

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/revu1l3l8ksl5mufhh4h.jpg)
Next.js Codebase Analysis <> create-next-app <> index.ts explained — Part 1.5
Tags: webdev, javascript, nextjs, react
Published: 2024-01-26 22:11:01

In the previous articles, we took a little detour to understand the `program` variable used in `run()` function.

```
async function run(): Promise<void> {

  console.log("program.resetPreferences:", program.resetPreferences);

  // a Conf object creation with projectName.
  // We do not know what Conf does yet and it is okay.
  const conf = new Conf({ projectName: 'create-next-app' })

  // My first thought, where did the program come from?
  // Let’s find out by looking outside the run() function.
  // We skipped Conf class but the program variable cannot be skipped.
  // I know for a fact it is a global variable.
  if (program.resetPreferences) {
    conf.clear()
    console.log(`Preferences reset successfully`)
    return
  }

  if (typeof projectPath === 'string') {
    projectPath = projectPath.trim()
  }
```

Unknown here is Conf. Let’s find out what it is. You have knowns and unknowns and the goal is to make unknowns in your code to knowns as much as possible.

## Conf

[conf](https://www.npmjs.com/package/conf) is a simple npm config handling for your app or module.

Let’s console.log this and find out what is in it.

![Conf](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nzr551yrjooxnin1fpg1.jpeg)

1. Prepare a build

```
npm run build
```

2. Execute the command

```
npx create-my-app
```

This is what conf has

```
conf Conf {
  _deserialize: [Function (anonymous)],
  _serialize: [Function (anonymous)],
  events: EventEmitter {
    _events: [Object: null prototype] {},
    _eventsCount: 0,
    _maxListeners: undefined,
    [Symbol(kCapture)]: false
  },
  path: '/Users/ramunarasinga/Library/Preferences/create-next-app-nodejs/config.json'
}
```

I am thinking conf is used to persist some of your preferences chosen when you run create-next-app because the following is set just before closing the run function:

_I initially made this tool to let command-line tools persist some data._

The above quote from the conf package documentation.

## Conclusion
Conf is used to persist data such as preferences when you use command line tools

I am building a platform that explains best practices used in open source by elite programmers. [Join the waitlist](https://docs.google.com/forms/d/e/1FAIpQLSe2JCZAaIB5oXzNHLTrYJR4LMZ5SEwrGPgmG5DeFWdDhu8-Gw/viewform?usp=send_form) and I will send you the link to the tutorials once they are ready.

If you have any questions, feel free to reach out to me at ramu.narasinga@gmail.com
Comment le Logging et le Monitoring Défendent nos Mondes Numériques 🤕
Published: 2024-01-26 22:08:49


Les services de renseignement sont les gardiens silencieux de la sécurité de l'État. Grâce à leurs vastes réseaux d'informateurs et à leurs technologies de pointe en matière de surveillance, ils infiltruent des organisations, interceptent des communications et analysent méticuleusement ces données. L'objectif est d'anticiper toute menace terroriste, de contrecarrer l'espionnage étranger et de préserver la stabilité du pays.

Cette notion de protection proactive contre la menace invisible est transposable au monde de l'informatique. Les entreprises sont aujourd'hui ciblées par une cybercriminalité sophistiquée, qu'il s'agisse de hackers, de mafias numériques ou d'espionnage industriel. Face à ces attaques furtives circulation sur le web, elles doivent se doter d’une riposte à la hauteur de l’enjeu.

Prenons l’analogie d’une propriété privée à protéger. Un riche homme d’affaires investira dans des gardes du corps, des caméras thermiques détectant tout intrus, des coffres renforcés. Dans notre cas, le logging et le monitoring constituent l’équivalent numérique d’un dispositif de sécurité optimisé.
Le logging consiste en un enregistrement temps réel de l’intégralité des évènements du système informatique dans des journaux d’audit consultables a posteriori. Qu’il s’agisse des connexions utilisateurs, des requêtes de bases de données ou du trafic réseau, chaque interaction est scrupuleusement consignée avec force détails techniques (adresses IP, protocoles, etc). En cas de faille détectée, ces traces numériques permettent de remonter le fil des opérations et identifier la chaîne d’évènements ayant conduit à l’incident. On peut ainsi colmater la brèche et améliorer la robustesse du système.

Le monitoring pousse la logique de surveillance proactive encore plus loin. Des solutions dédiées analysent en temps réel les flux entrants et sortants de données à la recherche d’anomalies statistiques révélant une possible cyberattaque. Ces outils peuvent par exemple détecter des tentatives de connexions anormalement fréquentes vers un serveur, interprétées comme une volonté d’intrusion. Des alertes sont alors générées automatiquement pour bloquer l’attaque avant qu’elle ne produise de dégâts.

On le voit, logging et monitoring sont les deux faces d’une même médaille dans une stratégie globale de cybersécurité. Le premier fournit une traçabilité a posteriori en cas d’incident, le second assure une surveillance proactive pour les prévenir. Ensemble, ils assurent une protection optimale contre tous types d'attaques numériques. A l’heure où la cybersécurité est devenue l’enjeu stratégique numéro un des entreprises, de tels mécanismes de défense s’avèrent indispensables face à la mutation permanente des menaces. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4hpglb58n9ou21mjy9x2.jpg)
Machine Learning on AWS: A Brief Introduction
Tags: aws, machinelearning
Published: 2024-01-26 21:53:08




In this fast-paced world of technology, businesses are constantly seeking innovative solutions to stay ahead of the curve. One such revolutionary technology that has gained immense popularity in recent years is machine learning. I have been working on Machine Learning projects on AWS and recently got my [AWS Machine Learning - Specialty Certification](https://aws.amazon.com/certification/certified-machine-learning-specialty/).

In this short blog post, I will introduce the basic ecosystem of Machine Learning on AWS. I plan to delve deeper in future posts, including an end to end project, so stay tuned!


**Data: S3, Athena, AWS Glue**

Data is a very important aspect in a machine learning project. 
AWS provides tools such as Amazon S3 for scalable storage, AWS Glue for data preparation, and Amazon Athena for querying data directly in S3. These services create a robust foundation for data-driven decision-making and model training.

**Foundations : Amazon Sagemaker**

This is the heart of machine learning on AWS. Amazon Sagemaker is a fully managed service that allows developers and data scientists to build, train and deploy machine learning models at scale. With support for machine learning frameworks like Tensorflow and pyTorch, Sagemaker simplifies the entire machine learning workflow. It also supports governance requirements with simplified access control and transparency over your ML projects.

Data scientists can leverage SageMaker's easy-to-use interface to experiment with different algorithms, hyperparameters, and data sets. The service also supports distributed training, enabling faster model convergence.


Once a model is trained, deploying it for real-world use is seamless with SageMaker Hosting. Whether you want to deploy models for batch processing or real-time predictions, AWS provides scalable and cost-effective solutions that automatically handle the underlying infrastructure, allowing developers to focus on their applications.

**Security and Compliance**

With features like VPCs (Virtual Private Cloud) and encryption at rest and in transit, businesses can ensure the confidentiality and integrity of their machine learning workloads. 

I hope this short overview piqued your interest in the wonderful world of machine learning on AWS. I am truly excited about the next posts as we shall venture deeper into these technologies and build something amazing!
Seeding in Laravel
Tags: database, learning, webdev, laravel
Published: 2024-01-26 21:19:46



## What is seeding

This is the adding dummy data to the database using the command line.

## How to generate seeder file

By using the command below, you create a seeder file called MembersSeeder.
`php artisan make:seeder MembersSeeder`

After creating the seeder file, then ensure to register the Str method and Facades mehtod.

`use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;`

Put the above code in the seeder file.

## Data seeding

Add the following lines of code to the seeder file:
`class MembersSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        //
        DB::table("members")->insert([
            'name' =>Str::random(10),
            'email' =>Str::random(10).'@gmail.com',
            'address' =>Str::random(10),
        ]);
    }
}
`
Always ensure that the schema matches the seeder file definition.

And then run the following command:

`php artisan db:seed --class=MembersSeeder`

To add another seed into the table, just repeat the above command.

Remember you must have the migrations (table and schematic definition for the tables before you can be able to do seeding)

Check my previous post on how to make migrations.
RECLAIM STOLEN BITCOIN, ETHEREUM AND USDT, PRO WIZARD GILBERT RECOVERY
Published: 2024-01-26 21:05:58

It's quite terrible that we live in a world filled with dishonest people and there’s nothing we can do about it. These people now make a living from being very dishonest and cheating as many gullible persons as possible. This practice is very old amongst men yet every new generation seems to birth new ideas and tricks inspired by whatever the latest pandemic or current trends there is to exploit. Unfortunately, I have also fallen victim to scammers, This time it was an investment opportunity designed to elevate me from suffering. The economy was hit hard and I was behind on 90% of my bills, my restaurant business was in a very bad place financially so it was either I get run down with time due to lack of capital or somehow improve my finances in other to have the capital I needed to save my business and my life in general. I always heard crypto trading can be very profitable if done correctly with the right guidance and risk management. Well, it turned out I got guidance from the wrong people who eventually took me for every penny I had left, they ripped me off as much as 128K USD in 3 months including the loans I took from friends to settle some fees. I thought I was as careful as ever but the way everything is backed up with documents was very convincing, it’s up to us to realize when we are being taken. When I did realize the scam, I got very depressed thinking I had lost everything then one day, I decided to go online and seek any possible help to recover my assets but no matter what I did it looked like I was always hitting a dead end with no positive lead on genuine recovery company to help recover my assets, My friend suggested I try Pro Wizard Gilbert Recovery and asked me to give it a thought. A few days later, He connected me with Pro Wizard Gilbert Recovery, the team took up my case after doing the necessary verifications and within 6 hours my stuck-up funds were transferred into my wallet and I quickly converted them to cash. Quite a tremendous job the team carried out to save my life and I fully recommend getting help from Pro Wizard Gilbert Recovery if you’re in a similar situation. Email: prowizardgilbertrecovery@engineer.com And Telegram: @Pro_Wizard_Gilbert_Recovery
Building a Library of Python Processors for NiFi 2
Published: 2024-01-28 16:23:45

---
title: Building a Library of Python Processors for NiFi 2
published: true
date: 2024-01-26 21:01:00 UTC
tags: 
canonical_url: 
---

[ https://medium.com/@tspann/building-a-library-of-python-processors-6b5517404a58](https://medium.com/@tspann/building-a-library-of-python-processors-6b5517404a58)
Managing Public and Private Repositories in a Project
Tags: git, opensource, github, tutorial
Published: 2024-01-26 21:00:45

Projects often require a combination of public and private repositories to manage code effectively. This strategy is particularly useful for maintaining an open-source version while safeguarding proprietary or sensitive information. Below, we'll walk through the process using GitHub, but the principles apply to any Git hosting service like Bitbucket or GitLab.

### Forking a Public Repository

To start, we'll fork a public repository into our account. Let's use GitHub for this example, but the process is similar elsewhere. Suppose we're forking a blog template built with Astro:

**Step 1:** Fork the public repository to your account. For instance:

[Blog Template](https://github.com/danielcgilibert/blog-template)

**Step 2:** Clone the forked repository to your local machine. Adjust the URL with your username:

```bash
git clone https://github.com/yourusername/blog-template
```

### Creating a Private Repository

Next, we need a private repository for internal development. Let's call it `personal-blog-template`. This repository will house content not intended for public viewing, such as personal blog posts.

### Adding the Private Repository as a Remote

To interact with the private repository, we'll add it as a remote:

```bash
git remote add private https://github.com/yourusername/personal-blog-template
```

Verify the addition:

```bash
git remote -v
```

### Making Changes and Pushing to the Private Repository

Now, let's upload changes to the private repository. Create a new branch to prevent conflicts:

```bash
git checkout -b release
```

Make desired changes and commit them:

```bash
git add .
git commit -m "Add some changes to the README.md file"
```

Push changes to the private repository:

```bash
git push private release
```

### Integrating Changes into the Public Repository

Suppose we want to merge changes from the private repository into the public one. 

Fetch changes from the private repository:

```bash
git fetch private
```

Merge the changes into the public repository:

```bash
git merge private/release
```

### Conclusion

Managing both public and private repositories within a project is essential for maintaining transparency while protecting sensitive information. Whether for open-source projects or internal development, this approach ensures flexibility and security. By following these steps, you can effectively collaborate and manage your project across multiple repositories. 

For enhanced control, tools like **Husky** can prevent accidental uploads of sensitive branches to public repositories. Experiment with these techniques to streamline your workflow and safeguard your project's integrity. Thank you for reading!
Drilling in React
Tags: props, drilling, javascript
Published: 2024-01-26 20:47:47

Props are used by react to pass information from one component to another

There are situations that require information to go from Parent component to child component and to Grandchildren 

How to avoid prop drilling
In case, when you project become larger and more complex, prop drilling can become a problem. To avoid this problem in React-based projects, there are several patterns and techniques that can be used:

**React Context**
React Context is a way to share data across the component hierarchy without passing it down explicitly as props. Context can be a good alternative to prop drilling when you need to share data across multiple components.
The problem with Prop Drilling is that whenever data from the Parent component will be needed, it would have to come from each level, Regardless of the fact that it is not needed there and simply needed in last.

With Context, you can define data at the top level of the component tree and then access it anywhere in the tree. This can help reduce the amount of code you need to write, and make it easier to manage and share data across the component hierarchy.

**Drawbacks of Drilling**
**Code Complexity**
As components grow, prop drilling increases code complexity as it is difficult to track the flow of data through various components.
**Reduced Maintainability** 
It will become very challenging to maintain the code with prop drilling. When changes are required in the data flow, you need to make changes in many components.

**Performance Overhead** We have to pass props through unnecessary intermediary components which can impact performance.

**Decreased Component Reusability**
Components used in prop drilling become tightly coupled to the structure of the parent components, so it very difficult to use it on other parts of the application.
Increased Development Time: Prop drilling often requires additional planning to implement. This can slow down the development process, especially when the component hierarchies is complex.

A better alternative to this is using useContext hook. The useContext hook is based on Context API and works on the mechanism of Provider and Consumer. Provider needs to wrap components inside Provider Components in which data have to be consumed. Then in those components, using the useContext hook that data needs to be consumed.

**Resources**
https://www.geeksforgeeks.org/what-is-prop-drilling-and-how-to-avoid-it/
https://javascript.plainenglish.io/prop-drilling-in-react-understanding-the-benefits-and-pitfalls-of-passing-props-down-the-component-fcf9887f8b73
"Programming Poetry: A Collection of Poems on the Art of Programming"
Published: 2024-01-26 20:40:09

Code is like poetry,
An art form for the eyes to see,
With every line and every word,
A message is conveyed and heard.

A program is like a song,
With each line, we sing along,
And with each note, we create,
A symphony that is truly great.

In the world of programming,
There is magic in the air,
With every keystroke we create,
A world beyond compare.

Programming is an art,
A canvas for the mind,
With every line and every stroke,
A masterpiece we find.

In the world of code,
There is beauty to behold,
With every function we create,
A story is told.

A program is a journey,
A path that we explore,
With every step we take,
A new world we uncover.

Programming is a puzzle,
A challenge we must solve,
With every piece we fit together,
A masterpiece we evolve.

In the realm of programming,
There is a beauty that transcends,
With every line we write,
A world of wonder never ends.

A program is like a garden,
A place where we can grow,
With every line and every seed,
A bounty we can sow.

In the world of programming,
There is a rhythm to the beat,
With every line we write,
A melody we complete.


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

[blooger](https://echoaditya.blogspot.com/)
[sps](https://spsn.netlify.app)