teleren/devto huggingface dataset:
Keep Docker alive during docker daemon downtime
Tags: docker, containers, linux
Published: 2019-08-08 21:56:59

---
title: Keep Docker alive during docker daemon downtime
published: true
description: How to keep docker alive when docker daemon is down.
tags: docker, containers, Linux
---

When the docker daemon terminates by default it shutdowns the running docker containers. From Docker Engine 1.12, you can configure the daemon so that containers remain running even if the daemon becomes unavailable. 
This functionality is named is **live restore**. The live restore option helps reduce container downtime due to daemon crashes, planned outages, or upgrades.

### How do we enable live restore?

There are two ways to enable live restore 

- Add the configuration to the daemon configuration file. On Linux, this defaults to /etc/docker/daemon.json

    Use the following JSON to enable live-restore.

     ```
      {
         "live-restore": true
       }
     ```
     you can restart the docker daemon now. If you are using systemd, then use the command *systemctl reload docker*. 

- you can also start the dockerd process manually with the --live-restore flag.


###Impact of live restore on running containers

If the daemon is down for a long time, running containers may fill up the FIFO log the daemon normally reads. A full log blocks containers from logging more data. The default buffer size is 64K. If the buffers fill, you must restart the Docker daemon to flush them.

On Linux, you can modify the kernel’s buffer size by changing /proc/sys/fs/pipe-max-size.

### Live restore and swarm mode

The live restore option only pertains to standalone containers, and not to swarm services. Swarm services are managed by swarm managers. If swarm managers are not available, swarm services continue to run on worker nodes but cannot be managed until enough swarm managers are available to maintain a quorum.

### Live restore during upgrades

Live restore supports keeping containers running across Docker daemon upgrades, though this is limited to patch releases and does not support minor or major daemon upgrades.

If you skip releases during an upgrade, the daemon may not restore its connection to the containers. If the daemon can’t restore the connection, it cannot manage the running containers and you must stop them manually.

### Live restore upon restart

The live restore option only works to restore containers if the daemon options, such as bridge IP addresses and graph driver, did not change. If any of these daemon-level configuration options have changed, the live restore may not work and you may need to manually stop the containers.
Understanding timezones
Tags: timezones, mysql, time
Published: 2019-08-08 21:53:25

---
title: Understanding timezones
published: true
description: playing with time
tags: timezones, mysql, time
---

Recently I was assigned to create a filter in an API that give you for a specific time span only events that occured at either AM or PM (by passing a timezone). Luckily in our database except from the epoch time we also had a Date type field and a Time type field.

The Time type is special, as it is designed to store not specifically and only the time of the day but also elapsed time during two events. 

In the later case time can take values from -838:59:59 to 838:59:59.

Also its not valid to do a search from 23:00:00 to 01:00:00, but rather need to do from 
23:00:00 to 23:59:59 and
00:00:00 to 01:00:00


so depending on the timezone we had to project, the time zone AM and PM zones to UTC and split accordingly. 

So I ended creating the follow graph with a colleague, which made things really easy and I thought it would be a nice idea to share it.

