Questions tagged [resources]

Memory, files, network connections, I/O devices and other objects that have to be acquired and then released within a program. Please do not use this tag to ask questions about educational resources such as tutorials, books, websites or classes. Those are off-topic on Programmers.

Filter by
Sorted by
Tagged with
0 votes
1 answer
108 views

Sink or non-sink API's?

This might be an opinionated question but I'm eager to hear your anecdotes as I'm at the beginning of designing a new API. Now I'm questioning whether I want this API to be a sink API or non-sink API. ...
0 votes
0 answers
42 views

In Laravel, how do you handle a resource being managed differently depending on a user role while using policies?

I find myself in a situation where I have two roles, "Admin" and a "Organizer". The "Admin" accesses the AdminUserController to update users, while the "Organizer&...
-2 votes
2 answers
61 views

When to self-audit complex calculation [closed]

Given an app that manages appointment bookings, I'm separately storing purchases, bookings made, or cancellations (some of them non-refundable) and am required to show the sum of these, based on ...
0 votes
1 answer
140 views

Can resource which requires asynchronous cleanup be constructed synchronously?

More specifically this applies only to resources which have asynchronous dependencies themselves (but I think that's majority of them). Concrete example: class Foo : IAsyncDisposable { public ...
73 votes
4 answers
11k views

What is the purpose of storing multiple lower resolution versions of the same original image?

Sometimes in apps I look into the Resources and find files for, for example, a 256x256 version, a 128x128 version, a 64x64 version, AND a 32x32 version, of the same icon. When I see simple geometric ...
0 votes
0 answers
109 views

HTTP polling vs WebSocket for very small payloads that don't change often

In our team we are currently discussing which technology makes more sense for an upcoming feature - HTTP polling vs WebSocket. To give some context: We are developing a TV streaming application (...
41 votes
9 answers
6k views

Is memory management in programming becoming an irrelevant concern?

Background I revisited an old (but great) site I had not been to for ages - the Alioth Language Shootout (http://benchmarksgame.alioth.debian.org/). I started out programming in C/C++ several years ...
2 votes
1 answer
442 views

How to structure your URIs?

I am making a web UI and an HTTP API for editing JSON documents in collaboration (role and versioning system). There are several types of JSON documents. Each type is described by a JSON schema, let ...
2 votes
1 answer
974 views

How to store a vector of smart pointers, except some of them are owned by another object?

I'm making a basic platformer game. I have a Game class as well as Level class. The game object holds a pointer to the current Level object. A level currently has a std::vector of GameObject raw ...
32 votes
5 answers
10k views

Why can't Java/C# implement RAII?

Question: Why can't Java/C# implement RAII? Clarification: I am aware the garbage collector is not deterministic. So with the current language features it is not possible for an object's Dispose() ...
0 votes
1 answer
95 views

Managing the disposal of network connections

I am writing a class -- let's call it MessageSender -- that needs to perform operations over the network. It basically does these things: Take some configuration establish a connection send stuff If ...
-1 votes
1 answer
185 views

Updating last resource access time when clients perform a GET

We have many clients which, upon start up, request a specific resource on the server using an HTTP API (not RESTful). This resource is - currently, identical for all clients. Naturally, since the ...
-4 votes
2 answers
77 views

How do browsers isolate traffic within a single tab?

I know that browsers use a separate port for each tab. However, in each tab, there might be multiple scripts doing data transfer over the network. How does a browser makes sure that the data is ...
1 vote
2 answers
113 views

How do VMs and GCs treat objects which wrap yet active resources, but that are unreachable from user code?

I am building an interpreter in C for a simple programming language. The interpreter is fitted with a built in garbage collector. The GC simply marks all objects which are linked from some root (the ...
1 vote
1 answer
3k views

Managing .resx resources files for multiple languages application

I am currently developing a software for a multi languages environment using visual studio (en, fr and es). The soft is some kind of a 3d configurator, if I take the exemple of a car configurator, the ...
2 votes
1 answer
395 views

How can I accurately estimate the minimum resources my application needs?

For an application that is starting out I do not want to over pay for servers and resources that will not be used since the budget is very limited at this point. This will be a for an iOS and Android ...
-4 votes
1 answer
64 views

Can iOS App Process Location Info while it's not running?

I want to ask about iOS application characteristic/behavior regarding processing location information. My previous wording isn't straightforward and seems to make it look unclear (which is my problem ...
0 votes
1 answer
96 views

Designing a system of loadable resources with dependencies

Context: For a video game, I need to load an arbitrary amount of resources which when combined would form a complete level of the game. These resources would be 3D models, textures, sound, etc. Some ...
0 votes
1 answer
606 views

Are resource files (.resx) secure?

I have a resource file called AppSecrets.resx, and the bit of code below to check the login credentials of the "super duper admin user". This admin user is distinct from normal admin users, as it is ...
1 vote
2 answers
1k views

Making localization files easy to use for translators

I want to make my application available in many languages. I started using Resource Files, but there is a little problem with them. I want other people to have access to these files. Visual Studio ...
9 votes
7 answers
35k views

What are the alternatives to resx file

I am developing a Windows application and I want to store all the text for labels, radio buttons, buttons, check boxes and column headers of grids at one place. I have tried using a class file, an xml ...
36 votes
2 answers
5k views

What is the proper way to do REST?

Everybody nowadays does SOA, even if some don't actually understand what is all about. So they do it wrong. Using that as an analogy I know what REST is (or at least I think I do) and want to do some ...
10 votes
3 answers
9k views

Is it OK to use email as an identifier in a RESTful URI?

I'm working with a team building a RESTful web service, and our current implementation utilizes the user's email as a unique identifier for the user resource, yielding URIs like the following: https:/...
1 vote
1 answer
129 views

Board support driver for custom board - API design - MCU resource configuration

I have got to implement a board support package for a custom board, and I would like to know your opinion about the different approaches of designing board support drivers. My custom board pupulates ...
4 votes
3 answers
5k views

How do you format part of a resource?

Suppose you're building a web application in ASP.NET MVC, and you have to display some formatted text. A very simple example might be: Click any of the links below, or click here to cancel. ...
2 votes
1 answer
72 views

recommendations regarding resource uri

lets say we have a "door api" and I want to create a resource to close the door. I could do this in 3 ways: traditional way using PUT with payload {id: XX, color: YY, closed: true} advantages: ...
1 vote
2 answers
217 views

API - editing subset of attributes

Given a resource for which only its subsets of attributes can be edited, {E.g. invoice (resource) with a status (attribute) and paidAmount (attribute)}, in terms of API design, which amongst the ...
5 votes
2 answers
2k views

Implementing reference counting from scratch or using shared_ptr for resource?

In an OpenGL application that I am writing, I want to have a simple shader class to wrap the OpenGL shader handle. Ultimately, I want this shader class to behave very similarly to a shared_ptr in c++ (...
9 votes
4 answers
7k views

How do you find out what resources are unmanaged?

Looking through the .NET documentation, specifically the WebRequest class, I don't see any information indicating that I should wrap an instantiation of it in a using statement. Even the provided ...
4 votes
2 answers
1k views

REST Api Design Patterns

I'm developing a REST Api using Node.js & Express.js. Recently I've started looking towards best practices for REST Api design but it's bit confusing so please bear with me. For Example: Lets ...
2 votes
1 answer
148 views

Mark&sweep GC with automatic freeing resources

Note: I use term "resource" in opposition to memory here, resource here is file, socket, etc. Is there a language implementation that uses M&S GC (but not necessarily only that kind ¹) that is ...
4 votes
2 answers
544 views

Should ID be given in URL if already secured with JWT containing ID?

Say I have the endpoints: /users and /users/<id> If I wanted to DELETE a user authenticated with a JWT token that contains the user object, should this DELETE handled go under /users or /...
3 votes
2 answers
579 views

Why does C#'s System.Threading.Semaphore implement IDisposable and why doesn't java.util.concurrent.Semaphore implement Closeable?

In .NET framework, System.Threading.Semaphore is an IDisposable that requires manually invoking dispose. However, in JavaSE, java.util.concurrent.Semaphore is not a Closeable nor an AutoCloseable. ...
0 votes
2 answers
150 views

REST Resource design

Hi I'm working with an API Where an employee can see his Vacation (overview and balance) and Request new Vacation. A manager can Approve or Reject a Request for Vacation. He can also create Vacation ...
19 votes
2 answers
23k views

To include a resource ID in the payload or to derive from URI

Designing an API, we've come up against the question of whether a PUT payload should contain the ID of the resource being updated. This is what we currently have: PUT /users/123 Payload: {name: "...
1 vote
1 answer
104 views

Structuring Resource Files

In .NET we've got Resource files which are great for allowing providing translations across your application. In the past I've seen these resource files grow into monolithic unmaintainable lists of ...
1 vote
1 answer
69 views

Who should read an external resource

I am often in the following situation: I have a config file, specifying the path to a resource file This config file gets parsed and the values (e.g., file path) are stored in a ConfigStore object A ...
3 votes
4 answers
1k views

How to design HTTP endpoint which search for single resource instance and returns it with another, connected instance

I have an endpoint returning single-element collection (I didn't return just object-instance to keep consistent with resource-as-collection convention, so only get-by-id returns single instance) GET ...
19 votes
3 answers
26k views

What's the difference between an Asset and a Resource?

I've used several IDEs and created several default projects. Upon creation, I'll find folder structures created for me. Sometimes I'll see a Resources folder, sometimes an Assets folder, and sometimes ...
13 votes
2 answers
14k views

Can a REST API return multiple resources as one single compound resource?

I'm in the progress of creating a REST API and currently, I'm encountering the following problem: Foo is the first resource. CRUD operations can be applied via the /foo/ URI. Bar is the second ...
70 votes
16 answers
21k views

Is it a waste of time to free resources before I exit a process? [duplicate]

Let's consider a fictional program that builds a linked list in the heap, and at the end of the program there is a loop that frees all the nodes, and then exits. For this case let's say the linked ...
3 votes
2 answers
9k views

Can GC.SuppressFinalize cause performance problems?

I'm being asked to implement IDisposable on objects that are 100% managed resources, which contain no streams, and no large resources. I understand the importance of properly disposing of large ...
1 vote
0 answers
136 views

Trade off between concurrency and stagnation in a Dining Philosophers problem analogue?

I am currently facing a problem in the application I am developing that I think is the same as, or an analogue of, the Dining Philosophers Problem. In my application I have a list of N resources. I ...
16 votes
5 answers
4k views

How to organize localization string resources?

We're developing a large application, consisting of many small packages. Each package has its own set of resource files for localization. What's the best approach to organizing and naming the ...
4 votes
1 answer
5k views

Rest API calls with side effects on other resources

Let's say I have a mobile app, android/iOS and a java Spring back end. Given the mobile connectivity, the number of network round trips must be limited, ideally, 1 or less per screen. Now, let's say ...
1 vote
4 answers
1k views

How do I elegantly store tabular data in code?

Let's say I want to store date which cannot be changed by the user in code. For example, my application supports ten types of reports, and I want to store metadata about it. Usually, I'd use a ...
1 vote
1 answer
86 views

What's the proper name for the type of security where we secure resources by ownerrship?

I work on a REST API that mixes two types of security: First you have standard role-based security - so we have multiple roles such as administrator, read-only user, super user user, etc. Then we ...
18 votes
4 answers
4k views

Why are string resources generally kept external to the code and not inside the code?

Generally, on many platforms, I'm writing my string resources to a .resx or .xml file, and then I'm getting them using some platform-dependent approach. That is, on iOS, I'm getting them via NSBundle....
14 votes
2 answers
8k views

Should Java 8 Stream instances always be close()'d?

Quoth the Javadoc: Streams have a BaseStream.close() method and implement AutoCloseable, but nearly all stream instances do not actually need to be closed after use. Generally, only streams whose ...
-1 votes
1 answer
76 views

How costly is DB data transfer as compared to data storage?

I've seen a number of answers (1, 2, 3) where they state that storage is cheap. So when designing a DB structure, it shouldn't be a main concern, or at least it doesn't rank very high in the list of ...