06 2011 档案

摘要:需要给前端以xml格式提供一些数据,这些数据在目前的数据库中已经存在。如果使用django返回xml数据的话,需要包装下头信息:r = HttpResponse(str_xml)r.mimetype = "text/xml"r['Content-Type'] = "application/xml"另外,使用group by可以使用以下方式来查询。objs = Fish.objects.raw("SELECT id, almanac_name, style , almanac_code,almanac_description FR 阅读全文

posted @ 2011-06-30 11:38 蛇小狼 阅读(322) 评论(0) 推荐(0)

摘要:四、充值充值弹窗<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js"></script><script>FB.init({ appId:'{{ app_id }}', cookie:true, status:true, xfbml:true });</script>function buyit(rmb, pearls){ FB.ui({ method:'pa 阅读全文

posted @ 2011-06-29 15:21 蛇小狼 阅读(2021) 评论(1) 推荐(0)

摘要:一、开发者后台账号设置web site sit url: http://apps.facebook.com/app_name/facebook Integration canvas url: http://your_real_domain/ iframe size: auto_resize bookmark url: you_app_url tab name: you_app_name tab url: your_real_domainadvanced sandbox mode: enable disable时,只有测试号可以登录app Remove Deprecated Auth Metho 阅读全文

posted @ 2011-06-29 15:12 蛇小狼 阅读(1338) 评论(1) 推荐(0)

摘要:#从一列表中,生成不重复的随机值#算法实现import randomtotal = 100li = [i for i in range(total)]res = []num = 20for i in range(num): t = random.randint(i,total-1) res.append(li[t]) li[t], li[i] = li[i], li[t]print res#python 已经实现这样的方法print random.sample(li, num) 阅读全文

posted @ 2011-06-28 14:55 蛇小狼 阅读(692) 评论(0) 推荐(0)

摘要:#单个字符替换s = 'abcd'a = ["a", "b", "c"]b = ["c", "d", "e"]import strings.translate(string.maketrans(''.join(a),''.join(b)))print s#字符串,改善版s = "hello, i'm mouren, hehe~~,hehe~~mourenmouren"a = ["mouren 阅读全文

posted @ 2011-06-28 14:51 蛇小狼 阅读(278) 评论(0) 推荐(0)