Software, .NET, PC's, PHP, ETC..

 

 


[CaRP] Can't open cache file.
CodeKeep Python Feed
The latest and greatest Python code snippets publicly available

Crude Random Birth date Generator
20 Feb 2007 at 7:45am
Description: Python code to generate a list of 25 random dates in the range suitable for pasting into excel.

Link: http://www.codekeep.net/snippets/54e0c94e-2fd8-42ac-acda-4eb01e020c5b.aspx

import random zot = 1 random.seed() while zot < 25: print random.randrange(39083, 39447, 1) zot += 1
urllib
21 Jun 2006 at 10:45am
Description: python/urllib

Link: http://www.codekeep.net/snippets/dfc674ef-4351-4a31-9da4-81d377c0833d.aspx

import urllib print urllib.urlopen("http://www.google.de").read()
file watcher
5 Dec 2005 at 4:23pm
Description: file watcher

Link: http://www.codekeep.net/snippets/7dd22e3b-f077-4dcd-8014-8b5f1624ffb8.aspx

from twisted.application import internet def watch(fp): fp.seek(fp.tell()) for line in fp.readlines(): sys.stdout.write(line) import sys from twisted.internet import reactor s = internet.TimerService(0.1, watch, file(sys.argv[1])) s.startService() reactor.run() s.stopService()
tcp server
5 Dec 2005 at 4:18pm
Description: tcp server

Link: http://www.codekeep.net/snippets/07434b90-90e5-46e9-b3bd-ad128cd3a5e6.aspx

######################################################### # Server side: open a socket on a port, listen for # a message from a client, and send an echo reply; # this version uses the standard library module # SocketServer to do its work; SocketServer allows # us to make a simple TCPServer, a ThreadingTCPServer, # a ForkingTCPServer, and more, and routes each client # connect request to a new instance of a passed-in # request handler object's handle method; also supports # UDP and Unix domain sockets; see the library manual. ######################################################### import SocketServer, time # get socket server, handler objects myHost = '' # server machine, '' means local host myPort = 50007 # listen on a non-reserved port number def now(): return time.ctime(time.time()) class MyClientHandler(SocketServer.BaseRequestHandler): def handle(self): # on each client connect print self.client_address, now() # show this client's address time.sleep(5) # simulate a blocking activity while 1: # self.request is client socket data = self.request.recv(1024) # read, write a client socket if not data: break self.request.send('Echo=>%s at %s' % (data, now())) self.request.close() # make a threaded server, listen/handle clients forever myaddr = (myHost, myPort) server = SocketServer.ThreadingTCPServer(myaddr, MyClientHandler) server.serve_forever()

Newsfeed display by CaRP

 

rule01

Best Selling Python-related books from


[CaRP] Can't open cache file.
Windows PowerShell in Action
by Bruce Payette
Amazon Price: $29.69
Customer Review: I don't ever remember reading a computer book from cover to cover, but I got hooked on this book and "can't put it down"... Plus, who ever thought that the history of a program could be as interesting as this one is. After all, the book begins by ask...

Learning Python, Second Edition
by Mark Lutz, David Ascher
Amazon Price: $26.39
Customer Review: Learning Python is an efficient way to learn python if you are familiar with one or more other programming languages. The book does a nice job of comparing and contrasting python's qualities with those of other languages (C++ and Java in particular) ...

Mastering Regular Expressions
by Jeffrey Friedl
Amazon Price: $29.69
Customer Review: Are you a programmer working on text-related tasks? If you are, then this book is for you. Author Jeffrey Friedl, has done an outstanding job of writing a cool book that will interest anyone who has an opportunity to use regular expressions.
<...

Programming Python
by Mark Lutz
Amazon Price: $37.79
Customer Review: Very comprehensive. In fact it is too comprehensive that will take 3~4 month to finish reading this book. Beginners are not adviseble to buy this book yet if your understanding of Python is not firm yet.

Python in a Nutshell (In a Nutshell (O'Reilly))
by Alex Martelli
Amazon Price: $26.39
Customer Review: Python in a Nutshell is a excellent reference book, all python programmer must have one in the desk.
The online documentation for the python language is good, but some times is difficult to search for a feature of the language, in this book is ...