1. Voltage Dividers

    Working through some example circuit simulations I finally gained an intuitive understanding of the voltage divider equation — it’s just a ratio, but I had never figured this out before.

    Given this circuit, where the voltage source is rated at 1V:

    The voltage at A is equal to 1V·(R2 / R1 + R2), which is 1·(1/1+1) = 1·(1/2) = 0.5.

    Why? Because R1 + R2 represents the total resistance of the path, and as such the total voltage drop. Dividing R2 by the total produces a fraction representing the voltage drop over R2. Multiplying the input voltage by this fraction leaves us with the voltage dropped over just the R2 portion of the circuit, which must be VA because there are no other branches in the circuit.

    Put another way, the equation finds the ratio of resistance (and so voltage drop) R2:R1 and then feeds the input voltage through this. Here’s a more abstract visual representation of what’s going on:

  2. Emil Björklund: #PHP folks: when fetching from an API, would it be wise to use function_exists to check for cURL, and else fall back to file_get_contents()?

    @thatEmil that should work fine — one thing to bear in mind is that by default they both treat redirects differently. IIRC, cURL doesn’t follow redirects by default whereas file_get_contents will.

  3. Sandeep Shetty: @BarnabyWalters Very cool. What's the use-case though? Also is this coming of the doctrine based indexer that you had?

    @sandeepshetty thanks! I’ve wanted to plot tag usage over time for a while now to see if there are any interesting patterns. I’m not using doctrine any more, in fact I’m not even using a SQL database for indexing until I really need one — data stored in yaml files, indexed by a csv file in ~210 lines of code — see also waterpigs.co.uk/notes/4TQNY2

    When I post a note, adds one to the week counter for each tag, then I have an endpoint which makes that data into an SVG.

  4. @chloeweil great article and great work implementing ! Interested in your choice to use a database for performance reasons, was that prompted by actual experience or just the cited help thread? fwiw I’m having no performance problems storing >2000 notes in flat files with a CSV file index