内容目录:

  • JSONP应用
  • 瀑布流布局
  • 组合搜索
  • 多级评论
  • tornado框架简介

JSONP应用

由于浏览器存在同源策略机制,同源策略阻止从一个源加载的文档或脚本获取或设置另一个源加载的文档的属性。

特别的:由于同源策略是浏览器的限制,所以请求的发送和响应是可以进行,只不过浏览器不接受罢了。

浏览器同源策略并不是对所有的请求均制约:

  • 制约: XmlHttpRequest
  • 不制约(不生效)的标签: img、iframe、script等具有src属性的标签

JSONP(JSONP - JSON with Padding是JSON的一种“使用模式”),利用script标签的src属性(浏览器允许script标签跨域)

几种方式的对比查看,本机访问另一个域名方式采用另一个django项目方式

访问过程中需要绑定hosts 127.0.0.1 jabe.com

django项目jsonp1

  1. from django.conf.urls import url
  2. from django.contrib import admin
  3. from app01 import views
  4.  
  5. urlpatterns = [
  6. url(r'^admin/', admin.site.urls),
  7. url(r'^index/', views.index),
  8. url(r'^get_data/', views.get_data),

url code

  1. from django.shortcuts import render,HttpResponse
  2.  
  3. # Create your views here.
  4.  
  5. def index(request):
  6. return render(request,'index.html')
  7.  
  8. def get_data(request):
  9. return HttpResponse('ok')
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title></title>
  6. </head>
  7. <body>
  8. <h1>Index</h1>
  9.  
  10. <input type="button" onclick="Ajax();" value="普通AJax"/>
  11. <input type="button" onclick="Ajax2();" value="跨域普通AJax"/>
  12. <input type="button" onclick="Ajax3();" value="跨域牛逼AJax"/>
  13. <input type="button" onclick="Ajax4();" value="江西TV"/>
  14.  
  15. <script src="/static/jquery-2.1.4.min.js"></script>
  16. <script>
  17. function Ajax(){
  18. $.ajax({
  19. url: '/get_data/',
  20. type: 'POST',
  21. data: {'k1': 'v1'},
  22. success: function (arg) {
  23. alert(arg);
  24. }
  25. })
  26. }
  27.  
  28. function Ajax2(){
  29. $.ajax({
  30. url: 'http://jabe.com:8001/api/',
  31. type: 'GET',
  32. data: {'k1': 'v1'},
  33. success: function (arg) {
  34. alert(arg);
  35. }
  36. })
  37. }
  38. function Ajax3(){
  39. // script
  40. // alert(api)
  41. var tag = document.createElement('script');
  42. tag.src = 'http://jabe.com:8001/api/';
  43. document.head.appendChild(tag);
  44. document.head.removeChild(tag);
  45. }
  46. function fafafa(arg){
  47. console.log(arg);
  48. }
  49. function Ajax4(){
  50. // script
  51. // alert(api)
  52. var tag = document.createElement('script');
  53. tag.src = 'http://www.jxntv.cn/data/jmd-jxtv2.html?callback=list&_=1454376870403';
  54. document.head.appendChild(tag);
  55. document.head.removeChild(tag);
  56. }
  57. function list(arg){
  58. console.log(arg);
  59. }
  60. </script>
  61. </body>
  62. </html>

index html code

第二个项目jsonp2

  1. from django.conf.urls import url
  2. from django.contrib import admin
  3. from app001 import views
  4. urlpatterns = [
  5. url(r'^admin/', admin.site.urls),
  6. url(r'^api/', views.api),
  7. ]

url code

  1. def api(request):
  2. li = ['jabe', 'ljb', 'tony']
  3. temp = "fafafa(%s)" %(json.dumps(li))
  4. return HttpResponse(temp)

同时可以直接设置ajax发送请求类型设置为JSONP,即dataType:JSONP,

  1. <!DOCTYPE html>
  2. <html>
  3. <head lang="en">
  4. <meta charset="UTF-8">
  5. <title></title>
  6. </head>
  7. <body>
  8.  
  9. <p>
  10. <input type="button" onclick="Jsonp1();" value='提交'/>
  11. </p>
  12.  
  13. <p>
  14. <input type="button" onclick="Jsonp2();" value='提交'/>
  15. </p>
  16.  
  17. <script type="text/javascript" src="jquery-1.12.4.js"></script>
  18. <script>
  19. function Jsonp1(){
  20. var tag = document.createElement('script');
  21. tag.src = "http://c2.com:8000/test/";
  22. document.head.appendChild(tag);
  23. document.head.removeChild(tag);
  24.  
  25. }
  26.  
  27. function Jsonp2(){
  28. $.ajax({
  29. url: "http://c2.com:8000/test/",
  30. type: 'GET',
  31. dataType: 'JSONP',
  32. success: function(data, statusText, xmlHttpRequest){
  33. console.log(data);
  34. }
  35. })
  36. }
  37.  
  38. </script>
  39. </body>
  40. </html>

demo

jsonp的callback和list

  1. dataType: jsonp
  2. jsonp: 'callback',
  3. jsonpCallback: 'list'
  4.  
  5. function list(arg){
  6. console.log(arg);
  7. }
  8.  
  9. - jsonp: callback # request.GET.get("callback")
  10. - jsonpCallback: 'list' # list(...)

jsonp不能发送POST请求

==> 最终全部都会转换成GET请求  

扩展

CORS-跨站资源共享,浏览器版本要求

瀑布流布局

在实际的环境中我们的网页可能会出现并排的布局,但是图片和内容大小不一致,我们希望下面并排挨着上面紧凑布局方式,因此就用到了瀑布流布局。

实例展示

  1. from django.conf.urls import url
  2. from django.contrib import admin
  3. from app01 import views
  4. urlpatterns = [
  5. url(r'^admin/', admin.site.urls),
  6. url(r'^student/', views.student),
  7. ]

url code

  1. from django.shortcuts import render
  2.  
  3. # Create your views here.
  4.  
  5. def student(request):
  6. img_list = [
  7. {
  8. {
  9. {'src': '3.jpg', 'title': 'asdfasdfasdf','content': 'asdf'},
  10. {'src': '4.jpg', 'title': 'asdfasdfasdf','content': 'asdf'},
  11. {
  12. {'src': '21.jpg', 'title': 'asdfasdfasdf','content': 'asdf'},
  13. ]
  14.  
  15. return render(request, 'student.html', {"img_list":img_list})
  1. {% load xx %}
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="UTF-8">
  6. <title></title>
  7. <style>
  8. .container{
  9. width: 980px;
  10. margin: 0 auto;
  11. }
  12. .container .column{
  13. float: left;
  14. width: 245px;
  15. }
  16. .container .item img{
  17. width: 245px;
  18. }
  19. </style>
  20. </head>
  21. <body>
  22.  
  23. <div class="container">
  24. <div class="column">
  25. {% for i in img_list %}
  26. {% if forloop.counter|detail1:"4,1" %}
  27. <div class="item">
  28. {{ forloop.counter }}
  29. <img src="/static/{{ i.src }}">
  30. </div>
  31. {% endif %}
  32. {% endfor %}
  33. </div>
  34. <div class="column">
  35. {% for i in img_list %}
  36. {% if forloop.counter|detail1:"4,2" %}
  37. <div class="item">
  38. {{ forloop.counter }}
  39. <img src="/static/{{ i.src }}">
  40. </div>
  41. {% endif %}
  42. {% endfor %}
  43. </div>
  44. <div class="column">
  45. {% for i in img_list %}
  46. {% if forloop.counter|detail1:"4,3" %}
  47. <div class="item">
  48. {{ forloop.counter }}
  49. <img src="/static/{{ i.src }}">
  50. </div>
  51. {% endif %}
  52. {% endfor %}
  53. </div>
  54. <div class="column">
  55. {% for i in img_list %}
  56. {% if forloop.counter|detail1:"4,0" %}
  57. <div class="item">
  58. {{ forloop.counter }}
  59. <img src="/static/{{ i.src }}">
  60. </div>
  61. {% endif %}
  62. {% endfor %}
  63. </div>
  64. </div>
  65.  
  66. </body>
  67. </html>

student html code

  1. # Author:Alex Li
  2. from django import template
  3. from django.utils.safestring import mark_safe
  4. from django.template.base import resolve_variable, Node, TemplateSyntaxError
  5.  
  6. register = template.Library()
  7.  
  8. @register.filter
  9. def detail1(value,arg):
  10.  
  11. """
  12. 查看余数是否等于remainder arg="1,2"
  13. :param counter:
  14. :param allcount:
  15. :param remainder:
  16. :return:
  17. """
  18. allcount, remainder = arg.split(',')
  19. allcount = int(allcount)
  20. remainder = int(remainder)
  21. if value%allcount == remainder:
  22. return True
  23. return False

templatetags xx.py

组合搜索

在很多的电商网站类似京东和淘宝都有多级组合的筛选条件来找到自己想要的商品,我们来做一下这个组合搜索的功能

  1. from django.conf.urls import url
  2. from django.contrib import admin
  3. from app01 import views
  4. urlpatterns = [
  5. url(r'^admin/', admin.site.urls),
  6. # url(r'^student/', views.student),
  7. url(r'^video-(?P<direction_id>\d+)-(?P<classfication_id>\d+)-(?P<level_id>\d+).html', views.video),
  8. ]

Url Code

  1. from django.shortcuts import render
  2. from app01 import models
  3. # Create your views here.
  4.  
  5. def video(request,**kwargs):
  6. print(kwargs)
  7. print(request.path_info)
  8. current_url = request.path_info
  9. direction_id = kwargs.get(')
  10. classfication_id = kwargs.get(')
  11. q = {}
  12. # 方向是0
  13. ':
  14. cList = models.Classification.objects.values('id', 'name')
  15. # 分类是0
  16. ':
  17. # video-0-0
  18. pass
  19. else:
  20. # video-0-1
  21. # 选中了某个分类
  22. q['classification__id'] = classfication_id
  23. else:
  24. obj = models.Direction.objects.get(id=direction_id)
  25. temp = obj.classification.all().values('id','name')
  26. id_list = list(map(lambda x:x['id'],temp))
  27.  
  28. cList = obj.classification.all().values('id','name')
  29.  
  30. ':
  31. # video-1-0
  32. # 根据风向ID,找到所属的分类ID
  33.  
  34. print(id_list)
  35. q['classification__id__in'] = id_list
  36. else:
  37. # video-1-1
  38. if int(classfication_id) in id_list:
  39. q['classification__id'] = classfication_id
  40. else:
  41. q['classification__id__in'] = id_list
  42. url_list = current_url.split('-')
  43. url_list[2] = "
  44. current_url = '-'.join(url_list)
  45. level_id = kwargs.get('level_id',None)
  46. ':
  47. q['level'] = level_id
  48.  
  49. result = models.Video.objects.filter(**q)
  50.  
  51. dList = models.Direction.objects.values('id', 'name')
  52.  
  53. lList = models.Video.level_choice
  54. # level_choice = (
  55. # (1, u'初级'),
  56. # (2, u'中级'),
  57. # (3, u'高级'),
  58. # )
  59. return render(request, 'video.html', {"dList":dList,
  60. 'cList': cList,
  61. 'lList': lList,
  62. 'current_url': current_url})
  1. from django.db import models
  2.  
  3. # 技术方向,
  4. class Direction(models.Model):
  5. name = models.CharField(verbose_name='名称', max_length=32)
  6.  
  7. classification = models.ManyToManyField('Classification')
  8.  
  9. class Meta:
  10. db_table = 'Direction'
  11. verbose_name_plural = u'方向(视频方向)'
  12.  
  13. def __str__(self):
  14. return self.name
  15.  
  16. # 技术分类、语言
  17. class Classification(models.Model):
  18. name = models.CharField(verbose_name='名称', max_length=32)
  19.  
  20. class Meta:
  21. db_table = 'Classification'
  22. verbose_name_plural = u'分类(视频分类)'
  23.  
  24. def __str__(self):
  25. return self.name
  26.  
  27. # 技术视频,
  28. class Video(models.Model):
  29. level_choice = (
  30. (1, u'初级'),
  31. (2, u'中级'),
  32. (3, u'高级'),
  33. )
  34. level = models.IntegerField(verbose_name='级别', choices=level_choice, default=1)
  35.  
  36. classification = models.ForeignKey('Classification', null=True, blank=True)
  37.  
  38. title = models.CharField(verbose_name='标题', max_length=32)
  39. summary = models.CharField(verbose_name='简介', max_length=32)
  40. img = models.ImageField(verbose_name='图片', upload_to='./static/images/Video/')
  41. href = models.CharField(verbose_name='视频地址', max_length=256)
  42.  
  43. create_date = models.DateTimeField(auto_now_add=True)
  44.  
  45. class Meta:
  46. db_table = 'Video'
  47. verbose_name_plural = u'视频'
  48.  
  49. def __str__(self):
  50. return self.title

Models Code

  1. {% load xx %}
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="UTF-8">
  6. <title></title>
  7. <style>
  8. .condition a{
  9. display: inline-block;
  10. padding: 5px;
  11. }
  12. .condition a.active{
  13. background-color: coral;
  14. color: white;
  15. }
  16. </style>
  17. </head>
  18. <body>
  19. <div class="condition">
  20. <div>
  21. {% all_menu current_url %} :
  22. {% for i in dList %}
  23. {% ac1 current_url i.id i.name %}
  24. {% endfor %}
  25. </div>
  26. <div>
  27. {% for i in cList %}
  28. {% ac2 current_url i.id i.name %}
  29. {% endfor %}
  30. </div>
  31. <div>
  32. {% for i in lList %}
  33. {% ac3 current_url i.0 i.1 %}
  34.  
  35. {% endfor %}
  36. </div>
  37. </div>
  38.  
  39. </body>
  40. </html>

Video html Code

多级评论

  1. from django.conf.urls import url
  2. from django.contrib import admin
  3. from app01 import views
  4. urlpatterns = [
  5. url(r'^admin/', admin.site.urls),
  6. url(r'^comment/', views.comment),
  7.  
  8. ]

url code

  1. from django.shortcuts import render
  2. import collections
  3. # Create your views here.
  4.  
  5. def tree_search(d_dic, comment_obj):
  6. # 在comment_dic中一个一个的寻找其回复的评论
  7. # 检查当前评论的 reply_id 和 comment_dic中已有评论的nid是否相同,
  8. # 如果相同,表示就是回复的此信息
  9. # 如果不同,则需要去 comment_dic 的所有子元素中寻找,一直找,如果一系列中未找,则继续向下找
  10. for k, v_dic in d_dic.items():
  11. # 找回复的评论,将自己添加到其对应的字典中,例如: {评论一: {回复一:{},回复二:{}}}
  12. if k[0] == comment_obj[2]:
  13. d_dic[k][comment_obj] = collections.OrderedDict()
  14. return
  15. else:
  16. # 在当前第一个跟元素中递归的去寻找父亲
  17. tree_search(d_dic[k], comment_obj)
  18.  
  19. def build_tree(comment_list):
  20. comment_dic = collections.OrderedDict()
  21.  
  22. for comment_obj in comment_list:
  23. if comment_obj[2] is None:
  24. # 如果是根评论,添加到comment_dic[评论对象] = {}
  25. comment_dic[comment_obj] = collections.OrderedDict()
  26. else:
  27. # 如果是回复的评论,则需要在 comment_dic 中找到其回复的评论
  28. tree_search(comment_dic, comment_obj)
  29. return comment_dic
  30.  
  31. comment_list = [
  32. (1, ', None),
  33. (2, ', None),
  34. (3, ', None),
  35. (9, ', 5),
  36. (4, ', 2),
  37. (5, ', 1),
  38. (6, ', 4),
  39. (7, ', 2),
  40. (8, ', 4),
  41. ]
  42.  
  43. def comment(request):
  44. comment_dict = build_tree(comment_list)
  45.  
  46. return render(request, 'comment.html', {'comment_dict': comment_dict})

Views Code

  1. from django.db import models
  2.  
  3. # Create your models here.
  4.  
  5. class SendMsg(models.Model):
  6.  
  7. nid = models.AutoField(primary_key=True)
  8. code = models.CharField(max_length=6)
  9. email = models.CharField(max_length=32, db_index=True)
  10. times = models.IntegerField(default=0)
  11. ctime = models.DateTimeField()
  12.  
  13. class UserInfo(models.Model):
  14. nid = models.AutoField(primary_key=True)
  15. username = models.CharField(max_length=32, unique=True)
  16. password = models.CharField(max_length=32)
  17. email = models.CharField(max_length=32, unique=True)
  18. ctime = models.DateTimeField()
  19.  
  20. class NewsType(models.Model):
  21. nid = models.AutoField(primary_key=True)
  22.  
  23. caption = models.CharField(max_length=32)
  24.  
  25. class News(models.Model):
  26. nid = models.AutoField(primary_key=True)
  27. user_info = models.ForeignKey('UserInfo')
  28. news_type = models.ForeignKey('NewsType')
  29. title = models.CharField(max_length=32, db_index=True)
  30. url = models.CharField(max_length=128)
  31. content = models.CharField(max_length=50)
  32. favor_count = models.IntegerField(default=0)
  33. comment_count = models.IntegerField(default=0)
  34. ctime = models.DateTimeField()
  35.  
  36. class Favor(models.Model):
  37.  
  38. nid = models.AutoField(primary_key=True)
  39.  
  40. user_info = models.ForeignKey('UserInfo')
  41. news = models.ForeignKey('News')
  42.  
  43. ctime = models.DateTimeField()
  44.  
  45. class Meta:
  46. unique_together = (("user_info", "news"),)
  47.  
  48. class Comment(models.Model):
  49. nid = models.AutoField(primary_key=True)
  50.  
  51. user_info = models.ForeignKey('UserInfo')
  52. news = models.ForeignKey('News')
  53.  
  54. up = models.IntegerField(default=0)
  55. down = models.IntegerField(default=0)
  56. ctime = models.DateTimeField()
  57.  
  58. device = models.CharField(max_length=16)
  59. content = models.CharField(max_length=150)
  60.  
  61. reply_id = models.ForeignKey('Comment', related_name='b', null=True, blank=True)

Models Code

  1. #!/usr/bin/env python
  2. # -*- coding:utf-8 -*-
  3. from django import template
  4. from django.utils.safestring import mark_safe
  5.  
  6. register = template.Library()
  7.  
  8. TEMP1 = """
  9. <div class='content' style='margin-left:%s;'>
  10. <span>%s</span>
  11. """
  12.  
  13. def generate_comment_html(sub_comment_dic, margin_left_val):
  14. html = '<div class="comment">'
  15. for k, v_dic in sub_comment_dic.items():
  16. html += TEMP1 % (margin_left_val, k[1])
  17. if v_dic:
  18. html += generate_comment_html(v_dic, margin_left_val)
  19. html += "</div>"
  20. html += "</div>"
  21. return html
  22.  
  23. @register.simple_tag
  24. def tree(comment_dic):
  25. html = '<div class="comment">'
  26. for k, v in comment_dic.items():
  27. html += TEMP1 % (0, k[1])
  28. html += generate_comment_html(v, 30)
  29. html += "</div>"
  30. html += '</div>'
  31.  
  32. return mark_safe(html)

templatetags xx.py

  1. {% load xx %}
  2.  
  3. {% tree comment_dict %}

comment html code

Tornado框架简介

Tornado 是 FriendFeed 使用的可扩展的非阻塞式 web 服务器及其相关工具的开源版本。这个 Web 框架看起来有些像web.py 或者 Google 的 webapp,不过为了能有效利用非阻塞式服务器环境,这个 Web 框架还包含了一些相关的有用工具 和优化。

Tornado 和现在的主流 Web 服务器框架(包括大多数 Python 的框架)有着明显的区别:它是非阻塞式服务器,而且速度相当快。得利于其 非阻塞的方式和对 epoll 的运用,Tornado 每秒可以处理数以千计的连接,这意味着对于实时 Web 服务来说,Tornado 是一个理想的 Web 框架。我们开发这个 Web 服务器的主要目的就是为了处理 FriendFeed 的实时功能 ——在 FriendFeed 的应用里每一个活动用户都会保持着一个服务器连接。(关于如何扩容 服务器,以处理数以千计的客户端的连接的问题,请参阅 C10K problem。)

安装:

  1. pip3 install tornado

简单应用

  1. #!/usr/bin/env python
  2. # -*- coding:utf-8 -*-
  3.  
  4. import tornado.ioloop
  5. import tornado.web
  6.  
  7. class MainHandler(tornado.web.RequestHandler):
  8. def get(self):
  9. self.write("Hello, world")
  10.  
  11. application = tornado.web.Application([
  12. (r"/index", MainHandler),
  13. ])
  14.  
  15. if __name__ == "__main__":
  16. application.listen(8888)
  17. tornado.ioloop.IOLoop.instance().start()

执行过程:

  • 第一步:执行脚本,监听 8888 端口
  • 第二步:浏览器客户端访问 /index  -->  http://127.0.0.1:8888/index
  • 第三步:服务器接受请求,并交由对应的类处理该请求
  • 第四步:类接受到请求之后,根据请求方式(post / get / delete ...)的不同调用并执行相应的方法
  • 第五步:方法返回值的字符串内容发送浏览器

参考url:http://www.cnblogs.com/wupeiqi/articles/5702910.html

python运维开发(二十二)---JSONP、瀑布流、组合搜索、多级评论、tornado框架简介的更多相关文章

  1. Python运维开发基础09-函数基础【转】

    上节作业回顾 #!/usr/bin/env python3 # -*- coding:utf-8 -*- # author:Mr.chen # 实现简单的shell命令sed的替换功能 import ...

  2. Python运维开发基础10-函数基础【转】

    一,函数的非固定参数 1.1 默认参数 在定义形参的时候,提前给形参赋一个固定的值. #代码演示: def test(x,y=2): #形参里有一个默认参数 print (x) print (y) t ...

  3. Python运维开发基础08-文件基础【转】

    一,文件的其他打开模式 "+"表示可以同时读写某个文件: r+,可读写文件(可读:可写:可追加) w+,写读(不常用) a+,同a(不常用 "U"表示在读取时, ...

  4. Python运维开发基础07-文件基础【转】

    一,文件的基础操作 对文件操作的流程 [x] :打开文件,得到文件句柄并赋值给一个变量 [x] :通过句柄对文件进行操作 [x] :关闭文件 创建初始操作模板文件 [root@localhost sc ...

  5. Python运维开发基础06-语法基础【转】

    上节作业回顾 (讲解+温习120分钟) #!/usr/bin/env python3 # -*- coding:utf-8 -*- # author:Mr.chen # 添加商家入口和用户入口并实现物 ...

  6. Python运维开发基础05-语法基础【转】

    上节作业回顾(讲解+温习90分钟) #!/usr/bin/env python # -*- coding:utf-8 -*- # author:Mr.chen import os,time Tag = ...

  7. Python运维开发基础04-语法基础【转】

    上节作业回顾(讲解+温习90分钟) #!/usr/bin/env python3 # -*- coding:utf-8 -*- # author:Mr.chen # 仅用列表+循环实现“简单的购物车程 ...

  8. Python运维开发基础03-语法基础 【转】

    上节作业回顾(讲解+温习60分钟) #!/usr/bin/env python3 # -*- coding:utf-8 -*- # author:Mr.chen #只用变量和字符串+循环实现“用户登陆 ...

  9. Python运维开发基础02-语法基础【转】

    上节作业回顾(讲解+温习60分钟) #!/bin/bash #user login User="yunjisuan" Passwd="666666" User2 ...

随机推荐

  1. 10步教你来优化WordPress速度 为服务器和访客减压

    1.Cookie的静态化制作 约有80%至90%的时间,访客要花费大量的时间等你的WordPress加载静态内容.这意味着,有大部分的时间,用户浏览您的网站,他们正在等待加载,如:图像,CSS,JS脚 ...

  2. python中 and 和 or 运算的核心思想 ——— 短路逻辑

    python中 and 和 or 运算的核心思想 --- 短路逻辑 1. 包含一个逻辑运算符 首先从基本的概念着手,python中哪些对象会被当成 False 呢?而哪些又是 True 呢? 在Pyt ...

  3. java读取property文件

    property文件中: url = jdbc:mysql://localhost:3306/resume   user= root   pwd = 123 java代码读取:       packa ...

  4. Codeforces 494D Upgrading Array

    http://codeforces.com/contest/494/problem/D 题意:给一个数组,和一个坏质数集合,可以无数次地让1到i这些所有数字除以他们的gcd,然后要求Σf(a[i])的 ...

  5. 【转】Linux下tar.xz结尾的文件的解压方法--不错

    原文网址:http://blog.csdn.net/silvervi/article/details/6325698 今天尝试编译内核,下载到了一份tar.xz结尾的压缩文件,网上解决方法比较少,不过 ...

  6. javascript遍历Json对象个数

       var data={};     for (var d in data) {         $(data[d]).each(function (i, e) {             aler ...

  7. Populating Next Right Pointers in Each Node II 解答

    Question Follow up for problem "Populating Next Right Pointers in Each Node". What if the ...

  8. fcitx 输入框纵向

    打开~/.config/fcitx/conf/fcitx-classic-ui.config 找到下面的:# 竖排候选词列表# 可选值:# True False#VerticalList=True-- ...

  9. qt model/view 架构自定义模型之QFileSystemModel

    # -*- coding: utf-8 -*- # python:2.x #QFileSystemModel """ Qt  内置了两种模型:QStandardItemM ...

  10. python之路-pip安装

    pip类似RedHat里面的yum,安装Python包非常方便   安装pip方法: 1.安装环境:ubuntu-14.04.2 sudo apt-get install python-pip pyt ...