... Random Counter = new Random(Guid.NewGuid().GetHashCode()); ...
參考網站 : 不同的Random物件給予不同的亂數種子
... Random Counter = new Random(Guid.NewGuid().GetHashCode()); ...
... <filter> <filter-name>SetCharacterEncoding</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>SetCharacterEncoding</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> ...
...
var obj = from t in ctx.test_T
orderby Guid.NewGuild()
select t
...
# MySQL Setting datasource.mysql.driverClassName=com.mysql.jdbc.Driver datasource.mysql.dialect=org.hibernate.dialect.MySQLDialect datasource.mysql.demowebdb.url=jdbc:mysql://localhost:3306/demowebdb?useUnicode=true&characterEncoding=UTF-8 datasource.mysql.demowebdb.username=xxxxx datasource.mysql.demowebdb.password=xxxxx ...d. 開啟 WEB-INF\spring\appServlet\servlet-context.xml 檔, 更改
...
<beans:bean class="com.mchange.v2.c3p0.ComboPooledDataSource" id="dataSource">
<beans:property name="driverClass" value="${datasource.sqlite.driverClassName}"/>
<beans:property name="jdbcUrl" value="${datasource.sqlite.demowebdb.url}"/>
<beans:property name="user" value="${datasource.sqlite.demowebdb.username}"/>
<beans:property name="password" value="${datasource.sqlite.demowebdb.password}"/>
</beans:bean>
...
修改成...
<beans:bean class="com.mchange.v2.c3p0.ComboPooledDataSource" id="dataSource">
<beans:property name="driverClass" value="${datasource.mysql.driverClassName}"/>
<beans:property name="jdbcUrl" value="${datasource.mysql.demowebdb.url}"/>
<beans:property name="user" value="${datasource.mysql.demowebdb.username}"/>
<beans:property name="password" value="${datasource.mysql.demowebdb.password}"/>
</beans:bean>
...
>>> import pickle
>>> x = {'name':'allen', 'sex':'boy'}
>>> xs = pickle.dumps(x)
>>> xs
"(dp0\nS'name'\np1\nS'allen'\np2\nsS'sex'\np3\nS'boy'\np4\ns."
>>> xsa = pickle.loads(xs)
>>> xsa
{'name': 'allen', 'sex': 'boy'}
>>> import pickle
>>> x = {'name':'allen', 'sex':'boy'}
>>> f = open('c:/pyreadfile.txt', 'wb')
>>> pickle.dump(x, f)
>>> f.close()
>>> f = open('c:/pyreadfile.txt', 'rb')
>>> a = pickle.load(f)
>>> f.close()
>>> print a
{'name': 'allen', 'sex': 'boy'}
>>> import MySQLdb
>>> db = MySQLdb.connect(host="localhost", user="xxxx", passwd="xxxx", db="xxxx")
>>> cursor = db.cursor()
>>> cursor.execute("select * from system_user")
2L
>>> result = cursor.fetchall()
>>> for record in result :
print record[0]
USERE00000000000000000001
USERE00000000000000000002
>>>