|
Items like this don't, in my experience, create major design issues. Larger business rules such as (and I'm making this up) "Child record can only be entered if Parent record field 'hasChild' is checked" tend to be what cause more problems from a design perspective if you hard code them. You might later decide you want to determine whether a parent has a child based on whether or not there are actually any child records related to a parent record, so such a validation would be done more at the database level (I hope I'm not being to obscure here).
Simple "sanity checking", so to speak, won't create major design flaws that will cause you to have to start over. You might have to tweak the patterns you are using, but there is not a lot of danger in doing so and will in all liklihood be necessary. In practice I almost always just add the basic validation to both the client and server (or just the form in winforms) without providing some larger design structure for it. That's me though. I'm sure there are other opinions.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
i am trying to build a "missed message" queue on a C# TCP server. many
of the devices connecting are mobile and may drop out in bad signal
areas. i want to store any messages missed for when they reconnect.
so far....it takes activity on the client end to initialize the close.
isnt there a check when the server sends a socket.send to a client that
has lost connection? it takes a few minutes for the exception to get
hit, and i am losing vital time.
is there a way for as soon as the the server attempts Socket.Send it
can tell if the device on the other end still has an active connection?
even Socket.Poll() has quite a delay.
i have been testing with desktops. I connect two workstations to the
server and when i chat back and forth, i unplug one from the network.
it takes at least two minutes for the server to recognize that one
client is disconnected while the still-connected client is sending
messages. it seems they are just going nowhere.
|
|
|
|
|
How about using UDP in some way?, it is a connectionless protocol.
Packages like Symantec pcAnywhere (a remote control/file transfer application) use UDP to moniter the status between connections and TCP for data transfer.
Or alternatively, how about the clients collecting/pulling the messages from the server instead of them being sent/pushed to the client?
Just some ideas.
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog
|
|
|
|
|
i thought UDP doesn't have verification of message arrival. it just sends blindly, right?
the problem with the client pull is that in my scenario, the clients are passive, the server handles all activity...sometimes automatically based on outside forces.
|
|
|
|
|
<quote>it just sends blindly, right?
Yes, thats right. What I was thinking was perhaps the Client could send a UDP datagram to the Server at regular intervals. The Server could listen for the datagram, rather like pinging the server. The server need not send a reply to the client but upon receiving the request, it knows the client is still active.
It could keep the connection alive.
I guess however, it depends on how passive the clients are?
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog
|
|
|
|
|
okay, i'm kind-a new in here, but i have a problem.
the problem is in my webservice, but this is in C#, and the problem is more C# related.
the code below is the code i use, it always return false through the Catch, the Catch sais "No Value given for one or more..." (well i hope you know this exception).
the problem i can't figure out, is why?
if someone can help me i would be very thankful.
yours, NaNg.
<br />
[WebMethod]<br />
public bool AddProject(string ProjName, string ProjID)<br />
{<br />
try<br />
{<br />
objCon.Open();<br />
DataSet ds = new DataSet();<br />
objDA = new OleDbDataAdapter(string.Format("Select Count([SID]) from tblProjects Where SPorjID = '{0}' And SProjName = '{1}'", ProjID, ProjName), objCon);<br />
objDA.Fill(ds, "tblProjects");<br />
if ((int)ds.Tables[0].Rows[0][0] == 0)<br />
{<br />
objCmd = new OleDbCommand(string.Format("Insert into tblProjects(SProjID, SProjName) Values('{0}', '{1}')", ProjID, ProjName), objCon);<br />
objCmd.ExecuteNonQuery();<br />
return true;<br />
}<br />
else<br />
return false;<br />
}<br />
catch (Exception exp)<br />
{<br />
return false;<br />
}<br />
finally<br />
{<br />
objCon.Close();<br />
}<br />
}<br />
|
|
|
|
|
NaNg15241 wrote: the Catch sais "No Value given for one or more..." (well i hope you know this exception).
Um, no. This is pretty much the crux of your problem. You need to provide the complete text of the exception for anyone to be able to help you?
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Hi,
I am encountering problems with clearing the combobox, the first value gets automatically selected. Even though i have set the SelectedIndex to -1 in the load event.
Another problem: I have placed the combobox on a tabpage of a tabcontrol. If I clear the combobox and then swtich tabs the first value again gets automatically selected.
The combobox is bound to string array.
Using .NET v1
It seems like a .NET bug to me. Any help would be appreciated.
Thanks.
|
|
|
|
|
If you haven't already created one, add an event handler to the combobox for SelectedIndexChanged. Then add some dummy code at the beginning of that method and place a break point on the dummy code. Then, when the index changes, the break point will be hit and you can track where it was called from.
Hope that helps.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
I am failing in finding a way to use the new ListView.OwnerDraw=true and render a custom background.
- ListView.BackgroundImage does not work for our needs.
- SetStyle(ControlStyles.UserPaint, true); causes OnPaint and OnPaintBackground to fire *after* OnDrawItem, erasing any custom Item rendering.
Am I missing a way to custom draw a ListView background while using the new-fangled OwnerDraw?
|
|
|
|
|
Q. Unable to get a Profile custom (object) collection to bind to GridView,etc (IList objects)?
This is my first custom object so I may be doing something rather simple, wrong, or it may be something else to do with the Profile object. Either way, I need help
Here's a brief description of the code----------------------------------------------------------------------------------
1) I have a custom object: "School.Teachers" (see below)
2) which is used as a Profile object data type in the web.config file:
<profile defaultProvider="AspNetSqlProfileProvider" >
<properties>
<add name="Teachers"
type="School.Teachers"
allowAnonymous="true"/>
</properties>
</profile>
3) I'm setting the value of a Profile object (ASP.NET 2.0) equal to the custom object:
School.Teachers tlTeachers = new School.Teachers();
tlTeachers.Add(new School.Teacher("Buck"));
Profile.Teachers = tlTeachers;
4) Code like this works:
Label1.Text = Profile.Teachers.Count.ToString(); // The number of items in the profile object
Label1.Text = Profile.Teachers[1].FirstName.ToString(); // The value of an item at a particular index position
5) But this does not:
GridView1.DataSource = Profile["Teachers"]; // Populate the GridView1 from the Profile Object
GridView1.DataBind();
The custom object: "School.Teachers"---------------------------------------------
[Serializable()]
public class Teachers : CollectionBase
{
public Teachers()
{}
public Teacher this[int index]
{
set
{
List[index] = value;
}
get
{
return (Teacher)List[index];
}
}
public int Add(Teacher value)
{
return List.Add(value);
}
public int IndexOf(Teacher value)
{
return List.IndexOf(value);
}
public void Insert(int index, Teacher value)
{
List.Insert(index, value);
}
public void Remove(Teacher value)
{
List.Remove(value);
}
public bool Contains(Teacher value)
{
return List.Contains(value);
}
}
-- modified at 14:35 Friday 10th February, 2006
|
|
|
|
|
Hello,
I have textbox.text = row["TotalArea"].ToString();
In VS 2003, all the trailing zeros were removed, so if the value of the area was 60.0000, then I would see only the value of 60.
However, in VS 2005 the same statement gives 60.0000. Exact value from a server. How can I make sure for all values the zeros are removed.
Thank you.
|
|
|
|
|
Specify the format string you want to use in the .ToString() method.
TextBox.Text = row["TotalArea"].ToString("###.##");
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
But that way if the value has 3 decimal values, it will cut it short.
So I guess what I am asking, how come the same command produces different results in both version of Visual Studio?
|
|
|
|
|
Actually, I'm not getting the results your describing. No matter what I input for a datatype, I'm always getting the trailing zero's removed when .ToString() returns.
You might want to try to force the value to a known type first before calling ToString() on it:
textbox.text = ((float)row["TotalArea"]).ToString();
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Is there some documentation of all available formatting rules? In my opinion MSDN lacks this information, but maybe I'm just blind
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Do you mean this[^]?
Be sure to look at the index on the left side of the page to see additional information. Formatting is a MUCH larger topic than it would appear to be.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
That's a great source, thanks
modified 12-Sep-18 21:01pm.
|
|
|
|
|
How can I make a form ALWAYS topmost regardless if another form within the project has been set to topmost? Thanks in advance.
P
|
|
|
|
|
try adding to your database at your forum-msgs table another field called "Type", you should probably use numbers for this.
when you call for your messages at your page, try putting first the ones with type = 1, and later get the others.
this is a prioraty for your messages, then you can arrange them.
|
|
|
|
|
Ummm....And this has what to do with making a form TopMost???
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hmmm... escuse me for being new here and not knowing **** about anything...
but now i get what he sais... sorry
|
|
|
|
|
So, is there a way to do this?
Thanks
|
|
|
|
|
well... i think that the best solution is that when you show it, you use the command form.showdialog() insted of form.show, this way it won't enable it to go to the last one...
that's the best option that i could think of, i don't think that you can do topmost with some other and not enable it to switch forms... unless...
you can do an event "On leave", and then do a focus command on the form, that way if you leave, it will get focused on the form and wouldn't be able to switch... i think that that would work.
no moer options for me...
good-luck, NaNg
|
|
|
|
|
Thanks for the help guys.
P
|
|
|
|