server-side

Server Side Javascript: Why?

血红的双手。 提交于 2019-11-28 18:58:52
问题 Is the use of server side javascript prevalent? Why would one use it as opposed the any other server side scripting? Is there a specific use case(s) that makes it better than other server side languages? Also, confused on how to get started experimenting with it, I'm on freeBSD, what would I need installed in order to run server side javascript? 回答1: It goes like this: Servers are expensive, but users will give you processing time in their browsers for free. Therefore, server-side code is

Save the document generated by javascript

故事扮演 提交于 2019-11-28 18:26:39
Javascript can manipulate the document the browser is displaying, so the following: <script> document.write("<table><tr><td>Hola</td><td>Adios</td></tr></table>"); </script> Will make the browser display a table just like if it was the original HTML document: <table> <tr> <td>Hola</td> <td>Adios</td> </tr> </table> Is there a way I can save/serve this document content? Currently we have some nicely generated reports using Ext-js, what I would like to do is to have the "text/html" version of it ( I mean, something that doesn't require javascript ) So at the end of the page I would add a button

PHP: How to compress images without losing visible quality (automatically)?

强颜欢笑 提交于 2019-11-28 17:18:28
I'm wondering how to figure out the best compress rate (small filesize + no quality loss) automatically. At the moment I'm using imagejpeg() with $quality = 85 for each .jpg . PageSpeed (Chrome Plugin) suggests, to lower the quality of a few images to save some kb. The percentage of reduction is different. I'd like to write a cronjob that crawls a specific directory and optimizes every image. How does PageSpeed or TinyPNG figure out the best optimized quality and is this possible with PHP or another serverside-language? TinyPNG uses pngquant . Pngquant has option to set desired quality,

When to use “client-side routing” or “server-side routing”?

*爱你&永不变心* 提交于 2019-11-28 14:37:20
问题 I'm a little bit confused about this, and I feel slightly stupid asking this question, but I want to understand it. So, say I'm working with a client side web framework, like Backbone, Angular or Durandal. This framework includes routing. But I of course still have a server for database stuff, and so on, which also has routing. My question now is: When to use "client-side routing" or "server-side routing"? How is it "decided" whether routing is already performed on the client side or whether

Do copyright dates need to be updated? [closed]

99封情书 提交于 2019-11-28 13:12:02
问题 Every now and then I see a web site that has an old copyright date. In my mind, I always think "Look at the sucker who forgot to update his copyright year!" Then, while I was hard-coding a copyright year into the site I'm currently designing, it suddenly struck me: How the hell am I going to remember to update this? My immediate reaction was just to use some server-side coding to automatically display the current year. Bam, fixed. Later, I began to ponder to myself, if someone as big and

Calculate driving directions using PHP?

狂风中的少年 提交于 2019-11-28 13:03:53
For my application I need a server to calculate driving directions. The Google Maps API was designed for clientside use only, with a Javascript and Flash API. Is there any way I can run their API's server-side? As I know it this isn't official and google doesn't support it but it works: $url = str_replace(' ', '%20', "http://maps.google.com/maps/nav?client=yourclient&output=json&q=from: ".$lat1.",".$lon1." to: ".$lat2.",".$lon2); $result = file_get_contents($url); $data = json_decode(utf8_encode($result), true); And you'll have directions in $data array. 来源: https://stackoverflow.com/questions

How to Create an anti-request forgery state token In google+ server side sign-up

本小妞迷上赌 提交于 2019-11-28 12:55:16
<?php require_once '/google-api-php-client/src/Google_Client.php'; require_once '/google-api-php-client/src/contrib/Google_PlusService.php'; session_start(); // Create a state token to prevent request forgery. // Store it in the session for later validation. $state = md5(rand()); $app['session']->set('state', $state); // Set the client ID, token state, and application name in the HTML while // serving it. return $app['twig']->render('index.html', array( 'CLIENT_ID' => CLIENT_ID, 'STATE' => $state, 'APPLICATION_NAME' => APPLICATION_NAME )); // Ensure that this is no request forgery going on,

Office 2010 server side automation in a Windows HPC Server 2008 R2 Environment

雨燕双飞 提交于 2019-11-28 12:50:14
I am aware of of the infamous Considerations for server-side Automation of Office from Microsoft and it clearly lists products from the 2010 suite. However, today I was made to believe by an IT ops techie that Office 2010 does not suffer from the issues mentioned in that article and can be used without issues within a server environment. I have been unable to find any reference or supporting doc that would substantiate the claim. (I will follow up with him on this, however he must have been referring to some other server side technique) My gut tells me he was smoking his socks! Is there an

Check if Javascript is Enabled (Serverside) with Rails

女生的网名这么多〃 提交于 2019-11-28 12:16:31
How would you check if javascript is enabled in Rails? So that I could do something like this in the views: <div> <% if javascript_enabled? %> <p>Javascript Enabled!</p> <%- else -%> <p>No Javascript</p> <%- end -%> </div> You can detect it, but it isn't pretty. First, you need a new controller with an action that updates a timeout in the session: class JavascriptController < ApplicationController def confirm session[:javascript_updated] = Time.now end end Next you need to include a javascript action in all your pages so this controller action is called on each page load. The easiest way is to

Android: Using server-side when working with Parse

核能气质少年 提交于 2019-11-28 08:50:51
Me and my friend are working on an app., and we wish to use Parse.com as our data base from which we can retrieve info. We can't decide what is the best way to access the data on Parse. For the sake of the example, our app. (i.e. client side) needs something stored on the Parse data base (say some number) - should it directly run the query using the Parse API, or should it make a request to a server side, let it retrieve that number from Parse, and send it back to the client? We know there's no definite answer, but we couldn't find answer regarding this specific situation. We read this post: