heaveyduty.com https://www.heaveyduty.com/ Training. Nutrition. Garage Gym. Fri, 09 Dec 2022 20:03:37 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.6 Logging in Python https://www.heaveyduty.com/logging-in-python/ https://www.heaveyduty.com/logging-in-python/#respond Fri, 09 Dec 2022 20:00:32 +0000 https://www.heaveyduty.com/?p=8366 A common approach to debugging code is to litter it with print statements, then comment them out or delete them after you’ve solved your problem. This is sloppy and cumbersome. There’s a better way. The Case for Logging Logging gives you all the insights available from scattered print statements, but with more power and flexibility […]

The post Logging in Python appeared first on heaveyduty.com.

]]>
A common approach to debugging code is to litter it with print statements, then comment them out or delete them after you’ve solved your problem. This is sloppy and cumbersome. There’s a better way.

The Case for Logging

Logging gives you all the insights available from scattered print statements, but with more power and flexibility and nearly no extra work.

For instance, on a project I’m currently working on, I have a python script connecting to a Postgres database, scraping a website that requires a login along with a handful of other related tasks.

If something unexpected happens when scraping the site, like the script is unable to login to the website or it fails to connect to the database or maybe a database query goes off the rails – I have logging configured to notify me of these events via email.

If none of these critical events occur though, I don’t receive an email. The code just happily executes, logging benign status messages on the server. I may never look at that server log, but it’s good to know it’s there. This is the script’s version of an airplane black box recorder. Though it may never be needed, on the occasion it is, it’s very nice to have.

The critical messages sent via email and the status messages left on the server highlight a powerful logging feature – different actions taken based on the severity of an event/log message. That alone differentiates them from print statements in a big way.

That’s just the beginning though.

Let’s say I discover a problem and need to do some local development to debug it. I can flip a switch that triggers verbose log messages that will appear on the console or in a local file.

Again, compare that to the alternative of adding a bunch of print statements or possibly uncommenting existing ones to debug your code. With logging, a simple change to the configuration file and the behavior alternates between emergency-only email reporting and verbose console-based debugging.

If the potential for logging piqued your interest, read on to learn how to get started with it in python.

Basic Logging Setup

Logging is a standard module bundled with python. The most basic implementation looks like this:

import logging
logging.warning('This is a warning message')

The only difference between using logging in this example and the print statement equivalent is the use of logging.warning() vs. print().

Now, run this code in a python terminal right now and you’ll see the following output to your console.

WARNING:root:This is a warning message

The above log message includes a few key pieces of information:

  1. the severity of the message, WARNING
  2. the name of the logger, root
  3. your specified message, “This is a warning message”

Forget about the logger name, you don’t need to understand that to get the basics. I’ll return to it later. Let’s dig into severity though.

Severity levels are used to differentiate and prioritize log messages so you can respond accordingly. Earlier, I outlined how I’m working on a project where a script emails critical messages to me, but logs ordinary status messages on a server – severity plays an important role in accomplishing that.

The code snippet above used logging.warning(). This command sets the severity level at WARNING for that message, but you could have also used: logging.debug(), logging. info(), logging.error() or logging. critical(). The idea behind each of these options being that throughout your code, your most verbose and rarely needed log messages are set at the lowest severity level (debug), but as the severity of the message increases, you work your way up the ladder to critical.

In order to respond to log messages of varying severities in different ways, a handler is required. Handlers are also simple to configure but hold tight on that for just a minute.

Logging Variables

You probably don’t want to just log static statements, sometimes you need to log the contents of variables. This is accomplished similarly to print statements.

import logging

log_var = 'variable'
logging.warning('You can print a %s with logging too!', log_var)

The above code results in the following log message:

WARNING:root:You can print a variable with logging too!

If you’re using Python 3.6 or higher, you can also use f-strings to display variables instead if you prefer. Here’s the python documentation on f-strings if you want to learn more about them.

Capturing exceptions

In addition to logging variables, you can also use logging to gain insight into exceptions. You’ll get the full stack trace of an exception when raised if you use logging.exception()

import logging

try:
	#Do Something
except Exception as e:
	logger.exception('Bummer, there was an exception')

Wait, this is a new command… where does this fall in the severity hierarchy? logging.exception() logs the message at level ERROR – but unlike messages logged with logging.error() it includes the additional exception data. Remember, this should only be called from within an exception handler (as done in the example).

If you’d rather log exceptions at a level other than ERROR there is a way to accomplish this, do a little googling about exc_info=True and you’ll find the solution.

This Was Logging the Simple Way

The simple approach I’ve outlined thus far is what I’ll arbitrarily refer to as the level 1 approach. Level 1 logging is almost identical to using print statements. The only difference is you have to import the logging library and pick which severity you want to use for each message.

If we add just a little more complexity and jump up to what I’ll refer to as level 2 logging, we get all sorts of additional features, like the ability to send log messages to a file instead of the console as done in the code below.

import logging
logging.basicConfig(filename='test.log', level=logging.DEBUG)

Now, if you type the same log command from before:

logging.warning('This is a warning message')

Instead of being displayed in the console, it’s pushed into the file test.log.

To get these level 2 features, the only additional complexity required was a call to basicConfig(). Let’s take a closer look at the parameters used in the call above.

First filename='test.log' specifies that all log messages should be routed to the file test.log. Second, level=logging.DEBUG sets the minimum severity message this logger responds to.

By default logging only captures messages at a severity level of WARNING and higher, i.e., WARNING, ERROR & CRITICAL. All other messages are dropped. So, in the level 1 logging example, if you had used logging.debug() instead of logging.warning() no message would have appeared in your console. Try it if you don’t believe me :).

In the level 2 example above using basicConfig(), the minimum level is now set to DEBUG with the level property, and since DEBUG is the lowest level log message, all levels will be captured in the test.log file, i.e., DEBUG, INFO, WARNING, ERROR & CRITICAL.

basicConfig() can be used to configure other logging properties too, like whether or not the log file should be appended to (default behavior) or overwritten (filemode=‘w’) each time you run your program. You can also adjust the format of the log messages.

