teleren/devto huggingface dataset:
Understanding Python
Tags: beginners, python, learning, codenewbie
Published: 2021-06-07 14:52:24

At the moment I am on a self enrolled Python Course from a company named the Shaw Academy.

I have decided to pickup and learn Python because I have been told by several friends and colleagues alike it is an emerging and popular technology and its one of the easiest to code in todays society amongst other programming languages.

So far I can say its very much different from what I have been learning in comparison to HTML, CSS and JavaScript.

The concepts seem far off from the other languages, and its definitely taking me a while to pick up some of this stuff.

The only things I have been learning so far is to *print* a result from a inserted list. This could be a math equation or just simply gathering one of the items that you have inserted in the list.

So far with what I have been learning it definitely does not feel easy to pick up, or that I could code a whole interactive game just by learning this language. But hey, I guess I pretty much felt the same way when I started web design (Which I am still struggling with =[).

I believe if I stick at it with my full-time coding routine I will pick up more things and then soon be able to start actually programming useful results. I guess exercising patience is the main lesson here. Anyways, I plan to fail more here so that I can learn more as I go along. 

Please stay tuned as I update you guys with my progress.

Thank you for reading.
Mika/Malcolm.
Importance of Keys in DBMS
Tags: database, computerscience
Published: 2021-06-07 14:40:43

**DBMS Keys**
It is used to identify unique records by the combination of one or more fields(attributes) in the database table.
Keys play an important role in DBMS.

**Different Types of Keys:**

**i) Candidate Keys** - It is a minimal(minimum) set of attributes that can identify each tuple/row uniquely in a Relation.

**Example** - In the below example of Employee relation, we can see that **EPhone** is the only unique attribute. Hence it can be treated as a Candidate Key.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7w0x40zozl7tg62vvoip.png)

**ii) Primary Keys** - It is a set of one or more attributes that can uniquely identify each tuple.
   -> Primary Key cannot have "NULL" values.
   -> Only one Primary Key is possible in a table.
   -> Values of Primary Key are unique and they cannot be repeated.
   -> One of the Candidate Keys is selected as the Primary Key.

**iii) Super Keys** - It is a superset of Candidate Keys.

-> **Trivial Super Key** - It is the set of all attributes.

**iv) Foreign Keys** - An attribute which is a key in one table and it also behaves as a Primary Key in another table is known as Foreign Key.
-> It is used to combine two tables logically.

**v) Alternate Key** - All other Candidate Keys which are not selected as a Primary Key is called as Alternate Keys. It is also called as Secondary Key.

**vi) Composite Keys** - If a key contains more than one attribute then it is called as a Composite Key.

Example: Employee table has key=>{eName, eAge, eAddress}. This key will be called as Composite Key.

Thank You!
See you soon.
What does “it depends” mean in web development
Tags: webdev
Published: 2021-06-07 14:29:16

I have been in numerous situations where my answer to a client’s question was: “it depends.”

But what does that seemingly simple phrase mean in web development? Let’s try to find out.

## Scenarios

Here is a common scenario: the client, or a team member, wants a shiny new component on the site and asks for the estimation.

My usual answer is: “it depends.”

It depends because of many reasons. These kinds of questions come to my mind:

- Should the component be reusable on other pages?
- Should the component be configurable?
- Should the component be adaptive to its surroundings?
- Should the component be accessible?
- Should the component be responsive?
- And so on goes the list of questions.

Here is another scenario: the client, or a team member, wants a better page speed score and wants to know how much time it will take to improve it.

My usual answer is: “it depends.”

It depends because of many reasons. Here are some questions that go through my head:

- Should we optimize CSS code and delivery?
- Should we optimize JavaScript code and delivery?
- Should we optimize fonts?
- Should we optimize images?
- The list of questions adds up.


There are many similar examples, but not everything is about estimation. Sometimes “it depends” answer means choosing the right technologies or prioritizing tasks or anything that requires planning and organizing a series of actions to come up to a solution. Unless the task or request is something trivial, it automatically brings many questions to the table.

## Questions, questions, questions

Asking the right questions and understanding the problem is the job-half-done. That is where the experience steps in. Experienced developers ask questions to help the client understand the request and guide the client to the solution. Non-experienced developers should learn how to ask these questions.

