- NodeBox - a nice lib to create images of graph networks
- Python Image Library
- BeautfulSoup - HTML parser
- mechanize - automated web browsing
var flag1= null; | |
var flag2 = null; | |
$().ready(function(){ | |
$("*").hover(function () { | |
if (flag1 != null) { | |
flag1.removeClass("elemHover"); | |
} | |
flag1 = $(this); |
.elemHover { | |
border: #FF0000 solid thin; | |
background-color: #EEEE00; | |
} | |
.elemselected { | |
border: #FF3030 solid; | |
background-color: #90EE90; | |
background: #90EE90; | |
} |
# Add external css file to webkit | |
self.view.settings().setUserStyleSheetUrl(QtCore.QUrl.fromLocalFile("selectElem.css")) | |
# Add Local QObject and expose its slots and properties to JavaScript Context | |
self.view.page().currentFrame().addToJavaScriptWindowObject('htmlTextEdit', self.htmlTextEdit) | |
# Load Local jquery file to webkit | |
jqueryfile = QtCore.QFile("jquery-1.10.2.min.js"); | |
jqueryfile.open(QtCore.QIODevice.ReadOnly | QtCore.QIODevice.Text); | |
jQueryJs = jqueryfile.readAll().data(); |
function XPath(elm) { | |
for (segs = []; elm && elm.nodeType == 1; elm = elm.parentNode) { | |
if (elm.hasAttribute('id')) { | |
segs.unshift('id("' + elm.getAttribute('id') + '")') | |
return segs.join('/') | |
} | |
else if (elm.hasAttribute('class')) | |
segs.unshift(elm.localName.toLowerCase() + '[@class="' + elm.getAttribute('class') + '"]') | |
else { | |
for (i = 1, sib = elm.previousSibling; sib; sib = sib.previousSibling) |
Apple's wireless keyboard built entirely using css3. I could use code for the background, but currently gradients have really ugly banding. Regardless, enjoy! (:
A Pen by Dustin Cartwright on CodePen.
outer_html = $('selector').clone().wrap('<p>').parent().html(); |
# 加入如下代码片段, python2.7 默认为ascii编码,改为utf-8 | |
import sys | |
default_encoding = 'utf-8' | |
if sys.getdefaultencoding() != default_encoding: | |
reload(sys) | |
sys.setdefaultencoding(default_encoding) | |
from jinja2 import Environment, FileSystemLoader | |
import os | |
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) | |
env = Environment(loader=FileSystemLoader(CURRENT_DIR), trim_blocks=True) | |
template = env.get_template("template.xml") | |
# 利用数据(字典数据文件或 key-value对)渲染模板 | |
print template.render(taskData) |
# ! /usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# 在MySQL中建立中文表名及中文字段名 | |
# MySQLdb 默认编码为 latin-1,改为utf-8 | |
import MySQLdb as mdb | |
con = mdb.connect('localhost', 'root', 'root', 'testdb') | |
con.set_character_set('utf8') |