반응형
반응형

Everything You Should Know About Progressive Web Apps

What is a Progressive Web App

In its core a progressive web app isn’t any different from a normal website – it’s made of HTML, CSS and JavaScript, and lives in the browser. What separates PWAs from regular websites is a list of 10 key concepts that need to be fulfilled. Here they are, taken directly from the Google Developers website.

  1. Safe – Served via HTTPS to prevent snooping and ensure content hasn’t been tampered with.
  2. Progressive – Work for every user, regardless of browser choice because they’re built with progressive enhancement as a core tenet.
  3. Responsive – Fit any form factor: desktop, mobile, tablet, or whatever is next.
  4. Connectivity-independent – Enhanced with service workers to work offline or on low quality networks.
  5. App-like – Feel like an app to the user with app-style interactions and navigation because they’re built on the app shell model.
  6. Fresh – Always up-to-date thanks to the service worker update process.
  7. Discoverable – Are identifiable as “applications” thanks to W3C manifests and service worker registration scope allowing search engines to find them.
  8. Re-engageable – Make re-engagement easy through features like push notifications.
  9. Installable – Allow users to “keep” apps they find most useful on their home screen without the hassle of an app store.
  10. Linkable – Easily share via URL and not require complex installation.


What a Progressive Web App is NOT

The concept of PWAs shouldn’t be confused with:




앞서 언급 한 모든 기술은 HTML 앱을 포장하여 .apk , .exe 또는 기타 다른 앱 파일처럼 실행 파일로 패키지화합니다.이 파일 은 각 앱 스토어에서 다운로드 받아 사용자 기기에 설치해야합니다.

 

PWA는 설치가 필요하지 않으며 Google Play 또는 iTunes App Store에서 사용할 수 없습니다. PWA를 다운로드하려면 웹 사이트를 방문한 다음 홈 화면에 바로 가기로 저장해야합니다. 별도의 iOS 및 Android 버전을 개발하고 유지 관리하는 것은 더 이상 문제가되지 않지만 브라우저 지원을 고려해야합니다.



반응형
반응형

[NodeJS] Realtime Chat with Node.js


http://tutorialzine.com/2014/03/nodejs-private-webchat/


In this tutorial, we are going to build a realtime chat system with Node.js and the socket.io library. The chat permits users to create private chat rooms that they can share with a friend. For avatars, we will use gravatar. You can run the chat locally with node, or push it to heroku or a different cloud service provider.

The code

You can grab the source code from the download button above. It has plenty of comments and is easy to follow. Start with the app.js file and read from there. Here are a few things to look for:

  • All dependencies are declared in the package.json file. They are not included in the zip and you will have to run npm install to get them.
  • We are using separate JavaScript files for the configuration and routes, to make the code more manageable.
  • In the routes file, socket.io stores the username, avatar and room of the person as properties of the socket object itself. This saves us a lot of code and makes managing rooms easy.
  • We use socket.io‘s rooms feature to isolate one chat from another, which is exactly what that feature was developed for.
Enter your name to chat

Enter your name to chat


반응형
반응형
성공적인 Google 팀의 다섯 가지 핵심 요소


https://rework.withgoogle.com/blog/five-keys-to-a-successful-google-team/




Google의 인력 운영 팀 (인사 부서)은 데이터와 엄격한 분석을 사용하여이 질문에 답변했습니다 . Google 팀이 효과적인 이유는 무엇입니까? 우리는 오늘 AP 통신 과 함께 우리의 연구를 공유했으며, 여기에서도 결과를 공유하고 있습니다.


2 년 동안 Google 직원 (Google 직원)과 200 회 이상의 인터뷰를했으며 180 개 이상의 적극적인 Google 팀의 250 가지 이상의 특성을 조사했습니다. 우리는 별의 팀에 필요한 개인의 특성과 기술을 완벽하게 조합 할 수있을 것이라고 확신했습니다. 하나의 Rhodes Scholar, 두 명의 외향적 인 사람, AngularJS의 바위 인 엔지니어 한 명, PhD. 빌라. 드림 팀이 조립 했지?


우린 죽었어. 누가 팀에하면 팀 구성원이 구조 작업을, 상호 작용, 그들의 기여를 보는 방법보다 중요하다. 그 마법 알고리즘에 너무 많은 것들이 있습니다.


