|
K.Bharathidhasan wrote: gridview conrol coding in asp.net c#
Yes I am sure that you can do that if you just give it a try. In the future, please try and create a meaningful title for your posting as "c#" is not very descriptive of your question, if indeed you meant to ask some sort of a question.
|
|
|
|
|
MSDN[^]
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
Hi,
i want to store the webservice method's XML output[the one which we get after invoking the webservice method]. Below is the code which am using and the output that am getting after executing it. Please help to get sort of this....
code:
After adding web reference that consists of webservice URL am using the below code.
WindowsService.webservice ody = new WindowsService.webservice ();
try
{
ody.PreAuthenticate = true;
ody.Credentials = new System.Net.NetworkCredential("login", "Password", "Domain");
Logfile(ody.Reconfigure(1).ToString());
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
output as in log file:
OdyTibWinService.OdyTibWebService.OUT_Reconfigure
But the actual XML output is:
<message>Reconfiguration completed successfully.
|
|
|
|
|
Logfile(ody.Reconfigure(1).ToString());
That would call the "ToString" method on a "Reconfigure" item, of the class called "OUT_Reconfigure".
Member 9826281 wrote: But the actual XML output is:
<message>Reconfiguration completed successfully.
Implement a function in that class to return the "actual content". Might be that it's already implemented. Change the code to look like below;
Logfile(ody.Reconfigure(1).); Now remove the dot (the one on the far-right), and type it in again. Check the list; there should be a description popping up as you hover the items.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Member 9826281 wrote: But the actual XML output is:
<message>Reconfiguration completed successfully.
Well since that is not XML that certainly isn't the output.
|
|
|
|
|
Hi everybody,
my application is written in VB.NET using Visual Studio 2008 and it runs an a Windows CE device, so it uses Compact Framework.
I need to avoid multiple instances of the application and I don't know how to do it.
I have found some solutions but only for the full framework, not for the compact.
Other solutions to this problem talk about mutex: when the application start I should create a mutex if this is the first instance of the application or stop the application if the mutex already exists (or something like this)... but I don't know how to do this.
Can someone help me?
Thanks in advance
|
|
|
|
|
steve_9496613 wrote: but I don't know how to do this.
Would require some P/Invokes as described on SO[^]. Also check out the alternative file-lock.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi Eddy!
Searching again I found some code about mutex and with little changes it seems to work.
I wrote (copy/past + some changes...) a class SingleInstanceApplication:
Imports System.Reflection
Imports System.Runtime.InteropServices
Public Class SingleInstanceApplication
<DllImport("Coredll.dll", SetLastError:=True)> _
Public Shared Function CreateMutex(ByVal Attr As IntPtr, ByVal Own As Boolean, ByVal Name As String) As IntPtr
End Function
<DllImport("Coredll.dll", SetLastError:=True)> _
Public Shared Function ReleaseMutex(ByVal hMutex As IntPtr) As Boolean
End Function
Const ERROR_ALREADY_EXISTS As Long = 183
Public Shared Sub Run(ByVal frm As Form)
Dim name As String = Assembly.GetExecutingAssembly().GetName().Name
Dim mutexHandle As IntPtr = CreateMutex(IntPtr.Zero, True, name)
Dim Rerror As Long = Marshal.GetLastWin32Error()
If (Not Rerror = ERROR_ALREADY_EXISTS) Then
Application.Run(frm)
End If
ReleaseMutex(mutexHandle)
End Sub
End Class
then I wrote a class to start the application:
Public Class StartApp
Public Shared Sub main()
Try
SingleInstanceApplication.Run(FormMain)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
End Class
finally I modified the start object of the application from "FormMain" (the main form of the application) to "StartApp".
It works!
Thanks.
|
|
|
|
|
Nice, you're welcome
|
|
|
|
|
Sorry for the cross post but this doesn't fit neatly into Silverlight/WPF!
I am asking this in the WPF forum because this is a WPF app but this question does not necessarily pertain to WPF, i.e. the UI thread.
Here is the scenario:
I have three (3) threads. Thread One (1) call it the Master Thread; Thread Two (2) is a Ethernet Comm thread; and Thread Three (3) is a GPIB comm thread. Both communication threads handle asynchronous communications from remote entities. At this time there is only one entity hanging off each comm type.
I have implemented a mix of EventWaitHandles and delegates. This all works pretty well. Just think this architecture is a bit ...... ugly. So which one is better/safer?
My concern is as follows. With delegates, for example, the Master thread registers an event handler with Thread 2 and an event handler with Thread 3 for messages that come in. Obviously data could come in near simultaneously. So Thread 2 encases a message in an EventArg and invokes the event on the Master thread. The Master Thread begins processing and then Thread 3 encases its message in an EventArg and invokes the event on the Master Thread. What happens? Does the Master Thread stop in the middle of handling the first event to service the second one? Does the second event wait until the first event is processed? What if Thread 2 gets another message and invokes the event again while the Master is processing the first event?
I wonder if using a queue and an manual Reset EventWaitHandle is not a better idea as the Thread 2 can check the status and wait until it is reset before putting the message in the queue and setting the EventWaitHandle again.
Opinions, please?
Thanks,
Doug
I am a Traveler
of both Time and Space
|
|
|
|
|
I have a similar case: multiple threads accessing temperature controllers over a serial port; a temperature charting thread; another handling user interaction.
When I need to access a shared resource (like the serial port), I’ve been using a C# “lock” at the appropriate point to block a competing thread.
It’s been working well and does not require the threads to do anything “special” (other than insure all requests are short in duration so as not to tie up any one thread for an extended amount of time).
|
|
|
|
|
Good solution! I am using that in a couple of places and that helps. More I am trying to avoid a mix of EventWaitHandles and delegate/event handlers. I think this is a bit "messy" looking. But with schedule tight sometimes you just have to do what you have to do
Doug
I am a Traveler
of both Time and Space
|
|
|
|
|
OK, I cannot get my head around the whether there is a difference between the 'classic' (perhaps long winded) way of doing it, multiple classes and the 'new' Yield route to (apparently) the same end.
I can understand the classic route (I think), see the code below.
Yield confuses the heck out of me, if I understand it correctly then it's absolutely genius, I get the idea of a state machine (I think) and logically it sort of makes sense but I am not at all confident.
Can it possibly be this simple? You just make that one method as simple or complex as necessary for your situation?
(Warning, silly example since arrays can already be enumerated, but it's easy to demo)
Public Class YieldExample
Implements IEnumerable
Private _Thing As Double()
Public Iterator Function GetEnumerator() As IEnumerator Implements IEnumerable.GetEnumerator
If IsNothing(Me._Thing) Then
Throw New InvalidOperationException()
End If
For Index As Integer = 0 To Me._Thing.GetUpperBound(0)
Yield Me._Thing(Index)
Next
End Function
End Class
What I understand to be the 'old way'.
Public Class ExampleEnumerable
Implements IEnumerable(Of Double)
Private _Thing As Double()
Public Function GetEnumerator() As IEnumerator(Of Double) Implements IEnumerable(Of Double).GetEnumerator
Return New ExampleEnumerator(Me._Thing)
End Function
Public Function GetEnumerator1() As IEnumerator Implements IEnumerable.GetEnumerator
Return Me.GetEnumerator
End Function
End Class
Public Class ExampleEnumerator
Implements IEnumerator(Of Double)
Private _Thing As Double()
Private _Index As Integer
Private _curItem As Double
Public Sub New(ByVal Thing As Double())
Me._Thing = Thing
Me._Index = -1
Me._curItem = Nothing
End Sub
Public ReadOnly Property Current As Double Implements IEnumerator(Of Double).Current
Get
If IsNothing(Me._curItem) Then
Throw New InvalidOperationException()
End If
Return Me._curItem
End Get
End Property
Public ReadOnly Property Current1 As Object Implements IEnumerator.Current
Get
Return Me.Current
End Get
End Property
Public Function MoveNext() As Boolean Implements IEnumerator.MoveNext
If Me._Index = Me._Thing.GetUpperBound(0) Then
Return False
End If
Me._Index += 1
Me._curItem = Me._Thing(Me._Index)
Return True
End Function
Public Sub Reset() Implements IEnumerator.Reset
Me._Index = -1
Me._curItem = Nothing
End Sub
#Region "IDisposable Support"
End Class
Thanks,
Mike
|
|
|
|
|
Dear Mike,
I realise this is a late answer, so maybe you've already figured this out. But maybe it's still worth something, so here goes:
I think the short answer is that Yield is absolutely genius. The 'classic' way as you put it actually is the same implementation over and over again, where only the return value varies. What yield does for you is that it allows you to construct an IEnumerable directly from a function (using Yield statements), such that every time MoveNext() is called, the function takes off where it left off until the next Yield statement.
So, yes, you can just use yield whenever you want I think the only possible issue with it is that it's probably slower than a proper custom ('classic') implementation, so if you have A LOT of elements AND you notice a performance bottleneck in enumeration THEN you might consider getting your hands dirty.
Best regards,
Richard
|
|
|
|
|
Thank you
Appreciated whatever the timing
|
|
|
|
|
|
Your question is to vague. Please explain a bit more.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
ho ho ho!!
|
|
|
|
|
Based on your pretty vague question but the key words, following should give you some idea:
http://en.wikipedia.org/wiki/Managed_code[^]
Steps in managed execution process:
1. Choose Compiler
2. Convert the source code to MSIL
3. Convert MSIL to Native code using JIT.
4. Executing code and various services.
|
|
|
|
|
i want code for dis project
how to get it
|
|
|
|
|
Read this[^]. Point #2 specially.
Best wishes,
Navaneeth
|
|
|
|
|
It does not work like this here.
Here is what is expected of enquirers:
1. TRY first what you want to do! You may find that it's not that hard.
2. Formulate what was done by you that looks like an issue/not working.
Try them and tell if you face issues.
Members will be more than happy to help like this.
|
|
|
|
|
You can start learning a programming language by reading a book.
|
|
|
|
|
krish8888 wrote:
i want code for dis project how to
get it
You "get it" by writing it yourself. There is no other way that is acceptable in research.
|
|
|
|