Programming 98

쉘 스크립트 if문

기본 문법 if [ 조건식 ]; then 수행문 fi 예제 #! /bin/bash A=1 B=2 if [ A == B ]; then echo "A and B are the same." fi AND 조건문법 if [ 조건식1 ] && [ 조건식2 ]; then 수행문 fi OR 조건문법 if [ 조건식1 ] || [ 조건식2 ]; then 수행문 fi 조건문 -z : 문자열의 길이가 0이면 참 -n : 문자열의 길이가 0이 아니면 참 -eq : 값이 같으면 참 -ne : 값이 다르면 참 -gt : 값1 > 값2 -ge : 값1 >= 값2 -lt : 값1

Programming/Shell 2019.09.27

Angular7 ag-Grid 도입

오늘은 ag-Grid에 대해서 알아보겠습니다. https://www.ag-grid.com/ ag-Grid에는 community 버전과 enterprise 버전이 있습니다. 제가 사용할 버전은 community 버전! (1) 모듈 설치 npm install --save ag-grid-community ag-grid-angular (2) src/app/app.module.ts 파일에 모듈 등록 import { AgGridModule } from 'ag-grid-angular'; imports: [ ..., AgGridModule.withComponents([]) ] (3) src/style.css 파일에 스타일 등록 @import "~ag-grid-community/dist/styles/ag-grid.css..

[Node Express-Angular 7] 브라우저 새로 고침 시 404 에러

angular 소스를 빌드 후, node express에 import 시키고 서버를 띄웠을 때, 브라우저를 새로고침하면 404에러가 나면서 아래 에러를 뱉습니다..! No default engine was specified and no extension was provided. 그럼 굉장히 당황스럽죠? 그럴 때 당황하지 말고~ app.routing.ts 또는 app-routing.ts 아니면 app.module.ts 파일 내 routing 부분에 " { useHash: true } "를 추가해주면 됩니다! @NgModule({ imports: [RouterModule.forRoot(routes, { useHash: true })], exports: [RouterModule] }) 저렇게 적용하게 되면 u..

[Node Express - Angular5] JWT 기반 사용자 인증 개발 - Node 편

JWT 모듈 import와 JWT 비밀키 설정 var jwt = require('jsonwebtoken'); app.set('jwt-secret', "please_input_jwt_key in here"); JWT 생성 var u_token = new Promise(function(resolve, reject) { jwt.sign({ user_id: id }, req.app.get('jwt-secret'), { expiresIn: '1h' }, (err, token) => { if(err) reject(err); resolve(token); }); }); u_token.then(function(token){ res.status(200).json({"status": "OK", "token": token})..

"ng new 프로젝트명" 입력 시, Data path ".name" should match format "html-selector". 에러 발생

오랜만에 angular project를 만드려고 하니, 다음과 같은 에러가 발생했습니다.. ㅎㄷㄷ [sy@localhost ~]$ ng new test_angular ? Would you like to add Angular routing? No ? Which stylesheet format would you like to use? CSS Schematic input does not validate against the Schema: {"name":"test_angular","ve rsion":"7.3.8","routing":false,"style":"css"} Errors: Data path ".name" should match format "html-selector". 현재 Angular version..

[Node Express - Angular5] JWT 기반 사용자 인증 개발 - Angular 편

[ Angular Version 정보 ] Angular CLI: 1.7.4 OS: linux x64 Angular: 5.2.11 @angular/cdk: 6.4.7 @angular/cli: 1.7.4 @angular/material: 6.4.7 @angular-devkit/build-optimizer: 0.11.4 @angular-devkit/core: 0.0.22 @angular-devkit/schematics: 0.0.40 @ngtools/json-schema: 1.1.0 @ngtools/webpack: 1.10.2 @schematics/angular: 0.3.2 @schematics/package-update: 0.3.2 @schematics/schematics: 0.0.10 typescript: ..

ng generate error : Error: Path "/__path__/__name@dasherize@if-flat__/__name@dasherize__.service.spec.ts" does not exist.

[td@localhost app]$ ng g s test --module=app.module.ts Error: Path "/__path__/__name@dasherize@if-flat__/__name@dasherize__.service.spec.ts" does not exist. Path "/__path__/__name@dasherize@if-flat__/__name@dasherize__.service.spec.ts" does not exist. ng 명령어로 service 파일 생성하려고 하니까 다음과 같은 에러 발생..(극혐) [td@localhost app]$ ng g s test --module=app.module.ts --spec=false create app/test.service.ts (11..

ng generate error : Error: Cannot read property 'dasherize' of undefined

[td@localhost web-client]$ ng g c test Error: Cannot read property 'dasherize' of undefined Cannot read property 'dasherize' of undefined 오랜만에 글 좀 써보려고 했더니, 역시 Angular 답게 바로 에러 뱉어주시고~ (필자는 angular5 사용 중) 스택오버플로우에 물어보니, @angular-devkit/core 모듈이 없어서 그런거랍니다. 바로 설치 고고 스택 오버 플로우 짱 npm install --save @angular-devkit/core * --save 안해줘도 되는데, 그냥 해줘버림 [td@localhost web-client]$ ng g c test create src/app/..