teleren/devto huggingface dataset:
Node, accept input from the command line
Tags: node
Published: 2018-08-16 18:34:33

---
title: Node, accept input from the command line
published: true
tags: node
canonical_url: https://flaviocopes.com/node-input-from-cli/
---

How to make a Node.js CLI program interactive?

Node since version 7 provides the [`readline` module](https://nodejs.org/api/readline.html) to perform exactly this: get input from a readable stream such as the `process.stdin` stream, which during the execution of a Node program is the terminal input, one line at a time.

```js
const readline = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
})

readline.question(`What's your name?`, (name) => {
  console.log(`Hi ${name}!`)
  readline.close()
})
```

This piece of code asks the username, and once the text is entered and the user presses enter, we send a greeting.

The `question()` method shows the first parameter (a question) and waits for the user input. It calls the callback function once enter is pressed.

In this callback function, we close the `readline` interface.

`readline` offers several other methods, and I’ll let you check them out on the package documentation I linked above.

If you need to require a password, it’s best to now echo it back, but instead showing a `*` symbol.

The simplest way is to use the [`readline-sync` package](https://www.npmjs.com/package/readline-sync) which is very similar in terms of the API and handles this out of the box.

A more complete and abstract solution is provided by the [Inquirer.js package](https://github.com/SBoudrias/Inquirer.js).

You can install it using `npm install inquirer`, and then you can replicate the above code like this:

```js
const inquirer = require('inquirer')

var questions = [{
  type: 'input',
  name: 'name',
  message: "What's your name?",
}]

