Questions tagged [structure]

Structure is a fundamental, tangible or intangible notion referring to the recognition, observation, nature, and permanence of patterns and relationships of entities. DO NOT USE this tag for C or C++ struct questions!

A structure can be a:

  • A structure in mathematical logic: in universal algebra and in model theory, a structure consists of a set along with a collection of finitary operations and relations which are defined on it.

  • The structure of a program

For the following topics, use different tags as indicated below:

  • A : a particular way of storing and organizing data in a computer so that it can be used efficiently.
  • A (short for "structure") is a keyword in the C and C++ languages, used to indicate a structures record.
6561 questions
47
votes
2 answers

Best algorithm for efficient collision detection between objects

I'm confused. Well not confused, so much as not wanting to do 6 test programs to see which algorithm is the best. So I thought I'd ask my expert friends here at SO to give me the benefit of their experience. The scenario is a 3d scene with…
Robinson
  • 9,666
  • 16
  • 71
  • 115
45
votes
18 answers

Good practices in writing MATLAB code?

I would like to know the basic principles and etiquette of writing a well structured code.
user238469
44
votes
2 answers

What is the purpose of gradle's buildSrc folder?

In gradle, what is the purpose of using a buildSrc file as a top level, as opposed to just a typical java project layout (src/main/java)? If I have a layout of src main java or buildSrc src main java What would be the…
Jeff Storey
  • 56,312
  • 72
  • 233
  • 406
43
votes
3 answers

How to structure api calls in Vue.js?

I'm currently working on a new Vue.js application. It depends heavily on api calls to my backend database. For a lot of things I use Vuex stores because it manages shared data between my components. When looking at other Vue projects on github I…
Jordy
  • 4,719
  • 11
  • 47
  • 81
43
votes
5 answers

How to return a struct from a function in C++?

I've tried on a few different forums and can't seem to get a straight answer, how can I make this function return the struct? If I try 'return newStudent;' I get the error 'No suitable user-defined conversion from studentType to studentType…
tail_recursion
  • 660
  • 1
  • 7
  • 11
43
votes
8 answers

java.util.zip - Recreating directory structure

While trying to zip an archive using the java.util.zip I ran into a lot of problems most of which I solved. Now that I finally get some output I struggle with getting the "right" output. I have an extracted ODT file (directory would be more fitting…
Eric Tobias
  • 3,225
  • 4
  • 32
  • 50
41
votes
6 answers

scipy.io.loadmat nested structures (i.e. dictionaries)

Using the given routines (how to load Matlab .mat files with scipy), I could not access deeper nested structures to recover them into dictionaries To present the problem I run into in more detail, I give the following toy example: load scipy.io as…
mergen
  • 1,081
  • 1
  • 9
  • 10
41
votes
5 answers

Padding in structures in C

This is an interview question. Till now, I used to think such questions were purely compiler dependent and shouldn't worry me, but now, I am rather curious about it. Suppose you are given two structures as: struct A { int* a; char b; } …
letsc
  • 2,075
  • 5
  • 24
  • 43
39
votes
5 answers

Project structure for PHP

I am new to PHP and want to know the directory structure for the php projects. I have experience in Java and in java we have src contains java source files, WEB-INF contains lib, and jsp pages. Do we have any similar standard directory structure in…
javafan
  • 1,525
  • 3
  • 21
  • 40
39
votes
8 answers

Tree implementation in Java (root, parents and children)

I need to create a tree structure similar as the attached image in Java. I've found some questions related to this one but I haven't found a convincing and well explained response. The application business consists in food super categories (main…
Carlos
  • 1,319
  • 2
  • 17
  • 20
39
votes
1 answer

Writing Structs to a file in c

Is it possible to write an entire struct to a file example: struct date { char day[80]; int month; int year; };
amarVashishth
  • 847
  • 3
  • 12
  • 26
38
votes
6 answers

Print the structure fields and values in C

I am interested in printing the structure fields . Typedef struct { UINT32 thread_id; BOOL is_valid; }T_THREAD; Is there a way in "C" language to print the contents of a structure, something like ex: print (T_THREAD) and output should be…
user3555115
  • 546
  • 1
  • 4
  • 11
37
votes
7 answers

Allocating memory for a Structure in C

I'm tasked to create a program which dynamically allocates memory for a structure. normally we would use x=malloc(sizeof(int)*y); However, what do I use for a structure variable? I don't think its possible to do struct st x =…
Blackbinary
  • 3,936
  • 18
  • 49
  • 62
36
votes
3 answers

C++ Private Structures

I have read that the main differences between classes and structures (other than functions), is that class members default to private, whereas structure members default to public. That implies that structure members can be private. My question is:…
Dasaru
  • 2,828
  • 5
  • 25
  • 25
36
votes
1 answer

Structure for multiple JSF projects with shared code

I have two JSF projects that share a lot of code - java classes, xhtml files, tag libraries, css and javascript files etc. My dev environment/platform consists mainly of Eclipse, Ant, Perforce and Tomcat. Has anyone found a way to create and…
Heizenberg
  • 363
  • 1
  • 4
  • 5