teleren/devto huggingface dataset:
docker learn #07: A Tiny Post about Image Size & Run Times
Tags: docker, containers, devops
Published: 2019-11-23 04:24:35

---
title: docker learn #07: A Tiny Post about Image Size & Run Times
published: true
description: A series of posts by Alex Ortiz of Educative, as he learns Docker
tags: docker, containers, devops
series: docker learn
cover_image: https://thepracticaldev.s3.amazonaws.com/i/9ksmy8eoqzkj4vpqyw7w.jpeg
---

I have the tiniest of Docker Learn write-ups this week. 🙃

# Alpine Builds and Runs so QUICKLY

Suppose you try each of the following commands:

1. `docker run ubuntu`
2. `docker run fedora`
3. `docker run alpine`
4. `docker run golang`

The first two commands install images and run super short-lived containers based on Ubuntu Linux and Fedora Linux, respectively. The third one does the same, but on Alpine Linux. By now [I know](https://dev.to/alexoeducative/docker-learn-my-learning-journey-with-docker-02-2723) that Alpine is 10x smaller than Ubuntu, but running these commands really brought the point home about why that makes a difference.

With the first two commands, it took a few seconds for the Docker daemon to download the images before it could run the container. But the third image (Alpine) downloaded so quickly that I almost didn't even notice the progress bar for it in the Docker terminal. The fourth command, on the other hand, took longer to execute than the first three combined.

# `docker images` = `docker image ls`

If I run `docker images` or `docker image ls`, both commands will output the same thing:

```
$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
golang              latest              54e71dcafb7c        3 weeks ago         803MB
ubuntu              latest              775349758637        3 weeks ago         64.2MB
fedora              latest              f0858ad3febd        3 weeks ago         194MB
alpine              latest              965ea09ff2eb        4 weeks ago         5.55MB
```

This is a useful command, as I can now quickly compare the four images from above, by image size. The output seems to be sorted by image creation date rather than size. But it's still easy to compare the image sizes—and it's now obvious why the `alpine` image downloaded so quickly and the `golang` image so slowly, relatively speaking. Alpine was just 5.55 MB in size, compared to Golang's 803 MB.

By the way, `docker images ls -a` will also output the same information. (I don't yet know under what conditions this would not be the case)


And that's it! Until next week 👋🏾.
Learn Node.js from scratch: From Beginner to Advanced
Tags: node, javascript, webdev, tutorial
Published: 2019-11-23 04:23:27

Ultimate Node.js guide! Learn the basics and advanced of Node.js from scratch

Welcome to Node.js course. In this course you will learn about Node.js from scratch. We will assume that you are a complete beginner and by the end of the course you will be at advanced level. This course contain Real-World examples and Hands On practicals. We will guide you step by step so that you can understand better. By using this comprehensive course you will learn the basics of Node.js, Some of the advanced methods of Node.js programming and much more.

 **What you'll learn**
* Gain knowledgw about basics of node js
* Learn about Modules and File System
* Learn about NPM In Node js
* Acquire knowledge about Events 

{% youtube xcO7y3xGL8c %}
Getting Started with Microsoft SQL Server on Mac and Windows in 2020
Tags: sql, database, webdev, tutorial
Published: 2019-11-23 03:38:28

SQL for beginners 2020 - How to install Microsoft SQL Server on Mac and Windows with sample database

Do you want to learn a skill that can help you earn nearly $100,000 per year? If so, then this course is for you!

In this course, we will teach you how to install SQL Server 2017 Express edition for free on both Mac and Windows.

Then will teach how to connect to the SQL Server that you installed using Azure Data Studio.

And finally, will teach how to download and install a sample database(AdventureWorks) from the official Microsoft website for free which you can use in our next FREE course to learn SQL programming using real scenarios.

This course will be your first and most important step towards learning SQL programming on Microsoft SQL Server.

No prior knowledge is required - just a willingness to learn.

What you'll learn
* Getting Started Microsoft SQL Server on Mac and Windows in 2020 - Installation Tutorial (FREE)
* How to install SQL Server on Mac and Windows in 2020
* Docker download and Installation on Mac
* Kitematic download and Installation on Mac
* Docker Configuration for SQL Server on Mac
* Download and Install SQL Server 2017 Express edition on Mac and Windows
* Download and Install Azure Data Studio on Mac and Windows
* Download and Restore a sample database(AdventureWorks) to SQL Server on Mac and Windows

{% youtube _fcqMbx7Tq4 %}
My top 4 takeaways from Kubecon 2019
Tags: kubernetes, devops
Published: 2019-11-23 03:05:04

- When your pod is terminating, it takes a while for requests to stop hitting your pod. In your pod definitions, always have a `preStop` with `sleep 20` to allow Endpoint changes to propagate. After `preStop` is when Kubernetes hits your containers with a `SIGTERM`.

- Always have CPU requests. Be very wary of CPU limits -- don't add them unless you really need to. This allows your container to use more CPU when it's available. But when CPU pressure comes in, your app is guaranteed the amount of CPU cycles it requested.

- A corollary to the above: there is always tension between your cluster's utilization and stability. You can increase your utilization rate i.e. by increasing the difference between requests and limits. But that ups the chance of eviction. Reduce utilization, and you'll see less evictions. Find the balance for you.

- Automation is not the end-all-be-all. When your automation doesn't work, someone has to fix it after all.
What is the __construct Method Used For in PHP?
Tags: beginners, php, oop
Published: 2019-11-23 01:01:49

The `__construct` method is used to pass in parameters when you *first* create an object--this is called 'defining a constructor method', and is a common thing to do. 

However, constructors are **optional**--if you don't want to pass any parameters at object construction time, you don't need it.

Here's an example:
```php
    // Create a new class, and include a __construct method
    class Task {

        public $title;
        public $description;

        public function __construct($title, $description){
            $this->title = $title;
            $this->description = $description;
        }
    }
    
    // Create ('construct') a new object, passing in a $title and $description
    $task = new Task('Learn OOP','This is a description');
    
    // Try it and see
    var_dump($task->title, $task->description);
```
For more details on what a constructor is, see [the manual](http://php.net/manual/en/language.oop5.decon.php).
[Need Help] Getting data using Axios does not work for some URLs
Tags: help
Published: 2019-11-23 00:25:52


I have a simple express app with "index.js package.json" in a folder.
I have installed all the required libraries.

I am not getting why the below code does not work with the Github API URL but works for the jsonplaceholder.typicode.com URL. Can someone help with this ?

index.js
========
const express = require('express');
const cors = require('cors');
const axios = require('axios');
axios.defaults.withCredentials = true;

const app = express();
app.use(cors());

app.get('/api', (req, res) => {
        // const url = `https://jsonplaceholder.typicode.com/todos`;
        const url = `https://api.github.com/users/memahesh`;
	axios.get(url, { headers: { 'Access-Control-Allow-Origin':  '*'  } }).then(response => {
		res.json({data: response.data});
	});

});


const PORT = 5000;

app.listen(PORT, () => console.log(`Listening on port ${PORT}`));

Console Log:
============
(node:1912) UnhandledPromiseRejectionWarning: Error: connect ETIMEDOUT 13.233.76.15:443
[0]     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1129:14)


Thanks in advance,
Day #2 of #30DaysOfWebPerf
Tags: imagelazyloading, sitespeed, userexperience, performance
Published: 2019-11-22 23:43:59

---
title: Day #2 of #30DaysOfWebPerf
published: true
description: Dealing with images - Optimizing your images
tags: image lazy loading, site speed, user experience, performance
---

{% twitter 1198021282358386688 %}{% twitter 1198021286376529921 %}{% twitter 1198021287622275073 %}{% twitter 1198021291116072965 %}{% twitter 1198021292466696192 %}{% twitter 1198021293297160192 %}{% twitter 1198021304001056768 %}{% twitter 1198021305519312896 %}{% twitter 1198022456100843520 %}{% twitter 1198022457933778945 %}
Day 40 : All Of Us
Tags: hiphop, code, coding, lifelongdev
Published: 2019-11-22 23:30:26

_liner notes_:
- Professional : Got the prize wheel application functioning. I can now create create contests and have people enter in on a website, the names display in real time on the prize wheel and in the admin panel. I can activate the spinner on the prize wheel from the admin panel. Once the winner is selected, their name is shown on the prize wheel and added to the admin panel. A notification is also sent to the contestants pages to let them know if they won or not. Just have a few things I want to work out like clean up and refactor the code, do some error handling and some other things. I think this could be an application that all of us could use. Also had a meeting with the Client SDK team to plan out what we've got coming up. Hung out virtually with some other team members later in the afternoon. Pretty eventful day!

- Personal : After work, mowed my lawn. Did my laundry. Going to finish out the night working on the radio show and my side project.

![Mountain side view of the lake in Crater Lake, Oregon](https://thepracticaldev.s3.amazonaws.com/i/htrlpdt7y95mnp8j0dea.jpg)

This weekend should be a full one. I want to try and get to the station as early as possible so that I can test out Stadia. They have super fast internet. There's also a show I may attend after the radio show. Sunday, I want to get a bulk of my personal side project done.

Have a great weekend!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube l71LCn5m7uM %}
📚📚📚 What's on your dev.to Reading List? Please share it!
Tags: dev, discuss
Published: 2019-11-22 23:07:31

I guess it would be awesome to see, what everyone has planned to read, but not done so far. So please share your **dev.to Reading Lists**!


## How?
Scroll through your Reading List, open the console, run the following snippet and copy the results in the comments to share your own Reading List!

```js
Array.from(document.querySelectorAll('.item'))
  .map(a => `[${a.querySelector('.item-title').innerHTML}](${a.href})`)
  .reduce((acc, e) => `${acc}\n* ${e}`, '');
```

## My Reading List

Usually, I save a lot of stuff to read later - and I never read it. It was like that was my pocket reading list, where I saved >1k articles, but never read them. My dev Reading List is currently quite small. So by sharing yours, I'm pretty sure, I'll find some nuggets to extend mine.

* [Book review: The Unicorn Project](https://dev.to/raoulmeyer/book-review-the-unicorn-project-j95)
* [Microfrontends based on React](https://dev.to/florianrappl/microfrontends-based-on-react-4oo9)
* [19 Takeaways From React Conf 2019](https://dev.to/amorriscode/19-takeaways-from-react-conf-2019-2m36)
* [Invented here syndrome](https://dev.to/mortoray/invented-here-syndrome-4mg8)
* [🔥 Svelte Crash Course (in 10 pics!)](https://dev.to/hexrcs/svelte-crash-course-with-pics-27cc)
Gatsby vs Next.js vs create-react-app ⚔️ - what are they and what are the differences?
Tags: nextjs, gatsby, react, javascript
Published: 2019-11-22 22:41:20

If you're a web developer you've probably heard at least about one of them. If you're doing react, I'm pretty sure, that you heard of them all. And you might have wondered what the differences are. Let's clarify these here.

Gatsby, Next.js, and create-react-app are systems to build React applications without having to handle the bundling of the app e.g. via webpack yourself. They help you to set up and run React applications quickly.

## Gatsby

Gatsby is a static site generator. That means, that your pages will be prepared at build time, not on runtime. For a lot of use cases that's sufficient. E.g. for a forum it might be a bad choice because you would have to run your static site generator every time a forum post was done. The advantage is, that these pages are usually very performant. That's especially good for SEO nowadays. So static site generators are a good choice for landing pages or your blog, where content doesn't change often.

Gatsby is quite opinionated and you have to use graphQL. That might be the right thing for you, but it also might not. 

Another big advantage of Gatsby is the vast ecosystem of plugins. From using Google Sheets as a CMS, to converting images, implementing analytics or newsletter integrations. You'll find a lot. Therefore Gatsby seems to be one of the most powerful Wordpress contenders. Especially because it has a pretty good SEO score out of the box.

## create-react-app

create-react-app is a nice tool for react development because you can basically start developing your React application with zero configuration. 

It's not necessarily meant for running apps in production, though that's definitely possible. The main problem is, that it doesn't render pages on the server. It only supports **client-side rendering**. This might be an issue if you need a highly performant site, or if SEO is a big topic for you. There are still some benefits to server-side rendering. If you need these, you should have a look at Next.js.

## Next.js

Next.js applications are rendered on the server-side (SSR) and on the client-side (CSR). If a static page is not enough for your needs and you need SSR, then Next.js might be the right choice for you. 

It has some nice concepts like file system routing (you can just create files in that pages folder, that will then be actual server and client-side routes in your application) or an integrated zero-config CSS-in-JS solution, which you can optionally use (`styled-jsx`).

It's super simple to start, develop and even host. For every dynamic page, Next.js might be the best choice in react land, if you don't want to write your own bundling, code splitting, etc.

---

Please follow me, if you're interested in web development topics like this one, especially if you're interested in **Next.js** or **GatsbyJS++, because I'm going to write a series on each, that will also appear on [my blog](https://codesnacks.net).

Thanks for reading!
The Unknown Powershell Cmdlets Everyone Should Know About
Tags: powershell, productivity
Published: 2019-11-22 22:31:20

---
title: The Unknown Powershell Cmdlets Everyone Should Know About
published: true
date: 2019-11-22 21:56:43 UTC
tags: powershell, productivity
canonical_url: https://erickguillen.dev/post/the-unknow-powershell-cmdlets-everyone-should-know-about/
cover_image: https://thepracticaldev.s3.amazonaws.com/i/awpzprnza1dj4vxya8nu.png
---

Have you ever thought...I wish I have known this earlier!? With PowerShell, it is pretty common not to be aware of some of the features or options it has. It takes the time to read the documentation and at the time you (I) find a way to do X, you (I) will probably skip reading the documentation.
However, across experience and seeing others code, I have found some cmdlets, I wish I have known before! and it seems not everybody knows about them!
Today, I want to share these little secrets that have made my Powershell time a lot more enjoyable and hopefully make your life a bit easier.


## Show-Command

```powershell
Show-Command Set-Content
```

Yes...that's right! Now you have auto-generated GUI for any cmdlet you want, even the ones from custom modules! This comes pretty handily with some of the cmdlets you are not used to.

![ShowCommand Screenshot](https://thepracticaldev.s3.amazonaws.com/i/4zb7ryqt6ilpd8pspr5r.png)

When you click "run", it actually copies the GUI inputs to your command line! So you can just copy and paste the code to a script if needed.
```powershell
Set-Content -Path test.txt -Value HelloWorld
```

If you need extra help with the parameters or the cmdlet click the "?" button at the top right corner to get some extra help!
## Get-Help -ShowWindow

```powershell
Get-Help Get-Process -ShowWindow
```

If you use PowerShell you must know about the `get-help` command, but some people don't know it has a parameter flag call `-ShowWindow`.
This is pretty handy to get the full help of command, get search bar and even Zoom! (sometimes PS font-size is too small when I'm tired).

![Get-Help ShowWindow Example](https://thepracticaldev.s3.amazonaws.com/i/1fq30nyaxx4w95w31a9w.png)

## Out-GridView

```powershell
Get-Process | Out-GridView
```

Sometimes you are working with a LOT of data, and maybe you want do to a manual quick scan and filtering before writing the next piece of code. Well, `Out-GridView` will help you through just that!

![OutGridView Example](https://thepracticaldev.s3.amazonaws.com/i/6lyd2m1gtif40e7hy1i9.png)



## Invoke-Item

```powershell
# You can also do "ii ." for short
Invoke-Item .
```

You just got an explorer window on your current path!

## What's Next?

Now you have a new few tools to play in Powershell! I encourage you to keep exploring PowerShell, `get-help` with some `*` here and there is a great way to find out new things. Hope you enjoy this post, See you next time!
seo vs content marketing 
Tags: seo, webdev
Published: 2019-11-22 21:52:13

SEO and content marketing have now changed the digital marketing world. SEO refers to the technical process of attracting maximum visitors to a website but content marketing is to focus on valuable content to get profitable customers. SEO without content marketing is like a body without a soul. People use content writing to cover a lot of ground quickly. In order to introduce the product or brand, they will find a way to gain the attention of viewers. Content writing includes sales pages, ads, direct mail, landing pages. But content marketing is all about providing value to viewers to gain their trust and loyalty. Similarly, different enterprises use content writing for cost savings and increase their sales.
TypeScript and C# both were created by the same person named Anders Hejlsberg 👏 💪 🔥(with video)
Tags: typescript, csharp, opensource, oop
Published: 2019-11-22 21:14:39

I went to one TypeScript meetup recently and talked to a few developers there.

Surprisingly, a lot of people don't know that both languages were designed by the same person.

Yes, his name is <b>Anders Hejlsberg</b>
[https://en.wikipedia.org/wiki/Anders_Hejlsberg](https://en.wikipedia.org/wiki/Anders_Hejlsberg)

He also created Turbo Pascal and Delphi :open_mouth:

He was invited to JavaScript Air Podcast in 2016 along with the creator of FlowType Jeff Morrison.

It's an old video which I watched when it was released. I request all to watch this too.

{% youtube Qiqsg02nXFE %}

And some fun things are - TypeScript has really a lot of similarities to C#

If you already know TypeScript, I would say please check out C# for few hours or vice versa!

TypeScript is getting a lot of Popularity and I think knowing a bit of them could be a benefit.
Happy learning :nerd_face:

Cheers!
:wave:

As I am trying to contribute contents on the Web, you can buy me a coffee for my hours spent on all of these ❤️😊🌸
<a href="https://www.buymeacoffee.com/destromas" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" style="height: 51px !important;width: 217px !important;" ></a>
The Lazy Desk-Worker Diet
Tags: health, wellness, lifestyle, fitness
Published: 2019-11-22 20:36:47

In my 20s, I had an enviable metabolism. I gobbled down donair pizza, Chinese food, zesty cheese Doritos, chocolate chip cookies, and all other manner of university student comfort food--hardly gained a pound! 

Now in my early-40s, my body protests. I'm a sedentary desk-worker facing down classic middle-age spread.

A little over a year ago, my weight peaked. I was 50+ lbs heavier than in my younger years. 

*\*grumble\* ...now where did I put that bag of chips?!*

This spring, my family physician gave me a stern talking to. I had dropped a few pounds as often happens when winter breaks and spring...well...springs; however, my cholesterol numbers were slipping. 

*Hmmm... My father had a stroke in his 40s. I sit in front of a computer all day fuelling myself with coffee and sugar. Maybe it's time I take my health more seriously.*

I started to...

Last week, I checked in again with the doctor: Good news; my cholesterol is improving. Doubly good news; my resting heart rate and blood pressure have come down. Triply good news; I've dropped 30 pounds in the last nine months.

So what is my secret, you may ask? Stay lazy.

Yes, laziness! I'm still largely sedentary, sitting behind a desk 8 hours each day. I don't work out. I've never set foot in a gym in my life and, frankly, I don't have time for a regimented exercise routine.

What I have done is make a few low-effort, high-reward changes to my daily routine:

* No snacking within 2 hours of bedtime
* Be mindful of simple carbohydrates (Until recently, I ate a peanut butter and jelly sandwich every. single. day. for lunch.)
* Replace one snack with raw fruit or veg (But I'm not militant. If I've eaten my carrot sticks, I'm still allowed to eat a donut--but just one, not three!)
* Walk an extra 1000-2000 steps each day (None of this 10K steps/day business. I take my dogs around the block before work each morning. Combined with regular daily activity gets me to 6000 steps, and that's plenty.)

Nothing Earth-shattering. Nothing that requires much effort. Easy, really. Just what we desk-workers need!

So, if you're like I was, letting your health sag while spending copious amounts of time at your desk; know that it's possible to feel better.

Make a tiny change. Improve your health. Stay lazy! ;)