Unit 1: How to Write an Introduction


1.1 Structure





1.2 Grammar and Writing Skills


지금 부터 서론 작성에서 중요한 4가지를 다루겠다. 각각은 다음과 같다.

  • TENSE PAIRS
  • SIGNALLING LANGUAGE
  • PASSIVE / ACTIVE USE
  • PARAGRAPHING



1.2.1 Tense pairs


Present Simple / Present Continuous

두개의 차이는 Present simple는 permanent situation을 나타내고, present continuous는 temporary situation을 나타낸다는 것이다.

이러한 특징 때문에, present simple을 이용해서, 당신의 주장이 사실로써 받아들이도록 주로 사용된다.

즉, present continuous는 거의 사용하지 않는다!


나중에 실험 결과를 설명할때, Past Simple과 Present Simple 사이에서도 선택을 해야 한다.

다음의 예제를 보라.

a) We found that the pressure increased as the temperature rose, which indicated that temperature played a significant role in the process.

b) We found that the pressure increases as the temperature rises, which indicates that temperature plays a significant role in the process.


a) 처럼 과거로 사용할 경우, 찾아낸 사실은 단순히 현재의 연구 결과에만 영향을 미치는것 처럼 보이며, 저자는 그것의 가정을 주장하기 힘들다. 심지어, 다른 연구자는 똑같은 결과를 얻기위해서 매번 다시 그 작업을 해야하는 뉘양스를 풍기게 된다.


b) 현재를 사용할 경우 찾아낸 결과는 충분히 사실이라고 주장할 수 있다.

연구에서 찾는 사실이나, 결과는 불변의 참값이므로, 현재 시제로 작성 한다. 즉, 이러한 경우 강하게 그것이 진실이며, 통용되는 사실이라고 믿게 만든다. 논문을 읽는 독자는 이러한 결과에 맞추어서 지속적으로 생각을 이어가게 된다. 혼돈을 주지 않는다. 이러한 주장과 결과에대한 기술법은 Result 섹션에서도 중요하게 다룬다.


결론: 논문이란 새로운 결과를 주장하는 것이다. 따라서 Present Simple을 주로 사용해라. 


Past Simple vs Present Perfect

둘다 Introduction을 작성할 때 필요한 시제이다.

하지만, 언제 사용해야되는지를 적절히 살정 해야한다.


(a) Past Simple: I lived in Tokyo for five years ~ 

-> But i don't live there anymore.

(b) present Perfect: I have lived in Tokyo for five years

-> and I still live there NOW.

(c) Past Simple: I broke my glasses~

-> but it doesn't matter / I repaired them

(d) Present Perfect: I have broken my glasses

-> and so I can't see properly NOW.

(d)의 표현은 (c)보다 더 현재에 더 밀접한 관계가 있음을 내포 하고 있다.


이러한 사실들이 왜 Introduction을 작성하는데 중요한지를 다음 예제를 통해서 생각해보자.

아래의 예제는, Introduction에서 특히, previous research를 나타낼때의 예제이다. 과거의 연구의 부족한점을 기술할때 tense는 매우 유용하게 사용되어지며, 잘못된 사용은 심각한 오류를 발생 시킨다.


[Present Perfect]

For example, Penney et al. showed that PLA composites could be prepared using blending techniques and more recently, Hillier established the toughness of such composites. However, although the effect of the rubber particles on the mechanical properties of copolymer systems was demonstrated over two years ago, little attention  has been paid to the selection of an appropriate rubber component

계속해서 Past Simple을 사용하다가, 갑자기 Present Perfect를 사용한 이유는 무엇일까? 그것은 현재 논문은 적합한 rubber component를 선택하는것에 관심을 기우리고 있다는것을 보이기 위함이다.

*Note: a little means 'a small amount', but little meas 'virtually none'.


만약 Writer가, 마지막 문장을 계속해서 Past Simple로 작성할경우, 어떠한 문제가 발생하는지 생각해보자.

[Past Simple]

However, although the effect of the rubber particles on the mechanical properties of copolymer systems was demonstrated over two years ago, little attention was paid to the selection of an appropriate rubber component.

2년전에 적합한 rubber component를 선택하는 것을 관심 가졌었다는 의미가 된다. 아마도 그러한 관심은 그때 부터 계속 지속되었을 것이고, 결국 그 문제는 해결 되었을 것이라는 의미를 내포하게 된다.


결국, tense의 변경은 항상 의미의 뱐화를 내포 하고 있으므로, 임의로 생각없이 변경해서는 안된다. 사용과 변경에 있어서 신중함을 기해야 한다. 



1.2.2 Signalling Language


Sentence connection

문장 작성에서 가장 많이 나타나는 실수중 하나는, 각각의 문장들이 연결되지 않는 문제이다.

즉, 한단락이 끝나거나, 새로운 내용이 시작될때, 보통 컴퓨터를 끄고 집에간다. 다음날, 다시 그 부분부터 작업을 하게 된다. 과연, 다음 날 시작할때 의미상 Gap이 없이, 잘 작성할 자신이 있는가?

통상은 그렇지 못하다. Writer는 알더라도, reader는 절대로 사소한 의미상 Gap 조차 용납하지 못한다.

이것을 해결하기 위한 전략을 소개 한다.


One was to connect sentences is to overlap meaning to repeat something from the previous sentence:

The pattern of inflammation during an asthma attack is different from that seen in stable asthma. In stable asthma the total number of inflammatory cells does not increase.


One way to toughen polymers is to incorporate a layer of rubber particles. As a result, there has been extensive research regarding the rubber modification of PLA.


Another way is to use a pronoun (it, they) or pro-form (this method, these systems) to glue the sentences together:

Many researchers have suggested ways of reducing cost without affecting the quality of the image. These methods rely on data structures built during a preprocessing step. 


On the basis of these criteria it then describes the preparation of a set of polymer blends using PLA and a hydrocarbon rubber (PI). This combination of two mechanistically distinct polymerisations formed a novel copolymer in which the incorporation of PI significantly increased flexibility.


문장을 끝내지 말고, semicolon 또는 relative clause를 이용해서 연결 한다.

Th e procedure for testing whether components are operationally safe usually takes many hours; this means that tests are rarely repeated. 


It has received much attention over the past few decades due to its biodegradable properties, which offer important economic benefits.


위 4가지 전략 외에도,


connector를 적절히 사용하면, 의미를 명확히 할 수 있다. therefore, however를 적절히 사용하면, 독자가 모든 문장을 이해하지 못해도, 최소한 결론만큼은 이해할 수 있게된다. 이러한 것들을 사용하지 않는다면, 독자는 해당 정보가 가지는 의미를 이해하기 어렵다. 


문법완벽하고, 모든 단어가 정확히 사용됬더라도 독자는 그 뜻을 잘 이해할 수 없을때가 많다. 따라서 connector를 이용해서 구분을 지어주며, 의미를 분명히 표현해 주는 것은 매우 중요하다. 하지만, 매번 therefore, however를 사용할 수는 없다. 아래에 science writing에서 일반적으로 사용되는 connector를 정리 했다.


Note: 아래의 설명을 보면, however나 therefore를 접속사처럼 쓰는 예문이 있다. 사실 엄밀히 말하면 틀린것은 아닌데, 현대영어에서는 접속사로 잘 쓰지 않으니, 그점을 유의해서 볼 필요가 있다. 특히 한국에서는 접속부사로써, 접속사로 쓰지말라고 가르치고 있으니, 안쓰는게 좋다. 

CAUSE

Th e experiment was unsuccessful ________ the measuring instruments were 

inaccurate.

Th e experiment was unsuccessful ________ the inaccuracy of the measuring 

instruments.


due to (the fact that) as

on account of (the fact that) because

in view of (the fact that) since


•  Be careful when you use since; it is also oft en used to mean ‘from 

that time’, so if there’s any possibility of confusion, choose a different 

connector.

•  All these connectors can be used at the start of a sentence, even because

(Because the measuring instruments were inaccurate, the experiment was 

unsuccessful).


RESULT

The measuring instruments were calibrated accurately, ________ the experiment was successful.


therefore /  as a result (of which)

consequently / which is why

hence / so


•  Don’t start sentences with so to communicate a result; it’s too informal.

  You can sometimes use then, for example in sentences like ‘If x then y’, but it won’t work in every sentence, which is why it has not been included in this list.


CONTRAST/DIFFERENCE

British students are all vegetarians, __________ Norwegian students eat meat every day.


however / on the other hand

whereas / while

but / by contrast


 on the contrary and conversely don’t fit into this category because they don’t only communicate difference; they communicate the fact that ‘exactly the opposite is true’, so you can’t use them in the sentence above (because vegetarians and meat eaters aren’t opposites, they’re just different). 


However, you could use them in the following sentence: 

Some experiments used uncalibrated instruments and succeeded; conversely, other experiments used carefully calibrated instruments and failed.

•  Be careful when you use while; it is also oft en used to mean ‘at that/the same time’, so if there’s any possibility of confusion, choose a different connector.



UNEXPECTEDNESS

(a) _______ it was difficult, a solution was eventually found.

(b) _______ the difficulty, a solution was eventually found.

(c) It was difficult; ________ a solution was eventually found.


(a) Although         (b) Despite            (c) nevertheless

(a) Even though    (b) In spite of         (c) however

(a) Though         (b) Regardless of   (c) yet

  (b) Notwithstanding (c) nonetheless

(c) even so


Th ere are other connectors with the same meaning, such as still and anyway,but they are more informal.


ADDITION

We used a batch processing system because it was more effective; 

___________ it was faster.


in addition / also

moreover / secondly (etc.)

furthermore / in the second place (etc.)

apart from that/which     /   what is more


•  besides has more or less the same meaning as the items in the list above, but it’s more powerful and is therefore better used in more persuasive contexts.



1.2.3 Passive / Active 


종종 논문을 쓰다보면, Active로 쓰라는 말을 많이 듣는다. 한국어는 주어를 잘 쓰지 않으니 어렵지않다.

영어로 작문하다보면, Active를 쓸려고 하다보니, 주어를 생각하게 되고, We 를 많이 쓰게된다. 


과연 We를 research group이나 team을 지칭하기 위해서 논문에서 써도 될까?

결론은, "쓰지 말아야 한다" 이다. 한 두번이야 쓸수 있지만, in general 하게 막 써서는 안된다. 

실제로, 본인이 IEEE transaction에 수차례 떨어질때 에디터의 지적중 하나가, we를 쓰지말라는것이다. 

아래는 해당 에디터의 지적 원문이다.

The level of the use of the English language is unsatisfactory to be included in this publication, and/or the paper has instances of being written in the first person tense (the instructions clearly state the paper is to be written in the third person tense so no 'we', 'us', 'our', 'I', etc.) Authors whose primary language is not English are advised to seek help in the preparation of the paper.


결론은 Third person tense로 작문하라는것이었다. 

그래서, we를 제거하다보니 8 pages 논문에서 90개가 넘는 사용이 있었다. 

당시에는 accept를 목표로 생각없이 모든 We를 포함하는 Active 문장을 무작정 Passive 문장으로 변경 했었다. 하지만, 이것은 논문은 Active로 작성하라는 기본적인 원칙에 반하는 것이며, 독자로 하여금 혼란을 야기 시킨다. 그래도 논문은 붙었으니 First person tense 사용보다는 괜찮은것인것 같다.


그렇다면, 어떻게 we를 안쓰고 Active 문장을 만들것인가? 방법은 두가지 이다.


  • It을 사용하자.

We know / think that -> It is known / thought that 


또 다른 경우로, 만약Thesis를 작성한다면, research group 또는 team이 아니라, 개인 연구인것을 나타내야하므로, 어려울 수 있다. 그렇다고, I 를 쓸수는 없다. 그래서 보통, Passive 문장을 다시금 이용하게 된다.


Passive로 바꿔서 사용할 경우에는 here 또는 In this study 등을 사용해서 스스로의 연구임을 지칭 하면 된다.


Active로 하고싶은 경우, Dummy를 이용해서 i 또는 we와 같은 subject를 대체 할 수 있다.

  • This article describes an algorithm for clustering sequences into index classes.
  • The present paper presents a set of criteria for selecting such a component.


Passive sentence를 사용할 때의 문제는 agent를 나타낼 수 없다는 것이다.

다시말하면, by me 또는 by other researchers 와 같이 쓸 수 없다는 것이다.

이렇게 되면, 독자는 agent를 생각하며 글을 읽어야 하고, 직관적이지 않다.

따라서, Introduction에서는 agentless 한 Passive 표현을 쓰지 말아야 한다. 

그렇다고, We 를 써서도 안된다. 

따라서 Dummy subject가 최적의 방법이다. 상황에 따라, agent가 너무나도 분명하다면, passive를 써도 된다.



1.2.4 PARAGRAPHING 


Paragraph은 읽을때나 쓸때 모두 효과적인 시각화 지원을 해주기 때문에 매우 중요하다.


이때의 기본적인 오류는 두가지이다.

1) 너무 짧거나 단일 문장으로 paragraph을 만드는 것

2) 너무 길게 paragraph을 만드는 것


두 에러모두 독자에게 혼란을 주며, 저자에게는 잘못 글이 구성되고 있다는것을 나타내는 지표이다.


좋은 Paragraphing을 간단한 예로 설명한다.


소설에서는,즉 추리소설에서는 스토리 텔링이 중요하다.

의문점들을 쭉쭉 뿌리면서, 등장인물들을 나열하면서, 최종적으로 범인을 색출 하게된다. 


하지만, Science writing에서는 사실을 감춰서는 안된다. 가장 먼저, 사실을 먼저 보여줘야한다.

그리고 상세한 설명이 뒤따라온다.

추리소설을 읽을때 범인이 누군지, 왜그랬는지, 모두 안다면, 소설에 대한 흥미는 급속도로 떨어지지만, 

스스로 필요없는 정보를 제거하면서, 빠르게 소설을 읽을 수 있다. 왜냐하면, 등장인물에 대해서 세세히 집중할 필요도없으며, 의문점들에 대해서도 그렇게 집중하지 않아도 된다. 그러면서도 사건의 전체 흐름과 수사 과정에대해서 효과적으로 이해할 수 있다.


위 차이가 바로 Science writing에서의 paragraph 생성의 핵심이다. 즉, 두괄식으로 작성 하라는 것이다.

우나라말은 항상 결론이 끝에 나온다. 이런 악습관을 science writing에서는 버려야한다. 항상 보여주고자 하는 결론을 가장 간단하고, 명확한 문장으로 paragraph 앞에 기술하라. 그다음에 상세한 이유와 과정 그리고 특징을 설명 하면 된다.