Unfortunately, you can’t configure a custom logger using basicConfig(), you only have access to the root logger. So, even with level 2 logging, you still miss out on a lot of power and versatility. To get access to those features requires just a bit more complexity and jumping up to level 3. However, if you have simple needs and want to stick with basicConfig() you can learn more about the configuration options here.

Our First Trip Into The Weeds

One other point worth mentioning is that basicConfig() is meant to be called before any other logging commands. If you call it after a call to logging.debug() or an earlier call to basicConfig(), it will be ignored. So, if you’re experiencing unexpected behavior from basicConfig(), that’s something to investigate.

Ok, back out of the weeds…

Wrapping Up The Basics

If you implement logging as outlined thus far, you’re already miles ahead of using simple print statements. But, there is a lot more power and flexibility available that only requires a little extra complexity.

Loggers, Handlers & Formatters

Loggers

The logging module provides a default logger. That’s what we’ve relied on thus far. It’s fine for simple cases too, but as your codebase grows, you may want to name your loggers so you can take advantage of the logger hierarchy. Remember root from earlier? That’s the name of the default logger.

Usually you’ll want to define your custom logger as such:

import logging
logger = logging.getLogger(__name__)

Using python’s built-in __name__ yields log messages that track your package/module hierarchy and thus clearly indicate the source of logged events. Meaning, if this code is executing within some module like, example.project.module – that’s what will be reported in the logger output (as opposed to root). This can be a big help in multi-module, complex code.

Another Quick Trip in the Weeds

Within multi-module code, where you use getLogger() within each module, there is a pitfall you need to be careful not to get tripped up on. By default, python respects existing loggers.

Let’s say you had the following code in example_module.py:

#example_module.py
import logging

#logger instantiated by default
logger = logging.getLogger(__name__)

def test():
	logger.info('Hello world')

Now in your top-level code, let’s say you do something like this:

#top_level_example_module.py
import logging
from example_module import *

logger = logging.getLogger(__name__)

This configuration may lead to unexpected behavior. Since the import of example_module occurs before the logger is called in your top-level code, the settings from the example_module.py logger take precedence. _

To prevent this, only get the logger when it’s needed, not by default within a module. An updated example_module.py with that in mind looks like this:

#better_example_module.py
import logging

def test():
	#logger only instantiated when needed
	logger = logging.getLogger(__name__)
	logger.info('Hello world')

Here getLogger() is within the function not outside of it as in the first version provided.

To make sure there are no preexisting loggers mucking things up when you load your logger, you can also set the parameter disable_existing_loggers to false. I’ll show you how to do this with configuration files soon.

I know some of that may have been confusing. Just keep it in the back of your mind, it’s one of those things to examine more closely if/when your logger isn’t behaving as expected.

Handlers

Handlers define where your program should send log messages. One of the most powerful features with handlers is that you can define more than one. Earlier I mentioned how I was sending critical messages to myself via email, reporting regular status to a file on a server and had an option for detailed logging to the console when debugging locally. This is a prime example of handlers in action.

#multiple_handler_example.py
import logging

logger = logging.getLogger(__name__)

# Instantiate Loggers
handler1 = logging.StreamHandler()
handler2 = logging.FileHandler('test.log')

# Set Severity Handler Responds To
handler1.setLevel(logging.DEBUG)
handler2.setLevel(logging.ERROR)

# Add Handlers to Logger
logger.addHandler(handler1)
logger.addHandler(handler2)

Keep in mind that setting the severity establishes the lowest level that the handler will respond to. So, in the example above handler1 will respond to DEBUG, WARNING, ERROR, and CRITICAL while handler2 will respond to ERROR and CRITICAL, ignoring DEBUG and WARNING.

You can use handlers to log messages to many different destinations like files, HTTP GET/POST locations, emails, sockets, queues, etc. For more on that, check out this list of useful handlers.

Formatters

By default, a log message looks something like this:

WARNING:root:This is a warning message

This may satisfy your needs, but it is pretty basic. There’s a handful of additional information available such as date/time, process id, etc. that you may want to include depending on your application. Formatters provide a mechanism for including these extra details and/or generally modifying the way your log messages appear.

#explicit_logger_handler_formatter_example.py
import logging

logger    = logging.getLogger(__name__)
handler   = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')

handler.setFormatter(formatter)
logger.addHandler(handler)
logger.warning('This is a formatted message')

Running the code above produces the output depicted below.

2019-10-11 07:57:07,637 - __main__ - WARNING - This is a formatted message

You’ll notice that the date and time are now present in the message.

Just like with handlers, you can specify multiple formatters. This can be helpful if you want more detail to be displayed for debugging, but fewer details for regular info messages. There’s a lot you can do with formatters, here’s the python documentation on formatters for you to explore.

Configuration Files

It’s good practice to load your logger configuration from a separate file. It enables you to modify the behavior without changing your code, e.g., the example up top where I mentioned different configurations running on a production server and when developing locally.

There are a couple of log file formats you can use, but my personal preference is YAML, so I’ll show that.

One Final Trip Into the Weeds

YAML does require the PyYAML library. If you don’t have that library, you can get it via pip with the following command:

pip install pyyaml

You may need to run the command as root using sudo. Ok, back to log files…

Here’s an example YAML log configuration file

#config.yaml
version: 1
formatters:
  simple:
    format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
handlers:
  console:
    class: logging.StreamHandler
    level: DEBUG
    formatter: simple
    stream: ext://sys.stdout
loggers:
  example_module:
    level: DEBUG
    handlers: [console, email]
    propagate: no
  email:
    class: logging.handlers.SMTPHandler
    level: ERROR
    mailhost: <your mail server>
    fromaddr: <email from address>
    toaddrs: <email to address>
    subject: <your subject line>
    credentials: !!python/tuple [<login>, <password>]
root:
  level: DEBUG
  handlers: [console]
#loading_logfile_example.py
import logging
import logging.config
import yaml

with open('config.yaml', 'r') as f:
    config = yaml.safe_load(f.read())
    logging.config.dictConfig(config)

logger = logging.getLogger(__name__)

logger.debug('This is a debug message')

