server-side

Server-Sent Events vs Polling

最后都变了- 提交于 2019-11-26 19:14:17
问题 Is there a big difference (in terms of performance, browser implementation availability, server load etc) between HTML5 SSEs and straight up Ajax polling? From the server side, it seems like an EventSource is just hitting the specified page every ~3 seconds or so (though I understand the timing is flexible). Granted, it's simpler to set up on the client side than setting up a timer and having it $.get every so often, but is there anything else? Does it send fewer headers, or do some other

AngularJS - server-side rendering

若如初见. 提交于 2019-11-26 18:53:46
问题 As you may know, AirBnb opensourced Rendr (http://nerds.airbnb.com/weve-open-sourced-rendr) which should enable server-side rendering of Backbone apps. This is cool, because one can run the first "iteration" of template rendering on the server and the client gets fully rendered HTML document plus the whole JS app. It greatly reduces time-to-display and can get us rid of other server-side templating systems. So, have someone managed to render AngularJS with jsdom or ZombieJS ? These dom

How to handle multiple submissions server-side

寵の児 提交于 2019-11-26 18:49:29
We all know the good old "disable the submit button" trick but what are the best ways to handle multiple submissions server side? I have an application where it is absolutely critical that a form only be sent once - it processes a credit card. I didn't write how it is right now but as a quick fix I threw on the disable-on-submit technique, however some impatient users that have javascript disabled are still getting charged twice. So, what are ways to avoid this? I can think of a few - I have used a few in the past - but I'd like to see if there's any "best practices" on how to tackle this one.

AngularJS client MVC pattern?

走远了吗. 提交于 2019-11-26 18:44:05
问题 Until now I was mainly using Struts 2 , Spring , JQuery technology stack for building web applications. The point is, that mentioned stack uses server side MVC pattern. The main role of web browsers was limited to a request/response cycle (+ client side validation). Data retrieval, business logic, wiring and validation were mainly responsibilities of the server side. I have few questions regarding AngularJS framework that were inspired by following quotes I've read: From the AngularJS

Meteor: Debug on server side

耗尽温柔 提交于 2019-11-26 18:26:40
Does anyone know a good method to debug server side code? I tried enable Node.js debug then use node-inspector but it does not show any of my code. I end up using console.log but this is very inefficient. Update: I found the following procedure works on my Linux machine: When you run Meteor, it will spawn two processes process1: /usr/lib/meteor/bin/node /usr/lib/meteor/app/meteor/meteor.js process2: /usr/lib/meteor/bin/node /home/paul/codes/bbtest_code/bbtest02/.meteor/local/build/main.js --keepalive You need to send kill -s USR1 on process2 Run node-inspector and you can see your server code

url with multiple forward slashes, does it break anything?

狂风中的少年 提交于 2019-11-26 17:55:13
http://example.com/something/somewhere//somehow/script.js Does the double slash break anything on the server side? I have a script that parses URLs and i was wondering if it would break anything (or change the path) if i replaced multiple slashes with a single slash. Especially on the server side, some frameworks like CodeIgniter and Joomla use segmented url schemes and routing. I would just want to know if it breaks anything. HTTP RFC 2396 defines path separator to be single slash . However, unless you're using some kind of URL rewriting (in which case the rewriting rules may be affected by

Pulling data from a webpage, parsing it for specific pieces, and displaying it

我只是一个虾纸丫 提交于 2019-11-26 17:21:14
I've been using this site for a long time to find answers to my questions, but I wasn't able to find the answer on this one. I am working with a small group on a class project. We're to build a small "game trading" website that allows people to register, put in a game they have they want to trade, and accept trades from others or request a trade. We have the site functioning long ahead of schedule so we're trying to add more to the site. One thing I want to do myself is to link the games that are put in to Metacritic. Here's what I need to do. I need to (using asp and c# in visual studio 2012)

Why and when to use Node.js? [duplicate]

六眼飞鱼酱① 提交于 2019-11-26 14:59:52
问题 Possible Duplicate: How to decide when to use Node.js? Sorry if I'm a bit ambiguous, but I'm trying to understand the real advantages of using Node.js instead of other server-side language. I'm a JavaScript enthusiast, so I'm probably going to play with Node.js, but I want to know if I should use it in my projects. 回答1: It's evented asynchronous non-blocking I/O build ontop of V8. So we have all the performance gain of V8 which is the Google JavaScript interpreter. Since the JavaScript

How do I access PHP REST API PUT data on the server side?

房东的猫 提交于 2019-11-26 14:35:13
问题 -- Question -- I am just starting out with the REST API and am getting pretty confused. This is what my PHP cRUL client-side looks like for a PUT. case 'PUT': curl_setopt($handle, CURLOPT_CUSTOMREQUEST, 'PUT'); curl_setopt($handle, CURLOPT_POSTFIELDS, $data); break; Now when I look at the server my $_SERVER['REQUEST_METHOD'] shows PUT, but my question is how do I get the $data I sent with CURLOPT_POSTFIELDS. All I need to do is get the $data sent with a PUT request into the next line. Like

When and how do you use server side JavaScript? [closed]

≯℡__Kan透↙ 提交于 2019-11-26 12:54:01
问题 Occasionally I search for some JavaScript help and I come upon the term \"Server-side JavaScript\". When would you use JavaScript server-side? And how? My experiences of JavaScript have been in the browser. Is there a compiled version of JS? 回答1: There's the project Phobos, which is a server side JavaScript framework. Back In The Day, the Netscape web server offered server-side java script as well. In both of these cases, JavaScript is used just like you'd use any language on the server.