maven

Spring 2015. 12. 4. 11:29

spring 에서   pom.xmL을 이용하는 경우가 많은데

이것은 maven 의존성 관리툴에서 사용하는 파일이다.


maven을 직접사용하는 방법도 있는데

maven 설치 후


$ mvn archetype:generate     해서 각종 값을 넣고 나면 (주로  package 명으로 넣으면된다)

pom.xml까지 자동 생성이 되며,


mvn compile exec:java -Dexec.mainClass=com.ky.App

 으로 바로 커맨드 상에서 실행한다.


매우 유용하다. 

 




Posted by yongary
,

tomcat 설치 (Linux)

FRONT-END 2015. 12. 1. 21:19

rpm이나 deb로 설치 후,


etc/profile 5줄 추가==================

JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.amd64


CATALINA_HOME=/usr/share/tomcat7


CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$CATALINA_HOME/lib/jsp-api.jar:$CATALINA_HOME/lib/servlet-api.jar


PATH=$PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin


export JAVA_HOME CLASSPATH PATH CATALINA_HOME


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




======tomcat port 수정.

/etc/tomcat7/server.xml 수정. 8080->80

service tomcat7 restart


(Ubuntu인 경우 필요할 수 있음)

autobind를 이용한 80포트 사용토록 수정. 

http://blog.ciaranoconnor.me/2015/01/12/configuring-tomcat7-to-port-80-on-ubuntu/



=======front-end 소스를 

/var/lib/tomcat7/webapps/ROOT  밑에 복사.



Posted by yongary
,

기타 index

mongoDB, redis 2015. 11. 9. 17:47

mongoDB의 index는 메모리상의 working Set 에  Cache되어 관리된다.

working Set에는 index외에도, 데이타 일부가 cache되지만,   index가 우선 cache되어 성능향상을 시키는 구조이다.

 

 

데이타가: type: "restratunt"

loc: [ 37, 132 ] 일 경우,  

 

<2D index>

 

 

db.data..ensureIndex( {loc:'2d', type:1} )

 => $near 나  $maxDistance 가 사용가능하다. 

 

 

 

<2dsphere index>

 

db.data..ensureIndex( {loc:'2dsphere', type:1} )

=> $near 나 $maxDistance 가 사용가능하다.  $gemetry를 사용할 수 있다.

db.data.find( {loc: {  $near: {   $geomerty: { type: "restaurant",  coordinates:[38,127] },  $maxDistance:2000 }   }})

 

 

<text search index>

 

db.data..ensureIndex( {type:'text'} )

db.data.find( {'$text:{$search:'restaurant'}'} )          //$text앞에 '는 빼도 될듯.

 

 

Posted by yongary
,

<Index>

mongoDB에서 index 및 멀티index가 가능하다.

(default는 _Id 가 인덱스이다.)


<DB daata>

    db.nameage.find()

    { "_id" : ObjectId("561ddb57e8c49d6d56c71503"), "name" : "kim", "age" : 2 }


인덱스 추가시 

> db.nameage.ensureIndex( {name:1} )  or

db.nameage.createIndex( {name:1,  age:-1} )  // -1=descending.. compound index.

index show
db.nameage..getIndexes()

> db.namegae.dropIndex( {name:1} )


조회시 index  사용하는지 확인.
> db.nameage.find({name:"kim"}).explain()



MultiKey  index (for array index)  : age가 array라면 자동으로 MultiKey index 가 됨.

   - explain()해보면  isMultiKey: true라고 나옴.

    - name이 array라고 되고, age가 array라도 됨.

=> 단, name과 age 둘 다 array 로 doc insert하면.. insert 실패 남.


    -array 안에 subDoc이 있을 때, .(dot)을 사용해 index 생성가능. names:[  { country:"kor", name:"yong" }, { country:"nz", name:"gary"} ]

     db.nameage.createIndex( {names.name:1} )


     tip:  subDoc조회시에는 $elemMatch 사용가능.

    

Unique Index

   > db.nameage.createIndex( {name:1}, {unique:true}  )

   unique index를 만들면서, sparse 옵션을 주면  unique이긴 하지만, 그 필드가 없어도 된다.

 db.nameage.createIndex( {name:1}, {unique:true, sparse:true} )

    단, sparse index 일 경우, sort()명령에서는 index 사용을 못함.



<Storage Engine>


Mongo서버가---> StorageEngine을 통해서 --> disk에 접근.

MongoDB에는 2가지 storageEngine이 있다.


1. linux기본의  mmap  (이게 3.0에서도 default)

- collection 레벨 locking

- 2의 승수(power of 2) document 생성. (즉, 4,8,16,32  byte단위로 update여유 있게 생성)

2. WiredTiger ( 최근에 인수.)  mongoDB 3.0부터 지원,

        - document 레벨 locking

       -  압축 지원

       -  no in-place Update  (즉, update 하면 doc을 항상 추가함) : 이게 doc 레벨 lockding의 원동력임.