성공적인 팀을 Google의 다른 팀과 차별화시키는 핵심 역학이 5 가지 있음을 알게되었습니다.


  1. 심리적 안전성 : 우리는 불안하거나 당혹감을 느끼지 않고이 팀에서 위험을 감수 할 수 있습니까?

  2. 신뢰성 : 우리는 시간을두고 고품질의 작업을 할 수 있다고 서로 믿을 수 있습니까?

  3. 구조 및 명확성 : 팀의 목표, 역할 및 실행 계획이 명확합니까?

  4. 일의 의미 : 우리는 우리 각자에게 개인적으로 중요한 무엇인가를 연구하고 있습니까?

  5. 업무의 영향 : 우리가하는 일이 근본적으로 중요하다고 생각합니까?

위의 다섯 가지 질문에 "예"라고 대답하면 축하드립니다! 당신은 아마도 우수한 팀에 속해있을 것입니다. 그리고 그렇지 않다면 모든 희망이 사라지지 않습니다. 이것은 초점을 맞출 수있는 곳, 나아질 수있는 방법 및 구조화 된 방식으로 동료와이 개념을 이야기하는 방법을 찾는 데 도움이되는 바로 가기입니다.


심리적 안전 : https://www.youtube.com/watch?v=LhoLuui9gX8


[TED 강연] 켈리 맥고니걸 (Kelly McGonigal) "스트레스를 친구로 만드는 법 (How to make stress your friend)"







.

반응형
반응형

코딩 교육 : https://codility.com/programmers/


http://codecademy.com/

반응형
반응형

Apache Kafka - 분산 스트리밍 플랫폼


http://kafka.apache.org/


Apache Kafka

카프카(kafka)는 분산 스트리밍 플랫폼(Distributed streaming platform)이다. 분산 스트리밍 플랫폼은 아래의 기능을 가지고 있어야 한다.

  1. 데이터 스트림을 게시(Publish)하고 구독(Subscribe)할 수 있어야 한다. 이 점에서 메시지 큐 혹은 엔터프라이즈 메시징 시스템과 유사한 면이 있다.
  2. 내결함성(장애에 대한 내성)을 가지고 있어야 한다. 스트리밍 플랫폼을 구성하는 노드에 문제가 생기더라도 데이터를 안전하게 저장 할 수 있어야 한다.
  3. 데이터 스트림을 처리 할 수 있어야 한다.

카프카는 분산 스트리밍 플랫폼이 가져야 하는 위의 기본적인 기능을 가지고 있다. 카프카는 아래의 응용프로그램을 개발하는데 유용하게 사용 할 수 있다.

  1. 시스템과 시스템 혹은 시스템과 애플리케이션 사이에 안전한 데이터 전송을 위한 실시간 스트리밍 데이터 파이프라인 구축
  2. 데이터 스트림을 변환하거나 이를 받아서 즉시 처리하는 실시간 스트리밍 애플리케이션의 구축

카프카가 어떻게 이런일을 하는지 살펴보자. 아래 카프카의 주요 컨셉을 설명하고 있다.

  • 카프카는 하나 이상의 서버로 구성되는 클러스터에서 작동한다.
  • 카프카 클러스터는 토픽(topics)라고 부르는 파이프라인에 데이터 레코드 스트림을 저장한다.
  • 각각의 레코드는 키, 값, 타임스탬프로 구성된다.

카프카의 주요 API들은 아래와 같다.

  • Producer API : 애플리케이션은 이 API를 이용해서 하나 이상의 카프카 토픽에 스트림 레코드를 게시할 수 있다.
  • Consumer API : 애플리케이션은 이 API를 이용해서 하나 이상의 카프카 토픽으로 부터 스트림 레코드를 구독 할 수 있다.
  • Streams API : 애플리케이션이 하나 이상의 토픽에서 입력 스트림을 읽고 변환해서 하나 이상의 출력 토픽으로 스트림을 보낼 수 있도록 한다.
  • Connector API : Connector를 이용해서 재 사용 가능한 Producer 혹은 Consumers를 카프카 토픽에 연결 할 수 있다. 예를 들어 관계형 데이터베이스 컨넥터는 테이블에 대한 변경 사항을 캡처할 수 있다.

