35 Matching Annotations
  1. Jan 2024
    1. Instance methods Instances of Models are documents. Documents have many of their own built-in instance methods. We may also define our own custom document instance methods. // define a schema const animalSchema = new Schema({ name: String, type: String }, { // Assign a function to the "methods" object of our animalSchema through schema options. // By following this approach, there is no need to create a separate TS type to define the type of the instance functions. methods: { findSimilarTypes(cb) { return mongoose.model('Animal').find({ type: this.type }, cb); } } }); // Or, assign a function to the "methods" object of our animalSchema animalSchema.methods.findSimilarTypes = function(cb) { return mongoose.model('Animal').find({ type: this.type }, cb); }; Now all of our animal instances have a findSimilarTypes method available to them. const Animal = mongoose.model('Animal', animalSchema); const dog = new Animal({ type: 'dog' }); dog.findSimilarTypes((err, dogs) => { console.log(dogs); // woof }); Overwriting a default mongoose document method may lead to unpredictable results. See this for more details. The example above uses the Schema.methods object directly to save an instance method. You can also use the Schema.method() helper as described here. Do not declare methods using ES6 arrow functions (=>). Arrow functions explicitly prevent binding this, so your method will not have access to the document and the above examples will not work.

      Certainly! Let's break down the provided code snippets:

      1. What is it and why is it used?

      In Mongoose, a schema is a blueprint for defining the structure of documents within a collection. When you define a schema, you can also attach methods to it. These methods become instance methods, meaning they are available on the individual documents (instances) created from that schema.

      Instance methods are useful for encapsulating functionality related to a specific document or model instance. They allow you to define custom behavior that can be executed on a specific document. In the given example, the findSimilarTypes method is added to instances of the Animal model, making it easy to find other animals of the same type.

      2. Syntax:

      Using methods object directly in the schema options:

      javascript const animalSchema = new Schema( { name: String, type: String }, { methods: { findSimilarTypes(cb) { return mongoose.model('Animal').find({ type: this.type }, cb); } } } );

      Using methods object directly in the schema:

      javascript animalSchema.methods.findSimilarTypes = function(cb) { return mongoose.model('Animal').find({ type: this.type }, cb); };

      Using Schema.method() helper:

      javascript animalSchema.method('findSimilarTypes', function(cb) { return mongoose.model('Animal').find({ type: this.type }, cb); });

      3. Explanation in Simple Words with Examples:

      Why it's Used:

      Imagine you have a collection of animals in your database, and you want to find other animals of the same type. Instead of writing the same logic repeatedly, you can define a method that can be called on each animal instance to find similar types. This helps in keeping your code DRY (Don't Repeat Yourself) and makes it easier to maintain.

      Example:

      ```javascript const mongoose = require('mongoose'); const { Schema } = mongoose;

      // Define a schema with a custom instance method const animalSchema = new Schema({ name: String, type: String });

      // Add a custom instance method to find similar types animalSchema.methods.findSimilarTypes = function(cb) { return mongoose.model('Animal').find({ type: this.type }, cb); };

      // Create the Animal model using the schema const Animal = mongoose.model('Animal', animalSchema);

      // Create an instance of Animal const dog = new Animal({ type: 'dog', name: 'Buddy' });

      // Use the custom method to find similar types dog.findSimilarTypes((err, similarAnimals) => { console.log(similarAnimals); }); ```

      In this example, findSimilarTypes is a custom instance method added to the Animal schema. When you create an instance of the Animal model (e.g., a dog), you can then call findSimilarTypes on that instance to find other animals with the same type. The method uses the this.type property, which refers to the type of the current animal instance. This allows you to easily reuse the logic for finding similar types across different instances of the Animal model.

      Certainly! Let's go through each part and explain it in simple terms: ### 1. `this` in Mongoose: - **What is `this`?** In JavaScript, `this` refers to the current context or object. In Mongoose, particularly within methods and middleware functions, `this` represents the instance (document) the function is currently operating on. - **Why is it used?** `this` is used to access and modify the properties of the current document. For example, in a Mongoose method, `this` allows you to refer to the fields of the specific document the method is called on. ### 2. Example: Let's use the `userSchema.pre("save", ...)`, which is a Mongoose middleware, as an example: ```javascript userSchema.pre("save", async function (next) { if (!this.isModified("password")) { next(); } else { this.password = await bcrypt.hash(this.password, 10); next(); } }); ``` - **Explanation in Simple Words:** - Imagine you have a system where users can sign up and set their password. - Before saving a new user to the database, you want to ensure that the password is securely encrypted (hashed) using a library like `bcrypt`. - The `userSchema.pre("save", ...)` is a special function that runs automatically before saving a user to the database. - In this function: - `this.isModified("password")`: Checks if the password field of the current user has been changed. - If the password is not modified, it means the user is not updating their password, so it just moves on to the next operation (saving the user). - If the password is modified, it means a new password is set or the existing one is changed. In this case, it uses `bcrypt.hash` to encrypt (hash) the password before saving it to the database. - The use of `this` here is crucial because it allows you to refer to the specific user document that's being saved. It ensures that the correct password is hashed for the current user being processed. In summary, `this` in Mongoose is a way to refer to the current document or instance, and it's commonly used to access and modify the properties of that document, especially in middleware functions like the one demonstrated here for password encryption before saving to the database.

    Tags

    Annotators

    URL

  2. Nov 2023
    1. excessive expectations and reliance on CCUS
      • for: quote - Carbon Capture expectations - unfeasible

      • quote

        • If oil and natural gas consumption were to evolve as projected under today’s policy settings, this would require an inconceivable 32 billion tonnes of carbon captured for utilisation or storage by 2050,
          • including 23 billion tonnes via direct air capture to limit the temperature rise to 1.5 °C.
        • The necessary carbon capture technologies would require 26 000 terawatt hours of electricity generation to operate in 2050,
          • which is more than global electricity demand in 2022.
        • And it would require over USD 3.5 trillion in annual investments all the way from today through to mid-century, which is an amount equal to the entire industry’s annual average revenue in recent years.
  3. Sep 2023
    1. Recent work has revealed several new and significant aspects of the dynamics of theory change. First, statistical information, information about the probabilistic contingencies between events, plays a particularly important role in theory-formation both in science and in childhood. In the last fifteen years we’ve discovered the power of early statistical learning.

      The data of the past is congruent with the current psychological trends that face the education system of today. Developmentalists have charted how children construct and revise intuitive theories. In turn, a variety of theories have developed because of the greater use of statistical information that supports probabilistic contingencies that help to better inform us of causal models and their distinctive cognitive functions. These studies investigate the physical, psychological, and social domains. In the case of intuitive psychology, or "theory of mind," developmentalism has traced a progression from an early understanding of emotion and action to an understanding of intentions and simple aspects of perception, to an understanding of knowledge vs. ignorance, and finally to a representational and then an interpretive theory of mind.

      The mechanisms by which life evolved—from chemical beginnings to cognizing human beings—are central to understanding the psychological basis of learning. We are the product of an evolutionary process and it is the mechanisms inherent in this process that offer the most probable explanations to how we think and learn.

      Bada, & Olusegun, S. (2015). Constructivism Learning Theory : A Paradigm for Teaching and Learning.

  4. Jun 2023
    1. Example 1: If a 1000-Ω resistor is connected in parallel with a3000-Ω resistor, what is the total or equivalent resistance? Alsocalculate total current and individual currents, as well as thetotal and individual dissipated powers.R R RR R1000 30001000 30003, 000, 0004000 750total1 21 2= ×+ = Ω × ΩΩ + Ω = ΩΩ = ΩTo find how much current flows through each resistor, applyOhm’s law:I VRI VR12 V1000 0.012 A 12 mA12 V3000 0.004 A 4 mA111222= = Ω = == = Ω = =These individual currents add up to the total input current:Iin = I1 + I2 = 12 mA + 4 mA = 16 mAThis statement is referred to as Kirchhoff’s current law. Withthis law, and Ohm’s law, you come up with the current divider

      Great intro problem to Kirchhoff's current law

      Current divider notes as well!

  5. Feb 2023
      • Title: Faster than expected
      • subtitle: why most climate scientists can’t tell the truth (in public) Author: Jackson Damien

      • This is a good article written from a psychotherapist's perspective,

      • examining the psychology behind why published, mainstream, peer reviewed climate change research is always dangerously lagging behind current research,
      • and recommending what interventions could be be taken to remedy this
      • This your of scientific misinformation coming from scientists themselves
      • gives minimizers and denialists the very ammunition they need to legitimise delay of the urgently needed system change.
      • What climate scientists say In public is far from what they believe in private.
      • For instance, many climate scientists don't believe 1.5 Deg. C target is plausible anymore, but don't say so in public.
      • That reticence is due to fear of violating accepted scientific social norms,
      • being labeled alarmist and risk losing their job.
      • That creates a collective cognitive dissonance that acts as a feedback signal
      • for society to implement change at a dangerously slow pace
      • and to not spend the necessary resources to prepare for the harm already baked in.
      • The result of this choice dissonance is that
      • there is no collective sense of an emergency or a global wartime mobilisation scale of collective behaviour.
      • Our actions are not commensurate to the permanent emergency state we are now in.
      • The appropriate response that is suggested is for the entire climate science community to form a coalition that creates a new kind of peer reviewed publishing and reporting
      • that publicly responds to the current and live knowledge that is being discovered every day.
      • This is done from a planetary and permanent emergency perspective in order to eliminate the dangerous delays that create the wrong human collective behavioural responses.
  6. Jan 2023
    1. The moral vocabulary that climate activists and public health professionals use is not able to activate the moral and political imagination that effective ecological and health governance require. To respond to the recurring crises that are coming, the governance of complex societies must be able to reach the tap roots latent in their own moral ethos, politics, and motivational structures.

      !- identification : of failings of current climate activists

  7. May 2022
    1. The advantage of ocean currents is their stability. They flow with little fluctuation in speed and direction, giving them a capacity factor — a measure of how often the system is generating — of 50-70%, compared with around 29% for onshore wind and 15% for solar.

      Have other coastal countries other than Japan explored the capacity factor for tidal energy of the currents off their shoreline? Are other currents as promising as the Kuroshio current?

    2. Japan’s New Energy and Industrial Technology Development Organization (NEDO) estimates the Kuroshio Current could potentially generate as much as 200 gigawatts — about 60% of Japan’s present generating capacity.

      This is quite a significant percentage of Japan's total power needs.

  8. Jun 2021
  9. May 2021
  10. Mar 2021
    1. The lone Black delegate to the convention, Isaiah Montgomery, participated in openly suppressing the voting eligibility of most of those Black men, in the hope that this would reduce the terror, intimidation and hostility that white supremacists aimed at Black people.

      This is interesting because Montgomery essentially sacrificed a part of his community and his heritage in the name of peace and compromise without being certain of the results. This makes me consider the present day political climate, particular, the way that neither side is willing to make concessions (especially the people power).

  11. Feb 2021
  12. Oct 2020
    1. Typically, platform accessibility APIs do not provide a vehicle to notify assistive technologies of a role value change, and consequently, assistive technologies may not update their cache with the new role attribute value.

      It's too bad they couldn't just allow role to be changed, and assistive technologies would just have to be updated to follow the suit.

    1. that will advance justice and opportunity for college athletes. The proposal will guarantee fair and equitable compensation, enforceable health and safety standards, and improved educational opportunities for all college athletes.

      Parts of the College Athletes Bill of Rights (CABR)

  13. Sep 2020
  14. Aug 2020
  15. Jul 2020
    1. He had put the case (without mentioning names) to an eminent physician; and the eminent physician had smiled, had shaken his head, and had said–nothing. On these grounds, Mr. Bruff entered his protest, and left it there.

      So to say nothing is enough proof that there is no merit to this experiment? Isn't Ezra's thoughts inspired by textbooks/an intention to mimic the scientific process?

      I feel like such ignorance towards science is relevant today *cough*,*cough* people who refuse to wear face masks *cough*,*cough*

  16. Mar 2020
    1. Voltage is the pressure from an electrical circuit's power source that pushes charged electrons (current) through a conducting loop, enabling them to do work such as illuminating a light.

      This is by far the best explanation I found.

  17. Jan 2020
    1. ere were positive ideals and goals and projects. People were aiming for something.
    2. Today, if you use the word “progress,” you get laughed out of the room.
  18. Mar 2019
    1. Instructor-Led Training

      SharedBook.com published this article about the state of Instructor-Led Training (ILT) in 2018. It claims that technology has not caused instructor-led training demand to decrease, but instead as simply altered it to provide instructors with new tools. It is important to note how technology changes the delivery of ILT, because now trainers are able to reach more people in a variety of places, and have far more at their fingertips to help facilitate training than they did before technology became so pervasive. Technology also helps with assessing learner outcomes, as it provides more analytical tools. Hybrid ILT is also becoming more common as a super-training platform that combines strengths of E-learning with ILT. It is important, however, to ensure technology is used purposefully in technology-heavy ILT environments. 9/10

  19. Jan 2019
    1. Still, to focus only on this social evolutionary aspect misses less familiar forms of rhet-oricity.

      It is crucial to not approach topics with too narrow of a perspective. Considering other elements and points of view make for a more well-rounded individual and argument. When thinking of current political issues plaguing the United States, what might be an instance where broadening perspective would be beneficial?

  20. Dec 2018
    1. SELECT sj.name , sja.* FROM msdb.dbo.sysjobactivity AS sja INNER JOIN msdb.dbo.sysjobs AS sj ON sja.job_id = sj.job_id WHERE sja.start_execution_date IS NOT NULL AND sja.stop_execution_date IS NULL

      View current running jobs SQL

  21. Nov 2018
    1. “Any time when nurse practitioners and other providers get together, there is always this challenge of professions,” he says. “You’re doing this or you’re doing that, and once you get people who understand what the capabilities are past the title name and what you can do, it’s just amazing.”
    2. Recent State of Hospital Medicine surveys showed that 83% of hospitalist groups are utilizing NPs and PAs, and SHM earlier this year added Tracy Cardin, ACNP-BC, SFHM, as its first non-physician voting board member
  22. Oct 2017
    1. The absence of a need for co-signaling through CD28 for these BiTEs might also be explained by the observation that among all T cell subtypes, CD8+ effector memory cells CD45RO+ (TEM) and CD8+ effector memory CD45RA+ (TEMRA) contribute the most to BiTE activity, whereas naïve T cells do not contribute at all to the killing efficiency.50 It is believed that memory T cells do not require CD28 costimulation for expansion during secondary responses, which could explain the efficiency of BiTEs. However, this dogma has recently been challenged.5

      absence of need for cosignal effector memory cells contribute most to bite activity memory T ells dont require cd28 costimulation for expansion?

  23. Feb 2017
    1. So when Fish says “form” he means “school grammar” and syntax.

      No.

    2. Winterowd states that “current-traditionalism simply has no advocates” (En-glish 14), and among compositionists this is generally true.

      hmm

    3. Translated into pedagogy, this belief typically results in some version of current-traditionalism. And despite some novel elements, Fish’s approach to writing instruction is indeed current-traditional, within a belletristic conception of English as the refined appreciation of literature.

      Argument

    4. Meanwhile, current-traditional composition already has its prominent public intellectual: Stanley Fish.

      Contention

    5. it continues to frame public attitudes toward writing pedagogy, and thus—to the extent that the public assesses practice and influences policy—continues to influence com-position.

      The problem.

    6. current-traditional p
    1. For current-traditional rhetoric, reality is rational, regular and certain - a realm which when it is not static is at least in a predictable, harmonious, symmetrical balance. Meaning thus exists independent of the perceiving mind, reposing in external reality.

      No way Fish believes this.