Showing posts with label Howto. Show all posts
Showing posts with label Howto. Show all posts

Saturday, June 1, 2013

Python Tip - If you've accidentally deleted your .py files, all is not lost...

Recover .py files using uncompyle

If you've accidentally deleted your .py file, all is not lost. Use uncompyle to recover:

  git clone https://github.com/gstarnberger/uncompyle.git
  cd uncompyle/
  sudo ./setup.py install

  uncompyler.py thank_goodness_this_exists.pyc > recovered_file.py


See Also

Python Tip - Create and detach a child process

Create and detach a child process

Use the following code to create and subsequently detach a child process

  DETACHED_PROCESS = 0x00000008
  pid = subprocess.Popen([sys.executable, "longtask.py"],
                         creationflags=DETACHED_PROCESS)

  pid.poll()  # Returns: None if child still active
              #          returncode otherwise 


In Sym, a complex component will be made up of a parent process and related child processes. 

See Also


Wednesday, May 29, 2013

Using sym for notifications and predictions

As a follow-up on the sym workflow posted earlier,  here are some uses for sym.

Notification applications

The following will apply to any kind of notify-on-change kind of apps:
  1. Create sym check the price of gold continuously called say, goldpx
    1. Link goldpx to diffcheck
    2. Get sms notifications whenever the price of gold changes

Prediction applications

This is quite rough but does seem doable.
  1. Create a sym that's a neural network called say, nn
    • Set nn mode to train
    • Link goldpx to nn for a day or so. 
    • Set nn mode to predict 
    • Link nn to diffcheck
    • Get sms notifications whenever the neural network a change in the price of gold

A good name and actionable readme on GitHub is important

A comparison of two projects

Compare jsonschema and json-schema-validator on GitHub for do's and don'ts e.g.:

Short, succinct package names

jsonschema is better than json-schema-validator

Well-thought, actionable readmes


json-schema validator readme

jsonschema readme