What the “it depends” answer means, in a nutshell, is that the task is not very well defined. That leads us to the actual problem. If the person who assigns the tasks knows the possibilities of how to resolve the task, there wouldn’t be “it depends” answers. But not everyone understands these possibilities. And that is ok.

By slowly educating the client or a team member, we make our lives easier. Every new task gets better in terms of requirements and definition. That is how the whole team evolves. This process might be a lengthy one but is worth it.

On the other hand, if the task is well-defined, we could eliminate many questions and generate the estimation or solution more quickly. The perfect scenario is when there are no follow-up questions. (Sometimes, you could anticipate the answer if you have a solid relationship with the client. Cherish that client and never let it go.)

## Conclusion

As you see, a single “it depends” phrase triggers a series of questions. It is like you say, “let’s start planning.” So, the next time when you hear the “it depends” answer, try to define the task more carefully and provide as many details as possible.
Payment operations using Quickwork

Published: 2021-06-07 14:27:59

Carpayz: Cardpayz is a leading platform for global payment. It facilitates international payments, fraud monitoring, multi-currency acquisition, Visa and Mastercard processing, and many more features. It is a reliable merchant account banking partner with easy settlements, low-cost payment processing, and unique payment solutions.
PayPal: 
PayPal Holdings, Inc. is an American company operating a worldwide online payment system, allowing you to pay for items using a secure internet account and serves as a digital electronic alternative to primitive paper methods like cheques and money orders. It operates as a payment processor for online vendors, auction sites, and many other commercial users.
Unlimint
Unlimint is the leading merchants and banking services provider. Unlimint offers thousands of new payment methods and innovative solutions for businesses around the world. Unlimint provides a simple business interface that enables payments for businesses to grow and move efficiently.
Stripe
Stripe is a third-party payment gateway that enables merchants, local retailers, or small business bodies to accept payments through Credit Cards, wallets, Debit Cards, etc. Being highly flexible, it integrates with more than 300 tools, products, and portals and helps in currency exchange in-person and online.

Quickwork helps companies integrate multiple systems and applications to design delightful user journeys using Quickwork automation builder. Quickwork automation builder is an API-driven, zero-code, DIY tool, enabling any user to design and implement workflows with ease and speed.
Integrate  Stripe payment app with other apps

Published: 2021-06-07 14:27:28

Stripe is a third-party payment gateway that enables merchants, local retailers, or small business bodies to accept payments through Credit Cards, wallets, Debit Cards, etc. Being highly flexible, it integrates with more than 300 tools, products, and portals and helps in currency exchange in-person and online.
Add paying customers to the newsletter contact list in Mailchimp.

Add customers charged by Stripe as subscribers on Mailchimp

Add a sale to an Airtable base after its payment has been completed via Stripe.

Quickwork helps companies integrate multiple systems and applications to design delightful user journeys using Quickwork automation builder. Quickwork automation builder is an API-driven, zero-code, DIY tool, enabling any user to design and implement workflows with ease and speed.
JavaScript Date and Firebase Signup
Tags: javascript, html, webdev, github
Published: 2021-06-07 14:23:06

>1st Post
```
<script>
var d= new Date();

let date= d.getDate()+"-"+d.getMonth()+1+"-"+d.getFullYear();
document.getElementById("your tag id").innerHTML= date;
firebase.database().ref('/user/'+ username).set({
//User table, Username Key
            Name:name,
            Email:email,
            Password:password,
            Phone:phone,
            DateofRegistration :date
        });
</script>
```
Date Function in Detail-
`getMonth()` - Returns months in range 0 to 11 ~So for correct month d.getMonth+1
`getDate()` - 0-31
`getFullYear()`
`getHours()`- 0-23
`getMinutes()` - 0-59
`getSeconds()` - 0-59

4 Methods for date object constructor-
```new Date()```
```new Date(year, month, day, hours, minutes, seconds, milliseconds)```
```new Date(milliseconds)```
```new Date(date string)```
I referred w3Schools for this topic.
Programmatically generating color palettes
Tags: css, design, javascript, color
Published: 2021-06-07 14:09:18

