teleren/devto huggingface dataset:
Create a Dynamic Prompt String in Bash
Tags: bash, shell, showdev, tutorial
Published: 2019-07-25 13:40:50

You may have seen some cool `zsh` prompts that show the name of the current Git branch in the prompt, like this one from [`oh-my-zsh`](https://github.com/robbyrussell/oh-my-zsh):

[![](https://thepracticaldev.s3.amazonaws.com/i/dvho55ke84sastfm80vq.png)](https://github.com/robbyrussell/oh-my-zsh)

I wanted to recreate something like that in `bash` and discovered that it's actually really easy to generate a dynamic `bash` prompt. Let's start with a boring old static prompt:

```bash
$ export PS1="\n$ "

$ ls
Applications      Documents         Dropbox           Library
Desktop           Downloads         Git               Movies

$ 
```

This sets my prompt to just a `$` sign, with a newline before it so the output of the previous command isn't directly adjacent to the next prompt. To add a function to a bash prompt, all we need to do is include it as a subshell within the definition of `PS1`, making sure to escape the `$` at the beginning of the subshell syntax, like so:

```bash
$ export PS1="\n\$(date)\n$ "

Thu 25 Jul 2019 14:27:23 IST
$ ls
Applications      Documents         Dropbox           Library
Desktop           Downloads         Git               Movies

Thu 25 Jul 2019 14:27:25 IST
$ 
```

Now, to check what branch we're on in a `git` project, we can do

```bash
Thu 25 Jul 2019 14:32:12 IST
$ git status
On branch my-test-branch
Your branch is up to date with 'origin/my-test-branch'.

nothing to commit, working tree clean
```

This gives us the current branch name in the first line. We can select that line with `grep` and parse it with `sed`:

```bash
Thu 25 Jul 2019 14:34:45 IST
$ git status | grep 'On branch' | sed 's/On branch / => /'
 => my-test-branch
```

But what happens if we're not within a `git` repo?

```bash
Thu 25 Jul 2019 14:35:06 IST
$ cd

Thu 25 Jul 2019 14:35:12 IST
$ git status | grep 'On branch' | sed 's/On branch / => /'
fatal: not a git repository (or any of the parent directories): .git
```

Oof, error text. Let's redirect all error output to `/dev/null`:

```bash
Thu 25 Jul 2019 14:35:26 IST
$ git status 2>/dev/null | grep 'On branch' | sed 's/On branch / => /'
```

There's now no output at all when the current directory isn't a `git` repo, so `grep` returns nothing and so does `sed`. Finally, let's add this to the prompt:

```bash
Thu 25 Jul 2019 14:35:36 IST
$ export PS1="\n\$(date)\$(git status 2>/dev/null | grep 'On branch' | sed 's/On branch / => /')\n$ "

Thu 25 Jul 2019 14:35:41 IST
$ cd Git/my_git_project/

Thu 25 Jul 2019 14:35:49 IST => my-test-branch
$ git checkout master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.

Thu 25 Jul 2019 14:35:53 IST => master
$ 
```

That's it! You now have the same functionality as those fancy styled shells that display your current `git` branch. Just add some colour to this and you're good to go.
How to get react-native-push-notifications to work with React Native >= 0.60
Tags: reactnative, help
Published: 2019-07-25 13:38:14

Hey! So I spent almost the whole day fiddling around with [react-native-push-notifications](https://github.com/zo0r/react-native-push-notification) which has a really slow update cycle.

Besides linking the package via react-native and setting up the native code in iOS it works fine out of the box on iOS devices.

On Android on the other hand, the currently available npm version of the package will break with any react native project using **androidx**. Thats because androidx dropped the old module structure from `android.support` to `androidx.`.

Funny thing is: the fix is already commited to the master. So you can just simply install the repository from Github via

```sh
npm install npm install git+https://git@github.com/zo0r/react-native-push-notification --save
```

Now you should have the fixed version in your repository! Follow the android setup guide as described in the README.

The only thing you now need to do is to add a Firebase and Google Play Services version to your apps `build.gradle`

Add the following values to your `ext` values just below the `supportLibVersion`:

```
googlePlayServicesVersion = "16.1.0"
firebaseVersion = "17.3.4"
```

my `ext` configuration now looks like this:

```
ext {
    buildToolsVersion = "28.0.3"
    minSdkVersion = 16
    compileSdkVersion = 28
    targetSdkVersion = 28
    supportLibVersion = "28.0.0"
    googlePlayServicesVersion = "16.1.0"
    firebaseVersion = "17.3.4"
}
```

Now you should be able to build your android project and run your app in the simulator!
PWA vs Native App - What's your preference as a user? As a developer?
Tags: discuss, pwa, ios, android
Published: 2019-07-25 13:09:01

Myself, I feel like PWAs are great for quick and easy cross platform development but at the end of the day nothing beats a native app for me as a user.

However, having fell out of the app game some time ago it would take an immense amount of time for me to get back up to speed on things (especially on iOS). So, I tend to lean towards PWAs for development if I'm going to share with the world.

I would like to know the community's view on this... 

Do you prefer to install PWAs or native apps on your device? And, do you prefer to develop PWAs or native apps for distribution?
Hire Freelancer Remote developer with Codersera
Tags: reactnative, react, angular
Published: 2019-07-25 12:43:42

Remote work is a working style that allows people to work outside of a traditional office atmosphere. It is based on the concept that work does not need to be done in a specific place to be performed successfully.


There has been a cultural pattern shift in what society considers to be an appropriate workplace and remote work has capitalized off of that newfound freedom. 
Think out of the box!! Instead of commuting to an office each day to work from a designated desk, remote employees can perform their projects and exceed their goals wherever they please. In remote work, people have the flexibility to design their days so that their professional and personal lives can be experienced to their fullest potential and coexist peacefully.

Click here to complete reading this article:- https://codersera.com/blog/hire-freelancer-remote-developer-with-codersera/
Updating everything PyPI in Windows
Tags: python, cmd
Published: 2019-07-24 13:26:22

---
title: Updating everything PyPI in Windows
published: true
description: ways of driving pip in Windows
tags: python, cmd
---

I have a number of collections of software: [npm](https://www.npmjs.com/)-based, [scoop](https://scoop.sh/)-based, [pip](https://pypi.org/project/pip/)-based, and [cygwin64](https://www.cygwin.com/)-based. I also use [FileHippo App Manager](https://filehippo.com/download_app_manager/) to update applications and have used [Ninite](https://ninite.com/) from time to time.

I was trying to find a way of updating my PyPI collection. Below are three adapted-for-Windows approaches based on similar offerings for Linux:

* Using `pip`, `sed` and `xargs` (available through `scoop`)
```
pip freeze | sed -e "s/==.*//" | xargs pip install -U
```
Here we pipe `pip freeze` through `sed` replacing double-equals and everything after with an empty string, then pipe that into xargs which runs `pip`.

* Using `pip` and `sed` with a more `CMD`-like approach
```
FOR /F %f IN ('pip freeze ^| sed -e "s/==.*//"') DO pip install -U %f
```
In this approach we use the file-set parameter (/F) on the `for`. The command between the single-quotes is evaluated (which does the pip and sed thing of #1) and every line is then placed into the `%f` meta-variable for execution in the `do` clause.

* Using `pip` and `CMD` only.
```
FOR /F "tokens=1 delims==" %f IN ('pip freeze') DO pip install -U %f
```
Finally, we use the `for /f` method but this time give extra parameters to control the parsing of the output from `pip freeze`: we split on `=` and take the first token. Each result goes into `%f` for processing by the `do` clause.

There are other ways of doing this on Windows, like [PowerShell](https://docs.microsoft.com/en-us/powershell/scripting/overview?view=powershell-6). Hopefully, someone will demonstrate how.
How to win the fight against react-number-format's keyDown handler?
Tags: help, react
Published: 2019-07-25 12:36:23

Hello, guys. Glad to join the awesome [**DEV.to**](http://dev.to/) community. I'm banging my head on the keyboard trying to understand how to make react-number-format library to treat keyDown event where key property '**,**' (comma) as if a user typed '**.**' (period). 

It perfectly works with the first example where **decimalSeparator=','** In this case, the component takes '**.**' as if a user typed '**,**'. I want the same effect, but for the **second** example, so the library could get '**,**' as if a user typed '**.**'.

Already tried to curb through the code, but unfortunately, debugger behaves oddly in Chrome DevTools. Would be glad if anybody gives the notion where to move in order to make it happen. Thanks.

Codesandbox - https://codesandbox.io/s/recursing-sky-23o31
[Video] Ultimate Guide to Derived Queries with Spring Data JPA
Tags: java, tutorial, beginners
Published: 2019-07-25 12:34:35

Today, I am here with the ultimate guide for using derived queries with Spring Data JPA. We will start with a simple query and extend it until you know all the features you need to use derived queries in your project.

{% youtube GVeY08vUiPE %}

If you like this video, please subscribe to [my YouTube channel](http://bit.ly/2cUsid8). I publish new videos every week.
Gitignore in VSCode
Tags: git, vscode
Published: 2019-07-25 12:19:31

---
title: Gitignore in VSCode
published: true
description: 
tags: GIT, VSCODE
---
This week I published an article about automating the creation of a [LICENSE file for GIT](https://dev.to/eclecticcoding/license-file-for-git-3dp) in VSCODE. I wanted to consider the same methodology for the obligatory `.gitignore` file.  

As you probably already know, the `gitignore` file is used in your local GIT repository to ignore files, like `node_modules` directory and `env` files which may contain API keys, to exclude them from your repository. 

Just like with the LICENSE file example, you could easily copy a `gitignore` file from another repository and include it in your next *commit*, but there is an **EASIER** way? 

![alt text](https://thepracticaldev.s3.amazonaws.com/i/xx3beul77at99q46wzsv.png "VSCODE Extensions Marketplace.")

##VSCode Extensions   
If you are using Vscode as your IDE, you already know there are a ton of extensions for almost everything you need. Today, I found this nifty extension, called [.gitignore Generator](https://marketplace.visualstudio.com/items?itemName=piotrpalarz.vscode-gitignore-generator) which installs a `.gitignore file`, specific for your type of project, to your root project directory.   

So, to use, go to the Command Palette, and type `gitignore`, and select `Generate .gitignore File.` A selection box will pop-up (see below):

![Screenshot of selection menu.](https://thepracticaldev.s3.amazonaws.com/i/aty8tjfmzkd31ntmlqy9.png "Screenshot of selection menu.")

It will generate a `.gitignore` file based on the [gitignore](https://www.gitignore.io/) API. 

Have a nice day.
Changelog
Tags: blockchain, validator, smartcontract, grafana
Published: 2019-07-25 12:07:32

Join the discussion in DAOBet Telegram groups:

- [International community [EN]](https://t.me/daobet)
- [Validators group chat](https://t.me/daobet_validators)
- [Game developers group chat](https://t.me/daobet_developers)

Join our social media to keep up to date with all the announcements: [Twitter](https://twitter.com/daobet_org/), [Facebook](https://facebook.com/DAObet.org/), and [LinkedIn](https://linkedin.com/company/daobet/).


DAOBet’s (ex — DAO.Casino) development process is firing on all cylinders - and we’re right on target to meet our [Roadmap](https://daobet.org/?&utm_source=devto) milestones. 

Our governance smart-contract implementation is complete, moving us into the next phase of our progress. Currently, we’re seeking [DAOBet Validators](https://daovalidator.com) to become a fundamental element of the DAOBet system and platform.

DAOBet blockchain is on the brink of being ready for our new community of Validators - look out for the *upcoming “How to run a validator node” tutorial* - available soon!

*Below, you’ll find the recent changelog...*


![](https://thepracticaldev.s3.amazonaws.com/i/c6itieiqydw0hdmfv1yz.jpg)

### **Governance Smart-Contract Implementation - COMPLETE!**
We’ve been beavering away tirelessly for the last month or so to spearhead the implementation of our new and improved governance rules for the DAOBet Blockchain. 

This brand, spanking new governance system includes a dynamic number of validator nodes (21-60?) and a dedicated staking mechanism for the voting process.
### **TestNet Toolchain Automation and Monitoring Environment - UP & RUNNING!**
We’ve also been busy building robust monitoring and telemetry setups - based on Prometheus and Grafana - for collection and processing. 

This allows us to measure our network’s test environment performance, to provide key insights to our community using the data collected. 
### **RANDPA Consensus Algorithm Bugs & Performance - FIXED & IMPROVED!**

Don’t think we’ve forgotten about RANDPA! We’re all hands on deck, ensuring our revolutionary consensus algorithm - RANDPA - is on schedule for its TestNet v2 release.

In order to meet our deadlines, we’ve been full steam ahead, enhancing both the stability and performance of the algorithm.  We’ve been fervently fixing bugs and working on performance speed and reliability for a ‘powered-up’ RANDPA in TestNet v2.

Luckily, the sprint is almost over! Get out your calendars, we’re about to release a dev.diary to give you a more comprehensive view of what’s happening behind the scenes at DAOBet. 


Join the discussion in DAOBet Telegram groups:

- [International community [EN]](https://t.me/daobet)
- [Validators group chat](https://t.me/daobet_validators)
- [Game developers group chat](https://t.me/daobet_developers)

Join our social media to keep up to date with all the announcements: [Twitter](https://twitter.com/daobet_org/), [Facebook](https://facebook.com/DAObet.org/), and [LinkedIn](https://linkedin.com/company/daobet/).
Baseline for Effort Estimation - How Do You Do It?
Tags: agile, productivity, discuss
Published: 2019-07-25 12:06:55

My team and I have recently been running some sessions to determine a fresh baseline for estimating our work. I'm curious how others on DEV come to a baseline for their estimations.

So, how do *you* come up with a baseline for your estimations?

Image courtesy of [Annie Spratt](https://unsplash.com/photos/QckxruozjRg) on Unsplash
Base - API for authentication, email sending, image upload and more!
Tags: webdev, api, crystal, mintlang
Published: 2019-07-25 12:06:45


I work in an agency ([Digital Natives](https://www.digitalnatives.hu)) which creates products (large and small) for clients. We are there from the design and validation phase up until the MVP development, which I'm part of as both frontend and backend developer. 

I realized that these projects have a lot in common so I created **[Base](https://www.base-api.io)** 🎉 (API as a Service) to help me with them:

- 👥 handling user registration / authentication
- 📧 sending emails
- 📁 uploading files to a cloud provider for downloading later
- 🖼 uploading images to a cloud provider, with cropping and resizing capabilities

In my ~7 years of professional experience **I build these things over and over again** for many products using a library / service or just coding by hand.

In the last project I worked on I used different services for each and the end result is a spagetti of calling different APIs with different keys and some interesting hacks to keep them working correctly 🤮, not to mention the hustle of getting production keys from the client and managing all of those admin interfaces.

At this point I thought 🤔: **there must be something easier, more compact to use** but there isn't, especially if you want to remain language agonistic.

So **[Base](https://www.base-api.io)** was born and with it you can do all the things mentioned above using a **single API key**, and it has a **nice, clean UI** where you can see all of your resources per project:

![Screenshot](https://thepracticaldev.s3.amazonaws.com/i/a701uz7pf6qaqhf1qtof.png)

Keep in mind this is just an MVP, there are a few features I'm planning to add in the next couple of weeks:

- client libraries for some languages (Ruby, NodeJS, Go and Crystal at first)
- single newsletter signup and querying the recipients
- batch email sending
- scheduling calls to your server (think cron jobs)
- using your own credentials for storage and email sending

I hope it will be useful for your next project :)

Let me know what you think!

------------

Since this is DEV Community here are some facts about the code:

- the backend is build with [Crystal](https://crystal-lang.org), it's currently a **2.4 MB single binary** that runs on Heroku using 13 dependencies (shards)
- the frontend is build with [Mint](https://www.mint-lang.com), it's hosted on [Netlify](https://www.netlify.com), it's both desktop and mobile friendly and it has no dependencies other than the standard library
- the frontend is a PWA so the API reference is working offline
- the backend is ~2200 LOC and the frontend is ~8600 LOC
- the database is PostgreSQL
- it took me around a month to build it off work

If you have any questions I would be happy to answer them.

------------

_Credit: Header illustration from [fullvector](https://www.freepik.com/fullvector)_
Mapbox dans un projet jhipster
Tags: jhipsteravecmapbox
Published: 2019-07-25 12:03:14

Bonjour je suis en stage de fin d'etude dans une entreprise et mon projet consiste à faire une application utilisant les SIG(systemes d'informations géographiques). Je compte utiliser mapbox(vu que google map est payant) vous pourrez me donner quelques conseils pour le faire.? merci
things you should know before a dev interview (part 1 of n)
Tags: sql, interview
Published: 2019-07-25 11:25:30

---
title: things you should know before a dev interview (part 1 of n)
published: true
description: stuff you should know before an interview
tags: sql,interview
---

tl;dr learn you some SQL

I have interviewed a lot of potential developers and one of the core skills you really should have is SQL. 

Not all jobs will require you to know SQL. The concepts are core to what most businesses will want from programmers. Every shop will have data stored somewhere. Even if you are a front end developer your data will come from somewhere and knowing how SQL works will give you an advantage.

Here are some of the questions you should be able to answer and or talk about.

**What is SQL? Have you used it? Tell me how you would get data from a database.**
Do you know what SQL stands for? Can you name some different databases? Why do you need a database? All of these questions are "get in the door" basic questions that you should be able to answer if asked.

**understand the concept of connecting to a database**
In whatever language you use there will be a concept of connecting to a SQL database. In Python it is a connect statement. In Java you will use JDBC to load the driver and the connect to the DB.

There is also an element of resource management with this idea too. Can one program make hundreds of connections to a single database? 

There is a life cycle of the connection: you connect, you do work and then you release the connection. Again these are basic concepts but important to understand.

**learn the SELECT statement**
You need to have interacted with a SQL database either in the CLI that the DB provides or in your language of choice. Almost all modern languages have a way to run queries and get data from a SQL database. Do this at least once before an interview.

**learn how to filter data with the SELECT statement**
Being able to write a SELECT state with a WHERE clause is a fundamental skill. The concept of grabbing rows of data then taking one of more columns from those data rows and filtering the data is fundamental.

**learn about joins**
If you are just starting out this will be push your knowledge a bit. You do not have to be an expert but understanding the concepts here is essential.
The concept of taking two sets of rows from different tables and joining them together based on a field in the data.

**I am just a beginner and do not work for a company how can I get SQL experience?**
Use SQLite. https://www.sqlite.org/index.html It is free! This is an easy way to use/practice with SQL syntax. You do not even need to use it with a language it has a command prompt you can use.

If you are going to use sqlite with a language the easy choice is Python.
In Python sqlite is built into the language you downloaded for free.

```python
import sqlite3
```

I will write more about SQL in some other posts!
Productivity Hack: The Most Important One
Tags: productivity, journey, personaldevelopment, management
Published: 2019-07-25 11:15:54

---
title: Productivity Hack: The Most Important One
published: true
description: 
tags: productivity, journey, personal development, management
---

I have tested a lot of hacks for productivity.
Some worked, but were too complex to implement in the long run.
Some didn't work at all for me.

From now on, I'll write more about this topic and my experiences and approaches.

Today I'll start with my most important hack for productivity: 

---

# Use a Schedule (properly!)

That doesn't sound very original.
Many people already use a schedule - in a less than optimal way.

My biggest mistake was that I only entered external appointments,
i.e. appointments with other people - meetings, dinners, etc.

This put my personal appointments in the background and gave them a lower priority.
First I took care of all other people, then I took care of myself.
Why didn't personal appointments deserve a place in the schedule?

**Treat your personal me-time appointments with respect, give them space in your schedule!**

_Example:_
A person says that his/her health & fitness is very important.
At the same time, this person has hardly any related appointments in his/her schedule. Eating, moving, sleeping - put it in your schedule.

---

**Implementation:**

**Step 1:**
Create a blueprint schedule with an entry for every time block that lasts at least 30 minutes. We don't want to become micro-managers, otherwise the system becomes too complex.

_Question:_ Why should I do that?
_Answer:_ To get an overview of your daily activities and whether goals and implementation match.
_Example:_ Goal: To be healthy & fit. Implementation: 5hrs sleep, 10mins eating at the desk and 5mins of walking from apartment to car => Goals and implementation doesn't match.

I use Google Calendar.
You can enter repeating appointments:

_Example:_
2200-0600: sleeping
0700-0800: grooming, mobility, breakfast
0830-0900: commute
0900-1200: work, part 1
1200-1300: lunch
1300-1700: work, part 2
1730-1800: commute
1800-1900: dinner, relaxing
1900-2000: gym
2000-2200: friends

This could be a blueprint schedule for Monday through Friday.
Also do this for Saturday & Sunday. 

_Question:_ Saturday & Sunday?
_Answer:_ Sure. Do you know this feeling when weekend passed by quickly? That's because many people live an unconscious life.


**Step 2:**
Adjust the schedule daily to get the actual data of your life.
If you see some empty blocks, try to remember what you did there.

**Step 3:**
Review your actual schedule at the end of the week and look where your time actually flows to. Does this contribute to reaching your goals? 

---

What are your best productivity hacks?