Search Results

Search found 4126 results on 166 pages for 'bitwise operations'.

Page 104/166 | < Previous Page | 100 101 102 103 104 105 106 107 108 109 110 111  | Next Page >

  • delete,copy,rename files and directories in WINAPI ..?

    - by Kristian
    hi I made a code that search in a givin path for a certain file name or folder and print the value BUT now how can i modify it to instead of printing its name perform on of the operations ( delete,copy,rename ) I searched on google and found nothin. #include "stdafx.h" #include <windows.h> int _tmain(int argc, _TCHAR* argv[]) { TCHAR *fn; fn=L"d:\\*"; HANDLE f; WIN32_FIND_DATA data; f=FindFirstFile(fn,&data); if(f==INVALID_HANDLE_VALUE){ printf("not found\n"); return 0; } else{ _tprintf(L"found this file: %s\n",data.cFileName); } while(FindNextFile(f,&data)){ { _tprintf(L"found this file: %s\n",data.cFileName); } } } FindClose(f); return 0; }

    Read the article

  • The ** idiom in C++ for object construction

    - by bobobobo
    In a lot of C++ API'S (COM-based ones spring to mind) that make something for you, the pointer to the object that is constructed is usually required as a ** pointer (and the function will construct and init it for you) You usually see signatures like: HRESULT createAnObject( int howbig, Object **objectYouWantMeToInitialize ) ; -- but you seldom see the new object being passed as a return value. Besides people wanting to see error codes, what is the reason for this? Is it better to use the ** pattern rather than a returned pointer for simpler operations such as: wchar_t* getUnicode( const char* src ) ; Or would this better be written as: void getUnicode( const char* src, wchar_t** dst ) ; The most important thing I can think of is to remember to free it, and the ** way, for some reason, tends to remind me that I have to deallocate it as well.

    Read the article

  • SQlite/Firebird: Does any of them support multiple concurrent write access ?

    - by Quandary
    Question: I currently store ASP.net application data in XML files. Now the problem is I have asynchronous operations, which means I ran into the problem of simultanous write access on a XML file... Now, I'm considering moving to an embedded database to solve the issue. I'm currently considering SQlite and embeddable Firebird. I'm not sure however if SQlite or Firebird can handle multiple concurrent write access. And I certainly don't want the same problem again. Anybody knows ? SQlite certainly is better known, but which one is better - SQlite or Firebird ? I tend to say Firebird, but I don't really know. No MS-Access or MS-SQL-express recommodations please, I'm a sane person.

    Read the article

  • Faking a Single Address Space

    - by dsimcha
    I have a large scientific computing task that parallelizes very well with SMP, but at too fine grained a level to be easily parallelized via explicit message passing. I'd like to parallelize it across address spaces and physical machines. Is it feasible to create a scheduler that would parallelize already multithreaded code across multiple physical computers under the following conditions: The code is already multithreaded and can scale pretty well on SMP configurations. The fact that not all of the threads are running in the same address space or on the same physical machine must be transparent to the program, even if this comes at a significant performance penalty in some use cases. You may assume that all of the physical machines involved are running operating systems and CPU architectures that are binary compatible. Things like locks and atomic operations may be slow (having network latency to deal with and all) but must "just work".

    Read the article

  • PHP: Simulate multiple MySQL connections to same database

    - by Varun
    An insert query is constantly getting logged in my MySQL slow query log. I want to see how much time the INSERT query is taking with 100 simultaneous insert operations(to the same table). So I need to simulate the follwoing. 500 different simultaneous connections from PHP to the same database on a mysql server, all of which are inserting a row(simultaneously) to the same table. DO I need to use any load testing tool? Or Can I simply write a PHP script to do this? Any thoughts?

    Read the article

  • C++ Translation Phase Confusion

    - by blakecl
    Can someone explain why the following doesn't work? int main() // Tried on several recent C++ '03 compilers. { #define FOO L const wchar_t* const foo = FOO"bar"; // Will error out with something like: "identifier 'L' is undefined." #undef FOO } I thought that preprocessing was done in an earlier translation phase than string literal operations and general token translation. Wouldn't the compiler be more or less seeing this: int main() { const wchar_t* const foo = L"bar"; } It would be great if someone could cite an explanation from the standard.

    Read the article

  • how to protect an imported win32 dll into a .net application from memory issues

    - by Eric
    I have a c# application that needs to use a legacy win32 dll. The dll is almost its own app, it has dialogs, operations with hardware, etc. When this dll is imported and used, there are a couple of problems that occur: Dragging a dialog (not a windows system dialog, but one created by the dll) across the managed code app causes the UI to not repaint. Further it generates a system out of memory exception from various ui controls. The performance is incredibly slow. There seems to be no way to unload the dll so the memory never gets cleaned up. When we close our managed app, we get another memory exception. At the moment we import each method call as such: [DllImport("dllname.dll", EntryPoint = "MethodName", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]

    Read the article

  • Is there a Windows utility that will let me do multiple programmatic find/replaces on text that I cu

    - by billmaya
    I've inherited some C# code that contains about a thousand lines of source that I need to modify, transforming it from this: newDataRow["to_dir"] = comboBox108.Text; To this: assetAttributes.Add("to_dir", comboBox108.Text); The lines occur in various places throughout the application in groups of 40 or 50. Modifying each line by hand in Visual Studio 2008 can be done but it's labor intensive and prone to errors. Is there a Windows utility out there that will let me cut and paste groups of code into it and then run some sort of reg-ex expression to transform the individual lines one-by-one? I'd also be willing to use some sort of VS 2008 add-in that performed the same set of reg-ex operations against a selection of code. Thanks in advance.

    Read the article

  • Apache and Rewrite Module

    - by Yvon Blais
    I created a file .htaccess in the /var/www directory., The rights are root root --wxrwxrwxr The content of the file is : Options +FollowSymlinks RewriteEngine on RewriteLogLevel 3 RewriteLog "/var/log/apache2/rewrite.log" RewriteRule ^(.*?)$ testphp.php When I call the page phpinfo.php, I've got: Loaded Modules ... mod_rewrite ... Therefore, the modules is loaded Afer each modification,I restared the server manually with sudo /etc/init.d/apache2 restart The error.log gives Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.2 with Suhosin-Patch configured -- resuming normal operations When I call a page anyone.htm or anyone.php, the rewrite.log does contain nothing and the real page is called. If I understand, the page anyone.php should be replaced by testphp.php Did I make siomething wrong ? Thanks

    Read the article

  • Strange behaviour of Android debugger in Eclipse when using Camera for preview.

    - by Buzzy
    Hi, I have an Android application that uses a SurfaceView subclass and Camera object to preview images before capture. Once I capture an image, I stop the preview and release the camera. Execution stops at any breakpoint after this. However, apart from the "Suspend" and "Terminate" icons, the rest are disabled. This is strange because the "Debug Current Instruction Pointer" is clearly at the said breakpoint and execution is already suspended. I can't perform any debugging operations and have no option but to terminate the session. Sometimes (very rarely), the session terminates by itself. I can confirm that this odd behavior takes place only after I preview the camera capture. I am fairly new to Android development. Is there some obvious mistake I am making? Any help would be highly appreciated.

    Read the article

  • Do I need to syncronize thread access to an int

    - by Martin Harris
    I've just written a method that is called by multiple threads simultaneously and I need to keep track of when all the threads have completed, the code uses this pattern: private void RunReport() { _reportsRunning++; try { //code to run the report } finally { _reportsRunning--; } } This is the only place within the code that _reportsRunning's value is changed, and the method takes about a second to run. Occasionally when I have more than six or so threads running reports together the final result for _reportsRunning can get down to -1, if I wrap the calls to _runningReports++ and _runningReports-- in a lock then the behaviour appears to be correct and consistant. So, to the question: When I was learning multithreading in C++ I was taught that you didn't need to synchronize calls to increment and decrement operations because they were always one assembly instruction and therefore it was impossible for the thread to be switched out mid-call. Was I taught correctly, and if so how come that doesn't hold true for C#?

    Read the article

  • Connect Android application to remote data

    - by tadywankenobi
    Sheesh talk about limited information! I'm trying to get my Android application to connect to an online database to access information. There's quite a bit of info including geotags and these are going to be mapped on my app. The developer site has the very informative piece of information: You can use the network (when it's available) to store and retrieve data on your own web-based services. To do network operations, use classes in the following packages: java.net.* android.net.* Like I said in my previous question, I'm still very much an android newbie, and trying to remember my java oop from college is slow. Does anyone have an example of how this might work, or how I could implement it? I wouldn't mind even connecting to a local xml file, if I could find a good example of how to do that!? Am I just looking in all the wrong places?! Help. Please! T

    Read the article

  • A window that behaves both modally and non-modally

    - by Chris
    I want to create a WPF window that behaves as a modal dialogue box while at the same time facilitating selected operations on certain other windows of the same application. An example of this behaviour can be seen in Adobe Photoshop, which offers several dialogues that allow the user to use an eyedropper tool to make selections from an image while disabling virtually all other application features. I'm guessing that the way forward is to create a non-modal, always-on-top dialogue and programmatically disable those application features that are not applicable to the dialogue. Is there an easy way to achieve this in WPF? Or perhaps there's a design pattern I could adopt.

    Read the article

  • Simple integer encryption

    - by tloflin
    Is there a simple algorithm to encrypt integers? That is, a function E(i,k) that accepts an n-bit integer and a key (of any type) and produces another, unrelated n-bit integer that, when fed into a second function D(i,k) (along with the key) produces the original integer? Obviously there are some simple reversible operations you can perform, but they all seem to produce clearly related outputs (e.g. consecutive inputs lead to consecutive outputs). Also, of course, there are cryptographically strong standard algorithms, but they don't produce small enough outputs (e.g. 32-bit). I know any 32-bit cryptography can be brute-forced, but I'm not looking for something cryptographically strong, just something that looks random. Theoretically speaking it should be possible; after all, I could just create a dictionary by randomly pairing every integer. But I was hoping for something a little less memory-intensive.

    Read the article

  • How to optimize indexing of large number of DB records using Zend_Lucene and Zend_Paginator

    - by jdichev
    So I have this cron script that is deployed and ran using Cron on a host and indexes all the records in a database table - the index is later used both for the front end of the site and the backed operations as well. After the operation, the index is about 3-4 MB. The problem is it takes a lot of resources (CPU: 30+ and a good chunk of memory) and slows the machine down. My question is about how to optimize the operation described below: First there is a select query built using the Zend Framework API, this query is then passed to a Paginator factory that returns a paginator which I am using to balance the current number of items being indexed and not iterate over too much items. The script is iterating over the current items in the paginator object using a foreach loop until reaching the end and then it starts from the beginning after getting items for the next page. I am suspecting this overhead is caused by the Zend_Lucene but no idea how this could be improved.

    Read the article

  • Using generics in dotnet for functions with any number of arguments?

    - by Zarigani
    I would like to have a function that can "wrap" any other function call. In this particular case, it would allow me to write some more generic transaction handling around some specific operations. I can write this for any particular number of arguments, e.g. for one argument: Public Shared Sub WrapFunc(Of T)(ByVal f As Action(Of T), ByVal arg As T) ' Test some stuff, start transaction f(arg) ' Test some stuff, end transaction End Sub ... but I was hoping to have this handle any number of arguments without having to have duplicate code for 0 args, 1 arg, 2 args, etc. Is there a way of doing this?

    Read the article

  • Identify a non-computer network device?

    - by Avilan
    I'm current working on a program that scans my network and discoveres computers and devices on the network. I use various operations to find data on the devices I discover, but want to distinguish the network devices from computers. And I'm wondering if anyone knows how I could do this? I looked a bit at SNMP, and tried connecting to my network printer, router and modem. But I seem to only be able to connect to the printer, neither the router or modem responds. Is there another way to identify what kind of a device an IP address belongs to?

    Read the article

  • Representing a very large array of bits in little memory

    - by user614624
    Hello, I would like to represent a structure containing 250 M states(1 bit each) somehow into as less memory as possible (100 k maximum). The operations on it are set/get. I cold not say that it's dense or sparse, it may vary. The language I want to use is C. I looked at other threads here to find something suitable also. A probabilistic structure like Bloom filter for example would not fit because of the possible false answers. Any suggestions please?

    Read the article

  • Reading files with Java

    - by sikas
    I would like to know how can I read a file byte by byte then perform some operation every n bytes. for example: Say I have a file of size = 50 bytes, I want to divide it into blocks each of n bytes. Then each block is sent to a function for some operations to be done on those bytes. The blocks are to be created during the read process and sent to the function when the block reaches n bytes so that I don`t use much memory for storing all blocks. I want the output of the function to be written/appended on a new file. This is what I've reached to read, yet I don't know it it is right: fc = new JFileChooser(); File f = fc.getSelectedFile(); FileInputStream in = new FileInputStream(f); byte[] b = new byte[16]; in.read(b); I haven't done anything yet for the write process.

    Read the article

  • IDL-like parser that turns a document definition into powerful classes?

    - by paniq
    I am looking for an IDL-like (or whatever) translator which turns a DOM- or JSON-like document definition into classes which are accessible from both C++ and Python, within the same application expose document properties as ints, floats, strings, binary blobs and compounds: array, string dict (both nestable) (basically the JSON type feature set) allow changes to be tracked to refresh views of an editing UI provide a change history to enable undo/redo operations can be serialized to and from JSON (can also be some kind of binary format) allow to keep large data chunks on disk, with parts only loaded on demand provide non-blocking thread-safe read/write access to exchange data with realtime threads allow multiple editors in different processes (or even on different machines) to view and modify the document The thing that comes closest so far is the Blender 2.5 DNA/RNA system, but it's not available as a separate library, and badly documented. I'm most of all trying to make sure that such a lib does not exist yet, so I know my time is not wasted when I start to design and write such a thing. It's supposed to provide a great foundation to write editing UI components.

    Read the article

  • Optimality of Binary Search

    - by templatetypedef
    Hello all- This may be a silly question, but does anyone know of a proof that binary search is asymptotically optimal? That is, if we are given a sorted list of elements where the only permitted operation on those objects is a comparison, how do you prove that the search can't be done in o(lg n)? (That's little-o of lg n, by the way.) Note that I'm restricting this to elements where the only operation permitted operation is a comparison, since there are well-known algorithms that can beat O(lg n) on expectation if you're allowed to do more complex operations on the data (see, for example, interpolation search). Thanks so much! This has really been bugging me since it seems like it should be simple but has managed to resist all my best efforts. :-)

    Read the article

  • C++ / Java: Toggle boolean statement?

    - by Martijn Courteaux
    Hi, Is there a short way to toggle a boolean? With integers we can do operations like this: int i = 4; i *= 4; // equals 16 /* Which is equivalent to */ i = i * 4; So is there also something for booleans (like the *= operator for ints)? In C++: bool booleanWithAVeryLongName = true; booleanWithAVeryLongName = !booleanWithAVeryLongName; // Can it shorter? booleanWithAVeryLongName !=; // Or something? In Java: boolean booleanWithAVeryLongName = true; booleanWithAVeryLongName = !booleanWithAVeryLongName; // Can it shorter? booleanWithAVeryLongName !=; // Or something?

    Read the article

  • Construction an logical expression which will count bits in a byte.

    - by danatel
    When interviewing new candidates, we usually ask them to write a piece of C code to count the number of bits with value 1 in a given byte variable (e.g. the byte 3 has two 1-bits). I know all the common answers, such as right shifting eight times, or indexing constant table of 256 precomputed results. But, is there a smarter way without using the precomputed table? What is the shortest combination of byte operations (AND, OR, XOR, +, -, binary negation, left and right shift) which computes the number of bites?

    Read the article

  • Calling asynchronous methods from wcf service

    - by hima
    In my asp.net application, I am using wcf service to get all the business logic. I am using that service reference in my application to work with that. Now adding that service reference is giving another option Update service reference is giving Generate asynchronous operations. If I check the option and add the service will it generate asynchronous methods for my existing service. If so how do I use the metohd. Let me know the way for that. Thanks, Hima.

    Read the article

  • g++: Use ZIP files as input

    - by Notinlist
    We have the Boost library in our side. It consists of huge amount of files which are not changing ever and only a tiny portion of it is used. We swap the whole boost directory if we are changing versions. Currently we have the Boost sources in our SVN, file by file which makes the checkout operations very slow, especially on Windows. It would be nice if there were a notation / plugin to address C++ files inside ZIP files, something like: // @ZIPFS ASSIGN 'boost' 'boost.zip/boost' #include <boost/smart_ptr/shared_ptr.hpp> Are there any support for compiler hooks in g++? Are there any effort regarding ZIP support? Other ideas?

    Read the article

< Previous Page | 100 101 102 103 104 105 106 107 108 109 110 111  | Next Page >