EBS Radio 녹음하기 Ubuntu

Ubuntu 패키지 설치: sudo apt-get install rtmpdump libav-tools vim ebs-record.sh #!/bin/bash #RADIO_ADDR=”rtmp://ebsandroid.ebs.co.kr/fmradiofamilypc/familypc1m” RADIO_ADDR=”rtmp://ebsandroid.ebs.co.kr/iradio/iradiolive_m4a” RADIO_NAME=”ebs_radio” PROGRAM_NAME=$1 RECORD_MINS=$(($2 * 60)) DEST_DIR=$3 REC_DATE=`date +%Y%m%d-%H%M` TEMP_FLV=`mktemp -u` MP3_FILE_NAME=$PROGRAM_NAME”_”$REC_DATE.mp3 rtmpdump -r $RADIO_ADDR -B $RECORD_MINS -o $TEMP_FLV avconv -i $TEMP_FLV -ac 2 -ab 128 -vn -y -f mp3 $MP3_FILE_NAME rm $TEMP_FLV mkdir -p $DEST_DIR mv $MP3_FILE_NAME $DEST_DIR 실행 모드로 전환: chmod…

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] var mongoosastic = require(‘mongoosastic’); var BlogSchema = new mongoose.Schema({ … }); BlogSchema.methods = { ……

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: blog.model.js: [js] var mongoosastic = require(‘mongoosastic’); var BlogSchema = new mongoose.Schema({ … }); BlogSchema.methods =…

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; this.$state = $state; this.$stateParams = $stateParams; this.blogs = []; $scope.url = ‘/api/blogs’; $scope.perPage = parseInt($location.search().perPage,…

Read More

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

Angularjs Markdown Modules 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 index.html: <!doctype html> <html lang=”en”> <head> <meta charset=”utf-8″> <!– build:css(client) app/vendor.css –> <!– bower:css –> <link rel=”stylesheet” href=”bower_components/highlightjs/styles/default.css” /> . . . <!– endbower –> <!– endbuild –> . .…

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 el = angular.element($(‘.md-editor’)).parents(‘.panel’); el.css( “background-color”, “#ffeeff” ); setTimeout(() => { el.css( “background-color”, “#ffffff” ); },…

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); res.status(500).json(err.message || err); });

Read More