V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
V2EX  ›  watsy0007  ›  全部回复第 8 页 / 共 17 页
回复总数  328
1  2  3  4  5  6  7  8  9  10 ... 17  
2018 年 10 月 19 日
回复了 AllOfMe 创建的主题 PostgreSQL 有人在业务上使用过 PostgreSQL 吗?感觉体验如何?
https://item.jd.com/11684063.html
不能修改, 换一个链接
2018 年 10 月 19 日
回复了 AllOfMe 创建的主题 PostgreSQL 有人在业务上使用过 PostgreSQL 吗?感觉体验如何?
2018 年 10 月 17 日
回复了 kirinzer 创建的主题 程序员 MacBook Pro 外接 27 寸 2k 显示器
上 4k 吧.
2018 年 10 月 16 日
回复了 eeljiang 创建的主题 奇思妙想 有没有多人共用的牙膏或者挤牙膏装置?
私人物品最好不要公用.可以买次洗漱时候自带好了.
2018 年 10 月 15 日
回复了 yo0o0o0 创建的主题 奇思妙想 求个自动倒水的设备
买个 2L 的瓶子, 满足你一天的用水量
2018 年 10 月 15 日
回复了 martifact 创建的主题 北京 [北京] 后端程序员求合租
1. 图片挂了
2. 主卧合租是什么意思? 2 个人一间屋?
不能洗澡的健身房没啥性价比.
2018 年 10 月 9 日
回复了 Ewig 创建的主题 Python mongodb 在 scrapy 如何去重,然后下载管道如何管理
v2ex 不支持 markdown...

https://gist.github.com/watsy0007/779c27fb0ceab283cc434b5eec10b7c4

封装了针对数据处理的公共方法.
2018 年 10 月 9 日
回复了 Ewig 创建的主题 Python mongodb 在 scrapy 如何去重,然后下载管道如何管理
```python

class MongoCache:
db = None

def __init__(self):
if not hasattr(MongoCache, 'pool'):
MongoCache.create_instance()

@staticmethod
def create_instance():
client = MongoClient(config.MONGO_URL)
MongoCache.db = client['spider']

def create(self, table, unique_key, origin_data):
if self.exists(table, unique_key):
return None

summaries = {k: generator_summary(v) for (k, v) in origin_data.items()}

return self.db[table].insert({
'unique_key': unique_key,
'data': origin_data,
'summaries': summaries
})

def get(self, table, unique_key):
data = self.db[table].find_one({'unique_key': unique_key})
if data is None:
return None
return data['data']

def exists(self, table, unique_key):
data = self.db[table].find_one({'unique_key': unique_key})
return data is not None

def is_changed(self, table, unique_key, origin_data):
if not self.exists(table, unique_key):
return True

last_summaries = self.db[table].find_one({'unique_key': unique_key})['summaries']
for (k, v) in origin_data.items():
summary = generator_summary(v)
last_summary = last_summaries.get(k, None)
# print('{} -> {} | {} -> {}'.format(k, v, summary, last_summary))
if last_summary is None or last_summary != summary:
return True
return False

def change_fields(self, table, unique_key, origin_data):
if not self.exists(table, unique_key):
return origin_data
changes = {}
last_summaries = self.db[table].find_one({'unique_key': unique_key})['summaries']
for (k, v) in origin_data.items():
last_summary = last_summaries.get(k, None)
# print('{} -> {} | {} -> {}'.format(k, v, summary, last_summary))
if last_summary is None or last_summary != generator_summary(v):
changes[k] = v
return changes

def update(self, table, unique_key, origin_data):
if not self.exists(table, unique_key):
return origin_data
new_summaries = {k: generator_summary(v) for (k, v) in origin_data.items()}
self.db[table].update_one({'unique_key': unique_key},
{'$set': {'data': origin_data, 'summaries': new_summaries}})
return origin_data
```
2018 年 10 月 9 日
回复了 Giethoorn 创建的主题 职场话题 本周我是这样安排工作的,有木有跟我一样的?
手动帮你 @你们公司领导
2018 年 10 月 9 日
回复了 pandaaa 创建的主题 程序员 现在使用 Python 的公司是用 2 还是 3?
3.7
2018 年 10 月 7 日
回复了 duvalier 创建的主题 生活 话说我一个学医的整天逛 V2EX 是不是太乱入了?
360 行, 行行转 it
2018 年 7 月 23 日
回复了 1800x 创建的主题 旅行 如何运送一台显示器
顺丰和德邦都用过. 完好无损
资瓷.
2018 年 1 月 7 日
回复了 tzungtzu 创建的主题 Steam steam for macos 下, PS4 手柄可以用吗?
1. 游戏是否支持手柄?

2. 在 steam 里面用手柄启动游戏应该可以
我遇到过这种情况,游戏已经打开了,手柄无法连接,游戏关掉从 steam 里面用手柄启动游戏可以玩.
2018 年 1 月 3 日
回复了 RealLiuSha 创建的主题 深圳 自如真垃圾-帮自如 SEO 一下
北京服务挺好.基本都是按照预约时间上门维修更换.
开发够用.
2017 年 8 月 23 日
回复了 chenuu 创建的主题 职场话题 刚毕业的码农,感觉干不下去了
外接屏幕,仰脖子看显示器。
换椅子,必须要有腰撑

有时间多锻炼
2017 年 8 月 23 日
回复了 macroideal 创建的主题 程序员 山寨币是不是该操底了?
@mozutaba 我正好相反。bts 及时止损上了 ans
1  2  3  4  5  6  7  8  9  10 ... 17  
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1294 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 37ms · UTC 23:46 · PVG 07:46 · LAX 16:46 · JFK 19:46
♥ Do have faith in what you're doing.