having a global variable persist after crashes in Nodejs [closed] - node.js

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 8 years ago.
Improve this question
So lets say I have this global variable foo, which while my server is running I can access it. What I want to be possible is if my server crashes it will first initially try to recover foo, then continue to do server stuff. I want to know the best way possible to do such a thing. Here are the ways I can think of doing this.
1, Whenever foo is updated, (which not frequently), I will write to a file a marshalized foo, and when my server crashes it will eval the content's of the file to be foo.
2, Use a light database such as sqlite to store foo,
Come to think about it both these ideas are really closely related, but is there a referred solution given that foo is at any point going to be 10kBytes.

I would store the var in redis. This allows what you want and provides scalability.
Node redis module: https://github.com/mranney/node_redis
Hands on: http://howtonode.org/node-redis-fun

Related

Can using a math interpreter be potentially dangerous? [closed]

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 1 year ago.
Improve this question
I want the user to be able to write their own math functions in my program. And these functions could possibly be shared with someone else, and run natively on their machine. Algebra is Turing complete. Does it mean I should warn users of my program about potential danger of running math? Sorry if this is a silly question :)
Edit:
I am making a simple diary, but the entries have dynamically calculated properties. I am thinking of using bc for running the user defined functions. It's rather easy to fix things for user if the expression does not end since they can modify the expression outside of the program. But let's say user A sends user B their diary. Should I warn user B that it's not safe to open their diary?
For example, you can have a Turing-complete language with recursion, but limit the stack size and run time (to kill the busy beavers) for each user script. If it's implemented as some kind of a VM it'll be very easy to do. You can also have a total functional language to ensure termination (but that won't solve the busy beavers problem).

This edit resolves the original close reason and the question should be considered for reopening [closed]

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
This edit resolves the original close reason and the question should be considered for reopening.
To be honest, just do it, you don't have to "look" for anything just make apps, make better and better apps, start with a simple MySql login app, then manipulate data from database make a forms app that displays something, make a simple text editor etc etc and put it on Github, so you can show it on a interview simple as that.
Good luck!

Is it a good idea to use global variables to store DB handles in a Go web application? [closed]

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 8 years ago.
Improve this question
Official guide says it's okay to use a global variable to cache templates:
http://golang.org/doc/articles/wiki/
First we create a global variable named templates, and initialize it
with ParseFiles.
Can global variables be used to store DB handles and repository objects? Or do they have to be initialized for every request?
Thanks a lot
Yes, that's perfectly fine, it's used in the official Go packages all over the place, now if you gonna modify these objects from your handlers, you will have to use a mutex so you wouldn't run into races.

How would someone implement version control system in an application for their users, eg. in plnkr.co [closed]

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 2 years ago.
Improve this question
I am creating an application where each user will have his own workspace which will consist of some text files. He will be editing and saving these files excessively.
I want to implement a version control system for each user to keep track of his work and revert back and forth to any previous version if he wants to.
I would also like users be able to fork into each others workspace to copy the content to their own workspace just like in plnkr.co, make changes and commit easily.
My stack is node.js and angular.js
Where should I start, to implement it. I guess there should some way to use git or some other open source project. Does anybody have any idea what plunker is using?
Super late response, but for anyone stumbling across this, try checking out git=annex
We used this at one of my old jobs for keeping track of fMRI datasets. It's best used for large data though, so one may want to find something similar but perhaps better aligned for what they need.

NoSQL - what's the best option for IP tracking? [closed]

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 9 years ago.
Improve this question
I'm trying to implement a system using node.js in which a number of sites would contain js loaded from a common host, and trigger an action when some user visits n+ sites.
I suppose a nosql solution storing a mapping of ip address => array of sites visited would be preferable to a RDBM both in terms of performance and simplicity. The actions I need are "add to array if not there already" and getting the length of the array. Also, I wouldn't like it all to sit in memory all the time, since the db might get large some day.
What's a system that fits these requirements the best? MongoDB seems like a nice option given $addToSet exists, but maybe there's something better in terms of RAM usage?
When I hear about working with lists or sets, the first choice is Redis

Resources