background preloader

Tornado Web Server

Tornado Web Server
Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed. By using non-blocking network I/O, Tornado can scale to tens of thousands of open connections, making it ideal for long polling, WebSockets, and other applications that require a long-lived connection to each user. Upgrade notes As of Tornado 3.2, the backports.ssl_match_hostname package must be installed when running Tornado on Python 2. This will be installed automatically when using pip or easy_install. Hello, world Here is a simple “Hello, world” example web app for Tornado: import tornado.ioloop import tornado.web class MainHandler(tornado.web.RequestHandler): def get(self): self.write("Hello, world") application = tornado.web.Application([ (r"/", MainHandler), ]) if __name__ == "__main__": application.listen(8888) tornado.ioloop.IOLoop.instance().start() This example does not use any of Tornado’s asynchronous features; for that see this simple chat room. Installation

PylonsHQ - Home A Universal RFID key RFID projects have been pretty prominent recently, ranging from projects here in Instructables, to our local Silicon Chip magazine in Australia publishing a RFID door lock project in their November issue. Even I recently purchased a RFID door lock on eBay for $15 to lock my garage (so my front neighbor could get tools if he wanted to). We have known that the cheaper RFID technologies were pretty insecure for a number of years. Researchers have demonstrated cloners of all varieties, but simple RFID tags are still being used for access control. A while ago, I was looking at Hack A Day, and I saw an amazing project that somebody had made. So, in typical fashion, I built my own reader hardware so I could have a look at the data from a card, and created my own version of the Universal RFID key. The key I made works beautifully both on my garage door, as well as on a number of other readers I tried. Will this key let you into anybodies RFID protected office?

Hidden features of Python What I Wish Tornado Were FriendFeed has released its web server, Tornado. It seems like everyone's blogging about it, and it's obviously relevant to my interests, so I feel like I should say something. Let me start with the good stuff. First of all, I think it's great that we have yet another asynchronous contender in the Python world. Every time something like this comes out, it means that Twisted has to fight that much less hard to get over the huge hump of event-driven programming being too hard, or too weird, or whatever. It's good to have an endorsement of the general message "if you need a web server to handle COMET requests, it needs to be asynchronous to perform acceptably" from such a high-profile company as Facebook. Unfortunately I think the larger picture here is a failure of communication in the open source community. This is especially important if you are later going to make claims about that project not living up to your vaguely-described requirements, and thereby damage its reputation.

Doctor JS Using PyObjC for Developing Cocoa Applications with Python Cocoa Frameworks The Cocoa frameworks consist of libraries, APIs, and runtimes that form the development layer for all of OS X. By developing with Cocoa, you will be creating applications the same way OS X itself is created. The Power of Objective-C Much of Cocoa is implemented in Objective-C, an object-oriented language that is compiled to run at incredible speed, yet employs a truly dynamic runtime making it uniquely flexible. As your application runs, the Objective-C runtime instantiates objects based on executing logic—not just in ways defined during compilation. Cocoa Uses the Model-View-Controller Design Pattern Cocoa uses the Model-View-Controller (MVC) design pattern throughout. The MVC pattern means that Interface Builder requires no code to be written or generated while you focus exclusively on the View of your application. Features List: Frameworks by Category Audio and Video AV Kit AV Foundation Core Video Core Audio Audio Units Data Management Core Data Graphics and Animation

Python Community in Anguish, Pain, Despair Over Web Server First they had the guts to punk TechCrunch, now Facebook picks a fight with the Python community by releasing a web server, called Tornado, developed by recently acquired Friendfeed. Terry Jones, CEO of Fluidinfo, probably best expressed the pain felt by Pythonistas: "Words fail me on this one. I’ve spent some hours today trying to put my thoughts into order so I could put together a reasonably coherent blog post on the subject. But I’ve failed." Facebook's Bret Taylor explains the reasons for such a highly unpopular move: "We ended up writing our own web server and framework after looking at existing servers and tools like Twisted because none matched both our performance requirements and our ease-of-use requirements." The performance myth was quickly dismissed by an article which shows that Twisted performs almost as well as Tornado. Pwpwp looked at the Twisted documentation, to dispel the ease-of-use myth. As you can see clearly, it's mostly a problem of perception.

HTTP Compression of the Fortune 1000 - content encoding can compress xhtml, css, and javascript for faster web page download times web compression Summary: HTTP compression uses standards-based gzip and deflate compression algorithms to compress your XHTML, CSS, and JavaScript to speed up web page downloads and save bandwidth. HTTP compression, otherwise known as content encoding, is a publicly defined way to compress textual content transferred from web servers to browsers. HTTP compression uses public domain compression algorithms, like gzip and compress, to compress XHTML, JavaScript, CSS, and other text files at the server. This standards-based method of delivering compressed content is built into HTTP 1.1, and most modern browsers that support HTTP 1.1 support ZLIB inflation of deflated documents. Stephen Pierzchala, Senior Technical Performance Analyst with Gomez, said this about HTTP compression: "When tied to other methods, such as proper caching configurations and the use of persistent connections, HTTP compression can greatly improve Web performance. The Browser / Server Conversation Browsers Can Lie 2P. Further Reading

Twisted Twisted is an event-driven networking engine written in Python and licensed under the open source MIT license. Twisted makes it easy to implement custom network applications. Here's a TCP server that echoes back everything that's written to it: from twisted.internet import protocol, reactor class Echo(protocol.Protocol): def dataReceived(self, data): self.transport.write(data) class EchoFactory(protocol.Factory): def buildProtocol(self, addr): return Echo() reactor.listenTCP(1234, EchoFactory()) Learn more about writing servers, writing clients and the core networking libraries , including support for SSL, UDP, scheduled events, unit testing infrastructure, and much more. Twisted includes an event-driven web server. Learn more about web application development, templates and Twisted's HTTP client. Here's a simple publish/subscribe server, where clients see all messages posted by other clients: Twisted includes a sophisticated IMAP4 client library.