|
|
Me too
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
|
|
|
|
|
|
mdpavel wrote: How do I make sure the hidden field is posted ? I am always getting null even after psotback.
Then your field is not in the form that is posted. Either you put the field in the wrong place of the page, or you are not doing a postback at all.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
lets say i have a dll which relies on nhibernate or log4net. And within this dll there're calls which references these external library (nhibernate/log4net .. etc).
To be specific, and as an example I may have a config file look like this:
<configuration>
<configsections>
<sectiongroup name="spring">
<section name="context">
type ="Spring.Context.Support.ContextHandler, Spring.Core"/>
<section name="objects">
type="Spring.Context.Support.DefaultSectionHandler, Spring.Core" />
</section></section></sectiongroup>
<section name="nhibernate">
type="System.Configuration.NameValueSectionHandler, System,
Version=1.0.5000.0,Culture=neutral,
PublicKeyToken=b77a5c561934e089" />
<section name="log4net">
type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</section></section></configsections>
<spring>
<context><resource uri="config://spring/objects" /></context>
<objects>
</objects>
</spring>
<nhibernate>
... nhibernate config ...
</nhibernate>
<log4net>
... log4net config ...
</log4net>
</configuration>
Now where should I put app config for log4net or nhibernate. In the application's app.config or in dll's app.config?
I want avoid having to copy config setting when I reference my DLL from a console app this time, then next time to a ASPNET or WebService. Each time having to merge/cut/paste app.config (from Dll) seems like a waste of time.
Thanks
dev
modified on Thursday, January 8, 2009 8:50 AM
|
|
|
|
|
In the publish tab of the properties there is a prerequisites where you can put this, it then ends up in the app.config I beleive.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
sorry I open "Properties" of my dll project - I don't see any publish tab there? I do see there's a "Publish" tab under "Properties" of the console app (which references my Util dll project). I'm not sure what you're getting at though...
And my confusion really arise from:
MyConsoleApp.exe's app.config
vs
MyDll's app.config
Where should I put nhibernate/log4net config - obviously, since my nhibernate/log4net code in dll, not the console app. I therefore would prefer config be placed in App.Config of the dll, not the console app.
dev
|
|
|
|
|
I'm creating a game and I need to rotate this object. Ok i'll make my explanation simple, I have Object1 and Object2.. Let's say Object1 is at coordinates 0,0 (x,y) and Object 2 is at coordinates 10,10... Object 1 is currently facing south, Now I need object 1 to be facing Object 2 so I need the "degree" value from object 1 to object 2. Does anyone have a math formula for getting the degree? or an alternative solution can help.
|
|
|
|
|
Hi,
imagine a rectangular triangle with your two points on the hypotenuse, and the two perpendicular sides parallel to the axes. The angles you want have tangent or cotangent
equal to deltaY/deltaX, so you need something similar to Math.Atan2(deltaY,deltaX) .
However, are you sure you need the angle? Trigonometric functions are rather expensive,
and a lot of graphic stuff does not need them after all, often something much simpler
can do the trick as in Math.Sqrt(deltaX*deltaX+deltaY*deltaY) for the distance, and
similar stuff for projections and stuff.
|
|
|
|
|
Luc Pattyn wrote: imagine a rectangular triangle
I'm trying - really I am.
If I knew then what I know today, then I'd know the same now as I did then - then what would be the point?
.\\axxx
(That's an 'M')
|
|
|
|
|
|
How to read special characters such as <,> in XML document in C#. I am passing sql statement from xml file to my c# program. SQL statement contain >,< characters. Please tell me a way escape these characters.
Dushan Perera
|
|
|
|
|
|
It's Not working
Dushan Perera
|
|
|
|
|
Then you are doing it wrong.
How are you creating the XML document?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
hi everyone
so this is my problem, i have a windows forms proyect, the first form calls the second and that last one is a gui like an agenda, its connected with sqlite (i think this is irrelevant but i just wanted to mention it) the contacts are sorted in a treeview and if i makes changes in one contact, like names or telephone if i click on another contact the program asks if i want to save changes
now here is my problem
sometimes i change the name or something and then when i click on another contact and i choose to save the changes the program will call Dispose method for no reason and shut down, this error has also happened when i choose to NOT save changes, and when i do save them , i look in my database and it DOES save them! debugging my program i noticed that whenever this thing happens it gives me a NullReferenceException, you know the "object reference not set to an instance of an object"
this thing only happens SOMETIMES, for no aparent reason do you have any ideas why is this and how i could fix it?
thanks a lot in advance guys
|
|
|
|
|
Dispose on what object, called from where, and what does the Dispose method do?
Check the call stack, see where it's being called from.
Check whether the object is being refered to after it's disposed by the caller.
Check whether the Dispose method is using instance members that may have been cleared or failed to be initialized.
Bar fomos edo pariyart gedeem, agreo eo dranem abal edyero eyrem kalm kareore
|
|
|
|
|
well its like this
when i run the program a form shows up and it has a button like this
form2 F = new form2();
F.show();
this F form is the one making all the operations, saving changes, deleting etc, when the error occurs this F form calls ITS dispose method to close the F form, when i tried to see why it was being called (exception.stacktrace or exception.source) it only showed me the exception was originated in my class ( that F form.cs) i dont know why it gives me that exception, i dont know what object its refering to, the form itself?
after it closes the F form the first form shows me another exception here
static void Main()
{
try
{
Application.Run(new Form1());
}
catch (Exception ex)
{
}
}
that exception's stacktrace is huge, something like " ex.StackTrace at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc....... "
|
|
|
|
|
Hi,
I suggest you look at the first stacktrace line that mentions a file name with line number; that is where you should start looking.
BTW: if a release build does not give that information, try a debug build instead.
[ADDED]
FYI: The ideal way of implementing Dispose(), from the excellent article Implementing IDisposable and the Dispose Pattern Properly[^] by Scott Dorman:
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
}
}
disposed = true;
base.Dispose(disposing);
}
[/ADDED]
|
|
|
|
|
thanks for the advice man, by the way my dispose method is the same as that one you posted, i didnt create it , visual studio puts it in there for me, it has it like this :
protected override void Dispose(bool disposing)
im gonna look at ex.stacktrace once again though, i hope i find something there
the thing that i cant understand is that i know all the methods involved, i thought one of them would be the problem but they all work fine!, even when the error occurs
this is the method's order: beforeselect(treeview), InfoChanged(this one i created), updateInfo(this one i created), SQLUpdate(this one i created to update database registries), AfterSelect(treeview)
when the error occurs it occurs AFTER all my methods, it evens saves the changes, is there any way this could be some random visual studio problem or something? because i do the same steps over and over again and the error occurs only sometimes.
|
|
|
|
|
i mean why does the program calls Dispose after everything is done if i didnt call it myself?????
|
|
|
|
|
Hi,
there are several ways Dispose() may get called implicitly:
- through the using statement as in using Form myDialog=new Form() {...}
- through some method that cleans up and basically hides Dispose under another name (File.Close, Form.Close, ...) ;
- by the GC finalizer once it decided your object is no longer alive (i.e. all references to it have vanished);
- and maybe more.
[ADDED]
When an app is done, most if not all objects are no longer alive, and might get
collected, hence their Dispose() called, however the process is not guaranteed to do that; just exiting is good enough to clean everything. If you happen to have an app that intends to exit, but remains somewhat alive (because of a thread for which you forgot to set IsBackground=true), a lot more Dispose() calls would eventually occur. In that case Task Manager would no longer show the app (under the Applications tab) but it would still show the process (under the Processes tab).
[/ADDED]
|
|
|
|
|
hey i havent seen this post, i will check right now maybe there is something like this in my program thanks a lot man you are very helpful every time i come here
|
|
|
|
|
Hi,
a program running fine most of the time probably indicates it is mostly correct;
however a single failure indicates it is not completely correct.
IIRC you mentioned a null ref exception and a Dispose being called twice; I do not understand how these fit together though, a correct Dispose is protected against null refs; and maybe the double Dispose is due to Dispose() calling Dispose(bool)?
Anyway, you have only two handles to the problem: source code review, and analysis of the symptoms.
Once you know the exact line (and calling context) where the fatal exception occurs,
and assuming you have the source, you could add logging information writing lots of
useful stuff to a file, so next time it fails you can work from there.
If it really is a null ref, it should be rather easy to figure which reference is bogus,
and then analyze how that is possible...
FWIW: Are you sure your try-catch constructs don't discard exception information,
i.e. if a catch block is empty, an earlier exception may got consumed unnoticed, making it much harder to figure out what caused later symptoms.
|
|
|
|
|
hi man, well no not one of my try catches are empty so i know when an exception happens, what i was refering to when i said dispose called itself was that i added a little piece of code to my dispose method, a call to the method that checks if any changes has been made, so whenever i close my form , the form lets me know if there were in fact any changes, this call im talking about has as parameter a treeeview node name, at first i thought this was the problem, maybe i havent selected any nodes so if i make the reference treeview.selectednode.text it would make sense that it gave me a nullreference exception since nothing is selected, but i erased that line and left the dispose method as visual studio puts it for me and the error still happens sometimes.
i mean even if i messed up in the dispose method by adding a line of code with a null reference, the program , as far as i know, only calls the dispose method when im closing the form, so why would the dispose method call itself after i saved my form's changes IF I HAVENT EVEN CLOSED THE FORM YET???
and ONLY sometimes, i mean i do the same steps over and over again and most times nothing bad happens and dispose method doesnt call itself for no reason, until i actually close the form.
thanks for your replies
|
|
|
|
|