• update 중.







  • Meteor
    • 공식홈페이지
    • 개인 홈페이지
    • Meteor Packages
    • Book
    • Lecture Points
    • QnA
      • Questions
        • Namespacing and CoffeeScript, use variable from a .coffee file with package scope
          • CoffeeScript 의 variable 을 Meteor 의 package scope (전역 변수? 라고 해야하나) 로 접근하는 방법
          • Solution

            Namespacing and CoffeeScript

            Here's how CoffeeScript works with Meteor's namespacing.

            Per the usual CoffeeScript convention, CoffeeScript variables are file-scoped by default (visible only in the .coffee file where they are defined.)

            When writing a package, CoffeeScript-defined variables can be exported like any other variable (see Writing Packages). Exporting a variable pulls it up to package scope, meaning that it will be visible to all of the code in your app or package (both .js and .coffee files).

            Package-scope variables declared in .js files are visible in any .coffee files in the same app or project.

            There is no way to make a package-scope variable from a .coffee file other than exporting it. We couldn't figure out a way to make this fit naturally inside the CoffeeScript language. If you want to use package-scope variables with CoffeeScript, one way is to make a short .js file that declares all of your package-scope variables. They can then be used and assigned to from .coffee files.

            If you want to share variables between .coffee files in the same package, and don't want to separately declare them in a .js file, we have an experimental feature that you may like. An object called share is visible in CoffeeScript code and is shared across all .coffee files in the same package. So, you can write share.foo for a value that is shared between all CoffeeScript code in a package, but doesn't escape that package.

            Heavy CoffeeScript users, please let us know how this arrangement works for you, whether share is helpful for you, and anything else you'd like to see changed.


      • Error
        • Exited with code: 8

          W20160314-19:04:49.039(9)? (STDERR)           
          W20160314-19:04:49.039(9)? (STDERR) /home/juce/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
          W20160314-19:04:49.039(9)? (STDERR)                         throw(ex);
          W20160314-19:04:49.039(9)? (STDERR)                               ^
          W20160314-19:04:52.018(9)? (STDERR)          
          W20160314-19:04:52.018(9)? (STDERR) /home/juce/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
          W20160314-19:04:52.018(9)? (STDERR)                         throw(ex);
          W20160314-19:04:52.018(9)? (STDERR)                               ^
          W20160314-19:04:52.102(9)? (STDERR) Error: A method named '/posts/insert' is already defined
          W20160314-19:04:52.102(9)? (STDERR)     at livedata_server.js:1542:15
          W20160314-19:04:52.102(9)? (STDERR)     at Function._.each._.forEach (packages/underscore/underscore.js:113:1)
          W20160314-19:04:52.103(9)? (STDERR)     at [object Object]._.extend.methods (livedata_server.js:1538:7)
          W20160314-19:04:52.103(9)? (STDERR)     at [object Object].Mongo.Collection._defineMutationMethods (packages/mongo/collection.js:927:1)
          W20160314-19:04:52.103(9)? (STDERR)     at new Mongo.Collection (packages/mongo/collection.js:218:1)
          W20160314-19:04:52.103(9)? (STDERR)     at lib/collections/posts.js:5:11
          W20160314-19:04:52.103(9)? (STDERR)     at lib/collections/posts.js:7:4
          W20160314-19:04:52.103(9)? (STDERR)     at lib/collections/posts.js:7:15
          W20160314-19:04:52.103(9)? (STDERR)     at /home/juce/work/conext/meteor-proto/.meteor/local/build/programs/server/boot.js:242:10
          W20160314-19:04:52.103(9)? (STDERR)     at Array.forEach (native)
          => Exited with code: 8
          • Solution
            • http://stackoverflow.com/questions/27079682/exited-with-code-8-sample-meteor-applications
            • CoffeeScript 를 사용할 때 Watcher 설정을 해 놓으면 자동으로 같은 이름의 js 파일을 생성하게 되는데,
              똑같은 이름의 파일이 2개 이상 있게 되면,|
              이미 파일이 있는데 또 다시 실행하여 문제가 생김.
            • 임시적으로 간단하게는
              • Metor Project 의 Package 설정 중 meteor add coffeescript 로 추가했던 CoffeeScript package 를
                meteor remove coffeescript 로 제거하고 프로젝트를 진행하던지
              • WebStorm 에서 coffeescript watcher 설정을 해제하고 프로젝트를 진행하자.


  • MongoDB
    • Shell-centric cross-platform MongoDB management tool
      • Free Version Download : http://app.robomongo.org/download.html
        • Download Filename : tar zxvf robomongo-0.9.0-rc4-linux-x86_64-8c830b6.tar.gz (버전에 따라 다름)
      • 설치방법

        # 위의 링크에서 robomongo-0.9.0-rc4-linux-x86_64-8c830b6.tar.gz Download 후 # 압축파일 풀기
        $ tar -zxvf tar zxvf robomongo-0.9.0-rc4-linux-x86_64-8c830b6.tar.gz
        # 압축이 풀린 폴더가 생성되면 설치 끝

        # 추가 진행 (Optional)
        # 1. robomongo 프로그램 폴더 move
        $ sudo mv robomongo-0.9.0-rc4-linux-x86_64-8c830b6/ /usr/lib
        # 2. 어디서나 실행 가능하도록 soft-link 걸어주기(만들어주기)
        $ sudo ln -s /usr/lib/robomongo-0.9.0-rc4-linux-x86_64-8c830b6/bin/robomongo /usr/local/bin/robomongo

        • Robomongo 설치 끝
      • Robomongo DB 사용법
        • Menu 의 맨 왼쪽 위의 Computer Connection Icon 을 클릭하여
        • Connection 종류를 추가하고
        • Connection 설정을 한 후 확인
          • address
          • id
          • password
        • 생성된 Connection 을 Choice 하고, 오른쪽 아래의 Connection 클릭
    • Meteor 기본 MongoDB 에 연결하기
      • 자신이 접속하고자 하는 Meteor App 을 실행시킨 후
      • 다른 command shell 을 띄워서 다음 명령어 입력
        $ meteor mongo
        MongoDB shell version: 2.6.7
        connecting to: 127.0.0.1:3001/meteor
        
      • Robomongo 실행 후 Connection 설정에서 위의 ip:port (127.0.0.1:3001) 정보를 입력 후 Connection 버튼 클릭
      • 연결 끝.
    • Reference


  • Cordova


+ Recent posts