|
sowjanya_mudimala wrote: TypeDesciptor.GetConverter(typeof(MyPoint)) doesn't return the converter for MyPoint but returns System.ComponentModel.TypeConverter.
I just tested it:
class Program
{
static void Main(string[] args)
{
var tc = TypeDescriptor.GetConverter(typeof(MyPoint));
Console.WriteLine(tc.GetType());
Console.ReadLine();
}
}
Result:
MyPointTypeConverter
|
|
|
|
|
This seems to be a problem only on Vista with a certain set of pictues.
For instance, here is a picture...
http://tinyurl.com/55psg9[^]
Here is an excerpt of the code I am using to display the thumbnail (special code because height > width in the particular picture).
<br />
float _scale = (float)_orig.Width / (float)_orig.Height * __DesiredSize.Width;<br />
Image _image = _orig.GetThumbnailImage ((int)_scale, (int)__DesiredSize.Height, tnCallBack, IntPtr.Zero);<br />
<br />
Bitmap _backgroundImage = new Bitmap (__DesiredSize.Width, __DesiredSize.Height);<br />
Graphics _graphics = Graphics.FromImage (_backgroundImage);<br />
<br />
Rectangle _toPut = new Rectangle ((__DesiredSize.Width - _image.Width) / 2, 0, _image.Width, _image.Height);<br />
_graphics.DrawImage (_image, _toPut, new Rectangle (0, 0, _image.Width, _image.Height), GraphicsUnit.Pixel);<br />
Displaying the thumbnail in the a listview shows black bars on the side. Same thing happens with the landscape pics.
Any help would be greatly appreciated.
|
|
|
|
|
I have a threading problem and I'd like to ask your opinions about it. I have an array of objects I need to process one by one. I need to do two operations on each object. The problem is, both of those operations run on separate BackgroundWorkers. I need a solution to do operation 1 first and then operation 2 and when operation 2 completes continue to the other object in list. I couldn't figure out how to such a thing. Any ideas? I appreciate any ideas on this.
|
|
|
|
|
May be you ca keep a flag variable to keep track of what operation is going on currently so that both threads can use it as a look up to determine when to proceed with the next
Thanks
Laddie
Kindly rate if the answer was helpful
|
|
|
|
|
Well I tried this:
start process 1 worker
process 1 worker do work
process 1 worker complete: call for process 2 worker
start process 2 worker
process 2 worker do work
process 2 worker complete: call for check next
check next:
----index++
----if index > array.count then complete()
----else start process 1 worker
Well this does work fine for the first iteration but then all breaks loose. I logged the process and after second iteration and beyond, saw weird things like process 1 do work and process 2 do work working twice sometimes
I'm truly lost. God I hate threading
Here's the work log:
process1() - index: 0
process1 run.
process1 dowork.
process1 completed.
process2 run.
process2 dowork.
process2 completed.
nextitem().
process1() - index: 1
process1 run.
process1 dowork.
process1 dowork. (??)
process1 completed.
process2 run.
process1 completed.
process2 dowork.
process2 dowork.
process2 completed.
nextitem().
process1() - index: 2
process1 run.
process2 completed.
nextitem().
finished().
process1 dowork.
modified on Wednesday, May 21, 2008 11:32 AM
|
|
|
|
|
So you want to know how to do Synchronous operations Asynchronously? Perhaps you might want to rethink that?
led mike
|
|
|
|
|
I think the exact opposite. I need to do two async operations synchronous. That or I know definitions wrong
Either way I know it's weird but it's not my call, it's a component so I can't change the way it works..
|
|
|
|
|
From your problem description it sounds like led mike is right...
You say that you want to:
1. Run operation 1 on the next item in the array.
2. Wait for it to complete.
3. Run operation 2 on the same item.
4. Wait for it to complete.
5. Advance to the next item and start over at 1.
If we understand you correctly, there is no point whatsoever in running the operations on separate threads. If you need to run all of it on another thread than the main thread (so as not to block the UI), why not place the entire loop (for (i == 0; i < MyList.Length; i++) { Op1(i); Op2(i) } in a background thread?
If you instead want both operation 1 and 2 to be done on all elements in a list and the operations can be done in any order (2 before 1 or 1 before 2) on each element, run one (background) loop for operation 1 and one for operation 2. Don't bother letting them try to wait for eachother.
If you instead mean that both operations are lengthy and shouldn't block eachother (you want operation 1 to be able to proceed to the next element while operation 2 is working with the last one), but operation 1 has to happen before operation 2 on each element, try something like this:
private volatile int worker1index = 0;
private volatile int worker2index = 0;
private void Worker1()
{
for (worker1index = 0; worker1index < MyList.Length; worker1index++)
{
Op1(worker1index)
}
}
private void Worker2()
{
for (worker2index = 0; worker2index < MyList.Length; worker2index++)
{
while (worker1index <= worker2index)
{
Sleep(100);
}
Op2(worker2index);
}
}
Declaring the index variables volatile tells the compiler not to optimize away any memory accesses, and that is enough here. No need for "Interlocked" stuff (an int read or write is always required to be atomic, and even though the increment isn't it doesn't matter in this case). Sleeping in a loop is a bit crude, but it works...
Just fire up each worker on its own background thread to get the job done. Use BackgroundWorkers and their events to get signaled when they are done.
Be aware that you of course cannot add or remove items in the List while the workers are running. That is not threadsafe and will crash you.
--
Peter
|
|
|
|
|
I'm not quite clear on why you're using two threads, unless you want to overlap the first object's operation 2 with the second object's operation 1 (if the second thread finishes first, it would have to wait for the first thread; if the first thread finishes first, it could go on to object 3).
If that is your goal, and if you can guarantee that both threads will be operating on the same list of objects (nothing is going to appear or disappear), one approach would be to use a semaphore. The first thread should signal the semaphore after processing each object; the second should semaphore-wait before processing each object. The second thread would thus not process any object until the first thread was done with it, and each thread would (naturally) only process one object at once.
If you use this approach, you must take care that things don't get out of sync. If the first thread processes all the objects, signaling after each one, and the second thread waits before each object, and if both threads act upon the same objects in the same order, everything will work beautifully and efficiently. If an exception prevents the first thread from signaling after a particular object, however, the second thread may find itself waiting forever. Further, if objects appear or disappear at the wrong times, the second thread could get stuck waiting forever or it could process objects in advance of when the first thread does.
Provided the issues that would break synchronization are dealt with (by using suitable try/finally blocks and by requiring that nobody monkey with the list) the semaphore should provide a good approach.
|
|
|
|
|
How do I know an assembly was created under which version of .net framework ?
|
|
|
|
|
Run ILDasm > Open the assembly > double click the manifest node
The first line shows the .net version it was compiled.
// Metadata version: v1.1.4322
Thanks
Laddie
Kindly rate if the answer was helpful
|
|
|
|
|
Thanks. But I can't find such information here, Is there anything am I missing?
|
|
|
|
|
You mean to say you are not able to find the ILDASM tool or you are not able to find the manifest node ?
Thanks
Laddie
Kindly rate if the answer was helpful
|
|
|
|
|
When I use ildasm to open assembly, there is no such information you provided in manifest node.
|
|
|
|
|
You should double click the manifest node to open in a text viewer to see it
optionally you can go to the view menu > header
In the text find out the section called clr header it will be someting like this
----- CLR Header:
Header size: 0x00000048
Major runtime version: 0x0002
Minor runtime version: 0x0005
Which will give you the major and minor version of runtime required.
Thanks
Laddie
Kindly rate if the answer was helpful
|
|
|
|
|
I get what you said when I using ildasm v2.0, previously, I use ildasm1.1.
Thanks.
|
|
|
|
|
In a large organization, if you have UNIX applications, mainframe applications, Windows applications, etc. How do you get these to talk to each other?
may i know how .NET solve this problem ?
also, during deployment,we have to worry about which version of IE is installed, which version of MDAC is installed, etc. we may have to test our install on Windows 95, 98, ME, NT, 2000, and XP, with different service packs, to insure that the install and uninstall work correctly.
may i know how .NET solve this ?
|
|
|
|
|
|
Find out more about Mono, an open source Linux .NET Runtime and Framework.
Semicolons: The number one seller of ostomy bags world wide. - dan neely
|
|
|
|
|
Hi, i am taking a look into the windows updates and I have found a service pack 2 for .Net Compact Framework. I have already installed the .Net Framework 2.0 and 3.0 with both Service Packs 1. Should I get this update? Are there differences between them? (If yes... which)
Thanks.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
modified on Wednesday, May 21, 2008 1:15 PM
|
|
|
|
|
Nelek wrote: Should I get this update?
No. Never install updates, 3 out of 4 Security Experts agree updates can cause cavities.
led mike
|
|
|
|
|
Damn, I was hoping this would be a bit like the SUBJECT of the title, not even what OP SAID,
Can someone seriously though explain the differences in .NET CF and just .NET Framework, is it just that simple? I just don't get it, I am new to the mobile programming, and this has seriously recently fugged with me, my program requires .NET CF 2.0, on the pda .NET FRAMWORK 2.0 (blah blah long number) is loaded, however I CAN successfuly install .NET CF 2.0 on my windows mobile 5 pda. It then shows in Add / Remove Programs - however my Windows Mobile 6.0 PDA (even changed the platform so it would be a 6.0 app) No .NET CF shows up in the add / remove / programs - try to install NET CF 2.0 it says, there is a newer version already on it and to uninstall it - but like I said it doesnt show it in the add and remove, so I check the .NET FRAMWORK version of the PDA and its the same as the other one, however my app wont run on it, because I cant install the CF 2.0.
Sorry if I ranted a bit, but I'd really love to get schooled on what the differences is in the two? Is CF just simply compact meaning its for a mobile/compact device? Gosh, makes me want to go back web programming.
Computer Programmer Web/Mobile .NET
|
|
|
|
|
Compact Framework is, yes, just for mobile device programming on Windows CE and Windows Mobile. There's a different version for different devices.
Further complicating matters is that Windows Mobile 2003 and newer have versions of .NET Compact Framework in ROM. This ROM version is used if no version is installed to the filesystem. The ROM version, however, has been universally either the wrong version or buggy. .NET Compact Framework 1.0 was useless before SP2 and you should use SP3 if you plan to use this version, but I would recommend universally upgrading to Compact Framework 2.0 as there were numerous problems with CF 1.0 (not least very poor performance). Windows Mobile 5.0 generally came with CF 1.0 SP2 in ROM but the OEM could override this and I think some of Microsoft's OEM Adaptation Kit Updates (AKUs) included a newer version.
I haven't yet handled a Windows Mobile 6.0 device but it would be reasonable to expect that these come with Compact Framework 2.0 in ROM. Yours may well have the same version that you're trying to install.
To show the latest version(s) of Compact Framework installed on the device, navigate to \Windows in File Explorer and run the cgacutil program. This will show one line for each major release present (i.e. one for 1.0, one for 2.0, one for 3.5) indicating the build number. See here[^] for the list of build numbers versus service pack number.
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
.NET Compact Framework is for mobile device programming (Windows CE and Windows Mobile). If you don't do any mobile device programming, don't worry about it.
If you do, this update will update the version of .NET Compact Framework that Visual Studio automatically deploys to the device when you start a debug session. The service packs fix a number of serious issues like leaking memory when doing P/Invokes.
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
Thanks for the info.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|