teleren/devto huggingface dataset:
Svelte Summit Fall 2022: SvelteKit hits RC phase! 🎉
Tags: svelte, javascript, sveltekit, html
Published: 2022-09-10 13:05:34

Svelte Summit 2022 took place in Sweden from 8th to 9th September. Rewatch the talks here:

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

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

Biggest announcement of the summit certainly was SvelteKit entering the release candidate (RC) phase:
{% twitter https://twitter.com/geoffrich_/status/1568264897905164289 %}

Learn more about Svelte and SvelteKit:

- https://svelte.dev/
- https://kit.svelte.dev/
- https://sveltesociety.dev/
- https://www.sveltesummit.com/
System Design: Transactions
Tags: distributedsystems, architecture, tutorial
Published: 2022-09-10 12:55:52


A transaction is a series of database operations that are considered to be a _"single unit of work"_. The operations in a transaction either all succeed, or they all fail. In this way, the notion of a transaction supports data integrity when part of a system fails. Not all databases choose to support ACID transactions, usually because they are prioritizing other optimizations that are hard or theoretically impossible to implement together.

_Usually, relational databases support ACID transactions, and non-relational databases don't (there are exceptions)._

## States

A transaction in a database can be in one of the following states:

![transaction-states](https://raw.githubusercontent.com/karanpratapsingh/portfolio/master/public/static/courses/system-design/chapter-II/transactions/transaction-states.png)

### Active

In this state, the transaction is being executed. This is the initial state of every transaction.

### Partially Committed

When a transaction executes its final operation, it is said to be in a partially committed state.

### Committed

If a transaction executes all its operations successfully, it is said to be committed. All its effects are now permanently established on the database system.

### Failed

The transaction is said to be in a failed state if any of the checks made by the database recovery system fails. A failed transaction can no longer proceed further.

### Aborted

If any of the checks fail and the transaction has reached a failed state, then the recovery manager rolls back all its write operations on the database to bring the database back to its original state where it was prior to the execution of the transaction. Transactions in this state are aborted.

The database recovery module can select one of the two operations after a transaction aborts:

- Restart the transaction
- Kill the transaction

### Terminated

If there isn't any roll-back or the transaction comes from the _committed state_, then the system is consistent and ready for a new transaction and the old transaction is terminated.


---

_This article is part of my open source [System Design Course](https://github.com/karanpratapsingh/system-design) available on Github._

{% github karanpratapsingh/system-design %}
How to import bots from Automation Anywhere Community Edition
Tags: automationanywhere, a360, rpa, rpadeveloper
Published: 2022-09-10 12:53:37

We frequently start tinkering with the Community Edition Control Room as we start our RPA journey with A360 to built awesome bots. When we finally get the enterprise control room, we end up having to recreate all of the use cases in the new control room, which is tedious job. 

> Follow the instructions below to transfer your bots from community to enterprise CR.

### Community CR

- Login to community CR

- Navigate to the bot which you want to export

- Capture `content` backend API call using Developer tools in any browser


![content](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fow29krehtpjsnsxjwkr.png)

- Copy the content API call response 

### Enterprise CR

`Lets switch to enterprise control room`
- Login to enterprise CR
- Create a new bot with any command `Ex: Message Box`

![Bot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6n4uaa29ug5i931lh71i.png)

- Check-in the task bot

![Check-in](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fn3fmc6osx54ypupkz5m.png)

- Export the bot and download the zip file to your local HDD

![Export the bot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8l924swvmslkn98p9wam.png)


![Click Export](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/04g5znowq2q0dg1cysjg.png)


![Download Zip](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/diq6r901wtjyt6jjo16d.png)

- Extract the zip, go to Automation Anywhere\Bots\Dev folder and edit the file `Enterprise_Bot` using Notepad and delete the existing content.

![Enterprise_Bot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fl6lc1eb8v4b17kysuis.png)

- Copy the previously collected response from community CR to this file and save it.
- Rezip the main folder and then import it back to enterprise CR

![import](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hnm61ybs31u3at5zq7lj.png)

- Edit or view the bot, you will see the community bot details over here.

![Enterprise Bot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1bexladte53gm8ioykah.png)

### Conclusion

Hopefully you found it interesting to learn how to import bots from CE to Enterprise CR. Feel free to share your experience and the number of bots you have migrated from CE to Enterprise CR.
How to use DynamoDB data import
Tags: aws, serverless, cloud, database
Published: 2022-09-10 12:38:30

## Introduction
Last month updated, DynamoDB has provided a data import feature🎉 [(Reference)](https://aws.amazon.com/jp/blogs/database/amazon-dynamodb-can-now-import-amazon-s3-data-into-a-new-table/). New tables can be created by importing data in S3 buckets.

The data export to S3 has been available so far, but now import is finally possible, and the combination of the two makes it possible to create and restore backups easily and conveniently!

I used this feature this time because I needed to redesign the DynamoDB partition key and sort key, and it was very useful. I know that many people have written scripts for data import when recreating Dynamo (I did too), but from now on, scripts are no longer necessary😎! 

Please refer to the following instructions💡

## How to use
### 1. Export data to S3
Firstly, I export data to an S3 bucket. So I access the DynamoDB table and use the Export to S3 feature.

![1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lh88qs9m9h6bhv1516xg.png)


Set your S3 bucket and wait for the executed.

![2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qkmsyib06uti2hu32rmj.png)

Done!

![3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q0fo86spzzz9s41rlcm4.png)



### 2. Import data from S3
Now, I do the import feature using the exported data. Access to the "Imports from S3" menu from left side menu.

![4](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oqondg43hgenpmmzxcwu.png)

Set the import data information. Please note that S3 Exported data will be GZIP and JSON format by default.

![5](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wvh7f3ev674xcdedazg8.png)

Note that as for `Source S3 URL`, the imported data resides in the bucket's `data` directory, so the URL selection should be set the `data` directory.
![6](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3mmz0iqtymzyl9y1rydq.png)

Determine the table name, partition key, etc. to be imported.
![7](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ssrrze40c1g0vvt2bka3.png)

Table settings can also be selected.(I set default here)
![8](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1twfepzhofirvvckgvl3.png)

If all is well, press the Import button to execute.
![9](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nb6ygn78eluu26f4emsy.png)

Done!
![10](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r01oo5quc4j52rjq70kt.png)


### 3. Confirm the result
I have successfully confirmed that the table exists!
![11](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bv1nef6mdd8abbras7z8.png)

I also looked at it from NoSQL Workbench! I can confirm that the metadata is set correctly, including the various keys I have set.
![12](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ah36xcojquwgck8u1fq.png)

## Conclusion
Import function, extremely useful🤣🤣🤣 
It would be very good when restoring from backups, recreating key settings, etc.😇😇😇

**Thank you for reading!**
.NET 6 - Web API Logging 📝
Tags: dotnet, logs, tutorial, api
Published: 2022-09-10 12:25:29

In this article we will be discussing logs in .NET 6 WebAPI and how we can utilise the WatchDog package to integrate it within our application.

You can watch the full video on youtube 
{% embed https://youtu.be/LO-QKMHK5ps %}

And you can find the full source code on Github
https://github.com/mohamadlawand087/webapi-log

Why use WatchDog:

- RealTime HTTP Request and Response Logger
- RealTime Exception Logger
- In-code message and event logging
- User Friendly Logger Views
- Search Option for HTTP and Exception Logs
- Filtering Option for HTTP Logs using HTTP Methods and StatusCode
- Logger View Authentication
- Auto Clear Logs Option

## Code

Create a new WebApi application

```csharp
dotnet new webpi -n DataLog
```

Install the nuget package

```csharp
dotnet add package WatchDog.NET
```

Now we need to configure our application to work with the DogWatch library inside the program.cs we need to add the following

```csharp
builder.Services.AddWatchDogServices();
```

We can take the WatchDog service configuration to the next step by updating the following

```csharp
builder.Services.AddWatchDogServices(opt =>
{
    opt.IsAutoClear = true; // clears the logs after a specific duration
    opt.ClearTimeSchedule = WatchDog.src.Enums.WatchDogAutoClearScheduleEnum.Monthly; // specify when it will automatically clear the logs
});
```

We want to be able to store the logs in a database so we can refer back to them, for that we will be utilising PostgreSQL

First we need to make sure that PostgreSQL is installed on our machine

```csharp
brew install postgresql
```

Starting and Stoping Postgres is running

```
brew services start postgresql
brew services stop postgresql

```

Connect with Postgres

```
psql postgres

```

Create User and Pass so we can utilise them in our .NET app

```
CREATE ROLE devuser WITH LOGIN PASSWORD '12345678';
ALTER ROLE devuser CREATEDB;
ALTER ROLE devuser WITH Superuser;
```

Create a Database

```
create database sampledblogs;

```

Grand permission to the db

```csharp
GRANT CONNECT ON DATABASE sampledb TO mohamad;
```

Update AppSettings with connection string

```csharp
"ConnectionStrings": {
    "SampleDbConnection": "User ID =devuser;Password=12345678;Server=localhost;Port=5432;Database=samplelogs; Integrated Security=true;Pooling=true;"
  }
```

Now we need to enable the db connection to watch dog

```csharp
builder.Services.AddWatchDogServices(opt => 
{
    opt.IsAutoClear = false;
    opt.SetExternalDbConnString = builder.Configuration.GetConnectionString("SampleDbConnection");
    opt.SqlDriverOption = WatchDog.src.Enums.WatchDogSqlDriverEnum.PostgreSql;
});
```

Now we need to enable exception logs

```csharp
app.UseWatchDogExceptionLogger();
```

Next we need to enable admin portal

```csharp
app.UseWatchDog(opt => 
{ 
   opt.WatchPageUsername = "admin"; 
   opt.WatchPagePassword = "Mohamad123!"; 
 });
```
Nested loop practice.
Tags: beginners, programming, python, loop
Published: 2022-09-10 12:22:02

**1.Introduction to `For loop`**
For loop is used to iterate over a sequence. With the help of `for loop` all the items present in the sequence are accessed one by one.
  
**2.Trick to solve nested `loop `questions easily**
Let the first `loop `condition be Days and the other `loop `conditions be sessions. Linking this analogy to the daily life of a student- a student has to sit in all sessions every day.

For example-
```
for i in range(3):
 for j in range(6):
   print(j, end=' ')
```
**TRICK TO SOLVE ABOVE QUESTION**:
Let i = Days(Monday, Tuesday, etc..) &
j = Sessions(Mathematics, Science, etc..)
range for i = (0,1,2)
range for j = (0,1,2,3,4,5) 
Iteration 1:

i=0, the condition becomes True and the `loop `will be connected and the day will be Monday. There are 6 sessions in j, and a student must sit in all sessions daily.
So, the result will be: 0 1 2 3 4 5
Iterations 2:

i = 2, the condition becomes True and the day will be Wednesday. Result: 0 1 2 3 4 5 

**Final Output:**
0 1 2 3 4 5 0 1 2 3 4 5 0 1 2 3 4 5 


Example 2:

```
my_string =['Mathematics','Science','History']
for i in range(len(my_string)):
  for x in range(4):
    print(x, end=(' '))
```
**Explanation:**
Iteration 1:

Range for i = (0,1,2)
Range for x = (0,1,2,3)
i = 0, Day 1 i.e Monday, we have to sit in all sessions So, the output becomes: 0 1 2 3
Iteration 3:

i = 2, Day 3 is Wednesday and after sitting in all sessions, output comes out to be: 0 1 2 3.
**Final output**
0 1 2 3 0 1 2 3 0 1 2 3
Need a Feedback!
Tags: html, node, css, mongodb
Published: 2022-09-10 12:20:22

Warning! There are all of nudity stuff in thumbnail, so if you are not with that don't look at it.
I have host the website using my pc, so if the link not work send a message in telegram ( https://t.me/RunTimeX ) I will send you the link.

I have created a movie trailer website, but I will convert it to movie website in future.
here is the link : https://danz.loca.lt/

I need a feedback about any thing need to be added or problem in ui, something like that.
What to do when you want to use an async function inside of an async function?
Tags: javascript, programming, webdev
Published: 2022-09-10 11:58:27

The problem: I needed both Firebase functions `listAll()` and `getDownloadURL()` to work together in one custom function which takes images directory and return images' url. 

###The code I came to
```js
...
export const getImages = async (dir) => {
  let data = []
  const storage = getStorage()
  const listRef = ref(storage, dir)
  await listAll(listRef)
    .then(res => {
      res.items.forEach(itemRef => {
        getDownloadURL(itemRef)
          .then(url => {
            data.push(url)
          })
      })
    })
  return data
}
```
It didn't work cuz it turned for me out that there's no way to nest async functions. So I just asked a question on [StackOverflow](https://stackoverflow.com/questions/73658806/firebase-storage-listall-together-with-getdownloadurl-doesnt-work-out) and someone helped me out. The key to the solution was [promise chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#chaining).
###The solution
```js
export const getImages = async (dir) => {
  let data = []
  const storage = getStorage()
  const listRef = ref(storage, dir)
  const res = await listAll(listRef)

  const promises = res.items.map(itemRef => getDownloadURL(itemRef))
  const data = await Promise.all(promises)
  console.log(data)

  return data
}
```
Help with entrepreneurship and starting a SaaS
Tags: startup, saas, entrepreneurship, help
Published: 2022-09-10 11:42:43


Hi!

I have a few years of experience as a full-stack developer and I have a job that I enjoy very much, but for the last year or so I have been obsessed with the idea of starting my own SaaS company. But I have neither any idea nor knowledge of how to start a SaaS company...

I have previously worked at a small SaaS company so I have some experience but mostly the technical side.

I want tips on books or courses about entrepreneurship and how to start a SaaS company.

Any help is appreciated!
== Vs === confusion Solve...🌟
Tags: javascript, es6, webdev, beginners
Published: 2022-09-10 11:33:13

Before knowing the difference between **"=="** vs **"==="** in JavaScript lets know about what are the **==** and **!=** operator. 
**== vs !=**
so the double equals **(==)** operator use to check if two values are equals and not equals **(!=)** if the two values are not equal 
and its return type is always boolean like **true **or **false**.

In == and != both operater do type conversion before comparing the elements For **e.g : - 2 == '2'** so in this **==** operate do type conversion implicitly like before comparing it will do implicitly type coercion like **2 == Number('2')** and then it will show output as **true **so this is what happens when we compares using == operater before showing output it add string '2' value in number fucntion and convert into number 2 and the comparing's we get the output as a true which 2 == 2
**for E.g **

```
let xxx = 2;
let xxxx = '2';
console.log(xxx == xxxx);// true
```

Now Check with === operater is also called as strictly equality operator thats means it will not do any type conversion  internally

**For E.g:** 

```
let x = 1;
let y = '1'
console.log(x===y)// output will false
```
גאמא סייבר- רשימת נושאים
Published: 2022-09-10 09:40:26

#רשתות / Networks
**DNS**:
1. https://www.isoc.org.il/technologies-and-infrastructure-services/what-is-dns
2. https://www.geeksforgeeks.org/domain-name-system-dns-in-application-layer/


**Broadcast**:
1.https://www.firewall.cx/networking-topics/general-networking/109-network-broadcast.html


**Socket, TCP, Bind-listen-accept**:
1.https://www.cs.dartmouth.edu/~campbell/cs50/socketprogramming.html קישור נהדר עפתי על כל הסבר והסבר, אם אתם  תרצו בעברית ממליץ ללכת על ספר רשתות בגוגל


**IpConfig**:
1.https://www.techopedia.com/definition/4981/internet-protocol-configuration-ipconfig#:~:text=Internet%20Protocol%20Configuration%20(ipconfig)%20is,this%20data%20on%20a%20screen


**POST/GET methods**:
1. https://www.hamichlol.org.il/HTTP_POST
2. https://www.w3schools.com/tags/ref_httpmethods.asp

**Wireshark**:
1. https://iw.theastrologypage.com/wireshark



#אבטחה / Security

**Firewall/חומת אש**:
1.https://www.eset.com/il/firewall/
2.https://www.checkpoint.com/cyber-hub/network-security/what-is-firewall/


**DOS**:
1. https://www.bezeq.co.il/bloghome/Surfing/ddos/
2. https://www.cloudflare.com/learning/ddos/what-is-a-ddos-attack/

**SQL injection**:
1. https://www.gov.il/he/departments/publications/reports/sql_injection
2. https://www.cisa.gov/uscert/sites/default/files/publications/Practical-SQLi-Identification.pdf
3. https://www.cisa.gov/uscert/sites/default/files/publications/sql200901.pdf


#Windows / חלונות


**Threads**:
1. https://www.informit.com/articles/article.aspx?p=362660
2. https://www.hamichlol.org.il/%D7%AA%D7%94%D7%9C%D7%99%D7%9B%D7%95%D7%9F

**%SYSTEMROOT%**:
1. https://networkencyclopedia.com/systemroot/

**CMD**:
1.https://www.techtarget.com/searchitoperations/tip/When-to-use-the-Windows-command-prompt-vs-PowerShell
2.https://www.techtarget.com/whatis/definition/command-prompt

**DLL**:
1.https://docs.microsoft.com/en-us/troubleshoot/windows-client/deployment/dynamic-link-library\
2.https://www.youtube.com/watch?v=4daUujBgQQ8

**Desktop**:
1.https://www.techtarget.com/searchenterprisedesktop/definition/desktop

**Task Manager**:
1.https://www.howtogeek.com/405806/windows-task-manager-the-complete-guide/
SITE-TO-SITE CONNECTIVITY
Published: 2022-09-10 10:52:24

A site-to-site virtual private network (VPN) is a connection between two or more networks, such as a corporate network and a branch office network. Many organizations use site-to-site VPNs to leverage an internet connection for private traffic as an alternative.

Creating a **Site-to-Site** Connectivity: 
Block Diagram of the connectivity we will be making shown below.

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

- We need to have **SUBSCRIPTION** in my case I'm using **STUDENT SUBSCRIPTION.**
- Creating a **Resource Group**.

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

- Creating a **Virtual Network** and **2 Subnets**.

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

- After creating the **Virtual Network** and **Subnets** we create the **GATEWAY SUBNET**.

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

- Now we create a **LOCAL NETWORK GATEWAY**, and **2 Subnets** that needs to be allowed by the company’s Subnet(if required).

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

- Then we create a **VIRTUAL NETWORK GATEWAY**. This will take around 25-30mins to be created.

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

- After the **Virtual Network Gateway** is created, we go to the **CONNECTIONS** tab and configure it and add it.

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

- After the connection is made we click on it and then we click on **Download Configuration**.
Here we provide **Device Vendor**, **Device Family** and **Firmware Version** and **download the configuration file**.

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

- This file is then shared with the **client** so that they can configure from their end and **Site-to-Site connectivity** can be done.

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

By doing this we successfully completed the Site-to-Site(S2S) Connectivity using AZURE.

Stay tuned for my upcoming blogs.

Thank You !
Think First, Code Second
Tags: javascript, codereview
Published: 2022-09-10 10:51:54

From time to time I see code from colleges or other people, that seems to be to complicated or architectures that consists of many parts, more than I would add.

My questions: Why is that? 

I think they simply follow a known pattern read or seen anywhere.

They do not think about it first, is something really needed or who needs it.

Adding a statemanagement library like Pine, adding Axios for the REST API, MinIO for Object Store, Elastic Search and so on. And sometimes it is even more strange, when the framework itself has a solution for this and you do not have to add another one.

I would suppose: Think first, start lean and simple, use interfaces to hide implementation details and only switch to bigger players when really needed.

What do you think? How would you start a project?