안드로이드를 PC에 연결해서 개발좀 해보려 했으나 예전에는 USB방식이라 연결하면 바로 폴더가 보였는데 이젠 MTP인가 로 바뀌었네요


여튼 드라이버도 설치하고 그랬는데 계속 nexus7을 인식하지 못하는 현상이 발생함.


결론, 케이블을 바꿔주니 바로 인식 !


아.... 삽질의 끝이란 



출쳐 : 

http://blog.naver.com/guangin/80198713875

'etc > old' 카테고리의 다른 글

cordova - platform support  (0) 2015.06.05
cordova - overview  (0) 2015.06.05
[HTML] IE8 에서 ajax 업로드 처리 방법  (0) 2014.07.24
[MAC] MAC에서 톰캣 8.0.x 설치하기  (1) 2014.05.26
[ETC] Ubuntu 13.10 서버 환경 설치작업  (0) 2014.02.25

요즘은 html5의 기능인 FormData를 활용하여 ajax 업로드를 구현할 수 있다.


하지만 IE8 같은 브라우저를 사용한다면 FormData는 undefined -_-; (IE10 이상부터 사용가능) 난감하다


그래서 아래 소스를 참조하여 구현하니 잘 된다. 만들어 주신분께 감사.


로직은 동적으로 iframe을 만들고 해당 페이지에서 submit을 하는 것


출처 : http://onicodeline.blogspot.kr/2013/06/replace-jquery-formdata-for-file-upload.html


function fileUpload(form, action_url, div_id) {

    // Create the iframe...

    var iframe = document.createElement("iframe");

    iframe.setAttribute("id", "upload_iframe");

    iframe.setAttribute("name", "upload_iframe");

    iframe.setAttribute("style", "border: none;display: none;");

 

 

    // Add to document...

    form.append(iframe);

    window.frames['upload_iframe'].name = "upload_iframe";

 

    iframeId = document.getElementById("upload_iframe");

 

    // Add event...

    var eventHandler = function () {

 

            if (iframeId.detachEvent) iframeId.detachEvent("onload", eventHandler);

            else iframeId.removeEventListener("load", eventHandler, false);


            // Message from server...

            if (iframeId.contentDocument) {

                content = iframeId.contentDocument.body.innerHTML;

            } else if (iframeId.contentWindow) {

                content = iframeId.contentWindow.document.body.innerHTML;

            } else if (iframeId.document) {

                content = iframeId.document.body.innerHTML;

            }

 

            //getting the response from server 

           content = content.replace("","").replace("","");

          alert(content);

        }

 

    if (iframeId.addEventListener) iframeId.addEventListener("load",eventHandler,true);

    if (iframeId.attachEvent) iframeId.attachEvent("onload", eventHandler);

 

    // Set properties of form...

    form.attr("target", "upload_iframe");

    form.attr("action", action_url);

    form.attr("method", "post");

    form.attr("enctype", "multipart/form-data");

    form.attr("encoding", "multipart/form-data");

 

    

    form.submit();// Submit the form...

 

}

MAC에서 톰캣 8.0.x 설치하기




1. 자바 버전 확인


java -version


톰캣 8.0은 Java SE 7 이후 버전을 필요로 한다. 

