Skip to main content

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
12 votes
4 answers
3k views

How to initialize the same global resources from multiple modules independently?

I encountered the following situation: I have two modules, TokenService and Wifi which are initialized from main(). The modules themselves don't know of the existence of each other and function ...
glades's user avatar
  • 419
0 votes
1 answer
268 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. ...
glades's user avatar
  • 419
0 votes
0 answers
89 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&...
Aridez's user avatar
  • 129
-2 votes
2 answers
63 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 ...
benomatis's user avatar
  • 105
0 votes
1 answer
291 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 ...
Shadow's user avatar
  • 361
75 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 ...
CPlus's user avatar
  • 1,189
0 votes
0 answers
142 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 (...
david.mihola's user avatar
2 votes
1 answer
2k 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 ...
Luke B's user avatar
  • 147
0 votes
1 answer
322 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 ...
Felk's user avatar
  • 194
-4 votes
2 answers
82 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 ...
marked-off-topic's user avatar
1 vote
2 answers
146 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 ...
Aviv Cohn's user avatar
  • 21.5k
1 vote
1 answer
4k 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 ...
TontonVelu's user avatar
2 votes
1 answer
594 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 ...
Luis Liz's user avatar
  • 131
-4 votes
1 answer
100 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 ...
Alvin Suryadi's user avatar
-1 votes
1 answer
499 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 ...
user991710's user avatar
0 votes
1 answer
102 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 ...
aybe's user avatar
  • 955
0 votes
1 answer
806 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 ...
Stian's user avatar
  • 131
2 votes
1 answer
472 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 ...
Géry Ogam's user avatar
1 vote
1 answer
145 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 ...
Sinushyperbolikus's user avatar
2 votes
1 answer
77 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: ...
masber's user avatar
  • 327
1 vote
2 answers
437 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 ...
Opal's user avatar
  • 275
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++ (...
Anonymous Person's user avatar
2 votes
1 answer
153 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 ...
greenoldman's user avatar
  • 1,543
6 votes
2 answers
1k 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 /...
tomhepz's user avatar
  • 351
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 ...
Lorenzo von Matterhorn's user avatar
0 votes
2 answers
180 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 ...
Christian Johansen's user avatar
4 votes
3 answers
6k 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. ...
John Wu's user avatar
  • 26.9k
1 vote
1 answer
70 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 ...
andrew231's user avatar
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 ...
AndrzejD's user avatar
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 ...
FCin's user avatar
  • 522
13 votes
2 answers
16k 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 ...
ceran's user avatar
  • 255
3 votes
2 answers
672 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. ...
Yang Bo's user avatar
  • 141
1 vote
0 answers
143 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 ...
KDecker's user avatar
  • 185
4 votes
1 answer
6k 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 ...
MikaelW's user avatar
  • 651
18 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 ...
Daniel Wolf's user avatar
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 ...
Heinzi's user avatar
  • 9,838
-1 votes
1 answer
88 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 ...
garci560's user avatar
  • 267
1 vote
1 answer
435 views

When should I consider using a string table resource over a string constant in my Win32 application?

I've written a fair bit of Win32 desktop apps as hobby projects throughout my career but I've never used resources of the type string table in any of them; usually I either hard-code strings or build ...
Govind Parmar's user avatar
6 votes
2 answers
9k views

Does RESTful response always return a 404 and empty content when an array is expected but the result is empty?

I worked with Ruby on Rails and RESTful api before and now with Django Rest framework. For this question let's say we only consider the case of JSON but not XML. It seems that when we expect an ...
nonopolarity's user avatar
  • 1,837
4 votes
1 answer
2k views

Is it better not to .close() inside API method body when passed a Reader or InputStream?

There are plenty of similar questions that have been answered. Example here. However, they all have both the Reader and the InputStream within the same scope or method body, and so suggest to close ...
YoYo's user avatar
  • 584
3 votes
2 answers
1k views

How do I model a sortable resource in sql database? [closed]

I encounter this issue when I create REST API. I cannot tell the exact scenario, but let's say it is for a website that has category and product resources. Each category has many products and both ...
Curious Sam's user avatar
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 ...
RuslanD's user avatar
  • 731
16 votes
4 answers
16k views

Will the Database connection be closed if we yield the datareader row and not read all the records?

While understanding how yield keyword works, I came across link1 and link2 on StackOverflow which advocates the use of yield return while iterating over the DataReader and it suits my need as well. ...
GawdePrasad's user avatar
1 vote
1 answer
66 views

Fill widget with data retrieved from internet

I want to retrieve data from internet and show them into a widget. In particular, I've a widget with a QComboBox containing some service from which I can retrieve a list of exchange markets. When I ...
Jepessen's user avatar
  • 123
3 votes
1 answer
2k views

How to deal with relative paths in out of source build?

An out of source build is a build which can be in any directory other than the source directory I have a project which contains relative paths to some resource files, needed at runtime, which are ...
user695652's user avatar
3 votes
0 answers
179 views

Is there a language for defining restful web services? [closed]

I'm implementing a restful service automation tool for client applications. Basically, the tool takes a config file that defines restful resources, and creates some DTOs and resource classes for ...
Ben's user avatar
  • 992
1 vote
1 answer
1k views

Why would we need to rollback twice before closing in a finally block?

I'm trying to implement the change in database connection closing suggested in this question's answers. More than once, I've come across this block of code at the end of my try blocks: try { -...
Zibbobz's user avatar
  • 1,592
8 votes
3 answers
14k views

Is there an issue with closing our database connections in the "Finally" block of a Try statement?

I'm doing some refactoring for our application, and trying to reduce the number of issues reported in our ISO Scan (a static code analysis tool based on HP Fortify). Right now, what I'm trying to ...
Zibbobz's user avatar
  • 1,592
9 votes
4 answers
8k 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 ...
transporter_room_3's user avatar
1 vote
1 answer
89 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 ...
Sebastian K's user avatar