teleren/devto huggingface dataset:
Reading through the Python standard library
Tags: python
Published: 2019-11-27 18:05:43

A couple of years ago I decided to read the entire Python standard library.  A few months back, I finished.

What I learned is this: **while there is some interesting "hidden" stuff in there, you don't need to do this to become proficient.**

Did you know that nearly all the HTTP status codes are in the standard library?  Judging by all the Python packages that defined their own status codes, I assumed that the codes weren't in there.  I was [wrong](https://docs.python.org/2/library/httplib.html).  And they got [better in 3.5](https://docs.python.org/3/library/http.html#http-status-codes).  Reading through the library revealed many "easter eggs" like that.

Even though learning about those hidden corners of the standard library is fun, there's a really large problem with reading through the whole library.

### It's a lack of context.

One challenge of reading through everything is that you may be unaware of what parts are excellent (like `os.path`) and what parts are not (I won't name names here).  Occasionally, the reader is given a warning about the dragons ahead.  You might find a tip to use [requests](https://docs.python.org/3/library/urllib.request.html).  I think those kinds of suggestions are rare.

Maybe you're asking:

### "*So if the library doesn't provide much direction, what do I do?*"

Part of getting good with the standard library is experiential.  The best ways to gain that experience is through practice and exposure.  This is where I point you to the community.

Your local Python user group (hi, [Python Frederick](https://www.meetup.com/python-frederick/)!), online Python communities like on IRC, and open source Python projects are excellent places to get exposure.  You'll encounter people who can provide pointers and read code from those who are a bit farther on this journey than you are.

If it's tough for you to get into those social groups, maybe [The Hitchhiker's Guide to Python](http://docs.python-guide.org/en/latest/) will work for you.  For folks that have a programming background, I can also recommend [Dive Into Python 3](http://www.diveintopython3.net/).  I got my start with the Python 2 version and can attest that it's a good resource.

If you're tempted to read through the standard library like I was, **cool! Best of luck!** Please don't forget that there are people around you that can help provide that missing context.

*Photo credit to [Loughborough University](https://www.flickr.com/photos/loughboroughuniversitylibrary/6333984637).*

This article first appeared on [mattlayman.com](https://www.mattlayman.com/blog/2016/readthrough-python-standard-library/).
Comparing Services for Cheap Cloud Hosting and Storage (Cloud / AWS / S3 / Amazon Cloudfront / ... ???)
Tags: explainlikeimfive, help, aws
Published: 2019-11-09 22:54:03

Hi Dev.to! 👋👋👋 

Some questions for all you performance aficionados and AWS / Cloud experts out there.

I'm looking for a cheap (as close to free as possible) service for:

#### 1. Hosting AND serving images. These images will be used on a website, in emails, etc. I want to plan for:

* 100GB of added storage / month
* 100M image views (GET requests) / month
* 100K new image uploads (PUT / POST requests) / month

#### 2. CDN / Edge caching - so as to serve requests as fast as possible. Here I am looking to reduce response times and website load times that end-users will experience. 


AWS both has an amazing suite of products and at the same time is very difficult to get started with.[AWS S3's pricing model](https://aws.amazon.com/s3/pricing/) is confusing. I did also play a bit with their [calculator](https://calculator.s3.amazonaws.com/index.html), but it's hard to say if I'm entering the numbers in correctly. 


-----
Q1: In the AWS ecosystem:
* For S3: What is "Storage pricing" vs "Request Pricing"? 
* What is S3 Select and how is it different from S3?
* What is S3 Intelligent-Tiering?
* What is S3 Glacier?
* And what about Amazon CloudFront?

-----
Q2: Is AWS the best (and cheapest) available option? What about services like:
* Cloudflare
* Cloudinary
* Photon by Jetpack etc?
* Versus using my Linode server itself for hosting and serving images?
* versus the 1000+ other options out there?

Thoughts on what service I should be using? Looking for advice from folks that are knowledgeable on the matter. 🙏🙏🙏
React app global state management with hooks
Tags: react, javascript
Published: 2019-11-10 08:41:01


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

React app global state management made easy with hooks and Context API: 
https://link.medium.com/bZs5cKG6r1

How to achieve this:
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/s34zy9h1bfwc3t06yo5p.png)

You can read how it works on medium, or jump directly to the code:
https://github.com/Spyna/react-context-hook
Stockpile of Resources
Published: 2019-11-10 23:06:48


There is an endless supply of articles, tutorials, frameworks, etc out there on the internet. If nothing else, this is a catch-all for me to keep track of the resources I've come across that I imagine will help me out in the future. I'm currently thinking I'll refresh this single post often with my favorites, rather than turning it into a series. I would rather it evolve over time than expand.

*********************************************************
<h1><center> Let's get started! </center></h1>
*********************************************************


[Figma](https://www.figma.com) was approachable and perfect for copying SVG for the logo animation on my portfolio site. It's not as intense as [Gimp](https://www.gimp.org/), but I only scratched the service of the cool features on Figma and I expect to be using it quite a bit. 


[Zurb Motion UI](https://zurb.com/playground/motion-ui) is a SASS library for creating flexible CSS transitions and animations. It's really straight-forward and curated. I'm drawn to it for the assistance it provides in series animations. 


[GitPitch](https://gitpitch.com) sidetracked me for a few hours this week while researching slideshow options for my blog. I ultimately went with [Speaker Deck](https://speakerdeck.com/) to take advantage of the Dev.to liquid tags but I hope to put GitPitch to use ASAP.  


[Git Magic](http://www-cs-students.stanford.edu/~blynn/gitmagic/index.html) is something I just stumbled upon while looking into how to solve a Git mistake I made months ago. This may not have been updated in a couple years so just double-check anything you end up using!


[Markdown Guide](https://www.markdownguide.org/) may seem like a no-brainer, but for me the best tutorial or guide is often just the official docs. I also have no shame in my lack of memorized markdown, and intend to revisit this often.


[Shields.io](https://shields.io/category/activity) is another cool GitHub adjacent tool I found this week. These shields will help spruce up your README.md files! Speaking of README.md files, I was really into this generator I found over the last couple weeks. I even suggested a LinkedIn prompt and the team has already implemented it! 

{% link https://dev.to/kefranabg/generate-beautiful-readme-in-10-seconds-38i2 %}


[CSS Animation for Beginners](https://thoughtbot.com/blog/css-animation-for-beginners) has been a go-to article for me over the past couple weeks. I noticed it was published in 2014 so I almost skipped over it until I realized it has been updated in 2019! Once I used most of the tips, the following article made so much more sense and helped me a ton on a couple projects this week. 

{% medium https://medium.com/engineerbabu/a-detailed-guide-to-css-animations-and-transitions-b544502c089c %}


*********************************************************
<h1><center> That's all folks! </center></h1>
*********************************************************





[](https://)
[](https://)
[](https://)
[](https://)
What's New in Angular 9?
Tags: angular, typescript, angular9
Published: 2019-11-11 05:23:52

Angular 9 is the smaller, faster, and easier to use and it will be making Angular developers life easier. The fully version of Angular 9 will be released in the month of October/November 2019.

Added Angular 9 Features -
1. Added undecorated classes migration schematic in the core.
2. The formControlName also accepts a number in the form
3. Now allow selector-less directives as base classes in View Engine in the compiler.
4. Added support selector-less directive as base classes in Ivy and also make the Ivy compiler the default for ngc.
5. Convert all ngtsc diagnostics to ts.Diagnostics

Explore in detail-
https://www.code-sample.com/2019/08/whats-new-in-angular-9-angular-9-new.html
WEB COMPONENTS VS. FRAMEWORKS: A Podcast
Tags: javascript, webdev, typescript, todayilearned
Published: 2019-11-11 11:01:59

Happy Friday, Hackers! Today we've got some food-for-thought content for you! Davy and Danny discuss when to use PWAs vs. Native App or if you need an app at all and just a really responsive website. Continue to watch the FULL VIDEO on a discussion about web components vs. frameworks and much more! 

WATCH THE FULL VIDEO ON YOUTUBE: https://youtu.be/hfekHpHrFPM

Click below for Danny's article that went VIRAL:
 https://itnext.io/using-the-dom-like-a-pro-163a6c552eba

Danny's GitHub:
https://github.com/DannyMoerkerke/custom-element

Related Articles: 
https://dev.to/ionic/apple-just-shipped-web-components-to-production-and-you-probably-missed-it-57pf

🔥 PREVIOUS VIDEO • PODCAST ON HACKING A GROWTH MINDSET AND REACH YOUR GOALS
→ https://www.youtube.com/watch?v=YzNSTGCJqJI&t=233s 🔥

➡️Share this Video:
https://youtu.be/hfekHpHrFPM

📺Subscribe To Our Channel and Get More Great Tips
http://bit.ly/Subscribe2Hackflix

➡️ Ever wanted to learn about the tech industry and software engineering? Hackflix is your HACK to learning the tips and tricks, motivational stories and educational podcasts to guide you for your future in the industry. We aim to learn, inspire and share! So what are you waiting for? Check out all of our latest videos on https://hackflix.dev/

✅Make sure to Like, Favourite and Share this video and Subscribe if you haven't done so already at: https://bit.ly/Hackflix

🎬Watch our BRAND NEW series! Teach Me Anything in Less than 10 minutes!:

➡️Event loop in JavaScript & Web Workers
https://www.youtube.com/watch?v=zf6N5OcfxnU&t=11s

➡️Scaling Systems And Organising Teams
https://www.youtube.com/watch?v=HDMnUeX7pvU&t=18s

// Other Great Resources:
https://hackflix.dev/

⬇️Tweet us a Question!
https://twitter.com/hackflix_dev

👤Connect with us:
https://www.facebook.com/hackflix.dev
https://www.instagram.com/hackflix.dev
https://twitter.com/hackflix_dev
https://www.linkedin.com/company/hackflix

& For our developers out there:
https://dev.to/hackflix_dev
Mongodb replace external id after $lookup 
Tags: help
Published: 2019-11-11 10:43:52

Hi, im going crazy...

I want to replace the userId inside the comments with the real user after the $lookup, i tried in many ways, i tried to group but i cant really reach what i want

This is my field inside the page collection:

<pre>

"comments" : [
		{
			"user_Id" : ObjectId("aaa"),
			"content" : "aaaa",
			"rep" : [
				{
					"user_Id" : ObjectId("bbb"),
					"comment" : "bbbb",
				},
				{
					"user_Id" : ObjectId("ccc"),
					"comment" : "cccc",
				}
			]
		},
		{
			"user_Id" : ObjectId("ddd"),
			"content" : "ddd",
			"rep" : [ ]
		}
	]

</pre>

Users collection:

<pre>

"users" : [
		{
			"_id" : ObjectId("aaa"),
			"name" : "user1",
			"email" : "test1@test.com",
		},
		{
			"_id" : ObjectId("bbb"),
			"username" : "user2",
			"email" : "test2@test.com",
          }
]

</pre>

What result i was looking for:


<pre>

"comments" : [
		{
			"user" : {
			    "_id" : ObjectId("aaa"),
			    "name" : "user1",
			    "email" : "test1@test.com",
		        }
			"content" : "aaaa",
			"rep" : [
				{
					"userId" : {
			"_id" : ObjectId("bbb"),
			"username" : "user2",
			"email" : "test2@test.com",
          },
					"comment" : "bbbb",
				},
				{
					"user" : {
			                   "_id" : ObjectId("aaa"),
			                   "name" : "user1",
			    "email" : "test1@test.com",
		        },
					"comment" : "cccc",
				}
			]
		},
		{
			"user" : {
			"_id" : ObjectId("bbb"),
			"username" : "user2",
			"email" : "test2@test.com",
          },
			"content" : "ddd",
			"rep" : [ ]
		}
	]


</pre>

What i did so far:


<pre>

db.pages.aggregate([
    { 
        $match: { _id: ObjectId('abcbc') }
    },
    {
        $project: {
            comments: 1,
        }
    },
    {
        $lookup:
            {
                from: 'users',
                localField: 'comments.user_Id',
                foreignField: '_id',
                as: 'users'
            }
    }
]).pretty()

</pre>

Right now it gives me the correct users but it give me comments with all my comments and users with all matched users how can i replace the userId with the real user object inside rep too?
If i change inside the $lookup as into 'comments.user' it'll replace everything.
Some useful TypeScript snippets
Tags: typescript, productivity, codenewbie, tutorial
Published: 2019-11-11 15:53:25

## Pick
If you need to construct a new type based on some properties of an interface you always can get the `Pick` utility type. 

```typescript
interface MyInterface {
  id: number;
  name: string;
  properties: string[];
}

type MyShortType = Pick<MyInterface, 'name' | 'id'>;
```

Now `MyShortType` only have `name` and `id` properties extracted from `MyInterface`.

## Omit
One more useful transformer type as `Pick`, but `Omit` works to "another direction" and excludes properties from the given interface. Let's have a look at the example:

```typescript
interface MyInterface {
  id: number;
  name: string;
  properties: string[];
}

type MyShortType = Omit<MyInterface, 'name' | 'id'>;
```

This time `MyShortType` only has `properties` property, because the others are omitted from `MyInterface`.

## keyof
This is my favorite. Very useful for writing getters:

```typescript
interface MyInterface {
  id: number;
  name: string;
  properties: string[];
}

const myObject: MyInterface = {
  id: 1,
  name: 'foo',
  properties: ['a', 'b', 'c']
};

function getValue(value: keyof MyInterface) {
  return myObject[value];
}

getValue('id'); // 1
getValue('count') // Throws compilation error: Argument of type '"count"' is not assignable to parameter of type '"id" | "name" | "properties"'.

```

## Record

If you tried to write types to a plain object like this, you know it looks like a mess then:

```typescript
const myTypedObject: {[key: string]: MyInterface} = {
  first: {...},
  second: {...},
  ...
}
```

Better to achieve this by using shiny `Record` type:

```typescript
const myTypedObject: Record<string, MyInterface> = {
  first: {...},
  second: {...},
  ...
};

```

That's a bit neater to use Record rather than ugly `{[key: string]: ...}` construction isn't it?

## Bonus: Optional Chaining

This is a very useful feature. It is new in TypeScript since it released in 3.7. Almost every React Component has ugly code like this:
 
```jsx
<React.Fragment>
  {apiResult && apiResult.data && apiResult.data.params && apiResult.data.params.showOnline && (<div>✅ Online</div>)}
</React.Fragment>
```

Now you can do it like that (thanks to all the coding gods!):

```jsx
<React.Fragment>
  {apiResult?.data?.params?.showOnline && (<div>✅ Online</div>)}
</React.Fragment>
```
I hope these little snippets will help you a bit 🙃.
who into NLP? 📚
Tags: discuss, nlp, jsnotebooks, collections
Published: 2019-11-11 16:34:15

---
title: who into NLP? 📚
published: true
description: my ObservableHQ NLP collection
tags: #discuss #nlp #jsNotebooks #collections
---

For the NLP & Observable HQ [#jsNotebooks 📚](https://twitter.com/search?q=%23jsNotebooks&src=typed_query) fans out there:

https://observablehq.com/collection/@randomfractals/nlp

![NLP JS Notebooks](https://thepracticaldev.s3.amazonaws.com/i/fimm7feu8ftbcjjrlm40.png)

P.S: yeah, we killz in dataViz, NLP, d3, you name it! :) https://observablehq.com/@randomfractals/nlp-tag-tree?collection=@randomfractals/nlp

# Do you have NLP || jsNotebooks 📚 to share?

...
Jobless is better than in the wrong job. Insecurity is better than secure-but-with-caveats
Tags: life, choices, values
Published: 2019-11-11 17:41:29

Friday I took a decision, I did something I have never done before in my life: I put values ahead of money, fear and security. I decided that being jobless was better than being in the wrong job, furthering a really bad cause.

I had accepted a new job in the gambling sector. For a month, that did my head in. It's not something I can endorse, nor I can ignore. It's not a sector I believe should even exist.

After a month of internal struggles, fighting with the always-in-my-head-disappointed-father thought, I have spent a day thinking.

And I did turn around. I'd rather be 2 months jobless than have a pay that comes from that.

What happened after this? I had spent the week bedridden due to illness. It all cleared out within an hour after voiding the contract I had signed. I am now looking forward to December and January without a job. I have never taken more than 5 days off work over a year in my entire life, so this is now scary and exciting!

Be true to yourselves, be yourselves, be a good human.

Also this is my first ever post on DEV.TO!
Three layers of productivity and my recommends
Published: 2019-11-11 21:15:58

I think there are three layers in the productivity.

The first one is personal productivity, the second one is team productivity, and the last layer is the architecture(or organization) productivity.

# Personal Productivity
My recommends for boosting **personal productivity** in coding are TDD, knowing data structure and algorithm, and design pattern.
TDD stands for Test Driven Development and it improve my code and speed.
Knowing data structure, especially hash map, reduce my time for problem resolution.
And design pattern is applicable through any platform or any framework. Listener pattern can be used in mobile development, web development, and simple application anywhere.

# Team Productivity
Agile or Scrum is for boosting team productivity.
Kanban board is super useful for task management.
Retrospective makes us look back our process and improve it.

# Architecture Productivity
Micro Service is the best architecture for big products.
Many team can work in autonomous with freedom and responsibility.
Each team can use any technology and any programming language for the specific problem they want to solve.
They can innovate small.
It also reduce communication overhead.
disable view on laravel nova attach
Tags: laravel, nova
Published: 2019-11-12 07:44:31

to disable view on attach item add this to the resource that want to be disable to view

```
public function authorizedToView(Request $request)
{
    if($request->query->get("viaResource")) {
        return false; 
    }
    return true;
}
```

"$request->query->get("viaResource")" to find if the resource is accessed from other resource
5 Mistakes to Avoid When Building Your First Product
Tags: startup, beginners
Published: 2019-11-12 08:30:32


## Mistake #1 - Solving a problem that no one has (or that no one is willing to pay for)

[Paul Graham wrote](http://www.paulgraham.com/startupideas.html) about how trying to come up with a startup idea is a pretty bad way to come up with a good idea. You generate a bunch of plausible-sounding ideas (that superficially resemble products you’re familiar with) that are doomed to fail. To paraphrase Mark Twain, the difference between a plausible-sounding idea and a good idea is the difference between the lightning bug and the lightning.

## Mistake #2 - Writing off an idea because someone else has already done it

Facebook wasn’t the first social network, Google wasn’t the first search engine, and the iPhone wasn’t the first smartphone. More importantly, many markets are not monopolies and can easily support multiple products. The fact that someone built something similar to what you’re thinking about is a good thing. They proved it’s an economically viable idea, and you can learn from their successes and failures. The alternative (building something no one has made into a successful business before) is much riskier.

## Mistake #3 - Not having a marketing plan

If you build it, they won’t come. Go ahead, spend the next six months building something and put it out on the internet. No one will know it’s there unless you do something about it. For a product idea to be a good idea there has to be an economically viable way to gain new customers. Maybe that’s inbound traffic through blog posts (content marketing), maybe that’s Google Ads, or maybe that’s outbound cold calls. Regardless, without a viable channel, you don’t have a product idea - you have a fun project. Check out [Traction](https://www.amazon.com/Traction-Startup-Achieve-Explosive-Customer/dp/1591848369) to learn more.

## Mistake #4 - Not setting your sights low enough

With large markets comes lots of money. Thus, lots of competition, a large (required) marketing budget, and a relatively small number of viable business ideas (it’s hard to make something that everyone wants). It’s much easier to build something that’s perfect for a few thousand people. Better yet, once you have a target niche in mind it’s much easier to find ideas that will delight your customers.

## Mistake #5 - Not being remarkable

People are busy and won’t care about your little app. Cut through the noise and give them an experience they’ll remark about. [Seth Godin has written](https://seths.blog/2007/01/how_to_be_remar/) about this.

## Conclusion

A good way to find out if your product has legs is to build an MVP as quickly as possible and try to sell it (this is the premise of [The Lean Startup](http://theleanstartup.com/), which you should read). The longer you put that off, the more likely you are to be wasting your time. Even better, know that people will pay for it before you start to build it (get them to fund the development!).