teleren/devto huggingface dataset:
Code Decay
Tags: softwardevelopment, learninpublic
Published: 2020-03-21 21:50:13

I want to make an analogy between the software we write and cars.

To start, I want you to imagine a house, maybe somewhere kind of rural, that has a big, fenced-in plot of land. On that land are sitting some old cars. You can tell they are old not just because the style of cars changes over time, but also because of the fading paint, the spreading rust, and layers of dirt and dust.

A similar thing happens to code that is left to sit. The code we write is always in decay.

For a car, if we are not actively maintaining it, cleaning it, refurbishing it, replacing parts, and driving it around, then it is going to wither away. Similarly, if we fail to maintain and update our code and ensure it runs, then it is going to deteriorate in its repository or on that remote server.

It seems counter-intuitive to say. Surely, if you get code working, it should continue to work forever. Unlike an actual car, code is not exposed to the elements and its parts don't experience wear and tear. Right?

The reality is, the plane of technology that we build on is always in motion. It is moving forward. It is accumulating new mass and shedding the old, deprecating parts of itself. For that same reason, the technology that we build has to stay in motion as well. We have to actively maintain it for it to not also wither away.

That all sounds a bit abstract, so let's put it in concrete terms. Let's say I built a Rails app ten years ago with the latest tech. I have a widely supported version of Ruby and I'm using a popular NoSQL database. I use a third-party provider for the database and I deploy the Rails server to a reliable platform like Heroku. Let's say the app does everything it needs to. It will continue to do so for years to come. It is essentially feature complete. With nothing to change, there is nothing to maintain. Right?

Not quite.

The plane of technology is always in motion.

New versions of Ruby are released, and support and security patches are eventually phased out for the old versions. The same goes for Rails. Heroku isn't going to support everything forever; they need to keep up with modern releases and not let their maintenance surface area expand too broadly. The same goes for that NoSQL database. New versions come out, old ones fade into the background and so does support from third-party providers.

All of the software that underlies this app is evolving and improving, and we aren't taking advantage of any of that. And as time and releases pass by, the harder of a task it becomes to make those upgrades. Our Ruby version may opt us out of pulling in newer, now-standard dependencies and we may find ourselves needing to manually back-patch an existing broken dependency. And in the longer run, we see that the infrastructure that supports our app may eventually have to pull the rug right out from under us.

Code decays. We can't ignore that. The longer we let it sit, the harder it is to maintain. Software has a lifecycle and upgrades have to be part of that if we want it to survive.
Covid-19: Not much to say but stay at home!
Published: 2020-03-21 21:35:07

---
title: Covid-19: Not much to say but stay at home!
published: true
description: 
tags: 
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/mj645t5d2fduiecwbead.jpg
---

Visual Dashboard (desktop): https://www.arcgis.com/apps/opsdashboard/index.html#/bda7594740fd40299423467b48e9ecf6

Visual Dashboard (mobile): http://www.arcgis.com/apps/opsdashboard/index.html#/85320e2ea5424dfaaa75ae62e5c06e61

2019 Novel Coronavirus COVID-19 (2019-nCoV) Data Repository by Johns Hopkins CSSE: https://github.com/CSSEGISandData/COVID-19


edit (new info links):

- https://medium.com/@tomaspueyo/coronavirus-act-today-or-people-will-die-f4d3d9cd99ca
- https://medium.com/@tomaspueyo/coronavirus-the-hammer-and-the-dance-be9337092b56
- Epidemic Calculator http://gabgoh.github.io/COVID/index.html
Learn To Code With This New Growing Youtube Channel Called "Code Bl00ded".
Tags: webdev, android, codenewbie, womenintech
Published: 2020-03-21 21:09:23

Learn how to code join this new and growing youtube channel to learn web and app development if u're interested, to subscribe to the channel for new videos about coding and other techy stuff subscribe link below. 
👉 https://bit.ly/sub_here
Simple Tip Calculator
Tags: codepen, webdev, app
Published: 2020-03-21 21:06:40

