Search Results

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

Page 89/144 | < Previous Page | 85 86 87 88 89 90 91 92 93 94 95 96  | Next Page >

  • How to free member (i.e BSTR, SAFEARRAY, VARIANT) of an IDL User Defined Structure which is encapsul

    - by Picaro De Vosio
    Hi, I have a structure defined in IDL. This structure has following members: { BSTR m_sFirst; BSTR m_sSecond; VARIANT m_vChildStruct; //This member encapsulate a sub structure SAFEARRAY __RPC_FAR * m_saArray; }CustomINFO; I am allocating the memory for the structs using CoTaskMemAlloc and encapsulating it in Variant as follows: vV-vt = VT_RECORD; vV-pvRecord = pStruct; //Pointer of sturct vV-pRecInfo = pRI; //RecordInfo Interface Is it enough to call VariantClear to deallocate the memory of struct and its members? Will it also release the IRecordInfo interface? Or i have to manually get the encapsulated struct and deallocate each member myself and then use CoTaskMemFree to deallocate sturct. Thanks Picaro De Vosio

    Read the article

  • Problem with istringstream in C++

    - by helixed
    Hello, I'm sure I'm just doing something stupid here, but I can't quite figure out what it is. When I try to run this code: #include <iostream> #include <string> #include <sstream> using namespace std; int main(int argc, char *argv[]) { string s("hello"); istringstream input(s, istringstream::in); string s2; input >> s2; cout << s; } I get this error: malloc: *** error for object 0x100016200: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug The only thing I can think of is that I allocated s2 on the stack, but I thought strings manage their own content on the heap. Any help here would be appreciated. Thanks, helixed

    Read the article

  • pthread_create from non-static member function

    - by Stanislav Palatnik
    This is somewhat similiar to this : http://stackoverflow.com/questions/1151582/pthread-function-from-a-class But the function that's getting called in the end is referencing the this pointer, so it cannot be made static. void * Server::processRequest() { std::string tmp_request, outRequest; tmp_request = this->readData(); outRequest = this->parse(tmp_request); this->writeReply(outRequest); } void * LaunchMemberFunction(void * obj) { return ((Server *)obj)->processRequest(); } and then the pthread_create pthread_create(&handler[tcount], &attr, (void*)LaunchMemberFunction,(void*)&SServer); errors: SS_Twitter.cpp:819: error: invalid conversion from void* to void* ()(void) SS_Twitter.cpp:819: error: initializing argument 3 of int pthread_create(pthread_t*, const pthread_attr_t*, void* ()(void), void*)

    Read the article

  • Using vertical-align on an element with background-image

    - by bobo
    <style type='text/css'> #span1{ background-image:url("http://www.reoiv.com/images/rss.jpg"); background-repeat:no-repeat; cursor:pointer; display:block; float:left; height:15px; width:15px; vertical-align:text-bottom; } </style> <span id='span1'></span>???? What I would like to do is to achieve the vertical align: text-bottom effect but I am not doing it on a image element. I am doing it on an element with background-image set. If you paste the above codes here: http://htmledit.squarefree.com/ You will see that the text failed to vertically align to bottom. I would like to know how it can be done without adding extra html element if possible. Many thanks to you all.

    Read the article

  • "Cannot find executable for CFBundle/CFPlugIn" error

    - by Emil
    Cannot find executable for CFBundle/CFPlugIn 0x432bfa0 </Library/Audio/Plug-Ins/HAL/DVCPROHDAudio.plugin> (not loaded) Cannot find function pointer NewPlugIn for factory C5A4CE5B-0BB8-11D8-9D75-0003939615B6 in CFBundle/CFPlugIn 0x432bfa0 </Library/Audio/Plug-Ins/HAL/DVCPROHDAudio.plugin> (not loaded) That's the error I get when I try to run this code: NSString *path = [[NSBundle mainBundle] pathForResource:[arraySubFarts objectAtIndex:indexPath.row] ofType:@"mp3"]; NSURL *file = [[NSURL alloc] initFileURLWithPath:path]; AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:file error:nil]; self.player = player; [player prepareToPlay]; [player setDelegate:self]; [self.player play]; Any idea why? :S I have included the needed frameworks, and the code works great, the only thing is this odd Console-message..

    Read the article

  • Objective C Insanity -- simple assignement to a single float variable results in {{{CRAZY}}} values

    - by morgancodes
    memberA is defined in the header of ClassA. memberB is defined in the header of ClassB. ClassB is a subclass of ClassA Inside an instance of ClassB, setting memberA via simple assignment: memberA = 0.05 ...also changes memberB, but to a crazy number -- 1028443341. Additionally, assigning 0.05 to memberA results in memberA showing up in the debugger as 5.33083531e-38. Both variables are floats, neither is a pointer. I'm almost certianly making some noob mistake, but I don't have any clue what it might be. What sort of screw-up might make it so assigning a value to one variable results in crazy values appearing in two variables? I can give more details or real code, but figured I'd keep it simple to start with in case it's an obvious problem/solution.

    Read the article

  • Need tips for better usability for tabular data with pagination

    - by Anil Namde
    Hi all, Just another day i found myself writing code to show data on the UI. I am again using DataGrid/GridView (ASP.NET), User Id as link button (clickable) to redirect user to another page. User having hard time to find where to click(Though the link has underline and hand pointer as usual on hover) just another common table like structure Following are the columns for example, User ID (Link button), User Name, First Name, Last Name, Date Of Birth Now i would like to make it better form the usability point of view. Can someone suggest a good link, example or suggestions to make it better. Thanks all,

    Read the article

  • How do I get around Inconsistant accessibilty error in C # ?

    - by xarzu
    How do I get around Inconsistant accessibilty error in C # ? I need to pass a pointer to a node in a linked list to a method. When I do, I get a "Compiler Error CS0051" Example The following sample generates CS0051: Copy Code // CS0051.cs public class A { // Try making B public since F is public // B is implicitly private here class B { } public static void F(B b) // CS0051 { } public static void Main() { } } That is a simple example. The actual program is a bit more complicated. I am actually using a node in a linked list to pass to the method LinkedListNode node The method uses recursion because the node is mart of a huge linked list structure of linked lists that outputs an xml file. Either I have to find a way to use recursion without using methods or I need to find a way to pass pointers nodes or actual nodes.

    Read the article

  • Finding the closest grid coordinate to the mouse position with javascript/jQuery

    - by Acorn
    What I'm trying to do is make a grid of invisible coordinates on the page equally spaced. I then want a <div> to be placed at whatever grid coordinate is closest to the pointer when onclick is triggered. Here's the rough idea: I have the tracking of the mouse coordinates and the placing of the <div> worked out fine. What I'm stuck with is how to approach the problem of the grid of coordinates. First of all, should I have all my coordinates in an array which I then compare my onclick coordinate to? Or seeing as my grid coordinates follow a rule, could I do something like finding out which coordinate that is a multiple of whatever my spacing is is closest to the onclick coordinate? And then, where do I start with working out which grid point coordinate is closest? What's the best way of going about it? Thanks!

    Read the article

  • c++ casting base class to derived class mess

    - by alan2here
    If I were to create a base class called base and derived classes called derived_1, derived_2 etc... I use a collection of instances of the base class, then when I retrieved an element and tried to use it I would find that C++ thinks it's type is that of the base class, probably because I retrieved it from a std::vector of base. Which is a problem when I want to use features that only exist for the specific derived class who's type I knew this object was when I put it into the vector. So I cast the element into the type it is supposed to be and found this wouldn't work. (derived_3)obj_to_be_fixed; And remembered that it's a pointer thing. After some tweaking this now worked. *((derived_3*)&obj_to_be_fixed); Is this right or is there for example an abc_cast() function that does it with less mess?

    Read the article

  • Accessing structure elements using pointers

    - by Arun Nadesh
    Hi Everybody, Greetings! I got surprised when the following program did not crash. typedef struct _x{ int a; char b; int c; }x; main() { x *ptr=0; char *d=&ptr->b; } As per my understanding the -> operator has higher precedence over & operator. So I expected the program to crash at the below statement when we try to dereference the NULL pointer tr. char *d=&ptr->b; But the statement &ptr->b evaluates to a valid address. Could somebody please explain where I'm wrong? Thanks & Regards, Arun

    Read the article

  • How do I copy object in Qt?

    - by Martin
    I'm using Qt and have some real basic problems. I have created my own widget MyTest that have a variable obj. I need to set this variable obj from an object outside of the widget so that the variable is copied not just a pointer to another object. I get an error message and can't figure out how to do this basic stuff. This is the code I'm using: MyTest.h: class MyTest : public QWidget { Q_OBJECT public: void setObj(QObject &inobj); QObject obj; .... } MyTest.cpp: void MyTest::setObj(QObject &inobj) { obj = inobj; //HERE I get the error message: "illegal access from 'QObject' to protected/private member 'QObject::operator=(const QObject &)'" } main.cpp: int main(int argc, char *argv[]) { QApplication a(argc, argv); QObject *ob = new QObject(); MyTest w; w.setObj(*ob); } Thanks for your help!

    Read the article

  • printing sequence number of a sniffed packet

    - by scatman
    i am using pcap to create a packet sniffer. i have this tcp structure: typedef struct TSP_header{ unsigned short int sport; unsigned short int dport; unsigned int seqnum; unsigned int acknum; unsigned char reserved:4, offset:4; unsigned int tcp_res1:4, //little-endian tcph_hlen:4, //length of tcp header in 32-bit words tcph_fin:1, //Finish flag "fin" tcph_syn:1, //Synchronize sequence numbers to start a connection tcph_rst:1, //Reset flag tcph_psh:1, //Push, sends data to the application tcph_ack:1, //acknowledge tcph_urg:1, //urgent pointer tcph_res2:2; unsigned short int tcph_win; unsigned short int tcph_chksum; unsigned short int tcph_urgptr; }TSP_header; how can i print the sequence number? shou i use htons(sequence_number)?? coz it isn't working this way!!

    Read the article

  • Put an X on the topright of a div without making the top clickable

    - by acidzombie24
    I have a rect and have an X on the top right with items inside of it. The div with the X is clickable. The problem is the whole top area is clickable and not just the topright (the 'X') as i wanted. How do i make only the X clickable and still align to the right? my css is .itembox { float:left; } .itembox .RemoveMediaNotif { text-align: right; text-decoration:underline; cursor: pointer; } my html is <div class="itembox" id="i16"><div class="RemoveMediaNotif">X</div><div ...

    Read the article

  • Patterns for simulating optional "out" parameters in C#?

    - by Jesse McGrew
    I'm translating an API from C to C#, and one of the functions allocates a number of related objects, some of which are optional. The C version accepts several pointer parameters which are used to return integer handles to the objects, and the caller can pass NULL for some of the pointers to avoid allocating those objects: void initialize(int *mainObjPtr, int *subObjPtr, int *anotherSubObjPtr); initialize(&mainObj, &subObj, NULL); For the C# version, the obvious translation would use out parameters instead of pointers: public static void Initialize(out int mainObj, out int subObj, out int anotherSubObj); ... but this leaves no way to indicate which objects are unwanted. Are there any well-known examples of C# APIs doing something similar that I could imitate? If not, any suggestions?

    Read the article

  • Android programmatically add buttons to layout from string array

    - by Luke Batley
    Does anyone know how to programatically add buttons to the layout from an array? I have an array of titles and icons that i have used for a list view and now i'm wanting to reuse the same arrays to create a layout as displayed here so the layout adds a button for each item in the array and arranges them in 3's according to device width. is this possible to do? I have tried using a custom Array Adapter to generate the Grid but getting a null pointer error at the point menuGrid = (GridView) findViewById(R.id.gridView1); MenuItemsSetup menuData[] = new MenuItemsSetup[] { new MenuItemsSetup(R.drawable.ic_menu_icon1, "menuItem1"), new MenuItemsSetup(R.drawable.ic_menu_icon2, "menuItem2"), new MenuItemsSetup(R.drawable.ic_menu_icon3, "menuItem3"), new MenuItemsSetup(R.drawable.ic_menu_icon4, "menuItem4"), new MenuItemsSetup(R.drawable.ic_menu_icon5, "menuItem5"), new MenuItemsSetup(R.drawable.ic_menu_icon6, "menuItem6"), new MenuItemsSetup(R.drawable.ic_menu_icon7, "menuItem7"), new MenuItemsSetup(R.drawable.ic_menu_icon8, "menuItem8") }; String[] menuBgColours = {"#FFFFFF","#FFFFFF", ,"#888888", "#FFFFBB", "#BBFFFF","#000000", "#666666"}; CustomArrayAdapter adapter = new CustomArrayAdapter(this, R.layout.drawer_list_item, menuData, menuBgColours); menuList.setAdapter(adapter); menuGrid.setAdapter(adapter);

    Read the article

  • Passing Boost uBLAS matrices to OpenGL shader

    - by AJM
    I'm writing an OpenGL program where I compute my own matrices and pass them to shaders. I want to use Boost's uBLAS library for the matrices, but I have little idea how to get a uBLAS matrix into OpenGL's shader uniform functions. matrix<GLfloat, column_major> projection(4, 4); // Fill matrix ... GLuint projectionU = glGetUniformLocation(shaderProgram, "projection"); glUniformMatrix4fv(projectionU, 1, 0, (GLfloat *)... Um ...); Trying to cast the matrix to a GLfloat pointer causes an invalid cast error on compile.

    Read the article

  • Is it possible to run a MIDP application under Android

    - by SteveM
    The Google Market offers an application purporting to run J2ME MIDP applications on the Nexus One. I have tried this application but it only appears to run MIDP applications that are downloaded from particular web sites; it does not seem capable of picking up a MIDP application that is stored on the SD card in the phone. I have suggested to the developers that they might like to add such functionality, but they have not been particularly responsive to my messages. So I would like to build my own MIDP runner for Android and would like to see if I can find a pointer as to where to start, or even whether this is possible. The MIDP application in question was supplied on CD along with a security camera system and permits remote viewing and remote control over the security system. Clearly it wasn't built with the Android platform in mind. However, if it is possible somehow to run MIDP applications on Android (perhaps by creating some kind of sandbox environment for example) then I'd be quite keen to develop it.

    Read the article

  • Can someone explain this "endian-ness" function for me?

    - by Mike
    Write a program to determine whether a computer is big-endian or little-endian. bool endianness() { int i = 1; char *ptr; ptr = (char*) &i; return (*ptr); } So I have the above function. I don't really get it. ptr = (char*) &i, which I think means a pointer to a character at address of where i is sitting, so if an int is 4 bytes, say ABCD, are we talking about A or D when you call char* on that? and why? Would some one please explain this in more detail? Thanks. So specifically, ptr = (char*) &i; when you cast it to char*, what part of &i do I get?

    Read the article

  • Dereferencing pointers without pointing them at a variable

    - by Miguel
    I'm having trouble understanding how some pointers work. I always thought that when you created a pointer variable (p), you couldn't deference and assign (*p = value) unless you either malloc'd space for it (p = malloc(x)), or set it to the address of another variable (p = &a) However in this code, the first assignment works consistently, while the last one causes a segfault: typedef struct { int value; } test_struct; int main(void) { //This works int* colin; *colin = 5; //This never works test_struct* carter; carter->value = 5; } Why does the first one work when colin isn't pointing at any spare memory? And why does the 2nd never work? I'm writing this in C, but people with C++ knowledge should be able to answer this as well.

    Read the article

  • How to send large objects using boost::asio

    - by Max
    Good day. I'm receiving a large objects via the net using boost::asio. And I have a code: for (int i = 1; i <= num_packets; i++) boost::asio::async_read(socket_, boost::asio::buffer(Obj + packet_size * (i - 1), packet_size), boost::bind(...)); Where My_Class * Obj. I'm in doubt if that approach possible (because i have a pointer to an object here)? Or how it would be better to receive this object using packets of fixed size in bytes? Thanks in advance.

    Read the article

  • Django excluding specific instances from queryset without using field lookup

    - by Agos
    Hi, I sometimes have the need to make sure some instances are excluded from a queryset. This is the way I do it usually: unwanted_instance = Mymodel.objects.get(pk=bad_luck_number) uninteresting_stuff_happens() my_results = MyModel.objects.exclude(id=unwanted_instance.id) or, if I have more of them: my_results = MyModel.objects.exclude(id_in=[uw_in1.id, uw_in2.id, uw_in3.id]) This 'feels' a bit clunky, so I tried if I was lucky: my_ideally_obtained_results = MyModel.objects.exclude(unwanted_instance) Which doesn't work. But I read here on SO that a subquery can be used as parameter for exclude. Am I out of luck? Am I missing some functionality (checked the docs, but didn't find any useful pointer)

    Read the article

  • Python nested function scopes

    - by Thomas O
    I have code like this: def write_postcodes(self): """Write postcodes database. Write data to file pointer. Data is ordered. Initially index pages are written, grouping postcodes by the first three characters, allowing for faster searching.""" status("POSTCODE", "Preparing to sort...", 0, 1) # This function returns the key of x whilst updating the displayed # status of the sort. ctr = 0 def keyfunc(x): ctr += 1 status("POSTCODE", "Sorting postcodes", ctr, len(self.postcodes)) return x sort_res = self.postcodes[:] sort_res.sort(key=keyfunc) But ctr responds with a NameError: Traceback (most recent call last): File "PostcodeWriter.py", line 53, in <module> w.write_postcodes() File "PostcodeWriter.py", line 47, in write_postcodes sort_res.sort(key=keyfunc) File "PostcodeWriter.py", line 43, in keyfunc ctr += 1 UnboundLocalError: local variable 'ctr' referenced before assignment How can I fix this? I thought nester scopes would have allowed me to do this. I've tried with 'global', but it still doesn't work.

    Read the article

  • Throwing Exception in CTOR and Smart Pointers

    - by David Relihan
    Is it OK to have the following code in my constructor to load an XML document into a member variable - throwing to caller if there are any problems: MSXML2::IXMLDOMDocumentPtr m_docPtr; //member Configuration() { try { HRESULT hr = m_docPtr.CreateInstance(__uuidof(MSXML2::DOMDocument40)); if ( SUCCEEDED(hr)) { m_docPtr->loadXML(CreateXML()); } else { //throw exception to caller } } catch(...) { //throw exception to caller } } Based on Scott Myers RAII implementations in More Effective C++ I believe I am alright in just allowing exceptions to be thrown from CTOR as I am using a smart pointer(IXMLDOMDocumentPtr). Let me know what you think....

    Read the article

  • How to GetGuiResources for all system processes?

    - by Krzysztof
    Hello, I need to measure all used GDI objects in a Windows xp system. I found a GetGuiResources(__in HANDLE hProcess, __in DWORD uiFlags) method (with the GR_GDIOBJECTS flag). I call it for the process which I get from the method GetCurrentProcess() defined in WinBase.h. I don't know how to call it for other system processes, which I get by System::Diagnostics::Process::GetProcesses(), because that function returns an array of Process pointers, and GetGuiResources takes a HANDLE. Does anybody know a solution for that? How can I transform Process pointer to a Handle or get HANDLEs for all running system processes? thanks for help in advance!

    Read the article

< Previous Page | 85 86 87 88 89 90 91 92 93 94 95 96  | Next Page >