Search Results

Search found 8389 results on 336 pages for 'shared calendar'.

Page 66/336 | < Previous Page | 62 63 64 65 66 67 68 69 70 71 72 73  | Next Page >

  • Using CreateFileMapping between two programs - C

    - by Jamie Keeling
    Hello, I have two window form applications written in C, one holds a struct consisting of two integers, another will receive it using the CreateFileMapping. Although not directly related I want to have three events in place so each of the processes can "speak" to each other, one saying that the first program has something to pass to the second, one saying the first one has closed and another saying the second one has closed. What would be the best way about doing this exactly? I've looked at the MSDN entry for the CreateFileMapping operation but I'm still not sure as to how it should be done. I didn't want to start implementing it without having some sort of clear idea as to what I need to do. Thanks for your time.

    Read the article

  • Is boost shared_ptr <XXX> thread safe?

    - by sxingfeng
    I have a question about boost :: shared_ptr. There are lots of thread. class CResource { xxxxxx } class CResourceBase { public: void SetResource(shared_ptr<CResource> res) { m_Res = res; } shared_ptr<CResource> GetResource() { return m_Res; } private: shared_ptr<CResource> m_Res; } CResourceBase base; //---------------------------------------------- Thread A: while (true) { ...... shared_ptr<CResource> nowResource = base.GetResource(); nowResource.doSomeThing(); ... } Thread B: shared_ptr<CResource> nowResource; base.SetResource(nowResource); ... //----------------------------------------------------------- If thread A do not care the nowResource is the newest . Will this part of code have problem? I mean when ThreadB do not SetResource completely, Thread A get a wrong smart point by GetResource? Another question : what does thread-safe mean? If I do not care about whether the resource is newest, will the shared_ptr nowResource crash the program when the nowResource is released or will the problem destroy the shared_point?

    Read the article

  • Using WPF class in a web application, problem with hosting permission

    - by tanathos
    I'm developing a DLL that uses WPF classes to make image manipulation. It works fine in my local environment, but when I try to use it in an hosted web site I retrieve this error: Request for the permission of type 'System.Security.Permissions.MediaPermission, WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' failed. exactly when I try to call the EndInit() of a BitmapImage object: BitmapImage originalImage = new BitmapImage(); originalImage.BeginInit(); originalImage.CacheOption = BitmapCacheOption.OnLoad; originalImage.UriSource = new Uri(physical_imagepath); originalImage.EndInit(); Any suggestion?

    Read the article

  • Trouble assigning a tr1::shared_ptr

    - by Max
    I've got a class that has a tr1::shared_ptr as a member, like so: class Foo { std::tr1::shared_ptr<TCODBsp> bsp; void Bar(); } In member function Bar, I try to assign it like this: bsp = newTCODBsp(x,y,w,h); g++ then gives me this error no match for ‘operator=’ in ‘((yarl::mapGen::MapGenerator*)this)->yarl::mapGen::MapGenerator::bsp = (operator new(40u), (<statement>, ((TCODBsp*)<anonymous>)))’ /usr/include/c++/4.4/tr1/shared_ptr.h:834: note: candidates are: std::tr1::shared_ptr<TCODBsp>& std::tr1::shared_ptr<TCODBsp>::operator=(const std::tr1::shared_ptr<TCODBsp>&) in my code, Foo is actually yarl::mapGen::MapGenerator. What am I doing wrong?

    Read the article

  • Casting a container of shared_ptr

    - by Jamie Cook
    Hi all, I have a method void foo(list<shared_ptr<Base>>& myList); Which I'm trying to call with a two different types of lists, one of DerivedClass1 and one of DerivedClass2 list<shared_ptr<DerivedClass1>> myList1; foo(myList1); list<shared_ptr<DerivedClass2>> myList2; foo(myList2); However this obviously generates a compiler error error: a reference of type "std::list<boost::shared_ptr<Base>, std::allocator<boost::shared_ptr<Base>>> &" (not const-qualified) cannot be initialized with a value of type "std::list<boost::shared_ptr<DerivedClass1>, std::allocator<boost::shared_ptr<DerivedClass1>>>" Is there any easy way to cast a container of shared_ptr? Of alternate containers that can accomplish this?

    Read the article

  • Using CreateFileMapping between to programs - C

    - by Jamie Keeling
    Hello, I have two window form applications written in C, one holds a struct consisting of two integers, another will receive it using the CreateFileMapping. Although not directly related I want to have three events in place so each of the processes can "speak" to each other, one saying that the first program has something to pass to the second, one saying the first one has closed and another saying the second one has closed. What would be the best way about doing this exactly? I've looked at the MSDN entry for the CreateFileMapping operation but I'm still not sure as to how it should be done. I didn't want to start implementing it without having some sort of clear idea as to what I need to do. Thanks for your time.

    Read the article

  • How can I compile an autotools project with statically linked dependancies?

    - by flyx
    There's an open source library I want to use. As I want to spread my software as binary package, I do not want the library to have dependancies on other libraries, so I need to link the dependancies statically. Now as the library is open source and there are no binaries provided, I compile it myself. The library uses autotools, and I didn't find any useful documentation on how to link dependancies statically. What I did try is to call the configure script with --enable-static, but this apparently only tells configure to compile a static version of the library - but what I need is a dynamic library that includes all the libraries it depends on. So, I need a way to either tell configure to link against dependancies statically, or a way to post-process the built library to include all dependancies. Can anyone tell me how to do this? Oh, and if it matters: I'm on 64bit Snow Leopard.

    Read the article

  • Java Thread - Memory consistency errors

    - by Yatendra Goel
    I was reading a Sun's tutorial on Concurrency. But I couldn't understand exactly what memory consistency errors are? I googled about that but didn't find any helpful tutorial or article about that. I know that this question is a subjective one, so you can provide me links to articles on the above topic. It would be great if you explain it with a simple example.

    Read the article

  • `enable_shared_from_this` has a non-virtual destructor

    - by Shtééf
    I have a pet project with which I experiment with new features of the upcoming C++0x standard. While I have experience with C, I'm fairly new to C++. To train myself into best practices, (besides reading a lot), I have enabled some strict compiler parameters (using GCC 4.4.1): -std=c++0x -Werror -Wall -Winline -Weffc++ -pedantic-errors This has worked fine for me. Until now, I have been able to resolve all obstacles. However, I have a need for enable_shared_from_this, and this is causing me problems. I get the following warning (error, in my case) when compiling my code (probably triggered by -Weffc++): base class ‘class std::enable_shared_from_this<Package>’ has a non-virtual destructor So basically, I'm a bit bugged by this implementation of enable_shared_from_this, because: A destructor of a class that is intended for subclassing should always be virtual, IMHO. The destructor is empty, why have it at all? I can't imagine anyone would want to delete their instance by reference to enable_shared_from_this. But I'm looking for ways to deal with this, so my question is really, is there a proper way to deal with this? And: am I correct in thinking that this destructor is bogus, or is there a real purpose to it?

    Read the article

  • Advice for keeping large C++ project modular?

    - by Jay
    Our team is moving into much larger projects in size, many of which use several open source projects within them. Any advice or best practices to keep libraries and dependancies relatively modular and easily upgradable when new releases for them are out? To put it another way, lets say you make a program that is a fork of an open source project. As both projects grow, what is the easiest way to maintain and share updates to the core? Advice regarding what I'm asking only please...I don't need "well you should do this instead" or "why are you"..thanks.

    Read the article

  • Multiset of shared_ptrs as a dynamic priority queue: Concept and practice

    - by Sarah
    I was using a vector-based priority queue typedef std::priority_queue< Event, vector< Event >, std::greater< Event > > EventPQ; to manage my Event objects. Now my simulation has to be able to find and delete certain Event objects not at the top of the queue. I'd like to know if my planned work-around can do what I need it to, and if I have the syntax right. I'd also like to know if dramatically better solutions exist. My plan is to make EventPQ a multiset of smart pointers to Event objects: typedef std::multi_set< boost::shared_ptr< Event > > EventPQ; I'm borrowing functions of the Event class from a related post on a multimap priority queue. // Event.h #include <cstdlib> using namespace std; #include <set> #include <boost/shared_ptr.hpp> class Event; typedef std::multi_set< boost::shared_ptr< Event > > EventPQ; class Event { public: Event( double t, int eid, int hid ); ~Event(); void add( EventPQ& q ); void remove(); bool operator < ( const Event & rhs ) const { return ( time < rhs.time ); } bool operator > ( const Event & rhs ) const { return ( time > rhs.time ); } double time; int eventID; int hostID; EventPQ* mq; EventPQ::iterator mIt; }; // Event.cpp Event::Event( double t, int eid, int hid ) { time = t; eventID = eid; hostID = hid; } Event::~Event() {} void Event::add( EventPQ& q ) { mq = &q; mIt = q.insert( boost::shared_ptr<Event>(this) ); } void Event::remove() { mq.erase( mIt ); mq = 0; mIt = EventPQ::iterator(); } I was hoping that by making EventPQ a container of pointers, I could avoid wasting time copying Events into the container and avoid accidentally editing the wrong copy. Would it be dramatically easier to store the Events themselves in EventPQ instead? Does it make more sense to remove the time keys from Event objects and use them instead as keys in a multimap? Assuming the current implementation seems okay, my questions are: Do I need to specify how to sort on the pointers, rather than the objects, or does the multiset automatically know to sort on the objects pointed to? If I have a shared_ptr ptr1 to an Event that also has a pointer in the EventPQ container, how do I find and delete the corresponding pointer in EventPQ? Is it enough to .find( ptr1 ), or do I instead have to find by the key (time)? Is the Event::remove() sufficient for removing the pointer in the EventPQ container? There's a small chance multiple events could be created with the same time (obviously implied in the use of multiset). If the find() works on event times, to avoid accidentally deleting the wrong event, I was planning to throw in a further check on eventID and hostID. Does this seem reasonable? (Dumb syntax question) In Event.h, is the declaration of dummy class Event;, then the EventPQ typedef, and then the real class Event declaration appropriate? I'm obviously an inexperienced programmer with very spotty background--this isn't for homework. Would love suggestions and explanations. Please let me know if any part of this is confusing. Thanks.

    Read the article

  • How to install the program depending on libstdc++ library

    - by Alex Farber
    My program is written in C++, using GCC on Ubuntu 9.10 64 bit. If depends on /usr/lib64/libstdc++.so.6 which actually points to /usr/lib64/libstdc++.so.6.0.13. Now I copy this program to virgin Ubuntu 7.04 system and try to run it. It doesn't run, as expected. Then I add to the program directory the following files: libstdc++.so.6.0.13 libstdc++.so.6 (links to libstdc++.so.6.0.13) and execute command: LD_LIBRARY_PATH=. ./myprogram Now everything is OK. The question: how can I write installation script for such program? myprogram file itself should be placed to /usr/local/bin. What can I do with dependencies? For example, on destination computer, /usr/lib64/libstdc++.so.6 link points to /usr/lib64/libstdc++.so.6.0.8. What can I do with this? Note: the program is closed-source, I cannot provide source code and makefile.

    Read the article

  • Same address, multiple shared_ptr counters, is it forbidden by C++ standard?

    - by icando
    Suppose I have some needs to do the following (This is just some imaginative code for discussion of the C++ standard, thus I won't discuss why I design it this way, so don't bother me something like: your design is wrong.) T* ptr = new T; shared_ptr<T> p(ptr); shared_ptr<T> q(ptr, SomeDeleterThatDoesnotDeleteButDoSomeOtherStuff()); Suppose the logic guarantees that p or some of its copies lives longer than any copies of q, so practically there won't be any problem. My question is, is it forbidden by C++ standard, e.g. explicitly stated as UB by C++ standard, that different shared_ptr counters share the same address? Thanks.

    Read the article

  • Why isn't the boost::shared_ptr -> operator inlined?

    - by Alan
    Since boost::shared_ptr could be called very frequently and simply returns a pointer, isn't the -> operator a good candidate for being inlined? T * operator-> () const // never throws { BOOST_ASSERT(px != 0); return px; } Would a good compiler automatically inline this anyway? Should I lose any sleep over this? :-)

    Read the article

  • PHP: Mapped Network Drives

    - by Abs
    Hello all, I have mapped a network drive to a computer in my home network. Now I am trying to access it via PHP - I did this quick test: echo opendir('Z:\\'); This gives me: Warning: opendir(Z:\) [function.opendir]: failed to open dir: No error in C:\wamp\www\webs\tester-function.php on line 3 What have I done wrong here? I don't want my users typing in the UNC path so is there a way to get the UNC path for them and maybe that will work when I try to access it? This is possible in Microsoft languages but I am not sure how to get PHP to do this - maybe using a cmd.exe command? Please note, the mapped drive does exist as I can see it and I can access it. It also does not appear to be a permissions problem as I am assuming it would of complained about this IF it could access that drive...right? Thanks all for any help

    Read the article

  • Which libraries use the "We Know Where You Live" optimization for std::make_shared?

    - by KnowItAllWannabe
    Over two years ago, Stephan T. Lavavej described a space-saving optimization he implemented in Microsoft's implementation of std::make_shared, and I know from speaking with him that Microsoft has nothing against other library implementations adopting this optimization. If you know for sure whether other libraries (e.g., for Gnu C++, Clang, Intel C++, plus Boost (for boost::make_shared)) have adopted this implementation, please contribute an answer. I don't have ready access to that many make_shared implementations, nor am I wild about digging into the bowels of the ones I have to see if they've implemented the WKWYL optimization, but I'm hoping that SO readers know the answers for some libraries off-hand. I know from looking at the code that as of Boost 1.52, the WKWYL optimization had not been implemented, but Boost is now up to version 1.55. Note that this optimization is different from std::make_shared's ability to avoid a dedicated heap allocation for the reference count used by std::shared_ptr. For a discussion of the difference between WKWYL and that optimication, consult this question.

    Read the article

  • shared_ptr as class member

    - by idimba
    It's common to declared contained objects as a pointers to that class, while "forward declarating" them in header file. This in order to reduce physical dependencies in code. For example class B; // forward declaration class A { private: B* pB; }; Would it be good idea to declare such a member as shared_ptr, instead of naked pointer? I would prefer scoped_ptr, but AFAIKit it won't be in standard.

    Read the article

  • C++ static classes & shared_ptr memory leaks

    - by HardCoder1986
    Hello! I can't understand why does the following code produce memory leaks (I am using boost::shared_ptr with static class instance). Could someone help me? #include <crtdbg.h> #include <boost/shared_ptr.hpp> using boost::shared_ptr; #define _CRTDBG_MAP_ALLOC #define NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) static struct myclass { static shared_ptr<int> ptr; myclass() { ptr = shared_ptr<int>(NEW int); } } myclass_instance; shared_ptr<int> myclass::ptr; int main() { _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_ALWAYS_DF | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)); return 0; }

    Read the article

  • C - fork() and sharing memory

    - by Ben
    I need my parent and child process to both be able to read and write the same variable (of type int) so it is "global" between the two processes. I'm assuming this would use some sort of cross-process communication and have one variable on one process being updated. I did a quick google and IPC and various techniques come up but I don't know which is the most suitable for my situation. So what technique is best and could you provide a link to a noobs tutorial for it. Thanks.

    Read the article

  • C++/Qt - Memory allocation question

    - by HardCoder1986
    Hello! I recently started investigating Qt for myself and have the following question: Suppose I have some QTreeWidget* widget. At some moment I want to add some items to it and this is done via the following call: QList<QTreeWidgetItem*> items; // Prepare the items QTreeWidgetItem* item1 = new QTreeWidgetItem(...); QTreeWidgetItem* item2 = new QTreeWidgetItem(...); items.append(item1); items.append(item2); widget->addTopLevelItems(items); So far it looks ok, but I don't actually understand who should control the objects' lifetime. I should explain this with an example: Let's say, another function calls widget->clear();. I don't know what happens beneath this call but I do think that memory allocated for item1 and item2 doesn't get disposed here, because their ownage wasn't actually transfered. And, bang, we have a memory leak. The question is the following - does Qt have something to offer for this kind of situation? I could use boost::shared_ptr or any other smart pointer and write something like shared_ptr<QTreeWidgetItem> ptr(new QTreeWidgetItem(...)); items.append(ptr.get()); but I don't know if the Qt itself would try to make explicit delete calls on my pointers (which would be disastrous since I state them as shared_ptr-managed). How would you solve this problem? Maybe everything is evident and I miss something really simple?

    Read the article

  • Force an object to be allocated on the heap

    - by Warren Seine
    A C++ class I'm writing uses shared_from_this() to return a valid boost::shared_ptr<>. Besides, I don't want to manage memory for this kind of object. At the moment, I'm not restricting the way the user allocates the object, which causes an error if shared_from_this() is called on a stack-allocated object. I'd like to force the object to be allocated with new and managed by a smart pointer, no matter how the user declares it. I thought it could be done through a proxy or an overloaded new operator, but I can't find a proper way of doing that. Is there a common design pattern for such usage? If it's not possible, how can I test it at compile time?

    Read the article

  • What factors could cause the scalability issue on a 10-core CPU?

    - by JackWM
    I am tuning the performance of parallel Java programs. And want to check the impacts from the Architecture. I'm look into the Intel 10-core CPU, Intel(R) Xeon(R) CPU E7-L8867. I found my program only scales up to 5 cores. What could be the causes? I'm considering the Architecture effects. e.g. memory contention? More specifically, Are the 10 cores symmetric to each other? How many memory controllers does it have?

    Read the article

< Previous Page | 62 63 64 65 66 67 68 69 70 71 72 73  | Next Page >