Search Results

Search found 3592 results on 144 pages for 'pointer'.

Page 73/144 | < Previous Page | 69 70 71 72 73 74 75 76 77 78 79 80  | Next Page >

  • C++ stl collections or linked lists

    - by Lucas
    I'm developing a OpenGL based simulation in C++. I'm optmizing my code now and i see throughout the code the frequently use of std:list and std:vector. What is the more performatic: to continue using C++ stl data structs or a pointer based linked list? The main operation that involve std::list and std::vector is open a iterator and loop through all items in the data structs and apply some processing

    Read the article

  • Java: Are these 2 codes the same?

    - by Kevin Duke
    for (Player p : players) { p.addCard(deck.dealCard()); p.addCard(deck.dealCard()); } and for (int i = 0; i < players.size() ; i++) { Player p = players.get(i); p.addCard(deck.dealCard()); p.addCard(deck.dealCard()); } The second code yeilds a null pointer exception, what can be done to make the bottom one equivalent ?

    Read the article

  • getting node value exception

    - by Aswan
    Hi Folks <amount currency="USD">1000500</amount> while parsing above string i am getting only attribute value .when i try to get node value null pointer exception for getting node value using NodeList amountList= estimateElement.getElementsByTagName("amount"); Element amtElement= (Element)amountList.item(0); String amount=amtElement.getFirstChild().getnodevalue() Thanks in advance Aswan

    Read the article

  • current page highlights on child pages

    - by user557318
    Im trying to achieve current page highlights on wordpress similar to this site Alex Soth. I'm very nearly there with my css. At present i have current page highlights on pages, ie. home,calendar, projects. However when it come to current page highlights on child pages i have a problem. the indented child page list appears on hover when selecting a child page, but after page selection the menu reverts back to the standard pages menu with no visible child menus? unlike the link to the Alex Soth site where the extended menu stays and current page is highlighted I know that the answer will be a simple piece of css involving current_page_item and possible position:relative to obtain the menu staying visible after selection. But i can for the life of me work it out. Any ideas Ive attached my relivant pieces of css below?? thanks /* =Link Styles ------------------------------------------------------------------*/ input#submit { cursor: pointer; } input#searchsubmit { background: url(images/search.png) no-repeat center; } input#searchsubmit:hover { background: url(images/search.png) no-repeat center #3399FF !important; cursor: pointer; } .navigation a:hover, input#submit { background: #3399FF; color: #3399FF !important; } a { color: #666; } a:hover, a:hover span { color: #c11501 !important;background-color: #fae100; } .entry sup a, #main_nav .current_page_item a, #main_nav .current_page_ancestor a { color: #666 !important; } #main_nav h1.masthead a { color: #666; } #main_nav h1.masthead a:hover { border-right: none; } h2 a, #main_nav a { color: #3399FF; } img a, img a:hover { text-decoration: none; } .post a, .navigation a { font-weight: bold; color: #000; } .navigation a { background: #EEE; color: #666; font-weight: normal; padding: 3px 0px; border-radius: 0px; -webkit-border-radius: 0px; -moz-border-radius: 0px; } .post sup { font-size: 11px; color: #aaa; } .post sup a { border: 0; margin: 0; font-weight: normal; font-size: 10px; } #supplementary .post_nav ul.about_nav li a, #supplementary .post_nav ul.single_post_meta a, #supplementary ul.contact_key li a { color: #888888; border-bottom: 0; } /* =Main Menu ------------------------------------------------------------------*/ #main_nav ul.menu li { position: relative; } #main_nav ul.menu li:hover ul.sub-menu, #main_nav ul.menu li:hover ul.children { display: block; }

    Read the article

  • How to allocate memory in another process for windows mobile

    - by Serafeim
    I'd like to read the contents of another process listview control in windows mobile. To do this, I need a pointer to some free memory to that process in order to put the values there (and then read them from my process). This can be done in normal Windows or Win32 with the VirtualAllocEx function. However, this function is not supported in windows mobile ! Can you recommend me a way to allocate that memory?

    Read the article

  • Add new property to a class at runtime using reflection...

    - by Lee
    I have some serialized data (using BinaryFormatter), and wanting to deserialise it. However the deserialise method failed since the current assembly does not have the deleted field. I want to be able to reconstruct earlier assembly at run-time in order to deserialise the data. Appreciated any pointer. Thanks.

    Read the article

  • A few questions about char pointers.

    - by m4design
    1- How does this work: char *ptr = "hi"; Now the compiler will put this string in the memory (I'm guessing the stack), and create a pointer to it? Is this is how it works? 2- Also if it is created locally in a function, when the function returns will the memory occupied by the string be freed? 3- Last but not least, why is this not allowed: ptr[0] = 'H'; ?

    Read the article

  • variable argument list in windows va_list

    - by shrikant
    hi, I wanted to have function which will accept as foo(...) { } usage of this would be foo(1,2,3); foo(1) foo(1,2,3,4,5,5,6); va_list can be used but again for that I have to pass foo(int count, ...), as this at run time i dont know how many argument i have. any pointer would be appreciated Thanks

    Read the article

  • Declare Locally or Globally in Delphi?

    - by lkessler
    I have a procedure my program calls tens of thousands of times that uses a generic structure like this: procedure PrintIndiEntry(JumpID: string); type TPeopleIncluded = record IndiPtr: pointer; Relationship: string; end; var PeopleIncluded: TList<TPeopleIncluded>; PI: TPeopleIncluded; begin { PrintIndiEntry } PeopleIncluded := TList<TPeopleIncluded>.Create; { A loop here that determines a small number (up to 100) people to process } while ... do begin PI.IndiPtr := ...; PI.Relationship := ...; PeopleIncluded.Add(PI); end; DoSomeProcess(PeopleIncluded); PeopleIncluded.Clear; PeopleIncluded.Free; end { PrintIndiEntry } Alternatively, I can declare PeopleIncluded globally rather than locally as follows: unit process; interface type TPeopleIncluded = record IndiPtr: pointer; Relationship: string; end; var PeopleIncluded: TList<TPeopleIncluded>; PI: TPeopleIncluded; procedure PrintIndiEntry(JumpID: string); begin { PrintIndiEntry } { A loop here that determines a small number (up to 100) people to process } while ... do begin PI.IndiPtr := ...; PI.Relationship := ...; PeopleIncluded.Add(PI); end; DoSomeProcess(PeopleIncluded); PeopleIncluded.Clear; end { PrintIndiEntry } procedure InitializeProcessing; begin PeopleIncluded := TList<TPeopleIncluded>.Create; end; procedure FinalizeProcessing; begin PeopleIncluded.Free; end; My question is whether in this situation it is better to declare PeopleIncluded globally rather than locally. I know the theory is to define locally whenever possible, but I would like to know if there are any issues to worry about with regards to doing tens of thousands of of "create"s and "free"s? Making them global will do only one create and one free. What is the recommended method to use in this case? If the recommended method is to still define it locally, then I'm wondering if there are any situations where it is better to define globally when defining locally is still an option.

    Read the article

  • How to pass objects to functions in C++?

    - by Rakesh K
    I am new to C++ programming, but I have experience in Java. I need guidance on how to pass objects to functions in C++. Do I need to pass pointers, references, or non-pointer and non-reference values? I remember in Java there are no such issues since we pass just the variable that holds reference to the objects. It would be great if you could also explain where to use each of those options.

    Read the article

  • Function pointers in javascript using django

    - by Hulk
    Is this a valid function pointer code below, In views , def change(request): dict={} function_ptr="create()" dict.update({'function_ptr' : function_ptr}) return render_to_response('mpjt/create.html',context_instance=RequestContext(request,{'dict': dict})) In create.html $(document).ready(function() { var a = '{{dict.function_ptr}}' func_ptr(a); function create() { alert('got respponse'); } }); Thanks..

    Read the article

  • What is the point of function pointers?

    - by gramm
    Hi, I have trouble seing the utility of the function pointers. I guess it may be useful in some cases (they exist, after all), but I can't think of a case where it's better or unavoidable to use a function pointer. Could you give some example of good use of function pointers (in C or C++)? Many thanks :)

    Read the article

  • C++ interview question

    - by benjamin button
    as i am not an expert in c++,i was not aware of the answer to this question asked in one of the interviews. lets say there is a base class pointer which is pointing to a base class object: baseclass *bptr; bptr= new baseclass; now if i do bptr= new derived; what is the problem here?

    Read the article

  • Send a variable on the heap to another thread

    - by user1201889
    I have a strange problem in C++. An address of a Boolean gets "destroyed" but it doesn't get touched. I know that there are beater way's to accomplish what I try to do, but I want to know what I do wrong. I have a main class; this main class contains a vector of another class. There is a strange problem when a new instance gets created of this object. This is how my code works: There will start a thread when the constructor gets called of the “2nd”object. This thread gets as Parameter a struct. This is the struct: struct KeyPressData { vector<bool> *AutoPressStatus; vector<int> *AutoPressTime; bool * Destroy; bool * Ready; }; The struct gets filled in the constructor: MultiBoxClient::MultiBoxClient() { //init data DestroyThread = new bool; ReadyThread = new bool; AutoThreadData = new KeyPressData; //Reseting data *DestroyThread = false; *ReadyThread = false; //KeyPressData configurating AutoThreadData->AutoPressStatus = &AutoPressStatus; AutoThreadData->AutoPressTime = &AutoPressTime; AutoThreadData->Destroy = DestroyThread; AutoThreadData->Ready = ReadyThread; //Start the keypress thread CreateThread(NULL,NULL,(LPTHREAD_START_ROUTINE)AutoKeyThread,AutoThreadData,NULL,NULL); } As long as the constructor is running will the program run fine. But when the constructor closes the address of the “AutoThreadData-Destroy” will get corrupted. The program will crash when I call the value of the pointer. void WINAPI AutoKeyThread(void * ThreadData) { KeyPressData * AutoThreadData = (KeyPressData*)ThreadData; while(true) { if(*AutoThreadData->Destroy == true) //CRASH { *AutoThreadData->Ready = true; return; } Sleep(100); } } What did I test: I logged the address of the AutoThreadData and the AutoThreadData-Destroy when the constrcutor is running and clossed; the AutoThreadData address is equal to AutoThreadData when the constructor is closed. So there is no problem here. The address of AutoThreadData-Destroy gets destroyed when the constructor is closed. But how can this happen? The Boolean is on the heap and the KeyPressData struct (AutoThreadData) is on the heap. Destroy before: 00A85328 Destroy after: FEEEFEEE Can someone maby explain why this crash? I know that I can send a pointer to my class to the thread. But I want to know what goes wrong here. That way I can learn from my mistakes. Could someone help me with this problem? Thanks!

    Read the article

  • Convert NSString to string

    - by coure06
    NSDate *now = [NSDate date]; NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"yyyy"]; NSString *stringFromDate = [formatter stringFromDate:now]; CGContextShowTextAtPoint(context, 50, 50, stringFromDate, 5); I am not getting the exact date? also getting warning while compiling warning: passing argument 4 of 'CGContextShowTextAtPoint' from incompatible pointer type

    Read the article

  • Scan Numbers among letters in a Sentence

    - by ZaZu
    Hello, I have a pretty easy question. (using C) In a sentence such as In this document, there are 345 words and 6 figures How can I scan 345 and 6 while ignoring all that is in between ? I tried fscanf(FILE *pointer,"%d %d",&words,&figs); But it only gets the first value ... What am I doing wrong ?

    Read the article

  • 'Invalid conversion from some_type** to const some_type**'

    - by petersohn
    I've got a function that requires const some_type** as an argument (some_type is a struct, and the function needs a pointer to an array of this type). I declared a local variable of type some_type*, and initialized it. Then I call the function as f(&some_array), and the compiler (gcc) says: error: invalid conversion from ‘some_type**’ to ‘const some_type**’ What's the problem here? Why can't I convert a variable to const?

    Read the article

  • In gzip libary, what's the difference between 'uncompress' and 'gzopen' ?

    - by Sol
    There are some functions to decompress in zlib library(zlib version 1.2.3) I want to decompress my source zip(.gz) file using 'uncompress' function. It is now working(error code -3) but gzopen is. It is still not working when I input payload pointer(passing gzip header) to 'uncompress' . So the question is "What's the valid arguments for uncompress function?" and If it needs different format, how can I make it? Google doesn't helpful this time :(

    Read the article

  • Determining the word width in C

    - by das_weezul
    Hi! I'm learning C right now and so I'm fiddling about with pointers. Is there a way to determine the word width of the CPU in C because I'm writing a small program which prints it's own stack (Because I'm curious how it is structured), so that information would come in handy. Right now I'm using an int pointer, as an integer is 4 Bytes wide and I'm using a 32-bit Intel Atom CPU. Thanks in advance, C gurus ;o)

    Read the article

  • LInux C++: how do profile time wasted due to cache misses?

    - by anon
    I know that I can use gprof to benchmark my code. However, I have this problem -- I have a smart pointer that has an extra level of indirection (think of it as a proxy object). As a result, I have this extra layer that effects pretty much all functions, and screws with caching. Is there a way to measure the time my CPU wastes due to cache misses? Thanks!

    Read the article

  • Login screen delay in CentOS 5.4 x64

    - by user208728
    I was happily running my CentOS 5.4 before something bad happened that somehow corrupted the 'nautilus' package. It stopped me from using the default Gnome Desktop. Then I installed (using yum) the KDE and nautilus later on. Now, KDE is running perfectly with one exception that it takes around 10 minutes before showing up the Login Screen and only a blue screen with mouse pointer keeps showing during those 10 minutes. Thanks in Anticipation. Regards, Talal

    Read the article

  • What do people find difficult about C pointers?

    - by Paul
    From the number of questions posted here, it's clear that people have some pretty fundemental issues when getting their heads around pointers and pointer arithmetic. I'm curious to know why. They've never really caused me major problems (although I first learned about them back in the Neolithic). In order to write better answers to these questions, I'd like to know what people find difficult. So, if you're struggling with pointers, or you recently were but suddenly "got it", what were the aspects of pointers that caused you problems?

    Read the article

< Previous Page | 69 70 71 72 73 74 75 76 77 78 79 80  | Next Page >