teleren/devto huggingface dataset:
SQL: Union Operator
Tags: sql, postgres, programming
Published: 2019-12-02 13:53:47

---
title: SQL: Union Operator
published: true
description: 
tags: #sql #postgres #programming 
---
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/f5gtqs5djuae1i2ou2p4.png)
In our previous SQL posts we learned how to combine tables using the Join clause to produce results based on common columns among these tables. In this post, we will be talking about the **UNION** operator, which in simple words is used to combine the results of different ``SELECT`` statements into one results set. The following image shows it's basic syntax:

![Union operator basic syntax](https://thepracticaldev.s3.amazonaws.com/i/habsyyxqtw45la908q7w.png)

The **UNION** operator comes with some requirements that must be met in order to be able to implement it:

* All ``SELECT`` statements or queries must have the same number of columns.
* Said columns must appear in the same order in all queries.
* These columns' data types must be the same or compatible.

Let's consider the following tables to study this operator:

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

Now, let's use it to combine these tables into one:

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

The results **might** look like this:

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

Notice we mentioned that the results **might** look like the previous image, and that's because we presented these results sorted by **bill**, but without an ORDER BY clause, the order of these results could vary.

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

When we use the **UNION** clause, all duplicate records are removed. If we want to keep these records, we should use the **UNION ALL** statement, which includes them in the final results set.

Had we used **UNION ALL** in our previous example, the columns **mortgage** and **cellphones** would have appeared twice in the results set.

Learn about SQL Inner Join, [here](https://dev.to/wendisha/sql-inner-join-4eb2).
Learn about SQL Outer Joins, [here](https://dev.to/wendisha/sql-outer-joins-2cj7).
Hidden messages from Advent Of Code challenge
Tags: adventofcode, swift, adventofcode2019
Published: 2019-12-02 11:00:18

Incase if you don't know [Advent Of Code](https://adventofcode.com) is a small programming puzzles which can be solved in any programming language of your choice. It runs throughout the December and each day the complexity will increase.

This year the over all theme was about Santa on some other planet and how we help him to reach earth on time for Christmas. I started little late on Day 2 and tried to catch up all 4 puzzles.

Interesting thing I found today is one of the puzzle input was to figure out the input values to get output as `19690720`.

If you look closely to the value it's actually a Date - `1960/07/20`. Which is the exact date of Apollo Moon landing. 🤯 Also lots of keywords and things used on Apollo Guidance computer like Noun and Verb. Never expected hidden messages from the puzzle. Good Job for the Apollo nostalgia [Eric Wastl](https://twitter.com/ericwastl)

P.S: If you are following the advent calendar and wanted to check my solution in swift, you can check at this [repo](https://github.com/rizwankce/AdventOfCode) on Github. I will try to push it to GitHub whenever I found a solution.
VS Code shell variables and git
Tags: vscode, git, commandline
Published: 2019-12-02 13:33:16

---
title: VS Code shell variables and git
published: true
description: This is how I setup my environment variables to use Visual Studio Code from the command line.
tags: vscode,git,command-line
---

I use zshell so in order to persist my choice I edit `~/.zprofile`:

```shell
export EDITOR="code --new-window"
```

When commiting from the command line (`git commit`) we have to make the editor *wait* for us to finish the commit message and therefore we need to instruct git use the `--wait` option too:

```
$ git config --global core.editor "code --wait --new-window"
```

This way the commit message will be taken by git right after we issue a save command.

🎩
Get the list of all files with specific extension in C#
Tags: csharp, fileinfo, directryinfo, dotnet
Published: 2019-12-02 13:11:24

One might have come across a situation to fetch all the files under a given directory and do something with those files. In this article, we will look at how it can be done with a single line of code in C#. Later, I'm going to mention how did I stumble upon such a use case.

We will be using `GetFiles` static method available on [Directory](https://docs.microsoft.com/en-us/dotnet/api/system.io.directory.getfiles?redirectedfrom=MSDN&view=netframework-4.8#System_IO_Directory_GetFiles_System_String_System_String_) class under System.IO namespace. This method has three overloads. We will use the one that takes three arguments.
* A string that takes an absolute or relative path to the directory
* A string that takes a search pattern to match the files against 
* A search option  to search recursively or only the current directory

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

My use case is to search for all the images with a .bmp extension under the specified directory and convert them to jpeg images.
So, the line of code I would use is
```c#
Directory.GetFiles(@"C:\mydir", "*.bmp", SearchOption.AllDirectories);
```
Here, `SearchOption` is an enum that contains two fields. `AllDirectories` and `TopDirectoryOnly`. I guess it's self-explanatory how to use those fields.
Make sure when you are using `AllDirectories`, the directory structure do not form a loop.

That's it!! I hope this article has augmented that knowledge bundle of yours.

Thank you!! Happy to receive feedback and answer any questions !!
Scale Securely with Transit Gateway
Tags: security, aws, technology, networking
Published: 2019-12-03 16:19:01

---
title: Scale Securely with Transit Gateway
published: true
date: 2019-12-02 13:01:01 UTC
tags: security,aws,technology,networking
canonical_url: 
---

[![](https://cdn-images-1.medium.com/max/1000/0*U_jZ17j5eqDjGwsh)](https://medium.com/swlh/scale-securely-with-transit-gateway-198f600547e8?source=rss-784649f47696------2)

AWS Transit Gateway provides secure and scalable cloud connectivity to on-premise networks

[Continue reading on The Startup »](https://medium.com/swlh/scale-securely-with-transit-gateway-198f600547e8?source=rss-784649f47696------2)
What's New at The Book of Secret Knowledge
Tags: github, rss
Published: 2019-12-02 12:57:37

Do you follow [The Book of Secret Knowledge](https://github.com/trimstray/the-book-of-secret-knowledge) on Github? 

Here's a [full-content RSS feed](https://botonomi.github.io/BoSK-Watch/feed.xml) of recent changes.
Running expo and raw React-Native together
Tags: reactnative
Published: 2019-12-02 12:57:09

Hello world! Glad you asked this question, about ejecting your expo app. Well, you might have been asked by your senior developer, or boss or you might have just heard it from someone but don’t exactly have a good acquaintance with it. In this article we’ll try to answer these questions, all of you might be dead curious to know this in the simplest way –

Why do we need to eject an expo app, although it gives us a tonne of features?
Can we use some modules which have native code with expo like pusher, react-native-modal, etc?

<b>how to make expo and react native work together?</b>
Let’s add a secret ingredient called expo-starter-kit to make all of this happen with a breeze.


<b>Overview</b>

Expo-starter-kit is a powerful, minimal configuration scaffolding tool, which provides a basic configuration for ejected apps built with expo, saving the developers from the hassle of manually ejecting apps. expo-starter-kit exposes an easy-to-use scripts’ list for handling builds, running an app in ejected as well as in unejected mode.


<b>Features</b>

Some of the features which make this module a boon for developers is-

Minimal configuration
Blazing fast development
Rich script structure to run the app in ejected or unejected mode, with the help of just one command
Do whatever you want in the Xcode and Android Studio projects
Support for third-party native modules for React Native, non-Expo-specific instructions such as react-native link
distribute your app as an ipa or apk without pain

<b>Why should I eject my expo app?</b>

And the answer is pretty simple. “Ejecting” is the process of setting up your own custom builds for your CRNA app. It can be necessary to do if you have needs that aren’t covered by CRNA or expo. Apps built with React-native are written in javascript, offering a bridge between writing old school platform-specific apps using kotlin, swift, etc. And this is the specialty offered by react-native, which makes it blazing fast and powerful to use.

However, there are some cases where advanced developers need native capabilities outside of what Expo offers out-of-the-box. The most common situation is when a project requires a specific Native Module which is not supported by React Native Core or the Expo SDK.

for more details about <a href="https://codersera.com/blog/running-expo-react-native-together/">Running expo and raw react-native together</a>
Deploying your app with Bitrise
Tags: android, ci, automation, deploy
Published: 2019-11-30 15:56:20

---
title: Deploying your app with Bitrise
published: true
description: Issues you'd run into when trying to deploy Android apps from Bitrise to the play store
tags: Android, CI, automation, deploy 
---

I had a pretty hard time deploying an app via bitrise to the play store and I ran into several errors because I had a few wrong assumptions and some things in the docs were unclear.
So I'll walk through what surprised me.

The first and greatest surprise, was that by default, bitrise doesn't do the steps you need before you can even begin to deploy such as....making a build!

So first we'll need to add some steps to the workflow.

Steps you'll need to add to the workflow:
1. Android Build!
Yes, bitrise doesn't actually do a release build on its own. It'll just do the test build!

2. Android Sign
Since it doesn't do a build, and it doesn't have your keys or info, there's no way it can sign right!
That's the next step, where you upload your keystore and give it the passwords.

3. Deploy to Google Play
This means you'll have to a lot, creating a worker, giving it access and getting a key in json form. This can be done via following the link [here](https://blog.bitrise.io/how-to-deploy-android-app-to-google-play-store)
The mistake I made, was putting the json directly into a secret variable. Which gets you a very confusing error.
What you need to do is go to [code signing](https://app.bitrise.io/app/56ba40fd5c2ff870/workflow_editor#!/code_signing) and add your JSON key to a generic file storage.
There you specify an environment variable for it and give it the entire json file.

3. Specify an aab build. This makes the app smaller for each person who downloads it since files that aren't supported on their phone (such as language files or binary blobs specific to architectures) aren't downloaded.

4. Remember to update the version code for sure otherwise it'll just be rejected saying that the version was the same as another build.

That's it, you should now be able to deploy directly to the play store. It could help if you always deploy to alpha or beta and if you're feeling brave, even production.
I wouldn't do a production deploy unless you had UI tests that ran on either the Firebase Test Lab or an emulator at least.
It's too easy to just instantly crash all your users even with flawless unit testing.
PHP 7.4 (Changes & Performance)
Tags: php74, changes, performances, php8
Published: 2019-12-02 12:46:21

---
title: PHP 7.4 (Changes & Performance)
published: true
description: Last chapter of the series about PHP 7.4, in this one you will see changes in PDO, Composer, Benchmark plus JIT and more
tags: php 7.4, changes, performances, php 8
cover_image: https://anastasionico.uk/img/blog/php-7-4-changes-and-performance.jpg
---
Want to know who my biggest competitor is?

No, it isn’t the young boy just graduate and full of motivation, It isn't the Python community with its machine learning features.

It's me. Well, kind of.

A part of me would love to be always up to date, learning the new trends as soon as they are released or spend more time studying what is going on in the industry.

The other part loves popcorn and watches Stranger Things on Netflix.


The reality is that it is very easy to bourn-out and motivational videos work only until a certain point.
The rest is up to me,
Chances are, if you are not making the progress you’d like, you might also find yourself in the same position.


The good news is that you do not have to spend all your free time reading books, buying expensive courses or even reading blog posts.
You can do it only when it is actually needed.

How you find out when learning is needed?
From time to time certain moments occur, some breakthroughs, a new technology comes up or a new version of a programming language is released.

Successful people follow the Pareto principle,

It says that 20% of our effort will cause 80% of our results.

I find deeper meaning by focusing on what is important. 
What I value most. What keeps me fired up and makes all current obstacles seem insignificant.

The series I have published in the last couple of weeks, and that ends with this episode was about this concept.

PHP 7.4 did not bring any major changes or disrupting features but learning it is a mandatory step to understand in which direction this programming language is moving.

In this article, you will discover what the changes are, how the benchmarks of PHP 7.4 compare to other versions and we'll have a look at what to expect from PHP 8.

[Read the full article here](https://anastasionico.uk/blog/php-7-4-changes-and-performance)
India's opportunity to become THE global leader.
Published: 2021-04-13 09:42:39

---
title: India's opportunity to become THE global leader.
published: true
date: 2019-12-02 12:45:11 UTC
tags: 
canonical_url: 
---

We have the largest workforce in the world - close to 500 million strong - more than the population of every major country except China. This kind of opportunity doesn't come along often and we are squandering it. People don't stay young forever. We have maybe 25 years to capitalize on this and I know if we do we'll shoot straight to the top. I'm not suggesting it's an easy job but I truly believe we are capable enough to lift ourselves to the top.

In my opinion there are two factors that disproportionately affect our ability to generate value.

First, our people are not skilled enough, thanks to archaic and utterly pointless educational curricula. Bad education is the root cause of our suffering. Just ask the millions of jobless engineers. We're spending a paltry 3-4% of our GDP on education in comparison to the 6-8% of other developing nations. I strongly believe that solving the education problem will solve most other issues.

Second, policy changes and passing of bills take way too long. That's a result of the democratic process and I respect that, but again, people don't stay young forever. There are a lot of policies and rules that need an overhaul and the sooner we change them, the faster we can grow.

[More Info](https://www.moneycontrol.com/news/business/economy/5-trillion-economy-distant-dream-india-slips-to-7th-spot-in-global-gdp-ranking-4281691.html)
Exibindo erros do PHP no navegador
Tags: php, errors, ptbr
Published: 2019-12-02 12:13:43

---
title: Exibindo erros do PHP no navegador
published: true
description: Para quem não tem acesso diretamente ao servidor, algo de grande ajuda muito é a exibição do erros gerados pelo PHP diretamente no navegador.

tags: php, errors, pt-br
---
Para quem não tem acesso diretamente ao servidor, algo de grande ajuda muito é a exibição do erros gerados pelo Apache diretamente no navegador.

Temos uma lista com 3 funções que nos ajudam nessas exibições:

* [*display_errors*](https://www.php.net/manual/pt_BR/errorfunc.configuration.php#ini.display-errors): onde este faz a exibição dos erros de script diretamente na tela
* [*display_startup_errors*](https://www.php.net/manual/pt_BR/errorfunc.configuration.php#ini.display-startup-errors) que são os erros ocorridos na inicialização do PHP
* [*error_reporting*](https://www.php.net/manual/pt_BR/errorfunc.configuration.php#ini.error-reporting) onde este define que tipo de erro será exibido

Para definição dos tipos de erros que desejamos acompanhar, temos os seguintes tipos:

* **E_ALL** - Todos os erros e alertas
* **E_ERROR** - Erros fatais
* **E_WARNING** - Erros não fatais
* **E_PARSE** - Erros de compilação (antes da execução do código)
* **E_DEPRECATED** — Avisos de coisas obsoletas, que serão retiradas no futuro
* **E_NOTICE** - Avisos que podem ou não ser bugs
* **E_STRICT** - Dá recomendações de melhor interoperabilidade, desde o PHP 5.

Podemos usar 1 ou mais tipos, devemos utilizar o | (pipe) como separador.

E_ERROR | E_PARSE | E_NOTIVE

Abaixo, segue exemplo da utilização das funções para exibição dos erros.

Em seu arquivo principal, adicione as seguintes linhas de código:

```
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
```

É isso ai pessoal!!
Why do we feel worse when working less than overworking?
Published: 2019-12-02 11:43:06


> This is my third post ever, sorry if it's not that well structured or written!

**First of, a bit about me:**
I've been programing for 5 years, and working in the industry for around 4. 
This is important as the issue explained below has come into play recently, when the expectations people have on me is greater.


**The issue:**
We (my company) are in a position at the moment where workload is minimal, maybe enough for 4-6 hours of work a day although we should be working full time.

I've been feeling really weird recently, as if I don't meet my boss standards or I don't do as much work as he might like to, although he has never said anything about it, nor has he ever required us to do 8h a day.

This is kinda weird, because I do more work than the majority of employees and even my boss, but I feel bad when I don't manage to fill in all those hours. It feels really unproductive and a waste of time to be sat there looking at a screen.


Weird thing is, it's not the case when I overwork for some reason, then I don't feel bad at all. 

> When talking to some friends about this, I've found out It's more common than I expected it to be, not only for technology related work. 


I know about **Impostor Syndrome**, but this does not seem to fit into that category. 

To finish, I would like to ask you guys some questions:
* [1] Have you suffered this at any point?
* [2] What you think is the reason for this?
* [3] What do you do to overcome this?
Software Training Institute in Chennai

Tags: python, java, php, javascript
Published: 2019-12-02 11:42:16

SLA Institute’s training sessions offer students excellent learning experience. We don’t stop with just technical skills training but also impart life skills training to the candidate. We are the Best Software Training Institute in Chennai because we empower the students with technical knowledge, career-oriented skills, and better career concepts. This will eventually help the students in gaining the best from the ever-changing world of technology.
Stan's Links #2
Published: 2019-12-02 11:39:00

https://help.github.com/en/github/importing-your-projects-to-github/adding-an-existing-project-to-github-using-the-command-line

https://support.apple.com/en-us/HT201361

https://www.npmjs.com/package/react-images-upload

https://www.competa.com/blog/storing-javascript-object-localstorage/

https://www.youtube.com/watch?v=bebuiaSKtU4
Advent of Code (AoC) - Day 1
Published: 2019-12-02 11:36:56

---
title: Advent of Code (AoC) - Day 1
published: true
description: That was a struggle for a Monday morning!
tags: 
---

I thought I'd document my journey through AoC 2019.  As I've been concentrating on learning React recently, I feel like some other basic concepts might be starting to fade from my memory banks!

[Part one](https://adventofcode.com/2019/day/1) was very straight forward.

Read in the input numbers from the text file and stuff them into the calculation given to you: -

```javascript
const readline = require('readline');
const fs = require('fs');

// set up the file for reading line-by-line
const readInterface = readline.createInterface({
    input: fs.createReadStream('./AoC1-input.txt')
});

// calculate fuel required given a mass
const getFuelRequirement = (mass) => {
    return fuel = Math.floor((mass / 3) - 2)
}

// calculate the total fuel requirement
// for all the masses listed in the file
const getTotalFuelRequirement = () => {
    let totalFuel = 0; 
    // on each new line, add the calculated requirement to
    // the totalFuel
    readInterface.on('line', (line) => {
        totalFuel += getFuelRequirement(line)
    });

    // at the end console log the total
    readInterface.on('close', () => {
        console.log(totalFuel)
    })
}

getTotalFuelRequirement()

```

Then, the spanner in the works for me came on part two.  I think it was hinting at solving the problem with a recursive function.  I was scrambling trying to get my brain into that mode of using recursion.  I almost gave up, reverting to a solution without the recursive bit, but the reason I am doing this is to try to help me remember some concepts I'd let slip.  So I persevered and came up with a solution: -

```javascript
const readline = require('readline');
const fs = require('fs');

// set up the file for reading line-by-line
const readInterface = readline.createInterface({
    input: fs.createReadStream('./AoC1-input.txt'),
});

// calculate fuel required given a mass
const getFuelRequirement = (mass) => {
    
    let fuel = Math.floor((mass / 3) - 2)

    // base case -- fuel required is negative or zero
    if(fuel <= 0){
        return 0;
    }
    // recursive bit - fuel for the initial mass, plus the
    // fuel required for the fuel until it is zero
    return fuel + getFuelRequirement(fuel);

}

const getTotalFuelRequirement = () => {
    let totalFuel = 0; 
    readInterface.on('line', (line) => {
        totalFuel += getFuelRequirement(line)
    });
    readInterface.on('close', () => {
        console.log(totalFuel)
    })
}

getTotalFuelRequirement()
```
Using Azure Storage with PowerShell
Tags: azure, powershell, devops
Published: 2019-12-02 11:24:57

### Create a Resource Group

```
New-AzResourceGroup -Name storagePractice -Location eastus
```

### Create a Storage Account

```
New-AzStorageAccount -Name storageaccountpractice -ResourceGroupName storagePractice -Location eastus -SkuName Standard_LRS
```

### Get Storage Account Key Value

```
$key = (Get-AzStorageAccountKey -ResourceGroupName storagepractice -Name storageaccountpractice)[0].value
```

### Create New Storage Content

```
$context = New-AzStorageContext -StorageAccountName storageaccountpractice -StorageAccountKey $key
```

### Create a Storage Blob Container

```
New-AzStorageContainer -Name images -Context $context -Permission Blob
```

### Upload Image to Azure Storage Blob Container

```
Set-AzStorageBlobContent -File ./books.png -Container images -Blob 'books.png' -Context $context
```

### List Contents of an Azure Blob Storage Container

```
Get-AzStorageBlob -Container images -Context $context
```

### Download Contents of Azure Blob Storage Container

```
Get-AzStorageBlobContent -Blob "books.png" `   
-Container images `        
-Destination "books2.png" `               
-Context $context
```

### Remove Azure Resource Group ( Cleanup )

```
Remove-AzResourceGroup -Name storagePractice -Force
```

### Sources

[Quickstart: Upload, download, and list blobs by using Azure PowerShell](https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-powershell)