Gut Bacteria and Health

Dr. Trajkovski’s recent research, Gut Microbiota Orchestrates Energy Homeostasis during Cold, published in Cell, finds that cold exposure changes gut microbiota composition. These changes increase insulin sensitivity, caloric absorption from food, and browning (converting white adipose tissue into beige adipose tissue). Being in colder temperatures- wearing a lighter jacket, turning down the heat- may confer you some health benefits.

The Economist published a pretty good article about Dr. Trajkovski’s research.

Also in Cell, the research, Dietary Fiber-Induced Improvement in Glucose Metabolism Is Associated with Increased Abundance of Prevotella, illustrates another example of how our gut bacteria affects our health.

Curious which bacteria reside in your gut? Check out: uBiome and American Gut. I just discovered these two resources, so just pointing out that sequencing your microbiome is available.

Ember.js: Connecting your Components to the rest of your App

Brief overview on ember.js components:

At a bare minimum, a component just needs to have its template defined.

  • A route doesn’t need to be defined, unless you need to fetch data from a model.
  • A javascript file doesn’t need to be defined, unless you need to customize the component’s behavior. This is where your logic/data manipulation/attributes/functions reside.

Linking the component to your main template:

  • Include {{component name}} in your template that has a route
  • Link component.js to component.hbs by calling the function/attribute in the template by including {{function’s name}} or {{attribute name}}. The template already knows which file to use because the template has the same file name as the javascript file. In order to call a function in the component’s template add “.property(‘function name’)” after the closing bracket of your function. Example:
    • totalDayCost: function() {
      return 4.2;
      }.property(‘totalDayCost’)

Source code for this project

Highlights from ‘The Economist’

Recently published in The Economist
Publisher: The Economist Newspaper Limited
© The Economist Newspaper Limited, London 2015

Signature dishes
Date:Oct 3, 2015

Summary: Humans leave behind a signature bacterial trace that can potentially by used in the future by forensic scientists at crime scenes to detect who was at the crime scene.

Sweating the big stuff
Date: Sep 19, 2015

Summary: Diabetics currently have two options to monitor their glucose levels- micro needle implants or daily finger pricking. Soon, there may be a third, less invasive, option: sweat patches. Sweat contains biomarkers that are metabolic products indicative of one’s health. Advances in microfluidics have made it possible to have patches that can analyze small amounts of liquids. Eccrine Systems is developing a patch that attracts the biomarkers for glucose and uses microfluidics to analyze the concentration of glucose.

Now there’s an app for that
Date: Sep 19, 2015

Summary: One of the complications of diabetes is retinopathy. An algorithm has been created that can detect for signs of this complication.

Money for everything
Date: Oct 3, 2015

Summary: Globally, cash is mainly being used as a store of value. High denomination amounts are the ones most in circulation. Cash has decreased as a means for trading, but fears of banks charging negative interest rates, amongst other fears, have keep cash alive.

Heroku Tips

Tips on deploying to Heroku using Ruby:

  • Heroku doesn’t support sqlite, instead use ‘pg’
  • If you have already created your app locally follow these steps to deploy for the first time:
    1. in your terminal under project directory, type the commands:
    2. heroku login
    3. heroku create <app name>
    4. heroku git:remote -a <app name>
    5. git push heroku master (deploys)
  • To update db schema, type in terminal:
    • heroku run rake db:migrate
  • To check heroku’s db:
    • heroku pg:psql -a <app name>
    • \d (view tables)
  • To restart heroku’s db and not delete any data:
    • heroku restart
      • this is useful to try after adding a new migration and getting 500 status error
  • To reset heroku’s db (this will delete any data):
    • heroku pg:reset DATABASE_URL

Linked List vs Array

An array is a Ruby class that stores in memory an ordered list of Ruby objects. Each object is referenced by its index, its location away from the starting point. Retrieving an object via its index is quick, Big O (1); but comes at a cost. Inserting items into an array is Big O (n)  because each object has to be shifted to accommodate an addition.

A linked list is not an already defined Ruby class. Linked lists are more efficient at creating an ordered list than retrieval. Objects are not stored in a particular order in memory, so one has to iterate through each node to find the object. Retrieving an object is Big O(n). However, adding or removing an object is Big O(1) because only two node values need to be changed for every addition or removal.

Ruby vs Python’s Garbage Collection

Ruby’s garbage collection algorithm is like the person who waits to clean their home once entropy has reached high levels. Python’s garbage collection algorithm is like the person who cleans as they cook and never leaves clothes on the floor.

Ruby’s algorithm, mark & sweep, creates objects before you run your code, storing them in a free linked list, and hands one over when an object is called by the program.  Instead of wiping the newly used object from memory, it remains in the list. Eventually the list runs out of free objects to hand over, and this is when Ruby is forced to clean up. During the clean up, Ruby forces the application to stop running.

Python uses reference counting; objects are created as they are needed and released from memory as soon as they are no longer needed. The drawback to a clean tidy home is having to leave room in each object for the reference count. Changing a variable or reference is a more complex operation because the GC algorithm will have to change the counter values and potentially free the object. Python runs slower because it has to constantly update the counter values.

Reference:

Visualizing GC in Ruby and Python

Stale PID

If you have a stale PID because of improper shut down of Postgres, follow these steps to delete the stale PID. This will remove your entire db, so if you have data you need to keep, this is not the route to go.

1) $ cd ~/Library/Application\ Support/

2) $ rm -rf Postgres

3) Recreate your db:

4) $ rake db:create

5) $ rake db:migrate