If you do use the name variable for all of your loggers and you want to specify unique properties for a handler of a specific module, you’ll need to make sure to use the name of that module in your log file. You can see I did this with example_module.py in the configuration file above.

Odds and Ends

If you don’t specify a name for a logger, it defaults to root and if you do specify a name, but don’t specify a unique behavior, it will default to the behavior of the root logger.

Multiple calls to getLogger() with the same name will return a reference to the same logger object – this is helpful so you don’t have to pass logger objects around everywhere in your code, you can just call getLogger() whenever you need to use it.

WRAP UP

I definitely didn’t cover everything there is to know about logging in this post, but I did try to provide links for areas you might want to explore more deeply. Hopefully, this post has given you the motivation to start using logging and tools you need to implement it.

I maintain a GitHub repository for this site. The examples in this post are pretty basic, but they’re in the repository along with code related to other posts on this site.

If anything I’ve written here is unclear, feel free to post questions in the comments below.

Resources

GitHub repository with code from the examples in this post (and from the rest of this site).

The python organization has published a Logging Cookbook, that provides code snippets for common use cases.

Finally, this article was made possible in part by these other great pages on logging in python:

The post Logging in Python appeared first on heaveyduty.com.

]]>
https://www.heaveyduty.com/logging-in-python/feed/ 0
200 Ways to Improve Your Nutrition https://www.heaveyduty.com/200-ways-to-improve-your-nutrition/ https://www.heaveyduty.com/200-ways-to-improve-your-nutrition/#respond Thu, 20 Jun 2019 19:40:57 +0000 https://www.heaveyduty.com/?p=7878 200 Ways to Improve Your Daily Nutrition Why is nutrition so easy for some… and so much more difficult for others? Hint hint, it’s not likely superhero willpower. According to research from Wansink & Sobal (2007) we make around 200 decisions per day related to food…and we don’t even recognize most of these. So why […]

The post 200 Ways to Improve Your Nutrition appeared first on heaveyduty.com.

]]>
200 Ways to Improve Your Daily Nutrition

Why is nutrition so easy for some… and so much more difficult for others?

Hint hint, it’s not likely superhero willpower.


According to research from Wansink & Sobal (2007) we make around 200 decisions per day related to food…and we don’t even recognize most of these.

So why bring this up?  It’s likely that for individuals that appear to have their “nutritional sh*t” together, they’ve more than likely spent a large amount of time making those decisions as simple and easy as possible for themselves.

For example, it’s fairly easy to eat some veggies every day if you’ve meal prepped yummy greens for your lunches at the beginning of the week.

It’s also pretty easy to decide to enjoy an evening snack of strawberries rather than ice cream…  IF you have no ice cream in the house and you have a beautiful bowl of berries sitting at eye-level in the fridge.

(If however, there’s a big tub of cookies n’ cream in the freezer, it’s going to be a much more difficult decision to reach for the berries over the ice cream scooper.) 


It is more important to control your environment than controlling your willpower.

How can you use this insight?

Set yourself up for success at the start of the week (or whenever you feel highly motivated).

Get rid of the mindless munching sh*t in your pantry- or keep it in a location that’s a pain in the ass to get to.  Prep some protein and veggies for the week.

Afterall, you’ve got roughly 200 nutrition decisions to make today. 

Make them no-brainers.

In the lovely words of DJ Khaled:

“You stick out of the crowd, baby, it’s a no-brainer
It ain’t that hard to choose
Him or me, be for real, baby, it’s a no-brainer”



 

The post 200 Ways to Improve Your Nutrition appeared first on heaveyduty.com.

]]>
https://www.heaveyduty.com/200-ways-to-improve-your-nutrition/feed/ 0
Why You (And Even Your Grandma) Need A Coach https://www.heaveyduty.com/why-you-and-even-your-grandma-need-a-coach/ https://www.heaveyduty.com/why-you-and-even-your-grandma-need-a-coach/#respond Thu, 13 Jun 2019 15:37:41 +0000 https://www.heaveyduty.com/?p=4180 Most people think having a coach is reserved for serious athletes.  Those individuals whose livelyhood depends on it- and yes, I agree 100%, they need a coach to optimize their sport specific performance.  But how about the 40 year old soccer mom just trying to get fit?  How about your grandma?  Would they benefit?  Absolutely. […]

The post Why You (And Even Your Grandma) Need A Coach appeared first on heaveyduty.com.

]]>
Most people think having a coach is reserved for serious athletes.  Those individuals whose livelyhood depends on it- and yes, I agree 100%, they need a coach to optimize their sport specific performance.  But how about the 40 year old soccer mom just trying to get fit?  How about your grandma?  Would they benefit?  Absolutely.

I actually wrote this while back at PaleoFx in Austin, Tx.  I was sitting in the back of a room during a break, waiting for the next talk…and enjoying conversation with some fellow fitness nerds, including James Fitzgerald.  He’s awesome, and if you haven’t met him, or heard about OPEX, you’re missing out.  His #1 goal and mission is to educate and produce knowledgeable coaches who care.  Coaches who understand priorities, and are well-versed in taking care of their clients for the long term.

Let me repeat that again- for the long term.

You see, everyone can benefit from a coach, and I’d even say, those non-athlete clients need a coach just as much or more than athletes.  The every day joe needs help with handling life.  With being able to keep up with their kids, their grandkids, and be able to live life to the fullest capacity- efficiently, healthy and pain free.

IMG_8417

There are a few avenues to receive coaching.  A class format works for many, but for others, a one-on-one approach of receiving individual programming works best.  Perhaps you have been training for a while, and are starting to see stagnation in your results despite attending group CrossFit classes multiple times a week.  Perhaps you have an upcoming event, goal or achievement in mind, and you’d like a program developed specifically for your goals.  Or maybe you’re dealing with an injury (old nagging, or maybe something fairly new).

