teleren/devto huggingface dataset:
Demystifying Git Submodules
Tags: git
Published: 2020-09-14 01:23:09

## If you are working with Git submodules for the first time they may catch you off guard with their behavior.

Where are the submodules files after cloning? Why do they show changes when I ask git for status? Let's dig into the docs and figure out how to get started working with Git Submodules. 

First, what are these submodules and why would I use them?

>It often happens that while working on one project, you need >to use another project from within it. Perhaps it’s a library >that a third party developed or that you’re developing >separately and using in multiple parent projects. A common >issue arises in these scenarios: you want to be able to treat >the two projects as separate yet still be able to use one >from within the other.

The two tricky things you can encounter when you are first working with submodules are: initializing the submodule and pulling upstream changes.

When you first pull down a git repository containing submodules you will not actually get the submodule files with the clone. Kinda weird right? To get the files you can run 
```
git submodule update --init
```

The "--init" command will populate the submodules with their respective git commit's. 

The next hang up you might run into is when you pull down a branch an upon running "git status" you see that the submodules are modified with the message "(new commits)". This means your local branch does not contain the changes from upstream. To pull these run:

```
git submodule update
```

That should be enough to get you started working with Git submodules. For more information visit the [Git Man page](https://git-scm.com/book/en/v2/Git-Tools-Submodules)
Github Codespaces Java Test Tools
Tags: github
Published: 2020-09-14 01:01:27

For a client scenario I am building a custom Github Java Codespace.  This client uses unit testing frequently.  To that end I wanted to get JUnit up and running in the simplest possible way in my custom Codespace.

To do this I downloaded and then uploaded the two required JAR files (junit and hamcrest) to my `jars` directory in my Repo.  Then I manually added each JAR file to the `.classpath` file.

I installed the following extensions.
- Java Extension Pack
- Debugger for Java
- Java Test Runner

Then I tried a sample test.  I also tested the Java debugger (shown below).

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

My sample test was designed to fail in order to test the testing functionality.  It worked as expected (shown below).

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/y38saqf2qvepsbngabhd.png)
Covid ER Diagram and Aura's Security Flaws
Tags: datascience, ethics, security
Published: 2020-09-14 00:47:35

# Hello everyone,

# Universities have been placed in a tough position due to the dangers of Covid-19. While every college student across the globe can agree that in-person learning is more beneficial for our education, the logistics of in-person learning can endanger the entire student body. Safety aside, universities are still run as businesses and remote learning makes the school less appealing for incoming students. Stacked with the loss of profits from campus housing, the balancing of loss of profits with student safety becomes a difficult choice. 

# The specific case of Albion College in Michigan provides a great example of what colleges shouldn't do in this situation. The rushed roll out of their unsecured but still mandatory tracing app is an ethical problem that needs more attention. Forcing students to install an app that tracks them through GPS constantly and preventing them from leaving the campus is unnecessarily strict and the benefits of the system are grossly outweighed by its flaws. If the same policy was enacted here at Penn State, I would choose to return home rather that allowing my location data to be collected 24/7 without even telling me who has access to that information. While public safety is very important, so is privacy and Albion's program absolutely destroys their students' privacy without enough benefit to public health


{% youtube K4DNbPIzDek%}
What gets logged in console.log() for objects and arrays?
Tags: javascript, webdev
Published: 2020-09-14 00:17:19

Have you ever used `console.log(myObject)` and were confused by the result you got after expanding what was printed to the console?

For example:

```jsx
    const myObject = {
      firstName: "Elad",
      lastName: "Tzemach",
      favoriteFood: "cake"
    };
  
    console.log(myObject);

    // lots of other code
  
    myObject.favoriteFood = "broccoli";
```

Will give give us this in the console:

![Screen Shot 2020-09-13 at 7.36.39 PM](https://dev-to-uploads.s3.amazonaws.com/i/v0i90vrqa1vyuoyi6o8v.png)
 
Yay! :heart_eyes: I love cake! :cake: :cake: :cake:

Let's expand this:

![Screen Shot 2020-09-13 at 7.39.30 PM](https://dev-to-uploads.s3.amazonaws.com/i/ftp5wged1gsshfu00w1l.png)

What?? :flushed: `"broccoli"`?? What happened??  

See that little blue icon "i" icon?

![Screen Shot 2020-09-13 at 7.42.39 PM](https://dev-to-uploads.s3.amazonaws.com/i/pt5t6s79a33awq7y41ae.png)
 
If you hover over it, you will see a tool tip saying "Value below was evaluated just now."

## Evaluating with console.log()

Evaluating objects (or arrays) using `console.log()` is done in an asynchronous manner: the reference to the object itself is passed to `console` synchronously, and that is why we initially see the object with `favoriteFood: "cake"` before we expand it - because that is what the object "looked like" at the time we logged it to the console.

However, if the object had been later modified and then we expanded it in the console, it would be evaluated to what it is equal to **now** (after the app code had finished running), so the data shown will have the updated values.

## What can be done?

To avoid any confusion, one approach is to use:

```jsx
console.log("users", JSON.stringify(users, null, 2));
```

Then we would just get the object at the time we called `console.log()`, expanded by default: (although we won't be able to collapse it)

![Screen Shot 2020-09-13 at 8.05.23 PM](https://dev-to-uploads.s3.amazonaws.com/i/fghcsfmaf904oz8qivel.png)

Another one is to simply deep clone the object and only then log it: 

```jsx
console.log({...myObject});
```

(Easily done by the spread operator if you don't have nested objects. If you do, you would have to use third-party libraries like `Lodash` or `ImmutableJS`)

## Conclusion

Understanding how `console.log()` works with objects and arrays could definitely save you some frustration!

And if you have made it till the end, i have a confession to make: i like broccoli too :smile:

Happy coding!! :rocket:
OpenAPI Review Action
Tags: actionshackathon
Published: 2020-09-14 00:02:08

### My Workflow
[Note]: # (Make sure to include the name of your GitHub Action and share where it's being used!)

```yaml
on: [pull_request]

jobs:
  review_openapi_specs:
    runs-on: ubuntu-latest
    name: Review all OpenAPI specs
    steps:
      - name: Checkout
        uses: actions/checkout@v1
      - name: Review OpenAPI specs
        uses: blake-mealey/openapi-review-action@v1
        with:
          spec-paths: ./fixtures/*.@(json|yaml|yml)
          github-token: ${{ secrets.GITHUB_TOKEN }}
```

### Submission Category: 

Maintainer Must-Haves

### Yaml File or Link to Code

{% github blake-mealey/openapi-review-action %}

### Additional Resources / Info

Screenshots:

![OpenAPI Review Comment](https://dev-to-uploads.s3.amazonaws.com/i/wyue4su5tjx4ensc5xxp.png)

Example PR:

https://github.com/blake-mealey/openapi-review-action/pull/22
How to create a read stream in Node.js?
Tags: node
Published: 2020-09-14 00:00:00

---
  title: How to create a read stream in Node.js?
  published: true
  tags: Nodejs
  date: Mon Sep 14 2020 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/create-read-stream-nodejs
  cover_image: https://melvingeorge.me/_next/static/images/main-9b52948c4d9bc1b8551e3a9ccbd998cd.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/create-read-stream-nodejs)
  
## Why do we need streams in Node.js?

Streams are not limited to Node.js runtime, it is a method to transfer data continuously from one point to another in computer science. Large data cannot be loaded into a computer's primary memory at a time as it may be filled with only that data and thus streams were introduced to divide the large data into chunks. To simply put, Youtube videos are streams of small chunks of data coming from Youtube servers.

## How to create a read stream in Node.js?

To create a read stream in Node.js, you need to first import or require the native filesystem module. In Node.js filesystem module is named as `fs`.

```javascript
// import filesystem module
const fs = require("fs");
```

Now we need to make use of a method called `createReadStream()` on the `fs` object.

- The method requires a valid path to a file to read from as a string type.
- The method returns a `ReadableStream` Object.

```javascript
// import filesystem module
const fs = require("fs");

// create a read stream
// consider I have a file named hello.txt
// inside the hello.txt, I have a text of "Hello World".
const rs = fs.createReadStream("hello.txt");
```

Now to see the contents from the stream, you need to listen for the `data` event. Since it is a stream the data will be coming in small pieces called `chunks`.

We need to set the encoding to `UTF8` so that it is streamed in text format.

```javascript
// import filesystem module
const fs = require("fs");

// create a read stream
// consider i have a file named hello.txt
// inside the hello.txt, i have text of "Hello World".
const rs = fs.createReadStream("hello.txt");

// set encoding
rs.setEncoding("UTF8");

// display the stream
rs.on("data", (data) => {
  console.log(data);
});
```

Now if you Observe in the prompt you could see the contents inside the `hello.txt` file.

See this snippet live in [repl.it](https://repl.it/repls/UnrulyWretchedBackground#index.js).

### Feel free to share if you found this useful 😃.

---
💭Faith and 💻Computer Science
Tags: career, discuss
Published: 2020-09-13 23:40:42

👋 Hey guys! As a Computer Science major and a Christian, I'm wondering how your **personal beliefs** (whether you're religious, atheist, or agnostic) **directly affect your career**, and how they **are/aren't expressed** in what you do in your industry. 

Rephrases of what I'm asking:
* 💭 | 💻 Do you keep your personal beliefs separate from work? Is it appropriate for them to intersect?
* 💭 --> 💻 Does your faith fuel or inspire you to code? Is that even possible in this kind of industry?
* 💭 --> 💻, 👩‍🚒, 🤼 How do you express who you are when you program, choose your job or interact with teammates?
Update 1.4.0 is out
Tags: electron, twitch
Published: 2020-09-13 23:14:42

DisStreamChat 1.4.0 is out and I'm excited to share the longest changelog yet.

## Bug Fixes
 - fixed bug with search bar cursor moving to end
 - fixed bug with channel points being caught in subscription search
 - fixed bug with the sign-in page when "hide header on unfocus" is true
 - fixed bug with unread messages persisting across channels
 - fixed performance bug with saving messages in local storage

# Changes
 - improved chatters tab with better styles and basic user cards
 - improved reversed mode with a scroll to bottom button and better autoscrolling
 - improved autocomplete for emotes and mentions
 - added compact channels setting
 - added pin button to channel items
 - added setting to show a scroll bar when the app is focused
 - added streamer is live notifications
 - added support for message replies
 - added setting for transparent message backgrounds
 - added toast notifications for updates
 - added a setting to turn on and off storing messages in local storage
 - added setting to show automod messages or not
 - added follow button
 - added a "more tab" to the header with extra channel-specific settings and options
 - added support for automod messages (only for channels you moderate for)
 - added the ability to easily switch between channels by right-clicking on the home icon
 - added user card to messages by right-clicking on the username
 - added a setting to change font scaling
 - added emote picker for the chatbox
  
# Modifications
 - modified platform colors setting to affect the compact mode
 - modified search bar to hide on unfocus only if it is empty  
 - modified to allow you to add any streamer's channel
 - modified font change to affect the whole app
 - modified the update button from link to next update to auto-# installer
 - modified channels button to the home icon
 - modified mod and message options into a context menu on messages

Check it out 👇👇👇
https://www.disstreamchat.com 
https://www.github.com/disstreamchat
Fixing Emulator Lags
Published: 2020-09-13 08:55:32

It's been a long time since I have been writing my Tips and Tricks for gamers on Gamers Info Point. 
People are just starting to come to get their much-needed content from the blog. 
I am not that professional gamer and I am using my old laptop to write content and even play games sometimes. 
Games like <a href=”https://www.gamerspoint.info/category/pubg/pubg-mobile/”>PUBG Mobile</a> and <a href=”https://www.gamerspoint.info/category/free-fire/”>Free Fire</a> are kinda best to play using an emulator and I have a pretty much good idea on using <a href=”https://www.gamerspoint.info/best-gameloop-settings-guide/”>Best Gameloop settings</a> for Performance Increase.
In this post, I am going to mention some of my personal experiences in Fixing lags and setting up a better setting for the Gameloop emulator.
You can do these things tho
Increase your PC performance by changing some settings which are-
Optimize your C Drive.
Delete Cache Files.
Set up your PC at high performance.
Set your Power options at high.
Use <a href=”https://www.gamerspoint.info/best-gameloop-settings-guide/”>Best Game Boosters</a>
Delete Unnecessary Files from C drive along with the Recycle bin.
All these things are well explained on the given link. Please check if you are not that pro with the Windows Settings.
After you finish up all these things, you also have to set up your emulator or Gameloop with the best-needed settings for your PC. 
If you are using a good one then set it up to higher options or you can still use it on low options.
So, good luck with your optimizations. Please share and support my blog <a href=”https://www.gamerspoint.info/”>Gamers Point Info</a>
If you are a fan of Mobile Legends, then please check <a href=”https://www.gamerspoint.info/tips-to-fix-lag-in-mobile-legends-for-low-end-phones/”>Mobile Legends Lag Fix Guide</a>
Any tips on passing my AWS SysOps? I have 6 weeks to scheduled date.
Tags: aws, career, testing
Published: 2020-09-13 22:47:16

I have my AWS CCP, I passed it about two weeks ago. I took a little week break, deciding what test I wanted to do next either being SysOps or CSAA. I chose the SysOps and just wanting some tips on the difficulty and best/efficient way to study for it. I already have loads of Udemy practice test and am skimming through exam pros course.
AWS Marketplace - Machine Learning solutions
Published: 2020-09-13 22:06:41

 ML (Machine Learning) can be subject to political ambitions. You can tune library the way, it gives certain predefined results, based on developer's/company's political views.

When we are analyzing several solutions from [AWS Marketplace] (https://aws.amazon.com/marketplace) sections Machine Learning - Text we have figured out that some solutions are politically oriented.

Here is the test:
1. We use CNN webpage to pull [article](https://www.cnn.com/2020/09/12/politics/trump-west-coast-wildfires/index.html) - please, note link is valid as of 09/13/20
2. We used paragraph 3

*"Trump will visit McClellan Park, California, on Monday for a briefing with local and federal fire and emergency officials on the state's wildfires, the White House said Saturday. The President was already set to visit Reno, Nevada, on Saturday, where he is likely to see firsthand evidence of the devastating fires, as the National Weather Service in Reno issued a dense smoke advisory through Sunday"*

3. Tested Sentiments in 3 different solutions
- [Twinword API] (https://aws.amazon.com/marketplace/pp/B07FXSGDV5?qid=1600029756137&sr=0-8&ref_=brs_res_product_title)
- [AWS Comprehend](https://aws.amazon.com/comprehend/)
- [SigmoData Sentiment Analysis](https://aws.amazon.com/marketplace/ai/model-evaluation?productId=702afdb5-f282-4579-9f4d-d37728f74bf5)

4. Method used - Replace word _Trump_ with word _Biden_

5. The results:
 - Twinword API - same scores
 - AWS Comprehend - same score
 - SigmoData Sentiment Analysis came with surprise
     - With word _Trump_ it gives 38% of positive score
![Trump](https://web221source.s3-us-west-2.amazonaws.com/dev/devtoimages/Trump.PNG)
     - With word _Biden_ it gives 82% of positive score
![Biden](https://web221source.s3-us-west-2.amazonaws.com/dev/devtoimages/Biden.png)
Try it yourself 
https://aws.amazon.com/marketplace/ai/model-evaluation?productId=702afdb5-f282-4579-9f4d-d37728f74bf5

Summary: before using any ML model, make sure you test it on edge values.
Simple Template for typescript in Node
Tags: node, typescript
Published: 2020-09-13 22:04:00

I have found myself copying a lot of files every time I start a new project so I decided to make an easy to use template that you can download and start with little setup. The template has almost everything you could need, a .gitignore, .tsconfig.json, .prettierrc.js, .npmignore, node scripts for transpiling the typescript and testing. The repo for the template is https://github.com/GypsyDangerous/node-typescript-project-template and you can download it with `degit`, `npx degit GypsyDangerous/node-typescript-project-template`. I want to improve it by adding more files like an eslintrc so any contributions are greatly appreciated 😀
The Death of my GitHub Organizations... and my own rebirth as a DEV
Tags: github
Published: 2020-09-13 21:45:10

If an igloo is set on fire... does it melt, or rise again like a phoenix?

My two GitHub organization accounts are no more... but the number of personal repos I have is now almost 80 thanks to mass transfers. I therefore consider this a developer rebirth of sorts... onward to an even brighter future!

I intend to start blogging here a lot more than I have been, now that I know how easy it is to start!
Learning Guile - Booleans
Tags: learn, gnu, guile, scheme
Published: 2020-09-13 21:29:27

![Guile Logo](https://upload.wikimedia.org/wikipedia/commons/thumb/b/b3/GNU-Guile-logo.svg/220px-GNU-Guile-logo.svg.png)

The two boolean values are: "true" and "false". Respectively `#t` or `#true` and `#f` or `#false` in Guile.

In a conditional test context, "true" means any expression other than `#f` or `#false`.

Here is a small test suite that illustrates all this:

```scheme
(use-modules (srfi srfi-64))

(test-begin "test-suite")

(test-equal "Truth"
  #t
  #true)

(test-equal "Falsness"
  #f
  #false)

(test-equal "Numbers are true"
  #t
  (if 12547
      #t
      #f))

(test-equal "Strings are true"
  #t
  (if "I am not false"
      #t
      #f))

(test-equal "Lists - even empty - are true"
  #t
  (if '()
      #t
      #f))

(test-equal "Symbols are not false"
  #f
  (not 'i-am-not-false))

(test-end "test-suite")
```

Create a `/tmp/bool.scm` file with the code below. Run the tests and if everything goes well, you should see the following result:

```
$ guile bool.scm 
;;;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;; or pass the --no-auto-compile argument to disable.
;;;; compiling /tmp/bool.scm
compiled /home/jeko/.cache/guile/ccache/3.0-LE-8-4.3/tmp/bool.scm.go
%%%% Starting test-suite (Writing full log to "test-suite.log")
# of expected passes 6
```

If you feel like it, you can tweak this file to experiment!
Custom Middleware Function in Express 
Tags: node, express, javascript
Published: 2020-09-13 21:25:45

So this last week I learned how to created custom middleware functions when using Express. Middleware functions are run before the main routes and can be executed on every route call or conversely when calling specific routes.
####Middleware functions in Express are used to accomplish four things:####
* Execute any code.
* Make changes to the request and the response objects.
* End the request-response cycle.
* Call the next middleware in the stack.

Express has a vast amount of middleware functions available for use, but if you cannot find one that fits your needs it is sooo easy to make your own. Before that, however, I want to briefly cover how to use middleware functions in Express.
##So How Do I Use Middleware
There are three simple ways to use middleware in express:
```
app.use(cors())
```
```
app.get('/', cors(), (req,res) =>{..Controller Function..})
```
```
app.post('/',[cors(), json, morgan('dev')], (req,res) => {..Controller Function..})
```
So to explain the three examples I gave above; app.use allows the middleware function passed in to be run before every request, the next example uses middleware as the second argument in a route call and then calls the function before the controller in the route. The last example passes a list of middleware functions to be run before the controller. For more information on how to use middleware, you can go to the [Express](https://expressjs.com/en/guide/writing-middleware.html) middleware page.
###Getting to the Point###
So now you know how to use middleware and want to implement your own. Well, the good news is there is only one thing to learn, the next function. Middleware functions take in three arguments the request, response, and next. The request and response are the same as what you would use in routes, so I am not going to cover that here. However, the next parameter is extremely important, if you do not want your request to time out. At the end of your middleware function, you must call next() otherwise the server will never leave your function. To show this I built a simple middleware function that logs the data to be passed into a post route.
```
const logData = (req,res, next) => {
      console.log(`Data: ${req.body}`)
      next() 
}
app.post('/data', logData, (req,res) => {
    res.send({message: 'Got the data'})
})
```
Notice anything, familiar. The middleware function is nothing special, it is literally a javascript function that can be anything you want as long as it ends in next() and is either set up to be called by express using app.use or in a route as shown above.
So go create some awesome middleware. I would love to see the things you guys can create with this.
Filter Your JavaScript Array Elements Based on a Condition With .filter()
Tags: javascript, arraymethods
Published: 2020-09-13 21:00:32

One of my favorite things about the JavaScript language is that it provides many useful array methods. One such array method that I find myself using over and over is .filter(). In a nutshell, .filter() allows you to pass in a test function which will return a new array consisting of only the elements from the original array that meet a specific condition.

For example, let's say that we have an array of numbers, and that we would like to create a new array consisting of only the even numbers from our original array. 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/5v0xdcga7hmmuazvdi8g.png)
You could write out a whole function involving a for loop, some conditional logic, and pushing elements into a new array. However, I prefer to use .filter() because there is less code to write, and the syntax is much cleaner.

To get back a new array of only the even numbers from our original array you simply write:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/8qo9nq00la0q80yih89v.png)
And that's all there is to it. You can also use .filter() on an array of objects, to return a new array of objects containing only those objects that meet the condition that you provide. 

There are many different array methods available in the JavaScript language, but .filter() is one I guarantee you will use over and over again.

Thanks for reading, and happy coding!