Categories

Archive

Elasticsearch Custom Analyzer applied to Node.js Mongoosastic search

Installing Elasticsearch Custom Analyzer for Korean analysis(kr_analyzer) Check version of Elasticsearch $ curl -XGET ‘localhost:9200’ >result: { “name” : “Caprice”, “cluster_name” : “elasticsearch”, “version” : { “number” : “5.0.0-alpha4”, “build_hash” : “3f5b994”, “build_date” : “2016-06-27T16:23:46.861Z”, “build_snapshot” : false, “lucene_version” : Read more ›

Install Elastic Search Server and mongoosastic search pagination

Download and install Elasticsearch server https://www.elastic.co/downloads/elasticsearch Download and unzip the latest Elasticsearch distribution Run bin/elasticsearch on Unix or sudo dpkg -i elasticsearch-xxx.deb Run curl -X GET http://localhost:9200/ Install and set “mongoosastic” nodejs module npm install –save mongoosastic server: blog.model.js: [js] Read more ›

[mongoosastic] Install Elastic Search Server and mongoosastic for Node.js

Install Elastic Search server Download and install https://www.elastic.co/downloads/elasticsearch Download and unzip the latest Elasticsearch distribution Run bin/elasticsearch on Unix or sudo dpkg -i elasticsearch-xxx.deb Run curl -X GET http://localhost:9200/ Install and set “mongoosastic” nodejs module npm install –save mongoosastic server: Read more ›

[Angularjs] how to use ‘angular-paginate-anything’ pagination module

Client-side Aangularjs Install: bower install angular-paginate-anything –save Angularjs: app.js angular.module(‘myModule’, [‘bgf.paginateAnything’]); blog.controller.js [js] class BlogCtrl { constructor(Auth, Blog, $state, $stateParams, $http, $scope, $location, socket) { this.errors = {}; this.success = {}; this.submitted = false; this.Auth = Auth; this.Blog = Blog; Read more ›

[Angularjs] markdown editor modules: Install markdown angular-marked and highlight.js

Angularjs Markdown Modules https://github.com/Hypercubed/angular-marked highlight.js: Syntax highlighting for the Web Install markdown angular-marked and highlight.js Install modules: bower install –save highlightjs bower install –save angular-marked Angularjs: [js] var app = angular.module(‘exampleApp’, [‘hc.marked’]); app.config([‘markedProvider’, function (markedProvider) { markedProvider.setOptions({ gfm: true, tables: Read more ›

[bootstrap-markdown] show and hide markdown editor programmatically

html: [html] Edit [/html] Angularjs: [js] editComment(comment){ var self = this; var editor = angular.element($(`#${comment._id}`)); editor.markdown({autofocus: true, savable: true, hideable:true, onSave: function(e) {//e: markdown editor self.Blog.saveComment({ id: self.blog._id, comment_id: comment._id, content: e.getContent() }).$promise .then(() => { //angular.element($(‘.md-editor’)).children(‘.md-footer’).html(‘Comment is updated.’); var Read more ›

[mongoose] update and delete embedded document in array

Update: var comment = blog.comments.id(comment_id); comment.author = ‘Bruce Wayne’; blog.save(function (err) { // emmbeded comment with author updated }); Delete: Blog.findByIdAndUpdateAsync(blogId, { $pull: { comments: {_id: commentId}} }) .then(blog => { res.status(200).json(‘Comment is deleted successfully.’); }) .catch(err => { console.error(err); Read more ›

angular-fullstack generated code upgrade with Babel 6

Install  Babel 6 related packages: npm install –save-dev babel-register npm install –save-dev babel-plugin-add-module-exports npm uninstall –save-dev babel-core npm install –save-dev babel-core npm install babel-preset-es2015 Create .babelrc file: vi .babelrc { “presets”: [“es2015”], “plugins”: [“babel-plugin-add-module-exports”] } Chanage server/index.js file: vi server/index.js Read more ›

ECMAScript 6 Tutorial, Setting up Babel 6 – Babel compile it to run in current browser

현재의 브라우저는 ES6(ECMAScript 6) 자바스크립트를 지원하지 않는다. ES6 코드는 컴파일러(트랜스파일러)를 사용해 현재의 브라우저에서 돌아가는 코드로 변환해야 한다. 바벨(Babel)이 ES6 코드를 컴파일하는 사실상의 표준이 되었다. 아래 투토리얼은 Babel를 이용해 ES6 어플리케이션을 개발하고 실행하기 위한 개발환경을 설정해 본다. ** Babel 6 버전이 Read more ›