Yes, your class formatted workout can be scaled or modified, but you’d be much better off having a knowledgeable coach develop a training program addressing your issues rather than modifying a class workout around your hindrances.

             I personally started working with a coach for individual programming in 2014.  Yes, I’m a coach and I have a coach.  No, I’m not a professional athlete.  And I really don’t compete much.  But I train because I love it, and it makes me feel whole.  And after 4 years in a class format, the CrossFit group model was no longer working for me.  Injuries, stagnation in results, and high intensity overtraining were leading me away from my goal: optimal health and longevity.  Do I miss doing group workouts with others?  Occasionally.  But to be honest, I love working off of a program that my coach developed specifically for me, my weaknesses, my limitations, and my strengths.  Not because I want to be an amazing athlete, but because I enjoy the process and want to be the healthiest I can be over the long term.

IMG_6428

The ultimate goal: training for life, longevity, and happiness.

 

Train on my friends, and if you’d like to find out more about individual programming options to address your specific needs, feel free to contact us.

The post Why You (And Even Your Grandma) Need A Coach appeared first on heaveyduty.com.

]]>
https://www.heaveyduty.com/why-you-and-even-your-grandma-need-a-coach/feed/ 0
Django Development on an iPad Pro https://www.heaveyduty.com/django-development-on-an-ipad-pro/ https://www.heaveyduty.com/django-development-on-an-ipad-pro/#respond Tue, 14 May 2019 23:17:59 +0000 https://www.heaveyduty.com/?p=7843 I don’t write a lot of code. But I used to and I miss it. So I decided to kick off a side project to compliment my non-software work over at Evidence Based Athlete. Incidentally, I also picked up the latest iPad Pro and thought it’d be a fun challenge to see if I could […]

The post Django Development on an iPad Pro appeared first on heaveyduty.com.

]]>
I don’t write a lot of code. But I used to and I miss it. So I decided to kick off a side project to compliment my non-software work over at Evidence Based Athlete.

Incidentally, I also picked up the latest iPad Pro and thought it’d be a fun challenge to see if I could stand up a django environment on it for local development.

Luckily, many others have blazed a trail for django on iPad. Actually, it’s damn near a highway now. But, I found many of the write-ups incomplete for my needs. So, I figured I’d create my own post outlining how I got it all working. Oh, did I forget to mention I got it working 😉 Here’s a screenshot for proof:

Python on iPad

First, thing first. Python. I learned my choice of Django on the iPad was fortuitous. As of the publish date of this post, python is one of the few languages you can run natively on an iPad. This is thanks, in large part, to the incredible Pythonista app – a fully functioning python IDE.

Apparently, Pythonista began as a simple Python text editor and morphed into a hackable development environment including Python 2 & 3 support and bundled with popular packages like flask and numpy.

Step one, buy and install Pythonista for iPad. Easy, peasey.

Add Python Libraries with StaSh

Even though Pythonista comes standard with many useful python libraries, django isn’t one of them. Out of the box, Pythonista also doesn’t include a way to easily add libraries. That’s right, no pip 😢. But, as I mentioned, it is hackable, which is where the StaSh add-on enters the picture.

StaSh is a useful shell for pythonista that enables commands like pip. It’s probably great for a bunch of other stuff, but I don’t really care about any of that right now. I just want django. And if you’re reading this, you’re probably in the same boat. To install StaSh:

  1. Open the console window in Pythonista and type in the following: import requests as r; exec(r.get('https://bit.ly/get-stash').text)
  2. Restart Pythonista

Done.

Now for Django

With StaSh set up, getting django running is very simple:

  1. In the Pythonista file browser, locate and select StaSh by navigating as follows: Script Library -> This iPad -> launchstash.py
  2. Once you select the file, hit the run button in the upper right corner, this will trigger the StaSh shell in the console window.
  3. In this shell, type in: pip install django

Version Control (aka Getting Your Code into Pythonista)

Pythonista gives you access to a few locations within your iPad to store code, but going that route is a bit cumbersome, plus using some sort of version controlled repository is ideal for most applications. Luckily, another excellent app is here to save the day – Working Copy.

Taking a quick step back, my planned workflow includes:

  • Using GitHub with Working Copy
  • Local development on the iPad
  • Eventual release deployed via some venue like Python Anywhere

Prior to pursuing this Django on iPad project, I’d already established a repository on GitHub for my code. So all I needed to do was download Working Copy, register my GitHub account and add my repository to the app.

This may feel like extra steps, but assuming your code will eventually migrate to some production server, or you’ll have multiple contributors or you’ll be developing on multiple machines – this really is the way to go. When I make changes within Pythonista, they are automatically registered in Working Copy where they can easily be committed and pushed up to GitHub.

  1. Download and install Working Copy (free for many use cases)
  2. Add your GitHub credentials in Working Copy
  3. Add your target repository in Working Copy
  4. Open Pythonista
  5. Select Open…
  6. In Locations choose Working Copy
  7. Hit select in the upper right corner
  8. Select your target repository
  9. Click open

Fire Up Your Django Project

Ok, it’s not quite that simple. We do have to deal with a couple of iPad specific limitations now. Pythonista only supports a single python thread and because of the way the app’s console is trigged with messages, it makes sense to minimize Django’s very talkative nature. To this end, we must add some flags for runserver. We also need to inform python of the location of our Django project.

Open manage.py in Pythonista and with that file open, activate the console window. In console type the following:

import sys
sys.path

You’ll see a line in the response that looks like this:

/private/var/mobile/.../<your-django-project-name>

Copy that path. In your manage.py file, under the “import sys” line add the following:

sys.path.append("<copied path>")

You may need to restart Pythonista at this point.

Finally, open manage.py again, and press and hold the run button in the upper right corner. This will open a dialog box that enables you to pass parameters.

Add the following text to that box:

runserver --noreload --nothreading -v 0 instead

If you’re getting a noreload error and something about valid port numbers (“noreload” is not a valid port number or address:port pair.”), it’s probably due to smart punctuation on the iPad.

This iOS feature is automagically converting your double “-” into a single, longer “-” which python doesn’t know what to do with. You need to go into the settings and turn off smart punctuation to get it working.

Settings->General->Keyboard->Smart Punctuation (toggle this off)

Go back and type in the text from above into the dialog box, it should work this time. If it does, you’ll see the following in the console window:

And now you can fire up safari and access your project at the url specified in the console window: https://127.0.0.1:8000

That’s it. You’re up and running. Develop to your heart’s content.

Additional Things To Explore

In the process of reading other articles and getting this all running on my iPad, I noticed certain recommendations come up time and time again. My needs are quite basic right now, but I’m sure I’ll find the need for more advanced features as time goes on. Below is a quick look at some of the additions I encountered in case they’re relevant for your needs.

Black Mamba

Black Mamba is another add-on (like StaSh) for Pythonista that greatly enhances its function. As far as I can tell, it enables features like keyboard shortcuts and drag and drop, things you’d want if you’re going to spend considerable amounts of time developing within Pythonista. Nearly every write up I encountered on Pythonista praised Black Mamba.

SSH Terminal

I’ve read great things about the Blink and Terminus apps for ssh. Most are operating under the premise of using an iPad as a thin client paired with a server elsewhere to execute your code, e.g. Digital Ocean. I have no experience with this yet but may play with it in the future. Apparently, Blink (a paid app) supports the Mosh protocol, which is essentially UDP for an intermittent connection – this is important because without Mosh the iPad will basically close your connection after a short period of you being in another app (due to iPad multitasking limitations). Blink also offers sandboxed local terminal access. Sounds cool.

General Purpose Code Editor, i.e., an editor for more than just python

If you’re looking for a general purpose code editor, I’ve read positive things about GoCoEdit and Textastic, but have yet to try them out. I believe GoCoEdit pairs well with Working Copy.

Coda is apparently a solid app for editing and developing HTML, CSS, etc. Again, no need for that right now, but I can see how it might be helpful while working on django templates.

Documentation

Ok, I actually have this potentially useful little bugger installed. Dash is an app that allows you to download documentation for just about every coding-related subject matter you could care about. Most pertinent to the task at hand, it includes Django documentation. I haven’t played around with it much, but the whole point of getting django running locally on the iPad is to support offline development right? This fits nicely with that use case.

iPad Accessories

I didn’t feel like shelling out the big bucks for Apple’s smart keyboard folio and I already had the ultraportable Logitech keys to go bluetooth keyboard, so I picked up the highly rated and extremely cheap ESR Yippee case on Amazon. So far, I can’t complain.

I also got this very inexpensive Amazon Basics tablet stand for greater adjustability of viewing angle and for applications when I want to prop the iPad up in the portrait orientation. It works fairly well for this. I probably wouldn’t want to use it this way outdoors for fear of a strong wind sending my iPad crashing over though.

Finally, and not that they’re especially applicable to the use case outlined in this post, but rounding out my accessories are an apple pencil and the PaperLike screen protector. Even though these won’t help you with django development, I can’t recommend these two items highly enough.

Resources

To close out this post, here are the sites I found very helpful in getting my environment set up:

The post Django Development on an iPad Pro appeared first on heaveyduty.com.

]]>
https://www.heaveyduty.com/django-development-on-an-ipad-pro/feed/ 0
Coaching: Knowledge is Power (And where to find it) https://www.heaveyduty.com/coaching-knowledge-is-power-and-where-to-find-it/ https://www.heaveyduty.com/coaching-knowledge-is-power-and-where-to-find-it/#respond Thu, 01 Oct 2015 14:00:26 +0000 https://www.heaveyduty.com/?p=4823 I had the privilege this summer to attend two very different coaching seminars.  This gave me great perspective comparing the programs and their teachings.  Without further adieu, here’s the rundown of… OPEX vs CROSSFIT  Now to be fair, the OPEX program I completed was their assessment and program design (a fairly advanced course), while the CF […]

The post Coaching: Knowledge is Power (And where to find it) appeared first on heaveyduty.com.

]]>
I had the privilege this summer to attend two very different coaching seminars.  This gave me great perspective comparing the programs and their teachings.  Without further adieu, here’s the rundown of…

OPEX vs CROSSFIT 

Now to be fair, the OPEX program I completed was their assessment and program design (a fairly advanced course), while the CF course was a revalidation of my CF L1 Trainer certificate.

If you’re a CF fanatic, and want to learn more about the theory and methodologies behind CrossFit, the CFL1 certificate course is for you.  

Detailed description of their 9 basic movements (air squat, front squat, overhead squat, deadlift, sumo deadlift high pull, med ball clean, shoulder press, push press, push jerk), points of performance of these movements, and typical faults/ coaching cues are reviewed.  This is a broad course where nutrition and programming are also touched upon in brief 1 hour lectures.

The CFL1 seminar staff are phenomenal- excellent speakers, coaches and genuinely awesome people; however, I must repeat, this is a very basic course.  You will NOT be prepared to coach classes, counsel on nutrition or address semi-complicated movement disorders.  That my friend, comes from months (years really) of hands-on experience interning at a facility.  (Aka- learning, screwing up and learning from your mistakes under the guidance of an experienced coach.)

So what if you’ve been coaching for a while, but you want more…  

You want to know how to deal with those movement-challenged clients.

You want to learn more about programming than simply making couplet and triplet wods with varying reps and time domains?

…OPEX, baby.

Now, I am slightly biased, as Heavey completed his CCP L1 OPEX coaching credentials last fall, and has been raving since day 1.  But seriously, the assessment and program design blew my mind.

If the CFL1 was elementary school, this was college.

In assessment you learn how to dissect an athlete piece by piece.  Joint by joint to figure out if and where they have any movement issues.  You learn about body composition pinch testing, and what kind of training your client needs based on those results.  Aka- do they have hormone imbalances or stressors causing fat accumulation in certain areas (tricep, iliac, hammy, scap)?  If so, certain training methodologies may be better than others for these clients.

You also learn how to appropriately test athletes to determine their strengths and weaknesses.

For example:   What’s their back squat to front squat ratio?  How about their clean to snatch?  How is their single leg strength?  Is loaded double leg strength work appropriate for them yet?  And when do you safely incorporate plyometrics?  (Hint hint, it might be awhile!)

Learning all of this you start to realize that whole “scaling the wod for everyone”might not be the best form of action.  

