|
Try and search for this error on the internet. A lot of posts discuss this error and many of the reasons mentioned are different - so you might find a solution somewhere.
My signature "sucks" today
|
|
|
|
|
Common statement - "Dotnet provides a common object oriented programming model across the languages it support."
One of the languages supported by CLR is 'C'. does the above statement mean that 'C' supports OOPS???
Regards,
NetQuestions
|
|
|
|
|
NetQuestions wrote: One of the languages supported by CLR is 'C'.
I don't think that is true. Managed C++ (aka C++/CLI) is supported but not C.
It's time for a new signature.
|
|
|
|
|
The concern is the managed C++/C, however i think the answer is no.
Thanks
Md. Marufuzzaman
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
NetQuestions wrote: languages supported by CLR is 'C'
Where did you find this? They must have meant C#.
My signature "sucks" today
|
|
|
|
|
NetQuestions wrote: One of the languages supported by CLR is 'C'
Wrong.
Visual Studio, since version 7, can be used to develop .NET applications, as it supports several .NET languages; it also supports building a Win32 application (all versions, up to and including the current version 10), based on a different set of languages; that is where C and C++ come in.
Furthermore managed code can call unmanaged or native code (such as C, assembler, ...), by using P/Invoke. That does not turn those languages into .NET languages; if it did, every language would be "managed".
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Personally I have never worked on any language in Dotnet other than C#. I have not worked on unsafe means also.
Luc, is it possible to call base class library methods like system.console.writeline() using unmanaged code like 'C'?
For it that is true, then 'Console is a class' here and Dotnet allows every language to use and access OOP based api => common object oriented programming model
Can this be a correct interpretation of my statement?
Regards,
NetQuestions
|
|
|
|
|
Hi
I had a string which consists both english and hindi characters. I want to write this in a unicode file, but some junk has been observed in the file. But, if i try to write the same data in utf8 file, it is perfectly written as it is.
what is the error?
How can i solve this?
the code is as follows:
string str1 = "This";
string str2 = "यह";
string str3 = str1 + "~" + str2;
StreamWriter sw11 = new StreamWriter(File.Open(@"C:\abc.txt", FileMode.Append));
sw11.WriteLine(str3);
sw11.Close();
str3 = Encoding.Unicode.GetString(Encoding.Convert(Encoding.ASCII, Encoding.Unicode, Encoding.ASCII.GetBytes(str1))) + Encoding.Unicode.GetString(Encoding.Convert(Encoding.ASCII, Encoding.Unicode, Encoding.ASCII.GetBytes("~"))) + Encoding.Unicode.GetString(Encoding.Convert(Encoding.UTF8, Encoding.Unicode, Encoding.UTF8.GetBytes(str2)));
StreamWriter sw12 = new StreamWriter(File.Open(@"C:\abcd.txt", FileMode.Append));
sw12.WriteLine(str3);
sw12.Close();
|
|
|
|
|
|
it is all in the documentation[^], as usual.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
I need to display multiple images from a folder by using four image boxes.
The pictures should display according to change. I was put "FileSystemWatcher" to identify the file change and display images according to that. but when execution it does't go inside the "public void OnChanged" function.
but no image will display.
does anyone know how to solve this issue. or any other method for display latest four images from a folder..
Thank you.
This is my code
public partial class Form1 : Form<br />
{<br />
FileSystemWatcher watcher = new FileSystemWatcher();<br />
<br />
public Form1()<br />
{<br />
<br />
InitializeComponent();<br />
<br />
watcher.Path = @"f:\My FYP\FYP_Update 2.1\New_Traffic_Pics";<br />
watcher.Created += new FileSystemEventHandler(OnChanged);<br />
LoadLatestImage();<br />
<br />
}<br />
<br />
public void LoadLatestImage()<br />
{<br />
<br />
<br />
<br />
watcher.NotifyFilter = NotifyFilters.LastWrite;<br />
<br />
watcher.Filter = "*.jpg";<br />
<br />
<br />
}<br />
<br />
public void OnChanged(object source, FileSystemEventArgs e)<br />
{<br />
pictureBox1.ImageLocation = e.FullPath;<br />
}<br />
<br />
<br />
private void Form1_Load(object sender, EventArgs e)<br />
{<br />
<br />
}<br />
<br />
private void pictureBox1_Click(object sender, EventArgs e)<br />
{<br />
<br />
}<br />
<br />
private void timer1_Tick(object sender, EventArgs e)<br />
{<br />
LoadLatestImage();<br />
}<br />
<br />
<br />
}
|
|
|
|
|
I agree.
Watch out for EnableRaisingEvents.
And please use PRE tags, not CODE tags, to preserve formatting when posting code snippets. It is in the guidelines.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
You might want to review this article series regarding FileSystemWatcher.
FileSystemWatcher - Pure Chaos (Part 1 of 2)[^]
FileSystemWatcher - Pure Chaos (Part 2 of 2)[^]
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Hi everyone
I have a question about creating a click event for a class. Thing is I have created a UserControl which takes images and arranges them dynamically given certain circumstances. This control uses a list of 'Viewports' (basically rectangles which carry an image). I would like to create an event for this Class 'Viewport'. Currently i use the click event of UserControl and loop through the list, checking the regions of these viewports. I thought I could do better than this and give each port it's own event without having to loop. Is this possible? I was thinking in the direction of an API, but all ideas are welcome.
Thanks
Steven Solberg
|
|
|
|
|
Steven Solberg wrote: This control uses a list of 'Viewports' (basically rectangles which carry an image).
Could each of them be a UserControl?
|
|
|
|
|
Hmmm, I could give that a shot I guess. Certainly would fix the issue about the click event. I however don't know how that would affect the rest of my application. But i'll let you know. Thanks for the tip
Steven
|
|
|
|
|
I added the inheritance from UserControl for the Viewport Class and added the click event. Ran a simple test with a messagebox and it works Or at least sort of. This fix totally screwed up my threads, but i'll sort that out later. Thank you very much
|
|
|
|
|
Why a UserControl? why not just a Panel? or, God forbid, a PictureBox?
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
:: shrugs :: Hadn't had any coffee at that point?
|
|
|
|
|
if your view ports are not real Controls in the Windows sense, then they are contained in one, probably the UserControl itself. So you could use its Click event, and apply a filter, something like:
protected override void OnClick(object sender, MouseEventArgs e) {
Point pt=e.Location;
foreach(ViewPort vp in viewPorts) {
if (vp.Bounds.Contains(pt) && ViewPortClick!=null) ViewPortClick(vp, e);
}
}
That way, you don't modify your UserControl design, don't add Controls, don't spend memory, and don't slow down its rendering; it would dispatch your click somewhat slower if you were to have dozens or hundreds of ViewPorts, however that would be bad for rendering already.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Perhaps it would be best if I widen my explanation
The Viewports in the UserControl are somewhat controls themselves, but I don't need all the overhead of anchors and such. In other words, I made something like a listview with a dynamic hierarchical design. This enables me to zoom in on a picture, draw on it and pass these drawn points upward to the source viewport. The control also knows what kind of line is drawn (The purpose of this program is a facial analysis tool, lines between eyes and such). Then I need to rotate and translate them, to match certain patterns. All of this dynamic stuff works perfectly, only thing is that when the number of ports increases, the responses to mouseclicks 'degrade'. This is why I wanted to use a click event. That forloop monstrosity is what I am using now . If only i could post a picture, that would explain a whole lot...
|
|
|
|
|
Steven Solberg wrote: the responses to mouseclicks 'degrade'
what does that mean?
response time increasing unacceptably? it shouldn't, I see no reason, you need a hit-search like the one I've shown, that should not take up much cycles!
image flickering? it shouldn't, no need to repaint anything.
so how does it degrade?
FWIW: you can store an image on any of a number of free sites, then post a link here.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Yes you're right... It shouldn't. I can't find any reason for it though. Problem is that I have to keep the mousebutton down for a few milliseconds instead of just clicking it.
I have put the image on one of my repositories. You can log in as 'guest', password is also 'guest'. Hope you don't mind I upload it this way.
The control uses a number of different viewmodes. The one you're seeing in the image is the treeview for subsections. These subsections are linked to their sources by drawing a rectangle on the original picture. It then saves this image and the offset to it's source. So I can calculate the points on the source when lines are drawn on a subsections. Perhaps an important detail: I use a number of threads and an FSM to power the changing of these viewmodes. When this happens, every viewport gets a thread to make it change location and size, so it appears to be moving. This is limited at 30fps though.
http://solberg.sin.khk.be/repos/PublicRep/[^]
|
|
|
|
|
so it is NOT a MouseClick issue, it is a "do many things while mouse is down" problem.
Not sure what the picture should tell me. All I see is a couple of images, some very similar or identical.
Some thoughts:
1.
While the mouse is down (I assume inside a MouseMove handler), maybe you are repeating a lot of calculations over and over, which only need to happen once, and could be moved to the actual MouseDown handler.
2.
Using multiple threads may cause delays; it all depends on how you organize things. If you have more threads than cores, and all of them are "ready" meaning they have some non-blocking job, they will be switched in and out based on the time slice which probably is 1 or 2 system ticks (that would be 10 to 30 milliseconds), a fairness principle.
3.
Watch your CPU load; if Task Manager never comes close to 100%, then more threads might help. If you are close to 100%, then many things are possible:
a. you are performing unnecessary operations (e.g. repainting an image that hasn't changed at all)
b. you have polling loops; that is the perfect way to waste CPU power
c. you have small jobs (less than 0.1 millisecond); thread switching becomes dominant cost
d. your implementation is OK, maybe the job is big, or your concept is flawed.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
The pictures in blue are the subsections I was talking about. These are extracts from the picture at the left of them. So by drawing a line on one of the blue pictures, a line is drawn in the same physical place on the yellow picture, just more precise. The other yellow pictures are just other independant pictures, which in turn can also have subsections. I already considered the MouseMove issue, but I programmed my control not to react when threads are still running. The threads I mentioned only move the viewports. Between mouseclicks. So that shouldn't be a problem. Calculations are only run when the mouse is released. I don't even use MouseMove and I watch the use of OnPaint very carefully My CPU isn't doing any overtime either. around 10% mostly, spikes of 50% (Both cores that is)
I really appreciate the effort you put in my problem though, so thanks
|
|
|
|
|