기본 콘텐츠로 건너뛰기

6월, 2017의 게시물 표시

RxJS Common Mistakes

https://egghead.io/courses/save-time-avoiding-common-mistakes-using-rxjs Convert RxJS Subjects to Observables The use of RxJS Subjects is common, but not without problems. In this lesson we will see how they can be usually safely replaced with plain Observables. Sometimes you may write code in RxJS that uses subjects. While subjects have a legitimate use cases, most of the times, they are actually unnecessary. In this case, for instance, we have a subject called click stream. Whenever a click event happens in this event listener, we will send that event into the subject using the .next method. There are a couple reasons why this is a bad idea. First of all is that the click stream is now exposed here for any other script in the page to send events into it, so you may get confused how does this click stream work. You need to search for all of the usage of .next throughout the whole codebase. That may get confusing. The second reason is that the event listener here is not being dis

raspberryPi zero 에서 USB 네트웍 연결이 안될 때.

집에선 안되고 밖에선 잘되는 알 수 없는 USB 네트웍 연결 raspberryPi Zero가 연결 안된 상태에서 ping 을 했을 때 $ ping raspberrypi.local PING raspberrypi.local (218.38.137.28): 56 data bytes 64 bytes from 2xx.xx.xxx.xx: icmp_seq=0 ttl=53 time=3.452 ms 64 bytes from 2xx.xx.xxx.xx: icmp_seq=1 ttl=53 time=2.664 ms 64 bytes from 2xx.xx.xxx.xx: icmp_seq=2 ttl=53 time=3.632 ms 64 bytes from 2xx.xx.xxx.xx: icmp_seq=3 ttl=53 time=5.183 ms 64 bytes from 2xx.xx.xxx.xx: icmp_seq=4 ttl=53 time=3.374 ms 64 bytes from 2xx.xx.xxx.xx: icmp_seq=5 ttl=53 time=3.516 ms ^C 이렇게 다른 놈이 잡고 있어서다. 다른 네트웍(가령 테더링)으로 연결 후 ssh pi@raspberrypi.local 로 접근(기본 암호는 raspberry) 후 잘되면 sudo vi /etc/hostname 하여 기존 raspberrypi 를 적절한 것으로 변경하고 raspberryPi Zero를 재부팅 후 ssh pi@<변경한 hostname>.local ( <>는 입력하지 않음) 으로 접속한다.

Cycle.js 의 Driver에 대한 이야기

왜 이름이 Driver 인가 OS에서 외부하드웨어와 연결하는 소프트웨어를 Driver라고 하는데 외부로부터 영향(effect)를 주고 영향을 받는다는 점에서 아이디어를 얻음. DOM Driver Sink가 없는 형태의 Driver function WSDriver(/* no sinks */) {   return xs.create({     start: listener => {       this.connection = new WebSocket('ws://localhost:4000');       connection.onerror = (err) => {         listener.error(err)       }       connection.onmessage = (msg) => {         listener.next(msg)       }     },     stop: () => {       this.connection.close();     },   }); } websocket의 예 Driver 만드는 법 function myDriver(sink$, name /* optional */) 부터 시작. 다시 Sock(가짜 실시간 리얼타임 채널 API) 구현 // Establish a connection to the peer let sock = new Sock('unique-identifier-of-the-peer'); // Subscribe to messages received from the peer sock.onReceive(function (msg) {   console.log('Received message: ' + msg); }); // Send a single message to the peer sock.send('Hello world'); 이렇게 일단 가정. effect가 어떤 것인지 가려내

Meteor DDP 완전분석 - All about DDP

한번은 정리해야지 하는 생각으로 Websocket 모니터를 열고 DDP를 하나하나 각개 격파해보려고 한다. 클라이언트에서 요청별로 서버 응답 내용을 정리해보았다. 로그인 없을 때 접속 14:07:20.485   {'msg':'connect','version':'1','support':['1','pre2','pre1']} 14:07:20.486 a {'server_id':'0'} 14:07:20.634 a {'msg':'connected','session':'wqr3vuoJSYXvHLKyR'} 정해진 JSON을 단순하게 전송하고 { msg: connected } 를 받는다. 단순! meteor_autoupdate_clientVersions 요청 14:07:20.486   {'msg':'sub','id':' nhyS7NmraDAk8Y5Nc ','name':'meteor_autoupdate_clientVersions','params':[]} 14:07:20.636 a {'msg':'added','collection':'meteor_autoupdate_clientVersions','id':'HgGFXuNFEw4TeHb7S','fields':{'current':true}} 14:07:20.639 a {'msg':'added','collection':'meteor_autoupdate_clientVersions','id':'version','fields