Once you’ve passed the OPEX assessment exam, you are allowed to move on to program design…and oh boy, it’s a brave new world.

Energy Systems and Program Design

In the CF L1 (and slightly more in detail in the CF L2) you learn about the 3 energy systems: phosphocreatine, glycolytic, and aerobic systems.  For balanced fitness, you need to touch on all three of these systems frequently, and preferably in couplets and triplets to keep intensity high.  Pure strength work is recommended once a week.

 

From: https://graemethomasonline.com

(Pictorial from: https://graemethomasonline.com)

OPEX goes into much more detail on the PC, glycolytic, and aerobic systems in their three-day didactic program design course…

Here are the OPEX detailed energy systems you will not only become familiar with, but will learn how to incorporate into long term training programs for all levels of athletes:

  • Anaerobic Alactic Power
  • Anaerobic Alactic Endurance
  • Anaerobic Alactic Capacity
  • Anaerobic Lactic Power 1 / Power 2
  • Anaerobic Lactic Endurance 1 / 2 / 3
  • Anaerobic Lactic Capacity
  • Max Aerobic Power 1 / 2 / 3 / 4 / 5 / 6 / 7 / 8 / 9 / 10 (that’s 10 separate ones)
  • Aerobic Capacity Test

Phew.

Heavey and I incorporate all of our OPEX assessment and energy system programming goodness into all of our individual clients’ programs.

Now after reading on all of this, you might think I’m dogging on the CF L1 course.  NOT AT ALL.  Everyone needs to start somewhere, and that’s a perfect point to begin your search for coaching knowledge.  CF seminar staff member Cherie Chan said it herself:  “As a coach, your search for knowledge to better yourself and your clients is never over.”  (BTW- she was awesome!)

With that said, if you’re looking to advance your coaching, check out OPEX and prepare to have your mind blown.  Knowledge is power, for you and your clients.

~Nicole

PS- Interested in learning more about your personal fitness assessment?  Want to know if individual program design is right for you?  Contact us – we’d love to have a chat about your training and goals.

 

IMG_9628

The post Coaching: Knowledge is Power (And where to find it) appeared first on heaveyduty.com.

]]>
https://www.heaveyduty.com/coaching-knowledge-is-power-and-where-to-find-it/feed/ 0
Why Paleo Is Making You Fat https://www.heaveyduty.com/why-paleo-is-making-you-fat/ https://www.heaveyduty.com/why-paleo-is-making-you-fat/#respond Thu, 24 Sep 2015 14:00:37 +0000 https://www.heaveyduty.com/?p=4725 It’s an interesting cycle to watch: You start CrossFitting–> You get fitter and more interested in your overall health. You hear about this buzzword “Paleo”, become interested in also improving your nutrition and dive all-in to the Caveman eating plan.  Grains, sugar and legumes are banned (most likely dairy too) and you start looking seriously fit and […]

The post Why Paleo Is Making You Fat appeared first on heaveyduty.com.

]]>
It’s an interesting cycle to watch:

You start CrossFitting–> You get fitter and more interested in your overall health.

You hear about this buzzword “Paleo”, become interested in also improving your nutrition and dive all-in to the Caveman eating plan.  Grains, sugar and legumes are banned (most likely dairy too) and you start looking seriously fit and trim.

Paleo-CrossFit becomes your new religion and man it’s glorious!

…BUT eventually this magic stops working so well.  Progress stalls for no apparent reason.  You’re still eating clean, still training like crazy, so what gives?

Here’s the top 3 faults seen among the Paleo crowd:

  1. Eating in excess
  2. Paleo Baking (eek!)
  3. Not enough veggies

Let’s break this down:

  1. Eating in excess- Even though you may be eating super “clean”, it is easy to overeat in the Paleo realm.  Most Paleo-ers know fruit should be consumed in moderation, but it can also be easy to overdose on all those healthy fats.  Giant handfuls of nut, several pieces of bacon with breakfast, a plethora of fatty meats and cupfuls of coconut milk can over time pack a punch on the waistline.bacon
  2. I hate to admit this one, because I LOVE to bake, but the truth is, all those Paleo baking recipes out there… well, you might be better off eating a small amount of the real thing rather than the Paleo counterpart.  Why?  Most paleo baking recipes include almond flour.  Almond flour is simply ground almonds- in fact, 1 cup of almond flour contains about 90 almonds.  That’s a lot of nuts!  Compared to regular white flour, almond flour has 33% more calories.  As a paleo-ite it’s probably been ingrained in your head that calories no longer matter.  The fact is, over time in excess, they do!  paleomeme
  3. The truth is, in the Paleo world, meat (bacon!!), eggs, and butter are glorified…but where are the veggies?  The majority of your plate should be veggies- leafy greens and as many other colors of non-starchy beauties that tickle your fancy.  Not only are veggies less calorically dense, but they’re also chocked full of micronutrients/antioxidants/fiber.

paleo veggies


So, What’s A Paleo Guy/Gal To Do?

  • The Weigh and Measure Game

If you’re not where you want to be on your nutrition and body comp, start weighing and measuring your food.  Set up a free account on my fitness pal and log EVERYTHING for 1-2 weeks.  This will teach you portions and help you figure out where your macros need tweaking.

  • For All Those Bakers

If you’re a baking queen like myself, remember, a cookie is a cookie whether it’s Paleo or not.  You can play around with subbing some of your almond flour with coconut flour or even protein powder to change up the macronutrients and calories to better fit your goals.

  • And for the Meat Lovers

Don’t forget your veggies.  Fill your plate with 3/4 veggies.  You’ll poop like a pro, your waist will love you and your micronutrients will be rocking.

 

~Nicole

PS- Need help with macros?  Unsure where to start?  Contact us for a nutrition consult.


 

 

The post Why Paleo Is Making You Fat appeared first on heaveyduty.com.

]]>
https://www.heaveyduty.com/why-paleo-is-making-you-fat/feed/ 0
Overcoming Injuries https://www.heaveyduty.com/overcoming-injuries/ https://www.heaveyduty.com/overcoming-injuries/#respond Thu, 17 Sep 2015 14:00:23 +0000 https://www.heaveyduty.com/?p=4712 Injuries…I hate to break it to you, but they’re going to happen. As an athlete, or even a weekend warrior, at some point you will get injured, and that’s okay. Yes, some injuries can be prevented via smart programming, mobility work, and avoiding overtraining, but silly things like spraining your ankle on a 400m run, […]

