teleren/devto huggingface dataset:
want to change username to phone number for login form in asp.net core .any idea..
Tags: csharp
Published: 2019-10-17 11:03:23

hello Dev.. i want to login to my website using phoneNumber and password. in .net we can login to website using username and password where we have username function but i need to change this to phone number and password this is my api code i define phone number and password property in loginModel class.

[HttpPost]
        [Route("Login")]
        //POST : /api/ApplicationUser/Login
        //.FindByNameAsync(model.PhoneNumber);
        public async Task<IActionResult> Login([FromBody]LoginModel model)
        {
            var user = await _userManager.FindByNameAsync(model.PhoneNumber);
            if (user != null && await _userManager.CheckPasswordAsync(user, model.Password))
            {
                var tokenDescriptor = new SecurityTokenDescriptor
                {
                    Subject = new ClaimsIdentity(new Claim[]
                    {
                        new Claim("UserID",user.Id.ToString())
                    }),
                    Expires = DateTime.UtcNow.AddDays(1),
                    SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_appSettings.JWT_Secret)), SecurityAlgorithms.HmacSha256Signature)
                };
                var tokenHandler = new JwtSecurityTokenHandler();
                var securityToken = tokenHandler.CreateToken(tokenDescriptor);
                var token = tokenHandler.WriteToken(securityToken);
                return Ok(new { token });
            }
            else
                return BadRequest(new { message = "Mobile NO or password is incorrect." });
        }
    }
The Amazon way; why making software is hard; & tricks our brain plays
Tags: todayilearned, software, programming
Published: 2019-10-17 11:00:17

*My TL;DR style notes from articles I read today.*

### [How is software developed at Amazon?](http://bit.ly/32kJQ9z)

Key tenets Amazon follows to ensure its obsessive customer focus: 
- Decompose a monolithic organization into small, autonomous teams that own each service or product end to end.
- Deploy in a pessimistic fashion, constantly looking for problems. 
- Deploy on a small scale, so that you can rollback in case of failure and expand only if successful. 
- Start every project with a threat model and have it reviewed by a security engineer; also seek peer feedback before committing to a build.
- Architects do not develop the architecture of a project; developers on each team do. 
- Plan from the bottom up, because teams closest to the product know best what the customer wants. 
- Accept that keeping teams independent can result in occasional duplication.

