424 Matching Annotations
  1. May 2024
  2. Apr 2024
  3. Mar 2024
    1. The master of ceremonies was their Indian interpreter, Squanto, who hadhelped the English survive a difficult winter. Left out of this story is thedetail (not so minor) that Squanto only knew English because he had beenkidnapped and sold as a slave to an English ship’s captain.

      The fact that early Americans needed to be bailed out by others also doesn't seem to do anything to dampen either the mythology of American exceptionalism nor their "can-do attitude".

  4. Feb 2024
    1. One of my inquiries was for anecdotes regarding mistakes made between the twins by their near relatives. The replies are numerous, but not very varied in character. When the twins are children, they are usually distinguished by ribbons tied round the wrist or neck; nevertheless the one is sometimes fed, physicked, and whipped by mistake for the other, and the description of these little domestic catastrophes was usually given by the mother, in a phraseology that is some- [p. 158] what touching by reason of its seriousness.

  5. 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

  6. Dec 2023
    1. Not sure how "communities" are going to shut down oil refineries as big as large cities in some cases.
      • for: question - can communities have real impact?

      • question: can communities have real impact?

        • In this discussion, Ross is acting as the devil's advocate questioning whether communities can have real impact. He is consistent and his comments are based on evidence and experience. He challenges everyone else to prove him wrong and makes everyone go deeper to validate their positions.
        • Ross makes valid points that so far, have not been effectively addressed, mainly because nobody has thought further of how to systematically organize communities to the scale required. It's not trivial!
    1. “come back next year and try again”. My response is that it will be the same old thing – they’ve had 26 chances already. The planet can’t afford any more. I think the time for the Cop process is over. We just can’t keep kicking the can down the road.
      • for: quote - COP - Rupert Read, quote - COP - come back next year and try again, quote - alternative COP

      • quote

        • come back next year and try again
      • author: Rupert Read
      • date: Dec. 4, 2021

      • quote

        • We just can't keep kicking the can down the road
      • author: Rupert Read
      • date: Dec 4, 2021

      • comment

        • Well, COP28 is over and just as Rupert Read predicted above, we will
          • kick the can down the road again
          • come back next year and try again
        • It's a perpetual groundhog day, until it isn't
  7. Nov 2023
  8. Oct 2023
    1. The main usage difference is that dependency can be used in a second sense as a "concrete" noun to mean a person or thing which depends on something/someone else. But note that in the programming context it's not uncommon to see it used to mean a software resource upon which some piece of software depends (i.e. - reversing the need/provide relationship).

      Is that really true? Can dependency refer to a person or thing which depends on something/someone else?? I'm only used to it the other way.

  9. Jul 2023
  10. Jun 2023
  11. Apr 2023
    1. Although CAN-SPAM hasn't resulted in less spam, the law gives authorities a new tool in the fight against spam, Lochart said. "It's a good thing we have a law, so when we find some of these roaches, we can prosecute them," he said.
    2. Spammers, apparently in response to CAN-SPAM, changed tactics this year, said Andrew Lochart, director of product marketing at Postini. More spammers are using so-called zombie networks -- computers hijacked with Trojan horse programs -- to send spam, and spammers are using increasingly sophisticated directory harvest attacks to spam corporate mail servers, he sai
    1. Extending the life of electronic products and re-using electrical components brings an even larger economic benefit, as working devices are certainly worth more than the materials they contain. A circular electronics system - one in which resources are not extracted, used and wasted, but re-used in countless ways - creates decent, sustainable jobs and retains more value in the industry.

      This paragraph caught my attention for several reasons. The first is that it was one of the first paragraphs that I actually understood what it was saying. Additionally, it made me feel like I could do something about it. When it said that reusing electrical components are better, it helped me see a clear way that I can direct effect this. Finally, I thought this paragraph was interesting because it talked about creating jobs. This is important to note because more and more people are going to school for something involving technology. This creates jobs for that specific group of people.

  12. Mar 2023
    1. ```js import React, { Component } from 'react'; import './style.css'; import ndjsonStream from 'can-ndjson-stream';

      class App extends Component { constructor(props) { super(props);

      this.state = {
        todos: []
      };
      

      }

      componentDidMount(){ fetch('http://localhost:5000/api/10', { method: 'get' }).then(data => { return ndjsonStream(data.body); }).then((todoStream) => { const streamReader = todoStream.getReader(); const read = result => { if (result.done) return;

          this.setState({ 
            todos: this.state.todos.concat([result.value.user])
          });
      
          streamReader.read().then(read);
        };
      
        streamReader.read().then(read); 
      }).catch(err => {
        console.error(err)
      });
      

      }

      render() { return ( <div className="App">

      React + NDJSON Stream Demo

        {this.state.todos.map((todo, i) =>
      • {todo}
      • )}
      </div> ); } }

      export default App; ```

  13. Jan 2023
    1. we have individual capitalists who try 00:48:45 to make the most profit and this is linked to their capital and productivity so to achieve more in less time and 00:48:57 productivity is linked to energy [Music] the only source of energy to increase profit is carbon oil and gas and this has resulted in a change in our 00:49:15 atmosphere we have to put an entities if we wish to live in our planet can our capitalism do this based on the current data we won't be able to do so 00:49:28 therefore perhaps we should do the following reflection if capitalism is unable to do so either Humanity will die with it or 00:49:42 Humanity will overcome capitalism so that we can live in our planet

      !- Urrego : Key Point - Can capitalism rapidly detour away from fossil fuels? The current data indicates no. So either Humanity does our it drops capitalism

    1. 个人学习可能取决于他人行为的主张突出了将学习环境视为一个涉及多个互动参与者的系统的重要性
    1. Much of what they do can be done without eliciting the ire of nation-states. Bike shares, pedestrian zones, insulated buildings, renovated port facilities, congestion fees, car emission limits, furnace specifications, fuel upgrades (from oil to gas to alternative energy) and white paint roofs, for example, are only some of the innovations city officials can promote to effect significant reductions in emissions and pollutants.

      !- cities actions : can be done without eliciting ire of nation state - bike shares - pedestrian zones - insulated buildings - renovated ports - congestion fees - car emission limits - furnace specifications - fuel upgrades - white paint roofs - cities are the right level for focusing on effective global climate action

    2. here states have grown dysfunctional and sovereignty has become an obstacle to global democratic action—as when the United States (or China, France, or Canada) refuses to compromise its sovereignty by permitting the international monitoring of carbon emissions on its soil—cities have increasingly proven themselves capable of deliberative democratic action on behalf of sustainability, as they have actually done in intercity associations like the C-40 or ICLEI. If presidents and prime ministers cannot summon the will to work for a sustainable planet, mayors can. If citizens of the province and nation think ideologically and divisively, neighbors and citizens of the towns and cities think publicly and cooperatively.

      !- claim : cities can mitigate corrupted democracy and foster global cooperation - ie. C40 or ICLEI (also Covenant of Mayors) - cities are not plagued by the problems of state actors who cannot reach any meaningful agreement at COP conferences

  14. Nov 2022
  15. Sep 2022
    1. To see if you are writing good code, you can question yourself. how long it will take to fully transfer this project to another person? If the answer is uff, I don’t know… a few months… your code is like a magic scroll. most people can run it, but no body understand how it works. Strangely, I’ve seen several places where the IT department consist in dark wizards that craft scrolls to magically do things. The less people that understand your scroll, the more powerfully it is. Just like if life were a video game.
    1. Filter gives me the impression of inclusion... so if I filter by fruits, I expect to see apples, oranges, and bananas. Instead, this is more like filter out fruits... remove all the fruits, and you're left with the rest. Filter in/out are both viable. One means to include everything that matches a condition, and the other is to exclude everything that does not match a condition. And I don't think we can have just one.
    1. Earlier this week, during a seminar at Schumacher College that included an exploration into what a Citizens Action Network might entail, a student wondered if we’d ever heard of South Africa’s CANs movement. No, we answered, we had not…

      !- definition : citizen action network (CAN) !- question : rapid whole system change at community scale - Can CAN's scale globally for rapid whole system change? If so, how?

  16. Jul 2022
    1. 08:58 - Migrant gene DRD4-7R* Allele and correlation with the pursuit of novelty

      DRD4-7R is the specific gene that Peter implicates in migrants who are adventurous enough to come to America. This is associated with the "can do" perspective that has propelled America into a world leader but also drives America reflexively into the future...on autopilot.

  17. Apr 2022
  18. Feb 2022
  19. Nov 2021
  20. Oct 2021
    1. DIRECTORY (in progress): This post is my directory. This post will be tagged with all tags I ever use (in chronological order). It allows people to see all my tags, not just the top 50. Additionally, this allows me to keep track. I plan on sorting tags in categories in reply to this comment.

      External links:

      Tags categories will be posted in comments of this post.

  21. Sep 2021
  22. Aug 2021
  23. Jun 2021
    1. "Many North American music education programs exclude in vast numbers students who do not embody Euroamerican ideals. One way to begin making music education programs more socially just is to make them more inclusive. For that to happen, we need to develop programs that actively take the standpoint of the least advantaged, and work toward a common good that seeks to undermine hierarchies of advantage and disadvantage. And that, inturn, requires the ability to discuss race directly and meaningfully. Such discussions afford valuable opportunities to confront and evaluate the practical consequences of our actions as music educators. It is only through such conversations, Connell argues, that we come to understand “the real relationships and processes that generate advantage and disadvantage”(p. 125). Unfortunately, these are also conversations many white educators find uncomfortable and prefer to avoid."

  24. May 2021
  25. Apr 2021
    1. “Who cares? Let’s just go with the style-guide” — to which my response is that caring about the details is in the heart of much of our doings. Yes, this is not a major issue; def self.method is not even a code smell. Actually, that whole debate is on the verge of being incidental. Yet the learning process and the gained knowledge involved in understanding each choice is alone worth the discussion. Furthermore, I believe that the class << self notation echoes a better, more stable understanding of Ruby and Object Orientation in Ruby. Lastly, remember that style-guides may change or be altered (carefully, though!).
  26. Mar 2021
    1. If you want to compile youself you can pass the --with-features=huge to the configure script. Note, however, this does not enable the different language bindings because those are mostly optional and also the various GUIs need to enabled specifically, because you can have only one gui.

      This explains why the standard vim package on ubuntu doesn't have GUI support (I was going to say because it wouldn't know which GUI you needed, but I think it would based on the Ubuntu variant: GNOME, KDE, etc.) (maybe because it wouldn't know whether you wanted GUI support at all)

      I was going to say because it wouldn't know which GUI you needed, but I think it would based on the Ubuntu variant: GNOME, KDE, etc.

      found answer to that: https://hyp.is/NyJRxIgqEeuNmWuaScborw/askubuntu.com/questions/345593/how-to-build-vim-with-gui-option-from-sources

      so you have to install a different package with GUI support, like vim-gtk or vim-athena

    1. The elimination of what is arguably the biggest monoculture in the history of software development would mean that we, the community, could finally take charge of both languages and run-times, and start to iterate and grow these independently of browser/server platforms, vendors, and organizations, all pulling in different directions, struggling for control of standards, and (perhaps most importantly) freeing the entire community of developers from the group pressure of One Language To Rule Them All.
  27. Feb 2021
    1. In combination with [Track()], the :magnetic_to option allows for a neat way to spawn custom tracks outside of the conventional Railway or FastTrack schema.

      Instead of magnetic_to:, I propose wrapping the steps that are on a separate track in something like...

        DefTrack do :paypal do
          step :charge_paypal
        end
      

      or

        paypal_track = RailwayTrack do :paypal do
          step :charge_paypal
        end
      

      so we can reference it from outputs, like we can with tracks created with Path helper.

  28. Jan 2021
    1. Progress is made of compromises, this implies that we have to consider not only disadvantages, but also the advantages. Advantages do very clearly outweigh disadvantages. This doesn’t mean it perfect, or that work shouldn’t continue to minimize and reduce the disadvantages, but just considering disadvantages is not the correct way.
    2. If folks want to get together and create a snap-free remix, you are welcome to do so. Ubuntu thrives on such contribution and leadership by community members. Do be aware that you will be retreading territory that Ubuntu developers trod in 2010-14, and that you will encounter some of the same issues that led them to embrace snap-based solutions. Perhaps your solutions will be different. .debs are not perfect, snaps are not perfect. Each have advantages and disadvantages. Ubuntu tries to use the strengths of both.
  29. Nov 2020
    1. Svelte by itself is great, but doing a complete PWA (with service workers, etc) that runs and scales on multiple devices with high quality app-like UI controls quickly gets complex. Flutter just provides much better tooling for that out of the box IMO. You are not molding a website into an app, you are just building an app. If I was building a relatively simple web app that is only meant to run on the web, then I might still prefer Svelte in some cases.
    1. This is Sass based, and therefore doesn't require Svelte components

      Just because we could make Svelte wrapper components for each Material typography [thing], doesn't mean we should.

      Compare:

      • material-ui [react] did make wrapper components for typography.

        • But why did they? Is there a technical reason why they couldn't just do what svelte-material-ui did (as in, something technical that Svelte empowers/allows?), or did they just not consider it?
      • svelte-material-ui did not.

        • And they were probably wise to not do so. Just reuse the existing work from the Material team so that there's less work for you to keep in sync and less chance of divergence.
  30. Oct 2020
    1. In the software industry we use "dependency" to refer to the relationship between two objects. We say "looking for dependents" for relationships to dependent things and "looking for dependencies" for relationships to prerequisite things, so it gets that connotation, but the literal meaning is the relationship itself, not the object. Finding a better word is exactly the point of the question
    1. All validators can be used independently. Inspried by functional programming paradigm, all built in validators are just functions.

      I'm glad you can use it independently like:

      FormValidation.validators.creditCard().validate({
      

      because sometimes you don't have a formElement available like in their "main" (?) API examples:

      FormValidation.formValidation(formElement
      
    1. This is valid javascript! Or harmony or es6 or whatever, but importantly, it's not happening outside the js environment. This also allows us to use our standard tooling: the traceur compiler knows how to turn jsx`<div>Hello</div>`; into the equivalent browser compatible es3, and hence we can use anything the traceur compile accepts!
    1. I'm suggesting there should be a way to write lifecycle related code that also responds to changing props, like how useEffect works. I think how React handles this could be a good source of inspiration.
  31. Sep 2020
    1. You must: reference each element you are extending using refs or an id add code in your oncreate and ondestroy for each element you are extending, which could become quite a lot if you have a lot of elements needing extension (anchors, form inputs, etc.)
    2. This is where hooks/behaviors are a good idea. They clean up your component code a lot. Also, it helps a ton since you don't get create/destroy events for elements that are inside {{#if}} and {{#each}}. That could become very burdensome to try and add/remove functionality with elements as they are added/removed within a component.
    1. One key advantage of 'HTML-plus' languages is that you don't actually need tooling in order to be productive — most editors give you out-of-the-box support for things like syntax highlighting (though imperfect, as JavaScript expressions are treated as strings) and auto-closing tags. Tools like Emmet work with no additional setup. HTMLx should retain that benefit.
  32. Aug 2020
  33. Jul 2020
    1. So when Avdi took to air some of those grievances on Twitter, the natural thing happened that always happens when you feel your work is attacked: The core contributor group got defensive! That’s a mischaracterization! Where are the completed bug reports!? You know the drill, if you’ve ever worked on something, poured your heart into it, and then seen it criticized online. There’s that immediate, knee-jerk reaction of a sting. But it doesn’t have to sting.
  34. Jun 2020
  35. Apr 2020
  36. Mar 2020