C****t 发帖数: 53 | 1 def revSum(a):
d = height(a)
level, sum = 1, [0]
helper(a, d, level, sum)
return sum[0]
def height(a):
d = 1
for ele in a:
if type(ele) == list:
d = max(d, 1+height(ele))
return d
def helper(a, d, level, sum):
for i in range(len(a)):
if type(a[i]) != list:
sum[0] += a[i]*(d-level+1)
else:
helper(a[i], d, level+1, sum) |
|
t********5 发帖数: 522 | 2 nvm 有bug 把generator改成while loop就好了
要in place的话就只有用最傻瓜的一个index一个index的看了
import re
def reverse(string):
words = map(lambda x: x[::-1], re.split('\W+', string))
symbol = re.split('\w+', string)[1:-1]
combinedResult = list(generateNewString(iter(words), iter(symbol)))
return ''.join(combinedResult)
def generateNewString(words, symbol):
while True:
yield words.next()
yield symbol.next()
print reverse('abc, def') |
|
e****x 发帖数: 148 | 3 就是backtracking,然后用一个list来记录剩余硬币的数量
不过我没想到如何在过程中去重,直接用set了,OJ妥妥会超时……
def centsChange(cents):
# pennies, nickles, dimes, quarters
quantity = [7,5,4,2]
value = [1,5,10,25]
path = [0,0,0,0]
result = []
dfs(cents, cents, path, result, quantity, value)
return list(set(result))
def dfs(remaining, cents, path, result, quantity, value):
if remaining < 0: return
if centsSum(path, value) == cents:
result.append(tuple(path))
for i,v in ... 阅读全帖 |
|
c******a 发帖数: 14 | 4 多谢@BabyKnight内推,让我有了这次电面机会。
两道题:
1. 给一个string list, 例如:['a', 'b', 'b', 'c', 'c', 'e', 'e', 'e'],返回出
次次数是中位数的字符。例如本题,应该返回[b, c]。
主要就是两次hash,第一次算每个char的count, 第二次把count作key, char作value即
可。不过有点浪费空间。
2. def crawling()
pass
def getcrawlingurl():
a = []
for x in (1, 100):
a.append('google.com'+str(x))
return a
listsOfURL = getcrwalingurl()
def crawlingMax5(listsOfURL)
问题是如何在crawlingMax5()中调用crawling(),使得一次最多抓取5次url。
我没太明白第2题的题意,开始我以为是多线程问题,后... 阅读全帖 |
|
r*****n 发帖数: 35 | 5 Scala code, not tested
object Parenthesis {
def main(args: Array[String]) {
val ret = constructTree("1+3*5")
println("start")
ret.foreach(println)
}
def wrap(c: Char): (Int, Int)=>Int = {
c match {
case '+' => (x, y) => x + y
case '-' => (x, y) => x - y
case '*' => (x, y) => x * y
}
}
def constructTree(input: String): Array[Int] = {
var split = false
var ret = (0 until input.length).flatMap{ idx =>
input(idx) match {
case '+' ... 阅读全帖 |
|
b*********n 发帖数: 1258 | 6 写了200多行,2个小时,这电面肯定要跪
大牛有什么好的算法吗?
题目就是flatten json to a list of map, 有一段json,比如说如下:
{
"uuid": "abc",
"properties": {
"sessionName": "Test session name",
"waypoints": [
{"uuid": "def", "properties": {"latitude": 3}}
]
}
}
把它转化成List |
|
f*******5 发帖数: 52 | 7 如果用python的话stack里不用放当前下标。当栈顶是数组的话就弹出数组, 然后逆序
入栈。以下是python代码,假定只有list 和 basic type 两种类型
class ListIter(object):
def __init__(self, lst):
self.stack = [lst]
def next(self):
if len(self.stack) == 0:
raise StopIteration
while isinstance(self.stack[-1],list):
l = self.stack.pop()
self.stack.extend([i for i in reversed(l) if not isinstance(i,
list) or len(i)>0])
if len(self.stack) == 0:
raise StopIteration
... 阅读全帖 |
|
v********a 发帖数: 155 | 8 不需要用stack,两个指针足够。
class Iterator:
def __init__(self, arr):
self.arr = arr
self.major = 0
self.minor = -1
def next(self):
if type(self.arr[self.major]) != list:
val = self.arr[self.major]
self.major += 1
self.minor = -1
return val
else:
self.minor += 1
if self.minor >= len(self.arr[self.major]):
self.major += 1
self.minor = -1
... 阅读全帖 |
|
a*******g 发帖数: 1221 | 9 为啥都要用topology sort呢?用topology sort解这题就跟用quick sort解一个数组的
最大值似的。这不是sort的问题,因为这里面没有排序,最后的要求是你要么输出“无
解”,要么输出一个最终解,没有排序。我说没有排序的原因是这里面你先算哪个格后
算哪个格没有关系的。直接递归O(MN)就出来了。如果用topo sort的话我想不出来能O(
MN)内能解决的,并且topo sort还得建一个dependency之类的东西,更麻烦。
def __init__(self):
# 这里面存着类似于{'A2':10, 'E3': 20}这种已经算好的值
self.cell2val = {}
self.computing = set()
self.icandoit = true
def compute(self, cell):
if not self.icandoit:
return None
if cell in self.cell2val:
return self.cell2val[cel... 阅读全帖 |
|
z****l 发帖数: 5282 | 10 ☆─────────────────────────────────────☆
phynix (饱乐) 于 (Fri May 13 10:36:03 2011, 美东) 提到:
欢迎给俺发包子 :D
http://slickdeals.net/forums/showthread.php?t=2924895
500 gc or
http://dmn.delta.com/offers/getmore/
If you transfer your points to delta skymiles before May 31, you get a 50%
bonus. So 50K = 75,000 skymiles. I doubt you will get the points before May
31 but they have this promotion every year. You also get 25,000 EQM, which
would earn you silver medallion on Delta. This is by far the best r... 阅读全帖 |
|
b*******r 发帖数: 432 | 11 【 以下文字转载自 Overseas 讨论区,原文如下 】
发信人: caocao (有所思-一个人在路途上), 信区: Overseas
标 题: 各种班机的座位分布情况-空中客车系列
发信站: The unknown SPACE (Sat Oct 9 15:07:47 1999) WWW-POST
A340-300
AB DEFG JK 21为第一排,33为安全出口
A321
ABC DEF 8,22为安全出口
A319
ABC DEF 10为安全出口
A310
AB DEFG JK 10为第一排
A320
ABC DEF |
|
|
L**S 发帖数: 7833 | 13 请教下悲催的文章排名:
我现在做文章的排名list,如果用eigenfactor,差不多ABC三篇paper排名很好看,DEF
很悲催。如果用Impact factor的话,刚好相反,ABC三篇很悲催,DEF排名却很漂亮。
请问这种情况下,可以厚颜无耻的ABC用Eigenfactor排名,DEF用IF排名吗?还是干脆
两种排名方式都放在一起? |
|
t****x 发帖数: 1429 | 14 由于查不到状态,所以没法在 uscis 设置 email alert。 导致每天不停刷屏,非常影
响工作效率。
写了一个python script。 状态变了可以自动发email提醒。有兴趣的可以拿去用。
需要自己改caseId, toaddress. 最好发信的email address 和密码 fromaddress也用
自己的。
现在的设置每 10分钟check一次。
非码工,纯业余爱好,高手莫见笑。
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
import re
import smtplib
import time
from email.mime.text import MIMEText
statusP = re.compile('Your Case Status: ([ws/]*?)')
fromaddress = "t**********[email protected]" ## (Have to be a gmail account.
Suggest to use your own gma... 阅读全帖 |
|
w******e 发帖数: 576 | 15 4:43 Yao Rebound (Off:2 Def:8)
4:10 Yao Rebound (Off:2 Def:9)
3:46 Yao Turnaround Jump Shot: Made (29 PTS) Assist: McGrady (6 AST)
3:17 Yao Rebound (Off:3 Def:9)
1:08 Yao Hook Shot: Made (31 PTS) Assist: Battier (3 AST)
0:29 Francis Driving Layup Shot: Made (9 PTS) |
|
l**p 发帖数: 6080 | 16 03:06 Battier 3pt Shot: Missed
03:05 James Rebound (Off:1 Def:2)
03:04 James Tip Shot: Missed
03:03 James Rebound (Off:2 Def:2)
03:02 James Tip Shot: Missed
03:00 James Rebound (Off:3 Def:2)
02:59 James Tip Shot: Made (7 PTS) |
|
g*****5 发帖数: 737 | 17 You don't get it. Right now Harden uses eyes def, which causes the whole
def issue for the team. That's part of reason Bev is the PG in 5 now.
Lin should not play with Ball hogger and no def SG, which is the point. |
|
g*****5 发帖数: 737 | 18 Nothing can be more agree with you.
I was saying not too much worry just meaning to compare with in Rockets.
It does not mean to play less def.
And the worry is about the whole team def problem Rockets has, not a
personal def.
Then the offense should be the focus for him.
I do not think he was super defender in NY either.
he |
|
f*****x 发帖数: 545 | 19 hoho,my favorite are
1) bidding: lawrence. I learned all good bidding theory from him.
2) def.: Kelsey. killing def and more killing def. teachs me good habit of
counting, counting, and counting.
3) play: Reese, expert play. If I played correctly, that is because I learned
it from reese. If I played wrongly, then it is because I forgot:) |
|
l******o 发帖数: 80 | 20 DeShaun Foster CAR RB topdog 6 1
Tom Brady NWE QB GLENMONT Fire 6 2
Jake Plummer DEN QB Titan 6 3
Philadelphia Eagles PHI Def/ST cyberdragon 6 4
Peter Warrick CIN WR foo 6 5
Carolina Panthers CAR Def/ST carbon60 6 6
Willis McGahee BUF RB Maple 6 7
Alge Crumpler ATL TE spacepower 6 8
Jake Delhomme CAR QB Miami Canes 6 9
Jeremy Shockey NYG TE Demon of Noontide 6 10
Miami Dolphins MIA Def/ST Rick 6 11
Keyshawn Johnson DAL WR Go Go Egirls!!! 6 12
Ashley Lelie DEN WR TX Red Stars 6 13
Dallas Cowboys |
|
f*n 发帖数: 1019 | 21 参加公司league五年,打了三年的酱油,终于否极泰来,继去年以tie breaker取胜后
,今年一路领先,提前一周卫冕成功。趁着放假,借着拜神的滔滔大水,给自己做个得
失总结.
1.Randy Moss
2.Aaron Rodgers
3.DeSean Jackson
4.Pierre Thomas
5.Percy Harvin
6.Matt Forte
7.Brent Celek
8.SF Def.
9.Nate Keading
10.Steve Slaton
11.Dez Bryant
12.SD Def.
13.Kellen Winslow
14.Donald Brown
15.Derrick Mason
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
上面是今年的草稿结果,当时是请饭大喜达人张无忌出面话事的,大牛就是大牛,为这
个赛季奠定了扎实的基础。先来说说这个草稿。
最佳草稿: 龙哥(排名第三的饭大喜QB)。在少打一场半的情况下,得分和阿汤,大白菜
,老猪不分伯仲。很期待老鹰绿湾的外卡之战。
其他提名:Percy Harvin(排名第三的饭大喜WR... 阅读全帖 |
|
g**********y 发帖数: 14569 | 22 Nov 17 4:39am Keiland Williams (Was - RB) Add Waivers ($35) 无忌
Nov 17 4:39am Mario Manningham (NYG - WR) New player notes Add
Waivers ($26) 张三丰 (berniefu)
Nov 17 4:39am Matt Cassel (KC - QB) New player notes Add Waivers (
$15) 无忌
Nov 17 4:39am Zach Miller (Oak - TE) New player notes Add Waivers
($11) 逍遥子(Hearst)
Nov 17 4:39am Anthony Fasano (Mia - TE) New player notes Add
Waivers ($9) 无忌
Nov 17 4:39am New Orleans (NO - DEF) No ... 阅读全帖 |
|
b******u 发帖数: 469 | 23 周一
DFL半决赛,靠上周四万年不爆发的Garcon和神经刀CJ2K奠定了优势,周日虽然有时候有些波折,
但是还是有惊无险战胜小薇。
MFL还是老样子,整个队伍萎靡不振,幸好少有的爆发都赶上时候,因为对手更加萎靡,以第七名成
绩赶上季后赛8强名单。
周二
闲来无事。晚上是DFL的waiver wire。两周前all in吃下西西,手中无米,只好精神上参与了。
话说西西真是无用,高价买来,就被dixon强去位置,沦为鸡肋。这周主力RB门灯号遭遇NYJ,正是
其出手之时,却碰到@SD,想来还是首发号兄吧。
说到号兄,这赛季看他比赛真是痛苦。你看其他RB,AFoster,AP,甚至Hillis随便都能跑出空
来,就港人的破OL,本来就不行,还老受伤,让我们号兄情何以堪嘛。不说了,明早起来抢WW
周三
早上一起来已经是十二点了,如果有勤奋的同僚,比如之前凌晨四点起床督战的老何,这周就又废
了。还是MFL好,9点才能抢WW。
打开网页,发现是半决赛的对手,杨逍的个人秀。一下居然连抢了两个DEF,根本不叫人活么。之前
老何也是,经常选了人又退掉,把所有人放到ww上,不给其他owner活路嘛这不是。... 阅读全帖 |
|
h***o 发帖数: 2321 | 24 Pats问题不多,就三个:
Def
Def
Def |
|
b*****u 发帖数: 1978 | 25 昨天出门度假,特意带着 Windows 电脑,就为了DFL的选秀,
结果还是瞎子点灯白费蜡,无论如何进不了选秀现场。
后来,看完 Yahoo 替我机选的结果,简直是令人发指、惨绝人寰:
QB:
Andy Dalton
Jay Cutler
RB:
Isaac Redman
DeAngelo Williams
Doug Martin
WR:
Steve Smith
Jeremy Maclin
Marques Colston
Kenny Brit
Dwayne Bowe
TE:
Antonio Gates
Jason Witten
K:
John Kasay
DEF:
Houston
Philadelphia
* 10 个队的league,队数少,谁都知道 draft 要拼主力明星、特别是超级明星,
因为二、三流角色在FA里面多得是,根本不用担心板凳深度。一般策略,应把$200
资本花光,抓进11、12个球员就行了,剩下3、4个位子从FA里面找。倒好,Yahoo
给我挑了完整15人,还剩下 $30不花,过期作废!
* 考虑全体球员的总排名,既然是10 个队,按最低标准,每个队应该能有 1 ... 阅读全帖 |
|
G**Y 发帖数: 33224 | 26 有希望,Jets的pass def据说还行,但是run def不行。但是问题是Lynch在我对家。
最好是靠DEF多TD几个。哈哈 |
|
G**Y 发帖数: 33224 | 27 QB---是不用指望了。虽然Elite Joe还在上面。他的fantasy面值并不高。
WR---Jennings和Garcon在上面。Jennings有笨狗挡着,争取把Garcon拿到(Garcon打
Cowboys,不能给对家呀)。准备drop Cardinals的DEF,Cardinals的DEF还是不错的,
只能指望Seahawks不犯大错了。其实上周有充分的时间抢这两个,但是当时激战的没有
心思。
K---Tucker! 不会再狗血吧?不会吧?
RB---没啥意思
DEF---这个也别折腾了,我准备上49er了。
胜败在此一举了! |
|
s*******u 发帖数: 1855 | 28 前十二轮:平局每场大约2个pass td吧.战绩11-1.其实应该12-0,如果不是被黑.tate,
Baldwin都打的很impressive,不能说多牛吧,也很够用.至少不让人miss rice. even
kearse, miller, luke wilson, all have shining moments. Looks that wilson can
make every wr look better.
(suddenly, my g pinyin chrome app crashed. have to use english)
past 5 games, < 0.5 td per game. passing simply sucks. below average.
why? A few candidate answers:
1) injury. rice out completely. kearse out. but not very strong argument.
two main guys, tate and baldwin, still there. but bo... 阅读全帖 |
|
b*****u 发帖数: 1978 | 29 宣布 keepers 截止时间到了,还有两个队未报,只好由 commish 代选了,
尽量按照 common sense 替他们选择。
- blackshop - 队名 Y's Rad Team (原队名 Going Home)
Cam Newton QB, CAR
(2013==Keeper, 2012==Keeper,
连续两年Keeper,不可再Keep)
Danny Woodhead RB, SDG (2013==RD8)
Mike Tolbert RB, CAR (2013==RD11)
Calvin Johnson WR, DET (2013==RD1)
Brian Hartline WR, MIA (2013==RD6)
A.J. Green WR, CIN (2013==Keeper==RD1,2012==RD2)
Coby Fleener TE, IND (2013==RD9)
Graham Gano K, CAR (2013==UDFA==RD8)
New England DEF, NWE (2013==RD7)
Darren McF... 阅读全帖 |
|
s*******u 发帖数: 1855 | 30 还有雅图本地球迷媒体,一般觉得et3是防守第一大将,整个体系没有谁不能没有他.队伍
内部,def队长是kam.但是sherman就可以搞得全国媒体球迷一提起雅图def,立马想到
sherman.论广告,def球员他好像仅次于jjw.这就是水平啊! |
|
s*******u 发帖数: 1855 | 31 我图盗版oh no系列之没有第三了
---------
膜拜大神白教授,献丑一把,oh no一下我好鸟。
白教授都oh no到系列之十八,我这个系列不起来,赛季最后一次oh no了。
本来上周小鸟就要被狮子吃掉,没有第二的,谁知道前版主三哥最后关头开了金手指,改
机票飞回翡翠城,显身(献身)世纪莲,轻拍了巴西蝴蝶的翅膀, 导致狗代尔连打喷嚏, 折
翼海鹰勉强苟延残喘一把.
这周吗就没有这种黑天鹅了.三哥众筹不成,三嫂一怒之下宣布破产,freeze了三哥的信
用卡.买不了去恶狼屯的机票,我小小鸟唯有束手待擒,被又黑又凶山中大鸟死里蹂躏的
命运,已经是hector输给achilles一样,纵然神仙也干预不得.
------ history ------
我图playoff客场赌场underdog, 结果0:8, 无一幸免. 客场也就欺负一下乳剂菜鸟,遇
上上狗,10死无生,何况面对mvp?
我图最近4年,两次playoff做客nfcs打divisional round, 两个上半场比分? 0:28, 0:
31,加起来0:59.这是什么样的大坑?
mvp同学虽然号称软,但是打playoff... 阅读全帖 |
|
O****e 发帖数: 3290 | 32 Don't know. Seems not. 不过因为资金雄厚,拍片用的摄像机都非常高端,比如可以
从很远的距离拍下高分辨的镜头,Here is a list of the cameras they use:
1. Phantom HD Gold Camera, $70,000
It can shoot more than 1,000 high-def frames per second.
2. Cineflex V14 HD Camera, $500,000
Developed by the defense industry for spying. Can shoot high-def from far
distance and is rock-solid stable. And, can be remotely controled.
3. Red one HD Camera, $35,000
Shoots 30 fps at 4,500 pixels, nearly four times the resolution of
standard high-def ca... 阅读全帖 |
|
D******o 发帖数: 1222 | 33 Federer won 74 sets 6-0 in his career and just 4 sets with such a score.
Nadal bagelled his opponents 56 times and lost 12 sets to love, three of
them against the Swiss. In 2011, the main “bagel baker” is Novak Djokovic,
with a 13-1 record, followed by Murray and Tipsarevic. This year, a 6-0
recurred 292 times out of 8156 sets played (3.6%).
6-0 is the worst possible score for a tennis players. It’s quite a rare
outcome: in 2011 out of the 8156 sets played in men’s singles matches (ATP
World Tou... 阅读全帖 |
|
h*d 发帖数: 19309 | 34 发信人: yibabilun (Sigilish), 信区: TVGame
标 题: ff13召唤兽卡关救急攻略
发信站: 水木社区 (Thu Dec 24 23:59:48 2009), 站内
首先是重要的加速秘籍,切换职业时每两次有一次可以直接满行动条直接行动。好
好利用。
shiva:没有难度,一直防御就可以了.
odin:其实互相加血乌龟一点更容易过.
Brynhild:这个的关键在于一开始就用loli的jam的劣化制造出属性弱点,然后两个
bla
咂一砸加加血就过了。不用jam基本必然时间不够。
Bahamut:这个其实就是def+bla+hlr然后一路自动。
Alexander:这个其实不是太难,先enh+hlr+def加全员护盾,然后在hlr+def和猛砸
之间
切换。可以利用2tp的全员回血复活机能来降低治疗的次数。
黑卡蒂:唔。。这角色被夏娜萌化太过以至于这里这个版本能难接受啊。这个家伙
正常
打法不管你如何nb都是要挂的。让云芳花12000cp学一个火魔法,然后两个bla
就有足够
的时间加血了。否则基本无法在时间限定之内保证不死和完成条件 |
|
j******n 发帖数: 21641 | 35 来自主题: LeisureTime版 - 梁公启超 记得我们学元数学的时候考试题是用逻辑证明:1+1=2
简单证明如下,不过罗素写了300页
The proof starts from the Peano Postulates, which define the natural
numbers N. N is the smallest set satisfying these postulates:
P1. 1 is in N.
P2. If x is in N, then its "successor" x' is in N.
P3. There is no x such that x' = 1.
P4. If x isn't 1, then there is a y in N such that y' = x.
P5. If S is a subset of N, 1 is in S, and the implication
(x in S => x' in S) holds, then S = N.
Then you have to define addition recursively:
Def: Let a and b be ... 阅读全帖 |
|
I*********t 发帖数: 5258 | 36 其实你可以“证明”1+1=2的
http://mathforum.org/library/drmath/view/51551.html
The proof starts from the Peano Postulates, which define the natural numbers
N. N is the smallest set satisfying these postulates:
P1. 1 is in N.
P2. If x is in N, then its "successor" x' is in N.
P3. There is no x such that x' = 1.
P4. If x isn't 1, then there is a y in N such that y' = x.
P5. If S is a subset of N, 1 is in S, and the implication
(x in S => x' in S) holds, then S = N.
Then you have to defi... 阅读全帖 |
|
m*****d 发帖数: 13718 | 37 百度来的
“A=180-B-C
B=180-A-C
C=180-A-B
因为DEF是正三角形
所以
DEF=EFD=FDE=60
所以
ADE+BDF=120
AED+CEF=120
BFD+CFE=120
设角ADE是X度
BDF=120-X
设角EFC是Y度
DFB=120-60-Y
所以
角B=180-(120-X)-(120-Y)
设FEC是Z度
所以
C=180-Y-Z
AED=180-DEF-Z
AED=120-Z
A=180-B-C
代入上面B C
A=180-(180-(120-X)-(120-Y))-(180-Y-Z)
A=180-(180-120+x-120+y)-180+y+z
A=180-180+120-x+120-y-180+y+z
A=180-180+120+120-180-x-y+x+y
A=60
下来继续
A+X+AED=180
代入一下上面证明的
60+X+120-Z=180
X-Z=0
这样X=Z 有问题么?
下面还用我继续推下去吗?” |
|
q*****g 发帖数: 1568 | 38 刚刚在网上找到的,大家欣赏一下怎样用一个 page description language
来编程。
请将下面小程序copy paste下来,存成文件:fern.ps,然后打印出来,或者
用一个能看ps文档的工具来看(finder里头双击即可):
%!PS-Adobe-1.0
%%Title:Random Fern
%%Creator:Eric Wicklund
% Last modified: MLO 02 Jan 1993 11:24:14
% Changed: 'save' and 'restore' statements (incorrect grammar);
% length added, and set to 0.001 (0 does not work with Post 1.7).
/m1 [ 0.00 0.00 0.00 0.16 0.00 0.00 ] def
/m2 [ 0.85 -0.04 0.04 0.85 0.00 1.60 ] def
/m3 [ 0.20 0.23 -0.26 0.22 0.00 1.60 ] def
/m4 [ -0.15 0.26 |
|
H*********e 发帖数: 276 | 39 在任何一个database 下, 用这个code 找, 我以前工作里面一个大牛给我的
select
pt.[name] as [ParentTable],
pc.[name] as [ParentColumn],
ct.[name] as [ChildTable],
cc.[name] as [ChildColumn]
from sys.foreign_key_columns fk
JOIN sys.columns pc on pc.column_id = fk.parent_column_id and pc.object_id =
fk.parent_object_id
JOIN sys.columns cc on cc.column_id = fk.referenced_column_id and cc.object
_id = fk.referenced_object_id
JOIN sys.objects pt on pt.object_id = pc.objec... 阅读全帖 |
|
m******u 发帖数: 12400 | 40 thanks for sharing.
发信人: HoneyCoffee (贝贝), 信区: Database
标 题: Re: 给一堆table,怎样能自动生成ERD
发信站: BBS 未名空间站 (Sun Oct 11 22:24:08 2015, 美东)
在任何一个database 下, 用这个code 找, 我以前工作里面一个大牛给我的
select
pt.[name] as [ParentTable],
pc.[name] as [ParentColumn],
ct.[name] as [ChildTable],
cc.[name] as [ChildColumn]
from sys.foreign_key_columns fk
JOIN sys.columns pc on pc.column_id = fk.parent_column_id and pc.object_id =
fk.parent_object_id
JOIN sys.columns cc on... 阅读全帖 |
|
|
w****w 发帖数: 521 | 42 It's working!
Just replace:
def get_info(videoId2):
return json.loads(get_html('http://v.youku.com/player/getPlayList/VideoIDS/'+videoId2))
with:
def get_html_use_proxy(url):
proxy = urllib2.ProxyHandler({"http":"proxy.uku.im"})
opener = urllib2.build_opener(proxy)
response = opener.open(url)
data = response.read()
if response.info().get('Content-Encoding') == 'gzip':
data = ungzip(data)
elif response.info().get('Content-Encoding') == 'deflate':
data =... 阅读全帖 |
|
b*g 发帖数: 644 | 43 7. Comparing two objects ( == instead of .equals)
When we use the == operator, we are actually comparing two object
references, to see if they point to the same object. We cannot compare,
for example, two strings for equality, using the == operator. We must
instead use the .equals method, which is a method inherited by all
classes from java.lang.Object.
Here's the correct way to compare two strings.
String abc = "abc"; String def = "def";
// Bad way
if ( (abc + def) == "abcdef" )
{
......
} |
|
N*D 发帖数: 3641 | 44 这个也可以
def main(args:Array[String]) = println("hello")
and these both compile fine:
def main(args:Array[String]) {
println("hello")
}
def main(args:Array[String]) = {
println("hello")
} |
|