teleren/devto huggingface dataset:
What is CyberSecurity?
Tags: cybersecurity, computersecurity, security, cyberattack
Published: 2024-01-21 14:57:22

**Cybersecurity** also known as Computer Security refers to the practice of protecting systems, networks, and programs from digital attacks. These attacks are usually aimed at accessing, changing, or destroying sensitive information, extorting money from users via ransomware, or interrupting normal business processes. 

Cybersecurity aims to protect individuals’ and organizations’ systems, applications, computing devices, sensitive data, and financial assets against cyberattacks. The rise in cloud computing adoption, network complexity, remote work, bring your own device (BYOD) programs, and connected devices have created exponentially more ways for cybercriminals to attack.

A successful cybersecurity approach has multiple layers of protection spread across the computers, networks, programs, or data that one intends to keep safe. In an organization, the people, processes, and technology must all complement one another to create an effective defense from cyber attacks.

The cost of cybercrime is rising. For example, the average cost of a data breach in 2023 was USD 4.45 million, up 15 percent over the last three years. The average cost of a ransomware-related data breach in 2023 was even higher, at USD 5.13 million. This does not include the cost of the ransom payment, which averaged an additional USD 1,542,333, up 89 percent from the previous year. By one estimate, cybercrime will cost the world economy USD 10.5 trillion per year by 2025.

**Source: **
(1) What Is Cybersecurity? - Cisco. https://lnkd.in/gfkcEavG.
(2) What is Cybersecurity? | IBM. https://lnkd.in/gtkXkXjj.
(3) Computer security - Wikipedia. https://lnkd.in/g2rEjZXj.
(4) What is Cybersecurity? | CISA. https://lnkd.in/g94rsjdu.
Should We Return Web-Form Controls to ASP.NET Core?
Tags: discuss, dotnet, backend, developers
Published: 2024-01-21 14:56:14

## What is Web-Form

Web-form controls are parts of web pages that are built based on the ASP.NET Standard. Web-form controls are tags that increase the ease of programming. Each of these controls are classes with their own attributes and methods.

These controls were very attractive to desktop programmers. To create a web page in Visual Studio, programmers would create a new project and just drag and drop the web form controls to the page.

List of popular controls:
 - Label
 - Text Box
 - Button
 - Checkbox
 - Radio Button
 - List Box
 - Check Box List
 - File Upload

The image below shows an example of controls.

![Example of controls](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2k0bz9fmpgym55jh987p.PNG)

The use of these types of controls is very less in the web and in the new versions of ASP.NET Core, it is not a happy news for web-form programmers in ASP.NET Standard; On the desktop, it is only used for non-graphical management programs.

Example control in Web-Form
```html
<asp:TextBox ID="TextBox1" Text="Guest" runat="server"></asp:TextBox>
<asp:Button ID="Button1" Text="Button" OnClick="Button1_Click" runat="server" />
```

In the code above, the first line is a textbox control and the second line is a button control.

Click example
```csharp
protected void Button1_Click(object sender, EventArgs e)
{    
    TextBox1.Text = TextBox1.Text + " , welcome to Web-For control!";
}
```

The code above is a simple example of the function of counters in web-forms. In the example above, after clicking Button1, a string is added to the TextBox1 string.

For events where the response is applied on the same page, web developers use Ajax or Fetch.

