structure

What are some efficient ways to combine two structures in MATLAB?

I want to combine two structures with differing fields names. For example, starting with: A.field1 = 1; A.field2 = 'a'; B.field3 = 2; B.field4 = 'b'; I would like to have: C.field1 = 1; C.field2 = 'a'; C.field3 = 2; C.field4 = 'b'; Is there a more efficient way than using "fieldnames" and a for loop? EDIT: Let's assume that in t...

What is the optimal VSTF source structure? Are there any best practices?

There are a number of other questions related to this topic: Whats a good standard code layout for a php application How to structure a java application, in other words: where do I put my classes? Recommended Source Control Directory Structure? Structure of Projects in Version Control I could not find any specific to VSTF, which has...

Visual Studio Solution Structure for multiple deployable projects

Scenario: Currently we have a single solution supporting a single deployable entity, a WinForm/WPF client, this solution has a layer architecture with projects representing various layers (Data, Business, UI). We will be introducing other deployable entities such as a LiteClient, a Server and an RIA. We are considering a restructure wh...

MVC model structure in Python

Hi all, I'm having problems structuring classes in the Model part of an MVC pattern in my Python app. No matter how I turn things, I keep running into circular imports. Here's what I have: Model/__init__p.y should hold all Model class names so I can do a "from Model import User" e.g. from a Controller or a unit test case Model/Data...

how do you know how to design a mysql database when creating an advanced php application?

i've never created a shopping cart, or forum in php. aside from viewing and analyzing another persons project or viewing tutorials that display how to make such a project or how to being such a project. how would a person know how to design the database structure to create such a thing? im guessing its probbably through trial and error.....

javascript closures and function placement

Does the placement of a function have an effect on the performance of closures within scope? If so, where is the optimal place to put these functions? If not, is the implied association by closure enough reason to place a function in another place logically? For instance, if foo does not rely on the value of localState, does the fact ...

Correct approach to Properties.

I am working in Java on a fairly large project. My question is about how to best structure the set of Properties for my application. Approach 1: Have some static Properties object that's accessible by every class. (Disadvantages: then, some classes lose their generality should they be taken out of the context of the application; they...

Why this union is deleting the 1st records in arrays in the c code?

look at one of my header file which consists of a union template with 4 different structures. <#define MAX 3 union family { struct name /*for taking the name and gender of original member*/ { unsigned char *namess; unsigned int gender; union family *ptr_ancestor; /*this is a pointer to his ancestors detai...

C++ project structure under Visual Studio 2008

So, I've been doing Java for a number of years now, but now I'm starting a C++ project. I'm trying to determine best practices for setting up said project. Within the project, how do you generally structure their code? Do you do it java style with namespace folders and break up your source that way? Do you keep your public headers in an...

Why this union's size is 2 with bitfields?

I am working on turbo C on windows where char takes one byte.Now my problem is with the below union. union a { unsigned char c:2; }b; void main() { printf("%d",sizeof(b)); \\or even sizeof(union a) } This program is printing output as 2 where as union should be taking only 1 byte. Why is it so? for struct it is fine giving 1 byte bu...

data structure for bigger number of files

Hello I'm looking for effective way to sort albums with songs. I have around 10000 and growing albums with approx 10 songs in every album. So that means 100000 files. Now I do not want to store all folders (albums) in one main folder, but I'm looking for a better way to store it. All folders are hierarchy equal, so I was thinking to g...

Is it OK to have code in the root of a project?

I am trying to come up with a best practices on project directory structure. my latest thought is that there should be no classes in the root directory of a project. All classes must go under one of the following directories UI BusinessObjects BusinessLogic DataAccess i would like to hear other people thought on if there are use...

Init Structure with std::wstring

I've got a structure as follows: typedef struct { std::wstring DevAgentVersion; std::wstring SerialNumber; } DeviceInfo; But when I try to use it I get all sorts of memory allocation errors. If I try to pass it into a function like this: GetDeviceInfo(DeviceInfo *info); I will get a runtime check error complaining that I ...

defining structures globally in c++

there was a somewhat detailed thread (228684) on how to globally (using extern struct) declare a structure that could be seen in more than 1 c++ file, but I can not figure out exactly how to do it (there was a lot of discussion about do this, do that, maybe do this, try this, etc...). couuld someone please post a very simple example of...

How do you structure your source code?

(I'm asking this with Visual Studio Web Applications in mind, but am interested in more high-concept answers) Recent topic of conversation in my life with colleagues and friends has been how best to structure source files within a project. Not a source-control question or a development-environment question per se, I'm more interested in...

How to work with pointer to pointer to structure in C?

Hi, I want to change member of structure under double pointer. Do you know how? Example code typedef struct { int member; } Ttype; void changeMember(Ttype **foo) { //I don`t know how to do it //maybe *foo->member = 1; } Thanks for any help. ...

MySQL tool or query that suggests table structure

I used a query a few weeks ago in MySQL that described a table and suggested possible improvements to its structure. For example, if I have an int field but only the numbers 1-3 in that field, it will suggest set(1,2,3) as the type. I think I was using phpMyAdmin but I've been through all the functions I can find - Analyze, Describe, Ex...

How you organize non-source-resources available at the classpath in your java-project?

In a software-project written in java you often have resources, that are part of the project and should be included on the classpath. For instance some templates or images, that should be accessible through the classpath (getResource). These files should be included into a produced JAR-file. It's clear that these resources should be add...

Where can one find a specification for the data structures representing a dll in memory?

Specifically I want to know what the data structure for the imports (idata) section looks like. ...

How do you manage your Django applications?

Hi, I just wanted to try to build a project with django. Therefore I have a (basic) question on how to manage such a project. Since I cannot find any guidelines or so on how to split a project into applications. Let's take a kind of SO as an example. Which applications would you use? I'd say there should be the applications "users" and ...