structure

Is there anything wrong with using C++ vectors in structures?

Ok, I'm coming from vb.net to c++. Im trying to use vectors in a structure, but the compiler yells at at me for it. What is wrong with the current statement? #include <vector> struct FactorSet { vector<long long> UpperFactor(0); vector<long long> LowerFactor(0); }; Output error (Visual Studio 2008): Error 1 error C2059: syntax e...

PHP file structure for a simple website?

Hello there! I have been working with PHP for a couple of years now but I don't consider myself any more than a moderate programmer. While creating some websites (varying from presentation websites to some simple CMS'es), I have taken 2 approaches which I will discuss below. My question is simple: which one is better in terms of custom...

Defining constants inside a structure

Is there any special significance to defining constant data inside a structure as shown. This is from a 3rd party library. typedef struct { IntVB abc_number; #define ABC_A 0x01 #define ADBC_E 0x02 IntVB asset; } StructA; ...

Prolog Rules Reflect Strucutre

Hello to all, i need to design a rules which test a loan is a car loan or not. carLoan(flexiCar,minLoanAmount(20000),maxTenure(12) ). iscarloan(X, Y, Z) :- carLoan(X, Y >= minLoanAmount(20000), Z =<(maxTenure(12)) ). iscarloan(X, 25000, 10). I need to test the Y and Z variable against the structure from the fact inside the rule. Ho...

Where should utility functions live in Django?

Where should utility functions live in Django? Functions like custom encrypting/decrypting a number, sending tweets, sending email, verifying object ownership, custom input validation, etc. Repetitive and custom stuff that I use in a number of places in my app. I'm definitely breaking DRY right now. I saw some demos where functions were...

Structure constructor in .net: any overhead?

About using structure constructors; are those two code blocks equal in performance? With constructor: Dim pt As Point For i As Integer = 1 To 1000 pt = New Point(i, i) Next No constructor: Dim pt As Point For i As Integer = 1 To 1000 pt.X = i pt.Y = i Next First one is shorter, especially if constructor would have m...

describe table structure

Which query will give the table structure with column definitions in SQL? ...

data structures and search algorithm for multiple predicate

Hi: Does anyone know any good data structure and algorithm for searching with multiple predicate. eg. suppose I have a set of tcp header data (assuming no duplicate). If I were searching for an tcp header of the list by src ip, I could sort the set by src IP and do binary search. What kind of data structure/algorithm should I use if I...

How to Assign the value to Main /Parent Structure in a Nested Structure?

Hi I have writen an Nested Structure in C# . Find the code snippet below: public struct SMB_MESSAGE { #region SMB Parameter public struct SMB_PARAMETERS { public byte WordCount; public ushort[] Words; } #endregion #region SM...

I need your advice about php application structure (not MVC, but something simplier)

Hello, I'm not using any MVC framework and my application structure is rather simple... actions/ registration.php classes/ views/ header.php footer.php registration.php index.php actions/registration.php <?php $variable = htmlspecialchars($_GET['name'], ENT_QUOTES).", are you ok!?"; include("views/registration.php"); ?> vi...

Accessing the underlying struct of a PyObject

I am working on creating a python c extension but am having difficulty finding documentation on what I want to do. I basically want to create a pointer to a cstruct and be able to have access that pointer. The sample code is below. Any help would be appreciated. typedef struct{ int x; int y; } Point; typedef struct { PyObject_HEAD ...

While Creating a Array Inside a Structure , Does that Structure Contain Directly the Value of Array or the Memory reference to that array?

Hi, I am creating an array as below: public struct Smb_Parameters { public byte WordCount; public ushort[] Words; } While I assign the values Like below: Smb_Parameters smbParameter = new Smb_Parameters(); smbParameter.WordCount = 0; string words= "NT LM 0.12"; smbParameter.Words = Encoding.AS...

How to get the Updated Size of Structure?Size of the Structure not getting Updated When I add values to dynamic array Fields

Hi, This is related to my previous question, and thought will make this as a sparate question as it will make more sense. I have created my Struct as : public struct Smb_Parameters { public byte WordCount; public ushort[] Words; } Without Assigning any Values when I try to get the size of the S...

What mysql engine for huge amount of data (logging)?

What mysql engine would be best suited for handling huge amount (many rows) of (small) data? I talking about logging. I'm thinking about logging whenever I do things on my page, like calling a function, calling a file and so on. A tip of how I should structure the table is also appreciated. ...

are interfaces essentially additional abstraction layers?

My knowledge of interfaces is quite limited. I'm trying to understand them better. What purpose exactly do they serve and when would it be advisable to use them? Thanks ...

How can I move variables into and out of a structure akin to LOAD and SAVE in MATLAB?

Is there a quick way (i.e. one line) to dump a collection of variables "in" a structure, using the variable names as the structure fields? The "load" function basically does this but saving and loading to a temporary file seems ugly. For example: clear a = 'adsf' b = rand(10); x = var2struct(a,b) x.a x.b or better yet: x = var2str...

Reading in a binary file containing an unknown quantity of structures (C#)

Ok, so I currently have a binary file containing an unknown number of structs like this: private struct sTestStruct { public int numberOne; public int numberTwo; public int[] numbers; // This is ALWAYS 128 ints long. public bool trueFalse; } So far, I use the following to read all the structs into a List<>: List<sTest...

Inside a structure how can I define an array (dynamic) of structures with the same type as the structure itself.

The objective is to build a "infinite" tree using dynamic arrays. items[3] - MENUITEM - items[2] - MENUITEM -items[0] - MENUITEM - items[0] - MENUITEM - items[0] - MENUITEM - items[2] - MENUITEM - items[0] - MENUITEM - items[0] I define the structure: typedef struct MENUITEM { char id...

c++ structures and constructures

ok so i nee help with this constructures struct balls { balls() { SetTimer(hWnd, balls.BALL_ID, 1, null); } int Ex; int Ey; UINT_PTR BALL_ID; }; well when i set the timer im having trouble with balls.BALL_ID. the compiler thinks that balls is structure like balls something. wel...

Best practice for storing tags in a database?

I developed a site that uses tags (key words) in order to categorize photographs. Right now, what I have in my mysql database is a table with the following structure: image_id (int) tag (varchar(32)) Every time someone tags an image (if the tag is valid and has enough votes) it's added to the database. I think that this isn't th...