|
object1.ReferenceEquals(object2)
Edit, shows how much I use it. should be
Object.ReferenceEquals(object1, object2);
|
|
|
|
|
|
T M Gray wrote: Once you have a grasp on the basics
In my opinion, neither ASP.net nor WinForms is "the basics" -- new developers should learn "the basics" of the language before attempting ASP.net and WinForms.
|
|
|
|
|
That is a very purist point of view. For many people if they don't apply what they learn to real situations they won't absorb it as well. And to me, you don't really know the basics if you can't produce something useful. If I say I have a basic knowledge of chess I would be implying I could actually play a game start to finish. Using your definition of the basics it would only imply I could identiy the pieces.
|
|
|
|
|
T M Gray wrote: That is a very purist point of view
Of course.
The programs that were assigned when I first learned to program are not applicable to real situations -- they teach the fundamentals.
It's the same way they teach sports -- learn each part separately, then show how to put the pieces together to play a game.
T M Gray wrote: produce something useful
Even when I was just learning I took it upon myself to write programs I found useful using the techniques that had been covered to that point.
T M Gray wrote: I could identiy the pieces
I seem to recall reading about a chess teacher who teaches kids one piece at a time -- some exercises that teach just how knights move, just how rooks move, etc. and how they can be used together. And only after the students have become familiar with each of the pieces, starts to mix the pieces together.
A better, more structured, teaching technique is more likely to produce better practitioners.
It seems there are a lot of "developers" here who learned the easy way and never learned the intricacies of for loops -- their educations are stunted by not getting the fundamentals the way we old dogs did.
|
|
|
|
|
I watched several SQL related LearnVisualStudio videos a couple of years back and found them to be somewhat useful.
If you're looking for an introductory general purpose programming course, I highly recommend this[^] one @ MIT OpenCourseware. I'm also a huge fan of Stanford Engineering Everywhere[^] and am currently wading thru their course on Machine Learning[^]. Btw, SEE also has a great "Programming 101" course that features the venerable Karel (the Robot).
/ravi
|
|
|
|
|
Hi Ravi
Just had a look at the SEE courses at Standford and they look like something that is useful for me. These courses in combination with some good textbooks is probably what I would go for. Thank you very much for the valuable links.
/Eiel.
|
|
|
|
|
I'm going through the MIT material (I just watched video 7) -- it is very good. Thanks for pointing it out.
|
|
|
|
|
Glad you like it - I think it's a great set of videos regardless of one's experience!
/ravi
|
|
|
|
|
In AssemblyInfo.cs
1. What is the difference between AssemblyVersion and AssemblyFileVersion ? Why would you specify different values for the two different attributes?
2. More importantly, I see the following comment in my AssemblyInfo.cs file:
This sounds like a neat idea so I thought I'd try it. But, when I access the version info in my app at runtime, using Application.ProductVersion , it still only returns the string "1.0.*". What am I doing wrong here?
|
|
|
|
|
|
If it's your application, they mean what you want them to mean.
|
|
|
|
|
|
hi!
i have an ini files. in this file, the value is in following format:
abc= mno
xyz=ijk
efg=pqr
and so on.....
my need is that i have to store the value before= (abc,xyz) in an array and after=(mno,ijk) in another array.
and after storing the value in an array, replace abc with mno and so on in C#
|
|
|
|
|
And what part of this is giving you a problem?
And why are you using .INI files anyway - they pretty much went out with Win98!
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
hello!
my requirement is to store multiple value as shown above,
more or less 300
|
|
|
|
|
i have solved to read and replacing method.
but can u tell me what the procedures to store the value as i ask in my question.
|
|
|
|
|
assuming the order is not important and all keys are unique, I would store all this "key=value" information into a Dictionary<key, value> . If order is relevant or duplicate keys could exist, a List<KeyValuePair<key, value>> could do. And use string type for key, and probably for value too.
|
|
|
|
|
ahmad25 wrote: replace abc with mno and so on in C#
Do you mean replace like with the "C-Preprocessor"?
Using two arrays is not the way to go in any case.
|
|
|
|
|
Hi,
Scenario:
I have many user components added to a form. I wish to do some information reporting from each user control to a centralized destination, where many form can subscribe and acquire the information.
I have a class named MiscFunctions, contains an informationEvent handler which each forms subscribes too rather than subscribing to each UI component.
I want to trigger that event present in Miscfunctions class from my UI components with some arguments, and all my forms subscribing to an event in miscfunctions to listen it.
Any help please?
|
|
|
|
|
I assume you are using static Eventhandlers on your Miscfunction ...
what you need is another static method that is used to raise the event when ever you want, hope I got your question
static event EventHandler commonHandler;
static void raiseCommonHandler(object sender, EventArgs e)
{
if (commonHandler != null)
commonHandler(sender, e);
}
MiscFunction.raiseCommonHandler(new object(),null);
|
|
|
|
|
You need to create and call a method in your MiscFunctions instance (or static class) that raises your custom event passing an instance of your own event args class (derived from System.EventArgs ) as a parameter.
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.(Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
Thank you guys.
Did some snopping around and found no other way than you guys mentioned.
Thank you...
|
|
|
|
|
Hi,
I'm having a big problem with a "data importer" code.
I'm working on this data importer since January and never have any problem before. The big difference is just that there is more data to load now than in january. And each entity is bigger (more properties)
I'm using .NET 3.5 C# nHibernate & spring
The exception is:
Exception of type 'System.OutOfMemoryException' was thrown. ------- at System.Collections.Generic.Dictionary`2.Resize()
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value)
at NHibernate.Event.Default.AbstractFlushingEventListener.PostFlush(ISessionImplementor session)
at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)
at NHibernate.Impl.SessionImpl.Flush()
at NHibernate.Transaction.AdoTransaction.Commit()
at PagesJaunes.Adnc.DataAccess.Repositories.Repository`1.CommitTransaction()
There is a total of 500 000 entities to save.
My code is saving 10 000 entities, then commit and start a new transaction for the next 10 000
It take nearly 12 hours to save everything, and after ~400 000 entites i receive my OutOfMemoryException
I already try lots of things, can anyone help me having new ideas ?
- i tried to commit each 100 entites or each 1000 entites.
- i tried to call GC.Collect regularly
- if a commit throw the exception, i tried to rollback and start a new one. but then each commit throw the f** exception, no matter what.
- googling since 2 days and i can't find anything on this subject
- now i'm trying to do a commit/flush/clear each 10 000 entites (it's running i don't know the result yet)
--
Nicolas
|
|
|
|
|
Hi,
I see two possibilities: a real out-of-memory condition (just keeping too many objects alive at the same time), or a fragmentation problem (the memory for each individual object needs to be contiguous, big arrays/collections may fail their allocation).
Here is how to tell them apart:
- display or log the result of Environment.WorkingSet regularly; it shows how much memory is needed by your app. (You could divide by 1024*1024 to get megabytes rather than bytes).
- if it continues to increase, up to one or a few gigabytes, you're really running out of memory, and you must look for memory leaks (not disposing of things you should?) or too many objects that never die (e.g. a poorly implemented caching scheme trying to remember everything that ever lived).
- if the WorkingSet is well below 1 gigabyte when your app crashes, you have a fragmentation problem. They were common on older .NET versions when using collections that grow all the time. There is no 100% solution, you should try removing items you no longer need (or clear the collection ASAP), and allocate a sufficient capacity when starting a collection (see http://www.perceler.com/articles1.php?art=capacity1[^] for some background info).
|
|
|
|