随笔分类 -  CS Background

 
About Closure
摘要:Closure被翻译为闭包,C++11引入了Lambda表达式支持Closure,JavaScript支持Closure,Objective C支持Blocks,他们都是Closure,名字各有不同,可是Closure到底有什么用呢?为什么C++11要引入这个东西呢? 按照Wikipedia上的总结,他们都可以统统被叫做Anonymous Function(匿名函数),这样一说,可能很多人就变得没... 阅读全文
posted @ 2014-04-20 07:41 做个不善的人 阅读(241) 评论(0) 推荐(0)
关于文件压缩的一些小知识
摘要:以前也没研究过这些,很多时候也搞不太清楚他们之间的关系,今天把以前遇到的问题一一揭开.ZUnix Shell的一个程序compress基于LZC算法将文件压缩,typically,被压缩的文件后缀是.z。Most tar programs will pipe their data through compress when given the command line option "-Z".ZIPZIP是一种支持无损压缩的文件格式,A .ZIP file may contain one or more files or folders that may have been 阅读全文
posted @ 2014-03-19 02:44 做个不善的人 阅读(727) 评论(0) 推荐(0)
Unichar, char, wchar_t
摘要:之前总结了一些关于字符表示,以及字符串的知识。现在在看看一些关于编译器支持的知识。L"" Prefix几乎所有的编译器都支持L“” prefix,一个字符串如果带有L“”prefix,意味着这个字符串中的字符都被作为wide char存储,但是根据OS的不同这里的wide char又各有不同,比如在Windows上默认使用UTF-16表达Unicode,而MacOSx和Linux使用UTF-32表达Unicode,也就是默认情况下:wchar_t在Windows可用于存储UTF-16的字符,长度为2个字节;而在Linux上往往用于存储UTF-32在字符,长度为4个字节。尽管 阅读全文
posted @ 2013-10-25 05:07 做个不善的人 阅读(3575) 评论(0) 推荐(0)
命名法
摘要:常用的命名法有匈牙利命名法、驼峰式命名法和Pascal命名法。驼峰式命名法和Pascal命名法有些相似,单字之间不用任何连接符号隔开( - 和 _ 等)连结,有两种格式:小驼峰式命名法(lower camel case):第一个单字以小写字母开始;第二个单字的首字母大写,例如:firstName、lastName。大驼峰式命名法(upper camel case):每一个单字的首字母都采用大写字母,例如:FirstName、LastName、CamelCase,也被称为Pascal命名法。本文重点说说匈牙利命名法,这种命名方法很适合在C++程序中使用。下面分变量和函数名来分别说明。变量,基本结 阅读全文
posted @ 2013-05-20 03:26 做个不善的人 阅读(556) 评论(0) 推荐(0)
Algorithms in Cryptography
摘要:先介绍几个跟算法相关的基本概念。 block cipher In cryptography, a block cipher is a deterministic algorithm operating on fixed-length groups of bits, called blocks, with an unvarying transformation that is specified b... 阅读全文
posted @ 2013-03-26 16:29 做个不善的人 阅读(448) 评论(0) 推荐(0)
理解ABI
摘要:An application binary interface (ABI) describes the low-level interface between a computer program and the operating system or another program. An embedded-application binary interface (EABI) specifie... 阅读全文
posted @ 2013-02-05 17:05 做个不善的人 阅读(1358) 评论(0) 推荐(0)
计算机基础知识问答
摘要:线程和进程的区别和联系(What's the difference between process and thread? What kind of information does thread maintain? its own stack? heap?How and when to do a context switch? How do you handle an time slice i... 阅读全文
posted @ 2012-11-25 11:30 做个不善的人 阅读(209) 评论(0) 推荐(0)
(zz)Why Memory Barrier
摘要:原文:http://sstompkins.wordpress.com/2011/04/12/why-memory-barrier%EF%BC%9F/ 要了解如何使用memory barrier,最好的方法是明白它为什么存在。CPU硬件设计为了提高指令的执行速度,增设了两个缓冲区(store buffer, invalidate queue)。这个两个缓冲区可以避免CPU在某些情况下进行不必要的等待... 阅读全文
posted @ 2012-11-07 16:14 做个不善的人 阅读(4020) 评论(1) 推荐(0)
锁的理解
摘要:内核同步机制 原子变量 自旋锁 Semaphore 用户态同步机制 自旋锁 自旋锁是专为防止多处理器并发而引入的一种锁,它在内核中大量应用于中断处理等部分(对于单处理器来说,防止中断处理中的并发可简单采用关闭中断的方式,即在标志寄存器中关闭/打开中断标志位,不需要自旋锁)。 何谓自旋锁?它是为实现保护共享资源而提出一种锁机制。其实,自旋锁与互斥锁比较类似,它们都是为了解决对某项资源的互... 阅读全文
posted @ 2012-10-02 16:23 做个不善的人 阅读(267) 评论(0) 推荐(0)
数组
摘要:在C和C++语言中,声明数组时[]是放在标识符的后面的,比如下面的方式: int a[10]; char b[3]={‘a’,’b’,’c’}; 下面是不合法的: float c[n]; 因为C中不支持动态数组,而C++支持,动态数组的声明方式如下: float *d = new float[m]; 但下面的方式是不合法的: float d[] = new float[m]; 在C#中声明数组... 阅读全文
posted @ 2012-06-28 14:32 做个不善的人 阅读(176) 评论(0) 推荐(0)
Memory Barrier in Compiler and CPU
摘要:Memory barrier, is a type of barrier and a class of instruction which causes a CPU or compiler to enforce an ordering constraint on memory operations issued before and after the barrier instruction. ... 阅读全文
posted @ 2012-06-24 15:29 做个不善的人 阅读(3661) 评论(0) 推荐(0)
非规格化数字(denormalized numbers)
摘要:In computer science, denormal numbers or denormalized numbers (now often called subnormal numbers) fill the underflow gap around zero in floating point arithmetic: any non-zero number which is smaller than the smallest normal number is 'sub-normal'.In a normal floating point value there are 阅读全文
posted @ 2012-05-11 18:49 做个不善的人 阅读(5501) 评论(0) 推荐(0)
Kerberos
摘要:Basic Concepts in Kerberos Kerberos client, Kerberos server, application server In Kerberos, all authentication takes place between clients and servers. So in Kerberos terminology, a "Kerberos client"... 阅读全文
posted @ 2012-05-10 19:50 做个不善的人 阅读(313) 评论(0) 推荐(0)
Basic Digital Certificate
摘要:A certificate is a set of data that identifies an entity. A trusted organization assigns a certificate to an individual or an entity that associates a public key with the individual. The individual or... 阅读全文
posted @ 2012-04-04 22:21 做个不善的人 阅读(467) 评论(0) 推荐(0)
字符编码知识:Unicode、UTF-8、ASCII、GB2312等编码之间是如何转换的?[转]
摘要:转自: http://apps.hi.baidu.com/share/detail/17798660 字符编码是计算机技术的基石,想要熟练使用计算机,就必须懂得字符编码的知识。不注意的人可能对这个不在意,但这些名词有时候实在让人迷惑,对想学习计算机知识的人来说,搞懂它也十分重要,我也是在学习中慢慢了解了一些这方面的知识。 1. ASCII码 在计算机内部,所有的信息最终都表示为一个二进制的字符串。每一个二进制位(bit)有0和1两种状态,因此八个二进制位就可以组合出256种状态,这被称为一个字节(byte)。也就是说,一个字节一共可以用来表示256种不同的状态,每一个状态对应一个符号,就是2. 阅读全文
posted @ 2012-02-05 11:46 做个不善的人 阅读(3837) 评论(0) 推荐(0)
关于线程调度
摘要:Linux中线程调度策略: Normal Policy: SCHED_OTHER: Default Linux time-sharing scheduling SCHED_OTHER can only be used at static priority 0. SCHED_OTHER is the standard Linux time-sharing scheduler that is intended for all processes that do not require the special real-time mechanisms. The... 阅读全文
posted @ 2011-12-18 16:36 做个不善的人 阅读(2637) 评论(0) 推荐(0)
线性系统, 卷积, 线性时不变
摘要:线性系统 对某个特定系统,输入x1(t)产生输出y1(t)即:x1(t)—>y1(t),而对另一个输入x2(t)产生输出y2(t)即:x2(t)—>y2(t)。 这个系统是线性的,当且仅当它满足如下条件:x1(t)+x2(t)—>y1(t)+y2(t)。 卷积 卷积的物理意义: 在生活当中有很多现象都体现了卷积的含义,比如古人钻木取火就是一个很形象的例子。当我们用一根木头与另一根木头接触并钻一下,由于摩擦产生热,在两根木头接触的地方就会发热,但是很明显,就只钻一下,木头是不可能燃起来的,而且随着时间变长,那一点由摩擦产生的热量会一点一点消失掉。妙果我们加快钻的频率,也就是在之 阅读全文
posted @ 2011-04-17 17:39 做个不善的人 阅读(4488) 评论(1) 推荐(0)
Cross-site scripting,XSS
摘要:XSS 是一种很常见的攻击手段,在该攻击中攻击者将一个恶意代码段注入到一个运行良好的站点中。XSS 攻击有如下两种基本的类型: Reflected XSSStored XSSReflected XSSReflected XSS 攻击的前提条件是某Web应用程序会把用户输入的信息不加检查和限制地返回给用户。一个常见的例子就是,用户登录时,输入用户名和密码,比如用户Joe登录,密码错误了,网站会显示Sorry, Joe, Your password is incorrect。网站把用户名直接返回给用户, 如果用户输入了Javascript代码,会直接返回给用户,并造成Javascript代码执行。 阅读全文
posted @ 2010-10-25 20:09 做个不善的人 阅读(1573) 评论(0) 推荐(0)
MMF I/O
摘要:What Do Memory-Mapped Files Have to Offer?One advantage to using MMF I/O is that the system performs all data transfers for it in 4K pages of data. Internally all pages of memory are managed by the virtual-memory manager (VMM). It decides when a page should be paged to disk, which pages are to be fr 阅读全文
posted @ 2010-07-13 15:58 做个不善的人 阅读(374) 评论(0) 推荐(0)
Low-fragmentation Heap
摘要:Heap fragmentation is a state in which available memory is broken into small, noncontiguous blocks. When a heap is fragmented, memory allocation can fail even when the total available memory in the heap is enough to satisfy a request, because no single block of memory is large enough. The low-fragme 阅读全文
posted @ 2010-06-30 14:16 做个不善的人 阅读(1519) 评论(0) 推荐(0)