You may have seen color palettes like the [Material Palette](https://material.io/design/color/the-color-system.html#:~:text=2014%20Material%20Design,Design%20color%20palettes) or the [tailwind colors](https://tailwindcss.com/docs/customizing-colors). Well, I wanted to know how these were generated and wanted to generate my own too. Here's how I did it.

## The Base Colors

This was the easiest one because I could just [use `hsl`](https://dev.to/siddharthshyniben/why-hsl-is-better-3inl) to adjust the hue by a certain step. So we get `hsl(0, 50%, 50%)`, `hsl(20, 50%, 50%)`, `hsl(40, 50%, 50%)`

![Base colors](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8kq88u0ojl9zd0kppd6u.png)
<figcaption>That was easy enough</figcaption>

## The rest of the palette

Then, I thought of iterating over the saturation to brighten or darken the colors. So I iterated again, adding in 10 to the value, but there was always grey at the start of every color.

![Color palette with grey at the start](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v5rhodyhl7xwi0dfn9uz.png)
 <figcaption>Not quite right</figcaption>

Tweaking the loop gave me this final palette:

{% codepen https://codepen.io/SiddharthShyniben/pen/JjWLBYe %}

Not the best, but OK by my standards
PHP Tricky True False Examples
Tags: php, programming, laravel
Published: 2021-06-07 14:06:46

The result of a PHP True False statement might be different from what looks like a simple and logical result.

## PHP Comparison Operators == VS ===

PHP with loosely `==` operator will not compare type, so numeric strings will be converted to numbers and compared numerically. Below are two examples: for more on PHP comparisons, check the [PHP.net](https://php.net/manual/en/language.operators.comparison.php) page.

`var_dump(0 == "a"); // 0 == 0 -> true`
`var_dump(10 == "1e1"); // 10 == 10 -> true`

PHP strict comparison `===` will not convert string to a numeral. It compares both: type and the value. So examples above, comparing two of the different types, will always be false.


`var_dump("1" === "01"); // 0 == "a" -> false`
`var_dump("10" === "1e1"); // 10 == "1e1" -> false`

StackOverflow user [Nick](https://stackoverflow.com/users/9021/nickf) has added nice [detailed comparison tables](https://stackoverflow.com/questions/80646/how-do-the-php-equality-double-equals-and-identity-triple-equals-comp) of `==` and `===` operators with `TRUE, FALSE, NULL, 0, 1, -1, ‘0’, ‘1’, ‘-1’`.


## PHP TRUE, FALSE
In PHP: an `undeclared` variable, `empty array`, `“0”`, `0` and `empty string` are `false` while `-1` is `true`. Here are some more TRUE, FALSE examples.

**PHP STRINGS**
```php
var_dump((bool) "");        // bool(false)
var_dump((bool) "0");       // bool(false)
var_dump((bool) "1");       // bool(true)
var_dump((bool) "alpha");   // bool(true)
```
**PHP INT, FLOAT**
```php
var_dump((bool) 1);           // bool(true)
var_dump((bool) -1);          // bool(true)
var_dump((bool) 2.3e5);       // bool(true)
var_dump((bool) -2);          // bool(true)
var_dump((bool) 0.0);         // bool(false)
var_dump((bool) -0.1);        // bool(true)
```
**PHP ARRAYS**
```php
var_dump((bool) array());    // bool(false)
var_dump((bool) array(5));   // bool(true)
```
**OTHERS**
```php
var_dump((bool) "false");   // bool(true)
var_dump((bool) NULL);      // bool(false)
```

### PHP Functions
Return values of some commonly used PHP core functions might break the conditional flow by returning `NULL` or `int()` integer values. For example `stripos()` can return `0` which will be interpreted as `false` in an `IF` conditional block.
```php
$text = 'abc xyz';
$pos = strpos($text, 'a');
var_dump($pos);  
//result: int(0) 
```
This code will return true with the output of string position `int(0)`. This return value zero evaluates to the `false`.

```php
if (!strpos($text, 'a')) {echo "'a' not found in '$text'";}
//result: 'a' not found in 'abc xyz'
```
Above code will detect “a” but if block will evaluate to `false` as a’s position is `0`. 
Instead, explicitly check if the value returned is not `FLASE`
```php
if(strpos($text, 'a') === FALSE){echo "'a' not found in '$text'";}
```

I am also on Twitter. You can [follow me there](https://twitter.com/waq_r) as I regularly tweet about my journey.
Make simple cross-browser testing with Comparium
Published: 2021-06-07 14:02:10

Cross-browser testing is a critical part of web projects that's why there are quite a few different services for testing a website in different browsers. You can simplify testing by using [old browsers version emulator](https://comparium.app/blog/old-browsers-emulator/), Comparium.

Comparium is a web checker on internet browsers and helps in displaying the results for a short period. The tool supports the web designer in designing a compelling and visible website. It is a unique platform that tests your website on different operating systems and also on various internet browsers.
One-way and Two-way Data Binding in Angular
Tags: angular, javascript
Published: 2021-06-07 13:27:46

Today I was helping a new guy in angular with differences between the bind data in Angular, because it provides 2 ways to move data to DOM, One-way and two-way data binding it help us to build dynamic apps.

It binds the data from our component to the DOM, unidirectional from component to view or view to the component in few ways.

### Interpolation
The interpolation is used with `{{myproperty}}` in the DOM.

```html
<p>{{myproperty}}</p>
```
### Property binding 
Add brackets around of property `[]`like hidden angular bind the property for DOM elements or components.

```html
<p [hidden]="myproperty"></p>
<app-username [name]="myproperty"></app-username>
```
### Event binding
Angular understand bind events using parentheses like *(click)* for DOM element or *(userSelected)* components event trigger.

```html
<button (click)="close()">Close window</button>
<app-logout (logout)="hideDashboard()"><app-/logout>
```

### Two-way binding
Angular two-way data binding is bi-directionally communication using the ngModel directive, it is part of FormsModule from @angular/forms, it needs to be import in your app.module.ts

```typescript
import { FormsModule } from "@angular/forms";
 @NgModule({ 
   imports: [BrowserModule, FormsModule], 
   declarations: [ AppComponent], 
   bootstrap: [AppComponent] 
}) 
export class AppModule { }
```
Using the directive [(ngModel)] with combination of square brackets and parentheses of the event binding, the ngModel connect our property to changes.

My example link the property name with changes in input, but can be use in select, checkbox or other DOM elements.

```html
<input [(ngModel)]="name" />
{{name}}
```

You can see demos:
[https://stackblitz.com/edit/angular-ivy-9eepqg](https://stackblitz.com/edit/angular-ivy-9eepqg)

Photo by <a href="https://unsplash.com/@surface?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Surface</a> on <a href="https://unsplash.com/s/photos/connect?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
JavaScript Interview Question #46: Length of JS functions
Tags: javascript, beginners, codenewbie, webdev
Published: 2021-06-07 13:20:21

![javascript interview question #46](https://learn.coderslang.com/js-test-46.png)

What's the value of the `length` field for JavaScript functions? What will be logged to the console?

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

A lot of JavaScript entities have the `length` field.

For example, it holds the total number of element in JavaScript arrays.

```javascript
const arr = ['a', 'b', 'c'];
console.log(arr.length);    // 3
```

 For strings — it’s the number of characters. Literally, the length of a string.

```javascript
const welcomeMessage = 'Hello!';
const goodbyeMessage = 'Goodbye!';
const emptyString = '';

console.log(welcomeMessage.length);  // 6
console.log(goodbyeMessage.length);  // 8
console.log(emptyString.length);     // 0
```

Regular objects don’t have the `length` field by default.

```javascript
const user = { name: 'Jack', age: '32'};
console.log(user.length);  // undefined
```

But the functions do have it! And it holds not the "length of a function", which is hard to define, but rather the number of function parameters.

```javascript
const sum = (a, b) => a + b;
const log = (s) => console.log(s);
const noop = () => {};

console.log(sum.length);  // 2
console.log(log.length);  // 1
console.log(noop.length); // 0
```

---

**ANSWER**: The `length` field holds the number of parameters for all JavaScript functions. Thus, the output is

```js
1
0
```

As the function `sayHello` has one parameter and the function `confirmSubscription` has zero parameters.

[Learn Full-Stack JavaScript](https://js.coderslang.com)
How to start programming for college students
Tags: programming
Published: 2021-06-07 13:10:43

## 1. Consistency
You need to be consistent while programming. Do not take programming as a subject take it as a hobby. Practice it like cricket.

Practice it every day, spend some time on coding take it as a hobby 
I see many people that they start programming today and they never touch for a week
Or month. So be consistent

When you learn something in programming, do code on the laptop or a computer.

Because there will be a difference between playing cricket at home VS stadium. The stadium for programming is a laptop or computer. So be practical

## 2. Time management for college students
You have to manage both the college syllabus and programming, so You need time management to do both things, so that's why I recommend you plan a reasonable timetable.

## 3. Do not learn multiple languages. Be master at one language
If you learned c, c++, Java, and any other languages, that doesn't mean you are a good programmer.

If you know at least one language but if you are master at that language, that means you have more value than the person who knows 5 to 10 languages.

## 4. Makings projects
I see many students learn about programming, but they won't do projects in that particular language they have learned. **This is similar: You know how to use a gun, but you don't know how to aim the target.**
so by doing projects will make you more comfortable at programming

## 5. Don't be in a tutorial hell
While we are learning, we learn from college or from the internet like YouTube, articles by this you will be in tutorial hell once you learn basics of your favorite language try to do projects by yourself. It makes you more confident.

**This is what I have learned from programming for the past six years**
GIT Commands 
Published: 2021-06-07 13:05:01

Some easy useful git commands 



## Git configuration
You can configure git by creating a ``.gitconfig`` file in user folder
or use commands

```

git config --global user.name {{YOUR_USERNAME}}

git config --global user.email {{YOUR_EMAIL}}

git config -l

```

## To create Git repository locally  
```
git init
```

## Download/Clone repository from remote
```
git clone {{REPOSITORY_LINK}}
```

## Git branch 
Git branches are effectively a pointer to a snapshot of your changes. When you want to add a new feature or fix a bug—no matter how big or how small—you spawn a new branch to encapsulate your changes

#### View all branches
```
git branch
```

#### Create a new branch
```
git branch {{BRANCH_NAME}}
```

#### Delete a branch
```
git branch -d {{BRANCH_NAME}}
```

#### Switch to another branch
```
git switch {{BRANCH_NAME}}
```

#### Merge a branch to current branch
```
git merge {{BRANCH_NAME}}
```

#### Sync branches
```
git fetch
```

#### Cleanup all local branches
Before fetching, remove any remote-tracking references that no longer exist on the remote. 
```
git fetch --prune
```

## Git stage
Before we make a commit, we must tell Git what files we want to commit (new untracked files, modified files, or deleted files) this is called staging.
#### To know the file status/changes
```
git status
```

#### Add a file to stage
```
git add {{FILE}}
```

#### Add all files to stage
```
git add .
```

#### Add only certain files starts with
With the asterisk command , you can add all files starting with 'index' in the staging area.
```
git add {{FILE_STARTS_WITH}}*
```

#### Reset/undo file changes
```
git reset {{FILE}}
```

#### Reset/undo all changes
```
git reset
```

## Git Update
Update changes to remotes

#### Commit changes
```
git commit -m {{"YOUR_COMMIT_MESSAGE"}}
```

#### Get changes from remote
```
git pull
```

#### Get changes from different branch
```
git pull origin {{BRANCH}}
```

#### Updates changes to remote
```
git push
```

#### Updates changes to different branch
```
git push origin HEAD:{{BRANCH}}
```

## Git Undo
Undo/revert changes from git

#### Reset/undo local changes
```
git reset --hard
```

#### Reset to previous heads 
```
git reset --hard HEAD~{{NUMBER}}
```

#### Revert changes
```
git revert head
```

#### Revert a commit
```
git revert {{COMMIT_ID}}
```


## Git Helps

#### To get git command help
```
git help
```

#### To see commit history
```
git log
```

#### View commit log as a graph 
```
git log --graph --oneline
```

#### View commit log as a graph of all branches 
```
git log --graph --oneline --all
```

#### Show changes between commits, commit and working tree,
```
git diff
```

#### Remove tracked files from the current working tree
```
git rm {{FILE}}
```
Build a Rest API using Node.js, Express, Sequelize, Postgres, Docker

Tags: docker, node, postgres, tutorial
Published: 2021-06-07 13:03:10

A great video of Francesco Ciulla, who demonstrates together with our Dev Advocate, how to build a full CRUD Rest API application FROM SCRATCH, using Node.js, Express, Sequelize, Postgres, and Docker

{% youtube HhkwLJCZw2Y %}