|
My god. I am poor in C++.
|
|
|
|
|
I have a Software Program from a MICROS Server that can send via TCP or Serial Port. I have another application on another server that sends and receives data from the MICROS Server through a physical null modem cable on Serial port COM2. I am virtualizing the MICROS Server and that does away with the Serial Port communication. I can't change the Server that receives the data from a Serial Port. So, does anyone have a solution to send from the MICROS Server through TCP to the second server and be able to pass that down to COM2 and be able to have COM2 respond back through the TCP port back to the MICROS Server without having a physical cable? Any code support would be greatly appreciated.
|
|
|
|
|
Why are your attempting to create your API at the TCP level rather than just create a Send/Receive API and let the API internals deal with the communication?
|
|
|
|
|
I might have not explained it correctly. I have been asked to Virtualize a Microsoft Server which runs an application Server Software called MICROS. MICROS is used as the back end for POS Systems. When MICROS gets a transaction, it can send that transaction out through TCP or Serial Port. There is another Server that is connected to the MICROS Server via null modem cable. Since we are virtualizing the MICROS Server on a Windows 2008 R2 Server, we can not get the Serial Port to pass through from the Virtual Host because Microsoft no longer supports passing through Serial Ports from the Virtual Host to the Virtual Session. I am looking to create a C# Application to take the place of communicating on both sides because the null modem cable can not be used. The Server that receives data and sends data back to the MICROS Server is an old outdated piece of software that I can't change right now because there is no newer version. It is a DOS Application. So, I am looking for a way to pass Serial to Serial through Named Pipes, Serial to TCP, or any other method. If the receiving Server was able to send and receive via TCP then this wouldn't be an issue. My client is pushing me to make it happen.
Thanks!
|
|
|
|
|
Unless I'm mistaken you are looking for this:
http://www.eterlogic.com/Products.VSPE.html[^]
I used the free variant and it works perfectly fine. You can create any number of serial ports and connect them virtually on the same machine or remotely over tcp/ip. You can also create gateways and bridges. Very neat.
I guess you have buy it, the server variant is not free.
|
|
|
|
|
hello, how can i index my files form my system and then use that index for fast searching in c#. for desktop search engine
|
|
|
|
|
Start here[^]. You might also search this site to see if there any articles that might be useful.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
Hey
I get results from an searchengine that i need to split into pieces. The structure looks like this:
[ // begining of file
{ // struct 1
"name1":"value1",
"name2":"value2",
"name3":"value3",
"name4":"value4",
"name5":"value5",
"name6":"value6",
"name7":"value7",
"name8":"value8",
},
{ // struct 2
"name1":"value1",
"name2":"value2",
"name3":"value3",
"name4":"value4",
"name5":"value5",
"name6":"value6",
"name7":"value7",
"name8":"value8",
},
] // end of file
In plain text it looks. Like this:
[{"name1":"value1","name2":"value2","name3":"value3","name4":"value4","name5":"value5","name6":"value6","name7":"value7","name8":"value8"},
{"name1":"value1","name2":"value2","name3":"value3","name4":"value4","name5":"value5","name6":"value6","name7":"value7","name8":"value8"}]
I don't understand how to split this in parts. What I done is this:
\[(?<text_between_brackets>.*?)\]
But that only gives me the text between [ ] so how do i add commands for splitting { } and : ?
I want each structure with values, I don't care for the names.
Thanks
|
|
|
|
|
That appears to be a JSON formatted response. You just need a JSON library to parse it for you. Try this[^].
|
|
|
|
|
Why not use the JSON deserializer built into .NET?
|
|
|
|
|
You could.
I'm just partial to the NewtonSoft library because I found it easier, much faster, more capable and reliable.
|
|
|
|
|
Thanks. Didn't know it was JSON.
But how do you use regex for a task like this?
modified 13-Mar-13 18:07pm.
|
|
|
|
|
I'm trying to override those operators:
==, !=, <, >, <=, >=, <<, >>
...but VS10 give me this error:
Overloadable unary operator expected
Is there some special conditions to make this work..? Cause those operators are overloadable...
|
|
|
|
|
Those are binary operators.
MSDN[^]
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
...and..? On MSDN they are overloadable...
|
|
|
|
|
They're also overridable in your code. Did you check the example? There's a link at the bottom of the page.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
And we'd need to see your code where you're overloading these operators to tell you what you're doing wrong.
|
|
|
|
|
|
As Eddy states, those aren't Unary operators. This would indicate that these aren't the ones that are causing you problems. Could you post a sample that shows the code that the compiler is complaining about?
|
|
|
|
|
OK, thanks guys for the links, but I've already seen this. Problem is that I'm trying to convert simple class from C++ to CS. Here is the code:
class SOME_API SomeClass
{
public:
bool operator==( const SomeClass& Other ) const
{
return Index == Other.Index;
}
bool operator!=( const SomeClass& Other ) const
{
return Index != Other.Index;
}
private:
int Index;
};
Is there any chance to convert this to CS without writing a bunch of code?
|
|
|
|
|
A rough untested example of how I do this for a class (it's much simpler for a struct as it can never be null ):
public class SomeClass : IEquatable<SomeClass>
{
private int index;
public SomeClass(int index)
{
this.index = index;
}
public static bool operator ==(SomeClass instance, SomeClass other)
{
if(object.ReferenceEquals(instance, other))
return true;
if(object.ReferenceEquals(null, instance) || object.ReferenceEquals(null, other))
return false;
return instance.index == other.index;
}
public static bool operator !=(SomeClass instance, SomeClass other)
{
return !(instance == other);
}
public int Index
{
get { return index; }
}
public override bool Equals(object obj)
{
return Equals(obj as SomeClass);
}
public bool Equals(SomeClass other)
{
if(object.ReferenceEquals(null, other))
return false;
return index.Equals(other.index);
}
public override int GetHashCode()
{
return index;
}
}
And a struct:
public struct SomeStruct : IEquatable<SomeStruct>
{
private int index;
public SomeStruct(int index)
{
this.index = index;
}
public static bool operator ==(SomeStruct instance, SomeStruct other)
{
return instance.index == other.index;
}
public static bool operator !=(SomeStruct instance, SomeStruct other)
{
return !(instance == other);
}
public int Index
{
get { return index; }
}
public override bool Equals(object obj)
{
if(obj is SomeStruct)
return Equals((SomeStruct)obj);
return false;
}
public bool Equals(SomeStruct other)
{
return index.Equals(other.index);
}
public override int GetHashCode()
{
return index;
}
}
|
|
|
|
|
Unary operators require one parameter, so it's assuming that the operator should be a unary one as you are only supplying one parameter.
The operators you have listed are binary operators, so require two parameters.
See my example in my other post and my article An Introduction to Operator Overloading in C#[^]
|
|
|
|
|
Thanks for the snippets DaveyM69 - I've ended up with something similar. For now, to compare I'm using GetIndex(), but my converted code is constantly growing. Didn't know that CS is so much more complicated...
Thanks again...
|
|
|
|
|
I don't believe C# is much more complicated with this; I think the real difference is that you'd typically let the overloaded operators be member functions in C++ and C# wants them to be static functions. So if you rewrite your C++ code to the static overloading, then you're already having the same code in C# and C++.
|
|
|
|
|
Is that possible to open two mdi parent form in one(same) mdi container???? And if yes then how????
Please Give me the answer.......
|
|
|
|