|
If you're going with the web-connected stuff anyway, you could go one step further and mode a vital piece of code to the server. Pirates are going to have a pretty bad time with that.
|
|
|
|
|
Check this out. www.cybersurelock.net. Let me know what you think.
|
|
|
|
|
Is ther any component or OCX which we can use it to
generate and print a barcode? when we use the one
printer's facility, it doesn't work correctly for other printers. I want also to know is there a
general software for this purpose? thanks
|
|
|
|
|
Try this font[^].
Bastard Programmer from Hell
|
|
|
|
|
thanks I took a look at that link. I think it may work, but as I understand it can generate only
one format (Code 39). thus user cant select his own
standard. but it will give me good idea.
|
|
|
|
|
There are more barcode-fonts out there, for different formats - just don't forget to add any checksums, if required for that particular format
Bastard Programmer from Hell
|
|
|
|
|
Take a look at some of the results here[^].
When I needed a simple Code128 barcode generator for a site I was working on, I found the base code in one of these articles. It took less than 1 day to adapt the code to my purpose, so it was a very good base.
The specific article I used is this one: GenCode128 - A Code128 Barcode Generator[^] (Edit: I know this is an older article, but it converted very easily to dotnet 4 for me)
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
Thanks, but I didn't need barcode generator, the thing that I need is a program (for example an ActiveX or DLL) which I be able to use them in my own
project. I will search more carefully through the
second link which u sent. 
|
|
|
|
|
|
how do i use pdfbox in c#??
|
|
|
|
|
|
In a function, I want to catch all exceptions and just log them (they do not really matter), but one specific type of exception must not be handled like this - it must be dealt with in a function farther up the call stack.
Currently, I do something like this:
private void SomeFunction()
{
try
{
}
catch(UserTriedToCheatException)
{
throw;
}
catch (Exception ex)
{
Log(ex.ToString());
}
}
Though that code works as expected, I am not content with it. That catch-throw looks so terrible.
Do you have "nicer" suggestions?
|
|
|
|
|
Exceptions don't really matter? Hm ...
I don't find your construct too bad but the alternative which expresses your intent (imo) slightly better is:
try {
} catch(Exception ex) {
if(ex is UserTriedToCheatException) throw;
else Log(ex);
}
|
|
|
|
|
Looks different, but not so much better that I will change my code. Thanks anyway.
|
|
|
|
|
OK, but leave out the else - it's extraneous.
/ravi
|
|
|
|
|
If you're just logging the exception, why do you need an exception handler here at all? Just use the one 'further up the callstack'.
Regards,
Rob Philpott.
|
|
|
|
|
Because of other code to be executed or not. Something like this:
public ReturnType APublicFunction(some params)
{
try
{
SomeType someValue = aPrivateFunction(other params);
}
catch(Exception ex)
{
}
}
private SomeType aPrivateFunction(other params)
{
SomeFunction();
}
In case of the UserTriedToCheatException, it has to be handled in APublicFunction, and no more other code needs to be executed, while in other cases, the exceptions are not such important, the rest of the functions can still be executed (sufficient fallback functionality provided).
|
|
|
|
|
How about something similar to the way TryParse[^] works?
if (SomePrivateFunction(out SomeType SomeParamName))
{
}
Bastard Programmer from Hell
|
|
|
|
|
you can always invoking a Delegate, which will call the registered private method
Satish
|
|
|
|
|
Bernhard Hiller wrote: That catch-throw looks so terrible.
In my opinion, it won't look so terrible with some good comments around it!
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Could you please clarify the meaning of up in the hierarchy or the use case where you need such type of exception handling?
I am asking this only because I thing your approach could be wrong?
well even I could be thinking wrong as well
Happy Coding
|
|
|
|
|
For example: a program starts. Many configuration and option files are read, server connections established etc. Some problems might arise, but fallback mechanisms are provided for many cases. But somewhere down in a function, a manipulation of the license is detected - that must be raised to the topmost level, the user must be told "You bad user $€$€!" and the program shuts down immediately.
|
|
|
|
|
Ok got it!
Do following things
1. Build two separate hierarchies for exception
1.1 For exception that you want to catch log e.g. LoggableException
1.2 For exception that you want to you caller to handle e.g. NonLoggableExcptions
2. Only catch the LoggableException exceptions - log in your case
3. Don not catch NonLoggableExcptions - these will be automatically traverse to the caller
4. The try block code should only throw these two exceptions or the derived objects from these exceptions
5. Don not catch Exception, its a bad practice, which says anything could be happen in the code. can it be . this gives bad impression. though I am not sure if any unhanded exception occurs how it is handled in the client server application as I never worked on it
hope this helps to you and solve you problem...
let me know if you need some further help
Happy Coding

modified 28-May-12 3:00am.
|
|
|
|
|
did this solution helped you?
|
|
|
|
|
How to block USB ports in c# application?
|
|
|
|