teleren/devto huggingface dataset:
5 Reasons to Learn Python
Published: 2022-08-17 07:17:00

**Wikipedia:** Python is a high-level, interpreted, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation.

## 1. Main reason
Python is incredibly **easy to learn** and use **for beginners** and newcomers in the industry. The language is the most accessible among all the programming languages available because it has simplified syntax that is not complicated at all and gives more emphasis on natural language. Due to its ease of learning and usage, Python codes can easily be written and executed much faster than other programming languages. One of the main reasons why Python’s popularity has exponentially grown is due to its simplicity in syntax so that it could be easy to read and developed by amateur professionals as well. 

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

## 2. Python Automates Tasks
Python language can help automate several industrial tasks that require too many tools and modules. **It is incredible to know that one can reach an advanced level of automation easily by just using necessary Python codes.** The language is considered a performance booster in automation software testing. The developers only need to write **a few lines of code** for automation tools.

## 3. Has a Highly Supportive Community
Since is not only one of the most popular **programming languages,** but is also **one of the oldest**. Hence, it got the time to gather a growing, supportive community of programmers, developers, and coders. Because of this support, Python learners can easily develop **industry-required skills** and can be subjected to the right guidance.

## 4. The Language is Extensively used in Data Science
Whichever path you choose in the tech world, data will always be a part of it. Currently, Python is extensively used in **data science.** The amounts of data generated by data analytics tools are increasing every day, hence, experts need to learn programming languages like Python to handle **advanced technologies** for data analytics. Data professionals also need to stay updated with the latest tech developments in the industry to leverage the most advanced technologies.

## 5. Flexibility and Reliability
The Python language is **flexible** enough to provide developers with ample time to try new experiments. Python experts will not just stop at the usual things, instead, they will try to build new processes, technologies, or applications. It provides the developers with the freedom and flexibility that they need to just learn one language and utilize their **best potential and skills.**
Get your statistics assignments done faster with our experts
Tags: statisticsassignmenthelp, domystatisticsassignment, education, university
Published: 2022-08-17 07:07:47


