Skip to content

Instantly share code, notes, and snippets.

View zhuqling's full-sized avatar

zhuqling zhuqling

  • @xinsailei
  • Guangzhou
View GitHub Profile
@zhuqling
zhuqling / affect_with_light_copy.py
Last active December 15, 2015 06:39
结论1:字符为不可变类型,因此不存在浅复制问题,并且不能更改字符串内容 结论2,用不可变类型复制出来的列表(可变类型),不可变类型变更,不会影响列表,因为不可变类型其实是引用到了新地址空间 结论3,只有用可变类型复制的内容,当原可变类型变化时,复制出来的变量内容即更新 结论4,使用列表内涵生成的列表,等同于使用for循环添加列表元素,不受浅复制影响
"""
>>> char = 'a'
>>> str = char * 3
>>> str
'aaa'
>>> str[0] = 'b'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'str' object does not support item assignment
@zhuqling
zhuqling / javascript_enlightment.md
Last active December 16, 2015 05:48
Javascript进阶内容

Javascript 进阶

Head object/Global object

  • Head object只有一个,即window
  • Global object为全局变量(函数也是变量),它们的上级是Head object
var name = 'jason chuh';
var title = 'Mr.';
@zhuqling
zhuqling / WCF REST Pass and Get Header Field.cs
Last active December 19, 2015 01:09
WCF在REST状态下,传递和获取Header
// 传递Header
using (WebChannelFactory<IService> wcf = new WebChannelFactory<IService>(new Uri("http://localhost:"+port+"/Web")))
{
IService channel = wcf.CreateChannel();
// 首先创建OperationContextScope
// ** 注意OperationContextScope只能使用在单个调用内,不能跨调用包裹 **
using ( OperationContextScope scope = new OperationContextScope((IContextChannel)channel))
{
// 传递Header
@zhuqling
zhuqling / WCF REST Post pass JSON parameters.cs
Last active December 19, 2015 01:18
WCF REST 当为POST方式+JSON数据类型时,如何传递参数
// 协议定义
[OperationContract]
[WebInvoke
(
// UriTemplate="/EchoWithPost",
// Method="POST", 默认为POST
// BodyStyle = WebMessageBodyStyle.Bare, 默认为Bare无包裹
RequestFormat=WebMessageFormat.Json,
ResponseFormat=WebMessageFormat.Json
)
@zhuqling
zhuqling / wcf_basis.md
Last active December 19, 2015 01:19
WCF 基础

WCF 基础

地址

地址 = Protocal :// MachineName/DomainName/IP [:Port]

  • TCP. net.tcp://localhost:8002/MySrv, net.tcp://localhost:8002/MySrv2
  • HTTP. http://localhost:8001 默认80端口
@zhuqling
zhuqling / bootstrap-sub-submenu-implemation.html
Last active December 19, 2015 08:28
bootstrap实现多层菜单效果
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.js"></script>
<script type="text/javascript" src="http://fiddle.jshell.net/js/lib/bootstrap-2.0.2.js"></script>
<link rel="stylesheet" type="text/css" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<style>
body {
padding-top: 60px;
padding-bottom: 40px;
}
@zhuqling
zhuqling / ios_develop_flow.md
Last active December 21, 2015 12:09
iOS开发流程、问题汇总

证书

  • 确认Apple所有证书为最新,否则先删除,再去www.apple.com/certificateauthority/下载所有,并安装
  • 创建证书(Developer+Distribution),下载并安装
  • ** 下载的证书安装后显示不信任,则为Apple证书已经过期,应重新下载所有证书 **

App

  • 创建App ID(此即为app identify,如com.whatever.projectname)
  • 创建App,选择App ID,选择计费
  • 当为“Prepare to upload”时,需打开,点击“Ready to Upload binary”,选择安全条款,状态变为“Ready for upload”
class Panel extends Backbone.View
el: $('#test')
events:
'click #superZone': 'clickMyZone'
initialize: ->
$("#test").append '<span id="superZone">Panel initialized</span>, '
@foo = 'bar'
render: ->
$("#test").append 'super render'
@

C#编码规范

概述

规范制定原则

  • 方便代码的交流和维护。
  • 不影响编码的效率,不与大众习惯冲突。
  • 使代码更美观、阅读更方便。
  • 使代码的逻辑更清晰、更易于理解。
@zhuqling
zhuqling / elastic search define analysis and test
Last active August 29, 2015 14:07
elastic search指定分析器与分析器测试
# 中文全文检索,使用mmseg
## 创建索引
PUT http://localhost:9200/index
## 设置mapping
POST /index/fulltext/_mapping
{
"fulltext": {
"_all": {