*[Full video here](http://bit.ly/32kJQ9z), 41 mins watch time*

---

### [Why is making software so difficult?](http://bit.ly/33CszZK)

- Business objectives can be messy: assumptions behind them can be wrong or there may be confusion about the objectives themselves.
- Project lifecycles can vary immensely and may become unpredictable.
- Software development often relies on stitching together existing tools and libraries. It can be difficult to see beforehand whether the chosen tools are actually suitable for the job. 
- Refining project specifications is harder because software is abstract.
- Often, the person commissioning the project does not know what the solution should look like. Specifications are fuzzy at best. 
- It is up to the developer to articulate a solution and see whether it fits the expectations. It is not just a logical activity, it requires creative problem-solving.

*[Full post here](http://bit.ly/33CszZK), 10 mins read time*

---

### [How cognitive biases influence software development](http://bit.ly/2VMFSE1)

- Anchoring effect (prior information used to make a decision that really should not depend on this given information): counter it by visualizing relevant data instead of relying on an anchor.
- It is a logical fallacy to assume chronology (X came before Y) indicates causality (Y happened because of X).
- Avoid confirmation bias by focusing more on what can go wrong than on what you are sure is right. 
- Pre-empt inattentional blindness by using checklists. 
- Authority bias: Just because someone trustworthy puts out a piece of information, does not mean you need to act on it or use it. The ‘authority’ can also be a specification document, or even yourself. Question all assumptions.

*[Full post here](http://bit.ly/2VMFSE1), 6 mins read time*

---

*I share these TL;DR versions of articles on software engineering that I read every weekday through my newsletter - [in.snippets(). Sign up here](https://mailchi.mp/appsmith/insnippets?utm_source=devto&utm_medium=post08&utm_campaign=is) if you liked what you just read.*
Turbo Console Log
Tags: javascript, console
Published: 2019-10-17 10:51:51

---
title: Turbo Console Log
published: true
description: Turbo Console Log
tags: javascript, console
---

For VSCode users, just found out about this extension today (Turbo console logging) and is a huge time saver for me.

cmd+shift+D recommended

https://marketplace.visualstudio.com/items?itemName=ChakrounAnas.turbo-console-log
Stateless vs Stateful - Which direction should you take?

Tags: discuss, webdev, scalability
Published: 2019-10-17 10:46:51

Scaling a web app is hard, for it always comes with uncertainties and failures. Even a minor fault can break an application if it’s not built for scalability. 

In traditional web development, however, one thing that might help a website scale is –– everything being stateless. Here Statelessness means that the server should not remember the application’s state. Instead, the client should remember all the information necessary for the execution with each request as the server can’t memorize and reuse information from previous requests. 

Whenever you have to fetch a few things from a database, you receive a request containing everything you need to know. On answering that request, you don’t care about the client until you receive a new request. This makes work so easy; so convenient to execute as you are ensuring a clean state every time. 

In traditional application development, however, everything for a fact is stateful. Things are stored in memory, which gives you a sigh of relief that they will continue to remain there until the app is closed; or unless it is reopened. You are not expected to maintain state across sessions; not forced to think that things can be missed out.

## Enter Modern Complex Web apps

Modern web apps, on the contrary, sits in between statelessness and statefulness. Here, your server remains stateless and the frontend is stateful. 

Think about a web app such as Trello or Canva where every URL points to a single page. Once you reload the page, all elements must be re-fetched from the server, maintaining the state on the server. 

So, how do you decide whether the stateless or stateful approach would help you out? 

**The Answer is…**

Until and unless you need a reason to store a state, going Stateless might help. One thing, however, you need to make sure is to think about the situation where maintaining a state is necessary. 

[Hugh Mckee](https://twitter.com/mckeeh3), the developer advocate at Lightbend, urges to look into specific circumstances while choosing between Stateless or Stateful approach. 

In his blog “[How to build successful cloud-native solutions](https://www.lightbend.com/blog/design-techniques-stateful-cloud-native-applications-resilience-recoverability-scalability)”, Hugh demonstrates the scaling capability of stateful applications by illustrating a shopping cart example. 

Hugh concludes his opinion on stateless vs stateful debate with the following quote,

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/1gylf823c02n9gpuilpb.png)

> Need help in building complex web apps that scale, you can refer to these [scalability tips shared by 25+ experts](https://www.simform.com/tips-building-scalable-web-applications/). 

What is your opinion regarding stateful vs stateless debate? I would really love to know in the comments.
Why great developers/software engineers suffer from imposter syndrome
Tags: industry, beginners, mentalhealth, inclusion
Published: 2019-10-17 10:25:31

I remember when I first heard the term imposter syndrome at a conference and it was a real revelation for me; in a room full of hundreds of talented lead developers, only a handful had never experienced this.

Imposter syndrome is essentially the feeling that you’re not good enough and you’ve got to where you have by accident. It sounds ridiculous when you say that; how could you have faked years of experience and delivering great projects? But it’s a very real feeling.

The thing I’ve learnt during my time in industry, is that imposter syndrome is usually the sign of a great developer. A developer can never know everything, technology is constantly changing, there are multiple correct ways to solve problems and we’re surrounded by people who know things that we don’t. A developer that thinks that they know everything isn’t usually someone that you want to work with.

Although imposter syndrome usually means a person is aware that they need to keep learning, it can also really hold people back. I’ve had friends who are amazing developers that I’ve really looked up to tell me that they fear interviews and that they don’t think they’re good enough for roles. It’s not simply a confidence thing either, as these are people who are really confident when they’re working on projects. It’s the awareness that people will know more than you on particular topics.

So how can we overcome this feeling? I’m not sure we can ever overcome it completely, it’s the price we pay for being in an industry surrounded by really intelligent people and endless things to learn. One thing that’s really helped me over the years though is to embrace the knowledge of others, learn from them and you’ll find that they also learn from you. I remember years ago doing pair programming for the first time in a large company and I was terrified because I thought I’d look stupid in front of them. In the end we had great fun and we learnt from each other.

*Tell your colleagues and friends that they are great, go to them for help when they know something you don’t and don’t be afraid of someone being better than you. A collaborative environment is far better than a competitive environment that just exacerbates imposter syndrome.*

[Originally posted on Medium](https://medium.com/charlottes-digital-web/why-great-developers-suffer-from-imposter-syndrome-d892c07b4c72)
Telegram Vs. Whatapp, Who wins? Features, Security, etc...
Tags: discuss
Published: 2019-10-17 10:22:01

---
title: Telegram Vs. Whatapp, Who wins? Features, Security, etc...
cover_image: https://static.makeuseof.com/wp-content/uploads/2017/07/telegram-vs-whatsapp-670x335.jpg
published: true
tags: discuss, help

---


Hello, friends on Dev, which is the best messaging application between these two?. I need the candid opinion of everyone (or anyone) in the community. This <a href="https://www.quora.com/Is-Telegram-messenger-secure-Is-it-more-secure-than-WhatsApp" target="_blank">(Quora)</a> thread is in favour of Telegram with regards to security. This <a href="https://telegra.ph/What-are-the-features-of-a-secure-and-private-communication-service-07-10-2#Vulnerability-list" target="_blank">telegraph</a> and this <a href="https://telegra.ph/How-really-secure-and-private-is-Telegram-09-02">one</a> also have interesting content. 

However, <a href="https://www.reddit.com/r/Telegram/comments/dekx2t/how_really_secure_and_private_is_telegram/" target="_blank">one</a> of many threads on reddit is quite confusing. Can we discuss this?
Yum Install Postgres 11 client
Tags: postgres
Published: 2019-10-17 10:17:59

CentOS 7

```bash
# -U Upgrade 
# -v Show verbose stdout
# -h Show hash marks
rpm -Uvh https://yum.postgresql.org/11/redhat/rhel-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
```

Install PostgreSQL Client
```bash
# -y Always answer yes for all questions
# and clean cached package
yum -y install postgresql11 && yum clean
```

Check psql command
```bash
psql --version
psql (PostgreSQL) 11.5
```

Connect your Postgres database
```bash
# $PG_HOST: Hostname of Postgres
# $PG_PORT: Default is 5432
# $PG_USER: User of Postgres
psql -h $PG_HOST -p $PG_PORT -U $PG_USER
Password for user wms: # enter the password
```
What sucks about this app?
Tags: discuss
Published: 2019-10-17 10:03:27

---
title: What sucks about this app?
published: true
tags: discuss
---

Hi guys, I've been working on a web-based chat app built on a serverless architecture using React + Firebase and I was wondering how I could improve the experience.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/zor8qnkswqjb1olly57g.png)

If you're interested, please check out the app here http://venni-235518.firebaseapp.com and you can find the code for it here: https://github.com/ovieokeh/venni

All feedback & criticism is appreciated.
Become a technical mentor at Gaza Sky Geeks third annual women’s inclusivity hackathon
Tags: mentor, hackathon, inclusion, gaza
Published: 2019-10-17 09:39:41

Gaza Sky Geeks is organizing their third annual women’s inclusivity hackathon in Gaza on December 5-8. They want to recruit a team of mentors to come to Gaza and support the teams during the hackathon. 

Are you a developer or designer -- or do you know any amazing developers and designers -- who would be interested and able to make the trip out to Gaza and participate in the hackathon as a technical mentor?

https://gazaskygeeks.com is part of the Mercy Corps https://www.mercycorps.org



To apply:

https://airtable.com/shr6qSeiwlL1Gw4Wm



A few notes:

You have to pay for the flight to Tel Aviv yourself, also you have to take care of a visa for Israel. Your stay there will be paid for (sleeping arrangement, food etc). Basically this is voluntary position.

To find more information about what it takes to be a mentor: https://gazaskygeeks.com/become-a-mentor/

This page also has information about the safety of Gaza.
Extracting pages from a document and saving them as a new file in C#
Tags: extractpages, splitpages, createdoc, csharp
Published: 2019-10-17 09:21:55

The first and foremost question in your mind could be, is it about PDF documents only? And the answer is, No. In this blog post we will see how simple yet helpful it is to extract pages from different kinds of documents (e.g. Word, Excel, Presentation, PDF, HTML, RTF) and save them as a new file using GroupDocs.Merger for .NET. Learn more about the supported file formats. Hence, the resultant document will possess only extracted pages.

Is there any software installation needed?
GroupDocs.Merger for .NET is a back-end API that can be integrated in any existing or new .NET application (e.g. ASP.NET, Windows form, Console). It doesn’t matter if MS Office or any PDF reader is installed on your computer or not. API doesn’t rely on any third party tool or software.

How simple is it?
The following code sample demonstrates how to extract document pages by specifying exact page numbers:

{% gist https://gist.github.com/GroupDocsGists/4ed9531e8c9047ac0d39d2c38dd63a5d %} 

The following code sample demonstrates how to extract document pages by specifying page numbers range:

{% gist https://gist.github.com/GroupDocsGists/5d7e2aeca06cb84d94c49595e72738ca %} 

Below is the source PDF with 13 pages. Suppose we want to extract two pages only (1, 3) and create new PDF.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/yw7yha3wgnnxtwr7ns98.JPG)

Output PDF will look like this:

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/w1rjtcobsxdg17sm35r2.JPG)


You can download API [here](https://downloads.groupdocs.com/merger/net). Stay tuned about new features or releases [here](http://bit.ly/33AG1NB).
Build a Raffle with Google Sheet (Part 2)
Tags: google, sheet, javascript, appscript
Published: 2019-10-17 09:11:12

---
title: Build a Raffle with Google Sheet (Part 2)
published: true
description: build a simple application using Google App Script
tags: google, sheet, javascript, appscript
series: google-raffle-2
cover_image: https://thepracticaldev.s3.amazonaws.com/i/omd5spr5fqskmi2wx2a3.png
---

In the first part of this serie we've learnt how to build a simple Raffle using Google Sheet ( https://dev.to/jagedn/build-a-raffle-with-google-sheet-5da )

In this second part we'll refactor some parts of the code and improve it with new features

# Separate business logic from  UI

Open the script editor (as explained in the previous post) and create a new html file called `Client.html` and another file called `Dialog.html`

## Client.html

Paste this code into the `Client.html`

{% gist https://gist.github.com/jagedn/b649a9db6cbfc6215b1831e71957add1 file=Client.html%}

This will render the sidebar once the user select the Raffle option in the menu. 

We'll show how many participants remains to participate and we'll build a list of buttons, once per prizze. In this way the admin can choose what prizze to raffle in every moment

As you can see, when the admin click a prizze button we'll call a remote function sending the prizze selected.

## Dialog.html

Paste this code into the `Dialog.html`

{% gist https://gist.github.com/jagedn/b649a9db6cbfc6215b1831e71957add1 file=Dialog.html%}

This file is the template to render the winner of a prizze and let to choose an action (accept, denied, and not pressent)

Once the admin click one of buttons following actions happen: 

- the dialog call a remote function to notify the action selected
- when the remote function is executed the dialog is closed.

For example if the winner accept the prizze the dialog will execute this:

`google.script.run.withSuccessHandler(google.script.host.close).yepes(suertudoIdx,prizze)`

where `yepes` is a remote function

## Business

Paste this code into the `Code.gs` (replace all the code if you followed the previous post)

{% gist https://gist.github.com/jagedn/b649a9db6cbfc6215b1831e71957add1 file=Code.gs%}

## Prepare your Raffle

In a clean sheet write the participants and the prizzes following this screen:

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/p5lxxotk2qe4neannujp.png)

Pay attention to use the same rows and columns or if you want to use different ranges remember to adjust them into the `Code.gs` file


## See in action

In this video you can see the raffle in action

{% youtube F8isRNpUJoU %}
Visual Studio: Learn Free Web Scriping in Easy 10 Steps | Data Mining | HTMLAgilityPack | LINQ
Tags: webscraping, htmlagilitypack, datamining
Published: 2019-10-17 09:10:10

These 10 articles will guide you how to become a web scraper, data mining from scratch, you must have basic concepts of programming. You can scrap whole website after learning these articles.

{% link https://dev.to/anjankant/free-video-library-be-an-expert-in-web-scraping-with-free-15-awesome-video-1oin %}


- [HAP: What is HTML Agility Pack?] (https://www.technologycrowds.com/2018/04/hap-what-is-html-agility-pack.html)
- [HAP: Learn to Install HTML agility pack and Load an HTML Document](https://www.technologycrowds.com/2018/04/hap-learn-to-install-html-agility-pack.html)
- [Learn HAP: Extract Meta-Information from the website using HTML agility pack] (https://www.technologycrowds.com/2018/05/Extract-Meta-Information-from-the-website-using-HTML-agility-pack.html)
- [Learn HAP: Select Nodes using Html Agility Pack] (https://www.technologycrowds.com/2018/08/learn-hap-select-nodes-using-html.html)
- [Learn HAP: HTML Manipulation using html agility pack] 
(https://www.technologycrowds.com/2018/09/html-manipulation-using-html-agility-pack.html)
{% link https://dev.to/anjankant/asp-net-web-api-interview-questions-and-answers-3kk6 %}
- [Learn HAP: HTML Traversing using Agility Pack C#] (https://www.technologycrowds.com/2018/11/HTML-Traversing-html-using-Agility-Pack-CSharp.html)
- [Learn HAP: HTML Writer using Agility Pack C#] (https://www.technologycrowds.com/2018/11/html-writer-using-html-agility-pack-csharp.html)
- [How to Find Text by class name using Html Agility Pack C#] (https://www.technologycrowds.com/2019/07/how-to-find-text-by-class-name-using-html-agility-pack.html)
- [How to search HTML Page by specific text using html agility pack?] (https://www.technologycrowds.com/2019/08/how-to-search-html-page-by-specific-text-using-html-agility-pack.html)
- [HAP: How to extract favicon from website using HTML Agility Pack] (https://www.technologycrowds.com/2019/08/hap-how-to-extract-favicon-from-website.html)

**[Source](https://www.technologycrowds.com/search/label/HTML%20Agility%20Pack)**
Tech News and Opinions about Python
Tags: todayisearched, news, opinions, python
Published: 2019-10-17 09:02:35

Disclaimer: I don't hate Python. I'm studying it over at [Exercism](https://exercism.io). The opinions of the writer and commentators of the quoted article are their own.

I recently stumbled over a, new to me, news aggregator called [TechURLs](https://techurls.com/). It's part of a larger stable of aggregators, including [MathURLs](https://mathurls.com/) and likely many others.

It was on TechURLs that I discovered an opinion-piece entitled [Python is not a great programming language](https://gist.github.com/RobertAKARobin/a1cba47d62c009a378121398cc5477ea). 

So I'm wondering, as I do, *does Python have any cons* (in the pros and cons sense)? It seems fairly ubiquitous, appearing in all sorts of places, so the pros must be fairly compelling. But are there situations where it's really not the best, and if so, why?
How to fix autoplay html5 video on iOS?
Tags: html, video, autoplay, ios
Published: 2019-10-17 08:58:21

If you have used Javascript to play an html5 video, you may encounter some errors, including this error:

![Unhandled Promise Rejection: AbortError: The operation was aborted.](https://thepracticaldev.s3.amazonaws.com/i/b1q9ijz4v1mggqr13nmh.png)

or permission errors.

The reason is that browsers in recent years changed their [policies](https://webkit.org/blog/6784/new-video-policies-for-ios/) to prevent autoplay video because they think users don't want it (that's correct in most cases).

What we can do to solve this issue?
- Add `autoplay`, `muted` and `playsinline` attributes to your `<video>` element.
- If you need sound, you should put an unmute button beside the video, then in onClick callback, get video element and set `muted = false` by Javascript.

**Pro Tip!** If you have multiple videos on your page and only a single unmute button, then make sure to unmute all videos in the click callback of that button, otherwise, iOS won't let you unmute video before playing it on demand.

That's it, happy autoplaying!