server-side

node.js: program either exits unexpectedly or just hangs

南楼画角 提交于 2019-12-23 08:01:36
问题 I wrote a module in node.js that performs some network operation. I wrote a small script that uses this module (the variable check below). It looks like this: check(obj, function (err, results) { // ... console.log("Check completed"); }); Now here is the interesting thing. When this code executes as part of a mocha test, the test exits as expected. I see the log statement printed and the process exits. When the code is executed as a standalone node script, the log statement gets printed, but

Server Side Sorting using Mongoose (mongodb + node.js)

牧云@^-^@ 提交于 2019-12-23 06:01:09
问题 I am trying to sort based on a function. I am currently doing the following, and it works. var _criteria = ... some search criteria var _pageNumber = ... the page num I want to see var _nPerPage = ... the number of documents per page var _sort = {}; _sort.name = ... the column name I am sorting on _sort.order = ... asc or desc sort Collection.find(_criteria) .skip((_pageNumber-1)*_nPerPage) .limit(_nPerPage) .sort(_sort.name,_sort.order) .execFind(function (err, docs) { ... }); Now I would

Server Side Sorting using Mongoose (mongodb + node.js)

半城伤御伤魂 提交于 2019-12-23 05:59:46
问题 I am trying to sort based on a function. I am currently doing the following, and it works. var _criteria = ... some search criteria var _pageNumber = ... the page num I want to see var _nPerPage = ... the number of documents per page var _sort = {}; _sort.name = ... the column name I am sorting on _sort.order = ... asc or desc sort Collection.find(_criteria) .skip((_pageNumber-1)*_nPerPage) .limit(_nPerPage) .sort(_sort.name,_sort.order) .execFind(function (err, docs) { ... }); Now I would

Looking for a managed image parser library (JPEG, BMP, PNG, GIF) [closed]

走远了吗. 提交于 2019-12-23 04:43:24
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I am writing a discussion board software that will have "avatar" images for the users. I want to resize any picture that gets uploaded to a reasonable size. I could easily do that with System.Drawing but that is relying on GDI+ which has hat security problems before. The problem is that the images are untrusted.

react-loadable.json with mini css plugin return undefined on styles

蓝咒 提交于 2019-12-23 02:22:23
问题 I am currently trying to code split for react server side rendering. Everything works fine except the refreshing part. When I refresh the page, Everything shows in server side. However, the split second right before client side takes over the lazy loading component is gone then it show up when client side start rendering again. "webpack": "^4.4.0", "mini-css-extract-plugin": "^0.4.0", react-loadable.json part { "undefined": [ { "id": 2, "name": null, "file": "styles.css", "publicPath": "/dist

Can somehow show progress on file upload without using AJAX?

狂风中的少年 提交于 2019-12-22 22:21:16
问题 Let's say that I upload a file using a basic multipart post. The server then receives the request and starts to execute the server side code. Can I somehow in that state start to output the response and after some data is sent start to receive the file? Finally when the file is uploaded I output the rest of the response. If this is possible I can display file upload progress without using ajax? I guess this might depend on what I run server side. But let's assume that I have full network

Can somehow show progress on file upload without using AJAX?

雨燕双飞 提交于 2019-12-22 22:20:54
问题 Let's say that I upload a file using a basic multipart post. The server then receives the request and starts to execute the server side code. Can I somehow in that state start to output the response and after some data is sent start to receive the file? Finally when the file is uploaded I output the rest of the response. If this is possible I can display file upload progress without using ajax? I guess this might depend on what I run server side. But let's assume that I have full network

change html tags text , on server side (C#, ASP.NET)

时间秒杀一切 提交于 2019-12-22 11:28:52
问题 can i change html client tags text , on the server side? like for example, change h2 or p tags text on server side? for example: <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <h2> Welcome to ASP.NET! </h2> <p> To learn more about ASP.NET visit <a href="http://www.asp.net" title="ASP.NET Website">www.asp.net</a>. </p> <p> You can also find <a href="http://go.microsoft.com/fwlink/?LinkID=152368&clcid=0x409" title="MSDN ASP.NET Docs">documentation on ASP.NET at

How to clear browser's cache from server side?

血红的双手。 提交于 2019-12-22 05:04:09
问题 I have to create a web application that deals with user's sensitive information. I need to immediately clear the browser's cache after user logs out since cached data would be vulnerable. Client's browser should be enforced to clear the Cache from server side. Also all cache policies must be exposed to the client from the server side. Is there any solution to this problem? 回答1: Set the response to expire immediately, and for good measure tell proxies, etc., not to cache: Expires: 0 Cache

Can I execute js files via php?

谁都会走 提交于 2019-12-22 00:38:46
问题 The situation is next: I have php file, which parses a web-page. on that web-page is a phone number and it's digits are mixed with each other. The only way to put each digit on the correct place is to use some JS functions (on the client side). So, when I execute that php file in linux console, it gives me all that I need, except js function's result (no wonder - JavaScript is not a server-side language). So all I see from JS - only a code, that I have written. The question: can I execute js