달력

4

« 2024/4 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
2018. 6. 20. 09:28

호이안 밥집 리스트 Enjoy/etc2018. 6. 20. 09:28

호이안



포슈아

오전 10 ~ 오후 9

길찾기

반세오 분짜, 깨끗



미쓰리 (Miss Ly Cafe 22)

오전 11 ~ 22시 브레이크 15-17

길찾기

프라이드완탄, 새우볶음밥, 깨끗



모닝글로리

길찾기

분짜 등등. 에어컨자리 요청, 깨끗



포비엣46

오전10 ~ 오후 10

길찾기

쌀국수, 한국인많음 에어컨 깨끗, 아기의자



반미프엉

오전 6.5 ~ 오후 9.5

길찾기

반미, 소고기 질김, 돼지 비계많고, 꼭 닭으로...



비스마켓 (vy's market)

오전 8 ~ 오후 10, 브레이크 오후3~5

길찾기

넓고 깨끗한편, 반쎄오 등등



라이스 드럼

오전 8 ~ 오후 11

길찾기

완탕튀김... 2층 뷰 좋음, 깨끗



블루드래곤

오전 8 ~ 오후 10

길찾기

쌀국수 스프링롤



베일웰 (베일우물)

오전 10 ~ 오후 10

길찾기

라이스페이퍼 반쎄오



cong 분짜

오전 10.5 ~ 오후 9.5

길찾기

분짜



홈호이안 

오후 1 ~ 오후 11

길찾기

두부요리, 에어컨 깨끗.



피반미

오전 8 ~ 오후 8

길찾기

반미



콩카폐

오전 7 ~ 오후 11.5

길찾기

코코넛커피



에스프레소 스테이션

오전7.5 ~ 오후 5

길찾기

코코넛커피






:
Posted by 라면스프
2016. 5. 20. 16:30

Visual Basic 6 명령줄에서 빌드하기 Enjoy/etc2016. 5. 20. 16:30


Visual Basic 6 컴파일 하기!!!!!

비주얼베이직6  외부에서 컴파일 할때 사용하기.

CMD 창에서 실행할때 사용되는 명령어 확인

까먹지말고 정리정리!!!



참고사이트 : https://msdn.microsoft.com/en-us/library/aa231236(v=vs.60).aspx



=============================================================================


[컴파일 명령어 및 옵션]


도움말보기




vb6.exe [[{/run | /r}] | [/runexit] | [{/make | /m}] 프로젝트이름] [/out 로그파일명] [/outdir 로그파일경로] [/d 상수=값{[:constN=valueN]}][/mdi | /sdi][{/cmd 인수 | /c 인수}]


[옵션]


/run 또는 /r 프로젝트

:[프로젝트 속성] 대화상자의 [만들기] 탭의 [명령줄 인수] 필드에 저장된 인수를 사용하여, VisualBasic이 프로젝트 이름을 컴파일하고 실행합니다.


/runexit 프로젝트이름

:VisualBasic이 프로젝트 이름을 컴파일하고 실행합니다. 프로젝트가 디자인모드로 되돌아 오면 VisualBasic이 종료됩니다.


/make 또는 /m 프로젝트

:프로젝트 파일 안에 저장된 기존 설정을 사용하여, VisualBasic이 프로젝트 이름을 컴파일하고 실행 가능한 파일을 만듭니다.


/out 파일이름

:/m 또는 /runexit로 만들 때 오류를 파일로 받아들일 수 있게 지정합니다. /out을 사용하지 않으면 오류가 메시지 상자에 표시됩니다.


/outdir 경로

:/make를 사용할 때 만들어지는 모든 출력파일이 놓여질 디렉토리경로를 지정합니다.


/d 또는 /D 상수=값...

:VisualBasic이 /make로 EXE나 ActiveX 구성 요소를 만들 때 조건부 컴파일 상수로 사용할 값을 지정합니다. 상수가 여러 개일 때는 콜론으로 구분하십시오.


/cmd 또는 /c 인수

:[프로젝트 속성] 대화 상자의 [만들기] 탭의 [명령줄 인수]필드에 인수를 지정합니다. 이 때 이 옵션은 명령줄 맨끝에 위치해야 합니다.


/mdi 또는 /sdi

:VisualBasic 환경을 단일 문서 인터페이스(SDI)나 다중 문서 인터페이스(MDI)로 전환합니다. 이 설정을 바꾸기 전까지는 현재의 모드를 유지합니다.


* 위의 스위치에서 프로젝트 이름 위치에 그룹 이름을 사용할 수 있습니다.



EX) TEST.vbp 프로젝트를 make 하는 명령어. out 메시지는 test_out.log 로 출력할 때


     "C:\Program Files (x86)\Microsoft Visual Studio\VB98\vb6.exe" /make "D:\VBProject\TEST\TEST.vbp" /out "D:\VBProject\TEST\outlog\test_out.log"

     



=============================================================================




Working with Command Line Switches


Command line switches provide a way to control how Visual Basic executes. Using command line switches, you can start an instance of Visual Basic and run a specified project, make an executable file or dynamic-link library, or specify a string to be passed to the Command$ function.

For example, to run the project MyProj.vbp and then automatically exit, start Visual Basic with the following command line:


c:\Program Files\Microsoft Visual Studio\VB\vb6.exe /runexit MyProj.vbp


The following table summarizes the Visual Basic command line switches.


Switch Description


/cmd cmdstring Specifies a command string to be passed to the Command$ function. When used, it must be the last switch on the command line.

/d compileconst Specifies one or more conditional compilation constants to use with the /make or /makedll switch.

/make projectname Makes the specified project into an executable file.

/makedll projectname Makes the specified project into a dynamic-link library.

/mdi Starts Visual Basic using the multiple document interface (MDI) programming environment.

/out filename Outputs errors to a file when used with the /make or /makedll switch.

/run projectname Runs the specified project.

/runexit projectname Runs the specified project and then automatically exits.

/sdi Starts Visual Basic using the single document interface (SDI) programming environment.

/? Displays a list of valid command line switches.


For More Information   See "Command Line Arguments."




:
Posted by 라면스프
2016. 3. 28. 16:25

레이븐 길드 계산기 It's Me2016. 3. 28. 16:25

레이븐   [태양] 길드  라면스프


어플 설치 없이 계산



:
Posted by 라면스프
2015. 11. 5. 15:09

Convert JSON string to Map – Jackson Enjoy/JSP2015. 11. 5. 15:09

출처 : http://www.mkyong.com/java/how-to-convert-java-map-to-from-json-jackson/


In this tutorial, we will show you few Jackson examples to convert JSON string to/from a Map.

P.S All examples are tested with Jackson 2.6.3

1. JSON string to Map

JsonMapExample.java
package com.mkyong.json;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;

public class JsonMapExample {