Statistics may not be the most common discipline to study in college, but still, it is present in many courses. For students who study it, statistics represent a significant portion of what they do throughout their academic careers. Thus, there’s nothing unusual about having serious problems with the subject – there are so many obscure and difficult-to-understand aspects to statistics that make studying it a problem, especially if you don’t have a knack for numbers. It is quite common for college students to look to **[do my statistics assignment](https://www.statisticsassignmenthelp.com/do-my-statistics-assignment)** online. 

In statistics, as in any other discipline, much depends on the personal qualities and abilities of the person working on the problem. This is why we are so careful and selective when it comes to hiring experts in this. Only those who can prove their credentials and pass the many difficult exams get the opportunity to work with our clients and write their assignments. In other words, when you place an order with **[statistics assignment help](https://www.statisticsassignmenthelp.com/)**, you can be one hundred percent sure that the person assigned to your job is going to be an experienced expert in statistics. Do not worry about your task – we’ll take care of it and send the results back to you well before the deadline so that you'll have enough time to check it and see if everything is okay.

Our services:

- On-Time Delivery
- A+ Quality Assignments
- 50+ Subjects Assignment
- 3000+ Assignment Experts
- 24*7 Support Team
How to Handle Static Files in Production server of Django.
Tags: django, python, staticwebapps, beginners
Published: 2022-08-17 06:54:00

while working in the Development environment we use `python manage.py runserver` so Django makes the development environment faster automatically by serving the static files for us. 

`python manage.py runserver` command uses  `django.contrib.staticfiles` module to server the static files in development when DEBUG is set to True. if we set DEBUG to False then it does not uses `django.contrib.staticfiles`. and then we have to server our static files manually by 

```py
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    # ... the rest of your URLconf goes here ...
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

```

as described in the [Docs](https://docs.djangoproject.com/en/4.1/howto/static-files/#:~:text=For%20example%2C%20if%20your%20STATIC_URL%20is%20defined%20as%20static/%2C%20you%20can%20do%20this%20by%20adding%20the%20following%20snippet%20to%20your%20urls.py%3A)

In Production Django just dont want to serve static files for us its just neglect all of them.. so for that we have light weight library, which can easily solve this problem, Called [whitenoise](http://whitenoise.evans.io/en/stable/index.html).

solve your problem in three steps:-

1. install whitenoise `pip install whitenoise`.

2. `"whitenoise.middleware.WhiteNoiseMiddleware",` add this middleware to your `MIDDLEWARE` list in `settings.py`
 
3. `"whitenoise.runserver_nostatic",` add this line to your I`NSTALLED_APPS` list.

This is how i handled my static files in production as like so many other guys. Hope you can too!
Using Rails Model or SQL query in Ruby On Rails
Tags: sql, rails, ruby, api
Published: 2022-08-17 06:53:00

Although there can be multiple ways you can get data from your database, but here are two ways you can get data.

1. **Using Rails Model** -> In this method of data fetching we use rails model, which we create using `rails g model model_name`.

So the code is as follows:

```
def index
    @data = ModelName.all
    render_success_response @data
  end
```
In above piece of code

index -> name of the method

@data -> name of variable to store the data

.all -> rails method to get all the data from the respective table associated with the model

render_success_response -> default rails method to render a success response

Now there can be multiple methods we can use. Check out [devhints](https://devhints.io/rails-models) for references.

2. **Using SQL Query** -> In this method of data fetching we use direct SQL queries.

So the code is as follows:

```
def index
    sql = "select * from table_name"
    @data = ActiveRecord::Base.connection.execute(sql)
    render_success_response @data
  end
```
In above piece of code

ActiveRecord::Base.connection.execute() -> it is used to run sql queries in ruby on rails.

**Conclusion**
You can use both rails model or sql query in you code according to your use case.

**References**
[Dev Hints](https://devhints.io/)
5 Interview questions/tests
Published: 2022-08-17 06:48:00

These questions/tests include problem solving, knowledge testing and others. I took these from various sites. Hope you like and if you have any other tests, write them to comments for others to know!

## 1. What is programming ?
1. Programming is the process of creating **a set of instructions that tell a computer how to perform a task.**

2. Programming is a hands-on technical skill that involves **designing, creating, and refining code to solve problems,** build applications, and more.

3. Programming is the process of writing instructions for a computer in the form of code. Developers write the code in a programming language, and it is then translated into a notation **the computer can understand so that it can perform some task.** 


## 2. Give some exmaples for statements
A statement is a single line of code that performs **a specific task**.

#### Answer:
1. if, elif (else if), else
2. for
3. while
4. switch (not in python)


## 3. Give some exmaples for operators
An operator is a symbol that usually represents an action or process. These symbols were adapted from mathematics and logic. An operator is capable of manipulating a certain value or operand.

#### Answer:
1. +, -, *, /
2. ==, !=, >, <, >=, <=
3. && (and), || (or), ! (not)


## 4. What is an Array?
An array is commonly referred to as a collection of items stored at contiguous memory locations.


## 5. What is LIFO and FIFO:?
1. LIFO is an abbreviation for **Last In First Out**. It is a way of accessing, storing and retrieving data. It extracts the data that was stored last first.

2. FIFO stands for **First In First Out**. It is a way of accessing, storing and retrieving data. The data that was stored first is extracted first.

## A little tip
In an interview, you often need to talk. Speak every thought in your mind. If you think you have chosen a bad language, the interviewer will not care which language you use. They are looking for your problem solving and programming knowledge.
804. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-08-17 06:29:49

```
class Solution {
 public:
  int uniqueMorseRepresentations(vector<string>& words) {
    const vector<string> morse{
        ".-",   "-...", "-.-.", "-..",  ".",   "..-.", "--.",  "....", "..",
        ".---", "-.-",  ".-..", "--",   "-.",  "---",  ".--.", "--.-", ".-.",
        "...",  "-",    "..-",  "...-", ".--", "-..-", "-.--", "--.."};
    unordered_set<string> transformations;

    for (const string& word : words) {
      string transformation;
      for (const char c : word)
        transformation += morse[c - 'a'];
      transformations.insert(transformation);
    }

    return transformations.size();
  }
};

```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/unique-morse-code-words/
Jagged Array for C#
Tags: csharp
Published: 2022-08-17 06:28:31

最近在 LeetCode 刷題時，發現一個我不知道的東西—**不規則陣列（Jagged Array）**

從古自今，筆者對於陣列的認知不外乎就是一維與多維陣列，然而在工作上也從未遇過不規則陣列的使用，導致近日在刷題時，曾一度懷疑自己的眼睛，這是不是打錯了？井底之蛙的我馬上跪拜古哥，結果在 [C# 程式設計手冊](https://docs.microsoft.com/zh-tw/previous-versions/2s05feca(v=vs.110)?redirectedfrom=MSDN)發現了它的蹤影，廢話不多說，馬上來看！

不規則陣列（Jagged Array）是陣列的一種，其陣列內的元素也是陣列，不規則陣列的元素可以具有不同維度及大小，也是與多維陣列明顯的差異之處。

不規則陣列的宣告及初始化

```CSharp
// 不規則陣列的宣告方式
int[][] array = new int[5][];

// 初始化元素
array[0] = new int[6];
array[1] = new int[5];
array[2] = new int[4];
array[3] = new int[3];

// 使用 Initializer 直接填入陣列元素的值，無須設置大小
array[0] = new int[]{ 1, 2, 3 };
array[1] = new int[]{ 4, 6 };
array[2] = new int[]{ 7 };
```

從上述可知，多維陣列在同一維度下的元素大小必須相同，而不規則陣列的元素大小可以不同，不規則陣列內的元素是陣列，又稱為陣列中的陣列。

我們也可以在宣告時直接初始化元素

```CSharp
// 宣告時直接初始化
int[][] array = new int[][]
{
    new int[]{ 1, 2, 3 },
    new int[]{ 4, 6 },
    new int[]{ 7 }
};

// 或是不使用 new 運算子的縮寫格式
int[][] array =
{
    new int[]{ 1, 2, 3 },
    new int[]{ 4, 6 },
    new int[]{ 7 }
};
```

其指派值的方式與多維陣列相同

```CSharp
// 指派值 100 到第 [0] 個陣列的第 [1] 個元素
array[0][1] = 100;
// 指派值 100 到第 [1] 個陣列的第 [2] 個元素
array[1][2] = 200;
```

以上介紹的是一維不規則陣列，其中皆包含一維陣列的元素。不規則陣列還可以使用混合的不規則陣列，比如說，宣告及初始化一維不規則陣列，其中包含三個大小不同的二維陣列元素。

```CSharp
// 宣告及初始化
int[][,] array = new int[3][,]
{
    new int[,]{ {1,2}, {3,4}},
    new int[,]{ {5,6}, {7,8}, {9,10}},
    new int[,]{ {11,12}, {13,14}, {15,18}, {100,220}}
};

// 存取值的方式
Console.WriteLine(array[0][1,0]);
array[0][1,0] = 4;
Console.WriteLine(array[0][1,0]);
```

以筆者目前的工作性質來說，較不容易使用到不規則陣列，若以遊戲方面來說，我想物品欄應可透過這種方式來存取。

了解多維陣列與不規則陣列的差別後，還有一點很重要，多維陣列在分配空間上，所有元素的長度是固定大小，而不規則陣列的元素長度可以依需求分配，故不規則陣列對於空間利用優於多維陣列。

實際以儲存 1-5 的數字來看，二維陣列對子元素的空間分配必須是相同長度，故在存放 5 後的空間位置須補上 0，此處就是一個未被利用的空間；不規則陣列對子元素的空間分配較彈性，可以完全依照需求長度進行配置，才不會造成空間浪費

```CSharp
// 二維陣列
int[,] arr1 = new int[,]
{ 
    { 1, 2, 3 },
    { 4, 5, 0 } 
};

// 不規則陣列
int[][] arr2 = new int[][]
{
    new int[]{ 1, 2, 3 },
    new int[]{ 4, 5 }
};
```

使用迭代讀出所有元素方法

```CSharp
// 不規則陣列
int[][] arr = new int[][]
{
    new int[]{ 1, 2, 3 },
    new int[]{ 4, 5 }
};

foreach(int[] item in arr)
{
    foreach(int i in item)
    {
        Console.WriteLine(i);
    }
}
```

也可以使用 `SelectMany()` 讀取

```CSharp
var item = arr.SelectMany(s => s);

foreach (var i in item)
{
    Console.WriteLine(i);
}
```

---

Thanks for reading the article :tulip: :sunflower: :blossom:

If you like it, please don't hesitate to click heart button :heart:
or follow my [GitHub](https://github.com/FakeStandard) :star:
or buy me a coffee :arrow_down: I'd appreciate it.

[![Buy-me-a-coffee][1]][2]

[1]: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h077sxd0vx1hix4t7lw8.png
[2]: https://www.buymeacoffee.com/FakeStandard
Docker storage commands?
Tags: docker, devops, webdev, tutorial
Published: 2022-08-17 05:22:57

## Create volume:

```
$sudo docker volume create  volume-b1
volume-b1
```
**Inspect a Volume**
```
$ sudo docker inspect volume-b1
[
    {
        "CreatedAt": "2022-08-17T09:52:47+05:30",
        "Driver": "local",
        "Labels": {},
        "Mountpoint": "/var/lib/docker/volumes/volume-b1/_data",
        "Name": "volume-b1",
        "Options": {},
        "Scope": "local"
    }
]
```
**list a volume:**
```
$sudo docker volume ls
 
DRIVER    VOLUME NAME
local     vol-busybox
local     volume-b1

```
**delete a volume:**

```
 $sudo docker volume rm volume-b1
```

## Mount the driver to a container
1. -v or --volume :  contains all fields and also order should be maintained
   * name of the volume
   * path
   * options like _ro_--(read-only)
```
$ sudo docker run -d --volume vol-ubuntu:/tmp ubuntu
14efcc03cc75c98877f1074bc30d3570b4f062c122cccb83272409d677c9ae4c

```

2. --mount: Separate fields , and contains as key-value pair, order is not important, easier to understand.

```
$ docker service create \
    --mount 'type=volume/bind/tempfs,src=<VOLUME-NAME>,dst=<CONTAINER-PATH>,volume-driver=local,volume-opt=type=nfs,volume-opt=device=<nfs-server>:<nfs-path>,"volume-opt=o=addr=<nfs-address>,vers=4,soft,timeo=180,bg,tcp,rw"'
    --name myservice \
    <IMAGE>
```

```
$ sudo docker run -d   --name devtest   --mount source=myvol2,target=/app   nginx:latest
8639e7cc80f422fdbc00b7209a3f976368af7692d38f75b4310b81961c27fc11
```
**inspect volume: **

```
$ sudo docker inspect myvol2
[
    {
        "CreatedAt": "2022-08-17T10:37:28+05:30",
        "Driver": "local",
        "Labels": null,
        "Mountpoint": "/var/lib/docker/volumes/myvol2/_data",
        "Name": "myvol2",
        "Options": null,
        "Scope": "local"
    }
]

```
Angular Library Dependencies vs PeerDependencies
Tags: angular
Published: 2022-08-17 04:13:04

Dependencies serve many different purposes. Some dependencies are needed to build your project, others are needed when you’re running your program.

# Dependencies
The libraries under dependencies are those that your project really needs to be able to work in production. Usually, these libraries have all or part of their code in your final bundle(s).

```
npm install MY_PACKAGE
``` 
or 
```
yarn add MY_PACKAGE
```

Adding package dependencies on Angular Library project.  

#### 1. Root package.json 
Make sure your package added on root `package.json` `dependencies` section.

```json
....
  "dependencies": {
      ...
      "MY_PACKAGE": "VERSION"
}
```

#### 2. Project package.json 
The same package should add on the Angular Library project `package.json` `dependencies` section also.

```json
....
  "dependencies": {
      ...
      "MY_PACKAGE": "VERSION"
}

```

#### 3. Project ng-package.json 
Package name should added on the Angular Library project `ng-package.json` `allowedNonPeerDependencies` array section.

```json
....
  "allowedNonPeerDependencies": [
      "MY_PACKAGE"
]

```


#PeerDependencies
You want to create and publish your own Angular Library so that it can be used as a dependency, you may also need the peerDependencies. 

In the `package.json` file, there is an object called as `peerDependencies` and it consists of all the packages that are exactly required in the project or application who is downloading and the version numbers should also be the same.

#### 1. Root package.json 

Make sure your package added on root `package.json` `dependencies` section.

```json
....
  "dependencies": {
      ...
      "MY_PACKAGE": "VERSION"
}
```

#### 2. Project package.json 
The same package should add on the Angular Library project `package.json` `peerDependencies` section also.

```json
....
  "peerDependencies": {
      ...
      "MY_PACKAGE": "VERSION"
}

```
7 Essential Security Terms - Part 2
Tags: security, android, ios, mobile
Published: 2022-08-17 05:15:00

Continue to [7 Essential Security Terms - Part 1](https://dev.to/teamliapp/7-essential-security-terms-part-1-2nmd), in this post we'll discuss what is the meaning of Debugging, Code Obfuscation and Code Encryption.


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

-Successful Service Business-

**5. Debugging**
Debugging refers to a test process in the final stage of program development that explores program errors and its causes to solve those existing problems. Yet, hackers, or malicious users, exploit debugging as a conduit for analyzing program behavior and security vulnerabilities.


**6. Code Obfuscation**
Code Obfuscation refers to, breaking down and totally modifying the source code so that it is difficult for the third party to understand the code while keeping the original features of the app. It's a technique to protect important information from being stolen.

Changing the meaningful name on the class, method, field, etc. written in the source code to a name that cannot be easily inferred is also a type of code obfuscation technique. Ex) Changing name 'Buy_Item' -> 'a' However, be aware that obfuscation mainly takes a role of slowing down the time of source code analysis and analogy, not preventing attacks such as malicious changes in apps or memory changes. 


**7. Code Encryption**
Encryption is usually referred to a technique that protects important information (ex. A crucial and confidential document files) from being recognized. Ex) A crucial and confidential document files. However, in the case of LIAPP, encryption techniques are applied not only to general files but also to source codes to provide a safe running environment for apps. 


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

-Source Code Protection with LIAPP-

Hope the above information is helpful for you to prepare the essential security elements for the app service and grow into a successful one. If you have any questions, please leave a comment in discussion section!

To know more about how to protect your mobile app?
[Come and visit LIAPP](https://liapp.lockincomp.com/?utm_source=devto&utm_medium=social&utm_campaign=20220817) :)
Rapidity: распределённый rate limiting
Tags: ruby, rails, distributedsystems, microservices
Published: 2022-08-17 05:14:09

Когда ваш продукт начинает активно использоваться, то перед вами обязательно встаёт вопрос масштабирования, а вслед за ним и проблема ограничения доступа к чему-нибудь: [Rate Limiting](https://en.wikipedia.org/wiki/Rate_limiting).

RNDSOFT не исключение, поэтому в этой статье мы расскажем небольшую историю и поделимся своим инструментом: [https://blog.rnds.pro/030-rapidity](https://blog.rnds.pro/030-rapidity?utm_source=devto&utm_medium=post&utm_campaign=rnds)


![rapidity](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uratxhkufh5ygl3n72pj.jpeg)
Pre Signed URL in less than 3 minutes on Amazon S3
Tags: aws, storage, cloudskills, s3
Published: 2022-08-17 05:12:00

 Presigned URL , What is it?  A pre signed URL allow you to share the content of your bucket  so that friends and families can  view it for a limited period of time.  It is a time stamped public link giving outsider a limited access to a content hosted on AWS S3 bucket. 

  Head to  your AWS S3 portal and create an a bucket. Make  Make sure to select the region you wish to have the bucket hosted. 
sure that the bucket name is unique as required by AWS (Globally Unique ) .Bellow are the following rules that applied to AWS bucket names:

- Bucket names must be between 3 (min) and 63 (max) characters long.
- Bucket names can consist only of lowercase letters, numbers, dots (.), and hyphens (-).
- Bucket names must begin and end with a letter or number.
- Bucket names must not contain two adjacent periods.
- Bucket names must not be formatted as an IP address (for example, 192.168.5.4).
- Bucket names must not start with the prefix xn--.

To learn more about bucket naming restrictions,  follow the link [here](https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fg1cz39o8etwzx2t1235.JPG)
 Once you have the bucket create and the file loaded, select the file and head to the "Action" tab and select : "Share with a presigned URL 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/74ahy471zpy8tmarkyba.JPG)

On the next window select how long you would like the presigned URL to stay active (TTL Time to Live) and the click on " Create presigned URL"


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

Grab the link on the top right corner and share it . 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/56rsshzevdg1cts54f2g.JPG)

 Enjoy

 Lets link up on twitter @askouley
Rails 7: три мощных ответа JavaScript’у в 2021+
Tags: rails, ruby, webdev, r
Published: 2022-08-17 05:01:24

[https://blog.rnds.pro/026-three-great-answers](https://blog.rnds.pro/026-three-great-answers?utm_source=devto&utm_medium=post)

_Перевод статьи "Rails 7 will have three great answers to JavaScript in 2021+"_
_David Heinemeier Hansson (DHH) от 6 сентября 2021 года._

![rails 7](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1fkftwj82fdawp5vouog.jpeg)
Вы хочете песен? Их есть у меня! (Poison Message #2)
Tags: rabbitmq, microservices, eventdriven, ruby
Published: 2022-08-17 04:54:00

Самое время рассмотреть “достаточно хороший” алгоритм для борьбы с Poison Message. Здесь будет уже специфика RabbitMQ и к Apache Kafka она не применима, точнее применима только частично - но это уже совсем другая история. 

> В [первой части мы разобрали несколько примеров](https://blog.rnds.pro/018-posion1?utm_source=devto&utm_medium=post) и сформулировали проблему Poison Message, здесь же рассмотрим сам алгоритм её решения.

[https://blog.rnds.pro/019-poison2](https://blog.rnds.pro/019-poison2?utm_source=devto&utm_medium=post)


![Poison Message](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tb1h6qlxw7s56y08os3y.jpeg)