Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I have a 5 applications(programmed in 5 different languages) deployed in one common web server and these applications are written to work on a particular task and create a log file for any action. How can we achieve a security of log file by not being over written by other applications?
First of all, if you don't trust one application to not clobber the log file of another one, then you have a really serious problem. `Cos the applications could also do other more harmful things. If the applications are believed to be insecure or untrustworthy, the most secure answer is to not run them at all.
If you are concerned that applications might accidentally write to the same log file1, just configure them to use different log file names or different log file directories2.
If you are simply trying to secure the logging, then one solution is to do your logging via an independent (secure) logging service such as Linux syslog.
Another approach is to create separate accounts for running each of the applications, and make sure that you set the file and directory access so that one application doesn't have permission to modify another's log file.
1 - Actually applications can safely write to the same file if they all open the logfile in "append" mode. Log file rotation could be problematic though.
2 - You've probably already thought of that.
If your logs are stored in a commong log folder, then a simple solution would be to have proper naming for logs of different applications
e.g.
pythonApp_log_timestamp
aspNetApp_log_timestamp
This way applications will write to its designated logs and not overwrite other application's log and would work irrespective of your hosting environment linux or windows.
Also you could limit the file size of each of the log file that your applications create, this way you could ensure that applications create new file if specified file size has been reached and not too much data is dumped into a single file, this will help in debugging or verifying the logs later.
I use this method in my application and helps me find the log from specific duration and not searching logs too much.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am creating a website that must be able to login using the credentials that are saved in a text file(login.txt).After logging in the person must be able to add and remove images(images folder).
These images will then later be used to create a gallery that all users will be able to view.
What I want to know is can i achieve these results by only making use of HTML and JavaScript or must i also make use of server side languages like php or asp.net ?
note : I have done a good amount of research and still wasn't able to find an accurate answer for this question.
Any advice will be useful. Thanks ahead...
Short answer: You have to use a server
I assume you already know Javascript, so my advice is use Node.js.
You have to use a server side language because other users need to see the gallery , besides the ones that are uploading. So you can't use localStorage to save the images, because the front-end is private to the user, not global to every user (like a database or a server).
Some suggestions:
Use a database for user details, is faster, safer, and more maintainable
Define a Rest API on the server-side
On the front-end make a Single page application (using desired framework/libraries), using TDD principle
You should to use a server side language.
And if you save the credentials in a text file then anyone can reach these infos with that file url. ( Eg: http://yoursite.com/login.txt )
What I want to know is can i achieve these results by only making use of HTML and JavaScript or must i also make use of server side languages like php or asp.net ?
You'll need something on the server. That something might be:
Web server software that supports using the PUT verb to put files in a directory on the server. The general term for this is DAV or, in the web context, WebDAV. Apache, for instance, supports it with mod_dav. I've never tried it, but it may be possible to set up Apache with simple authentication (probably not with a plain text username/password file, though) and enable WebDAV for authenticated users. Your client-side code could then send PUT requests via ajax.
A server-side programming environment of some kind whether that's PHP, ASP.Net, NodeJS, or something else.
A content management system of some kind that already provides the ability you would otherwise write.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I've got a plan for four systems: A, B, C and D.
System A is to hold a small database which will accept information from the other three systems via HTTP requests--I'll try to implement a RESTful service here. The other systems only talk to System A.
System B and C both produce a .csv file which I need to monitor for changes and then send their contents back to system A with a timestamp. I'm afraid that while communicating back to A, a file change might be made but the system will ignore it because it's busy.
System D will be run by the client on a browser.
Is Node.js appropriate to run on systems B and C? To monitor the file changes and send some PUT/POST requests to System A? In the rare case of an update taking very long to occur on System A, will Node.js be able to send another request if it sees a file change while the first one is trying to finish? I've never used Node, but I feel like this is what it's good for. I'm willing to give it a shot.
I'm afraid that while communicating back to A, a file change might be made but the system will ignore it because it's busy.
Well worry not because node is built from its very core to be asynchronous. It's very tagline is:
Node.jsĀ® is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
You could certainly use other languages/platforms to solve your use-case as well, but node was practically designed for stuff like this :)
I play a game called Hearthstone and the game generates a log file of what happens as the game progresses. I wrote a little log watcher module that monitors the Hearthstone log file. This code snippet is the portion that monitors the file.
So far my app has never missed any lines in the log file since each of the file change events are queued up as changes happen. My app doesn't block while waiting for file changes and then processing them. Instead, node adds events to the queue and checks their status with each iteration of the event loop. Eventually it processes all the file change events no matter what.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Can anybody explain me what is the difference between LAMPP and METEOR js framework?
Thanks in advance.
There is quite a big difference between the two.
LAMP:
This is a stack that originally (and still largely) stands for Linux Apache MySQL and PHP
The alternative of windows is called WAMP.
The linux part is the system the stack is running on; Apache is a server system where you can store and access your websites and apps; MySQL is the type of database(Relational Database); PHP is the server-side language you use to create these dynamic sites (you can also use python or perl).
The community is much larger and you can get support everywhere as it has been around longer than Meteor
If you run a linux os, you can literally download the apache server and host it on your computer see: http://httpd.apache.org/
Meteorjs
Meteor is a full stack platform that allows you to write all your code in Javascript. This means you can write the front end in Javascript, then turn around and also write the server/backend using the same JavaScript! Literally write once, run everywhere
Meteor allows you to write an app in very short amount of time as you are using just javascript.
-What really makes Meteor stand out is their "realtime" way of doing things. With mete0r, everything is reactive. When a change happens in the server, it is immediately reflected on the front-end without refresh or waiting at all!
Meteor apps come with Mongodb (NoSQL) already set up as your database system as opposed to MySQL used by LAMP. Meteor goes the extra mile by also creating a small database in the front end of your app and whatever changes you make are performed in this mini-mongo database which automagically synchronizes with the server and updates it. METEOR DOES ALL THIS FOR YOU.
-Learn more at https://www.meteor.com/ and this https://www.youtube.com/watch?v=RpQTPWvD6HA offers a great intro.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm interested in using Node.js to aggregate various pieces of information from different servers using JSON API's. Summarize it and serving it as static web pages. The data I am collecting is ~100kbytes so I am assuming it would reside in the memory and be served when request.
So is there a way of aggregating caching data in memory as a JSON structure which could be served to static pages. I would prefer not to write it in MongoDB.
I am using 'serve-static' to serve static web pages from node.js.
The npm site shows 241 results for cron.. Another approach would be to remember the last time you did an update, and, everytime a user connects, check that time and do a "just in time" update. I have a site that does the latter. Depends on how long and complex is the update.
It seems to me that using a templating engine like JADE would be superior to serving static pages that aren't really static. Not that I like JADE, I don't, YMMV, but if your data is dynamic then using templates seems to make way more sense.
Storing JSON in memory or in Mongo is so simple that I really don't understand that part of your question.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I understand this question has been asked before, but I couldn't think of a simple definition of my problem to put in it's place. I am learning to do this informally, so I'm not exactly sure how to phrase questions/search for answers yet.
I'm trying to build a simple checklist program as I learn javascript - I'm doing this by hand without using any libraries (so no jQuery, just basic javascript). I have a functioning DOM interface getting formatted by CSS, all running in and editing the contents of a <div>, so that side of things seems fine.
I'm testing this off of my HDD and have no intention of hosting it anywhere.
Currently, I'm trying to solve my data storage problem without installing php/mysql/apache. I'd like to have each task list nested "subtasks" when selected, with one level of nesting.
To do this I'd like to create a new XML file every time I create a new task, and then append it's information to a list file (list.xml) so that I can navigate list.xml to dynamically display all the current primary tasks.
I've since learned that you cannot simply create new .xml files with javascript alone, for security reasons. While this makes sense, I'm now looking for other solutions.
What is the simplest way to store this information as it's entered? One solution I've considered is having just one XML file (so I always know what to point the script to), and using "<id>" nodes to slave subtasks to their respective primaries. This would, however, create a very long and disorganized XML file that would become cumbersome and annoying to traverse, forcing me to write a tricky method for looping through it.
Should I continue as I am to simply complete the project and help lock in my skills (it will be my first complete "program" with a gui of any kind that wasn't dictated by a guide or lesson), or should I bite the bullet and go through the annoying php install (I did this on my last tower and it was a frustrating time-consuming mess) and learn php/mysql/apache for all the server-side nonsense?
sry about tl;dr please help my pynchonesque code masters will kill me
You can't do much in web programming with only user side. Sooner or later you will have to learn also server side. And installing PHP is not so annoying. You can use wamp server. It has very simple installation.
If you're learning Javascript, I'd recommend staying with Javascript (don't jump over to PHP or some such just because it'll save you 5 minutes in configuration).
There are a number of really nice Javascript serverside frameworks that will happily write files to the file system or talk to a database for you. Node.js is currently the most popular. I don't want to start a flame war about how or why Node is superior to PHP, I'm simply saying that if you're a beginner, I wouldn't mix apples and oranges and just stay within one language.