잘 쓴다는 것은, 독자를 고려한 글쓰기가 되어야 한다. 어떻께 훑어보기를 하는지 알아보자.


How to I skim efficiently and quickly?

아래는 skimming 하는 방법을 기술한 것이다.

대부분의 가이드는, look at or check 하라는 것이다. 읽는것이 아니다. 훑어 보는 것이다.


1. READ THE TITLE 

and try to predict the type of information you expect to see 

2. LOOK AT THE NAME OF THE AUTHOR 

What you know about the writer will help you predict and evaluate the content. 

3. CHECK THE DATE 

and use it to help you assess the content.

4. READ THE ABSTRACT 

to find out what the researchers did and/or what they found 

5. LOOK QUICKLY AT THE FIRST PARAGRAPH 

without trying to understand all the words.

6. LOOK QUICKLY AT THE FIRST SENTENCE OF EACH PARAGRAPH 

without trying to understand all the words

7. LOOK QUICKLY AT EACH FIGURE/TABLE AND READ ITS TITLE 

to try and find out what type of visual data is included

8. READ THE LAST PARAGRAPH

especially if it has a subtitle like ‘Summary’ or ‘Conclusion’ 


Skimming may help me read, but how does it help me to write?

6번째를 보면, 대부분 paragraph의 첫문장에 중요한 정보가 있으므로, 그것을 주의 깊게 읽으라고 되어 있다.

즉 academic writing은 시작에서 정확히 main idea를 기술해야한다. 그다음 올것은, 상세한 설명과 예이다. 만약 첫 줄의 주제문과 너무 거리가 먼 내용을 기술해야 한다면, 새로운 paragraph을 만들어야 할 것이다.



Correct paragraphing is essential

하지만, 매우 쉽게 paragraphing을 생각 없이 작성하는 안좋은 습관을 가지게 된다. 귀찮음이나, 부주의함을 언제나 조심해야한다.


반드시, paragraphing을 하기전에, 각각의 paragraph에 들어갈 main idea/concept을 리스팅하고, 그것을 bullet point로 마크한다음 논리적인 흐름이 이어지는지 확인해야한다.

그다음 조심스럽게 paragraphing을 해야한다. 무작정 쓰면, 엉망이된다.



1.3 Writing Task: Build a Model



1.3.1 Building a model



1.3.2 Key


Introduction의 첫번째 문단은 해당 연구가 왜 중요한지를 기술 해야 한다.

In Sentence 1 ‘Polylactide (PLA) has received much attention in recent years due to its biodegradable properties, which offer important economic benefits.’  the writer establishes the importance of this research topic. 


What if I don't have the confidence to say that my research is important?

만약, 정말로 저렇다 하더라도, 중요함을 필역 하지 않으면 안된다. 그렇다면, 해당 연구는 가치를 잃어버린다.

자신의 연구가 중요하거나 유용하다는 것에 대해서 기술하는것을 부끄러워 하지 말라.


What tense should I write in here?

과거 연구를 이야기 할때는 Present Perfect tense를 사용

Much study in recent years has focused on....

현재 나의 연구의 중요성을 이야기 할때는 Present Simple tense를 사용

There are substantial benefits to be gained from .....


In Sentence 2 'PLA is a polymer obtained from corn and is produced by the polymerisation of lactide.’ the writer provides general background information for the reader.


So What kind of facts should I start with?

광범위한 곳에 출간되는 연구라면, 좀더 일반적인 내용으로 뒷밤침하고,

좁은 범위에 출간된다면, 고급수준의 내용으로 본인의 연구가 가치있음을 주장해야한다.

두 경우 모두 반드시 레퍼런스를 명시해야 한다.


What if there are several background facts I want to start with, not just one?

How do I know which one to begin with?

가장 일반적인 것으로 시작하면 된다. 그것은 대부분의 독자가 알 수 있을 만한 것이다.

항상 상세한것을 설명하기 이전에 큰 그림을 먼저 소개시켜줘야 한다.


I'm still not sure where to begin.

논문 제목과 타이틀이 도움을 줄 수있다. 그것을 이용해서 시작을 이끌어 낸다.


Can't I start by describing the problem I am hoping to solve?

할수 있다. 하지만, 대부분의 저자들은 그렇게 하지 않는다. 

대부분의 독자들은 기본 지식이 부족하므로, 그것을 이해하기 어렵고, 이것을 해결하기 위해서는 저자는 글 작성에 많은 노력을 기우려야한다. 이것은 더 어려운 작업이다.


In Sentence 3 ‘PLA has many possible uses in the biomedical field(1) and has also been investigated as a potential engineering material(2,3) the writer does the same as in Sentences 1 and 2, but in a more specific/detailed way, using research references to support both the background facts and the claim for significance.


Don't the research references means that this is part of the literature review?

여전히 그것은 배경지식이 맞으므로 잘 작성 해야 한다.


So why does the author include reference if it's only the background?

첫번째, Plagiarism 방지

두번째, 독자들에게 좀더 읽고 탐구할 수 있는 기회를 제공 한다.

the third reason is that failing to provide a reference may indicate that you are not familiar with research in your area.


이것을 위해선, 논문을 작성하기 이전에 반드시 많은 참고문헌들을 수집 해야함을 의미한다. 


서론을 작성할때, 스스로에게 다음과 같은 3가지 질문을 던져봐야 한다.

1) Which of the research papers I have read should be mentioned somewhere in the Introduction?

참고문헌을 선택하고 배치하는 것은 매우 중요한 작업이다. 내가 선택한 참고문헌들은 현 시점에서 가장 대표적인 연구들이며 그것들과의 관계를 기술하는것은 독자로 하여금 해당 연구가 어떠한 의미와 위치를 가지는지를 명확히 이해하게 하는 효과를 가져 온다.


2) Which ones should be part of the background to the research and which ones should go in the literature review which comes later in the Introduction?


3) What order should I mention them in? 


In Sentence 4 ‘However, it has been found to be too weak under impact 

to be used commercially.

4

’ the writer describes the general problem 

area or the current research focus of the field. 




In Sentence 8 ‘Th e present paper presents a set of criteria for selecting such a component.’ the writer describes the paper itself.


본인 방법의 정당성을 기술 할때는 보통 Present Simple Tense를 사용 한다.


Past Simple Tense는 논문의 목적을 이야기 할때 쓴다.

The aim of this project was .... 

하지만 이것은 부분적으로만 가능한 시제는 주의해서 사용 한다. 즉, 논문에서 부분적인 성과거나, 논문의 나머지 부분이 향후에 해결 될 것이거나, 다음 단게에서 보고되어질 경우이다.



In Sentence 9  ‘On the basis of these criteria it then describes the preparation of a set of polymer blends using PLA and a hydrocarbon rubber(PI).’the writer  gives details about the methodology reported in the paper.


In Sentence 10‘This combination of two mechanistically distinct polymerisations formed a novel copolymer in which the incorporation of PI significantly increased flexibility.’ the writer announces the findings.


기법과 찾은 결과를 기술 한다. 하지만, 중요한것은 절대로 너무 디테일한 내용을 다루워선 안된다.



1.3.3 The model 


각각의 요약하면, 내가 생각하는 4가지 블럭이다.

1) 연구의 중요성을 만들어냄

2) 일반적인 배경지식을 이야기함 (중요성에 관한)

2-1) 저널의 특성에따라 구지 필요 없을 수도 있다.

3) 좀더 상세하고 디테일 하게 설명한다. (레퍼런스를 인용 하라는 것 배경지식을 설명 하기 위해서)


4) 중요한 것들에 대한 일반적인 문제점들을 이야기 한다. 

    문제점이 일반적일 때는 레퍼런스가 필요 없으며, 다소 무리가 있으면 레퍼런스를 달아야 한다.


    혹은 현재 연구들이 이 분야에 많음을 이야기 한다.연구들을 이야기 할때는 레퍼런스가 필요하다.


5) 글쓴이는 일반적인 문제점에서 이것을 해결하기 위한 방법으로 문맥을 전환 해야 한다.




6) 핵심 연구들에대한 간략한 리뷰를 한다.

리뷰하는 방법들

Chronological: 사건의 발생 순서대로 그것을 나열 한다.

Different approaches / theories / models: 각각의 특성들을 묶어서 설명 한다. 그리고 이것은 However or On the other hand 등을 이용해서 분류 할 수 있다.

general / specific: Start with general research in the filed and gradually move to research that is closer to your own.


7) 제안하는 연구와 기존 연구들 간의 차이점을 이야기한다.


8) 제안하는 논문의 내용을 기술 한다 간략히

9)  제안하는 방법을 설명

10) 찾는 결과를 말한다.


위의 것들을 요약해서 4개의 Basic component로 만들면 다음과 같다.


Establish the importance of your filed

Provide background facts / information

Define the terminology in the title / keywords

Present the problem area / current research foucs

 Previous and / or current research and contributions

 3

 Locate a gap in the research

Describe the problem you will address

present a prediction to be 

 4

Describe the present paper 



1.3.4 Testing the Model  


각자 연구의 서론을 읽어면서, 1,2,3,4를 표시해 보자.


이러한 연습을 통해서 많이 완성 할 수 있는 것이다.




1.4 Vocabulary 


해당 어휘들은 600편의 논문들에서 추출한 것이며, 모두 Native 에서 가져온 것이다.


각각의 서론 모델들에서 주로 사용되는 것들을 정리해 본다.


1) Establishing significance

일반적인 words와 expression을 이용해서 해당연구의 중요성을 강조


2) Previous and / or current research and contributions

past tense verb를 사용한다. 

'did' 같은 것들을 쓰면 안되고, calculated, monitored, 등과 같은 해당 연구자가 구체적으로 뭘 했는지 past tense verb로 명확히 표현 해야 한다.


3) Gap / Problem / Question / Prediction

여기서는, 명확하고 정확하게 이전의 또는 현재 연구들이 제안하는 논문에서 다루는 문제점에 대해서 완벽히 해결하지 못하거나 아에 다루지 않았음을 이야기 해야 한다. 


4) The present work

제안하는 연구의 목적, 전략 디자인 등을 설명한다



1.4.1 Vocabulary for the Introduction 


1) Establishing significance




Here are some examples of how these are used:


•  A major current focus in population management is how to ensure sustainability of…

•  Numerous experiments  have established that ionising radiation causes…

•  Low-dose responses to radiation have generated considerable recent research interest.

•  Analysis of change in the transportation sector is vital for two important reasons: …

•  PDA accounts for over 95%of all pancreatic cancers.

•  It is generally accepted that joints in steel frames operate in a semi-rigid fashion.

•  Nanocrystalline oxide films are attracting widespread interesti n fields such as…

•  The importance of strength anisotropy has been demonstrated by…

•  Convection heat transfer phenomena play an important role in the development of…

•  For more than 100 years researchers have been observing the stress strain behaviour of…

•  Much research in recent years has focused on carbon nanotubes......



2) Verbs used in the literature review to present previous and/or current research and contributions


이것들은 4번째 파트에서 동사들 대부분은 무엇을 이 논문에서 할 계획인지를 설명 할때 재사용할 수 있다.


4) GAP / question / problem / criticism


핵심은 너무 강하게 비판할 우려가 있으니, 그것을 조심해야한다. 선행 연구자에대한 예의를 지켜야 한다.


4) the present work


논문의 나머지 부분이 어떻게 구성될지를 쓸때, 동사를 너무 한가지로만 쓰면 안되는 것을 주의하자.



1.5 Writing an Introduction 


연습이 가장 중요하다.




'논문 작성 > Science Research Writing for Non-Native Speakers of English' 카테고리의 다른 글

Tense  (0) 2015.02.04
Unit 03: Results  (0) 2014.12.29

Git 간편 사용법: Click

Naver Blog: Click



맨 처음 시작



# set up git on your machine if you have not already.
$ mkdir /path/to/your/project
$ cd /path/to/your/project
$ git init
$ git remote add origin https://leejaymin@bitbucket.org/leejaymin/power-aware-notification-project.git

# Create your first file, commit, and push
$ echo "jemin lee" >> contributors.txt
$ git add contributors.txt
$ git commit -m 'Initial commit with contributors'
$ git push -u origin master




기존 프로젝트가 존재하는 경우



만약 기존에 있던 원격 저장소를 복제한 것이 아니라면, 원격 서버의 주소를 git에게 알려줘야 한다.

git remote add origin [저장소 URL]


로컬의 변경 내용은 현재 HEAD에만 있다. 이것을 원격 서버에 반영 시킨다. 

git push -u origin master

Note: 특정 branch로 반영을 원할 경우, master 대신에 해당 이름(ex: GUI)를 써야한다.


모든것을 반영하는 방법

git push -u origin --all # pushes up the repo add its refs for the first time

git push -u origin --tags # pushes up any tags



그런데, not fast forwarding 오류가 나면,

원격 저장소 내용을 로컬 저장소에 반영할 때 씀.

-> git pull origin master // 이것으로 동기화 한다.


강제로 push 하는 방법: Click

-> git push -f



Branch



Staging (Index)에 추가된것 초기화 하기: Site

git reset HEAD <file> 

git reset HEAD




□ 대전에서 에버랜드 가는법 (공대 스타일로 작성함, 쓸때없는 사진과 내용 최대한 제거)


에버투어를 이용함.

미리 예약하고 입금하면 됨.

다음의 웹사이트에서 함.  [클릭]


버스에 내리면, 주차장이므로, 다시 에버랜드내에서 에버랜드가 제공해주는 무료버스를 타고

에버랜드 입구로 이동해야함. 

따라서, 내리자말자 뛰어서, 누구보다 빠르게 해당 버스를 타해야함. 통상 이 버스타는것을 늦게 타면, 아무리 에버랜드 빨리 가봐야 소용이없다. 초반에 누구보다 빨리 개장하자말자 들어가는것이 많은 놀이기구를 탈 수있는 핵심임.

왜냐하면, Q-Pass예약제도를 이용해서 놀이기구를 선점 할 수 있기 때문임. 상기 내용은 아래에서 상세 설명함.


□ 에버랜드 이용 TIP


1. 에버랜드 앱을 설치함. 

해당 앱은 놀이기구의 대기시간 및 현재 위치에서의 거리를 표시해 주므로, 최적화된 놀이기구 탑승 동선을 실시간으로 알아낼 수 있는 장점을 가짐.


2. 제휴카드를 이용해서 할인.

제휴카드를 확인해서 자유이용권 할인을 받아야함.

필자는, 우리카드로 50% 할인을 받음.

전월 실적을 반드시 확인해서 조건에 충족하는지를 봐야함.


3. 에버랜드 놀이기구 설명

에버랜드는 그림1과 같이 4개의 테마파크로 구성된다. 각각의 테마파크는 다음과 같다.


