Seems like BeautifulSoup may help.
|
Wanted a clean CSS solution for centering DIV HTML content, something to replace DIV align="center" Found somewhere a solution, which looked easy enough: .center {margin-left:auto;margin-right:auto;} Good write-ups: http://css-discuss.incutio.com/wiki/Centering_Block_Element, http://www.w3schools.com/css/css_align.asp ... on vertical alignment - Understanding vertical-align, or "How (Not) To Vertically Center Content" |
Ucoz web hosting provides useful features, such as RSS Reader and Informers so you can easily integrate RSS newsfeeds or aggregated views to your pages. But there is a big gotcha: These things are best integrated with so called ucoz codes, e.g. $RSSIT_xxx$, $MYINF_xxx$ which are supposed to be just copy-pasted to pages. BUT unlike "Page Editor", the "Publisher" module does not process these directives. There is a solution though, - Java Script. Instead of RSS Reader's <script type="text/javascript" src=http://your_site_address/rssi/xxx> </script> Instead of Informer's <script type="text/javascript" src="http://your_site_address/informer/xxx"> </script> With RSS Reader there is another gotcha: If there is a problem with the feed source, your visitors will see the last successful record from there. This could be misleading at times. Addressing this issue is not that simple, but some clues could probably be found here - http://likbezz.ru/publ/ucoz/scripts/correct_the_image_links_rss_for_ucoz/29-1-0-77 (Russian) Given the Ucoz codes are not working in articles, why use the Publisher module at all? Well, it is somewhat better for publishing articles as it has reach catalogging feature, fine grain access control, it is possible to split material into summary and full body, and the most important - it has commeting feature (the basic "Site Pages" does not provide this feature at all). |
Something for Python 2.6, work in progress.
#!/usr/bin/env python """loc2log template v.0.2 Template for a simple command line script, Python 2.6. Usage: <script_name> [-hvd] -v, --verbose Verbose output -d, --debug Debug level -h, --help This usage screen """ import traceback import os import sys import subprocess import getopt import datetime import re is_verbose = False debug_level = 0 def usage(rc): """Show usage from 'About', then exit.""" print globals()['__doc__'] sys.exit(rc) def do(cmd): p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) (std, err) = p.communicate() # rc = p.returncode return std def main(): try: optlist, arglist = getopt.getopt(sys.argv[1:], 'hvd:', ['help','h','verbose', 'debug']) except Exception, e: print >>sys.stderr, "[ERROR] Unexpected input." usage(1) if len(optlist) == 0: print >>sys.stderr, "[ERROR] Missing input parameters." usage(1) for opt, arg in optlist: if opt in ('-h','--help'): print 'Help:' usage(0) elif opt in ('-v', '--verbose'): is_verbose = True elif opt in ('-d', '--debug'): debug_level = int(arg) print "debug_level=" + str(arg) else: print >>sys.stderr, "[ERROR] Unknown input parameter(s)." usage(1) if __name__ == "__main__": try: main() sys.exit(0) except KeyboardInterrupt: print("Keyboard interrupt.") sys.exit(0) except SystemExit: sys.exit(0) except Exception, e: print str(e) traceback.print_exc() sys.exit(1)Note: For Python 2.7 or 3.2, the recommended way for handing command-line parameters is argparse instead of getopt. The latter does not handle optional parameters. Good reads: getopt – Command line option parsing by Doug Hellman |
Problem: Read items pairwise from list with single elements (planar_list)
from itertools import izip planar_list = [1, 2, 3, 4] for item1, item2 rom izip(*[iter( planar_list )]*2): print str(item1) + " " + str(item2)See Pairs from single list - http://stackoverflow.com/questions/4628290/pairs-from-single-list for details. |
Here is how to enable ssh access root on RedHat(ish) systems.
You need to change in /etc/ssh/sshd_config: PermitRootLogin noto PermitRootLogin yesand let sshd know its configuration needs to be re-read.
Here is a quick'n'dirty way to be executed from root account, or with sudo, sed -e "s/PermitRootLogin no/PermitRootLogin yes/" -i /etc/ssh/sshd_config /sbin/service sshd reloadto disable ssh root access: sed -e "s/PermitRootLogin yes/PermitRootLogin no/" -i /etc/ssh/sshd_config /sbin/service sshd reload |
Here are command line calls for MS Windows admin utilities. Use them from Run or cmd: adsiedit.msc - edit Acrive Directory, you can see it "as is", all elements, with all prefixes. gpedit.msc - edit domain policy, remote desktop (terminal) users |