Source

filesnake / NOTES.org

* Notes about this project
** Sending files over network
*** Raw sending through Line
The file sending stuff is not really easy however twisted seems to
have a very good way to handle this, illustrated at this link:
http://twistedmatrix.com/pipermail/twisted-python/2007-July/015738.html
(There's an example)

*** Bittorrent
Another way would be integrate a bittorrent library inside the code, in that way:
A:
 pass the .torrent file
B:
 accept and start the connection
There should be at least one tracker. (maybe one for each client)
Maybe the best library is libtorrent-rasterbar

*** Perspective Broker
**** Producer/Consumer
A perspective broker should be nice for doing that, plus the
Producer/Consumer pattern.
The producer/consumer however are on another port like:

PBRoot()
def remote_transfer_file(port,host,key):
    start transfer
    
**** Pager
using pager is on the same port, though I don't know if the
performances are good.

** Features Planned
First:
- Automatic discovery in LAN through avahi
- easy file transfer, possibly fast
- directory transfer
- stop/pause/resume transfer.
- checking for integrity and if there are some parts not integer, it
  will recover that parts without redownloading all the file.

Second:
- recovering transfers after ungraceful shutdown [maybe, it will require something like authentication]

* Packaging
** Linux
.desktop files are installed using desktop files install
icons are installed in usr/share/icons/hicolor... and the db should be updated:
gtk-update-icon-cache -q -t -f usr/share/icons/hicolor in the post_install, post_upgrade and post_remove function.
http://wiki.archlinux.org/index.php/Gnome_package_guidelines
* Notes about twisted
** Deferreds
inlineCallbacks seems something really nice to use, a good way to
simplify much code (they're actually coroutines)
** Testing
Testing is fundamental:
what I've learned:
1) Don't use sockets
2) To test the server, simulate the client calls
3) To test the client, simulate the server responses

** Events:
an useful event stuff is EventDispatcher (twisted.python.dispatch)

A global event dispatcher for events. I'm used for any events that need to span disparate objects in the client.

I should only be used when one object needs to signal an object that it's not got a direct reference to (unless you really want to pass it through here, in which case I won't mind).
I'm mainly useful for complex GUIs.

Method Summary
  	__init__(self, prefix)
  	autoRegister(self, obj)
  	publishEvent(self, name, *args, **kwargs)
  	registerHandler(self, name, meth)

http://www.cs.lth.se/EDA046/assignments/assignment4/twisted-api/twisted.python.dispatch.EventDispatcher.html
** Factories
from the finger tutorial:

   The same behavior, but finally we see what usefulness the factory
   has: as something that does not get constructed for every
   connection, it can be in charge of the user database. In
   particular, we won't have to change the protocol if the user
   database back-end changes.

   self-explanatory!

* Notes about pygtkhelpers
reading the source is the only way till the 1.0.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.