The post Overcoming Injuries appeared first on heaveyduty.com.

]]>
Injuries…I hate to break it to you, but they’re going to happen.

As an athlete, or even a weekend warrior, at some point you will get injured, and that’s okay.

Yes, some injuries can be prevented via smart programming, mobility work, and avoiding overtraining, but silly things like spraining your ankle on a 400m run, tripping and breaking your nose on that run, or busting a lip/chipping a tooth on a push press is all part of being a human non-couch potato.

As the saying goes:  Shit Happens.

Now spraining your ankle is fairly minor, but what do you do if you have a more serious injury?

A broken bone more than likely means you (or part of you) will be out of commission for a fair amount of time for proper healing and recovery.  And coming back to normal training after that can feel like a very steep hill of poopy-doo, both mentally and physically.

How to return to training

It’s important during this return to training to ease back in with a focus more on strict strength work – and if it was an extremity that was injured, this should include unilateral strength work to correct injury related strength imbalances.

Meet Remote Coaching Client Heather

FullSizeRender-25

Let’s take a look at Remote Coaching Client Heather.  Heather broke her wrist 9 months ago while testing her 1 rep (squat) clean.  She caught the bar wrong, elbow dropped, and wrist snapped.  No fun for sure- and she has since self-diagnosed herself with “Squat Clean PTSD”.

She did the best she could with her training over the next 6 months sans “lefty”- and maintained decent conditioning; however, after fully healed it was very clear she had a huge strength discrepancy left to right in her upper body.

We started working together 6 weeks ago with a goal to correct these imbalances and get her back in tip-top shape- both mentally and physically.

How did we do this?

Among other things, the focus has been on lots and lots of upper body dumbbell work as well as technique work to regain confidence in her clean:

  • DB Bench Press
  • DB Rows
  • DB Overhead Press
  • Tall Cleans

I’m proud to say Heather hit a milestone this past week in her training… a grinder metcon with 3 full cleans at ~90% of her old 1 rep per round.  Though it was a huge hurdle for her, she rocked the sh*t out of it.

I couldn’t have said it better myself:

“Some days you are asked to face a brick wall and get over it. Today was that day. I haven’t done any heavy squat cleans since breaking my arm in December. Today I was asked to do 133# for three. I warmed up. I did power cleans and front squats. And I got the first one. I knew I would have to take a rest before number two. Technique over time I always say. I went for number two and bailed. This created flashbacks of the “Pop pop pop” of my bones breaking. I had to focus on one lift and not what “could happen.” Then I got it. Went for number three: fail. Then fail again. Breath. Boom. Got it. Went through my other moves and there I was. Back at the bar. I lifted and didn’t even get to the turn. Fail two. Fail three. Hat was thrown. Select words were said. But I was not giving up. Got one! Rest. Fail. Possibly kicked something. I’m not lowering it. Number two. Got it. Number three. Yup! Sometimes we face a wall. Sometimes we don’t want to go over it. But we have to if we want to keep making progress. Thanks @strength_babe for asking me to do this. #‎squatcleanptsdisreal.

-Heather

 

11953475_10156237420305144_4793383944903162457_o

Getting back on the horse with strict strength and technique work…
Getting comfortable with the uncomfortable…
Facing your fears…
Congrats to coaching client Heather​ on climbing that brick wall.

 

~Nicole    (Aka @strength_babe)

Coming back from an injury?  Need to correct strength imbalances?  Contact us to learn more about how we can help.

 

The post Overcoming Injuries appeared first on heaveyduty.com.

]]>
https://www.heaveyduty.com/overcoming-injuries/feed/ 0
Oh Heavey Fancy! https://www.heaveyduty.com/oh-heavey-fancy/ https://www.heaveyduty.com/oh-heavey-fancy/#respond Thu, 10 Sep 2015 14:00:29 +0000 https://www.heaveyduty.com/?p=4674 So, disclaimer here, I’m about to brag… about Heavey. ‘Cuz he got fancy. Some of you know, some of you don’t, but the life of Mr and Mrs Heavey Duty has been far from “normal” to say the least.  We started off normal with college, grad school, 9-5 corporate jobs and such, but very quickly […]

The post Oh Heavey Fancy! appeared first on heaveyduty.com.

]]>
So, disclaimer here, I’m about to brag… about Heavey.

‘Cuz he got fancy.

Some of you know, some of you don’t, but the life of Mr and Mrs Heavey Duty has been far from “normal” to say the least.  We started off normal with college, grad school, 9-5 corporate jobs and such, but very quickly realized being the norm was not our jam.

We made a pact and a plan to follow a path of our passions, making as calculated financial decisions as possible for a simple future.  One that didn’t involve both of us working for someone else.  One that DID involve us spending time together, doing what we love (health and fitness goodness) and helping others along the way.

We started a CrossFit affiliate, gained as much training and coaching knowledge as we could, and realized in the process that we really revel the science and the background of training, and working with clients one-on-one to attain their goals.

Heavey attained his CCP L1 OPEX certification (at the time, only the 22nd person in the world to do this).  He’s currently working on his L2 OPEX certification, but I’m excited to announce his newfound expertise in another area…

 

IMG_8126

Meet Brandon Heavey, FDN-P

(Functional Diagnostic Nutrition Practitioner)

What does FDN-P mean to you?

Heavey now has the credentials and expertise to order lab work on his clients and treat them as a functional medicine client.  Besides writing kick ass training programs and analyzing your nutrition he can now assess adrenal function by ordering hormone panels, food sensitivity testing, leaky gut tests, and even pre-conception health for couples ready to start a family.

(Sidenote:  Ladies, did you know it’s highly recommended to get your stress, hormones, and gut health in check at least a year before conceiving to ensure optimal fetal health and reduce chances of child behavioral and health issues?!)

