햄버거 먹고 싶다

 

지난 10월 한달 동안 프로젝트 내에서 백엔드 개발을 담당했는데, 아직 개발 단계라 SSL을 적용하지 않은 http 통신으로 rest api를 구축하였다. 내 테스트용 디바이스는 출시한지 꽤 날짜가 지난 넥서스였는데, api와 통신에 문제가 없어서 괜찮은 줄 알았다...

 

 

그런데 다른 휴대폰에서 동작이 안되서 원인이 뭘까하고 찾아보다가(욕을 많이 먹었다)

안드로이드에서는 기본적으로 HTTP 접근을 허용하지 않는단 것을 알게 되었다. 그래서 기록해둔다.

 

안드로이드 Pie(API28)부터는 cleartext HTTP를 비활성화한다.

그러므로 API28 버전 이후부터는 강화된 네트워크 보안 정책으로 인해

Http에 접근하려면 cleartext HTTP를 활성화 시켜야 한다.

 

AndroidManifest.xml 파일 내부에
application 태그 내부에 android:usesCleartextTraffic="true" 로 설정을 추가해주면 된다.

 

리엑트 네이티브에서 페이스북 로그인을 구현하던 중 아래와 같은 에러를 마주쳤다.

 

빨간색 FAILED가 세상에서 젤 싫다

 

안드로이드 스튜디오를 열어 SDK Tools에서 NDK(Side by Side)를 추가해준다.

앙 끝!

 

1. JSX.IntrinsicElements

 

Typescript complains Property does not exist on type 'JSX.IntrinsicElements' when using React.createClass?

I am using typescript to write redux application. var item = React.createClass({ render: function() { return (

hello world
) } }); export default class ItemList extends

 

stackoverflow.com

Your component must start with a capital letter I instead of small letter i otherwise TypeScript would yell. Changing item to Item should fix it

 

 

 

 

2. 스크롤뷰 하단까지 도달 시 이벤트

 

Detect ScrollView has reached the end

I have a Text with long text inside a ScrollView and I want to detect when the user has scrolled to the end of the text so I can enable a button. I've been debugging the event object from the onSc...

stackoverflow.com

 

 

 

 

3. Navigation 버전 5에서 파라미터 pass

 

React Navigation 5 pass params to screen inside nested navigator

We are migrating an app in React Navigation 4 to React Navigation 5. The project has a BottomTabNavigator which has for one of its routes a nested TopTabNavigator with three tabs. One of the tabs i...

stackoverflow.com

 

 

 

4. Sequelize Group By & Join

 

Using group by and joins in sequelize

I have two tables on a PostgreSQL database, contracts and payments. One contract has multiple payments done. I'm having the two following models: module.exports = function(sequelize, DataTypes) ...

stackoverflow.com

 

4. 익스프레스와 Socket.io를 같은 포트

 

 

 

 

How to use ExpressJS and Socket.io on a same port?

In the third version of ExpressJS express.createServer() changed to express() this changes makes difficult to bind socket.io on a same port. Maybe somebody could find robust decision. Now, this do...

stackoverflow.com

 

포스팅 예정

 

 

현재 객체가 다른 객체를 참조하고 있다면 현재 객체는 다른 객체에 대해 의존성을 가짐.

 

Object Dependencies (객체 의존성)

public class PetOwner {
	private AnimalType animal;
    
    public PetOwner() {
    	this.animal = new Dog();
    }
}

PetOwner 객체는 AnimalType 객체(Dog)에 의존한다.

PetOwner 생성자에서 new Dog();를 통해 Dog에 의존성을 가짐

 

문제점

- PetOwner 객체는 AnimalType 객체의 생성을 제어하기 떄문에 두 객체 간에는 긴밀한 결합(tight coupling)이 생기고, tight coupling에 따라 AnimalType 객체를 변경하면 PetOwner객체도 변경됨.

- 하나의 모듈이 바뀌면 의존한 다른 모듈까지 변경되어야 한다

- 두 객체 사이의 의존성이 존재하면 Unit Test 작성이 어려워진다.

 

Dependency Injection (의존성 주입)

= IOC(Inversion of control) 제어의 역전

객체를 직접 생성하는 것이 아니라 외부에서 생성 후 주입

필요의 이유

  1. 의존성 파라미터를 생성자에 작성하지 않아도 되므로 보일러 플레이트 코드를 많이 줄일 수 있습니다. 보일러 플레이트 코드를 줄이는 것만으로도 유연한 프로그래밍이 가능합니다.
  2. Interface에 구현체를 쉽게 교체하면서 상황에 따라 적절한 행동을 정의할 수 있습니다. 이것은 특히 Mock 객체와 실제 객체를 바꿔가며 테스트 할 때 유용합니다.

+ Recent posts