stack

Android onSearchRequested() callback to the calling activity

点点圈 提交于 2019-12-04 15:02:35
I have a MapActivity that will display the Android Search box when a search button is pressed. The SearchManager manages the dialog, and passes the user's query to a searchable activity, which searches an SQLite DB and displays the results using a custom adapter. This works fine - and I'm getting the correct results from the DB displayed. However, what I want to do is display the result in the MapActivity on a map when the user clicks on a search result. Currently, this means starting a new MapActivity, passing the search result in using a Bundle. I'd have thought the cleaner way was to pass

Run-Time Check Failure #2 - Stack around the variable 'x' was corrupted

。_饼干妹妹 提交于 2019-12-04 14:58:53
I receive this Run-Time Check Failure upon the return in the following code. I believe similar code is running fine elsewhere in the program. Any ideas? String GetVariableName(CString symbol, CString filepath) { char acLine[512]; char acPreviousLine[512]; CString csFile; FILE *fp; csFile.Format("%svariables.txt", filepath); fp = fopen(csFile, "r"); if (! fp) return(""); for (;;) { strcpy(acPreviousLine, acLine); // NULL means we are out of lines in the file. if (myfgets(acLine, 511, fp) == NULL) break; // "END" indicates end of file if (! strcmp(acLine, "END")) break; if (! strcmp(acLine,

Should a list of objects be stored on the heap or stack?

最后都变了- 提交于 2019-12-04 14:58:22
I have an object(A) which has a list composed of objects (B). The objects in the list(B) are pointers, but should the list itself be a pointer? I'm migrating from Java to C++ and still haven't gotten fully accustomed to the stack/heap. The list will not be passed outside of class A, only the elements in the list. Is it good practice to allocate the list itself on the heap just in case? Also, should the class that contains the list(A) also be on the heap itself? Like the list, it will not be passed around. Andrew Grant Bear in mind that The list would only be on the stack if Object-A was also

Stack and heap in c sharp [duplicate]

房东的猫 提交于 2019-12-04 12:56:34
This question already has answers here : Closed 9 years ago . Possible Duplicate: Why are structs stored on the stack while classes get stored on the heap(.NET)? Can anyone tell me that how the allocation of memory is done that which object is to be stored in stack and which to be in heap portion of the memory? 3 rules of thumb: Objects are stored on the heap . These include instances of reference-types and boxed value-types. Local variables and parameters are stored on the stack . For local value-types, this means that the value itself is stored on the stack. For local reference-types, only

How to check a uiviewcontroller is present in uinavigationcontroller stack

北战南征 提交于 2019-12-04 12:56:09
I have a UINavigationController . I have to pop a view from a UINavigationController and replace it with another view. How we can search for a UIViewController object and replace it with another ? when i print NSMutableArray *allViewControllers = [NSMutableArray arrayWithArray: myDelegate.navigationController.viewControllers]; I tried.. [allViewControllers removeObjectIdenticalTo: @"NonLogginedViewController"]; [allViewControllers removeObjectIdenticalTo: myDelegate.nonLogginedViewController]; myDelegate.navigationController.viewControllers = allViewControllers; But it didn't update the

runtime: goroutine stack exceeds 1000000000-byte limit, fatal error: stack overflow on printing a nested struct

淺唱寂寞╮ 提交于 2019-12-04 12:23:29
I have a nested struct. type ConfigOne struct { // Daemon section from config file. Daemon daemon } type daemon struct { Loglevel int Logfile string } And I have a String() string method on that type, which I am trying to return the nested struct elements as func (c ConfigOne)String() string{ return fmt.Sprintf("%+v\n", c) } When I am trying to print it as c := &modules.ConfigOne{} c.Daemon.Loglevel = 1 c.Daemon.Logfile = "/tmp/test.log" modules.Logger.Infoln(c.String()) I am getting the error runtime: goroutine stack exceeds 1000000000-byte limit fatal error: stack overflow runtime stack:

How are the function local variables accessed from the stack?

空扰寡人 提交于 2019-12-04 11:55:54
问题 From http://www.learncpp.com/cpp-tutorial/79-the-stack-and-the-heap/ Here is the sequence of steps that takes place when a function is called: The address of the instruction beyond the function call is pushed onto the stack. This is how the CPU remembers where to go after the function returns. Room is made on the stack for the function’s return type. This is just a placeholder for now. The CPU jumps to the function’s code. The current top of the stack is held in a special pointer called the

geom_text on only top part of stacked bar plot

被刻印的时光 ゝ 提交于 2019-12-04 11:50:04
I would like to have labels on only the top part of my stacked bar plot. Here is my data frame: #create data frame building <- c("Burj \nKhalifa", "Zifeng \nTower", "Bank of \nAmerica Tower", "Burj Al Arab", "Emirates \nTower One", "New York \nTimes Tower", "Emirates \nTower Two", "Rose Rayhaan \nby Rotana", "The \nPinnacle", "Minsheng \nBank Building") occupiable<- c(585, 317, 235, 198, 241, 220, 213, 237, 265, 237) nonoccupiable <- c(244, 133, 131, 124, 113, 99, 97, 96, 95, 94) df.build <- data.frame(building, occupiable, nonoccupiable) #melt data frame for stack bar plot df.build2 <- melt

logical structure/details of a reference variable and object in the memory?

孤人 提交于 2019-12-04 11:44:25
问题 Let's say we have a class: class Class1 { int i = 1; } and we have a variable: Class1 ob1 = new Class1(); Does a reference itself stored in a variable ob1 store the information that it refers to an object of Class1 ? Does the part of the heap where Class1 is stored store the information that it is of Class1 type? How does logically looks like this information? It's a string like application1.Class1 or a reference to some reference types pool? If you can recommend the source of such

GCC - How to realign stack?

谁都会走 提交于 2019-12-04 11:44:20
问题 I try to build an application which uses pthreads and __m128 SSE type. According to GCC manual, default stack alignment is 16 bytes. In order to use __m128, the requirement is the 16-byte alignment. My target CPU supports SSE. I use a GCC compiler which doesn't support runtime stack realignment (e.g. -mstackrealign). I cannot use any other GCC compiler version. My test application looks like: #include <xmmintrin.h> #include <pthread.h> void *f(void *x){ __m128 y; ... } int main(void){ pthread