teleren/devto huggingface dataset:
Edit your commit messages in GIT
Tags: git, edit, commit, vasubabu
Published: 2020-03-27 07:15:33


Sometimes intentionally or unintentionally you may have given a wrong commit message due to various reasons.

But don't worry...

You can change your commit messages with GIT `rebase` command.

### Step 1: Checkout Branch
checkout your branch where you want to change your commit messages
```javascript
   git checkout <branch>
```
### Step2: Pull last N commits 
Rebase will help you modify your commit messages, squash and merge all your commits into one, but this tutorial is mainly to edit your messages. I will talk more about `rebase` in another tutorial.
```javascript
   git rebase -i HEAD~N
```
`display a list of the last `N` commits in your default text editor.`

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/j0wdaapuvooccesqv5yh.png)

### Step3: Long live `Reword`
Replace pick with reword before each commit message you want to change.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/9zcujuaamz9uttp6q7os.png)

### Step 4: Use force sometimes

```javascript
git push -f origin <branch>
```

### Step 5: Have a break !!!!
Quick Tip – How to have an EditText which takes only numbers ?
Tags: android, howto, java, todayilearned
Published: 2020-03-27 07:12:00

---
title: Quick Tip – How to have an EditText which takes only numbers ?
published: true
date: 2020-03-27 07:00:00 UTC
tags: Android,How to,Java,TodayIlearned
canonical_url: https://10xlearner.com/2020/03/27/quick-tip-how-to-have-an-edittext-which-takes-only-numbers/
---

Hello ! I’m Xavier Jouvenot and in this small post, I am going to explain how to create an `EditText` which takes only numbers.

_Self promotion_: You can find other articles on Android development on my [website](www.10xlearner.com) 😉

## Numbers only by default

To make sure that a user only enter numbers in an `EditText`, there are several solutions.And the first one we are going to see is to specify that the `EditText` should only take numbers by default.

