server-side

Next.JS: How to make ALL requests server-side

三世轮回 提交于 2019-12-04 08:39:12
问题 I am building a Next.JS app that will be getting data from a Python API and an Postgres Database. Normally this would be simple, except requirements are such that I need to send all requests from the server-side, not the user's client. I have been working with and grokking getInitialProps, but I am not confident that it is the full solution that I need because of this line in the README : For the initial page load, getInitialProps will execute on the server only. getInitialProps will only be

How do multiple servers work in sync for web application?

独自空忆成欢 提交于 2019-12-04 07:53:43
问题 My first question is, I often read about people using multiple dedicated servers to run their websites, and process queries from users. But how do they exactly do this? I mean, when I enter a domain name, a DNS resolves maps that to an IP address, but I am lost after that.. is there some kind of master/slave architecture there to load balance incoming requests amongst the (potentially) hundreds of servers? If that's the case, how do the various servers, share data (database for e.g.)? Will

How to set html input type text value using ASP.NET C#?

谁都会走 提交于 2019-12-04 07:31:22
I have an html control which I want to set its value .... here's the control: <input runat="server" id="first_name_txt" type="text" placeholder="First Name" /> in code behind, I use: first_name_txt.Value = String.empty; but the value of my input control still has the old value like "blah-blah" and not set to "". Its old question , but may help someone. You have to use Request.Form to get and call .Value to set the value. HTML <input runat="server" id="first_name_txt" type="text" placeholder="First Name" /> CODE BEHIND //To get value: string myname=Request.Form["first_name_txt"]; // To set

input types on server side controls

时间秒杀一切 提交于 2019-12-04 06:43:57
问题 I'm using asp.net to build an ipad webapp. I know that using input type="email" will cause the keyboard layout on the ipad to change to handle email input more easily than the default. The problem is I'm using a server side text box control. Does anyone know how to make a server side control do this? 回答1: textBox.Attributes.Add("type", "email") or write it out like this in your aspx <input type="email" id="emailTextBox" name="emailTextBox" runat="server" /> 来源: https://stackoverflow.com

PHP: Obtaining Image Size

牧云@^-^@ 提交于 2019-12-04 06:26:13
问题 I am writing down a function and it takes an argument which is the physical path of an image on server. I was wondering if it is possible in any way to obtain its original size in pixels. In one variable I would like to store its width and in other variable its height. The challenge that made me ask this is because I have to obtain it on server-side thus any client-side solution would not help. 回答1: Try to use something like this: <?php $size = getimagesize ("img.jpg"); echo "<img src=\"img

Can you reliably set or delete a cookie during the server side processing of an Ajax (XHR) call?

给你一囗甜甜゛ 提交于 2019-12-04 06:23:38
I have done a bit of testing on this myself (During the server side processing of a DWR Framework Ajax request handler to be exact) and it seems you CAN successfully manipulate cookies, but this goes against much that I have read on Ajax best practices and how browsers interpret the response from an XmlHttpRequest. Note I have tested on: IE 6 and 7 Firefox 2 and 3 Safari and in all cases standard cookie operations on the HttpServletResponse object during Ajax request handling were correctly interpreted by the browser, but I would like to know if it best practice to push the cookie manipulation

LUA Script - web socket communication

旧街凉风 提交于 2019-12-04 06:13:37
问题 I am working with between Linux-based machine and android app. First of all, I need to open a server socket on the machine to communicate with the app. I need to code with LUA Script, and I have no idea with it.. Could you please give me some exmaple to open a server socket and receive the message from android app? thank you. 回答1: If you are looking for websocket support in Lua, try lua-websockets. For regular sockets, you can use luasocket; the introduction page includes an echo server

Securing AJAX Requests via GUID

与世无争的帅哥 提交于 2019-12-04 05:18:46
I'm writing a web app that will be making requests via AJAX and would like to lock down those calls. After a little research, I am considering using some form of random token (string) to be passed back along with the request (GUID?). Here's the important parts of my algorithm: Assign a token to a JavaScript variable (generated server-side). Also, store that token in a DB and give it a valid time period (i.e. 10 minutes). If the token has still not been used and is within it's valid time window, allow the call. Return requested information if valid, otherwise, log the request and ignore it.

How to run composer update on PHP server?

别等时光非礼了梦想. 提交于 2019-12-04 04:21:23
Is there a way to run composer update command on our production/test environment? Problem is that i don't have access for Command Line. WhipsterCZ Yes. there is a solution. but it could demands some server configuration... and some of these are forbidden by default due to security risks!! download composer.phar https://getcomposer.org/download/ - this is PHP Archive which can be extracted via Phar() and executed as regular library. create new php file and place it to web public folder. i.e. /public/composer.php or download at https://github.com/whipsterCZ/laravel-libraries/blob/master/public

javascript (spidermonkey) how does one run a linux command from js shell?

青春壹個敷衍的年華 提交于 2019-12-04 04:10:05
问题 I'm stumped and feeling stupid. I've tried every search combination I can think of to figure this out. It seems simple, but being new to javascript I'm not seeing anything helpful in my search for examples or demos. I'm looking to use a script like I would a python or perl script to run a simple linux command. The interpreter is up and running, so I'm just looking for server-side js resources for help in learning more about js. I've found lots of helful examples if I want to do these types of