Tag:decorate

  • Principle analysis of Redux

    Time:2021-12-8

    Introduction to Redux Redux is a predictable state manager for JavaScript applications. Design patterns in Redux Decorator mode Definition: decorator pattern is used to dynamically add responsibilities to objects. Let’s take a look at the GitHub code of the earliest Redux (v0.2.0): //Counter.js import React from ‘react’; import { performs, observes } from ‘redux’; @performs(‘increment’, […]

  • For you who are new to using nestj as a project (three articles: writing API & uploading pictures)

    Time:2021-10-18

    For you who are new to using nestj as a project (three articles: writing API & uploading pictures) Module 1. Like we wrote beforeuserController for(controller)And services(service)In fact, they should be regarded as a whole. For example, they should be introduced somewhereuserRelated operations, direct introductionUser’s moduleOK, let’s start from scratchmoduleTry it. nest g module modules/users nest […]

  • [design mode] decorator

    Time:2021-10-13

    Introduction to decorator mode The core of the decorator is to add new functions to the class without changing the original class. It can avoid too many subclasses caused by inheritance and the complexity brought by AOP. The decorator mainly solves the problem of subclass expansion due to the continuous horizontal expansion of functions under […]

  • Providers in angularjs: differences between service and factory

    Time:2021-10-2

    introduction After reading a lot of articles, I may still not be able to sayAngularJSCreate suppliers in(provider)Method of(factory(),service(),provider())What’s the difference, when and what to use? I’ve been foolishly confused before. Now let’s sum up. In the following, general references are uniformly used in Chinese, and English refers specifically$provideMethod is created by the corresponding method Supplier […]

  • Django 1.8 official document translation: 3-1-4 view decorator

    Time:2021-9-15

    View decorator Django provides several decorators for the view to support related HTTP services. Allowed HTTP methods django.views.decorators.httpThe decorator in the package can restrict access to the view based on the requested method. If the conditions are not met, it will returndjango.http.HttpResponseNotAllowed。 require_http_methods(requestmethodlist)[source] The restricted view can only the HTTP method specified by the service. […]

  • Detailed instructions for use of flask limiter

    Time:2021-8-1

    This article was first published in:Walker AI Rate limiting is usually implemented as a defense measure of the service. Services need to protect themselves from overuse, whether intentional or unintentional, to maintain service availability. In the development process of the flash project, when you encounter the need to restrict the interface and don’t want to […]

  • Lazy loading decorator for class properties in Python

    Time:2021-7-1

    class lazy: First callMyClass.nameIt will enter into the decoration__get__Method, we use the__get__The interior of the method is then re decorated with thefuncReturn value assigned toowner(this isMyClass)OfnameAttribute to achieveReplacement valueIt’s a new concept. python This work adoptsCC agreementReprint must indicate the author and the link of this article

  • Design pattern learning 10 (Java implementation) – Decorator Pattern

    Time:2021-6-30

    Write on the front Take notes on learning design patterns Improve the flexible use of design patterns Learning address https://www.bilibili.com/video/BV1G4411c7N4 https://www.bilibili.com/video/BV1Np4y1z7BU Reference article http://c.biancheng.net/view/1317.html Project source codehttps://gitee.com/zhuang-kang/DesignPattern 12. Decorator mode 12.1 definition and characteristics of Decorator Pattern Definition of decorator mode:It refers to the mode of dynamically adding some responsibilities (i.e. adding additional functions) to […]

  • Notes on how to learn Python decorator

    Time:2021-6-18

    The function of decorator is to decorate something. Attention is to decorate, not to modify. Personal feeling is like make-up. It only makes some modifications on the original appearance of a person,It doesn’t really change people. The following is a simple case to realize the decorator step by step: import time This work adoptsCC agreementReprint […]

  • React high level component hoc (1)

    Time:2021-6-18

    Official document on react high level componentshttps://reactjs.org/docs/high…。 cause In the process of discussing react with a few friends before, we all thought that we were very familiar with react. When we talked about the problem of react high-level components, we couldn’t clearly explain why. On the surface, we seldom use react high-level components, but in […]

  • Python iterator generator decorator context manager

    Time:2021-6-6

    Basic agreement Clsx: class X Valx: variable x Funcx: function x Codex: code fragment x Special methods / properties of Python internal objects 1.__ dict__ Properties: ClsA.__ dict__, Property Dictionary of class A, including Properties, https://www.cnblogs.com/alvin2010/p/9102344.html ValA.__ dict__, Attribute dictionary of variable x 2.__getattr__(self, item): #Gets the property named item #The default value is return […]

  • Midway serverless 2.0, integration makes front-end R & D more effective again

    Time:2021-4-22

    Introduction:In March 2021, midway serverless launched its second major version. As I said two years ago, open source is just the beginning, but the end is far from coming. Midway system hopes to be able to continuously evolve forward at the current crossroads, so that the front end can develop and move towards application engineers. […]