아래 그림은 카프카의 구성요소들을 보여주고 있다. 이들 구성요소들은 위의 주요 API를 이용해서 주어진 일을 한다.


참고

.

반응형
반응형

Python socket programming



Python socket programming

1. Python : Socket Program Produced by Tae Young Lee

2. 클라이언트/서버 아키텍처 서버가 하나 이상의 클라이언트(사용자)에게 '서비스'를 제공 listen

3. Socket • 소켓은 '통신 종단점'이라는 개념을 구체화한 컴퓨터 네트 워크 데이터 구조 • 네트워크를 사용하는 애플리케이션은 통신을 시작하기 전 에 항상 소켓을 만들어야 함 • 소켓 없이는 통신을 시작할 수 없음 • 원래 소켓은 실행중인 프로그램(프로세스)이 같은 호스트 안에 실행 중인 다른 프로그램과 통신하기 위해 개발됨

4. Socket 유형 • 유닉스 소켓 – AF_UNIX 라는 '패밀리 이름' 을 가진다. AF는 주소 패밀리(Address family)를 의미. – 쉽게 클라이언트와 서버가 유닉스 환경의 동일한 컴퓨터에 존재해야 한다는 뜻. – 이 소켓은 파일 기반이다. 소켓의 기반 구조가 파일 시스템을 통해 지원됨 – 파일 시스템은 같은 호스트에서 실행 중인 프로세스 사이에 지속적으 로 공유되므로, 합리적인 방법이라고 할 수 있다. • 네트워크 기반 – 패밀리 이름은 AF_INET 이다. – 클라이언트와 서버가 인터넷 어디서든 존재할 수 있다는 의미를 갖는 다 • 파이썬은 AF_UNIX, AF_NETLINK, AF_TIPC, AF_INET{,6} 패 밀리를 지원

5. 연결 방식에 따른 분류 • 연결 지향 소켓(connection oriented) – 통신을 하기 전에 반드시 연결 돼 있어야 한다(전화를 거는 것과 유사) – 레코드 경계 없이 데이터를 순서대로 신뢰성 있게 중복없이 전 달. 각 메세지는 여러 조각으로 나뉘어서 반대편에 확실히 전달 된 다음에 다시 순서대로 한데 묶인 후 기다리는 애플리케이션 에 전달 – 연결 지향 소켓을 구현한 프로토콜(protocol)로는 전송 제어 프 로토콜(TCP, Trasmission Control Protocol) 이 있으며, 이 소켓을 만드려면 소켓 유형으로 SOCK_STREAM(스트림 소켓)을 지정 – 이 소켓은 네트워크상에서 IP를 호스트를 찾기 위해 사용하기 때 문에 두 프로토콜의 이름을 붙여 TCP/IP 라고 함.

6. • 비연결형 소켓(connectionless) – 스트림 소켓과 대비되는 데이터그램(Datagram) 유형의 비연결 – 통신 시 최초 연결하는 과정이 필요 없음 – 데이터 전달 과정에서 순서나 신뢰성 이나 중복 방지를 보장할 수 없음. 이는 메세지가 연결 지향 소켓처럼 조각으로 나뉘지 않 고 통째로 송신된다는 것을 의미(우편 서비스에 비유) – 연결 지향 소켓은 가상 회선을 맨 처음 만들고 유지하기 위해 상 당한 부가 비용이 발생 비연결 지향 소켓은 이런 부담이 덜하고 성능면에서 더 좋다. – 데이터그램 소켓을 구현한 프로토콜로는 (UDP, User Datagram Protocol)이 있고, UPD 소켓을 만들려면 SOCK_DGRAM을 소켓 유형으로 지정. – 이 소켓도 IP를 네트워크상에서 호스트를 찾기 위해 사용 UPD/IP라고도 부름

7. Socket의 동작 과정

8. conn.close() from socket import * svrsock = socket(AF_INET, SOCK_STREAM)

9. conn.close() from socket import * svrsock = socket(AF_INET, SOCK_STREAM) svrsock.bind(('127.0.0.1', 7799))

10. conn.close() from socket import * svrsock = socket(AF_INET, SOCK_STREAM) svrsock.bind(('127.0.0.1', 7799)) svrsock.listen(1)

