This is probably far too simple for what you need to do, and it's aimed at a vintage version of .NET (the article says 2002). Yet it supports rotations, handles and, as far as I remember, isn't that bad, at least as a starting point.
DesignSurface
Hope it helps.
--m
Discussions
-
-
Excessive use of glass is already discouraged in the Top 10 Rules in the Vista UX Guidelines (rule #3).
Read them all carefully, then compare to the "Add Gadget" dialog... at first sight I would say it breaks three rules out of ten, which isn't too bad for a dialog with pretty much nothing on it.
I'm not ranting... it's a CTP and so on. I just picked on that dialog because if you drag it over notepad, or any sizable white surface, you immediately understand why a lot of glass is NOT a good idea. (and also why a lot of the other rules in the guidelines actually make sense).
--m
-
Announcements
Downloads Not Available Due to Site Maintenance
Downloads from MSDN Subscriber Downloads are currently not available due to site maintenance. We apologize for the inconvenience, and will restore full download functionality as soon as possible.
*yuck* bad timing or what? -
Hoegaarden
Weihenstephan
Schumacher Alt
Pilsner Urquell
Prosit -
I saw the same pattern, slow start, stuck during the night. I also installed FTM 5.0 this morning, hoping it would solve the problem, and apparently it did as it started off much better (somewhere around 240KB/sec)...
Now I'm stuck at 93%, which sounds like a bad joke.
Irascian, if that's of any comfort, I also get the 11001 error for any MSDN download. They probably choked...
*sigh*
-
Thanks a lot, "aquila" and congratulations for your italian...

--m -
Hello,
I'm almost done downloading Vista 5308 and I would like to test it on a beefed-up PC. Unfortunately that would be mine...
Has anybody tried dual-booting on this or previous CTP's? Is it up to scratch?
Thanks in advance
--m
-
First, I owe an apology to Minh for not answering his question... blame the long week-end we just had over here and too much overdue sleep. I'll catch up, promise.
In my post I was not suggesting to stop a thread with Thread.Abort(). I was only responding to the correct observation that you cannot abort a thread that is performing a blocking call to Accept().
The only way I could find to free a thread from this condition is to close the listening socket: this will cause a call to winsock's WSACancelBlockingCall() and an exception to be thrown. Once the exception is correctly handled, you can either have the thread clean up its mess and exit gracefully or kill it from the outside with a Thread.Abort() if this is what you intend to do (and I fully agree with wkempf that it usually isn't).
--m -
If you don't have to do other stuff while waiting for the connection, the simplest solution is to use the Poll () method on _listenSocket.
The Socket.Poll (int timeout, SocketMode mode) will wait for the indicated timeout until the socket is in the specified mode (timeout is expressed in microseconds). A listening socket that has an incoming connection will be reported to be "readable".
Assuming you would want your application to stop listening within 10msec of the stop request, you should replace your loop with:
while (! mustExit) {
if (_listenSocket.Poll (10000, SelectMode.SelectRead)) {
Socket incoming = _listenSocket.Accept ();
ThreadPool.QueueUserWorkItem (new ...);
}
}
There are other options, I will try to put together some examples.
HTH
--m
P.S.: you can put everything in a thread... after all that's just what the async functions do. The only trick is that before calling Thread.Abort, you must close _listenSocket, so that the thread will not stay hanged in Accept. -
A lot depends on the kind of data you are going to manipulate... replicates and sorting comes to mind.
As far as sorting is concerned, I would say that if the data are not already sorted it would be a safe bet to sort them anyway. A linear scan will be O(N^2), while the sorted + binary search version will be O(N*log(N))... well, ok, the Quicksort has a wort case O(N^2), so in that case you would lose something, but that rather rare.
For the algorithm, here is a crude attempt that seems to be reasonably efficient, at least with random values.
public static int [] Match (int [] [] arrays) {
for (int i = 0; i < arrays.Length; i++) {
Array.Sort (arrays [i]);
}ArrayList res = new ArrayList ();
int current = 0;
int start = 0;
int index = 0;while (index < arrays [current].Length) {Happy new year (too late for Christmas).
int currentValue = arrays [current] [index];
for (;;) {
current = (current + 1) % arrays.Length;
if (current == start) {
res.Add (currentValue);
index++;
break;
} else {
int foundIndex = Array.BinarySearch (arrays [current], currentValue);
if (foundIndex < 0) {
index = ~foundIndex;
start = current;
break;
}
}
}
}
return (int []) res.ToArray (typeof (int));
}
--m