teleren/devto huggingface dataset:
What is Module?
Tags: python, programming, beginners, webdev
Published: 2022-01-21 21:19:35

A module is a file containing Python definitions and statements which we can use in other Python programs.
A module is simply a “Python file” which contains code(functions, classes,lists etc)  we can reuse in multiple Python programs. 

Modules in Python can be of two types:

Built-in Modules.
User-defined Modules.

Modules allows us to use the functionality we need when we need it, and it keeps our code cleaner.

The functions we import as part of a module stays in their own namespace.(A namespace is simply a space within which all names are different from each other). The same name can be reused in different namespaces but two objects can’t have the same name within a single namespace.
 
For example, Many cities have a street called “Main Street”,
It is okay if 'different' cities have that 'same' street name but it’s very confusing if two streets in the same city have that same name!

Another example is the folder organization of file systems. One can have a file called "todo" in her work folder as well as her personal folder, but she knows which is which because of the folder it’s in; each folder has its own namespace for files.
 
One important note, human names are not part of a namespace that applies uniqueness; that’s why governments have invented unique identifiers to assign to people, like passport numbers.

In order to use Python modules, we have to import them into a Python program.

1)If we import morecode in a code, that imports everything in morecode.py. To invoke a function f1 that is defined in morecode.py, we can write morecode.f1().
``` morecode.f1 ```
Note that we have to explicitly mention morecode again, to specify that we want the f1 function from the morecode namespace.If we just write f1(), python will look for an f1 that was defined in the current file, rather than in morecode.py.

2)We can also give the imported module an alias (a different name, just for when we use it in our program). For example, after executing import morecode as mc, 
we would invoke f1 as mc.f1(). We have now given the morecode module the alias mc. Programmers often do this to make code easier to type.

3)A third possibility for importing occurs when we only want to import SOME of the functionality from a module and we want to make those objects be part of the current module’s namespace. 
For example, we could write from morecode import f1. Then we could invoke f1 without referencing morecode again: f1().
Graph vs SQL vs NoSQL Part 1: Theory
Published: 2022-01-21 21:13:54

## **SQL:**
The age-old standing solution to persist data in a query-able manner has stood the test of time. It started with Web 1.0 and is still serving in Web 2.0. SQL databases store data where rows placement takes precedent over the columns, i-e singular rows are expected to be of more importance to ensure foreign key constraints across tables. This ensures the strong consistency of keys within the table and across the tables as well. Moreover, SQL provides a lot of precise filters to operate on attributes within the table and complex joins to go beyond a table. It also provides enriched features to what goes within your table, I-e you can define constraints other than your keys.





## **NoSQL:**
NoSQL originated with the birth of Web 2.0. Web 2.0 became quickly abundant with data at rest and in transit. SQL faced dire consequences of the bulk of load moving in and out. Those were the few challenges that were faced by SQL databases. NoSQL tackled the problem by being able to shard horizontally. But, in order to be able to shard horizontally, shards used the concept of hash maps to distribute table keys. Columns took exclusive precedence instead of rows for the access pattern. This had a reason, in order to bulk load values, the row-by-row access pattern had to be removed. It solved two problems, the first one being bulk loading data by fetching the entire columns and the other one being column values share more resemblance than row values, so, it yelled better compression ratios. But data embedding and establishing relations across tables became a problem since there is no foreign key to extend the relations. This was partially solved by the massive reduction in storage prices. NoSQL SQL proffered storing data with relations within the same table even if it meant replication of some attributes to favor speed. NoSQL doesn’t provide constraints on attributes. So, a faster speed with a less grip on the data than SQL.




## **Graph:**
Graph databases contain a mix of both two. Based on graph theory, it uses a linked-list data structure that captures the qualities of SQL and NoSQL databases. Graph databases provide precedence over the row operations but distribute the entities by hashed node ids. It provides NoSQL-like columnar distribution but has relations to serve as foreign keys to establish relationships with different entities without creating replicated data. Complex join operations requiring foreign keys are replaced with an already established path between nodes, called relationships. Labels are just a columnar grouping of nodes with a logical category that speeds up columnar queries. It provides constrains on attributes as well and is still schema-less like NoSQL but provides the grip of data like SQL.
Boas práticas no desenho de APIs - 11 Dicas úteis
Tags: rest, api, beginners, programming
Published: 2022-01-21 20:11:59

