Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. Zyrenthian

    non repeating random number gen - Listbox.items.contains broken?

    If you are generating all number from x->y inclusive. Why not create an array of all the number and instead swap indexes some arbitrary number of times. It will speed it up vs determining if you already generated the number when you have 10000 numbers and only one number left to generate :-)
  2. Zyrenthian

    WCF and Attributes

    Thanks :-) Hadn't heard the POCO's about WCF before but it will be worked into the design to prevent any further straying from the path. Matt
  3. Zyrenthian

    WCF and Attributes

    I am currently working with a WCF service and my searches both in this forum as well as on the web have no results specific enough to answer my question. Has anyone successfully passed attributes of a property via nettcp in WCF? Here is the scenario. I have an attribute class with an ID...
  4. Zyrenthian

    Default Code for Get/Set Properties

    Thanks for the responses guys :-) In either response, it just ends up being too much work. I have come to the same conclusion from a different angle. I thought of the reusability of this code and it is a nightmare. It requires that every set call triggers this flag. Ultimately, it all...
  5. Zyrenthian

    Default Code for Get/Set Properties

    Hi All, I have a base class I defined to maintain if a set property has been called. In each class that inherits from this base class, I add the line "IsDirty = true;". Is it possible to have the base class define for all child classes, this line is added/executed by default? If so, is...
  6. Zyrenthian

    Documenting memory usage

    TaskManager will show you how much memory you are using at any given time. Turn on Mem Usage in the processes tab (View->Select Columns) Matt
  7. Zyrenthian

    memory exceptions

    if it is a char**, try doing lpBuff[0] = new char[dwCurBufSize]; The error might be more descriptive. Also, put a try catch block arround it, break in the catch and follow the call stack backwards to make sure that the buffer being passed is indeed a 2d array. Matt
  8. Zyrenthian

    rounding

    float f = 2.8; int x = (int)f; Matt
  9. Zyrenthian

    Write a structure to a file

    If you dont mind adding extra data to a struct you could do struct structOne { size_t structSize; // other data structOne():structSize(sizeof(*this)){} }; struct structTwo { size_t structSize; // other data (different of course) structTwo():structSize(sizeof(*this)){} }; etc...
  10. Zyrenthian

    number of bits in a byte (char)

    You still need to deal with padding issues. Most likely it will still have 8. Look into defining your own type within a struct using pramas #pragma pack(push:1) struct my_struct { unsigned fiveBits:5; }; #pragma pack(pop) I am not sure if this will work for you because (i think) it will...
  11. Zyrenthian

    finite state machines

    Well, this can be a problem unless each record is somehow uniquely identified (i.e. a single file that you read in its entirety, a return value from a function that ensures a full binary/ascii return of the entire record, etc..) If that is the case, you have a unique situation. Because "JRBP"...
  12. Zyrenthian

    Double-subscripted array - sum for each column

    int values[ROWS][COLS]; if this is what you mean, it is just the reverse of the row sum int rowSum = 0; for(int col = 0;col<COLS;col++) { rowSum += values[rowToSum][col]; } for columns it would be for(int row = 0;row<ROWS;row++) { colSum += values[row][colToSum]; } Matt
  13. Zyrenthian

    Efficient Numerical Search

    To add all numbers 1 to n you can calculate it without a for loop by doing int quickSum = (sumTo+1)*(sumTo/2) + ((sumTo+1)/2) * (sumTo%2); Where sumTo in your case is equal to 1000 Now, take your array with one missing number, sum it and subtract it from quickSum... You have your missing...
  14. Zyrenthian

    calling a batch file from a program

    system(path to bat file) would work or CreateProcess is another approach
  15. Zyrenthian

    reading a bitmap header

    MSDN pack #pragma pack( [ n] ) Specifies packing alignment for structure and union members. Whereas the packing alignment of structures and unions is set for an entire translation unit by the /Zp option, the packing alignment is set at the data-declaration level by the pack pragma. The pragma...
  16. Zyrenthian

    reading a bitmap header

    Could be a padding issue... try a #pragma push(pack,2) before your struct (i think the syntax is right) <your struct> #pragma pop Or use the BITMAPFILEHEADER struct Matt
  17. Zyrenthian

    template functions

    Just called up my wife, yep... that is what i did :-P Hope it works for you :-) Matt
  18. Zyrenthian

    template functions

    I ran into this problem before... I believe what I did was for template classes was move the default #include "stdafx.h" to the bottom of the cpp file. I dont have my code here at work so I dont know if this is the exact answer. Matt
  19. Zyrenthian

    wchar_t and unicode help

    I would think it is more of a font issue. Extended ascii character can be different in other fonts. Matt
  20. Zyrenthian

    A static object

    1. Not really any effect 2. Same 3. Global Data to this file only 4. Not really any effect. For # 4, if declared somewhere else then main, the value remains the same every time you come back to the function. Ex. int myFxn() { static int number_of_calls = 0; number_of_calls++...

Part and Inventory Search

Back
Top