Showing posts with label python. Show all posts
Showing posts with label python. Show all posts

Thursday, August 2, 2012

Setting up Python Mako with MySQL Workbench

It seems that on MAC, does not to include packages from:

/Library/Python/2.7/site-packages/*


Therefore, its not available within the plugin environment of MySQL Workbench.

The solution is to copy
/Library/Python/2.7/site-packages/mako
as:
/Users/james/Library/Application Support/MySQL/Workbench/mako



Thursday, April 14, 2011

Cron but not frequent enough?

If you ever need a on going php process, lets say every 5 or 2 seconds once, you may use python script to do this.
Here is an example of a script:
--------------------
#!/usr/bin/env python
import thread
import time
import os
import sys

sPHPPath = "/usr/bin/php"

def myphp1():
  while 1:
    os.system(sPHPPath + " " + sys.path[0] + "/myphp1.php")
    time.sleep(2)

def myphp2():
  while 1:
    os.system(sPHPPath + " " + sys.path[0] + "/myphp2.php")
    time.sleep(2)

if __name__=="__main__":
  thread.start_new_thread(myphp1, ())
  thread.start_new_thread(myphp2, ())
  while 1:
    time.sleep(60)