|
from time to time, I see some sample code that is handed to me that has a code snippet that looks like this:
<code>public string Name { get; set; }</code>
Does this actually do anything? Does it really make it so that one can set and get the "Name" string variable?
I have always thought that what is required is something like this:
<code>private string name;
public string Name
{
get
{
return this.name;
}
set
{
this.name = value;
}
}</code>
Am I correct?
Please advise.
|
|
|
|
|
|
how to create interface loging
|
|
|
|
|
Use ILog<t> where : T interface
Or for a real answer that will work, please be more specific.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.
So stop trying to type as little as possible and help us to help you!
Sent from my Amstrad PC 1640
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I am using custom client connection for 10 tcp clients.
bool _flagScanner1Connect = true;
private xyzTranmissionProtocol xyz1TranmissionProtocol = null;
private static readonly object LockWhileConnectingForScanner1 = new object();
internal ICustomClient Scanner1Conn;
System.Threading.Timer _tmrCheck1ClientConn;
public void Start1ScannerConn() { try { _tmrCheck1ClientConn = new System.Threading.Timer(Check1ScannerConn, null, TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(5));
}
catch (Exception )
{
}
}
private void Check1ScannerConn(object state)
{ if (!_flagScanner1Connect) return;
lock (LockWhileConnectingForScanner1) {
if (Scanner1Conn == null || Scanner1Conn.CommunicationState == ClientCommunicationStates.Disconnected) {
try { _tmrCheck1ClientConn.Change(Timeout.Infinite, Timeout.Infinite);
Scanner1Conn = CustomClientFactory.CreateClient(new CustomClientTcpEndPoint(“Scanner IpAdress”, “Scanner Port Number”));
Scanner1Conn.Connected += Scanner1Conn_Connected; ;
Scanner1Conn.Disconnected += Scanner1Conn_Disconnected;
Scanner1Conn.MessageReceived += Scanner1Conn_MessageReceived;
xyz1TranmissionProtocol = new xyzTranmissionProtocol();
Scanner1Conn.TransmissionProtocol = xyz1TranmissionProtocol;
Scanner1Conn.Connect();
//SEND A PING MESSAGE
_tmrCheck1ClientConn.Change(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5));
}
catch (Exception )
{
if (_flagScanner1Connect)
try
{
Scanner1Conn?.Disconnect();
}
catch { }
try
{
Scanner1Conn?.Dispose();
}
catch { }
try
{
Scanner1Conn = null;
}
catch { }
}
finally
{
_tmrCheckClientConn.Change(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5));
}
}
}
}
I have written 10 different functions for 10 bar code scanners. above code is for 1 scanner. if i use 3 scanners or less than 3 my application will work. but if i use more than 3 scanners then message received events will not work And the application will become very slow. can anyone help me out to solve this issue.
|
|
|
|
|
I'll bet that what's going on is that you're experiencing one or more run-time exceptions, but since you're just swallowing them, you have no idea that they are happening.
Remove the empty catch blocks, and you'll get a better idea of what's happening in your code.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I have a gridview with 2 columns and 5 rows-these are fixed.
I want the user to reorder the rows only not the columns. How can i do this? At present i can just reorder the rows.
|
|
|
|
|
Sorry?
Dipk11 wrote: I want the user to reorder the rows only not the columns. How can i do this? At present i can just reorder the rows.
That sounds like it's doing what you wanted it to ...
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.
Sent from my Amstrad PC 1640
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Sorry! My Bad
I can just rearrange the columns, not rows.
|
|
|
|
|
Message Removed
-- modified 10-Jul-18 13:26pm.
|
|
|
|
|
Message Removed
modified 10-Jul-18 13:26pm.
|
|
|
|
|
Hello,
Do we have any way to check or monitor the activeness of any layer or component in any WPF application ? I heard about WatchDog mechanism to use for this purpose but couldn't get any proper information.
My Scenario -
ComponentOne (ClassLibrary)
||
|| reference being used in ComponentTwo
V
ComponetTwo (ClassLibrary)
||
|| reference being used in ComponentThree
V
ComponentThree (.exe/view)
On view i want to show the health of above two component something like Active-if everything is fine, Dead- if any Thread is aborted etc.
we need to introduce a mechanism that the GUI knows if the Interface is still intact/alive/responding etc.
What I have tried:
Read about WatchDog but no luck
|
|
|
|
|
Search for a taskmanager-example here on CodeProject; it will show how to get a list of processes, and whether or not those are active.
That will only apply to the main-thread; other threads do not need to report anything.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I have seen projects in which they are following the method of creating models as interfaces(without any concrete implementation) and mapping them using Fluent API. The reason for such an architecture is to have multiple inheritance. I am not able to digest the reason because as per my understanding interfaces are contracts which needs to be implemented and to make loosely coupled models-view architecture. Please confirm which approach is correct.
|
|
|
|
|
At some point, there's going to have to be a concrete implementation of the interface. The idea of creating a model as an interface is a good way to defer the responsibility of the creation of the model. One reason you might want to do this is because your model has to be filled from a database but you want to write unit tests for the classes that have dependencies on the model without worrying about how to create the model; in a case like this, your class would refer to the interface and your tests would inject a mocked up model that has no database interaction whatsoever. This is a good way to isolate and test your functionality.
This space for rent
|
|
|
|
|
But in this case those properties in Interface Models are mapped to external database fields either by attribute based mapping(Glass mapper) or by fluent api mapping.
|
|
|
|
|
It doesn't matter. As the code only refers to the interface, you can substitute in any implementation. That's what makes it substitutable and testable.
This space for rent
|
|
|
|
|
So after my last post on this I did some research and now I have a question.
From what I can see the idea is to Hash the password, then store it to the DB. Next, you Hash a string and compare it to the stored value. This is all done on the server where it's most secure.
The part I'm questioning is that it seems that you have to pass the PLAIN TEXT password to the back end to do the comparing.
What's the right way to do this?
Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
If it's a website, then yes, generally it's a plain-text password that gets transferred to the server - which is insecure but then so is sending a hashed password for comparison!
Provided your login page is SHTML so it's via an encrypted connection, that isn't a problem, because the password isn't transfered over the web in clear, so it's difficult if not impossible to set up a man-in-the-middle attack to access the "raw" password.
Once it reaches the server, it gets salted, hashed, and compared.
Sent from my Amstrad PC 1640
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
He could always encrypt the password in order to transfer it, decrypt it after it's transferred, and then hash it to compare with the database content.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Except that means the encryption key needs to be available to the javascript...
Sent from my Amstrad PC 1640
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Joking again?
(That's precisely what HTTPS does.)
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
No, not joking. HTTPS has been proven insecure (there was a big kerfuffle over that realization a couple of years ago), so why solely rely on it? It shouldn't be difficult to set up.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
John Simmons / outlaw programmer wrote: HTTPS has been proven insecure
That's a pretty bold claim. Do you have a link to back that up?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|