여러 개의 파워포인트 파일을 하나로 합치는 프로그램 입니다확장자가 ppt 이거나 pptx 관련 없이 작업이 가능 하고 합치는 파일의 순서도 설정이 가능 합니다.


powerpoint file add


 

먼저 파일을 다운로드 합니다구글 코드에서 다운로드 하면 됩니다.

https://code.google.com/archive/p/powerpointjoin/downloads


powerpoint file add


리스트의 마지막 pptjoin-0.2.zip 파일을 클릭해서 다운로드 받습니다.


powerpoint file add


다운받은 파일을 압축을 풀면 다음과 같은 파일들이 보입니다.


powerpoint file add


여기에서 pptjoin.hta 파일이 실행 파일 입니다.

 

하나로 합칠 파워포인트 파일들을 하나의 폴더에 넣고 연결 순서를 결정하기 위한 텍스트 파일을 하나 생성 해서 파워포인트를 모아놓은 폴더에 같이 저장 합니다.


powerpoint file add


이렇게 기록을 하면 됩니다.


powerpoint file add


이제 작업 전 폴더 내 파일들이 이런 식으로 준비가 되었습니다.

 

압축 해제한 프로그램 폴더에서 pptjoin.hta 파일을 더블 클릭해 실행합니다.


powerpoint file add


1번에서 [찾아보기] 버튼을 이용하여 문서를 합치는 순서를 기록한 파일을 선택해 줍니다.

 

그리고 2. Click here 에서 파란색 here를 클릭하여주면 파일이 하나로 생성이 됩니다.


powerpoint file add


3번이 보인다면 작업이 완료가 된 것 입니다. 파워포인트를 모아놓은 폴더를 볼까요?


powerpoint file add


자동으로 combined.ppt라는 이름으로 모든 파일을 하나로 하여 생성이 되었습니다이렇게 간단하게 파일들이 하나로 통합 됩니다.


- copy coding -


전번 글에 Firebase 웹 사이트에서 프로젝트를 생성하고 Android Studio에 연결하는 방법을 알아 보았습니다이번에는 Android Studio에서 프로젝트를 진행 하다가 Firebase를 연결 하는 방법을 알아 보려고 합니다.


firebase android firestore assistant


두가지 방법 모두 결과는 동일한데 수동으로 작업을 하느냐 자동으로 하느냐의 차이만 있습니다개인적으로는 두 가지 방법 중 좀더 쉬운 방법은 Assistant를 이용하는 방법 입니다.

먼저 안드로이드 스튜디오에서 프로젝트 하나를 생성 합니다.


firebase android firestore assistant


Empty Activity를 선택 하고 [Next] 버튼을 클릭 합니다.


firebase android firestore assistant


프로젝트 명을 적당히 적어 줍니다.


firebase android firestore assistant


Android Studio 메뉴에서 Tools > Firebase를 선택 합니다.


firebase android firestore assistant


Firebase 관련 Assistant 창이 나오고 여러가지 접속 방법들이 나오는데 그 중에 Firestore를 선택 하고 확장된 화면에서 [Read and write documents with Cloud Firestore]를 클릭해 줍니다.


firebase android firestore assistant


그러면 Assistant 팝업 창이 나오는데 Firebase에 연결하는 방법이 순서대로 기술되어 있기 때문에 순서에 맞추어 하나씩 작업을 하면 됩니다저는 여기서 2번까지만 진행 합니다.  2번 까지만 진행하면 Android ProjectFirebase의 연결이 완료 되고 바로 프로그램을 진행 할 수 있습니다.

 

 

1단계 Connect your app to Firebase

 

말 그대로 Android ProjectFirebase의 연결 작업을 진행하는 단계 입니다.

[Connect to Firebase]를 클릭 하면 Firebase 사이트 웹 브라우저 창이 뜹니다.


firebase android firestore assistant


로그인을 안했다면 로그인을 하고 연결 하려는 프로젝트를 선택 합니다아니면 프로젝트를 새로 추가해도 됩니다저는 기존 CopyCoding 프로젝트를 선택 하였습니다.


firebase android firestore assistant


Firebase project 콘솔로 넘어가면서 Android app을 생성 합니다. [연결] 버튼을 클릭해서 연결을 진행 합니다.


firebase android firestore assistant


잠시 작업이 진행 되고 Android Studio Project Firebase가 연결이 되었습니다.

다시 Android Studio로 돌아오면


firebase android firestore assistant


1단계가 Connected로 변경 되었습니다.

 

2단계 Add Cloud Firestore to your app

1단계는 Firebase를 연결한 것이고 2단계는 Firestore를 연결하는 것 입니다.

[Add Cloud Firestore to your app] 을 클릭 하면 팝업이 하나 나옵니다.


firebase android firestore assistant


Android Studio ProjectFirestore를 연결 하기 위해 gradle에 자동으로 소스를 추가 한다고 합니다.  [Accept Changes] 버튼을 클릭 합니다.


firebase android firestore assistant


2단계도 Dependencies set up correctly로 변경 되었습니다.

