2,472 Matching Annotations
  1. Mar 2020
    1. The author of the class probably begins the names with the underscore(s) to tell you, “don’t use it”

      __ <--- don't touch!

    2. You can keep away from that with some additional logic. One of the ways is this:

      You can keep away from the problem:

      >>> def f(value, seq=[]):
      ...     seq.append(value)
      ...     return seq
      

      with some additional logic:

      >>> def f(value, seq=None):
      ...     if seq is None:
      ...         seq = []
      ...     seq.append(value)
      ...     return seq
      

      Shorter version:

      >>> def f(value, seq=None):
      ...     if not seq:
      ...         seq = []
      ...     seq.append(value)
      ...     return seq
      

      The result:

      >>> f(value=2)
      [2]
      >>> f(value=4)
      [4]
      >>> f(value=8)
      [8]
      >>> f(value=16)
      [16]
      
    3. The Pythonic way is to exploit the fact that zero is interpreted as False in a Boolean context, while all other numbers are considered as True

      Comparing to zero - Pythonic way:

      >>> bool(0)
      False
      >>> bool(-1), bool(1), bool(20), bool(28.4)
      (True, True, True, True)
      

      Using if item instead of if item != 0:

      >>> for item in x:
      ...     if item:
      ...         print(item)
      ... 
      1
      2
      3
      4
      

      You can also use if not item instead of if item == 0

    4. When you have numeric data, and you need to check if the numbers are equal to zero, you can but don’t have to use the comparison operators == and !=

      Comparing to zero:

      >>> x = (1, 2, 0, 3, 0, 4)
      >>> for item in x:
      ...     if item != 0:
      ...         print(item)
      ... 
      1
      2
      3
      4
      
    5. it’s a good practice to use properties when you can and C++-like getters and setters when you have to

      Use

      • properties <--- when you can
      • getters and setters <--- when you have to
    1. Dutch programmer Guido van Rossum designed Python in 1991, naming it after the British television comedy Monty Python's Flying Circus because he was reading the show's scripts at the time.

      Origins of Python name

    1. Dunder or magic method, are methods that start and end with double _ like __init__ or __str__. This kind of methods are the mechanism we use to interact directly with python's data model

      Dunder methods

    1. As the name suggests, multiprocessing spawns processes, while multithreading spawns threads. In Python, one process can run several threads. Each process has its proper Python interpreter and its proper GIL. As a result, starting a process is a heftier and more time-consuming undertaking than starting a thread.

      Reason for multiprocessing being slower than multithreading:

      Multiprocessing is more time-consuming to use because of its architecture

    1. supporting this field is extremely easy If you keep raw data, it's just a matter of adding a getter method to the Article class.

      Way of supporting a new field in JSON is much easier than in a relational database:

      @property
      def highlights(self) -> Sequence[Highlight]:
          default = [] # defensive to handle older export formats that had no annotations
          jsons = self.json.get('annotations', default)
          return list(map(Highlight, jsons))
      
    2. query language doesn't necessarily mean a database. E.g. see pandas which is capable of what SQL is capable of, and even more convenient than SQL for our data exploration purposes.

      Query language, not always = database. For example, see pandas

    3. cachew lets you cache function calls into an sqlite database on your disk in a matter of single decorator (similar to functools.lru_cache). The difference from functools.lru_cache is that cached data is persisted between program runs, so next time you call your function, it will only be a matter of reading from the cache.

      cachew tool isolates the complexity of database access patterns in a Python library

    1. We only need to use global keyword in a function if we want to do assignments / change them. global is not needed for printing and accessing.

      global inside a function is:

      • required if we want to assign/change variable
      • not required if we just want to print/access a variable.

      Example code:

      # This function modifies global variable 's' 
      def f(): 
          global s 
          print s 
          s = "Look for Geeksforgeeks Python Section"
          print s  
      
      # Global Scope 
      s = "Python is great!" 
      f() 
      print s
      
    1. The nonlocal keyword is used to work with variables inside nested functions, where the variable should not belong to the inner function. Use the keyword nonlocal to declare that the variable is not local.

      nonlocal is used to declare variables inside the nested functions.

      Example (if nonlocal wouldn't be used, the output would be "John", not "hello"):

      def myfunc1():
        x = "John"
        def myfunc2():
          nonlocal x
          x = "hello"
        myfunc2()
        return x
      
      print(myfunc1())
      
    1. Here, I rewrite this example using the walrus operator

      How to reduce Python expressions using the walrus operator (:=). It's used to both assign and evaluate variable names in a single expression, thus reducing repetition.

      Before:

      count = fresh_fruit.get('lemon', 0)
      if count:
      ...
      

      After:

      if count := fresh_fruit.get('lemon', 0):
      ...
      
    1. map, filter and reduce can all operate independently, or be chained together

      map, filter, reduce

    2. During each loop of reduce, you can get result of the last loop, and the next element in the array Change the result, then return it for the next loop iteration When you're done, you have the completed collection

      reduce reduce

    3. This lets you transform each element into something new (or keep it the same) Types don't have to be the same: can return objects, string, numbers - anything!

      map map

    4. It loops over the elements, passing each one to a callback function You can return true to include that element in the new array, or false to exclude it

      filter filter

    5. So why are map, filter and reduce useful?

      Advantages of map, filter, reduce:

      • don't have to manually loop over array
      • chain together for short, straightforward array transformations
      • can reuse callback functions and compose them together
    1. The formula China is using is current total deaths/current confirmed cases.

      Mortality rate of COVID-19 used by China =

      \(\dfrac{currentTotalDeaths}{currentConfirmedCases}\)

    2. Each year the flu infects between 2 to 11% of the population. 11The infectiousness of a disease is measured by its R0 value. R0 is a measure of how many people will catch a disease from one infected person. The R0 value of the flu is 1.28. The R0 of COVID-19 is assumed to be between 1.4–3.8

      R0 - measure of how many people will catch a disease from one infected person.

      R0 (Flu): 1.28

      R0 (COVID-19): 1.4 - 3.8 (but some say 4.7 - 7.12)

    3. cases outside of china are doubling roughly every 5 days. The reported rate of infection in China is lower, but China has taken drastic quarantine measures, including welding people inside apartment buildings.

      Doubling tendency of COVID-19

    4. “confirmed cases” is the lowest possible number of cases in that country. It’s the lower bound of an estimate.

      What confirmed cases actually means

    5. In The Atlantic, Marc Lipsitch, a leading epidemiologist at Harvard reported that “that within the coming year, some 40 to 70 percent of people around the world will be infected with the virus that causes COVID-19”. This was last week and while ridiculed at the time, his assumptions are now the generally accepted position among epidemiologists.

      40 - 70 % of people will be infected with COVID-19 (it might even increase)

    6. Death Rate

      Death rate of COVID-19:

    7. The Virus may persist on surfaces for up to 9 days, on some surfaces up to 27 days

      Coronavirus' lifespan

    1. 10-50 minutes in natural spaces was the most effective to improve mood, focus and physiological markers like blood pressure and heart rate. “It’s not that there’s a decline after 50 minutes, but rather that the physiological and self-reported psychological benefits tend to plateau after that,”

      Nature therapy

      • 10 to 50 minutes in nature was found to be most effective to improve mood, focus, blood pressure, and heart rate
      • After 50 minutes the effects tend to plateau
    1. Steven Hoober shed light on the three ways users hold their phones.

      3 most popular ways people use their smartphones:

  2. Feb 2020
    1. We’re mapping a human health tragedy that may get way worse before it subsides. Do we really want the map to be screaming bright red? Red is a very emotive colour. It has meaning. It can easily connotate danger, and death, which is still statistically extremely rare for coronavirus.

      Why using a red colour on choropleth map might be not the best choice

    2. you cannot map totals using a choropleth thematic mapping technique. The reason is simple. Each of the areas on the map is a different size, and has a different number of people in it.

      Why using choropleth thematic mapping isn't a good idea for a Covid-19 map

    1. Learn how to write good emails, how to present your work, how to phrase your questions in a thoughtful manner.

      Important soft skills to be learned by junior devs

    1. I want to have a choice whether to forget or remember events, and I'd like to be able to potentially access forgotten ones.

      It's better to lifelog than not if we have a choice

    1. Even ignoring quality of life you are looking at a 3-7 fold return on every minute you spend exercising in extended life,[1] perhaps even exceeding that if you are making optimal use of your time. Something just clicked and I was consistent since reading this. Even 1-fold return would worth it: basically you gain free consciousness (quality of thinking is shit when I exercise, but it's better than nothing).

      While exercising, you get additional lifespan, which obviously isn't linear, but still worth the effort

    2. Exobrain, or "second brain", or "brain dump" is something like public wiki where you can keep your notes, ideas and thoughts.

      Exobrain examples:

    3. Annotation is the process of adding a layer of personal (with a potential for sharing) metadata on top of existing content such as highlights, notes, anchors etc.

      Just like I'm doing it here now (annotation) ;)

    4. Human brains seem to be best for generating new ideas. I want to learn more, think faster, distract less, interact and visualize, effortlessly remember everything; not memorize and do routine information processing, which computers seem better at.

      Why Personal Knowledge Management (PKM) is important

    5. Extended mind is the idea that your mind isn't limited by your physical body, but augmented by external means. Paper notes & diaries, data in your computer/phone/cloud – all these things contribute to your cognitive process, thinking and help you navigate the landscape of ideas. One of the biggest motivations to start dumping my brain out here, write and share is to offload my mind a bit and interact with people even in my physical absence.

      Extended mind - idea that our mind doesn't only resist in our physical body

    6. I can't imagine going on a run without my HR monitor, because whatever the benefit exercise has and however exhausting run would be, at least I'll have a data point. learning about routine and trying to optimize routine is also way more fun than doing the actual routine Human body is fragile and needs constant care, but it's still a fascinating mechanism.

      Quantifying self during the run is also my main use. It adds a layer of motivation when I see just the timestamps of all my journeys

    1. quantified self refers both to the cultural phenomenon of self-tracking with technology and to a community of users and makers of self-tracking tools who share an interest in “self-knowledge through numbers.”[1] Quantified Self practices overlap with the practice of lifelogging and other trends that incorporate technology and data acquisition into daily life, often with the goal of improving physical, mental, and/or emotional performance.

      Quantified self relates to all of us managing our life with Mi Bands, Fitbits, etc.

    1. Its automated reasoning sounds great

      You can also use automated reasoning inside Grakn (machine learning)

    2. In Grakn, these algorithms are built-in as native functionalities of the language.

      In Grakn, distributed analytics are built-in

    3. code below instantiates a client, opens a session, and runs an insertion query

      Start by instantiating a client and opening a session. Afterwards, you can begin to run queries

    4. We will use the python client API to interact with Grakn.

      After setting up Grakn keyspace, you can interact with it using Python client API

    5. We just created a Grakn keyspace experiment and defined its schema.

      It's good to have a single Grakn keyspace per application (outermost container for data in a Grakn knowledge graph, corresponding closely to a relational database)

    6. Now that we have the schema ready, the next step is to load it into Grakn.

      After defining schema, it needs to be loaded into Grakn:

      1) Place schema.gql in the container volume, such as db/schema.gql.

      2) Run:

      docker exec -ti grakn bash -c '/grakn-core-all-linux/grakn console --keyspace experiment --file /grakn-core-all-linux/server/db/schema.gql'
      

      3) Observe a similar result:

      Loading: /grakn-core-all-linux/server/db/schema.gql
      ...
      {}
      Successful commit: schema.gql
      
    7. An attribute can be abstract if you never assign it directly and use it only as a parent type. Entities can be abstract, too, if they are never instantiated.

      Attributes and entities can be abstract

    8. There's just one more step – defining the attribute types

      Don't forget to define attribute types, such as:

      name sub attribute,
          datatype string;
      
      address sub attribute,
          datatype string;
      
      timestamp sub attribute, abstract,
          datatype date;
      
          created sub timestamp;
          last-modified sub timestamp;
          last-accessed sub timestamp;
          penalty-until sub timestamp;
      
      url sub attribute,
          datatype string;
      

      ...

    9. Attributes can be assigned to anything, including relations.
    10. We've ended up with three entities: user, badge and location. How to glue them together? Using relations.

      Use of relations to glue different entities:

      location-of-user sub relation,
          relates located-user,
          relates user-location;
      
      achievements sub relation,
          has score,
          relates contributor,
          relates award;
      
    11. Some things are common to multiple users, like a location (e.g. Austin, TX, USA) or the types of badges they've been awarded (bronze, silver, gold). We'll model locations and badges as separate entities.

      Modelling separate entities:

      location sub entity,
          key address,
          plays user-location;
      
      badge sub entity,
          key color,
          plays award;
      
    12. Graql — Grakn's query language that allows you to model, query and reason over data.

      Graql is part of Grakn

    13. What can we have in a schema? There are three types of things

      In schema we can have three types of things:

      • entity
      • attribute
      • relation
    14. schema – a skeleton structure that represents the logical view of the entire knowledge graph

      Before using JSON data in the database, we need to define its schema

    15. To keep things nice and platform agnostic, let’s go with Docker.

      You can run Grakn with Docker using 3 simple commands (check below this highlight)

    16. Grakn is a knowledge base for intelligent systems. A quick look at their developer site and examples piqued my curiosity

      Grakn:

    1. Of the three primary color channels, red, green and blue, green contributes the most to luminosity.

      Green colour vs red and blue (RGB)

    1. Imagine that you're using a database to export them, so your schema is: TABLE Article(STRING id, STRING url, STRING title, DATETIME added). One day, the developers expose highlights (or annotations) from the private API and your export script stats receiving it in the response JSON. It's quite useful data to have! However, your database can't just magically change to conform to the new field.

      Relational model can be sometimes hand tying, unlike JSON

    2. Storage saved by using a database instead of plaintext is marginal and not worth the effort.

      Databases save some space used by data, but it's marginal

    3. if necessary use databases as an intermediate layer to speed access up and as an additional interface to your data Nothing wrong with using databases for caching if you need it!

      You may want to use databases for:

      • speeding access up
      • creating additional layer
      • caching
    4. I want to argue very strongly against forcing the data in the database, unless it's really inevitable.

      After scraping some data, don't go immediately to databases, unless it's a great stream of data

    1. black and white with monotones

      Hues <--- pure colors

      Tints <--- hue + white

      Tones <--- hue + grey

      Shades <--- hue + black

    2. Basic Color Schemes

    3. Warm colors exhibit energy and joy (best for personal messages), while cool colors convey calmness and peace (best for office use).

      Warm and Cool colors

    1. But I think we read a lot of self-help because we need to. As I’ve already mentioned, we need lots of examples to drive this wisdom home. We should be more forgiving of self-help (the genre) and more forgiving of ourselves. Putting wisdom into practice takes requires reading, reflection, and practice—but it’s worth it.

      Read lots of self-help as it's worth it

    2. advice can either be arcane or obvious, general or specific.

      Aim to share the good self-help as the bad self-help might not apply to everyone.

    3. no business book can predict what sorts of situations (businesses, market conditions, etc.) the reader will encounter, so instead it offers general, obvious-sounding rules.

      Business books

    4. We feel divinely inspired while reading Minimalism, but when it’s time to actually cull our wardrobes, it turns out we have good reasons for keeping everything!

      Read less, apply more!

    5. We’re embarrassed by self-help because (at its best) it’s full of banal platitudes—but these are platitudes because they’re so general.

      We tend to be embarrassed by self-help

    6. Wisdom Knowledge

      Wisdom vs Knowledge: Easily understood Difficult to learn Widely applicable Narrowly useful Hard to implement Easy to implement Self-help Textbooks

    7. So which is it? Is our obsession with self-help embarrassing or admirable? Is self-help snake oil or salvation? I’m going to argue that it’s both.

      Self-help can be good and bad

    8. But what if you wanted wisdom, not knowledge? Are there books that contain wisdom? In other words, are there books that give you general-purpose, one-size-fits-all advice for navigating life? Of course there is! It’s called self-help.

      Self-help books are there to make you wise, not knowledgable

    9. “a wise person knows what to do in most situations, while a [knowledgeable]1 person knows what to do in situations where few others could.” In other words, wise people are moderately successful in many domains, while knowledgeable people are very successful in a few.

      ~ Paul Graham

    1. there are two sources of feeling like a noob: being stupid, and doing something novel. Our dislike of feeling like a noob is our brain telling us "Come on, come on, figure this out."

      Two sources of being a noob

    2. the more of a noob you are locally, the less of a noob you are globally.For example, if you stay in your home country, you'll feel less of a noob than if you move to Farawavia, where everything works differently. And yet you'll know more if you move. So the feeling of being a noob is inversely correlated with actual ignorance.

      Being a noob

    1. n the end, it didn’t matter if the students walked more than even 15,000 steps; they still gained weight
      • Step-counting experiment tracked caloric intake and weight of 120 participants throughout 24 weeks of walking different amounts of steps a day for 6 days per week.
      • Participants gained 1.5 kg (3.5 lbs) on average during the experiment, even those who walked 15,000 steps a day.
      • While their weight wasn’t affected, they did notice positive changes in their physical activities, and reduced sedentary time.
      • Overall, the more steps we walk, the better.
      • Step-a-day goals are great to get up and get moving, but if you need to lose weight, you must do other things as well.
    1. Scientists at EPFL in Switzerland have shown that you are more likely to initiate a voluntary decision as you exhale.

      We make conscious decisions when we breathe out, says new study involving 52 people pressing a button, monitored with brain, heart and lung sensors.

    1. A combinaison of split(), subString(), removePrefix(), removeSuffix() is usually enough.

      Sometimes the following functions are more than enough for your string matching problems

  3. Jan 2020
    1. When you get tired of thinking about a piece of work and feeling bad for not finishing it yet, go "screw it, let's do it" and start with something, anything.

      One way of starting to do what we postpone

    2. When you know that you don't have to make the greatest thing ever right from the start, it's easier to start. And then it's easier to continue.

      Apply the MVP principle to start doing

    1. Level 0 is no automation whatsoever. Level 1 is partial assistance with certain aspects of driving, like lane keep assist or adaptive cruise control. Level 2 is a step up to systems that can take control of the vehicle in certain situations, like Tesla's Autopilot or Cadillac's Super Cruise, while still requiring the driver to pay attention. Get past that and we enter the realm of speculation: Level 3 promises full computer control under defined conditions during a journey, Level 4 expands that to start-to-finish autonomous tech limited only by virtual safeguards like a geofence, and Level 5 is the total hands-off, go-anywhere-at-the-push-of-a-button experience.

      Description of 6 levels defining autonomous cars:

      1. Level 0 - no automation.
      2. Level 1 - partial assistance with certain aspects of driving, like lane keep assist or adaptive cruise control.
      3. Level 2 - step up to systems that can take control of the vehicle in certain situations, like Tesla's Autopilot or Cadillac's Super Cruise, while still requiring the driver to pay attention.
      4. Level 3 - promises full computer control under defined conditions during a journey.
      5. Level 4 - expands that to start-to-finish autonomous tech limited only by virtual safeguards like a geofence.
      6. Level 5 - total hands-off, go-anywhere-at-the-push-of-a-button experience.
    2. The CEO of Volkswagen's autonomous driving division recently admitted that Level 5 autonomy—that's full computer control of the vehicle with zero limitations—might actually never happen.
    1. Majority of the times, the only way to break into a circle is for someone within that circle to speak positively on your behalf.

      Who speaks on your behalf?!

    2. I have observed something else under the sun. The fastest runner doesn’t always win the race, and the strongest warrior doesn’t always win the battle. The wise sometimes go hungry, and the skillful are not necessarily wealthy. And those who are educated don’t always lead successful lives. It is all decided by chance, by being in the right place at the right time. — Ecclesiastes 9:11
    3. They simply possess the willpower and drive to observe people, get to know people, appear in gatherings that involve people that are aligned with their goals, and connect people with one another.

      Skill that puts sometimes the smartest minds below you

    1. This quote from Richard Feynman is at the top of my blog’s landing page: I learned very early the difference between knowing the name of something and knowing something.

      Inspiration to maintain a research blog

    2. Summarizing a paper in your own words restructures the content to focus on learning rather than novelty.

      In the scientific papers we convey novelty, hence, some of the early readers might confuse themselves that this is the right way to speak in a daily scientific community

    3. Blogging has taught me how to read a paper because explaining something is a more active form of understanding. Now I summarize the main contribution in my own words, write out the notation and problem setup, define terms, and rederive the main equations or results. This process mimics the act of presenting and is great practice for it.

      Why teaching others/blogging has a great value in terms of learning new topics

    4. When I first started teaching myself to program, I felt that I had no imagination. I couldn’t be creative because I was too focused on finding the syntax bug or reasoning about program structure. However, with proficiency came creativity. Programming became less important than what I was building and why.

      While learning, don't worry about the creativity, which shall come after gaining proficiency (knowledge base)

    5. In my opinion the reason most people fail to do great research is that they are not willing to pay the price in self-development. Say some new field opens up that combines field XXX and field YYY. Researchers from each of these fields flock to the new field. My experience is that virtually none of the researchers in either field will systematically learn the other field in any sort of depth. The few who do put in this effort often achieve spectacular results.

      I think we all know that...

    6. Many of us have done this on exams, hoping for partial credit by stitching together the outline of a proof or using the right words in an essay with the hopes that the professor connects the dots for us.

      Often we tend to communicate with a jargon we don't understand just to pretend we know something

    1. Since water is denser than air, and the reflection is diffuse. A lot of light is internally reflected, thereof, increasing the probability of absorption at surface.

      The light is reflected back inside the water, because of the total internal reflection:

      • water is denser than air
      • angle of incidence is greater than the so-called critical angle

    2. This is because the light now has a layer of water to go through. And due to the reflectance of water, not all light at the air-liquid-interface (border between air and water) goes through the water. Some of it is reflected.

      Wet things become darker, because of the water consistency, reflectance that doesn't let all the light to transmit through it.

      The probability of light getting transmitted is: 1 - R1 (reflectance at the air-liquid interface)

    3. There are two types of reflection (two ways the wave can be thrown back). Specular Diffuse

      Two types of reflection:

      1. specular - light leaves the surface at the same angle it hits it
      2. diffuse - hitting light is scattered into all angles when reflected
    1. ericb 12 days ago | unvote [-] * Better googling. Time-restricted, url restricted, site restricted searches. Search with the variant parts of error messages removed.* Read the source of upstream dependencies. Fix or fork them if needed.* They're better at finding forks with solutions and gleaning hints from semi-related issues.* Formulate more creative hypothesis when obvious lines of investigation run out. The best don't give up.* Dig in to problems with more angles of investigation.* Have more tools in their toolbelt for debugging like adding logging, monkey-patching, swapping parts out, crippling areas to rule things out, binary search of affected code areas.* Consider the business.* Consider user-behavior.* Assume hostile users (security-wise).* Understand that the UI is not a security layer. Anything you can do with PostMan your backend should handle.* Whitelist style-security over blacklist style.* See eventual problems implied by various solutions.* "The Math."

      What do top engineers do that others don't?

      • Better googling. Time-restricted, url restricted, site restricted searches. Search with the variant parts of error messages removed.
      • Read the source of upstream dependencies. Fix or fork them if needed.
      • They're better at finding forks with solutions and gleaning hints from semi-related issues.
      • Formulate more creative hypothesis when obvious lines of investigation run out. The best don't give up.
      • Dig in to problems with more angles of investigation.
      • Have more tools in their toolbelt for debugging like adding logging, monkey-patching, swapping parts out, crippling areas to rule things out, binary search of affected code areas.
      • Consider the business.
      • Consider user-behavior.
      • Assume hostile users (security-wise).
      • Understand that the UI is not a security layer. Anything you can do with PostMan your backend should handle.
      • Whitelist style-security over blacklist style.
      • See eventual problems implied by various solutions.
      • "The Math."
    1. technology diffused more easily along lines of latitude than along lines of longitude because climate changed more rapidly along lines of longitude making it more difficult for both humans and technologies to adapt

      Technology adapts better across latitude than longitude

    2. Anything that’s invented between when you’re fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it.

      Before 15 it's just a part of our world creation, after 35 it's the natural order of things

    3. "One of history’s few iron laws is that luxuries tend to become necessities and to spawn new obligations. Once people get used to a certain luxury, they take it for granted. Then they begin to count on it. Finally they reach a point where they can’t live without it.”

      Be careful what becomes your necessity to live

    4. A 90s study showed that women preferred the scents of men whose immune systems were most different from their own immune-system genes. Evolutionarily this makes sense as, children should be healthier if their parents’ genes vary, protecting them from more pathogens.

      Why women are attracted to opposite scents in a men

    5. Between 2011 and 2013, china used 50% more cement than the United States in the 20th century.Of the world’s 100 highest bridges, 81 are in China, including some unfinished ones.

      China's infrastructure is growing amazingly fast

    6. Here’s Warren Buffett: “Cola has no taste memory. You can drink one at 9am, 11am, 5pm. You can't do that with cream soda, root beer, orange, grape. You get sick of them after a while. The average person drinks 64 ounces of liquid per day, and you can have all 64 ounces of that be Coke.”Same with Doritos, Cheetos, most popular junk food. They are engineered to overcome “sensory-specific satiety” and to give a sense of “vanishing caloric density.”

      Why chips and coca-cola are addicting:

      the taste is vanishing

    7. One of the tasks of true friendship is to listen compassionately and creatively to the hidden silences. Often secrets are not revealed in words, they lie concealed in the silence between words.

      Listen to the silence

    8. Video Games are a Booming IndustryThe video game industry generates more revenue than movies and music.

      Revenue raised by videogames > films + music

    9. Humor treads at the frontier of consciousness. When a comic finds a funny joke, they are unearthing a truth that people are only kind of aware of, but the whole room grasps that everybody else is aware of the truth, and laughter ensues.

      Humor as a comprehension

    10. Highest Grossing Media Franchises

      What type of media sells the most:

    11. How the Sun Moves
    12. “Twitter is the most amazing networking and learning network ever built.For someone whose pursuing their dream job, or chasing a group of mentors or peers, it’s remarkable. In any given field, 50-80% of the top experts in that field are on Twitter and they’re sharing ideas, and you can connect to them or follow them in your personal feed.If you get lucky enough and say something they find interesting, they might follow you, and the reason this becomes super interesting is that unlocks direct message, and now all of a sudden you can communicate directly or electronically with that individual. Very, very powerful.If you’re not using Twitter, you’re missing out.” — Bill Gurley

      I cannot agree more on this, since I finally accumulated a great network on Twitter. It's important to hit the bell icon next to the profiles we value the most, so that we're never missing out of their new content

    13. 80% of Americans live, work, and hang out in the pink areas — 3.6 percent of the landmass of the lower 48 states.

      Map where 80% of Americans' life is

    14. "The easiest way to be discovered right now in technology and perhaps many fields is to create your own independent blog and write. There is a huge dearth in availability of good, current, first party content today.The single most important advice I can give to actually write is to write.The thing that happens which you don’t see until you write is that your content engages some of the smartest people who are lurking around the internet. And they reach out to you."

      Totally agree with this ;)

    15. By some estimates, more than 50,000 pieces of artwork are stolen each year, amounting to annual losses of around $6 to $8 billion globally. This makes art theft one of the most valuable criminal enterprises around, exceeded only by drug trafficking and arms dealing.

      Art crime is even more serious than we think

    16. Where is Wealth Concentrated?

      Map of wealth concentration

    17. This map shows the relative density of commercial shipping around the world. The darker the color, the busier the route.

      Map of global shipping routes

    18. I've noticed a weird pattern: In most of the best marriages I see, one person is an early-bird, and the other is a night-owl. They have opposite circadian rhythms.I think this is healthy. The two partners get the benefits of time together and time alone, which helps the marriage.

      Circadian rhythm as a way to validate a great marriage

    19. look around and figure out who you want to be on your team. Figure out the people around you that you want to work with for the rest of your life. Figure out the people who are smart & awesome, who share your values, who get things done — and maybe most important, who you like to be with and who you want to help win. And treat them right, always. Look for ways to help, to work together, to learn. Because in 20 years you’ll all be in amazing places doing amazing things.

      One of the best life advises some can get

    1. It goes completely against what most believe, but out of all major energy sources, nuclear is the safest

      Nuclear energy as the safest energy

  4. Dec 2019
  5. unix4lyfe.org unix4lyfe.org
    1. if you care at all about storing timestamps in MySQL, store them as integers and use the UNIX_TIMESTAMP() and FROM_UNIXTIME() functions.

      MySQL does not store offset

    2. The system clock is inaccurate. You're on a network? Every other system's clock is differently inaccurate.

      System clocks are inaccurate

    3. A time format without an offset is useless.

      Always use timezone offset

    4. If you want to store a humanly-readable time (e.g. logs), consider storing it along with Unix time, not instead of Unix time.

      Logs should be stored along with Unix time

    5. When storing a timestamp, store Unix time. It's a single number.

      Store Unix timestamps (single numbers)

    6. Most of your code shouldn't be dealing with timezones or local time, it should be passing Unix time around.

      Most of your code should use Unix time

    7. Unix time: Measured as the number of seconds since epoch (the beginning of 1970 in UTC). Unix time is not affected by time zones or daylight saving

      Unix time - # of seconds since 1970 in UTC

    8. GMT is still used: it's the British national timezone in winter. In summer it becomes BST.

      GMT and BST in Britain

    9. Australian Eastern Standard Time is UTC+1000. e.g. 10:00 UTC is 20:00 EST on the same day.

      Example of UTC offset

    10. GMT: UTC used to be called Greenwich Mean Time (GMT) because the Prime Meridian was (arbitrarily) chosen to pass through the Royal Observatory in Greenwich.

      GMT - previous name of UTC

    11. UTC: The time at zero degrees longitude (the Prime Meridian) is called Coordinated Universal Time (UTC is a compromise between the French and English initialisms)

      UTC

    1. we shield ourselves from existential threats, or consciously thinking about the idea that we are going to die, by shutting down predictions about the self,” researcher Avi Goldstein told The Guardian, “or categorizing the information as being about other people rather than ourselves.

      Magically, our brain doesn't easily accept the fact that we will die some day. It was proved by the short experiment:

      volunteers were watching images of faces with words like "funeral" or "burial", and whenever they've seen their own one, the brain didn't showcase any surprise signals

    1. test of whether they know how to look for help.Are they able to read a manual?Can they formulate a search query?How do they assess whether the tutorial they found is suitable or reliable?What steps do they take to make sure they're finding - and learning - the right information?

      Interesting approach to hiring: put someone in front of an unfamiliar program, make them complete a set of tasks and observe how they look for help.

    1. Zugzwang (German for "compulsion to move", pronounced [ˈtsuːktsvaŋ]) is a situation found in chess and other games wherein one player is put at a disadvantage because they must make a move when they would prefer to pass and not move

      Zugzwang - I need to remember this word!

    1. Today, my process is enjoyably unsophisticated. When I want to post something, I first write it in a text file, copy my last blog post’s HTML file, paste in my new article, make some slight adjustments, update my list of posts, add it to my RSS file, and that’s basically it. Any page on my website can be anything I want it to be, like how, for example, double clicking on this article leads to a small easter egg.

      Interesting approach on ignoring any type of site generators

    1. walking, cycling and more green spaces not only cut air pollution but also improved mental health.

      Quick tip: try to omit public transportation when possible, take a walk and influence others

    2. “Although the studies included were from different parts of the world – eg China, the US, Germany – and varied in sample size, study design and measures of depression, the reported associations were very similar.”

      The studies proved that the cultural background did not have a direct impact on the results

    3. The studies analysed took account of many factors that might affect mental health, including home location, income, education, smoking, employment and obesity. But they were not able to separate the potential impact of noise, which often occurs alongside air pollution and is known to have psychological effects.

      During the study behind the effect of air pollution, other factors were taken into the consideration as well

    4. more than 90% of the global population lives with air pollution above WHO-recommended levels

      Devastating news

    5. People exposed to an increase of 10 micrograms per cubic metre (µg/m3) in the level of PM2.5 for a year or more had a 10% higher risk of getting depression.

      Level of air impact

    6. The data analysed in the new research linked depression with air pollution particles smaller than 2.5 micrometres (equivalent to 0.0025 millimetres and known as PM2.5)

      Beware of particles smaller than 2.5 micrometres

    7. Other research indicates that air pollution causes a “huge” reduction in intelligence and is linked to dementia. A comprehensive global review earlier in 2019 concluded that air pollution may be damaging every organ and virtually every cell in the human body.

      Air pollution impacts more than just our mental health

    8. the finest particulates from dirty air can reach the brain via both the bloodstream and the nose, and that air pollution has been implicated in increased [brain] inflammation, damage to nerve cells and to changes in stress hormone production, which have been linked to poor mental health,” Braithwaite said

      How air impacts our mental health

    9. “You could prevent about 15% of depression, assuming there is a causal relationship. It would be a very large impact, because depression is a very common disease and is increasing.” More than 264 million people have depression, according to the WHO.

      Increase of depression rate

    10. Depression and suicide linked to air pollution in new global study Cutting toxic air might prevent millions of people getting depression, research suggests

      Depression linked to air quality

    1. Nothing truly novel, nothing that matters, is ever learned with ease

      If you don't struggle you don't learn, right?

    2. Leaders in every sector seem to agree: Learning is an imperative, not a cliché. Without it, careers derail and companies fail.

      Don't stop learning

    1. Unit Testing
      • Unit tests take a piece of the product and test that piece in isolation.
      • Unit testing should focus on testing small units.
      • Units should be tested independently of other units. This is typically achieved by mocking the dependencies.
    2. End-to-End Testing
      • End-to-end testing is a technique used to test whether the entire application flow behaves as expected from start to finish.
      • Tests that simulate real user scenarios can easily help to determine how a failing test would impact the user.
    3. Integration Testing
      • Integration testing is when we integrate two or more units.
      • An integration test checks their behavior as a whole, to verify that they work together coherently.
    4. There are three different methods of Automated Testing
      • Unit
      • Integration
      • Ent-to-End
    1. The major selling point of Julia these days is in crafting differentiable algorithms (data-driven code that neural networks use in machine learning) in Flux (machine learning library for Julia)

      Main selling point of Julia these days

    1. I decided that the name of the game is to optimise quality of life. That means, infrequent brutal deadlines, minimal (pref. zero) commute, opportunity to learn, and spend time with family and friends and be of use to society at large.

      Advice for happy life:

      • infrequent brutal deadlines
      • minimal (preferably 0) commute
      • opportunity to learn
      • spending time with family and friends
      • be of use to society at large
    1. My mom is the best example of how to enjoy life in the present. She takes her work seriously, but doesn't take herself too seriously, and by putting fun first, every accomplishment and accolade is merely a bonus

      70 yo's secret to a full and happy life

  6. Nov 2019
    1. But we can take steps to control and lower our stress levels and, as a result, our arousal. Techniques like consciously controlling your breathing, and listening to chilled music have been known to help. More traditional advice, like reducing how much coffee you drink, eating a balanced diet and getting enough sleep each night should also be helpful

      Reduce stress by:

      • controlling your breathing / meditating
      • listening to chilled music
      • reducing coffee
      • eating balanced diet
      • getting enough sleep
    2. In our third study, we had 169 participants jog on the spot for 60 seconds. We found that these participants were more likely to share embarrassing stories – or open up to others – after physical exercise. Usually, people might disclose personal information like this to people that are close to them, but it seems we are more likely to open up to strangers when aroused, particularly by physical exercise

      After exercising we might be more prone to revealing a secret as well

    3. Information that we’re usually careful about disclosing, like secrets and very personal information, are more likely to be disclosed when we default to more automatic responses; mainly because they require some degree of effort to conceal.

      Therefore we tend to disclose secrets easier under stress

    1. At some point, we replaced the order of displaying the superpower packs (SP) from ascending to descending

      The revenue from the most expensive pack increased, but in the end the total revenue stayed as before the change

    2. Users don’t appreciate it when you try to trick them out of their money, or when they think you are doing that. A better approach would be to give them the opportunity to get what they want for free (even with a lot of work involved), and give an alternative purchase option. In this case the purchase will be perceived as a small cheat to make life easier instead of a shady scheme to get users to pay

      If you care about reviews

    3. There were four packs respectively containing 25, 50, 150 and 500 superpowers. We increased the biggest power pack from 500 to infinity. Practically, nothing changed. 500 superpowers were more than enough for the entire game, and very few users had spent all of it. However, after the change was made, the revenue from this pack grew by 50%

      Word "infinity" might work well for your sales

    4. I observed a similar effect in my own business when I was producing and selling metal license plates (sold via partner brick-and-mortar stores and through our own online store). At the start, the prices we set were relatively low ($3-5). But in a few months, we raised the prices by 2-3 times, and the plates then cost $15-25. Contrary to our expectations, the conversion rate almost doubled, as well as the average order amount.

      Example of placebo effect on selling license plates.

      $15-25 price range sells more than $3-5. Maybe because the product is unique and people prefer to pay once but expect better conditions

    5. With a vitamin C priced at $3, 100% of participants experienced relief. But the drug priced at $0.1 only worked in 50% of cases

      Placebo effect experienced on people trying to reduce the pain. Higher value of a product = higher effectiveness

    6. The word “free” makes any product more attractive to its potential customers. If you have a way to distribute your product for free, at least partially (a trial option, a limited version), then make sure to use it. This approach will greatly expand the top of your funnel. Once done, you will simply have to learn how to convert these new users into the paying ones

      Try using the word "free" somewhere in your sales. For example, try adding "free delivery for minimum $20 shopping" and you will see increase in sales

    7. I decided to compare how those who got it for free and those paid for it went through the levels in the game. There was a hypothesis that those who got it for “free” should stop using the game faster and sooner than those who paid for it. The hypothesis turned out to be wrong. The users of both the free and the paid version had identical behavior in the first 40 levels However, after level 40, the “free” players started quitting the game much faster. I interpreted this as those who received the game for free appreciated it less, so their motivation to go till the end or return to it after a couple of days was less

      If you get something for free, you tend to appreciate it less, although it's of the same quality as the paid version

    8. When we make decisions, our perception is influenced by a lot of factors such as presentation, packaging, brand, opinions of people around us, experts’ opinions, our own expectations, etc. Each of these factors can ultimately determine how much a person will like your product and how much she will be willing to pay for it

      Summarising, pay more attention to the background behind the final product

    9. In one case, the participants were given brochures describing the capabilities of a new audio system. The only difference between the brochures was that the first one was published on behalf of the system’s manufacturer and the second one on behalf of an independent research center. The participants who had seen the second brochure were willing to pay twice as much as the first group for the audio system

      It's similar to Brain.fm, which includes all the scientific facts on their homepage

    10. those who received coffee when the table was beautifully set appreciated the taste way more, and were also ready to pay more for it

      You will achieve higher sales with better packaging

    11. Joshua Bell, one of the best concert violinists in the world played for free, for 45 minutes, on a violin worth $3.5 million dollars at a subway station. He managed to raise $32. Most people (98%) who passed by paid no attention to him, only 2% gave him some money, and less than 0.5% stopped to listen (those were the people who actually recognized him)

      Influence of the environment plays an important role. If a homeless violinist had to play in an opera, he would have been more respected, although he would have been on the same level as he plays on the subway

    12. If you want to change the rules of the game in a field that you are about to enter, try to portray your product as something new and different. Doing so will enable you to set the rules of the game from scratch and be the first one to establish the anchor. And when you install the anchor, do not lower the price; there will still be time for that (making a discount always sounds better than raising the price)

      Tip for establishing new product: visualise your product as a new solution and do not start with a lowered price. Later you will attract customers with a discount

    13. When the sales agents of a health insurance company that was selling its services via phone asked people (who agreed to proceed) why they chose their company, the proportion of those who eventually decided to purchase the insurance increased significantly. As they thought about the answer to this question, the respondents subconsciously convinced themselves that they had made the right choice, further strengthening their decision and eventually leading to their making the purchase

      Marketing trick: ask why someone chose your service, so their mind will be more aware and convinced of the right choice; hence, buy your product again

    14. People also tend to form new “rules” when they encounter something for the first time. Starbucks is very different from other coffee stores. Therefore, when interacting with them, people create new rules instead of resorting to existing patterns

      Therefore Starbucks can be considered as something different than a regular coffee shop

    15. we tend to base our decisions on things we’ve experienced before, to make decisions easier

      We're basing decisions on previous experience rather than considering pros and cons.

      Therefore, after buying one expensive coffee at Starbucks, the next time we will also do it, as we would remember how good it was, but not how expensive.

      That is how we form good and bad habbits, which are so hard to get rid of

    16. It is difficult to find a logical explanation for this, but apparently the prices that end with 9 trigger some kind of automatic mechanism

      When presented with the price catalogues of:

      • $39
      • $34 and $44

      The first option would exceed all the other numbers of orders

    17. Offering to proceed with a $1 per day tariff and the one that costs $350 per year are mathematically equivalent, but trigger different reactions in customers. The first option can be compared to purchasing a water bottle in a grocery store, and the second option is more like purchasing a mobile phone

      Better to present sale in the form of $1 per day than $350 per year

    18. Mathematically equivalent statements are not necessarily equivalent psychologically

      For example, presenting two sets:

      A: A drunken motorist runs over a woman.

      B: A motorist runs over a woman.

      People would choose A as the more likely, but in fact it's just a subset of B.

      Same in this case:

      A: If you fly with this airline once a year, there's a possibility of one air crash in a 1000 years.

      B: 1 in every 1000 flights ends in a disaster

      It also applies in case of graphs:

    19. Do not lower prices. The price that you declare at the very beginning will become the reference point. You can also try to show your customers big numbers before starting to talk about the money

      Advice for marketers

    20. people are guided by the available prices to assess the rest of the offered goods

      For example, court judges were asked to roll a die before passing sentence, and the length of their verdict correlated with the values ​​they got on the dice rolled. Of course, the judges didn’t realize that the die roll had affected them

    21. Salesmen in retail stores try to sell the most expensive things first, or at least offer them to customers. For instance, a person who came to buy a suit is first shown the suits. When the customer makes his choice, then the salesperson suggests appropriate accessories, such as a tie to go with the suit. Compared to the suit’s price, the tie looks very inexpensive and is an easy upsell

      Propose the most expensive thing first.

      Case 1: For example, when someone wants to buy a suit:

      1. Suit
      2. Tie (small price in comparison to suit)
      3. Socks (small price in comparison to suit)

      Case 2:

      1. Overpriced real estate
      2. The right real estate
    22. We rarely think in absolute terms, and we don’t have a universal measure to understand the value of a certain thing. Therefore, we tend to evaluate things by comparing them to others

      The bait principle

      It can be supported by an experiment.

      1st version: Group of people was presented with 3 options:

      • a web subscription ($59) <--- 16% votes
      • a print subscription ($125)
      • print + web subscription ($125) <--- 84% votes

      2nd version: Group of people was presented with 2 options:

      • a web subscription ($59) <--- 68% votes
      • print + web subscription ($125) <--- 32% votes
    23. The lack of a ready-made pattern of behavior makes people rely on “simple” factors in decision-making (such as other people’s behavior, template principles, pre-designed baits, etc.), rather than the correct ones

      Use this for your advantage in sales

    24. The circles drawn in the center of the image above are identical. But depending on their environment, their perceived size changes

      Use this property in marketing:

    1. New study shows that our personal memories might not be personal at all. All it takes to change your memories is thinking about a different person, and considering how they would approach what happened to you. Perhaps our character isn’t as unique as we think, but more fluid, and changed by every person we meet. Our evaluation of ourselves changes even when we think of objects, not just other people

      Plasticity of our mind

    1. if your goal is to build a remarkable life, then busyness and exhaustion should be your enemy

      Life protip

    2. Hard work is deliberate practice. It’s not fun while you’re doing it, but you don’t have to do too much of it in any one day (the elite players spent, on average, 3.5 hours per day engaged in deliberate practice, broken into two sessions). It also provides you measurable progress in a skill, which generates a strong sense of contentment and motivation

      Hard work:

      • isn't draining like hard to do work
      • provides measurable progress in a skill
      • generates a strong motivation
    3. The elite players were spending almost three times more hours than the average players on deliberate practice

      1st difference between the elite and average students:

      spending 3x more time on deliberate crafting of the skill

    4. The average players, they discovered, spread their work throughout the day. A graph included in the paper, which shows the average time spent working versus the waking hours of the day, is essentially flat. The elite players, by contrast, consolidated their work into two well-defined periods

      2nd difference between the elite and average students:

      working in 2 well-defined blocks rather than multiple ones

    5. the elite players slept an hour more per night than the average players

      3rd difference between the elite and average students:

      1 additional hour of sleep

    6. the elite players were significantly more relaxed than the average players, and the best of the best were the most relaxed of all

      4th difference between the elite and average students:

      more relaxation

    1. the more files you have and the bigger your project, the more resources VS Code will start to consume. The Search Indexing and File Watcher scripts start eating up your memory. Moreover, to work on such a project, you will open each file in a new tab, leading to multiple VS Code instances running simultaneously, and eventually, your CPU usage will start to look like this

      VS Code consumes much more memory in comparison to Sublime while working on more significant projects

    1. FKs don't work well with online schema migrations.

      3rd reason why at GitHub they don't rely on Foreign Keys: Working with online schema migrations.

      FKs impose a lot of constraints on what's possible and what's not possible

    2. FKs are a performance impact. The fact they require indexes is likely fine, since those indexes are needed anyhow. But the lookup made for each insert/delete is an overhead.

      2nd reason why at GitHub they don't rely on Foreign Keys: FK performance impact

    1. To grow, trees photosynthesize and turn water and carbon dioxide (pulled from the air), into hydrocarbons. A living tree sucks carbon dioxide from the air and locks it into wood as it grows. Even when the tree dies (unless we burn it), the carbon is still locked up in the wood

      Cycle of tree's life

    2. For a wood fire, ash is primarily composed of metal carbonates and oxides (such as Calcium Carbonate, and Potassium Carbonate), from the compounds in the original wood

      Ash - compounds that did not burn

    3. As long as there is a source of fuel (and oxygen), the fire will burn

      Oxygen keeps the fire alive

    4. As the fire gets hotter, more complete combustion occurs, less smoke is produced, and the flames lose the yellow color, turning more blue

      As the fire gets hotter:

      • more complete combustion
      • less smoke
      • yellow colour turns into blue
    5. yellow flames seen in a fire are the result of incomplete combustion

      Yellow flames - incomplete combustion

    6. smoke produced (early stages of fire) is unburned carbon

      Smoke - unburned carbon

    7. It is the volatile compounds that out-gas from the wood, and eagerly react with oxygen, that are burning, and generate the flames we see

      Generation of flames - volatile compounds eagerly reacting with oxygen

    8. When the temperature of wood is increased (through application of heat), first the water is driven off. This occurs up to about 200°C. Between approximately 200°C–280°C the heat starts to break down the hemicellulose compounds into Carbon Monoxide, Carbon Dioxide, Acetic Acid, (and more water vapour); these are driven out. Between 280°–500° decomposition of the longer cellulose and lignin begins and produces light tars and Methyl Alcohol

      Burning process:

      1. < 200°C - water is driven off
      2. 200°C-280°C - heat breaks down the hemicellulose compounds into Carbon Monoxide, Carbon Dioxide, Acetic Acid, and more water vapour
      3. > 280°C - hydrogen is still produced. Oxygen reacts directly with the Carbon left in the wood exothermically (process happening in the glowing embers)
    9. A couple of hundred intermediate products (organic acids, ketones, esters, aldehydes …) have been identified as being produced by the pyrolysis of wood

      Output from wood pyrolysis

    10. The pyrolysis of wood is an incredibly intricate and complex process that is not completely mapped out and the exact output depends of many variables

      Pyrolysis is complex and relies on lots of variables (type of wood, temperature...)

    11. The correct term to describe what is going on when we ‘burn’ wood is Pyrolysis

      Pyrolysis (from Greek) - correct term for "burning" wood (thermal decomposition)

    12. The chemical composition of wood varies from species to species, but is approximately 50% carbon, 42% Oxygen, 6% Hydrogen, 1% Nitrogen, and 1% other elements (mainly Calcium, Potassium, Sodium, Magnesium, Iron, and Manganese) by weight

      Chemical composition of wood. Mainly:

      • 50% carbon
      • 42% oxygen
      • 6% hydrogen
    13. Wood is the hard-fibrous material that comes from the trunk, stems, roots, and branches of a once living tree

      What is wood