3.1 아메리칸 어드벤처

바이킹, 허리케인, 롱링 엑스트레인 (360도 롤러코스터) 등과 같이, 전통적인 놀이기구로 구성 됨.

입구에서 가장 가까우므로, 가장 나중에 타는것을 추천함.


3.2 매직랜드

후룹라이드가 대표적이며, 아이들용 놀이기구들로 구성 됨.

놀이공원은 애들이 가장 많으므로, 의외로 사람이 많이 존재함.


3.3 주토피아

사파리월드, 로스트 밸리(수륙양용 자동차로 동물 관람) 등이 대표적이며, 동물관람을 주 목적으로함.

가족 단위의 관람객들이 많고, 유모차 부대가 많아서, 매우 활동성에 방해가 되는 곳.


3.4 유러피언 어드벤처

T 익스프레스(세계최고의 낙하 각도의 롤러코스터)가 전부 임.

통상, 10시 개장과 동시에 T 익스프레스를 타기위해 출발하므로, 지체없이 이것을 바로 타면됨.




그림 1. 에버랜드의 전체 지도



4. 놀이기구 탑승 팁


Q-Pass(큐패스) 이용: 아마존 익스프레스와 사파리만을 대상으로 하며, 미리 번호표를 뽑아서, 지정된 시간에 지체없이 바로 탑승이 가능하도록 만든 제도임.

따라서, 놀이기구오면, 바로 Q-pass(큐패스)부터 발권 받음. 그렇게하면, 다른것을 줄선다음, 바로 타고내려와서, Q-Pass를 이용해서 바로 다음것을 탑승 할 수 있음. 동시에 2개를 타는 효과.


필자는, 아마존익스프레스를 11시 50분 쯤에 탑승할 수 있도록, Q-Pass를 발권하고, 로스트벨리는 약 1시간동안 줄서서 탑승 했음. 그후에 바로 11시 50분쯤에 아마존 익스프레스 가서 놀이기구를 이용함. 엄청난 사람들이 줄서 있는 가운데, 줄을 서지않고 쭉쭉 들어가서 혼자만 놀이기구를 탈때의 기분은 정말 좋음. 바보같이 줄서는 일이 없도록 전략을 잘 짜야함.


예약제도 활용: T-익스프레스 해당. 다른것도 있는진 모르겠음.

T-익스프레스의 경우 줄서는 곳이 마땅치 않고, 사람이 워낙 많아서, 예약제도를 도입함.

일단 예약을 위해서 줄을서고, 예약시간을 발권받음.

그후에 다른것을 이용하고, 예약 시간에 와서 놀이기구 탑승.


5. 모든 이벤트 참여


로스트벨리 Swing 이벤트 참여.

각 놀이기구마다, 줄서는동안 지루하므로, 앱을 통해서 퀴즈 이벤트를 제공함.

필자의 경우 로스트벨리에 있는 Swing 앱을 다운 받아서, 퀴즈 10개를 품.

퀴즈 10개를 다 맞추어야 상품을 준대서, 나름 튜토리얼을 통해서 공부한다음, 퀴즈 10개를 다 맞추어 통과함.

상당히 귀찮은 작업이지만, 무작위 추첨으로주는 경품이 쏠쏠함.


여자친구의 경우 20% 기념품 할인권을 받음. 기념품을 살 마음이 있다면, 이런것을 꼭 받아야함.

필자의경우 대형 인형 선물 교환권을 받음.

대형 인형은, 기린, 백사자(타우), 얼룩말 3개중에서 고를 수 있으며, 가격은 15~18만원 사이의 인형들임.

이것은, 에버랜드 전체에서 하루에 2~3명 정도 당첨되는 확률이라고함.

전 직원들이 환호화고, 관람객 들이 박수 갈채를 보내줌.

따라서, 모두들 그냥 줄서지말고, 혹시 모르니, 이런거 한번씩 해보기를 추천함.


필자가 고른 인형은, 15만원 상당의 타우(백사자)인형임. 

뽑을 당시에는 너무 좋았지만, 여자친구에게 선물로 준 결과 털이 너무 날려서.. 현재 창고에 보관 중. 

사자인형의 모습은 그림2와 같음.


그림 2. 백사자 타우 대형 인형 (15만원).


6. 추천 하는 동선


그림1의 29번인 편의시설 스카이웨이 4인승 리프트를 무조건 탐. 

이것을 통해서 한방에 아메리칸 어드벤쳐에서 유러피언으로 이동가능.

지도로는, 가까워보이나, 엄청난 경사와 구불구불 길이 복잡하므로, 걸어가면 오래걸림.

이렇게하면 입장과 동시에 T-익스프레스를 누구보다 빨리 탈 수 있음.

대부분 걸어가고, 길도 잘 몰라서 헤매기 때문임.


T-익스프레스를 타고난 다음,

아마존 익스프레스와, 사파리의 Q-Pass를 발권함 (Q-Pass는 상기 설명을 따름).

그 후에, 각자 타고싶은것을 탐.

그다음 정해진 시간에 Q-Pass를 이용해서 아마존 익스프레스와 사파리를 이용함.


단, 아메리칸 어드벤쳐의 대부분의 놀이 기구는 오후 2시가 넘으면, 대시간이 매우 짧아 지므로,

초반에는 무조건 후룹라이드 등과 같이 줄을 어마어마하게 서야하는 것들을 공략해야함 .


상기의 방법을 따르면, 7개는 무난하게 탈 수 있음.

최대한 오전에 굵직한 놀이기구를 모두 정복 해줘야 함.



ADB_Over_network을 reboot시 초기화 하지 않는 방법


전체적인 System Properties와 preference와의 일관성 유지 및 사용자와의 상호작용 그리고 초기화 매커니즘은 아래의 그림과 같다.



Android Preference 구조 그림.pptx





□ setprop persist.adb.tcp.port 5555

  • 위 명령을 adb를 이용해서 치면, 재부팅 시에도 port가 5555로 설정 되어 짐.
  • 플랫폼을 수정할 필요 없는 가장 간단한 방법
  • adbd 자체에서, 이 기능을 지원함.
  • 원상태 복구를 위해서는, setprop을 다시 직접 쳐야한다는 단점, 발생 왜냐하면, Adb deamon은 persist option에는 반응하지 않음.


□ adbd을 수정


소스코드 위치: system/core/adb/adb.c

// adb_over_network ON
property_get("service.adb.tcp.port",value,"5555");
property_get("persist.adb.tcp.port",value,"");

// adb_over_network OFF
property_get("service.adb.tcp.port",value,"");
property_get("persist.adb.tcp.port",value,"");

핵심은 뒤의 것은 default라는 것이다. 값이 존재하지 않으면, ""를 기록 하게 됨.
""로 설정하면, SystemServer에서 Empty로 인식해서, Default 값을 기록 하게 됨 (Settings App에서의 일관성 유지).
단점: 원상 복구를 위해서는 직접 property를 변경 해야함.

□ Settings App과 System Server 수정


Settings App: 사용자와의 상호작용을 담당. 설정값에 대한 입력 과 출력

System Server: System Properties로부터 값을 읽어와서 System Preference값을 그에 맞추어 변경함. 즉, 서로다른 두 레벨간의 일관성을 유지시켜 줌.

추가로, ContentObserver를 등록 시켜서, System Preference가 변경되어 지면, 그것을 System Properties에 적용 시킴.


framework/base -> service/SystemServer.java


//해당 코드는 Content가 변경 되어지면, 호출 되어 짐. (e.g: 사용자가 설정을 변경 했을 때)

 91     private class AdbPortObserver extends ContentObserver {

 92         public AdbPortObserver() {

 93             super(null);

 94         }

 95         @Override

 96         public void onChange(boolean selfChange) {

 97             int adbPort = Settings.Secure.getInt(mContentResolver,

 98                 Settings.Secure.ADB_PORT, 0);

 99             // setting this will control whether ADB runs on TCP/IP or USB

100             SystemProperties.set("service.adb.tcp.port", Integer.toString(adbPort));

// 결국, 위 코드가 Setting.Secure(java)의 내용을 SystemProperties (native) 영역으로 // 전송하는 역할을 함.

101             Log.e("SystemServer:jaynux","adbPort: "+ adbPort);

102         }

103     }



→ 새로운 옵션 추가
Settings app에 ADBTCPIP_ENABLED 옵션 추가.
위 추가한 옵션을 이용해서, TCP Port를 초기화 할지, 아니면 다른 값으로 설정할지가 결정 됨.

→ System Properties는 변경 되지 않음
system properties로부터 get 한다. 핵심은 get만 한다는 것이다. 
결국, system properties는 변경 되어 지지 않는다. 따라서, get한 내용을, 그저 putInt를 통해서 System preference에 반영하는 작업만을 한다.

→ Default 동작의 의미
service.adb.tcp.port에 대해서 값을 얻어오고, 없을 경우 -1을 default로 하게 됨.
get은 native code 이다. default가 되어지는 경우는, null이거나, empty의 경우.
adbd은 해당 값을 ""로 설정하기 때문에, 항상 default 값이 System Preference에 반영됨.
그래서, Settings app으로 확인해 보면, CheckBox가 정상적으로 잘 표현되어 짐을 알 수 있다.
하지만, 아무리 Check 되어져 있다고 해도, 설령 이 값을 변경 한다고해도, Observer는 그 후에, 
등록 되어 지므로, system properties는 변경 안됨


→ Properties와 Preference의 일관성 유지를 위해서 사용한 방법
SystemProperties.set()을 이용해서 직접 Properties를 설정해주면 된다.
persist를 쓰면 편하지만, 현재 adbd는 persist 값을 부팅시에만 반영하므로, 동작중에 변경을 하더라도, adbd은 계속해서 TCP/IP 모드로 동작하므로, 불편함이 존재 한다. 
결론적으로, adbd의 변경 없이, 자유롭게 사용하기 위해서, service.adb.tcp.port를 사용하며, set()으로 직접 설정 한다.



System property를 Setting 하는 방법은 3가지가 있습니다.


1. Native

int property_get(const char *key, char *value, const char *default_value);

int property_set(const char *key, const char *value);

2. Java

String SystemProperties.get(String key);

SystemProperties.set(String key,String value);

3. adb 명령

adb shell 

root# setprop key value

root# getprop key



import android.util.Log 



String TAG = "tag id"


Log.e(TAG,"message");


Criterion C는 coverage domain으로 부터 유도 되어 진다.


이때, 테스팅 기법에 따라서 집중하는 Domain이 달라 지게 된다.


White-box testing의 경우는 Coverage domain을 code로 부터 추출 한다.


Black-box testing의 경우는 Coverage domain을 requirements로 부터 추출 한다.


하지만, 결국 Coverage domain은 P와 R 모두로부터 추출 해야 정확하게 된다.



핵심은, White와 Black은 기법의 이름이지 이것으로부터 Tests를 뽑아 내는것은 아니다.

Tests는 무조건 상세하게 뽑아내는것이 중요하고, 이때는 반드시 requirements를 반영해야한다.


Verification & Validation을 만족하기 위해서, 프로그램 측면과, 요구사항 측면을 모두 반영 해야 한다.




Statement Coverage는 쉬워 보이지만,


if ( x = malloc(10) {

..

}

else {

..

}

와 같은 코드들의 만족시키기란 쉽지 않다.





White-Box testing의 경우, V model 측면에서


Unit test level 수준에서 적용 할 수 있다.


Black-box testing의 경우, V model 측면에서,

System level test 수준에서 적용 할수 있다.



Coverage 공부를 위해 보면 좋은 블로그: http://froginpot.tistory.com/4 

'Computer Science > 소프트웨어 공학' 카테고리의 다른 글

시험 대비  (0) 2012.06.11


문제점.


wxPython에서 'Start'버튼을 눌렀 때, 정말 긴 작업을 발생 시킬 때가 존재한다.

당연히, 이때 GUI는 락킹 되어진다. 

이때, Thread를 사용하지 않고 이 GUI 락킹 문제를 해결 할 수 있을까?



해결방법.


3가지 방법: Threading, wxYield, Chunking up your processing in a wxEVT_IDLE handler.



1) Threading을 이용하는 방법


Thread와 별 차이가 없으며, 가장 쉽고, 일반적인 방법이다.


import time
from threading import *
import wx

# Button definitions
ID_START = wx.NewId()
ID_STOP = wx.NewId()

# Define notification event for thread completion
EVT_RESULT_ID = wx.NewId()

def EVT_RESULT(win, func):
    """Define Result Event."""
    win.Connect(-1, -1, EVT_RESULT_ID, func)

class ResultEvent(wx.PyEvent):
    """Simple event to carry arbitrary result data."""
    def __init__(self, data):
        """Init Result Event."""
        wx.PyEvent.__init__(self)
        self.SetEventType(EVT_RESULT_ID)
        self.data = data

# Thread class that executes processing
class WorkerThread(Thread):
    """Worker Thread Class."""
    def __init__(self, notify_window):
        """Init Worker Thread Class."""
        Thread.__init__(self)
        self._notify_window = notify_window
        self._want_abort = 0
        # This starts the thread running on creation, but you could
        # also make the GUI thread responsible for calling this
        self.start()

    def run(self):
        """Run Worker Thread."""
        # This is the code executing in the new thread. Simulation of
        # a long process (well, 10s here) as a simple loop - you will
        # need to structure your processing so that you periodically
        # peek at the abort variable
        for i in range(10):
            time.sleep(1)
            if self._want_abort:
                # Use a result of None to acknowledge the abort (of
                # course you can use whatever you'd like or even
                # a separate event type)
                wx.PostEvent(self._notify_window, ResultEvent(None))
                return
        # Here's where the result would be returned (this is an
        # example fixed result of the number 10, but it could be
        # any Python object)
        wx.PostEvent(self._notify_window, ResultEvent(10))

    def abort(self):
        """abort worker thread."""
        # Method for use by main thread to signal an abort
        self._want_abort = 1

# GUI Frame class that spins off the worker thread
class MainFrame(wx.Frame):
    """Class MainFrame."""
    def __init__(self, parent, id):
        """Create the MainFrame."""
        wx.Frame.__init__(self, parent, id, 'Thread Test')

        # Dumb sample frame with two buttons
        wx.Button(self, ID_START, 'Start', pos=(0,0))
        wx.Button(self, ID_STOP, 'Stop', pos=(0,50))
        self.status = wx.StaticText(self, -1, '', pos=(0,100))

        self.Bind(wx.EVT_BUTTON, self.OnStart, id=ID_START)
        self.Bind(wx.EVT_BUTTON, self.OnStop, id=ID_STOP)

        # Set up event handler for any worker thread results
        EVT_RESULT(self,self.OnResult)

        # And indicate we don't have a worker thread yet
        self.worker = None

    def OnStart(self, event):
        """Start Computation."""
        # Trigger the worker thread unless it's already busy
        if not self.worker:
            self.status.SetLabel('Starting computation')
            self.worker = WorkerThread(self)

    def OnStop(self, event):
        """Stop Computation."""
        # Flag the worker thread to stop if running
        if self.worker:
            self.status.SetLabel('Trying to abort computation')
            self.worker.abort()

    def OnResult(self, event):
        """Show Result status."""
        if event.data is None:
            # Thread aborted (using our convention of None return)
            self.status.SetLabel('Computation aborted')
        else:
            # Process results here
            self.status.SetLabel('Computation Result: %s' % event.data)
        # In either event, the worker is done
        self.worker = None

