|
Could you give me some example to do this using regular expression?
thanks
|
|
|
|
|
Hello everyone, I am a beginner at C#. My problem is as follows:
1. I am coding a server app running on a single proxy server.
2. We have got a client app on each client machine which pings the server (using UDP)
3. For the first ping, server app creates a new entry in the existing linked list (using IPAdress)
4. For each such entry, it starts a timer (should run for 60 sec.)
5. If any client app pings again within 60 secs, its timer should be reset. Timer Code should be non blocking.
6. If timer expires, corrosponding IPAddress Node should be removed from Linked List.
How do I implement this specific timer functionality? I will have to start 100 timers for 100 clients! And that too, each timer should have its own identity... IPAdress!
Please help. Waiting anxiously for reply.
Thank you.
|
|
|
|
|
I wouldn't. I would prefer a database, but a Dictionary would work too.
On each ping, I'd update the database or Dictionary for the pinger with the current time. Then periodically, enumerate the list, removing any entries where the time is expired.
|
|
|
|
|
But if I use a dictionary/database, how do I decrement the timer for each entry after each second? Since, in general, the number of entries may be large, how do I ensure that the decrement of the first entry and the last entry takes place within that same second?
|
|
|
|
|
You don't, you simply compare the time of the last ping with the current time and remove any entries that are older than some threshold.
|
|
|
|
|
I am relatively new to design patterns and LINQ to SQL and have come across a bit of a bump, mainly due to a lack of understanding on my part.
The situation i have setup at the moment is i am using DDD and so have my Domain/Model layer with all my domain objects contained therein, and my Infrastructure layer where i am trying to implement the Respoitory pattern. In my database i have tables such as BATCH, SITE and COMPANY, with BATCH having columns such as SiteID and OwnerID which are GUID types related to the ID's columns of the SITE and COMPANY tables respectively.
I have:
public interface IRepository < t >
{
IList < t > GetAll();
T FindBy(object key);
void Add(T item);
void Remove(T item);
}
public class BatchRepository : IRepository<batch>
{
...
}
</batch>
What would be the best way to go about pulling a more rich set of information than just the Batch object with only GUID data?
Previously, i would of used a SQL query that used JOIN to get the Company.CompanyName using Batch.OwnerId etc...
But now, the Repository returns only the plain BATCH object from the database, and obviously then iterating through each of these Batch objects and querying the DB AGAIN for the OwnerName, SiteName etc based on the Batch.OwnerId , Batch.SiteId data is wasteful...
Should i be creating additional domain layer objects such as BatchResult that has a more rich set of data properties and making the repository return that type instead?
Thanks in advance for patience with my ignorance
modified on Monday, February 9, 2009 10:51 PM
|
|
|
|
|
I am reading a table in from one access Database and storing it in a DataTable(or DataSet if easier)
I then want to update an empty table in another database with the data in the DataTable.
the two tables have the same fields
I know I can read the DataTable row by row and add the data to the 2nd database but I am wondering if there is an easier shorter way.
here is the code I am currently working on, (not sure that it will work all of the DataTable/DataSet examples I have found only are working with pulling data and updating from a single database.
DataTable HashTable = new DataTable();
Classes.SeedsDB seed = new Classes.SeedsDB();
seed.GetHashTable(ref seedDBPath, ref HashTable); //Opens 1st Database and stores the Table in HashTable
OleDbDataAdapter Adapter = new OleDbDataAdapter("SELECT * FROM BadHashTable",MAconn);
OpenAccessDB(); //Opens 2nd Database holds connection string that works in other Methods in the class
OleDbCommandBuilder Cmdbld = new OleDbCommandBuilder(OSAppsAdapter);
Adapter.Update(HashTable);
CloseAccessDB();
|
|
|
|
|
I prefer to just use a DataReader to read from one and copy to another.
Simply using the Update won't work, as you've found. The rows have the wrong status for that, you'd have to change their status. It's kind of the opposite of AcceptChanges. I'm not sure you can, I haven't tried it. I'll have a quick look.
[Later] See
DataRow.SetAdded Method
Changes the Rowstate() of a DataRow to Added.
modified on Monday, February 9, 2009 11:45 PM
|
|
|
|
|
Thanks for the help I ended up using the DataTableReader and got it working.
|
|
|
|
|
I'm working on a system that has two servers. Server A is the remoting client to server B which is the remoting server. Server A has two nics where nic A is on one network (ie 198.168.x.x) and nic B is on another network (ie 10.x.x.x). Server A is connected to Server B on the 10.x.x.x network.
The problem we are having is that Server A has a hard time establishing a connection with the remoting server. It seems that the client can't figure out which network card to use. When we disable the nic on the 198.168.x.x network, we have no problems establishing a connection to the remoting server.
I've read articles about setting the "bind to" attribute but this seems to be only for the remoting server.
Does anyone have any suggestions?
Thanks,
Omar
|
|
|
|
|
I need to use a WebBrowser in ASP.NET.Vui to show me!
|
|
|
|
|
|
You know the only help me, why me again review the question of me.You do not understand the content I will describe the requirements more clearly
|
|
|
|
|
Yes please. Your question is not clear.
|
|
|
|
|
nice one
|
|
|
|
|
I thought it was the other way around.
|
|
|
|
|
Since Visual Studio for Applications is now considered obsolete, what replacements are people now using for adding scripting to their application?? I'm not interested in VSTA due to the licensing fees and I wonder if there is anything out there that is better than CodeDOM? I'm looking for a scripting language that very similar to C or Basic in syntax.
If it matters, my application is .NET 2.0
I'd appreciate any insights, thanks.
modified 12-Jul-20 21:01pm.
|
|
|
|
|
string strInput= "plotno 55,xx street,yy city";
char[] delimiters = { ',', '#', ';', ' ', '/', '\0', '&', '-' };
string[] strTemp = strInput.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
foreach (string a in strTemp)
{
Console.WriteLine(" token'd string is\t{0}\t", a);
the ouput of the above code is
token'd string is plotno
token'd string is 55
token'd string is xx
token'd string is street
token'd string is yy
token'd string is city
it doesnt takes the specified delimiters as a token..... how to tokenenize icluding delimiters...
thanks
the quieter u become more u hear
|
|
|
|
|
Use a Regular Expression instead.
|
|
|
|
|
but input will be from array list...
is it possible to pass array list as input to regex
the quieter u become more u hear
|
|
|
|
|
Have you tried Regex.Split ?
With the input pattern like "(,)|(#)|(;)|( )|(/)|(&)|(-)"
string pattern = "(,)|(#)|(;)|( )|(/)|(&)|(-)";
string[] splitOutput = Regex.Split(input, pattern);
(the option for ; in the pattern is replaced by the smiley in the post )
|
|
|
|
|
in the example which you have provided, the string has been split based on your delimiters i.e. ',' and ' '. Do you want the delimiters also to appear in the output ?
|
|
|
|
|
hmmm. yes .. can u help me
the quieter u become more u hear
|
|
|
|
|
Hello,
I am working on an SDK that we are currently using internally. We plan to release it as a product eventually. I have been looking for a tool that would compare the public API of two different versions of the SDK so I can verify that what was changed in the interface is what we intended to change. I am particularly interested in breaking changes. I have attempted to use LibCheck on one of our assemblies (the one that only has dependencies on .Net) and I get an error loading the assembly. I have verified that the assembly has no dependencies except on .Net itself. Not sure why I would be getting this error.
So have you successfully used LibCheck? Do you know of another tool I could use to compare the public APIs of two different versions of my SDK?
Pat O
Tanks for your support
Pat O
<a href="http://currentchaos.blogspot.com/">Blog</a>
_ _ _
|
|
|
|
|