teleren/devto huggingface dataset:
Late update, Timely completed. 1 of 2 Eliminated. Officially a Telescope contributor. 
Tags: opensource
Published: 2020-11-19 05:43:12

Helllllllo all again with anew update. I have been planning to write this blog post for a while now, but I couldn't as I had lots of work left both personal and educational. So, here it is now the update of what happened and what I did for this week. 

I want to start of the story with something. I am now one of the proud contributors of the Telescope project. It makes me very happy as I did contribute something to Telescope, even it is not big. I am thinking of working with Telescope very often from now onwards. This is mainly because I want tog et familiar with all the new technologies is being used in the Telescope project alongside old ones. It will help gain more in depth knowledge on the latest technologies. I was issued to resolve a bug that was found in the app. It was for fixing variables in a particular file to make it run the correct way. I fixed it and did a PR for review. 2 reviews accepted what I did and finally it got merged to the original project. So, that way I can gladly say that I am one of the contributors of Telescope.

This was the first of 2 PR's I was assigned to complete in few days. I already found my 2nd Issue (already did a PR) as of writing this blog. I will be posting about that real soon. This blog post is overdue as I was busy finishing up other works as I was done with the main parts. So, keep an eye out cause I will be posting about my 2nd PR real soon.


Nothing much else to talk about as this week is just work , work, and work. Oh, not related to opensource but, I did my first few wireframe designs for a huge project. So, very happy about that and waiting for reviews from my team at the moment. Looking forward to it. Other than that, I am done with this blog post now so I will be seeing you guys real soon. Thank you for reading this and hope you guys have a wonderful day.

Link to my PR and Issue given below.

LINK - 

[Issue](https://github.com/Seneca-CDOT/telescope/issues/1347)

[PR](https://github.com/Seneca-CDOT/telescope/pull/1383)
How to explain tech stuff to non-tech people?
Published: 2020-11-19 05:41:24

I often feel frustrated when I have to explain concepts to non-tech members of the team. It could be explaining what a Pull Request is, what a branching strategy is, what is a pipeline in Azure DevOps and etc. 

Even though I feel I have explained it well and even show cased it a couple of times, I still end up in long discussions at the meetings explaining the concepts again and again. 

Has someone found a good strategy that works?

Maybe use drawings? Analogies to something non-technical?
Install Python 3.7+ on CentOS 7
Tags: python, centos
Published: 2020-11-19 05:38:25

This was my first time to install a recent version of Python on a CentOS. I always use Ubuntu and It is pretty easy using deadlysnakes PPA. so the only way was to compile the source code from python.org website.

The how-to is on the internet but I'm writing this as I did compilation serveral times as some options weren't set properaly. so let's go

1. Install build tools `sudo yum install gcc openssl-devel bzip2-devel libffi-devel`
2. Download the source from `https://www.python.org/downloads/source/`
3. Extract the source
4. run `./configure --enable-optimizations --enable-shared`
5. run `make altinstall`

**Notes**: 
* `libffi` is crucial, so don't forget it.
* `--enable-shared` is required if you will compile any library with C Extension.
* pip will be installed by default.
* If you get `/usr/local/bin/python3.7: error while loading shared libraries: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory`, then do the following
* `export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib`
or
* `sudo ldconfig /usr/local/lib`
Why did I choose to become a developer?
Tags: webdev, watercooler, devjournal, career
Published: 2020-11-19 05:34:29

I was in 7th standard when my father bought me a computer. As a kid, my only interest in the computer was playing games. Luxor, Road rash, Zuma were games that I played first and then some more cool games like GTA: Vice City, Prince of Persia, and so on.

While playing games, I thought 
>*what If I could make a game that has characters that I've designed, rules that I've created, and then play it*

I then researched how one can make a game and what study is required to do so. Based on that I decided that I would be a software engineer and develop games.

Well, my only concern and desire were playing and creating games but as soon as I entered the real world, I realized that there are many more cool things we can develop including games and it made me a developer.

But yes, in this journey, I've developed my first game in C using the graphics library which was not easy for me but anyway I have done that.

Here is the video of that game. Though it's not good enough, there are flickers also in the game and there are many patches in the game to make it work, it's very special to me. And I am very happy and fortunate that I am in a field I have an interest in.
{% youtube eKFBG-UxsSo %}

I have developed this game many years ago and I can improve it to a very good level still I like it the way it is... so I never touched it since then. Maybe the incompleteness and flaws of this game are making it perfect. It reminds me of my dreams, imaginations, and the golden time of imaging this stuffs.

Here is the Github repo for that game.
{% github Maulikdes/SpaceShip no-readme %}

What's your story, What made you a developer or whatever you are?
Prototype Delegation 
Published: 2020-11-19 04:53:28

#Intro 
In JavaScript, a prototype is a hidden property on an object that references an object or is set to null. If the script runs and can’t find a property/method in the targeted object. It then checks to see if the prototype could potentially have the property/method. In the following examples I will demonstrate how prototype delegation works. 
#The Prototype 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/5xbsu7oeka2jyrtlw9ni.png)
Here I will set car to be the prototype of different types of cars. We can use car to behave as a storage of many different methods but in this case we will have an accelerate method that will print to the console how fast a particular car accelerates. The keyword **this** will refer to the object that's at the left of the dot at call time.
# Prototypal inheritance
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/odg1mz59bt1xdtm8wqa3.png)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/0l04psxg4jgnn0qi4rsv.png)
To use the accelerate method on the hellCat object you have to set hellCat's prototype to car. A way to accomplish this is to create a property with the key as two underscores on each side of the word proto and the value the desired object. Car is now the parent to the hellcat object! When accelerate gets invoked with hellCat to the left of the dot, the script will run to see that it does not have the method inside hellCat. Since car is set to the prototype. Hellcat inherits the accelerate method so "Hellcat accelerates 0 to 60 in 3.6 seconds" gets printed to the console. 
#Prototype chain
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/h6zy82433sj4prrxlz5z.png)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/g80oy69wzvo7m46gtmwa.png)
Here Zr1's prototype is set to hellcat. When the script runs it will see that the accelerate method is not in Zr1. Although, Zr1 did inherit hellCat's characteristics. Which hellCat inherited characteristics from car object. This demonstrates the script going up the prototype chain until it finds the method in car.