inquirer.prompt(questions).then(answers => {
  console.log(`Hi ${answers['name']}!`)
})
```

Inquirer.js lets you do many things like asking multiple choices, having radio buttons, confirmations, and more.

It’s worth knowing all the alternatives, especially the built-in ones provided by Node, but if you plan to take CLI input to the next level, Inquirer.js is an optimal choice.
Tips on how to comment your code
Tags: comments, devtips, practicality
Published: 2018-08-15 12:28:27

---
title: Tips on how to comment your code
published: true
description: Many are having trouble telling others, through comments what their code does, this video is here to give you some direction.
tags: comments, devtips, practicality
---
{% youtube -cJbOq36OVw %}

What are your thoughts on this?

I am constantly improving the series with whatever information I can get my hands on, therefore, please, do leave a comment, however positive/negative it is.

Thank you!
I am a software developer with 10+ years experience, and run my own profitable business - AMA!
Tags: ama
Published: 2018-08-15 11:50:34

---
title: I am a software developer with 10+ years experience, and run my own profitable business - AMA!
published: true
description: AMA
tags: ama
---

As title suggests, I'm a software developer with 10y+ experience, run my own profitable business (profited within 2 months of operation, and remain profitable), AMA! :)

I’m also preparing to launch another business, if you’re interested give me a shout I’s love to collaborate.
Sometime ago I changed my life and you can change yours, too
Tags: career, productivity, routine
Published: 2018-08-15 11:29:18

---
title: Sometime ago I changed my life and you can change yours, too
published: true
description: I found a new way of living
tags: career, productivity, routine
---


Inspired by Hal Elrod's The Miracle Morning, I readapted my routine sometime ago, wanting to be better, I found a new way of living. The main purpose of the book is to wake up 1 hour earlier and dedicate this time to yourself, to the improvement of yourself.

To maintain a successful routine and do things that make us develop ourselves,  we need to create new habits, our bodies have to get used to the new way of living. But, of course, nothing is so simple, it's normal to want to give up right at the beginning and return to old habits, that is what our body wants most. The book explains how to create a habit using three stages:

* [Days 1–10] Stage 1: Unbearable - Despite the first few days of excitement, the sensation will soon be painful. Your mind and body will try to reject change. But this phase is temporary.

* [Days 11–20] Stage 2: Uncomfortable - You will be getting used to your new habit. At this stage it will still be tempting to go back to your old behaviors.

* [Days 21–30] Stage 3: irreversible- Where transformation takes place, your new habit becomes part of your identity. But nothing to stops at that moment, you should maintain your new condition for the future.

During the weekdays, this is my routine. I usually wake up 6:30 a.m., although I start working at 8 o'clock, I do this for a few reasons:

06: 30 am – 06: 35 am -> I stretch.

06: 35 am – 06: 40 am -> I make a list of goals and what I can do to reach them.

06: 40 am – 06: 50 am -> I read books.

06: 50 am – 07: 00 am -> For my personal development, I read some articles or watch some videos that will add somehow to my growth.

07: 00 am – 07: 15 am-> I write something, for example this text, now it's 7:42 am.

07: 15 am – 07: 30 am -> For my professional development, I read some articles or watch some videos that will add somehow to my growth.

07: 30 am – 07: 50 am -> Having breakfast, just as important as the other things.

In addition to these things I do in the morning, I usually add two more things at night, but not at a specific time:

Studying English -> For 1 hour

Exercise -> 30 minutes minimum

If you want to improve your routine, remember that in the beginning this process will be difficult, difficult things tends to make you give up. However, doing things that help us become better people every day causes you to grow in all aspects of your life.
How to hire highly-skilled Ruby developers?
Tags: ruby, career, rails
Published: 2018-08-15 10:59:49

---
title: How to hire highly-skilled Ruby developers?
published: true
description: Skilled tech talents are the core asset of any business. Explore the main tips & advice on how to hire RoR developers for your project.
tags: ruby, career, rubyonrails
---
Ruby on Rails is a framework that is commonly used in web application development. Its core benefits are: high code quality, powerful toolset and increased speed of app creation.  

With a large community of Ruby developers existing online, companies need to be especially attentive in their recruiting process. These are several important steps needed to [hire Ruby programmers](https://cybercraftinc.com/technologies/rubydevelopers):

1) Set strict requirements but remain flexible

Before screening dozens of candidate resumes, decision makers need to clearly set the required skills & knowledge for their particular project. Identifying the ideal picture of the employee is essential for productive recruiting process. Although, recruiters should understand that finding a perfectly-fitting candidate happens quite rarely. To avoid rejecting decent specialists, recruiters should adopt a flexible & employee-centric approach. Conducting personal interviews usually helps to find out if a person fits the job or not. 

2) Check their skills 

While selecting RoR developers, a testing task should not be underestimated. This allows to verify their coding skills in practice. If this is not possible, ask them to show examples of their work in dedicated communities. In such way, recruiters can have an idea about candidate's experience and level of performance. Cherry on top, conduct personal interview to check the candidate's soft skills.   

3) Get help of professionals. 

If you're new to IT recruitment, it's better to contact those who have experience in closing tech vacancies globally. For example, many companies prefer turning to a trusted [offshore software development company](https://cybercraftinc.com/). This allows to save considerable amount of time & money (60% to be precise) while still getting top quality tech talents. 

Whatever is your specific type of project & business, stay patient when looking for Ruby programmers. These specialists may play a decisive role in the success or failure of your project.
Git the basics #3 (how-to)
Tags: git, tutorial, example
Published: 2018-08-15 10:15:57

---
title: Git the basics #3 (how-to)
published: true
description: In this video we talk about how to use remote repositories, pushing and fetching changes and integrating them into our repository.
tags: git, tutorial, example, basic
---

{% youtube pAlO5F-ML7E %}
Continuous deployment to Firebase hosting using Travis CI
Tags: github, travisci, firebase, ci
Published: 2018-08-15 10:39:13

---
title: Continuous deployment to Firebase hosting using Travis CI
published: true
tags: github,travis-ci,firebase,continuous-integration
canonical_url: https://medium.com/@bartwijnants/continuous-deployment-to-firebase-hosting-using-travis-ci-e7d9c798ead4
---

#### Intro

Last night I had another multi million dollar web app idea. So of course first thing I do in the morning is start to work on my idea. Got to earn those dollars.

The first thing I need is some place on the internet where my customers can start handing me over their money. I want to move fast, so each time I change something I want to see the results immediately.

#### Enablers

[Firebase](https://firebase.google.com/) is a platform by Google that provides hosting with minimal effort and for free. [Travis](https://travis-ci.org/) is a hosted continuous integration solution that will allow me to deploy my changes to Firebase. [GitHub](https://github.com/) is the place where I’ll be storing my precious code.

To build this stuff I installed [Node.js](https://nodejs.org/en/) and [Docker](https://www.docker.com/) on my laptop. I didn’t really need Docker but I did not feel like installing [Ruby](https://www.ruby-lang.org/en/).

#### Let’s go to work

- Go to [Firebase](https://console.firebase.google.com) and create a new project.
- Create a new repository on [GitHub](https://github.com).
- Clone the repository locally.
- Create a minimal index.html.

```
mkdir public
touch public/index.html
```

- Connect GitHub repository to Firebase project using the Firebase tools.  
Don’t overwrite index.html when initializing.

```
npm install -g firebase-tools
firebase login
firebase init 
```

- Generate a Firebase CI token (and keep it handy).

```
firebase login:ci
```

- Go to [Travis](https://travis-ci.org/) and activate the GitHub repository.
- Encrypt the Firebase CI token using Travis CLI.

```
# only run the docker command if you don't have and don't want to install Ruby
docker run -it --rm ruby:latest bash
gem install travis
travis encrypt "1/firebase_CI_token" -r githubusername/reponame
```

- Create a .travis.yml file to deploy to Firebase after every push to GitHub.

```
language: node_js
node_js:
  - "node"
script:
  -
deploy:
  provider: firebase
  token:
    secure: "encrypted_firebase_CI_token"
```

- Commit and push the changes to GitHub.
- Watch Travis build and deploy.
- Check Firebase Hosting to see the deployment history.
- Go to the Firebase Hosting domain for the project to see the website.

#### Conclusion

I just spent half a day on writing a guide on continuously deploying a website to Firebase using Travis CI and I didn’t start working on my multi million dollar idea.

Find the code on [GitHub](https://github.com/bartw/travisonfire).

See the website [here](https://travisonfire-a209c.firebaseapp.com/).
I'm a fullstack web developer in ecommerce, Ask Me Anything!
Tags: ama
Published: 2018-08-15 09:57:40

---
title: I'm a fullstack web developer in ecommerce, Ask Me Anything!
published: true
tags: ama
---

I started my training back in 2009, finished it in 2012 working in a company that had a LAMPP-stack CMS as product with many modules for different industries (such as hotels, hospitals and call centers).

After that I moved to an agency that made online shops based on [OXID eShop](https://github.com/OXID-eSales/oxideshop_ce). Really interesting clients and challenges!

After that I decided to move to a bigger city (Hamburg, Germany) and I got employeed as lead fullstack developer in an agency that also creates online shops but based on [Shopware](https://github.com/shopware/shopware). Writing plugins, APIs and whatever the customer needs. That's where I am now.
Introduction to Netsuite
Tags: netsuite
Published: 2017-08-14 05:54:42

---
title: Introduction to Netsuite
published: true
description: Introduction to Netsuite
tags: netsuite
---

NetSuite Inc. is a United States software company based in San Mateo, CA. The company markets cloud-based software-as-a-service integrated business management software. This includes software for ERP, accounting, order management, inventory, CRM, professional services automation (PSA), and E-commerce applications. NetSuite was originally named NetLedger by its founders, Larry Ellison and one of his early employees, Evan Goldberg


Products:

NetSuite OneWorldNetSuite OneWorld is software for global businesses. It encompasses modules for accounting/Enterprise Resource Planning (ERP), Customer Relationship Management (CRM), ecommerce and professional services automation. [NetSuite](https://mindmajix.com/netsuite-training) launched OneWorld in 2008 to target midsized companies that are multinational or have multiple subsidiaries. It allows companies to run multiple companies or subsidiaries off of one system. The software runs in the cloud via a Software as a Service (SaaS) model, meaning NetSuite runs and maintains the computing infrastructure and delivers it over the Internet. Users access the software via a Web browser and pay a monthly subscription price. OneWorld supports more than 170 currencies, 15 languages, and country-specific accounting standards in North America, Europe and Asia. A foreign currency revaluation engine lets businesses monitor exchange rate fluctuations continuously. In 2012, NetSuite offered OneWorld as a Two Tier ERP option for companies running Oracle software. NetSuite argues that the two-tier approach can cut deployment time and costs instead of installing on-premise ERP in divisions.

NetSuite SuiteCommerceSuiteCommerce is NetSuite’s software package for retailers, integrating ecommerce websites with in-store sales and back office accounting tools. SuiteCommerce is a central system that manages all transactions and customer interactions via the Web, mobile, social and brick-and-mortar. NetSuite acquired Retail Anywhere, one of its partners, in January 2013 to provide a Point of Sale (POS) system to complement SuiteCommerce. Integrating Retail Anywhere with NetSuite's cloud computing platform gives businesses a full view of each customer across all retail channels, while providing inventory and financial information.

SuiteCloud Developer Network NetSuite’s SuiteCloud Developer Network is a Java-based development platform for NetSuite partners and customers to customize the software and build new applications to complement NetSuite. It includes the SuiteApp solution directory and a number of developer tools.

More [info](https://mindmajix.com)
How a non-coder created an API (and some questions)
Tags: api, discuss
Published: 2018-08-15 08:35:37

---
title: How a non-coder created an API (and some questions)
published: true
description: Questions about how to design and host APIs
tags: api, discuss
---


APIs fascinate me. That you can ping an unknown system and get it to share its treasure-trove with you, for you to play around with, is something that I find utterly fascinating. The first APIs that I ever used were the Twitter APIs and the IBM Watson ones; I totally loved (love?) them.

The other thing that I am fascinated by is Indology. However, APIs and Indology do not meet. While there are plenty of digital resources, freely available, on ancient India, none of these resources make available the data (treasure?) held in them in a manner that can be consumed by apps and programs.

I had the books, I had the data. But I had no idea about how to make APIs (I'd only ever used them to make bots and apps).  So, I hunted around for an easy solution and found sheetlabs.com. Thus was born [the vedic APIs](https://aninditabasu.github.io/rigVeda/index.html).

That's the non-coder way to go about making APIs, I guess. In this post, I'd like to ask you coders a couple of questions (and also to shout out about my APIs because I am so thrilled about them :) ).

### Question 1

Are nested arrays and lists a good idea, or no?
My APIs are designed to return JSON data like this, for example:

```
[
    {
        "mandal": 1,
        "sukta": 2,
        "sungby": "poet_name_1",
        "sungfor": "god_name_1",
        "meter": "meter_name_1"
    },
    {
        "mandal": 1,
        "sukta": 2,
        "sungby": "poet_name_2",
        "sungfor": "god_name_1",
        "meter": "meter_name_1"
    },
    {
        "mandal": 1,
        "sukta": 2,
        "sungby": "poet_name_2",
        "sungfor": "god_name_2",
        "meter": "meter_name_1"
    },
    {
        "mandal": 1,
        "sukta": 2,
        "sungby": "poet_name_2",
        "sungfor": "god_name_3",
        "meter": "meter_name_2"
    }
]
```

Is it better if they're like this? And, why so?

```
[
    {
        "mandal": 1,
        "sukta": 2,
        "sungby": ["poet_name_1", "poet_name2"],
        "sungfor": ["god_name_1", "god_name2", "god_name_3"],
        "meter": ["meter_name_1", "meter_name_2", "meter_name_3", "meter_name_4"]
    }
]
```

### Question 2

What could be a low-cost setup to host my own database server that'll have the data tables, and then making them available through web calls? One option that I had thought about was getting a Raspberry Pi to host a PostgreSQL server, and throwing the database open for API calls. Advisable? Other options?

### Question 3

What are the steps to convert a database table into an API? Dumb question?

I have tons of data on the Mahabharat that I want to turn into APIs, but the spreadsheets will go beyond the free limit of sheetlabs.com. Plus, some of the columns in one sheet could be linked to columns in another sheet. And I am looking for a more permanent solution anyway, so...thoughts?
Running dev.to in a container Part 2
Tags: container, docker, devto, webdev
Published: 2018-08-15 04:12:51

---
title: Running dev.to in a container Part 2
published: true
description: A follow up to my last post focusing on user experience
tags: container, docker, dev.to, webdev
cover_image: https://thepracticaldev.s3.amazonaws.com/i/6x027t1zsx9ji07x1tj3.jpg
---

In my last post I covered building a docker image, but it was so rushed I won't even link it here.

This article aims to improve on that mess of a Dockerfile. 

The [commit](https://github.com/chuckha/dev.to/commit/db3dc2fefd7f3adba16ad1532c78049d09be4336) can be found on my fork of the dev.to repo.

In order to get this version of dev.to running locally follow these steps (no cloning necessary):

```bash
# Setup a data directory for postgres
mkdir data