![](https://thepracticaldev.s3.amazonaws.com/i/5j2vcg5rezj7sny8bw10.png)
About Bryan Ziegenfuse

Tags: bryanziegenfuse
Published: 2019-08-08 16:15:16

Bryan joined iFP in December of 2018 following a diversified 15 year career as an executive across the lending, capital markets, finance and portfolio management disciplines. Prior to iFP, Bryan was Vice President of Strategy at Ocwen Financial Corporation. Bryan lead numerous corporate initiatives across risk management, capital preservation, customer experience and asset management during his tenure at Ocwen.  Additionally, Bryan managed key government relationships for the company.  Prior to Ocwen, Bryan held several positions at GMAC Mortgage (Ally Financial) from 2005 to 2013, including Director of Restructuring, Senior Fixed Income Trader and Director of Finance.  Bryan holds a Bachelor’s of Science in Finance from Pennsylvania State University. 
Bryan lives in Wayne, PA with his wife and two young children. When not in the office, Bryan enjoys spending quality time outside with the family either at home or at the beach.
Awesome Libs: pipx
Tags: python
Published: 2019-08-08 21:36:44

(Originally posted on [my blog](https://humberto.io/blog/awesome-libs-pipx/))

I'm starting this series of posts to give you tips on libraries that can be handy on your day to day as a Developer and also to present libraries I think you should keep on eye on.

One of the perks of a good Developer is having a proper tool-set available on your belt, and nothing more appropriate to start this series than a library that installs other libraries!

How many times did you install some Python CLI tool inside of a Python virtualenv? Have you ever updated some tool dependency and if make another library stop working because it relied on a common dependency?

If you like organization, stability and to not repeat yourself [pipx](https://pipxproject.github.io/pipx/) is an **awesome lib** for you.

![organized kittens image](https://thepracticaldev.s3.amazonaws.com/i/qtnubkw6jwf6t38r1czm.jpg)

Pipx is a handy tool to isolate your Python programs into separate environments, exposing their entry points so you can run them from anywhere.

You can also easily upgrade the installed packages without having a conflict between dependencies and have some useful tools like [nox](https://nox.thea.codes/en/stable/), [flake8](http://flake8.pycqa.org/en/latest/), and [black](https://black.readthedocs.io/en/stable/) installed once on your system (no more installing it on every single virtualenv that you create).

To install pipx you have to run:

```console
$ python3 -m pip install --user pipx
$ python3 -m pipx ensurepath
```

The second command is to ensure that you'll have CLI access to run the programs installed with pipx.

Now, you can install your favorite Python tools in isolated environments and have fun \\o/

```console
$ pipx install pyjokes
$ pyjoke
There are two ways to write error-free programs; only the third one works.
```
I'm writing a book about Django -- What do you want to learn?
Tags: python, django, api, showdev
Published: 2019-08-08 21:04:56

---
title: I'm writing a book about Django -- What do you want to learn?
published: true
description: 
tags: python, django, api, showdev
cover_image: https://images.unsplash.com/photo-1541478350962-8afa7f7ad168?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1920&h=1080&fit=crop&ixid=eyJhcHBfaWQiOjF9
---

Hi folks!

In my [previous post](https://dev.to/jamestimmins/why-we-re-writing-a-django-book-specifically-for-portfolio-projects-and-mvps-463i), I talked about the book I'm working on that covers building and deploying Django APIs for MVPs and portfolio projects.

Now that I'm a few chapters in, it seems like a good time to check back in with folks to hear their additional thoughts and get feedback on our overall direction.

If anyone is learning Django, has learned Django, wants to learn Django, or tried and was intimidated, it would be really helpful to hear your thoughts and specifically what was challenging or confusing when you were first starting out.


If you click [this link for a Typeform feedback form](https://jamestimmins.typeform.com/to/sx9t94), you can fill out a few questions and share your thoughts.

Assuming that enough people respond, in a few weeks I will share the results and my up-to-date outline for the book and how it incorporates that feedback.

Thank you so much!

---
If you're interested in following me you can do so at [@jamestimmins](https://twitter.com/JamesTimmins), and if you'd like to hear more about the book you can sign up for updates at [the official site](https://www.fullstack.io/fullstack-django).
Angular 9|8 Show Image Preview with Reactive Forms Tutorial
Tags: angular, angular98, reactiveforms, react
Published: 2020-01-31 20:40:01

---
title: Angular 9|8 Show Image Preview with Reactive Forms Tutorial
published: true
tags: Angular, Angular 9|8 , Reactive Forms, React
canonical_url: https://www.positronx.io/angular-8-show-image-preview-with-reactive-forms-tutorial/
---

The post [Angular 8 Show Image Preview with Reactive Forms Tutorial](https://www.positronx.io/angular-8-show-image-preview-with-reactive-forms-tutorial/) appeared first on [positronX.io](https://www.positronx.io).

Today in this Angular 8 tutorial, we are going to understand how to **show image preview before uploading** to the server in Angular app. We will take the help of the HTML input element to upload the selected image. I have come across a straightforward method through which we can show the image preview to the user before uploading image to the server.

We will also learn to apply validation for uploading only images using HTML5 `new FileReader()` api.

 [click here to read more](https://www.positronx.io/angular-8-show-image-preview-with-reactive-forms-tutorial/)
Composition over encapsulation
Tags: oop, inheritance, encapsulation, discuss
Published: 2019-08-08 19:17:02

---
title: Composition over encapsulation
published: true
description: Choosing composition over inheritance may weaken encapsulation
tags: oop, inheritance, encapsulation, discuss
---
A big problem with inheritance is that it easily gets out of hand a becames an unmaintainable mess. It very quickly becomes a tree that reaches out to all different directions. Also, when you change a class, it may have unexpected side-effects on inheriting objects. 

Many times you hear that you should prefer composition over inheritance. I definitely get that. It tackles a lot of problems what inheritance causes.

But what about encapsulation?

```java
abstract class Report
{
    abstract protected function title(): string;
    abstract protected function contents(): string;

    public function display(): string
    {
        return sprintf('%s\n%s', this.title(), this.contents());
    }
}

class SalaryReport extends Report
{
    private string title;
    private array salaries;

    public function constructor(string title, array salaries)
    {
        this.title = title;
        this.salaries = salaries;
    }

    protected function title(): string
    {
        return this.title;
    }

    protected function contents(): string
    {
        return this.salaries.join('\n');
    }
}
```

If i'd choose composition over inheritance, i would have to loosen the encapsulation of `SalaryReport.title()` and `SalaryReport.contents()` to public. The code would turn into this.

```java
interface ReportData
{
    public function title(): string;
    public function contents(): string;
}

class Report
{
    private ReportData reportData;

    public function constructor(ReportData reportData)
    {
        this.reportData = reportData
    }
    public function display(): string
    {
        return sprintf('%s\n%s', this.reportData.title(), this.reportData.contents());
    }
}

class SalaryReportData implements ReportData
{
    private string title;
    private array salaries;

    public function constructor(string title, array salaries)
    {
        this.title = title;
        this.salaries = salaries;
    }

    public function title(): string
    {
        return this.title;
    }

    public function contents(): string
    {
        return this.salaries.join('\n');
    }
}
```

Now `SalaryReport` isn't a real object anymore since it really hasn't got any notable behaviour, it's just data. Of course you could argue that `Report` doesn't do much either, but for the sake of the example let's go with this.

How can i use composition over inheritance without weakening encapsulation and turning my objects into data structures? It seems both approaches have severe drawbacks.
What's Your Favorite Way to Cook/Eat Ramen?
Tags: watercooler, food, lunch
Published: 2019-08-08 17:57:19

So, I am talking here about the stuff you buy in packages or cups at the grocery store/asian market for 35 cents (sometimes more). Do you add interesting ingredients to yours? Do you use it to create other dishes? 
My favorite way to eat ramen is to prepare it with less than two cups of water(the broth is a little more flavorful that way) and add a sprinkle of Tony Chachere's just before eating it, and Manchuren is my favorite...chicken or chicken tortilla! It must be al dente...I don't like mushy noodles! What about you?🍜
Using jQuery with Angular 6. Is it best practice?
Tags: angular, jquery
Published: 2019-08-08 18:25:17

Hi There,

We are currently building an application in angular and node. Part of our application involves a calendar with a drag and drop functionality where events can be moved between the different days. We have recently found out that the development team has build this functionality by using jQuery instead of Angular. 

From what I have researched so far, using jQuery in an Angular platform is bad practice and can make the platform more complicated for management and updates. I haven't found anything on what this impacts on security either but it would be great if anyone can share any feedback with regards to this. 

So questions are if anyone can help:

1. Is it possible to build the above functionality in Angular without using jQuery?

2. Is it advised to use jQuery with Angular?

3. Are there any security implications for using jQuery with Angular? (for example also in the scenario if there are scripts that have jQuery libraries even that aren't used on the platform but are contained with another script)

Many Thanks in advance!
How does knowledge proliferation works where you work?
Tags: discuss
Published: 2019-08-08 18:24:10

---
title: How does knowledge proliferation works where you work?
published: true
description: How does knowledge proliferation works where you work?
tags: #Discuss
---

Keeping people in touch with all that the company is using in terms of technology(IAC, Microservices, patterns, problems, solutions) is pretty hard, principally if you work on a big company, that's why I ask this question, what do you usually do and what you think it would be better?

In my opinion, platforms like eng.uber.com or medium.com/airbnb-engineering are the best situations, as not only you show what you are doing to your company, you show to the world, bringing attention to your company as a technology "hotspot".

But sometimes the communication between teams is pretty bad, and for example, your team have a problem that another team has already solved and your team has no clue about that.
Top 10 Static Code Quality Analysers for ASP.NET Core
Tags: csharp, dotnet, aspdotnetcore, analyzers
Published: 2019-08-08 18:00:56

**FXCopAnalyzers**

Created by Microsoft, a set of analyzers, called Microsoft.CodeAnalysis.FxCopAnalyzers, that contains the most important "FxCop" rules from static code analysis, converted to Roslyn analyzers. These analyzers check your code for security, performance, and design issues, among others.

You can install these FxCop analyzers either as a NuGet package or as a VSIX extension to Visual Studio. 

https://www.nuget.org/packages/Microsoft.CodeAnalysis.FxCopAnalyzers


**StyleCopAnalyzers**

An implementation of StyleCop rules using the .NET Compiler Platform. It helps in enforcing standard style for code.

https://www.nuget.org/packages/StyleCop.Analyzers/

**Security Code Scan**

Detects various security vulnerability patterns: SQL Injection, Cross-Site Scripting (XSS), Cross-Site Request Forgery (CSRF), XML eXternal Entity Injection (XXE), etc.

https://security-code-scan.github.io/

**Web API analyzers**

ASP.NET Core 2.2 and later includes the Microsoft.AspNetCore.Mvc.Api.Analyzers NuGet package containing analyzers for web APIs.

https://www.nuget.org/packages/Microsoft.AspNetCore.Mvc.Api.Analyzers

**SonarAnalyzer**

Analyzers which spot bugs and code smells in your code. 

https://www.sonarqube.org/
https://www.nuget.org/packages/SonarAnalyzer.CSharp

 
**Lindhart.Analyser.MissingAwaitWarning**

When using dependency injection and async-await pattern it is possible to end up with an interface with a method that returns a Task. If this interface method is used in a synchronous method there is a likelihood that it will erroneously be run like a fire and forget method. In this situation, this analyzer generates a warning.

https://www.nuget.org/packages/Lindhart.Analyser.MissingAwaitWarning

**NSubstitute.Analyzers.CSharp**

Provides diagnostic analyzers to warn about incorrect usage of NSubstitute in C#.

https://www.nuget.org/packages/NSubstitute.Analyzers.CSharp

**xUnit.net [Code Analyzers]**

Code Analyzers for projects using xUnit.net that help finds and fix frequent issues when writing tests.

https://www.nuget.org/packages/xunit.analyzers


**Microsoft.CodeQuality.Analyzers**

CodeQuality Analyzers

https://www.nuget.org/packages/Microsoft.CodeQuality.Analyzers


**Microsoft.CodeAnalysis.VersionCheckAnalyzer**

Microsoft.CodeAnalysis Version Check Analyzer
https://www.nuget.org/packages/Microsoft.CodeAnalysis.VersionCheckAnalyzer

Few more analyzers - https://github.com/dotnet/roslyn-analyzers
How was your last on-boarding experience as a new employee?
Tags: discuss, career, help
Published: 2019-08-08 17:34:57

---
title: How was your last on-boarding experience as a new employee?
published: true
cover_image: https://thepracticaldev.s3.amazonaws.com/i/yarur0rxbnoynkjg72vl.png
tags: discuss, career, help, 
---
Hey techies!🚀 I'm cooking a new workshop for **Google Actions** (actions sdk, dialogflow) and in preparation want to get your thoughts on something.

📍We've all gone through the on-boarding experience as new employees with a company.

I want to know what kind of **information** you received that was useful and what kind of information you wish you would have received but didn't.

📍Ex: finding info about other teams, where the cafeteria is, where the restroom is, where is the HR team, what kind of benefits you have, etc

Comment below and help me shape this workshop.

Thanks🙏
Your insights will be greatly appreciated!
GitHub Actions now includes our most-requested feature: built-in CI/CD and it’s free for open source
Tags: github
Published: 2019-08-08 17:24:36

With GitHub Actions now it easy to automate all your software workflows, with world-class CI/CD. Build, test, and deploy your code right from GitHub. Make code reviews, branch management, and issue triaging work the way you want.

sign up for beta ..

https://github.com/features/actions
THE HOTTEST AND BIGGEST GRAPHIC DESIGN TRENDS OF 2019
Tags: design, devops, graphql
Published: 2019-08-08 17:22:18

Now with the increased use of mobile screens and online platforms, the designers and brands only have a few seconds to anchor down the attention of the targeted audience. With extensive advertising and product marketing, the chances of making a lasting impression on the potential business prospects are lessening every day. Where only a few businesses and brands succeed in making an impact on the minds and perceptions of the customers, engaging your audience with attractive content and design contributes a lot in that regards.

For that very reason, many designers use online tools and apps like logo Xfinity and logo maker to create compelling designs and brand identities. Whether you are a new business looking for a brand-new business identity or an established firm looking for a brand refresh, having a clear idea about the graphic design trends is of crucial importance. Here are some of the most popular trends that will dominate the graphic design industry in the year 2019:

• Be bold with typography:

Undeniably, typography is one of the critical aspects of graphic designing. However, this year is all about proper and thoughtful us of primary elements to give a bold and powerful impression to your graphic design. You can browse the categories and option available on various tools and apps like <a href="https://www.logoxfinity.com/">logo Xfinity</a> to get a better die about bold typography.

• Contrasting schemes:

This trend is all about giving your graphic design a visual pop by using the combination of light and dark-colored schemes and themes. Be careful with the contrast ratio and give your design and come up with a design elevated visual appeal and even higher design readability and understandability.

• Vividness:

Whether you are creating logo Xfinity graphic design or high-quality logo, going bold with color selection is what this trend is all about. Where color plays a crucial role in evoking the right emotion, it also adds to the visual appeal of the design and overall design feel.

• Three-dimensional:

With global appreciation of the 3D effects, this graphic design trend allows the graphic designers to add meaning and depth to their logo Xfinity designs. However, extensive use of this effect is not a suggestible idea.
Autotools vs Cmake
Tags: discuss
Published: 2019-08-08 17:21:12

I have used **autotools** since I started programming on Linux and got used to the whole process. When you first encounter **autotools**, you are bombarded by numerous scripts and files and can get intimidated very quickly. When you manage to get yourself together, you begin to realize that there are only **TWO** files that need editing; **configure.ac** and **Makefile.am**.

**Cmake** has always managed to irritate me and cause an overall feeling of disgust. I know that many famous open source projects use **Cmake** and would like to know your opinion whether I should start using **Cmake** for my next **C** project, or continue with well known **autotools**. I don't plan to support any other platform but Linux (x86 and ARM embedded systems).

Thank You,
Comment away ;)