|
Hi all,
I have created a form with a datagridview.
I created a new Class called duplicate Picture that has 4 fields.
2 type String both hold filepaths.
2 type Bitmap that "should" hold the picture at the path set above.
My constructor sets the Bitmap to be the paths as specified.
I look through a file structure and find duplicate images, add them to a List of the class described above, then using CurrencyManager show a list of the path on the DataGridview as well as the image.
I kept getting the little White Square with a red cross in it for the Bitmaps.
So I changed the Properties for the Bitmaps to return a Image class instead, and converted the Bitmap to a Thumbnail, but that just caused more problems.
Am I missing something fundamental here?
Original Class I created -
<br />
sing System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
using System.Drawing;<br />
<br />
namespace DuplicateFile<br />
{<br />
class DuplicateFile<br />
{<br />
private string _shortName;<br />
private string _originalFilePath;<br />
private String _duplicateFilePath;<br />
private Bitmap _originalPicture;<br />
private Bitmap _duplicatePicture;<br />
<br />
public DuplicateFile(string newShortName, string newOriginalFilePath, string newDuplicateFilePath)<br />
{<br />
shortName = newShortName;<br />
originalFilePath = newOriginalFilePath;<br />
duplicateFilePath = newDuplicateFilePath;<br />
}<br />
<br />
<br />
<br />
public string shortName<br />
{<br />
get<br />
{<br />
return this._shortName;<br />
}<br />
set<br />
{<br />
this._shortName = value;<br />
<br />
}<br />
}<br />
<br />
public string originalFilePath<br />
{<br />
get<br />
{<br />
return this._originalFilePath;<br />
<br />
}<br />
set<br />
{<br />
this._originalFilePath = value;<br />
Bitmap originalPicture = new Bitmap(originalFilePath);<br />
}<br />
}<br />
<br />
public string duplicateFilePath<br />
{<br />
get<br />
{<br />
return this._duplicateFilePath;<br />
}<br />
set<br />
{<br />
this._duplicateFilePath = value;<br />
Bitmap duplicatePicture = new Bitmap(duplicateFilePath);<br />
}<br />
}<br />
<br />
public Bitmap duplicatePicture<br />
{<br />
get<br />
{<br />
return _duplicatePicture;<br />
}<br />
<br />
}<br />
<br />
public Bitmap originalPicture<br />
{<br />
get<br />
{<br />
return _originalPicture;<br />
}<br />
<br />
}<br />
}<br />
}<br />
<br />
|
|
|
|
|
Hello,
my app connect to a sql server 2000 db and a I store my data in a decimal data type like this(12.32) ,but when I retrive it in my app it appears (12.32000000)I'd like to solve the problem of the zero with out effecting
the value.
Dad
|
|
|
|
|
The value is not directly linked to how it appears. The appearence is only the string representation of the value. You can specify how you want the value displayed when you convert it to a string.
---
single minded; short sighted; long gone;
|
|
|
|
|
How can I draw a finest dot or color a particular pixel on the screen.............. Actually I want to do makeup on a picture and for doing soo I want to draw finest dots...... Can anybuddy help??????????
|
|
|
|
|
Bitmaps have a method called SetPixel but it is incredibly slow. Any real image manipulation will require unsafe code to be fast and even then it is slow.
File Not Found
|
|
|
|
|
I have used that set pixel but its sooo slow..... Can u give any example of the unlock bitmap so that I can draw on the particular pixel.... I must do the mapping frm the form to the bitmap that is again a problem...........
|
|
|
|
|
Look at my article on unsafe Grayscale conversion. If you modify my code you should be able to write a simple pixel offset arithmetic to edit only one pixel very quickly.
File Not Found
|
|
|
|
|
My image processing project nearing completion is built using VS2003, and intentionally uses a huge amount of memory (100's of data arrays loaded) which does not get fully released until I restart my app process: I can live that for now. I've read the various articles here on memory management, and the main issue appears to be the way the Large Object Pool is (mis)managed by NET 1.1. NET 2.0 apparantly fixes some of this, and XP64 or Vista fixes the rest(?).
So, several questions I can't locate simple answers to.
Can I update VS2003 to build with build with NET 2.0, or do I have to upgrade to VS2005 or later to get NET 2.0? What about NET 3.0? I'd REALLY not like to have to do this at this point.
As I run the app, I can watch the memory usage increase, but what I find odd is the Page File usage also increases. This is on a Core 2 Extreme (quad core) with 4GB of ram. Is this just an effect of the NET 1.1 memory management or what?
I also note that XPsp2 renders the top 750MB of my 4GB ram unusable to (according to MS) allow for "memory mapped I/O devices that MIGHT be installed". Well, I don't have any cards that need this, so is there any way that some of this 750MB of ram can be identified to XP as actually usable?
Thanks for any suggestions...
Stewart DIBBS
|
|
|
|
|
The 750 megs of unused space is for Memory Mapped IO and makes up a nice week in your Architecture class from the Computer Science degree. It is inherent in all memory mapped systems. (The limit may be different based on the processor and/or bus)
If your code will compile in 2005 (and it should) you can download the express edition or just the sdk and build it using the csc command line utility.
Page File usage is related to virtual memory usage. Memory mismanagement as well as significant use can cause the pf usage to go up.
File Not Found
|
|
|
|
|
I understand the use of Memory Mapped IO, and, yes, it was a nice week in my Architecture class back in '86 ... (what was that girl's name again <grin>)
My issue with is that (according to MS) this 750MB was allocated as of XPsp2, and of course is not an issue in XP64 or Vista, as Memory Mapped IO is now (once again) at the top end of a 64 bit address space.
So my question remains: is there any way that this 750MB of Memory Mapped IO space can be reduced if its not required?
Stewart DIBBS
|
|
|
|
|
You can use the full four gigs in XP on a 32 bit machine if you use /PAE and have an application that takes advantage of the memory extensions api. There is a lot of information on it online.
As for reducing it no. (I could be wrong) The PAE option put the 750megs on top of the 4g. So you have a 0 to 3.5 gig block and then a 4.0 gig to 4.5 gig block.
File Not Found
|
|
|
|
|
/PAE is enabled by default with the /noexecute=optin boot.inij parameter.
From what I read of the AWE API, I would have to write some low level code so my C# app can understand it. Anyone know if NET 1.1 or 2.0 Framework has issues with or can actually use AWE commands?
Stewart DIBBS
|
|
|
|
|
You c# application gets 4 gigs of addresses space only and can in fact address 4 gigs of memory even if the memory does not exist and unless you reduce the kernal size allocated to Windows only a max of 2 gigs will be real memory devoted to your app.
The AWE is api code as you have already read.
File Not Found
|
|
|
|
|
hi ,
the last visit time wich is shown below the discusion forums........
did you see ?
Any body please tell me time zone of this...
is it time zone for client or server?
and where i will found how to feed back ...
|
|
|
|
|
This would be better asked in a different forum, perhaps the General Discussions or Lounge.
|
|
|
|
|
oh!
really i dont know that. however thanks.
so i put
subject as wwww.codeproject.com
once again thank u lot.
|
|
|
|
|
needhelpinnet wrote: wwww.codeproject.com
Can not find server or DNS error
|
|
|
|
|
Anyone confirm this is thread safe please?
internal static List<string> GetList(string xmlString)
{
List<string> list = new List<string>();
BuildList(xmlString, list);
return list;
}
private static void BuildList(string xmlString, List<string> list)
{
string someXml = ModifyXml(xmlString);
list.Add(GetString(someXml));
if (GetBool(someXml))
BuildList(someXml, list);
}
Thanks much..
|
|
|
|
|
Looks thread safe to me. All of the methods you're calling are static; no instance objects are involved. Looks reentrant. I think you're safe.
EDIT-> When I say "instance objects," I'm refering to objects that persist at the instance level of a class. That is to say that none of the objects that I see used in the static methods persist at that level. So it looks safe.
-- modified at 14:22 Tuesday 6th March, 2007
|
|
|
|
|
|
I thought were clear - You meant no instance variable of the class as opposed to an instance declared local to the method.
Thanks.
|
|
|
|
|
Abisodun wrote: I thought were clear - You meant no instance variable of the class as opposed to an instance declared local to the method.
Exactly.
|
|
|
|
|
Your statement's been bugging me now I realize why. This code will cause a compilation error:
class MyClass
{
internal string stringVariable = string.Empty;
internal static void MyFunction()
{
stringVariable += "a";
}
}
Did you mean static variable of the class?
Instance variable always refers to a non static variable.
i.e.
class MyClass
{
internal string stringVariable = string.Empty;
internal static void MyFunction()
{
MyClass myClass = new MyClass();
myClass.stringVariable += "a";
}
}
which should not be a problem in a static method of the same class.
|
|
|
|
|
Abisodun wrote: Did you mean static variable of the class?
Instance variable always refers to a non static variable.
Yeah, I should have just said that since the methods are static, it's thread safe. I confused the issue by mentioning instance objects. The instance variables of a class can't be accessed from a static method, so there was no need to bring them into the discussion.
The main thing to watch out for with static methods and thread safety are objects that are passed into the method. Something like this:
public static void DoSomething(SomeObject obj)
{
obj.Change();
}
This isn't tread safe. The reason being that two threads could call this method at the same time (relatively speaking), and the "Change" method may be performing some thread unsafe operation. The example you gave in your original post didn't do this, so it's thread safe. But also, if an object is a class level variable, you still want to be careful:
public class MyClass
{
private static SomeObject obj = new SomeObject();
public static void DoSomething()
{
obj.Change();
}
}
This isn't thread safe for the same reason the first example isn't thread safe.
In your original post, all of the objects that were used were created within the static method. This means that if two threads called the method at the same time, the objects each thread uses is unique to the thread. So your original example is thread safe.
Does this help? Hopefully, I haven't made it more confusing.
|
|
|
|
|
No it's been very helpful. I was really only concerned about "List<string> list" being passed between static methods and recursively. But each new call stack starting with GetList in the first example should have it's own instance of "List<string> list".
I appreciate your help.
|
|
|
|