|
I agree with Jamie that it's primarily a training issue, but it's also one of validation.
Before accepting the data as entered you should be scrubbing the text entered and looking for multiple spaces next to each other and various other irregulaties that would break your output.
You should always be treating user input as if they're a bunch of demonic 2 years olds mashing the keyboard. Would you trust anything they enter?? Your code shouldn't trust it either...
|
|
|
|
|
trust me there are more checks on that address than there are at US customs on a flight from Colubia, but i'm not dealing entirely with my own system. i hate to interact with others. Its complicated. And also why i hate contractors. Overpaid and leaving me to clean up the mess.
|
|
|
|
|
blakey404 wrote: there are more checks on that address than there are at US customs on a flight from Colubia
Wanna bet?? Guess who I work for, as a contractor, who's grossly underpaid...
|
|
|
|
|
hehehe to be honest it is a particular contractor i mean to aim my anger at, not all of you
and yes i do wanna bet, the whole despatch system is based on postcodes (UK) for validation to lots and lots of checks are done. its a simple fact that this is the manual override option which is required because the UK post office cannot release their updates (to address based on postcode) quick enough for us to rely on it completely. So there does need to be a manual override, it just needs to allow as much but also as little functionality as possible, if that makes sense.
Cheers
Anthony
|
|
|
|
|
blakey404 wrote: And also why i hate contractors
Way to alienate people trying to help you.
|
|
|
|
|
grumpy contractor
|
|
|
|
|
Dave Kreskowiak wrote: You should always be treating user input as if they're a bunch of demonic 2 years olds mashing the keyboard. Would you trust anything they enter?? Your code shouldn't trust it either...
Thats brilliant, and very true.
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
Hi!
I guess the easiest solution will be to turn off word wrapping.
That way they can enter as many spaces as they like, they only get the TextBox to scroll horizontally once the right margin is reached and then (hopefully) they see the error in their ways.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
i considered that to be honest and its currently looking like my favourite solution as they cannot get to the next line that way without using return
|
|
|
|
|
A few years back, i worked on a project where permissions were handled by assigning a number to a user, and that number would then be read as a "binary" (if i remember correctly), ie, it would then get broken up into its parts based on the 1,2,4,8 scale.
so 3 = 1 and 2
7 = 1 and 2 and 4 and so on.
i know there is a method for interpreting this in c#, but i no longer work for that company, and a need to use a similar method of interpretation has come up. so, could someone please point me toward the method for interpreting this, and, let me know if i am calling it the right thing?
thank you
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
More commonly refered to as bitwise operation, you use the | and & operators. (& to interpret if a particular "bit" is set, and | to set a particular "bit").
Some examples.
<br />
int myNum = 1;<br />
myNum = myNum | 2;
To use this in a boolean expression, you can check the result != 0 (which effectively means the "bit is set".
<br />
if( (myNum & 2) != 0)<br />
{<br />
}
|
|
|
|
|
Yeah, what he said. Plus, look at the FlagsAttribute for enumerations.
|
|
|
|
|
Hi all,
I have a child form compiled as DLL (project1) to be used from another Main Application (project2). Now this window has many settings.
The Main Application can create multiple instances from the child form (project1).
All these instances will share the same settings.
My question is how can I make each instance create its own settings?
Thank you
|
|
|
|
|
I assume you're asking for persistent settings. Have you looked at any of the classes in System.Configuration namespace? You should be able to create a new app settings group per instance.
|
|
|
|
|
Hi All,
I need to run 3 methods parallaly.Then I have used Threading for that. Here is the code.
public void threadtest()
{
Thread SpecialThread = new Thread(new ThreadStart(this.GetSpecial));
Thread BulkThread = new Thread(new ThreadStart(this.GetBulk));
Thread NormalThread = new Thread(new ThreadStart(this.GetNormal));
SpecialThread.Start();
BulkThread.Start();
NormalThread.Start();
SpecialThread.Join();
BulkThread.Join();
NormalThread.Join();
while((NormalThread.ThreadState==System.Threading.ThreadState.Running) ||
(BulkThread.ThreadState==System.Threading.ThreadState.Running) ||
(SpecialThread.ThreadState==System.Threading.ThreadState.Running)
)
{
}
}
But most of time one or two threads are going to aborted or something happen and I loose their results.Sometimes this worked properly and I can get all results from 3 methods.
Can any one correct this code?
|
|
|
|
|
Repost. Though I'd seen it before and yes, a week ago you posted the same code. A complete c+p actually. No-one helped you then, what makes you think they will now?
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
So what? He is trying again and may have better luck. Why didn't you just ignore his post?
|
|
|
|
|
Hello,
Why are you doing the "Join()"?
What do the Methods of the Threads do?
What are the results you are expecting and where do you get them from?
All the best,
Martin
|
|
|
|
|
hi,
thanks for reply.
I am joining 3 threads with Join() method. Then 3 threads can execute parallary.
There are 3 methods ,all are return same types of arrays.
|
|
|
|
|
Hi!
The whole while(... construct is superfluous.
You start 3 threads and then call Join() for each of them.
So the last Join() will return only when NormalThread has finished and the other two threads have finished as well.
Depending on how you access the thread's "results", declaring the respective members as volatile might help.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
I suggest using 3 AutoResetEvent that each thread would Set() when done. So, you start your three thread, and then, in your main thread, do a WaitHandle.WaitAll(....). It would be advised to use the overload with a timeout.
Your code could look something like this:
public MyClass
{
private AutoResetEvent _specialEvent = new AutoResetEvent();
private AutoResetEvent _normalEvent = new AutoResetEvent();
private AutoResetEvent _bulkEvent = new AutoResetEvent();
public threadtest()
{
Thread SpecialThread = new Thread(new ThreadStart(this.GetSpecial));
Thread BulkThread = new Thread(new ThreadStart(this.GetBulk));
Thread NormalThread = new Thread(new ThreadStart(this.GetNormal));
SpecialThread.Start();
BulkThread.Start();
NormalThread.Start();
WaitHandle.WaitAll(new WaitHandle[] { this._specialEvent, this._normalEvent, this._bulkEvent } );
}
public GetNormal()
{
this._normalEvent.Set();
}
public GetSpecial()
{
this._specialEvent.Set();
}
public GetBulk()
{
this._bulkEvent.Set();
}
}
You could consider using the BackgroundWorker class also.
|
|
|
|
|
Hi,
thanks a lot for reply. I will check with your codes and comeback soon.
Is there a problem ,when I am using Join() method?.
I need to run my 3 methods paralaly. all the 3 methods return same type of arrays.
|
|
|
|
|
Hi,
we have a requirement that we have to suppress/deactivate all other applications except one application(running). Can we accomplish this using C# or VB.net? could you please help me to finish this task?
For example, if we open one application, all other applications should be suppressed/deactivated. (means we should give access for only one application for the users).
Thanks in Advance
SMARTech
|
|
|
|
|
The practical answer is no. There are too many processes in the system that are required to keep your application aloft for a start.
You could, for example, attempt to increase the priority of your application above all others but this would have a detrimental effect. Again, because your application relies on parts of the operating system doing its job it won't help if the OS cannot do its job because your application is elevated above it.
I am, however, extremely suspicious of why you might want to prevent other applications running in the OS while your application is running. It sounds like something a virus or trojan would want to do.
|
|
|
|
|
Colin Angus Mackay,
Thanks for you quick response, I dont want to prevent the services of OS, I just dont want to give access to the user for other applications except the one. how to prevent the user to access all other applications except the one application (running)? could you please help in this issue?
Thanks
SMARTech
|
|
|
|