## 1 - Organize APIs ao longo de recursos

- Não usar verbos no nome da URI e sim substantivos que são os dados aos quais a API fornece acesso
- Ex: GET /v1/public/stories, GET /v1/public/stories/{storyId}/series, GET /v1/public/series
- Link de api de exemplo https://developer.marvel.com/docs

## 2 - Padronização da Api

- Usar prefixo de versão /v1, /v2
- Usar prefixo de exposição /public, /private
- Usar recursos no plural /events
- Ex de uri: https://gateway.marvel.com:443/v1/public/events

## 3 - Evitar Api anêmicas

- Pensar no negócio
- Os endpoints devem refletir as Regras de negócio e não a base dados

## 4 - Criar Api simples

- Evitar criar URIs grandes
- O ideal é utilizar 3 níveis: coleção/item/coleção

## 5 - Considerar a atualização em lotes

- Evitar que o Cliente tenha que fazer um loop e chamar várias vezes o endpoint para poder atualizar mais de um recurso

## 6 - Se precisar receber datas e horas utilize o padrão ISO 8601

- https://api.com/{timestamp}
- https://api.com/YYYYMMDDThhmmssZ
- https://api.com/1937-01-01T12:00:27.87+00:20

## 7 - Documente sua API

- A maioria dos devs irão verificar as docs antes de tentar qualquer esforço de interação
- Ex de ferrameta: Swagger

## 8 - Sempre use HTTPS/SSL

- Pense sempre em segurança

## 9 Versione suas APIs

- Ex: https://api.com/v1/aulas

- Considere o versionamento da sua API necessário toda vez que uma mudança resultar em breaking changes do lado do cliente.

## 10 - Crie e use paginação

- Facilita a utilização educada do servidor
- Usar limit e offset

## 11 - Utilize corretamente os códigos de retorno HTTP

- Se está implementando um GET e foi bem-sucedido o retorno deve ser status code 200
- Link com informações sobre status code https://developer.mozilla.org/pt-BR/docs/Web/HTTP/Status




Referências:

https://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api
https://martinfowler.com/articles/richardsonMaturityModel.html_
Welcome to decentralized management - 100 Days of CSH #2
Tags: management, productivity, beginners, programming
Published: 2022-01-21 21:06:51

In today's article I'll explain a bit more about the work management which company I currently work for follows.

