10 2014 档案

摘要:IntroductionAll of the configuration files for the Laravel framework are stored in theapp/configdirectory. Each option in every file is documented, so... 阅读全文
posted @ 2014-10-31 23:37 wuhn 阅读(453) 评论(0) 推荐(0)
摘要:Basic ControllersInstead of defining all of your route-level logic in a singleroutes.phpfile, you may wish to organize this behavior using Controller ... 阅读全文
posted @ 2014-10-31 23:23 wuhn 阅读(407) 评论(0) 推荐(0)
摘要:上文(理解javascript原型和作用域系列(1)——一切都是对象)已经提到,函数就是对象的一种,因为通过instanceof函数可以判断。var fn = function () { };console.log(fn instanceof Object); // true对!函数是一种对象,但... 阅读全文
posted @ 2014-10-30 08:07 wuhn 阅读(173) 评论(0) 推荐(0)
摘要:“一切都是对象”这句话的重点在于如何去理解“对象”这个概念。——当然,也不是所有的都是对象,值类型就不是对象。首先咱们还是先看看javascript中一个常用的函数——typeof()。typeof应该算是咱们的老朋友,还有谁没用过它?typeof函数输出的一共有几种类型,在此列出: f... 阅读全文
posted @ 2014-10-30 08:05 wuhn 阅读(166) 评论(0) 推荐(0)
摘要:前两天被问到ajax跨域如何解决,还真被问住了,光知道有个什么jsonp,迷迷糊糊的没有说上来。抱着有问题必须解决的态度,我看了许多资料,原来如此。。。为何一直知道jsonp,但一直迷迷糊糊的不明白呢?——网上那些介绍资料都写的太复杂了!我是能多简单就多简单,争取让你十分钟看完!1. 同源策略aja... 阅读全文
posted @ 2014-10-30 08:00 wuhn 阅读(214) 评论(0) 推荐(0)
摘要:Update 10/24/12: If you’d like a new version of this tutorial fully updated for iOS 6 and Xcode 4.5, check out iOS 5 by Tutorials Second Edition!Note ... 阅读全文
posted @ 2014-10-29 15:09 wuhn 阅读(415) 评论(0) 推荐(0)
摘要:关于Core AnimationCore Animation是iOS与OS X平台上负责图形渲染与动画的基础设施。Core Animation可以动画视图和其他的可视元素。Core Animation为你完成了实现动画所需的大部分绘帧工作。你只需在配置少量的动画参数(如开始点位置和结束点位置)就可启... 阅读全文
posted @ 2014-10-29 14:08 wuhn 阅读(166) 评论(0) 推荐(0)
摘要:Fun with layers这篇文章的有些内容很奇怪,我根本就没有这种现象,所以暂时就这样吧In this post, I’ll explain how to add a border, rounded corners, and drop shadow to any UIView using so... 阅读全文
posted @ 2014-10-29 13:57 wuhn 阅读(196) 评论(0) 推荐(0)
摘要:I have a UIView and I'm trying to set its layer properties.self.colorSwatch = [[UIView alloc] initWithFrame:CGRectMake(400, 150, 100, 100)];self.color... 阅读全文
posted @ 2014-10-29 11:29 wuhn 阅读(1017) 评论(0) 推荐(0)
摘要:So right now I have a UIView with a UILabel in it. I want the background to have an opacity < 1.0 and the label to have an opacity of 1.0. However sin... 阅读全文
posted @ 2014-10-29 11:27 wuhn 阅读(225) 评论(0) 推荐(0)
摘要:在所有编程语言中都涉及到大量的字符串操作,可见熟悉对字符串的操作是何等重要。 Go中的字符串和C#中的一样(java也是),字符串内容在初始化后不可修改。 需要注意的是在Go中字符串是有UTF-8编码的,请注意保存文件时将文件编码格式改成UTF-8(特别是在windows下)。初始化var str ... 阅读全文
posted @ 2014-10-29 00:18 wuhn 阅读(2404) 评论(0) 推荐(0)
摘要:Channels can bebuffered. Provide the buffer length as the second argument tomaketo initialize a buffered channel:ch := make(chan int, 100)Sends to a b... 阅读全文
posted @ 2014-10-28 23:44 wuhn 阅读(195) 评论(0) 推荐(0)
摘要:Channels are a typed conduit through which you can send and receive values with the channel operator,<-.ch <- v // Send v to channel ch.v := <-ch ... 阅读全文
posted @ 2014-10-28 23:40 wuhn 阅读(168) 评论(0) 推荐(0)
摘要:The next section covers Go's concurrency primitives.A Tour of GoGoroutinesAgoroutineis a lightweight thread managed by the Go runtime.go f(x, y, z)sta... 阅读全文
posted @ 2014-10-28 23:32 wuhn 阅读(167) 评论(0) 推荐(0)
摘要:/* Exercise: Loops and Functions #43 */package main import ( "fmt" "math") func Sqrt(x float64) float64 { z := float64(2.) s := float64(0)... 阅读全文
posted @ 2014-10-28 23:29 wuhn 阅读(784) 评论(0) 推荐(0)
摘要:package mainimport ( "io" "os" "strings" "fmt")type rot13Reader struct { r io.Reader}func (rot13 rot13Reader)Read(p []byte) (n int, err... 阅读全文
posted @ 2014-10-28 23:27 wuhn 阅读(485) 评论(0) 推荐(0)
摘要:Remember the picture generator you wrote earlier? Let's write another one, but this time it will return an implementation ofimage.Imageinstead of a sl... 阅读全文
posted @ 2014-10-28 23:09 wuhn 阅读(409) 评论(0) 推荐(0)
摘要:Package imagedefines theImageinterface:package imagetype Image interface { ColorModel() color.Model Bounds() Rectangle At(x, y int) color.Col... 阅读全文
posted @ 2014-10-28 22:59 wuhn 阅读(132) 评论(0) 推荐(0)
摘要:Implement the following types and define ServeHTTP methods on them. Register them to handle specific paths in your web server.type String stringtype S... 阅读全文
posted @ 2014-10-28 22:57 wuhn 阅读(459) 评论(0) 推荐(0)
摘要:Package httpserves HTTP requests using any value that implementshttp.Handler:package httptype Handler interface { ServeHTTP(w ResponseWriter, r *Re... 阅读全文
posted @ 2014-10-28 22:47 wuhn 阅读(144) 评论(0) 推荐(0)
摘要:Copy yourSqrtfunction from the earlier exercises and modify it to return anerrorvalue.Sqrtshould return a non-nil error value when given a negative nu... 阅读全文
posted @ 2014-10-28 20:41 wuhn 阅读(565) 评论(0) 推荐(0)
摘要:An error is anything that can describe itself as an error string. The idea is captured by the predefined, built-in interface type,error, with its sing... 阅读全文
posted @ 2014-10-28 20:23 wuhn 阅读(136) 评论(0) 推荐(0)
摘要:A type implements an interface by implementing the methods.There is no explicit declaration of intent.Implicit interfaces decouple implementation pack... 阅读全文
posted @ 2014-10-28 20:08 wuhn 阅读(239) 评论(0) 推荐(0)
摘要:An interface type is defined by a set of methods.A value of interface type can hold any value that implements those methods.Note:The code on the left ... 阅读全文
posted @ 2014-10-28 20:00 wuhn 阅读(129) 评论(0) 推荐(0)
摘要:Methods can be associated with a named type or a pointer to a named type.We just saw twoAbsmethods. One on the*Vertexpointer type and the other on the... 阅读全文
posted @ 2014-10-28 19:34 wuhn 阅读(276) 评论(0) 推荐(0)
摘要:In fact, you can define a method onanytype you define in your package, not just structs.You cannot define a method on a type from another package, or ... 阅读全文
posted @ 2014-10-28 18:59 wuhn 阅读(119) 评论(0) 推荐(0)
摘要:Go does not have classes. However, you can define methods on struct types.Themethod receiverappears in its own argument list between thefunckeyword an... 阅读全文
posted @ 2014-10-28 18:54 wuhn 阅读(112) 评论(0) 推荐(0)
摘要:打开相机://先设定sourceType为相机,然后判断相机是否可用(ipod)没相机,不可用将sourceType设定为相片库 UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypeCa... 阅读全文
posted @ 2014-10-28 17:04 wuhn 阅读(191) 评论(0) 推荐(0)
摘要:PhoneGap 和 Cordova的关系阐述是PhoneGap贡献给Apache后的开源项目,是从PhoneGap中抽出的核心代码,是驱动PhoneGap的核心引擎。你可以把他想象成类似于Webkit和Google Chrome的关系。Apache Cordova is an open-sourc... 阅读全文
posted @ 2014-10-28 15:39 wuhn 阅读(207) 评论(0) 推荐(0)
摘要:To Install, ensure that you have NodeJS installed, then open your commandline and run the following:$ sudo npm install -g phonegap Once ins... 阅读全文
posted @ 2014-10-28 15:32 wuhn 阅读(169) 评论(0) 推荐(0)
摘要:In my app, I am loading a resource heavy view that takes about 1 to 2 seconds to load. So I am loading it in a separate thread like this:hud = [[MBPro... 阅读全文
posted @ 2014-10-28 10:12 wuhn 阅读(361) 评论(0) 推荐(1)
摘要:The next group of slides covers methods and interfaces, the constructs that define objects and their behavior. 阅读全文
posted @ 2014-10-28 07:56 wuhn 阅读(132) 评论(0) 推荐(0)
摘要:Let's explore Go's built-in support for complex numbers via thecomplex64andcomplex128types. For cube roots, Newton's method amounts to repeating:Find ... 阅读全文
posted @ 2014-10-28 07:54 wuhn 阅读(147) 评论(0) 推荐(0)
摘要:Switch without a condition is the same asswitch true.This construct can be a clean way to write long if-then-else chains.package main import ( "fmt... 阅读全文
posted @ 2014-10-28 07:38 wuhn 阅读(177) 评论(0) 推荐(0)
摘要:Switch cases evaluate cases from top to bottom, stopping when a case succeeds.(For example,switch i {case 0:case f():}does not callfifi==0.)Note:Time ... 阅读全文
posted @ 2014-10-28 07:35 wuhn 阅读(222) 评论(0) 推荐(0)
摘要:You probably knew whatswitchwas going to look like.A case body breaks automatically, unless it ends with afallthroughstatement.package main import ( ... 阅读全文
posted @ 2014-10-28 00:10 wuhn 阅读(163) 评论(0) 推荐(0)
摘要:Let's have some fun with functions.Implement afibonaccifunction that returns a function (a closure) that returns successive fibonacci numbers.package ... 阅读全文
posted @ 2014-10-27 23:44 wuhn 阅读(363) 评论(0) 推荐(0)
摘要:Go functions may be closures. A closure is a function value that references variables from outside its body. The function may access and assign to the... 阅读全文
posted @ 2014-10-27 23:30 wuhn 阅读(217) 评论(0) 推荐(0)
摘要:Functions are values too.在函数式语言中中函数都是变量,比如在javascript中package main import ( "fmt" "math")func main() { hypot := func(x,y float64) float64 { ... 阅读全文
posted @ 2014-10-27 23:25 wuhn 阅读(136) 评论(0) 推荐(0)
摘要:ImplementWordCount. It should return a map of the counts of each “word” in the strings. Thewc.Testfunction runs a test suite against the provided func... 阅读全文
posted @ 2014-10-27 23:21 wuhn 阅读(261) 评论(0) 推荐(0)
摘要:Insert or update an element in mapm:m[key] = elemRetrieve an element:elem = m[key]Delete an element:delete(m, key)Test that a key is present with a tw... 阅读全文
posted @ 2014-10-27 23:11 wuhn 阅读(113) 评论(0) 推荐(0)
摘要:If the top-level type is just a type name, you can omit it from the elements of the literal.package main import "fmt"type Vertex struct { Lat, Long... 阅读全文
posted @ 2014-10-27 23:04 wuhn 阅读(185) 评论(0) 推荐(0)
摘要:Map literals are like struct literals, but the keys are required.package main import "fmt"type Vertex struct { Lat, Long float64}var m = map[string... 阅读全文
posted @ 2014-10-27 22:54 wuhn 阅读(154) 评论(0) 推荐(0)
摘要:A map maps keys to values.Maps must be created withmake(notnew) before use; thenilmap is empty and cannot be assigned to.package main import "fmt"type... 阅读全文
posted @ 2014-10-27 22:51 wuhn 阅读(134) 评论(0) 推荐(0)
摘要:下面的不是指针指向数组,而是指针指向SliceI'm having a little play with google's Go language, and I've run into something which is fairly basic in C but doesn't seem to ... 阅读全文
posted @ 2014-10-27 22:41 wuhn 阅读(222) 评论(0) 推荐(0)
摘要:ImplementPic. It should return a slice of lengthdy, each element of which is a slice ofdx8-bit unsigned integers. When you run the program, it will di... 阅读全文
posted @ 2014-10-27 02:28 wuhn 阅读(285) 评论(0) 推荐(0)
摘要:You can skip the index or value by assigning to_.If you only want the index, drop the ", value" entirely.package main import "fmt"func main() { pow... 阅读全文
posted @ 2014-10-27 02:27 wuhn 阅读(116) 评论(0) 推荐(0)
摘要:Therangeform of theforloop iterates over a slice or map.package mainimport "fmt"var pow = []int{1, 2, 4, 8, 16, 32, 64, 128}func main() { for i, v ... 阅读全文
posted @ 2014-10-27 01:56 wuhn 阅读(164) 评论(0) 推荐(0)
摘要:IntroductionGo's slice type provides a convenient and efficient means of working with sequences of typed data. Slices are analogous to arrays in other... 阅读全文
posted @ 2014-10-27 01:51 wuhn 阅读(253) 评论(0) 推荐(0)
摘要:The zero value of a slice isnil.A nil slice has a length and capacity of 0.(To learn more about slices, read theSlices: usage and internalsarticle.)pa... 阅读全文
posted @ 2014-10-27 01:15 wuhn 阅读(154) 评论(0) 推荐(0)
摘要:Slices are created with themakefunction. It works by allocating a zeroed array and returning a slice that refers to that array:a := make([]int, 5) //... 阅读全文
posted @ 2014-10-27 01:13 wuhn 阅读(138) 评论(0) 推荐(0)
摘要:---恢复内容开始---Slices can be re-sliced, creating a new slice value that points to the same array.The expressions[lo:hi]evaluates to a slice of the elemen... 阅读全文
posted @ 2014-10-27 01:07 wuhn 阅读(117) 评论(0) 推荐(0)
摘要:A slice points to an array of values and also includes a length.[]Tis a slice with elements of typeT.package main import "fmt"func main() { p := []... 阅读全文
posted @ 2014-10-27 01:02 wuhn 阅读(174) 评论(0) 推荐(0)
摘要:The type[n]Tis an array ofnvalues of typeT.The expressionvar a [10]intdeclares a variableaas an array of ten integers.An array's length is part of its... 阅读全文
posted @ 2014-10-27 00:59 wuhn 阅读(124) 评论(0) 推荐(0)
摘要:The expressionnew(T)allocates a zeroedTvalue and returns a pointer to it.var t *T = new(T)ort := new(T)package main import "fmt"type Vertex struct { ... 阅读全文
posted @ 2014-10-27 00:50 wuhn 阅读(134) 评论(0) 推荐(0)
摘要:A struct literal denotes a newly allocated struct value by listing the values of its fields.You can list just a subset of fields by using theName:synt... 阅读全文
posted @ 2014-10-27 00:48 wuhn 阅读(186) 评论(0) 推荐(0)
摘要:Go has pointers, but no pointer arithmetic.Struct fields can be accessed through a struct pointer. The indirection through the pointer is transparent.... 阅读全文
posted @ 2014-10-26 23:30 wuhn 阅读(130) 评论(0) 推荐(0)
摘要:Struct fields are accessed using a dot.package main import "fmt"type Vertex struct { X int Y int}func main() { v := Vertex{1, 2} v.X = 4 ... 阅读全文
posted @ 2014-10-26 23:26 wuhn 阅读(161) 评论(0) 推荐(0)
摘要:Astructis a collection of fields.(And atypedeclaration does what you'd expect.)package main import "fmt"type Vertext struct { X int Y int}func ... 阅读全文
posted @ 2014-10-26 23:24 wuhn 阅读(152) 评论(0) 推荐(0)
摘要:As a simple way to play with functions and loops, implement the square root function using Newton's method.In this case, Newton's method is to approxi... 阅读全文
posted @ 2014-10-26 23:22 wuhn 阅读(334) 评论(0) 推荐(0)
摘要:Variables declared inside anifshort statement are also available inside any of theelseblocks.package main import ( "fmt" "math")func pow(x, n, ... 阅读全文
posted @ 2014-10-26 23:06 wuhn 阅读(142) 评论(0) 推荐(0)
摘要:Likefor, theifstatement can start with a short statement to execute before the condition.Variables declared by the statement are only in scope until t... 阅读全文
posted @ 2014-10-26 23:02 wuhn 阅读(150) 评论(0) 推荐(0)
摘要:Theifstatement looks as it does in C or Java, except that the( )are gone and the{ }are required.(Sound familiar?)package main import ( "fmt" "m... 阅读全文
posted @ 2014-10-26 22:54 wuhn 阅读(165) 评论(0) 推荐(0)
摘要:If you omit the loop condition it loops forever, so an infinite loop is compactly(简洁地;紧密地;细密地) expressed.package main func main() { for { ... 阅读全文
posted @ 2014-10-26 22:49 wuhn 阅读(108) 评论(0) 推荐(0)
摘要:At that point you can drop the semicolons(分号): C'swhileis spelledforin Go.package main import "fmt"func main() { sum := 1 for sum < 1000 { ... 阅读全文
posted @ 2014-10-26 22:47 wuhn 阅读(138) 评论(0) 推荐(0)
摘要:As in C or Java, you can leave the pre and post statements empty.package main import "fmt"func main() { sum := 1 for ; sum < 1000; { sum... 阅读全文
posted @ 2014-10-26 22:45 wuhn 阅读(138) 评论(0) 推荐(0)
摘要:Go has only one looping construct, theforloop.The basicforloop looks as it does in C or Java, except that the( )are gone (they are not even optional) ... 阅读全文
posted @ 2014-10-26 22:42 wuhn 阅读(158) 评论(0) 推荐(0)
摘要:Numeric constants are high-precisionvalues.An untyped constant takes the type needed by its context.Try printingneedInt(Big)too.package main import "f... 阅读全文
posted @ 2014-10-26 20:51 wuhn 阅读(384) 评论(0) 推荐(0)
摘要:The expressionT(v)converts the valuevto the typeT.Some numeric conversions:var i int = 42var f float64 = float64(i)var u uint = uint(f)Or, put more si... 阅读全文
posted @ 2014-10-26 20:39 wuhn 阅读(141) 评论(0) 推荐(0)
摘要:Go's basic types areboolstringint int8 int16 int32 int64uint uint8 uint16 uint32 uint64 uintptrbyte // alias for uint8rune // alias for int32 ... 阅读全文
posted @ 2014-10-26 20:08 wuhn 阅读(166) 评论(0) 推荐(0)
摘要:Inside a function, the:=short assignment statement can be used in place of avardeclaration with implicit type.Outside a function, every construct begi... 阅读全文
posted @ 2014-10-26 20:02 wuhn 阅读(173) 评论(0) 推荐(0)
摘要:A var declaration can include initializers, one per variable.If an initializer is present, the type can be omitted; the variable will take the type of... 阅读全文
posted @ 2014-10-26 19:55 wuhn 阅读(126) 评论(0) 推荐(0)
摘要:Thevarstatement declares a list of variables; as in function argument lists, the type is last.package main import "fmt"var i intvar c, python, java bo... 阅读全文
posted @ 2014-10-26 19:53 wuhn 阅读(115) 评论(0) 推荐(0)
摘要:A function can return any number of results.This function returns two strings.package mainimport "fmt"func swap(x, y string) (string, string) { ret... 阅读全文
posted @ 2014-10-26 19:47 wuhn 阅读(146) 评论(0) 推荐(0)
摘要:import后面接的是目录的名字,而不是所谓包的名字,并且如果一个目录下面还有目录的话都必须要写进去,比如:import "MyPackage"import "MyPackage/MyInnerPackage"在这里讲明白了import后面接的是目录名而不是文件名更不是所谓的包名,那么一个目录下面的... 阅读全文
posted @ 2014-10-26 17:12 wuhn 阅读(223) 评论(0) 推荐(0)
摘要:安装Go语言开发环境实例代码 - 详述Go语言安装所在需要的工作:安装C语言工具,安装Mercurial,更新go到新版本等操作实例。安装go环境1、简介Go是一个开源项目,采用BSD授权协议。 该文档介绍如何获取Go源代码,如何编译,以及如何运行Go程序。目前有两种方式使用Go语言。这里主要讲述如... 阅读全文
posted @ 2014-10-26 14:38 wuhn 阅读(324) 评论(0) 推荐(0)
摘要:Go语言简介 - Go语言是由Google开发的一个开源项目,目的之一为了提高开发人员的编程效率。Go语言简介Go语言是由Google开发的一个开源项目,目的之一为了提高开发人员的编程效率。 Go语言语法灵活、简洁、清晰、高效。它对的并发特性可以方便地用于多核处理器和网络开发,同时灵活新颖的类型系统... 阅读全文
posted @ 2014-10-26 14:35 wuhn 阅读(359) 评论(0) 推荐(0)
摘要:When running the command:+ mvn site site:stage -DskipTests -DskipTest -DskipITsyou get an error:[ERROR] Failed to execute goal org.apache.maven.plugin... 阅读全文
posted @ 2014-10-26 14:31 wuhn 阅读(1287) 评论(0) 推荐(0)
摘要:其实golang的工程管理还是挺简单的,完全使用目录结构还有package名来推导工程结构和构建顺序。当然,首先要说的是环境变量$GOPATH,项目构建全靠它。这么说吧,想要构建一个项目,就要将这个项目添加到$GOPATH中,多个项目用";"分隔。Golang项目目录下一般有三个子目录:src存放源... 阅读全文
posted @ 2014-10-26 11:11 wuhn 阅读(13333) 评论(0) 推荐(2)
摘要:原本不打算介绍GOPATH,然而,总是有初学者问一些关于GOPATH的问题,因此在这里再介绍一下GOPATHGOPATH环境变量用于指定这样一些目录:除$GOROOT之外的包含Go项目源代码和二进制文件的目录。go install和go 工具会用到GOPATH:作为编译后二进制的存放目的地和impo... 阅读全文
posted @ 2014-10-26 11:02 wuhn 阅读(582) 评论(0) 推荐(0)
摘要:项目目录结构如何组织,一般语言都是没有规定。但Go语言这方面做了规定,这样可以保持一致性1、一般的,一个Go项目在GOPATH下,会有如下三个目录:|--bin|--pkg|--src其中,bin存放编译后的可执行文件;pkg存放编译后的包文件;src存放项目源文件。一般,bin和pkg目录可以不创... 阅读全文
posted @ 2014-10-26 10:59 wuhn 阅读(413) 评论(0) 推荐(0)
摘要:IntroductionAll of the configuration files for the Laravel framework are stored in theapp/configdirectory. Each option in every file is documented, so... 阅读全文
posted @ 2014-10-24 19:30 wuhn 阅读(187) 评论(0) 推荐(0)
摘要:最近一位大学老师给我抱怨了一个她遇到的烦恼,一直在纠结,生活都被打乱了,事情大概是这样的: 她的优盘里辛辛苦苦弄好备课文件,放在了优盘里,可是每次上课时,就是找不到文件。有时好多文件都被修改了,非常烦恼。 第一次找到我后,我仔细看了看,应该是中了文件夹图标病毒,这类病毒的一般性质是:将优盘里面真... 阅读全文
posted @ 2014-10-24 19:11 wuhn 阅读(5494) 评论(0) 推荐(0)
摘要:一.安装Composer首先你需要安装Composer,Composer是PHP依赖管理工具,Laravel框架就是使用Composer执行安装和依赖管理。注:(1)若安装Composer出错,在php.ini中开启php_openssl,php_fileinfo扩展,因为Laravel需要。(2)... 阅读全文
posted @ 2014-10-24 19:08 wuhn 阅读(273) 评论(0) 推荐(0)
摘要:Where To StartLearning a new framework can be daunting, but it's also exciting. To smooth your transition, we've attempted to create very clear, conci... 阅读全文
posted @ 2014-10-24 19:03 wuhn 阅读(218) 评论(0) 推荐(0)
摘要:InstallationVia Laravel InstallerFirst, download the Laravel installer using Composer.composer global require "laravel/installer=~1.1"Make sure to pla... 阅读全文
posted @ 2014-10-24 18:58 wuhn 阅读(375) 评论(0) 推荐(0)
摘要:“Swift is a new programming language for iOS and OS X app development. Nonetheless, many parts of Swift will be familiar from your experience of devel... 阅读全文
posted @ 2014-10-24 13:36 wuhn 阅读(169) 评论(0) 推荐(0)
摘要:虚拟主机 (Virtual Host)是在同一台机器搭建属于不同域名或者基于不同 IP 的多个网站服务的技术. 可以为运行在同一物理机器上的各个网站指配不同的 IP 和端口, 也可让多个网站拥有不同的域名.Apache 是世界上使用最广的 Web 服务器, 从 1.1 版开始支持虚拟主机. 本文将讲... 阅读全文
posted @ 2014-10-24 07:58 wuhn 阅读(254) 评论(0) 推荐(0)
摘要:Spring-framework source codegit url: git clone git://github.com/SpringSource/spring-framework.git导入IDERun ./import-into-eclipse.sh or read import-into... 阅读全文
posted @ 2014-10-24 03:08 wuhn 阅读(569) 评论(0) 推荐(0)
摘要:/** * Take a String which is a delimited list and convert it to a String array. * A single delimiter can consists of more than one charact... 阅读全文
posted @ 2014-10-24 03:01 wuhn 阅读(1690) 评论(0) 推荐(0)
摘要:In Java, you can use StringTokennizer class to split a String into different tokenas by defined delimiter.(space is the default delimiter). Here’re tw... 阅读全文
posted @ 2014-10-24 02:56 wuhn 阅读(519) 评论(0) 推荐(0)
摘要:/** * Delete any character in a given String. * @param inString the original String * @param charsToDelete a set of characters to dele... 阅读全文
posted @ 2014-10-24 02:09 wuhn 阅读(4023) 评论(0) 推荐(0)
摘要:版本号:Python2.7.5,Python3改动较大。所谓网页抓取,就是把URL地址中指定的网络资源从网络流中读取出来,保存到本地。类似于使用程序模拟IE浏览器的功能,把URL作为HTTP请求的内容发送到服务器端, 然后读取服务器端的响应资源。在Python中,我们使用urllib2这个组件来抓取... 阅读全文
posted @ 2014-10-23 23:59 wuhn 阅读(1552) 评论(0) 推荐(0)
摘要:A uniform resource identifier (URI) is a uniform resource locator(定位器,探测器) (URL), uniform resource name (URN), or both.Incomputing, auniform resource ... 阅读全文
posted @ 2014-10-23 22:54 wuhn 阅读(353) 评论(0) 推荐(0)
摘要:一、网络爬虫的定义网络爬虫,即Web Spider,是一个很形象的名字。把互联网比喻成一个蜘蛛网,那么Spider就是在网上爬来爬去的蜘蛛。网络蜘蛛是通过网页的链接地址来寻找网页的。从网站某一个页面(通常是首页)开始,读取网页的内容,找到在网页中的其它链接地址,然后通过这些链接地址寻找下一个网页,这... 阅读全文
posted @ 2014-10-23 22:38 wuhn 阅读(1800) 评论(0) 推荐(0)
摘要:CCSize size = CCDirector::sharedDirector()->getWinSize(); CCSprite *bg = CCSprite::create("HelloWorld.png"); bg->setPosition(ccp(size.width/... 阅读全文
posted @ 2014-10-23 22:00 wuhn 阅读(294) 评论(0) 推荐(0)
摘要:1、环境搭建2、创建工程 2.1 VS2012运行 2.2 Android实体机运行1、环境搭建安装工具: 1.1、JDK 1.2、Android SDK 1.3、Android NDK 1.4、apache-ant 1.5、Python 1.6 coco2d-x-3.1.11.1、JDK安装与配置... 阅读全文
posted @ 2014-10-23 07:30 wuhn 阅读(389) 评论(0) 推荐(0)
摘要:pathmunge () { case ":${PATH}:" in *:"$1":*) ;; *) if [ "$2" = "after" ] ; then PATH=$PATH:$1 ... 阅读全文
posted @ 2014-10-23 00:10 wuhn 阅读(1892) 评论(0) 推荐(0)
摘要:Acommand-line interface(CLI), also known ascommand-line user interface,console user interface,andcharacter user interface(CUI), is a means of interact... 阅读全文
posted @ 2014-10-22 22:38 wuhn 阅读(390) 评论(0) 推荐(0)
摘要:bash中的变量动不动就说环境变量,真是奇怪,bash只是一个c语言编写的程序而已,跟环境变量有什么关系?如果知道dos的历史的话就知道有个时代是只有命令行界面而没有图形用户界面,这只小小的程序就包揽了所有你想要对操作系统进行的操作,你想要做任何事情也只能通过bash;但是当图形界面出来之后呢?ba... 阅读全文
posted @ 2014-10-22 21:34 wuhn 阅读(260) 评论(0) 推荐(0)
摘要:http://getcomposer.org/Composer-Setup.exe修改C:\wamp\bin\php\php5.3.10中php.ini中的配置在php.ini中开启php_openssl,php_fileinfo扩展 阅读全文
posted @ 2014-10-22 19:51 wuhn 阅读(509) 评论(0) 推荐(0)
摘要:最早Git是在Linux上开发的,很长一段时间内,Git也只能在Linux和Unix系统上跑。不过,慢慢地有人把它移植到了Windows上。现在,Git可以在Linux、Unix、Mac和Windows这几大平台上正常运行了。要使用Git,第一步当然是安装Git了。根据你当前使用的平台来阅读下面的文... 阅读全文
posted @ 2014-10-21 23:38 wuhn 阅读(146) 评论(0) 推荐(0)
摘要:Linus一直痛恨的CVS及SVN都是集中式的版本控制系统,而Git是分布式版本控制系统,集中式和分布式版本控制系统有什么区别呢?先说集中式版本控制系统,版本库是集中存放在中央服务器的,而干活的时候,用的都是自己的电脑,所以要先从中央服务器取得最新的版本,然后开始干活,干完活了,再把自己的活推送给中... 阅读全文
posted @ 2014-10-21 23:35 wuhn 阅读(143) 评论(0) 推荐(0)
摘要:Linus在1991年创建了开源的Linux,从此,Linux系统不断发展,已经成为最大的服务器系统软件了。Linus虽然创建了Linux,但Linux的壮大是靠全世界热心的志愿者参与的,这么多人在世界各地为Linux编写代码,那Linux的代码是如何管理的呢?事实是,在2002年以前,世界各地的志... 阅读全文
posted @ 2014-10-21 23:33 wuhn 阅读(170) 评论(0) 推荐(0)
摘要:Git是目前世界上最先进的分布式版本控制系统(没有之一)。那什么是版本控制系统?如果你用Microsoft Word写过长篇大论,那你一定有这样的经历:想删除一个段落,又怕将来想恢复找不回来怎么办?有办法,先把当前文件“另存为……”一个新的Word文件,再接着改,改到一定程度,再“另存为……”一个新... 阅读全文
posted @ 2014-10-21 23:24 wuhn 阅读(125) 评论(0) 推荐(0)
摘要:In the docs for the constructorInetSocketAddress(int port)it says:Creates a socket address where the IP address is the wildcard address and the port n... 阅读全文
posted @ 2014-10-21 03:35 wuhn 阅读(996) 评论(0) 推荐(1)
摘要:I need a monitor class that regularly checks whether a given HTTP URL is available. I can take care of the "regularly" part using the Spring TaskExecu... 阅读全文
posted @ 2014-10-21 03:27 wuhn 阅读(586) 评论(0) 推荐(0)
摘要:I am trying to convert an address specified by an IP number or a name, both in String (i.e.localhostor127.0.0.1), into anInetAdressobject. There's no ... 阅读全文
posted @ 2014-10-21 03:13 wuhn 阅读(202) 评论(0) 推荐(0)
摘要:The InetAddress class can be used to perform Domain Name Server (DNS) lookups. For example, you can call the static InetAddress.getByName("www.teamcak... 阅读全文
posted @ 2014-10-21 03:09 wuhn 阅读(317) 评论(0) 推荐(0)
摘要:TheInetAddressclass has no visible constructors. To create anInetAddressobject, you have to use one of the available factory methods.Factory methodsar... 阅读全文
posted @ 2014-10-21 03:03 wuhn 阅读(433) 评论(0) 推荐(0)
摘要:Modern applications often need the ability to learn information about hosts out on the network. One key class in this process for Java developers is t... 阅读全文
posted @ 2014-10-21 02:56 wuhn 阅读(180) 评论(0) 推荐(0)
摘要:TheInetAddressis Java's representation of an IP address. Instances of this class are used together withUDP DatagramSocketsand normalSocket'sandServerS... 阅读全文
posted @ 2014-10-21 02:43 wuhn 阅读(176) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2014-10-21 00:27 wuhn 阅读(128) 评论(0) 推荐(0)
摘要:字体对input的影响 效果: 效果:一个看起来还行的input输入框 阅读全文
posted @ 2014-10-21 00:20 wuhn 阅读(338) 评论(0) 推荐(0)
摘要:很简单的一个登陆界面:代码: ... 阅读全文
posted @ 2014-10-20 22:01 wuhn 阅读(301) 评论(0) 推荐(0)
摘要:---恢复内容开始---如果我们想要给图形上色,有两个重要的属性可以做到:fillStyle 和 strokeStyle。fillStyle = colorstrokeStyle = colorstrokeStyle 是用于设置图形轮廓的颜色,而 fillStyle 用于设置填充颜色。color 可... 阅读全文
posted @ 2014-10-19 18:10 wuhn 阅读(8064) 评论(0) 推荐(0)
摘要:如果明白数组其实就是map的话,我想你就会明白array_merge为什么要这么实现了PHP中合并数组分成两种情况1、如果这两个数组中有相同的字符串键名:'linux服务器配置与管理','php'=>'PHP程序设计'); $book2 = array('linux'=>'服务器配置与管理','js... 阅读全文
posted @ 2014-10-19 13:53 wuhn 阅读(202) 评论(0) 推荐(0)
摘要:可以画个1/4之一的圆也可以画整个圆 效果:也可以画个半圆 阅读全文
posted @ 2014-10-19 13:52 wuhn 阅读(264) 评论(0) 推荐(0)
摘要:$array[]从11开始 阅读全文
posted @ 2014-10-19 13:13 wuhn 阅读(904) 评论(0) 推荐(0)
摘要:C:\wamp\bin\apache\Apache2.2.21\bin>ab.exe -n5 -c5 http://www.baidu.comab.exe: invalid URLUsage: ab.exe [options] [http://]hostname[:port]/pathOptions... 阅读全文
posted @ 2014-10-19 12:55 wuhn 阅读(313) 评论(0) 推荐(0)
摘要:不要指定border-width属性: 效果:去掉border-width属性 效果:怎么是106和106?去掉border-style: solid; 所以如果你想要在:before中画一个圆,则必须让:before是一个block 阅读全文
posted @ 2014-10-19 00:08 wuhn 阅读(598) 评论(0) 推荐(0)
摘要:I would like to retrieve the content of a url. Similar to pythons:html_content = urllib.urlopen("http://www.test.com/test.html").read()In examples(jav... 阅读全文
posted @ 2014-10-18 14:09 wuhn 阅读(347) 评论(0) 推荐(0)
摘要:In Java it is possible to restrict access to specific functions like reading/writing files and system properties, thread control, networking, object s... 阅读全文
posted @ 2014-10-18 01:10 wuhn 阅读(387) 评论(0) 推荐(0)
摘要:If the current directory of the application. If e.g. you create a File by usingnew FileOutputStream("myfile")then it is created in the "current" direc... 阅读全文
posted @ 2014-10-17 00:50 wuhn 阅读(167) 评论(0) 推荐(0)
摘要:看到像上图这样的 tip 的小三角,你会怎么办?切个图上去?恩,不错,简单,兼容性也一级棒,不但好控制,那点小东西也增加不了多少图片的大小。但有没有更好更讲究技巧的办法呢?哈哈,那必须有啊,而且还不止一种呢:)纯 CSS 做三角形的方法,目前我知道三种,分别是利用 border 属性,“◆”字符,和... 阅读全文
posted @ 2014-10-17 00:41 wuhn 阅读(2075) 评论(0) 推荐(0)
摘要:给定的html代码是: 平常实现我们常是通过添加小的icon来实现,不仅需要添加图片资源,还需要改动html结构。 CSS伪元素 css中伪元素有四个,分别是:first-line,:first-letter,:before,:after。其中前两个分别选择... 阅读全文
posted @ 2014-10-17 00:34 wuhn 阅读(6233) 评论(0) 推荐(0)
摘要://--------------------------------------------------------------------- // Convenience methods for toString output //-----------------------... 阅读全文
posted @ 2014-10-16 05:46 wuhn 阅读(478) 评论(0) 推荐(1)
摘要:加入新的元素到数组中 /** * Append the given object to the given array, returning a new array * consisting of the input array contents plus the given ... 阅读全文
posted @ 2014-10-16 05:27 wuhn 阅读(428) 评论(0) 推荐(0)
摘要:/** * Determine whether the given object is an array: * either an Object array or a primitive array. * @param obj the object to check ... 阅读全文
posted @ 2014-10-16 05:08 wuhn 阅读(27403) 评论(0) 推荐(0)
摘要:/** * Return whether the given throwable is a checked exception: * that is, neither a RuntimeException nor an Error. * @param ex the t... 阅读全文
posted @ 2014-10-16 04:51 wuhn 阅读(2093) 评论(0) 推荐(0)
摘要:/** * Return whether the given throwable is a checked exception: * that is, neither a RuntimeException nor an Error. * @param ex the t... 阅读全文
posted @ 2014-10-16 04:38 wuhn 阅读(648) 评论(0) 推荐(0)
摘要:DescriptionTheJavax.xml.parsers.DocumentBuilder.setEntityResolver(EntityResolver er)method specifies the EntityResolver to be used to resolve entities... 阅读全文
posted @ 2014-10-16 00:41 wuhn 阅读(1370) 评论(0) 推荐(0)
摘要:解析xml有SAX,Stax,dom等方式,那么spring中是如何解析xml文件的呢?Document doc = this.documentLoader.loadDocument( inputSource, getEntityResolver(), this... 阅读全文
posted @ 2014-10-16 00:35 wuhn 阅读(5688) 评论(0) 推荐(0)
摘要:ps由于历史的原因,所以很奇特,有些命令必须加"-",比如:ps A上面的写法是错误的********* simple selection ********* ********* selection by list *********-A all processes ... 阅读全文
posted @ 2014-10-15 21:32 wuhn 阅读(1684) 评论(0) 推荐(0)
摘要:SRPM 的使用 : rpmbuild包含Source code 的 SRPM新版的 rpm 已经将 RPM 与 SRPM 的命令分开了,SRPM 使用的是 rpmbuild 这个命令,而不是 rpm !如果你是 Red Hat 7.3 以前的用户,那么请使用 rpm 来替代 rpmbuild !利... 阅读全文
posted @ 2014-10-15 21:32 wuhn 阅读(466) 评论(0) 推荐(0)
摘要:因为Python是跨平台的,它可以运行在Windows、Mac和各种Linux/Unix系统上。在Windows上写Python程序,放到Linux上也是能够运行的。要开始学习Python编程,首先就得把Python安装到你的电脑里。安装后,你会得到Python解释器(就是负责运行Python程序的... 阅读全文
posted @ 2014-10-15 21:31 wuhn 阅读(218) 评论(0) 推荐(0)
摘要:Guido van Rossum 1989年圣诞节期间C语言是可以用来编写操作系统的贴近硬件的语言,所以,C语言适合开发那些追求运行速度、充分发挥硬件性能的程序。而Python是用来编写应用程序的高级编程语言。当你用一种语言开始作真正的软件开发时,你除了编写代码外,还需要很多基本的已经写好的现成的东... 阅读全文
posted @ 2014-10-15 21:29 wuhn 阅读(184) 评论(0) 推荐(0)
摘要:Python是一种计算机程序设计语言。用任何编程语言来开发程序,都是为了让计算机干活,比如下载一个MP3,编写一个文档等等,而计算机干活的 CPU只认识机器指令,所以,尽管不同的编程语言差异极大,最后都得“翻译”成CPU可以执行的机器指令。而不同的编程语言,干同一个活,编写的代码量, 差距也很大。比... 阅读全文
posted @ 2014-10-15 21:27 wuhn 阅读(228) 评论(0) 推荐(0)
摘要:数据封装、继承和多态只是面向对象程序设计中最基础的3个概念。在Python中,面向对象还有很多高级特性,允许我们写出非常强大的功能。我们会讨论多重继承、定制类、元类等概念。 阅读全文
posted @ 2014-10-15 21:19 wuhn 阅读(211) 评论(0) 推荐(0)
摘要:Adding support for multiple style sheetsThis month our hardworking columnist(专栏作家) adds support for multiple style sheets to the XM content-management... 阅读全文
posted @ 2014-10-15 19:17 wuhn 阅读(162) 评论(0) 推荐(0)
摘要:Consider this XML filehowto.xml: Java http://www.rgagnon.com/topics/java-xml.html PowerBuilder http://www.rgagnon.com/topics... 阅读全文
posted @ 2014-10-15 19:16 wuhn 阅读(342) 评论(0) 推荐(0)
摘要:#import @interface ClassVirable : NSObject{ NSInteger year;//保护树形}@property int age;//不用在实现文件中写@synthesize age就会有setAge:和age方法了-(void)set:(NSIntege... 阅读全文
posted @ 2014-10-15 09:34 wuhn 阅读(225) 评论(0) 推荐(0)
摘要:工作管理 (job control)这个工作管理 (job control) 是用在 bash 环境下的,也就是说:『当我们登陆系统取得 bash shell 之后,在单一终端机介面下同时进行多个工作的行为管理 』。举例来说,我们在登陆 bash 后, 想要一边复制文件、一边进行数据搜寻、一边进行编... 阅读全文
posted @ 2014-10-15 08:06 wuhn 阅读(257) 评论(0) 推荐(0)
摘要:---恢复内容开始---什么是程序 (process)在 Linux 底下所有的命令与你能够进行的动作都与权限有关, 而系统依据UID/GID以及文件的属性相关性判定你的权限!在 Linux 系统当中:『触发任何一个事件时,系统都会将他定义成为一个程序,并且给予这个程序一个 ID ,称为 PID... 阅读全文
posted @ 2014-10-15 07:36 wuhn 阅读(310) 评论(0) 推荐(0)
摘要:Bash 支持很多运算符,包括算数运算符、关系运算符、布尔运算符、字符串运算符和文件测试运算符。原生bash不支持简单的数学运算,但是可以通过其他命令来实现,例如 awk 和 expr,expr 最常用。原生的bash到底支持不支持数学计算我不清楚了,不过也这样做到一样的效果:#!/bin/bash... 阅读全文
posted @ 2014-10-15 00:56 wuhn 阅读(516) 评论(0) 推荐(0)
摘要:Shell在编程方面比Windows批处理强大很多,无论是在循环、运算。bash支持一维数组(不支持多维数组),并且没有限定数组的大小。类似与C语言,数组元素的下标由0开始编号。获取数组中的元素要利用下标,下标可以是整数或算术表达式,其值应大于或等于0。 定义数组在Shell中,用括号来表示数组,数... 阅读全文
posted @ 2014-10-14 23:10 wuhn 阅读(20511) 评论(0) 推荐(1)
摘要:打开文本编辑器,新建一个文件,扩展名为sh(sh代表shell),扩展名并不影响脚本执行,见名知意就好,如果你用php写shell 脚本,扩展名就用php好了。输入一些代码:#!/bin/bashecho "Hello World!"“#!” 是一个约定的标记,它告诉系统这个脚本需要什么解释器来执行... 阅读全文
posted @ 2014-10-14 23:00 wuhn 阅读(168) 评论(0) 推荐(0)
摘要:因为Shell似乎是各UNIX系统之间通用的功能,并且经过了POSIX的标准化。因此,Shell脚本只要“用心写”一次,即可应用到很多系统上。因此,之所以要使用Shell脚本是基于:简单性:Shell是一个高级语言;通过它,你可以简洁地表达复杂的操作。可移植性:使用POSIX所定义的功能,可以做到脚... 阅读全文
posted @ 2014-10-14 22:55 wuhn 阅读(279) 评论(0) 推荐(0)
摘要:大体上,可以将程序设计语言可以分为两类:编译型语言和解释型语言。编译型语言很多传统的程序设计语言,例如Fortran、Ada、Pascal、C、C++和Java,都是编译型语言。这类语言需要预先将我们写好的源代码(source code)转换成目标代码(object code),这个过程被称作“编译... 阅读全文
posted @ 2014-10-14 22:54 wuhn 阅读(247) 评论(0) 推荐(0)
摘要:上面提到过,Shell是一种脚本语言,那么,就必须有解释器来执行这些脚本。Unix/Linux上常见的Shell脚本解释器有bash、sh、csh、ksh等,习惯上把它们称作一种Shell。我们常说有多少种Shell,其实说的是Shell脚本解释器。 bashbash是Linux标准默认的shell... 阅读全文
posted @ 2014-10-14 22:52 wuhn 阅读(316) 评论(0) 推荐(0)
摘要:Shell本身是一个用C语言编写的程序,它是用户使用Unix/Linux的桥梁,用户的大部分工作都是通过Shell完成的。Shell既是一种命令语言,又是一种程序设计语言。作为命令语言,它交互式地解释和执行用户输入的命令;作为程序设计语言,它定义了各种变量和参数,并提供了许多在高级语言中才具有的控制... 阅读全文
posted @ 2014-10-14 22:51 wuhn 阅读(439) 评论(0) 推荐(0)
摘要:前面已经讲到,变量名只能包含数字、字母和下划线,因为某些包含其他字符的变量有特殊含义,这样的变量被称为特殊变量。例如,$ 表示当前Shell进程的ID,即pid,看下面的代码: $echo $$特殊变量列表变量含义$0当前脚本的文件名$n传递给脚本或函数的参数。n 是一个数字,表示第几个参数... 阅读全文
posted @ 2014-10-14 07:54 wuhn 阅读(386) 评论(0) 推荐(0)
摘要:注释 Ctrl+/能为光标"所在行"或者"选中行"添加注释或者取消注释。 也可以对多行添加或取消注释快速修复 Ctrl + 1删除当前行 Ctrl+d光标位于行的任何地方, 按Ctrl+D 删除当前行, 当然也可以删除空行, 不用为了删除行,而按很多删除键了格式化整个文档 Ctrl+Shift+... 阅读全文
posted @ 2014-10-14 07:35 wuhn 阅读(172) 评论(0) 推荐(0)
摘要:在Shell中,调用函数时可以向其传递参数。在函数体内部,通过 $n 的形式来获取参数的值,例如,$1表示第一个参数,$2表示第二个参数...带参数的函数示例:#!/bin/bashfunWithParam(){ echo "The value of the first paramter is... 阅读全文
posted @ 2014-10-14 02:48 wuhn 阅读(2771) 评论(0) 推荐(0)
摘要:函数可以让我们将一个复杂功能划分成若干模块,让程序结构更加清晰,代码重复利用率更高。像其他编程语言一样,Shell 也支持函数。Shell 函数必须先定义后使用。Shell 函数的定义格式如下:function_name () { list of commands [ return va... 阅读全文
posted @ 2014-10-14 02:43 wuhn 阅读(1316) 评论(0) 推荐(0)
摘要:在循环过程中,有时候需要在未达到循环结束条件时强制跳出循环,像大多数编程语言一样,Shell也使用 break 和 continue 来跳出循环。break命令break命令允许跳出所有循环(终止执行后面的所有循环)。下面的例子中,脚本进入死循环直至用户输入数字大于5。要跳出这个循环,返回到shel... 阅读全文
posted @ 2014-10-14 02:28 wuhn 阅读(434) 评论(0) 推荐(0)
摘要:until 循环执行一系列命令直至条件为 true 时停止。until 循环与 while 循环在处理方式上刚好相反。一般while循环优于until循环,但在某些时候,也只是极少数情况下,until 循环更加有用。until 循环格式为:until commanddo Statement(s)... 阅读全文
posted @ 2014-10-14 02:13 wuhn 阅读(336) 评论(0) 推荐(0)
摘要:while循环用于不断执行一系列命令,也用于从输入文件中读取数据;命令通常为测试条件。其格式为:while commanddo Statement(s) to be executed if command is truedone命令执行完毕,控制返回循环顶部,从头开始直至测试条件为假。以下是一个... 阅读全文
posted @ 2014-10-14 02:10 wuhn 阅读(3600) 评论(0) 推荐(0)
摘要:How do I use bash for loop to repeat certain task under Linux / UNIX operating system? How do I set infinite loops using for statement? How do I use t... 阅读全文
posted @ 2014-10-14 02:04 wuhn 阅读(621) 评论(0) 推荐(0)
摘要:echo -e "a\tb\tc\nd\te\tf"加-e 阅读全文
posted @ 2014-10-14 01:31 wuhn 阅读(8118) 评论(0) 推荐(0)
摘要:#!/bin/bashnum1=1num2=2num3=3#echo $($num1+$num2+$num3)#错误写法echo $[$num1+$num2+$num3]echo $(($num1+$num2+$num3))echo $(expr $num1 + $num2 + $num3 ) 阅读全文
posted @ 2014-10-14 01:30 wuhn 阅读(5652) 评论(0) 推荐(0)
摘要::<<EOF注释的代码...EOF单行是# 阅读全文
posted @ 2014-10-14 01:26 wuhn 阅读(925) 评论(0) 推荐(0)
摘要:与其他编程语言类似,Shell支持for循环。for循环一般格式为:for 变量 in 列表do command1 command2 ... commandNdone列表是一组值(数字、字符串等)组成的序列,每个值通过空格分隔。每循环一次,就将列表中的下一个值赋给变量。in ... 阅读全文
posted @ 2014-10-14 01:21 wuhn 阅读(6896) 评论(0) 推荐(0)
摘要:case ... esac 与其他语言中的 switch ... case 语句类似,是一种多分枝选择结构。case 语句匹配一个值或一个模式,如果匹配成功,执行相匹配的命令。case语句格式如下:case 值 in模式1) command1 command2 command3 ... 阅读全文
posted @ 2014-10-14 00:50 wuhn 阅读(397) 评论(0) 推荐(0)
摘要:if 语句通过关系运算符判断表达式的真假来决定执行哪个分支。Shell 有三种 if ... else 语句:if ... fi 语句;if ... else ... fi 语句;if ... elif ... else ... fi 语句。1) if ... else 语句if ... else ... 阅读全文
posted @ 2014-10-14 00:23 wuhn 阅读(586) 评论(0) 推荐(0)
摘要:centos 6 使用的是 rsyslog 而 centos5 使用 syslog ,兩個不同版本使用軟體不同。因此,你得要修訂 /etc/rsyslog.conf 才行!軟體也變成 /etc/init.d/rsyslog! 阅读全文
posted @ 2014-10-13 23:40 wuhn 阅读(2137) 评论(0) 推荐(0)
摘要:什么是 daemon 与服务 (service)Linux Daemon (守护进程)是运行在后台的一种特殊进程。它独立于控制终端并且周期性地执行某种任务或等待处理某些事件。它不需要用户输入就能运行并且提供某种服 务,不是对整个系统就是对某个用户程序提供服务。 Linux 系统的大多数服务器就是通过... 阅读全文
posted @ 2014-10-13 23:30 wuhn 阅读(714) 评论(0) 推荐(0)
摘要:HTML5的标题HTML5的内容!Hello我是用记事本写的,保存后在网页上运行竟然出现了乱码。换成GB2312能正确显示中文。HTML5的标题HTML5的内容!Hello但是毕竟标准不一样。还是要用Utf-8。最后发现代码没有一点问题,问题就出记事本身上。 只是告诉浏览器要用utf-8来解释,而文... 阅读全文
posted @ 2014-10-12 18:54 wuhn 阅读(539) 评论(0) 推荐(0)
摘要:java跟python类似的做法,在java中字符串的编码是java修改过的一种Unicode编码,所以看到java中的字符串,心理要默念这个东西是java修改过的一种Unicode编码的编码。package string;import java.nio.charset.Charset;public... 阅读全文
posted @ 2014-10-12 18:30 wuhn 阅读(29690) 评论(0) 推荐(0)
摘要:In order to check XML data for validity we have to prepare its schema XSD-file. This file will be loaded by a JAXP package to a Schema objects instanc... 阅读全文
posted @ 2014-10-12 17:57 wuhn 阅读(302) 评论(0) 推荐(0)
摘要:The SAX and DOM APIs are defined by the XML-DEV group and by the W3C, respectively. The libraries that define those APIs are as follows:javax.xml.pars... 阅读全文
posted @ 2014-10-12 17:50 wuhn 阅读(126) 评论(0) 推荐(0)
摘要:The Java API for XML Processing (JAXP) is for processing XML data using applications written in the Java programming language. JAXP leverages the pars... 阅读全文
posted @ 2014-10-12 17:43 wuhn 阅读(118) 评论(0) 推荐(0)
摘要:Configure Java APIs (SAX, DOM, dom4j, XOM) using JAXP 1.3 to validate XML Documents with DTD and Schema(s).Many Java XML APIs provide mechanisms to va... 阅读全文
posted @ 2014-10-12 15:30 wuhn 阅读(345) 评论(0) 推荐(1)
摘要:JSONJavaScript Object Notation (JSON) is an open, human and machine-readable standard that facilitates data interchange, and along with XML is the mai... 阅读全文
posted @ 2014-10-12 12:13 wuhn 阅读(667) 评论(0) 推荐(0)
摘要:Exception in thread "main" java.net.UnknownHostException: file at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178) at ... 阅读全文
posted @ 2014-10-11 01:29 wuhn 阅读(3045) 评论(0) 推荐(0)
摘要:It is possible to turn on XML Schema validation during parsing with a SAXParser. Here is how it looks:Schema schema = null;try { String language = XM... 阅读全文
posted @ 2014-10-10 22:15 wuhn 阅读(290) 评论(0) 推荐(0)
摘要:This package provides the core SAX APIs. Some SAX1 APIs are deprecated to encourage integration(集成;综合) of namespace-awareness into designs of new appl... 阅读全文
posted @ 2014-10-10 20:51 wuhn 阅读(293) 评论(0) 推荐(0)
摘要:MongoDB is very powerful, but it is still easy to get started with. In this chapter we’llintroduce some of the basic concepts of MongoDB:• A document ... 阅读全文
posted @ 2014-10-10 03:05 wuhn 阅读(467) 评论(0) 推荐(0)
摘要:OverviewUse this tutorial to install MongoDB on a Windows systems.PLATFORM SUPPORTStarting in version 2.2, MongoDB does not support Windows XP. Please... 阅读全文
posted @ 2014-10-10 02:32 wuhn 阅读(433) 评论(0) 推荐(0)
摘要:MongoDB is a powerful, flexible, and scalable data store. It combines the ability toscale out with many of the most useful features of relational data... 阅读全文
posted @ 2014-10-10 00:23 wuhn 阅读(248) 评论(0) 推荐(0)
摘要:JavaScriptis aclass-free, object-oriented language, and as such, it uses prototypal inheritance instead of classical inheritance. This can be puzzling... 阅读全文
posted @ 2014-10-06 04:11 wuhn 阅读(197) 评论(0) 推荐(0)
摘要:JavaScript is all about objects. Objects are the foundation of everything, so if you’reunfamiliar with objects, you’re going to learn quickly. The goa... 阅读全文
posted @ 2014-10-06 03:54 wuhn 阅读(173) 评论(0) 推荐(0)
摘要:在一个Web App中,所有数据,包括用户信息、发布的日志、评论等,都存储在数据库中。在awesome-python-app中,我们选择MySQL作为数据库。Web App里面有很多地方都要访问数据库。访问数据库需要创建数据库连接、游标对象,然后执行SQL语句,最后处理异常,清理资源。这些访问数据库... 阅读全文
posted @ 2014-10-05 23:18 wuhn 阅读(863) 评论(0) 推荐(0)
摘要:在python用import或者from...import来导入相应的模块。模块其实就是一些函数和类的集合文件,它能实现一些相应的功能,当我们需要使用这些功能的时候,直接把相应的模块导入到我们的程序中,我们就可以使用了。这类似于C语言中的include头文件,Python中我们用import导入我们... 阅读全文
posted @ 2014-10-05 22:40 wuhn 阅读(423) 评论(0) 推荐(0)
摘要:搭建开发环境首先,确认系统安装的Python版本是2.7.x:$ python --versionPython 2.7.5然后,安装开发Web App需要的第三方库:前端模板引擎jinja2:$ easy_install jinja2MySQL 5.x数据库,从官方网站下载并安装,安装完毕后,请务必... 阅读全文
posted @ 2014-10-05 18:00 wuhn 阅读(352) 评论(0) 推荐(0)
摘要:用Python写一个真正的Web App!目标我们设定的实战目标是一个Blog网站,包含日志、用户和评论3大部分。比如webpy.org上就提供了一个Blog的例子,目测也就100行代码。我们要写出用户真正看得上眼的页面,首页长得像这样:评论区:还有极其强大的后台管理页面:项目名称必须是高端大气上档... 阅读全文
posted @ 2014-10-05 17:57 wuhn 阅读(543) 评论(0) 推荐(0)
摘要:Python 里面的编码和解码也就是 unicode 和 str 这两种形式的相互转化。编码是 unicode -> str,相反的,解码就是 str -> unicode。剩下的问题就是确定何时需要进行编码或者解码了.关于文件开头的"编码指示",也就是 # -*- coding: -*- 这个语句... 阅读全文
posted @ 2014-10-05 17:34 wuhn 阅读(288) 评论(0) 推荐(0)
摘要:字符串是要用引号(双引号,单引号,多行用三个引号)引起来TypeError: not enough arguments for format stringyou have to specify multiple arguments as tuple, egprint "%d %s of beer o... 阅读全文
posted @ 2014-10-05 17:29 wuhn 阅读(2428) 评论(0) 推荐(0)
摘要:You’re excited; your client is excited. All is well. You’ve just launched the client’slatest website, and it’s fantastic. You’ve put in hours of sweat... 阅读全文
posted @ 2014-10-05 13:28 wuhn 阅读(265) 评论(0) 推荐(0)
摘要:“Programs are meant to be read by humans and only incidentally(顺便;偶然地;附带地) for computers to execute.” —Donald KnuthWhen a team is brought together(被放在... 阅读全文
posted @ 2014-10-05 13:08 wuhn 阅读(198) 评论(0) 推荐(0)
摘要:JQuery的extend扩展方法: Jquery的扩展方法extend是我们在写插件的过程中常用的方法,该方法有一些重载原型,在此,我们一起去了解了解。一、Jquery的扩展方法原型是: extend(dest,src1,src2,src3...); 它的含义是将src1,src2,src3...... 阅读全文
posted @ 2014-10-05 03:04 wuhn 阅读(169) 评论(0) 推荐(0)
摘要:object type.html:26undefined type.html:27null type.html:28undefined type.html:29undefined type.html:30undefined 阅读全文
posted @ 2014-10-05 02:45 wuhn 阅读(291) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2014-10-05 02:25 wuhn 阅读(445) 评论(0) 推荐(0)
摘要:今天遇到一个 IE7 下 JSON.parse 失败的问题。经过排查发现:服务端某个配置文件编码是UTF-8 + BOM,输出的字符串最开始包含了 BOM 字符,不是合法的 JSON。IE7 不支持原生 JSON,我们项目中使用的是json2.js,但解析不了开头有 BOM 字符的 JSON 不是 ... 阅读全文
posted @ 2014-10-05 02:13 wuhn 阅读(762) 评论(0) 推荐(0)
摘要:TypesEquality and ComparisonsJavaScript has two different ways of comparing the values of objects for equality.The Equality OperatorThe equality opera... 阅读全文
posted @ 2014-10-05 01:04 wuhn 阅读(252) 评论(0) 推荐(0)
摘要:ObjectsObject Usage and PropertiesEverything in JavaScript acts like an object, with the only two exceptions beingnullandundefined.false.toString(); /... 阅读全文
posted @ 2014-10-05 00:49 wuhn 阅读(418) 评论(0) 推荐(0)
摘要:Although JavaScript is very powerful, the language’s fundamentals do not have a very steep learning curve. Prior to the explosion of web applications,... 阅读全文
posted @ 2014-10-05 00:27 wuhn 阅读(328) 评论(0) 推荐(0)
摘要:Are you baffled(阻碍;使迷惑) by thenewoperator in JavaScript? Wonder what the difference between a function and a constructor is? Or what the heck a protot... 阅读全文
posted @ 2014-10-04 23:40 wuhn 阅读(251) 评论(0) 推荐(0)