class MainApp(wx.App):
    """Class Main App."""
    def OnInit(self):
        """Init Main App."""
        self.frame = MainFrame(None, -1)
        self.frame.Show(True)
        self.SetTopWindow(self.frame)
        return True

if __name__ == '__main__':
    app = MainApp(0)
    app.MainLoop()


여기서 문제는, 어떤 이유에서 Thread가 종료 되어 지지 않는다면, 그냥 "self.setDaemon(1)"을 에 추가하면 된다. 그러면, Python은 그것의 terminate을 기다리지 않게 된다.


문제점

Thread는 미세한 종료문제를 발생 시킴

Signal 처리와 같은 Process 레벨의 작업



2) wxYield를 이용하는 방법


computation code가 있는 위치에대가 wxYield()의 호출을 추가해 준다.

wxYield 가 호출 되어질 때, 어떤 pending window event들은 dispatched 되어 지게 된다. 즉, window는 refresh되고, 버튼이 눌러지게 되는 등의 작업을 할 수 있다.


그다음, 위에서 Thread로 처리 했을 때와 같게, wxYield 가 리턴된 뒤의 위치의 작업 코드들을 제어하기 위해서 flag들을 설정 해야 한다. 즉, wxYield로 인해서 pending 되어진 'STOP'에 관한 이벤트가 들어 왔다면, 작업은 종료가 되어 져야한다. 따라서 그 후의 처리를 위해서는  flag를 통해서 제어를 해줘야 한다.


Threading의 경우와 마찬가지로, 모든 이벤트들은 wxYield 가 호출되어지는 동안, 처리되어 지므로, 반드시 같은 오퍼레이션이 두번 실행되어지는것에 대해서 보호되어 져야된다.


보여지는 코드는, 위의 Threading 코드와 똑같은 기능을 하지만, Computation Code들이 main window class안으로 들어 갔다. 핵심은, Threading 코드와 다르게 응답성은 절대적으로 wxYield의 호출 빈도에 의존한다는 것이다.


import time
import wx

# Button definitions
ID_START = wx.NewId()
ID_STOP = wx.NewId()

# GUI Frame class that spins off the worker thread
class MainFrame(wx.Frame):
    """Class MainFrame."""
    def __init__(self, parent, id):
        """Create the MainFrame."""
        wx.Frame.__init__(self, parent, id, 'wxYield Test')

        # Dumb sample frame with two buttons
        wx.Button(self, ID_START, 'Start', pos=(0,0))
        wx.Button(self, ID_STOP, 'Stop', pos=(0,50))
        self.status = wx.StaticText(self, -1, '', pos=(0,100))

        self.Bind (wx.EVT_BUTTON, self.OnStart, id=ID_START)
        self.Bind (wx.EVT_BUTTON, self.OnStop, id=ID_STOP)

        # Indicate we aren't working on it yet
        self.working = 0

    def OnStart(self, event):
        """Start Computation."""
        # Start the processing - this simulates a loop - you need to call
        # wx.Yield at some periodic interval.
        if not self.working:
            self.status.SetLabel('Starting Computation')
            self.working = 1
            self.need_abort = 0

            for i in range(10):
                time.sleep(1)
                wx.Yield()
                if self.need_abort:
                    self.status.SetLabel('Computation aborted')
                    break
            else:
                # Here's where you would process the result
                # Note you should only do this if not aborted.
                self.status.SetLabel('Computation Completed')

            # In either event, we aren't running any more
            self.working = 0

    def OnStop(self, event):
        """Stop Computation."""
        if self.working:
            self.status.SetLabel('Trying to abort computation')
            self.need_abort = 1

class MainApp(wx.App):
    """Class Main App."""
    def OnInit(self):
        """Init Main App."""
        self.frame = MainFrame(None,-1)
        self.frame.Show(True)
        self.SetTopWindow(self.frame)
        return True

if __name__ == '__main__':
    app = MainApp(0)
    app.MainLoop()



3) Chunking up your processing in a wxEVT_IDLE handler


마지막으로, 작업을 idle handler에서 처리 할 수 있다. 이것을 사용할 때에는, wxPython이 IDLE event를 언제든지 발생 시킬 수 있도록 허용 해야 한다. 즉, 일반적인 유저 이벤트들의 처리가 완료 되어졌을 때, IDLE 핸들러가 실행 되도록 해야 한다. 단순히 그냥 Flag로 조작 된다.


구현된 알고리즘에 따라서 약간은 어려운 부분이 존재 한다. 이러한 알고리즘들은, 별게의 조각들로 나누어서 실행 할 수 있어야 한다.


IDLE handler안에서, 만약, 작업이 완료 되지 않았다면, 다시 이 핸들러가 호출 되어 질 수 있도록 해야 한다.


결국, IDLE Hander에서 얼마나 자주 return 되는지가 응답성을 보장 하게 된다. 매우 제약적인 방법이며, 복잡하기만 하다. 쓸때없음.


import time
import wx

# Button definitions
ID_START = wx.NewId()
ID_STOP = wx.NewId()

# GUI Frame class that spins off the worker thread
class MainFrame(wx.Frame):
    """Class MainFrame."""
    def __init__(self, parent, id):
        """Create the MainFrame."""
        wx.Frame.__init__(self, parent, id, 'Idle Test')

        # Dumb sample frame with two buttons
        wx.Button(self, ID_START, 'Start',p os=(0,0))
        wx.Button(self, ID_STOP, 'Stop', pos=(0,50))
        self.status = wx.StaticText(self, -1, '', pos=(0,100))

        self.Bind (wx.EVT_BUTTON, self.OnStart, id=ID_START)
        self.Bind (wx.EVT_BUTTON, self.OnStop, id=ID_STOP)
        self.Bind (wx.EVT_IDLE, self.OnIdle)

        # Indicate we aren't working on it yet
        self.working = 0

    def OnStart(self, event):
        """Start Computation."""
        # Set up for processing and trigger idle event
        if not self.working:
            self.status.SetLabel('Starting Computation')
            self.count = 0
            self.working = 1
            self.need_abort = 0

    def OnIdle(self, event):
        """Idle Handler."""
        if self.working:
            # This is where the processing takes place, one bit at a time
            if self.need_abort:
                self.status.SetLabel('Computation aborted')
            else:
                self.count = self.count + 1
                time.sleep(1)
                if self.count < 10:
                    # Still more work to do so request another event
                    event.RequestMore()
                    return
                else:
                    self.status.SetLabel('Computation completed')

            # Reaching here is an abort or completion - end in either case
            self.working = 0

    def OnStop(self, event):
        """Stop Computation."""
        if self.working:
            self.status.SetLabel('Trying to abort computation')
            self.need_abort = 1

class MainApp(wx.App):
    """Class Main App."""
    def OnInit(self):
        """Init Main App."""
        self.frame = MainFrame(None, -1)
        self.frame.Show(True)
        self.SetTopWindow(self.frame)
        return True

if __name__ == '__main__':
    app = MainApp(0)
    app.MainLoop()






읽은것: 색깔

안 읽은것: 색깔

약한 논문: 색깔










우리말로는 같이 "비율"로 해석되는 경우가 많지만..
다른 의미의 단어입니다.


Ratio
Ratio는 말 그대로 비율입니다. 5:5, 6:4, 과학 또는 수학 계산시 특정 수식에 사용하는 이런거죠...

즉 두 수와의 관계를 나타내는 것 입니다.

flashlight가 2개 있고 battery가 5개 있다면, flashlights / batteries 를 계산하면 2개를 비교하는 ratio가 된다.

즉, 2 to 5, 2:5, or 2/5 인 것이다.

값으로 표현하면, 2:5 또는 0.4 이다.




Rate
Rate는 빈도수를 말합니다. 분당 100회, 초당 25회, 주당 3일, 3일에 한번... 이런거죠..
Rate는 또한 등급, 속도, 정도의 뜻도 있습니다.

서로 다른 Unit일 때도 사용 한다.


10개 젤리빈당 $45 라면 이때 1개의 젤리빈 가격을 알고 싶으면


4500 cents / 10 젤리빈 을 계산 한다.

그럼 $4.5가 된다.

이 처럼 서로 다른 unit의 비율을 계산할 때도 사용 한다.




같이 쓰이는 경우
그런데, 두 단어가 비슷한 뜻으로 쓰이는 경우도 있는데...
이 경우는 예를들어 "주당 3일"이라면... 이것은 Rate로 해야 맞지만, 
이것을 7-3:3 = 4:3 으로 쓸 수도 있으므로.. Ratio도 사용할 수 있습니다.

영어 단어와 우리말의 단어는 1:1로 매치되지 않으므로 정확하게 선을그어 
구분하기에는 어려움이 있으므로..
영어를 많이 접하시면서 .. "감"을 잡으시는것이 좋습니다.
제가 드린 설명도 .. 그런 이유로.. 100% 정확할 수는 없습니다.
그냥 문맥에 따라 해석 하시는것이 가장 바람직하겠습니다.



Fraction


3:4 == 3/4 는 같은 의미 (ratio)



잘 정리된 그림






의문문 어순


Basic: be동사, 조동사, 일반동사 의문문


1.동사 + 주어

2. 조동사 또는 Be 동사가 있으면, 주어 앞에 위치

3. 완료형 have p.p의 have의 경우 주어 앞에 위치


형태: be동사 + 주어 + 동사 또는 조동사 + 주어 + 동사


[예문]

It was built in 1980: 그건 1980년도에 세워졌어..

=> Was it built in 1980?: 그건 1980년도에 세워졌어?


You can't see anything: 넌 아무것도 볼 수 없어.

=> Can't you see anything? 너 아무것도 볼수 없어?


4. 조동사, be동사 둘다 있으면, 조동사가 주어 앞으로!

형태: 조동사 + 주어 + be동사.


you will be studying in the United States next year.

: 너 내년에 미국에서 공부하고 있을 거야.


=> Will you be studying in the United State next year?

: 너 내년에 미국에서 공부하고 있을 거야?


5. 동사가 일반동사인 경우는?

- 단, 문장에 조동사는 없을 때.


주어 앞에 do/does (현재), did (과거) 붙여 줌..

형태: Do/Does/did + 주어 + 동사


You know tom: 너는 탐을 알아.

=> Do you know Tom? 너는 탐 아니?


6. 만약 문장에 의문사가 있으면?


의문사: who, what, how, which 등


모든 규칙에서, 의문사는 맨 앞으로 오게 한다.

( 조동사, be 동사, 일반동사 )

의문사가 목적어로 쓰이는 경우.


What did you eat for lunch? 너 점심으로 뭘 먹었니?

How many people have you invited? 너 몇명 초대 했어?


※ 꾸며주는 말과 꾸밈받는 말이 항상 붙어 다니게 된다.


[예외]

의문사가 '주어'로 쓰인 경우는 형태 주의!

형태: 의문사 + 동사 + (목적어)


Who cried?: 누가 울었니?

Who saw Tom?: 누가 탐을 봤어?



Basic Two: 의문사 의문문


§ 의문사의 종류


1. 부사: how, when, where, why

뒤에는 당연히, 형용사, 부사가 올 수 있다.

[예문]

How was it? 그거 어땟나요?

Where are you?  너 어디에 있어

Why are you angry at me? 왜 나한테 화를 내?

When did it happen? 언제 그게 일어났어?


2. 대명사: what, which, who, whom, whose

Who are you? 너 누구야?

What is it? 그게 뭐야? 

Whom do you like? 너 누구를 좋아해?


3. 형용사 역할: what, which, whose

-뒤에 명사와 한 덩어리로 쓰입니다.


What time is it now? 지금 몇시야? 

Which way is faster? 어느 길이 더 빨라?

Whose bag is this? 이건 누구 가방이야?


§ 의문사 의문문 만들기


1.의문사로 의문문을 만들때는 의문사가 항상 앞에 온다.

즉, 의문문을 만든 상태에서 의문사만 맨 앞에 붙인다.


추가적으로, 다음의 두 가지 형태로 나뉘어 진다.


1) 의문사가 주어 역할 할때 [주의]

-형태: 의문사 + 동시 + (목적어)


Who saw Tom today? 누가 오늘 탐 봤어?

Who can be elected? 누가 선출될까?


2) 의문사가 목적어 역할할 때

-형태: 의문사+조동사나 be동사+주어+동사


Who(m) did Cindy see? 신디는 누굴 봤어?

회화: 목적격 whom 대신, 주격 who를 많이 씀


Who(m) do you like? 너는 누구를 좋아해?


[전치사의 위치]

의문사가 전치사의 목적어로 쓰인 경우!


I should talk to (     ) 난 누구한테 말해야 돼.

의무문 만들때, 목적어의 전치사는 맨 끝에 둡니다.


Who(m) should I talk to? 난 누구에게 말 해야돼?


전치사가 앞에 오는 경우: 격식체

이때는 who가 아닌, whom을 사용한다.


-> To whom should I talk?








§ 의문문사 의문문의 경우


조동사가 있는 경우: (의문사) + 조동사+ 주어+ 동사 

When did the mail arrive? 언제 편지가 도착 했니?

Can you believe Tommy got a scholarship? 너는 Tommy가 장학금을 받았다는 것을 믿을 수 있니?



조동사가 없는 경우: (의문사+) 동사 + 주어

When are you able to come? 너는 언제 올 수 있니?

Are you free this Sunday? 이번 주 일요일에 한가하니?



§ 의문 형용사: What 과 Which + 명사


Which room did she enter? 그녀가 어느 방에 들어 갔니?

Which section has the dictionaries? 어느 섹션에 사전이 있나요?



§ 의문 부사: How + 형용사/부사


How long should I wait? 제가 얼마나 오래 기다려야 하나요?



§ 간접 의문문: 다른 문장 안에 포함된 의문문 


일반적인 형태: 의문사 + 주어 + 동사

I heard why the professor quit. 나는 그 교수가 그만둔 이유를 들었다.

Tell me which courses you will take. 네가 어떤 수업을 들을 건지 내게 말해줘.