Anyway, yeah, Heavey is fancy.

Be on the lookout for client cases and knowledge bombs from B. Heavey, FDN-P.

Interested in having adrenal or food sensitivity tests for yourself to improve your performance both inside and outside the gym?  Contact Heavey to find out more.

~Nicole


FullSizeRender-23

The post Oh Heavey Fancy! appeared first on heaveyduty.com.

]]>
https://www.heaveyduty.com/oh-heavey-fancy/feed/ 0
Sprinklers: The key to motivation, happiness, and gainz. https://www.heaveyduty.com/sprinklers-the-key-to-motivation-happiness-and-gainz/ https://www.heaveyduty.com/sprinklers-the-key-to-motivation-happiness-and-gainz/#respond Thu, 03 Sep 2015 14:00:30 +0000 https://www.heaveyduty.com/?p=4317   Ah, motivation.  Motivation to move, to work, to workout.  To be…productive. Often times, it can be buried underneath everyday life.  Hard to find at times, and if you disagree with that statement- you’re lying to yourself. If you’re a coach working with clients, you’ll notice a waxing a waning of motivations.  Extreme motivation some […]

The post Sprinklers: The key to motivation, happiness, and gainz. appeared first on heaveyduty.com.

]]>
 

Ah, motivation.  Motivation to move, to work, to workout.  To be…productive.

Often times, it can be buried underneath everyday life.  Hard to find at times, and if you disagree with that statement- you’re lying to yourself.

motivation

If you’re a coach working with clients, you’ll notice a waxing a waning of motivations.  Extreme motivation some weeks, and other times…crickets and apologies about getting way behind, promising they’ll get back on track.

 

When this is the case- when motivation is lost- it’s important to look at the whole picture.  Perhaps there are additional complications.  Perhaps a lack of enthusiasm is caused by exogenous stressors- work, family issues.  Perhaps it’s internal issues related to nutrition or sleep disturbances…or perhaps the client just needs a break.

 

So what if you find yourself in that position as the client?  …The unmotivated, overburdened individual stuck in blah-land, and can’t get yourself out the door.

There are a few tricks to regain that va-voom you seemingly lost.

 

  1. Take a look at yourself.  Evaluate your internal and external stressors…and what YOU have control over.   Accept and stop worrying about the shit you can’t change.
  2. Remind yourself why you train.  What is the personal value obtained?  Is it mental/physical health?  Is it to keep up with your kids?  Training for an event or competition? Or, be honest, you just want to look effin’ sexy naked?  Just reminding yourself “WHY” is a huge motivation.

If all else fails, scrap your training  for the day and do something crazy and completely childish… like galloping through your neighbors sprinklers- arms flailing, awkward sprint and all.  Laugh at yourself, remember what it’s like to be a kid, and smile.

 

…Because in the end, finding motivation is reconnecting with your inner self.  Capture spontaneous bursts of energy and motivation with surely follow.
Be bold.  And tackle those random sprinklers.

~Nicole

The post Sprinklers: The key to motivation, happiness, and gainz. appeared first on heaveyduty.com.

]]>
https://www.heaveyduty.com/sprinklers-the-key-to-motivation-happiness-and-gainz/feed/ 0
Finding Your Six-Pack… With Cereal. https://www.heaveyduty.com/finding-your-six-pack-with-cereal/ https://www.heaveyduty.com/finding-your-six-pack-with-cereal/#respond Fri, 21 Aug 2015 14:00:06 +0000 https://www.heaveyduty.com/?p=4636 I used to be a devoted paleo/primal worshiper…I’m not anymore. Do I still feel a grain-free unprocessed diet is optimal for longevity and health?  Absolutely without a doubt. Do I preach that to my nutrition clients?  Kinda-sorta. Why? Because my #1 priority for my clients is to find a way of eating that will be […]

The post Finding Your Six-Pack… With Cereal. appeared first on heaveyduty.com.

]]>
I used to be a devoted paleo/primal worshiper…I’m not anymore.

Do I still feel a grain-free unprocessed diet is optimal for longevity and health?  Absolutely without a doubt.

Do I preach that to my nutrition clients?  Kinda-sorta.

Why?

Because my #1 priority for my clients is to find a way of eating that will be sustainable for them for the long term.  Like FOREVER.

Let’s face it: how many of you have done nutrition challenges, seen great results, and then months down the line with much frustration, you’re back to where you started before the challenge?!

A nutrition challenge, whether it’s Whole-30, Paleo, or the Twinkie diet is a complete failure if you’re not able to:

A. Maintain that lifestyle

B. Maintain your positive outcomes


 

Enter B.R.

IMG_0081

Left pictures on 7/12/15. Right pictures on 8/15/15.

B.R…hot damn check out that six-pack!

Now let’s be honest here, B.R. looked pretty darn amazing to start with, BUT she felt like she was getting “soft” despite her 6-day-a-week lifting regimen and wanted to improve her nutrition.

We focused on tweaking B.R’s nutrition to improve her protein intake as a vegetarian, with a secondary focus on macronutrient ratios and adequate hydration.

NOTE- B.R. has actually been consuming MORE calories in the last 5 weeks of her nutrition coaching, and has noticed improved energy and strength in her workouts and everyday life.  Boom!

Yes, she’s leaner now, but NO, she has not been eating a restrictive diet. (Far from it!)

She’s been enjoying her favorite snacks- Raisin Bran cereal and even homemade cookies by watching her portions and fitting them into her macronutrient goals.

The goal here is a SUSTAINABLE lifestyle of balanced healthy eating for the long term.

As a nutrition coach, I am not interested in putting my clients on a restrictive diet.

My goal is to teach portions, nutrient densities, and allow my clients to take control over their food intake and their choices…and let their six-pack shine.

Rock on B.R.!!

Yes she did.

Yes she did.

Want to learn more about how to sustainably enjoy your favorite foods while leaning out?  Hit us up.

~Nicole


 

 

The post Finding Your Six-Pack… With Cereal. appeared first on heaveyduty.com.

]]>
https://www.heaveyduty.com/finding-your-six-pack-with-cereal/feed/ 0