structure

Marshal.SizeOf error in computing size.

i have a structure public struct SERVER_USB_DEVICE { USB_HWID usbHWID; byte status; bool bExcludeDevice; bool bSharedManually; ulong ulDeviceId; ulong ulClientAddr; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] string usbDe...

String not referenced properly in C# structure with Layout

I have a structure [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public struct SERVER_USB_DEVICE { USB_HWID usbHWID; byte status; bool bExcludeDevice; bool bSharedManually; ulong ulDeviceId; ulong ulClientAddr; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] string usbDeviceDescr; ...

The Fruit Basket, how to use Linq to view from the basket or the fruit's perspective?

The question is related to financial products, interest rates and two properties that determine which interest a certain product has. But I think fruits and baskets are easier to visualize for this. First, we have fruit. Fruit can have a specific size (Small, medium, Large) and colour (Red, Green, Blue). These will be two different enum...

What is a good data structure to represent an undirected graph?

I need to construct an undirected graph. I don't need it to do anything too fancy, but ideally it would work like this: structure UDG = UndirectedGraph val g = UDG.empty val g = UDG.addEdges(g, n1, [n2, n4, n7]) (* n1 is connected to n2, n4, and n7 *) val g = UDG.addEdge(g, n2, n3) UDG.connected(g, n2) (* returns [n1, n3] *) Is there...

Application Structure for GUI & Functions

I'm starting a basic application using Python and PyQt and could use some experienced insight. Here's the structure I was thinking. This is understandably subjective, but is there a better way? myApp/GUI/__init__.py mainWindow.py subWindow1.py subWindow2.py myApp/Logic/__init__.py setOfMethods1...

java.util.zip - Recreating directory structure

Hello there. 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 a description) to which I did some modifications. Now I want to compress that...

Directory structure of Mobiles connected as USB pendrive

Hi, I need to find photos on external devices like cameras and mobiles connected as USB pendrive. As I don't want to traverse all disks, I thought of looking for specific folders under root or deeper, e.g. DCIM for cameras and start traverse from there. For cameras the directory structure is specified in the Design rule for Camera File ...

Wicket directory structure

Hey! I'm trying to figure out the directory structure of wicket. I don't get it at all! Let's say I wanna load an image with images/logo.gif or something like that. Where do I have to place the images folder? Please help me with this! ;) ...

Python - Basic pygame structure

Here is how I'm implementing my simple pygames now (I'm following a tutorial): import pygame, sys from pygame.locals import * def run_game(): pygame.init() SIZE = (640, 400) BG_COLOUR = (0, 0, 0) LINE_COLOUR = (255, 255, 255) screen = pygame.display.set_mode(SIZE) clock = pygame.time.Clock() while True: ...

Default modular directory structure for Zend Framework application

I'm aware of default directory structure for Zend Framework modular applications that is in the manual. /application /controllers /modules /admin /controllers /views /views /configs /www index.php But I'm wondering why should I do it this way. It really sux to have the default module in /application and othe...

How to change structure of subversion repository after a migration?

Hi, I am a newbie to both Subversion and PVCS VM I currently migrated my project from PVCS VM to Subversion And I now have this structure I got the project and in my project i got my components inside each components I have trunk, branches and tags. We are trying to change the structure to have the project and then I got my components...

How do I load example datasets in R?

Let's say I want to reproduce an example posted on StackOverflow. Some have suggested posters use dput() to help streamline this process or one of the datasets available in the base package. In this case, however, suppose I have only been given the output of the dataframe: > site.data site year peak 1 ALBEN 5 101529.6 2 ...

Why is the need for MySQL database schema?

What is the need for a database schema (embedded in the DB) if I can configure my MySQL DB structure and write CRUD statements to work with it directly? I've never worked with these, but I'm assuming they're only for performance optimization? I know of schema diagrams that can be exported as .sql commands which generate the DB structure...

Common WCF Object Support Classes

I am confused how to add/include/reference a set of supporting classes required for both server and client projects where WCF is involved. In my C# solution I have: A Server project doing server type stuff A Client project doing gui type stuff A WCF Library containing class definitions for network passed data objects The Server proj...

Building the equivalent of a C structure in RubyCocoa

I'm trying to do something similar to this code sample but in RubyCocoa. In particular, I'm having some trouble trying to build a SecKeychainAttributeList. I suspect I need to make use of Array#pack or something to build a suitable structure in Ruby. Any advice on how to build the equivalent of attributes in the following chunk of code w...

Code organization style for C?

I know some higher level languages, all web based (PHP, javascript, some python). I've finally decided to learn a lower level language, and I've decided to go with C. The problem is that all the languages I use are based heavily on OOP. Seeing as (based on the research I did) C doesn't have classes or inheritance. As a result, I ask y...

How to hide the constructor and "general" functions from individual objects?

I'm looking for advice on the best way to structure my program. Here is what I have now, and the problems I see with the design: I have a class with a private constructor and a submit() method, to carefully control the objects created, and every object created is added to a global list. The program has several functions that perform "bi...

Help with structuring a javascript visualisation application

I'm using http://raphaeljs.com/ to draw some vector graphics on a canvas element on the page. I want somehow to update the graphics on the page in realtime as events happen on another website i'm running. For example, when someone uses the search facility on the other site, I want this to be represented on my canvas. Its a sort of ev...

How to update DB structure when updating production system without doing a teardown / rebuild

If I'm working on a development server and have updates to the database structure for some of our releases, what is the best way to update the structure on the production server? Currently we create a new production database containing the structure only, do a SQL dump of the data on the 'old' production database, then run a SQL query t...

Signature inside of a structure

I want to place signature/structure pair inside a structure, like so: structure Outer :> OUTER = struct signature INNER = sig ... end structure Inner :> INNER = struct ... end end but even the simplest of examples produces an error: ../test.sml:1.18-2.6 Error: syntax error: replacing STRUCT with...