※ 말할때, 순식간에 어순을 맞추면서도, 시제와 인칭을 맞추어서 이야기하기란 쉽지 않다. 그래도 연습을 해야 한다.


[추가 예문]

1. be동사/조동사 간접의문문


I don't know who that girl is. 나 몰라, 저 여자애 누군지..

Please, tell me where I can meet Lena. 좀 말해줘 Lena 어디서 만날 수 있는지..

Do you remember what my name is? 너 기억나? 내 이름이 뭔지?

You don't know what kind of person I am. 넌 몰라~ 내가 어떤 사람인지..


2. do 동사 간접 의문문


I want to know what this word means (나 알고 싶어, 이 단어 무슨 뜻인지..)

그냥 의문문이라고 하면, What does this word mean? (what은 목적어로써 쓰인다.)


i don't understand why you did that (난 이해가 안돼, 너가 왜 그랬는지..)

원래 의문문, Why did you do that?  (why는 목적어로 쓰였다.)


3. 의문사가 없는 의문문 (누가 너 봤어: Did anybody see you?)

을.. 간접 의문문 형태로 중간에 넣을 때는, If나 whether을 사용 한다.

이 때, If나 whether 뜻은 -인지 or -인지, 아닌지.. ( if는 조건/ 가정의 뜻이 아니다.)


Do you know if/whether anybody saw you? (너 알어? 누가 너 봤는지?)




Think, believe, imagine, suppose, suggest 등이 동사로 쓰인 의문문에

간접 의문문이 포함되면 의문사가 문장의 맨 앞으로 온다.


Do you think? + What are they planning? 당신은 생각하나요? + 그들은 무엇을 계획하고 있나요?

-> Do you think what they are planning ? [x]

-> What do you think the are planning? [0]











EndNote x7 사용방법 정리



Introduction

해당 Journal에 맞게 Citations & Bibliography를 수정하는 방법이다.

IEEE transaction 라고해도, 각각이 모두 틀리다. 따라서 수정을 해줘야 한다. 틀리면, reject...



Menu 위치

Edit -> Output Styles -> New Style or Edit "xx" 


Citations는 본문에 인용되는 형식을 말함.

Bibliography는 reference section에 표시되는 형식을 말함.


각각의 항목에서 해당 저널에 맞게 스타일을 수정 해준다.


IEEE Transactions on Consumer Electronics Style로 수정 하기

Bibliography 수정 사항 [conference paper, journal article, book]


Conference paper

Author, “Title,” in Proc. Conference Name|, Conference Location|, `pp.` Pages|, Date Year|.

Journal Article

Author, “Title,” Journal|, vol. Volume|, no. Issue|, `pp.` Pages|, Date Year|.

Book

Author|, Title|, Edition `ed.`|, Publisher: Place Published|, Year|, pp. Pages|.


백업 방법

아래 위치에서 본인이 만든 style 파일을 백업 한다. 애써만든것 날려버리지 말자.

C:\Program Files (x86)\EndNote X7\Styles


또는


내문서 > Endnote > Styles에 있다.



MS-Word에서 스타일 바꾸는법

https://www.youtube.com/watch?v=L1y7B3f5pAg


Thomson Reuters 공식 Youtube site: https://www.youtube.com/channel/UCdTDZ4RUT9Jl81oRhpEIIxA



MS Word Bibliography 설명

Format Bibliography



Layout

First line indent: 0.000 in // 각 래퍼런스의 첫 번째 라인의 indentation을 변경시킨다.

Hanging Indent: 0.500 in // 스타일에 hanging indent(내어쓰기)가 셋팅되어 있을 수도 있습니다.

// [1] 글자 <-- 여기서의 [1]과 "글자" 사이의 공백을 결정하게 된다.

Line spacing: 서지 정보 전체 텍스트에 적용이 된다.

Space after: 레퍼런스들 사이에 추가적인 스페이스를 넣을 수 있도록 한다.




Citation group references (그룹 인용)

[1],[2],[3] -> [1]-[3] 또는 [1-3] 등으로 표현하는 방법.


1단계: 옵션 설정

Edit -> Output Styles -> [desired style] -> Check "use number ranges for consecutive citations"


2단계: MS Word에서 사용 방법


아래와 같이 인용한다.

{{Ravindranath,  #283;Rastogi,  #290;Enck,  #291;Azim,  #288;Lee,  #286;Liu,  #287;MacHiry,  #284;Liang,  #285}}.


또는 원하는 스타일 대로 인용하대 반드시 모든 공백을 제거 한다.

공백이 있으면 consecutive citation이 동작하지 않는다.




Endnote 참고 문헌을 BibTex 파일로 만들기

1) 필드 항목중 label에 키값을 삽입한다. 이것이 bibtex에서의 key로 자동으로 번역 된다.

2) export할 문헌 정보 또는 디레터리를 선택 한다.

File > Export > Output style을 Bibtex으로 지정한다. 그다음 확장자를 bib로 설정하거나

txt로 나온것을 복사 붙여넣기 하면 된다.







'논문 작성 > EndNote' 카테고리의 다른 글

EndNote에서 BibTeX 가져오기 (import)  (0) 2015.06.10


명사절


발화 인지 감정 등에 관련된 동사: say, think, pretend

  형용사: sure glad

뒤에 쓰인 That은 생략 할 수 있다.


Rising sea levels show (that) ice caps are melting.

The guard was sure (that) he had locked the door.



관계대명사


주격 관계 대명사 + be 동사는 생략 할 수 있다.

  • We're preparing a meal (that is) fit for a king

목적격 관계 대명사는 생략 할 수 있다.

  • She bought the camera (which/that) she saw at the store


관계 부사


관계부사 when, where, why는 선행사와 관계부사를 모두 쓰거나, 둘 중 하나는 생략 한다.

  • The architect described the reason why the bridge had become unstable.
  • The architect described the reason the bridge had become unstable.
  • The architect described why the bridge had become unstable.


단, how의 경우 선행사 the way와 how 중 하나는 반드시 생략 한다.

  • Show knows the way how we can get uptown quickly.
  • Show knows how we can get uptown quickly.
  • Show knows the way how we can get uptown quickly.




'영어 > 영문법' 카테고리의 다른 글

compare with vs compare to  (0) 2015.01.20
의문문 어순  (1) 2014.03.19
12. 대명사 - this 와 that의 사용법.  (0) 2014.02.17
관계 대명사 That  (0) 2014.01.29
비교급 용법  (0) 2013.12.09

that/those의 사용법


지시 대명사 일때
1) 앞에나온 명사를 대신하며, 이때 반드시 뒤에서 수식어 전치사구, 관계절, 분사의 꾸밈을 받는다.

-> than that of her rival.

-> besides those that already exist.

지시형용사 일때는 this와 that은 별 차이가 없다. 그냥 단수 복수만 구분


'영어 > 영문법' 카테고리의 다른 글

의문문 어순  (1) 2014.03.19
생략 1 - 명사절, 관계사절, 부사절의 각각의  (0) 2014.03.01
관계 대명사 That  (0) 2014.01.29
비교급 용법  (0) 2013.12.09
수동태의 행위자 생략  (0) 2013.12.07

관계 대명사 that


전차사 뒤에는 사용할 수 없다.


수량 표현 + 관계 대명사에서는 사용할 수 없다.

one / each, some/any, the rest, all/both

several, half, many/much/most,              of + 관계대명사 (which / whom / whose + 명사)


계속적 용법으로 쓰인 관계절에는 선행사에 관계 없이 관계 대명사 That이 올 수 없다.

The restaurant, that/which closed last year, has been turned into a bookstore.


---------------------------------------------------------------------------------------------


최상급 서수, all, the same, the very, the only 등이 있는 경우, 관계대명사 that 만 올 수 있다.





 



   
비교급의 구문 : A ~+비교급+than+B」의 비교급 구문은「A가 B보다 더 ~하다」라는
                               의미를 갖는다.

  • Gold is heavier than copper. (금은 구리보다 무겁다.)
  • He is taller than his father. (그는 그의 아버지보다 더 크다.)
  • Mike likes me better than Ed. (에드보다 마이크가 나를 더 좋아한다.)
  • He is happier than before. (그는 전보다 더 행복하다.)
  • This game is more exciting than that one. (이 게임은 저것보다 더 흥미진진하다.)
  • She is more beautiful than her sister. (그녀는 그녀의 여동생보다 더 아름답다.)
  • I can speak English more fluently than my brother.
     
    (나는 내 형보다 더 유창하게 영어를 할 수 있다.)

      ☆. Note : 비교급 구문의 than 이하에서 앞부분과 중복이 되는 말은 생략하는 것이 
                        원칙이다.

    • Mike likes me better than Ed (likes me).
    • He is happier than (he was) before.

   비교의 대상이 되는 것은 문법적으로 동등한 것이어야 한다. 
            < ☞ 문의 병렬구조 >

  • The climate of Korea is milder than that of Canada. 
     
    (한국의 기후는 캐나다의 기후보다 온화하다.)
    cf. The climate of Korea is milder than Canada. (X)

 



   
비교급의 강조 : 비교급을 강조할 때는 much, far, even, still, a lot 등을 비교급 앞에
                             쓰게 되는데「훨씬, 더욱」의 의미를 갖는다.

  • It was much worse than I thought. (그것은 내가 생각했던 것보다 훨씬 나빴다.)
  • I feel much better today. (오늘은 훨씬 더 좋습니다.)
  • He is much older than I am. (그는 나보다 훨씬 나이가 많다.) 
     
  • His picture is far better than mine. (그의 사진은 나의 것보다 훨씬 좋다.)
  • She speaks Japanese far better than me. (그녀는 나보다 훨씬 더 일본어를 잘한다.) 
     
  • She acted even more cleverly than usual. 
     
    (그녀는 평소보다도 훨씬 더 영리하게 행동했다.)
  • This flower is even prettier than that. (이 꽃은 저것보다 훨씬 더 예쁘다.) 
     
  • That’s still better. (저것이 훨씬 더 좋다.)
  • Ted runs a lot faster than his brother. (테드는 그의 형보다 훨씬 더 빨리 달린다.)

 



 
  비교급 앞에는 the를 붙이지 않는 것이 원칙이지만, 다음과 같은 경우에는「the+비교급」의
   형태로 쓰인다.

   (1)「두 개 중 더 ~한」의 의미로 쓰일 때는 비교급에 the를 붙인다.

  • This is the heavier of these two bags. (이 두 가방 중에서 이것이 더 무겁다.)
  • This computer is the better of the two. (이 컴퓨터가 둘 중에서 더 좋다.)

   (2) the greater part of ~ (대부분의 ~), the latter part of ~ (~의 후반부), 
        the younger generation (젊은 세대), the upper class (상류계층) 등과 같이 비교의
        대상이 없이 막연히 그룹을 지어「~한 편의 것」이라는 뜻으로 쓸 때는 비교급 앞에 
        the를 붙인다. 이것을 
절대비교라 한다.

  • His family belonged to the upper class. (그의 집안은 상류계층에 속했다.)
  • The latter part of his play was so boring. (그의 연극의 후반부는 아주 지루했다.)

   (3)「the+비교급」의 형태로 쓰이는 관용적 표현들

    ☆ the+비교급, the+비교급 (~하면 할수록 더 ~하다)

  • The more, the better. (많으면 많을 수록 좋다.)
  • The higher we climb, the colder it becomes. (높이 오르면 오를수록 더 추워진다.)
  • The sooner, the better. (빠르면 빠를수록 더 좋다.)
  • The more we know about him, the better we can understand his novels. 
     
    (그에 대해 많이 알면 알수록 그의 소설을 더 잘 이해할 수 있다.)

    ☆ all the+비교급+for/because of = so much the+비교급+for/because 
         (...하기 때문에 더욱 ~하다)

  • I love her all the more for her beauty. 
     
    (나는 그녀가 아름답기 때문에 더욱 더 그녀를 사랑한다.)
  • I like him all the better because of his honesty. 
     
    (나는 그의 정직함 때문에 더욱 그를 좋아한다.) 



능동태의 주어는 by+목적어 로 행위자를 표현하게 된다.



[by + 목적]의 행위자 표시는 꼭 필요하 경우에만 한다.


They cut down the trees (그들이 그 나무를 잘랐다.)

=> The trees were cut down

We call it "Blackie." (우리는 그것을 블랙키라고 부른다.)

=> It is called "Blackie."

Someone broke the window of my car. (누군가가 내 차의 유리창을 깨뜨렸다.)

=> The window of my car was broken.

People killed the animals for money. (사람들이 돈을 위해 그 동물들을 죽였다.)

=> The animals were killed for money.




Image.open() 이 정상적으로 작동하다가 갑자기 작동 하지 않으면서, no Attribute라는 error 메시지를 나타낼 경우 그것은, namespace 충돌 때문일 것이다.


그 경우 모듈로 다시 masking을 해주면 문제를 해결 할 수도 있다.

PIL.Image

이렇게 하는 경우 어떤 class 이름이 Image일경우 namespace 문제가 발생 하는 것을 맊을 수 있다.


from PIL import Image

위의 것 대신에,

Import PIL.Image 를 사용 한다.


When working with a lot of imports, beware of namespace confilict.

I'm generally very wary of from some_module import * statements.


'Computer Science > Python' 카테고리의 다른 글

