•  


  • developerdotstar

    2009-11-09

    http://www.developerdotstar.com/mag/articles_top.html

     

  • http://www.developerdotstar.com/mag/articles/art_computer_programming.html

     

  • 乱七八糟

    2009-11-05

    maha distance相当于基于正态分布的概率

    kernel的版本相当于假定高维空间上是正态分布

  • pca

    2009-10-30

    最近pca用的比较多,以前听说过,学过,就是没用过

    现在用了一下,体会深了很多

    算covariance matrix其实也相当于算pca

    算基于cov倒数的距离相当于在pca变换后的对轴进行校正后的距离。

    轴校正后点的分布成为一个圆

    现在的问题是优化计算,每次有大量点和上次重复。只要加上新的点XX‘去除旧的点就可以。均值算是一个点。

    //半夜没睡好,想这个问题去了。

  • 还是语言

    2009-10-28

    以前是这么划分的:

    语法相当于一等公民

    标准库相当于二等公民

    第三方类库相当于三等公民

    现在觉得还得细分

    语法本身也有不同等级

    比如C++里面的exception就明显是个三等公民

    再说类的概念

    类的一种核心概念是自动分配和释放内存

    从某种方面来说这是一种进步

    可是从另外一个方面来说,这是个陷阱

    为什么是陷阱呢?因为机器本身不支持这个概念

    C/C++的机器是硬件

    Java, .net的机器是vm

    动态语言的机器是解释器

    只有机器本身支持的特性才是一等公民

    其他的都是二等公民或者以下

    内存的自动分配是个美好的特性

    但是如果机器本身不支持就成了假冒伪劣

    或者,只是一种模仿秀,而不是真枪实货

    另外,还有机器的数据模型

    硬件机器的数据模型是字节数组

    我这几天总试图用C实现matlab的语法

    发现非常困难

    而基本原因,则是因为矩阵是matlab的一等公民,是机器模型

    而不是硬件机器的数据模型

    另外还有范型

    硬件机器是不支持泛型的

    所以要写出基于范型的函数会非常蹩脚

    C++有模板技术,同样,仅仅是一种模仿

    很简单的

    vector<double>和vector<int>是无法互换的

    只有动态语言才是真正的泛型

    那么将来是否是动态语言的天下呢?

    当然不是

    如果是以前,我也许会这么认为,但是现在再也不会

    感觉新的东西总在变化,但是老的东西基本不怎么变

    机器语言是所有语言的基础,虽然不会再有人用机器语言编程,但只是因为面向硬件的语言替换了它而以

    比如汇编,比如C

    有硬件存在的地方,就有C的用武之地

    C要消失,除非等到硬件消失

    硬件会消失么,当然不可能。所以C的寿命会是最长的。

    再说动态语言,最早流行的动态语言似乎是perl,但现在明显不如python和ruby

    那么将来呢?

    也许会出现很多的领域语言

    再说应用

    从面向应用来说,高级语言似乎总比低级的语言更好

    但现在不这么觉得,原因是硬件资源的限制

    资源优化是一个永恒的主题

    因为资源的稀缺是永恒的

    资源的丰富永远只是一个假相

    而资源,归根结底都是硬件资源

    而优化硬件资源的使用,则必须使用面向硬件的语言

    所以搞我这一个行当,信号处理,一个hyperspectal image就占了800MB。我能用动态语言么?用matlab都是够呛。load了一张图片,就不能load第二张。不仅不能load第二张。做个任何的操作都极可能out of memory。因为matlab里面的对象一般都是copy的。

    所以呢,我看我得回归硬件。

    用C来做传说中的榨干硬件的点滴资源

     

     

  • 乱七八糟

    2009-10-26

    这两天脾气异常暴躁

    不知道是不是身体劳累的缘故

    已经很久没有参加任何的教会活动

    也没有读经,也没有祷告

    以前老婆坐月子的时候嘉嘉再闹,我再累,我也心平气和

    现在嘉嘉调皮起来我开始有些受不了

    前天打了嘉嘉一下后

    我发觉自己已经变成一头可怕的猛兽

    圣经说爱是恒久忍耐

    我却不知不觉中丧失爱的能力

    为什么会这样

    我该怎么办

    我想我必须每天花一些时间在神上面了

     

  • http://www.itwriting.com/blog/?postid=261

    http://kobyk.wordpress.com/2007/07/20/dynamically-linking-with-msvcrtdll-using-visual-c-2005/

    nnd,花了好大劲

    COM模块老是load出错

    现在又体会到静态库的好处了

    动态库看似依赖少了,其实依赖只不过是隐藏起来了。而且把问题从链接拖到了运行。

  • nook

    2009-10-21

    http://news.cnet.com/8301-17938_105-10379125-1.html?tag=newsEditorsPicksArea.0

    基于android

    不知道里面的硬件怎么实现的

    可以预见的是很快有很多类似的平板电脑也会出来

  • 乱七八糟

    2009-10-21

    CPU其实就是一个计算机

    或者,一个程序执行器

    或者,一个程序解释器

    CPU定义了自身的一套语言

    这套语言是所有程序的基础

    和所有的语言都有相似之处

    是最基本,最简单的语言

    几类元素

    变量,数据运算,数据移动,跳转

    这三种元素可以用来描述任何的程序

    函数可以由跳转来实现

    函数相当于数据运算

    只要有了这三样,就有了基本的语言

     

  • Registers

    2009-10-21

    From <<Fundamentals of Computer Organization and Architecture>>

     

    Registers are essentially extremely fast memory locations within the CPU that are

    used to create and store the results of CPU operations and other calculations.

     

    Two registers are essential in memory write and read operations: the memory data

    register (MDR) and memory address register (MAR). The MDR and MAR are used

    exclusively by the CPU and are not directly accessible to programmers.

     

    Two main registers are involved in fetching an instruction for execution: the program

    counter (PC) and the instruction register (IR). The PC is the register that contains

    the address of the next instruction to be fetched. The fetched instruction is

    loaded in the IR for execution. After a successful instruction fetch, the PC is updated

    to point to the next instruction to be executed. In the case of a branch operation, the

    PC is updated to point to the branch target instruction after the branch is resolved,

     

    Condition registers, or flags, are used to maintain status information.

     

     

  • CPU

    2009-10-21

    From <<Fundamentals of Computer Organization and Architecture>>

     

     

    The primary function of the CPU is to execute a set of instructions stored in the computer’s memory. 

     

    A simple CPU consists of a set of registers, an arithmetic logic unit (ALU), and a control

    unit (CU).

     

     

     

    The ALU provides the circuitry needed to perform the arithmetic, logical and shift operations demanded of the instruction set.

     

     

     

    The control unit is the entity responsible for fetching the instruction to be executed from the main

    memory and decoding and then executing it.

     

     

     

    The CPU fetches instructions from memory, reads and writes data from and to

    memory, and transfers data from and to input/output devices.

     

  • X86

    2009-10-21

     

    From <<Fundamentals of Computer Organization and Architecture>>

    The X86 family of processors defines a number of instruction types. Using the

    naming convention introduced before, these instruction types are data movement,

    arithmetic and logic, and sequencing (control transfer).

     

  • pages = Sketchup.active_model.pages

    page = pages.add_matchphoto_page photo camera

    一项期待已久的特性

    如果早点儿出来,当初就不用那么费力绕圈,还不方便

    现在calibration可以单独写一个软件,然后导出camera的参数,再从sketchup里面load进来

    有了这一项,基本上就可以整出专业的基于图像的建模工具了

    以后还可以加上procedure modeling,功能就比sketchup本身的photomatch强大多了

     

  • 作了一个梦

    初中毕业的场景

    大学的人物

    出国的心态

    全部混到一起

    梦见自己在宇宙中飘荡

    不知怎的抓住一只蓝色的懒人拖把

    我知道我拿到了出国的offer

    非常高兴,也非常庆幸

    我回到初中的教室,打开自己的小书桌,一本一本收拾我的书

    屋子里很暗,还有其他的同学

    有些书要寄走,有些书想扔掉,又觉得可惜(这不是几个月前博士毕业搬家时的状态么?)

    书都是高中时那种的辅导材料

    在毫无准备的情况下

    老师宣布我们毕业了

    我觉得有些措手不及

    好像还没有和同学好好玩玩

    我们每个同学都走向老师,向老师汇报自己的毕业后的走向(大学本科毕业时就是这样)

    这时同学都成了大学本科同学

    老师周围有些拥挤

    我很高兴的走向老师,说自己出国。带着一丝自豪。

    我看到旁边有yzy,他也出国,还有一些其他的同学,hyk

    有人说明天踢球,还有活动

    我想这是毕业后最后一次跟同学的机会

    我已经幻想到在操场上和大家踢球的场景

    向老师汇报情况后我们出来

    大家站在走廊里面

    开始我前面站着dyf,接着发现lsp也在旁边

    我们在聊出国的事情

    dyf是最早确定出国的

    我跟他们说我抽(奖)到一个懒人拖把。懒人拖把似乎就是一个出国的offer

    lsp有一个offer,但是还要等什么手续

    他们说,哎,我怎么没有抽到?

    我想,其实我不过是幸运的中奖了

    后来就醒了,还没有来得及去踢球

    发现自己躺在异乡

    回首过去,一晃就是十几年

    而今已经有了老婆孩子,开始了自己的事业

    真是恍若隔世

    觉得自己其实是不断的漂泊

    每隔三五年就从一个地方漂到另外一个地方

    总是没有根

    过去的同伴就像舞台的演员

    一幕一幕掠过

    我也不过是其中一员

    从一个舞台跳到另一个舞台

    而年华,就不知不觉在舞台中流逝

    慕然回首,却是在梦里

  • dll, interface

    2009-10-17

    感觉dll相对于静态库很大的一个优点是依赖更少

    如果一个函数编译需要用到B,而B又依赖于A,等等。那么在项目里面就得包含B,还有A。这样每次重新编译都很费时间。如果用动态连接的话,只用写一个函数的dll。接口就是这个函数。这样依赖最小化。编译也很快。

    dll将源代码和部署分开。这样有利于接口和实现分离。

    dll的问题是c++

    com是一种方法。但是比较丑陋。

    qt的方法是公开源代码,自己去编译。很多的c++的项目也是这样。

    不过c++的接口很容易变化。c和c++的接口都是通过.h和.lib。c的.h可以与实现完全无关。但是c++包含私有成员,就容易变化,也就导致客户端总是重新编译。虽然pimpl模式可以缓解。但是很繁琐。qt用了这种模式么?

    如果要保证向后兼容,就必须小心维护接口。接口其实是最重要,最关键的东西。c的话,就是一些.h,里面是结构和函数。那么c++呢?这些.h的内容如何保证不轻易变化呢?

  • 一般来说任何多维的matrix都可以表示成一个array

    一般来说,程序设计语言里面的,a[i][j] = *(a + i * dim_j + j)。也就是说,是逐行存储。index越靠后,优先级越高。

    用这样的知识,去写matlab程序读一个envi文件,结果发现问题

    matlab有一个reshape,非常方便得把一个一维的数组转换成一个矩阵

    envi是三维的,头文件里面假如说col,band,row,matlab里面可以直接reshape(cols, bands, rows),非常对应

    我现在想一个bands一个bands的读

    我以为跟程序语言一样,越靠后的间隔越小,结果总是有问题。

    后来发现matlab里面的存储方式是完全相反的,即越靠后的间隔越大。比如一个二维矩阵是逐列存储。

    Linear indexing帮助里面是这么说的:

    MATLAB stores matrices and arrays not in the shape that they appear when displayed in the MATLAB Command Window, but as a single column of elements. This single column is composed of all of the columns from the matrix, each appended to the last.

     

  • version

    2009-10-16

    //其实一直不是真正懂得该怎么搞version

    //http://en.wikipedia.org/wiki/Software_versioning

    major.minor.revision

    major: 当系统完全进行重新设计,接口改变以至于不能向后兼容时,改变major number。反过来,同一个major number开头的东西必须保证向后兼容。

    minor:系统增加了新特性,或者接口增加。

    revision: bug被补上。功能被完善。

    之前的想法是用tags来保存不同的版本。一个项目总是只有一个trunk。现在觉得不好。应该是每个major version都要单独创建一个项目,有对应的trunk, tags, branches。这样旧版本还可以继续被使用,完善。minor和revision使用tags。好想也有用major.minor单独做项目的。

     

  • assembly language

    2009-10-15

    From <<Fundamentals of Computer Organization and Architecture>>

     

    An assembly language program is a symbolic representation of the machine language program.

     

    Machine language is pure binary code, whereas assembly language is a direct mapping

    of the binary code onto a symbolic form that is easier for humans to understand

    and manage.

     

    Converting the symbolic representation into machine language is performed

    by a special program called the assembler.An assembler is a program that

    accepts a symbolic language program (source) and produces its machine language

    equivalent (target). In translating a program into binary code, the assembler will

    replace symbolic addresses by numeric addresses, replace symbolic operation

    codes by machine operation codes, reserve storage for instructions and data, and

    translate constants into machine representation.

     

     

  • cpu instructions

    2009-10-15

    From <<Fundamentals of Computer Organization and Architecture>>

     

    The type of instructions forming the instruction set of a machine is an indication of

    the power of the underlying architecture of the machine.

     

    Data Movement Instructions

    Arithmetic and Logical Instructions

    In addition to the ADD and SUBTRACT instructions, some machines

    have MULTIPLY and DIVIDE instructions. These two instructions are expensive

    to implement and could be substituted by the use of repeated addition or repeated

    subtraction. Therefore, most modern architectures do not have MULTIPLY or

    DIVIDE instructions on their instruction set.

    Sequencing Instructions

    Control (sequencing) instructions are used to change the sequence in which

    instructions are executed. They take the form of CONDITIONAL BRANCHING

    (CONDITIONAL JUMP), UNCONDITIONAL BRANCHING (JUMP), or CALL

    instructions.

    The CALL instructions are used to cause execution of the program to transfer to a

    subroutine. A CALL instruction has the same effect as that of the JUMP in terms of

    loading the PC with a new value from which the next instruction is to be executed.

    However, with the CALL instruction the incremented value of the PC (to point to the

    next instruction in sequence) is pushed onto the stack. Execution of a RETURN

    instruction in the subroutine will load the PC with the popped value from the

    stack. This has the effect of resuming program execution from the point where

    branching to the subroutine has occurred.

    Input/Output Instructions

    Input devices are interfaced with a computer through dedicated input

    ports. Computers can use dedicated addresses to address these ports.


     

     

  • envi file format

    2009-10-15

    http://bm2.genes.nig.ac.jp/RGM2/R_current/library/caTools/man/ENVI.html

     

  • addressing modes

    2009-10-14

    From <<Fundamentals of Computer Organization and Architecture>>

     

    The different ways in which operands can be addressed are called the addressing

    modes. Addressing modes differ in the way the address information of operands is

    specified. The simplest addressing mode is to include the operand itself in the

    instruction, that is, no address information is needed. This is called immediate

    addressing. A more involved addressing mode is to compute the address of the

    operand by adding a constant value to the content of a register. This is called indexed

    addressing. Between these two addressing modes there exist a number of other

    addressing modes including absolute addressing, direct addressing, and indirect

    addressing.

  •  

    From <<Fundamentals of Computer Organization and Architecture>>

     

    It is interesting to indicate that there exist zero-address instructions. These are the

    instructions that use stack operation. A stack is a data organization mechanism in

    which the last data item stored is the first data item retrieved. Two specific operations

    can be performed on a stack. These are the push and the pop operations.

     

    As can be seen, a specific register, called the stack pointer (SP), is used to indicate

    the stack location that can be addressed. In the stack push operation, the SP value is

    used to indicate the location (called the top of the stack) in which the value (5A) is to

    be stored (in this case it is location 1023). After storing (pushing) this value the SP is

     

    incremented to indicate to location 1024. In the stack pop operation, the SP is first

    decremented to become 1021. The value stored at this location (DD in this case) is

    retrieved (popped out) and stored in the shown register.

     

     

    Different operations can be performed using the stack structure.

     

  • From <<Fundamentals of Computer Organization and Architecture>>

     

    Between the two- and the one-address instruction, there can be a one-and-half

    address instruction. Consider, for example, the instruction ADD B,R1. In this case,

    the instruction adds the contents of register R1 to the contents of memory location

    B and stores the result in register R1. Owing to the fact that the instruction uses

    two types of addressing, that is, a register and a memory location, it is called a

    one-and-half-address instruction. This is because register addressing needs a smaller

    number of bits than those needed by memory addressing.

  •  

    From <<Fundamentals of Computer Organization and Architecture>>

     

    Information involved in any operation performed by the CPU needs to be addressed.

    In computer terminology, such information is called the operand. Therefore, any

    instruction issued by the processor must carry at least two types of information.

    These are the operation to be performed, encoded in what is called the op-code

    field, and the address information of the operand on which the operation is to be

    performed, encoded in what is called the address field.

     

    Instructions can be classified based on the number of operands as: three-address,

    two-address, one-and-half-address, one-address, and zero-address.

     

     

     

    It should be noted that in presenting these examples, we would use the convention operation,

    source, destination to express any instruction. In that convention, operation represents

    the operation to be performed, for example, add, subtract, write, or read.

    The source field represents the source operand(s). The source operand can be a constant,

    a value stored in a register, or a value stored in the memory. The destination

    field represents the place where the result of the operation is to be stored, for

    example, a register or a memory location.

     

  • From <<Fundamentals of Computer Organization and Architecture>>

     

    Three basic steps are needed in order for the CPU to perform a write operation

    into a specified memory location:

    1. The word to be stored into the memory location is first loaded by the CPU

    into a specified register, called the memory data register (MDR).

    2. The address of the location into which the word is to be stored is loaded by

    the CPU into a specified register, called the memory address register (MAR).

    3. A signal, called write, is issued by the CPU indicating that the word stored in

    the MDR is to be stored in the memory location whose address in loaded in

    the MAR.

     

    It is worth mentioning that the MDR and the MAR are registers used exclusively

    by the CPU and are not accessible to the programmer.

     

    Similar to the write operation, three basic steps are needed in order to perform a

    memory read operation:

    1. The address of the location from which the word is to be read is loaded into

    the MAR.

    2. A signal, called read, is issued by the CPU indicating that the word whose

    address is in the MAR is to be read into the MDR.

    3. After some time, corresponding to the memory delay in reading the specified

    word, the required word will be loaded by the memory into the MDR ready

    for use by the CPU.

  • read write word cpu

    2009-10-14

    From <<Fundamentals of Computer Organization and Architecture>>

     

    In order to be able to move a word in and out of the memory, a distinct address

    has to be assigned to each word. This address will be used to determine the location

    in the memory in which a given word is to be stored. This is called a memory write

    operation. Similarly, the address will be used to determine the memory location

    from which a word is to be retrieved from the memory. This is called a memory

    read operation.

     

    The number of bits, l, needed to distinctly address M words in a memory is given

    by l = log2 M.

     

    Alternatively, if the number of bits in the address is l, then the maximum

    memory size (in terms of the number of words that can be addressed using these

    l bits) is M = 2^l.

     

    Typically, memory read and memory write operations are performed by

    the central processing unit (CPU).

     


  • bit byte word

    2009-10-14

    From <<Fundamentals of Computer Organization and Architecture>> Chapter I


    The (main) memory can be modeled as an array of millions of adjacent cells, each

    capable of storing a binary digit (bit), having value of 1 or 0. These cells are

    organized in the form of groups of fixed number, say n, of cells that can be dealt

    with as an atomic entity. An entity consisting of 8 bits is called a byte. In many

    systems, the entity consisting of n bits that can be stored and retrieved in and out

    of the memory using one basic memory operation is called a word (the smallest

    addressable entity). Typical size of a word ranges from 16 to 64 bits.

  • karaok

    2009-10-14

    新买的卡拉ok没有音频线输入,只能放cd

    老爸带的vcd也不能放

    刻cd,可是中途出错

    再刻,总是失败

    昨天试,今天又试

    失败N次

    终于发觉CD-R只能写一次,wk~

    翻箱倒柜,所有的盘全是CD-R,wk

    之前还浪费了一张

    这下老爸没得歌听了

  • 新的事情

    2009-10-13

    一下子多了很多

    公司里面几乎所有的事情都需要参与

    昨天的demo据说还可以,没有出漏子。别人提了很多新的需求,看我们有没有实力做。他们还想要一个demo的程序。所以这个礼拜得把demo完全整完,把最近新作几个功能模块都做出demo,还得写文档,可能还要录视频。对方提了一个合理的需求,看似简单。但是现有的架构要改动支持这个需求会非常之麻烦。先让jenson想想看吧。也想趁这个机会让jenson放弃之前的架构。

    现在svn server在我的pc上面,准备放到另一个旧的pc上面,就是之前一堆病毒的机器。准备装一个trac。以后还得做build automation。backup automation。test automation。

    bio方面有可能新来一个项目,需要快速出结果。

    另外有两个项目,需要和别人合作一起弄。