自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(34)
  • 收藏
  • 关注

原创 postgresql

以postgres用户 建立book数据库/Library/PostgreSQL/9.3/bin/createdb -U postgres book

2014-01-23 08:57:20 690

转载 mysql 启动命令

/usr/local/mysql/support-files/mysql.server start/usr/local/mysql/support-files/mysql.server stop

2014-01-20 08:48:31 710

原创 django js的国际化步骤

输入test.html对应的url,原来是弹出'Hello'对话框。经国际化后,Hello改为 你好。1、在全局urls.py中加入:js_info_dict = { 'packages': ('books.package', ),}urlpatterns += patterns('',    url(r'^jsi18n/$', 'django.views.i

2014-01-06 15:28:48 2136

原创 XMLHttpRequest status 0

>>> var xhr = new XMLHttpRequest();undefined>>> xhr.open('GET', 'http://192.168.1.102:8000/2.0/10', true);undefined>>> xhr.send()GET http:

2013-11-20 16:06:22 1154

原创 canvas transform setTransform

transform是对当前坐标系进行变换, setTransform是对默认坐标系进行变换

2013-11-19 08:48:52 988

原创 犀牛书一段话的理解-canvas width height

csdn上有一个帖子(http://bbs.csdn.net/topics/360033491),关于canvas HTML width and height 和css width height之间区别的疑问,在犀牛书上的一段话有说明:By default, a is displayed on-screen at the size (in CSS pixels) specified by i

2013-11-18 16:47:59 1018

原创 Django SVG 名字空间

HTML里面SVG可以不使用名字空间,如:This is a red square: width="10"height="10">    rect x="0"y="0"width="10"height="10"fill="red"/>但当在Django模板文件中使用时,最好使用名字空间,如:

2013-11-18 07:23:35 869

原创 Django + application cache 配置备忘

1.如某文件 index.html 连接到 permanote.appcache,即:    manifest="{% static 'book20/manifest/permanote.appcache' %}">在permanote.appcache中即使不出现index.html,也会自动缓存index.html。相反,如果加上index.html,在safa

2013-11-16 21:44:15 953

原创 scp 复制目录命令

scp -r local_folder remote_username@remote_ip:remote_folder

2013-11-16 11:13:47 971

原创 django 上下文

django template的上下文不能自动转化int和string,如:view中    return render(request, 'book20/index.html', {        'passage_list': passage_list,        'chapter': chapter,        'start_chapter': '0',   

2013-11-14 17:09:16 1039

原创 html, width

子元素的width, 如采用百分比,是根据减去父元素的margin,border和padding后剩下的空间进行计算。

2013-11-14 06:33:35 674

原创 jQuery Django 用load post整个表单

{% csrf_token %} {% for field in form %} {% if field.errors %} {{ field.errors }} {% endif %} {{ field.label_tag }} {{ field }} {% endfor %}

2013-11-11 11:31:01 825

原创 jQuery delegate() on()

div class="dynamic">div>>>> $('.dynamic').bind('click', function() { alert(11); return false;});  #通过return false阻止冒泡Object[div.dynamic]>>> $(document).delegate('a'

2013-11-09 21:14:40 662

原创 jQuery Global jQuery event

http://www.manning-sandbox.com/thread.jspa?messageID=143092Triggering an event using $.event.trigger() does not work in jQuery versions 1.9 and above

2013-11-09 19:46:08 734 1

转载 jQuery .width(value)

jQuery 1.10Note that .width("value") sets the content width of the box regardless of the value of the CSS box-sizing property.

2013-11-09 07:22:05 736

原创 jQuery .position() .offset()

.sprite_style {    margin: 12px;    border: 10px solid red;    padding: 4px;    width: 400px;    height: 200px;}SPRITE>>> var elt = $('#sprite')undefined>>>

2013-11-08 21:20:21 821

原创 jQuery .css()

$('p').css('font-variant', 'small-caps'); 对$('p').css('font-variant', 'smallcaps'); 错$('p').css('font-variant', 'smallCaps'); 错 $('p').css('font-variant', 'small-caps')

2013-11-08 17:38:13 685

原创 jQuery .index()方法

.index()方法几种重载方式: Head 1Head 2Head 3Head 41. 不带参数:返回结果集 [即$('h2')] 中第一个元素 在兄弟元素中的位置。>>> $('h2').index()12. 参数为string:将index的参数作为选择器进行计算,产生集合A, 返回结果集 [即$

2013-11-08 15:31:21 864

转载 跨域头

http://huaidan.org/archives/2729.html

2013-11-08 09:00:38 1860

转载 JavaScript execCommand

JavaScript execCommandhttp://www.quirksmode.org/dom/execCommand.html

2013-11-03 11:11:40 623

原创 Django, timezone

当 USE_TZ = True 时,把当地时间(如08年奥运开幕时间)以UTC形式存入数据库的方法:>>> import pytz>>> cn = pytz.timezone('Asia/Taipei')>>> import datetime>>> cntime = datetime.datetime(2008, 8, 8, 20, 8, 8, tzinfo=cn)>>> cn

2013-10-17 16:41:21 861

转载 Django, csrf

I have recently updated a website from Django 1.0 to 1.3. One of the changes introduced wasautomatic protection against CSRF attacks. For the most part, this works great, but I have a problem with c

2013-10-14 18:16:52 706

原创 Django 邮件告警配置

SERVER_EMAILEMAIL_HOSTEMAIL_POSTEMAIL_HOST_USEREMAIL_HOST_PASSWORD

2013-10-13 19:00:46 885

原创 Django LANGUAGE_CODE

Once LocaleMiddleware determines the user’s preference, it makes this preference available asrequest.LANGUAGE_CODE for each HttpRequest.'django.middleware.locale.LocaleMiddleware',{{ LAN

2013-10-12 12:34:54 1304 1

原创 Django 查询字符串

def world(request, offset): return render(request, 'books/world.html', { 'now': timezone.now() + datetime.timedelta(hours=int(offset)), 'query_string': request.GET['q'], })

2013-10-10 10:36:22 2247

原创 Django 时区

def world(request): return render(request, 'books/world.html', { 'now': timezone.now() })浏览器显示本地时间Hello World!It's now Oct. 10, 2013, 9:50 a.m..>>> from django.utils im

2013-10-10 09:54:09 1010

原创 Django get_absolute_url 用法

You don’t even need to provide a success_url forCreateView orUpdateView - they will useget_absolute_url() on the model object if available.

2013-10-08 12:55:25 3888

原创 Django UpdateView, TemplateView简单示例

http://localhost:8000/myapp/author_update/1/点击提交后,窗口显示Thanks!,同时将更新内容存入数据库。当使用自带测试服务器时,再次访问http://localhost:8000/myapp/author_update/1/ 很有可能得不到更新后结果。一、目录结构:mysite/manage.pymyapp/

2013-10-07 21:06:16 4420 1

原创 解决Django+sqlite3 attempt to write a readonly database问题

sqlite3 数据库文件mydb 权限 644mydb所在文件夹django 权限 775selinux模式 Enforcing出现attempt to write a readonly database1、将selinux设为Permissive模式: setenforce 0, 问题依然存在2、chmod 777 django问题依然存在3、chm

2013-10-07 20:34:21 5187

原创 Django CreateView, TemplateView简单示例

点击提交后,窗口显示thanks.一、目录结构:mysite/manage.pymyapp/__init__.pyurls.pymodels.pytests.pyviews.pytemplates/myapp/thanks.htmlcontact.html

2013-10-07 15:55:51 5019

原创 Django FormView, TemplateView简单示例

点击提交后,新窗口显示thanks.一、目录结构:mysite/manage.pymyapp/__init__.pyurls.pyforms.pymodels.pytests.pyviews.pytemplates/myapp/thanks.htmlcontact.htm

2013-10-07 15:05:04 4793

原创 django sqlite

django后端用sqlite时,Entry.objects.get(headline__contains="MY") 不区分大小写Entry.objects.get(headline__startswith="MY")不区分大小写Entry.objects.get(headline__exact="MY")区分大小写Entry.objects.get(headline

2013-09-30 09:26:02 854

原创 django USStateField

>>> obama = Person(... first_name='Barack',... last_name='Obama',... birth_date=datetime.date(1961, 8, 4),... address='White House',... city='D.C.',... state='MO')class Person(models.Mod

2013-09-28 17:45:27 629

原创 django using your own package

in settings.py, comment out     'django.template.loaders.eggs.Loader'

2013-09-28 09:18:59 679

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除