|
My vote of one:
What use is this recursive call of RegisterUser() ?
I'd really like to see an explanation for that. In case there is some information missing/empty there will be a recursive call to method RegisterUser which will bring absolutely nothing except locking up the application.
More interesting still is that OP thinks this is a solution (Silent SP alarm goes off!).
Strange!
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|
Didn't notice the call was recursive; it's original location looked flaky too
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
hi to all
im want using an extension method in c#
.my code is
public static class Extensions
{
public static string GetFirstThreeCharacters(this String str)
{
if(str.Length < 3)
{
return str;
}
else
{
return str.Substring(0,3);
}
}
}
but when i want t use this extension method icant see "GetFirstThreeCharacters" method in below code?
String str = "my new String";
str = str.GetFirstThreeCharacters();
thank for help
|
|
|
|
|
Make sure you have include the namespace your extension class is in, in the using statements. Your code has to be able to "see" the extension to use it.
|
|
|
|
|
You might want to change this:
if(str.Length < 3)
to this:
if (str.Length < 4)
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I tried the same question but it is working in my app.. check the output rather than intellisence feature....
public static class Exte
{
public static void add(int x, int y)
{
}
public static string GetFirstThreeCh(this string str)
{
if (str.Length < 3)
{
return str;
}
else
{
return str.Substring(0, 3);
}
}
}
class Program
{
static void Main(string[] args)
{
String str = "my new String";
str = str.GetFirstThreeCh();
}
}
|
|
|
|
|
As your code is in the same namespace, it would work. Try moving the extension into a separate namespace and do the same without referencing that namespace when you try to call it.
|
|
|
|
|
ok
this work in my App too
thanks
|
|
|
|
|
i was going through a wcf code and found lots of things was written in app.config file where wcf has been hosted. i just do not understand many things in app.config file regarding wcf. please explain every entry in details....if possible. here is the content
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IViewerService" closeTimeout="00:10:00"
openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647" messageEncoding="Mtom"
textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="">
<extendedProtectionPolicy policyEnforcement="Never" />
</transport>
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
<wsHttpBinding>
<binding name="WSHttpBinding_IViewerService" closeTimeout="00:10:00"
openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Mtom" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="">
<extendedProtectionPolicy policyEnforcement="Never" />
</transport>
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="false" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://97.87.12.242:1003/Rlc/Viewer" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IViewerService" contract="ViewerProxy.IViewerService"
name="BasicHttpBinding_IViewerService" />
</client>
tbhattacharjee
|
|
|
|
|
Tridip Bhattacharjee wrote: please explain every entry in details
You're kidding aren't you? Do you think that anyone here has the time, or the inclination, to answer a question like this. You have all the keywords you need in there, so happy Googling.
|
|
|
|
|
Pete O'Hanlon wrote: Do you think that anyone here has the time, or the inclination, to answer a question like this. Ironic that his profile description reads "I don't have the time".
/ravi
|
|
|
|
|
That would take a small book to explain, FAR more than allowed in a few forum posts.
Do yourself a favor and pick up a book on WCF and teach it to yourself.
That is, unless "you don't have the time". In which case you wouldn't have the time to read the pile of forum posts that would be required to explain all of this anyway.
|
|
|
|
|
After 10 Hour shift + only 4 hours sleep in a rough night
now an hour before my shift ends i think i lost a fuse... anybody can give me hint on this one?
Link
[^]
Hmm i wonder why its doing that......ARGHS NO STOP, ROLLBACK ROLLBACK...F*** That's how i learned to "Always Backup"!!
Dogs are man's best Friend,
Cats are man's adorable little serial killer
|
|
|
|
|
Why have you posted this? Your question is in the queue and will be answered when someone feels they have something useful to add. Bottom line: please be patient.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Questions from Q&A are usually not repeated/linked to on the forum.
I cannot give a hint, as I don't know what direction; let's assume it's UI-wise, you'd want two lists with columnnames, where the right side can be manipulated easily.
The question is rather whether you, or the end-user should do the final mapping. I'd assume that it'd be hard to predict every situation, and hence suggest to let the user decide, if possible.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
This has to do basically the same thing, although it is an Excel Addin instead of just reading Excel. However, can use a lot of the code pretty much directly if you are willing to spend the time to understand what the code is doing: Excel Add-in Framework for Validating and Exporting Data[^]
|
|
|
|
|
In my applications (generally WinForms) I am currently using Log4Net to allow me to use application logging.
my question is that currently I log at exception levels, but I feel that this level of logging is not enough.
what I am asking is advice / help or even pointers to a good logging strategy.
Thanks
Simon
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
As with most things: it depends. I have worked on systems which can log just about everything that happens in the program to those that do not properly log (or catch) exceptions. One of the options you could try is to add code that will log every method call, entry and exit, including parameters and return values, but make it optional, so you only enable it when trying to locate a problem. You can also try logging particular types of activity based on flags or debug levels etc.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Good advice.
It might also depend upon what the application is doing. For instance, on a windows service, I tend to log everything because it might be useful to have a record of what is going on each time the application carries out its tasks and to check that it has done so properly.
All according to need. I also use log4Net: pretty good piece of kit.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
Thanks Richard,
what you have suggested makes a lot of sense.
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Simon_Whale wrote: my question is that currently I log at exception levels, but I feel that this level of logging is not enough.
Can you objectively point out where you lack logging and which part needs additional tracing?
You could trace every sql-statement on the database-server, log a lot of actions and events, and even log the information on the network. You could "always" run the app in debug-mode, using a custom debugger to log everything.
If you're hunting exceptions in the wild, you might want to make minidumps[^]. That's not logging, but might still be what you're after.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Thanks Eddy
The application is a complete back office for an insurance underwriters which I work for, at present I felt with just capturing the exception and the data that caused the issue it gave me a wild goose chase to find the area that caused the problem, as not all the time does the user give you a full picture of what they were doing.
but with information from yourself and Richard I now have a lot of things that I can do to make logging a good debugging tool.
Thanks
Simon
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Simon_Whale wrote: what I am asking is advice / help or even pointers to a good logging strategy.
There are several definitions for logging. I have taken to using the following definitions.
1. Audit logging. This involves tracking what 'users' are doing on the system. For example if a user deletes a record then a 'audit log' is created. This can be driven 'users' that are not actually people such as a 3rd party application.
2. Operations logging. This is information collected specifically to assist operations staff in diagnosing expected error conditions. For example if a third party web service goes down then operations needs to know about it.
3. Trace logging. This is logging that assist a developer in determining why a system failed due to unexpected problems. It will often require familiarity with the code base to understand everything.
Audit logging is defined by business requirements.
Operations logging is defined mostly by operations but can be guessed at by development.
Trace logging is solely dependent on development making educated guesses about failure points.
Specifically for trace logging...
Trace logging does NOT work if it does not exist in the production system. Thus trace logging is NOT a tool that is used during development. That doesn't mean you can't add logging to figure out some obscure problem while you are writing code but it does mean that the logging statements that are left in must be manageable in production.
It also means that logging must exist in the production system. It is not turned off nor turned down.
Trace logging can be used by operations but operations does not dictate, control nor otherwise own it. Operations can make suggestions for improvements but consideration should be given that operations has their own log and thus most times what they want should be in there and not in the trace log.
In general logging (trace logging) cannot use a off box repository (database,etc) because both of those can fail. And with such failures there must be some way to log that.
Trace logging must not stop the real application from running. Compare this to audit logging which one might code such that the application stops working if it can no longer do audit logging.
With smaller systems it often seems possible and desirable to do things like log the entry and exit from every major method. However that is impossible in systems will larger volumes. Both because the log files can become large very quickly (think 10 of gigs daily or larger) and because finding anything when there is a lot of data becomes a problem.
So addressing large system only one can come up with the following
- Log exceptions but insure that they only log once. In practice this means that if you catch an exception and log it you do NOT re-throw it.
- Log entry and exit (including success/failure) from major functional areas.
- Provide a trace id for every message in the application and even better in the system. When logging relevant to message processing then always log with that id.
- Log off box request/response attempts. This includes success and failure. Especially when going to a 3rd party.
- Avoiding logging in looping structures. This is to reduce noise. Logging at the beginning and the end is sufficient.
- Avoid duplicate logging. If you load configuration information don't log it every time you access the configuration information, but only the first time.
- Log messages must contain relevant information. Thus don't log "x=3" but instead "result of order query=3"
- Log messages are not a dumping ground for development. Developers must keep in mind that the log file is not an infinite resource and also keep in mind that although they will need to use it to debut problems that unnecessary log lines can multiply hundreds of thousands of times in production and thus make it that much harder to determine problems. The log file provides assistance but not solutions to unknown problems.
Another trick that I have found valuable works in some scenarios with exception handling.
- This is often a boundary layer system.
- I catch an exception, log it along with an id (GUID).
- I throw another exception with a message that is appropriate for the boundary layer and I include the id as part of the message.
The advantage of the above is that upstream, perhaps a user or a third party system gets an error message that means something to them. And questions about that can be address in the context of finding the exception cause in the log file with the id if that becomes necessary.
|
|
|
|
|
Thanks jschell
that has given me great things to read and use
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
I've done some fair logging and mostly the needs depend a little on the application.
There are several questions that need to answering:
1. What
Despite the actual text you might want to log off course, the datetimestamp (go millisecond or smaller!), but also who was the user at the time, what machine, which application, module, class, method and finally you'll need a log type (error, warning, information,...) and severity.
2. When
Concerning the actual log message I usually log every exception and the SQL statements. Then mostly I add logging at key points eg when receiving information from a webservice call or when we send an email succesfully, ...
3. Where
Mostly one logs to a txt file or something like that. I find that horrible personally. If you have one application, no problem, but if you have a system, log to the database. It will be easier to trace the sequence instead of going through five log files at the same time comparing datetime stamps. It is always possible to catch a db down and write to txt file as backup.
4. How
Prevent in using a method inside each class, create an assembly that can be used by all applications. Built in a debug level setting that will prevent logging too verbose when not required.
Hope this helps.
|
|
|
|