# Create the network that is shared between containers
docker network create devto

# Run the database
docker run --rm --network devto --name db -e POSTGRES_PASSWORD=devto -e POSTGRES_USER=devto -e POSTGRES_DB=PracticalDeveloper_development -v $(PWD)/data:/var/lib/postgresql/data postgres:10
```

and then in another terminal follow these steps for the application server:

```bash
# Setup the database and ensure dependencies are met
docker run --rm -it --network devto -e CONNECT_TIMEOUT=30 -e DATABASE_URL=postgresql://devto:devto@db:5432/PracticalDeveloper_development chuckdha/dev.to:latest bin/setup

# Run the webserver
docker run --rm -it --network devto -p 3000:3000 -e CONNECT_TIMEOUT=30 -e DATABASE_URL=postgresql://devto:devto@db:5432/PracticalDeveloper_development chuckdha/dev.to:latest bin/rails s
```

Then visit http://localhost:3000 in a web browser.

Let me know what you think!
Need Help To make Vedio Stream App using MERN stack
Published: 2018-08-15 08:04:00

---
title: Need Help To make Vedio Stream App using MERN stack
published: true
description: 
tags: 
---


I am going to build a video streaming app which is going to quite similar to twitch 's live stream or youtube 's live stream with live chat also. It is going to be app on top of react-native . The stack I am going to use is

## Node.js - for server and the stream
## React-Native - for front-end
## MongoDB
## socket.io - for notifications and all
## webRTC - dont know it will help cause never used it but have to learn this as recommended by many
And now I think this is enough but by problems are

How the video from the front-end will go to `node.js` and then server will broadcast it at an link which users can use to watch
how the comment will reflect to this link
Am I going to need any third party apis like `twilio` or `pusher` for this
How to Run Individual XCTestCases
Tags: ios, xcode, unittest
Published: 2018-08-15 07:40:42

---
title: How to Run Individual XCTestCases
published: true
description: 
tags: ios,xcode,unittest
---

# Background
You can run XCTest (unit tests for your Xcode project) easily with 'Run Test' ('Product'>'Test' or `Command+U`) on Xcode. This is useful if you make extensive changes to your product code and want to test them all at once because 'Run Test' executes all the test cases implemented in your project.

But there are times when you want to run individual test cases, such as while fixing bugs for a specific method and want to run only test cases for the method.

## Xcode
### Edit Scheme
Select 'Product' > 'Scheme' > 'Edit Scheme' > 'Test' pane > 'Info' tab, and then check and uncheck test case names. By doing this, you can specify which test cases are executed with 'Run Test'. This method is more troublesome as you implement more test cases...
![Screenshot of Edit Scheme](https://thepracticaldev.s3.amazonaws.com/i/42kno5agq1o13m7j3poc.png)

### Test Navigator
Show 'Test Navigator' in the left side panel of the Xcode window, and push the 'PLAY' icon displayed to the right of the test case name.
![Screenshot of Test Navigator](https://thepracticaldev.s3.amazonaws.com/i/j7xyajf6c957zlzh71ol.png)

### Run Current Test
`Control + Option + Command + U`
This executes a test case in which your cursor is.

### Re-Run Last Test
`Control + Option + Command + G`
This re-runs the last test cases executed.

## xcodebuild
You may find value in specifying test cases with command line interface, if you have many test cases and want to switch execution targets frequently. xcodebuild is one of the command line tools bundled with Xcode.

### Sample Usage
```
> xcodebuild test \
>   -workspace MyXCWorkSpace \
>   -scheme MyAppScheme \
>   -destination "platform=iOS,name=my_iphonex" \
>   -only-testing:MyXCTargetForTest/MyTestSuite/MyTestMethod
```

## Remarks
Xcode Version: 9.2

## References
Is there a keyboard shortcut in Xcode 6 to run a single current test function under cursor?
https://stackoverflow.com/q/28057643

Running individual XCTest (UI, Unit) test cases for iOS apps from the command line
https://stackoverflow.com/q/35166214

How to use xcodebuild with -only-testing and -skip-testing flag?
https://stackoverflow.com/q/39427263