teleren/devto huggingface dataset:
C++ Compiler for Android
Tags: cpp, oop, android
Published: 2020-11-27 18:22:58

We all know that we have to compile source code via compiler in our machine to run the code. But there was no such thing for android phones, recently intel announced its C++ compiler for android. Let’s discuss that.

#C4droid [ C/C++ GCC Compiler ]
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/2fh73spr53ix0hpaygcf.png)

C4droid is a user-friendly C/C++ compiler for android devices. It compiles C++ source code and provides an android compatible module that can run on the device. Intel’s C/C++ compiler is not free on google play store. But you can find the compiler on other sites for free. I will provide a link down below.

##Basic features of C4droid compiler
 

1. Offline: We can write and compile our application on our device without having the internet connection.
2. C4droid provides the text editor that can highlight the syntaxes, tabs and also provides the code completion and formatting.
[Read more](https://www.kodlogs.com/blog/2665/c-compiler-for-android)
How to separate your test, development and production databases using NODE_ENV.
Tags: node, javascript, backend, showdev
Published: 2020-11-27 18:22:42

# Why should you separate your test, development and production databases?

As your applications become more complex you're going to incorporate different methods of testing to help ensure that your application works as intended. Of course this doesn't make your application 100% bullet proof, which is why proper testing is important, but why is it important to separate our testing environment from development and production? When running test suites, there is usually some degree of changes made to the database in the form of updating entries, adding, deleting, forcing errors etc. We want to make sure that when we run our tests, they don't rely on previous data to ensure that one test doesn't influence another. An easy way to do this is to implement some clean up method before and after a test is run, which usually means clearing a database and filling it with the same dummy data. 
Running a test suite on a production database would be irresponsible because a test might have unwanted side effects and alter the state of our database, or worse it would reveal information about our tests and source code. The data inside of the production database is always changing as well, which means that a test suite might work one day, but fail another day because the same data was altered causing our tests to fail.

# How to separate application environments using NODE_ENV

We can store environment variables in the node process (highly encourage you to read up on this if you're not familiar). Then we can access any of these variables in any part of our program. These variables are also secure so it is common to store API keys, credentials and other secrets inside of the node process. When running our node applications we can set the NODE_ENV and conditionally change the applications settings based on this NODE_ENV. It is a common practice to store these variables as key=value pairs inside of a .env file shown below. 

{% gist https://gist.github.com/Kristian-Roopnarine/b2a744d0025d76551c902e7d7afd9d9d %}

The environment is set to development by default and one implementation of this is found below by changing our the URI to our database. 

{% gist https://gist.github.com/Kristian-Roopnarine/d3d5152ad19b2f6bf7b359cf4e1dfea5 %}

This does not have to be used with mongoose, it was just an example. But depending on the environment our application will use a different database. This can be used to change the settings of other features as well, maybe you want to enter a testing environment for stripe, or sandbox environment to test an SDK.

# How to set NODE_ENV

Now that we know how to conditionally render settings using NODE_ENV, how do we set NODE_ENV when running our application? A common approach is to set them in `package.json` scripts: 

```
{
  ...
  "scripts": {
    "start": "NODE_ENV=production node ./app"
  }
  ...
}
```

This way you can start an app in either a test, development or production environment.
Can you reduce your time to market using Parse Server as BaaS?
Tags: backend, javascript, parse, baas
Published: 2020-11-27 18:16:18

Backend as a Service (BaaS) is a cloud-based solution to provide the backend processes in the best possible way. With a BaaS, you can connect your web and mobile applications to the pre-written cloud-based services. These can help in connecting applications to backend processes such as cloud storage, authentication, etc.

I see [Parse](https://parseplatform.org/) as a good alternative for Firebase or AWS Amplify, as I am always afraid to end up broke on a [one single mistake](https://hackernoon.com/how-we-spent-30k-usd-in-firebase-in-less-than-72-hours-307490bd24d).

Also, when I see the possibility to deploy a server on [Digital Ocean](https://www.digitalocean.com/community/tutorial_series/how-to-host-parse-server) for $5 a month, I just think that this is a no-brainer option.

However, I tend to believe that Parse is not so popular nowadays, so I'm curious to hear from you if you still using Parse, and what was your experience with it?
#5 Saving data to MongoDB
Tags: mongodb
Published: 2020-11-27 18:14:23

```
const mocha = require('mocha');
const assert = require('assert');
const MarioChar = require('../models/mariochar');

describe('Some demo tests', function(){

    //Create tests
    it('Saves a record to the database', function(done){
        var character = new MarioChar({
            name: "Mario",
        })
        character.save().then(function(){
            assert(character.isNew === false)
            done();
        })
    })
})
```
```
character.save().then(function(){
        assert(character.isNew === false)
        done();
})
```
The above function saves the `character` in the database.
`character.isNew` returns `true` when the object is created but not present in the database.
and returns `false` when the object is found in the database.
As `save` is an asynchronous function, to perform next tests we have to explicitly tell when it is finished through `done` method.

#2. Using ES6 promise instead using mogoose's own promise
```
const mongoose = require('mongoose');

// Using ES6 promise instead mogoose's promise
mongoose.Promise = global.Promise 

// Connect to mongodb
mongoose.connect('mongodb://localhost/testaroo');
mongoose.connection.once('open', function(){
    ...
}).on('error', function(error){
  ...  
})
```

At this point our test is being ran even before the connection is established.
To do that we have to put our connection code inside `before`
```
before(function(done){
     mongoose.connect('mongodb://localhost/testaroo');
    mongoose.connection.once('open', function(){
        console.log('Conneciton is made');
        done();
    }).on('error', function(error){
        console.log('Connection error', error);
    })
})
```
Note that we've also used **done** to explicitly tell when the connection is established.
Simple python string replace without using in-built function
Tags: python, replace, string, discuss
Published: 2020-11-27 18:14:14

A friend asked if I could replicate the python in-built string replace function. 

Not as robust of course but I thought I should give it a try. 

Below is my take. 

Any ideas to improve this are welcome. 

```python
def replace(strng, substr, rplstr): 
    if substr not in strng:
        return strng

    low_index = strng.find(substr) # get lowest index of substring
    high_index = low_index + len(substr) # evaluate the highest index of substring

    return replace(strng[:low_index]+ rplstr + strng[high_index:], substr, rplstr) 

```

### Output
```python
print(replace("Hello World Hello World", "llo", "@@"))
He@@ World He@@ World
```
Dawn of the Final Day: 3 releases remain
Tags: opensource, javascript, typescript, react
Published: 2020-11-27 18:11:25

The final hour is quickly approaching, with one enemy left. Release 0.4, the final assignment in my Open Source Development class. It's the big boy. We're to add a feature to any project of our choosing, and this feature cannot be a simple translation or minor bug fix. Let us proceed.

When I started programming about 2 years ago, I immediately felt enamored with C/C++. The flow, the structure, the control, the headaches, the pain, the disapp- but when I self-taught myself Python in between semesters I really started to enjoy the more high level, dynamically typed languages. Maybe JavaScript and web programming wasn't so bad. Confusing and kind of a mess, but not so bad. Structure exists in there, you just need the right eyes to discern it.

At any rate, my JavaScript/TypeScript are my weakest aspects as a developer, thus I'd like to improve them. It's for that reason that I'd like to return to [Telescope](https://github.com/Seneca-CDOT/telescope) and assist with the migration of [Gatsby to Next](https://github.com/Seneca-CDOT/telescope/issues/1316). So far I've assigned myself [two](https://github.com/Seneca-CDOT/telescope/issues/1436) [issues](https://github.com/Seneca-CDOT/telescope/issues/1463) related to this, and ideally I'll do more before the end of the semester (*I can't believe November is already over*) but my Data Structures and Algorithms class is starting to really worry me (*along with my 5 other classes, but this more than those*.) Fascinating course, but terrifying.

It will be fun to challenge myself yet again and dive into a pretty decently sized project. My TypeScript is even worse than my JavaScript so we'll see how that goes, but I'm starting to really dig web development, so I think the challenge will be a lot of fun.

And that's the plan, and with a bit of luck (and lots of planning), hopefully the pieces will naturally fall into place.

___

So many times in college I've questioned why I'm here, how I got here, and where I'm heading. Are you really growing if you're not the dumbest person in the room? Can you really increasing your bipedal plumage if you're not consistently (*and adequately*) challenged? Intimidation is a non-issue when contrasted next to bravery when moving forward. Git push yourself.

Melodramatic, I know, but I've come to the realization that this course is not about programming;  that's secondary. OSD600 is primarily about your growth as a developer, and thus your growth as a person.

> We had all the momentum; we were riding the crest of a high and beautiful wave.... So now, less than five years later, you can go up on a steep hill in ~~Las Vegas~~ Toronto and look West, and with the right kind of eyes, you can almost see the high-water mark—that place where the wave finally broke and rolled back.

`¯\_(ツ)_/¯`


Edit: [Super interesting post here](https://cacm.acm.org/magazines/2020/11/248199-it-is-time-for-more-critical-cs-education/fulltext).
What is Data Engineering?!!!
Tags: datascience, database, news
Published: 2020-11-27 18:06:30



Data Engineering is not new concept or new career path. Its a old concept. The idea and core of data engineering, and what its' all about has been around for a long time. The only difference is now, its being redesigned, redeveloped and re modified. 

Think of full stack developers. A full stack developer, is just a back-end and front-end developer merged together. Likewise, If you ever  think about databases or know people that are DBAs, SQL, and ETL Developers, then you seen data engineering before. You just seen it in a different light or perspective. 

Data Engineering in simple terms consists of taking data from one place to another. To dive a little deeper, the reasoning behind why we need data engineering is the most important part. 

Lets start with ETL. ETL in the beginning sounds confusing but we are going to start with the basics. 

E stands for Extract. Extract meaning remove or withdraw, data from different sources. So the source can be data from ESPN, Yahoo News, CNN, CBS etc.. 

T stands for Transform. Initially when you extract data from these different sources, the data may be unstructured, may be under performing in terms of speed, or may need to join some data together into one table. This is where you will do this part. 

L stands for Load. So, this is the final part. It means to store the data, that was transform somewhere in a data lake or data warehouse.
 
You can learn more about data lakes and data warehouses:[here]
(https://www.guru99.com/data-lake-vs-data-warehouse.html)

You store the data in Google Cloud's Big Query, Azure SQL Database or AWS Redshift Data Warehouse. This is ETL. Congrats! You now know what ETL is, if you always wanted to know or if you want to teach someone else. 

So there are some additional features around ETL, that you hear about such as Apache Airflow, Luigi, AWS Glue, Apache Spark. These are all tools that are either apart of the ETL process or makes the ETL pipelines more efficent at doing their job. 

For example, Apache Airflow is used for scheduling or creating cron jobs to say something like "update this table of users in this particular database everyday at 6am pacific time". There is a lot more in data engineering but this is the bare bones on data engineering to get you started. 

I hope this tutorial was informational and it gave a general idea of what data engineering is. Stay tuned to my next data engineering article where I am going to teach you how to write your own ETL pipeline in python.
Sending email using flowable workflow engine
Tags: java, spring, flowable, workflow
Published: 2020-11-27 18:01:43

Integrating Email task in Flowable. If doing from flowable-UI follow this.

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

Once you are done with the filing To, From, Html/HtmlVar, etc,. Configure the email server configuration in your spring application.

```properties
# email config
flowable.mail.server.host=smtp.google.com
flowable.mail.server.port=587
flowable.mail.server.username=arjun
flowable.mail.server.password=arjun
flowable.mail.server.use-tls=true
```

In case you want to add the email task manually paste this node to your workflow bpmn file.

```xml
<serviceTask id="RejectionEmail" name="Rejection Email" flowable:type="mail">
      <extensionElements>
        <flowable:field name="to">
          <flowable:string><![CDATA[arjun@bitmonkey.in]]></flowable:string>
        </flowable:field>
        <flowable:field name="subject">
          <flowable:string><![CDATA[Rejection]]></flowable:string>
        </flowable:field>
        <flowable:field name="html">
          <flowable:string><![CDATA[<a href="http://bitsmonkey.in">Rejection reason</a>
<input type="textarea">Dummy Message</input>]]></flowable:string>
        </flowable:field>
      </extensionElements>
    </serviceTask>
```

Code On!

Originally posted on [Bitsmonkey](http://bitsmonkey.in/blog/2020/11/27/flowable-email-setup)
Arrow Functions
Tags: javascript, coding, es6, developer
Published: 2020-11-27 17:47:46

Arrow functions were added in javascript as a part of the ES6 javascript revision. Arrow functions are also called 'Fat Arrow' functions. The arrow function syntax is used to write concise code.

Usually while writing a function in javascript, we prefix it with the _function_ keyword. The traditional method of writing functions is kind of messy. Fat arrow syntax helps to write compact and clean code. 

It is called a fat arrow because of the syntax `=>`.

Let's discuss the usage of arrow functions with the help of a few examples below.

In general, a function to add two numbers and return the result is written as follows,

```
function addition (num1, num2) {
return num1 + num2;
}
```
We can simplify the above code and make it look cleaner with the help of a fat arrow.

``` 
const addition = (num1, num2) => {
return num1 + num2;
}
```
Here, addition is a constant function that takes two parameters and returns a result.

While using arrow functions, if the function has only a single return statement then we can completely eliminate curly braces and a return keyword.

``` 
const addition = (num1, num2) => num1 + num2;
```
Our code looks cleaner as compared to traditional functions.
We can remove curly braces and a return keyword only if there is a single return statement.

Similarly, if a function takes only one input parameter then it is completely ok to remove surrounding parentheses. Let's see it in action below.

``` 
const multiply = num => num * 2;
```
The above function takes only a single input parameter *num* and returns the result.

Arrow functions are called similarly to traditional functions.

```
console.log(multiply(2));
```
In conclusion, an arrow function provides an alternative way to write shorter and cleaner code.
Deploying Strapi using Digital Ocean's App Platform and Managed DB
Published: 2020-11-27 14:23:19

---
title: Deploying Strapi using Digital Ocean's App Platform and Managed DB
published: true
description:  Deploying Strapi using Digital Ocean's App Platform  
tags: 
//cover_image: https://direct_url_to_image.jpg
---

In this article, I'm going to share how I deployed one of my  apps using Digital Ocean. This should take you around 15-20 minutes.

# Updating your code for different environments
Most of the time, I only have 3 environments in my application; development, staging and production.
To create these configurations, you need to create these folders:
config > env > {configName }

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/bbzkzthtfcycs5lmwr6a.png)
Take note of your environment variables, we're going to need them later in App Platform.


You can learn more from the official [doc](https://strapi.io/documentation/v3.x/concepts/configurations.html#environments)

# Setting up Managed DB

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6xkyxn3eem78qrsi9a4s.png)
Make sure to choose MySQL. For some reasons, I was not able to connect using Postgres.

For other options, just pick according to your needs.

After provisioning is done, create a new user which you are going to use later to connect to your app.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/53ojx06lsw5curkab7hv.png)
For Password Encryption, use the **Legacy – MySQL 5.x**. I'm not a DB expert and it took me a lot of time to figure out this one.

Take note of the connection details found here
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/5ff3u74tibj7z4hyrk9m.png)
You will need them later when setting up the environment variables.

DB part is done and now we go to the App Platform

# Setting up App Platform
App platform will prompt you to choose your git repo and branch to deploy from.

After clicking Next, you will be prompted similar to this screenshot

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/z8cit8m3fewz8mt0px6y.png)
The important part here is the **Environment Variables**. You can set them now or just do it later. For Build/Run Command, you don't need to change it since the scripts in your package.json already had the same names and working accordingly.

Set the values of your Environment variables now if you haven't because the build will fail without them.
You can go to the Components tab > Environment variables

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/zmg1qf8362lieoheu7m1.png)
You can freely choose your own variable names and don't need to necessarily copy mine. After clicking save, App Platform will rebuild your app.

If the build finish successfully, you will see a link in your dashboard like this

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

Feedback is welcome. If you have a better way of doing things, please comment it down below.

If you reached this section, please consider using my affiliate link when creating a new account :D
You will get $100 in credit over 60 days
https://m.do.co/c/5c95573fc1d2
What is considered practical in terms of applictions?
Tags: question, beginners, python, discuss
Published: 2020-11-27 17:38:05

Hi! I started learning Python about 6 months ago, and yesterday made my first graphic application, [Hazy](https://github.com/onyxcode/hazy). I was very happy that upon sharing the project on Reddit, it recieved 4 stars including one from [PySimpleGUI](https://github.com/pysimplegui) themselves!

I am very curious and would like to know your opinion on what is considered "practical" for an application, and the reason behind it. I would love to build your ideas into apps!

Let me know in the comments!


**[Cover image](https://unsplash.com/photos/ieic5Tq8YMk) by [Chris Ried](https://unsplash.com/@cdr6934) on [Unsplash](https://unsplash.com).**
JDBC in simple
Tags: java, jdbc, 100daysofcode, database
Published: 2020-11-27 17:31:27

In this article, I will straightforwardly explain JDBC. Let's get into the topic directly. First, I will get a simple terminology to explain JDBC. 

Imagine we are living in a city called **City A**. We are low on water. **City B** has a well that is full of water. But our language (City A language) and their language (City B language) are different. So, first of all, we are going to need a language translator. Then we need a road to go to City B. Then we need a vehicle to go to City B. When we send our vehicle to City B, there should be a tank on the vehicle to bring water to City A. 

This terminology explains nothing but JDBC application architecture. Imagine there are a Database and a Java application. We need to get data from the database to our Java application. According to the above terminology, our Java application is nothing but the **City A**, low on water. The database is nothing but the **City B**, which is rich in water.

Now we need some application that can convert our Java call into a Database understandable call. In the above terminology, this tool is nothing but the language translator. In JDBC terminology, it is the **Driver**.

When we get the connection, we need a vehicle to send our database request to the Java application database. This vehicle is nothing but **Statement Object**.

When we send our vehicle to City B, there should be a tank to fill water. In JDBC terminology, this tank is nothing but **Result Set**. When the vehicle brings back the tank with water from City B, we can carefully unload the water tank from the vehicle. When the statement object brings back the data we want in the result set, we can fetch that data from the Java application.

Now let's try to summarize this.

### Components of the JDBC

1. Driver - Translate Java calls into Database calls
2. Connection - Create the connection between the java application and the Database
3. Statement Object - Transport our database query to the database
4. Result Set - Contains the data received from the database

Using these components, we can create a simple JDBC application. These are the basics steps to follow to create a JDBC application.

### Steps to create a JDBC application

1. Load and register the driver
2. Establish the connection to the database
3. Create the statement object
4. Send and execute the query
5. Receive and process data
6. Close the connection

By following the above steps, we can develop a simple JDBC application.


**Resources**
- https://www.udemy.com/course/complete-jdbc-programming-part-1/