|
Sorry, I don't know about Mono.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Another question relating this matter.
If the library is running a thread that is using blocking sockets, and the object representing the library has a "Stop" method, how can this be made thread safe? Its kind of like the same question except the other way around.
|
|
|
|
|
Hi,
here are some ideas:
if the thread you want to stop can cooperate, then that is the best way; e.g. have a
bool flag indicating it should stop, and have it periodically test that flag. Maybe
give timeouts to your I/O operations so it will effectively check the flag.
if that is not possible, try sending an interrupt to the thread, which should result
in an interrupt exception, then clean up in the catch block.
if that does not work, you would have to abort the thread, leading to a possible
unknown state of some objects it created, them not being disposed, etc. A possible solution
here is to have two threads, one that creates and manages objects (and does not get aborted),
the second one not creating/disposing but just using those objects; then have the main thread
signal the first thread (again with a bool), and abort the second.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Is there anyway to signal a blocking network operation to continue like you can signal a blocking waitOne() to continue?
|
|
|
|
|
I have a solution that is not particularly elegant but I use it in a speech recognition application I am writing.
My scenario is that I have a keyhook class that listens for a button being pressed.
In the KeyHook class I declare the following at the top of the class.
private static TestApp.MainForm m_InstanceRef = null;
public static TestApp.MainForm InstanceRef
{
get
{
return m_InstanceRef;
}
set
{
m_InstanceRef = value;
}
} Within the main form I call the KeyHook class using the following syntax:
KeyHook.InstanceRef = this;
KeyHook.Listen();
Within the KeyHook class I then run a method when the key that I want is pressed, called EnableCheck(), in the main form thus:
InstanceRef.EnableCheck();
Like you I am a learner with C#, and hopefully will always be one, and feel a more elegant solution would be to throw an event that could be picked up by the main form.
This way of doing things breaks the rules of OOP but it works.
Regards
Guy
You always pass failure on the way to success.
|
|
|
|
|
Hi,
is it possible that I can use the Excel Chart Object from Office 2002
in my C# application as embedded or so but not as excel application only Chart object from it.
thx in advance
|
|
|
|
|
It should be. Google might help out.
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
Hi
I've got a problem with some security-settings while remoting with TcpChannels.
I've got a server and client. When the connection is estabilished and the client tries to run a method that is going to the server, the client throws the following exception:
************** Exception Text **************
System.Security.Authentication.AuthenticationException: A remote side security requirement was not fulfilled during authentication. Try increasing the ProtectionLevel and/or ImpersonationLevel. ---> System.ComponentModel.Win32Exception: The network logon failed
--- End of inner exception stack trace ---
Server stack trace:
at System.Net.Security.NegoState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.NegotiateStream.AuthenticateAsClient(NetworkCredential credential, String targetName, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel allowedImpersonationLevel)
at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.CreateAuthenticatedStream(Stream netStream, String machinePortAndSid)
at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.CreateSocketHandler(Socket socket, SocketCache socketCache, String machinePortAndSid)
at System.Runtime.Remoting.Channels.SocketCache.CreateSocketHandler(Socket socket, String machineAndPort)
at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket(EndPoint ipEndPoint)
at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket()
at System.Runtime.Remoting.Channels.SocketCache.GetSocket(String machinePortAndSid, Boolean openNew)
at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWithRetry(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream)
at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ITransportHeaders& responseHeaders, Stream& responseStream)
at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Interface.IServer.test(String msg, IClient cO)
at Client.Form1.btnSend_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Client
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Documents%20and%20Settings/Administrator/Desktop/Neuer%20Ordner/Client.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Runtime.Remoting
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
Interface
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Documents%20and%20Settings/Administrator/Desktop/Neuer%20Ordner/Interface.DLL
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
I created the following solution, that will be the network-engine for some projects (yes, there is a socket-connection too in that solution):
http://www.krifi-ware.de/ngame/networkengine.zip
There error only occurs, when the client is on a different machine than the server.
When server and client are running on the same machine, the error only occurs, when you are using an external IP (at my machine the Local-LAN IP and localhost (127.0.0.1) are working and the hamachi-IP (a VPN) is like the client is on an external machine).
|
|
|
|
|
Difference between two dates .(MM/DD/YY)
One date is given through Textbox are in the same format as System date.
Other is just system date .
I want to get date,month,year differences
|
|
|
|
|
The right way to do this is by converting to two DateTime objects, then apply
whatever it is you need, e.g. subtract to get a TimeSpan.
You should not operate on date strings yourself, use TryParse() instead.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
What Luc said, plus:
Don't use TextBoxes for dates, use a DateTimePicker.
Use ISO 8601-compliant formats -- YYYY-MM-DD.
|
|
|
|
|
I'm trying to BitBlt a portion of an image to another but all I get is the background color of the source bmp! Any ideas?
may your code be error free.
(okay, maybe two lines.)
|
|
|
|
|
The code that you have written is incorrect.
If you show the code, you may have a chance of getting a more specific analysis.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
I have had this happen to me when I use the WinAPI BitBlt method. What I had to do is make a call to CreateCompatibleDC[^], then copy the bitmap to that DC, and finally use BitBlt from the resulting DC. Without seeing any of your code, I have NO idea if this will help, but my guess is that it might.
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Hello,
anyone knows if there is a configuration framework available which provides saving of configuration and edit the configuration in an graphical editor..
Best regards
Hansjörg
|
|
|
|
|
|
Hello,
I search some configuration framework with which I can make application configuration. Edit inside the application, load and save a new configuration. The property grid is for sure usefull to make such a framework, but it is only a part of it...
Til now I have found NINI which looks good. But it provides only to part of saving and loading...I search also the part of the graphical representation of the configuration data.
Best regards
Hansjörg
|
|
|
|
|
How do I go about getting 24bit audio to play using directSound? 8 and 16 bit audio plays fine, but when ever I go to play 24 bit audio, my program throws an 'Value does not fall within the expected range.' exception on:
sound = new SecondaryBuffer(dataGridResults.CurrentRow.Cells[3].Value.ToString(), d, dSound);
The creation and initialization:
private Device dSound;<br />
private SecondaryBuffer sound;<br />
private BufferDescription d = new BufferDescription();<br />
<br />
dSound = new Device();<br />
dSound.SetCooperativeLevel(this, CooperativeLevel.Priority);<br />
d.LocateInHardware = true;<br />
<br />
d.ControlPan = true;<br />
d.ControlVolume = true;<br />
d.ControlFrequency = true;<br />
d.ControlEffects = true;<br />
d.GlobalFocus = true;<br />
How do I fix this?
|
|
|
|
|
Is the file a Wav or an MP3?
|
|
|
|
|
The file is a wav recorded at 44100.
|
|
|
|
|
I remember reading something about this a loooooooong time ago, but I can't remember what and I can't for the life of me remember where. Bear with me while I try and see if I can dig it up.
One other question, does the DirectX sample application (included with the DX SDK) do the same thing when you try and play the file?
|
|
|
|
|
Thanks for any help you can give.
I tried the file in several of the sample applications, and they all give 'File to large. You should stream large files'. However, I get this message even with files that play correctly in my app.
|
|
|
|
|
I'm running into exactly the same problem here and I haven't worked it out yet.
Did you get anywhere with this?
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
I created a brand new project and open clissview diagram window. Then i added 2 class Person and Employee i want to add the inhertiance line to show the relationship but visual studio doesn't let me to drag and drop the inhertance symbol from the toolbox window.
I know If i create these two classes then i will automatically but i want to create class diagram first then actually creating classes.
Any help thanks
|
|
|
|
|
Don't drag and drop it, just click the inheritance tool and your cursor will now change on the designer. You then click on the child class and you will see a line start to draw. You finally click on your base class and the inheritance has thus been completed.
Hope that helped.
Also, quick question. Shouldn't the employee just be an enum of PersonType?
|
|
|
|