Posted by & filed under Webdev.

Edit ~/.ssh/confing or /etc/ssh/ssh_config

Host           friendly-name
HostName       long.and.cumbersome.server.name
IdentityFile   ~/.ssh/private_ssh_file
User           username-on-remote-machine

Now you can connect using the friendly-name:

ssh friendly-name 

Posted by & filed under Webdev.

phpDeamon is Asynchronous framework in PHP. It has a huge number of features. Designed for highload. Each worker is able to handle thousands of simultaneous connections holding beer can. Main features and possibilites:

  • Powerful servers: HTTP, FastCGI, FlashPolicy, Ident, Socks4/5.
  • Many bundled clients like DNS, MySQL, Postgresql, Memcache, MongoDB, Redis, HTTP, IRC, Jabber, ICMP, Valve games client, etc.
  • Asynchrounous Filesystem I/O (using eio).
  • Many useful built-in applications like CGI.
  • Interactive debug console.
  • Dynamic spawning workers.
  • Chroot & Chdir for workers.
  • Automatic graceful reloading user’s scripts when it’s updated.
  • Graceful worker shutdown (and re-spawn if necessary) by the following limits: memory, query counter, idle time.

Posted by & filed under Webdev.

class Abstract1( object ):
    """Some description that tells you it's abstract,
    often listing the methods you're expected to supply."""
    def aMethod( self ):
        raise NotImplementedError( "Should have implemented this" )

Because Python doesn’t have (and doesn’t need) a formal Interface contract, the Java-style distinction between abstraction and interface doesn’t exist. If someone goes through the effort to define a formal interface, it will also be an abstract class. The only differences would be in the stated intent in the docstring.

Read more »

Posted by & filed under Webdev.

class Singleton(object):
	_instance = None
	def __new__(cls, *args, **kwargs):
		if not cls._instance:
			cls._instance = super(Singleton, cls).__new__(
								cls, *args, **kwargs)
		return cls._instance


if __name__ == '__main__':
	s1=Singleton()
	s2=Singleton()
	if(id(s1)==id(s2)):
		print "Same"
	else:
		print "Different"