Do Androids Dream of Electric Sheep?

Understanding SVM

Understanding SVM

Based on Andrew Ng’s Machine Learning Basic.

SVM is a kind of optimization of Linear Regression.

In Linear Regression, we trying to minimize the error function:

\[min(\xi = \sum_{i=1}^my^{(i)}\bigg( -\log h_\theta(x^{(i)}) \bigg) + (1-y^{(i)})\bigg( -\log (1 - h_\theta(x^{(i)})) \bigg)+ \frac\lambda{2m}\sum_{j=1}^n\theta_j^2)\]

in the function above, $-\log h_\theta(x^{(i)})$ and $-\log (1 - h_\theta(x^{(i)}))$ are called cost function, which used to measure the distant between prediction result and actual result.

Because we use sigmoid function for you prediction, so the curve of $-\log h_\theta(x^{(i)})$ looks like this:

We use a two linear function to describe that curve roughly:

And we call this new cost function $ Cost_0(\theta^Tx)$

According to the cost function $Cost_0(\theta^Tx)$, if we want to minimize the it, we should have $\theta^Tx \ge 1$

(in the case of the result $y = 1$)

(Minimizing the cost function $Cost_0(\theta^Tx)$ will minimize the Error function $\xi$ too)

So we can get a important restriction: \(\theta^Tx \ge 1\)

This restriction makes the data points the boundary have the influence of angle of the linear boundary. In other words, which means we can have a margin for the boundary. We are trying to finde the biggest margin of the boundary.

How to modify the margin?

From my understanding, we can rewrite the restriction as this:

\[\pmb{\theta x'} \ge C (C = Constants)\]

Where the $\pmb x’$ is the projection of $\pmb x$ on the direction of $\pmb \theta $, $\pmb x = \Vert x \Vert * cos\beta$

norm symbol in Latex: https://tex.stackexchange.com/questions/107186/how-to-write-norm-which-adjusts-its-size

So we have

\[\pmb \theta \ge \frac{C}{\pmb x'}\]

The factor $C$ will influence the angle theta.

The key step is using a discrete function to replace a continous function, which made the $C \ne 0$

Somewords of Kernel Methods

The course of Andrew Ng is good!

I have been confused what is Kernel and how to understanding the Kernel in a more intuitive way. Before I studying his course I always need to recall a lot of conceptions and try to remember it in a hard way.

The example of him is to describe the Kernel function as a tool of checking the similarity of two points.

So who is our standard? The answer is quite simple but it costs me some time to realize it. Training set is our standard for comparing the similarity. In Andrew’s course, he called it as “landmark”.

When a new data from Testing set comes in, we will use Kernel function to check if the new data similar with each “landmark”. As the result of comparing, it will save the result in a column vector.

As for the whole data set, we can derive a matrix from Testing set, which is called Kernel Matrix.

The size of Kernel Matrix:

Suppose that we have a training set $X_{training} \in R^{m_1 \times n}$, where $m_1$ is the number of data, $n$ is the number of features, or dimesions. The test data set is $X_{testing} \in R^{m_2 \times n}$

So for the Kernel Matrix: $K \in R^{m_1 \times m_2}$

The Kernel function is a projection of a data set, from which we can project the data to a feature space, in that space we can use Linear classifier for classification problem.

Combination of SVM and Kernel Method

They are two seperated things, SVM is a classfier that have better performance than normal linear classifier.

Kernel is a good method that will reduce the computation complex when implementing the classifier.

For my understanding, SVM is a engine in a car and Kernel is the N2O Booster.

Quanlity Assurance Note 3 - Model Checking for CTL

Quality Assurance Note 3 - Model Checking for CTL

QES笔记3

前情提要

前两篇的笔记讲的是怎么用形式化的语言来表述一个系统, Kripke Structure更多的是倾向于单任务的, 无时序的系统的描述.

而Timed automata就是在此之上为我们提供了描述时序和多任务系统的方法. 最后, 我们发现其实Timed automata这种无限状态机也可以转换为有限的Kripke Structure, 这样的归化为之后的分析带来了极大的方便. 这样我们就可以只用专注于自动化的分析Kripke Structure这件事儿就行了, 不必分心于考虑时序和多任务的情况.

简介

每一节一定先要把目标确定好, 这样才能知其所以然.

这一节的首要目标是: 既然我们已经知道了怎么描述一个系统(Kripke Structure), 也知道了怎么取形式化的描述需求(LTL和CTL), 那我们需要用某一种可以被计算机理解和执行的方法去让计算机验证我们的系统是否满足需求.

在这一节里面,我们讨论的主题是CTL, 因为它更加常用:

  1. CTL的Labeling Algorithm是什么, 怎么使用
  2. 怎么利用SAT(Boolean Satisfiability)算法来找到在哪个具体的状态上满足CTL的描述

Labeling Algorithm##

1. CTL的性质

之前我们提到CTL有许多描述符, 但是越多的描述符虽然越容易让人类理解, 但是对于计算机来说, 无形中会多出了许多case.

其实对于CTL来说, 只要有满足一下条件的描述符的集合, 就足够了:

  1. {AX, EX}至少有一个
  2. {EG, AF, AU} 至少有一个
  3. 必须含有EU (Exist … Until..)

比如说 {¬, ∧, EX, EG, EU}就是一个在功能上完备的描述符合集, 其他的所有描述符都能用这5个基本描述符描述

下面就是如何用这5个描述符展开其他描述符的公式, 可以看看

φ ∨ ψ ≡ ¬(¬φ ∧ ¬ψ) 
EF φ ≡ E[true U φ] 
     ≡  φ ∨ (true ∧ EX E[true U φ]) 
     ≡  φ ∨  EX E[true U φ] 
     ≡  φ ∨  EX EF φ
AG φ ≡ ¬ EF ¬φ 
AF φ ≡ ¬ EG ¬φ
AX φ ≡ ¬ EX ¬φ 

这其中, AF, EG, EF 和 EU 可以用AX和EX的递归式来定义

EG φ ≡ φ ∧ EX EG φ
AF φ ≡ φ ∨ AX AF φ
EF φ ≡  φ ∨  EX EF φ
E[φ U ψ] ≡ ψ ∨ (φ ∧ EX E[φ U ψ]) 

这里有伏笔, 过会儿说的SAT算法的时候要用到这几个递归式

2. Labeling Algorithm

这个算法的目标是: 判断在所有的状态中是否满足CTL表达式

这个算法主要的方法是先替换, 再筛选. 一步步验证状态是否满足.

首先, 我们需要把一个CTL表达式利用CTL的性质转换成用{¬, ∧, EX, EG, EU}描述的CTL表达式

下面来详述分别在不同情况下怎么应用 Labeling Algorithm

  1. 如果状态s中存在φ(φ是原子命题,例如说a=5),那就给状态s标记一个φ
  2. 如果状态中同时存在φ1φ2, 那么就给状态标记φ1∧φ2
  3. 如果状态中不存在φ,那么就给状态标记¬φ
  4. 对于AFφ标记方法如下:
    1. 先把所有标记为φ的状态标记为AFφ

    2. 如果一个状态的所有子状态被标记为了AFφ那么也把这个状态标记为AFφ; 一直重复这一步直到各个状态上面的label没有变化

  5. 对于E[φ1Uφ2]
    1. 先把所有被标记为φ2的状态标记为E[φ1Uφ2]

    2. 如果一个状态被标记为φ1, 且它的子状态中有E[φ1Uφ2], 那么就把它标记为E[φ1Uφ2]; 一直重复这一步直到各个状态上面的label没有变化

  6. 如果一个状态拥有一个φ的子状态,那么就可以给他标记上EXφ

  7. 对于EGφ
    1. 先把所有标记为φ的状态标记为EGφ
    2. 如果一个被标记为EGφ的状态, 它的子状态都不存在EGφ,那么就把它身上的标记删掉; 一直重复这一步直到各个状态上面的label没有变化

其实Labeling Algorithm可以让我们在一个比较高的抽象层级上面来检验一个Kripke Structure是否满足CTL表达式, 但是具体到实现上, 就需要一个为实际问题定制的算法, 也就是SAT算法, 它可以看做是Labeling Algorithm的特别定制版

SAT(Boolean Satisfiability)算法##

用布尔方程(Boolean formula)表示Kripke Structure

我们已经知道每个状态上只可能存在, 或者不存在原子命题φ, 所以我们就可以用布尔值1或者0来表示”存在φ“或者”不存在φ”.

但是transition, 也就是状态之间的转换怎么表示呢.

在这里我们用来表示两个状态之间的跳转

举个例子, 有下图这样的Kripke Structure

它有两个状态, 分别是:s1=a∧b,s2=a∧¬b

那从s1s2的transition就是: (a ∧ b) ∧ (a' ∧ ¬b')

所以整个Kripke Structure就可以这样描述:

(a∧b ∧ a'∧b')∨(a∧¬b ∧ a'∧¬b')∨(a∧¬b ∧ a'∧¬b')∨(a∧¬b ∧ a'∧b')

这一段感觉讲的没什么道理, 因为布尔方程的”目的”我也还不是很清楚…

SAT算法 (fixed point algorithm)

感觉这个SAT算法是一个比较深的东西, 在这里我只说一下他是怎么在model checking里面得到应用的. 详细的东西还是先详细学习了以后才能了解.

SAT算法提供了一个验证CTL表达式的方法, 我一直很想把它和之前的labeling algorithm连起来, 因为他们是在有许多相似之处. 但是总觉得有些地方解释不通, 所以也不敢妄下结论.

这个算法里面的基本知识是要理解SAT(EX Z) 这个运算.

SAT是satisfy的简写, 输入是一个CTL表达式, 输出是满足这个表达式的状态的集合.

举例:

SAT(φ) 就是图里所有存在φ的状态的合集

SAT(EX φ)就是图里所有子状态存在φ的合集(这里要注意, 不一定要所有的子状态都是φ, 只要有一个子状态有φ就行)

前面在“CTL性质”这一小节里面, 我们有提到了, CTL里面最基本的几个表达式

{¬, ∧, EX, EG, EU}就是一个在功能上完备的描述符合集, 其他的所有描述符都能用这5个基本描述符描述

EX 又是一个很简单明了的描述符, 所以我们只需要了解EGEU就好, 但是为了方便起见, 我们先谈EGEF这两个用的比较多又有代表性的描述符

EG φ

//求EG φ
Z:= SAT(φ)
	do
		Z := Z ∧ SAT(EX Z); //注意这里是取交集
	until nothing changes in Z
return Z

名词解释:

Z: 一个变量,可以视为一个数组,用来存储状态的集合

SAT(φ): 所有存在φ的状态的集合

Z:= Z ∧ SAT(EX Z): 分三步理解

  1. 找到当前的Z所存储的状态集合, 第一次的进入循环的时候Z:=SAT(φ).
  2. 找到所有Z中状态的父状态的集合, 因为这些状态都满足EX Z
  3. 对1. 和2. 中的两个集合求交集.

当Z中的元素不再变化时, 我们就能找到所有满足EG φ的合集

此时到达greatest fixed point

这里有个问题, 就是SAT算法其实是找到了一个循环. 如果是一个所有状态都存在φ的线性的树状图, 图内没有任何循环, 那么当循环到初始状态(S0状态)的时候, 此时Z={S0}, EX Z=∅. 最后得到的结果也是空集(), 根据SAT算法, 那么我们会得出这个图并不满足EG φ的结论, 这明显不符合.

我说的是这样的:

EF φ

//求EF φ
Z:= SAT(φ)
	do
		Z := Z ∨ SAT(EX Z); //注意这里是取并集
	until nothing changes in Z
return Z

EF φEG φ的区别就是取的是并集, 所以当到达fixed point 的时候, 此时为 least fixed point

E[φ U ψ] ≡ ψ ∨ (φ ∧ EX E[φ U ψ])
//求E[φ U ψ]
Z:= SAT(ψ)
	do
		Z := Z ∨ (SAT(φ) ∧ SAT(EX Z)); //注意这里是取并集
	until nothing changes in Z
return Z


这一期就到这里啦! 生硬的结尾, 写的实在有点焦躁, 这块知识还是不是理解的很透彻呀.

Game Note - 异次元通讯录2

Game Note - 异次元通讯录2

写这个东西的目的就是为了让自己专心复习….

因为发现自己容易沉迷新游戏, 可能是机核网的广播听太多了造成了一种玩游戏的心理氛围. 虽然并不觉得有太多错, 不过过于玩游戏确实是一种”用有限的时间挑战无限时间”的事情.

毕竟我们都是和一些循环和判断构成的软件进行交互, 而编程不就是把许多状态, 甚至无限的状态归纳并执行的步骤嘛.

不过许多游戏有很多好的想法, 每个游戏也有自己的有点和缺点.

也许最后我也不会去做游戏, 但是就按照自己的视角分析一下并不是什么坏事

自己并不是一个擅长游戏的人, 反应力和记忆力都不是很好所以经常只能玩初级难度和关卡. 但是我相信真正的core player也只是少数, 就算是core player也愿意在没事儿的时候尝试新的游戏. 所以一个新手测评也是有用的吧

其实并不是科幻

不得不说现在国内的画师们的水平稳步上升呢, 虽然是经典的主角大逆光透视.

这个构图我记得有地方介绍过是仿照某名画的, 表达了一种年轻人迎难而上斗天斗地斗地主的进取心.

虽然在各种电影海报上很常见, 但是确实很适合一个冒险游戏的氛围.

不过呢, 虽然题图十分酷炫而科幻, 但是就我弃坑的进度来说, 并没有感受到许多科幻元素, 反而卖萌和卖肉元素很多呢.

第一印象

这是个设定上和”生命线”很相似的文字冒险游戏, 不得不说相比较于生命线, 它的交互更加符合我们使用微信和微博的习惯.

与主角miko酱聊天的时候, 她的打字是需要一定时间的, 而且在她打字和我们思考选项的时候会出现一个像是whatsapp里面一样的有三个跳动的点的提示. 确实能让代入感增强一些, 但是在玩了一段时间之后, 就会觉得这样有些多余, 因为我更想知道剧情的进展. 感觉这样的小动画太多了有点拖沓.

miko酱的聊天也很符合大家的聊天习惯, 是不是来个颜文字卖个萌什么的. 不过整体的人物性格有点…牵强? 感觉是为了各种萌要素然后很片面的粘上了许多个性. 写文章这种事儿需要慢慢练习的所以一起加油吧大家!

感觉上有意思的各种系统

之前提到了这个游戏的微博和微信系统, 就让我在这里罗列一下我觉得做的挺好的各种系统吧

日志

这个系统还挺眼前一亮的, 觉得整个维度一下子提高了许多. miko发日志的时间一般来说是下线时间. 第一次打开这个类似微博的日志的时候, 感觉一下子就被带入进去了!

就我玩到的地方来说, 整个日志的作用就是看萌图. 还有就是收集图鉴啦, 但是对于推动主剧情完全没有作用. 我觉得设计组是想用日志来丰富人物的形象, 但是这种把各种二次元萌元素堆在一起然后就来卖萌的感觉还是有点小违和...

快速模式

游戏里面有个”快速模式”, 好像也没有帮助界面或者提示,来让我明白这个是用来做什么的.

不过根据字面意思应该是加快游戏中时间流逝的吧.

虽然我的手机垃圾导致根本没有提示, 但是这个真是体谅了我这种没什么耐心一直等着剧情发展的玩家.

吐槽

首先表达对这种偶尔拿起玩一下然后就可以放下的游戏的喜爱之情, 上手门槛很低呀而且不会很占用时间, 是一个解决碎片化时间先要打发时间获得一段故事的好方法.

可能是经验不太足的原因吧, 有些时候游戏的选项让我感到莫名其妙. 而且对于选项造成的结果也没什么道理…

死了两次, 一次因为地铁逃票…另一次因为试了一下密码锁…

总之感觉就是个不作死就不会死的设定.

不过这个度好像有点过了, 感觉随便尝试了一件小事儿就作了个大死被失联.

想要变得更好

确实有很多地方自己感觉被代入了整个事件, 但是只能二选一的选项让我是不是跳戏, 因为两个选项都不是我想选的额.

如果从游戏制作的角度来说, 我觉得是剧本对于玩家心理的把握还不是很到位. 但是有个想法, 能不能给游戏装上chatbot呢?

玩家可以向AI提出各种问题, 就像有个文字版的siri. 但是AI会引导玩家接近一个故事, 当然实时游戏的设定确实很棒可以保留.

玩家的提问也是让玩家了解世界观和人物性格的一个好方法.

当然, 现在的AI技术可能还没有到能通过图灵测试又方便开发的程度. 不过这是可以尝试的呢, 如果真的有个AI客服一样的存在, 那我们就可以做一个在微信群里面的密室逃脱游戏?

另外, 受到”日志”系统的启发, 做一个文字开放世界冒险如何?.

在网上搜了一下已经有些游戏这样做了, 这不是文字冒险游戏的时代,但150万字的《巫术》卖出了150万套, 这篇文章里面的”80天”这个游戏, 有空可以试试看呢.

最后

恩没什么好总结的, 好好复习准备期末考试.

Human side of Innovation Notes

Human side of Innovation

Creativity

»>SUMMARY

  • Introduction and definition
    • Definition of creativity
    • Ways to measure creativity
  • Amabile’s theory on creativity
    • 3 components (domain-relevant skills, creativity-relevant skills, task motivation) and their effects on 5 phases of creativity
    • Effects of organizational work environment on motivation and creativity
  • Brainstorming
    • Understand brainstorming problems and possible solutions
  • Discussion of empirical studies on creativity
    • Several factors influence creativity
    • Importance of interaction effects

»>Measurement of creativity: Via behavior in context vs via personality scales.Discuss Advantages / Disadvantages

Difference of Innovation and Creativity

Creativity:

  • Generation of novel(新颖的) and useful ideas
  • Absolute (”true”) novelty
  • Partially an intra-individual (自我节点内的) cognitive process

Innovation:

  • Production of creative ideas and implementation
  • Relative novelty (e.g., ideas may be adopted from other organizations)
  • Primarily an inter-individual(人与人之间的) social process

Measurement of creativity

Three Components of Creativity (Amabile, 1996a)

Componential theory: 3 main creativity facilitators (= components)

  1. Domain-relevant skills (factual knowledge, skills and experience in a specific field)
  2. Creativity-relevant skills (e.g., innovative cognitive style, knowledge of techniques to produce creative ideas)
  3. Task motivation (intrinsic and extrinsic)

Creativity intersection: Highest creativity when an individual is high in all three components!

»>Amabile’s model on creativity: remember the example we discussed (MIT,Amazon Kindle)

Amabile’s model on creativity

Positive Organizational Influence

  • Increase intrinsic motivation :
    • Freedom & autonomy
    • Give optimal challenge
    • Assign tasks to match interests
  • Increase extrinsic motivation
    • Confirm competence through recognition
    • Give a clear strategic direction
    • Provide sufficient resources
  • Diminish demotivational extrinsic factors
    • Do less surveillance and establish fewer rigid procedures
    • Reduce expectation of too critical evaluation
    • Give realistic deadlines
  • Domain-relevant skills
    • Provide training in relevant factors
    • Provide support for critical success factors
    • Assign tasks to match skills
  • Creativity-relevant skills
    • Encourage unconventional thinking
    • Support alternative solutions
    • Give time to fully capture situations and problems

Analyzing the mini case of Kindle

Please discuss the creative process behind this development based on Amabile’s model of creativity.

TODO: 我要自己试着用前面的model和这些positive的行为来分析 后面也有一些经验的结论, 这些好像也和这个minicase 相关

»>Brainstorming!

TODO: 主要是说brainstorm的问题什么的

What is Brainstorming?

Brainstorming is a method of group problem solving

Possible Threats

  • Production blocking
    • No uninterrupted flow of thought possible
    • Only one person can speak at one time
    • While others’ speak, one’ own idea production is blocked or ideas are being forgotten
  • Social loafing
    • Participants may not work as hard as they would alone, especially if they perceive their contribution to be unidentifiable
  • Evaluation anxiety and conformity
    • Fear that others may negatively evaluate one’s ideas
    • Members may communicate traditional or similar ideas to ”fit in” and not to diverge from others
  • Downward norm setting
    • Performance across group members often converges
    • Brainstorming participants sometimes tend to match their performance to that of the least productive members)

Better method:

BrainWriting

  • Nominal group technique (sharing and discussing ideas after independently writing them down)
  • Electronic brainstorming (individual computer stations to type in ideas, while all or a sample of all ideas are projected on the wall or shown in a separate window on the computer screen)
  • Diversification of the team (e.g. regarding training) and membership change (exit of old member and entry of new member)
  • Trained facilitators minimize some threats, e.g. ensure that only the ideas themselves and not anecdotes are communicated

BrainWarming

In brainwarming graph, the goal grows downward into refined subgoals.

Resoureces are interacted together and grow upward.

When the two directions connect, solutions start to emerge.

####»>Discussion of Empirical Studies on Creativity

The Impact of Mood on Creativity

Positive mood facilitates creative thinking

  • Daily positive mood positively predicted daily creative thought (judged by expert raters) on the same day and with a 1-2 day delay
  • Aggregated monthly positive mood positively predicted monthly coworker- rated creativity
  • Most creative incidents (86%) associated with positive emotional reactions

But there are also opposing results:

  • Negative mood positive for creativity if organization recognizes and rewards creativity (George and Zhou, 2002)
Motivation, Bureaucracy and Creativity

Situational influences (higher-level team climate factors) may weaken or strengthen the effect of individual differences → Person-in-situation theory

研究雇员motivation和组织架构的关系

  • Employee motivation was studied using 3 types of goal orientations
    • Learning orientation (sample item: I often look for opportunities to develop new skills and knowledge)
      • Performance prove orientation (sample item: I’m concerned with showing that I can perform better than my co-workers)
      • Performance avoidance orientation (sample item: I’m concerned about taking on a task at work if my performance would reveal that I had low ability)
  • 2 bureaucracy factors - Centralization: - How is power distributed in an organizational hierarchy? - Is there a chain of command? - Are employees encouraged to participate in decision making - Sample item: The team leader uses my work group’s suggestions to make decisions that affect us - Formalization: - Which rules are clearly specified, which procedures standardized? - Sample item: Our work involves a great deal of paperwork and administrations

RELATIONSHIP:

  • Performance avoidance orientation had a negative relation with creativity (consistent with the notion that this orientation disposes individuals to be less creative because of risk of failure and the possibility of appearing incompetent)

  • Employees’ performance prove orientation was positively related to creativity when formalization was low, but not when it was high

  • When centralization was low - learning orientation was positively related to creativity - performance avoidance orientation was less negatively related to creativity

  • When formalization was low

    • performance prove orientation was positively related to creativity (see next slide)
    • performance avoidance orientation was more negatively related to creativity

RESULT:

  • To get creative results, managers should seek to understand employees’ motivational orientations in context, so the combination of individual disposition and bureaucratic context yields the most desirable associations with creativity.
  • Decentralization brings out the best in learning-oriented employees and attenuates the negative of an avoid orientation on creativity. Thus, from a creativity perspective, decentralized decision making is attractive, even when it does little for prove-oriented individuals.
  • Formalized practices are a more complex issue. Although the creativity of prove-oriented individuals thrives in less formalized contexts, low formalization actually brings out undesirable tendencies in avoid-oriented team members
  • ”The conclusion would be that creativity is best obtained by (where possible) not selecting avoid-oriented individuals **for a team, while creating a team context characterized by **high levels of decentralized decision making and low formalization, to let learning-oriented and prove-oriented individuals flourish.” (p. 638)
When Job Dissatisfaction Leads to Creativity

What is job dissatisfaction:

  • Reactions to job dissatisfaction
    • Exit: Leave the company (active, destructive reaction)
    • Neglect: Lower effort (passive reaction)
    • Loyalty: Accept status quo (passive reaction)
    • Voice: Do something about it (active, constructive reaction)

How to measure it:

  • Creativity:
    • 13 item scale (such as ”Person suggest new ways to achieve goals or objectives”)
  • Job dissatisfaction:
    • 3 item scale (such as ”In general I like working at this company”; ”In general, I like my job”)
  • Continuance commitment:
    • 6 item scale (such as ”Right now, staying with this company is a matter of necessity as much as desire”)
  • Useful feedback from coworkers:
    • 3 item scale (such as ”I find the feedback I receive from my coworkers very useful”)
  • Coworker helping and support:
    • 4 item scale (such as ”We help each other out if someone falls behind in their work”)
  • Perceived organizational support for creativity:
    • 4 item scale (such as ”Creativity is encouraged at this company”; ”The reward system encourages innovation”)

RESULT:

  • Implications
    • Job dissatisfaction is not necessarily undesirable for organizations
    • Managers should (of course) not try to increase job dissatisfaction, but try to create a suitable work environment that even in this unfavorable situation positive results are possible ⇒ Positive effect on worker and organization possible
  • Critique and Further Research
    • Dyadic data: Biased responses minimized
    • Cross-sectional study: Difficult to assess causality
    • What are the effects of creative behavior in response to job dissatisfaction?
    • What is the effect of individual characteristics of workers on the analyzed hypotheses (e.g. self-esteem)?

###Teams

Given Situation / task: Describe how a team can be useful in such a situation: Discuss positive factors (such as complementarities, specialisation, knowledgetransfer) as well a negative effects (such as free riding, coordination effort)

TODO:我觉得不应该就这么点吧…每个优缺点就一句话?

DEFINITION

A team can be defined as a social system of two or more people, which is embedded in an organization (context), whose members have a common identity, and who collaborate on a common task (teamwork).

这里的chance of teamwork, 侧重于TEAMWORK, 也就是”collaborate on a common task”, 讨论的是在做事儿的时候的chance和risk

Chances of Teamwork (Based on Scholl, 2005)
  • For the organization
    • Improved coordination due to interdependencies(相互依赖) in teams
    • Better decision making (process) due to integration of different perspectives
    • Easier implementation of decisions due to consideration of various interests in the decision making process
    • Improved e ciency due better coordination of specialised capabilities
    • Better customer service due to bundling of competencies in customer contact
  • For the employee
    • Faster familiarisation due to information exchange with other team members
    • Self-awareness and reflections of own behavior through feedback of other team members
    • Easier learning of new skills and acquiring knowledge
    • Better identification with the company through sense of belonging to the team (within the company)
    • Satisfaction of needs for social contacts
Risks of Teamwork (Based on Scholl, 2005)
  • For the organization
    • Reduction of decision quality due to peer pressure
    • Increased coordination effort (especially due to interdependencies in teams)
    • Increased risk of conflicts due to different personal or professional views
    • Increased resistance of a teams against (wanted) changes due to an internal ”subculture“ .
  • For the employee
    • Less motivation due to diminished influence on own performance
    • Reduced performance and dedication due to ”social slack“ of (some) team members
    • Negative influence of internal conflicts on members’ feelings
    • Conformity pressure can lead to lower performance

下面说的advantage和problem是关于TEAM这个组织形式的, 只要有这个组织形式存在, 就会产生什么问题

Advantages

Complementarities:

The task can be done faster / more effciently with more people

Specialisation

Each team member may concentrate on a certain task and fulfill this task better, e.g. due to learning effects

Knowledge transfer

Team members possess idiosyncratic knowledge, which is helpful for other team members

Problems

Free-Riding problem

Coordination effort

Free-riding

What Influences the Decision to Free-ride?

  • Team size
  • Relations within the team
  • Observability of effort
  • Punishments
  • Norms

Team Size:

The larger a team, the smaller the individuals’s impact on the outcome

Plus, it is harder to observe individual effort of each member

CONCLUSION The larger the team, the higher the incentives to free-ride

Team composition:

  • Team composition is thus facing the following problems:
    • How many members should a team have?
    • Who should be part of the team?
    • Is free-riding punished? Are there any individual incentives?
    • What kind of working norm is there in the team / the organization?

If the team is composed of very heterogeneous(各种各样的) members with heterogeneous tasks, it is more diffcult to observe and judge individual effort

CONCLUSION The more homogeneous a team, the lower the incentives to free ride

Design of Incentives for Teams

Explicit Incentives

  • Team bonus (e.g. Bonus for completion of an R&D project in time)
    • Problem: Only if the bonus is based on individual effort it counters the free-riding problem
    • This, however, requires observability of the individual effort
  • Profit sharing (variable part of the salary depends on company profit)
    • Huge free riding problem (Large group, low observability, little influence)
  • Stocks and stock options
    • Basically the same effect (and problems) as profit sharing (only a different success measurement)

Implicit Incentives: Norms

In order to improve the team coordination and spirit, the company / team leaders max try to establish team norms

Such norms generate behaviour expectations against other team members and thus have (implicit) effect on team behaviour and activities

Norms can concern and affect all kinds of behaviour in R&D teams, such as performance norms, communication norms, cooperation norms

Considering the previous formal analysis: If there are established team norms, deviation from the norm causes ”costs“ for the deviating team member

偏离了团队价值观!就是和其他人不能友好相处

Problems with Norms

建设团队价值观, 准则的时候,会遇到的问题

  • Search for suitable norms (What kind of norms are right for this particular team, suitable for the organization culture?)
  • Norm establishment (Exemplifying norms by higher management, honoring of members who work accordingly)
  • Norm control (Supervision, sanctioning: Suitable in an R&D team (?)).
  • Adaptation of norms (Reaction to new conditions, new team members, new tasks).

但是这些问题都不会很危险, 因为:

Why is it not that Critical?

  • Intrinsic motivation (People in R&D often actually like doing their job) - Other benefits (Working in the team leads to personal benefits)
  • Commitment to the team (Feeling of a community)
  • Reciprocity (Hope that others will engage as well)
  • Trusted partnership with employer
  • Teamwork is perceived as a good thing – and should therefore be supported

Idea Generation, Creativity and Incentives (Toubia, 2006)

RESULT

The paper shows that different incentive schemes may trigger different behaviour

  • It appears that extrinsic incentives are not detrimental to creativity (contrary to some psychological literature)
  • Impact based incentives trigger exploration
  • Incentives need to fit to the type of task

实验让大家提点子,然后用三种不同的奖励方式来奖励

(1) Flat condition: Participants received a flat reward of $10

(2) Own condition: Participants rewarded based exclusively on their own contribution ($3 for each new original idea submitted)

(3) Impact condition: Participants rewarded based on the impact of their ideas: ($2 for each new idea that builds on one’s own idea)

上面提到的 Impact based incentives 就是基于影响力的激励

Teamwork and success (hackman model): Similar question as above (Amabile) possible

这个model是用来衡量一个team是不是有效率, 这个team的表现怎么样的工具

It provides a diagnostic tool to assess and design work environments for work groups in organizations

three process criteria of effectiveness

  • Effort applied to the group task
  • Amount of knowledge and skill applied to the group task
  • Task-appropriate performance strategies

Each of these criteria is influenced by the organizational context and the group design, with group synergy as a moderator(调节器)

这里的逻辑是这样的:

一个team的效率首先分成两部分来评估:

  1. Process Criteria of Effectiveness((衡量teamwork)效率的过程标准?):
  2. Material Ressources (物质资源)

其中Process Criteria of Effectiveness又再分成三个小部分评估

  1. Organizational Context
  2. Group Design
  3. Group Synergy

评估的话总要有个标准吧, 于是这个Hackman提出了对着三个小部分评估的标准

  1. Effort applied to the group task
  2. Amount of knowledge and skill applied to the group task
  3. Task-appropriate performance strategies

下面就介绍了具体到每个标准, 在每个小部分里面是怎么评估的

Effort applied to the Group Task

  • Group design: Structure of the task:
    • If the task requires a variety of high-level skills and has a visible outcome,
    • If this outcome has consequences for other people(对他人有意义), and the group is clearly responsible for this outcome
    • If regular performance feedback is given –> Work will be perceived as meaningful leading to higher effort(如果工作被别人察觉到是有意义的, 那么就会更加努力工作) (这一点和下面的reward是不是重复了?)
  • Organizational context: Reward system
    • Set challenging, specific performance objectives
    • Provide positive consequences for excellent performance
    • Focus on group rewards and objectives (not individual behaviour)
  • Group synergy
    • Minimize coordination and motivation losses (e.g. through free-riding problem, see above)
    • Create shared commitment 创造共有的义务

Amount of knowledge and skill applied to the group task

  • Group design: Composition of the group
    • Individuals should have high task-relevant expertise
    • The group size should be large enough to do the work (but not too large)
    • Members should have interpersonal skills (in addition to task expertise)
    • Heterogeneity is moderately diverse
  • Organizational context: Education system
    • The organization helps the team to obtain ”outside” experience to get along with its work, such as educational resources (e.g. seminars)
  • Group synergy
    • Minimize inappropriate weighting of member contributions (based on task-irrelevant considerations such as demographic attributes, race, gender, etc., or behavioral style)
    • Foster collective learning to increases the total pool of talent available for task work

Task-Appropriate Performance Strategies

  • Group design: Group norms (see above)
    • Norms should be clear and intense
    • Norms should support situation scanning and strategy planning (in order to be adaptable)
  • Organizational context: Information system
    • Clarity about the parameters of the performance situation (task requirements, available material resources, people who receive/ review the group ”product”)
    • Access to data about likely consequences of alternative strategies (analytic tools to compare and evaluate probable consequences)
  • Group synergy
    • Minimize slippage in strategy implementation
    • Create innovative strategic plans

Group Effectiveness

  • The productive output of the team should meet or exceed the performance standards of the ”clients” / people (e.g. managers, executives) who receive and / or review the output
  • The social processes used in carrying out the work should maintain or enhance the capability of team members to work together on subsequent team tasks
  • The group experience should, on balance, satisfy rather than frustrate the personal needs of team members

material resources (Suffciency of material resources required to accomplish the task well and on time) is then a moderator of the influence of the process criteria of effectiveness on group effectiveness

Teamwork Quality and Success

这个TWQ主要衡量的是team里面合作的程度是好是坏

TWQ: teamwork quality, TWQ is a comprehensive(全面的) measure of the quality of cooperations in teams

  • Communication
    • Team members communicate frequently, directly and personally, spontaneously
    • Information is shared openly by all team members, on time, precisely and useful
  • Coordination
    • The subtasks within the project are closely harmonized
    • Goals for subtasks are clear, fully comprehended and accepted by all team members
  • Balance of Member Contributions
    • Individual potential is recognized and members contribute in accordance to their potential
    • Conflicts due to imbalance of contributions should be avoided
  • Mutual Support
    • Team members help and support each other as the best they could - Conflicts are easily and quickly resolved
    • Discussions and controversies are conducted constructively.
    • Suggestions and contributions are respected by all team members. Suggestions are discussed and further developed.
    • The team is able to reach consensus regarding important issues.
  • Effort
    • Every team member fully pushes the project.
    • Team members make the project their highest priority.
    • The team puts much effort into the project.
    • There are no conflicts regarding the efforts that team member put into the project.
  • Cohesion
    • The team members are strongly attached to the project.
    • It is important for the team members to be part of the team. Members feel proud to be in the team.
    • All team members are fully integrated in the team.
    • There is personal attraction between the team members.

###Interactive value creation

why are there collaborations in R&D?

Basically, they expect similar advantages as we discussed in the session on teamwork, just on a higher scale

  • Complementarities
  • Specialisation
  • Knowledge transfer

The Trade-offs of “Make or Cooperate”

自己开发的好处

Developing new technologies internally can have several objectives

  • Capabilities available (+building and renewing):
    • Carrying out a development project alone requires a firm to stretch and challenge existing capabilities
    • Incentives to obtain new capabilities
  • Protecting proprietary technologies:
    • Avoid exposure of core technologies to potential competitors
    • Maintain exclusive control over newly developed technology
  • Controlling technology development:
    • Desire to control the whole development process and its results
    • Strategic and cultural reasons inside the company (importance of technology, strong emphasis of own technological capabilities)
  • Controlling costs:
    • Control of expenditures fully within own company

合作开发的好处

Objectives of developing new technologies in collaboration

  • Saving time:
    • Obtaining necessary skills and resources via collaboration usually is faster than in-house development
    • Complementarities and specialization can lead to faster development
  • Increasing flexibility:
    • Externally acquiring instead of building and owning necessary assets increases the capability of a firm to respond to market change
  • Enabling learning:
    • Close contact to other firms can enhance knowledge transfer and creation of new knowledge applicable in further development efforts
  • Sharing risk and costs:
    • Joint implementation of technology development efforts characterized by uncertainty reduces individual firm’s share in the associated risks and costs

2 fundamental problems of innovation: Discuss in context

  • Need Information
    • Utility and preferences of customers
    • What kind of advantage should the information provide, what problem should be solved?
    • Access to need information allows to put the right innovation to the market
  • Solution Information
    • How can a certain need be satisfied with a product or service?
    • What kind of (chemical, physical, Need biological etc.) principle should be applied to solve a problem? Information
    • What kind of technology should be used?

Problem with Access to Need information

Sticky Information (von Hippel, 1994)

  • Access to customers often difficult Solution
  • Needs are oftentimes hard to Information articulate(善于表达的)
  • Oftentimes people do not know what you want(ed) unless you see the solution
  • “If I had asked people what they Doing things right Realization wanted, they would have said faster horses.” (Henry Ford(?))

Problem with Solution Generation (Information)

Local Search Bias

  • For (new) problems, people often try known solution (principles)
  • Oftentimes, this is useful (in particular if Need the problem is only slightly modified)
  • For radically new problems, however, this approach is often a dead end street
  • Tendency to avoid new ways of doing things (NIH syndrome: Katz and Allen, 1982)

→ New approaches must be taken, old concept procedures must be questioned in order to find (really) new solutions

TODO: discuss!!!! in context怎么做

User Integration

这一部分列举了几种User Integration 的方法, 要把每种都记下来

Ways to Integrate the User in the Innovation Process
  • Search for lead user inventions (“Lead User method”)
  • Observe users in (online) communities (“empathic design” and “netnography”)
  • Provide infrastructure for users to co-create (“ideation contests” and “user toolkits for innovation”)
The Lead User Method

What is Lead User

Lead users face needs that will be general in a marketplace – but much earlier

Lead users are positioned to benefit significantly by obtaining a solution to their needs

  • What do I want to achieve by using the Lead User method
    • Identification of innovative and radical ideas to diversify business activities
    • Develop innovative insights into technical solutions for existing (technical) problems
    • Generating trend explorations
    • Identification of product requirements from user perspective
  • What do I need to use the Lead User method
    • High resource effort, demands also participation of senior (experienced) developers from company in project team
    • Dedicated training in lead user identification
  • How do I apply the Lead User Method?
    1. Definition of project focus and scope
      • Definition of project team (senior experts)
      • Definition of project objectives
    2. Trend research
      • Analysis of trends and needs in search fields, using secondary data sources and expert interviews
    3. Identification of Lead Users
      • Identification of eligible lead Users using diverse search techniques, pyramiding (networking) or screening
      • Motivation of lead users to participate 4. Lead User Workshop for Concept Design
      • Use of creativity and ”design thinking” methods to foster concept generation
      • Evaluation and internal refinement of ideas
  • What are the benefits of using the Lead User Method?
    • In many (BtoB) industries, most functional novel products have originally been innovated by lead users (e.g. process innovation)
    • Identification of strong market opportunities
    • Concepts are developed with direct input from “lead users”
    • Get new products and services faster to the market, as often needs are immediately translated into solution technologies
  • What do I need to be aware of while using the Lead User Method?
    • Does no work without strong commitment of firm, as high expensed开销很大需要公司的强力支持
    • Works best in BtoB markets, limited use in some consumer markets
    • Motivation of lead users (especially from analog markets) to join workshop
    • Danger of niche orientation, hence combination with conventional concept testing!
    • Legal framework has to be established (NDA, IP)
#Observation of Users

用观察用户的方法来找idea

  • The idea is to either get to know better how someone uses a product or what kind of problems (potential) customers face

  • This can be done by observing professionals do their work, people enjoying their hobbies or users being active in online communities

观察用户有两个方法: Emphatic Design and Netnography

Emphatic Design
  • What is Emphatic Design?
    • The idea is to identify latent潜在的 customer needs by not asking but observing customers in a non-intrusive way during a usage situation.
    • This approach builds on recognition that customers have difficulties envisioning future solutions due to lack of familiarity with technical possibilities and as they are locked in old mindset.
    • The objective is to develop concepts based on unarticulated不被提及的 customer needs. Key is to observe customers in their usage environment by special teams.
    • On the basis of the observations, unspoken customer needs are identified which serve as an input for other methods of concept generation.
  • What do I want to achieve by using empathic design?
    • Gathering information about:
      • Interaction of the product with the consumers environment
      • Customer habits
      • Assessment of emotional and aesthetic product features
      • Not yet articulated or future customer needs
    • Achieve breakthrough designs in potentially shorter product development cycles
    • Field observation can reveal opportunities to commercialize innovations existing users have already developed to improve products
  • What do I need to use empathic design?
    • Specialists or methodological knowledge (anthropologists, ethnographers…)
    • Short process, but demands often longer preparation
    • Low to medium resource demand
    • Good opportunities for outsourcing外包 to specialized agencies, however real learning only when developers are part of observation team, too可以外包但是开发者也要在观察者里
  • How do I apply Emphatic Design?
      1. Search field definition
        • Definition of potential target segments / users for observation
        • Definition of issues observers concentrate on
        • Research team definition
      1. Capturing data
        • Engage in non-intrusive way to capture observations
        • Use photography or video as tools to store and convey data that might otherwise be omitted
        • Note critical incidents and own developments / solutions developed by customers
      1. Evaluation and documentation
        • Share and extract observations
        • Review visual data
        • Cluster observation into need areas
        • Formulate problem statements, not (only) solutions
      1. Reflection and analysis
  • What are the benefits of using empathic design?
    • Gathering a differentiated picture of the needs of customers during usage of products
    • Determine customer requirements which customers cannot articulate or recognize themselves
    • Create opportunities for differentiation strategies, often by also addressing non-core dimensions of an offering (e.g., package instead of content)
    • Rather low cost, low risk method
  • What do I need to be aware of while using empathic design?
    • Lack of objectivity of the results, when too close relationship between researcher and subjects
    • Difficulty to not judge behavior or decisions of constituents
    • Emphatic design cannot replace classic market research, but rather contributes ideas that need further testing
    • Community politics often make it difficult to select few individuals to work with
Netnography
  • What is netnography?
    • Netnography (interNET & ethNOGRAPHY) is a qualitative research approach to analyze the customer and users dialogues in existing (often user generated) online communities分析网上留言
    • The aim is to gain valuable insights especially in the early stages of the innovation process.
    • The empathic and non-obtrusive online observation allows the qualitative assessment of explicitly verbalized and implicitly existing needs, wishes experiences, motivations, attitudes, and perceptions of consumers towards products, services and brands.有助于定性分析需求…
    • As people engaging in these communities often show ”lead user characteristics”, their input is especially valuable.网上发言的人更有lead user特质
  • What do I want to achieve using netnography?
    • Clearly outlined “consumer insights“ and “consumer understandings“
    • Typologies of user groups
    • Identification of user innovations, user generated content as well as product prototypes
    • Identification of opinion leaders, early adopters and lead users
  • What do I need to use netnography?
    • Systematic process to search, extract, and evaluate community input
    • User input data from online communities, boards, blogs…
    • Experienced researchers in finding relevant communities and identifying relevant user input
    • Specialized agencies are available to support this activity外包
  • How do I apply netnography?
    1. Search field definition
      • Systematization of topics, trends, markets and products
    2. Identification and selection of online communities and sources
      • Sources like: Boards, blogs and user generated content platforms
      • Using defined selection criteria
    3. Community observation and software aided data gathering
      • Observation, data storage and qualitative data analysis of topics, issues, threats, profiles and user innovations
      • Software based coding for additional quantitative analysis
    4. Qualitative in depth analysis, interpretation and aggregation of consumer insights
      • Aggregation of consumer insights
      • Description of concepts
    5. Insight translation into product and service solutions
      • Transfer of the results into R&D and marketing projects
  • What are the benefits of using netnography?
    • Classification and positioning of products and brands within a perceptual知觉的 map
    • Because of the passive and unobtrusive不惹眼 observation, companies are able to gain unbiased consumer insights without informing competitors about activity
    • As opposed to more quantitative web monitoring approaches, listening to consumers rather than asking them, understanding rather than measuring consumers’ attitudes and behaviors, are core principles of netnography定性的, 所以不用去量化用户
  • What do I need to be aware of while using netnography?
    • Solutions can be biased by the selected communities/inputs选择的社区不同, 提出的方案也不同
    • Exploitation of customer communities – companies often lack the capability to communicate with communities (communication strategy)
    • Important: What ever you find here, test it with conventional concept testing to make the ”freak” test – not all ”innovative” statements are relevant
    • Scalability: It is hard to evaluate large quantities of qualitative data and find innovative ideas.
Ideation Contests
  • What are ideation contests?
    • Ideation contests are (typically) web-based contests to generate ideas and concepts for new products, services, or designs, addressing a specific task
    • They are based on the crowdsourcing principle of an open call for participation, i.e. broadcasting a task widely and self-identification of participants with either special task motivation or dedicated pre-knowledge.
    • Participants can be external or internal
    • Using both competitive and collaborative mechanisms
    • Submissions are usually evaluated by an expert panel讨论小组, based on a pre-evaluation of participants.
  • What do I want to achieve by using ideation contests?
    • Generate new ideas / solutions and get market insights also from nonconventional audiences as a response to a given task (”challenge”)
    • Generation of an idea pool
    • Identification of experts (lead users) who possess special solution- and/or need information
  • What do I need to use ideation contests?
    • Dedicated online platform and professional community management
    • 3 to 5 month process
    • Marketing budget to broadcast contest
    • Experts to judge the competition
    • Specialized intermediaries available to support activity
  • How do I apply ideation contests? 1. Preparation & task definition - Establish timeline and determine contestant submission structure; recruit judges - Frame task and define rules of participation 2. Promotion stage (ongoing) - Broadcast question; Identify potential participants (e.g.by quick Netnography study) - Advertise contest task via banners, but mostly context specific search-machine 3. Participation stage - Web-based submission of ideas, commenting, evaluations - Community management required 4. Evaluation - Prepare shortlist of submissions using pre-evaluations of participants, internal criteria - Prepare and execute jury meeting 5. Extraction & exploration - Follow-up workshop with winners; communicate results back to every participant Disseminate and investigate best idea, investigate IP

  • What are the benefits of using ideation contests?
    • Looking outside the box, reaching also “non representative” customers and those that are not known to the firm
    • Utilize tournament to foster creativity and dedicated input
    • Fulfills often also additional marketing objectives, ideation contests allow interactive engaged marketing
    • Today often also used to identify potential employees or development partners
  • What do I need to be aware of while using ideation contests?
    • Framing the task (question) neither to narrow nor too broadly
    • Self selection process might not reach the needed experts / innovators
    • Too many solutions / ideas might lead to problems selecting / evaluating the best solution / idea
    • Deviant users, i.e. unwanted content openly posted on company platform
    • Overcoming the problem of ”Not invented here” when reintegrating the winning proposals
    • Balance between fair rules and IP interests

##### User Toolkits for Innovation

这个应该就是快速迭代,用户参与设计

  • What are toolkits for user innovation?
    • The aim of a toolkit is to integrate (potential) users of a product into the innovation process.
    • For this purpose, the manufacturer builds a platform which handles the communication with the customer.
    • These systems provide customers with sufficient “manufacturing related information“ and guide them through the codesign process of expressing their needs and wishes in a usable format.
    • In these systems, different product variants and design options are represented, visualized, assessed and priced in a learning-by-doing process for the user.
    • However, toolkits can be more than this. High-end toolkits offer a theoretically unlimited solution space within the product capabilities of the manufacturer.
  • What do I want to achieve using toolkits?
    • Companies can get into dialogue with a great number of potential and current customers and integrate them into value creation at great scale
    • Help customers to express their ideas and requirements of a customizable product
    • Reduce costs by shifting certain design tasks from the locus of the manufacturer to the customer
    • Increase customer satisfaction by integrating the customer into the design process
  • What do I need to use toolkits?
    • The toolkit needs to be user friendly
    • There needs to be a basic functionality that allows for a simple and efficient creation of new products.
    • There needs to be a pre-defined solution space, in which the user can become creative, to ensure that the solution is executable.
  • How do I apply toolkits?
    1. Develop a user-friendly toolkit for customers
      • Toolkit must enable customers to run repeated trial-and-error experiments and test them rapidly and efficiently
      • Customers should be able to work in familiar design language
      • Toolkit should include a library of standard design modules
    2. Increase flexibility of the product process
      • Manufacturing operations need to be retooled for fast, low-cost production of specialized designs developed by customers
    3. Carefully select the first customers to use the toolkit
      • Best prospects are customers with a strong need to develop custom products quickly and frequently, are skilled and have little experience with traditional customization services
    4. Develop the toolkit continually and rapidly to satisfy leading-edge customers
      • Customers at the forefront will always push for improvements
    5. Adapt business practices accordingly
      • Toolkits fundamentally change the relationship with customers (e.g. a change from person-to-person contact to computer-to-computer interactions
  • What are the benefits of using toolkits?
    • User toolkits enable consumers to develop customized products and applications without having dedicated technical knowledge
    • Toolkits are a very powerful tool to meet the growing demand for customized products and applications
    • Possibility to derive aggregated总数 information about customer needs to strengthen future product development
    • Customized manufacturing lowers the risk of product rejects
  • What do I need to be aware of while using toolkits?
    • Development of creativity of the users strongly depends on the design of the solution space
    • Development of the toolkit can be quite time consuming, complex and expensive
    • Development and technical care of a good toolkit as well as the assessment of developed customer data can be a very complex task
    • The quality of the toolkit is the key towards customers acceptance of the toolkit

One specific method: mini case

Community management

###Leadership

  • Transactional leadership
    • Exchange-oriented leadership (reward or punishment for good or poor performance)
    • Transactional leaders focus on increasing the efficiency of established routines and procedures and are more concerned with following existing rules than with making changes to the structure of the organization
    • Also called: Managerial leadership
  • Transformational leadership
    • Visionary, inspirational and stimulating leadership engendering higher levels of employee performance and satisfaction
    • ”A transformational leader is one who articulates a shared vision of the future, intellectually stimulates subordinates, provides a great deal of support to subordinates, recognizes individual differences, and sets high expectations” (Kirkman et al., 2009)

Factors

Transactional leadership

  • Leaving
    • absence of leadership
    • avoidance of intervention
    • delayed decision-making
    • Example: ”is absent when needed”
  • Passive management-by-exception
    • intervene and make corrections only when things already go wrong - Example: ”waits for things to go wrong before taking action”
  • Active management-by-exception
    • monitor subordinates
    • focus on errors and deviations from standards
    • correct and criticize immediately
    • Example: ”keeps track of all mistakes”
  • Contingent reward
    • set performance goals
    • clarify expectations
    • give recognition upon goal attainment
    • Example: ”expresses satisfaction when I meet expectations”

Transformational Leadership

  • Idealised influence (behavioural)
    • communicate mission and values
    • act as ethical role model
    • Example: ”talks about his/her most important values and beliefs”
  • Idealised influence (attributed)
    • perceived as exceptional, confident and trustworthy
    • Example: ”instills pride in me for being associated with him/her”
  • Inspirational motivation
    • articulate visions and shared goals
    • display optimism talks enthusiastically about what needs to be accomplished
    • Example: ”talks enthusiastically about what needs to be accomplished”
  • Intellectual stimulation
    • encourage others to question assumptions and develop new approaches
    • Example: ”gets me to look at problems from many different angles”
  • Individualised consideration
    • treat subordinates on a one-to-one basis
    • provide coaching
    • Example: ”helps me to develop my strengths”

Leadership and Innovation

其实就是Transformational leadership特棒!

Innoation Phases and Leadership Style

Different leadership behaviors should be exhibited in different stages of the innovation process (behaviors noted in parentheses)

  • Initiation phase: Nurturing (encouraging safety and ideas, being supportive, being open-minded, ensuring a non-judgemental climate)
  • Discussion phase: Developing (obtaining opinions, evaluating proposals, agreeing implementation plans, pushing plans forward)
  • Implementation phase: Championing (selling the proposal to all groups affected, gaining commitment, ensuring participation in implementation)
  • Routinization phase: Validating/modifying (checking effectiveness, identifying weak links, modifying and improving the innovation)
Leadership and Creativity

As compared to transactional leadership, transformational leadership positively facilitated both fluency (number of unduplicated ideas) and flexibility (number of different types of ideas) in brainstorming groups

Right Environment Important
  • Transformational leadership positive performance predictor
  • All 3 transactional factors negative performance predictors!
  • Transformational leadership more positively predicted performance when ”support for innovation” (team climate factor) was high
  • Managers with an internal locus of control (belief that one can influence important outcomes) exhibited greater levels of transformational leadership

  • Transformational leadership positively predicted organizational-level innovation through enhanced support for innovation (organizational climate: perception that the company facilitates the implementation of new products and processes)
How does Transformational Leadership affect Innovative Behavior and Task Performance
  • transformational leadership related positively and significantly to employees’ work engament, both directly nad through enhanced meaningfulness and responsibility
  • work engament related positively and significantly to innovative behavior and task performance

transformational leadership -> work engament -> innovative behavior

Authentic Leadership

Authentic leaders

  • Are aware of their own personal values and beliefs and act in accordance to them
  • Are trustworthy and of high moral character
  • Support self-awareness and personal development among themselves and their followers
how to measure Authentic leadership
  • Self-awareness
    • Understand own strengths and weaknesses and one’s influence on others
    • Sample item: Accurately describes how others view his or her capabilities
  • Relational transparency
    • Show one’s ’true self’ and reveal one’s real thoughts and feelings
    • Sample item: Says exactly what he or she means
  • Balanced processing
    • Ask for opinions that challenge own assumptions and analyze all relevant input before making decisions Sample item: Listens carefully to different points of view before coming to conclusions
  • Moral perspective
    • Show behavior in accordance to one’s personal values rather than external pressures
    • Sample item: Demonstrates beliefs that are consistent with actions

Authentic leadership related positively and significantly to employees’ creativity, both directly and indirectly through improving employees’ “psychological capital”

###Human Resource Management

Principal-Agent Theory

Principal-Agent theory (PAT) deals with relations and contracts, in particular in situations with asymmetric information

Two General Problems covered by PAT
  • P 1: Certain characteristics of the agent not are not known to the principal (Hidden Information)
    • Is it possible to design contracts that only ”suitable“ candidates want to sign it? (Adverse Selection)
    • Is it possible for the agents to (credible) submit their characteristics? (Signaling)
    • Is it possible for the principal to design the contract, that agents (credibly) reveal their characteristics? (Screening)
  • P 2: Agents actions are hard /impossible to monitor (Hidden Action).
    • What actions should be taken to monitor the agent?(Monitoring)
    • Is it possible to design contracts in a way that the agents choose the ”right“ actions (Moral Hazard)

Adverse Selection is a situation where information asymmetry lead to non-optimal results in a market

adverse selection是一种因为信息不对称带来不利结果的情形, 解决这个情形有两个方法:

Signalling is a mechanism where the agent credibly conveys information about itself to the principal

就是agent主动地去和principal表达自己的信息

Screening is the opposite of signaling, the principal takes action to reveal the true characteristics of the agent

principle主动地去试图找到agent的真实面目!

主要说signaling, human capital也要背…. signaling是说工作经验, 工作中获得的评价更重要. Human capital theory 是说学历更重要

Human capital theory explains these differences due to different stock in human capital (Knowledge, skills, capabilities)

Signaling theory

  • The job market values these characteristics differently
  • Highly intelligent people are likely to be of high productivity
  • Highly intelligent people do also invest more in their human capital
  • Salary in this perspective is not regarded as an immediate consequence of education. Rather, education signals a higher intelligence (in general)

Differentiation:

  • Human capital theory: Education increases productivity
  • Signaling Theory: Education certificates reveal productivity
Hidden Action Problems

Central question: How can the principal induce the agent(s) to choose their actions in the principal’s interest

2 ways for solving this issue

  • Reduction of information asymmetry (monitoring)
  • Alignment of interests

Monitoring the principal aims to control the actions of the agent, in order to have the possibility to avoid or sanction opportunistic behavior

Monitoring leads to two types of costs for the principal:

  • Direct costs (e.g. cameras, supervisors)
  • Indirect costs (z.B. Reduction of creativity, trust issues)

Possible problems with monitoring:

  • Monitoring is not perfect
  • Monitoring is basically possible but not contractable

Alignment of Interests

共同利益? 利益绑定. 就是怎么不通过监视使员工好好干活

One option: Performance based payments

Alternative: Change of working conditions

Possible problems:

  • Incentives lead in the wrong direction: Dysfunctional behavioral responses where agents emphasize only those aspects of performance that are rewarded (Prendergast, 1999)
  • Incentives are demotivational (for the incentivized person, for other individuals)
  • Incentives could lead to increased risk taking (Option-Theory)
  • Incentives have other unintended effects

If Performance Based Payment Does not Work

  • Make employees feel like a part of the organization
  • Ensure security of workers
  • Try to ensure that more effort is not a downside (employees ’like’ working hard)
  • Company success = individuals’ success
  • Psychological ownership心理上成为主人! (Sieger et al., 2013)

Persons’ Roles in the Innovation Process

The Champion

推到创新的人

Champions are necessary to overcome the social and political pressures imposed by an organization and convert them to its advantage

  • Step 1: Study among managers
    • Think of an innovation in recent years
    • Was there a particular individual responsible for this innovation?
    • Name five actions which the individual actually performed that you consider being representative of his or her support of the innovation
    • Elimination of duplicates, non-activities, very specific actions: List of 102 potential activities of an innovation champion
  • Step 2: Scale development with alumni of a business school
    • Think of an innovation in recent years
    • Was there a particular individual responsible for this innovation?
    • Please evaluate this individual’s behavior with respect to the activities on this list
    • Selection of top answers and principal component analysis
Leadership vs Champion Behavior
  • Leadership
    • can induce innovation-related behavior by changing the situation I This can be done by each and every manager
    • Key Questions:
      • How much autonomy should be granted?
      • How should expert-knowledge of the superior be used?
  • Championship literature stresses direct motivational influences: I Expresses enthusiasm and confidence
    • Persists under adversity
    • Gets the right people involved

champion能带来好的也有坏的

  • Expectations
    • Commitment
    • Imagination and creativity
    • Leadership
    • Expertise
    • Analytical skills
    • Diplomatic skills
    • Good knowledge of the organization
  • Risks
    • Unrealistic idealization of one hero
    • Diffculty of an ex ante identification of the right champion
    • Dependency of the organization on a single person
    • Limited management capacity of a single person
    • Cooperation with other key persons is not defined
Promoter促进者 Roles

Promotor models are based on the following assumptions:

  • The innovation is confronted with different kinds of barriers
  • To surmount克服 these barriers different kinds of power-bases are needed
  • In utilizing these power-bases, promotors provide valuable contributions to an innovation
  • Barriers, power-bases and contributions define a promotor role

什么是促进者

  • Promotors
    • are persons, which actively and intensively support an innovation
    • start an innovation process
    • sustain a high activity level
    • terminate the decision process
  • Promotors by hierarchical power (power promotors):surmount barriers of will through their hierarchical potential
  • Promotors by know-how (expert promotors): surmount barriers of capability through their expert knowledge

两种促进者的

  • The Power Promotor
    • has access to material resources
    • acts as an investor
    • legitimizes projects
    • influences personnel decisions
    • blocks opposition
    • protects expert promotors
    • influences priorities and schedules
  • The Expert Promotor
    • knows critical details
    • develops alternatives
    • evaluates external solution proposals
    • implements concepts
    • tests prototypes
    • solves problems

Process Promotor

  • Barriers might also be organizational and administrative resistance (”We are not allowed to do that“)
  • Promotor needed that has
    • ”positional“ power
    • knowledge of the organization
    • social competence
  • Contributions
    • Knows concerned people
    • Links sponsors and experts
    • Steers the process through all stages
    • Leads and moderates the innovation team

Relationship Promotor

  • Has a central position in external exploitation networks
  • Knows the rules of the market and regulatory institutions
  • Has social competence, and good external networks
  • Finds external innovation partners and links them with internal ones
  • Plans, controls, moderates exchange processes, supports flow of information I Builds trust, solves conflicts, supports common goals with external partner

Technological Gatekeeper

  • Expert knowledge, particularly from outside the organization
  • Good position in knowledge networks (”Research communities“ and/or ”communities of practice“)
  • Social competence and personal credibility: opinion leader
  • Search for technical information; funneling, assessment, consolidation and storage of information
  • Selection of technical information; translation, preparation, interpretation and dissemination of information
  • Promotion of socialization processes within the work group
  • Helps to develop personal contact to external information partners

Quality Assurance Note 2 - Time automata

Quality Assurance Note 2 - Time automata

这里是关于Quality Assurance课程的第二篇整理笔记

##简介##

Time automata是用于描述系统结构的另一种方法, 和上一篇中提到的Kripke Structure相似.

当我们在使用Kripke Structure 试图描述一个系统的时候, 我们会发现一个问题: Kripke Structure 怎么描述带有时序的系统呢?

所以我们引入了一个时序变量, 使得状态机能够表达时间的顺序.

这就是今天要说的Time Automata.

##Definition of Time Automata##

Timed Automata, extend finite automata with clocks and clock conditions

  • Clocks run continuously (they do not stop)
  • All clocks run with the same speed (synchronous and uniform)
  • Clocks may be reset to zero (at transitions)
  • Clocks may affect which transitions can fire (clock conditions)
  • Clock domain: positive real numbers and zero \((\Re^+ \cup {0})\)

一般来说, 我们用单个小写字母来表示时钟, 例如 x, y, z.

举个例子!

上面这个图中有两个状态, 在这两个状态之间通过transition连接, 每个状态也有labeling function来表示他们自己 (\( S_1,S_2 \), 注意不是 \(x \leq 2\), 因为x在这里只是时钟变量, 并不是表达一个状态的labeling function).

如果只看这三个部分的话, 这张图和普通的Kripke Structure没有任何区别

但是请注意我们这张图上又添加了了一些元素, 例如 \( x:= 0, x > 1, x \leq 2\)之类的, 下面就让我们说说这些是什么

  • 在transition上面的表达式(x>1, x:=0), 我们称作guard(转换条件), 它的解释是

    Transitions can only fire if the current clock values satisfy the guard (guards enable progress)

    这里的fire 意思是”发生”

  • 写在状态上面的表达式 (\(x \leq 2\)), 我们称作invariant

    The automaton can only stay in a state as long as the invariant is true (invariants ensure progress)

所以一个time automata应该是这样的:

还有许多关于这个图的语义描述和语法描述我就不写下来了, 这种概念的东西背背就好

##Networks of Timed Automata##

涉及到时序的问题的话就会涉及到系统间的消息的传输问题, 就有了同步和异步的概念.

在time automata里面的消息传输有两种方式, 一种是双边同步(Binary Synchronization), 第二种是广播同步(Broadcast Synchronization).

双边同步

一方为发送方, 另一方为接收方, 他们两者都是阻塞的. 意思就是只要有一方没有准备好, 另一方就会一直等待.

广播同步

一方为发送方, 接收方可以有多个. 接收方式阻塞的, 它们会一直等待消息的到来, 但是发送方是非阻塞的, 一旦发送了消息, 它就会直接进行下一步动作

Region and Zones

Time automata十分好用, 因为它更加接近现实生活.

但是问题来了, 计算机是一个有限的状态机的集合, 但是time automata是一个无限状态机. (因为从0秒到1秒之间是可以分成无限个时间片段, 现实世界是连续的模拟量!)

我们的解决方案就是把无限的状态机用一个固定的量程切分, 就像尺子把一段距离切分成许多毫米组成的片段一样.

这里我们使用的量程是1秒.

比如这个例子:

时钟是x. 让我们用秒做单位进行切割

  1. \( x = 0\)
  2. \( 0 < x < 1\)
  3. \( x = 1\)
  4. \( 1 < x < 2\)
  5. \( x = 2\)
  6. \( 2 < x <3\)
  7. ….

其实从x>2之后我们就没必要再写了, 因为当 \(x \geq 2\) 的时候x又会被\(x:=0\)赋值成为0.

根据我们分割的结果, 我们就可以画出这样的有限状态机

有没有发现现在的图形就很像是最开始提到的Kripke Structure, 这就是Region操作的意义, 把复杂的Time automata转变为简单的Kripke Structure, 从而使得计算机可以运算.

另外!

上面的图形其实有很多冗余的部分, 比如x=0, 0<x<1, x=1, 1<x<2 这4部分都可以合并在一起, 成为一个状态.

于是我们就像下图一样把一样的地方圈出来!

最后得到的结果是这样!

到此为止, Time Automata就彻底变成Kripke Structure的一部分啦!

总结

这个部分主要讲的是怎么用Timed automata来描述一个系统并如何把time automata转变成普通的Kripke Structure.

就这样!

Quality Assurance Note 1 - Model Checking

Quality Assurance Note 1 - Model Checking

2016.12.15

决定还是用中文.

Quality Assurance of Embedded Systems 是EIT Digital: Embedded Systems第一学期TU Berlin的必修课程

一开始学习的时候觉得挺没劲的感觉都是概念和公式, 但是经过半个学期的学习发现这里面也有些有趣的思想和逻辑. 所以就想着反正以后要复习的, 不如现在就把现在的理解记录下来, 对以后的复习也有帮助.

之前做了思维导图, 这里的话就根据思维导图的笔记整理一下.

简介

到目前为止, 我们讨论的话题都还是以model checking为主. 一般来说保证质量的方法有两种: Formal VerificationSimulation and Testing.

Formal Verification(形式化证明):

  • Formal proof of properties of a model of the system
  • All possible inputs and system behaviors are considered Prerequisite: formal model
  • complete and costly

Simulation and Testing(模拟和测试)

  • Sampled execution of a model (simulation) or of the implementation (testing)
  • No universal propositions
  • incomplete and cheap and simple

Model Checking是一种Formal Verification 的方法.

他的目标是:

Goal: show that a model of the system (specification) satisfies given properties (requirements)

就是为了证明某种系统架构确确实实的符合了需求的描述

##How to modelize a system - Kripke Structure ##

先从怎么怎么描述一个系统的model开始, 一般来说, 我们用Kripke Structure来描述一个待证明的系统

略过详细的定义(可以从Wikipedia里面找), 用大白话描述一下这个东西.

一个完整的Kripke Structure由四个部分组成:

  1. 一个有限的状态集合
  2. 一个初始状态的集合(意味着可能有多个初始状态)
  3. 从两个状态之间的转换(transition)
  4. 每个状态要有个labeling function, 也就是状态的描述式

举个例子1!

比如有这么一段C代码(为了有行号我要贴图)

我们可以从这段代码找到这几个变量

  1. int x
  2. int v
  3. int u
  4. main线程的行号计数器\(pc_m\)
  5. thread线程的行号计数器\(pc_t\)

先说明一下join()函数的意思是等待线程的结束, 在这个例子1里面就是等待thread()线程返回.

于是根据代码一步步往下走就能得到完整的Kripke Structure.

下面说说画Kripke Structure的几个要注意的地方:

  1. 行号计数器的值为某一行时, 这一行的代码并未被执行. 被执行的是上一行的代码:

    例如, 初始状态是\((x=0,pc_m=9)\), 在这个状态的时候fork(thread)并未被执行, 所以 \(pc_t= \emptyset \) ( \( \emptyset \) 是空集的意思 )

    再比如在 \( (x=0,pc_m=11,u=0,pc_t=5,v=0) \)的状态时, 虽然 已经有了 \(pc_t=5\), 但是x并没有被赋值.

  2. 建议是每一步都画下来, 因为后面有算法去精简的, 所以没必要吝啬笔墨

##How to describe a requirement - LTL & CTL##

这里说的是怎么描述需求! 这一点一定要牢记

先从三个不怎么重要的概念开始, 不是特别重要, 可以略过

怎么定义一个需求的重要程度

我们可以分成3个不同的等级.

  1. Safety: something bad will never happen
  2. Liveness: something good will eventually happen
  3. Fairness: something is true infinitely often

第三个有点难翻译…意思就是好的事情会发生, 坏的事情也会发生, 而且他们发生的概率是相同的. (想想fairness - 公平的)

下面说两种描述

LTL (Linear Temporal Logic)

如果一系列在需求中的一系列事件是顺序发生, 而且只有一条执行路径, 那么就可以用LTL描述

CTL (Computation Tree Logic)

如果这些需求里面可能有多条执行路径, 那么就可以用CTL 描述

举个例子2!

举个起床的例子…

LTL:

早上7→点闹钟响了→醒了→下床

因为没有其他的可能性了, 所以是LTL

CTL:

 下床 ┬→刷牙-洗脸━┳→吃早餐
     └→洗脸-刷牙━┛

在下床之后出现了两条路径, 先洗脸和先刷牙, 所以这就是CTL

接下来就是这一段的重点了, 背一大堆符号表, 因为我们可以用这一对符号来描述需求!

决定直接贴图算了, 要详述的话再说.

用来描述LTL的符号:

用来描述CTL的符号

可以看到描述CTL的符号比LTL的就多了几个Path quantifier而已.

下面是几个基本的CTL用到的表述, 重要!


总结一下

这一章我们主要讨论了这2个问题

  1. 怎么描述一个系统的架构: 使用Kripke Structure的状态来描述
    • 有些系统是单路径的, 我们把它称为LTL
    • 另一些系统是多路径的, 我们把它称为CTL
  2. 怎么描述需求: 我们使用一些描述符去描述需求
    • 有些符号是CTL专有的, 例如: A (所有路径上)

这两个问题是Quality Assure的基本问题, 只有当系统和需求都能被量化之后, 我们才可能去定量的分析系统的优劣和确保系统的稳定.

Some notes about Linux Device Tree

Part 1 Kernel 相关文档

找到kernel的这个文档:

https://www.kernel.org/doc/Documentation/devicetree/bindings/mtd/partition.txt

这里面说的很清楚怎么给nand分区

Part 2 关于 address-cells, size-cells 是什么意思

这得从 reg 字串开始说起,

reg 字串其实就是一个用来存某个空间的首地址和空间大小的存储器

但是呢, 受制于32bits的兼容问题, 所以首地址和空间大小必须以8byte=32bits的大小来存储

这就像英美数字表示法里面的逗号comma, 如果是999以下的数字用英美数字表示法就是纯粹的999, 但是大于等于1000的数字, 用英美数字表示法就变成了”1,000”.

这就可以说是在英美数字表示法里面用3位的10进制作为单位存储一个大数字.

类比在 Linux device tree里面, 它用 8位的16进制(=32位的二进制)作为单位存储一个大数字.

比如我们要表达一个8GB的数字, 十进制的8GB = 0x100000000 (8个0) , 用device tree 的表达方法就是应该为 8GB = 0x1 0x00000000

这样问题又来了, 作为程序, 我怎么知道一串数字 <0x1 0x00000001 0x1000000>

哪一部分是空间首地址, 哪一部分是空间大小呢?

所以, 就有了 #address-cells , 和 #size-cells 这两个字段

这两个东西都是用来描述 reg 这个字串的, 他们描述了, 在描述首地址或者是空间大小时,使用了多少个8bytes 字符

举个栗子

example

这个是kernel文档里面关于flash分区的一段描述

这个flash的分区里面的 #address-cell =1, #size-cells=2 所以, 在他的 reg 字段里面, 第一个8bytes 字符表示的是这个分区的起始地址, 第二和第三个8bytes字符表示的是这个分区的大小

关于一些其他的知识, 在kernel的文档里面说的很清楚: https://www.kernel.org/doc/Documentation/devicetree/booting-without-of.txt

In general, the format of an address for a device is defined by the parent bus type, based on the #address-cells and #size-cells properties. Note that the parent’s parent definitions of #address-cells and #size-cells are not inherited so every node with children must specify them. The kernel requires the root node to have those properties defining addresses format for devices directly mapped on the processor bus.

Pasted from https://www.kernel.org/doc/Documentation/devicetree/booting-without-of.txt

另外这里提到的OF, 也就是Open Firmware, https://en.wikipedia.org/wiki/Open_Firmware

这个是基于PowerPC的一个bootloader啦

Part 3 博通的NAND的device tree的描述格式

在这里, 讲的很清楚, 连例子都有

https://www.kernel.org/doc/Documentation/devicetree/bindings/mtd/brcm,brcmnand.txt

Using Jenkins to Build Wince

Part 1 历史由来

好了, 这次让我们说中文, 就不瞎掰扯自己的垃圾英语水平了.

公司项目里面用的是Windows CE 5.0 嵌入式系统, 这是个非常老旧的操作系统, 没记错的话整个系统只能有32个用户进程, 每个进程还不能完整使用全部的虚拟内存地址.

关于这套系统: https://en.wikipedia.org/wiki/Windows_CE

这套古老的系统我维护了一年了, 工作是维护HAL, 也就是硬件外设层的代码.

因为系统的古老所以一直以来这个项目的版本发布都是依赖于每个开发者自己编译和发布.

有个10年前的子项目的发布步骤繁琐到令人发指, 照着文档做都很难完全做对.

这样带来的问题可想而知, 去年我就因为发布的时候漏掉了一步导致被投诉…

做维护的事情就是很烦而且还要负责任.

那次事故之后, team里面就申请了一台服务器上的虚拟机用作专门版本发布.

我就在工作之余慢慢研究整个的工作流程怎么移植到这台专用机器上面.

Part 2 Jenkins

Jenkins, http://jenkins-ci.org

这应该是一个主流的自动化编译服务器框架吧.官网上说他的好处如下:

Jenkins offers the following major features out of the box, and many more can be added through plugins:

Easy installation: Just run java -jar jenkins.war, deploy it in a servlet container. No additional install, no database. Prefer an installer or native package? We have those as well.

Easy configuration: Jenkins can be configured entirely from its friendly web GUI with extensive on-the-fly error checks and inline help.

Rich plugin ecosystem: Jenkins integrates with virtually every SCM or build tool that exists. View plugins.

Extensibility: Most parts of Jenkins can be extended and modified, and it’s easy to create new Jenkins plugins. This allows you to customize Jenkins to your needs.

Distributed builds: Jenkins can distribute build/test loads to multiple computers with different operating systems. Building software for OS X, Linux, and Windows? No problem.

在公司的项目中确实也有很多在用他来管理的, 所以大家的学习使用成本很低.

但是问题是这是第一次在WINCE, 或者说是windows平台上进行这种automation的工作.

宿主机器是Windows XP系统!

PS: WINDOWS不死, 程序员的世界永远不会更美好.

Part 3 Jenkins 用户权限管理问题

这是安装Jenkins一开始就遇到的问题..

注册了一个编译用的账号然而权限不足, 我是用直接改 Jenkins目录下 config.xml 的方法解决的额.

可以参考这个: http://www.cnblogs.com/gao241/archive/2013/03/20/2971416.html

关于怎么在Windows XP 下面重启Jenkins, 我机器上面的是以服务模式运行的, 所以用的方法是直接在 CMD里面 输入:

sc stop jenkins
sc start jenkins

就直接吧编译账号变为最高权限吧, 反正没几个人会用的.

Part 4 Windows CE 通常的编译方式

Wince的编译有两个模式, 一个是编译kernel, 第二个是编译应用,

因为有IDE的存在, 所以如果按照Wince 正常的工作模式, 编译也就是点两个按钮的问题.

但是因为我们发布的是库文件, 所以要用到命令行下的编译工具

Build.exe

但是通过先人传承下来的workflow, 我们需要

  1. 将对应的硬件的 BSP 放到 C:\WINCE500
  2. 打开IDE
  3. 通过IDE打开对应硬件平台的工程项目文件
  4. 点击菜单栏的 Build Tools -> Open Build Source
  5. 在弹出的命令行用cd 命令定位到我们项目的Git根目录
  6. 输入 build -c 编译

这需要极强的人工参与, 这也是为什么每次发版本效率极低

# Part 5 使用Windows Batch Command进行编译

通过网上查找资料, 还有自己的对比, 发现其实

点击菜单栏的 Build Tools -> Open Build Source

这一步弹出的窗口, 是一个已经预设过环境变量的CMD窗口而已,

之所以能通过输入build命令, 调用Build.exe程序, 就是因为在这个窗口的PATH环境变量里面吧build.exe所在的目录包含了.

所以通过使用set命令比对 原始的CMD窗口的环境变量 和从IDE里面打开的窗口的环境变量, 就能得到在编译时候的窗口环境了.

经过试验, 这样做是可行的, 于是进行下一步

# Part 6 Python进行流程控制

如果是单纯的编译就没那么麻烦了,

但是发布版本还涉及到文件的移动拷贝, 还有打包的工作

试图完全用Windows Batch Command 脚本来写整套逻辑的, 发现BAT脚本在逻辑处理上面真的是很糟糕, 于是就决定用python来进行一些逻辑层的处理

写了一个auto.py脚本和几个作为实施者的BAT脚本.

想到几个地方要注意的:

  1. 必须要是同步的, 在实施者执行命令的时候必须等待, 否则会出编译错误
  2. 最好每一步打好时间戳, 方便调试

不得不承认这是我第一次用Python写工具类应用, 之前都是解一些算法题什么的所以功力不够.

必须要是同步的, 在实施者执行命令的时候必须等待, 否则会出编译错误

这一个的解决方案是用 模块subprocess 的Pipe.open()Pipe.wait() 实现的.

可以参考这里:

小心subprocess的PIPE卡住你的python程序

避免python Popen阻塞

最好每一步打好时间戳, 方便调试

这个就很简单的调用 time 模块就行了

教程: python 获取当前时间

Part 7 SSH 的问题

这个问题是在尝试吧 GIT 仓库管理的部分集成在 auto.py 里面的时候遇到的, 虽然现在把这一块的管理移出到使用Jenkins插件了, 但是还是可以记录一下.

ssh实现免密码登陆的话, 需要把私钥存在 ~/.ssh/id_rsa 文件里面, 于是我可以用Git bash里面的小型的cygwin来运行这个 auto.py 并且把准备好的私钥文件copy到~/.ssh/ 里面就好.

然后在Jenkins的 Jenkins设置里面, 把shell的路径指定到 C:\Program Files\Git\bin\bash.exe 也就是GIT bash的可执行文件, 这样Jenkins在执行shell 命令的时候就会调用我们配置过SSH 私钥的Terminal了.

Study Notes of React Tutorial

The Link of React Tutorial: http://facebook.github.io/react/docs/tutorial.html

Above is the tutorial which told me that I need to setted up a node.js server

About installing the Node

npm install node server.js By the command above, I can start a Node.JS server on 127.0.0.1:3000

I have not used any node.js server anymore, so I searched some topic about what the “npm” it is.

The link of the usage of npm: http://www.tutorialspoint.com/nodejs/nodejs_npm.htm

For my MAC, I use brew to install node.js, the command is:

brew install nodejs The GIT repo address of my learning is: https://git.coding.net/pipicold/react-test.git

About the fundamental knowledge

To create a React component: React.createClass()

While creating a component, a important method is

render: ()

In this method, you can added some codes for when your component is firstly added.

You do not have to return basic HTML. You can return a tree of components that you (or someone else) built.

ReactDOM.render() instantiates the root component, starts the framework, and injects the markup into a raw DOM element, provided as the second argument.

first render

The class name of a component equals the name of the tag

example:

If I defined a class named “CommentBox” by the code:

var CommentBox = React.createClass();

I should call this component by:

ReactDOM.render(        <CommentBox />,        document.getElementById("content"))

Composing Components

I found that maybe React cannot divide the code into separated files

Firstly, I wrote 3 files

  1. tutorial2.js

var CommentList = React.createClass(   
    {           
        render: function(){         
            return(         
               <div className="commentList">     
                    Hello, I am a CommentList      
               </div>        
            );
        }
    }
);
var CommentForm = React.createClass(
    {            
        render:function(){                
            return(                        
                <div className = "commentForm">                        
                    Hey, I am a Comment Form                      
                </div>
            );            
        }        
    }        
);

  1. tutorialall.js
var CommentBox = React.createClass(
        {
render: function(){                
return (                        
        //'className' means 'class' in standard HTML
        <div className = "commentBox">                        
        Hello pipicold                        
        <h1>Comments</h1>
        <CommentList />                        
        <CommentForm />                        
        </div>                      
       );  
}        
}        
);
ReactDOM.render(
        <CommentBox />,      
        document.getElementById('content')        
        );

  1. index.html
<!DOCTYPE html>     <html>  

<head>    

<meta charset="utf-8">

<title>React Tutorial</title><br><!-- Not present in the tutorial. Just for basic styling. -->    

<link rel="stylesheet" href="css/base.css" />    
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.7/react.js">
</script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.7/react-dom.js"> </script>    

<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.15/browser.js"> </script>    

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.min.js"> </script>    

<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/0.3.5/marked.min.js"> </script><br></head>  

<body>    

<div id="content"> </div>    

<script type="text/babel" src="scripts/tutorial2.js"> </script>    

<script type="text/babel" src="scripts/tutorialall.js"> </script><br></body> </html>

It will not work.

After I merged those two JS file into one, the page went to normal.

Using props

the braces seems to mean the call of properties


<div className="comment">
<h2 className="commentAuthor">
{this.props.author}  
</h2>  
{this.props.children}       
</div>

what should be came up with is that the {this.props.children} means the elements between the tags: <Comment> </Comment>

Component Properties

Pass the properties like original HTML

render: function(){                
    return(                        
            <div className="commentList">                        
            <Comment author="Mrs. Wu"> I do not like baby</Comment>
            <Comment author="Mr. Wu"> I don't like baby</Comment>  
            </div>
          );            
}

By the way, I found that it is unimportant for the sequence of each Component, you can put a Component at any where but should before the line :

ReactDOM.render();

Besides, you can use any characters between tags in JSX

The rendered page showed like follow:

first render

Adding Markdown

http://facebook.github.io/react/docs/tutorial.html#adding-markdown

Marked is a external library wirtten in JS

offical usage in its github website: https://github.com/chjj/marked

<!doctype html>
<html>
<head>
  <meta charset="utf-8"/>
<title>Marked in the browser</title>
  <script src="lib/marked.js"></script>
</head>
<body>
 <div id="content"></div>
  <script>    document.getElementById('content').innerHTML =      marked('# Marked in browser\n\nRendered by **marked**.');  </script>
</body>
</html>

Whlie applying it to React, just us the braces to run your JS code

the content in the braces means the JS code, outside of that is the HTML part

besides, you cannot use “;” in the return, reason:

http://blog.csdn.net/lihongxun945/article/details/45826851

因为 React.createElement(“div”, null, var a = 1;) 是语法错误。

那么你也可以理解为什么大括号中的js表达式不能有分号结尾了吧。

需要注意的是,如果你在属性中输出JS变量,是不能加引号的,不然会被当做字符串而不被解析。

应该是这样:

the renderred page is like this:

first render

according to the description of React’s tutorial

That’s React protecting you from an XSS attack. There’s a way to get around it but the framework warns you not to use it:

two steps:

  1. using html: tag
rawMarkup: function() {
    var rawMarkup = marked(this.props.children.toString(), {sanitize: true});
    return { __html: rawMarkup };
  },
  1. using span tag
<span dangerouslySetInnerHTML={this.rawMarkup()} />

caution! you must use comma to separate two functions


var Comment = React.createClass(
        {
            rawMarkup: function()
            {
                var rawMarkup = marked( this.props.children.toString(), {sanitize:true});
                return {__html: rawMarkup};
            },//be careful of this comma!!
            render: function(){
                return(
                        <div className="comment">
                            <h2 className="commentAuthor">
                                {this.props.author}
                            </h2>
                            <span dangerouslySetInnerHTML={this.rawMarkup()}/>
                        </div>
                        );
            }
        }
        );

Hook up the data model

It is so fun and free while using function in JavaScript:

http://www.jb51.net/article/22742.htm

再有一个值得说一下的,就是JS中的函数的参数不一定是严格匹配的,通常的编程经验,比如有这样一个函数 fun(aa,bb),那么我们在调用这个函数的时候就应该给他传递两个参数。但是在JS中,我们可以给他传递任意个参数,1个,3个,等等,都可以。JS中的参数传递,不完全是按照函数声明时指定的那些参数,在每次调用函数的时候,都会有一个命名为arguments的数组,这个数组里面存储了函数调用时,传递进来的所有参数,有了它,我们甚至可以不再函数声明时指定形式参数

Reactive state

To implement interactions, we introduce mutable state to the component. this.state is private to the component and can be changed by calling this.setState(). When the state updates, the component re-renders itself.

Adding new comments

it is so hard for me to debug in React, maybe I should find a way to debug it.

also, I was not so familir with the “function” of Javascript, I should learn about it

It is so tired for me, because it is already 1.30 am now…I must go to bed…

There is an extension for debuging React, on chrome.

学习一下norflash

最近公司项目遇到了两个关于Nor Flash的问题, 于是就学习了一下NorFlash是怎么操作的.

项目的平台是博通(boardcom)的, 不过应该nor的操作是通用而相似的.

首先是找了一个特别好的文章 ===> Nor Flash

文章讲的很清楚, 接下来讲下遇到的问题

1. flash设备的时序

We have been able to track the problem and that’s caused by the fact that factory used slower flash devices on some production batch (100ns Vs 110ns).

遇到的问题是工厂换了一块和现在的IO速度不同的Nor Flash. 然后让我们看看是不是能够修改一下我们这边的设定

发现了可以提供修改的寄存器

2. 查看新的Nor Flash是否合适

用了两款新的Nor Flash, 但是不知道现有的代码是否支持?

主要的配置是有两种方式,

第一种方式, 是查询一个配置表, 里面把现在在产品上面用到的FLASH芯片的配置都列了出来

第二种方式, 是通过查询CFI信息, 获取芯片内部的配置, 关于CFI信息是什么东西

这里有份spansion的文档介绍 ====> Quick Guide to Common Flash Interface

然后还涉及到一个命令集的事情, 其实就是Nor 不仅仅有CFI命令, 还有自己的比如读数据, 写数据, 擦除数据的时候的指令集

之前提到的文章Nor Flash里面有详细的说法.

ok that is all

leetcode, 通过先序遍历和中序遍历构造二叉树

题目:

Construct Binary Tree from Preorder and Inorder Traversal

Given preorder and inorder traversal of a tree, construct the binary tree.

Note: You may assume that duplicates do not exist in the tree.

首先是这个二叉树里面的值没有重复的才行..

否则就怎么也解不出来的..

想了个思路:

比如有这样一个二叉树


    1

   / \

  2   3

 / \   \

4   5   9

   / \

  6   7

       \

        8

他的先序遍历是: preorder = [1, 2, 4, 5, 6, 7, 8, 3, 9]

他的中序遍历是: in_order = [4, 2, 6, 5, 7, 8, 1, 3, 9]

能显而易见看出的是先序遍历的第一个元素永远是根节点..

但是根节点之后的一个数可能是左节点也可能是右节点

而中序遍历的列表里面 根节点1 左边(4, 2, 6, 5, 7, 8)的都是左子树的元素, 右边(3, 9)的都是右子树元素

所以我有了这样的假设

if 在in_order中的根节点位置的左边有数据 then preorder[1]是左子树的根节点

if 在in_order中的根节点位置的右边有数据 then preorder[1]是右子树的根节点

扩展一下

就变成了

if 在in_order中某个位置的左边有数据 then preorder[对应节点的索引+1]是左子树的根节点

if 在in_order中某个位置的右边有数据 then preorder[对应节点的索引+1]是右子树的根节点

反过来想,

以preorder为条件的话.

那么可以变为这个流程

  1. 假设preorder[index] == data

  2. 如果preorder[] 有未被读取过的数据(可能是这种情况 [ 读过, 读过, 读过, 未读过]<- 指针在第2个读过那里)

  3. 那么找到 in_order[in_index] == data

  4. 如果preorder[] 的数据在 in_order[in_index] 左边

  5. 那么preorder[]preorder[index]的左节点

  6. 如果在右边就是右节点啦

于是就可以递归上面的步骤, 直到in_order中的某个位置的数据两边都没有未被访问过数据, 也就是说是叶子节点

卧槽搞了3-4个小时..就为了实现这个逻辑..

终于尼玛A过了,,,看起来简单的算法实现起来真尼玛麻烦

主要问题出在 hasZero() 这个函数上面, 之前的实现是


 def hasZero(direct,search_list, index):

            if direct == "left":

                try:

                    search_list[0:index].index(0)

                except ValueError:

                    return False

                return True

            if direct == "right":

                try:

                    search_list[index:(len(search_list)-1)].index(0)

                except ValueError:

                    return False

                return True


这样的话只要index的左侧或者右侧有0

这个函数的返回值就是True

不过我觉得我的实现好垃圾..

因为运行时间竟然到了916ms, 平均水平我觉得应该是200ms左右…

我的代码


def buildTree(self, preorder, inorder):
        def hasZero(direct,search_list, index):
            pointer= index
            if direct == "left":
                if index <= 0:
                    # print "left False"
                    return False
                pointer -= 1
                while (pointer >= 0):
                    if (search_list[pointer] == 1 and pointer < index -1):
                        # print "left True"
                        return True
                    elif (search_list[pointer] == 1 and pointer >= index -1):
                        # print "left False"
                        return False
                    pointer -= 1
                else:
                    # print "left True"
                    return True
            if direct == "right":
                if index >= len(search_list)-1:
                    # print "right False"
                    return False
                pointer += 1
                while (pointer <= len(search_list)-1):
                    # print pointer
                    if (search_list[pointer] == 1 and pointer > index +1):
                        # print "right True"
                        return True
                    if (search_list[pointer] == 1 and pointer <= index +1):
                        # print "right False"
                        return False
                    pointer += 1
                else:
                    # print "right True"
                    return True
                    
        def recursive(pre_visited, in_visited, preorder, inorder, current_node, pre_index):
            in_index = inorder.index(preorder[pre_index])
        #    if pre_index >= len(preorder)+1:
                #return None
            pre_visited[pre_index] = 1
            in_visited[in_index] = 1
            current_node.val = preorder[pre_index] 
            # print "recursive[", pre_index,"]:in_visited", in_visited, ":pre_visited:" ,pre_visited
            if hasZero("left", in_visited, in_index):
                #there are some un-visited nodes left
                try:
                    next_index = pre_visited.index(0)
                except ValueError:
                    assert(True)
                else:
                    # print "[",pre_index,"] -> left"
                    current_node.left = TreeNode(None)
                    recursive(pre_visited,in_visited,preorder,inorder,current_node.left,next_index)
            if hasZero("right", in_visited, in_index):
                #there are some un-visited nodes right
                try:
                    next_index = pre_visited.index(0)
                except ValueError:
                    assert(True)
                else:
                    # print "[",pre_index,"] -> right"
                    current_node.right = TreeNode(None)
                    recursive(pre_visited,in_visited,preorder,inorder,current_node.right,next_index)
            # print "leaf.val", current_node.val
            return
        if inorder in  [None, [], {}]:
            return None
        if preorder in  [None, [], {}]:
            return None
        root_node = TreeNode(None)
        pre_visited = [0]*len(preorder)
        in_visited = [0]*len(inorder)
        recursive(pre_visited,in_visited,preorder,inorder,root_node,0)
        return root_node
        

leetcode, 判断对称二叉树

题目:

Symmetric Tree

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).

For example, this binary tree is symmetric:

    1
   / \
  2   2
/ \ / \
3  4 4  3

But the following is not:

    1
   / \
  2   2
   \   \
   3    3

Note: Bonus points if you could solve it both recursively and iteratively.

confused what “{1,#,2,3}” means? > read more on how binary tree is serialized on OJ.

OJ’s Binary Tree Serialization:

The serialization of a binary tree follows a level order traversal, where ‘#’ signifies a path terminator where no node exists below.

Here’s an example:

   1
  / \
 2   3
    /
   4
    \
     5

The above binary tree is serialized as {1,2,3,#,#,4,#,#,5}.

刚刚看的时候觉得挺难得, 应该, 因为你看对称啊什么的很难解决,

后来看到这个OJ的二叉树表示法的提示之后就想诶能不能通过吧二叉树转化为列表然后比较列表是否对称就行了啊

说起二叉树转化成列表就又想到了前序, 中序, 后序遍历

比如前序遍历, 它的遍历方法是根->左->右

所以如果是镜像二叉树的话, 前序遍历的结果应该是相当于原始二叉树的根->右->左

所以如果

原始二叉树: 根->左->右遍历 镜像二叉树: 根->右->左遍历

他们分别得到的列表应该是相同的. 就用这个来判断

提交的时候发现不能完全用教科书上的遍历方法

因为有这个case:

[1,2,2,null,3,null,3]

就是这样的树

     1
   /   \
  2    2
 /  \ /  \
#   3 #   3

(# == null)

所以也要把空的子节点记录下来

最后A过的python代码如下

# Definition for a binary tree node.
# class TreeNode:
#     def __init__(self, x):
#         self.val = x
#         self.left = None
#         self.right = None
class Solution:
    # @param {TreeNode} root
    # @return {boolean}
    def isSymmetric(self, root):
        def preorder_left_first(node):
            ret=[];
            if node == None:
                return [None]
            ret.append(node.val)
            ret = ret + preorder_left_first(node.left)
            ret = ret + preorder_left_first(node.right)
            return ret
        def preorder_right_first(node):
            ret=[];
            if node == None:
                return [None]
            ret.append(node.val)
            ret = ret + preorder_right_first(node.right)
            ret = ret + preorder_right_first(node.left)
            return ret
        # logic start here
        if root in [None,[],{}]:
            return True
        if (root.left == None and root.right == None):
            return True
        if root.left == None or root.right == None:
            return False
        left_root = root.left
        right_root = root.right
        if left_root.val != right_root.val:
            return False
        else:
            right_ret= preorder_right_first(right_root)
            left_ret = preorder_left_first(left_root)
            if right_ret == left_ret:
                return True
            else:
                return False
        

leetcode, 非递归, 实现后序遍历二叉树

题目:

Binary Tree Postorder Traversal

Given a binary tree, return the postorder traversal of its nodes’ values.

For example: Given binary tree {1,#,2,3},

1
2 / 3

return [3,2,1].

Note: Recursive solution is trivial, could you do it iteratively?

这个问题貌似是一个挺经典的面试题

先要搞清楚后序遍历是什么

先遍历左节点, 然后右节点, 最后根节点

百度百科里面的递归算法

struct btnode
{
    int d;
    struct btnode *lchild;
    struct btnode *rchild;
};
void postrav(struct btnode *bt)
{
    if(bt!=NULL)
    {
        postrav(bt->lchild);
        postrav(bt->rchild);
        printf("%d ",bt->d);
    }
}

思路是这样的. 虽然有点复杂

有两个堆栈, 一个用来存每个叶子的节点的地址 叫做: pointer_stack,

另一个用来存这个节点是否被访问过,叫做 flag_stack

其实两个堆栈的指针都是走的同一个位置…

把节点存入pointer_stack堆栈的时候, 如果这个节点被访问过的话, flag_stack堆栈会被相应的存入 一个 1

否则存入 0

如果没有子节点可以遍历了就弹出堆栈里面的节点继续遍历.

恩, 于是A过的代码是:

# Definition for a binary tree node.
# class TreeNode:
#     def __init__(self, x):
#         self.val = x
#         self.left = None
#         self.right = None
class Stack:
    def __init__(self):
        self.top = -1
        self.stack=[];
    def pop(self):
        if self.top  < 0:
            return False
        else: 
            ret = self.stack[self.top]
            del self.stack[self.top]
            self.top = self.top - 1
            return ret
    def push(self, x):
        self.top = self.top + 1
        self.stack.append(x)
        return True
    def isEmpty(self):
        if self.top < 0:
            return True
        else:
            return False
    def peek(self):
        if self.top < 0:
            return None
        else:
            return self.stack[self.top]
    def dump(self):
        print self.stack , "top:", self.top
    def bottomValue(self):
        if self.top < 0:
            return None
        else:
            return self.stack[0]
class Solution:
    # @param {TreeNode} root
    # @return {integer[]}
    def postorderTraversal(self, root):
        pointer_stack = Stack();
        flag_stack = Stack();
        ret_list=[]
        if root == None:
            return []
        pointer_stack.push(root)
        flag_stack.push(0)
        while (not pointer_stack.isEmpty()):
            pointer = pointer_stack.pop()
            flag = flag_stack.pop()
            if (flag == 0):
                if pointer.left != None:
                    #1. if has left child, push current position first
                    flag_stack.push(1) #has been visited
                    pointer_stack.push(pointer)
                    #1.2. if right child != None, push right child
                    if pointer.right != None:
                        flag_stack.push(0)
                        pointer_stack.push(pointer.right)
                    #1.3. push left child, due to that, left child will be visited firstly
                    flag_stack.push(0) 
                    pointer_stack.push(pointer.left)
                    continue;
                if pointer.right != None:
                    # 2. if no left and has right, only push current position
                    flag_stack.push(1) #has been visited
                    pointer_stack.push(pointer)
                    # 2.1 push right child
                    flag_stack.push(0) 
                    pointer_stack.push(pointer.right)
                    continue;
                if (pointer.left == None and pointer.right == None):
                    ret_list.append(pointer.val);
            elif (flag == 1):
                ret_list.append(pointer.val)
        return ret_list

看看百度百科里面的非递归算法

好像和我的差不多. 只不过它的二叉树的节点里面可以存储一个tag, 标记有没有被访问过

在网上看到了另外一个不用堆栈的方法, 就是非递归,非堆栈,

也是巧妙的构造了一个特殊的可以存储父节点的二叉树节点来做的

引用:


/**************************************************************
 * $ID: PostOrderWalkOfBST.h
 * $DESC: postorder walk a BST, without stack, no recursion
 * $AUTHOR: rockins chen
 * $DATE: Mon Sep 24 23:15:55 CST 2007
 * $BUG: ybc2084@163.com or
 *        www.dormforce.net/blog/rockins
 **************************************************************/
 
#ifndef    _POST_ORDER_WALK_OF_BST_H_
#define    _POST_ORDER_WALK_OF_BST_H_
//
// BST node definition
//
typedef struct _BST_NODE {
    void    * private_data;        // store private data
    int        key;
    struct _BST_NODE * parent;
    struct _BST_NODE * lchild;
    struct _BST_NODE * rchild;
} BST_NODE, *PBST_NODE;
//
// post order walk a BST
// root denotes the BST
//
extern int PostOrderWalkBST(PBST_NODE root);
//
// find first postorder node of BST
// root denotes the BST(maybe a subtree)
//
static PBST_NODE FindFirstPostOrderNodeOfBST(PBST_NODE root);
#endif
/**************************************************************
 * $ID: PostOrderWalkOfBST.c
 * $DESC: postorder walk a bst, without stack, no recursion
 * $AUTHOR: rockins chen
 * $DATE: Mon Sep 24 23:17:03 CST 2007
 * $BUG: ybc2084@163.com or
 *        www.dormforce.net/blog/rockins
 **************************************************************/
#include "PostOrderWalkOfBST.h"
int
PostOrderWalkBST(PBST_NODE root)
{
    PBST_NODE curr_node;
    PBST_NODE next_node;
    
    // fist go to the first postorder node of BST
    curr_node = FindFirstPostOrderNodeOfBST(root);
    
    // if current node's parent is NULL, then curr_node must be root of BST, finished
    while (!curr_node->parent) {
    
        // if current node is parent node's left child and parent has no right child,
        // then parent is next node to visit
        if (curr_node->parent->lchild == curr_node &&
            !curr_node->parent->rchild)
            next_node = curr_node->parent;
            
        // if current node is parent node's left child and parent has right child,
        // then the fist postorder node of parent's right subtree is next node to visit
        if (curr_node->parent->lchild == curr_node &&
            curr_node->parent->rchild)
            next_node = FindFirstPostOrderNodeOfBST(
                            curr_node->parent->rchild);
        
        // if current node is parent node's right child(implicitly indicate parent node is not null),
        // then parent node is just next node
        if (curr_node->parent->rchild == curr_node)
            next_node = curr_node->parent;
        
        //
        // XXX: now visit curr_node, if necessary
        //
        VisitNode(curr_node);
        
        // step
        curr_node = next_node;
    }
}
//
// find fist postorder node of BST
//
static PBST_NODE
FindFirstPostOrderNodeOfBST(PBST_NODE root)
{
    PBST_NODE pNode;
    
    pNode = root;
    
    while (pNode->lchild || pNode->rchild) {
        if (pNode->lchild)
            pNode = pNode->lchild;
        else if (pNode->rchild)
            pNode = pNode->rchild;
    }
    
    return (pNode);
}
//
// virtual visiting pNode, do nothing
//
static int
VisitNode(PBST_NODE pNode)
{
}


leetcode, 二分求幂实现pow函数

###实现二分求幂

题目:

Pow(x, n)

Implement pow(x, n).

简单粗暴的只用实现求幂函数pow(x,n)

其实网上有一篇挺好的文章:

[http://blog.jobbole.com/74468/]

英文版:

[http://videlalvaro.github.io/2014/03/the-power-algorithm.html]

A过的代码如下:


def myPow(self, x, n):
		y=1
		if n < 0:
			index = -n
		else:
			index = n
		while (1):
			ret = index % 2 
			if ret == 1:
				y *= x
			index /= 2
			if index==0:
				break;
			x *= x
		if n < 0:
			return 1/y
		else:
			return y

刚刚躺床上玩了半个小时手机归来.

试图自己阐述一遍思路:

原理是这样的. 比如2的6次方, 相当于3个2的2次方相乘, 或者是一个2的4次方乘以2的平方.

所以就可以以平方 为单位把求幂的过程分解

假设求x的y次方, 用index 表示 y/2 之后的整数部分的值 用mod 表示y/2 的余数

那么一开始的算式是:

result = x^y

提取一个平方

result = x^2*(x^(y/2)*x^mod) = x^2*x^(y/2)*(x^2)*x^mod

再次提取一个平方

result = x^2*x^2*(x^(y/(2*2))*x^mod)*(x^2)*x^mod
       = (x^2)^2*x^(y/(2^2))*(x^2)^2*x^mod*x^2*x^mod

这里面就有递归迭代的意思了 , 所以呢. 无节操引用个别人的用递归实现的方法

 class Solution 
 {
    public:
    double pow(double x, int n) 
    {
        int index = n;
        if (n == 0)
            return 1;
        if (n == 1)
            return x;
        if (n < 0)
            index = -n;
        double rev = index%2==0 ? pow(x*x, index>>1) : pow(x*x, index>>1)*x;
        if (n < 0)
            return 1 / rev;
        else
            return rev;
    }
 };

另外既然是二分查找, 就可以看到二进制数和二分查找的相关性,

其实这个查找过程就和求二进制数是一样的

不断的除以二然后记录余数…直到商为0

所以可以用遍历幂的二进制形式的方法来解答, 继续盗代码

[http://blog.csdn.net/fengbingyang/article/details/12236121]

double my_pow(double x, int n)
{
	if(n==0)
        	return 1.0;
	if(n<0)
		return 1.0 / pow(x,-n);
	double ans = 1.0 ;
	for(; n>0; x *= x, n>>=1)
	{
		if(n&1>0)
			ans *= x;
	}
	return ans;
}

恩关于应用呢.

在第一篇引用的文章里面有写, 可以做方便的repeat函数用, 因为求幂运算就是不断重复一个


def function_foo(a,b):
	return a*b

的运算, 只不过传进去的是 function_foo(x,x)

所以这样的算法可以降低所有repeat函数的时间复杂度到O(log(n))

linux 用户组配置, 挂载新硬盘

今天上班没事做, 一点事都没…

于是把自己的笔记搬上来

建立Liunx账号

需要在ROOT权限下执行

useradd -m username

新建一个用户名为username的账号

passwd username

为username用户创建密码

Samba 服务

Fedora Samba配置文档

  1. 改/etc/samba/smb.conf 文件, 在最下面加上
    [dongmwu]
    path = /home/dongmwu
    writeable = yes
    public = yes
    guest ok = no
    
  2. 设置密码
    smbpasswd -a username
    
  3. 重启samba服务
    systemctl restart smb.service
    
  4. 记住关防火墙!!!
    systemctl stop firewalld.service
    

修改用户权限

用到的是chgrpchown这两个命令

一开始是这样的

/home1                                               
 $ ll                                                
total 20K                                            
drwxr-xr-x. 2 root root 4.0K May 27 10:11 dongmwu    
drwx------. 2 root root  16K May 26 23:29 lost+found

用 chgrp修改用户组

/home1                                                   
 $ sudo chgrp -R dongmwu dongmwu                       
/home1                                                   
 $ ll                                                 
total 20K                                                
drwxr-xr-x. 2 root dongmwu 4.0K May 27 10:11 dongmwu     
drwx------. 2 root root     16K May 26 23:29 lost+found  

用chown修改用户

/home1                                                           
 $ sudo chown -R dongmwu dongmwu                       [10:15:21]
/home1                                                           
 $ ll                                                  [10:15:27]
total 20K                                                        
drwxr-xr-x. 2 dongmwu dongmwu 4.0K May 27 10:11 dongmwu          
drwx------. 2 root    root     16K May 26 23:29 lost+found       

leetcode, deleteDuplicates删除重复链表

问题

Remove Duplicates from Sorted List

Given a sorted linked list, delete all duplicates such that each element appear only once.

For example,

Given 1->1->2, return 1->2.

Given 1->1->2->3->3, return 1->2->3.

这题终于是自己搞定的了

一开始的时候是觉得这就是个简单的链表所以一次遍历把所有的重复的链表接上就好了

# Definition for singly-linked list.
# class ListNode:
#     def __init__(self, x):
#         self.val = x
#         self.next = None

class Solution:
    # @param {ListNode} head
    # @return {ListNode}
    def deleteDuplicates(self, head):
        if head == None or head == [] or head == {}:
            return None
        tmp=head
        while (tmp.next != None):
            if tmp.val == tmp.next.val:
                tmp.next = tmp.next.next
            if tmp.next != None:
                tmp=tmp.next
        return head

后来发现在[1,1,1,1,1] 这种重复数据的case里面会出错

于是重复调用了自己, 然后这样就能消除多个重复值的影响,

# Definition for singly-linked list.
# class ListNode:
#     def __init__(self, x):
#         self.val = x
#         self.next = None

class Solution:
    # @param {ListNode} head
    # @return {ListNode}
    def deleteDuplicates(self, head):
        if head == None or head == [] or head == {}:
            return None
        tmp=head
        while (tmp.next != None):
            if tmp.val == tmp.next.val:
                tmp.next = tmp.next.next
                self.deleteDuplicates(tmp)
            if tmp.next != None:
                tmp=tmp.next
        return head

但是这样的时间效率好低啊…

时间复杂度应该是O(n2), 如果没算错的话

看看别人的解法

public class Solution {
    public ListNode deleteDuplicates(ListNode head) {
        if(head == null || head.next == null)
            return head;
 
        ListNode prev = head;    
        ListNode p = head.next;
 
        while(p != null){
            if(p.val == prev.val){
                prev.next = p.next;
                p = p.next;
                //no change prev
            }else{
                prev = p;
                p = p.next; 
            }
        }
 
        return head;
    }
}

老子写的真垃圾…

直接通过判断是不是一样的决定指针走不走不就行了…

# Definition for singly-linked list.
# class ListNode:
#     def __init__(self, x):
#         self.val = x
#         self.next = None

class Solution:
    # @param {ListNode} head
    # @return {ListNode}
    def deleteDuplicates(self, head):
        if head == None or head == [] or head == {}:
            return None
        tmp=head
        while (tmp.next != None):
            if tmp.val == tmp.next.val:
                tmp.next = tmp.next.next
            else:
                tmp=tmp.next
        return head

运行时间一下从快700ms降到了80多ms

!!!!

leetcode, count prime数素数

在看之前没写完的一题

Count Primes

Description: Count the number of prime numbers less than a non-negative number, n.

Credits: Special thanks to @mithmatt for adding this problem and creating all test cases.

自己先先写了一个解法

def countPrimes(self, n):
        i=0
        flag=0
        for val in range(0,n):
            if self.is_prime(val):
                i=i+1
        return i;
    def is_prime(self,n):
        for i in range(3, n):
            if n % i == 0:
                return False
        return True

这样的话会超时, 因为时间复杂度是O(n2)

 Submission Result: Time Limit Exceeded
        Last executed input:
                	499979

听了同事的意见, 用求根号来解决

如果n不是素数 n=ab (n>a>1 n>b>1) 那么 a 和 b一定有一个不超过根号n [否则 n=ab>(根号n)*(根号n)=n,矛盾] 于是只要除到根号n就可以判断是否是素数

后来google了一个更加棒的

(http://bookshadow.com/weblog/2015/04/27/leetcode-count-primes/)

class Solution:
    # @param {integer} n
    # @return {integer}
    def countPrimes(self, n):
        isPrime = [True] * max(n, 2)
        isPrime[0], isPrime[1] = False, False
        x = 2
        while x * x < n:
            if isPrime[x]:
                p = x * x
                while p < n:
                    isPrime[p] = False
                    p += x
            x += 1
        return sum(isPrime)

他结合了根号 和 那个筛选法,


while x*x < n:

这一句限制了他在根号内取值, 因为最多x取到 sqrt(n)

然后用一个列表 存储了 筛选的结果

Platform Builder 恢复调试方法

转: platform builder was unable to read the device settings from the datastore问题解决

本文章主要讲的是当安装完CE6后,会发现Platform Builder for CE5的Connectivity Options不好用了,即使修改设置后点Apply也无法把新设置保存住在完全卸载CE6和VS2005后,点PB5的Connectivity Options会弹出这个错误: Platform Builder was unable to read the device settings from the Datastore.

即使把CE5和PB5完全卸载,然后再重装,改错误仍然存在。

方案一:

1、关闭pb的所有进程,确保Cepb.exe, CeSvcHost.exe (CeSvcH~1.exe) and DeviceEmulator.exe 都已停止运行。

2、备份C:/Documents and Settings//local settings/application data/microsoft/corecon文件夹。(可以不用备份,直接删除)

3、备份C:/Documents and Settings/all users/application data/microsoft/corecon/1.0/addons文件夹。(可以不用备份,直接删除)

4、在C:/Documents and Settings/all users/application data/microsoft/corecon/1.0目录下创建一个addons文件夹。

5、将C:/Program Files//CoreCon/SDK/XSL/Addons目录下的所有.xsl问价复制到第四步中新建的文件夹下。

6、将C:/Program Files//CEPB/bin/microsoft.platformbuilder500.servicecategory.xsl也复制到第四步中新建的文件夹下。

注意:你可能找不到/local settings目录,需要在文件夹选项中选择不隐藏系统文件即可。

方案二:

1、在命令行中进入到你的platform目录

如:C:/Program Files/Windows CE Platform Builder/5.00/CORECON/SCRIPTS/

2、依次运行以下命令:

disablecorecon unregister register enablecorecon

注意:这里的path格式应该为”C:/Program Files/Windows CE Platform Builder/5.00”,别忘了加引号。

总结:

第一种方法我试验成功了,第二种方法不知道为什么没成功,但大家也可以借鉴一下

pipicold: 第二种方法我实验成功了, 我的case是, 不知道为什么我的Documents and Settings/user里面的文件被重置了, 然后直接用第二个方法就ok了

Linux学习笔记2

1. 建立linux账号

需要在ROOT权限下执行

useradd -m username

新建一个用户名为username的账号

passwd username

username用户创建密码

2. nfs server

In Fedora, the nfs-utils package is required for full NFS support. Run the following command to see if the nfs-utils is installed:

~]$ rpm -q nfs-utils
package nfs-utils is not installed

If it is not installed and you want to use NFS, use the yum utility as root to install it:

~]# yum install nfs-utils

检查是否安装了nfs

    rpm -qa |grep nfs

[kuaile@localhost ~]$ rpm -qa |grep nfs
nfs-utils-1.2.8-6.0.fc20.x86_64
libnfsidmap-0.25-7.fc20.x86_64

输出这就是已经安装了.

fedora 20 默认是已经安装的.

配置nfs

打开nfs配置文件exports

sudo vi /etc/exports

输入以下

/home/kuaile 192.168.122.1(insecure,rw,sync,no_root_squash)

/home/kuaile 是共享的目录

192.168.122.1 是允许挂在该目录的主机的IP地址, 如果不能确定 ,请使用 * ,表示任意IP 都可以

insecure 是一个安全选项, 如果nfs服务端口号小于1024则可以不添加这个选项, 否则不添加的话, 是无法访问的.其他主机访问的话就会被拒绝.

rw 是共享目录的权限,rw 是可读写的权限,只读的权限是ro.

sync 是同步的选项, 可选的还有 async. sync是不使用缓存,随时写入同步, async是使用缓存的.

no_root_squash 是NFS 服务共享的目录的属性, 如果用户是root, 那么对这个目录就有root的权限.

如果有多个目录, 每个目录一行,可添加多个目录.

Linux学习笔记1

这两天都在配置编译服务器,

1. 服务器的IP地址的问题

虚拟机的IP地址的问题搞定了. 修改/etc/sysconfig/network-scripts/ifcfg-ens32

TYPE="Ethernet"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
NAME="ens32"
UUID="476287bc-8643-404f-984e-8fd719a2832f"
ONBOOT="yes"
HWADDR="00:50:56:8C:6E:82"
PEERDNS="yes"
PEERROUTES="yes"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPADDR=10.79.183.125
NETMASK=255.255.255.0
GATEWAY=10.79.183.1

又遇到了一个dns的问题

在这个文件里面还需要添加

DNS1="64.104.123.144"
DNS2="171.70.168.183"

2. Sudo权限设置.

主要是看了一个blog How To Edit the Sudoers File on Ubuntu and CentOS

/etc/sudoers里面

root ALL=(ALL:ALL) ALL

这一行下面添加

demo ALL=(ALL:ALL) ALL

就ok

3. 64位系统的交叉编译环境 arm-linux-gcc 不能使用的问题.

有两个库找不到, libz.so.1ld-linux.so.2

google了一下, 问题是出在这个服务器是64位的, 有些32位的lib没有

yum install glibc.i686
yum install zlib.i686

4. fedora 设置环境变量

修改/etc/profile文件

PATH=/opt/tool:$PATH
export PATH

立即执行 环境变量

. /etc/profile

注意 点 ./ 之间有个空格

5. tftp Server on Fedora 21

这个弄了我好久.

tftpServer的本质是用tftpd来作为server

但是可以用不同的服务来启动.

Fedora 18的文档是这样写的.

On the DHCP server, verify that the tftp-server package is installed with the command rpm -q tftp-server. tftp is an xinetd-based service. Configure xinetd to process tftp requests by editing /etc/xinetd.d/tftp so that disable = no. Start the tftp service with the following commands:

systemctl start xinetd.service
systemctl enable xinetd.service

These commands configure the tftp and xinetd services to immediately turn on and also configure them to start at boot.

但是到了Fedora 21的文档就变成了

  1. Install the tftp server package. yum install tftp-server
  2. Start and enable the tftp socket. systemd will automatically start the tftpd service when required. systemctl start tftp.socket systemctl enable tftp.socket

恩其实是两个不同的服务调用了同一个程序: /usr/sbin/in.tftpd

这个程序的帮助: man in.tftpd

xinet

配置文件位置: /etc/xinet.d/tftp 没有的话就自己建立一个 配置如下:

service tftp
{
	disable		=	no
	socket_type	=	dgram
	protocol	=	udp
	wait		=	yes
	user		=	root
	server		=	/usr/sbin/in.tftpd
	server_args	=	-s /tftpboot
	per_source	=	11
	csp		    =	100 2
	flags		=	IPv4
}

注意的是:

  1. server_args 这一项是 in.tftpd的参数, 意思是把/tftpboot作为根目录
  2. flags=IPv4是采用IPv4的端口,否则默认用的是IPv6的.
tftp.service / tftp.socket

配置文件位置: /usr/lib/systemd/system/tftp.service 内容:

[Unit]
Description=Tftp Server
Requires=tftp.socket
Documentation=man:in.tftpd

[Service]
ExecStart=/usr/sbin/in.tftpd -s /tftpboot
StandardInput=socket

[Install]
Also=tftp.socket

IPV4的配置在 /usr/lib/systemd/system/tftp.service 要配置成这样:

[Unit]
Description=Tftp Server Activation Socket

[Socket]
ListenDatagram=0.0.0.0:69

[Install]
WantedBy=sockets.target

重要的是ListenDatagram这一项

配置成功!!!!

要把selinux配置成自由模式(放纵模式?)

setenforce 0

linux的帮助这样写的

setenforce(8) SELinux Command Line documentation setenforce(8) NAME setenforce - modify the mode SELinux is running in SYNOPSIS setenforce [Enforcing|Permissive|1|0] DESCRIPTION Use Enforcing or 1 to put SELinux in enforcing mode. Use Permissive or 0 to put SELinux in permissive mode. If SELinux is disabled and you want to enable it, or SELinux is enabled and you want to disable it, please see selinux(8). AUTHOR Dan Walsh, dwalsh@redhat.com SEE ALSO selinux(8), getenforce(8), selinuxenabled(8) dwalsh@redhat.com 7 April 2004 setenforce(8)

查看SELinux状态:

1、/usr/sbin/sestatus -v ##如果SELinux status参数为enabled即为开启状态

SELinux status: enabled

2、getenforce ##也可以用这个命令检查

关闭SELinux:

1、临时关闭(不用重启机器):

setenforce 0                  ##设置SELinux 成为permissive模式

                              ##setenforce 1 设置SELinux 成为enforcing模式

2、修改配置文件需要重启机器:

修改/etc/selinux/config 文件

将SELINUX=enforcing改为SELINUX=disabled

服务的启动

命令

systemctl status xinetd.service  //查看状态

systemctl start xinetd.service   //启动

systemctl stop xinetd.service    //停止

systemctl restart xinetd.service //重启

systemctl enable xinetd.service  //开机自启动

Samba 服务

Fedora Samba配置文档

1. 改/etc/samba/smb.conf 文件

在最下面加上

[dongmwu]
path = /home/dongmwu
writeable = yes
public = yes
guest ok = no

2. 设置密码

smbpasswd -a username

3. 重启samba服务

systemctl restart smb.service

4. 记住关防火墙!!!

systemctl stop firewalld.service

Study of Linux Driver

今天开始复习? 学习Linux设备驱动, 就是为了新项目嘛..

大概项目要用到的就只有最简单的字符设备就好.

所以慢慢学

1. Hello world模块

printf 不能用, 要用printk

用户空间和内核空间

内核空间是最高用户态, 拥有最多的权限可以进行所有的操作. 用户空间是运行在最低用户态, 处理器控制着对硬件的直接访问以及对内存的非授权访问.

每当应用程序执行系统调用或者被硬件中断挂起时, Unix将执行模式从用户空间切换到内核空间.

内核中的并发要注意, 所有驱动程序可能被很多个程序调用.

当前进程查看:

  1. #include <linux/sched.h>
  2. ‘printk(KERN_INFO “The process is %s (pid %i)”, current->comm, current->pid);’

双下划线是接口的底层组件. 最好不要修改

2. 编译和装载

Start to Learn Bootstrap

Start to have a glimpse on Bootstrap, it’s enough to know how to modify themes that built by Bootstrap.

Lua语言中pairs和ipairs的区别

tbl = {“alpha”, “beta”, [“one”] = “uno”, [“two”] = “dos”}

for key, value in ipairs(tbl) do

        print(key, value)

end

-pairs()函数基本和ipairs()函数用法相同, 区别在于:

pairs()可以遍历整个table,即包括数组及非数组部分。

–>如有pairs迭代输出如下:

–>1 alpha

–>2 beta

–>one uno

–>two dos

ipairs()函数用于遍历table中的数组部分。

–>如有ipairs迭代输出如下:

–>1 alpha

–>2 beta

###&&&

将键值对插入一个表就直接在空表里面符值就好

###关于串口监听的问题

原来的想法是用串口发送AT指令什么的。 现在暂时取消,采用单纯web来控制,以后再添加。先以完成demo为主

pipicoldblog搭建下一步计划

恩…那个jQuery的实现其实就是意味着我的这个blog终于可以加一点动态效果了

恩.要做出来的样子应该是有可以在blog里面显示图片的,每篇blog自己带一个文件夹

但是由于svn的代码空间只有100MB所以要把资源文件.主要是图片.

放在storage里面,这件事情已经探究过可行性了之前,只是觉得麻烦><

另外关于主界面,一开始的界面要修改了,现在这样虽然简洁吧但是也很简陋><

现在觉得既然是已经做了一个仿制PSP的界面就干脆利用这个?

大概的想法是黑白风格,然后把blog分为BLOG,PROJECT,PROFILE三个大块

然后至多采用三级菜单

BLOG部分

  1. 每个blog要加入一个<tag></tag>标签来进行分类
  2. 每个blog的文件名还是日期
  3. 每个加入一个<version></version>标签来标记现在的版本号

PS:标记版本号的目的就是为了不要每次都要遍历一次所有文件然后找出tag

但是也有变通的方法就是另外做个小程序每次发布新的blog之后把svn提交还有tag数据库的更新整合在一起用python写个?

PROJECT部分

大概就是吧每个项目的源码git地址搞下来然后再把readme.md弄下来就好

PROFILE部分

自己随意写写就好~~

老子回来了!带着jQuery

说起来真的好久没更新blog了

上一次的文章日期还是5月16日.

于是快过了2个月过来报道一下!

唔这两个月对于技术方面真的是很少更新.

上篇blog更新完了之后就忙着写毕业论文和帮媳妇儿做她的毕业设计

大概是一个FLASH+Arduino的一个展示性的项目

唔它重要的一点就是serproxy吧, 有空的话我再把源文件上传到git吧

之后就是毕业季和大家玩耍然后和基友们白白和老婆分居两地><

一个人来到上海找房子安顿下来开始上班,然后最近陷入了一点对未来的迷茫之中…

回归正题,这两天下班的时候想了想不能那么无聊是吧~于是自己学了一下jQuery这个框架怎么使用,发现它确实比原生的Javascript要好用和方便许多~!!!!

大概就属于随意敲敲代码就能弄出漂亮网页应用

目前还是一个完成了一半的状态

先是展示

就是一个点击就能切换二级菜单的东西..

唔用的原理是仿造于图片轮播

然后自己加上了一些按键控制和主菜单动画

源代码

	<!@@javascript@@!>
    /**
     * Created by Wu on 14-7-6.
     */


    //    2 vector test success

    //    var aa=new Array();

    //    aa[0]=new Array();

    //    aa[0][0]=10;

    //    alert(aa[0][0]);

    //




    var Main_index=0;//当前主按钮序号

    var Child_index=0;//当前子按钮序号

    var animate_time=200;//每个动画的执行时间

    var main_panel_button_counts=0;
    var child_panel_counts= new Array();
    var child_now_index=new Array();
    var can_press_key=true;



    $(document).ready(function(){

    	//init

    	main_panel_button_counts=$("li.buttons").length;//count the sum of button in main panel

    	count_child_menu();
    	init_child_now_index();
    	main_panel_change(Main_index);
    	can_press_key=true;

        $(document).keydown(function(event){
    	if(can_press_key==true){
    	    log("keyCode:"+event.keyCode+" is clicked.");
            if (event.keyCode==37){
               //left key down

    	   if (Main_index-1 >=0 ){
    		main_panel_change(Main_index-1);
    	   }
            };
            if (event.keyCode==39){
                //right key down

    	    if (Main_index+1<main_panel_button_counts){
    	    	main_panel_change(Main_index+1);
    	    }
            }
            if (event.keyCode==38){
                //up key down

    		if(child_now_index[Main_index]>0){
    			child_panel_change(child_now_index[Main_index]-1);
    		}
            }
    	if (event.keyCode==40){
    		//down key down

    		if (child_now_index[Main_index]<child_panel_counts[Main_index]-1){
    			child_panel_change(child_now_index[Main_index]+1);
    		}
    	}
    	}


        });
    //funciton main_panel_change(destination)

    //this function is used to move main panel,

    //when key down or mouse click;

    //let $("li.buttons) move to destination

    //and run the animate.

    //



        function main_panel_change(destination){
    	can_press_key=false;
    	log("can_press_key:"+can_press_key);
    	//change the child panel



    	//=================bug 1 when click the keys quickly, display will be wrong===========

    	//$("li.mymenu").eq(0).fadeOut(animate_time);

    	//$("li.mymenu").eq(1).fadeOut(animate_time);

    	//$("li.mymenu").eq(2).fadeOut(animate_time);

    	//$("li.mymenu").eq(4).fadeOut(animate_time);

    	//$("li.mymenu").eq(5).fadeOut(animate_time);

    	$("li.mymenu").eq(Main_index).fadeOut(animate_time,function(){$("li.mymenu").eq(destination).fadeIn(animate_time);can_press_key=true;});

    	//change main panel background-color

    	for (var i=0;i<main_panel_button_counts;i++){
    		if (i==destination){
    			$("li.buttons").eq(i).css("background-color","#e0e0e0");
    		}else{
    			$("li.buttons").eq(i).css("background-color","transparent");
    		}
    	}

    	//move main panel


    	var now_left=$("div#main_menu_panel").css("left");
            var move_distance=100;

            $("div#main_menu_panel").animate({left:"-="+(destination-Main_index)*move_distance+"px"})

            //let Main_index=destination

           	Main_index=destination;
    	child_panel_change(child_now_index[destination]);
        }

        //function child_panel_change()

        //when key down up and down, call this

        //1. get Main_index number to decide change which one

        //2

        function child_panel_change(destination){
        	log("child_destination :"+destination);
    	//change main panel background-color

    	for (var i=0;i<child_panel_counts[Main_index];i++){
    		if (i==destination){
    			$("ul.popupmenu").eq(Main_index).children("li").eq(i).css("background-color","#e0e0e0");
    		}else{
    			$("ul.popupmenu").eq(Main_index).children("li").eq(i).css("background-color","transparent");
    		}
    	}
    	child_now_index[Main_index]=destination;
        }



        //function count_child_menu()

        //a for loop to init the child_panel_counts[]

        function count_child_menu(){
    	for (var i=0;i<main_panel_button_counts;i++){
    		child_panel_counts[i]=$("ul.popupmenu").eq(i).children("li").length;
    	}
        }
        //function init_child_now_index()

        //init child_now_index to all 0

        function init_child_now_index(){
    	for (var i=0;i<main_panel_button_counts;i++){
    		child_now_index[i]=0;
    	}
        }
        //function log(data)

        //to output @ <p id="logoutput"></p>

        function log(data){

    //	$("#logoutput").text($("#logoutput").text()+"\r\n"+data);

        }
    //----------------------------below this line is mouse click event-------------------


        //$("#logoutput").text("start test");

        $("li.buttons").click(function(){

            var now_index=$(this).index();
        	main_panel_change(now_index);
    		});

        //子菜单被点击事件

        $("ul.popupmenu li").click(function(){

          //  alert("index:"+);

          var now_child_index=$(this).index();
          	child_panel_change(now_child_index);

        });

    });

稍微分析一下吧

主要的两个函数是main_panel_changechild_panel_change这两个分别是主菜单和子菜单的控制函数,

貌似没什么好讲的都挺简单><

虚拟AP和基础网模式

今天的又在做毕设。

昨天把网页设置的部分完了一点。

今天想添加新功能,虚拟AP,AP模式和基础网模式互换

Part.1 虚拟AP

就是用一个路由器广播多个ssid

这样的可以完成不同用户的独立控制。

比如呢。我给家里的wifi分隔一下,一个是Myself,我自己用的。另一个是Guest,用来给访客用

给自己的流量自然要多分一点,给访客的就让他们能够看网页就好啦~~~

这个功能在/etc/config/wireless中有设置

先看wireless里面的config信息

config wifi-device 'radio0'
        option type 'mac80211'
        option hwmode '11ng'
        option path 'platform/ar933x_wmac'
        list ht_capab 'SHORT-GI-20'
        list ht_capab 'SHORT-GI-40'
        list ht_capab 'RX-STBC1'
        list ht_capab 'DSSS_CCK-40'
        option disabled '0'
        option channel 'auto'
        option htmode 'HT40+'
        option country 'CN'
        option noscan '1'

config wifi-iface
        option device 'radio0'
        option network 'lan'
        option mode 'ap'
        option encryption 'none'
        option ssid 'pipi1net'

config wifi-iface
        option device 'radio0'
        option network 'lan'
        option mode 'ap'
        option encryption 'none'
        option ssid 'pipi2net'
参考资料在这里:Wireless configuration 利用nodogsplash 打造多节点超强无线广告机

我这里就是建立了两个不同的ap

一个是pipi1net,另一个是pipi2net

用uci实现

添加一个虚拟ap

uci add wireless wifi-iface
uci set wireless.@wifi-iface[1].device=radio0
uci set wireless.@wifi-iface[1].network=lan
uci set wireless.@wifi-iface[1].mode=ap
uci set wireless.@wifi-iface[1].encryption=none
uci set wireless.@wifi-iface[1].ssid=pipi2net
uci commit

删除虚拟ap

uci delete wireless.@wifi-iface[1]
uci commit

记得如果要立即看到效果的话要添加/etc/init.d/network restart啊啊啊

Part.2 基础网和AP模式互换

基础网模式就是wifi-client,就是像手机一样用wifi连接在某个ap上作为从机

AP模式是wifi-AP

主要参考资料:Routed AP Routed Client

我的这个模块拿到手里面的时候就是默认的AP模式

改为基础网(sta)模式要修改的地方 (修改第一个wifi ap)

 uci del wireless.@wifi-device[0].disabled
uci del wireless.@wifi-iface[0].network
uci set wireless.@wifi-iface[0].mode=sta
uci commit wireless
wifi

PS:wifi命令相当于原来的/etc/init.d/network restart

然后就开始扫描空间中的wifi信号

iwlist scan

官网资料上面说如果出现了Devic Busy或者资源被占用之类的事情

可以执行

killall -9 wpa_supplicant
iwlist scan

我在图书馆的扫描结果如下:


wlan0     Scan completed :
          Cell 01 - Address: 00:1F:64:EB:4F:78
                    Channel:1
                    Frequency:2.412 GHz (Channel 1)
                    Quality=29/70  Signal level=-81 dBm
                    Encryption key:off
                    ESSID:"Cert_Download"
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                              9 Mb/s; 12 Mb/s; 18 Mb/s
                    Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
                    Mode:Master
                    Extra:tsf=00000011157e1d06
                    Extra: Last beacon: 740ms ago
                    IE: Unknown: 000D436572745F446F776E6C6F6164
                    IE: Unknown: 010882848B960C121824
                    IE: Unknown: 030101
                    IE: Unknown: 0706434E20010D14
                    IE: Unknown: 2A0100
                    IE: Unknown: 32043048606C
                    IE: Unknown: 2D1AAD0103FFFF000000000000000000000000000000040
                    IE: Unknown: 331AAD0103FFFF000000000000000000000000000000040
                    IE: Unknown: 3D160100170000000000000000000000000000000000000
                    IE: Unknown: 34160100170000000000000000000000000000000000000

                    IE: Unknown: 4A0E14000A002C01C800140005001900
                    IE: Unknown: 7F0101
                    IE: Unknown: DD180050F2020101060003A4000027A4000042435E00623
                    IE: Unknown: DD0900037F01010000FF7F
          Cell 02 - Address: 00:1F:64:EC:4F:78
                    Channel:1
                    Frequency:2.412 GHz (Channel 1)
                    Quality=31/70  Signal level=-79 dBm
                    Encryption key:off
                    ESSID:"BUPT-3"
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                              9 Mb/s; 12 Mb/s; 18 Mb/s
                    Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
                    Mode:Master
                    Extra:tsf=4b000011157e26e8
                    Extra: Last beacon: 710ms ago
                    IE: Unknown: 0006425550542D33
                    IE: Unknown: 010882848B960C121824
                    IE: Unknown: 030101
                    IE: Unknown: 0706434E20010D14
                    IE: Unknown: 2A0100
                    IE: Unknown: 32043048606C
                    IE: Unknown: 2D1AAD0103FFFF000000000000000000000000000000040

                    IE: Unknown: 331AAD0103FFFF000000000000000000000000000000040
                    IE: Unknown: 3D160100170000000000000000000000000000000000000
                    IE: Unknown: 34160100170000000000000000000000000000000000000
                    IE: Unknown: 4A0E14000A002C01C800140005001900
                    IE: Unknown: 7F0101
                    IE: Unknown: DD180050F2020101060003A4000027A4000042435E00623
                    IE: Unknown: DD0900037F01010000FF7F
          Cell 03 - Address: 00:1F:64:ED:4F:78
                    Channel:1
                    Frequency:2.412 GHz (Channel 1)
                    Quality=30/70  Signal level=-80 dBm
                    Encryption key:on
                    ESSID:"eID_WAPI"
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                              9 Mb/s; 12 Mb/s; 18 Mb/s
                    Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
                    Mode:Master
                    Extra:tsf=32000011157e379a
                    Extra: Last beacon: 2000ms ago
                    IE: Unknown: 00086549445F57415049
                    IE: Unknown: 010882848B960C121824
                    IE: Unknown: 030101
                    IE: Unknown: 0706434E20010D14
                    IE: Unknown: 2A0100
                    IE: Unknown: 44140100010000147201010000147201001472010000
                    IE: Unknown: 32043048606C
                    IE: Unknown: 2D1AAD0103FFFF000000000000000000000000000000040
                    IE: Unknown: 331AAD0103FFFF000000000000000000000000000000040
                    IE: Unknown: 3D160100170000000000000000000000000000000000000
                    IE: Unknown: 34160100170000000000000000000000000000000000000
                    IE: Unknown: 4A0E14000A002C01C800140005001900
                    IE: Unknown: 7F0101
                    IE: Unknown: DD180050F2020101060003A4000027A4000042435E00623
                    IE: Unknown: DD0900037F01010000FF7F
          Cell 04 - Address: 3E:4B:D6:A1:34:28
                    Channel:6
                    Frequency:2.437 GHz (Channel 6)
                    Quality=26/70  Signal level=-84 dBm
                    Encryption key:on
                    ESSID:"AWIN-JPMT21CIJMJ"
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                              9 Mb/s; 12 Mb/s; 18 Mb/s
                    Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
                    Mode:Master
                    Extra:tsf=00000002ea7a06c0
                    Extra: Last beacon: 410ms ago

.........................实在太长了就截取到这里吧

于是呢我们就能找到想要加入的wfi网络的SSID和加密协议了~

根据这个信息使用UCI命令再次修改/etc/config/wireless

尝试连接至BUPT-3

uci set wireless.@wifi-iface[0].ssid=BUPT-3
uci set wireless.@wifi-iface[0].network=wan
uci commit

设置之后的/etc/cofig/wireless文件wifi-iface[0]部分内容如下

config wifi-iface
        option device 'radio0'
        option encryption 'none'
        option mode 'sta'
        option network 'wan'
        option ssid 'BUPT-3'

执行wifi命令之后出现一下信息

[ 1275.460000] wlan0: authenticate with 00:1f:64:ec:4f:78
[ 1275.470000] wlan0: send auth to 00:1f:64:ec:4f:78 (try 1/3)
[ 1275.530000] wlan0: authenticated
[ 1275.540000] wlan0: associate with 00:1f:64:ec:4f:78 (try 1/3)
[ 1275.550000] wlan0: RX AssocResp from 00:1f:64:ec:4f:78 (capab=0x421 status=0
aid=9)
[ 1275.560000] wlan0: associated
[ 1275.560000] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready

成功变为基础网模式

再次切换为AP模式只需恢复原有config即可

uci set wireless.@wifi-iface[0].network=lan
uci set wireless.@wifi-iface[0].ssid=pipinet
uci set wireless.@wifi-iface[0].mode=ap
uci commit

wifi路由要结题啦

昨天清考去了感觉能过的恩。。。

于是欢脱的过了半天今天继续做毕设。

不过老师给我消息说20号左右答辩,要把论文也写出来

。。。

今天试了一下ser2net。。工作状态ok

于是整理一下这个星期要做的事情(毕设):

一、把可以演示的demo做出来

软件部分。

  1. 要演示修改ssid(这就是修改配置)【ok】

  2. 传输数据(小灯亮)【和Netduino的沟通】【ok】
  3. 网页的配置工具(选作)【ing】

网页功能测试已经通过。

下一步测试uci命令 测试成功。

整合一下

开始写网页

  1. 争取能把ser2net的源码中控制串口的部分提取一下【later】

硬件部分。

  1. 做一块板子(手做)

二、写毕业论文

提纲

正文

翻译文献

try UCI

恩昨天的串口弄了一天继续失败,于是为了赶进度来做uci的部分。

主要参考资料

UCI系统

OPENWRT的一些UCI命令 BY 船长@又在折腾

然后自己折腾了一下

首先可以用

uci export

来输出所有的当前信息

然后,用

uci show 【package名字】

就可以看到这个包下面的所有参数和选项了。

然后就

uci set

命令就可以设置每个选项的具体值

example

恩今天改了个无线的ssid试了一下

uci export

发现wireless包下面有ssid的选项

package wireless

config wifi-device 'radio0'
	option type 'mac80211'
	option hwmode '11ng'
	option path 'platform/ar933x_wmac'
	list ht_capab 'SHORT-GI-20'
	list ht_capab 'SHORT-GI-40'
	list ht_capab 'RX-STBC1'
	list ht_capab 'DSSS_CCK-40'
	option disabled '0'
	option channel 'auto'
	option htmode 'HT40+'
	option country 'CN'
	option noscan '1'

config wifi-iface
	option device 'radio0'
	option network 'lan'
	option mode 'ap'
	option encryption 'none'
	option ssid 'FUCKMATH'

于是运行uci show

输出信息如下

wireless.radio0=wifi-device
wireless.radio0.type=mac80211
wireless.radio0.hwmode=11ng
wireless.radio0.path=platform/ar933x_wmac
wireless.radio0.ht_capab=SHORT-GI-20 SHORT-GI-40 RX-STBC1 DSSS_CCK-40
wireless.radio0.disabled=0
wireless.radio0.channel=auto
wireless.radio0.htmode=HT40+
wireless.radio0.country=CN
wireless.radio0.noscan=1
wireless.@wifi-iface[0]=wifi-iface
wireless.@wifi-iface[0].device=radio0
wireless.@wifi-iface[0].network=lan
wireless.@wifi-iface[0].mode=ap
wireless.@wifi-iface[0].encryption=none
wireless.@wifi-iface[0].ssid=FUCKMATH

根据最后一条信息。。

输入uci set wireless.@wifi-iface[0].ssid=pipicoldnet

运行成功没提示恩。

再次输入uci commit

然后输入/etc/init.d/network restart

或者重启也行。就能看到网络的ssid改了

关于一些命令的使用(使用中会陆续添加)

uci export

这个是导出所有的当前配置文件。。所有的包和选项,可以使用uci export > export.txt类似的组合命令输出到文件

uci import 暂未试用

顾名思义,导入配置,

uci show 【package】

显示某个包的内容

uci set

这个set后面要跟具体的选项的从属关系和值,具体的用法参见上文实例

uci commit

提交set命令所进行的修改

uci get

获取某个特定的配置项的值

config文件的形式

关于每个package的config文件怎么配置就要看第一个链接里面的那个各个config文件详述的表格了

觉得uci命令是配置路由器基础功能的核心部分

明天的任务:

恩早上高数复习(高效一点啦)

下午之后用lua吧uci命令运行一下试一试~

串口那里改个波特率试试?最好还是能双向通讯吧

月末的毕业设计

恩一转眼就月末了呢。

这个星期大概就没什么进展,从上次编译出SDK以后就一直没有coding关于毕设的事情

前几天看了一下教程【整理】如何在OpenWRT环境下做开发

发现自己还是要学一些关于Makefile的东西,于是就找了个跟我一起学Makefile看了看,

恩目前还没看完但是觉得还是挺有收获的。

于是今天早上就按照教程上的写了个helloworld程序

遇到了一下的问题恩

一开始我的Makefile是这样写的。。(这里只是最后的一些执行语句)

<!@@make@@!>

#prepare

define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/
endef

#install will be call

define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/bin/
endef

#the function eval will add the text into makefile

$(eval $(call BuildPackage,helloworld))

但是每次make的时候总是报错说是最后一行少了一个分隔符(separator)

百度了一下说是命令之前要加上一个TAB字符什么的

但是Makefile直接调用函数什么的根本不用加TAB啊啊啊啊。。。

于是琢磨了好久发现是在之前的define里面有问题

Makefile的define就是宏。。就相当于是文本替换。所以在

<!@@make@@!>
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/bin/
endef

这样打出的命令之前是没有TAB字符的。。于是在最后一行调用的时候就出现了缺少分隔符错误

后来修改成这样就正确了

<!@@make@@!>
define Build/Prepare
	mkdir -p $(PKG_BUILD_DIR)
	$(CP) ./src/* $(PKG_BUILD_DIR)/
endef


define Package/helloworld/install
	$(INSTALL_DIR) $(1)/bin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/helloworld $(1)/bin/
endef

$(eval $(call BuildPackage,helloworld))

注意上面这两个define中的行命令的行首都有TAB

恩。小问题但是要注意细节恩~

关于图片存储

逃避毕设来做blog

pipicoldblog搭建手记5

弄了两个上午。终于把GeSHi的代码高亮功能加到blog上面了

现在只需要在代码段中加入<!@@php@@!>

类似的字符串就能自动高亮了。

一下是收工后的总结:

恩就是玩弄字符串的一次操作

大概思路是找到所有的<pre><code></pre></code>对的坐标,分别放在两个数组里面

然后把文章的主题进行按照得到的坐标进行分割成一个sub_content数组

分隔后的每1,3,5….单数个数组元素都是代码了(因为每篇文章都有标题所以)sub_content[0]总是有东西的

然后就是用GeSHi处理一下再扔进去.

总之现在的blog显示页面t.php已经有自己独立的css提供样式了,

对了关于CSS显示<pre>标签.还遇到了一个不能自动换行的小问题,百度了一下找到了一篇文章

使pre的内容自动换行

大概就是加上个样式

 <!@@css@@!>
 pre {
white-space: pre-wrap;
word-wrap: break-word;
}
  • 有空记得我再把原来的代码全部加上<!@@code@@!>的tag吧~

下面就用高亮代码的代码显示高亮代码的代码(好绕口的一句话!!!~~~~)

<!@@php@@!>
//highlight_func.php

//written by pipicold

include_once "./libs/geshi/geshi.php";


function highlight_article($blogcontent){

	$geshi=new GeSHi();

	$body_start=stripos($blogcontent, "<body");
	$body_end=strripos($blogcontent, "</body>");
	$content=substr($blogcontent, $body_start,$body_end+7-$body_start);



	$code_starts=array();
	$code_ends=array();
	$sub_contents=array();


	$start_point=0;
	$end_point=0;

	while (true) {

		$tmp = stripos($content, "<pre><code>",$start_point);

		if ($tmp == null){
			break;
		}else{

			array_push($code_starts, $tmp);
			$start_point=$tmp+1;
		}
	}

	while (true) {

		$tmp = stripos($content, "</code></pre>",$end_point);

		if ($tmp == null){
			break;
		}else{

			array_push($code_ends, $tmp);
			$end_point=$tmp+1;
		}
	}

	if (count($code_starts)==0){
		array_push($sub_contents, $content);
	}else{
		$sub_contents[0]=substr($content, 0,$code_starts[0]-1);
		for ($i=0; $i < count($code_starts) ; $i++) { //代码区一定在$sub_content中的2i+1的那个位置0<i<count($code_starts)
			$sub_contents[$i*2+1] = substr($content, $code_starts[$i],($code_ends[$i]+13-$code_starts[$i]));

			//---------parse_code code---start
			$language=null;
			$sub_contents[2*$i+1]=htmlspecialchars_decode($sub_contents[2*$i+1],ENT_QUOTES);//把html代码转成字符
			preg_match("/<!@@(.+?)@@!>/", $sub_contents[$i*2+1], $language);

			if ($language==null) {

			}else{
				$sub_contents[2*$i+1]=substr($sub_contents[2*$i+1], 11,-13);
				$geshi->set_language($language[1]);

				$sub_contents[2*$i+1]=str_ireplace("<!@@".$language[1]."@@!>", "", $sub_contents[2*$i+1]);

				$geshi->set_source($sub_contents[2*$i+1]);
				$sub_contents[2*$i+1]=$geshi->parse_code();
			}

			//---------parse_code code----end

			if ($code_starts[$i+1]==null){
			}else{
				$sub_contents[$i*2+2] =	substr($content, $code_ends[$i]+14,($code_starts[$i+1]-1-$code_ends[$i]-14));
			}

		}
		array_push($sub_contents, substr($content, $code_ends[count($code_ends)-1]+14));

	}

return implode("", $sub_contents);

}


琐碎事物一小时什么的

前段时间看了微信上@warfalcon的账号,

上面提到了每天花一小时去完成梦想然后坚持一百天什么的。

我就用这1小时每天做点事情把。总感觉我有一堆杂事要做好不爽

  • blog的更新 关于markdown语法解析那一块其实就是字符串操作的练习

  • 笔记本 的耳机孔要重新焊一下

  • 重新安装Ubuntu14.04 到ssd硬盘,有可能要重装windows

  • 微信公众账号的功能更新

  • 学点设计

  • 学画画

第一篇blog

恩。纠结了一下还是决定用Mahua来写这个文档。

有过想自己用php写一个Markdown和HTML之间转换的小程序。不过因为我在网上找到了一个PHP Markdown Extra

所以觉得是不是还有必要自己写?

(自己写的话最好加一个小功能:图片大小

对了最近在看《设计模式之禅这本书》

其实自己写也是对自己一个练手的好机会诶。尽量用LSP原则去构建类吧

恩。以上。

关于博客的结构问题

大概想了一下恩

  • 在v1.0时期,博客以页面形式保存,就是在目录下有个blogs目录
  • 文件命名规则为“日期+当日第几篇序号”例如这一篇就是”2014032501”
  • 另外为了以后加入php markdown转换,所以所有文档还要保存一份markdown格式的在根目录下/markbak文件夹里面
  • 主页的话v1.0做一个能搜索本地blogs文件夹并超链接过去,恩。用个内联框架就可以展示啦

以上。

pipicold
2014-03-25