|
phil.o wrote: If your software will have to work in environments where you cannot control the NAT configuration, then you will have to rethink the way it works: have each client talk to the server only, and let the server play the role of transmitting messages between clients.
I am trying to make a software like TeamViewer, Ammmy, anydesk and Logmein, need transfer screen image and mouse+key coordinates, doing this the way you said I won't be able to transfer the information fast enough
|
|
|
|
|
Your replies are not logical. Use a server thread and a client thread on each machine.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
This Code is only example not my program, i need just work TCP Punch Hole but i can't.
|
|
|
|
|
im an artist and i code for fun.
I just encounter a strange problem in my code and i had to debug it a lot to find this little bug.
Not a bug per say, but more like my way of using things (probably wrong). But now is an eye opener.
List<string> block = new List<string>();
List<string> temp = new List<string>();
void SomeEvent
{
block.Clear();
block.AddRange(temp);
block = temp;
}
I wanted the text from [temp] list to copy into [block] list.
My usual way of doing it, was as in code2. But it seems is a bad way.
Because when temp is cleared, also the block is cleared, like block is a pointer to the temp.
I only wanted a temporary transfer of data between the 2 lists and not a permanent attachment.
Yah... can you explain the real difference? I had to learn it the hard way i suppose.
|
|
|
|
|
When you do this:
block = temp; you don't copy the elements, you copy the reference.
In other words, you throw away both the existing value in block , and the actual ilist itself.
The AddRange method adds each individual item to the existing collection - if you like, it copies the collection instead of changing the references. Have a look at this: Using struct and class - what's that all about?[^] - it gets a little more advanced than you are asking at the moment, but the early stuff should help.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
The first case deals with items "in the bucket".
In the second, you're replacing the original "block bucket", and pointing it to the same bucket that temp is pointing to.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Perhaps this is poor planing on my part, a bad document model but I thought it was the right way to go. I'm trying to find "US" and "AK" in a collection of Mongo Documents that represent ship rates. I have a collection of Ship Rate documents that look like this.
{
"Carrier" : "USPS",
"US Mail First Class Package",
"Countries" : [
{
"Name" : "United States",
"Abbr" : "US",
"States" : [
"AL",
"AK",
"More states ..."
],
"Name" : "Canada",
"Abbr" : "CA",
"States" : [
"BC",
"ON"
]
}
}
With this code in my repository, I can get all the documents with "US" in countries, but I want to go one step further and qualify the state as well, in case I don't want to ship to Hawaii.
var results = new List<QuotedShipRates>();
var filter1 = Builders<WEBSITE_SHIPSERVICES>.Filter
.ElemMatch(c => c.Countries, c => c.Abbr == countryCode);
var shipRates = await _context.WebsiteShipServices.Find(filter1).ToListAsync();
foreach (var shipRate in shipRates)
{
results.Add(new QuotedShipRates()
{
Name = shipRate.Name,
Code = shipRate.Code,
Rate = 5.99M,
GuaranteedDate = DateTime.Now.AddDays(5)
});
}
I just can't figure out how to get deeper here, to go to the array within the array.
I wanted to make this AsQueryable at first, but couldn't figure out how to write an expression for it.
I'm aware Canada has provinces, and Japan has prefectures, etc. I don't know what else to call states at the moment. LOL
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
That's exactly how to do it. It's an array within an array (or more preferable IMHO, a list within a list). Define your classes, and then use newtonsoft.json to deserialize into your objects.
".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
|
|
|
|
|
Well that was uplifting!
At least I designed my model right.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
This actually worked after modifying the document and taking out Hawaii.
I didn't think of it when I posted the first time, but it makes sense now.
I just appended && c.states.Contains(stateCode) to the filter.
I was hoping my model of states would work as like a continuous string of values.
var results = new List<QuotedShipRates>();
var filter1 = Builders<WEBSITE_SHIPSERVICES>.Filter
.ElemMatch(c => c.Countries, c => c.Abbr == countryCode && c.States.Contains(stateCode));<br />
var shipRates = await _context.WebsiteShipServices.Find(filter1).ToListAsync();
foreach (var shipRate in shipRates)
{
results.Add(new QuotedShipRates()
{
Name = shipRate.Name,
Code = shipRate.Code,
Alias = shipRate.Alias,
Rate = 5.99M,
GuaranteedDate = DateTime.Now.AddDays(shipRate.Days_Max),
Selected = false
});
}
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
|
Please don't repost if your question does not appear immediately: both of these went to moderation and required a human being to review them for publication. In order to prevent you being kicked off as a spammer, both had to be accepted, and then I have to clean up the spares. Have a little patience, please!
I've deleted the spare.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
Hi,
I got issue with reading data with proper encoding from DBF file.
Can you please help me to fix it? I can already read it but I can't find a way how to read the stream and convert it on the fly. All internet findings are not enough for me to adjust my code properly.
Her is the the code I use to read with wrong encoding:
private void WczytajTabeleSubiekta(string nazwaTabeli, string parametr, string parametr2, out DataTable dt)
{
dt = new DataTable();
try
{
OleDbConnection oConn = new OleDbConnection("Provider=VFPOLEDB.1;" + "Data Source=" + subiektPath + @"\DBFS\" + nazwaTabeli + ";Collating Sequence=machine");
oConn.Open();
System.Data.OleDb.OleDbCommand oCmd = oConn.CreateCommand();
oCmd.CommandText = "SELECT " + parametr + " FROM " + subiektPath + @"\DBFS\" + nazwaTabeli + " " + parametr2;
dt.Load(oCmd.ExecuteReader());
oConn.Close();
}
catch (Exception ex)
{
MessageBox.Show("Błąd podczas wczytywania tabeli - " + nazwaTabeli + "\n" + ex.Message.ToString(), "Komunikat");
}
}
|
|
|
|
|
What do you mean by "proper encoding"? Are you getting any errors?
|
|
|
|
|
Thanks for reply. The issue I got is that signs are not printed properly. I assume DBF encoding is in Latin2 (852) and stream converts data into Windows native one. I saw many similar problems where it was stated to read it via bytes[] and then convert to what I need. But as I am not C# proffesional and I am a hobbyst developer I got issue to adjust the code from solutions to my example. Hence I am looking for someone that will help me to write working example within my code of this:
[^]
Can you please help me to catch the data before it will be written into DataTable, encode it with 852 and then write as UTF-8?
|
|
|
|
|
Check out the first three answers here[^].
|
|
|
|
|
I would use some version of SQL Server (Management Studio) to import the DBF, or even into Excel and then export as CSV, etc. Then you can use "native" tools and API's.
That's if you want to skip having to deal with the DBF's directly.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
you will need an event target (e.g. a button), az event list, and events. To solve this problem, create the required data structures for event management, and test every required functionality. For optimal testability, every registered anonymous function must write different text on the console.
Base structure:
Event class, which stores the event function registered by the user (anonymous function). It gives two arguments to the listener function: the event's target (need to use base class, see later), and itself. It stores a public bool member, which if set true, the event chain stops, and further events are not run. This member has a default value of false and can be set from the listener function.
Event list class, which stores events. It can add and remove events. When adding new events, a bool argument defines if the event goes to the beginning or the end of the list. It can run every list in it sequentially with a method, and in the method, it uses a custom iterator for iteration.
Event target class. It has an event list, which gets the event target. It has a method for registering new events.
Button class. Inherits from the event target class. Has a click method, which runs the registered events.
Test cases:
1. Register an event to a new button. See if the button object is available from the event listener function.
2. Register two events to a new button in a way that the events are appended to the end of the list. Register a third event to the beginning of the list. See if they are in correct order.
3. Register three events to a new button. In the second event listener function stop the event chain. Make sure that the third listener function does not run.
|
|
|
|
|
Is there a reason you are posting your homework on the web?
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
Because i want to know how it works. For me it is difficult.
|
|
|
|
|
Life is difficult. The challenge is to use your skills, and learn new ones, to overcome its challenges. Start by reading through the assignment a few times. Make some notes about what specific items need to be addressed, as mentioned in the section headed "Base structure:".
|
|
|
|
|
if i could do it, i would have done it sir.
|
|
|
|
|
Yes, but just dumping your assignment here and saying, "please do my work for me", will not help you move forward. If you do not understand the question, or where to start, then you need to discuss the problem with your teacher. Maybe you missed some lessons, or need some extra teaching.
|
|
|
|
|
please solve it for now for me next time i`m gonna do it by my self
|
|
|
|
|