New answers tagged

2

You could make your object graph immutable and model updates as operations on an immutable data structure. In general, if you want to build a new version of an immutable data structure you do not need to copy the whole data structure, but only the parts that are mutated. So you could write to disk the current immutable version of the object graph while ...


0

I'd say no, don't put this in your code if putting it in your code means that when the application starts up it detects that it needs to seed the DB and does it. There are a few reasons for this (some will be similar or the same as what Alpha has provided): As I understand this, it needs to run exactly once in production. Having this procedure in your ...


0

Possibly the most efficient way is to store all the tasks by their filter keys, so you'd keep track of key1 and associate task1 and task5 with it. You can then iterate through each input key to add the set of tasks for that key to a result set and then count the number of times each task appears in the results. For each task that appears the number of times ...


14

You can always add a file into your project and set its build type to Embedded Resource so that it is embedded directly into the application itself. Alternatively a file that is encrypted and placed in an accessible location.


21

If the data never changes and is read only, then just put it in a code file as a list of constants. public readonly string AppStartUpData = "MyAppNeedsThis"; If this data is different per deployment, then an external file is fine. .Net comes with built in .config files (App.Config). One should use those as there are standard ways (built in to the ...


13

A binary file would be the obvious answer, but it depends on how you are loading it - you might as well make life easy for yourself if you can. XML might be a good choice as there are built in methods in C# for reading this. You could add a checksum to your data, so that if the user alters it, the checksum will no longer match (you need to add a check to ...


6

If you don't want the user to even peek at the data, you should serialize it into a binary data file. Only the app would know the length of the chunks to read from it. I don't know C# but in Java you would create the file like this: FileOutputStream fos = new FileOutputStream(file); ObjectOutputStream oos = new ObjectOutputStream(fos); oos....


4

If a number takes up 16 bits, and you use 6 of them for something, that leaves 10 bits.


1

Here is my take on this : The requirement is to find out the sleeping activity of the user ids that are stored in MongoDB which can grow till 1 Million. Later this requirement can be extended to pull other activities of the user. To build a decoupled scalable system, you can create 2 services. Service 1 : picks up the userIds from mongoDB or other ...


2

This would be a good use for a producer/consumer setup. Without going into the implementation in detail, you'd have one component whose job it is to pull the list of users from the DB and add them all to a queue. This could be triggered by your timer. Then, you'd have a component which sits there in a loop pulling an item from the queue, making the API ...



Top 50 recent answers are included