|
Niklas Lindquist wrote: I'm just saying there could be a good reason for doing this.
And calling BroadcastSystemMessage() is not a solution for that reason.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
I don't understand exactly how the WM_PASTE message is getting picked up,
but it might be safe to broardcast it everywhere if it only getting picked up in one place where the cursor and focus is,
remember - my intention is to let the user who already have his cursor focused on some text control to paste specific data, but the user must put the focus first before it will do anything...
Best Regards - Yovav Gad
CEO and founder of MicroMighty, Inc.
|
|
|
|
|
The huge array my algorithm need may be contain more than 2^100 struct elements.I don't know how to solve.
|
|
|
|
|
There is no question, so the only thing I can do is provide a comment. Here it is:
an "algorithm" that needs more memory than any reasonable system can hold, is not an algorithm at all. It is a kludge.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
I'm not sure Alan Turing would agree
|
|
|
|
|
Actually,this algorithm is just for a theoretical system.
|
|
|
|
|
The only thing that might help is sparse arrays[^] (if a lot of your array elements are some null value).
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I can't find any element could be ignored.
|
|
|
|
|
That's 1,267,650,600,228,229,401,496,703,205,376...
Are you doing a simulation of all of the fundamental particles in the universe?
And a 64bit processor isn't going to help you either. If each element took a byte, thats 1,267,650,600,228,229,401 Terabites (using vendors definition!) Assuming you had a bunch of terabite drives in RAID999, and each drive takes 10cm x 2cm x 20cm, you could fit 10x50x5 (in a cubic metre. That's with no cables or packaging.
So, 507060240091291760 m^3. Now, a container can hold approximately 75 cubic metres. Let's Assuming you squich it really hard to 100m^3. That's 5070602400912917 containers.
Looking at http://en.wikipedia.org/wiki/Container_ship[^], the largest container ship displaces 157,000 tons of water. Which is 157,000 cubic metres of cargo (assuming the boat is made of plywood). Thats 3229683057906 of these container ships.
Let's assume your local port can handle ten of these ships every ten hours, so averaging one an hour. It would take 3686852 centuries to just deliver this to you.
If they just delivered the last one now, they'd have had to start manufacturing them a 1/3rd of a million years BC.
I think you need to take another look at your algorithm, before I have to calculate how much mass you'd have to destroy in a matter-antimatter collider just to power the hard drive array for an hour.
Iain.
(Can you tell it's lunchtime?)
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
Iain Clarke wrote: container ship displaces 157,000 tons of water. Which is 157,000 cubic metres of cargo
This only holds if the density of the cargo is 1. So unless you can prove it is, Jabbe should be able to do what he wants.
|
|
|
|
|
To quote from a quick google search:
The density of pure water is 1000 kg/m3. Ocean water is more dense because of the salt in it. Density of ocean water at the sea surface is about 1027 kg/m3
I remembered it being 1 kg/litre, and there's 1000liter/m^3 so I was assuming fresh water...
I'm terribly sorry - the users algorithm is 2.7% more valid than I thought...
I expected many quibbles over my math - but not over the fundamental numbers!
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
My hard computational problem is NP—complete.However,my current computing strategy is based on the enumerative method,which causes the size of the initial record to increase exponentially.
|
|
|
|
|
Actually, it was not the numbers I was concerned about, but rather the assumption that the density of the drives equals the density of the displaced water.
I assume your ship has a hull, and thus it displaces the mass of the disk drives in water (salt or fresh) rather than the volume of them.
Jebbes approach is still not proven impossible.
|
|
|
|
|
Hmmm, you do have a point there... Hard drives are denser than water (no, I'm not testing this, but I have held bottled water).
So, if you would be so kind as to weight one of your Tb hard drives, then submerge it and get the displaced volume, I would be happy to recalculate whether then delivery start time was before or afer mankind descended from the trees.
(I don't mean little Jenssen getting an apple last week).
As for impossibility... I know you all are in denial, but you're simply fictions of my deranged imagination. So anything solution that happens after I die / wake up doesn't count...
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
It is common knowledge that if you fill a disk drive with light weight data structures, it will float on water.
|
|
|
|
|
You may use 24 tons of C12 (and a way to pack one struct in each atom)
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]
|
|
|
|
|
If i could,i will.
|
|
|
|
|
Your algorithm is probably wrong or inefficient. You'll do better to change your algorithm.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
guys..i am using silicon lab to send a data out to visual C++ using serial comm...i already know how to establish the serial port and receive data from the serial port...and i also can recieve data from it..but now the problem is the data i receive are strange character...example: i send a "hi" the output is "h¡ ||| |||" i dun understand this...im using printf("hi"); and using MFC to configure the serial comm..any helps?
|
|
|
|
|
Without seeing any code all we can do is guessing.
Maybe you are filling part of an uninitialized array and treating the entire array as if it were to contain valid data?
Show code, show more examples, figure out what the common characteristics are of your examples, look at the data both in ASCII and in hex, and try and explain the very first abnormal character or byte.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
I'm guessing that you are not null terminating the buffer into which you receive data.
Serial port communication does not null terminate anything.
So you might want to zero out the buffer before receiving data.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
ok..heres part of the code that put the data
void CComPort::Read(CString& sResult)
{
BOOL bWriteRC;
BOOL bReadRC;
DWORD iBytesWritten;
DWORD iBytesRead;
DWORD dwError;
char sBuffer[128];
char sMsg[512];
iBytesWritten = 0;
bWriteRC = WriteFile(m_hCom, "RE\r",3,&iBytesWritten,NULL);
if (!bWriteRC || iBytesWritten == 0)
{
dwError = GetLastError();
sprintf(sMsg, "Write of length query failed: RC=%d, "
"Bytes Written=%d, Error=%d",
bWriteRC, iBytesWritten, dwError);
AfxMessageBox(sMsg);
} // end if
memset(sBuffer,0,sizeof(sBuffer));
bReadRC = ReadFile(m_hCom, &sBuffer, 6, &iBytesRead, NULL);
if (bReadRC && iBytesRead > 0)
{
sResult = sBuffer;
}
else
{
/*sResult = "Read Failed";
dwError = GetLastError();
sprintf(sMsg, "Read length failed: RC=%d Bytes read=%d, "
"Error=%d ",
bReadRC, iBytesRead, dwError);
AfxMessageBox(sMsg);*/
} // end if
} // end CComP
the data that comes from the micro controller is put in sBuffer which then is put inside sResult...i can show display..but it give codes that looks like ascii to me...sometimes this " L!11…" sometimes this " 11…11", "LL!11","Š*ª11", and the best one i could get was this "HELL!",btw i send the word "HELLO"..
|
|
|
|
|
Try adding the following bold line to your code. It will null terminate your string as mentioned earlier.
memset(sBuffer,0,sizeof(sBuffer));
bReadRC = ReadFile(m_hCom, &sBuffer, 6, &iBytesRead, NULL);
sBuffer[iBytesRead] = 0;
if (bReadRC && iBytesRead > 0)
{
...
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
Hello,
i am creating a rectangle using glDrawPixels by specifying it's height and width. I need to rotate this rectangle somehow 45 degrees. What should i do in order to rotate this rectangle. by using glRasterPos i am positioning that rect somewhere on the screen. How would i keep it rotating?
thanks
|
|
|
|
|
Why are you using glDrawPixels ?
Can't you use glRect and then apply transformation on it (glRotate for instance) ?
|
|
|
|
|