Python 설치법, 환경설정, IDE 설정  (0) 2015.11.17
GUI Responsive ( Thread, wx.Yield  (0) 2014.04.11
subprocess  (0) 2013.07.26
mutlprocessing의 오류  (0) 2013.07.19
GUI 프로그래밍  (0) 2013.06.23

The amount of sugar overwhelmed the workers.

The number of tourists coming into Korea increases every year.


The amount of + 불가산 명사(단수) // 동사는 단수 동사.


The number of + 가산명사(복수 형태) // 동사는 단수 동사. = 단순히 해당 복수명사의 수를 의미하므로.


a(an) number of + 가산(복수 명사) // 동사는 복수 동사. = 해당 명사의 여러개를 의미하므로. 

'영어 > 영문법' 카테고리의 다른 글

비교급 용법  (0) 2013.12.09
수동태의 행위자 생략  (0) 2013.12.07
부정관사와 정관사의 사용 방법.  (0) 2013.08.18
which와 , which (콤마 which)의 차이점.  (4) 2013.08.18
Anyone과 Someone의 차이점.  (0) 2013.08.18


실행창에서


Sysdm.cpl


WordPress에 대한 code-coverage 측정 방법 연구


Project위치: ~/Android_Application_source/WordPress # 


WordPress version: r394


다음 파일에는 WordPress와 Monkey coverage 측정을 위한 TestProject 그리고 AndroidMonkey 라이브러리 Project가 있다.


□ Android 3.0 library를 사용하므로, 3.0 이상의 android OS 스마트폰 사용.

    2.3.3 진저브레드 사용지, action bar에 의한 error가 발생


WordPress.vol1.egg


WordPress.vol2.egg


WordPress.vol3.egg


WordPress.vol4.egg


WordPress.vol5.egg


WordPress.vol6.egg


WordPress.vol7.egg


WordPress.vol8.egg


WordPress.vol9.egg


WordPress.vol10.egg


WordPress.vol11.egg


Commit Hash Code:

commit 668464259ca179d80dc92369e7f83cd828552637
Author: mrroundhill <dan@automattic.com> 2011-11-09 07:59:31
Committer: mrroundhill <dan@automattic.com> 2011-11-09 07:59:31
Parent: b16ea0b1dc6768bf915faca510236ad4ce537b58 (set up posts, settings and stats as singleTask activities, so you can't have more than one of each activity running at a time.)
Child: 601bfbdbb38b824203331b60e467a5f96a1a5f45 (kill the network task/spinner if user performs an action on the post view.)
Branches: origin/notifications, origin/master, origin/NUX, origin/HEAD, origin/develop, master
Follows: 1.4.1
Precedes: 2.0

setting new version number


Bug list (직접 발견)


INSTRUMENTATION_RESULT: longMsg=java.lang.NullPointerException
INSTRUMENTATION_RESULT: longMsg=android.database.CursorIndexOutOfBoundsException:
INSTRUMENTATION_RESULT: longMsg=java.lang.IllegalArgumentException: no dialog with id 0 was ever shown via Activity#showDialog




Monkey coverage를 측정.

Project 위치: root@ubuntu:~/Android_Application_source/WordPress/WordPressTest_originTest#


기존 Moneky Coverage 측정 방법

Monkey 라이브러리 open project를 이용해서 test instrumentation code를 작성해서 실험.


Manifest.xml 분석에 의한 testing 기법 Coverage 측정 방법 

시작 Activity를 직접 수정해서 test instrumentation code 실행


public class RandomTest extends ActivityInstrumentationTestCase2<EditContent> {

/*

* WordPress R394

* the number of activity is to start as follows:

* cmp=org.wordpress.android/.Signup

* cmp=org.wordpress.android/.NewAccount

* cmp=org.wordpress.android/.ViewStats

* cmp=org.wordpress.android/.AddQuickPressShortcut 

* cmp=org.wordpress.android/.AddAcountSettings

* login case: 12

* cmp=org.wordpress.android/.Settings    -> o

* cmp=org.wordpress.android/.Link 

* cmp=org.wordpress.android/.AddAccount

* cmp=org.wordpress.android/.SelectCategories

* cmp=org.wordpress.android/.Signup

* cmp=org.wordpress.android/.ViewStats

* cmp=org.wordpress.android/.AddAcountSettings

* cmp=org.wordpress.android/.Dashboard -> This first acitvity.

* cmp=org.wordpress.android/.Write

* cmp=org.wordpress.android/.EditContent

* cmp=org.wordpress.android/.ViewCommentActivity

* cmp=org.wordpress.android/.ViewPostActivity

*/

private static final int NUM_EVENTS = 1;

private static final String packageToTest = "org.wordpress.android";

public RandomTest(){

super(packageToTest, EditContent.class);

}



1) Test Project 생성: Eclipse 이용


2) WordPress Project 변환 및 설치: Ant 이용

project name: WordPress-Android

android update project -p . -n WordPress-Android

WordPress(app) project install: ant emma debug install


3) coverage.em 파일 생성 (원본 파일이다.)

테스팅 과정중에도 생성되지만, 작업이 꼬이면, 엉기므로 미리 생성해준다.

명령어: ant instrument

생성위치: bin/coverage.em

위 파일을 미리 복사해 놓는다. 테스팅 과정 중에 계속 변경이 되어진다.


4) Test Project 변환 및 설치: Ant 이용

project name: WordPressTest_originTest

android update test-project -m ../WordPress-Android -p .

test project install: ant emma debug install

주의: 반드시, ant로 project를 변환하며, 설치 해야함


app project: $ android update project -p [현재 위치] -n [project 이름]

test project: $ android update test-project -m [app project의 위치] -p [현재위치]


android update 명령어는 ant 빌드를 위해서 build.xml 파일을 가져온다.

따라서, SDK version을 변경 했다면, android update를 새로 해주어야 한다.

즉, 변경한 version에 맞는 build.xml을 다시 얻어와야 한다.


4) to run testing: adb shell am instrument -e coverage true -w org.wordpress.android.test/android.test.InstrumentationTestRunner

단, ant emma debug install test는 coverage가 0%로 나오니 쓰지 않음.


5) coverage.ec 추출

위치: adb shell pull /data/data/org.wordpress.android/files/coverage.ec .


6) HTML로 변환: 

java -cp ~/Android_Application_tools/android-sdk-linux/tools/lib/emma.jar emma report -r html -in coverage.em,coverage.ec

java -cp ~/Android_Application_tools/android-sdk-linux/tools/lib/emma.jar emma report -r html -in coverage.em,about.ec,comments.ec,editcontent.ec,replytocomment.ec,addaccount.ec,link.ec,settings.ec,addacountsettings.ec,newaccount.ec,signup.ec,addquickpressshortcut.ec,dashboard.ec,posts.ec,viewstats.ec


주의: coverage.em,coverage.ec 사이에 space를 주지 않는다.




1) app project를 설치 할때 반드시 ant로 설치.


EMMA: processing input files ...
EMMA: 2 file(s) read and merged in 48 ms
com.vladium.emma.EMMARuntimeException: [CLASS_STAMP_MISMATCH] runtime version of class [org.wordpress.android.EditContent$4] in the coverage data is not consistent with the version of this class in the metadata, possibly because stale metadata is being used for report generation.
    at com.vladium.emma.report.ReportDataModel.getView(ReportDataModel.java:95)
    at com.vladium.emma.report.AbstractReportGenerator.initialize(AbstractReportGenerator.java:210)
    at com.vladium.emma.report.html.ReportGenerator.process(ReportGenerator.java:85)
    at com.vladium.emma.report.ReportProcessor._run(ReportProcessor.java:254)
    at com.vladium.emma.Processor.run(Processor.java:54)
    at com.vladium.emma.report.reportCommand.run(reportCommand.java:130)
    at emma.main(emma.java:40)


2) coverage.em을 반드시 백업한다. ant instrument를 이용해서 생성한다음

3) r20 버전을 반드시 쓴다. r22는 쓰지 말아라. 그것을 쓰면 오류가 난다. (x)

버전 문제다, android update를 재 실행해서 build.xml파일을 새로 얻어 와야 한다.


Ant builds support a property named adb.device.arg, 를 이용 한다.


For example:

root@ubuntu:~/Android_Application_source/testingProjectPackage/NotePad# ant -Dadb.device.arg="-s 0149A97F16021014" emma debug install

Buildfile: /root/Android_Application_source/testingProjectPackage/NotePad/build.xml



Luckily, adb supports another way to specify the device: via the ANDROID_SERIAL environment variable. This variable takes the same serial values as the -s flag, and being part of the environment is independent of how you end up running adb. To repeat my previous example, I just need to set the variable to the serial for my emulator:


jsankey@caligula:~/work/my-app$ export ANDROID_SERIAL=emulator-5554

jsankey@caligula:~/work/my-app$ ant install

Buildfile: build.xml

    [setup] Android SDK Tools Revision 6

    [setup] Project Target: Android 2.2

 

...

 

install:

     [echo] Installing /home/jsankey/work/my-app/build/MyAppActivity-debug.apk onto default emulator or device...

     [exec] 277 KB/s (14446 bytes in 0.050s)

     [exec]     pkg: /data/local/tmp/MyAppActivity-debug.apk

     [exec] Success

 

BUILD SUCCESSFUL

Total time: 4 seconds


AndroidMonkey is an Android Library. It is, in fact, a copy of the original Android Monkey Toolhttp://developer.android.com/guide/developing/tools/monkey.html and made as a library for testing and analysis (e.g. code coverage) purposes.


Tester/User can easily use the library to create random test cases to test android apps with GUI.


Why this library:

You can use this library to create random test cases for your application, with just few lines of code

You can add your assertions to access the state of the SUT (you can hardly do this with the Android Monkey Tool)

You can do Coverage analysis of random testing on Android Application, this is useful for Research Purpose (like what I'm doing)



실행방법


우선, 위 open project에서 다운받은 example code를 ant로 빌드환경에 맞게 update를 해야한다.


이러한 작업을 완료한 3개의 파일을 본 블로그에 첨부한다.




1) monkey testing할 project를 target smartphone에 설치 한다.

명령어: ant emma debug install 


root@ubuntu:~/Android_Application_source/testingProjectPackage/NotePad# ant emma debug install

Buildfile: /root/Android_Application_source/testingProjectPackage/NotePad/build.xml


emma:


-set-mode-check:


-set-debug-files:


-check-env:

 [checkenv] Android SDK Tools Revision 22.2.1

 [checkenv] Installed at /root/Android_Application_tools/android-sdk-linux_r22


install:

     [echo] Installing /root/Android_Application_source/testingProjectPackage/NotePad/bin/AntNotePad-debug.apk onto default emulator or device...

     [exec] 554 KB/s (63571 bytes in 0.112s)

     [exec] pkg: /data/local/tmp/AntNotePad-debug.apk

     [exec] Success


BUILD SUCCESSFUL

Total time: 6 seconds



2) app test project를 설치한다.

해당 project는 AndroidMonkey project와 종속성이 있다. 왜냐하면, 테스팅 수행 과정에서 random event를 생성해서 testing을 수행하기 때문이다.


root@ubuntu:~/Android_Application_source/testingProjectPackage/NotePadMonkeyTester# ant emma debug install

Buildfile: /root/Android_Application_source/testingProjectPackage/NotePadMonkeyTester/build.xml


emma:


-set-mode-check:


-set-debug-files:


-check-env:

 [checkenv] Android SDK Tools Revision 22.2.1

 [checkenv] Installed at /root/Android_Application_tools/android-sdk-linux_r22

...
...
installi:

BUILD SUCCESSFUL
Total time: 20 seconds




3) 테스팅을 실행한다.

환경은 notepad 어플리케이션에 2개의 post를 등록한 상태에서 실행을 한다.


명령어: adb shell am instrument -e coverage true -w com.example.android.notepad.test/android.test.InstrumentationTestRunner



특이사항: 위 명령어를 실행하면 app project의 bin 디렉터리에 coverage.em 파일이 생성 되어 진다.

root@ubuntu:~/Android_Application_source/testingProjectPackage/NotePadMonkeyTester# adb shell am instrument -e coverage true -w com.example.android.notepad.test/android.test.InstrumentationTestRunner


com.example.android.notepad.test.RandomTest:.

Test results for InstrumentationTestRunner=.

Time: 49.75


OK (1 test)


Generated code coverage data to /data/data/com.example.android.notepad/files/coverage.ec


3) report 생성.


주의: coverage.em이 없을 경우, app project 디렉터리에서 ant instrument 명령어를 실행해서 

root@ubuntu:~/Android_Application_source/testingProjectPackage/NotePad# adb pull /data/data/com.example.android.notepad/files/coverage.ec .

17 KB/s (691 bytes in 0.039s)


root@ubuntu:~/Android_Application_source/testingProjectPackage/NotePad/bin# java -cp ~/Android_Application_tools/android-sdk-linux/tools/lib/emma.jar emma report -r html -in coverage.em,coverage.ec
EMMA: processing input files ...
EMMA: 2 file(s) read and merged in 7 ms
EMMA: writing [html] report to [/root/Android_Application_source/testingProjectPackage/NotePad/bin/coverage/index.html] ...
root@ubuntu:~/Android_Application_source/testingProjectPackage/NotePad/bin# ls
AndroidManifest.xml                    AntNotePad-instrumented-unaligned.apk.d  AntNotePad.ap_.d  classes.dex    coverage.ec  jarlist.cache
AndroidManifest.xml.d                  AntNotePad-instrumented.apk              build.prop        classes.dex.d  coverage.em  proguard.txt
AntNotePad-instrumented-unaligned.apk  AntNotePad.ap_                           classes           coverage       dexedLibs    res
root@ubuntu:~/Android_Application_source/testingProjectPackage/NotePad/bin# firefox ./coverage/index.html 
failed to create drawable







F-검정에 대해서 공부해보자. 
몇 결정트리 알고리즘에서 t-검정, F검정을 사용하기 때문에 
해당 결정트리 알고리즘을 잘 이해하기 위해서는 이러한 통계 검정 방법들을 잘 이해해두어야 한다. 


F-검정은 언제 사용할까?
F-검정은 두 모집단의 분산의 차이가 있는가를 검정할 때 사용한다. 
(두 집단의 평균의 차이가 존재하는가가 아니라 분산의 차이가 있는가를 검정한다.) 


F-검정은 언제 사용할까?
F-검정은 두 모집단의 분산의 차이가 있는가를 검정할 때 사용한다. 
(두 집단의 평균의 차이가 존재하는가가 아니라 분산의 차이가 있는가를 검정한다.) 


예1. (제4판. 현대통계학. p.349-350) 
예를들어, 어느 중학교에서 1학년 학생들의 성적의 차이(분산)이 2학년이 되면 더 커질 것이라고 예상된다. 실제로 그런가 검정해보자. 1학년에서 7명을 뽑고, 2학년에서 9명을 뽑아서 각각의 성적의 분산을 조사해 봤더니, 1학년의 분산은 9.0 이었고, 2학년의 분산은 19.8 이었다. 두 모집단의 분산은 같다고 볼 수 있을까? 알파=0.05 에서 검정해보자. 
F(8,6) = 4.15 이다. (자유도는 개체 크기에서 1씨 뺀 값으며 2개가 사용된다. F분포표에서 찾아보자.) 
F = 19.8 / 9 = 2.2 이다. 2.2 < 4.15 이므로 F=2.2는 기각역 안에 있으며, 귀무가설을 기각할 수 없다. 
즉, 2학년학생의 성적 차이가 1학년 학생의 성적차이보다 크다고 할 수 없다. 


F-분포표 

F검정에 필요한 F분포표를 첨부하였다. 

F검정표는 두 개의 자유도 값을 사용한다. (행, 열에 두 표본의 자유도가 사용된다.)  




'AI > Probability & Statistics (R)' 카테고리의 다른 글

비교 분석  (0) 2016.08.03
가설 검증과 추정  (0) 2016.08.03
이상치 제거 (Box-plot 해석을 통한)  (0) 2015.01.03
회귀 분석 (1)  (0) 2013.08.29
조건부 확률, Conditional Probability / joint probability  (2) 2013.05.17


