This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE parent ( | |
| id INT NOT NULL AUTO_INCREMENT, | |
| name VARCHAR(50), | |
| PRIMARY KEY (id) | |
| ) ENGINE=INNODB; | |
| CREATE TABLE child ( | |
| id INT NOT NULL AUTO_INCREMENT, | |
| parent_id INT, | |
| name VARCHAR(50), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from twisted.web import static, server | |
| from twisted.application import service, internet | |
| application = service.Application("Demo Web Server") | |
| web = server.Site('/home/oubiwann/public_html') | |
| service = internet.TCPServer(7001, web) | |
| service.setServiceParent(application) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >>> from zope.testbrowser.browser import Browser | |
| >>> b = Browser('http://google.com') | |
| >>> b.title | |
| 'Google' | |
| >>> b.getLink('About Google') | |
| <Link text='About Google' url='http://www.google.com/intl/en/about.html'> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >>> from twisted.python.filepath import FilePath | |
| >>> tmp = FilePath('/tmp') | |
| >>> tmp.exists() | |
| True | |
| >>> bogus = tmp.child('bogus') | |
| >>> bogus.exists() | |
| False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Revision(object): | |
| """ | |
| A storm ORM object representing a row in the trac 'revsion' SQLite table. | |
| """ | |
| __storm_table__ = 'revision' | |
| rev = Unicode(primary=True) | |
| time = Int() | |
| author = Unicode() | |
| message = Unicode() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ git clone https://github.com/orthecreedence/cl-async.git | |
| $ cd cl-async | |
| $ tar cvzf libevent2.tgz ./libevent2 | |
| $ start-sbcl | |
| * (require 'asdf-install) | |
| ("ASDF-INSTALL") | |
| * (asdf-install:install "libevent2.tgz") | |
| Install where? | |
| 1) System-wide install: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # template loader framework | |
| from twisted.internet.defer import maybeDeferred | |
| from twisted.web.template import tags, Element, TagLoader, renderer, slot | |
| from twisted.python.util import mergeFunctionMetadata | |
| def withTemplate(templateTag): | |
| templateTag.render = "__top__" | |
| def deco(x): | |
| def it(request): | |
| e = Element(loader=TagLoader(templateTag)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (def read-agent (agent nil)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (def read-agent (agent "" :validator string?)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun my-echo-server () | |
| (format t "Starting server.~%") | |
| (as:tcp-server nil 9003 ; nil is "0.0.0.0" | |
| (lambda (socket data) | |
| ;; echo the data back into the socket | |
| (as:write-socket-data socket data)) | |
| (lambda (err) (format t "listener event: ~a~%" err))) | |
| ;; catch sigint | |
| (as:signal-handler 2 (lambda (sig) | |
| (declare (ignore sig)) |