Search Results

Search found 73 results on 3 pages for 'sharptooth'.

Page 2/3 | < Previous Page | 1 2 3  | Next Page >

  • How to best deal with photos passed to IFilter?

    - by sharptooth
    I'm implementing an IFilter for indexing image formats. One problem is photos - many users have tons of photos, photos are huge and loading and searching for text on them is time consuming. Yes, sometimes people use cameras instead of scanners for digitizing documents, but the potential problems IMO far outweight the possibility of encountering a document digitized with a photo camera. So my implementation will not extract text from photos at all. What should the IFilter do once it detects that a given file is a photo image - indicate an error or return empty text?

    Read the article

  • What's the purpose of having a separate "operator new[]" ?

    - by sharptooth
    Looks like operator new and operator new[] have exactly the same signature: void* operator new( size_t size ); void* operator new[]( size_t size ); and do exactly the same: either return a pointer to a big enough block of raw (not initialized in any way) memory or throw an exception. Also operator new is called internally when I create an object with new and operator new[] - when I create an array of objects with new[]. Still the above two special functions are called by C++ internally in exactly the same manner and I don't se how the two calls can have different meanings. What's the purpose of having two different functions with exactly the same signatures and exactly the same behavior?

    Read the article

  • Do I assign different or the same class id to 32-bit and 64-bit versions of the same IFilter?

    - by sharptooth
    I've implemented my own Microsoft Search IFilter. I need two versions of it - 32-bit and 64-bit for deploying them on corresponding systems. In case of IFilters for any file extension I can only register one IFilter class id. Which means I can only use one version on any system. So having two class ids seems useless - it only makes the automatic installer more complex. Do I reuse the same COM class id for both or do I use different class ids?

    Read the article

  • Can I use manifests to consume a COM server without specifying its version?

    - by sharptooth
    Two of our programs use the same COM server (also made by us) with the same class ids. Each program when installing copies the COM server files into its folder and regsvr32s the COM server. The problem is how to install the COM server so that the user can install either one or both of our programs into different folders in any order and likely of different versions. Clearly it's impossible without changing the class ids and that's lots of hassle with configurations. Ideally we would like to use manifests for that and go without regsvr32. The problem is every time I read about reg-free COM (for example, here) there's the version attribute in the assemblyIdentity. The version number should change every nightly build and I totally don't like the idea of (automatically) adjusting it. I understand why specifying dependency on a specific version is good, but it's completely useless in our scenarion. Is there a way to write manifests for both the COM server and the consumer so that they don't specify versions and just work with whatever version of the file happens to be in the folder? Also is there a way to restrict the search to the same folder as the consumer?

    Read the article

  • How could it happen that version control software emerged so lately?

    - by sharptooth
    According to Wikipedia (the table at the page bottom), the earliest known version control systems were CVS and TeamWare both known from year 1990. How can it be? Software development has been here from at most 1960's and I honestly can't imagine working with codebase without version control. How could it happen that version control software emerged so lately compared to software development?

    Read the article

  • How to easily pass a very long string to a worker process under Windows?

    - by sharptooth
    My native C++ Win32 program spawns a worker process and needs to pass a huge configuration string to it. Currently it just passes the string as a command line to CreateProcess(). The problem is the string is getting longer and now it doesn't fit into the 32K characters limitation imposed by Windows. Of course I could do something like complicating the worker process start - I use the RPC server in it anyway and I could introduce an RPC request for passing the configuration string, but this will require a lot of changes and make the solution not so reliable. Saving the data into a file for passing is also not very elegant - the file could be left on the filesystem and become garbage. What other simple ways are there for passing long strings to a worker process started by my program on Windows?

    Read the article

  • How to force programs out of swap file when a resources-intensive batch finishes?

    - by sharptooth
    We use employees' desktops for CPU-intensive simulation during the night. Desktops run Windows - usually Windows XP. Employees don't log off, they just lock the desktops, switch off their monitors and go. Every employee has a configuration file which he can edit to specify when he is most likely out of office. When that time comes a background program grabs data for simulation from the server, spawns worker processes, watches them, gets results and sends them to the server. When the time specified by the employee elapses simulation stops so that normal desktop usage is not interfered. The problem is that simuation consumes a lot of memory, so when the worker processes run they force other programs into the swap file. So when the employee comes all the programs he left are luggish and slow until he opens them one by one so that they are unswapped. Is there a way the program can force other programs out of swap file when it stops simulation so that they again run smoothly?

    Read the article

  • Can I use manifests to specify an optional dependency on a COM server?

    - by sharptooth
    I'd like to use manifests to specify a dependency on a COM server (reg-free COM). The consumer application will mostly work fine without the COM server - only something like 1,7% of its functionality uses the COM server. So with plain old regsvr32 it would start and work fine until the user would do something that would trigger CoCreateInstance() call and at that point the consumer would get an error message. Now I've played with manifests for a while and it looks like the consumer wouldn't even start unless the COM server assembly it depends on is present in the file system. That's no good. Is there a way to use reg-free COM with manifests and make the dependency optional - so that the consumer program starts and works fine until CoCreateInstance() is actually called?

    Read the article

  • IsValidLocale returns FALSE - how to overcome this?

    - by sharptooth
    When run on a Spanish version of Windows XP my program invokes LANGID langId = (LANGID) MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT ); LCID locale = MAKELCID( language, SORT_DEFAULT ); BOOL isValid = IsValidLocale( locale, LCID_INSTALLED ); IsValideLocale() return FALSE when asked about English locale. Obviously something must be tuned in Windows to change this behaviour. What exactly should I do? I understand that it's not completely a programming question but rather a deployment question. Still I think it will be better off here than anywhere else.

    Read the article

  • Is there a tool for detecting Visual Studio projects with duplicate GUIDs?

    - by sharptooth
    When creating new Visual Studio C++ projects there're two ways: either run the wizard and then painfully change all the necessary settings in the project or just copy and existing project, rename everything there and add files into it. The second variant is great except that the .vcproj file stores a project GUID. This GUID is used to track project dependencies and the startup project when two or more projects are in one solution. If any two projects in one solution have identical GUIDs problems can arise - dependencies are lost and the startup prject is reset on next solution reload. Clearly there's a need for a tool that would scan the filesystem subtree and detect projects with identical GUIDs here. Before I start writing one ... is there a ready tool for that?

    Read the article

  • How are iterators and pointers related?

    - by sharptooth
    Code with iterators looks pretty much like code with pointers. Iterators are of some obscure type (like std::vector<int>::iterator for example). What I don't get is how iterators and pointer are related to each other - is an iterator a wrapper around a pointer with overloaded operations to advance to adjacent elements or is it something else?

    Read the article

  • How to enforce users to create objects of class derived from mine with "new" only?

    - by sharptooth
    To implement reference counting we use an IUnknown-like interface and a smart pointer template class. The interface has implementation for all the reference-count methods, including Release(): void IUnknownLike::Release() { if( --refCount == 0 ) { delete this; } } The smart pointer template class has a copy constructor and an assignment operator both accepting raw pointers. So users can do the following: class Class : public IUnknownLike { }; void someFunction( CSmartPointer<Class> object ); //whatever function Class object; someFunction( &object ); and the program runs into undefined behavior - the object is created with reference count zero, the smart pointer is constructed and bumps it to one, then the function returns, smart pointer is destroyed, calls Release() which leads to delete of a stack-allocated variable. Users can as well do the following: struct COuter { //whatever else; Class inner;// IUnknownLike descendant }; COuter object; somefunction( &object.Inner ); and again an object not created with new is deleted. Undefined behavior at its best. Is there any way to change the IUnknownLike interface so that the user is forced to use new for creating all objects derived from IUnknownLike - both directly derived and indirectly derived (with classes in between the most derived and the base)?

    Read the article

  • How do I find useful code previously deleted but still stored in source control?

    - by sharptooth
    Whenever someone asks what to do with code that is no longer needed the answer is usually "delete it, restore it from source control if you need it back". Now how do I find that piece of source code in the repository? Let's limit scope to SVN for simplicity - I suspect that using any other source control system will not make much difference in this aspect (correct me if I'm wrong). If I delete that code and commit the changes it will no longer be in the latest revision. How do I find it without exporting each revision and searching thoroughly (which is nearly impossible)?

    Read the article

  • How to handle splitting a file under source control?

    - by sharptooth
    I have a .cpp file and .h file containing a class. Class.cpp contains the implementation and Class.h contains the definition. The class is overcomplicated so I want to separate some code and move it into a separate class. So I create NewClass.cpp and NewClass.h and move the code there. How do I handle this when the files are under SVN? I can simply "svn add" the two new files, but then they will appear as new and will have no history. I could instead "svn copy and rename" the two initial files and edit the the two old files and the two new files - then the two new files will have common history. Which approach is better from the point of version control? Should the new files share history with the old files or should they appear as new?

    Read the article

  • Why is overloading operator&() prohibited for classes stored in STL containers?

    - by sharptooth
    Suddenly in this article ("problem 2") I see a statement that C++ Standard prohibits using STL containers for storing elemants of class if that class has an overloaded operator&(). Having overloaded operator&() can indeed be problematic, but looks like a default "address-of" operator can be used easily through a set of dirty-looking casts that are used in boost::addressof() and are believed to be portable and standard-compilant. Why is having an overloaded operator&() prohibited for classes stored in STL containers while the boost::addressof() workaround exists?

    Read the article

  • What happens if a file I want to commit to SVN is updated so often I don't manage to do a merge quic

    - by sharptooth
    Consider a situation. I want to commit a changed file to SVN and see that someone else committed the same file after I checked it out, so I have to "update" and merge changes. While I'm doing that someone commits the same file again, so when I try to commit the merged file I have to update again. Now if other users commit often enough it looks like I will never be able to commit my changes. Is that really so? How is this problem solved in real development environments?

    Read the article

  • How to make Visual C++ 9 not emit code that is actually never called?

    - by sharptooth
    My native C++ COM component uses ATL. In DllRegisterServer() I call CComModule::RegisterServer(): STDAPI DllRegisterServer() { return _Module.RegisterServer(FALSE); // <<< notice FALSE here } FALSE is passed to indicate to not register the type library. ATL is available as sources, so I in fact compile the implementation of CComModule::RegisterServer(). Somewhere down the call stack there's an if statement: if( doRegisterTypeLibrary ) { //<< FALSE goes here // do some stuff, then call RegisterTypeLib() } The compiler sees all of the above code and so it can see that in fact the if condition is always false, yet when I inspect the linker progress messages I see that the reference to RegisterTypeLib() is still there, so the if statement is not eliminated. Can I make Visual C++ 9 perform better static analysis and actually see that some code is never called and not emit that code?

    Read the article

  • Why is short project lifetime and other situation-specific reasons used to excuse crappy code? [clos

    - by sharptooth
    Every now and then (including on SO) people say things implying that "if the project is short lived you can leave obvious defects there" or "that memory leak only accounts for 100 bytes per whole program lifetime and could be left". Now in my practice I always reuse company-owned code to the greatest extent I can. Like if I need something and I can find it in the company codebase I take it from there and reuse or adapt. This means that any crappy code will be reused as well and I might notice or not notice defects therein. So the defect in some "test we only need for a month" can slip into a proram we ship to customers. And a leak that "only accounted for 100 bytes per lifetime" now could account for 100 bytes 10 times per second in a server application intended to run for months. That's why I don't understand why excuses like that are offered. Is our compamy the only one having a source control? Or are we the only company that requires writing human-readable code? Could anyone shed a light on why people seriously offer such excuses?

    Read the article

  • Is the C++ compiler optimizer allowed to break my destructor ability to be called multiple times?

    - by sharptooth
    We once had an interview with a very experienced C++ developer who couldn't answer the following question: is it necessary to call the base class destructor from the derived class destructor in C++? Obviously the answer is no, C++ will call the base class destructor automagically anyway. But what if we attempt to do the call? As I see it the result will depend on whether the base class destructor can be called twice without invoking erroneous behavior. For example in this case: class BaseSafe { public: ~BaseSafe() { } private: int data; }; class DerivedSafe { public: ~DerivedSafe() { BaseSafe::~BaseSafe(); } }; everything will be fine - the BaseSafe destructor can be called twice safely and the program will run allright. But in this case: class BaseUnsafe { public: BaseUnsafe() { buffer = new char[100]; } ~BaseUnsafe () { delete[] buffer; } private: char* buffer; }; class DerivedUnsafe { public: ~DerivedUnsafe () { BaseUnsafe::~BaseUnsafe(); } }; the explicic call will run fine, but then the implicit (automagic) call to the destructor will trigger double-delete and undefined behavior. Looks like it is easy to avoid the UB in the second case. Just set buffer to null pointer after delete[]. But will this help? I mean the destructor is expected to only be run once on a fully constructed object, so the optimizer could decide that setting buffer to null pointer makes no sense and eliminate that code exposing the program to double-delete. Is the compiler allowed to do that?

    Read the article

  • Why is comparing against "end()" iterator legal?

    - by sharptooth
    According to C++ standard (3.7.3.2/4) using (not only dereferencing, but also copying, casting, whatever else) an invalid pointer is undefined behavior (in case of doubt also see this question). Now the typical code to traverse an STL containter looks like this: std::vector<int> toTraverse; //populate the vector for( std::vector<int>::iterator it = toTraverse.begin(); it != toTraverse.end(); ++it ) { //process( *it ); } std::vector::end() is an iterator onto the hypothetic element beyond the last element of the containter. There's no element there, therefore using a pointer through that iterator is undefined behavior. Now how does the != end() work then? I mean in order to do the comparison an iterator needs to be constructed wrapping an invalid address and then that invalid address will have to be used in a comparison which again is undefined behavior. Is such comparison legal and why?

    Read the article

  • Is it "legal" for C++ runtime to call terminate() when the C++ code is used inside some non-C++ prog

    - by sharptooth
    In certain cases - especially when an exception escapes a destructor during stack unwinding - C++ runtime calls terminate() which must do something reasonable post-mortem and then exit the program. When a question "why so harsh" arises the answer is usually "there's nothing more reasonable to do in such error situations". That sounds reasonable if the whole program is in C++. Now what if the C++ code is in a library and the program that uses the library is not in C++? This happens quite often - for example I might have a native C++ COM component consumed by a .NET program. Once terminate() is called inside the component code the .NET program suddenly ends abnormally. The program author will first of all think "I don't care of C++, why the hell is this library make my program exit?" How do I handle the latter scenario when developing libraries in C++? Is it reasonable that terminate() unexpectedly ends the program? Is there a better way to handle such situations?

    Read the article

  • Is a C++ compiler allowed to emit different machine code compiling the same program?

    - by sharptooth
    Consider a situation. We have some specific C++ compiler, a specific set of compiler settings and a specific C++ program. We compile that specific programs with that compiler and those settings two times, doing a "clean compile" each time. Should the machine code emitted be the same (I don't mean timestamps and other bells and whistles, I mean only real code that will be executed) or is it allowed to vary from one compilation to another?

    Read the article

< Previous Page | 1 2 3  | Next Page >