To do so, we are going to modify the `EditText` XML definition, and add one attribute to it.This attribute is `android:inputType` and can be set to a lot of different values depending on what you need. Here is a [link to the documentation]([android:inputType documentation](https://developer.android.com/reference/android/widget/TextView#attr_android:inputType)) if you want to learn more about them.This attribute is in fact a `TextView` attribute, but since `EditText` inherits from `TextView`, then it works.

Here is how an `EditText` XML definition looks like, when you want to allow only numbers:

```
<EditText
    <!--Some attributes-->

    android:inputType="number"

    <!--Some other attributes --> />

```

If not specified, this attribute is set to `text` for an `EditText`.

## Modifying the input type dynamically

Specifying the attribute in the XML is great!But if you want to modify the style of a `EditText` or a `TextView` while the program is running, then, you must use some Java code and the method `setRawInputType`.Here is how it looks like:

```
EditText et = findViewById(R.id.my_edit_text_id);
et.setRawInputType(InputType.TYPE_CLASS_NUMBER);

```

If you want to know what other option you can pass to `setRawInputType`, I encourage you to look at the [InputType documentation](https://developer.android.com/reference/android/text/InputType).

* * *

Thank you all for reading this article,And until my next article, have an splendid day 😉

## Interesting links

- [android:inputType documentation](https://developer.android.com/reference/android/widget/TextView#attr_android:inputType)
- [setRawInputType documentation](https://developer.android.com/reference/android/widget/TextView#setRawInputType(int))
- [InputType documentation](https://developer.android.com/reference/android/text/InputType)
- [EditText documentation](https://developer.android.com/reference/android/widget/EditText)
Day 14 [D&D Character Sheet]
Tags: 100daysofcode
Published: 2020-03-27 06:54:47

# Report 

Today I worked on the character sheet, I didn't make much progress but it's coming along slowly. I'm glad I went with bootstrap, their grid system makes it pretty easy to move things around.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/bd24hdn2tjnsbqkjcugs.png)


# Project

{% github ApproachingApathy/100days-dnd-character-sheets %}

The First project will be an app to keep D&D character sheets.

## Stack

I'll be using Node.js and building a full-stack Express app with MongoDB.
### Requirements
#### Minimum Viable 

- [ ] Investigate automating or finding a source of info for the data in the SRD.
- [ ] Present a D&D Character Sheet
    - [ ] The sheet should display all the same info as the first page of the 5e Official sheet.
- [ ] Users should be able to log in and create player-characters.
- [ ] Users should be able to edit character sheets.
- [ ] Users should be able to organize character sheets into groups (parties/tables)
- [ ] Sheets should auto calculate basic stats like ability modifiers.
    - [ ] Support Proficiency Bonuses 

### Cake
- [ ] Extend character creation to allow the user to use any of the three common stat gen methods.
    - [ ] Point Buy
    - [ ] Standard Array
    - [ ] Roll
- [ ] Extend the character sheet to all the info in the 5e official sheet.
- [ ] Allow for image uploads for character portraits.
- [ ] Allow for extended descriptions/backstories.
    - [ ] Characters should have nice full page backstories.
    - [ ] Preferably use a markdown editor.
useReducer in TypeScript, strictly typed version
Tags: react, typescript
Published: 2020-03-27 06:49:18

---
title: useReducer in TypeScript, strictly typed version
published: true
description: useReducer in TypeScript, strictly typed version
tags: react, typescript
---

https://reactjs.org/docs/hooks-reference.html#usereducer

```typescript
interface Action<T extends string, P = undefined> {
  type: T
  payload: P
}

type Actions = 
  | Action<'increment', { by: number }>
  | Action<'decrement', { by: number }>
  | Action<'reset', { to: number }>

type Reducer<S, A extends Action<any, any>> = (s: S, a: A) => S

const INITIAL_STATE = {
  count: 0,
} as const

const reducer: Reducer<typeof INITIAL_STATE, Actions>(state, action) => {
  switch (action.type) {
    case 'increment':
      return { count: state.count + action.payload.by };
    case 'decrement':
      return { count: state.count - action.payload.by };
    case 'reset':
      return { count: action.payload.to };
    default:
      throw new Error();
  }
}

function Counter() {
  const [state, dispatch] = useReducer(reducer, initialState);

  return (
    <>
      Count: {state.count}
      <button onClick={() => dispatch({ type: 'decrement', payload: { by: 1 })}>-</button>
      <button onClick={() => dispatch({ type: 'increment', payload: { by: 1 }})}>+</button>
      <button onClick={() => dispatch({ type: 'reset', payload: { to: 0 } })}>+</button>
    </>
  );
}
```
Resources for React with AWS
Tags: help, react, aws
Published: 2020-03-27 06:48:14

Hello does anyone know where I can find some good resources for learning serverless AWS with React?!

I am trying to create a very simple app and would be nice to see some detailed instructions or videos on how to do this with React Hooks and Cognito AWS.

The following I am trying to create is
1. Sign up ( with FB and Google Social Sign up also )
2. Sign In
3. Different user levels (ie. user, admin)
4. A nice display of the user name and email on the dashboard page, when they sign in
5. Ability to logout
6. Ability to change password or reset password

Extras
- Deploying with AWS (how to deploy with Environment variables)
- Hosting this AWS web app with Netlify

Some of this stuff I have some familiarity with using Mongo and Express, but I would like to see if there is some great tutorials with Cognito and React Hooks that really explain things in detail with best practices.

I mostly having issues with the user sign up via "federated identities", and I am a bit lost in the docs.

Thank you for your expertise and advise DEV community ❤️.
Please share some resources or links and your advise in the comments below!
How to Raise Startup Funding in India
Tags: startupfundinginindia
Published: 2020-03-27 06:26:06

How to raise startup funding in India relies on the type of firm you have. Its growth, market anticipations, age, team, and so forth are very comprehensive. Hence, you must modify your funding quest and your path. To attain financing for a firm project, you have to oversee how much cash is required to launch your firm, prove to your banker that your firm desires the fixed amount of refund, offer a gratuity, interest, or revenue for the investor’s contribution and make modifications to repay the loan.


Source Url:-https://www.startuppaisa.com/blog/how-to-raise-startup-funding-in-india/
Memoization in Javascript
Tags: javascript, beginners, webdev, functional
Published: 2020-03-27 05:51:00

#Memoization#

A memoized function "remembers" the results corresponding to some set of specific inputs.Functions can use objects to remember the results of previous operations, making it possible to avoid unnecessary work. This optimization is called memoization. JavaScript's objects and arrays are very convenient for this.Work avoidance is the best performance optimization technique. The less work our code has to
do, the faster it executes. Along those lines, it also makes sense to avoid work repetition. 
           Performing the same task multiple times is a waste of execution time. Memoization is an approach to avoid work repetition by caching previous calculations for later reuse, which makes memoization a useful technique for recursive algorithms.

When to use or memoize a function

1.Recursive function with recursive values as inputs.
2.Pure function as same input and produces same output.
3.Functions its outputs can be passed to Other function for computed results on the basis of previous result.

#Algorithm
 Pseudocode function to calculate the factorial of n:
{% runkit %}
function factorial (n is a non-negative integer)
    if n is 0 then
        return 1 [by the convention that 0! = 1]
    else   
        return factorial(n – 1) times n 
    end if
end function
{%endrunkit%}

#Algorithm  of  memoized function 
A memoized version of the factorial function 


 {% runkit %}
function factorial (n is a non-negative integer)
    if n is 0 then
        return 1 [by the convention that 0! = 1]
    else if n is in lookup-table then
        return lookup-table-value-for-n
    else
        let x = factorial(n – 1) times n 
        store x in lookup-table in the nth slot 
        return x
    end if
end function
{%endrunkit%}



#Conclusion:
Memoization is a way to lower a function's time cost in exchange for space cost; that is, memoized functions become optimized for speed in exchange for a higher use of computer memory space. The time/space "cost" of algorithms has a specific name in computing: computational complexity. All functions have a computational complexity in time (i.e. they take time to execute) and in space.
A Collection of Tips for Elixir’s Interactive Shell (IEx)
Tags: softwaredevelopment, phoenixframework, webdev, erlang
Published: 2021-07-27 02:28:41

---
title: A Collection of Tips for Elixir’s Interactive Shell (IEx)
published: true
date: 2020-03-27 05:14:09 UTC
tags: softwaredevelopment,phoenixframework,webdevelopment,erlang
canonical_url: 
---

[![](https://cdn-images-1.medium.com/max/2600/1*mwsqvmQRMUTm4rjyebjN1Q.png)](https://itnext.io/a-collection-of-tips-for-elixirs-interactive-shell-iex-bff5e177405b?source=rss-9a53804556------2)

It’s been a while since I last wrote about Elixir or Phoenix. So, when I thought about resuming my writing on Elixir, I thought I should…

[Continue reading on ITNEXT »](https://itnext.io/a-collection-of-tips-for-elixirs-interactive-shell-iex-bff5e177405b?source=rss-9a53804556------2)
Why should I use react native for mobile app development ?
Tags: help, reactnative, react, mobile
Published: 2020-03-27 05:01:42

---
title: Why should I use react native for mobile app development ?
published: true
description: 
tags: #help #react-native #react #mobile
---

I know React already, hence I am thinking of developing an application in native. I am not sure whats the pros/cons of choosing that over android/java ?

I need some help on:
1. Understanding those pros/cons ?
2. How can I maintain my application in a long run ?
3. Resources to delve more into native
4. Are there any better options than native ? (heard of capacitor ??)

Thanks!
Getting the min or max value from an array of numbers in javascript
Tags: javascript, typescript
Published: 2020-03-27 04:56:08

Turns out this is simple.  Well, it was simple anyway, but it's also quite concise.

I'll provide my code examples in javascript.

Let's suppose we have an array of number...

```javascript
var myNumbers = [100, 50, 200];
```

We can use swanky destructuring assignment, which I know more commonly as the spread operator.
```javascript
var myNumbers = [100, 50, 200];
var myMinNumber = Math.min(...myNumbers);
var myMaxNumber = Math.max(...myNumbers);
```

Short and sweet.
From Web Developer to Head of Engineering in under 5 years, AMA
Tags: ama, webdev, career, discuss
Published: 2020-03-27 04:50:19

Hi! My name's Alex and I'm currently Head of Engineering @ Shootsta.

I first started JavaScript/Web Development in 2015 and I'm now Head of Engineering of a global multi-million dollar organisation.

Happy to help out the community - reach out around goals, careers, progression or anything development. 

AMA!
I have created a video series to help you deploy a Laravel application with PHP7 and Nginx
Tags: php7, deployment, laravel, nginx
Published: 2020-03-27 03:29:29

---
title: I have created a video series to help you deploy a Laravel application with PHP7 and Nginx
published: true
description: In this tutorial video series, I will show you how to deploy a laravel application with PHP7.4, if you are using any PHP7 version it should be fine as well. As of now, PHP7.4 is the latest version so I have used it as well.
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/o7rrcxp0gpf6gihmos5c.png
tags: php7, deployment, laravel, nginx 
---

Hello, after a long time I had enough time to edit my recorded screencasts on deploying a laravel application. The corona time helped me, a lot of time is saved on getting ready for office, commuting, etc... 

In this tutorial video series, I will show you how to deploy a laravel application with PHP7.4, if you are using any PHP7 version it should be fine as well. As of now, PHP7.4 is the latest version so I have used it as well.

For the demo purpose, I have used a fresh installation of laravel without any database connectivity, but once you have deployed application this should be fairly simple for you to do, given how easy to set up a managed database these days. But still, I have plans to show you how to install and configure databases in another video. 

Below are the links to those videos, feel free to subscribe and post your doubts, comments and suggestions. also don't forget to subscribe if you find it useful.

### Part 1 - Laravel Deployment in Depth - Provisioning Server and Installing Nginx

{% youtube 5dyegVllDto %}

### Part 1 Extra (for aws users): Provisioning server in AWS

{% youtube vVM22k9iegc %}

### Part 2: Creating a custom user to secure the server 
{% youtube ceSulNURDUw %}

### Part 3: Installing PHP & Connect to a custom domain 
{% youtube vwe9vUTJD78 %}

### Part 4: Deploying the application to the server 
{% youtube UH_hd0Feh9M %}


### Github repo of the demo application

{% github ShobiExplains/LaravelDeployment no-readme %}
MongoDB, Express, NodeJS template with Passport authentication
Tags: javascript, mongodb, node, webdev
Published: 2020-03-27 03:09:32

I always wanted a swift way to create an API back-end with fewer steps. So I helped myself. I created a template with Mongoose, Express, NodeJS, Passport JWT authentication with @Hapi/Joi validation. It uses PM2 to run the server. Feel free to take look. (The whole project is modularized to directories.)

https://github.com/Niweera/men-pp-template 
[[ReadMe]](https://github.com/Niweera/men-pp-template/blob/master/README.md)
What’s your alternative solution? Challenge #1
Tags: challenges, discuss, javascript, codenewbie
Published: 2020-03-27 02:34:59

# About this series

This is series of daily JavaScript coding challenges... for both beginners and advanced users.

Each day I’m gone present you a very simple coding challenge, together with the solution. The solution is intentionally written in a didactic way using classic JavaScript syntax in order to be accessible to coders of all levels.

Solutions are designed with increase level of complexity.

## Today’s coding challenge

```
Print numbers from 1 to 10.

```

(scroll down for solution)

## Code newbies

If you are a code newbie, try to work on the solution on your own. After you finish it, or if you need help, please consult the provided solution.

## Advanced developers

Please provide alternative solutions in the comments below. 

You can solve it using functional concepts or solve it using a different algorithm... or just solve it using the latest ES innovations.

By providing a new solution you can show code newbies different ways to solve the same problem.

## Solution

```javascript
// Solution for challenge01

for(var i = 1; i <= 10; i++)
{
    println(i);
}

```


To quickly verify this solution, copy the code above in this coding [editor](https://codeguppy.com/code.html) and press "Run".

> Note: The solution was originally designed for [codeguppy.com](https://codeguppy.com) environment, and therefore is making use of `println`. This is the almost equivalent of `console.log` in other environments. Please feel free to use your preferred coding playground / environment when implementing your solution.
Find The commit that introduced a bug with git bisect
Tags: git, javascript, webdev, tutorial
Published: 2020-03-27 02:08:42


## Picture yourself in this scenario

You’ve been working on a branch for the past 3 days. 30 commits later you are ready to complete your feature when all of a sudden. You realize that something is wrong with the footer of your application. As you panic, you look at your previous commits to see if anything has changed in the footer. In fact, the footer has not been touched and you have no idea what’s going on. 

With `git bisect` you could save countless hours of trying to find the exact commit that introduced the bug, without having to go commit by commit.

`git bisect` will perform a binary search to help you find the exact commit you’re looking for. If you are unfamiliar with a binary search it basically means it will divide the options in half each time as you answer a simple question _Does the commit that it is showing you have the bug or not_.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/8h3qq3bbc2zsbl0tlkil.jpg)


## How To use

Now, to start the process use `git bisect start`. After doing this nothing happens... What you then need to do is supply git with a commit that you know where the bug not present or a ‘good’ commit  `git bisect good ch4792h2` for example. Then enter the second commit which has a known instance of the app with the bug, in other words, a ‘bad commit’ such as `git bisect bad ke37lw5`

After doing this git will checkout a commit for you that you will then have to respond with `git bisect good` if the commit it's showing you does not have the bug or `git bisect bad` if it does. After answering, git will narrow the search by removing the other half of the commits, then asking you the same question. Eventually narrowing down to the commit that introduced the bug.

And that’s it! In about 4 to 5 commits you were able to find the commit that introduced the bug. Now, this might be more beneficial for checking for changes in the UI since you can clearly see when something in the app is not working like its supposed to. However, it is a nice command to remember from time to time if something ever comes up

[Git Bisect Docs](https://git-scm.com/docs/git-bisect)
Image Upload Service with GRPC
Tags: grpc, python, docker, imgur
Published: 2020-03-27 01:20:03

Hello community!

I just shared on Github a repo containing a demonstration of image upload service in python, using imgur as the hosting.

As I started it mostly to get more used to the GRPC types and APIs, I noticed that there weren't many examples when searching for "python" + "GRPC" + "upload" + "stream". 

Soon I realized that, once finished, if I organized it a bit _(my experiments always start very messy)_, the project could be helpful to someone else.

So here is my contribution, in the hope that it is useful to somebody else in their learning process.

**[image-service](https://github.com/WesleyBatista/image-service)**

[![image-service](https://dev-to-uploads.s3.amazonaws.com/i/o5r1ckxfbdgecav5e2x9.png)](https://github.com/WesleyBatista/image-service)
Progress Check: From 1400pts to 77000pts
Tags: codenewbie, security, ctf, progress
Published: 2020-03-27 00:21:13

This last week I participated in two CTF competitions, March Hackness and PancakesCon. Both had a CTF from Cmd+Ctrl, but each were using different sites. The March Hackness used the Shadow Bank site, that I have attempted before at DefendCon this last year, and PancakesCon used the InstaFriends site.

After competing in these I decided to pull up the score cards and compare them and wow was I surprised.

# Importance of progress
Monitoring your progress in learning is important as it helps you see your strong points and weak points that need to be worked on. 
I use CTF competitions to monitor my progress in application penetration testing and my growth in understanding of the systems that can be used.

__SideNote: What is a CTF?__
For those that don't know what this style of CTF (Capture The Flag), it is an online competition where users find vulnerabilities in intentionally vulnerable websites and the stop scoring people usually wins some kind of prize.

Fun right? I think so. =)

# My Progress Check Points
I never really had a checkpoint before as I had yet to attempt a CTF challenge twice, until this last week.
The Shadow Bank site was that progress check point for me and wow have I made some good progress.

## First Time
My first attempt at the CTF was at DefendCon on September 26/27, 2019 and I was only able to get 1395 points (and most of those were from my bf poking around at it the second day when he was listening to talks with me.) I didn't do super well on my own.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/cwqi9lckbktn9uy8gake.png) 


## Second Time
My second attempt at the CTF was this last week on March 19-21, 2020 and I was able to get 7720 points without any help. I scored in the top 40 people and at one point I was the 11th from the top. 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/nhtv455x5wkd9wz34v7h.png)


#Growth
It felt good to see what I had made a LOT of growth in a lot of areas
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/w50znd8wmqch4aawgl0o.png)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/0s79kei22yvjopt2c7wf.png)
In 6 months I was able to add 6000 points to my score and see that SQL injection is still a weak point of me. And the image above shows a HUGE jump in difficulty that I was able to accomplish. 

I went from only getting easy on my own to getting a good amount of "hard" flags. Go me.
![](https://media.giphy.com/media/xNBcChLQt7s9a/giphy.gif)

<hr>

Happy Hacking
![](https://media.giphy.com/media/l3vRmVv5P01I5NDAA/giphy.gif)

###### Please Note that I am still learning. If something that I have stated is incorrect please let me know. I would love to learn more about what I may not understand fully.
scrollbar custom
Tags: codepen, scrollbar
Published: 2020-03-26 23:35:18

<p>inspired by <a href="https://alligator.io/css/css-scrollbars/" target="_blank">https://alligator.io/css/css-scrollbars/</a></p>

{% codepen https://codepen.io/Lo_h/pen/mdJQaXg %}