We at [Elanat team](https://elanat.net) have provided a [CodeBehind framework](https://github.com/elanatframework/Code_behind) to compete with the default structure of cshtml pages in ASP.NET Core. It's been eight months since CodeBehind was launched and we're constantly adding new features with new updates. View pages in the CodeBehind framework have an aspx extension; Of course, the CodeBehind framework has nothing to do with web-forms. CodeBehind is a new and modern framework built for deployment on ASP.NETCore.

We want to know if we need to add the possibility to add web controls in the CodeBehind framework.

  - If we add this feature, should the structure of the CodeBehind framework controls be similar to the former web-form controls?
  - Should we use viewstate or do you consider it unnecessary?
  - Should we use Ajax and Fetch behind controls without user involvement?
  - Should we require JavaScript to be active or still submit the form?

Please share with us and other users your thoughts on the return of web controls to ASP.NET Core.
Alexa certification challenge ... help
Published: 2024-01-21 14:32:14

Have created a unique Alexa skill which I've used for the past 5+ years, it only has a single intent but users can upload 1000's of commands via webpage. It integrates directly with a standard web browser where you can call up any YouTube video via voice, play local videos via voice etc but ...... I'd love to get it certified and released but stuggling to agree with certification requirements. It may go through but I'm trying to check it out. any help out there?
flatMap vs map in Array
Tags: javascript
Published: 2024-01-21 13:51:56


**flatMap**: It is identical to a map() followed by a flat() of depth 1 (arr.map(...args).flat()), but slightly more efficient than calling those two methods separately.
```
let LIST = [1,2,3];
let processedLst = LIST.flatMap((route) => {
    return [route, route];
  }).filter(Boolean);
console.log(processedLst)
// [ 1, 1, 2, 2, 3, 3 ]
```

**map:**
```
let LIST = [1,2,3];
let processedLst = LIST.map((route) => {
    return [route, route];
  }).filter(Boolean);
console.log(processedLst)
//[ [ 1, 1 ], [ 2, 2 ], [ 3, 3 ] ]
```
**flat()**: 
```
processedLst.flat()
//[ 1, 1, 2, 2, 3, 3 ]
```
I will be posting tricks I have been using in my journey.
**So follow me on** [LinkedIn](https://www.linkedin.com/in/mohdahshandanish/).
Build a simple fileserver in 1 line using go
Tags: softwaredevelopment, cloudnative, networking, go
Published: 2024-05-12 04:53:36

---
title: Build a simple fileserver in 1 line using go
published: true
date: 2024-01-21 13:14:51 UTC
tags: softwaredevelopment,cloudnative,networking,go
canonical_url: https://rajdeep-das.medium.com/build-a-simple-fileserver-in-1-line-using-go-6f771c333dbf
---

![](https://cdn-images-1.medium.com/max/1024/0*_-g25_-ZR76jyONj)
_Photo by imgix on Unsplash_

You have probably heard that Go is fantastic for building web applications of all shapes and sizes. This is partly due to the fantastic work that has been put into making the standard library clean, consistent, and easy to use.

If you’re just starting with web development in Go, the net/http package is super important. It helps you create servers for the web using simple and powerful building blocks.

### The http.Handler Interface

As you become more familiar with Go, you will notice how much of an impact _interfaces_ make in the design of your programs. The net/http interface encapsulates the request-response pattern in one method:

```
type Handler interface {
    ServeHTTP(ResponseWriter, *Request)
}
```

Implementors of this interface are expected to inspect and process data coming from the http.Request object and write out a response to the http.ResponseWriter object.

The http.ResponseWriter interface looks like this:

```
type ResponseWriter interface {
    Header() Header
    Write([]byte) (int, error)
    WriteHeader(int)
}
```

Often, you just want to share simple web pages with pictures and styles. Imagine you have a basic webpage with text, images, and design, and you just want to show it to others on the internet. That’s where serving static files comes in handy.

```
package main

import (
 "fmt"
 "net/http"
)

func main() {
 fmt.Println("FileServer Stared on Port : 8080")
 // "." - current directory where the progam is running
 http.ListenAndServe(":8080", http.FileServer(http.Dir("."))) 
}
```

The http.ListenAndServe function is used to start the server, it will bind to the address we gave it (:8080) and when it receives an HTTP request, it will hand it off to the http.Handler that we supply as the second argument. In our case, it is the built-in http.FileServer.

The http.FileServer function builds an http.Handler that will serve an entire directory of files and figure out which file to serve based on the request path. We told the FileServer to serve the current working directory with http.Dir(".").

If we go to _localhost:8080/main.go_ in our web browser, we’ll see what’s inside our main.go file. With just one line of Go code, we can run this program from any folder and turn our computer into a simple server that shares files, like a tree of files, with others.

Checkout the project — [Rajdeep-Das/go-networking: Go Lang Networking Stand Lib & Cloud Native Networking Projects (github.com)](https://github.com/Rajdeep-Das/go-networking)

Happy reading 📖. 😃
Why React Re-Renders?
Tags: react, webdev, javascript, programming
Published: 2024-01-21 13:07:24

#### **Why React Re-Renders?**


- Start with a fundamental every re-render in React starts with a state change.
- Re-renders only affect the component that owns the state + its descendants (if any).
- Some developers believe that a component will re-render because its props change, although that is a valid reason, it is not quite true when a component renders it all descends also re-renders, regardless of whether the descends components have props or not (pure components). The descends components can be exported with React.memo to prevent unnecessary re-rendering. If any pure components have props as a static value (object or function) you can use useMemo or useCallback hook to prevent re-rendering.
- Now What about context? Though some components have no props, if it uses a value form useContext If that state variable changes, a re-render will occur.

These are the fundamentals of React and why it re-renders. 

If any of the points are incorrect, please feel free to correct me, as I am also learning, and I have learned this through reading many blogs and articles.

Thank you for your attention 🙂
Github glow-up! Hack your contribution graph!
Tags: programming, git, github, developer
Published: 2024-01-21 12:33:27

You can manipulate your Github contribution graph realistically or with text. Fill gaps in your resume, fill empty years, or leave a message in your graph. Demo profile: wishfulgitting.com/demo

{% embed https://www.youtube.com/watch?v=UK3pUYq27Qc %}

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


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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tsa2aacbqvfpl47ig6or.png)
ClickBank affiliate marketing
Published: 2024-01-21 12:24:12

[ClickBank affiliate marketing](https://www.clickbankaffilliatemarketing.in/) is a popular and lucrative online business model that allows individuals to earn commissions by promoting and selling products listed on the ClickBank marketplace. Founded in 1998, ClickBank has become one of the largest and most diverse affiliate marketing platforms, offering a vast array of digital products, including ebooks, online courses, software, and more.

As a ClickBank affiliate, individuals can choose from thousands of products within various niches, making it accessible to a wide range of audiences. The process is straightforward: affiliates sign up for a ClickBank account, select a product to promote, and generate a unique affiliate link. When a customer makes a purchase through their affiliate link, the affiliate earns a commission, often ranging from 50% to 75% of the product's sale price.

ClickBank's user-friendly interface, extensive reporting tools, and timely commission payments contribute to its appeal among affiliate marketers. Additionally, the platform provides various promotional tools, such as banners and email swipes, to help affiliates effectively market products. Successful ClickBank affiliates often leverage digital marketing strategies, such as content marketing, social media promotion, and email marketing, to drive traffic and boost sales. Overall, ClickBank affiliate marketing offers a flexible and scalable opportunity for individuals to generate passive income online.
Supporting Cops: Strengthening Communities Through Unity and Appreciation
Tags: supportingcops, communityunity, backtheblue
Published: 2024-01-21 12:21:24

[Supporting Cops](https://supportingcops.org/) is a grassroots movement dedicated to fostering positive relationships between law enforcement officers and the communities they serve. At its core, the initiative is driven by a genuine appreciation for the sacrifices made by law enforcement professionals daily.

The movement actively advocates for positive change within law enforcement, emphasizing reforms, enhanced training, and increased support for officers. By amplifying the collective voice of the community, Supporting Cops seeks to contribute to a safer and more harmonious society.

Through engaging events, outreach programs, and initiatives, [Supporting Cops](https://supportingcops.org/) provides meaningful opportunities for direct interaction between law enforcement and community members. These efforts aim to break down barriers, dispel misconceptions, and foster understanding, ultimately strengthening the bond between officers and the neighborhoods they protect.

[Supporting Cops](https://supportingcops.org/) invites individuals to express gratitude for the dedication of law enforcement, actively participate in community-building initiatives, and stand united in fostering positive relationships. The movement serves as a reminder that, together, communities and law enforcement can create a safer and more connected society.
KFhair is #1 Vietnamese Human Hair Factory, Vietnamese Hair Extensions
Published: 2024-01-21 11:30:21

https://www.kfhair.com/ Kfhair Vietnam is a leading reputable distributor of human hair with high quality and cheapest price in the hair market✔️ With many years of research✔️ production and export of hair products to foreign markets✔️ Kfhair is now one of the largest hair enterprises in Vietnam✔️✔️✔️
+84 974 472 711
wholesale@kfhair.com
36 Thach Lam Street, Son Tra District, Da Nang City, Vietnam
#kfhair #kfhairvn #kfhairvietnam #kfhaircompany #supplierhair #humanhairsupplier #wholesalehairsupplier #hairextensionsupplier #besthairsupplier #hairfactory #humanhairfactory #hairwholesalers #realhair #hairsupplier
https://kfhaircom.zohosites.com/
https://hackmd.io/@kfhaircom
https://hashnode.com/@kfhaircom
I pre-released my project "apimock-rs" (former json-responder) written in Rust
Tags: rust, json, webdev, api
Published: 2024-01-21 11:09:58

I pre-released my project "json-responder" ☺

{% github nabbisen/json-responder %}

It is server written in Rust to generate JSON responses, aiming to help dev to easily get dummy API responses due to several paths.

Designed in mind with: fast speed, low memory consumption, easy usage.

Server startup:

![server startup](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f1m1r25jcgogh75kbsh4.png)

`curl` result:

![curl result](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a4covc862utmovc7afon.png)
Angular 17 Tutorial for Beginners
Tags: angular, javascript, beginners, angular17
Published: 2024-01-21 11:09:18

Angular 17 has a new syntax for control flow, better support for lazy loading of page components, and improved support for Server-Side Rendering (SSR). Additionally, the CLI now relies on ESBuild, significantly enhancing the build process.

**Technical updates in Angular 17**

- New looping syntax
- If-then-else
- Switch
- Block directives
- Deferred rendering
- SSR and SSG
- New build system
- Improved debugging for dependency injection

**Angular 17 Tutorial for Beginners:-**
What is Server-Side Rendering (SSR) and Why use SSR in Angular 17?
https://www.code-sample.com/2024/01/angular-17-server-side-rendering-ssr.html

What is Prerendering Static Site Generation (SSG)? Why use SSG?
https://www.code-sample.com/2024/01/angular-17-prerendering-static-site.html

What is Components DOM API and When to use DOM APIs in Components?
https://www.code-sample.com/2024/01/angular-17-components-dom-api-and-when.html

What is Component Inheritance and Extending other components and directives?
https://www.code-sample.com/2024/01/angular-17-component-inheritance.html

What are Component Lifecycle Hooks or Angular Lifecycle Hooks?
https://www.code-sample.com/2024/01/angular-17-component-lifecycle-hooks.html

What are Overriding LifeCycle methods?
https://www.code-sample.com/2024/01/angular-17-overriding-lifecycle-methods.html

What is ViewContainerRef to Render dynamic components?
https://www.code-sample.com/2024/01/angular-17-using-viewcontainerref-to.html


Angular 17 Tutorials:-
Install Angular 17 with Standalone (true):- https://youtu.be/Q4oDgwgc_zs
Angular 17 Routing For Beginners:- https://youtu.be/ebL7B5cq1cs
What Is Server-Side Rendering (SSR) and Why use?:- https://youtu.be/6d9Fx3mROY0
Angular 17 Component Inheritance:- https://youtu.be/SnSfvTugzzM
using ViewContainerRef To Render Dynamic Components:- https://youtu.be/8tRTmn-AWhE
Component Lifecycle Hooks:- https://youtu.be/AFWsRWnbC-Q
Prerendering Static Site Generation (SSG):- https://youtu.be/8b8deVyk3pw
Angular 17 for loop @for block Repeaters :- https://youtu.be/frNe5XVR9FA
Angular 17 if else statement example:- https://youtu.be/B8_ymr2x5Bk
What's New in Angular 17?:- https://youtu.be/1R4JMM2ORHM

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ukle26j9h6qzsp4wyr0y.png)
First Post
Tags: firstpost, beginners, nontech
Published: 2024-01-21 10:50:25

Hello dev community! My first post on dev.to! 

I am Karthik, from India's famous "[City of Pearls!](https://www.mangatrai.com/why-is-hyderabad-called-the-pearl-of-india)". I am mobile dev, with over 9 years of experience.

I have always wanted to write tech blogs, however it never got translated into actions!.
 
Hope in this new year, I am able to build my muscle for writing and share about my learnings and experience I have gained over these years and beyond.

Cheers!
SK
9 Free VS Code Extensions to Boost Your Productivity! 🚀
Tags: programming, beginners, productivity, webdev
Published: 2024-01-21 10:31:45

## Hey DEV Fam! 🚀

Let's dive into the fantastic world of VS Code extensions! 🎉 One of the coolest aspects of Visual Studio Code is its extensive collection of extensions that can supercharge your coding experience without denting your wallet.

Today, I'm excited to share 10 incredible free extensions from the VS Code Marketplace to take your coding game to the next level. Let's jump right in!

## 1. VS Code Auto Rename Tag 🏷️
   Say goodbye to tag renaming headaches! This nifty extension takes care of both opening and closing tags automatically.

![VS Code Auto Rename Tag](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yeirz1gx5oazkluaetya.gif)

## 2. Prettier in VS Code ✨
   Make your code sparkle with the Prettier extension. It beautifies your code, ensuring readability. Choose to format on save or paste.

![Prettier](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5v04m62ktd9l168ww5ok.gif)

## 3. Convert Pixels to Rem in VS Code 🔄
   No more unit conversion headaches! This extension effortlessly converts between pixels (px) and root em (rem). Just press alt + z to switch between the two.

![Convert Pixels](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6uy37gwqebliq5zfv5zh.gif)

## 4. VS Code Flexbox Cheatsheet 🤸‍♂️
   Master Flexbox with this handy cheatsheet. Access it through shortcuts or by hovering over a flex display.

![VS Code Flexbox Cheatsheet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3kwgwyuosrumxlnmuskj.gif)

## 5. Grid Snippets VS Code Extension 📐
   Level up your CSS Grid game with intuitive shortcuts for displaying grids and setting grid-template-columns.

![Grid Snippets](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7qjreueymmq0e119o8i7.gif)

## 6. Bracket Pair Colorizer 🌈
   Eliminate brace confusion! This extension assigns vibrant colors to different types of braces, enhancing code clarity.

![Bracket Pair Colorizer](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o5tr2qam9jgulbnc8gnd.png)

## 7. VS Code Icons 🖼️
   Aesthetics matter! Elevate your coding experience with file icons reflecting the language or framework you're working in.

![VS Code Icons](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lyb81f59herxx7qtp4mp.gif)

## 8. Polacode 📸
   Capture the beauty of your code with Polacode. Take stunning screenshots effortlessly with a simple shortcut.

![Polacode](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qkqo71gu2a8kb7e9ilgm.gif)

## 9. Code Time ⏰
   Track your coding journey! Code Time provides insights into progress, metrics, and even team collaboration – all for free.

![Code Time](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bbcus1kny1lk34or1uwn.png)

Thanks for exploring these awesome extensions with me!

Happy coding! 🚀💻
Special zeros
Tags: perl, python, theweeklychallenge
Published: 2024-01-21 10:42:14

## Weekly Challenge 252

Each week Mohammad S. Anwar sends out [The Weekly Challenge](https://theweeklychallenge.org/), a chance for all of us to come up with solutions to two weekly tasks. My solutions are written in
 Python first, and then converted to Perl. It's a great way for us all to practice some coding.

[Challenge](https://theweeklychallenge.org/blog/perl-weekly-challenge-252/), [My solutions](https://github.com/manwar/perlweeklychallenge-club/tree/master/challenge-252/sgreen)

## Task 1: Special Numbers

### Task

You are given an array of integers, `@ints`.

Write a script to find the sum of the squares of all special elements of the given array.

An element `$int[i]` of `@ints` is called special if i divides n, i.e. `n % i == 0`. Where `n` is the length of the given array. Also the array is 1-indexed for the task.

### My solution

Two pretty straight forward tasks this week, great way to get back into the new year. For this task, I create a variable `length` for the length of the list, and `solution` which starts with `0`. Then it is simply a matter of iterating through the array as follows:

```python
for pos in range(length):
    if length % (pos+1) == 0:
        solution += ints[pos] ** 2
```

### Examples

```bash
$ ./ch-1.py 1 2 3 4
21

$ ./ch-1.py 2 7 1 19 18 3
63
```

## Task 2: Unique Sum Zero

### Task

You are given an integer, `$n`.

Write a script to find an array containing `$n` unique integers such that they add up to zero.

### My solution

Looking at the example, I don't seem obvious how Mohammad come up with the numbers. Not to worry, I only need to come up with a solution that meets the criteria.

If `$n` is an even number, I can create pairs of an integer and its negative counterpart to add up to zero. If `$n` is odd, I can add a zero to ensure we have the correct number of integers.

```python
solution = []
half = n // 2

if n % 2 == 1:
    solution = [0]

for i in range(half):
    # Add a pair of numbers
    solution.insert(0, -i-1)
    solution.append(i+1)

print(*solution, sep=', ')
```

### Examples

```bash
$ ./ch-2.py 5
-2, -1, 0, 1, 2

$ ./ch-2.py 3
-1, 0, 1

$ ./ch-2.py 1
0

$ ./ch-2.py 6
-3, -2, -1, 1, 2, 3
```