Running thousands of NodeJS apps [closed] - node.js

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I would like to start writing lots of tiny "utility" NodeJS-based apps -- things like stream filters, generators, and the like, that might be 30-40LOC each. Each one would consume nearly zero CPU, RAM, or bandwidth (when the overhead of NodeJS and OS processes are factored out). The point is, I want a simple way to run thousands of them.
What do I need? Are there any PaaS's that can run thousands of NodeJS apps for a reasonable price ($10/mo)? Is there some kind of middleware that can give me thousands of sandboxed "partitions" on top of one Node process? Or is there some binary that's made for this that I could put on a VPS?

You can use vm module for sandboxing javascript code. It is still in works, be sure to read the caveats.
Functions that you can use:
runInThisContext: runs code in a separate context (but has access to global vars, not local).
runInNewContext: takes a seperate set of global var for context.
runInContext: takes a Context object(previously defined), for running the code.

Related

Linux script that will monitor folders and optimise image files? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
Does anyone know of an linux based script/program which will run continuously on the server and monitor a folder (with sub folders preferably) image files and optimise them, ala smash.it pngout, jpegtrans etc. Preferably all those tools.
I know there are lot of linux apps which will call upon these tools but I want one that will monitor a folder containing our website images and optimise new images (ignoring the images its already optimised previously) - on first run it should do everything, but after that it should know what its already processed.
Does such a tool exist?
if you can use a hook into inotify, use that. for example, let incron monitor specific directories, to which files are added or modified. if so, incron passes control to a program of your choice. convert, from imagemagick, can be useful for reducing image filesizes.
incron can pass name of altered/added files to your command or script, allowing it to work specifically on mutations, by using these variables as parameters to your commands:
$# watched filesystem path
$# event-related file name
$% event flags (textually)
$& event flags (numerically)

Optimistic and pessimistic locking in Node/Postgres? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I'm planning to use Node for my next project, because it seems to be a good fit for the problem I'm solving.
One thing I need to figure out is optimistic and pessimistic locking. http://guides.rubyonrails.org/active_record_querying.html#locking-records-for-update
Say, the user has a balance of 1. Two Node instances make requests concurrently to withdraw 1. The two requests could pass the check of sufficient balance at the same time, thus making two successful withdrawals resulting in a balance of -1.
Rails provides a wrapper around Postgres transactional and locking features. Does some kind of similar wrapper exist for Node?
How do you solve this in Node/Postgresql?
I know this is a database feature, but I wonder if Node or some library provides a abstraction away from writing raw SQL queries?

Threading Framework for Delphi 7 - any? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I'm looking for some threading framework to avoid writing it from scratches. Especially the tasks queuing and synchronization are what I need.
I know OmniThreadLibrary which is great but is not compatible with D7.
Any recommendations?
So you want to stay with Delphi 7, and you want a good thread library, but don't want to write it from scratch.
One day you will upgrade, I'm sure. So why go for a poor threading library that you'll need to change when you do.
My recommendation would be to take OmniThreadLibrary, and try to port it to work with Delphi 7. Then you'll have an upgrade path.
Otherwise, try one of the recommendations in: How Do I Choose Between the Various Ways to do Threading in Delphi?
A threading framework could possibly save you months of work in the long run, so depending on how important it is for you to have one, maybe you can use this as a reason to upgrade. And anyone who suggests that TThread and other Windows synchronisation primitives are all you need obviously has not written much threaded code. I estimate that I have spent at least 3-6 months just to develop my own threading framework to make things easier, and it has easily "paid" for itself.
I'm not trolling when I say this, but how about TThread? Although not a framework, it certainly makes working with Windows threading far less painful. Seriously, it is very well done.
Here are some links to get you started:
Delphi, Threading by Example
Synchronizing Threads and GUI in Delphi application
Running Queries in Threads

Can anyone recommend a good book or other resource on NTFS semantics? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I'd like to improve my understanding of NTFS semantics; ideally, I'd like some kind of specification document(s).
I could (in theory) figure out the basics by experimentation, but there's always the possibility that I'd be ignoring some important variable.
For example, I'm having difficulty finding definitive information on the following:
(1) When do file times (created/modified/accessed) get set/updated? For example, does copying and/or moving a file affect any or all of these times? What about if the file is being copied/moved between volumes? What about alternate streams?
(2) How do sharing modes and read/write access interact?
(3) What happens to security information (SACL, DACL, ownership etc.) when a file is copied and/or moved?
As I said, I could probably "answer" these questions by writing some code, but that would only tell me how the specific operations I tested behaved across any machines that I ran the code on. I'd like to find a resource that can tell me how this stuff is supposed to behave, identifying all the variables that could affect the behaviour.
TIA!
Apparently there are no public non-NDA specifications. Projects such as NTFS-3G would greatly benefit from them, but they don't mention anything.
A predecessor of NTFS-3G, called linux-ntfs, has made some documentation on its own here. Maybe that's good enough for you, maybe not.

Could you recommend an unstructured data indexing software? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I am collecting logs from several custom made applications. Each application has it's own log format. What I'm looking for is a central tool which would allow me to search through all of my logs. This means the tool would have to be able to define a different regex (or alike) for each log file (marking where a record begins, ends, and what are the fields). I've been trying Splunk, but I'm not happy with it, since performance are slow, I'm limited (free version) with the amount of indexed data per-day, and it's not as flexible as I want it to be.
Could you recommend a software (preferably free or cheap) for the task?
You can try Lucene. It is free. It is written in Java, and it allows full-text search over large amount of data. It is not a complete application, but rather a library, so you have to write code that uses it to index and to search your logs. You may have to define different document types or at least different indexing functions for your logs, but then search works beautifully.
If you can use Windows, try out Microsoft's best tool ever, Logparser. I wish there was such a simple tool for Unix. But there isn't. And although I've kept wanting to get around to making a Unix version of Logparser, I just haven't had the time.
Note: This would be a great project for someone with time on their hands or for a grad-student somewhere!
http://www.splunk.com/
Never used it, but have heard of it.

Resources