Tag Info

New answers tagged

1

No, there is nothing wrong with evaluating your own code, if you know for certain it's safe. Too many get caught up in blindly following rules. Evaluation of code in a string seems to really bring out strong opinions for some reason. Evaluation of code in a string is a tool. Learn what it does, how it works, and why it can be unsafe. When you really ...


3

If the JSON string is encoded entirely under your control, it is exploitable to the extent that your encoding method is broken. That said, you should be safe if you're performing a straightforward serialization using a trusted serializer, like so: var js = new JavaScriptSerializer(); var thingy123 = ThingyRepo.Get(123); var json = js.Serialize(thingy123); ...


10

Suppose I have a server-side variable containing JSON, called strJSON that my own code created. Was it created entirely by your code? Are you certain that at no point does it add in a piece of user input? Are you also certain that at no point in the future will it ever be modified to add in data that comes from user input? If you can be 100% sure of ...


1

I think option 2 is your best bet. While the public and admin sites are related and use the same DB most likely, admin use cases and work flows typically have little overlap with the use cases and workflows in the public site. So the admin site will likely have its own distinct set of business logic. You can certainly move code which is common into ...


2

You should assume that the server-side dataobjects use their own conventions, and the client-side would have its own. When fetching/posting data, you can set up a model adapter to handle switching between the two. By doing it at this level, each side uses their own conventions that make sense in each's contexts. After fetching your data from an ajax get, ...


0

The most performant solution is in-memory, after that.. YMMV. For example, reading the data from file can be slower than reading from the DB. I wouldn't like to say which is better, so you'll have to test it. However, if redis is caching the file, then this will be faster (effectively in-memory!) so I'd go for that, but automated consistency is something ...


1

You're basically writing a compiler, which translates from SQL to whatever your datastore understands. In the end, you'll probably have the following parts: a Parser which takes SQL and produces an Abstract Syntax Tree a bunch of Visitors which do semantic analysis and/or rewriting on the AST an Interpreter which finally executes the (processed) query ...


0

Primarily Adapter to adapt native datastore commands to SQL dialect. IMHO I would advise you against exposing SQL API in such case. You are better off delivering native datastore-like commands (possibly wrapped somehow) that are supported by datastore developers. Simply - do you create costly overhead that won't deliver much value?


0

There are also some other libraries used for data exchange, e.g. protobuf or MessagePack. These libraries can better fit your needs - depends on data you plan to exchange


1

Parsing chunks from a stream is usually an issue. One of the issues is that you often need to know the size of the packet to allocate the buffer needed to hold it while parsing. Most text based formats don't have that instead they are delimited by a special set of characters (JSON it's the closing brace/bracket). If you elect for a binary transmission I ...


0

Don't see why not, its juts another format you have to handle, and there are thousands of them in the wild already. At least JSON is a well-known format. A quick google says libjso, cJSON, and NxJSON are available as libraries to help parse and manage your data payloads so there shouldn't be much issue with the complexity of parsing it, no ore so than XML ...


1

Another alternative (using HATEOS). This is simple, mostly in practice you add a links tag in the json depending on your use of hateos. http://api.example.com/games/1: { "id": 1, "title": "Game A", "publisher": "Publisher ABC", "developer": "Developer DEF", "releaseDate": "2015-01-01", "platforms": [ {"_self": ...


0

This is one of those basic questions when it comes to REST API design. Every designer asks themselves this question on the first day. Sorry but the answer is "it depends". Each approach has pros and cons and you'll just need to make a decision and go with it.


0

JSON.NET has a nice approach for this. It provides different ways to deal with this issue. See Serializing and Deserializing JSON. There are method resulting in a type called JObject which has methods allowing you to traverse the resulting model.



Top 50 recent answers are included