2015-08-17 veryyoung
前几天做一个需求用到了sql in 子查询, 大概sql如下 SELECT * FROM table_a WHERE id IN (SELECT id FROM table_id_list) 执行时间150m,完全没法忍受 单独执行 SELECT id FROM table_id_list 秒查,只有七八行结果。 把查询结果写死在sql中 SELECT * FROM table_a WHERE id IN (1,2,3,4,5) 依然秒查 解决方案 再把ID列表select一次 SELECT * FROM table_a WHERE id IN (SELECT id from(SELECT id FROM table 继续阅读 »
2016-06-06 craneyuan
Question Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the linked list becomes 1->2->3->5. Note: Given n will always be valid. Try to do this in one pass. 解说 这道题的意思是,如何反向删 继续阅读 »
2017-01-15 Lu Huang
This page is going to tell how to install tensorflow on ubuntu 16.04 from the github sources. I sugget you to use conda or miniconda as your python, then you can skip section 6: Create the pip package and install. 继续阅读 »
2015-12-25 Golmic
在Scrapy框架下 more 蚂蜂窝 ```Python coding=utf-8 import json from urlparse import urljoin import re import logging import scrapy from scrapy.http import Request from scrapy.selector import Selector from andaman.utils.html import html2text, parse_time from andaman.items.qa import QAItem from andaman.items.jieban import Ji 继续阅读 »
2014-03-14 Kun Ren
Oftentimes, we obtain a long or a wide table from a certain data source, and it may be the only format we can get. For example, some financial databases provide daily tick data for all stocks in a financial market. The data table may be arranged in a long format like this: 继续阅读 »
2014-02-20 Kun Ren
People love dealing with well-structured data. It costs much less efforts than working with disorganized raw texts. In economic and financial research, we typically download data from open-access websites or authentication-required databases. These sources may provide data in multiple formats. For example, almost all 继续阅读 »
2016-04-16 jude
声明 文中的 promisify 函数原型出自 月影 的这篇博客。 了解Promise 继续阅读 »
2014-07-25 刘太华
项目用fabric做代码更新, 大体流程是利用fabric的接口, 登录到指定服务器上, 干一些事情. 而实际fabric在执行这个过程的时候, 使用的是ssh协议. 奇怪的问题是, 当在批量操作一些更新的时候, 批量是指可能对单个服务器目标同时有多个fabric的ssh连接操作, 此时会报错ssh_exchange_identification, 已经在一次更新中导致个别项目漏了更新. 仔细google, 已经看到第2页了, 找到的说法几乎都是把 sshd:ALL加入 /etc/hosts.allow中, 但是明显不是我这个问题的答案. 继续阅读 »
2013-12-19 Robin Wen
文/温国兵 如果我们习惯试错,将会收获更多。 最近一位好友问了我一个问题,就是MySQL的Delete语句删除会报ERROR1093 (HY000)错误。SQL语句如下:DELETE FROM test WHEREid=(SELECT max(id) FROM test); 我看了下这个SQL,语法上面没有什么问题啊,这不是标准SQL吗。于是我在Linux环境下测试了MySQL5.1版本和MySQL 5.5版本,均有这样的问题。后来我又到Oracle 11G R2环境下模拟了相同的问题,却可以正确地删除。后来才知道,使用MySQL进行DELETE FROM操作时,若子查询的 FROM 字句和更新或者删除对象使用同一张表,会出现错 继续阅读 »
2016-07-30 kk
Flask应用中通常会用工厂模式 来创建应用对象,这样方便配置和测试。 应用代码 ```python app/init.py from flask import Flask from flask_xxxext import Xxx from flask_yyyext import Yyy ... 一些flask拓展 xx = Xxx() yy = Yyy() 继续阅读 »