사용법:  시작시  $ mongod  -storageEngine wiredTiger             (-dbpath wT)

          

     

Posted by yongary
,

IMS 과금

IMS 2015. 11. 2. 18:52

ICID (IMS charging ID) :과금 ID

 

P-CSCF가 Regi 수신받으면 ICID 생성.  (11.12)

P-CSCF는  P-Charging-Vector헤더를 이용해 ICID를 S-CSCF로 전달.

 

S-CSCF는 받은 ICID를 저장. 하고 이를 이용한 과금 수행.

 

(12.7)

세션중에 P-CSCF는 추가적인 media-stream용 ICID생성. (PDP Context 연관부분)

IOI(Inter-Operator ID)도 과금에 사용됨.

-type2 : 주로 통신사 내부에서 이걸 사용함.

-type1:(p-cscf 와 s-cscf간 용도),   type3:로밍용.

 

발신쪽 S-CSCF가 P-Charging-Vector에 orig-ioi넣어놓으면,

착신쪽에서 orig-ioi를 제거하고 단말로 내려감(단말로는 과금정보 절대 안내려감)

대신 183이 단말에서 올라오면 다시 ICID,IOI등을 더해서  전달함.

Posted by yongary
,

Android 4,~ 6.0 Changes

Android 2015. 11. 2. 10:26

Android 6.0 (API level 23) - Marshmallow

- runtime permissions.

- App Power Saving optimization.

Doze: device

App Standby:

- ART runtime 수정.

- Android for Work changes

- Camera Service Changes

priority 추가.

 Wi-Fi & Network

기존에 다른 네트웍이 끊어졌지만, 이젠 끊어지지 않는다. (API 21이후에는 multinetwork지원)

- APK validation

- USB Connection

 

Android 5.x (Lollipop,  API Level 21)

- Android RunTime (ART), 기존 dalvik대체

1. AOT(Ahead Of Time) 컴파일

2. GC향상

3. debugging 향상
(단,

- JNI / obfuscator 쓰는 경우 주의 필요

- GC에 반하는 기술 주의 필요)

- Notification : 계정별로 noti가 됨.

- Sound / 진동

Notification.Builder를 이용해서 prioritymode를 써야 함.

- MediaSession  등장 for media control (이전의 RemoteControlClient 대신임.)

Notification.MediaStyle,   (with Notification.Builder.addAction() )

- 64bit support in NDK.

- Managed Profile

- file공유 (profile간)

- Lockscreen widget support 없어짐.  (이제 lockscreen에서 Widget이 사라지나 보네요)

 

Android 4.4 (Kitkat, API Level 19)

 

- WebView가 크롬으로 바뀜. (기존엔 WebView base였음)

- READ_EXTERNAL_STORAGE permission 추가됨. -> getExternalStoragePublicDirectory() 사용가능

 

- android.pirnt 프레임웍 추가, 로 문서 printing이 쉬워짐.

- SMS Provider 추가:  default SMS앱으로 선정되어야만 SMS수신등이 가능

 

-

 

Android 4.1, 4.2, 4.3 (Jellybean  API 16~18)

- 4.3  OpenGL ES 3.0 지원.

- WifiEnterpriseConfig 기업용 자동 Wi-Fi세팅 지원.

- MediaMuxer : 1audio + 1video mux.

- ViewOverlay: OpticalBounds 추가.

- Screen Orientation 사용자편의 옵션 3개 추가.

 

 

Android 4.0 (IcecreamSandwich, API Level 14)

 

- RemoteControlClient 등장: media control / lock screen 등의 이벤트 수신.

 

 

Posted by yongary
,

user collections에 data가 아래와 같을 때:

  {name:"kim", phone:{mobile:"010-1234", office:"02-1234" }}

  {name:"lee",  phone:{mobie:"010-2222", office:"02-2222" }}

 

Sub Document

>  db.user.find(  {phone:{mobile:"010-1234", office:"02-1234"}  } )       : mobile, office 순서가 일치해야지만 찾음. Exact match

 

result:  kim user 1 line.

>  db.user.find(  {phone:{mobile:"010-1234" }}) 

result: no result

 

Cursor

>  

cur=db.user.find();null;  (null 이 잠시대기함)> while (cur.hasNext()) printjson(cur.next());

result: all 2users. 2 line
 
 ( Doc 조회 이전 or empty일 때,  설정 가능한 작업들)
> cur.sort( {name:-1}  );null;                       //  reverse order -> return new Cursor. so need null;

> cur.sort( {name:-1}  ).limit(3); ;null;     // limit 3. -> return new Cursor. so need null;

 

update

대표예제:  db.b2bRawCncity.updateMany({cmId:{$gt:240400007}}, {$set:{cmId:null}} );

 

