Introduction to Electronic Circuits by Prof.S.C.Dutta roy 
http://www.youtube.com/playlist?list=PLC6210462711083C4
http://www.youtube.com/playlist?list=PL2D75EC7EC87B37E0

[ add comment ] ( 4 views )   |  [ 0 trackbacks ]   |  permalink
CSS Hacks: How to keep footers at the bottom of the page, Vertical Centering With Css 
http://matthewjamestaylor.com/blog/keep ... f-the-page
http://blog.themeforest.net/tutorials/v ... -with-css/
http://www.cssplay.co.uk/layouts/background.html
http://css-tricks.com/how-to-resizeable ... und-image/

[ add comment ] ( 4 views )   |  [ 0 trackbacks ]   |  permalink
Jaroslav Dušek - O ČASE, PŮSTU, VODĚ A KAMENECH (Chotěboř, 29.5.2011)  


[ add comment ] ( 5 views )   |  [ 0 trackbacks ]   |  permalink
Plný signál - nebezpečí mobilních telefonů a elektromagnetického záření  


[ add comment ] ( 6 views )   |  [ 0 trackbacks ]   |  permalink
python: map instantiated class objects in dictionary (for stream conversion) 
#!/usr/bin/python

__version__ = "0.7"
__author__ = "nej"
__descr__ = "realtime conversion of Oracle DBID to DBNAME"

import os
import sys
import re
import traceback
import datetime
import socket
import signal
from time import sleep


""" globals """
DBLIST = ( "/opt/oracle/dbid1.txt", "/opt/oracle/dbid2.txt" )
LOGPATH = "/var/log/clc/%s/oracle/"
ERRPATH = "/var/log/clc/%s/oracle/error/"
FIFONAME = "/opt/oracle/syslog.pipe"

classmap = {}
errfd = None

re_host = re.compile(".*(mycz[^ \.]*).*")
re_dbid = re.compile(".*DBID:\[\d+\] .([0-9]*).*")


def _quit(signum, frame):
""" gracefully quit on signal """

for item in classmap:
print "closing %s" %classmap[item].host
classmap[item].fd.close()

err = "* program closes because signal %s sent" %signum
errfd.write("%s\n" % err)
errfd.close()
sys.exit(0)


""" hostbased database information put in class """
class dbHost(object):
def __init__(self, host):
self.dbdict = {}
self.host = host

self.dt = datetime.date.today()
self.logpath = LOGPATH %( self.dt )

if not os.path.exists( "%s" %self.logpath ):
os.makedirs( "%s" %self.logpath )

self.logfilename = "%s-oracle" %host
self.log = self.logpath + self.logfilename
self.fd = open(self.log, "a")

def __repr__(self):
return self.host

def write(self, data):
self.fd.write("%s\n" % data)
self.fd.flush()


def classmap_init(server, dbid, dbname):
""" key: value mapping """
try:
classmap[server]
except KeyError:
classmap.update({server: dbHost(server)})

try:
classmap[server].dbdict[dbid]
except KeyError:
classmap[server].dbdict.update({dbid: dbname})


def io_processor(input):
""" reads input line, parses out hostname and dbid
appends dbid at eol """

ok_flag = True

""" can we extract host? """
try:
host = (re_host.search(input)).groups()[0]

except AttributeError:
""" a line has no servername match """
err = "* a line has no servername match ^%s" %input
errfd.write("%s\n" % err)
ok_flag = False

""" can we extract dbid? """
try:
dbid = (re_dbid.search(input)).groups()[0]

except AttributeError:
""" a line has no dbid match """
err = "* a line has no dbid match ^%s" %input
errfd.write("%s\n" % err)
ok_flag = False

if ok_flag:
try:
classmap[host].write('%s INSTANCENAME:[%s] \'%s\'' %(input[:-1], \
len(classmap[host].dbdict[dbid]), classmap[host].dbdict[dbid]))

except KeyError:
""" no record in class for given servername or dbid """
err = "* no record in class for given servername or dbid ( host: %s, dbid: %s ) ^%s" \
%( host, dbid, input )
errfd.write("%s\n" % err)


def pipe_read():
""" read from standard input and on any external exception
close all fd and exit """

fd = open(FIFONAME, 'r')

while 1:
line = "%s" %( fd.readline() )
if line:
io_processor(line)


def init():
""" this function loads database conversion table DBLIST
and creates class instance for each host
the syntax of the file is as follows:
HOST_NAME;FQDN;DBID;INSTANCE_NAME;DB_NAME;DB_UNIQUE_NAME;COLLECTION_TIMESTAMP
0 1 2 3 4 5 6

we use fields 1,2,3
"""

""" prepare error file / log file """
global errfd
errpath = ERRPATH %( datetime.date.today() )
if not os.path.exists( "%s" %errpath ):
os.makedirs( "%s" %errpath )
errfd = open(errpath + "error.log", "a")
print "error file descriptor: %s" %(errfd)

""" load the data in """
err = "* program restarts, loading conversion tables"
errfd.write("%s\n" % err)

for db_definition in DBLIST:
err = "* reading definition file: %s" % db_definition
errfd.write("%s\n" % err)
for dbdata in open( db_definition, "r" ).readlines():

dbdata = dbdata.split(";")
#dbdata[1] = socket.getfqdn(dbdata[1])
dbdata[1] = dbdata[1].split(".")[0]

try:
err = "* adding dbname: %s ( host: %s, dbid: %s )" \
%( dbdata[3], dbdata[1], dbdata[2] )
errfd.write("%s\n" % err)
classmap_init( dbdata[1], dbdata[2], dbdata[3] )
except:
traceback.print_exc()
pass


if __name__ == "__main__":

signal.signal(signal.SIGTERM, _quit) # kill <program>
signal.signal(signal.SIGINT, _quit) # KeyboardInterrupt

if not os.path.exists(FIFONAME):
os.mkfifo(FIFONAME)

init()
pipe_read()


[ add comment ] ( 8 views )   |  [ 0 trackbacks ]   |  permalink  |  related link
python: print specifici exception catch from except 

try:
...
except Exception, e:
print e



import traceback

try:
...
except Exception, e:
traceback.print_exc()



[ add comment ] ( 5 views )   |  [ 0 trackbacks ]   |  permalink  |  related link
IPython in-depth: high-productivity interactive and parallel python  


[ add comment ] ( 6 views )   |  [ 0 trackbacks ]   |  permalink
Data analysis in Python with pandas 


[ add comment ] ( 7 views )   |  [ 0 trackbacks ]   |  permalink
Introduction to PROLOG  


[ add comment ] ( 6 views )   |  [ 0 trackbacks ]   |  permalink  |  related link
We're undertaking a serious effort aimed at building a thinking machine. 
Here at OpenCog, we're creating an open source Artificial General Intelligence framework, intended to one day express general intelligence at the human level and beyond.


the guy behind this is either genius or a crook.

[ add comment ] ( 6 views )   |  [ 0 trackbacks ]   |  permalink  |  related link

<<First <Back | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | Next> Last>>