In basic term **Holacracy** is a system for managing a company where employees have the flexibility to take on various tasks and move between teams freely. The organizational structure of a holacracy is rather flat, with there being little hierarchy. Thus I named it decentralized in the title. There are about 200 people working in the company I work for and this system is working well so far (it's been actually more than 3 years since the change).

![Holacracy organization structure](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/psz3e668z65rmgmvp0hm.png)
 
Unlike traditional management, power is not given to people or positions, but to roles and circles.
There are four roles that make up the basic structure. They are: Lead Link, Rep Link, Facilitator and Secretary. I'll describe each of them throughout the next articles.

:arrow_double_down: Daily progress check update :arrow_double_down: 

According to the work I've done on the first day:
* I've practiced some Ankies (general stuff about js fullstack),
* I've add some Ankies (general stuff about holacracy),
* I've spent some time researching sources I can share with my fiance who apparently wants to start learning more about programming
* I've planned to introduce her to the 'Hello, World' by designing simple web game, we'll try to make this as pair-programming session (more on that in the next articles)
* I've created 1 article on dev.to

Tomorrow I'm going to:
* Spend at least **1 full hour** our focusing on my project
* Spend at least **25 mins** preparing flashcards on holacracy topic
* Spend at least **25 mins** preparing flashcards on fullstack topic
* Study at least **20 Anki flashcards**
* Spend at least **1 hour** on [Stephen Grider course on Udemy](https://www.udemy.com/course/microservices-with-node-js-and-react/) 
* Read 1 full article on Medium.com
* Read book for at least **30 mins** - [the confidence gap](https://www.amazon.com/Confidence-Gap-Guide-Overcoming-Self-Doubt/dp/1590309235) (from page 130) -  yep, didn't happen yesterday :wink: 

Are you working in a company with the same (or similar) structure, or it's totally different in your case?
Are you happy with it or is there anything that you'd likely change if it depended on you?

See you tomorrow! Happy weekend! :palm_tree:
Technical Documentation Template Alternate Version
Tags: codepen
Published: 2022-01-21 20:58:11

<p>This is the alternate version of my solution for FCC's technical documentation project. In this version: I have made modifications to some classes, particularly the links in the navbar that is displayed on medium and smaller sized screens; I have removed the FCC auto grader; and I have added comments to clean up the code a bit more than what it was prior. </p>

{% codepen https://codepen.io/harunpehlivan/pen/bGoXbrV %}
Building an Image processing workflow with Netflix Conductor
Published: 2022-01-25 19:57:12

---
title: Building an Image processing workflow with Netflix Conductor
published: true
date: 2022-01-21 20:43:01 UTC
tags: 
canonical_url: https://orkes.io/content/blog/image-processing-workflow-with-conductor
---

There are many tools available to work with images - resizing, changing the format, cropping, changing colors, etc. Tools like Photoshop require a lot of manual work to create image. Online tools for image processing are also extremely popular. But, rather than doing the work manually, or paying for a service to modify your images, wouldn't it be cool to have a workflow that does image resizing for you automatically? In this post, we'll build just this using Conductor to orchestrate the microservices involved, and to create an API-like surface for image processing.

Read the full post over at the [Orkes blog](https://orkes.io/content/blog/image-processing-workflow-with-conductor)
Highlighted Deep Dive Into Polkadot/Substrate/Kusuma/MoonBeam-Part(2)
Tags: blockchain, kusama, polkadot, ethereum
Published: 2022-01-21 20:40:43

Highlighted Deep Dive Into Polkadot/Substrate/Kusuma/MoonBeam-Part(2):
Polkadot and Substrate are not dependent on each other. Polkadot parachains can be built and maintained without ever touching Substrate. Substrate-based chains can exist as ‘solo-chains’ on an independent basis.

Substrate is a fully modular blockchain framework that unleashes developers instead of forcing them to work within the confines of others' design decisions.
Building a custom blockchain with Substrate offers greater freedom, flexibility, and optimization than building on top of a general-purpose smart-contract blockchain.

you're not only free to choose your parameters such gas costs, governance, and consensus, you're also free to choose how your blockchain is deployed and if/how it should communicate with other networks. 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/komwkxobv4hxmdpbw2rp.png)
 
That is all just for you:
https://read.cash/@arman-riazi-science
https://medium.com/@arman.riazi.science
I Made it with ❤️ for you
Highlighted Deep Dive Into Polkadot/Substrate/Kusuma/MoonBeam-Part(1)
Tags: blockchain, kusama, polkadot, ethereum
Published: 2022-01-21 20:39:13

Highlighted Deep Dive Into Polkadot/Substrate/Kusuma/MoonBeam-Part(1):
Polkadot unites a network of heterogeneous blockchain shards called parachains. These chains connect to and are secured by the Polkadot Relay Chain. They can also connect with external networks via bridges.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s9ckgahbunkj4w8ur2mu.png)
 
That is all just for you:
https://read.cash/@arman-riazi-science
https://medium.com/@arman.riazi.science
I Made it with ❤️ for you
10 Commandments for Programmers
Tags: javascript, programming, productivity, opensource
Published: 2022-01-21 20:30:46

Do your best to follow these 10 commandments 👇🏽

1. Make Googling a habit or thou shalt make very little progress in programming.

2. If it works, do not touch it unless you know what you are doing.

3. JavaScript might be well spoken of but it is not your friend.

4. Never debug in production.

5. Argue not about programming languages on Twitter.

6. Do not claim you know CSS. It is a lie, we all know.

7. Eat in the morning before you start programming. Otherwise you may not eat again.

8. No matter how sure you are, always clear your browser cache and try again.

9. It is easier to stay up till 6:00 AM than to wake up at 6:00 AM. Be discipline with your sleep cycle.

10. Always hide your wifi network SSID. There are others who are more dangerous than you think.

Did you enjoy these commandments? Do you want to write yours up or contribute to these ones, feel free & hit me up on Twitter: [@xSavitar](https://twitter.com/xSavitar).
Library web-app -- cleaning the code.
Tags: webapp, web, flask, python
Published: 2022-01-21 20:26:50

I started this the way you'd start a minimal flask application (ie: all the code base in one file). This is fine for a simple "hello world" app, but for a project that deals with many view-functions and multiple model-classes, this is terrible. Sooner or later you will end up pulling your hair while scrolling through the code. Having everything separated in it's own file is far better. That way it's easier to debug and maintain.
Movie Seat Booking App
Tags: codepen
Published: 2022-01-21 20:19:06

<p>This project is written in plain HTML, CSS, and JavaScript; no frameworks or outside code, save a single imported font from google fonts. This application is intended to replicate a seat booking application for a movie theater and it was course work in Brad Traversy's 20 JavaScript Projects course, viewable here: <a href="https://www.udemy.com/share/102yzoAEAbdlZRQ3kF/" target="_blank">https://www.udemy.com/share/102yzoAEAbdlZRQ3kF/</a>
When seats and a movie are selected, this information is saved to local storage so that the data persists after your browsing session ends or after the page is reloaded. The original project did not include a clear button which would erase the local storage and refresh the application, allowing you to begin anew; so I added on myself. However, since this this project is in a pen on Codepen, the reload() function which can be called on the window object and reload the page, doesn't work. This function does not appear to work from within a Codepen pen. So you have to manually refresh the browser after clicking on the 'clear selection' button. Note - while the reload() function doesn't appear to work, the 'clear selection' button will still clear the local storage for the application. Manual refresh is only needed to reset the user interface within the pen.</p>

{% codepen https://codepen.io/harunpehlivan/pen/NWaZQEZ %}
DevOps Security Challenges and How JFrog Xray Helps Overcome Them
Published: 2022-01-21 20:13:40


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

Reactive approach to application security and information security has been the trend for a very long time. Most of companies tend to still take reactive approach to application security. And when security becomes a problem, it becomes a crisis. But why wait for an attacker to get into your unprotected or minimally protected sensitive data before you decide to do something about it? 

If you wait until it’s too late, all attention will focus on remediation efforts and damage control as you attempt to hold onto what little trust still remains within your customer base. Proactive security approach is the name of the game. 

JFrog Xray Solves all the above problems. JFrog Xray is an application security tool that integrates security directly into your DevOps workflows, enabling you to deliver trusted software releases faster. JFrog Xray fortifies your software supply chain and spans your entire pipeline from your IDE, through your CI/CD Tools, and all the way through distribution to deployment.

JFrog Xray's key capabilities are;

- Automated Zero-Day & Malicious Code Detection by fully automated binary analysis capability and detection of previously unknown vulnerabilities in your code.

- Eliminate Configuration Security Threats by providing tool featuring software configuration security analysis

- Software Composition Analysis which helps detect vulnerabilities in your 3rd party OSS binaries and reduce your risk and fortify your brand as a trusted vendor

- Deep Recursive Scanning Supporting all major package types
helping see into all layers and dependencies of packages, container images, and zip files

- Contextual Remediation which reduces vulnerability noise with smart prioritization by security analysis done at the binary level for more relevance

- Visibility and Impact Analysis via component graph of your binaries and dependencies helping determine true impact of any vulnerability or issue discovered

- Automate Compliance with Granular Policies to implement security & legal guidelines by setting mitigation behaviours to match the issue context

- Accelerated Remediation to Minimize time to identify, prioritize and fix vulnerabilities along with enhanced CVE data with intuitive Step-by-Step Mitigation advice

- DevOps Ecosystem Integration & Automation helping Integrate into existing DevOps tools: IDEs, Git repository, CI/CD, observability & SIEMs. Automate with REST APIs or the JFrog CLI tool

The security conversation is often intimidating. But it doesn’t have to be. There are ways to overcome these application security challenges. Talk to one of our JFrog Xray experts here at JFrog https://jfrog.com/start-free/. 

Read more about JFrog Xray:

https://jfrog.com/security-and-compliance/
https://www.jfrog.com/confluence/display/XRAY
List Comprehension in Python
Tags: python, programming, codenewbie
Published: 2022-01-21 19:58:56

You may haven't heard of this, but you're going to love it👌. Wait what exactly is List comprehension🤔? well, list comprehension is **technique used by python programmers to create list from the previous list**. Yeah, you've got it now, let's see some examples, right. 

let's say you have this list of fruits.
```
fruits = ["apple", "banana", "cherry", "kiwi", "mango"]
```
and you want only fruits with letter "a" in the name. well, you might think of using for loop like this

```
fruits = ["apple", "banana", "cherry", "kiwi", "mango"]
fruits_with_letter_a= []

for x in fruits:
  if "a" in x:
    fruits_with_letter_a.append(x)

print(fruits_with_letter_a)

```

This works fine but there is another way of doing exactly the same thing with only one line of code.

```
fruits = ["apple", "banana", "cherry", "kiwi", "mango"]

fruits_with_letter_a= [x for x in fruits if "a" in x]

print(fruits_with_letter_a)
```

Let's understand clearly how list comprehension works.
The Syntax
```
fruits_with_letter_a= [expression for item in iterable if condition == True]
```

**Expression**
is the current item in the iteration, but it is also the outcome, which you can manipulate before it ends up like a list item in the new list.

Example: Set fruits names in the new list to upper case

```
newlist = [x.upper() for x in fruits]
```

**Iterable**
The iterable can be any iterable object, like a list, tuple, set etc.

**Condition**
The condition is like a filter that only accepts the items that valuate to _**True**_.

Let's try same challenge

```
name = "phelix"
lettes_list = [letter for letter in name]
print(lettes_list )
```
what will be the output🤔?

{% details The answer %} 
```
['p', 'h', 'e', 'l', 'i', 'x']
```
Did you get it?
{% enddetails %}

You now know more about list comprehension.

Read a lot via [w3schools.com](https://www.w3schools.com/python/python_lists_comprehension.asp)
Fun with Git aliases
Tags: git, development, hacks, guide
Published: 2022-01-21 19:40:31

Git is one of the most popular VCS (version control system). In this post we will discuss about git aliases and how to use them to their benefits.

So what are git aliases ? In simple words, aliases are custom shortcuts for executing regular git commands. These shortcuts are specified in the file `$HOME/.gitconfig`. Lets start with some examples.

In order to see the current status, the command would be

```bash
git status
```
Alternatively we can create an alias
```bash
git config --global alias.st status
```
And now, to see the git status we can run the command
```bash
git st
```
Similarly, more and more aliases can be added for easier and quick execution of commonly used git commands. Lets add some more aliases.

```bash
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.co checkout
git cofnig --global alias.pr pull --rebase
git config --global alias.pf push --force
git config --global alias.rsh reset --hard
```

Well, until now we have seen creating aliases for simple git commands. But what if you want to run multiple git commands in single alias. Functions to the rescue. 

Lets see an example situation. Let say you need to switch branch, but you also have staged changes. So you want to stash the changes  before switching to new branch, and pull the latest changes as well. But for this, we will edit the file `$HOME/.gitconfig` and add new entry under the tab `[alias]`. I am a `vim` guy, but you can use any editor of your choice.

```bash
[alias]
    st = status
    br = branch
    co = checkout
    pr = pull --rebase
    pf = push --force
    rsh = reset --hard
    cop = "!f() { br=`git br --show-current`; git stash save \"Stash from branch ${br}\"; git fetch; git co ${1}};  f"
```

The shortcut `cop` can also be extended. Lets extend the above case with situation that when you switch branch, you also want to delete the current branch. But why would you want so ? Lets say that you branched out from `master` for a minor bug fix. After you push the `bug-fix` branch to remote and submit it for review, you want to purge it from local, after switching back to `master` branch. Lets see

```bash
[alias]
    copd = "!f() { br=`git br --show-current`; git stash save \"Stash from branch ${br}\"; git fetch; git co ${1}; git br -d ${br}; };  f"
```

And how to use it.

```bash
vishalr@ubuntu (bug-fix-branch) $> git br
* bug-fix-branch
master
vishalr@ubuntu (bug-fix-branch) $> git copd master
vishalr@ubuntu (master) $> git br
* master
vishalr@ubunt (master) $>
```

Now that you have learnt, go ahead and create git aliases of your choice and have fun.