structure

table like java data structure

hi. I need to implement some kind table-like data structure that stores info like this in Java: +--------+-------+-----+ | sij | i | j | +--------+-------+-----+ | 45 | 5 | 7 | +--------+-------+-----+ | 33 | 1 | 6 | +--------+-------+-----+ | 31 | 0 | 9 | +--------+-------+-----+ | 12 | 8...

Pointers to Structures in C

When trying to compile the following code, I am getting a warning that line 18 makes integer from pointer without cast and that 19 and 20 are incompatible types in assignment. I am new to structures in C, and can't seem to figure out what is wrong. #include <stdio.h> struct song { char title[70]; }; struct playlist { stru...

How can I ignore a field when marshalling a structure with P/Invoke

Hi, I want to marshal a structure for use with P/Invoke, but this struct contains a field that is only relevant to my managed code, so I don't want it to be marshaled since it doesn't belong in the native structure. Is it even possible ? I was looking for an attribute similar to NonSerialized for serialization, but it doesn't seem to ex...

How can I display an organized hierarchical data in asp.net 3.5?

Hi, I am working on a project that organizes the structure and hierarchy of departments. I want to view and display the whole structure of the organization visually, but I am stuck. I wanted to know what is the best way to do it in ASP.net 3.5; my goal is to achieve something like this by code and each node is linkable and can have CSS. ...

Access function pointer defined in a structure?

Write a program to access the function "foo" using the structure structure2. typedef struct { int *a; char (*fptr)(char*); }structure1; typedef struct { int x; structure1 *ptr; }structure2; char foo(char * c) { --- --- --- } ...

MATLAB: Determine total length/size of a structure array with fields as structure arrays

I have a structure array containing fields as structure arrays of varying length. For example: 's' is a structure 'data' is a field in 's', and also a structure array itself and length(s(n).data) ~= length(s(m).data) I want to preallocate an array that takes a time stamp from every field s.data.timestamp. Is there a way to do this wi...

jsp:how to hide folder structure of website from users?

how to hide folder structure of website from users. i have developed a website on jave platform (jsp). website is deployed on jboss. suppose my website 's home page url is dummy.com/dummyFolder/dummy1.jsp user can watch all of jsp pages in website by going on url dummy.com/dummyFolder/ what should i do to prevent user to view my ...

how to implement trie data structure using c for the identification of sets?

here we should write a program to implement the identification of sets(object sets containing strings not in an alphabetical order) which makes basically use of tries. ...

C - how to check whether all required fields of a structure are filled? (most elegant method)

I have a function, which has a pointer to some structure as its argument. How can I check within this function, whether all required fields of the structure have been filled before a function call? example: //lib.c void f(X_type *x) { ... } //user.c main(){ X_type object; object.name = "I am X"; object.ID = 1; ... f(X_type &object);...

Structure Saved in a Session Variable

The ReportInfo is a structure. The structure works fine on one web page but I am trying to use it on another web-page. Here is where I saved the ReportInfo structure to the Session Variable Session["ReportInfo"] = reportInfo; On the other web-page, I re-created the Structure and then assign the session variable to it, like this... r...

Separating rapid development from refactoring/optimization

I'm working in a team of 2 front-end developers on a web-based late-stage startup project. The site works quite well, but there's a lot of room for improvement code-wise, as the code is quite messy and disorganized. I would like to clean things up gradually by writing tests and carefully refactoring to avoid breaking anything. (Using p...

How to fill a DataTable with a List(Of t) or convert a List(Of t) to a DataTable?

I have read many posts on this topic; among them and most recently .NET - Convert Generic Collection to Data Table. Unfortunately, all to no avail. I have a generic collection of structures : Private Structure MyStruct Dim sState as String Dim lValue as Long Dim iLayer as Integer End Structure Dim LOStates As New List(Of MyStruct) I...

Simulating a railway network

Hello, I wanted to simulate a railway network where there would be stations, trains and routes connecting each station. So how do you think I should attempt to model this?? I thought of using graphs taking station as vertex and edges as routes. Also since there will be tens of trains and stations and hence hundreds of routes so should I...

Why is that data structures usually have a size of 2^n ?

Is there a historical reason or something ? I've seen quite a few times something like char foo[256]; or #define BUF_SIZE 1024. Even I do mostly only use 2^n sized buffers, mostly because I think it looks more elegant and that way I don't have to think of a specific number. But I'm not quite sure if that's the reason most people use them...

is it right to save media file of project into svn repository?

I know that I can save all my projects files into repository so deployment of new version of software become only using svn export into properly directory. But I have a feeling that it is not right way and for media files I should use some other utilities for deployment like rsync. But it is also a problem with double-side sync = I like...

Size of a structure in C

Possible Duplicate: Why isnt sizeof for a struct equal to the sum of sizeof of each member? Consider the following C code: #include <stdio.h> struct employee { int id; char name[30]; }; int main() { struct employee e1; printf("%d %d %d", sizeof(e1.id), sizeof(e1.name), sizeof(e1)); return(0); } The out...

Ruby Array group and average by hour

We get our data from a sensor which records and stores data like hashes. At any time it measures a few stuff like that: {:temperature => 30, :pression => 100, :recorded_at => 14:34:23} {:temperature => 30, :pression => 101, :recorded_at => 14:34:53} {:temperature => 31, :pression => 102, :recorded_at => 14:34:24} {:temperature => 30, :p...

Checking an array of data for similar elements in C

Hi, I created an "address" structure. Each address (xx.yy.zz.mm) consists of an xx, yy, zz and mm element, all of which are ints. Each address also has a "name" element associated with it. I have an array of up to 100 addresses called "network". Here is an example of some elements in network: 186.88.1.21 Tyler 186.88.9.11 Bob 101.21.0...

Printf seems to mess the output of a simple C program

Hi there. I have some code to add fractions. #include <stdio.h> #include <stdlib.h> struct frac { int enumerator; int denominator; }; typedef struct frac frac_t; frac_t *Add(frac_t *b1, frac_t *b2) { frac_t rfrac; frac_t *p; p = &rfrac; (*p).enumerator= ((*b1).enumerator* (*b2).denominator) + ((*b2).enumerator* (*b1).d...

EDIFACT macro (readable message structure)

Hi, I´m working within the EDI area and would like some help with a EDIFACT macro to make the EDIFACT files more readable. The message looks like this: data'data'data'data' I would like to have the macro converting the structure to: data' data' data' data' Pls let me know how to do this. Thanks in advance! BR Jonas ...