Hope u can get from the following resources. http://en.csharp-online.net/Delegates_and_Events%E2%80%94Retrieving_Values_from_Multicast_Delegates[^] http://msdn.microsoft.com/en-us/vcsharp/bb508935.aspx[^] Regards
vivasaayi
Posts
-
Multidelegate with a returned value -
Request.BeginGetResponse probem in Windows 7 and unexpected Blocking behaviourHello Readers, I found the solution for the problem I mentioned. Just add to lines of Code to modify the properties of request object. Delay in the in the initial call is reduced by setting the Proxy as null. This happened in all versions of windows.
request.Proxy = null;
Also, In Windows 7, If I send 10 requests, I am only getting 5 or 6 responses. By setting KeepAlive property to false, I am getting all responses.
request.KeepAlive = true;
Hope this helps someone! Happy Coding...
-
Request.BeginGetResponse probem in Windows 7 and unexpected Blocking behaviourHello Readers, I am downloading a Html File using the following method.
public void LoadInitialData()
{
HttpWebRequest request = null;try { Stopwatch sw = new Stopwatch(); RaiseStateChangedEvent(10, "Creating Connection to Server"); request = (HttpWebRequest)(WebRequest.Create(this.\_ServerUrl)); RaiseStateChangedEvent(20, "Connected to Server"); int timeout = request.Timeout; if (request != null) { try { sw.Start(); request.BeginGetResponse(HttpRequestCallBackMethod, request); sw.Stop(); RaiseStateChangedEvent(40, "Waiting for Data from Server --Time Taken: " + sw.ElapsedMilliseconds); } catch (Exception ex) { if (onErrorOccured != null) onErrorOccured(ex.Message + "\\n" + ex.StackTrace); } } } catch (Exception ex) { if (onErrorOccured != null) onErrorOccured(ex.Message + "\\n" + ex.StackTrace); } } private void HttpRequestCallBackMethod(IAsyncResult iar) { RaiseStateChangedEvent(70, "Data Received From Server"); HttpWebRequest myHttpWebRequest = iar.AsyncState as HttpWebRequest; HttpWebResponse response = (HttpWebResponse)myHttpWebRequest.EndGetResponse(iar); using (StreamReader input = new StreamReader(response.GetResponseStream())) { string data = input.ReadToEnd(); RaiseStateChangedEvent(80, "Processing received Data"); ProcessData(data); RaiseStateChangedEvent(100, "Completed Loading Initial Data"); } } private void RaiseStateChangedEvent(int progress, string message) { if (onStateChanged != null) onStateChanged.Invoke(progress, message); } private void ProcessData(string data) { Console.WriteLine("Download Completed - Do any Processing here"); }
The program is written in .Net 2.0. When I try to run the same in Windows 7, I am not successful. I
-
Which ones are free databases?Instead of asking in different forums in Code Project you could have performed a google search...
-
Which ones are free databases?Try the following databases. Small and Fast. http://www.db4o.com[^] http://sqlite.phxsoftware.com/[^]
-
regex helpThe string you presented is a valid XML (root element is missing). If performance is not an issue, first add a root element and then you can use XmlDocument or XmlReader to extract the information you needed.
-
help for j2me to read /write ms word file in java mobileHi, It possible to read/write Word/Excel/Pdf files. I dont know whether there is any libraries available to read and write Word/Excel/files using J2ME. If you are familiar with the file structures of Word/Excel/PDF, you can create your own for J2ME.
-
XML With C#class Program
{
class Sample
{
public Sample()
{
string xmlString = "<xml><item>a<!--Item A--></item><item>b<!--Item B--></item><item>b<!--Item C--></item></xml>";XmlDocument document = new XmlDocument(); document.LoadXml(xmlString); //Navigate throgh all the nodes and check if a node is a comment Console.WriteLine("Method 1"); XmlNodeList nodes = document.SelectNodes("xml/item"); foreach (XmlNode childnode in nodes) { if (childnode.LastChild.NodeType == XmlNodeType.Comment) { Console.WriteLine(childnode.LastChild.InnerText); } } //Using Exact XQuery Console.WriteLine("\\n\\nMethod 2"); nodes = document.SelectNodes("xml/item/comment()"); foreach (XmlNode childnode in nodes) { Console.WriteLine(childnode.InnerText); } } } static void Main(string\[\] args) { Sample sample = new Sample(); Console.ReadLine(); }
}
Hope it helps!
-
XML opening with IEDo you have Zone Alarm installed? Check this out. Hope it solves. http://www.pcreview.co.uk/forums/thread-106850.php[^]
-
Accessing Database Using BluetoothI am using Nokia 3110c. It is having inbuilt Buetooth. So I am using only Bluetooth. No Wi-Fi. I am not able to tell which is better, because till now I have not used Wi-Fi. I hope Wi-Fi is better in terms of Performance with inreased cost and less secure. http://www.diffen.com/difference/Bluetooth_vs_Wifi[^] http://techupdate.zdnet.com/techupdate/stories/main/0,14179,2868374,00.html[^]
-
Accessing Database Using BluetoothI found the following few links. Google and find more. http://msdn.microsoft.com/en-us/library/aa362932(VS.85).aspx http://www.gatefold.co.uk/obex/ http://www.ibm.com/developerworks/wireless/library/wi-boogie1/ http://www.programmersheaven.com/2/Transferring-Files-and-Monitoring-Bluetooth-Ports http://www.codeproject.com/KB/mobile/ObeXplorer.aspx http://www.experts-exchange.com/Programming/Wireless\_Programming/Bluetooth/Q\_21670966.html I am not able presently to give you a working code. I hope the links will help Regards
-
Accessing Database Using BluetoothYes, You create a Bluetooth Server in the Laptop. Then implement the mobile client. All the hard part is in the Bluetooth server
-
Application State object is destroyed - Dont know why?Thank you for your comments. I am sure that no clients are connected when the application starts up. And I dont want to implement Application.Lock() because I dont want the clients to wait and also the clients will not modify the updateManagerObject in the Application State. I tested the UpdateManager class with Windows Forms and found that the Receiver Thread in UpdateManager class(Which downloads data from the Server) is orphaned sometimes. I simulated the same in the Web Service Also.
[WebMethod(Description = "Get the Current Quote")]
public string GetUpdate()
{
//The following code re-initializes the updateManagerObject. So the Receiver
//Thread in the old updateManagerObject becomes Orphan.
updateManager = new UpdateManager();
Application[key] = cache;
updateManager.Start();return updateManager.GetUpdate();
}
This happens whenever the updateManager is re-initialized without destroying the old object. If the previous object is destroyed properly (by calling Dispose method) then everything works fine and no orphan Threads. As you can see from the Web Service Constructor, the updateManager object is initialized when that object is null. Other wise it takes from the Application Object. My question is How an object which is initialized and Stored in Application object becomes null? Since it becomes null the UpdateManager Constructor is called once again. How can I cal the Dispose() method? I have no way to find the orphan threads, to destroy them. Please suggest me some solutions.
-
Application State object is destroyed - Dont know why?I am running a web service, which provides some updated quotes every 2 minutes. It takes quotes from a quote server. I expected this service to establish a single connection to the quote server. But few times I have notices that this web service establishes more than one connection to the Server. I think that the updateManager.Start() method is called more than one time. But how that could happen? Whether the Application State object is destroyed because of timeout or any internal error? I have a Destructor in UpdateManager Class. Will that be called automatically or I have to call it explicitly? If so how? I welcome your advise and comments.
public class Service : System.Web.Services.WebService { UpdateManager updateManager; string key = "update"; public Service() { if (Application[key] != null) { updateManager = (UpdateManager)Application[key]; } else { updateManager = new UpdateManager(); Application[key] = updateManager; //This method will establish a TCP connection with a remote server. //In server, sometimes I am finding more than one TCP connections from this webservice. //Objects placed in the Application State will be persisted till the application ends //so there should be one connection to the server. updateManager.Start(); } } [WebMethod(Description = "Get the Current Quote")] public string GetUpdate() { return updateManager.GetUpdate(); } }
-
Control.Invoke must be used to interact with controls created on a seperate threadYes. Previously I did not went through the AddAnnotation() function. Since you ChartControl is in the UI Thread, you can only access/modify the ChartControl properties by using a delegate. Just like you used a delegate to call the ChartResume method, use another Delegate to add annotation. This will surely solve the problem.
-
Control.Invoke must be used to interact with controls created on a seperate threadTry after changing the ResetChart function like this.
void ResetChart() { this.m_ChartControl.Invoke(ChartResume); }
-
where can i find the Tutorial about CryStal Report?Are u running Crystal Reports (V.10) without visual studio? Then you may first refer to Crystal Reports Help Manual. If you have Crystal Reports integrated with Visual Studio, then here is the MSDN samples and tutorials. http://msdn.microsoft.com/en-us/library/ms227881(VS.80).aspx[^]
-
String ManipulationHi 1. The string you posted is a valid XML. So why can't you load the string into an XML Document and navigate through the Child Nodes? 2. Or Use good old plain string matcing. Find the Start Index of <Name> and </name>. Then get the substring. 3. Use Regular Expressions
-
regular expression in c# [modified]If I were u I, I will change the StockPriceTag string to "<root><span class=\"pr\">\n<span id=\"ref_705173_l\">26.83</span> </root>". Then load it in an XML Document. Where you can simple read the value of Span tag. Cheers.
-
Finding HashTablePlease refer [^] Actually the Class Name is 'Hashtable'