V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  dreampuf  ›  全部回复第 37 页 / 共 50 页
回复总数  987
1 ... 33  34  35  36  37  38  39  40  41  42 ... 50  
2012-07-28 18:55:23 +08:00
回复了 zyyzj 创建的主题 程序员 大家觉得最能体现程序员特质的签名是什么?
Hello World!
2012-07-27 11:13:07 +08:00
回复了 jerain 创建的主题 问与答 你对张小龙同志最近的经验分享,有什么所想?
@liuxurong 第二条,是个悖论。类似“我说谎”。

赞同楼主第一条,把自己的一些想法分享出来就是挺难得的。
2012-07-27 11:10:45 +08:00
回复了 wangkangluo1 创建的主题 程序员 来来来 调试重于开发 摆摆大家常用的的调试技巧
1. 单步调试没法复用,不保值
2. 单步调试比设置Log的要求更低,更容易发生在不理解的情况下的修改
3. 非本机错误,很难(带价很高)调试
2012-07-25 18:08:20 +08:00
回复了 laskuma 创建的主题 分享发现 这货会是新一代灰鸽子吗?
@TaoTao
@kojp
赞 邪八 ,比起其他的Hacker站,邪八提供的文章非常硬
2012-07-23 22:30:36 +08:00
回复了 darasion 创建的主题 程序员 会不会 越是提前消灭 bug ,就越是没有绩效?
撸起自己的袖子,露出洁白的双手,勇于去擦别人肮脏的屁股
2012-07-21 11:53:19 +08:00
回复了 levon 创建的主题 Flask 看Flask教程关于Pluggable Views的问题
碰巧在看Flask的实现。实质是将一个Class Instance 转换为一个(或者多个,随Class 的dispatch_request方法的实现而不同)视图。
直接上代码或许比文档更直接。

@classmethod
def as_view(cls, name, *class_args, **class_kwargs):
"""Converts the class into an actual view function that can be
used with the routing system. What it does internally is generating
a function on the fly that will instanciate the :class:`View`
on each request and call the :meth:`dispatch_request` method on it.

The arguments passed to :meth:`as_view` are forwarded to the
constructor of the class.
"""
def view(*args, **kwargs):
self = view.view_class(*class_args, **class_kwargs)
return self.dispatch_request(*args, **kwargs)

if cls.decorators:
view.__name__ = name
view.__module__ = cls.__module__
for decorator in cls.decorators:
view = decorator(view)

# we attach the view class to the view function for two reasons:
# first of all it allows us to easily figure out what class based
# view this thing came from, secondly it's also used for instanciating
# the view class so you can actually replace it with something else
# for testing purposes and debugging.
view.view_class = cls
view.__name__ = name
view.__doc__ = cls.__doc__
view.__module__ = cls.__module__
view.methods = cls.methods
return view


使用举例:

class MethodView(View):
"""Like a regular class based view but that dispatches requests to
particular methods. For instance if you implement a method called
:meth:`get` it means you will response to ``'GET'`` requests and
the :meth:`dispatch_request` implementation will automatically
forward your request to that. Also :attr:`options` is set for you
automatically::

class CounterAPI(MethodView):

def get(self):
return session.get('counter', 0)

def post(self):
session['counter'] = session.get('counter', 0) + 1
return 'OK'

app.add_url_rule('/counter', view_func=CounterAPI.as_view('counter'))
"""
__metaclass__ = MethodViewType

def dispatch_request(self, *args, **kwargs):
meth = getattr(self, request.method.lower(), None)
# if the request method is HEAD and we don't have a handler for it
# retry with GET
if meth is None and request.method == 'HEAD':
meth = getattr(self, 'get', None)
assert meth is not None, 'Unimplemented method %r' % request.method
return meth(*args, **kwargs)
换个环境吧。
2012-07-16 19:04:16 +08:00
回复了 sofish 创建的主题 分享创造 翻译两个JS相关文档:idiomatic.js 和 Express(Node.js)
感谢!
2012-07-14 23:11:07 +08:00
回复了 tioover 创建的主题 Django App到底是什么东西!
一个project下面可以有多个app
app是按照网站业务不同的划分,比如博客,论坛,神马的。

https://docs.djangoproject.com/en/1.4/intro/tutorial01/

Projects vs. apps
What's the difference between a project and an app? An app is a Web application that does something -- e.g., a Weblog system, a database of public records or a simple poll app. A project is a collection of configuration and apps for a particular Web site. A project can contain multiple apps. An app can be in multiple projects.
2012-07-13 10:37:24 +08:00
回复了 colorday 创建的主题 分享发现 560个优雅的矢量应用图标团购,20元/人,7人即可成团
已经卖出去10件了
2012-07-12 18:31:21 +08:00
回复了 colorday 创建的主题 分享发现 560个优雅的矢量应用图标团购,20元/人,7人即可成团
@colorday 算我一个
2012-07-12 18:27:35 +08:00
回复了 soulhacker 创建的主题 分享发现 Pythonista: iPad 上(几乎)全功能的 Python IDE
我不要在任何设备上敲代码,太惨了:(
2012-07-11 14:59:17 +08:00
回复了 kran 创建的主题 问与答 为什么这些平台提供的OAuth接口都不按照标准来??
@forsaken 至少Python的clinet是Copy&paste的Twitter的
2012-07-07 14:15:33 +08:00
回复了 skydark 创建的主题 Python Python 中的 del 语句在什么场景下是不可或缺的?
del 只是将变量的引用计数手动减一,没有执行实际的GC操作。GC还是Python内部调整
2012-07-07 13:16:52 +08:00
回复了 HiVPS 创建的主题 站长 KVM VPS年付优惠:最低价格每月只需16元
@dreampuf 求联系方式,想知道访问速度如何
2012-07-07 13:01:29 +08:00
回复了 HiVPS 创建的主题 站长 KVM VPS年付优惠:最低价格每月只需16元
@HIVPS 操作系统有点少。有没有512测网速的?
2012-07-02 03:54:59 +08:00
回复了 sll822 创建的主题 服务器 关于idc带宽,备案,ip
@subdragon 同求 soddyque [AT] 163.com Thanks
2012-06-30 16:03:12 +08:00
回复了 Tuccuay 创建的主题 Chrome Chrome for iOS:evernote.com - 该网站的安全证书不受信任!
将DNS解析改为 8.8.8.8

在我们公司用chrome登录gmail的时候偶尔也会出现这种情况,貌似是“被链接中断”了。
2012-06-25 00:44:09 +08:00
回复了 cheshirecat 创建的主题 Diablo III DiabloDPS.com:战力评定
评定清空默认
DPS 9437 血量 12344 抗性 432 护甲 5086
综合战力 : 6.06 ~ 级别评定 : 渣 ~ EHP : 76537


伤不起。。
1 ... 33  34  35  36  37  38  39  40  41  42 ... 50  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2475 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 45ms · UTC 15:33 · PVG 23:33 · LAX 08:33 · JFK 11:33
Developed with CodeLauncher
♥ Do have faith in what you're doing.