170 Matching Annotations
  1. Dec 2018
    1. d famous, without a care for the rules of traditional journalism — The Enquirer would have had the tabloid story of a lifetime. Mary Al

      This is my comment

  2. Sep 2018
    1. Create a form that allows existing users to sign in using their email address and password. When a user completes the form, call the signInWithEmailAndPassword method:

      Ahhhhhh okay

    2. Create a form that allows new users to register with your app using their email address and a password. When a user completes the form, validate the email address and password provided by the user, then pass them to the createUserWithEmailAndPassword method:

      Ohhhh. So it looks like the only process involved with creating a new email/password user using firebase API is the createUserWithEmailAndPassword() function...

    1. It integrates nicely with Cloud Functions for Firebase so if you want to send an email to your newly registered user, you can do so without the need for a server.

      very interesting! Not needing a server to still do emails 😃

    1. The Firebase Auth instance persists the user's state, so that refreshing the page (in a browser) or restarting the application doesn't lose the user's information.

      That is super convenient!!!

    1. Return type determines whether we continue the redirect automatically      // or whether we leave that to developer to handle.

      That's all fine and good but what are the return types though?

    1. it’s important to emphasize that you should only spend time fixing issues that you were able to measure. It’s very easy to end up shooting in the dark if you’re not disciplined — again, focus on building things and only invest time on fixing the key performance bottlenecks.

      Ya this makes a lot of sense. Measuring is really your only way of knowing if you improved something.

  3. Aug 2018
    1. ou can see how the action gets dispatched in the handleSubmit method:

      Haaaaaaalp! I'm confused here. I was able to understand how this works for mapStateToProps but I don't understand this for mapDispatchToProps 😭😭😭

    2. the component gets exported as List. List is the result of connecting the stateless component ConnectedList with the Redux store.

      Oh very interesting....the component is truly stateless now

    1. Your application is responsible for starting a webserver and handling requests.

      E.g. like you need to use request and handle the requests. 👌👌👌.

    1. Hardware or software failures that cause early termination or frequent instance restarts can occur without warning and can take considerable time to resolve. Your application should be able to handle such failures.

      😮😮😮😮 But we pay you to not have to deal with this lol

    2. The following example demonstrates what an app with three services might look like if you are developing your app locally. The optional dispatch.yaml has been added to that app in the root directory. Also in the root are three directories for each of the app's services. The subdirectory for service1 includes the source and configuration files for that service. Similarly, both service2 and service3 are in separate directories, which contain each service's files, although service3 includes two versions of the YAML configuration file:

      GREAT example. Absolutely great example. For someone that had NO IDEA how to organize their directories, I found this incredibly useful.

    1. You can live quite happily without keepalive, so if you're reading this, you may be trying to understand if keepalive is a possible solution for your problem

      hahahaah yup that is EXACTLY why I am here lol

    1. You can set HTTP headers for responses of your static file or directory handlers. To set HTTP headers in Node.js, do that in your app's code.

      This option makes sense because it is necessary to serve static assets for CORS websites. That is, if the response does not contain the appropriate headers, then the browser will reject it and the sibling website won't be able to access the assets

    2. App Engine can handle URLs by executing application code, or by serving static files uploaded with the code, such as images, CSS, or JavaScript.

      Ohhhh. I didn't realize that the YAML file could also serve as a router for static assets 😮

    1. I was scraping a few thousand links from a single domain just a little too aggressively yesterday and kept getting ECONNRESET and socket hang up errors instead of that sweet, sweet data I longed for

      😂😂😂😂😂😂😂😂

    1. Some requests don’t trigger a CORS preflight.

      Is why the GET requests are working but the POST requests with content-type: application/json are NOT working?

    2. browsers "preflight" the request, soliciting supported methods from the server with an HTTP OPTIONS request method, and then, upon "approval" from the server, sending the actual request with the actual HTTP request method

      What the **? Could somebody break this down, I am particular confused by this 😢.

    3. The Cross-Origin Resource Sharing standard works by adding new HTTP headers that allow servers to describe the set of origins that are permitted to read that information using a web browser

      Is this saying that the response tells he BROWSER whether or not origin of the webapp should have access to the response?

      This seems like this can protect against client side injection but does nothing against me spinning up a server (so no browser) and trying to maliciously interact with the same server no?

    4. Cross-Origin Resource Sharing (CORS) is a mechanism that uses additional HTTP headers to tell a browser to let a web application running at one origin (domain) have permission to access selected resources from a server at a different origin.

      I am having a problem where my webpack server at localhost:8080 can't access resources from my firebase emulated functions at localhost:5000. If an origin/domain is defined as the protocol + host + port then this makes complete sense to me why this is happening. By definition, they are not the same domain 😢.

    1. More verbosely, you are trying to access api.serverurl.com from localhost. This is the exact definition of cross domain request.

      "This is the exact definition of cross domain request" 😂😂😂

    1. Let w be the amount of words in the trie.

      Is this the total number of leaves in the trie? I thought this would be the case because each word is defined to end at a leaf node or else the word is a substring and not a complete word.

    1. This technique relies on the fact that Cloud Firestore creates built-in indexes for all document fields, even fields in a nested map.

      Wooooah I didn't realize that firestore let you do this with nested maps??? That's super cool!

  4. Jul 2018
    1. // ... Your code here

      Would you be able to push a notification to Marie and provide her information about the progress of her upload being processed?

      Or would a better way to supply Marie with progress updates be for the client to repeatedly make inquiries (requests) to the server?

    2. name : "my chat room" collections_bookmark messages

      It looks like the way documents link to collections is implicit when you are storing a map in a document.

    3. maps

      How do documents link to sub-collections? Does that only happen if the data structure that is being written to in the document is a map?

      I see how collections can point do documents but not the other way around. Any help would be greatly appreciated 😃.

    4. You can create a subcollection called messages for every room document in your rooms collection

      Fascinating. They Firestore is really quite bullish on the number of documents you can create if they are recommending that you create a document for each message in a chatroom.

    5. A reference is a lightweight object that just points to a location in your database. You can create a reference whether or not data exists there, and creating a reference does not perform any network operations.

      Good to know that firestore references don't consume network when instantiated.

    1. app

      Is this app the same "app" as the one in the front end or is this app its own "app" in the sense that the project will have multiple mini-apps interacting with each other?

    1. request.rawBody The raw (unparsed) bytes of the request

      Is this how you would send a file through a PUT request? Like would you serialize the file and then transmit it?

    1. So, let’s add some error handling:

      Ah, I didn't realize that you could use promises when responding to API's. I thought everything had to be synchronous or the connection would expire. I was wrong 😅

    1. Focus just on writing code, without the worry of managing the underlying infrastructure.

      What is the difference between Google App Engine and Cloud Functions?

    1. while the goal is to execute the function exactly once, this is not guaranteed.

      VERY IMPORTANT point being made here. I ran into a whole lot of bugs because of this 😭.

    1. Nope, just the first parameter will be treated as resolution value in the promise constructor. You can resolve with a composite value like an object or array.

      Ohhhhhhhhh! I didn't realize this at all lmao! This makes so much more sense now 😛

    1. Cloud Functions for Firebase lets you select runtime options such as the Node.js runtime version and per-function timeout and memory allocation.

      thank god!!!!

    1. Local disk storage in the temporary directory is an in-memory filesystem. All files that you write consume memory available to your function. Files that you write are usually available at consecutive invocations, therefore failing to delete these files may eventually lead to an out-of-memory error and a subsequent cold start.

      Oooooh that is really good to know! I definitely thought that local files would have gotten deleted after each invocation 😨.

    1. When you use generation-match preconditions, a request succeeds only if the live version of the requested object has the specified generation number. If no such object exists, or is archived, Cloud Storage returns 412 Precondition Failed.

      So preconditions only work on live versions of objects

    2. If you send a delete request with a generation that corresponds to the currently live object, Cloud Storage deletes the object without making an archived copy.

      Interesting

    3. Each archived version of an object is charged at the same rate as the live version of the object. If you enable versioning, consider using Object Lifecycle Management, which can remove the oldest versions of an object as newer versions get archived.

      haha nice! Okay so you do get charged for every version stored

    1. Object archive events can be used only with versioning buckets. They are triggered when an old version of an object is archived. In particular, this means that when an object is overwritten or deleted, an archive event is triggered.

      Does this mean that in versioning buckets, 'delete'-ing a file really just means archiving it?

    1. Cloud Functions provides access to a local disk mount point (/tmp) which is known as a "tmpfs" volume in which data written to the volume is stored in memory. There is no specific fee associated with this however writing data to the /tmp mountpoint will consume memory resources provisioned for the function.

      👍👍👍

    1. There are still some areas where Google Cloud Functions and the Firebase SDK for Cloud Functions do not have full interoperability

      Aha! Yup Firebase Cloud Functions and GCloud Functions are different 😏

    2. Cloud Functions for Firebase is optimized for Firebase developers:

      Hmm. It seems like there is some type of difference between Cloud Functions for Firebase and Cloud Functions from google cloud services

    1. Creating a response to an event is done with a Trigger. A trigger is a declaration that you are interested in a certain event or set of events. Binding a function to a trigger allows you to capture and act on events.

      How does one bind such a function?

    1. Every deployed function is isolated from all other functions—even those deployed from the same source file. In particular, they don’t share memory, global variables, file systems, or other state. To share data across deployed functions, you can use storage services like Cloud Datastore, Cloud Firestore, or Cloud Storage

      I can see the advantages of this. I assume this still means that local / helper functions that a Cloud Function uses do share the same memory etc.

    2. The only writeable part of the file system is the /tmp directory (as defined by os.tmpdir()), which you can use to store temporary files in a function instance. This is a local disk mount point known as a "tmpfs" volume in which data written to the volume is stored in memory. Note that it will consume memory resources provisioned for the function.

      👍👍👍

    3. The function execution environment contains a runnable function file, plus files and directories included in the deployed function package such as local dependencies. These files are available in a read-only directory

      Woah does that mean that we can write any new files in cloud functions 😲😲😲

    4. In the case of HTTP functions, this also means returning the desired value even if the caller retries calls to the HTTP function endpoint

      This means that you'll probably want check for an items existence in a database before computing that item again.

    5. You can assume that the global scope has been executed exactly once before your function code is invoked in a new function instance (and on every subsequent creation of a new function instance)

      👍👍👍

    6. it is recommended to cache state across invocations in global scope where possible. Your function should be still prepared to work without this cache available as there is no guarantee that the next invocation will reach the same function instance

      👍👍👍

    7. For example, the counter value returned by the following function does not correspond to the total function invocation count because invocations may be handled by different function instances, which don’t share global variables, memory, file systems, or other state

      Got it. Basically, you should assume that state is unable to be shared between multiple invocations of a Cloud Function.

    8. However, each function instance handles only one concurrent request at a time. This means while your code is processing one request, there is no possibility of a second request being routed to the same function instance, and the original request can use the full amount of resources (CPU and memory) that you requested.

      Ahh that's great to know 😍

    1. Cloud Functions are written in Javascript and execute in a Node.js v6.14.0 environment on Google Cloud Platform

      You can ALSO use Node.js v8 but for some reason they don't tell you that here 😒

    1. You can use background functions to handle events from your Cloud infrastructure, such as messages on a Google Cloud Pub/Sub topic, or changes in a Google Cloud Storage bucket.

      Ohhh I think I see the difference between foreground and background function now! Foreground functions are an endpoint for an http request whereas background functions listen for events to happen in your Google Cloud ecosystem.

    1. projectId: 'grape-spaceship-123', keyFilename: '/path/to/keyfile.json'

      Do you need both of these or just one? Below it seems to say that you just need one. Why do they supply two here?

    1. Passing the path to the service account key in code You can alternately choose to explicitly point to your service account file in code, as shown in the following code example.

      🙏🙏🙏🙏🙏 finally found it

    1. Rapper Drake became the first artist to chart seven simultaneous Billboard Top 10 singles last week, besting the Beatles' record of five in 1964

      Woooooooow. That's crazy!!!!

    1. Using these functions executes a read operation in your database, which means you will be billed for reading documents even if your rules reject the request

      that's how they get you haha

    1. As a better solution, you can reduce the number of indexes by taking advantage of Cloud Firestore's ability to merge indexes for equality clauses:

      As I understand it, a merged index looks something like this:

      I1: field_A, field_B i2: field_B, field_C Merge I1,I2 = field_A, field_B, field_C

    2. Cloud Firestore does not automatically create composite indexes like it does for single-field indexes because of the large number of possible field combinations. Instead, Cloud Firestore helps you identify and create required composite indexes as you build your app.

      Am I correct in my understanding that for composite queries that they do a brute force approach until you decide to make a composite index at which point the queries become more efficient?

    3. A single-field index stores a sorted mapping of every document in a collection with a specific field. Each entry in a single-field index records a document's value for a specific field and the location of the document in the database.

      Interesting. Storing this many indices seems like this could make the database more bloated no?

    1. db.collection('coll').doc('doc').collection('subcoll').doc('subdoc') even though the document referenced by db.collection('coll').doc('doc') no longer exists. If you want to delete documents in subcollections when deleting a document, you must do so manually

      I didn't realize this, thanks for the heads up!!

    1. allow read, write: if roomId in get(/$(prefix())/users/$(request.auth.uid)).data.chats                            || exists(/$(prefix())/admins/$(request.auth.uid));

      This is saying: "Allow read and writes if you are part of the chat OR if you are a user with administrative privileges.

    2. Batched writes have fewer failure cases than transactions and use simpler code. They are not affected by contention issues, because they don't depend on consistently reading any documents. Batched writes execute even when the user's device is offline.

      Was going to ask what the difference between batch rights and transactions are but I remember now that transactions include reads and writes whereas batch rights only include writes.

    1. within documents.

      These words are key. They are only talking about nested objects within documents here. Not nested objects stored across documents / subcollectiosn

  5. www.heliconbooks.com www.heliconbooks.com
    1. The book identifier usually contains the book ISBN number, that is used by cataloging systems

      Do books only get an ISBN if they are published through some official publisher? In other words, do self-published books have an ISBN?

    1. all queries are shallow, meaning that you can simply fetch a document without having to fetch all of the data contained in any of the linked subcollections. This means you can store your data hierarchically in a way that makes sense logically without worrying about downloading tons of unnecessary data

      That's awesome!!

    2. Now if you're experiencing some deja vu, you're not alone. We realize this sounds awfully similar to another product you might already be using -- the Firebase Realtime Database. So if you're experiencing some deja vu, you're not alone.

      😂😂😂 that was great 😄

    1. It seems you can't dispatch() inside a reducer! This is how Redux was designed. Reducers only define how to move from one state to another; it can't have side effects

      Exactly! Reducers are supposed to be pure functions and are not meant to have any asynchronicity or mutate anything.

    1. Managing this ever-changing state is hard. If a model can update another model, then a view can update a model, which updates another model, and this, in turn, might cause another view to update. At some point, you no longer understand what happens in your app as you have lost control over the when, why, and how of its state. When a system is opaque and non-deterministic, it's hard to reproduce bugs or add new features.

      snaps fingers yup I agree!

    1. When an event happens, the Dispatcher would send the “payload” to the Store that is registered to listen for that particular action. Now it is up to the Store to update the View, which in turn triggers an action. The action to happen is also predetermined like name, type of action and so on.The View propagates the Action though a central Dispatcher and this will be sent to various Stores. These Stores would contain an application’s business logic and other data. It updates all the Views.

      That's it I'm out, this man is waaaay to repetitive for me. Time to find a better article ✌✌

    2. All the functionality is usually found within the Store. The Store is where all the work is done and tells the Dispatcher which events/actions it is listening for

      The author seems to be a bit verbose / redundant at times?

    3. the cascading updates makes the app really difficult to understand and debug

      Darn I'm not familiar with what is meant by cascading updates here. Could someone provide an example?

    4. MVC has stood the test of time, and ever since its launch in 1976, it has been the favorite for many developers.

      Woah I didn't realize MVC had been around for this long 😲

    5. problem with MVC is that it doesn’t scale well for Facebook’s huge code base

      I think it is really interesting how large software companies like Facebook and Google have to innovate new ways of reducing complexity of systems because of the challenges that you face when you reach such vast scales.

      In other words, it's no wonder that these companies are the ones that are coming out with the clever and clever ways of dealing with system complexity: they are the ones that have to deal with some of the most complex systems man has ever seen.

    1. <Note> <span>{task}</span> <button onClick={onDelete.bind(null, id)}>x</button> </Note>

      I mean if we're going to do this, what's the point of having a <note></note> element anymore? Why not just wrap the <span> and <button> elements in a<div></div> instead of doing this inside of Note.jsx?

      </button></span>

    2. a controlled component. We'll control the editing state explicitly from outside of the component. This gives us more power, but it also makes Editable more involved to use

      And by "outside the component", does it mean that the user directly influences the component as opposed to the component only being influenced via props?

    3. This uncontrolled way of designing can be valid if you don't want to do anything with the state outside of the component.

      So does uncontrolled mean that it is only influenced through props by its parents?

    1. It is equivalent to this ES5 code:

      Wait what? Why would you not just do this.setState({ name: value, });

      I don't understand why it is necessary to do this.setState({

      [name]: value,
      

      });

      Are they interchangeable? What's going on here?

    1. refs support a callback that gets called right after the component is mounted

      What is the point of using the callback for a ref? Should you use componentDidMount() instead?

    1. I was first prompted to take a close look at how Genius works on March 25th, when sexual health blogger Ella Dawson published a searing complaint alleging that the web annotator was tantamount to the forcible creation of comments for sites that don’t want them. I sympathized with her concerns somewhat, especially since Genius has thus far neglected to provide an opt-out mechanism for site owners. I immediately began working on a WordPress plugin called Genius Defender, which renders the service unusable for pages where it is running.

      😲

    2. The cross-site scripting prevented by the Content Security Policy is one of a broad class of security issues collectively known as "code injection."

      Does that mean that Genius's version of web annotations by prepending genius.it/ was form of code injection?

    1. with a given sequence of arguments preceding any provided when the new function is called.

      Ohhhh so if you wanted to pass an instance of a function such that each instance had a unique id, you could use bind as follows:

      function unboundGetX(uid = 10) { return uid; } var boundGetX = unboundGetX.bind(null, 7);

      var boundGetY = unboundGetX.bind(null, 9);

      console.log(boundGetX());

      console.log(boundGetY());

    2. The bind() method creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called.

      Invoking the function at the global scope: var unboundGetX = module.getX; console.log(unboundGetX());

      Invoking the function at the object's scope: console.log(module.getX());

    1. or an object expression to be expanded in places where zero or more key-value pairs (for object literals)

      let a = [1,2,3]

      Function calls: f(a) ==> f(1,2,3)

      Array literals: [a, 4] ==> [1,2,3,4]

      Object literals: I have no idea 😭😭😭. Could somebody explain this one?

    1. concat

      Just a heads up, concat() returns a new Array which is why we need to set the new state. Just performing concat() doesn't change this.state.notes

    2. After this change App owns the state even though the application still should look the same as before

      Ohhhh "App owns the state" because it is literally a property of the App class, this.state = {...}

    3. If you have used JavaScript before, the intuitive way to handle it would be to set up an event handler like () => notes.push({id: uuid.v4(), task: 'New task'}). If you try this, you'll see that nothing happens.

      haha yup that happened to me 😅

    4. o make room for more functionality, we could add a concept known as App on top of that. This component will orchestrate the execution of our application. We can add the button we want there and manage state as well as we add notes.

      Is app going to be the controller in the MVC model?

    5. The development setup will install the uuid dependency automatically.

      Bro you DEFINITELY should have said this before you wrote the code. I spent 10 minutes trying to figure out why I didn't have that package 😒

    6. Another interesting way to approach data would be to normalize it. In this case we would end up with a [<id> -> { id: '...', task: '...' }] kind of structure. Even though there's some redundancy

      woah woah woah. If "normalizing" data meant to reduce redundancies

      https://www.webopedia.com/TERM/N/normalization.html

      Why did the author say that this alternative version is more normalized? Like for example, it seems like the id's now exist twice <id> --> {id:....,task:....} where as before it was just one [{id:...,task:...},{...}]</id>

      The author even says himself that this way introduces more redundancy. What gives?

      Ya I guess I just don't really understand the intuition of this new data structure 😢

    1. a “read it later” service is just a fancy bookmarking app. You create an account, save articles you want to read from any web browser, and the app organizes them and lets you read them in a clean, uncluttered view that ditches most of the ads and focuses on the text.

      Is this a copy right infringement? If not why not?

    1. Highlighting in Pocket has two tiers: Free and Premium. All Pocket users will be able to create 3 highlights per article, and those who subscribe to Pocket Premium will be able to create an unlimited number of highlights.

      Fascinating. If they are introducing a barrier to the amount of annotations one you can put in an article, it does not seem like they care very much about the value of annotations 🤔. But we at hypothes.is know the value don't we 😛.

  6. developer.mozilla.org developer.mozilla.org
    1. If more than one trailing comma is used, an elision (or hole) is produced. An array with holes is called sparse (a dense array has no holes). When iterating arrays for example with Array.prototype.forEach() or Array.prototype.map(), array holes are skipped

      How many wholes get created when you add more than one trailing comma? I think I'm assuming that a whole is one element wide.

    1. Historically we have mixed the concerns of the DOM and state and tried to manage it there

      What is an example of mixing up the concerns of the DOM and the state? I don't think I follow why/how this is a problem?

    1. Even though it's a simple tool, it's quite powerful, and you can find use for it in many places

      Ya Trello learned that this was true and made a fortune lol...guess I'm just being salty haha

    2. Kanban, originally developed at Toyota, allows you to track the status of tasks. It can be modeled in terms of Lanes and Notes. Notes move through Lanes representing stages from left to right as they become completed

      Wow you're kidding this is Trello....you're saying that somebody took this idea from Toyota and made a $400M company from that 😑

    1. theoretically, all components in React could hold state, this is not the case — one of React’s best practices is to keep as many components as possible stateless, and isolate state into as few places as possible.

      interesting 🤔

    2. In an application that employs a two-way binding model, a change to the view is able to mutate the model data, and visa versa.

      that probably makes things incredibly convinient for the developer

    3. Getting from one’s wireframes to a working user interface was quite the ordeal, only intensified by the fact that one’s Photoshop layers didn’t directly map to HTML element

      yup been there before lol

    1. This is a necessary redundancy for two-way relationships. It allows you to quickly and efficiently fetch Ada's memberships, even when the list of users or groups scales into the millions or when Realtime Database security rules prevent access to some of the records.

      Fascinating! So redundancy seems to be a requirement in a NoSQL database in order to reduce the amount of stuff that you load at once.

    2. For example, listing the titles of chat conversations requires the entire chats tree, including all members and messages, to be downloaded to the client.

      Woah that's a scary!