	public static void main(String[] args) {

		try {

			ObjectMapper mapper = new ObjectMapper();
			String json = "{\"name\":\"mkyong\", \"age\":29}";

			Map<String, Object> map = new HashMap<String, Object>();

			// convert JSON string to Map
			map = mapper.readValue(json, new TypeReference<Map<String, String>>(){});

			System.out.println(map);

		} catch (JsonGenerationException e) {
			e.printStackTrace();
		} catch (JsonMappingException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}

Output

{name=mkyong, age=29}

2. Map to JSON string

Example to convert the Map to JSON string.

MapJsonExample.java
package com.mkyong.json;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;

public class MapJsonExample{

	public static void main(String[] args) {

		try {

			ObjectMapper mapper = new ObjectMapper();
			String json = "";

			Map<String, Object> map = new HashMap<String, Object>();
			map.put("name", "mkyong");
			map.put("age", 29);

			// convert map to JSON string
			json = mapper.writeValueAsString(map);

			System.out.println(json);

			json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(map);

			// pretty print
			System.out.println(json);

		} catch (JsonGenerationException e) {
			e.printStackTrace();
		} catch (JsonMappingException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}

Output

{"name":"mkyong","age":29}
{
  "name" : "mkyong",
  "age" : 29
}

3. Map to JSON File

JsonMapFileExample.java
package com.mkyong.json;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;

public class JsonMapFileExample {

	public static void main(String[] args) {

		try {

			ObjectMapper mapper = new ObjectMapper();

			Map<String, Object> map = new HashMap<String, Object>();
			map.put("name", "mkyong");
			map.put("age", 29);

			List<Object> list = new ArrayList<>();
			list.add("msg 1");
			list.add("msg 2");
			list.add("msg 3");

			map.put("messages", list);

			// write JSON to a file
			mapper.writeValue(new File("c:\\user.json"), map);

		} catch (JsonGenerationException e) {
			e.printStackTrace();
		} catch (JsonMappingException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
c:\\user.json
{"name":"mkyong","messages":["msg 1","msg 2","msg 3"],"age":29}

4. JSON file to Map

JsonFileMapExample.java
package com.mkyong.json;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Map;

import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;

public class Jackson2Example {

	public static void main(String[] args) {

		try {

			ObjectMapper mapper = new ObjectMapper();

			// read JSON from a file
			Map<String, Object> map = mapper.readValue(
					new File("c:\\user.json"), 
					new TypeReference<Map<String, Object>>() {
			});

			System.out.println(map.get("name"));
			System.out.println(map.get("age"));

			@SuppressWarnings("unchecked")
			ArrayList<String> list = (ArrayList<String>) map.get("messages");

			for (String msg : list) {
				System.out.println(msg);
			}

		} catch (JsonGenerationException e) {
			e.printStackTrace();
		} catch (JsonMappingException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}

Output

mkyong
29
msg 1
msg 2
msg 3

References

  1. Wikipedia : JSON
  2. Jackson – High-performance JSON processor
  3. Jackson 2 – Object to / from JSON


:
Posted by 라면스프
2015. 11. 5. 14:28

ObjectMapper (FasterXML/jackson) Enjoy/JSP2015. 11. 5. 14:28

출처 : http://noritersand.tistory.com/240


라이브러리 다운로드

http://wiki.fasterxml.com/JacksonDownload


 jackson-annotations-2.2.3.jar

 jackson-core-2.2.3.jar

 jackson-databind-2.2.3.jar


Map - JSON 변환



writeValueAsString( value )

  • value: String 타입으로 변환할 대상


readValue( arg, type )

  • arg: 지정된 타입으로 변환할 대상
  • type: 대상을 어떤 타입으로 변환할것인지 클래스를 명시한다. Class객체, TypeReference객체가 올 수 있다.

ex)

mapper.readValue(arg, ArrayList.class);

mapper.readValue(argnew ArrayList<HashMap<String, String>>().getClass());

mapper.readValue(arg, new TypeReference<ArrayList<HashMap<String, String>>>(){});


● Map

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import com.fasterxml.jackson.databind.ObjectMapper;
 
public class Test2 {
    public static void main(String[] args) throws Exception {
 
        ObjectMapper mapper = new ObjectMapper();
 
        HashMap<StringString> map = new HashMap<StringString>();
        map.put("name""steave");
        map.put("age""32");
        map.put("job""baker");
 
        System.out.println(map);
        System.out.println(mapper.writeValueAsString(map));
    }
}
 
// {age=32, name=steave, job=baker}
// {"age":"32","name":"steave","job":"baker"}
cs

맵 타입이 JSON 형식의 String 타입으로 변환된다. 자바스크립트에 JSON을 넘겨줄 때 유용하다. 


이와 반대로 JSON을 맵 타입으로 변환하려면 다음처럼 작성한다:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
 
public class Test2 {
    public static void main(String[] args) throws Exception {
 
        ObjectMapper mapper = new ObjectMapper();
        HashMap<StringString> map = new HashMap<StringString>();
 
        String jsn = "{\"age\":\"32\",\"name\":\"steave\",\"job\":\"baker\"}";
        
        map = mapper.readValue(jsn, 
                new TypeReference<HashMap<StringString>>() {});        
        
        System.out.println(map);
    }
}
 
// {name=steave, age=32, job=baker}
cs


● List<Map>

다음은 view에 전달할 model이 List<map<?, ?>> 타입일 때 이를 JSON으로 변환하는 방법이다.

사용방법은 크게 다르지 않고 writeValueAsString, readValue 메서드를 사용하되 타입 명시만 달리한다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
 
public class Test2 {
    public static void main(String[] args) throws Exception {
 
        ObjectMapper mapper = new ObjectMapper();
 
        // map -> json
        ArrayList<HashMap<StringString>> list 
                = new ArrayList<HashMap<String,String>>(); 
        
        HashMap<StringString> map = new HashMap<StringString>();
        map.put("name""steave");
        map.put("age""32");
        map.put("job""baker");
        list.add(map);
        
        map = new HashMap<StringString>();
        map.put("name""matt");
        map.put("age""25");
        map.put("job""soldier");
        list.add(map);
        
        System.out.println(mapper.writeValueAsString(list));
 
        
        // json -> map
        String jsn = "[{\"age\":\"32\",\"name\":\"steave\",\"job\":\"baker\"},"
                + "{\"age\":\"25\",\"name\":\"matt\",\"job\":\"soldier\"}]";
        list = mapper.readValue(jsn, 
                new TypeReference<ArrayList<HashMap<StringString>>>() {});        
        
        System.out.println(list);
    }
}
 
 
// [{"age":"32","name":"steave","job":"baker"},{"age":"25","name":"matt","job":"soldier"}]
// [{name=steave, age=32, job=baker}, {name=matt, age=25, job=soldier}]
cs






:
Posted by 라면스프
2015. 3. 2. 23:32

그리드 헤더 체크박스 Enjoy/FLEX2015. 3. 2. 23:32

3 state checkbox for headerrenderer in datagrid




출처 : https://srinichekuri.wordpress.com/2011/05/20/3-state-checkbox-for-headerrenderer-in-datagrid/


Today I made by first contribution to Adobe Cook by posting about this topic. The idea on this topic started by showing my earlier post on gmail header to my colleague who also happens to be the owner of post in adobe cookbook that talks about 3State checkbox for TreeRenderer. He pointed out that the checkbox in the header can be threeState. Well thats a common problem but suprisingly this was not addressed in the online opensource community for Datagrid. I saw an opportunity and coded it.

Note:
There is a bug in my colleague’s post that it doesn’t take care of the initial state, I have taken care of that bug in my code.My code itself is inspired by my colleagues post.

The checkbox in headerRenderer will have three states:

  • All the rows in the datagrid are selected (‘select’ State).
  • None of the rows in the datagrid are selected(‘unselected’ State)
  • One or more rows (but not all) are selected(‘undecided’ State).

ScreenShots:
Change of state from ‘unselect’ state to ‘select’ state:

Change of state from ‘select’ state to ‘undecided’ state:

Code:

Here is the code for Main.mxml:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                xmlns:s="library://ns.adobe.com/flex/spark"
                xmlns:mx="library://ns.adobe.com/flex/mx"
                creationComplete="creationCompleteHandler(event)">
 
    <fx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;
            import mx.controls.Alert;
            import mx.events.FlexEvent;
 
            private var _dataProvider:ArrayCollection;
            [Bindable]
            public function set dataProvider(value:Object):void{
                _dataProvider=value as ArrayCollection
            }
            public function get dataProvider():Object{
                return _dataProvider;
            }
 
            protected function creationCompleteHandler(event:FlexEvent):void
            {
                dataProvider = new ArrayCollection([
                    {checked:true, name:'Jim Smith'},
                    {checked:false, name:'Yancy Williams'}]);
            }
 
        ]]>
    </fx:Script>
 
    <mx:DataGrid id="myDataGrid" left="10" top="10" dataProvider="@{dataProvider}">
        <mx:columns>
            <mx:DataGridColumn textAlign="center" dataField="checked"
                                       width="90"
                                       rendererIsEditor="true"
                                       sortable="false"
                                       itemRenderer="renderer.CheckboxItemRenderer"
                                       headerRenderer="renderer.ThreeStateCheckBoxHeaderRenderer"
                                       />
            <mx:DataGridColumn headerText="Name" dataField="name" width="110"/>
        </mx:columns>
    </mx:DataGrid>
 
</s:Application>

Code for headerRenderer

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
package renderer
{
    import flash.events.MouseEvent;
 
    import mx.collections.ArrayCollection;
    import mx.controls.DataGrid;
    import mx.controls.Image;
    import mx.controls.dataGridClasses.DataGridListData;
    import mx.controls.dataGridClasses.MXDataGridItemRenderer;
 
    import spark.components.CheckBox;
 
    /**
     * HeaderRender with a Three State Checkbox.
     * <p>Functionality:<br>
     *    <li>Selecting the checkbox will select all the rows in the datagrid</li>
     *    <li>Unselecting the checkbox will unselect all the rows in the datagrid</li>
     *
     * <p>The checkbox can be three states at any point:<br>
     *    <li>select: This would mean that all the rows are selected</li>
     *    <li>unselect: This would mean that none of the rows are selected</li>
     *    <li>undecided: This would mean that one or more (but not all) of the rows are selected</li>
     *
     * @author Srinivas Chekuri
     *
     */
    public class ThreeStateCheckBoxHeaderRenderer extends MXDataGridItemRenderer
    {
        protected var myCheckBox:CheckBox;
        protected var myImage:Image;
        private var imageWidth:Number   = 9.5;
        private var imageHeight:Number  = 9.5;
        private var inner:String    = "assets/inner.png";
 
        private const SELECT_STATE:String="select";
        private const UNSELECT_STATE:String="unselect";
        private const UNDECIDED_STATE:String="undecided";
 
        private var STATE:String = UNSELECT_STATE;
 
        /**
         * Constuctor
         *
         */
        public function ThreeStateCheckBoxHeaderRenderer()
        {
            super();
        }
 
        /**
         * overides the function <code>createChildren</code> in the component lifecyle. This instantiates
         * <code>myCheckBox</code> and <code>myImage</code>.
         *
         */
        override protected function createChildren():void{
            super.createChildren();
            myCheckBox = new CheckBox();
            myCheckBox.setStyle("horizontalCenter", "0");
            myCheckBox.setStyle("verticalCenter", "0");
            myCheckBox.addEventListener( MouseEvent.CLICK, checkBoxClickHandler );
            addElement(myCheckBox);
            myImage = new Image();
            myImage.source = inner;
            myImage.addEventListener( MouseEvent.CLICK, imageClickHandler );
            myImage.visible=false;
            addElement(myImage);
        }
 
        /**
         * overides the function <code>updateDisplayList</code> in the component lifecyle. This sets the
         * display settings of <code>myCheckBox</code> and <code>myImage</code>. This also updates the state
         * according to the selections made in the datagrid.
         *
         * @param unscaledWidth
         * @param unscaledHeight
         *
         */
        override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{
            super.updateDisplayList(unscaledWidth,unscaledHeight);
 
            myImage.x=myCheckBox.x+1.5;
            myImage.y=myCheckBox.y+5.5;
 
            myImage.width=imageWidth;
            myImage.height=imageHeight;
 
            if(areAllSelected()){
                STATE=SELECT_STATE;
            }else if(isAnyColumnSelected()){
                STATE=UNDECIDED_STATE;
            }else if(!isAnyColumnSelected()){
                STATE=UNSELECT_STATE;
            }
            checkState();
        }
 
        /**
         * Makes adjustments to the <code>visible</code> property of <code>myImage</code> and
         * <code>selected</code> of <code>myCheckBox</code> according to the state.
         *
         * @private
         *
         */
        private function checkState():void{
            if(STATE==SELECT_STATE){
                myImage.visible=false;
                myCheckBox.selected=true;
            }else if(STATE==UNSELECT_STATE){
                myImage.visible=false;
                myCheckBox.selected=false;
            }else{
                myImage.visible=true;
                myCheckBox.selected=false;
            }
        }
 
        /**
         * Handler method for <code>MouseEvent.CLICK</code> event on <code>myImage</code>.
         *
         * @param event
         *
         */
        protected function imageClickHandler(event:MouseEvent):void{
            STATE=SELECT_STATE;
            checkState();
            selectAll();
        }
 
        /**
         * Handler method for <code>MouseEvent.CLICK</code> event on <code>myCheckBox</code>.
         *
         * @param event
         *
         */
        protected function checkBoxClickHandler(event:MouseEvent):void{
            selectAll();
        }
 
        /**
         * Selects all the rows in the datagrid.
         *
         */
        private function selectAll():void{
            var ac:ArrayCollection = DataGrid(DataGridListData(listData).owner).dataProvider as ArrayCollection;
            for each (var o:Object in ac){
                o.checked=myCheckBox.selected;
            }
            DataGrid(DataGridListData(listData).owner).dataProvider = ac;
        }
 
        /**
         * Checks if all the rows are selected in the datagrid.
         *
         * @return Boolean: returns <code>true</code> if all rows are selected else returns
         * <code>false</code>.
         *
         */
        private function areAllSelected():Boolean{
            var ac:ArrayCollection = DataGrid(DataGridListData(listData).owner).dataProvider as ArrayCollection;
            var b:Boolean=true;
            for each (var o:Object in ac){
                if(!o.checked){
                    b=false;
                    break;
                }
            }
            return b;
        }
 
        /**
         * Checks to see if any one of the rows are selected.
         *
         * @return Boolean: return <code>true</code> if any one the rows are selected.
         *
         */
        private function isAnyColumnSelected():Boolean{
            var ac:ArrayCollection = DataGrid(DataGridListData(listData).owner).dataProvider as ArrayCollection;
            var b:Boolean=false;
            for each (var o:Object in ac){
                if(o.checked){
                    b=true;
                    break;
                }
            }
            return b;
        }
    }
}

Code for itemRenderer:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!--?xml version="1.0" encoding="utf-8"?-->
 
        <![CDATA[
            import mx.collections.ArrayCollection;
            import mx.controls.DataGrid;
            import mx.controls.dataGridClasses.DataGridListData;
            import mx.events.FlexEvent;
 
            /**
             * Handler function for <code>MouseEvent.CLICK</code> on checkbox.
             *
             * @param event MouseEvent
             *
             */
            public function clickHandler(event:MouseEvent):void{
                var o:Object = DataGrid(DataGridListData(listData).owner).selectedItem;
                o.checked=cb.selected;
                ArrayCollection(DataGrid(DataGridListData(listData).owner).dataProvider).setItemAt(o,DataGrid(DataGridListData(listData).owner).selectedIndex);
            }
 
            /**
             * Overides <code>data</code> parameter to set the <code>selected</code> parameter of the
             * checkbox.
             *
             * @param value Object
             */
            override public function set data(value:Object):void{
                if(value!=null){
                    super.data=value;
                    cb.selected=value.checked;
                }
            }
        ]]>

You can download the code from my post in Adobe cook book.

:
Posted by 라면스프
2013. 11. 22. 15:26

[펌][BlazeDS] 메세징을 위한 폴링과 설정 Enjoy/FLEX2013. 11. 22. 15:26

원문출처 : http://jjaeko.tistory.com/115



[BlazeDS] 메세징을 위한 폴링과 설정



BlazeDS 에서는 rtmp 채널을 지원하지 않기 때문에, 디폴트로 폴링 방식으로 메세징을 지원 합니다.
이런 사실 때문에, real-time messaging을 지원하지 않을거라는 착각을 할 수 있는데 다양한 테크닉으로 real-time messaging을 구현할 수 있습니다. 하지만 앞으로 소개될 테크닉들은 http-based 이기 때문에 독자적인 socket을 사용하는 lcds에 비해 속도와 동시접속에 있어서 뒤쳐질 수 밖에 없습니다.


Simple Polling




이 방식은 real-time의 효과를 볼 수 없는 기본적인 polling 입니다. 일정한 간격으로 요청(poll)하고 응답(ack) 받습니다. 만약 요청 했을 때, 다른 client로 부터 메세지가 들어와 있지 않다면 비어 있는 응답을 받습니다.

설정 방법은 다음과 같습니다.

<channel-definition id="polling-amf" class="mx.messaging.channels.AMFChannel">
    <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amfpolling" class="flex.messaging.endpoints.AMFEndpoint"/>
    <properties>
        <polling-enabled>true</polling-enabled>
        <polling-interval-seconds>4</polling-interval-seconds>
    </properties>
</channel-definition>




Piggybacking Polling
이 방식은 Simple Polling에서 일정한 간격에 의한 poll 이전에 다른 client의 메세지가 들어와 있을 경우, 다른 어떤 요청(Producer 또는 RemoteObject)을 보낸다면 그에 대한 결과와 더불어 메세지도 함께 응답 합니다.

설정 방법은 다음과 같습니다.

<channel-definition id="polling-amf" class="mx.messaging.channels.AMFChannel">
    <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amfpolling" class="flex.messaging.endpoints.AMFEndpoint"/>
    <properties>
        <polling-enabled>true</polling-enabled>
        <polling-interval-seconds>4</polling-interval-seconds>
        <piggybacking-enabled >true</piggybacking-enabled >
    </properties>
</channel-definition>




Long Polling




이 방식은 polling 이지만 다른 client로 부터 메세지가 올 때까지(또는 설정한 기간 만큼) poll을 잡아 놓음으로써 real-time의 효과를 볼 수 있습니다.

설정 방법은 다음과 같습니다.
wait-interval-millis : (default 0) poll 의 대기시간 입니다. -1의 경우 다른 client의 메세지가 올 때까지 무한대로 기다립니다.
max-waiting-poll-requests : 대기하는 poll의 갯수입니다.

<channel-definition id="long-polling-amf" class="mx.messaging.channels.AMFChannel">
    <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amfpolling" class="flex.messaging.endpoints.AMFEndpoint"/>
    <properties>
        <polling-enabled>true</polling-enabled>
        <wait-interval-millis>-1</wait-interval-millis>
        <polling-interval-millis>100</polling-interval-millis>
        <max-waiting-poll-requests>50</max-waiting-poll-requests>
    </properties>
</channel-definition>




Streaming




HTTP1.1 스펙의 open connection 기능을 이용함으로써, 서버 push를 구현하는 방법 입니다.
서버 push이기 때문에 real-time 그 자체라고 할 수 있습니다.

설정 방법은 다음과 같습니다.
max-streaming-clients : open connection의 갯수입니다.

<channel-definition id="streaming-amf" class="mx.messaging.channels.StreamingAMFChannel">
    <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/streamingamf" class="flex.messaging.endpoints.StreamingAMFEndpoint"/>
    <properties>
        <max-streaming-clients>10</max-streaming-clients>
    </properties>
</channel-definition>




퍼포먼스는 Stream -> long polling -> piggybacking polling -> simple polling 순으로 좋습니다.
설정 가능한 프로퍼티는 참고 문서를 참조 하세요.





참고 사이트. http://livedocs.adobe.com/blazeds/1/blazeds_devguide/help.html?content=lcconfig_3.html


Configuring channels with servlet-based endpoints


The servlet-based endpoints are part of both BlazeDS and LiveCycle Data Services ES.

Simple channels and endpoints

The AMFEndpoint and HTTPEndpoint are simple servlet-based endpoints. You generally use channels with these endpoints without client polling for RPC service components, which require simple call and response communication with a destination. When working with the Messaging Service, you can use these channels with client polling to constantly poll the destination on the server for new messages, or with long polling to provide near real-time messaging when using a streaming channel is not an option in your network environment.

Property

Description

polling-enabled

Optional channel property. Default value is false.

polling-interval-millis

Optional channel property. Default value is 3000. This parameter specifies the number of milliseconds the client waits before polling the server again. When polling-interval-millis is 0, the client polls as soon as it receives a response from the server with no delay.

wait-interval-millis

Optional endpoint property. Default value is 0. This parameter specifies the number of milliseconds the server poll response thread waits for new messages to arrive when the server has no messages for the client at the time of poll request handling. For this setting to take effect, you must use a nonzero value for the max-waiting-poll-requests property.

A value of 0 means that server does not wait for new messages for the client and returns an empty acknowledgment as usual. A value of-1 means that server waits indefinitely until new messages arrive for the client before responding to the client poll request.

The recommended value is 60000 milliseconds (one minute).

client-wait-interval-millis

Optional channel property. Default value is 0. Specifies the number of milliseconds the client will wait after it receives a poll response from the server that involved a server wait. A value of 0 means the client uses its configured polling-interval-millis value to determine the wait until its next poll. Otherwise, this value overrides the default polling interval of the client. Setting this value to 1 allows clients that poll the server with wait to poll immediately upon receiving a poll response, providing a real-time message stream from the server to the client. Any clients that poll the server and are not serviced with a server wait use the polling-interval-millis value.

max-waiting-poll-requests

Optional endpoint property. Default value is 0. Specifies the maximum number of server poll response threads that can be in wait state. When this limit is reached, the subsequent poll requests are treated as having zero wait-interval-millis.

piggybacking-enabled

Optional endpoint property. Default value is false. Enable to support piggybacking of queued messaging and data management subscription data along with responses to any messages the client sends to the server over this channel.

login-after-disconnect

Optional channel property. Default value is false. Setting to true causes clients to automatically attempt to reauthenticate themselves with the server when they send a message that fails because credentials have been reset due to server session timeout. The failed messages are resent after reauthentication, making the session timeout transparent to the client with respect to authentication.

flex-client-outbound-queue-processor

Optional channel property. Use to manage messaging quality of service for subscribers. Every client that subscribes to the server over this channel is assigned a unique instance of the specified outbound queue processor implementation that manages the flow of messages to the client. This can include message conflation, filtering, scheduled delivery and load shedding. You can define configuration properties, and if so, they are used to configure each new queue processor instance that is created. The following example shows how to provide a configuration property:

<flex-client-outbound-queue-processor class="my.company.QoSQueueProcessor"> <properties> <custom-property>5000</custom-property> </properties> </flex-client-outbound-queue-processor>
serialization

Optional serialization properties on endpoint. For more information, see Configuring AMF serialization on a channel.

connect-timeout-seconds

Optional channel property. Use to limit the client channel's connect attempt to the specified time interval.

invalidate-session-on-disconnect

Optional endpoint property. Disabled by default. If enabled, when a disconnect message is received from a client channel, the corresponding server session is invalidated. If the client is closed without first disconnecting its channel, no disconnect message is sent, and the server session is invalidated when its idle timeout elapses.

add-no-cache-headers

Optional endpoint property. Default value is true. HTTPS requests on some browsers do not work when pragma no-cache headers are set. By default, the server adds headers, including pragma no-cache headers to HTTP responses to stop caching by the browsers.

Non-polling AMF and HTTP channels

The simplest types of channels are AMF and HTTP channels in non-polling mode, which operate in a single request-reply pattern. The following example shows AMF and HTTP channel definitions configured for no polling:

<!-- Simple AMF -->
<channel-definition id="samples-amf"
    type="mx.messaging.channels.AMFChannel">
    <endpoint url="http://{server.name}:8400/myapp/messagebroker/amf"
        type="flex.messaging.endpoints.AmfEndpoint"/>
</channel-definition>
<!-- Simple secure AMF -->
<channel-definition id="my-secure-amf"
    class="mx.messaging.channels.SecureAMFChannel">
    <endpoint url="https://{server.name}:9100/dev/messagebroker/
        amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
</channel-definition>
<!-- Simple HTTP -->
<channel-definition id="my-http"
    class="mx.messaging.channels.HTTPChannel">
    <endpoint url="http://{server.name}:8400/dev/messagebroker/http"
        class="flex.messaging.endpoints.HTTPEndpoint"/>
</channel-definition>
<!-- Simple secure HTTP -->
<channel-definition id="my-secure-http" class="mx.messaging.channels.SecureHTTPChannel">
    <endpoint url=
        "https://{server.name}:9100/dev/messagebroker/
            httpsecure"
        class="flex.messaging.endpoints.SecureHTTPEndpoint"/>
</channel-definition>

Polling AMF and HTTP channels

You can use an AMF or HTTP channel in polling mode to repeatedly poll the endpoint to create client-pull message consumers. The interval at which the polling occurs is configurable on the channel. You can also manually poll by calling the poll() method of a channel for which polling is enabled; for example, you want set the polling interval to a high number so that the channel does not automatically poll, and call the poll() method to poll manually based on an event, such as a button click.

When you use a polling AMF or HTTP channel, you set the polling property to true in the channel definition. You can also configure the polling interval in the channel definition.

Note: You can also use AMF and HTTP channels in long polling mode to get pushed messages to the client when the other more efficient and real-time mechanisms are not suitable. For information about long polling, see Long polling AMF and HTTP channels.

The following example shows AMF and HTTP channel definitions configured for polling:

<!-- AMF with polling -->
<channel-definition id="samples-polling-amf"
    type="mx.messaging.channels.AMFChannel">
    <endpoint url="http://{server.name}:8700/dev/messagebroker/amfpolling"
        type="flex.messaging.endpoints.AMFEndpoint"/>
    <properties>
            <polling-enabled>true</polling-enabled>
            <polling-interval-seconds>8</polling-interval-seconds>
    </properties>
</channel-definition>
<!-- HTTP with polling -->
<channel-definition id="samples-polling-http"
    type="mx.messaging.channels.HTTPChannel">
    <endpoint url="http://{server.name}:8700/dev/messagebroker/httppolling"
        type="flex.messaging.endpoints.HTTPEndpoint"/>
    <properties>
            <polling-enabled>true</polling-enabled>
            <polling-interval-seconds>8</polling-interval-seconds>
    </properties>
</channel-definition>

Note: You can also use secure AMF or HTTP channels in polling mode.

Long polling AMF and HTTP channels

In the default configuration for a polling AMF or HTTP channel, the endpoint does not wait for messages on the server. When the poll request is received, it checks whether any messages are queued for the polling client and if so, those messages are delivered in the response to the HTTP request. You configure long polling in the same way as polling, but you also must set the wait-interval-millismax-waiting-poll-requests, and client-wait-interval-millis properties.

To achieve long polling, you set the following properties in the properties section of a channel definition in the services-config.xml file:

  • polling-enabled
  • polling-interval-millis
  • wait-interval-millis
  • max-waiting-poll-requests.
  • client-wait-interval-millis

Using different settings for these properties results in different behavior. For example, setting the wait-interval-millis property to 0 (zero) and setting thepolling-interval-millis property to a nonzero positive value results in normal polling. Setting the wait-interval-millis property to a high value reduces the number of poll messages that the server must process, but the number of request handling threads on the server limits the total number of parked poll requests.

The following example shows AMF and HTTP channel definitions configured for long polling:

<!-- Long polling AMF -->
<channel-definition id="my-amf-longpoll" class="mx.messaging.channels.AMFChannel">
    <endpoint
        url="http://servername:8700/contextroot/messagebroker/myamflongpoll" 
        class="flex.messaging.endpoints.AMFEndpoint"/>
    <properties>
        <polling-enabled>true</polling-enabled>
        <polling-interval-seconds>0</polling-interval-seconds>
        <wait-interval-millis>60000</wait-interval-millis>
        <client-wait-interval-millis>3000</client-wait-interval-millis>
        <max-waiting-poll-requests>100</max-waiting-poll-requests>
    </properties>
</channel-definition>

<!-- Long polling HTTP -->
<channel-definition id="my-http-longpoll" class="mx.messaging.channels.HTTPChannel">
    <endpoint
        url="http://servername:8700/contextroot/messagebroker/myhttplongpoll" 
        class="flex.messaging.endpoints.HTTPEndpoint"/>
    <properties>
        <polling-enabled>true</polling-enabled>
        <polling-interval-seconds>0</polling-interval-seconds>
        <wait-interval-millis>60000</wait-interval-millis>
        <client-wait-interval-millis>3000</client-wait-interval-millis>
        <max-waiting-poll-requests>100</max-waiting-poll-requests>
    </properties>
</channel-definition>

Note: You can also use secure AMF or HTTP channels in polling mode.

The caveat for using the wait-interval-millis BlazeDS is the utilization of available application server threads. Because this channel ties up one application server request handling thread for each parked poll request, this mechanism can have an impact on server resources and performance. Modern JVMs can typically support about 200 threads comfortably if given enough heap space. Check the maximum thread stack size (often 1 or 2 megabytes per thread) and make sure that you have enough memory and heap space for the number of application server threads you configure.

To ensure that Flex clients using channels with wait-interval-millis do not lock up your application server, BlazeDS requires that you set the max-waiting-poll-requests property, which specifies the maximum number of waiting connections that BlazeDS should manage. This number must be set to a number smaller than the number of HTTP request threads your application server is configured to use. For example, you configure the application server to have at most 200 threads and allow at most 170 waiting poll requests. This setting would ensure that you have at least 30 application server threads to use for handling other HTTP requests. Your free application server threads should be large enough to maximize parallel opportunities for computation. Applications that are I/O heavy can require a large number of threads to ensure all I/O channels are utilized completely. Multiple threads are useful for the following operations:

  • Simultaneously writing responses to clients behind slow network connections
  • Executing database queries or updates
  • Performing computation on behalf of user requests

Another consideration for using wait-interval-millis is that BlazeDS must avoid monopolizing the available connections that the browser allocates for communicating with a server. The HTTP 1.1 specification recommends that browsers allocate at most two connections to the same server when the server supports HTTP 1.1. To avoid using more that one connection from a single browser, BlazeDS allows only one waiting thread for a given application server session at a time. If more than one Flash Player instance within the same browser process attempts to interact with the server using long polling, the server forces them to poll on the default interval with no server wait to avoid busy polling.

Streaming AMF and HTTP channels

The streaming AMF and HTTP channels are HTTP-based streaming channels that the BlazeDS server can use to push updates to clients using a technique called HTTP streaming. These channels give you the option of using standard HTTP for real-time messaging. This capability is supported for HTTP 1.1, but is not available for HTTP 1.0. There are also a number of proxy servers still in use that are not compliant with HTTP 1.1. When using a streaming channel, make sure that the channel hasconnect-timeout-seconds defined and the channel set has a channel to fall back to, such as an AMF polling channel.

Using streaming AMF or HTTP channels/endpoints is like setting a long polling interval on a standard AMF or HTTP channel/endpoint, but the connection is never closed even after the server pushes the data to the client. By keeping a dedicated connection for server updates open, network latency is greatly reduced because the client and the server do not continuously open and close the connection. Unlike polling channels, because streaming channels keep a constant connection open, they can be adversely affected by HTTP connectors, proxies, reverse proxies or other network components that can buffer the response stream.

The following table describes the channel and endpoint configuration properties in the services-config.xml file that are specific to streaming AMF and HTTP channels/endpoints. The table includes the default property values as well as considerations for specific environments and applications.

Property

Description

connect-timeout-seconds

Using a streaming connection that passes through an HTTP 1.1 proxy server that incorrectly buffers the response sent back to the client hangs the connection. For this reason, you must set the connect-timeout-seconds property to a relatively short timeout period and specify a fallback channel such as an AMF polling channel.

idle-timeout-minutes

Optional channel property. Default value is 0. Specifies the number of minutes that a streaming channel is allowed to remain idle before it is closed. Setting the idle-timeout-minutes property to 0 disables the timeout completely, but it is a potential security concern.

max-streaming-clients

Optional endpoint property. Default value is 10. Limits the number of Flex clients that can open a streaming connection to the endpoint. To determine an appropriate value, consider the number of threads available on your application server because each streaming connection open between a FlexClient and the streaming endpoints uses a thread on the server. Use a value that is lower than the maximum number of threads available on the application server.

This value is for the number of Flex client application instances, which can each contain one or more MessageAgents (Producer or Consumer components).

server-to-client-heartbeat-millis

Optional endpoint property. Default value is 5000. Number of milliseconds that the server waits before writing a single byte to the streaming connection to make sure that the client is still available. This is important to determine when a client is no longer available so that its resources associated with the streaming connection can be cleaned up. Note that this functionality keeps the session alive. A non-positive value disables this functionality.

user-agent-settings

Optional endpoint property. Default values are as shown in the following example:

<user-agent-settings> <user-agent match-on="MSIE" kickstart-bytes= "2048" max-streaming-connections-per-session="1"/> <user-agent match-on="Firefox" kickstart-bytes="0" max-streaming-connections-per-session="1"/> </user-agent-settings>

User agents are used to customize the streaming endpoint for specific web browsers for the following reasons:

  • A certain number of bytes must be written before the endpoint can reliably use a streaming connection as specified by the kickstart-bytes attribute.
  • There is a browser-specific limit to the number of connections allowed per session. In Firefox, the limit is eight connections per session. In Internet Explorer, the limit is two connections allowed per session. Therefore, BlazeDS must limit the number of streaming connections per session on the server to stay below this limit.

By default, BlazeDS uses 1 as the value for max-streaming-connections-per-session. You can change the values for Internet Explorer and Firefox, and you can add other browser-specific limits by specifying a new user-agent element with a match-on value for a specific browser user agent.

The following example shows streaming AMF and HTTP channel definitions:

<!-- AMF with streaming -->
<channel-definition id="my-amf-stream"
    class="mx.messaging.channels.StreamingAMFChannel">
    <endpoint url="http://servername:2080/myapp/messagebroker/streamingamf" 
        class="flex.messaging.endpoints.StreamingAMFEndpoint"/>
</channel-definition>

<!-- Secure AMF with streaming -->
<channel-definition id="my-secure-amf-stream"
    class="mx.messaging.channels.SecureStreamingAMFChannel">
    <endpoint url="http://servername:2080/myapp/messagebroker/securestreamingamf" 
        class="flex.messaging.endpoints.SecureStreamingAMFEndpoint"/>
</channel-definition>

<!-- HTTP with streaming -->
<channel-definition id="my-http-stream"
    class="mx.messaging.channels.StreamingHTTPChannel">
    <endpoint url="http://servername:2080/myapp/messagebroker/streaminghttp" 
        class="flex.messaging.endpoints.StreamingHTTPEndpoint"/>
</channel-definition>

<!-- Secure HTTP with streaming -->
<channel-definition id="my-secure-http-stream"
    class="mx.messaging.channels.SecureStreamingHTTPChannel">
    <endpoint url="http://servername:2080/myapp/messagebroker/securestreaminghttp" 
        class="flex.messaging.endpoints.SecureStreamingHTTPEndpoint"/>
</channel-definition>


:
Posted by 라면스프
2013. 7. 5. 16:10

괌 맛집 리스트 2013. 7. 5. 16:10

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력하세요.

출처 : http://www.samsungfire.com/CnLc_Contents.do?method=getDetail&lifecareType=02&idx=00000132


식스팩은 훈남이라면 가져야 할 필수 조건. 하지만 탄탄한 식스팩은커녕 불룩한 뱃살 때문에 고민이라면? 쉽고 간단하게 따라 할 수 있는 복근운동 기본동작으로 식스팩 만들기에 도전해 보자.

몸짱이 되기 위해서라면 필수적으로 가져야 할 첫 번째 요소가 바로 식스팩, 복근이다. 남성은 물론이고 요즘은 여성들 

사이에서도 복근은 미덕으로 통한다. 꾸준한 웨이트 트레이닝과 관리가 있어야만 가능하다는 복근 만들기. 헬스 클럽에 

등록해 관리하는 것도 좋지만 복근을 만들기 위해 가장 기본이 되는 동작만 알고 꾸준히 실천한다면 복근 만들기는 

더 이상 어려운 일이 아니다.

첫번째,복근운동 기본동작

오버헤드 크런치(Overhead Crunch)
이 동작은 팔의 위치에 따라서 저항력을 다르게 할 수 있고 운동을 할 때 물이 담긴 페트병 등 간단한 소도구를 잡고 할 

경우 저항력을 키워 윗배 즉, 상복부 쪽의 힘을 기를 수 있다.

첫번째 반듯하게 누운 상태에서 무릎은 굽혀 반쯤 세우고 두 팔을 머리 위로 쭉 뻗는다. 
두번째 손이 무릎에 닿을 정도로 팔을 앞으로 내리며 윗몸 일으키기를 하듯 일어난다.

오버헤드 크런치의 두 동작 사진
스트레이트 레그 크런치(Straight-Leg Crunch) 하는 사진

스트레이트 레그 크런치(Straight-Leg Crunch)
첫 번째 동작에서 다리만 좀 더 위로 올려서 상복부 집중력을 극대화시킬 수 있는 동작이다. 다리의 각도에 따라서 운동 저항 근력의 집중력을 다르게 줄 수 있다.

첫번째 오버헤드 크런치와 같은 자세로 누워 양다리를 곧게 편 상태로 들어 올린다. 
두번째 윗배에 힘을 주면서 천천히 상체를 들어올린다.

다리의 이동이 없이 팔만 움직여주면서 상복부 집중력을 극대화시킬 수 있다. 운동 도중 다리가 구부러진다든지 팔의 속도에만 의존하게 되면 복부의 집중력이 현저히 떨어지기 때문에 운동효과가 떨어지니 주의하자. 또한 다리각도가 90도인지 45도인지에 따라 복부운동의 느낌은 달라진다. 90도일 경우 상복부 쪽으로 집중할 수 있고, 45도로 내려갔을 경우 복부 전체를 훈련시킬 수 있다.

써포티드 크런치(Supported Crunch)
오버헤드 크런치나 스트레이트 레그 크런치에 비해 난이도가 낮아 복부의 근력이 약한 초급자, 중급자를 위한 운동이다. 

간단한 의자, 소파, 탁자에 다리를 올려놓고 상복부만 움직여주면 되는 운동이다.

써포티드 크런치의 두 동작 사진

첫번째 의자나 스툴 등 무릎 높이의 기구에 다리를 올린 후 누워 두 팔을 머리 위로 곧게 편다. 
두번째 팔을 앞으로 내리며 윗몸 일으키기를 하듯 일어난다.

집에서 무릎높이에 맞출 수 있는 가구를 골라 사용하면 되기 때문에 편안하게 할 수 있는 운동이다. 복부운동을 할 때 

흔히 하는 실수인 배치기 등의 동작을 방지해 복부의 집중력을 높여줄 수 있다.

더블 크런치(Double Crunch)
위에서 함께 한 운동보다는 난이도가 높은 동작으로 복부의 근력이 강한 상급자를 위한 운동이다. 팔과 다리의 위치에 

따라 복부 전체에 자극을 줄 수 있으므로 복부에 매우 효과적인 운동이기도 하다.

더블 크런치(Double Crunch) 하는 사진

첫번째 바닥에 누워 무릎을 굽힌 채 발을 허공에서 띄운다. 
두번째 상체와 하체를 동시에 들어올려 복부에 최대한 힘이 들어가도록 한다.

동작이 너무 어렵다거나 중심을 잡기가 힘들면 다리를 구부려 전체적인 저항을 줄일 수 있다. 단 바닥과의 반동을 이용해 상체나 하체를 끌어올리면 허리에 통증이 올 수 있으니 주의해야 한다. 특히 상체의 경우 목에 힘이 들어가면 안 되고 상복부의 힘으로만 상체를 들어야 한다.

레그 레이즈(Leg Raise)
레그 레이즈는 하복부의 집중력을 높이는 동작이다. 상체는 가만히 누운 상태에서 다리만 움직여서 하복부의 집중력을 

높여주는 운동이다.

레그 레이즈(Leg Raise)의 두 동작 사진

첫번째 바닥에 몸을 곧게 펴 눕는다. 
두번째 다리를 들어 올리면서 무릎을 살짝 구부린다.

팔의 위치에 따라 복부에 가는 저항력을 높이거나 낮출 수 있음을 주의한다. 팔이 양 옆에 붙어있는 것보다 팔이 

허리와 조금 떨어지게 되면 하복부에 가해지는 힘이 더 집중된다. 또한 허리에 통증이 있는 사람이라면 반드시 

꼬리뼈 쪽에 얇은 쿠션이나 방석을 대고 하면 좀 더 안전하게 할 수 있다.

니업 레그 레이즈(Knee-up Leg Raise)
니업 레그 레이즈(Knee-up Leg Raise) 하는 사진

레그 레이즈보다는 난이도가 약간 낮은 동작으로 하복부의 힘이 약한 사람들을 위한 운동이다.

첫번째 레그 레이즈 동작에서 무릎을 더 구부려 허벅지를 가슴까지 끌어올린다.

니업 레그 레이즈 동작을 할 때 주의할 점은 무릎 각도를 90도로 유지하면서 가슴방향으로 당겨야 하는데 이 때 뒤꿈치가 엉덩이 쪽으로 가까이 가면 안 된다. 레그 레이즈보다 허리에 전달되는 부담은 줄이면서 하복부에 집중력을 높일 수 있는 운동이다.

시저 킥(Caesar Kick)
시저 킥(Caesar Kick) 하는 사진

다리를 교대로 움직이거나 교차시킴으로써 다리 앞쪽의 대퇴사두근까지 하복부의 넓은 범위를 다루는 운동이다. 다리를 교대하는 방법과 다리를 교차하는 방법이 있다.

첫번째 곧게 누운 상태에서 한 쪽 다리만 곧게 편 상태로 들어올렸다 내리고, 이 동작을 반복한다.

크로스 오버 크런치(Cross Over Crunch)
하체의 힘을 전혀 사용하지 않게 되므로 복부, 특히 내외복사근에 집중력을 줄 수 있는 동작이다.

크로스 오버 크런치(Cross Over Crunch) 의 두 동작 사진

첫번째 누운 자세에서 다리를 굽혀 한쪽 다리를 꼰 다음, 꼰 다리의 반대쪽 팔로 머리를 받치고 상복부를 일으킨다. 
두번째 반대쪽도 같은 동작을 반복한다.

옆 복부의 힘이 약한 사람이라면 밑에 있는 팔에 힘을 주어 같이 밀어주면 동작이 쉬워진다. 
* 내복사근(Internal oblique) 뱃속의 빗근이라고도 불리는데 허리와 골반 사이의 근육을 말한다. 치골이라고 잘못 알려져 있기도 하다. 
* 외복사근(External oblique) 옆구리에 위치하며 갈비뼈 옆에서 골반까지 이어진 근육을 말한다. 이 근육은 척추의 회전을 보조하는 

역할을 한다.

오블리크 크런치(Oblique Crunch)
오블리크 크런치(Oblique Crunch)하는 사진

옆구리살을 빼는 데 도움이 되는 동작으로 특히 외복사근을 단련시키는 데 좋은 동작이다.

첫번째 옆으로 눕고 무릎은 90도로 구부려 양 무릎이 닿도록 한다.
두번째 양 손을 머리 뒤로 한 다음 상체를 대각선 방향으로 들어올린다

난이도가 상당한 동작이기 때문에 허리가 좋지 않은 사람은 가능한 자제하는 것이 좋다. 두 다리를 옆으로 놓는 것이 기본이지만 동작이 힘들다면 한쪽 다리 무릎을 세워서 할 경우 난이도가 훨씬 낮아진다.

크로스 바디 크런치(Cross Body Crunch)
내외복사근을 단련시키는 운동 중 가장 난이도가 높은 동작이다.

크로스 바디 크런치(Cross Body Crunch)의 두 동작 사진

첫번째 다리를 구부린 상태에서 누워 양 팔을 머리 뒤로 놓는다.
두번째 한쪽 무릎과 반대쪽 팔꿈치를 교차시켜 만나게 하는 동작을 반복한다.

크로스 바디 크런치 동작에서 주의할 것은 속도에 의존하지 말아야 한다는 점이다. 또한 반동을 이용해 허리를 쓸 경우 

운동 효과는 상당히 줄어든다는 점을 명심해야 한다.

| Editor 최선희, 이지혜  | Cooperation 월드짐 피트니스센터(02-2272-7999)  


:
Posted by 라면스프
2013. 3. 22. 18:52

grep 옵션 Enjoy/etc2013. 3. 22. 18:52

출처 : http://radiocom.kunsan.ac.kr/lecture/unix_cmd/grep.html


grep


지정한 파일에서 정규 표현식으로 나타낸 단어를 찾아 그 단어가 있는 라인을 출력함


하나 또는 그 이상의 파일에서 찾고 싶은 어떤 문자들을 검색하여 그 문자를 포함하는 라인들을 찾고, 찾은 라인 모두를 인쇄한다. grep 명령의 기본 구문은 다음과 같다.

grep 문자열 파일명

grep 문자열 *

grep [-chinvw] 'pattern' file_name [file_names]

-ccount 옵션은 파일 이름 다음에 패턴이 들어 있는 라인의 수를 표시
-hhide 옵션은 파일이름을 출력하지 않음
-iignore옵션은 대소문자 구분하지 않고 찾음
-nline number 옵션은 출력하는 각 라인에 라인번호를 붙임
-vinverse 옵션은 패턴이 없는 라인만 출력
-wword 옵션은 패턴 자체가 완전한 단얼로 독립되었을 경우만 글자로 인식함

여기서 ‘문자열’는 사용자가 찾으려는 단어 또는 구를 나타내고 ‘파일명’은 검색 대상 파일이다. ‘문자열’은 하나 또는 여러 문자를 의미한다. 단일 문자도 단어나 문장과 같이 하나의 문자열이다. 문자열에는 “빈칸”, 구두점과 보이지 않는 (제어) 문자들이 포함될 수 있다.

파일명은 지정하면 해당 파일에서만 찾지만, 파일명을 *와 같은 메타문자를 사용하면 현재 디렉토리의 모든 파일을 대상으로 하므로 디렉토리내의 모든 파일내에서 해당 문자열을 찾게된다.

grep, egrep, fgrep의 차이를 간단히 요약하여 정리하면 다음과 같다.

fgrep정규 표현식을 사용하지 않음
grep정규 표현식을 사용함
egrep정규 표현식과 확장 표현식을 사용

【예제】
    % grep s01287 /etc/passwd
    s01287:x:1028:103:choi eun sook:/export/home0/class12/s01287:/bin/csh
    %
grep은 다른 명령어들과 함께 “필터”로 자주 사용된다. grep은 사용자가 명령의 수행결과에서 불필요한 정보를 제거할 수 있도록 한다. grep을 필터로 사용하려면, 반드시 명령의 수행 결과를 grep을 통해 파이프(|) 해야 한다. 다음 예제는 파일 이름이 “.ps”로 끝나는 파일 중에서 5월에 생성된 것들을 나타낸다.

ls -l *.ps ¦ grep May

또한 여러 단어로 구성된 패턴을 찾으려면, 단일(‘ ’) 또는 이중(“ ”) 인용부호를 사용하여 해당 문자열을 묶어 준다.

grep "JoonIk Joe" phonebook

grep을 사용하여 파일 그룹에서 특정 문자열을 찾을 수 있다. grep이 여러 파일에서 일치하는 패턴을 찾은 경우, 먼저 해당 파일 이름과 콜론을 인쇄한 후 그 패턴과 일치하는 줄을 인쇄한다.

grep ar *

파일에서 특정 문자열을 포함하고 있지 않은 모든 줄을 찾으려면, grep에서 -v 옵션을 사용한다. 다음 예제는 현 디랙토리에 있는 파일 중에서 문자 e를 포함되지 않은 줄을 찾는 방법이다.

grep -v e *

정규 표현식을 사용하여 패턴으로 정의된 대상을 찾을 때 grep 명령을 사용할 수도 있다. 정규 표현식은 문자 및 숫자들과 grep에 특수한 의미를 갖는 문자로 구성된다. 메타문자인 특수 문자들은 시스템에서도 특수한 의미를 가지므로 인용부호나 이스케이프 문자를 사용해야 한다. 명령어 프롬프트 상태에서 grep 정규 표현식을 사용할 때마다 인용부호 또는 백슬래시(\)로 메타문자들(& ! . * $ ? 및 \)을 묶어 주어야 한다.

    % grep '^b' list    ☜  파일 list에서 “b”로 시작하는 줄을 찾는다.
    % grep 'b$' list    ☜  파일 list에서 마지막 문자가 ‘b’로 끝나는 줄을 찾음
    % grep '^b$' list   ☜  파일 list에서 “b”만 있는 줄을 찾음
    % grep 'an. ' list  ☜  세 자리 문자 중 처음 두 문자가 “an”으로 시작되는 것
    % grep 'qu*‘ list  ☜ 문자 “qu”가 포함된 모든 단어를 찾음
    % grep 'nn*' list   ☜ 문자 “n”을 포함하는 모든 단어를 찾음
    % grep 'nnn*' list  ☜ 문자 “nn”을 포함하는 모든 단어를 찾음
    % grep .* list      ☜ 어떤 문자가 나타나지 않거나 여러 번 나타난 경우를 찾음

정규 표현식에서 메타문자(& ! . * ? $ 및 \) 앞에 백슬래시(\)를 나타내면 grep으로 하여금 그것의 특수 의미를 무시하도록 한다.

예를 들어

    % grep ^\.       ☜ 마침표로 시작되는 줄을 찾음 
    % grep '\$'      ☜ "$" 문자가 포함된 줄을 찾음 

다음은 grep 탐색 패턴을 만드는데 자주 쓰이는 정규 표현식 기호이다

1) 일반 정규 표현식

기호의미사용 예설명
^라인의 첫 글자^aa자로 시작하는 라인
$라인의 끝 글자a$a자로 끝나는 라인
.한 글자a...ba와 b 사이에 3 글자가 있는 단어
** 기호 바로 이전의 글자나 정규 표현식이 
0회 이상 반복
abc*c가 0번 이상 반복
ab, abc, abcc, abccc 등
[ ]한글자를 대체할 글자의 목록을 []에 나열, "¦"를 여러 개 쓴 것과 같은 의미

"-" 기호와 함께 쓰면 문자의 범위를 지정할 수 있음

[abc]dad, bd, cd를 뜻함, a,b,c 중 어떤 한 글자라도 반드시 있는 단어

"[a-z]"는 a부터 z까지 중 하나, "[1-9]"는 1부터 9까지 중의 하나를 뜻함

[^]한글자를 대체하지 못할 글자의 목록을 [^ ]에 나열

"-" 기호와 함께 쓰면 문자의 범위를 지정할 수 있음

[^abc]dad, bd, cd는 포함하지 않고 ed, fd 등을 포함

[^a-z]는 알파벳 소문자로 시작하지 않는 모든 문자를 나타냄

2) 확장 정규 표현식

기호의미사용 예설명
++ 기호 바로 이전의 글자나 정규 표현식이
1회 이상 반복
abc+c가 1회 이상 반복 : abc, abcc, abccc 등
?? 기호 바로 이전의 글자나 정규 표현식이
없거나 1회만 존재
abc?c가 없거나 한번만 존재 : ab, abc
()부분 정규 표현식의 시작과 끝을 표시a(bc)*
a(bc)+
a(bc)?
bc가 0회 이상 반복 : a, abc, abcbc 등
bc가 1회 이상 반복 : abc, abcbc 등
bc가 있거나 없거나 : a, abc
¦¦로 구분된 단어들 중 최소 하나가 존재a(b¦c)b 또는 c가 최소 하나 존재 : ab, ac, abc, acb
{m,n}{} 기호 바로 이전의 글자나 정규 표현식이
m개 이상 n개 이하 반복
a{1,3}b'ab', 'aab', 'aaab'를 포함하지만,
'b'나 'aaaab'는 포함하지 않음

효율적인 검색을 위해 grep 명령어를 변형한 2개의 명령어가 제공된다.

그중 하나는 fgrep(fixed grep 또는 fast grep) 명령어로 이 명령어는 정규 표현식이 아닌 단순한 문자열만을 인수로 사용한다.

또 하나의 명령어인 egrep(extended grep) 명령어는 fgrep와는 반대로 grep보다 더 다양한 정규 펴현식 연산자를 사용할 수 있다. 일반적으로 grep 명령어가 제일 사용하기 편리하다.

【예제】
    % cat aa
    jinpo	202.31.146.123
    radio	202.31.146.122
    knusun1	202.30.55.11
    knu2000	202.30.55.15
    % grep 11 aa
    radio	202.31.146.122
    knusun1	202.30.55.11

fgrep 명령은 grep와 비슷하지만, 다중 표적 탐색에 쓸 수 있으나, 패턴 탐색을 위한 정규 표현식은 허용되지 않고, grep보다 빠르다. fgrep에서 다중 표적을 줄 때는 각 표적이 분리된 라인으로 하여야 되고, 다중 표적 설정 시 인용부호로 묶어야 한다.

【예제】
    # fgrep "jinpo
    > knusun1" aa
    jinpo	202.31.146.123
    knusun1	202.30.55.11

egrep는 grep 명령 패밀리 중 가장 강력하다. fgrep처럼 다중 표적 탐색을 할 수 있고, 표적 설정에 정규 표현식을 쓸 수 있으며, 보다 완전하고 강력한 정규 표현식을 제공한다.

egrep 명령은 문자 반복에 +, 0이나 ?을 사용할 수 있고, egrep는 다중 표적을 fgrep처럼 분리된 라인에 넣거나, 수직 바나 파이프 기호(¦)로 구분한다. 파이프 기호와 표적 사이에는 빈칸이 없어야 한다.

【예제】
    # egrep "jinpo
    > radio" aa
    jinpo	202.31.146.123
    radio	202.31.146.122
    # egrep "jinpo¦radio" aa
    jinpo	202.31.146.123
    radio	202.31.146.122
    # 
현재 디렉토리 내의 모든 파일을 점검하여 지정한 문자열을 찾을 수 도 있다.

【예제】

grep abc * ☜ *은 모든 파일을 의미함
fgrep abc * ☜ *은 모든 파일을 의미함
【예제】
$ grep Adm /etc/group /etc/passwd
/etc/passwd:adm:x:4:4:Admin:/var/adm:
/etc/passwd:lp:x:71:8:Line Printer Admin:/usr/spool/lp:
/etc/passwd:uucp:x:5:5:uucp Admin:/usr/lib/uucp:
/etc/passwd:nuucp:x:9:9:uucp Admin:/var/spool/uucppublic:/usr/lib/uucp/uucico
/etc/passwd:listen:x:37:4:Network Admin:/usr/net/nls:

$ grep -n Adm /etc/group /etc/passwd  ☜  줄번호도 표기
/etc/passwd:5:adm:x:4:4:Admin:/var/adm:
/etc/passwd:6:lp:x:71:8:Line Printer Admin:/usr/spool/lp:
/etc/passwd:7:uucp:x:5:5:uucp Admin:/usr/lib/uucp:
/etc/passwd:8:nuucp:x:9:9:uucp Admin:/var/spool/uucppublic:/usr/lib/uucp/uucico
/etc/passwd:10:listen:x:37:4:Network Admin:/usr/net/nls:

$ grep -h Adm /etc/group /etc/passwd  ☜ 파일명을 출력하지 않음
adm:x:4:4:Admin:/var/adm:
lp:x:71:8:Line Printer Admin:/usr/spool/lp:
uucp:x:5:5:uucp Admin:/usr/lib/uucp:
nuucp:x:9:9:uucp Admin:/var/spool/uucppublic:/usr/lib/uucp/uucico
listen:x:37:4:Network Admin:/usr/net/nls:

$ grep -c Adm /etc/group /etc/passwd  ☜  검색어가 있는 라인의 개수를 출력
/etc/group:0
/etc/passwd:5

$ grep -i Adm /etc/group /etc/passwd  ☜ 대소문자 구분없이 검색어를 찾음
/etc/group:sys::3:root,bin,adm
/etc/group:adm::4:root,daemon
/etc/group:tty::7:root,adm
/etc/group:lp::8:root,adm
/etc/group:sysadmin::14:
/etc/passwd:adm:x:4:4:Admin:/var/adm:
/etc/passwd:lp:x:71:8:Line Printer Admin:/usr/spool/lp:
/etc/passwd:uucp:x:5:5:uucp Admin:/usr/lib/uucp:
/etc/passwd:nuucp:x:9:9:uucp Admin:/var/spool/uucppublic:/usr/lib/uucp/uucico
/etc/passwd:listen:x:37:4:Network Admin:/usr/net/nls:
$ 
【예제】
$ grep 'Network' /etc/passwd
listen:x:37:4:Network Admin:/usr/net/nls:

$ grep 'uucp' /etc/passwd
uucp:x:5:5:uucp Admin:/usr/lib/uucp:
nuucp:x:9:9:uucp Admin:/var/spool/uucppublic:/usr/lib/uucp/uucico

$ egrep '(Network¦uucp)' /etc/passwd
uucp:x:5:5:uucp Admin:/usr/lib/uucp:
nuucp:x:9:9:uucp Admin:/var/spool/uucppublic:/usr/lib/uucp/uucico             
listen:x:37:4:Network Admin:/usr/net/nls:
$
【예제】
$ grep '$' /etc/init.d/ufs_quota  ☜ $는 줄 끝을 의미

#!/sbin/sh
#
# Copyright (c) 1993, 1997 by Sun Microsystems, Inc.
# All rights reserved.
#
#ident  "@(#)ufs_quota  1.2     97/12/08 SMI"

case "$1" in
'start')
        /usr/sbin/quotacheck -a
        /usr/sbin/quotaon -a
        ;;

'stop')
        /usr/sbin/quotaoff -a
        ;;

*)
        echo "Usage: $0 { start ¦ stop }"
        exit 1
        ;;
esac
exit 0
$ fgrep '$' /etc/init.d/ufs_quota ☜ $은 문자 $을 의미함 case "$1" in echo "Usage: $0 { start ¦ stop }" $

grep정규 표현식을 사용하여 파일에서 문자열을 찾음
egrep정규 표현식과 확장 정규 표현식을 사용하여 파일에서 여러 개의 문자열을 찾을때 편리
fgrep정규 표현식을 사용하지 않기 때문에 메타문자 따위도 파일에서 찾을 수 있음
pgrep지정한 프로세스를 찾음 (cf: ps -A)

:
Posted by 라면스프