기본 콘텐츠로 건너뛰기

10월, 2013의 게시물 표시

Genymotion 에서 Unroot/Root 상태 전환하기 위한 쉬운 방법.

Genymotion은 지옥 성능의 안드로이드 에뮬에 비해 확실히 쾌적하고 아름다운 툴이다. 최근 롬을 보면 기본 Su 설치 상태로 나오는데 일부 Root을 검사하는 앱에서 사용 제한이 걸리곤 한다. 멀티터치 같은 걸 시뮬하기 위해서 DroidMote를 사용한다던가 하는 용도를 봤을땐 Root가 필요하고 여러가지 이유로 개발환경에선 Root/Unroot를 다 쓸 수 있으면 좋다. Genymotion Configuration 아이콘을 찍고 Save 버튼 위 Always allow su access (bypass Superuser app)에 체크박스를 켜준다. Save 하면 아마 재부팅을 한다고 할 것이다. 재부팅하자. 요즘은 SuperSu 가 간단하니 SuperSu를 스토어에서 받자. 몇몇 가지를 묻는데 특별한 롬을 쓰느냐 물을 때 Normal 이랑 충돌이 있으니 기존 Su앱을 지우겠느냐에서 등등 상식적인 걸 체크하고 SuperSu를 다시 실행. 이제부턴 설정창에서 Su를 간편하게 껐다 켰다 할 수 있다.

meteor 에서 E-mail 인증하기

MAIL_URL은 gmail을 쓸 경우 다음과 같이 설정하면 된다. smtp:// 사용자계정 %40gmail.com: 계정암호 @smtp.gmail.com:465/ 혹은 google apps 계정은 경우 smtp:// 사용자계정 %40 구글Apps도메인 : 계정암호 @smtp.gmail.com:465/ ---- 가입자 확인 메일 발송엔 몇가지 문제가 있는데 1. Text로 메일을 보낸다. 2. Formatted 형식을 사용할 수 없다. 이건 내가 생각해봐도 좀 아니다 싶다. server 쪽에서 startup 할때 기존 Accounts.emailTemplate과 Accounts.sendVerificationEmail 등등이 제대로 작동하도록 바꿔치기 해주자. :: email.coffee Meteor.startup ->   # set Mail configuration   Email = Package.email.Email;   _.extend Accounts.emailTemplates,     from: "Gearlounge <no-reply@gearlounge.com>"     verifyEmail:       subject: (user)->         "#{"#{user.profile.displayName}님, "if (user.profile and user.profile.displayName)?}가입을 환영합니다."       html: (user, url)->         Handlebars.templates['verifyEmail'](           user: user.profile && user.profile.displayName           verifyEmailUrl: url           urlHome: Meteor.abs

Could not locate package.js 오류가 발생하면서 mrt/meteor 가 실행 안될때

/packages 디렉토리를 죄다 .gitignore로 등록해서 온 프로젝트가 있어서 지우고 다시 했더니 Could not locate package.js .. 오류가 발생했다. https://github.com/DiscoverMeteor/Microscope/issues/11 이 글을 참조. mrt uninstall --system 하고 다시 실행했더니 잘된다. 다행이네 다행이야.

node.js에서 angular.js 같은 동적 웹페이지를 사용할 때 crawling 문제

이전글 ( http://spectrumdig.blogspot.kr/2013/10/spiderable-package.html )에서 meteor가 어떻게 봇들에게 렌더링된 이후의 html을 전달하는지 보았다. 근데 만일 node.js에서 같은 구현을 해야한다면? 역시 request를 까발려서 _escaped_fragment_ 가 있는지 user-agent가 어떤 것인지 분별하면 된다. 방법이야 여러가지가 있을 텐데 preprocessor를 사용하여 가로채서 조건에 맞으면 처리하고 아닐 경우 next()로 포워딩하는 방법이 있고 ( https://github.com/acidsound/pushpot/blob/master/app.js#L30 ) Express/Connect Middle-ware를 사용하여 app.use(function(req, res, next){   if (req.query._escaped_fragment_ ||     [/^facebookexternalhit/i, /^linkedinbot/i, /^twitterbot/i].some(function(v) {       return v.test(req.headers['user-agent']);     })) {       // render by phantomJS       res.send(getHTMLfromPhantomJS(req.url));   } else {     next();   } 이런 식으로 처리해주면 되겠다.발로 짜서 실제 작동 여부는 모르겠다. getHTMLfromPhantomJS 는 물론 직접 구현하시라 :p https://github.com/meteor/meteor/blob/devel/packages/spiderable/spiderable.js 이런식으로 구현하면 됨.

spiderable package를 살펴보았다.

동적페이지를 만들면 웹크롤러들이 찌르러 왔다가 빈손으로 돌아가곤 한다. 이래서야 안될일. 발번역부터 시작해보자. // list of bot user agents that we want to serve statically, but do // not obey the _escaped_fragment_ protocol. The page is served // statically to any client whos user agent matches any of these // regexps. Users may modify this array. // // An original goal with the spiderable package was to avoid doing // user-agent based tests. But the reality is not enough bots support // the _escaped_fragment_ protocol, so we need to hardcode a list // here. I shed a silent tear. 우리가 정적으로 제공하고 싶지만 _escaped_fragment_ 프로토콜을 따르지 않는 봇 사용자 에이전트의 목록입니다. 페이지는 사용자 에이전트가 이러한 정규식 중 하나와 일치하는 모든 클라이언트에 정적으로 제공합니다. 사용자는 이 배열을 변경할 수 있습니다. spiderable 패키지와 원래 목표는 사용자 에이전트 기반의 테스트를 실시하는 것을 피하기 위해서였다. 하지만 현실은 봇들은 _escaped_fragment_ 프로토콜을 지원하지 않기 때문에, 여기에서는 목록을 하드 코딩해야합니다. 나는 조용히 눈물을 흘렸다. Spiderable.userAgentRegExps = [     /^facebookexternalhit/i, /^linkedinbot/i, /^twitterbot/i]; 요놈들! 말을 듣지 않는 나쁜 아이들이 니 놈들이렸다! 이 오라질 것들! 아래와 같