1. 단순 회귀 분석: 종속 변수 = 독립변수.


단순 회귀 모형은 최소 제곱법에 의해서 추정을 하게 된다. 


최소 제곱법


이때, L 값이 가장 작을 때의, 베타1과 베타0의 값으로 모형을 만들게 된다.



단순 회귀 분석에 의한 모형,



잔차의 정의: 잔차 = 측정치 - 예측치




2. 모형의 적합도 분석 


모형의 적합도는 분산분석의 F 검정을 실시하거나,

결정계수 r^2를 가지고 회귀 방정식의 유효성을 검증하게 된다.



사전 지식


SST (총변동) = SSE (잔차변동) + SSR (회귀변동)


따라서, SSE(잔차변동)이 0으로 가면 아주 좋은 것이다.

그렇게 될경우 SST(총 변동) = SSR(회귀변동)과 일치한다.

이 의미는, SSR(회귀변동)은 회귀 방정식에 의한 값이고 이게 SST(총 변동)과 일치한다는 것은 회귀 방정식이 완벽히 측정값과 일치한다는 의미를 가진다.


이러한 특성을 토대로 우리는 결정계수 R^2을 계산해 낸다.

결정계수: 


- 모형의 설명력

- 즉, 독립수들이 Y값을 얼마나 잘 설명해 주는가를 나타내는 척도

- 결정계수 값이 1에 가까울수록 설명력이 좋음 0에 가까울수록 설명이 떨어지는 것 

- 결정계수에 대한 검정방법은 없으므로, 회귀모형의 적합성에 대해 설명하는 것은 위험 하다.

단지 독립변수들의 설명력으로만 해석이 가능하다.

모델의 적합성은 F검정으로 해야 한다.



▣ 분산분석표에 의한 F-검정의 정의는 아래의 스크린샷과 같다.






보통, 통계페키지(SPSS)에 의해서 유의확률 p 값이 0.5 보다 작을 경우, 귀무 가설을 기각한다.

따라서 해당 회귀 방정식은 유효하다고 검정 한다.



▣ 베타계수

  • 독립변수들이 종속변수에 주는 영향력을 비교하기 위해 회귀계수를 직접 비교하는 것은 위험 (회귀계수의 크기가 독립변수들의 측정단위에 크게 영향을 미치기 때문) 
  • 측정단위에 관계없는 회귀계수 필요
  • 표준화 변환 후 회귀 모형 추정시 이때의 회귀계수를 표준화 계수 혹은 베타계수 
  • 독립 변수들간에 관련성이 낮을경우 상대적인 중요도 
▣ 회귀계수
  • 공선성 통계량

독립변수들 간에 상관관계가 높으면 하나의 변수가 투입이 되며 나머지 변수들이 갖는 고유한 설명력은 매우 작아짐

VIF = 1/공차한계

공차한계<0.1 이거나 VIF>10 이면 공선성이 존재

  • 다중 공선성

설명변수 사이에 정확한 선형관계는 아니나 상관관계가 매우 높은 경우

상관관계가 클수록 회귀분산이 커지고, 분산이 커지면 회귀계수 추정량에 대한 t-통계량값이 작아져서 유의성이 낮게 나타남

해결책

설명변수의 제외

모형의 재설정

사전정보이용

표본자료의 추가 



▣ T,F,P 값의 의미


T-test = T, P

ANOVA = T, P

회귀분석 = F, T, P

교차분석 = X^2, P


위 그림을 보면, x축에 T,F 값이 존재한다. 그리고 그 값에 대한 오른쪽 면적이 P 값이 된다.



이렇게 나온 P값을 기준치인 0.05랑 항상 비교해서 해당 통계치가 유의한지 유의하지 않은지를 판단하게 된다.





3. 중회귀모형 또는 다중 회귀 모형




결정계수는 독립변수가 늘어나면, 무조건 증가 하게된다.

따라서 어떠한 독립변수가 중요한 역할을 하는지를 알기위해서 다른 참조 값을 필요로 한다. 이 때 이용하는 값이 수정된 결정계수이다.


▣ 수정된 결정계수

결정계수를 자유도로 수정시킨 계수

설명력이 거의없는 독립변수가 추가되면 감소 따라서 변수선택의 기준으로 이용



▣ 부분상관계수 (part correlation coeff.)

기존의 회귀모형에 어떤 독립변수를 추가할 것인가를 결정하고자 할 때 이용.


편 상관계수 ( partial correlation coeef.)

용도는 부분 상관계수와 비슷한 용도를 가진다.




▣ 변수 선택 방법

의의: 모형은 최대한 간소화 되어져야 한다. 따라서 설득력있는 독립변수들로만 모형을 구성하는 것은 중요하다.


(1) 모든 가능한 회귀: all possible regressions

-> 독립변수 K에 대한 모든 변수들에 대한 모든 모형들을 만들어보는것이다.

ex k=5, 일 경우에는 2^5 개의 모형이 생겨나게 된다. 이렇게 많은 모형들중 가장 적합한 회귀를 하게 된다.

단점은, 계산량이 엄청나게 많다. 실무에서는 거의 쓸수 없다.

SPSS의 경우는 제공하지 않는 기능이다.


(2) 전진

-> 등록된 변수를 통계적 기준에 따라 가장 중요한 변수부터 선택하여 더 이상 중요한 변수가 없다고 판단될 때 중단 (변수를 하나씩 추가해 가는 방법)

-> 일단 선택된 변수는 다른 변수에 의해 중요성이 상실되더라도 희귀모형에서 빠져 나올 수 없음


(3) 제거

-> 모형 설정 후 사용 가능

-> 모형에서 변수 제거


(4) 후진

-> 등록된 모든 독립변수를 포함하여 통계적 기준에 따라 중요도가 낮은 변수부터 한 변수씩 제거해나가는 방법 더 이상 제거시킬 필요가 없을 때 중단

-> 남아있는 변수들을 중요한 변수로 선택


(5)입력

-> 독립변수들의 강제 투입, 지정해준 변수 그대로 다 넣은 상태에서 모형 만듬


(6) 단계별 회귀: stepwise regression

-> 실무에서 적용하는 것이다.

일단, 가장 유효성이 높은 독립변수를 추가하고,

그다음 남은 독립 변수들중에서 또 하나를 추가한다.

그다음 유효성을 검사해서, 새로운 변수를 추가 했을때, 이전의 독립변수가 유효하지 않게 된다면, 그 독립변수를 제거하게 된다.


앞으로 부터의 선택과의 차이점은, 단계별 회귀방법은 일단 모델에 반영된 독립변수일 지라도, 유효성이 없어진다면, 제거가 가능하다는 점이다.




4. 회귀 모형의 진단







(a) 분산이 일정함을 나타냄

(b) 분산이 점점 커지므로, 동일 분산의 가정이 틀림

(c) 베타0와 같은 y 절편의 값의 증가를 필요로 함을 나타냄

(d) 선형 모델이 아닌 곡선 모형이 적합하는 것을 나타냄








'AI > Probability & Statistics (R)' 카테고리의 다른 글

비교 분석  (0) 2016.08.03
가설 검증과 추정  (0) 2016.08.03
이상치 제거 (Box-plot 해석을 통한)  (0) 2015.01.03
통계학: F-검정  (0) 2013.08.29
조건부 확률, Conditional Probability / joint probability  (2) 2013.05.17


EMMA for running android application.


▣ 사전지식

본 예제는, test project가 아닌, running application 스스로 EMMA로 instrument해서 coverage를 측정하게 된다.

coverage.em: 이것은 class file들에 대한 meta 정보를 담고 있다.

coverage.em file은 "ant instrument" command를 입력하면, code를 build하며 coverage.em 파일을 생성 하게 된다.



Step 0


GitHub에 있는 Diego의 project를 다운 받는다.

편의를 위해서 본 블로그에 파일을 첨부해 놓았다.

File 1: external library project


ViewServer-master.tar.gz


File 2: Testing App for getting Code Coverage running application with EMMA


TemperatureConverter-master.tar.gz


▣ 기본적으로 Diego의 Project에는 오류가 몇가지 있다.

1) "LocalViewServer" project에 대한 의존성이 있다.

해결 방법: 

GitHub: https://github.com/dtmilano/ViewServer 에서  ViewServer-master를 다운 받는다.

TemperatureConverter-master project의 project.properties를 아래와 같이 수정한다.


android.library.reference.1=../ViewServer-master


2) ViewServer-master에 SDK version이 빠져 있으므로 eclipse에서 추가 해준다.

3) ViewServer-master에 build.xml이 없어서 ant command를 수행 할 수 없다.

해결방법: # android update project -p .



Step 1


root@ubuntu:~/Android_Application_source/TemperatureConverter-master# ant clean

-- clean all class files


Step 2


root@ubuntu:~/Android_Application_source/TemperatureConverter-master# ant instrument install

-- coverage.em 파일이 생성 되어야 한다.


Step 3


This command will start the android application on the device and create coverage.ec file for us


root@ubuntu:~/Android_Application_source/TemperatureConverter-master# adb shell am instrument -e coverage true -w com.example.i2at.tc/com.example.instrumentation.EmmaInstrumentation


-- Block while user action


INSTRUMENTATION_CODE: -1


08-25 21:26:28.245: I/System.out(2102): EMMA: runtime coverage data written to [/mnt/sdcard/coverage.ec] {in 72 ms}


Step 4


/sdcard/coverage.ec 에 위치한것을 꺼내온다.


root@ubuntu:~/Android_Application_source/TemperatureConverter-master/bin# adb pull /sdcard/coverage.ec .
30 KB/s (1202 bytes in 0.038s)


Step 5


▣ 소스코드를 참고하지 않는 경우. // 소스코드를 보지 못함

root@ubuntu:~/Android_Application_source/TemperatureConverter-master/bin# java -cp ~/Android_Application_tools/android-sdk-linux/tools/lib/emma.jar emma report -r html -in coverage.em,coverage.ec


EMMA: processing input files ...
EMMA: 2 file(s) read and merged in 9 ms
EMMA: writing [html] report to [/root/Android_Application_source/TemperatureConverter-master/bin/coverage/index.html] ...


▣ 소스코드를 참고하는 경우. // 소스코드를 볼 수 있음 (방법 아직 모름, ant emma debug install test시 정상적으로 잘 보임)


this command will give html coverage reports, and we can also see the src code also in the html reports.
the -sp option is given for that reason only.
java -cp emma.jar emma report -r html -in coverage.ec -sp D:\xxxxxx\EMMA_Coverage\TemperatureConverter-master\src -in D:\xxxxxx\EMMA_Coverage\TemperatureConverter-master\bin\coverage.em



// 내용 확인

root@ubuntu:~/Android_Application_source/TemperatureConverter-master/bin/coverage# firefox index.html
failed to create drawable


Step 6



결과를 아래와 같이 볼 수 있다. 단, 아직 소스코드 보는 법은 잘 모르겠음.




reference links for both:
-------------------------

key link: http://dtmilano.blogspot.in/2011/11/obtaining-code-coverage-of-running.html


https://developers.google.com/web-toolkit/doc/latest/DevGuideTestingCoverage#command-line

http://primates.ximian.com/~flucifredi/emma-HOWTO.html

http://stackoverflow.com/questions/2762665/how-to-use-emma-code-coverage-in-android

https://groups.google.com/forum/#!topic/android-developers/Q8-KjKVmL4U

http://mebeingneo.wordpress.com/2011/05/19/emma-code-coverage-of-android-2/

※ 상기 사항

1) ADT 20r 버전 이상을 사용

2) Android Application Testing Guide에 나온 방법 처럼 AOSP로 할 경우 잘 안됨.

3) tools/ant/build.xml을 변경하는 것은 비 추천.



1. android tool을 이용해서 project 생성 및 update


 생성: application과 test 각각 1개씩 project를 생성

test project creation: android create test-project -m <main_path> -n <project_name> -p <test_path>


▣ 갱신: eclipse로 기존에 작성된 app과 test project가 있을 경우

app project: $ android update project -p [현재 위치] -n [project 이름]

test project: $ android update test-project -m [app project의 위치] -p [현재위치]



2. ant와 emma를 이용해서 실행


app project: $ ant emma debug install

test project: $ ant emma debug install test



3. 실행 결과 및 자료.


▣ ant emma debug install



 ▣ $ ant emma debug install test





▣ HelloWordTest Coverage Result



▣ TemperatrueConverterTest Coverage Result




관련 파일


HelloWord.zip


HelloWordTest.zip


TemperatureConverter.zip


TemperatureConverterTest.zip




▣ reference site list 


1) ant command[stackoverflow]: http://stackoverflow.com/questions/2762665/how-to-use-emma-code-coverage-in-android 

2) build.xml 수정 한글 블로그: http://codemuri.tistory.com/826 

3) GeekTaco [완벽한 외국 블로그]: http://geektaco.blogspot.kr/2012/07/code-coverage-with-android-and-emma.html

4) google site [android tool 관련]: http://developer.android.com/tools/projects/projects-cmdline.html

5) google site [ am instrumentation과 android test-project 생성 관련]: http://developer.android.com/tools/testing/testing_otheride.html


6) google site [ command line으로 빌드하는 방법]: http://developer.android.com/tools/building/building-cmdline.html

7) unrooted device에 대한 정보: http://stackoverflow.com/questions/8599097/emma-does-not-generate-coverage-ec



3. adb shell am instrument를 이용해서 emma 실행



가장 먼저 coverage.em 를 생성 해야한다. 이때 명령어를 ant instrument 를 해서 coverage를 생성 한다. 

1) app project에서 ant instrument 명령어를 실행해서 coverage.em 을 생성 한다.

root@ubuntu:~/Android_Application_source/HelloWord# ant instrument


Buildfile: /root/Android_Application_source/HelloWord/build.xml


-set-mode-check:

..
..
BUILD SUCCESSFUL
Total time: 1 second


2) app project에서 ant emma debug install 명령어를 실행해서 emma를 포함해서 디버그 모드로 해당 프로젝트를 Target smartphone에 설치를 한다.


위 작업을, app test project에 대해서도 동일하게 해준다. test 프로젝트도 target 스마트폰에 설치를 한다.


root@ubuntu:~/Android_Application_source/HelloWord# ant emma debug install

Buildfile: /root/Android_Application_source/HelloWord/build.xml

emma:

-set-mode-check:
..
..
install:
     [echo] Installing /root/Android_Application_source/HelloWord/bin/HelloWorld-debug.apk onto default emulator or device...
     [exec] 226 KB/s (13892 bytes in 0.059s)
     [exec]  pkg: /data/local/tmp/HelloWorld-debug.apk
     [exec] Success

