|
Brain fart.
"Real men drive manual transmission" - Rajesh.
|
|
|
|
|
{OT} where is your MVP tag??
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
The MVP tag? That, I lost in the forest.
Actually, I didn't win it this year.
"Real men drive manual transmission" - Rajesh.
|
|
|
|
|
#include <windows.h>
#include <iostream>
using namespace std;
union MyUnion
{
ULONGLONG ull;
BYTE b[8];
};
int main()
{
ULONGLONG v = 0x0123456789ABCDEF;
MyUnion mu;
mu.ull = v;
for (int i=0; i<6; i++)
{
cout << hex << (INT) mu.b[i] << endl;
}
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi all,
char possibles[37] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
i am renerating random string with help of rand function.
how can i calculate the maximum combination for generate random string of given length?
like if i give length = 4?
so how cany maximum string generated of length 4 from given cahr array?
please help me for this.
thanks in advance.
|
|
|
|
|
It's known as Permutation[^], and there's formulae on that page that answers your question.
By the way, this is not even a programming question, and has nothing to do with C++ or MFC.
"Real men drive manual transmission" - Rajesh.
|
|
|
|
|
If order is important you have to use "Permutation". Otherwise you have to use "Combination". You have to select 4 characters out of the 36 characters. 36c4 is what you need. 36!/32!*4! is the way to calculate if my memory is good.
|
|
|
|
|
Depends on whether or not a character may be repeated in a string.
If so, it's very,very,very easy:
# combinations = pow(numCharsToChooseFrom, lengthOfGeneratedString)
4 char string - 37^4 = 1,874,161
5 char string - 37^5 = 69,343,957
If a character may not be repeated, it is a little more involved.
# combinations = (numCharsToChooseFrom!) / ((numCharsToChooseFrom-lengthOfGeneratedString)!)
4 character string - 37 * 36 * 35 * 34 = 1,585,080
5 char string - 37 * 36 * 35 * 34 * 33 = 52,307,640
or to put it more simply
4 character string - (37! / 33!) = 1,585,080
5 char string - (37! / 32!) = 52,307,640
Where the ! operator means factorial[^].
|
|
|
|
|
how to compress the data in c programming?
what is the algorithm in c?
|
|
|
|
|
|
|
I found ReadFile operation is slow. Is there ay way to make it fast? Or is there any assemble code available to read from file/disk
|
|
|
|
|
Often times, when disk-io needs to be sped-up there are gains to be made in the way that the data is accessed -but not so much (if any gain) available in the function used to get that data.
For example - if you have (say)a million pieces of data stored in a file, it's a better(faster) option to use ReadFile just once and read in the 1,000,000 pieces of data than it is to call the function 1,000,000 times to read 1 piece of data.
Provided you're running in an OS with protected memory (i.e not DOS), no - not practically. You could attempt to write some low level code, but I'd suspect that the folk that wrote that part of windows would be more capable of speed than you.
Are you able to elaborate on the conditions in which you're using ReadFile, and the reasons you've come to the conclusion it's slow? It's very likely that algorithmic improvements can be made. 
|
|
|
|
|
How do you measure "slow"? At the very best a ReadFile() operation will operate at the transfer speed of the disk and its interface. At the very worst there are lots of factors that may affect it.
The best things in life are not things.
|
|
|
|
|
Disk I/O in itself is slow, regardless of the API used. What exactly are you needing to do?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
I read data from a drive at different locations. I can not read large data because of some memory issue.
Why it's slow because i check one software which reads it fast.
|
|
|
|
|
Usually when reading from a file, then one reads in small chunks like one byte at a time.
If using a wrapper around ReadFile like fstream, then it will perform readahead caching by reading large chunks from the file into memory. When reading small chunks from fstream, then it will actually read directly from the internal cache inside fstream.
|
|
|
|
|
Hi all,
i want to send info to my server and on server side server processed on received information and get back some result on my side i receive the result and display a message what is returned by server.
so please tell me how can i do this processing?
what function or methods are use for this.
please help me for this and provide info and guidance for this.
thanks in advance.
|
|
|
|
|
There are many ways to do this (TCP/IP for instance), and most of them can be found with a simple Google search. CodeProject also has many articles on the subject.
"Real men drive manual transmission" - Rajesh.
|
|
|
|
|
Hi!
It depends on how you want to send the info to your server(whether it's in XML format or some other format). If it's XML use IXMLHTTPRequestPtr::open() to connect with the server and IXMLHTTPRequestPtr::send() to send ur XML content to the server. IXMLHTTPRequestPtr::responseText; to get the response from server.
Some body has already posted the whole code for this at the XML/XSL forum. See the reply of pix_programmer.Link below:
http://www.codeproject.com/Messages/427887/Failed-to-CreateInstance-while-using-IXMLHttpReque.aspx[^]
|
|
|
|
|
can i use POST method for this operation and function?
|
|
|
|
|
Le@rner wrote: can i use POST method for this operation and function?
I didn't fully understand your question. You can call open() function with "POST" as first parameter and the url or IP address of ur server as second parameter. Please go through the link I've given. It contains code that can be used as such if you are working with a VC++/MFC or a Win32 project.
|
|
|
|
|
I would almost venture to say raw sockets over your own API is the best method for a learner... everything else, including HTML/XML/Web Services is based on the socket foundation. So understanding sockets can be a great foundation.
|
|
|
|
|
Either use MFC wrapper classes or Windows API (try sockets, unless you want to write a totally custom driver). Use the Linux API sets for programs that you want to run on Linux. Alternatively you could use a third party networking solution (library), but I recommend coding a front end networking class that will load up different definition files based on the values of a set of macros (ex. #define OS WINDOWS). If your object oriented skills are up to par, then it should be no problem to write it once and port it to future programs, occasionally modifying the definitions based on the API updates/changes for each respective operating system you want to support.
|
|
|
|
|
I compiled a MFC application in debug mode.
When I run the program, most time, it was OK, but in a few times, it occurred following error:
Debug Error!
Program:
......XXX.exe
R6010
-abort() has been called
(Press Retry to debug the application)
Last night, I left the program running, it also occurred such error.
Now I let the program run for two hours,but the error has not occurred yet.
It seems the error occurred randomly, how can I get rid of the annoying problem .
|
|
|
|