11. conn.close() from socket import * svrsock = socket(AF_INET, SOCK_STREAM) svrsock.bind(('127.0.0.1', 7799)) svrsock.listen(1) conn, addr = svrsock.accept() addr ('127.0.0.1', 50933)

12. conn.close() from socket import * svrsock = socket(AF_INET, SOCK_STREAM) svrsock.bind(('127.0.0.1', 7799)) svrsock.listen(1) conn, addr = svrsock.accept() addr ('127.0.0.1', 50933) conn.recv(1024)

13. conn.close() from socket import * svrsock = socket(AF_INET, SOCK_STREAM) svrsock.bind(('127.0.0.1', 7799)) svrsock.listen(1) conn, addr = svrsock.accept() addr ('127.0.0.1', 50933) conn.recv(1024) conn.close()

14. conn.close() from socket import * clientsock = socket(AF_INET, SOCK_STREAM)

15. conn.close() from socket import * clientsock = socket(AF_INET, SOCK_STREAM) clientsock.connect(('127.0.0.1',7799))

16. conn.close() from socket import * clientsock = socket(AF_INET, SOCK_STREAM) clientsock.connect(('127.0.0.1',7799)) clientsock.send('Hi, it is me.')

17. Blocking & Non-Blocking • blocking 모드일 때 accept, recv, send 호출할 때 연결하려 고 하는 client 가 없을 때 무한정 기다리는 것 • non-blocking 모드일 때는 위와 같은 상황에서 일정한 시 간을 기다려도 응답이 없을 때 예외가 발생

18. • https://pl.python.org/docs/lib/socket-objects.html • setblocking(flag) Set blocking or non-blocking mode of the socket: if flag is 0, the socket is set to non- blocking, else to blocking mode. Initially all sockets are in blocking mode. In non- blocking mode, if a recv() call doesn't find any data, or if a send() call can't immediately dispose of the data, a error exception is raised; in blocking mode, the calls block until they can proceed. s.setblocking(0) is equivalent to s.settimeout(0); s.setblocking(1) is equivalent to s.settimeout(None). • settimeout(value)Set a timeout on blocking socket operations. The value argument can be a nonnegative float expressing seconds, or None. If a float is given, subsequent socket operations will raise an timeout exception if the timeout period value has elapsed before the operation has completed. Setting a timeout of None disables timeouts on socket operations. s.settimeout(0.0) is equivalent tos.setblocking(0); s.settimeout(None) is equivalent to s.setblocking(1). New in version 2.3. • gettimeout()Return the timeout in floating seconds associated with socket operations, or None if no timeout is set. This reflects the last call tosetblocking() or settimeout(). New in version 2.3. 위와 같이 기본적으로는 blocking 모드이다. non-blocking mode를 이용하려면 setblocking(flag)을 이용해 non- blocking mode 로 가거나 아니면 settimeout 을 이용해 non-blocking mode 로 전환하면 된다.

19. 위와 같이 socket 객체를 생성하고 gettimeout을 하면 처음에 아무 것도 볼 수 없음 blocking mode (default) 이므로 값이 무한대임을 의미 그 다음에 setblocking() 을 이용해 non-blocking mode로 변환한 후 gettimeout을 호출하면 0.0 이 나옴 non-blocking mode의 default time out value는 0.0 임

20. 위의 상황에서 생성된 socket 객체를 제거하고 다시 socket을 생성하면 default 이므로 blocking mode 임을 확인 (gettimeout) 여기서 setblocking 을 이용하지 않고 바로 settimeout 을 이용해도 원하는 timeout을 시간을 가진 non-blocking mode 로 변환되는 것을 확인

21. Example • 다음은 blocking mode 의 간단한 예제이다. Server 측 : localhost connection 이고 8000 port 를 binding 한 후 accept 함수를 호출해 client 와의 connection을 기다리고 있다.

22. • Client 측 : non-blocking mode 이고 timeout 이 3.5 초이 다. connect 을 통해 서버와 연결 된 후 non-blocking mode로 변환되고, recv 를 통해 3.5 초간 서버로부터의 데 이터 전송을 기다리다가 예외를 발생시킨다.

.

반응형

+ Recent posts