( 참조 > http://apache.tt.co.kr/tomcat/tomcat-8/v8.0.8/README.html )


2. 톰캣 다운로드


http://tomcat.apache.org/download-80.cgi 페이지에 접근한 다음


Core : tar.gz 버전을 다운로드 한 후, 파일을 압축 해제(더블클릭) 한다.


3. 파일 이동


터미널에 들어간 이후 아래와 같이 입력하여 배포 경로에 파일을 이동 시켜준다.


sudo mkdir -p /usr/local

sudo mv ~/Downloads/apache-tomcat-8.0.8 /usr/local


4. 다음 최신 버전을 손쉽게 배포하기 위해 아래와 같이 링크를 걸어준다.


sudo rm -f /Library/Tomcat

sudo ln -s /usr/local/apache-tomcat-8.0.8 /Library/Tomcat


5. 톰캣폴더의 접근권한을 부여한다.


sudo chown -R <로그인_아이디> /Library/Tomcat


6. 쉘 실행 권한 부여


sudo chmod +x /Library/Tomcat/bin/*.sh


7. 톰캣 시작

/Library/Tomcat/bin/startup.sh


8. 톰캣 종료


/Library/Tomcat/bin/shutdown.sh




참조 링크 : http://wolfpaulus.com/jounal/mac/tomcat7/


회사에서 사용하는 서버용 컴퓨터 (웹서버 + 파일서버 용도)를 새롭게 설치 함.


OS Ubuntu Desktop 13.10 64 bit

DOWNLOAD > http://www.ubuntu.com/download/desktop



설치 소프트 웨어 및 작업 요약


기존 하드 마운트, 내부 IP고정

웹 : Apache2 + PHP5 +MySQL + Tomcat7 연동포함

원격 : SSH

파일 : samba, FTP

기타 소프트웨어 : chromium, gparted, filezilla



작업시간


약 반나절 정도


후기


예전에 작업해서 속도가 나름 빨라진거 같아서 뿌듯했음.


상세 작업


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

선행작업

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


업데이트

최신으로 업데이트를 수행한다

설정 - 언어지원을 눌러 언어지원을 업데이트 한다


마운트

1. 다른 하드를 설치하고자 하는 경우 반드시 마운트를 해줘야 한다.

2. UUID 확인방법 :sudo blkid

3. 이후 /etc/fstab 에 아래와같이 추가한다.


# added sub hdd in 2014.02.25

UUID=6aca0ea0-beb5-4fcf-97e3-aaaaaaaaaaaa /aaa ext4 defaults 0 2

UUID=da7d9550-9318-4ba4-91c9-bbbbbbb /bbb ext4 defaults 0 2

UUID=62b1c2b3-e127-4941-87d7-cccccc /ccc  ext4 defaults 0 2


IP고정

- 네트워크 연결 - IP4v설정 - 수동

- IP 및 기타 정보 입력


공유기

- 포트포워드 설정

- 외부 IP확인 (나중에 도메인연결을 위함)


도메인설정

카페24에서 설정 정보 확인


APT UPDATE

sudo apt-get update

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

SERVER 설치 프로그램 (ubuntu 13.10 )


[U] : 우분투 소프트웨어 센터에서 다운로드 받음 

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

chromium [U]

웹브라우저


gparted [U]

파티션 나누는 프로그램


gksu [U]

Su그래피컬 프론트엔드

( 13.10에서 samba를 설치하기 위해서 선행 설치 되어야 한다)


samba [U]

파일 공유


MySql Server [U]

설치 후 root 암호 변경 

$ mysql -u root mysql

mysql > update user set password = password('new-password') where user = 'root';

mysql > flush privileges;

MySql Workbench [U]

Mysql Client


Apache2

웹서버

sudo apt-get install apache2


[동작]

sudo service apache2 start

sudo service apache2 stop


[HOME]

/var/www


PHP5

sudo apt-get install php5-common php5 libapache2-mod-php5 php5-mysql

[test.php]

<?php

phpinfo();

?>


Tomcat7

웹서버

sudo apt-get install tomcat7 tomcat7-admin tomcat7-common tomcat7-docs tomcat7-user

user added : tomcat7 / sudo passwd tomcat7 / 123123


[Directory]

http://askubuntu.com/questions/135824/what-is-the-tomcat-installation-directory

/etc/tomcat7/ >> 설정정보 있는 곳

/usr/share/tomcat7-root/ >> 웹 홈


[sudo vi tomcat-users.xml add line]

<user username="aaa" password="bbb" roles="manager-script,manager-gui"/>


Apache2 + Tomcat7 연동


1. MOD JK 설치

sudo apt-get install libapache2-mod-jk


2. 톰켓 리다이렉트 설정

[sudo vi /etc/tomcat7/server.xml]

위 파일에서 아래 부분 주석 해제

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />


3. apache2 worker파일 생성 및 설정

[sudo vi /etc/apache2/workers.properties]

# ajp13 을 사용하는 워커파일 정의 

worker.list=worker1 

# 워커 설정(ajp13)

worker.worker1.type=ajp13 

worker.worker1.host=localhost

worker.worker1.port=8009


4. apache2 jk 모듈 설정

[sudo vi /etc/apache2/mods-available/jk.conf]


JkWorkersFile 설정 경로 변경

JkWorkersFile /etc/apache2/workers.properties


5. JkMount 설정

[sudo vi /etc/apache2/sites-enabled/000-default]

JkMount /HelloWorld* worker1 라인 추가

( /HelloWorld* 접근 경로, worker1 workers.properties에서 설정한 워커


<VirtualHost *:80>

...

JkMount /HelloWorld* worker1

</VirtualHost *:80>


6. 재기동

sudo service tomcat7 restart

sudo service apache2 restart

[참조]

http://thetechnocratnotebook.blogspot.kr/2012/05/installing-tomcat-7-and-apache2-with.html


FTP

FTP SERVER

[설치]

sudo apt-get install vsftpd


[설정]

/etc/vsftpd.conf


local_enable=YES

anonymous_enable=NO

local_umask=022

write_enable=YES

xferlog_enable=YES

xferlog_file=/var/log/vsftpd.log

ftpd_banner=Welcome to FTP service !!

file_open_mode=777


[재시작]

sudo service vsftpd restart 


Filezilla [U]


FTP CLIENT


SSH

[설치]

sudo apt-get install ssh


[설정]

sudo vi /etc/ssh/sshd_config


[재기동]

sudo service ssh start


[동작확인 :22]

netstat -ntl


출처 : http://stackoverflow.com/questions/778385/rails-post-put-get


GET    /items        #=> index
GET    /items/1      #=> show
GET    /items/new    #=> new
GET    /items/1/edit #=> edit
PUT    /items/1      #=> update
POST   /items        #=> create
DELETE /items/1      #=> destroy

엑션     메소드          목적 ------------------------------------------------------------------------- index GET 목록형 자원 표시 show GET 단일 자원 상세 정보 표시 new GET 신규 자원 생성시 폼 표시 create POST 신규 자원 생성(폼 전송) edit GET 기존 존재하는 자원 수정하기 위함 폼 표시 update PUT 기존 존재하는 자원 수정 destroy DELETE 단일 자원 제거


기타 patch : 패치 일부를 수정하는 경우 사용


[참조] put : 전체를 수정하는 경우 사용

http://restcookbook.com/HTTP%20Methods/patch/

예를 들어 사용자의 이름만 바꿀때는 patch, 기타 여러 정보를 한번에 바꿀 경우에는 put을 사용하는 것을 권고한다.

(put은 patch, post와 달리 멱등성을 지니고 있음.)


멱등성 : 같은 연산을 여러번 하더라도 바뀌지 않는 것 

(참조 : http://ko.wikipedia.org/wiki/멱등법칙 )





출처 : http://jsfiddle.net/codingdude/V4xuq/


이메일을 통한 프로필 이미지 로딩 => 간단한 커뮤니티를 만들 때 사용하면 좋을거 같음.



<!-- modify the email attribute here then Run to see the gravatar image change -->

<codingdude-gravatar email="imtough99@gmail.com"></codingdude-gravatar>



var tagname = "codingdude-gravatar";

        document.createElement(tagname);

//find all the tags occurrences (instances) in the document

var tagInstances = document.getElementsByTagName(tagname);


//for each occurrence run the associated function

for ( var i = 0; i < tagInstances.length; i++) {

  codingdudeGravatar(tagInstances[i]);

}

function codingdudeGravatar(element){


//code for rendering the element goes here

if (element.attributes.email){


//get the email address from the element's email attribute

var email = element.attributes.email.value;

var gravatar = "http://www.gravatar.com/avatar/"+md5(email)+".png";

element.innerHTML = "<img src='"+gravatar+"'>";

}

}


    


"call 과 apply의 차이점 ? " ... 요약하면


동작은 동일, 단 2번째 파라미터가 다름.


출처 : http://odetocode.com/blogs/scott/archive/2007/07/04/function-apply-and-function-call-in-javascript.aspx


In order to explain how the createDelegate function works in the last post, we have to understand JavaScript closures and Function.apply(). The apply() method is the easiest subject to tackle, so we'll start there and work up.

Every function in JavaScript has a number of attached methods, including toString()call(), and apply(). If it sounds odd to you that a function might have its own methods - then remember that every function in JavaScript is an object. Read this article for a refresher. You might also wonder what the difference is between a function and a method. I believe the descriptors 'function' and 'method' are just a JavaScript convention. Functions stand on their own (there is an alert()function, for example), while methods are functions inside an object's dictionary, and we invoke them through the object reference. Every JavaScript object has atoString() method, for example, and we can use the toString() method on a function object to see its source code:

function foo()
{
    alert('x');
}
 
alert(foo.toString());

Because functions are objects they can have their own properties and methods, and we can treat them like data. "Functions as data" is important to remember for the next post, too, but for now we'll focus on two of a function's methods: apply(), and its counterpart: call().

Let's start with the following code:

var x = 10;
 
function f()
{
    alert(this.x);
}
 
f();

Here we have a global function by the name of f(). f() uses the this keyword to reference x, but notice we don't invoke the function through an instance of an object. So what object does this reference? this will reference the global object. The global object is where we defined the variable x. The above code does work and will show the value 10 in a dialog.

Both call() and apply() are methods we can use to assign the this pointer for the duration of a method invocation. As an example, here is how we could use thecall() method:

var x = 10;
var o = { x: 15 };
 
function f()
{
    alert(this.x);
}
 
f();
f.call(o);

The first invocation of f() will display the value of 10, because this references the global object. The second invocation (via the call method) however, will display the value 15. 15 is the value of the x property inside object o. The call() method invokes the function and uses its first parameter as the this pointer inside the body of the function. In other words - we've told the runtime what object to reference as this while executing inside of function f().

Fiddling with the this pointer might sound funny, even perverse, to C++, Java, and C# programmers. What's next? Dogs sleeping with cats? Working nVidia drivers for Windows Vista? It's all part of the fun that is ECMAScript.

We can also pass arguments to the target function via call():

var x = 10;
var o = { x: 15 };
function f(message)
{
    alert(message);
    alert(this.x);
}
 
f("invoking f");
f.call(o, "invoking f via call");

The apply() method is identical to call(), except apply() requires an array as the second parameter. The array represents the arguments for the target method.

var x = 10;
var o = { x: 15 };
function f(message)
{
    alert(message);
    alert(this.x);
}
 
f("invoking f");
f.apply(o, ["invoking f through apply"]);

The apply() method is useful because we can build a function like createDelegate (from the last post) that doesn't care about the signature of the target method. The function can use apply() to pass all additional arguments to the target method via an array. Are we getting close to a curry function?

var o = { x: 15 };
 
function f1(message1)
{
    alert(message1 + this.x);
}
 
function f2(message1, message2)
{
    alert(message1 + (this.x * this.x) + message2);
}
 
function g(object, func, args)
{
    func.apply(object, args);
}
 
g(o, f1, ["the value of x = "]);
g(o, f2, ["the value of x squared = ", ". Wow!"]);

The problem here is the awkward syntax. We are forcing the caller to stuff arguments into an array just so we call apply(). Fortunately, there is a way to make the syntax easier, but we have to introduce one more topic: the arguments identifier.

In JavaScript, every function essentially has a variable length argument list. The means we can pass 5 parameters to a function even if the function only uses one argument. The following runs without error and displays "H":

function f(message)
{
    alert(message);
}
 
f("H", "e", "l", "l", "o");

If we did want to access the other arguments from inside f(), we can use the arguments keyword. arguments references an Arguments object, which has a length property and feels like an array.

function f(message)
{
    // message param is the same as arguments[0]   
    
    for(var i = 1; i < arguments.length; i++)
    {
        message += arguments[i];
    }
     
    alert(message);
}
 
// this will say "Hello"
f("H", "e", "l", "l", "o");

Just so you know, arguments is technically not an array, even if it walks and talks like one. arguments has a length property but no splitpush, or pop methods. What we can do with arguments inside our previous g() function is copy the incoming arguments after arguments[1] into an array object that we pass to apply.

var o = { x: 15 };
 
function f(message1, message2)
{
    alert(message1 + (this.x * this.x) + message2);
}
 
function g(object, func)
{          
    // arguments[0] == object
    // arguments[1] == func
     
     
    var args = []; // empty array
    // copy all other arguments we want to "pass through"
    for(var i = 2; i < arguments.length; i++)
    {
        args.push(arguments[i]);
    }
 
    func.apply(object, args);
}
 
g(o, f, "The value of x squared = ", ". Wow!");

When we invoke g(), we can pass additional arguments as parameters instead of stuffing the arguments into an array.

At this point, we have the theoretical knowledge needed to understand call and apply, but perhaps you are already asking a question: what if I don't want to immediately invoke the target function f()? What if I just want to arrange all the players in this little drama so that I can invoke f() at some later point (as an event handler, for example), but still have this referencing the desired object (whithout tracking the desired object myself). In an upcoming post, we'll see how to combine our Function.apply and arguments knowledge with the concept of nested functions and closures to answer this very question.

underscore 메소드 정리

https://github.com/epeli/underscore.string


우리나라 사정상( 한글을 사용한다는 점) 의외로 쓰기 애매한 메소드가 많은것 같다.


개인적으로 프로젝트에서 쓸만한 것만 표시해 봤다.



method

priority

description

camelize

0

대쉬 또는 언더스코아 문자열을 제거하고 카멜케이스 형태로 보여준다(첫문자 유지)
capitalize

0

단어 첫번 째 대문자화
chars

1

한 단어로 자르기
chop

0

글자수 대로 자르기
classify

0

카멜 케이스 형태로 전환한다 (첫문자는 항상 대문자)
clean

0

앞 뒤 중간에 공백 제거, 중간은 1글자만 공백 유지
count

1

문자열에 특정 단어 포함 횟수 계산
dasherize

0

카멜 케이스 형태를 데쉬 연결로  전환한다(대쉬로 시작함)
endsWith

1

문자열이 특정 단어로 끝나는지 여부
escapeHTML

1

특수문자 교체
humanize

0

사람이 읽기 편한 형태로 전환한다 ( 첫문자 대문자화, 양쪽 공백 제거, 대쉬/언더스코어 공백으로 대치)
include

1

단어 포함여부 확인
insert

1

특정 위치에 문자열 삽입
isBlank

1

공백 여부 확인
join

1

문자열 합치기
levenshtein

0

문자열 다름 수치
lines

0

줄바꿈이 포함되면 나눈 이후 배열에 넣어준다
lpad

1

왼쪽 PAD
lrpad

0

양쪽 PAD
ltrim

0

왼쪽만 공백제거
numberFormat

1

숫자 컴마처리
pad

0

지정 길이 만큼 특정 단어로 채워 넣는다
prune

0

truncate 업그레이드 버전 / 단어가 중간에 짤리는 것을 방지 이전에서 자름 처리
quote

0

입력 단어에 따옴표를 넣어준다
repeat

0

입력 단어를 n번 반복한다
reverse

0

단어를 역전(뒤집어)한다
rpad

1

오른쪽 PAD
rtrim

0

오른쪽만 공백제거
slugify

0

URL에 넣을 수 있는 영단어로 변환한다 ( 공백 대쉬교체, 악센트 제거, 특수문자 제거)
splice

0

특정 위치의 단어를 교체한다
sprintf

1

c의 문자열 포멧팅과 유사
startsWith

1

문자열이 특정 단어로 시작하는지 여부
stripTags

1

태그를 제거한 문자열을 반환한다
strLeft

0

좌측 기준 특정 문자가 처음 나오는 곳 이후의 왼쪽 문자열 반환
strLeftBack

0

우측 기준 특정 문자가 처음 나오는 곳 이후의 왼쪽 문자열 반환
strRight

0

좌측 기준 특정 문자가 처음 나오는 곳 이후의 오른쪽 문자열 반환
strRightBack

0

우측 기준 특정 문자가 처음 나오는 곳 이후의 오른쪽 문자열 반환
succ

0

단어의 다음 알파벳을 반환한다
surround

0

입력 단어를 특정 단어로 둘러 쌓은다.
swapCase

0

대소문자 교체
titleize

0

단어 시작 알파벳을 대문자로 변환한다
toBoolean

1

문자열을 boolean 형태로 변환해 준다.
toNumber

1

문자열을 숫자로 바꿔준다(소숫점아래 지정 가능, 변환 불가시 NaN 반환)
toSentence

0

문자열 배열을 사람이 읽기 편한 형태로 연결하여 보여준다( , , and )
toSentenceSerial

0

문자열 배열을 사람이 읽기 편한 형태로 연결하여 보여준다 ( 무조건 , 를 넣어준다 )
trim

1

공백제거, 특정단어 양쪽끝 제거기능 포함
truncate

1

지정한 길이로 말줄임처리
underscored

0

카멜 케이스 형태를 소문자/언더스코어 연결로  전환한다
unescapeHTML

1

교체된 특수문자를 돌려 놓음
unquote

0

입력 단어의 따옴표를 제거한다
words

0

단어를 공백 또는 특정 문자기준으로 자른 이후 배열에 넣어 반환


select DATE_FORMAT(a.Date ,'%Y%m%d')  dates
from (
    select curdate() - INTERVAL (a.a + (10 * b.a) + (100 * c.a)) DAY as Date
    from (
               select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as a
    cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as b
    cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as c
) a
where a.Date between '2014-01-14' and date_format(now(),'%Y-%m-%d')


얼마전(2013년 10월 즘, 그러니 약 2개월 방치했었네요... ) 에 맥북에 아래와 같은 증상이 발생하였습니다.


"WIFI 목록은 보이는데 연결하려면 라우터가 가까이 있는지 확인해 보세요" 하면서 연결이 안되는 현상 발생


그래서 클린 설치도 해 보고 네트워크 목록도 지웠다가 다시 등록해도 안되네여 ...


맥북을 처음 구매 했을때 부터 그런건 아니여서 정말 당황 스러웠습니다.


그래서 서비스 센터에 연락하여 문의 한 결과 아래와 같은 조치 방법을 알려 주었습니다.


맥북 smc(?) 초기화 방법


1. 맥북의 전원을 끈다.

2 .shift + control + option 키를 누른 상태에서 전원 버튼을 약 2초간 누른다.

3. shift + control + option 키를 누른 상태에서 전원 버튼을 1번 누른다.

4. 전원 버튼을 눌러 부팅한다.


알려주신대로 위와같이 하니깐 무선랜이 연결되면서 정상적인 인터넷 라이프를 즐길 수 었었습니다.

(그전에는 안되서 랜선으로 연결해서 인터넷을... ㅜㅜ)


다들 즐거운 맥 라이프 즐기세요... 저와 같은일이 없어야 될텐데. 

( 참고로 위 문제는 하드웨어적 문제라 하네요... 뽑기 운이 별로인가 봐여... )

+ Recent posts