- Oct 2024
-
www.youtube.com www.youtube.com
-
23:10 MMT is not a new system or theory. It simply explains what happens today.
-
- Aug 2024
-
www.truthdig.com www.truthdig.com
-
for - building new sustainable cities
summary - Building new "sustainable cities from nothing often does not consider the embodied energy required to do so. When that is considered, it is usually not viable - A context where it is viable is where there is extreme poverty and inequality
to - Why do old places matter? - sustainability - https://hyp.is/vlBLGlQFEe-EpqflmmlqnQ/savingplaces.org/stories/why-do-old-places-matter-sustainability
-
- Jul 2024
-
-
Managing problems at the scale the planet, therefore, requires creating governance institutions at the scale of the planet.
for - key insight - governance - new planetary scale - NOT the UN
-
-
docdrop.org docdrop.org
-
one of the things i suggested in a short history of progress is that 00:30:18 one of our problems even though we're very clever as a species we're not wise
for - key insight - progress trap - A Short History of Progress - we are clever but NOT wise!
key insight - progress trap - A Short History of Progress - we are clever but NOT wise! - In other words - Intelligence is FAR DIFFERENT than wisdom
new memes - We have an abundance of intelligence and a dearth of wisdom - A little knowledge is dangerous, a lot of knowledge is even more dangerous
-
- Jan 2024
-
mongoosejs.com mongoosejs.com
-
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 theAnimal
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 theAnimal
schema. When you create an instance of theAnimal
model (e.g., a dog), you can then callfindSimilarTypes
on that instance to find other animals with the same type. The method uses thethis.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 theAnimal
model.
Tags
Annotators
URL
-
- Dec 2023
-
stackoverflow.com stackoverflow.com
-
I disagree. What is expressed is an attempt to solve X by making something that should maybe be agnostic of time asynchronous. The problem is related to design: time taints code. You have a choice: either you make the surface area of async code grow and grow or you treat it as impure code and you lift pure synchronous logic in an async context. Without more information on the surrounding algorithm, we don't know if the design decision to make SymbolTable async was the best decision and we can't propose an alternative. This question was handled superficially and carelessly by the community.
superficially and carelessly?
-
- Nov 2023
-
gitlab.com gitlab.com
-
I think we are a victim of behavioural norms and so many of the apps that I use have this pattern. That's not to say it's the right behaviour, but it may be hard to break the pattern for users.
-
- Jun 2023
-
stackoverflow.com stackoverflow.com
-
Been disappointed, surprised or hurt by a library etc. that was overly permissive in it's extensibility? I have not.
-
- Sep 2022
-
github.com github.com
-
When we do release a final version of JSON Schema, please do not use JSON Schema to guarantee an OpenAPI document is valid. It cannot do that. There are numerous constraints in the written specification that cannot be expressed in JSON Schema.
-
- Mar 2022
-
ludocode.com ludocode.com
-
I believe this is partly due to a militant position on free software. Some advocates believe so strongly that users should be able to recompile their software that they force them to do so. They break libraries seemingly on purpose just to say, “Recompile! Oh you can’t? That’ll teach you to use binary software!” Of course users don’t want to recompile their software, but what users actually want is usually lost on GNOME developers.
-
-
code.visualstudio.com code.visualstudio.com
-
Note that this is a breaking API change in the libraries (more information in the README.md). It does not affect the backwards compatibility of the protocol itself.
annotation meta: may need new tag: backwards compatibility of the protocol backwards compatibility for [libraries that use [it?]]
-
- Sep 2021
-
www.impressivewebs.com www.impressivewebs.com
-
Maybe there’s a technical term that I’m not aware of for this type of centered line-splitting heading.
"what's it called?"
-
- Aug 2021
-
www.ruby-lang.org www.ruby-lang.org
-
3. The no-keyword-arguments syntax (**nil) is introduced You can use **nil in a method definition to explicitly mark the method accepts no keyword arguments. Calling such methods with keyword arguments will result in an ArgumentError. (This is actually a new feature, not an incompatibility)
-
- Jun 2021
-
github.com github.com
-
Users who have installed it decided to trust me, and I'm not comfortable transferring that trust to someone else on their behalf. However, if you'd like to fork it, feel free.
Interesting decision... Seems like the project could have been handed off to new maintainers instead of just a dead-end abandoned project and little chance of anyone using it for new projects now.
Sure you can fork it, but without a clear indication of which of the many forks in the network graph to trust, I doubt few will take the (massively) extra time to evaluate all options and choose an existing fork as a "leader" (or create their own fork) to go with continuing maintenance...
-
- Apr 2021
-
stackoverflow.com stackoverflow.com
-
There's nothing to stop you from doing initializer code in a file that lives in app/models. for example class MyClass def self.run_me_when_the_class_is_loaded end end MyClass.run_me_when_the_class_is_loaded MyClass.run_me... will run when the class is loaded .... which is what we want, right? Not sure if its the Rails way.... but its extremely straightforward, and does not depend on the shifting winds of Rails.
does not depend on the shifting winds of Rails.
-
-
git.samba.org git.samba.org
-
Was trying to figure out where the canonical repo even is. Hard to figure out. Could be made clearer (like a prominent notice on one saying this is an unofficial clone with a link to the canonical source).
Ended up here via link from https://unix.stackexchange.com/questions/86879/suppress-rsync-warning-some-files-vanished-before-they-could-be-transferred to https://git.samba.org/?p=rsync.git;a=blob_plain;f=support/rsync-no-vanished;hb=HEAD
But then found https://github.com/WayneD/rsync, which I now believe to be canonical based on:
- last change here is Mon, 15 Mar 2021 09:35:39 -0700 (09:35 -0700) but on https://github.com/WayneD/rsync it was April 3.
- https://rsync.samba.org/bug-tracking.html links to: create an issue on GitHub
-
-
www.metacritic.com www.metacritic.com
-
nothing about the game is really offensive, but there’s just no hook that managed to keep me invested up to the end.
-
- Mar 2021
-
www.sitepoint.com www.sitepoint.com
-
As to opinions about the shortcomings of the language itself, or the standard run-times, it’s important to realize that every developer has a different background, different experience, different needs, temperament, values, and a slew of other cultural motivations and concerns — individual opinions will always be largely personal and, to some degree, non-technical in nature.
Tags
- JavaScript
- reaction / reacting to
- everyone has different preferences
- non-technical reasons
- runtime environment
- everyone has different background/culture/experience
- what is important/necessary for one person may not be for another
- good point
- software preferences are personal
- annotation meta: may need new tag
- +0.9
- software project created to address shortcomings in another project
Annotators
URL
-
-
github.com github.com
-
markdown-it is the result of the decision of the authors who contributed to 99% of the Remarkable code to move to a project with the same authorship but new leadership (Vitaly and Alex). It's not a fork.
-
- Feb 2021
-
2019.trailblazer.to 2019.trailblazer.to
-
note that TRB source code modifications are not proprietary
In other words, you can build on this software in your proprietary software but can't change the Trailblazer source unless you're willing to contribute it back.
loophole: I wonder if this will actually just push people to move their code -- which at the core is/would be a direction modification to the source code - out to a separate module. That's so easy to do with Ruby, so this restriction hardly seems like it would have any effect on encouraging contributions.
Tags
- software licensing
- neutral/dispassionate/impartial/objective wording
- reminder
- wording designed to be more palatable/pleasing/inoffensive
- loophole/escape hatch
- good point
- well-written
- LGPL
- proprietary software
- annotation meta: may need new tag
- open-source software: not contributing new code back to project
Annotators
URL
-
-
10.11.66.200 10.11.66.200
-
provide information for the following call type ONLY: New Enrollment Card Not Received
-
refer to the New Enrollment Card Not Received call type in the DCFC
-
- Oct 2020
-
facebook.github.io facebook.github.io
-
Why not just use that instead of inventing a syntax that's not part of ECMAScript?
-
-
github.com github.com
-
Why struggle with custom Syntax DSLs when you can use one so widely supported?
-
- Apr 2020
-
haveibeenpwned.com haveibeenpwned.com
-
In the future, these attributes may expand without the API being versioned. The current attributes are:
-
-
lnakamur.files.wordpress.com lnakamur.files.wordpress.com
-
Any critique of the digital must rec-ognize how precarity is differentially distributed across gender, race, and class
I'm pretty sure this is already happening. It's just not called precarity - but the social inequities have long been studied.
-
- Nov 2019
-
news.ycombinator.com news.ycombinator.com
-
the main reason we built a new multiprocess architecture is that Chromium's multiprocess support was never contributed to the WebKit project. It has always lived in the separate Chromium tree, making it pretty hard to use for non-Chrome purposes.Before we wrote a single line of what would become WebKit2 we directly asked Google folks if they would be willing to contribute their multiprocess support back to WebKit, so that we could build on it. They said no.
-
- Jan 2019
-
static1.squarespace.com static1.squarespace.com
-
new subjects of knowledge
Melvil Dewey: "Guess I'll forget the base 10 number system and switch to hexadecimal."
For real, she's proposing developing knowledge that is outside of Dewey's ordering system. It's like 150 years old; it's about time!
-
- Sep 2018
-
cnx.org cnx.org
-
City officials can actually help if they go out into the streets and ask real people what actually is going on. Something on blogs and on polls arent true, they dont always speak the truth. If they were to go out to communities and build relationships with people, they would have a clearer understanding of what is going on.
Tags
- group: F18-51-Hybrid
- City officials cannot fix problems if they do not know anything is wrong to begin with. Responding to public opinion polls, actively contributing to a political blog, or starting a new blog are all examples of different ways to be involved.
- https://hypothes.is/groups/q2jXEin4/f18-51-hybrid)
Annotators
URL
-
- Feb 2018
-
hypothes.is hypothes.is
-
My daughter will be brought up to understand her true value. That’s a promise. As for all the little girls to be born around the world, the creation of these ads is an effort to show how imagination can change the conversation around their lives.
-