좌측 Project 파일에 google-services.json 파일이 추가되어 있습니다.  gradle에도 자동으로 소스를 추가했다고 하는데 확인 들어 갑니다.

 

build.gradle(Project)

 

dependencies {
   
classpath
'com.android.tools.build:gradle:3.6.3'
   
classpath 'com.google.gms:google-services:4.3.3'

   
// NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

 

 

build.gradle(Module)

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

 

dependencies {
   
implementation fileTree(
dir: 'libs', include: ['*.jar'])

    implementation
'androidx.appcompat:appcompat:1.1.0'
   
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
   
implementation 'com.google.firebase:firebase-firestore:21.4.3'
   
testImplementation 'junit:junit:4.12'
   
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
   
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

  

필요한 설정들이 모두 자동으로 추가 되었고 Android Studio FIrebase가 연결이 되었습니다이제 Firestore Database를 사용하면 됩니다.

 

- copy coding -


Android appFirebase를 연결하는 방법 까지만 테스트 해보려고 합니다



먼저 android studio에서 Empty Activity로 앱을 하나 생성 합니다.


firebase android app


Project Name보다는 package name을 잘 기억해 둬야 됩니다.

com.copycoding.firebase 이렇게 미리 복사 해놓고 [Finish] 버튼을 눌러 작업을 진행 합니다.

 

이제는 웹에서 Firebase에 로그인을 합니다.


firebase android app


연결 하려는 프로젝트를 선택 하고 console로 이동 합니다.


firebase android app


[+앱 추가]를 선택 해서 확장 합니다.


firebase android app


추가할 플랫폼이 확장 되는데 여기에서 안드로이드 아이콘을 클릭 합니다.


firebase android app


Android studio에서 앱을 생성할 때 복사해둔 Package name을 적어주고 닉네입도 입력 합니다.  [앱 등록] 버튼을 클릭해서 2단계로 넘어 갑니다.


firebase android app


구성 파일 다운로드에서 [google-service.json 다운로드]를 클릭하면 파일이 하나 다운로드 되는데 앱에서 firebase에 연결하는데 사용되는 idkey 정보가 들어 있습니다.

다운받은 파일을 그림에서 처럼 android studio에 붙여넣기를 해주고 [다음] 버튼을 클릭 합니다.


firebase android app


안드로이드에 추가한 모습입니다.

 

3단계 Firebase SDK 추가에서는 Firebase를 사용하는데 필요한 내용을 gradle에 추가하는 방법을안내 합니다.


firebase android app


gradle에 이미 있는 내용도 있고 추가 해야할 내용도 있습니다. 직접 손으로 입력하는게 아니고 우측 복사 아이콘을 클릭하여 소스에 붙여넣기를 하면 됩니다.


firebase android app


2개의 gradle에 그림처럼 소스에 추가를 했다면 안드로이드 스튜디오 우측 상단에 나타나는 [Sync now]를 클릭해 줍니다.

잠시 후 안드로이드 스튜디오의 씽크가 종료되면 [다음] 버튼을 클릭 합니다.


firebase android app


4단계에서 앱과 Firebase가 연결 되었다는 내용을 볼 수 있습니다.  4단계에서 수고하셨습니다.”라는 내용이 나오지 않고 계속 맴도는 경우가 있습니다그럼 저는 안드로이드 프로젝트를 다시 만들어 샤용 합니다아직 코딩을 시작하기 전이니 가능 한 방법이죠.


- copy coding -


Spring Boot에서 프로젝트를 생성하여 Firestore에 있는 데이터 작업을 하려고 합니다.  


Firestore spring boot crud


Firebase에는 다음과 같이 collection을 만들어서 데이터를 입력 하였습니다.


Firestore spring boot crud


이 데이터베이스에 데이터를 조회, 추가, 수정, 삭제하는 기능을 Spring Boot를 이용하여 만들어 보려고 합니다.

 

Spring Boot에서 Spring Starter Project를 선택하여 신규 프로젝트를 생성 합니다.


Firestore spring boot crud


입력 사항은 테스트이니까 대충 적어 넣고 Next 버튼을 클릭 합니다.


Firestore spring boot crud


 

DependencySpring Web만 추가 했습니다.  Finish 버튼을 클릭 합니다.

 

pom.xmlfirebase를 추가 합니다현재 6.13.x 버전까지 나와있는데 한 단계 낮추어서 적어봤습니다.

 

               <dependency>

                   <groupId>com.google.firebase</groupId>

                   <artifactId>firebase-admin</artifactId>

                   <version>6.12.1</version>

                </dependency>

 

Firebase의 필드에 해당하는 Vo를 생성 합니다.

 

package com.copycoding.firebase;

 

public class Member {

        String id;

        String name;

        int age;

        String tel;

       

        public String getId() {

               return id;

        }

        public void setId(String id) {

               this.id = id;

        }

        public String getName() {

               return name;

        }

        public void setName(String name) {

               this.name = name;

        }

        public int getAge() {

               return age;

        }

        public void setAge(int age) {

               this.age = age;

        }

        public String getTel() {

               return tel;

        }

        public void setTel(String tel) {

               this.tel = tel;

        }

}

 

 

Service를 생성하기 위해 먼저 Interface 파일을 생성하고

 

package com.copycoding.firebase;

 

public interface FirebaseService {

 

        public insertMember(Member member) throws Exception;

       

        public Member getMemberDetail(String id) throws Exception;

       

        public String updateMember(Member member) throws Exception;

       

        public string deleteMember(String id) throws Exception;

}

 

 

 

Service Implement도 작성 합니다.

 

package com.copycoding.firebase;

 

import org.springframework.stereotype.Service;

 

import com.google.api.core.ApiFuture;

import com.google.cloud.firestore.DocumentReference;

import com.google.cloud.firestore.DocumentSnapshot;

import com.google.cloud.firestore.Firestore;

import com.google.cloud.firestore.WriteResult;

import com.google.firebase.cloud.FirestoreClient;

 

@Service

public class FirebaseServiceImpl implements FirebaseService {

 

        public static final String COLLECTION_NAME="member";

       

        @Override

        public String insertMember(Member member) throws Exception {

               Firestore firestore = FirestoreClient.getFirestore();

               ApiFuture<WriteResult> apiFuture = firestore.collection(COLLECTION_NAME).document(member.getId()).set(member);

               return apiFuture.get().getUpdateTime().toString();

        }

 

        @Override

        public Member getMemberDetail(String id) throws Exception {

               Firestore firestore = FirestoreClient.getFirestore();

               DocumentReference documentReference = firestore.collection(COLLECTION_NAME).document(id);

               ApiFuture<DocumentSnapshot> apiFuture = documentReference.get();

               DocumentSnapshot documentSnapshot = apiFuture.get();

               Member member = null;

               if(documentSnapshot.exists()) {

                       member = documentSnapshot.toObject(Member.class);

                       return member;

               } else {

                       return null;

               }

        }

 

        @Override

        public String updateMember(Member member) throws Exception {

               Firestore firestore = FirestoreClient.getFirestore();

               ApiFuture<WriteResult> apiFuture = firestore.collection(COLLECTION_NAME).document(member.getId()).set(member);

               return apiFuture.get().getUpdateTime().toString();

        }

 

        @Override

        public String deleteMember(String id) throws Exception {

               Firestore firestore = FirestoreClient.getFirestore();

               ApiFuture<WriteResult> apiFuture = firestore.collection(COLLECTION_NAME).document(id).delete();

              

               return "Document id :" + id + " delete";

        }

}

 

 

 

이제 마지막으로 Controller Rest Api 형식으로 작성 합니다.

 

package com.copycoding.firebase;

 

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.GetMapping;

import org.springframework.web.bind.annotation.RequestParam;

import org.springframework.web.bind.annotation.RestController;

 

@RestController

public class FirebaseController {

 

        @Autowired

        FirebaseService firebaseService;

       

        @GetMapping("/insertMember")

        public String insertMember(@RequestParam Member member) throws Exception {

               return firebaseService.insertMember(member);

        }

       

        @GetMapping("/getMemberDetail")

        public Member getMemberDetail(@RequestParam String id) throws Exception {

               return firebaseService.getMemberDetail(id);

        }

       

        @GetMapping("/updateMember")

        public String updateMember(@RequestParam Member member) throws Exception {

               return firebaseService.updateMember(member);

        }

       

        @GetMapping("/deleteMember")

        public String deleteMember(@RequestParam String id) throws Exception {

               return firebaseService.deleteMember(id);

        }

}

 

여기 까지는 일반 프로젝트와 동일한 방식으로 작성을 하면 됩니다.

 

package com.copycoding.firebase;

 

import java.io.FileInputStream;

import javax.annotation.PostConstruct;

import org.springframework.stereotype.Service;

import com.google.auth.oauth2.GoogleCredentials;

import com.google.firebase.FirebaseApp;

import com.google.firebase.FirebaseOptions;

 

@Service

public class FirebaseInitialize {

 

        @PostConstruct

    public void initialize() {

        try {

        FileInputStream serviceAccount =

                  new FileInputStream("./copycodingServiceAccount.json");

 

                FirebaseOptions options = new FirebaseOptions.Builder()

                  .setCredentials(GoogleCredentials.fromStream(serviceAccount))

                  .setDatabaseUrl("https://copycoding-bca04.firebaseio.com")

                  .build();

 

                FirebaseApp.initializeApp(options);

            } catch (Exception e) {

                e.printStackTrace();

            }

       

        }

}

 

추가로 Firebase에 접속하기 위한 설정 파일을 하나 생성해주면 됩니다.

이렇게 해서 프로그램이 완성 되었습니다.


이제 테스트를 해 봅니다.

귀찮으니 조회만 해 봅니다.


Firestore spring boot crud


조회가 잘 되는 군요.

성의가 없는 것 같아 삭제도 해 봅니다.


Firestore spring boot crud


삭제가 되었다고 하는데 Firebase 데이터베이스에 들어가 확인해 봅니다.


Firestore spring boot crud


document 2번이 삭제 되어 있습니다이런 식으로 작업을 하면 됩니다.


- copy coding -


1···78910111213···61

+ Recent posts