|
That's a real gem. I guess I received some OutOfMemoryExceptions in other contexts where such an exception was simply not possible. Maybe the programmer wants to tell as something different, like "the appropriate name for that exception is no more in my memory". Let's call it an AlzheimerException then.
|
|
|
|
|
There is a general problem with GDI+ and exceptions; most often you get a "General GDI+ exception" and are at a loss (try debugging a failing Image.Save operation).
In this particular situation, he got what is masqueraded as an OOM but actually is something quite different.
|
|
|
|
|
Seems reasonable, the image files probably originated on a mac anyway so they could be anything. Turns out there are a huge number of records with no image file so the first one will be to delete records with missing files and delete files not in the database then test each one for corruption, then turn the rest into thumbs. I hate graphics.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I don't know about deleting records, you might as well amend your code to skip null filenames. Afterward, a simple try-catch could be all it takes to identify a sporadic bad image file; unless you are filling the database with "images" that aren't "Images" as supported by .NET
Mycroft Holmes wrote: the image files probably originated on a mac
If and when multiple files cause problems, you'll have to find a way around that. Any idea what the original format, or file extension used to be (assuming they had one, Mac has different concepts).
If .NET can't read any of your images, your database will not be worth much, will it?
FYI: I hope you did carefully read the remarks[^], image file may indeed contain thumbnail information of insufficient quality for your purpose.
Mycroft Holmes wrote: I hate graphics
I don't, it is an interesting, evolving and challenging domain. There are several standards, and some special cases. As always.
|
|
|
|
|
Luc Pattyn wrote: FYI: I hope you did carefully read the remarks[^], image file may indeed contain thumbnail information of insufficient quality for your purpose.
Nope wandered right past the most useful information there. . I'm pretty sure the images originated on a mac, although most of them have displayed correctly. I'm quite happy to delete the missing/corrupted records and force the user to reload.
Thanks for that snippet btw, I have been struggling with thumbs and was not aware of the embedded thumb.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello,
I'm having troubles with Control.PointToScreen Method. I need to move mouse over controls center and then click on it. I am doing something like this:
<br />
Point aP = theControl.PointToScreen(new Point(theControl.Width / 2, theControl.Height / 2));<br />
MouseClick(aP);
I have two monitors. When I select as primary monitor first one, it works fine. Mouse is moved correctly over center of control and clicked. When I select as primary monitor second one, mouse is not moved to the center of control, but elsewhere in the form. I need to have the same behavior on the both screens. Does anybody know what is the problem here?
Thanks in advance,
noIdea77
|
|
|
|
|
Just a thought, but are the resolutions the same on both monitors?
V.
|
|
|
|
|
No, resolutions are not the same. I tried to switch the resolution of bigger monitor to the same as the smaller one and it works fine. I do not understand it. Is it system bug, or should I set some property before calling PointToScreen?
|
|
|
|
|
I'm not 100% sure, but what I think happened is that your pointtoscreen calculates the position based on the resolution. If both your monitors have the same size physically and one is 800x600 and the other 1024x768 the distance of 10 pixels eg, is different. As your Point2Screen bases its calculation on the other screen, it will calculate a different distance as it should.
Hope I make some sort of sense .
V.
|
|
|
|
|
While coding for a MS Exchange email client I came up with a peculiar problem. I am using Exchange Web Service Managed API to access the exchange mail server and getting the mail messages. The problems occur when I try to store the message object into the disk. While serializing the object it is throwing a SerializationException saying that - "Type 'Microsoft.Exchange.WebServices.Data.EmailMessage' in Assembly 'Microsoft.Exchange.WebServices, Version=14.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is not marked as serializable.".
One thing is not clear to me, if the object is not serializable then how come it is being transferred through the web service?
Secondly, do any one have any idea on how to store this non serializable object into disk.
I am in a dire need.
Thanks and regards,
Anindya Chatterjee
--------------------------------------------------------
|
|
|
|
|
Anindya Chatterjee wrote: One thing is not clear to me, if the object is not serializable then how come it is being transferred through the web service?
Probably, the EmailMessage isn't the thing being passed across the wire.
Anindya Chatterjee wrote: Secondly, do any one have any idea on how to store this non serializable object into disk.
Two options (but I don't know the details of EMailMessage , so take with a pinch of salt:
a) Make a serializeable object and write a converter to convert bewteen this andEmailMessage
b) Hand-serialize the object from its properties etc.
That said, the object you have probably contains alot of information needed at runtime and have security implications (which are probably two of the reasons why the object is not marked as serializable). Given there are lots of readonly properties, you won't be able to deserialize EMailMessage , but if you are just interested in storing and retrieving the contents you should be fine.
Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
|
|
|
|
|
Does that EmailMessage not have a ToString() and a FromString() method? Since emails are transported as plain ASCII, that should do the thing.
Otherwise, create a serializable object containing all the relevant properties, i.e. message body, to, cc, subject, etc. and serialize that.
|
|
|
|
|
Hi Friends,
I am using a repeater control which have footer. i have placed a asp:label control in the footer.
When i run the page label is showing its value like "1234.00"
but i want to display like "1,234.00".
How to do that.
Thanks in advance.
Regards,
Gourav Tyagi.
|
|
|
|
|
string valueString = string.Format("{0:0,0.00}", myValue);
.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
|
|
|
|
|
Something like this?
using System.Globalization
CultureInfo ci = new CultureInfo("es-ES");
NumberFormatInfo myFormat = ci.NumberFormat;
myFormat.NumberGroupSeparator = ",";
myFormat.NumberDecimalDigits = 2;
string MyFormattedString = MyDoubleValue.ToString("N", myFormat); The endusers' culture should determine how the number is formatted. That's usually configured in the Windows regional settings.
I are Troll
|
|
|
|
|
Hello,
I am creating a directory programatically (C#) to store some application specific data. I want that this directory should't be deleted or modified while the application is running but once the application is closed, it can be modified or deleted. Also, all user on the machine should have similar rights for that folder.
How do I achieve this? Any help in this direction will be greatly appreciated.
Thanks.
|
|
|
|
|
I think this can be achieved with the FileSystemAccessRule class (the creation of the rule(s) that is). Then you create a DirectorySecurity ojbect and use the AddAccessRule method to apply your access rule(s). Finally, create a DirectoryInfo object representing the folder and run the SetAccessControl method which takes your DirectorySecurity object as an argument.
That's pretty much how I've done it in the past. Good luck!
|
|
|
|
|
Thanks for reply.
I am using security like this:
AccessRule rule = new FileSystemAccessRule("Users",
FileSystemRights.Write |
FileSystemRights.ReadAndExecute ,
InheritanceFlags.ContainerInherit |
InheritanceFlags.ObjectInherit,
PropagationFlags.InheritOnly,
AccessControlType.Deny);
Still I am able to delete the folder manually.
Thanks.
|
|
|
|
|
You could open a file (located in the folder) with exclusive read/write, and any attempt to delete the folder will fail as long as that file is opened.
.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
|
|
|
|
|
Yeah.. That's good idea.
The only concern is that folder can't be deleted but other containts of the folder can be deleted one by one.
Anyway, this solution might resolve my problem.
Thanks.
|
|
|
|
|
The only thing you can do is be religious about using try/catch blocks and be ready with exception handling for when the user inevitably tries something stupid.
I don't know the nature of your code, so you're going to have to evaluate what's necessary on a case-by-case basis.
.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
|
|
|
|
|
That's odd.. Do you mean that after you apply a rule that deny Users to do something, a member of the very same group is still able to perform whatever it was you wanted to prevent?
|
|
|
|
|
Thanks for reply.
Yes it is allowing to delete with the rule I applied and posted here as well. I might be missing something in the rules but it is allowing.
It might be because I have admin rights on my PC.
Thanks.
|
|
|
|
|
I didn't check your use of flags that thoroughly, but it looked ok. But since you only add the deny rules for the Users group I would assume an Administrator is still able to delete the folder in question.
|
|
|
|
|
Hi guys i got a question for you:
I have created a windows mobile 6 app for a project at school. I have a docked picturebox and the sizemode is set to stretch.
I want to know how i can zoom into my picturebox on a specific area of the image. Like the double tap zoom in some windows mobile 6 applications. I tryed to use the sizemode.zoom but it isn't in there
Any help would be superb
|
|
|
|