64 Matching Annotations
  1. May 2024
  2. Mar 2024
  3. Feb 2024
  4. 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

    1. I feel we need a agreeable definition of work-items. It is getting confusing already. If the goal is to avoid confusion then exceptions must be avoided.
    2. I feel that the current design area should be a key part of the workflow on any work item, not just type of designs. As a PM I don't schedule designs independently. It's odd to open and close a design issue when it doesn't deliver value to the customer.
  5. Dec 2023
      • for: James Hansen - 2023 paper, key insight - James Hansen, leverage point - emergence of new 3rd political party, leverage point - youth in politics, climate change - politics, climate crisis - politics

      • Key insight: James Hansen

        • The key insight James Hansen conveys is that
          • the key to rapid system change is
            • WHAT? the rapid emergence of a new, third political party that does not take money from special interest lobbys.
            • WHY? Hit the Achilles heel of the Fossil Fuel industry
            • HOW? widespread citizen / youth campaign to elect new youth leaders across the US and around the globe
            • WHEN? Timing is critical. In the US,
              • Don't spoil the vote for the two party system in 2024 elections. Better to have a democracy than a dictatorship.
              • Realistically, likely have to wait to be a contender in the 2028 election.
      • reference

  6. May 2023
    1. Commonly known was that using an apostrophe, the back space key and a period would allow one to type an exclamation point on a typewriter. Less common were some of these additional special characters:

      • Division (÷): colon and hyphen
      • Pound Sterling (£): Hyphen and small f
      • Equation (=): Hyphens turning the variable slightly (unlocking the platen and moving it up)
      • Cedilla (ç): small c, backspace and comma
      • Paragraph mark )( parentheses

      p. 16

    Tags

    Annotators

    1. Underscore Updated: 05/01/2023 by Computer Hope Alternatively known as a low line, low dash, and understrike, the underscore ( _ ) is a symbol found on the same keyboard key as the hyphen. The picture shows an example of an underscore at the beginning and end of the word "Underscore."
    1. Cronkhite-Canada syndrome

      Cronkhite-Canada syndrome is a rare and serious gastrointestinal disorder characterized by the development of multiple polyps throughout the digestive tract, particularly in the colon and stomach. The polyps are usually benign, but they can cause a range of symptoms such as chronic diarrhea, abdominal pain, weight loss, and malnutrition. Cronkhite-Canada syndrome is also associated with nail and skin abnormalities, such as hyperpigmentation and alopecia. The cause of this syndrome is not yet fully understood, but it is thought to be an autoimmune disorder. Treatment typically involves a combination of medication and nutritional support.

    2. The

      Points:

      The cornerstone of diagnosis in those suspected of severe acute infectious diarrhea is microbiologic analysis of the stool.

      Workup includes cultures for bacterial and viral pathogens; direct inspection for ova and parasites; and immunoassays for certain bacterial toxins (C. difficile), viral antigens (rotavirus), and protozoal antigens (Giardia, E. histolytica).

      Clinical and epidemiologic associations may assist in focusing the evaluation.

      If a particular pathogen or set of possible pathogens is implicated, either the whole panel of routine studies may not be necessary or, in some instances, special cultures may be appropriate.

      Molecular diagnosis of pathogens in stool can be made by identification of unique DNA sequences, and evolving microarray technologies have led to more rapid, sensitive, specific, and cost-effective diagnosis.

      Persistent diarrhea is commonly due to Giardia, but additional causative organisms that should be considered include C. difficile, E. histolytica, Cryptosporidium, Campylobacter, and others.

      Flexible sigmoidoscopy with biopsies and upper endoscopy with duodenal aspirates and biopsies may be indicated if stool studies are unrevealing.

      Structural examination by sigmoidoscopy, colonoscopy, or abdominal computed tomography (CT) scanning may be appropriate in patients with uncharacterized persistent diarrhea to exclude IBD or as an initial approach in patients with suspected noninfectious acute diarrhea.

      Fluid and electrolyte replacement are of central importance to all forms of acute diarrhea.

      Oral sugar-electrolyte solutions (iso-osmolar sport drinks or designed formulations) should be instituted promptly with severe diarrhea to limit dehydration, which is the major cause of death.

      Profoundly dehydrated patients, especially infants and the elderly, require IV rehydration.

      In moderately severe nonfebrile and nonbloody diarrhea, antimotility and antisecretory agents such as loperamide can be useful adjuncts to control symptoms.

      Such agents should be avoided with febrile dysentery, which may be prolonged by them, and should be used with caution with drugs that increase levels due to cardiotoxicity.

      Bismuth subsalicylate may reduce symptoms of vomiting and diarrhea but should not be used to treat immunocompromised patients or those with renal impairment because of the risk of bismuth encephalopathy.

      Judicious use of antibiotics is appropriate in selected instances of acute diarrhea and may reduce its severity and duration.

      Many physicians treat moderately to severely ill patients with febrile dysentery empirically without diagnostic evaluation using a quinolone, such as ciprofloxacin (500 mg bid for 3–5 d).

      Empirical treatment can also be considered for suspected giardiasis with metronidazole (250 mg qid for 7 d).

      Selection of antibiotics and dosage regimens are otherwise dictated by specific pathogens, geographic patterns of resistance, and conditions found.

      Newer agents such as nitazoxanide may be required for Giardia and Cryptosporidium infections because of resistance to first-line treatments.

      Antibiotic coverage is indicated, whether or not a causative organism is discovered, in patients who are immunocompromised, have mechanical heart valves or recent vascular grafts, or are elderly.

      Bismuth subsalicylate may reduce the frequency of traveler’s diarrhea.

      Antibiotic prophylaxis is only indicated for certain patients traveling to high-risk countries in whom the likelihood or seriousness of acquired diarrhea would be especially high.

      Use of ciprofloxacin, azithromycin, or rifaximin may reduce bacterial diarrhea in such travelers by 90%, though rifaximin is not suitable for invasive disease but rather as treatment for uncomplicated traveler’s

    1. Analgesics cause dyspepsia, whereas nitrates, calcium channel blockers, theophylline, and progesterone promote gastroesophageal reflux.
  7. Dec 2022
  8. Nov 2022
    1. Second, if Jenkins runs as PID 1, then it may not receive the signals you send it! That's a subtlety in PID 1. Unlike other unlike processes, PID 1 does not have default signal handlers, which means that if Jenkins hasn't explicitly installed a signal handler for SIGTERM, then that signal is going to be discarded when it's sent (whereas the default behavior would have been to terminate the process).
  9. Oct 2022
    1. But what if we’ve more elements to ignore? people = { "Alice" => ["green", 34, "alice@example.com"], "Bob" => ["brown", 27, "bob@example.com"] } No problem. Just re-use the underscore: people.map { |name, (_, _, email)| [name, email] } You can’t do it with any variable, though, at least in Ruby 1.9. It only works with variables that are called _: people.map { |name, (x, x, email)| [name, email] } # SyntaxError: (eval):2: duplicated argument name
  10. Sep 2022
    1. in my personal opinion, there shouldn't be a special treatment of do-end blocks in general. I believe that anything that starts a "block", i.e. something that is terminated by and end, should have the same indentation logic
  11. Aug 2022
    1. When the hen sees a white oval object on the ground, she cannot leave it; she must keep upon it and return to it, until at last its transformation into a little mass of moving chirping down elicits from her machinery an entirely new set of performances. The love of man for woman, or of the human mother for her babe, our wrath at snakes and our fear of precipices, may all be described similarly, as instances of the way in which peculiarly conformed pieces of the world's furniture will fatally call forth most particular mental and bodily reactions, in advance of, and often in direct opposition to, the verdict of our deliberate reason concerning them. The labours of Darwin and his successors are only just beginning to reveal the universal parasitism of each creature upon other special things, [p.191] and the way in which each creature brings the signature of its special relations stampted on its nervous system with it upon the scene. Every living creature is in fact a sort of lock, whose wards and springs presuppose special forms of key, - which keys however are not born attached to the locks, but are sure to be found in the world near by as life goes on. And the locks are indifferent to any but their own keys. The egg fails to fascinate the hound, the bird does not fear the precipice, the snake waxes not wroth at his kind, the deer cares nothing for the woman or the human babe. Those who wish for a full development of this point of view, should read Schneider's Der thierische Wille, - no other book shows how accurately anticipatory are the actions of animals, of the specific features of the environment in which they are to live.

      Discusses how animals' special reactions are to their own type of animal or even offspring. A chicken doesnt look for the sent of a dog as a dog would not harbor a chicken egg.

  12. Jul 2022
    1. NOTES AND REFERENCES

      Dear god I really hate when publishers do their references/notes like this. Sitting here at the end, unlinked to the actual text. There's a special place in hell for editors that do this in the digital age.

  13. Jun 2022
  14. Nov 2021
    1. Of course, we can always add more special cases to the type system to detect the specific case of iterating over a known-bounded object literal, but this just leads to the "Why does this code not behave like this other nearly-identical code?" problem when we fail to properly exhaust all the special cases.
  15. Oct 2021
    1. Die vollständige digitale Reproduktion des Zettelkastens einschließlich aller Vernetzungen stellt die größte und reizvollste Herausforderung dieses Langzeitprojektes dar. Der Entwickler Sebastian Zimmer vom CCeH bezeichnete die Aufgabe als facettenreich und anspruchsvoll: "Immer wieder gibt es Spezialfälle zu entdecken. Dadurch ist der Spaß an der Sache gewährleistet, und es wird nie langweilig."

      Machine translation:

      The complete digital reproduction of the card box including all interconnections is the greatest and most appealing challenge of this long-term project. The developer Sebastian Zimmer from the CCeH described the task as multifaceted and demanding: "There are always special cases to discover. This guarantees fun and it never gets boring. "

      The idea that digitizing his zettelkasten has many special cases is an indicator that the system morphed and grew as he used it. He likely settled into some specific uses over time, but it's likely that the overall shape is similar to other note taking forms, but he worked to make things fit his particular style.

  16. Sep 2021
    1. The important thing to understand is that there is no such thing as a class method in Ruby. A class method is really just a singleton method. There is nothing special about class methods. Every object can have singleton methods. We just call them "class methods" when the object is a Class because "singleton method of an instance of Class" is too long and unwieldy.
  17. Aug 2021
  18. Jun 2021
  19. May 2021
  20. Apr 2021
  21. Mar 2021
    1. To the consternation of some users, 3.x employed Unicode variable names such as λ, φ, τ and π for a concise representation of mathematical operations. A downside of this approach was that a SyntaxError would occur if you loaded the non-minified D3 using ISO-8859-1 instead of UTF-8. 3.x also used Unicode string literals, such as the SI-prefix µ for 1e-6. 4.0 uses only ASCII variable names and ASCII string literals (see rollup-plugin-ascii), avoiding encoding problems.
  22. Feb 2021
    1. Write special-case classes. For example, you will have User base class with multiple error-subclasses like UserNotFound(User) and MissingUser(User). It might be used for some specific situations, like AnonymousUser in django, but it is not possible to wrap all your possible errors in special-case classes. It will require too much work from a developer. And over-complicate your domain model.
    1. Beware, though: What you are about to see is not particularly elegant. In fact, the TTY subsystem — while quite functional from a user's point of view — is a twisty little mess of special cases. To understand how this came to be, we have to go back in time.
  23. Nov 2020
    1. You could decide to trust yourself and your teammates to always remember this special case. You can all freely use short-circuiting, but simply don't allow a short-circuit expression to be on the last line of a script, for anything actually deployed. This may work 100% reliably for you and your team, but I don't believe that is the case for myself and many other developers. Of course, some kind of linter or commit hook might help.
  24. Oct 2020
  25. Jul 2020
    1. Most of Algol's "special" characters (⊂, ≡, ␣, ×, ÷, ≤, ≥, ≠, ¬, ⊃, ≡, ∨, ∧, →, ↓, ↑, ⌊, ⌈, ⎩, ⎧, ⊥, ⏨, ¢, ○ and □) can be found on the IBM 2741 keyboard with the APL "golf-ball" print head inserted; these became available in the mid-1960s while ALGOL 68 was being drafted. These characters are also part of the Unicode standard and most of them are available in several popular fonts.
  26. Jun 2020
  27. May 2020
  28. Apr 2020
  29. Apr 2019
    1. 28 C.F.R. § 600.8(c)

      PART 600—GENERAL POWERS OF SPECIAL COUNSEL can be found here: https://www.govinfo.gov/content/pkg/CFR-2016-title28-vol2/pdf/CFR-2016-title28-vol2-part600.pdf

      Part (c) reads:

      (c)Closing documentation. At the conclusion of the Special Counsel's work, he or she shall provide the Attorney General with a confidential report explaining the prosecution or declination decisions reached by the Special Counsel.

  30. Mar 2019
  31. Jul 2017
    1. Knowing how to read, write, and participate in the digital world has become the 4th basic foundational skill next to the three Rs—reading, writing, and arithmetic—in a rapidly evolving, networked world.

      I have a hard time knowing where digital literacy falls in terms of priority for students with disabilities. While it is no doubt just as important for them to grasp in order to better interact with our rapidly changing world, it is difficult to integrate the use of technology when trying to help students grasp certain skills.

  32. May 2017
    1. Mr. Russell, or some version of him, assays the role with a weird, disrupting digital face-lift that’s meant to suggest the young Ego, but really only makes you contemplate whether this Benjamin Button-style age-reversing is going to become an increasingly standard (and creepy) industry practice.

      So, in Ant Man, there is the same thing with Michael Douglas. I totally think it will be a common thing. Not just for flashbacks but for actors who want to play the role "younger."

  33. Feb 2017
    1. he honest rhetorician therefore has two things in mind: a vision of how matters should go ideally and ethically and a considera-tion of the special circumstances of his auditors.

      Aaaand also his own special circumstances, I would imagine. After all, one's account of "how matters should go ideally and ethically" always seems to conveniently leave the "honest" rhetorician in a comfortable position. At least, this is the case in the examples I've encountered.

  34. Aug 2016
    1. to America or the Colonies

      As Steve Jones says in my attached article, the 19th century relationship between the US and Britain was actually quite strong. Doyle is using this brief mention of America to display the relationship between the nations at the time. Though America became independent from the UK in 1776, by the 1800's it has become quite reasonable for someone to possibly seek refuge in "the Colonies".

    1. VISITS

      I'm not sure exactly where this would fit in, but some way to reporting total service hours (per week or other time period) would be useful, esp as we start gauging traffic, volume, usage against number of service hours. In our reporting for the Univ of California, we have to report on services hours for all public service points.

      Likewise, it may be helpful to have a standard way to report staffing levels re: coverage of public service points? or in department? or who work on public services?

  35. Dec 2015
    1. I cannot make myself any clearer than to say: Paul, do not waste your time with heady trips of greatness, of holiness, of grand purpose, of fulfilling a Divine Purpose in the universal scheme of things that is outside or other than “simply existing.“ Existence is all of those things, but it is nothing “special.“ It is only by comparison with ignorance that that which is “normal” can seem special, and you will weaken yourself greatly if you indulge in such nonsense! This had better be a fundamental point in your awareness of what is happening here, or you will lose the Value.

      The Infinity of Being is "normal"

  36. Nov 2015
    1. RAJ: You are correct. This jelling, as you have put it, will continue. The facts will become more meaningful to you as each day goes by. Since you already know that there truly is no process to it, I would encourage you to relinquish this idea that standing as the Door is something “special,” and therefore not something to waste your time doing during everyday activities. Nothing exists outside the infinitude of Being. Therefore, what you denominate “everyday activities” in a somewhat demeaning way, needs to be seen as equally worthy of being embraced and perceived from the standpoint of being the Door. Remember that standing as the Door, at the edge of the Unknown, will become a constant activity or point of observation in your life. You might as well see it in its proper perspective right from the beginning as being totally normal and not “special” in any way.

      Nothing exists outside of Being. Your everyday activities, your ordinary moments need to be seen as equally worthy of being embraced and perceived from the standpoint of being the Door.

    1. RAJ: Very well, Paul. I want you to consider the fact that “pedestals” are for show. They exist for the purpose of exhibiting whatever is resting upon them. As a matter of fact, the pedestal itself has become an object of art. I want you to consider the fact that a pedestal is used to set something apart from everything else. It is a divisive structure, three-dimensionally speaking. It is also divisive from an inner standpoint, wherein it equates with “ego”—”a liar and the father of it.“1 It is the liar, in that it holds up that which is not separate and says, “This is separate.” It is the father of the lie, in that what it holds up as separate is concocted of its own fantasy. The pedestal, together with what it shows off, is total illusion. One truly does not exist without the other.

      The pedestal is used as metaphor for ego and specialness. It is divisive in its claims as separate a thing that is not separate.

      The pedestal along with that which it holds as separate, is total illusion.

  37. Oct 2015
    1. Remember, Paul, you were not “picked” for this experience of communicating with a Guide, whether a Master or not. Now happens to be the time when you opened yourself up, and requested that your Guide contact you. I cannot help it that you picked a time to do this which coincides with a worldwide event of some import. That is pure coincidence.

      Paul is wondering about his relationship with Raj and is feeling 'special'.