Paul's Programming Notes     Archive     Feed     Github

SQLalchemy - Print Tables In Database (Show Tables)

from sqlalchemy import create_engine, Table, MetaData

engine = create_engine('mysql+mysqldb://username:password@111.111.111.111/databaseName')
metadata = MetaData(bind=engine)
metadata.reflect(engine)
print metadata.tables.keys()

You could also use that for looping through a list of the tables in the database.

Best VNC Installation Guide

https://wiki.amahi.org/index.php/Install_VNC_server_on_Ubuntu_Server_12.04

That guide gave me the least amount of hassle when I installed VNC on a server. I started by trying to get it working with 13.10, but had issues with a grey screen when tightvnc connected.

"Not Found The requested URL /app/install was not found on this server." - CakePHP

Rather than dealing with my .htaccess problems to fix the error, I thought this would be a better approach: http://wwdj.wijndaele.com/getting-started-with-cakephp-without-mod_rewrite/

Unfortunately, it messed up quite a few links on my site.

I ended up solving the problem by changing "AllowOverride" None to "AllowOverride All" in my /etc/apache2/sites-available/default file.

Why the heck is CakePHP using .htaccess files by default anyway? Yii has this more streamlined.

How To Use Endpoint Parameter - Flask-Admin

You can access the endpoint parameter by using self.endpoint.

class displayResults(BaseView):
@expose('/',methods=('GET','POST'))
def index(self):
print self.endpoint

admin.add_view(displayResults(name='test', endpoint='test2'))

That will print "test2".