用正則 Python正則表達(dá)式
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import re
str = "aabbcc!!";
searchObj = re.search( r'[,.!?,。!?]{2,}', str);
if searchObj:
print("searchObj.group() : ", searchObj.group());
else:
print("Nothing found!!");
session_handler相關(guān)函數(shù)貼一下,默認(rèn)是存文件的,你存數(shù)據(jù)庫(kù)證明這里有修改
先完成緊急的業(yè)務(wù)需求,之后在重新弄個(gè)int(38)的字段,因?yàn)楸旧磉@個(gè)就該弄成整數(shù)的,再去填充數(shù)值,而沒(méi)必要去弄個(gè)varchar ,或者你直接給varchar添加個(gè)索引
host
是localhost
,那么會(huì)使用UNIX domain socket
方式連接數(shù)據(jù)庫(kù),這也就意味著需要一個(gè)socket文件,如/tmp/mysql.sock
。1樓已經(jīng)回答了
類(lèi)沒(méi)找到,查下你的spring-core版本
性能可能會(huì)有影響,因?yàn)楸緛?lái)是需要直接執(zhí)行點(diǎn)擊事件對(duì)應(yīng)的方法就可以了,你現(xiàn)在是直接觸發(fā)點(diǎn)擊事件,然后間接的執(zhí)行對(duì)應(yīng)的方法。不過(guò)在我看來(lái)影響可能比較小。性能可能直觀上看不出來(lái)。最好的方法是調(diào)用事件對(duì)應(yīng)的方法。而你這個(gè)程序沒(méi)有,那就調(diào)用form的submit方法
$('form').submit()
類(lèi)的方法 可以同時(shí)被多個(gè)線程執(zhí)行,除非對(duì)方法加鎖。
類(lèi)加載時(shí) 方法信息保存在一塊稱(chēng)為方法區(qū)的內(nèi)存中,你可以把方法信息理解為 一段代碼信息,這個(gè)數(shù)據(jù)是不變的,多個(gè)線程都能讀取執(zhí)行。
你的MySQL是什么版本,自己編譯的嗎?
對(duì)這個(gè)參數(shù)有點(diǎn)印象,MySQL官方說(shuō)明中對(duì)其有介紹,默認(rèn)設(shè)置為NULL,據(jù)說(shuō)會(huì)禁止數(shù)據(jù)導(dǎo)入導(dǎo)出;也有設(shè)置成DINSTALL_SECURE_FILE_PRIVDIR=/usr/local/mysql/mysql-files
這樣的非NULL,包括空值,不過(guò)空值會(huì)有問(wèn)題:
A non-NULL value is considered insecure if it is empty, or the value is the data directory or a subdirectory of it, or a directory that is accessible by all users. If secure_file_priv is set to a nonexistent path, the server writes an error message to the error log and exits.
大體這意思是說(shuō),最好指向一個(gè)真實(shí)存在的目錄,且系統(tǒng)用戶均可訪問(wèn)。我記得說(shuō)明手冊(cè)上寫(xiě)的范例是在/usr/local/mysql這個(gè)目錄下新建。
fpm 配置max_requests 每個(gè)fpm 處理請(qǐng)求數(shù)超過(guò)這個(gè)數(shù)就會(huì)重啟。應(yīng)該是你們業(yè)務(wù)在那個(gè)時(shí)間段正好使得fpm請(qǐng)求數(shù)操作了閾值,造成fpm 進(jìn)程同時(shí)重啟,可以處理請(qǐng)求的fmp數(shù)目只有少數(shù),造成502??梢詤⒖?a rel="nofollow noreferrer">http://www.yunweipai.com/arch...
是可以的,但是感覺(jué)name-time-list:date這個(gè)有些多余,可以考慮使用 data 就使用 集合,可以將時(shí)間戳放到第一位
用 Column 對(duì)象 的 in_
方法。filter
需要傳遞的參數(shù)為表達(dá)式,此處剛好。filter_by
需要傳遞關(guān)鍵字參數(shù),所以此處in_
沒(méi)法使用。
in_
在OOP和非OOP兩種模式中的使用-demo:
# 通用
from sqlalchemy import (
create_engine,
Column,
Integer,
String
)
# oop方式所需
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
# 非oop方式所需
from sqlalchemy import (
Table,
MetaData,
)
from sqlalchemy.sql import func
Base = declarative_base()
class Table1(Base):
__tablename__ = 'table1'
id = Column(Integer, primary_key=True, autoincrement=True)
name = Column(String(55))
def __init__(self, name):
super(Table1, self).__init__()
self.id = None
self.name = name
def __repr__(self):
return '<Table1 {0}>'.format(self.id if not self.id is None else '')
uri = 'sqlite:///:memory:'
engine = create_engine(uri)
Base.metadata.create_all(engine)
Session = sessionmaker(bind=engine, autocommit=False)
############# 添加對(duì)象, 填充測(cè)試數(shù)據(jù)
session = Session()
for name in 'zhang,wang,li,gong,chen,zhao'.split(','):
obj = Table1(name)
session.add(obj)
session.commit()
lst_filter = ['wang', 'li', 'zhao']
############# OOP方式查詢
# 查詢總數(shù)
Q = session.query(Table1)
print(Q.count())
# 篩選
Q = Q.filter(Table1.name.in_(lst_filter))
result = Q.all()
print(result)
session.close()
############# 非OOP方式查詢
metadata = MetaData(bind=engine)
table = Table('table1', metadata, autoload=True)
# 查詢總數(shù)
stmt = func.count(table).select()
print(stmt.execute().fetchone())
# 篩選
stmt = table.select().where(table.c.name.in_(lst_filter))
rp = stmt.execute()
result = rp.fetchall()
# print(result)
print(len(result))
engine.dispose()
執(zhí)行結(jié)果:
6
[<Table1 2>, <Table1 3>, <Table1 6>]
(6,)
3
參考:
Implement the in operator.
In a column context, produces the clause a IN other. “other” may be a tuple/list of column expressions, or a select() construct.
apply the given filtering criterion to a copy of this Query, using SQL expressions.
apply the given filtering criterion to a copy of this Query, using keyword expressions.
INSERT INTO members_setmeal(uid, setmealid)
SELECT t.uid, 1
FROM
(SELECT m.uid
FROM members m
WHERE NOT EXISTS(SELECT 1 FROM members_setmeal ms WHERE ms.uid = m.uid)) t;
重裝吧 (= =|
大眼一掃,目測(cè)你把參數(shù)拼寫(xiě)錯(cuò)誤了
可以先擴(kuò)展一下『第二個(gè)想法』,Product存tags字段,自然Tag也能存products字段存放這個(gè)標(biāo)簽有哪些product,你要?jiǎng)h某個(gè)tag,把這個(gè)tag的products拿出來(lái)遍歷一部分即可,也就是這份『關(guān)系』同時(shí)在Product和Tag冗余一份。但是這樣做要不了多久products字段非常大,實(shí)操下來(lái)肯定很慢。
那么結(jié)合『第一個(gè)想法』,不要products字段,只要tags字段,再加上做了索引的ProductTag中間表,平時(shí)不用ProductTag,一旦要?jiǎng)htag,從ProductTag表讀,然后一個(gè)個(gè)去處理Product的tags字段。
希望能幫助到你。
commit提交一下。或者改成使用with語(yǔ)句。
從不看教程不看文檔的嗎?
解決nodejs require module時(shí)循環(huán)引用會(huì)導(dǎo)致undefined的問(wèn)題
這個(gè)一般在定義關(guān)聯(lián)的時(shí)候會(huì)用。
目前我的做法是把所有model的關(guān)聯(lián)放到一個(gè)js去做
import { Authorize, AuthorizeAttributes, AuthorizeInstance } from './authorize';
import { Comment, CommentAttributes, CommentInstance } from './comment';
import { Hit, HitAttributes, HitInstance } from './hit';
import { Moneylog, MoneylogAction, MoneylogAttributes, MoneylogInstance } from './moneylog';
import { Order, OrderAttributes, OrderInstance } from './order';
import { Post, PostAttributes, PostContentType, PostInstance } from './post';
import { Poundage, PoundageAttributes, PoundageInstance } from './poundage';
import { User, UserAttributes, UserInstance } from './user';
import { Withdrawal, WithdrawalAttributes, WithdrawalInstance } from './withdrawal';
Comment.belongsTo(Post, { foreignKey: 'post_id', as: 'post' });
Comment.belongsTo(User, { foreignKey: 'user_id', as: 'user' });
Order.belongsTo(User, { foreignKey: 'user_id', as: 'user' });
Order.belongsTo(Post, { foreignKey: 'post_id', as: 'post' });
Post.belongsTo(User, { foreignKey: 'user_id', as: 'user' });
Post.hasMany(Comment, { foreignKey: 'post_id', as: 'commentList' });
User.hasMany(Post, { foreignKey: 'user_id', as: 'posts' });
User.hasMany(Order, { foreignKey: 'user_id', as: 'orders' });
User.hasMany(Comment, { foreignKey: 'user_id', as: 'comment' });
root
設(shè)置密碼了么?
不重復(fù)的選擇的話可以用distinct
select distinct(民族) from `學(xué)生`;
北大青鳥(niǎo)APTECH成立于1999年。依托北京大學(xué)優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國(guó)IT技能型緊缺人才,是大數(shù)據(jù)專(zhuān)業(yè)的國(guó)家
北大青鳥(niǎo)中博軟件學(xué)院創(chuàng)立于2003年,作為華東區(qū)著名互聯(lián)網(wǎng)學(xué)院和江蘇省首批服務(wù)外包人才培訓(xùn)基地,中博成功培育了近30000名軟件工程師走向高薪崗位,合作企業(yè)超4
中公教育集團(tuán)創(chuàng)建于1999年,經(jīng)過(guò)二十年潛心發(fā)展,已由一家北大畢業(yè)生自主創(chuàng)業(yè)的信息技術(shù)與教育服務(wù)機(jī)構(gòu),發(fā)展為教育服務(wù)業(yè)的綜合性企業(yè)集團(tuán),成為集合面授教學(xué)培訓(xùn)、網(wǎng)
達(dá)內(nèi)教育集團(tuán)成立于2002年,是一家由留學(xué)海歸創(chuàng)辦的高端職業(yè)教育培訓(xùn)機(jī)構(gòu),是中國(guó)一站式人才培養(yǎng)平臺(tái)、一站式人才輸送平臺(tái)。2014年4月3日在美國(guó)成功上市,融資1
浪潮集團(tuán)項(xiàng)目經(jīng)理。精通Java與.NET 技術(shù), 熟練的跨平臺(tái)面向?qū)ο箝_(kāi)發(fā)經(jīng)驗(yàn),技術(shù)功底深厚。 授課風(fēng)格 授課風(fēng)格清新自然、條理清晰、主次分明、重點(diǎn)難點(diǎn)突出、引人入勝。
曾工作于聯(lián)想擔(dān)任系統(tǒng)開(kāi)發(fā)工程師,曾在博彥科技股份有限公司擔(dān)任項(xiàng)目經(jīng)理從事移動(dòng)互聯(lián)網(wǎng)管理及研發(fā)工作,曾創(chuàng)辦藍(lán)懿科技有限責(zé)任公司從事總經(jīng)理職務(wù)負(fù)責(zé)iOS教學(xué)及管理工作。
精通HTML5和CSS3;Javascript及主流js庫(kù),具有快速界面開(kāi)發(fā)的能力,對(duì)瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁(yè)制作和網(wǎng)頁(yè)游戲開(kāi)發(fā)。
具有10 年的Java 企業(yè)應(yīng)用開(kāi)發(fā)經(jīng)驗(yàn)。曾經(jīng)歷任德國(guó)Software AG 技術(shù)顧問(wèn),美國(guó)Dachieve 系統(tǒng)架構(gòu)師,美國(guó)AngelEngineers Inc. 系統(tǒng)架構(gòu)師。