I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.
I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.
I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.
I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.
I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.
add_comment($_POST) ) {
header( 'Location: index.php' );
}
else {
header( 'Location: index.php?error=Your comment was not posted due to errors in your form submission' );
}
?>
여기서는 실시간 기능에 관해서만 다루니 Persistence.php로 정의된 Template class를 사용
접속자의 $_SESSION을 사용해서 저장하는 방식으로 필요하다면 재수정을 해서 사용
DISPLAYING THE COMMENTS WITH THE BLOG POST
마지막으로 일반적인 블로그 코멘트 시스템을 설정해야 하는 것은 블로그 페이지를 갱신하는것이고, Persistence 객체로 부터 코멘트를 가져와서 보여주는 것이다.
form이 전송되게되면, handleSumbit함수는 form에서 추출한 서버로 보내길 원하는 댓글data를 모은다.
function handleSubmit() {
var form = $(this);
var data = {
"comment_author": form.find('#comment_author').val(),
"email": form.find('#email').val(),
"comment": form.find('#comment').val(),
"comment_post_ID": form.find('#comment_post_ID').val()
};
postComment(data);
return false;
}
function postComment(data) {
// send the data to the server
}
POST THE COMMENT WITH AJAX
postComment함수안에서 서버로 POST요청하여 form으로 부터 조회한 data를 전달한다.
DYNAMICALLY UPDATING THE USER INTERFACE WITH THE COMMENT
서버에 댓글이 전달되고 저장되는 시점이지만 AJAX response는 어떤 의미 있는 응답을 제공하지 않는다.
또한, 사용자가 페이지를 갱신해서 보려고 해도, 댓글 영역은 새로 등록된 댓글을 보여주기 위해 갱신되지 않는다
이제, UI를 갱신하고 기능적으로 테스트하는 code를 작성한다.
function postSuccess(data, textStatus, jqXHR) {
$('#commentform').get(0).reset();
displayComment(data);
}
function displayComment(data) {
var commentHtml = createComment(data);
var commentEl = $(commentHtml);
commentEl.hide();
var postsList = $('#posts-list');
postsList.addClass('has-comments');
postsList.prepend(commentEl);
commentEl.slideDown();
}
function createComment(data) {
var html = '' +
'
' +
'' +
'
' +
'
' + data.comment + '
' +
'
' +
'
';
return html;
}
function parseDisplayDate(date) {
date = (date instanceof Date? date : new Date( Date.parse(date) ) );
var display = date.getDate() + ' ' +
['January', 'February', 'March',
'April', 'May', 'June', 'July',
'August', 'September', 'October',
'November', 'December'][date.getMonth()] + ' ' +
date.getFullYear();
return display;
}
DETECT AND RESPONDING TO THE AJAX REQUEST
post_comment.php갱신하여 AJAX call을 감지하고, 새로 생성된 댓글에 관한 정보를 return한다.
add_comment($_POST);
if($ajax) {
sendAjaxResponse($added);
}
else {
sendStandardResponse($added);
}
function sendAjaxResponse($added) {
header("Content-Type: application/x-javascript");
if($added) {
header( 'Status: 201' );
echo( json_encode($added) );
}
else {
header( 'Status: 400' );
}
}
function sendStandardResponse($added) {
if($added) {
header( 'Location: index.php' );
}
else {
header( 'Location: index.php?error=Your comment was not posted due to errors in your form submission' );
}
}
?>
Getting Real-Time - Finally !
여기까지, ..위에서 작업한 것들이 가치가 있는 것이다. Pusher를 추가하는 것은 아주 쉽다.
WHAT IS PUSHER?
Pusher는 호스팅되는 서비스로 빠르고 쉽게 실시간 기능을 웹이나 모바일 앱에 추가하도록 해 준다.
이것은 RESTful API를 제공해서 쉽게 어떤 앱에서 오는 이벤트도 쉽게 publish한다.
이는 HTTP request와 WebSocket API이 실시간 양방향 통신을 위해 사용된다.
SIGN UP FOR PUSHER AND GET YOUR API CREDENTIALS
가입하고 API인증 값을 얻기, pusher_config.php에
index.php에서 require를 추가를 한다. JavaScript에서 APP_KEY를 사용할 수 있도록 만들고,Pusher로 연결시에 사용
REAL-TIME JAVASCRIPT
첫번째 할일은 Pusher를 앱에 추가할때 Pusher 자바스크립트library를 포함시키고 Pusher로 연결한다.
app.js에 Pusher기능을 추가한다.
var pusher = new Pusher(APP_KEY);
var channel = pusher.subscribe('comments-' + $('#comment_post_ID').val());
channel.bind('new_comment', displayComment);
SENDING REAL-TIME EVENTS USING THE EVENT CREATOR
Event Creator를 사용해서 서버측code를 작성하지 않고 기능을 테스트할 수 있다.
I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.
I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.
YCombinator가 지원하는 회사로 개발자 API를 지원하여, 그룹쳇과 p2p쳇, 뿐만 아니라 음성전화도 앱에 추가할 수 있다.
4) Firebase
YCombinator가 지원하며, 인기있는 쳇tool 웹사이트인 Envolve(웹사이트에 쳇room를 추가하록 지원)을 운영하는 팀이다. iOS/OSX, Java/Android,Node.js, HTML과 REST API로 접근할 수 있다. 또한 많은 예제를 제공하고, 초보지만 시작하는 것이 매우 쉽다.
I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.
I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.
I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.
Limit on-device data storage Synchronize data across multiple devices Handle the offline case gracefully Send notifications and messages Minimize battery drain
I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.
Firebase용 Query
Where절들이 없다? Join 문장이 없다? 문제는 없다!
SQL경험을 토대로, NoSQL 자료구조과 Firebase의 동적,실시간 Query환경의 자유로움을 이해하는데 어느 정도의 시간이 걸릴 수 있다.
* Select a user by ID ( WHERE id=x )
- Firebase궈리에서, record들은 "경로"에 저장이 된다. 경로는 데이타 계층구조에서 단순하게 URL이다. 샘플 데이타에서, 유저정보는 /user에 저장 되었다. 그래서 id를 통해서 record를 조회한다면, 단순하게 URL에 추가를 한다. (~/user/123 )
new Firebase('https://example-sql.firebaseio.com/user/123')
I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.
I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.
I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.