>  db.user.update(  {name:"kim"},   { name:"kim2"} )     //문서 전체 udpate. 

result:  kim->kim2  phone은 날아감. (disappear)

  $set

  >  db.user.update(  {name:"kim"},   { $set: { name:"kim2"} )  //just update

 result:  kim->kim2  phone remain.

  $unset

  >  db.user.update(  {name:"kim"},   { $unset: { phone:1} )

  field  phone remove

  $upsert : true   means  => 없을 때 insert 하라는 의미.

  $multi : true   means  => 여러건 update 할 때  필수. default는 한 건만 update.

 

$type:2    string을 의미함. bson의 저장방식으로 숫자마다 다른 type을 의미함.

 

 

Posted by yongary
,

user collections에 data가 아래와 같을 때:

  {name:"kim", food:["rice","water" ]}

  {name:"lee", food:["rice","orange" ]}

 

Field Display : _id는 default.

> db.user.find( {name:"kim"}, {food:false, _id:false } )

result: {"name":"kim"}

 

 

array

>  db.user.find( {food:"rice"} )       : array 1depth까지 바로 탐색.

result:  all user 2 line. 

  update array { $push (rightmost),  $pop:1(rightmost),       $pull (remove),  $addToSet(work like set) 

  >  db.user.update( {name:"kim", {food: { $pop:1}} )      

 

 

 

$or,

> db.user.find( { $or:[ { name:"kim"}, {name:"lee"} ] } )

 


$and

 and는 보통 필요가 없다.

> db.user.find( {name:"kim", food:"rice"}  ) ?

result: kim user 1 line. 


$regex, 

> db.user.find(  {name:  {$regex:" ^k"}   } )

result: kim user 1 line.


$exists (=field exists )

> db.user.find(  {name:  {$exists:true}   } )

result: all user 2line


$all,

> db.user.find ( {rice: {$all ["rice","water] }} )

result: kim user 1 line.


$in,  (sql 의 in과 유사)

> db.user.find ( {rice: {$in ["orange","water] }} )

result: all user 2 line.

Posted by yongary
,

commands: traceroute

Linux 2015. 10. 21. 10:16

UDP traceroute:

 

traceroute 125.152.0.117 -s 220.75.130.5 -p 5160 -U

Posted by yongary
,

SIP stack

IMS 2015. 10. 15. 10:27

SIP stack is process&Library for dealing with SIP.(Sessin Initiation Protocol)

 

Open Source SIP Stack for JAVA:

 -

1) PJSIP-JNI  which is java bindings for the C PJSIP library

2) JAIN-SIP  http://users.cis.fiu.edu/~ege/JAIN/

    https://github.com/Mobicents/jain-sip 

    https://jsip.ci.cloudbees.com/job/jsip/javadoc/ 

    http://www.oracle.com/technetwork/java/introduction-jain-sip-090386.html      (Oracle introduction)

    https://developer.opencloud.com/devportal/devportal/apis/jainsip/1.1/docs/index.html 

    http://www.worldlibrary.org/articles/mobicents 

    http://www.mobicents.org/products.html 

 

    RFC 3261 functionality and the following SIP extensions; the INFO method (RFC 2976), Reliability of provisional responses (RFC 3262), Event Notification Framework (RFC 3265), the UPDATE method (RFC 3311), the Reason Header (RFC 3326), the Message method (RFC 3428) defined for instant messaging and the REFER method (RFC 3515), Distributing Authoritative Name Servers via Shared Unicast Addresses (RFC 3581), the PUBLISH method (RFC3903).

   SDP API(JSR 141) is property of Dynamic Soft. => under JCP License

 

3) MjSip        http://www.mjsip.org

4) javaforce   http://sourceforge.net/projects/javaforce/

5) jSIP          http://jsip.java.net  http://jsip.sourceforge.net/

6) openjsip    http://code.google.com/p/openjsip/

 

 

 

SIP Stack for C

1) reSIPRocate    http://www.resiprocate.org, http://svn.resiprocate.org/dox/ 

 

 

2) Spirent IMS SIP stack = Radvision SIP Stack.   REF-SITE

   - (Avaya m&a Radvision(2012),   spirent m&a Radvision Tech Biz Unit(2014) )

 

  • P-headers: private SIP headers for IMS
  • IPv6 support: the mandatory IMS transportation level
  • Signaling compression: mandatory IMS request for signaling between UE and P-CSCF
  • Support for IM URI, PRES URI, and TEL URI
  • ENUM: translation between phone numbers or TEL URI to SIP URI
  • Support for different event packages, such as presence, reg-event
  • Support for instant messaging (IM)
  • HTTP DIGEST using 3GPP AKA Authentication -"AKAv1-MD5"
  • IPsec: IP security
  • Security agreement negotiation, as defined in RFC 3329
  • Support for mobile registration using Service-route and Path headers
  •  

    Posted by yongary
    ,