I hope I could help you understand how prototype delegation works. This is also a form of prototypal inheritance which some programmers might not agree with. Maybe I'll post on that but until next time thanks for reading! Peace!
Creating a custom date-time picker using Angular Material
Tags: angular, javascript, webdev, typescript
Published: 2020-11-19 04:49:23


My requirement was very specific so I am going to talk in terms of `mm/dd/yyyy, hh:mm:ss` input field format i.e. in the same field you must be able to edit date and time and also choose a calendar view with time fields as well besides date.


📌 For date selection, choose `<mat-calendar>` instead of `<mat-datepicker>`.

📌 Create a time component with input fields for hours, seconds and minutes.

📌 Smash them together inside one div and show/hide it using boolean values on an icon click to the right of input field.

📌 Setup a `form group` with date, time and input `form controls` (Yes reactive forms is the way)

📌 Since our input field is plain text , we need to have a **regex** to validate above stated format.

📌 Post successful validation comes the splitting of input field content to retrieve date and time content and set it to date and time formcontrols. 

📌 Similarly for any date or time change through calendar view, update the input formcontrol.


P.S. - Refer [github](https://github.com/angular/components/blob/master/src/material/datepicker/calendar.ts) for `<mat-calendar>` instead of angular material docs.
AWS DataSync
Tags: devops, aws
Published: 2020-11-19 04:40:23

AWS DataSync
Day 3
AWS DataSync, the word itself described as data synchronization in AWS, will be the subject we will be discussing. The data-transfer service that simplifies , easier and automates for replication of data between On-premises and AWS storage over internet or AWS direct.
 
How it works - Installing the AWS DataSync Agent on server to connect the file system to AWS and write data from AWS. Network transfers accelerates the encrypted data over WAN areas. It has high protection connecting with the storage in AWS services like S3 Bucket, EFS , Fsx on windows servers.
Overview
Helps in large amount of data transfer from on-premises to AWS.
Transfer files with NFS and SMB compatible file system.
Installing the DataSync Agent to start the replication, it can be maintained hourly, daily or weekly.

Use Cases
Data transfer can be made secure and reliable can be done by attaching the IAM roles to the AWS.
It helps in the reduction of operation data transfer cost, pay as per Giga-pricing of DataSync.
A project contribution: unit test!
Published: 2020-11-19 04:27:10

### Introduction
This time I'm working on creating a minor unit test for a [algorithm-gathering repo](https://github.com/aniketsharma00411/algorithmsUse). *algorithmUse* is a repo created for the purpose to embark on Data Structures and Algorithm. This repo contains multiple popular algorithms written in various languages.

### What did I do?
To encourage people to get involved to open source. The owner of the repo open an [issue](https://github.com/aniketsharma00411/algorithmsUse/issues/11) in which requested contribution to create unit tests for their algorithms. 

### How did I do
I, myself, also want to contribute. Therefore, I started to write a test for their binary search algorithm. My test is basically based on:

* Return -1 if an array is empty
* Return -1 if the to-be-found element is even in an odd array
* Return the 0 if the element is found in the first position of an sorted array
* Return the index of an element in an array.
* Return middle - 1 if the element is found in the middle of the array.

### Conclusion
- Writing test helps us to have big picture when it comes to designing an algorithm.
- You can also check my contribution at [here](https://github.com/aniketsharma00411/algorithmsUse/pull/181)
Code Smell 28 - Setters
Tags: oop, codenewbie, programming, webdev
Published: 2020-11-19 04:14:34

*The first exercise junior programmers do. IDEs, tutorial and senior developers keep teaching them this anti-pattern.*
 
# Problems

- Mutability

- Information Hiding

- Anemic Models

- Fail Fast

- Integrity

- Duplicated Code
 
# Solutions

1. Avoid Setters

2. Set essential attributes on private initialization.

# Sample Code

## Wrong 

{% gist https://gist.github.com/mcsee/7133ca38aceb3bace14d25548610f682 %}

Mutation brings lots of problems

{% gist https://gist.github.com/mcsee/2706ba1e510ef085a1f25dde11254e1a %}
 
Information Hiding Violated

{% gist https://gist.github.com/mcsee/63efec0e8bfd02179e0510a2db922580 %}

## Right
 
{% gist https://gist.github.com/mcsee/a32cc664ed6e5cc61f5d824f587ffcb8 %}

# Detection

First step will be to forbid public attributes (if language allows them). 

Secondly, we will search for methods *setXXXX()*, analyzing method structure (should be an assignment to attribute *xxxx*).

We should not forbid methods setting *accidental state* since this is valid. They should not be named *setters* since they ask the object to *change*, but they don't *set* anything. 

# Examples

- DTOs

# Exceptions

Setting attributes is safe for *non-essential* attributes. 

But it has all drawbacks and considerations already mentioned.

# Tags

- Mutation

- Information Hiding

# Conclusion

Creating incomplete and anemic objects is a very bad practice violating 
mutability, fail fast principle and real world [bijections](https://dev.to/mcsee/the-one-and-only-software-design-principle-3086).
 
# Relations

{% post https://dev.to/mcsee/code-smell-01-anemic-models-4dg2 %}

# More Info

[Fail Fast](https://maximilianocontieri.com/fail-fast)

[Here](https://maximilianocontieri.com/nude-models-part-i-setters) is the full discussion on *Setters*
 
# Credits

Photo by <a href="https://unsplash.com/@vimarovi">Victor Rodriguez</a> on <a href="https://unsplash.com/s/photos/crowded">Unsplash</a>

* * *

> Object-oriented programming languages support encapsulation, thereby improving the ability of software to be reused, refined, tested, maintained, and extended. The full benefit of this support can only be realized if encapsulation is maximized during the design process.

_Rebecca Wirfs-Brock_
FREE Cassandra Certification Voucher ($145 value) and Cool Swags
Tags: datastax, apachecassandra, k8ssandra
Published: 2020-11-19 04:13:24

Hi, i would like to share excited [Workshop: Putting Apache Cassandra™ on automatic with Kubernetes](https://www.eventbrite.com/x/workshop-putting-apache-cassandratm-on-automatic-with-kubernetes-tickets-128140695269?utm_campaign=reminder_attendees_event_starting_email&ref=eemaileventremind&utm_medium=email&utm_source=eventbrite&utm_term=eventname)

All attendees will receive a FREE Cassandra certification voucher ($145 value) and cool swags.

If you'd like to follow along with the hands-on exercise during the workshop, you can do this locally on your machine or laptop if you have at least a 4-core + 8 GB RAM machine. Otherwise, you can request a training cloud instance by contact datastax.com team to get your node and Team will send you the details immediately before the workshop.

If you have any questions during the workshop, you can engage with them on Discord (visit https://bit.ly/cassandra-workshop ).

Last date of workshop: Thursday, November 19, 2020 12:00 AM (+07) Workshop: Putting Apache Cassandra™ on automatic with Kubernetes

OPEN-SOURCE, SCALE-OUT, CLOUD-NATIVE NoSQL DATABASE datastax.com

Happy learning and get certified.
First Time Working With JSX
Tags: opensource, javascript, react, css
Published: 2020-11-19 04:09:48

For the release of this month in this open-source course, we're asked to do 2 pull requests. An internal one, and an external one. The external one can be in any open-source project on GitHub and the internal one is to work with the project that I mentioned in the [previous blog post](https://dev.to/yuanleemidori/start-with-telescope-5d43), [Telescope](https://github.com/Seneca-CDOT/telescope). Today, I'm going to talk about the internal PR that I sent.

[The issue](https://github.com/Seneca-CDOT/telescope/issues/1089) I worked on is a UI change of the post title. Due to the no word wrap setting, if the title is too long, it'll only be shown a part of it with ellipsis. 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/jt8hqroisf2dri87kezq.png)

If we wanted to view the whole title, we had to go to the original blog post. We were not able to view the whole title on telescope.

My initial thought was, create a function that toggle between true and false, and, by returning true or false value, the title content can be expanded and collapsed.

However, this project uses React JSX which I've never worked with. I've done some basic React application on the last semester, and that's everything. I tried different approaches, but they didn't work well because of different reasons such as using wrong ways to pass props or the syntax just didn't work like what I expected. I even tried the React Accordion to reduce some work on css, but it seemed to bring me more puzzles to resolve...

Eventually, I simply used inline conditional operator to switch the word wrap setting between `nowrap` (collapsed) and `normal` (expanded). And it worked perfectly!

After sending [the PR](https://github.com/Seneca-CDOT/telescope/pull/1380), I, then realized that I didn't finish all the environment set-up. There is a document lists all the setting that we need to modify the code and send the PR. I, again, recalled what the professor said, "Programming is 90% of reading, 1% writing, 9% debugging". Reading documents and code is critical and is usually underestimated the importance.

Following several change requests and reviews, my PR finally got approved and was able to merge. I'm always grateful for being reviewed by experienced developers because they not only bring me new skills or knowledge but also give me some of their experience, such as naming convention, good coding practice. These can't be learned from tutorial videos on YouTube or textbooks, they are accumulated over time and hardworking.
Adding a Static Analysis Tool  as a Open Source Contribution
Tags: opensource
Published: 2020-11-19 04:07:39

## Intro
This week, I took the knowledge from adding prettier in Fire Linker and found an issue to add prettier to a larger repo. The repo I found was an addon for ember.js .The addon makes it easier to add  Content Security Policy (CSP) to a ember project. In this blog I will talk about my experience working with a bigger repo and the process.

## Process over Implementation 
So, last week I showed my intention to work on this [issue] (https://github.com/rwjblue/ember-cli-content-security-policy/issues/157). Though this is smaller addition to big project but the change affects almost all the files in the repository. So, there can be many merge conflicts if I made the change and the contributors for the project where working on a bigger pr. That is what exactly happened for this issue, one of the contributors let me know he was working on  a rather big change and asked if I was okay with waiting till he merges his current pr. I told him I would wait before I add prettier to the repo. A couple days pass by and the contributor mentions me and say the pr is taking much longer than expected and that I should move ahead and implement the new addition. The biggest thing I learned from this experience is how important the process and communication is when contributing to the open source. What if I had just sent a pr right as I saw the issue or had done it before I was assigned to the issue. This small addition may have caused larger problems for the project.

## Implementation 
Implementing prettier at first I thought was simple, got slightly more complicated when I found out prettier does not support handlebars. Though the project is mostly javascript there are some test implementation that have a handlebars application. Though I wasn't sure, if I needed to implement prettier for handlebars. When, I saw the error I got a bit worried and then did research to find that handlebars is not supported by prettier and to use prettier on handlebars I need to use a different parser known as glimmer. As, I was unsure to implement and use a different parser for prettier. I created a simple prettier script for non handlebars files and mentioned in my pr that if they wanted me to implement and thing or change it. I would do so. 

## Implementation Reflection
Lastly, I just want to say that this small addition changed 500+ lines of code. I found it really interesting how something so small has such a big change in a project. This also reaffirmed my understanding that we should chose a code formatter at the beginning of the project to avoid a lot of conflicts in the future.
DA11 Messaging in EA
Tags: learning, design, architecture
Published: 2020-11-19 02:56:34

# 本篇主要讲使用**消息传递**机制来集成企业级应用。

Messaging system – responsible for transferring data from one application to another.

# Messaging Components

- Message channel
- Message
- Message router
- Message translator
- Message endpoint

## Message channel

Message Channel is a virtual pipe that connects a sender to a receiver.

Sender 和 receiver 都无需关心对方，只需要负责发送和接受。

对每一个channel，数据的格式要唯一，如果两个applications之间有不同格式的数据，那么需要多个channel。

### Two types of channel

- Point-to-point channel: send the data to a single application. 一对一。需要注意的是：在channel的另一端并不一定只有一个application，可以有多个，但是一个message只有一个application可以收到。
- Publish-subscribe channel: allow multiple applications to receive the same message. 一对多。
Add an infinite scroll  function to Telescope
Published: 2020-11-19 02:52:41

### getting started
So far, the Telescope generates more posts only when the "more post" button was click. Thanks to `useSWRInfinite()` and `IntersectionObserver`, the new posts can be rendered infinitely. 

### Implementation

First of all, we are going to grab a node, so we need `useRef` hook. Also, `IntersectionObserver` will be declared and assigned once the page is all loaded, so we need to have `useEffect`

```
import React, { useEffect, useRef } from 'react';
...
```

Second, we need to find out which node should be the flag that the current post is the last post, and the new posts should rendered. 

We can reuse the code from previous `loadMoreButton.jsx` button node. 
```
    <Container>
      <Grid item xs={12} className={classes.content}>
        <Button ref={$buttonRef}>Load More Posts</Button>
      </Grid>
    </Container>
```
This node will be the reference to indicate the post is the end of the current posts.

Third, we need to make it actually happen!
```
useEffect(() => {
    const options = {
      root: null,
      threshold: 1.0,
    };

    const observer = new IntersectionObserver(
      (entries) =>
        entries.forEach((entry) => {
          if (entry.isIntersecting) {
            onScroll();
          }
        }),
      options
    );
    observer.observe($buttonRef.current);

    return () => {
      observer.unobserve($buttonRef.current);
    };
  }, []);
```

This will make the selected button node to be acted like a flag for check.
Better Python for Loops Using enumerate
Tags: python, beginners, tutorial
Published: 2020-11-19 01:52:10

It's a common use case to iterate over a list together with its index. Traditionally, this has been done by using a `for` loop, utilizing `range` and `len` to create a list of indices. The items of the list then are accessed using `[]` notation, like so:
```python
shopping_cart = ['apple', 'cereal', 'banana', 'cola']

for i in range(len(shopping_cart)):
    print(f'{i}: {shopping_cart[i]}')

# 0 apple
# 1 cereal
# 2 banana
# 3 cola
```
But this solution is very imperative, reminiscent of older programming languages. We have a better, more pythonic solution.

Using the `enumerate` keyword, we can get an iterator that already gives both the item and index of the list. Using this, we can simplify the above code as follows:

```python
shopping_cart = ['apple', 'cereal', 'banana', 'cola']

for i, item in enumerate(shopping_cart):
	print(f'{i}: {item}')

# 0 apple
# 1 cereal
# 2 banana
# 3 cola
```
I personally think that this solution is cleaner, more elegant, and simpler to write. 

---

*Hey! My name is Adrian. I'm a software engineer who likes to write. If you liked this, why not [follow](https://twitter.com/adrianmarkperea) me on Twitter*?