Sunday, August 20, 2017

Troubling Post about Parents and Kids Having Phones

If you are thinking about whether or not to get your child a phone and let them spend time on facebook, snapchat, twitter, etc...  You really need to read this article:  https://www.theatlantic.com/magazine/archive/2017/09/has-the-smartphone-destroyed-a-generation/534198/

Have Smartphones Destroyed a Generation?


Below are a few quotes that really jumped out at me.
The results could not be clearer: Teens who spend more time than average on screen activities are more likely to be unhappy, and those who spend more time than average on nonscreen activities are more likely to be happy.


There’s not a single exception. All screen activities are linked to less happiness, and all nonscreen activities are linked to more happiness.


The more time teens spend looking at screens, the more likely they are to report symptoms of depression. Eighth-graders who are heavy users of social media increase their risk of depression by 27 percent, while those who play sports, go to religious services, or even do homework more than the average teen cut their risk significantly.

 
Teens who spend three hours a day or more on electronic devices are 35 percent more likely to have a risk factor for suicide, such as making a suicide plan.

 
Children who use a media device right before bed are more likely to sleep less than they should, more likely to sleep poorly, and more than twice as likely to be sleepy during the day.

And What to Do


The article suggests that the executives in silicon valley that bring us the devices and social media services that are behind all of this are unlikely to allow the amount of use that's associated with the troublesome increases in unhappiness, loneliness, depression and suicidal thoughts.
Even Steve Jobs limited his kids’ use of the devices he brought into the world.

 

Saturday, August 5, 2017

Debugging Dependencies of Django Project in Eclipse

This is another one of those posts to help myself in the future.  I've got some legacy python projects whose directions only get you a django app running in a virtualenv within eclipse but the dependencies themselves are not debuggable.

It was straightforward once I found the right advice.

If you're like me and have a build that creates a virtualenv with everything installed already by pip and a requirements.txt file.  Here's how to get the environment and eclipse changed so that you can debug any dependency.

#Step 1.  Remove the dependencies files from the virtualenv


This works for mac and uninstalls files that might have spaces in them too
python setup.py install --record files.txt
# inspect files.txt to make sure it looks ok. Then:
tr
'\n' '\0' < files.txt | xargs -0 sudo rm -f --

I figured that out after a few different attempts and the best way to do it came from StackOverflow here:  https://stackoverflow.com/a/25209129

 

#Step 2. Add the source folder as an external build dependency on the Python Interpreter Path


Add source folder to eclipse for debugging dependency

 

 

 

 

 

Credit for this step goes to a small sentence buried here:  https://lukeplant.me.uk/blog/posts/eclipse-pydev-and-virtualenv/

 

That's it.  Restart your django server and set a breakpoint inside that internal dependency.

This will save you a ton of time vs. all those import pdb; pdb.set_trace() statements

Drawbacks


This will break the virtualenv from the command line so for things like python manage.py commands.  For those items, I went ahead and set up a second virtualenv.