|
Thank you for this.
One of my java developer friend has already examined this. Some of the files are able to convert, but some are end up with error message saying that 'Byte array not a valid JPEG file'.
One of our senior developer suggested that it may be because of JPEG-2000 issue, because of that some of the tiff files are not able to convert to PDF.
However, I am able to view all the tiff files without any issues using FastStone Image viewer,converting to PDF at one short. But this will be a licensed one for commercial purposes.
I want to know if there are any free versions or is it possible to achieve this somehow in dotnet.
Thanks in advance
meeram395.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
|
Hi!
How to open image without show picture box style e.g : background AND border
Thanks
|
|
|
|
|
|
Hello Everybody,
I have some problem while to pass the value of of Object.
DObject D = new DObject();
Dobject D1 = new DObject();
Private void ChageValues()
{
D = ComeFromFile();
D1 = D;
D1.Name = "Piter";
}
if i am try to change the property of D1 then D is also changing.
So How can i Sepreate to both of them.
If you can think then I Can.
|
|
|
|
|
You can use ICloneable interface so that it will make only copy of the object.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
Try doing a deep copy or clone of D - Something like D1 = D.Clone() .
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
########## Please see the modified solution below ##########
Include this method in one of your class:
public static void CopyTo(object S, object T)
{
foreach (var pS in S.GetType().GetProperties())
{
foreach (var pT in T.GetType().GetProperties())
{
if (pT.Name != pS.Name) continue;
(pT.GetSetMethod()).Invoke(T, new object[] { pS.GetGetMethod().Invoke(S, null) });
}
};
}
I hope this is helpful
♫ 99 little bugs in the code,
99 bugs in the code
We fix a bug, compile it again
101 little bugs in the code ♫
|
|
|
|
|
Please don't..
As a last resort maybe, if you don't control the source of the type.
|
|
|
|
|
Ok.
♫ 99 little bugs in the code,
99 bugs in the code
We fix a bug, compile it again
101 little bugs in the code ♫
|
|
|
|
|
That's a code horror. You are calling GetProperties far too many times -- you probably only need to once.
|
|
|
|
|
Thanks sir, will keep it in mind in future
♫ 99 little bugs in the code,
99 bugs in the code
We fix a bug, compile it again
101 little bugs in the code ♫
|
|
|
|
|
To understand this behavior, you'll need to know the difference between a value type and a reference type.
Your 'DObject' is a reference type and hence assignment results in the variable pointing to the same object instead of a new object being created as in the case of a value type.
You'll need to implement IClonable interface and implement its Clone method, and then do something like this
D1 = D.Clone();
|
|
|
|
|
In your example you don't need to initialize the objects.
|
|
|
|
|
I propose another solution, seeing problems with my previous solutions, although working.
You can write your own
Clone() function inside your class. You need to mark your class as
[Serializable]
Function can be written as:
public object Clone()
{
object oClone;
using (MemoryStream myStream = new MemoryStream())
{
BinaryFormatter binFormatter = new BinaryFormatter();
binFormatter.Serialize(myStream, this);
myStream.Position = 0;
oClone = binFormatter.Deserialize(myStream);
}
return oClone;
}
You can call this function as
eg:
Person p2 = (Person)p1.Clone();
♫ 99 little bugs in the code,
99 bugs in the code
We fix a bug, compile it again
101 little bugs in the code ♫
|
|
|
|
|
Hi, I think this is your answer here.
Use of MemberWiseClone method of System.Object.
Please refer below example, you will come to know how to pass value of object and if you change one then other will not change like any other value type.
class Program
{
static void Main(string[] args)
{
D1 d = new D1();
d.Prop1 = "Sample...";
D1 d2 = d.ShalloCopy();
d2.Prop1 = "Some else";
}
}
class D1
{
public string Prop1 { get; set; }
public D1 ShalloCopy()
{
return (D1)this.MemberwiseClone();
}
}
In above example, when you make change into d2 then d will remain same it will not change.
|
|
|
|
|
I have a datagridview in a winform application, that gets data from an external dll and displays it dynamically.
As the new rows are getting added I want to show the newly added row to the user (so that the old rows keep moving upwards).
I am adding the new rows and showing the last added row as follows
string[] currentRow = new string[5];
currentRow[0] = curr.sequence().ToString();
currentRow[1] = typeString;
currentRow[2] = curr.stat().ToString();
currentRow[3] = detail;
currentRow[4] = curr.timestamp().ToString();
this.dataGridView1.Rows.Add(currentRow);
this.labelCount.Text = curr.sequence().ToString();
dataGridView1.CurrentCell = dataGridView1.Rows[curr.sequence()-1].Cells[0];
I am getting an exception of
[System.ArgumentOutOfRangeException] = {"Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index"}
at the line where I set the CurrentCell.
Although it occurly at random rows everytime. Sometime it occurs as early as 25th row. Other times at 1000th row.
What could be causing it? I see that the sequence is displayed correctly at labelbox.
Please help.
Thanks in advance.
|
|
|
|
|
What is curr ? and what value does curr.sequence() return?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
curr the object that I receive from the api/dll. curr.sequence() returns int value.
|
|
|
|
|
Good. Now tell us something that isn't so bloody obvious
What is the VALUE it returns? Is it 10, 25, -7? Does it return something that is random or sequential? Do you know what it does? Is it perhaps returning values that are out of order?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I apologize for my vague reply.
The sequence is like a counter that the dll increments as it creates new objects (here it is curr. The dll takes care of the object destruction). It ranges from 0-1500. This part of the code that I submitted is inside the an event that gets fired from the dll once the curr is available.
The sequence returns the correct value, as I display it the labelCount.
But anyways, I am storing the curr in a local list as I get. If I use list.Count() instead of curr.sequence(), then everything works fine. The problem is solved, but I don't understand why the datagridview has problem with the curr.sequence().
|
|
|
|
|
So what VALUE did it return at the point of the exception? Telling us what values it may have during the running of the program is no use at all.
manumith wrote: The sequence returns the correct value, as I display it the labelCount.
So what value gets displayed in this instance?
You have all the information, please share it.
The best things in life are not things.
|
|
|
|
|
There could be any number of reasons why there's a problem here, but they all come back to the same thing. curr.sequence is in the wrong order - this could be because of threading being used to retrieve values, but it's more likely to do with the item that's sorted on isn't curr.sequence . In other words, the order doesn't match the sort order.
|
|
|
|
|
I don't know, however:
1.
I would not call curr.sequence() over and over, if it were to change its mind in between calls, you'd be in trouble; so just call it once, store the value in a local variable, and use it.
2.
as the new row is at the bottom, how about
int nRows=dataGridView1.Rows.Count;
if (nRows>0) dataGridView1.CurrentCell = dataGridView1.Rows[nRows-1].Cells[0];
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
How come there's no such properties as "List|Dictionary.Capacity" - and, does anybody knows if inserting to last slot what's dotnet Collection behavior? Allocate 2xCapacity? In absence of MyDict.Capacity, how can I manipulate this?
Also, when you insert an element if Reference type into collection class, Collection class only stores a "Pointer" or "Reference", not a "Copy"
<br />
IDictionary SomeDict = new Dictionary<SomeClass, string>(MAXITEMS);<br />
SomeClass o = new SomeClass();<br />
o.a = -1;<br />
o.b = -1;<br />
o.c = -1;<br />
o.d = -1;<br />
SomeDict.Add(o, Guid.NewGuid().ToString());<br />
Observer this on debugger:
<br />
*o<br />
*SomeDict.ElementAt(0).Key<br />
They'd give you same reference.
So, I'm not quite sure why I'd pick a LinkedList over a Dictionary - my guess is, Dictionary's Hash table in the back is still one contiguous block of memory, where as LinkedList is not (but also because it's slots of memory all over the place, access is slower?) But there's no MSDN doc or article which describes this (For example, LinkedList references to payload/elements are stored in usual "array" of reference? If so it too has allocation problem if you keep adding). So really is allocation the only concern?
Thanks
Good reference but a bit unclear in some respect...[^]
Another discussion[^]
dev
modified on Monday, April 25, 2011 7:16 AM
|
|
|
|