|
However, the damages is done. You started here and should continue here, reposting is frowned upon. You can't delete a post once you have received replies.
No comment
|
|
|
|
|
Indeed. But I came up with a solution that night. Sometimes you don't see the wood for the trees. Here is the solution - pimped a bit by using a predicate to make this extension work for splitting custom class enumerations on a defined member.
public static IEnumerable<IEnumerable<T>> Split<T>(this IEnumerable<T> source, Func<T,double> predicate)
{
if (source == null)
{
throw new ArgumentNullException("source");
}
var remainingSequence = source;
while (remainingSequence.Count() > 0)
{
var currentElement = predicate.Invoke(remainingSequence.FirstOrDefault());
yield return remainingSequence.TakeWhile(t => predicate.Invoke(t).Equals(currentElement));
remainingSequence = remainingSequence.SkipWhile(t => predicate.Invoke(t).Equals(currentElement));
}
}
Called by
valueList.Split(x => x.Name)
it returns the correct results.
So thanks anyway!
|
|
|
|
|
We have a need to provide some functionality in the form of a LDAP Listener within our services product. I do not know much about this area, so I am looking for ideas
Our objectives are to:
1) Listen for LDAP Queries from a third party
2) Determine what the query is
We do not have direct access to Active Directory, but instead must make calls to a web service that does the LDAP query to AD on our behalf, hence the need to determine what the query is
3) Carry out the query (to the web service) and provide an LDAP Response to the third party
We would like to do this in code (VB.Net/C#)
|
|
|
|
|
I am trying to distribute a small application I wrote with C# and SQLCE.
I created a little virtual machine with Windows XP on it and I started to snapshot the install.
Upfront it asked for XP SP2, therefore I upgraded my VM to XP SP2.
From there it required more than 20 clicks to complete the installation and even then the application won't start!
Web page with a set of Snapshots[^]
The actual Application Publish Page[^]
I am aiming at non-technical users.
I am losing faith in the ClickOnce ability to make the install easy and fail-safe.
What would you use to distribute .Net + SQLCE ?
|
|
|
|
|
Pascal Ganaye wrote: I am losing faith in the ClickOnce ability to make the install easy and fail-safe.
I wouldn't lay the blame on ClickOnce. You are attempting to install an application on a very outdated platform, Windows XP SP1 was released nine years ago. How many updates and patches have been issued by Microsoft in the last nine years?
No comment
|
|
|
|
|
What is the best way to handle OutOfMemoryException and do you have any chance of recovery within your program or are you just doomed?
EDIT:
I have found the root of the problem, my application was running in 32bit mode and it max'ed out at 1.8gb ram usage.
I switched to 64bit on .net 4 and the OS seems to take care of everything, I'm currently using 7.8gb on a 8gb server.
Its the man, not the machine - Chuck Yeager
If at first you don't succeed... get a better publicist
If the final destination is death, then we should enjoy every second of the journey.
modified 25-Oct-11 6:48am.
|
|
|
|
|
|
Some remarks:
1.
IIRC your app can survive an OutOfMemoryException (as opposed to e.g. a StackOverflowException ), assuming it either doesn't really need the new (big) object and/or it can free some memory explicitly (e.g. by flushing a cache).
2.
I trust you know about WeakReference , which is a good way to organize a cache.
3.
FWIW: Some GDI methods throw OutOfMemoryException rather than signaling the actual problem; Image.FromFile() is the typical example, it flags The file does not have a valid image format as well as GDI+ does not support the pixel format of the file in that silly way.
4.
And then there is the MemoryFailPoint class (someone got that as part of some reply recently, it might have been you); this class might harm performance a bit though (just my guess).
|
|
|
|
|
Chances are you're never going to recover from an OutOfMemory expection. Think about it, if you really were out of memory, how would there be enough memory to create an instance of the OutOfMemory exception object??
There are a bunch of different ways of generating an OutOfMemory exception that have nothing to do with running out of memory, go figure... Just about all of which you can't recover from because you're already written your code improperly generating such a condition. Besides, how are you going to know what you did wrong to generate the exception??
|
|
|
|
|
Dave Kreskowiak wrote: Think about it, if you really were out of memory, how would there be enough memory to create an instance of the OutOfMemory exception object??
I'd expect a decent OS to reserve some memory and to give that specific warning before all memory is consumed, otherwise there would never be such a message (due to string-allocation).
Dave Kreskowiak wrote: Besides, how are you going to know what you did wrong to generate the exception??
We don't, but we handle the exception like any other; there's multiple ways a write can fail, yet it's hard to have the application "know" what it did wrong. Usually I display a message and let the user handle it. Most of the users recognize a "write failed", and check the file-attributes. Or the write-protection on the medium. Or their access-rights. Or whether the file is open.
That'd be my course of action in this particular case; the user might terminate some other app, like World of Warcraft, to free up valuable system-resources. I'd guess we both would display a message and write a note in the eventlog, as that's almost a default for the unhandled exceptions-handler
Bastard Programmer from Hell
|
|
|
|
|
Eddy Vluggen wrote: I'd expect a decent OS to reserve some memory and to give that specific warning
before all memory is consumed, otherwise there would never be such a
message (due to string-allocation).
True, a bad example on my part.
Eddy Vluggen wrote: We don't, but we handle the exception like any other; there's multiple ways a
write can fail, yet it's hard to have the application "know" what it did wrong.
He wants his code to recover from the failure. Chances are good an OutOfMemory wasn't caused by being out of memory.
Now, exactly what the circumstances are that cause him to look for this exception aren't known. It could be a genuine running low on memory case, but if his code is generating this exception and he doesn't know why, he's got much bigger issues that blindly trying to free up resources in his own code.
|
|
|
|
|
Dave Kreskowiak wrote: It could be a genuine running low on memory case, but if his code is generating this exception and he doesn't know why, he's got much bigger issues that blindly trying to free up resources in his own code.
That applies to more exceptions than only OutOfMemory, and my point was that we still handle it as if the machine is out of memory. A file-write exception might be caused by the hardware, I can't recover from that automagic either. You simply display the excuse that the OS comes up with and display that.
No, he doesn't need to free up resources, the user can do that by closing something else.
We're often thinking in terms of "handle the exception or rethrow it", where it would be more appropriate to let the user handle it.
Bastard Programmer from Hell
|
|
|
|
|
Eddy Vluggen wrote: That'd be my course of action in this particular case; the user might terminate
some other app, like World of Warcraft, to free up valuable system-resources.
That is phrased very badly or is just wrong.
Excluding a poorly configured (and non-default configured) windows OS a Net application will NOT run out of memory because of some other normal application.
That is also true for a unmanaged applications and also true for normal applications on any modern desktop OS.
Eddy Vluggen wrote: I'd guess we both would display a message and write a note in the eventlog, as
that's almost a default for the unhandled exceptions-handler
However many exceptions handled like that allow the user/app to continue.
An Out of Memory exception probably isn't something that should allow the app to continue. It certainly shouldn't be allowed to continue unless one considers carefully many possible error scenarios.
|
|
|
|
|
jschell wrote: Excluding a poorly configured (and non-default configured) windows OS a Net application will NOT run out of memory because of some other normal application.
I wouldn't expect it on a modern machine, but it can happen when your system is low on harddisk-space, since there's no place to grow the swapfile. Usually the system begins to crash when you're in that place
jschell wrote: However many exceptions handled like that allow the user/app to continue.
<layer>An Out of Memory exception probably isn't something that should allow the app to continue. It certainly shouldn't be allowed to continue unless one considers carefully many possible error scenarios.
True, anything "unknown" should cause the app to terminate; it's always better to rudely exit, than to continue with what could be corrupted data.
Bastard Programmer from Hell
|
|
|
|
|
Eddy Vluggen wrote: I wouldn't expect it on a modern machine, <layer>but it can happen when your system is low on harddisk-space, since there's no place to grow the swapfile. Usually the system begins to crash when you're in that place
None of which is normal and thus is not appropriate in the way the original statement was introduced.
|
|
|
|
|
jschell wrote: An Out of Memory exception probably isn't something that should allow the app to continue
I don't agree. Most Exceptions exist to tell you something is going wrong, however also to give you a chance to act upon the situation. There are a few others, more severe, say StackOverflow and maybe ShuttingDownByLackOfBatteryPower or some such.
If my app gets a FileNotFound, it either finds a way around that (maybe it has a list of alternative paths, of knows how to download the file again), or it asks the user for instructions, however it does not just terminate.
And if my app holds several algorithms to do something, and the preferred one fails with an OutOfMemory, it can still continue with the probably slower but less memory-hungry alternatives.
What I'm saying is an exception is only bad if you can't cope with it; if allocating a 10-character string fails, you're stuck obviously; when a request for a 100KB or larger object fails, your app may live on, chances are the user won't even know about it.
|
|
|
|
|
Luc Pattyn wrote: Most Exceptions exist to tell you something is going wrong, however also to give you a chance to act upon the situation.
Which I didn't claim otherwise.
However an Out of Memory exception does not fall into that category.
Luc Pattyn wrote: And if my app holds several algorithms to do something, and the preferred one fails with an OutOfMemory, it can still continue with the probably slower but less memory-hungry alternatives.
Nope. You are assuming that your 'algorithm' caused the exception.
You have threads 1,2,3 running three algorithms.
You also have thread X.
Thread X does something that causes an out of memory exception which shows up in thread 1.
Exactly what are you going to do in thread 1 in that case?
Luc Pattyn wrote: What I'm saying is an exception is only bad if you can't cope with it;
And what I am say pertains to an Out of Memory exception ONLY.
So your general comment means nothing.
Although your comment does not apply to all other exceptions either. For example a stack overflow exception.
modified 27-Oct-11 14:08pm.
|
|
|
|
|
Mehdi Gholam wrote: What is the best way to handle
It is possible that in the entire world there might be a single app where that is a good idea.
But it is unlikely to be yours.
And even more unlikely if you don't know exactly why the exception is occurring. And if the cause isn't an attempt to allocate a large array of primitives then unlikely also.
Best reason I have seen for accepting this is that there is no guarantee where an out of memory exception might occur. So, for example, even though you are allocating a 'bunch' of stuff in your thread the out of memory might occur in another one of your threads. Or even in a .Net internal thread.
|
|
|
|
|
Respected Sir/Friends,
i have 5 years working Experience with VB 6.0, but i am new in VB.Net, i developed my first Application in Hospital Management System but i have facing a problem with setup deployment, when i install my project on client computer, during the installation of DotNet Framework 3.5 sp, and display an error and setup close. I also used 3rd party software (Advanced Installer, Install Aware, etc)for its deployment but situation is same. so please help me and identify my mistake or step that i missed. and help me step by step deployment.
waiting for your kind response,
Regards
Yours Student
Love to Every One
|
|
|
|
|
Unless you explain what error you see, including the exact text of any messages, it is unlikely that anyone can guess what is going wrong.
|
|
|
|
|
I need to test my program on older machines.
How far do you think Mister Lambda is.
What is today's market share of Windows various flavour at home?
Do people still use Windows Me?
Do they have Windows XP with no service pack?
.NET framework 4 client requires Windows XP SP2, am I going to alienate my prospective client if I requires that too?
|
|
|
|
|
Pascal Ganaye wrote: What is today's market share of Windows various flavour at home?
There's a decent guess on the wikipedia[^].
Pascal Ganaye wrote: Do people still use Windows Me?
I know someone who does, yes.
Pascal Ganaye wrote: Do they have Windows XP with no service pack?
That happens.
Pascal Ganaye wrote: .NET framework 4 client requires Windows XP SP2, am I going to alienate my
prospective client if I requires that too?
The guy who's still on ME doesn't expect new software to run on his machine, and I doubt that he'd be interested.
Stick with the versions of Windows that you can get support for from Microsoft. Everything they don't support anymore (like Win95) needn't be on your supported-list.
Bastard Programmer from Hell
|
|
|
|
|
Pascal Ganaye wrote: .NET framework 4 client requires Windows XP SP2, am I going to alienate my prospective client if I requires that too?
Possibly, but you could find out what version of .NET your customer's system can handle and target your app to that version.
|
|
|
|
|
I was/am a PC modder for Oblivion and one thing that I was always amazed with was their modding tools. I never understood how it was possible to make a program that could be so easily managed by anyone who came along and decided to do so. I was intrigued by this notion and was thinking to apply it to software that I create.
All the programming I've been used to so far has had me creating code in my program for specific actions or instances, and creating premade interfaces... but I would like to learn how to create programs that can be easily modded by the end user (at least in the realm of visual appearance), while still being usable by me.
No matter how I look at it, it feels like this sort of programming direction needs to be decided at the beginning(not changed midway). Are there any articles that describe this sort of programming method or how to plan it before hand? Or can anyone give me any guidance towards this path? Anything would be helpful! Thanks!
- P.S. I'm not talking about this sort of programming method just for games, but just as a general approach to the subject. How to make a program that can be molded by the end user without losing any core functionality.
|
|
|
|
|
shingouki2002 wrote: at least in the realm of visual appearance
This concept is know as 'theming'.
A language like WPF will provide inbuilt support for themes.
ASP.Net provides themes as described here[^].
|
|
|
|