BUILD SUCCESSFUL
Total time: 5 seconds

----------------------------------------------------------------------

root@ubuntu:~/Android_Application_source/HelloWordTest# ant emma debug install
Buildfile: /root/Android_Application_source/HelloWordTest/build.xml

emma:
..
..
install:
     [echo] Installing /root/Android_Application_source/HelloWord/bin/HelloWorld-instrumented.apk onto default emulator or device...
     [exec] 710 KB/s (166754 bytes in 0.229s)
     [exec] pkg: /data/local/tmp/HelloWorld-instrumented.apk
     [exec] Success

installi:

BUILD SUCCESSFUL
Total time: 12 seconds



3) 아래의 명령어를 실행 해준다.


adb shell am instrument -e coverage true -w com.eslab.test.test/android.test.InstrumentationTestRunner


여기서 com.eslab.test.test 는 테스팅 코드가 instrumentation 되어있는 테스트 프로제긑의 package 이름이다. 뒤의 android.test.InstrumentationTestRunner는 변경하지 말고 다른 test project를 사용할 때에도 그대로 사용해 준다.


root@ubuntu:~/Android_Application_source/HelloWordTest# adb shell am instrument -e coverage true -w com.eslab.test.test/android.test.InstrumentationTestRunner

com.eslab.test.test.HelloAndroidTest:..
Test results for InstrumentationTestRunner=..
Time: 0.786

OK (2 tests)


Generated code coverage data to /data/data/com.eslab.test/files/coverage.ec


// coverage.ec 에 대한 report 생성 위치는 app project의 설치 위치에 저장되어 진다. 

// test project가 아니다.




4) html 파일로 coverage 보고서를 생성해 준다. 이때 app project 위치에서 해야한다.

당연히, coverage.em 파일은 app project에 있는 것을 사용 해야한다. app test project가 아니라.


소스 코드를 참조해서 보고서를 생성하는 명령어: java -cp ~/Android_Application_tools/android-sdk-linux/tools/lib/emma.jar emma emma report -r html -in coverage.ec -sp ~/Android_Application_source/HelloWord/src/ -in coverage.em


소스코드를 참조하지 않고 보고서를 생성하는 명령어: java -cp ~/Android_Application_tools/android-sdk-linux/tools/lib/emma.jar emma report -r html -in coverage.em,coverage.ec


root@ubuntu:~/Android_Application_source/HelloWord/bin# adb pull /data/data/com.eslab.test/files/coverage.ec .

adb server is out of date.  killing...

* daemon started successfully *

2 KB/s (98 bytes in 0.038s)


--------------------------------------------------------------------------------


root@ubuntu:~/Android_Application_source/HelloWord/bin# ls

AndroidManifest.xml               HelloWorld-instrumented-unaligned.apk    build.prop     coverage.ec

AndroidManifest.xml.d             HelloWorld-instrumented-unaligned.apk.d  classes        coverage.em

HelloWorld-debug-unaligned.apk    HelloWorld-instrumented.apk              classes.dex    jarlist.cache

HelloWorld-debug-unaligned.apk.d  HelloWorld.ap_                           classes.dex.d  proguard.txt

HelloWorld-debug.apk              HelloWorld.ap_.d                         coverage       res





root@ubuntu:~/Android_Application_source/HelloWord/bin#  java -cp ~/Android_Application_tools/android-sdk-linux/tools/lib/emma.jar emma report -r html -in coverage.em,coverage.ec

EMMA: processing input files ...

EMMA: 2 file(s) read and merged in 6 ms

EMMA: writing [html] report to [/root/Android_Application_source/HelloWord/bin/coverage/index.html] ...


root@ubuntu:~/Android_Application_source/HelloWord/bin# ls

AndroidManifest.xml               HelloWorld-instrumented-unaligned.apk    build.prop     coverage.ec

AndroidManifest.xml.d             HelloWorld-instrumented-unaligned.apk.d  classes        coverage.em

HelloWorld-debug-unaligned.apk    HelloWorld-instrumented.apk              classes.dex    jarlist.cache

HelloWorld-debug-unaligned.apk.d  HelloWorld.ap_                           classes.dex.d  proguard.txt

HelloWorld-debug.apk              HelloWorld.ap_.d                         coverage       res





결과: ant emma debug install test 보다 좀 더 많은 testing 요소들을 검사한다.








EMMA


1) ant 환경만 지원, build.xml 이 필요.

2) am instrument의 option으로 EMMA를 실행 가능.

3) running android application의 code coverage를 얻기 위해서는 android instrumentation framework를 반드시 이용 해야한다. 얻고자 하는 기등을 안에다가 넣던가, 아니면 code coverage를 수집하는 코드를 저 안에다가 구현 해야 한다.



java -cp ~/Android_Platform/aosp-2.3.3_nexus_one/external/emma/lib/emma.jar emma report -r html -in coverage.ec -sp ~/Android_Application_source/HelloWord/src/ -in coverage.em



Command line으로 Project를 생성 하는 방법.


1) Creating an Android Project

android project를 생성 하기위해서 android tool을 사용하게 된다. 

이것을 사용하면 project directory를 생성하며 몇몇 default application file들과 stub, configuration file, build file을 생성 하게 된다.


android create project

--target or -t <target_ID>

--name or -n <your_project_name>

--path or -p <path/to/your/project>

--activity -a <your_activity_name>

--package -p <your_package_namesapce>





1. Android Application Testing Guide 방법


우선 테스트 대상이 되는 프로그램인 2가지를 구성한다.


TemperatureConverter

TemperatureConverterTest


1) AOSP 컴파일


AOSP를 준비해야한다.


명렁어순서

. build/envsetup.sh

lunch -> generic-eng 선택


export EMMA_INSTRUMENT=true


make -j[작업 수]



2) AOSP에 Built-In App으로 우리의 테스팅 App을집어 넣는다.


테스팅 App의 심볼릭 링크로 만들어서 Android 아래의 디렉터리에 프로젝트 2개를 추가한다.


development/samples/ 

ln -s ~/Android_Application_source/TemperatureConverter .

ln -s ~/Android_Application_source/TemperatureConverterTest .


각 프로젝트 디렉터리에 Android Build System에 들어가 지도록 Android.mk 파일을 추가한다.


일단 samples에존재하는 아무 App이다. 꺼내온 다음. 


LOCAL_PACKAGE_NAME := TemperatureConverter 


로 변경 한다.


컴파일

development/samples/TemperatureConverter $ EMMA_INSTRUMENT=true mm


TemperatureConverterTest의 프로젝트도 동일한 작업 수행.


심볼릭 링크 or File copy

Android.mk 생성

컴파일



3) 코드 커버리지 분석 보고서 생성


컴파일의 결과가는, out/target/common/obj/APPS 디렉터리에 나와있다.

Coverage 측정을 위한 Emulator는 out/host/linux-86/bin/emulator 


Emulator 실행 명령어

$ mksdcard sdcard.img // sdcard 이미지 생성

$ out/host/linux-86/bin/emulator -sdcard sdcard.img -partition-size 256 // emulator 실행

$ adb remount // sdcard에 쓰기권한 설정

development/samples/TemperatureConverterTest$ adb Sync // 변경 사항 동기화


$adb shell am instrument -e coverage 'true' =w com.example.aatg.tc.test/android.test.InstrumentationTestRunner



저장을 위해서 mksdcard 명령어를 이용해서 sdcard.img를 생성해 준다.



에뮬레이터 실행에서 막힘 중단. 


-----------------------------



우선 Ant를 설치한다. 아래의 Web 주소를 참고 한다.

Apache Ant home page: http://ant.apache.org/


▣ Ant Command Reference

ant clean

Cleans the project. If you include the all target before clean (ant all clean), other projects are also cleaned. For instance if you clean a test project, the tested project is also cleaned.

테스팅 대상 프로젝트와 테스트 프로젝트 모두 클린 된다.


ant debug

Builds a debug package. Works on application, library, and test projects and compiles dependencies as needed.

debug package로 모든, 필요한 것들을 컴파일 한다.


ant emma debug

Builds a test project while building the tested project with instrumentation turned on. This is used to run tests with code coverage enabled.

테스팅 되어지는 프로젝트를 instrumentation을 켠상태로 빌드한다. 이것은 테스트 과정에서 code coverage를 측정 할 수 있다.


ant release

Builds a release package.


ant instrument

Builds an instrumented debug package. This is generally called automatically when building a test project with code coverage enabled (with the emma target)

이것은 emma라는 키워드를 사용할때 자동적으로 불리워지는 내용이다. 즉, ant emma를 할시 동일하게 적용되는 내용이다. debug pacakge에 instrumented code를 삽입하는 과정을 취한다.


ant <build_target> install

Builds and installs a package. Using install by itself fails.


ant installd

Installs an already compiled debug package. This fails if the .apk is not already built.


ant installr

Installs an already compiled release package. This fails if the .apk is not already built.


ant installt

Installs an already compiled test package. Also installs the .apk of the tested application. This fails if the .apk is not already built.


ant installi

Installs an already compiled instrumented package. This is generally not used manually as it's called when installing a test package. This fails if the .apk is not already built.


ant test

Runs the tests (for test projects). The tested and test .apk files must be previously installed.


ant debug installt test

Builds a test project and the tested project, installs both .apk files, and runs the tests.


ant emma debug install test

Builds a test project and the tested project, installs both .apk files, and runs the tests with code coverage enabled.


▣ am instrument option reference


am instrument의 일반적인 사용법


am instrument [flags] <COMPONENT>

-r: 결과를 모두 출력한다. 선능 측정을 위한 자료 수집에 유용하다.

-e <NAME> <VALUE>: Name을 Value로 설정 한다. 일반적으로 인자 <name,value> 쌍이다.

-p <FILE> 측정 데이터를 외부 파일에 저장한다.

-w 종료하기 전에 측정 기능이 끝나기를 기다린다. 보통 이 옵션을 쓰지 않으면 테스트 결과를 볼 수 없으므로 필수는 아니지만 꽤 유용하다.





부정관사의 용법


1. 대상 사물이 그 논문에 처음 등장 했을때.


In a previous report, the authors pointed out that ~

An experimental study was performed on ~


2. 저자가 임의로 결정한 사항

A distance of 7.3 cm was maintained between the poles.

a,an + 명사 + of + 숫자


3. 'one'을 뜻하는 경우

The measurements were made at a single institution.

여기서 single은 부정관사 a를 강조한다.


4. 배분단수 (distributive singular): 배분적인 뜻을 갖는다.


'영어 > 영문법' 카테고리의 다른 글

수동태의 행위자 생략  (0) 2013.12.07
The amount of + 불가사명사, The number of + 복수 명사  (0) 2013.11.26
which와 , which (콤마 which)의 차이점.  (4) 2013.08.18
Anyone과 Someone의 차이점.  (0) 2013.08.18
가주어  (0) 2013.08.17


which와 ,which의 해석 차이.


He sold the old books which were in the basement.

그는 팔았다 / 오래된 책들을 / 지하실에 있는

-> 그는 지하실에 있던 (모든) 오래된 책들을 팔았다. (다른 곳에 오래된 책들이 있을 수도 있다는 뜻을 의미)

which가 단지 old book을 부연 설명 하기 때문에 지하실에 있던 오래된 책들로 해석이되어서 의미가 제한적이며 한정적이 된다.


He sold the old books, which were in the basement.

그는 팔았다. 오래된(모든) 책들을, 그것들은 지하실에 있었다.

-> 그는 모든 오래된 책들을 팔았다. 그것들은 지하실에 있었다. ( 이제 다른 곳에 오래된 책들은 없다.)

He sold the old books으로 일단 한문장이 끝나는 것이다.

그다음에 which는 앞의 문장 전체를 부연설명하게 된다. 따라서 비제한적이며 비한정적인 의미를 가지게 된다.


'영어 > 영문법' 카테고리의 다른 글

The amount of + 불가사명사, The number of + 복수 명사  (0) 2013.11.26
부정관사와 정관사의 사용 방법.  (0) 2013.08.18
Anyone과 Someone의 차이점.  (0) 2013.08.18
가주어  (0) 2013.08.17
사역동사  (0) 2013.08.16


Anyone (anybody)는 '아무나, 누구나' 입니다.


예문)

Is there anyone in the conference room? 아무도 없어요?

Does anyone else want to come? 더 올사람 없어?

Has anyone called? 나한테 전화온거 없었어?


Anyone can see ~ ' 아무나, 누구나 볼 수 있다'

She was not anyone before she got that job 그녀는 아무나가 아니다. ( i.e., 특별한 여자라는 의미)

Anyone could be doing what I am doing. 내가 하는 일은 누구든지 할 수 있다.



Someone(Somebody)는 '어떤 사람' 입니다. i.e., a person을 의미 합니다.


예문)

There is someone at the doctor. 누군가 있다.

It is time for someone new to take over. 새로운 누군가가 아어받을때이다. 

If somebody asks me how my diet is going, I say 'fine' 누군가 나에게 'diet' 잘되가는지 묻는다면, 나는 'fine'이라고 답할거야.

'영어 > 영문법' 카테고리의 다른 글

부정관사와 정관사의 사용 방법.  (0) 2013.08.18
which와 , which (콤마 which)의 차이점.  (4) 2013.08.18
가주어  (0) 2013.08.17
사역동사  (0) 2013.08.16
분사구문 만드는법을 정리하면.  (0) 2013.04.06

가짜주어 there은 흔히 유도부사라고 한다.

즉, there is 또는 there are의 경우 ~가 있다. 라는 의미로 쓰이게 된다.

당연히, 수일치 또한 가짜주어기 때문에 뒤에 나오는 명사에 맞추어서 해주면 된다.


1) 가짜주어 there과 it 구문


가짜 주어 there은 '가 ~있다'를 뜻하며, 'there+동사(be, remain, exist ...) + 진짜 주어(명사)' 형태를 이룬다.

There has been controversy over cloning organisms for years. 생명체를 복제하는 것에 대한 논쟁이 수년간 있어 왔다.


There remains enough space for the sofa in my room. 내 방에는 그 소파를 놓을 충분한 공간이 남아 있다.



수일치 예문)

There are puppies in that house. 저 집에 강아지들이 있어.

There is an apple on the desk. 책상 위에 사과 하나 있어.



'영어 > 영문법' 카테고리의 다른 글

부정관사와 정관사의 사용 방법.  (0) 2013.08.18
which와 , which (콤마 which)의 차이점.  (4) 2013.08.18
Anyone과 Someone의 차이점.  (0) 2013.08.18
사역동사  (0) 2013.08.16
분사구문 만드는법을 정리하면.  (0) 2013.04.06

+ Recent posts