Tag Info

Hot answers tagged

5

You cannot prevent someone from calling your URL directly. What you can do, however, is reject invalid requests. You can add a unique key to each response which is then returned in the next request. If a request has an invalid or missing key, ignore it. This is the basic idea behind a session. In fact, you may be able to use sessions in your framework to ...


3

A server can be several things, in the internet context it will be a computer (either a single instance running on some hardware or a virtual machine) that is running a web server software (like Apache or nginx for example) that can take requests from a users browser. When such a request comes in it will look into it's configuration and find a project that ...


3

This is a classic API design dilemma, regardless of whether it's provided by a web service, or by linking a library, or by just being part of a code base that gets built along with everything else. It boils down to whether you prefer many functions that each do one specific thing, or whether you have fewer, more parameterized functions. Since web calls are ...


3

You include every line of code and configuration that took you time to write. It is doubtful that the 1 kSLOC of JSON and XML appeared out of thin air. If you fail to do this, you will underestimate the amount of effort to create the product. On the other hand, it is likely the case that writing 1 kSLOC of JSON will take a different amount of time than ...


2

I would have to agree with you that generating javascript ought to be the same whether from the 32-bit or 64-bit SDK. Further, I fail to see the project manager's concern about 32-bit clients visiting your site. However, it is conceivable that despite all intentions to the contrary, the 32-bit and 64-bit software (SDK) behave differently (i.e. one has a ...


2

You have to store your tasks, for instance in a db table, with at least the following informations: time_to_execute: timestamp of when task was set + delay in seconds to_do: things to do (this must be understandable by your backend) executed: 1 if the task has been executed already, otherwise 0 (default) Then, you need a scheduler, could be a cron, which ...


2

You can do this a few different ways. What you ultimately do depends on your server-side stack, your permissions on the server, and the nature of the side-effects needed for the delayed event. As I see them, your options are: An "embedded" scheduled task. If you're using a service-like backend technology (like a node server), you can put timeouts right in ...


1

For telecoms customers where downtime directly affects revenue and multicomponent migrations are often done in a one night process, we have used versioned table names and background scripts that replicate and convert the data prior to a cutover. That way testing can be done against the new version of the table which has a complete set of data against whict ...


1

I'm trying to determine when a web application should query a database for related data that may or may not be used in the current request. For such general questions it's hard to give a general answer. You have to consider two points: convenience and performance. Many things, which seem at first sight convenient are at hindsight performancekillers. ...


1

In your DAO layer, you should have a way to mark a relationship as required or optional (terms may vary based on whatever framework you use). Required relationships mean that if A links to B and I query A, the web service must return B as well. Use this for data where the two objects are always used together. Optional relationships mean that if A links to ...


1

A simple approach is to have a pending tasks table in your database. To create a task, add a row to the table that contains the action time, and any other data needed to process the task. You have a background thread that periodically queries the table, actions any tasks that have come due, and removes completed tasks from the table. I wouldn't describe ...


1

I suggest that you 1) learn what other REST APIs do, and 2) consider OData I love Odata because it supports every scenario you listed in one single API call. I'm biased though, because in C# you can implement an Odata server in just a few lines of code if you use the Entity Framework. There's also client side libraries that can format OData URLs. Let me ...


1

I have done such things as REST, which, as you say, doesn't solve all problems, though at least a few of them possibly. Basically search features I have implemented using URL params instead having a single URL for each of them. So your get_user_by_email would just be /user?email=joe.doe@something.net Similar you can handle the returned data for things ...


1

You could use a hash. If you had an inline script like this: <script>alert('Hello, world.');</script> You can hash it and specifiy it in your Content-Security-Policy header. Content-Security-Policy: script-src 'sha256-sha256-qznLcsROx4GACP2dm0UCKCzCG-HiZ1guq6ZZDob_Tng=' There's also a mechanism for using a nonce: <script ...



Only top voted, non community-wiki answers of a minimum length are eligible