Tuesday, February 25, 2014

Pip Not Working From Powershell

If you have strawberry perl installed, you may get one of these errors when you try to use pip from powershell:

  • Did not provide a command
  • Unknown or unsupported command 'install'
This is the result of a conflict between strawberry perl's pip and python's pip. You need to remove anything related to strawberry perl from your path environmental variable and ensure you have C:\Python27\Scripts and C:\Python27\Scripts in your environmental variables.

Tableau's Frustrating Licensing Program

Tableau's licensing program is crazy.

I was planning to use "Trusted Authentication" to share an embedded chart with lots of users (not all of whom have licenses). Some of those users will only look at the chart maybe once a year, and we can't justify buying them an entire license to look at a chart once.

This page says "everyone who visits the page must be a licensed user on Tableau Server": http://onlinehelp.tableausoftware.com/v7.0/server/en-us/trusted_auth.htm

If you want more details on how to implement Trusted Authentication using PHP, first visit the following folder on your server: C:\Program Files\Tableau\Tableau Server\8.1\extras\embedding\php

It has some sample code, but you need to install version 1.x of pecl_http to make it work. The guides for that are:

Possible Solution To Slow SQLalchemy + Flask Application

This stackoverflow thread talks about why you want to use scoped_session:
http://stackoverflow.com/questions/6519546/scoped-sessionsession-maker-or-plain-session-maker-in-sqlalchemy

Basically, your web application isn't thread-safe if you're not using scoped_session. It's much better than having you application use a new thread for every instance.

An example of scoped_session in use is available here: https://github.com/mjhea0/flask-boilerplate/blob/master/models.py

Tuesday, February 18, 2014

Hide Zero Value Points On Google Chart

I have a line chart which needed a series of points. I don't want points to show if the value is zero.

Here's my solution:

  • Set the series's lineWidth to zero and make the point larger than 0:
    series: {0: {lineWidth: 0, pointSize: 5}}
  • Make the viewWindow setting's min higher than 0 (to hide the 0 points):
    vAxis: { viewWindowMode:'explicit', viewWindow:{ min: 0.5 } },

Monday, February 17, 2014

Change Home Flask-Admin

This was the only thing I was able to get working: http://www.marteinn.se/blog/?p=637

Just putting index.html into an admin/ directory wouldn't work.

There's also an even shorter way to do it, for example:
admin = Admin(app, "G-Cal Manager", index_view=AdminIndexView(name='Home', template='admin/home.html', url='/'))

The example above will change the root url to / instead of /admin and it will use home.html from your templates/admin folder.

To fix the 404 errors on your stylesheets after the change, you will also need to change the static_folder in your flask object:
app = Flask(__name__, static_folder='admin')