Well, this is my first foray into programming anything really. I really enjoyed putting this together and seeing the end result. Getting a feel for piecing together the different parts with JS, CSS, and HTML was intimidating but inspiring in the end. 
{% codepen https://codepen.io/Colinschwager/pen/qBdMbRv %}
MongoDB Update multiple document with multiple condition
Tags: mongodb, mongoose, update, loop
Published: 2020-03-21 20:24:28

---
title: MongoDB Update multiple document with multiple condition
published: true
description: How to use loop in update query in mongoDB
tags: mongodb,mongoose,update,loop
---
How to use loop in update query in mongoDB?

Let’s assume a teacher has many student in his class and he is taking attendance. Default attendance is set as “Absent”.
He wants to update only those student whose who are actually present and have the same subject as his subject.
He’ll mark the student who are Present and press send

my attendance collection.Check “professorclass” has the student details and an “attendance_status”
{% gist 
https://gist.github.com/sahilkashyap64/277f5f5cad14cad99390f71e84fbe98a %}

I want to update only those student whose email_id and subject is passed from UI.

{% gist 
https://gist.github.com/sahilkashyap64/817a1d18367ab8262508eb60da38d872 %}

Have an array of email. We’ll use map to iterate through each email,update each document. And will use Promise.all and await to get it all done.

P.S: If anyone wants to add new info ,or if there’s a better way to update sequentially,Kindly share. I tried using updateMany but couldn’t filter data. I’m still learning :D
Full project here :https://github.com/sahilkashyap64/attendance-system-nodejs/blob/master/server/controllers/userController.js
The Critical Engineer
Tags: exploration
Published: 2020-03-21 20:13:13

---
title: The Critical Engineer
published: true
description: The Critical Engineering manifesto
tags: #exploration
---
Who is The Critical Engineer? And what is critical engineering at all?
I found this site, I don't remember when and how. But it still sits in my mind. Another way to see world. The group of engineers and artists gathered once and wrote that manifesto out of 10 (zero based) items: here is the beginning.

_0. The Critical Engineer considers Engineering to be the most transformative language of our time, shaping the way we move, communicate and think. It is the work of the Critical Engineer to study and exploit this language, exposing its influence._

https://criticalengineering.org/
Day 3 in web development
Tags: css, html, 100daysofcode, beginners
Published: 2020-03-21 19:48:32

Welcome on Day 3 first today I was very confuse or maybe i had very negative vibe i was't understand the simple anchor tags for multiple pages i had very low energy but after spending some time i get fresh my self and miss my friend Naqi Ahmed he has vary high and positive energy when every i meat him he charge me up than i sat back on my work Space and start learning anchor tags for multiple pages and it's very simple also i learn about link tag for external style sheet which is reduce the ability to use CSS in a page with a single line of code further i learn about CSS selector with section and div tags which need to understand very clearly for front-end developer in html Class are very important instead of id you can use id but where you have to need with class i learn about display-flex,margin,padding which make my pages more nice.css pseudo classes are also helpful i did't use much pseudo class target like in parent class you have many child if you want to change your first-child Background-color and else remain same you can just write like this
```li:first-child {background-color:red;}```
this is awesome i'm trying out to write more and learn more about web development.
Problems with Node.js
Tags: node, javascript, react
Published: 2020-03-21 19:40:00

Hi,

I am wondering why my server side code only outputs "Hi ${port}" on console without (1) showing the actual port number or (2) opening up the "locolhost:5000" web page. My command is "npm start server." The screenshots of (1) the code and the (2) scripts part of the package.json file are attached. Thanks!

https://dev-to-uploads.s3.amazonaws.com/i/fqccj2yqjogkszwzkjp5.png

https://dev-to-uploads.s3.amazonaws.com/i/w90w553emwra9deb7y8k.png
Should you ignore scripting time of virtual-dom?
Tags: javascript, react, vue
Published: 2020-03-21 19:03:43

In one of my post's comment section I made a statement saying,

`Scripting time will be more because it was considered by any virtual-dom framework that to re-draw the tree should be optimized more than the amount of javascript that is being run.`

A straight forward opinion might be to optimize scripting time is as important as it is to optimize Layout or DOM rendering. But we might want to remember web-workers here.

Workers provide multi-threading or a parallel process along with the main thread but they don't have access to DOM and other entities. As we speak about virtual-dom getting overloaded with higher scripting time, the entire operations can be moved there.

That's the reason, why the upcoming new opinion `virtual-dom is not needed` might not survive longer. Frameworks/libraries with virtual dom should adapt to workers.

Another issue with workers might be `Structured Cloning` or deep-copying which needs to be worked upon. Because to communicate between them, a huge object needs to be passed. This can be fixed by taking an input from the developer on which part of the tree might be under the scope of change. Thus reducing the tree size that is being communicated between Worker and main thread.

Thanks for reading!
How do you scrape Instagram?
Tags: python, datascience
Published: 2020-03-21 12:29:26

Recently, there have been talks of **Instagram** closing down its API and leaving access to only corporate partners. 
Data scraping becomes even more important in this scenario because of Instagram's large user base. Instagram is a platform full of data in its every nook and cranny. 
I decided to start by scraping whatever data we can find on a person's account page, which you can access at https://instagram.com/<username>

Let's take a look at my page for example at https://instagram.com/manan.code
![Profile](https://dev-to-uploads.s3.amazonaws.com/i/jr2n2kirez6oc6qgmhgv.png)
This is the main area I am interested in, what all could we scrape from here and how? Right-click on the page and click view page source to see the source file behind it.
You'll see something like this - 
![Source](https://dev-to-uploads.s3.amazonaws.com/i/5l98meync1h69cw5v870.png)
Now at first look, this seems incomprehensible and it seems almost impossible to find any data from this, it's just sea of link and script tags.
But the data is there somewhere for sure. 
I did some digging and found out the script tag that consists basically everything we need.
![script](https://dev-to-uploads.s3.amazonaws.com/i/713yabdp73bh95d4nvuw.png)
Now that we know where the data is, let's move on to the code.
We'll use the requests module and BeautifulSoup.
{% gist https://gist.github.com/manan2002/62358b41a7e04dc11d28dcaa6f2d441c %}
So till this point in the code, we've requested Instagram and got the source, after that we've converted it to a BeautifulSoup object to make it easy to find the script tag we need. After converting it to BeautifulSoup object, we've used the find_all function in the BeautifulSoup library and found all the script tags, by a little trial and error, I discovered, the script tag we need is the 5th one, so we index it appropriately and find the script tag we need.
But, we need to do one more thing, right now what we have is not a string, we can't slice it to find what we need. Hence, we access the contents of the script tag. 
The next step is to find out where's the part we need. 
{% gist https://gist.github.com/manan2002/e3e0da669d1cdabf5664d03529a9d989 %}
Now what we've done is, if you remember, the javascript object having all the data started from `{"config":`, I've simply used a little string processing to slice out the whole javascript object and having it isolated, convert it to a JSON object using loads from the json package in the standard library.
If you print `data_json`, this is what you get - 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/cjp94ki9ydgdw3e6w200.png)
On looking closely, I figured out all the right keys to the data we need, here is the result.
{% gist https://gist.github.com/manan2002/ea3dd4df30bc52c64738a0de74f42254 %}
![Final](https://dev-to-uploads.s3.amazonaws.com/i/j5yjvr0bq69lrtkoypop.png)
and this marks the end of our journey to scraping Instagram!
Check out my video where I go over the same thing - 
{% youtube yAT7nkPVG9Y %}
Open source business app like square app!
Tags: android, ios, webdev
Published: 2020-03-21 19:02:20

We have started our first big opensource project:
I have been thinking of creating an opensource project a business application that can be used in our daily life such as selling, transacting, schooling etc... especially in our continent where such an app is not available.

here is our GitHub:
for mobile: https://github.com/yegobox/flipper-mobile
for desktop and web: https://github.com/yegobox/flipper

The documentation is not good but at least that is a room that might need a contribution. we are open to suggestion and ideas please send us at dev@yegobox.com we would appreciate your contribution and be happy to have chat with you.
We are looking toward where this initiative will take us and we can not wait for more to come.

Thank you,
team from yegobox.
Train Simulation Problems
Tags: java, help
Published: 2020-03-21 19:02:09

Hey everyone,

I am having trouble with this Train Simulation that I am working on for school. I don't know what I have done wrong. I am not getting any errors but the output is just wrong. I am having problems with how many **stations** are being visited and also the **station names**. The station name that is being printed is **[Ljava.lang.String;@27716f4** and I don't know why.

> You can find the main class **MainClass** and support class **SubwayTrain** 
--> [here](https://gist.github.com/sonAndrew/dde70230fe184eb40993ed81f114a713).

If anyone can help I would greatly appreciate it.

Test data I am using
--------------------
```
Number of Stations: 3
Home Station Number: 33
Maximum Capacity: 10
```
What is GraphQL?
Tags: graphql, rest
Published: 2020-03-21 18:38:04

---
canonical_url: https://www.jenkens.dev/blog/what-is-graphql/
---

## What is GraphQL 
GraphQL is a query language for APIs invented and open-sourced by Facebook. It can be used as an alternative to REST and boasts a lot of advantages. GraphQL was originally made to keep up with the increase in mobile device usage because it helps limit the amount of data sent. Normally we use different endpoints to get data from a server and display it to the client and we are forced to accept whatever data the endpoint gives us. GraphQL uses declarative data fetching meaning the client can define exactly what they want from the API. GraphQL has a lot of moving pieces so my goal with this series of posts is to break them down into manageable chunks. 

## GraphQL vs REST
REST has been around for a while and most websites on the internet follow RESTful patterns. If you want something different from the traditional paths you'll have to create your own custom endpoint and continue to create and change these depending on the needs of the client. REST APIs have multiple different endpoints, such as your typical Create, Read, Update, and Delete(CRUD), whereas GraphQL only has one endpoint.  

## Benefits of GraphQL 
A major benefit of GraphQL goes back to declarative data fetching. Because you can create a request for exactly what you need, the client isn't stuck with any unnecessary data nor is it lacking information. This can save you requests, as sometimes we need to find the id of a specific model and then ask the API again for all the information about the object with that particular id. In a RESTful API, this can take 2 different requests but with GraphQL we only need to send one query. 

Another nice feature is that declarative data fetching defines what the response will look like as well. When you send a query to the GraphQL API the response will be in the same exact shape. This was a breath of fresh air for me because it meant I didn't have to spend time toggling between my code and the response to make sure I was accessing the data correctly. 

GraphQL can be used to combine multiple APIs into one GraphQL endpoint. Sometimes clients need to talk to multiple different APIs and with GraphQL you can stitch these APIs together. GraphQL can be wrapped around existing REST APIs and secure it under one endpoint.  

One of my favorite things about GraphQL is the [playground](https://github.com/prisma-labs/graphql-playground) that comes with it. The playground makes it easy to test out requests to the API and comes with a ton of information about your specific GraphQL project.

GraphQL has become extremely popular and is definitely picking up speed. I hope this article gives you a small insight into this cool technology. Be sure to look out for more articles in the series that will cover GraphQL Schema, Resolvers, and Apollo!

### Additional Resources
[How To GraphQl](https://www.howtographql.com/basics/0-introduction/)
[Apollo Docs](https://www.apollographql.com/docs/intro/benefits/)
Nevertheless, she questioned
Tags: math, datascience, machinelearning, connections
Published: 2020-03-21 17:54:59

Hi all! Have you ever sat in class, learned math principles _and then_ weeks later learned *all* the technical stuff? Ever wondered how the tech stuff ties back to the math?

I've wondered that too. Why spend so much time learning statistics and probability principles and then, afterward, learn about confusion matrices and classification metrics without any references to the math principles learned earlier?

Let's chat in the comments - I want to know if you've ever thought about this.
5 Canny little tricks for React devs
Tags: react, tricks
Published: 2020-03-21 17:36:31

---
title: 5 Canny little tricks for React devs
published: true
description: Canny tricks that won't make your React app better but will make your dev process easier.
tags: reactjs, tricks,
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/bsd95l7zmrzs3dbe7gjl.jpg
---

No extra talking. Let's get to it.

------

## 1. Pretty print your props.

You just created new component that has massive amount of props. To quickly get your head around them you can pretty print them on page with more arguments on native JSON.stringify function.

```jsx
const NewComponent = (props) => (
   <pre>
      {JSON.stringify(props, null, 2)}
   </pre>
);
```
------
## 2. Solve multiple HOC around a component?

You cannot use hooks for some reason so you end up with HOC (Higher Order Components). That can get hairy in no time. Use compose function to clean your code. You can create your own or if you use redux you can import one from it.

```jsx
export default connect(mapStateToProps, mapDispatchToProps)(i18n(format(Component)));

// vs.

import { compose } from 'redux'; // or your implementation

const enhance = compose(
   connect(mapStateToProps, mapDispatchToProps),
   i18n,
   format
);
export default enhance(Component);
```
------
## 3. console.log function that uses concise body (body without return statement).

You have function component that use concise body so you immidietely return body without the need of `return` statement. Pretty cool time saver.. but what about the time you want to console.log props. You would have to convert it to block body with return statement. Or not? Actually you can use condtional logic for it. 

```jsx
const Component = (props) => console.log(props) || (
   <div>
      {props.children}
   </div>
);
```

This both logs `props` to console and render the component because console.log returns falsy value so it skips to second part of the condition.

------
## 4. Manually restart nodemon

Sometimes you want to restart nodemon server manually. Instead of some random change to a random file and Ctrl + S just type `rs` with a carriage return (Enter) to the terminal running nodemon. It will restart.

------
## 5. Pass HTML character references as props
Want to pass HTML character references as props in JSX? It works with simple string but breaks with more complex logic. You can achieve it with String.fromCharCode function
```jsx
// <Component charCode={160} />
// 160 -> non-breaking space

const Component = (props) => {
   const divider = String.fromCharCode(props.charCode);
   return (
      <div>
         <SubComponent text={`${divider}-${divider}`} />
      </div>
   );
}
```

------

Find more tricks on my Twitter!
https://twitter.com/Michalhonc
Planning process for Middle-sized Projects
Tags: beginners, management, productivity
Published: 2020-03-21 17:12:17

> Any business project (reducing energy costs, or improving efficiency) needs to be planned, and time spent planning will save far more time later on. The Typical stages in this planning process are explained here:

- 1~st~ Task: Is to spot what needs to be done. Examine your *firm's current position*, by (maybe) making a **SWOT Analysis** (==is a strategic planning technique used to help a person or  organization identify strengths, weaknesses, opportunities, and threats  related to business competition or project planning==) 

<img src="https://cdn.corporatefinanceinstitute.com/assets/SWOT.png" alt="img" style="zoom:70%;" />

- 2~nd~ Step is to decide precisely what ==aim== of your plan is. In a single clear sentence, to ensure that it's clear and sharp *in your mind*. It will avoid **wasting effort on irrelevant issues**.
- Next, you should work on how to do it. It is tempting just to grad the first idea that comes to mind, but considering a wide range of options is better (so that you may come with less obvious but better solutions).
- After you have explored the options available to you, the selection of which option to choose (use) is the next step. depending on time and resources you have, you might decide to evaluate all options, carrying out some planning, like costing, for each (Normally won't have this luxury).
- Now you already have ***a board idea*** of what your project will consist of. So it's the time to work on full details, identifying the most effective & efficient method of carrying it out, including answering the questions of **who, what & when**.
- 6~th~ Step: is to **review your plan** and decide whether it will work satisfactorily, this evaluation enables you to change to other option that might be more successful, or to accept that no plan is needed.
- Once you have finished your plan an decided that it will work satisfactorily, it is time for ==implementation==. You plan will cover how this is to be done.
- Last but not least, Once you have achieved a plan, you can close the project. at this point it is often worth assessing the project to see whether there are any lessons that you can learn.