Posts

Showing posts from June, 2013

Donate

WebService Is Undefined Error In ASP.NET 4.0

1. First step is to add reference to the web service using Ajax Script Manager: <asp:ScriptManager ID= "ajaxManager" runat= "server" > <Services> <asp:ServiceReference Path= "~/Services/ProductService.asmx" /> </Services> </asp:ScriptManager> 2. Secondly is to include the namespace in calling the webservice method From ProductService.GetProducts( function (data) { $.each(data, function (index, elem) { $( "<option />" ) .text(elem.ProductName) .val(elem.ProductID) .appendTo( "#products" ); }); } ); To AccessingServerSideDataUsingClientScript.Services.ProductService.GetProducts( function (data) { $.each(data, function (index, elem) { $( "<option />" ) ...

Example Of IsPalindrome Generic Function Using Queue In C#

Hello, Excerpt from .NET 4.0 Generic's Guide , there's an example on testing whether a string is Palindrome using a Stack<T> object. I decided to create a a Queue<T> based method. One additional tip was to reverse the Queue object. See sample function below: public static bool IsPalindromic<T>(IEnumerable<T> inputSequence) where T : IComparable { Queue<T> buffer = new Queue<T>(); foreach (T element in inputSequence) { buffer.Enqueue(element); } buffer = new Queue<T>(buffer.Reverse()); for ( int i = 0; i < inputSequence.Count(); i++) { if (buffer.Dequeue().CompareTo(inputSequence.ElementAt(i)) == 0) { continue ; } else return false ; } return true ; } Source Code: Example Of IsPalindrome Generic Function Using Queue In C# That...

OpenWebKitSharp Document Text Similar To .NET WebBrowser In C#

Here's how you get the page source of a WebKitBrowser similar to DocumentText property of a .NET WebBrowser Control. JSValue val = webkitBrowser.GetScriptManager.EvaluateScript( "document.getElementsByTagName(\"html\")[0].outerHTML;" ); if (val != null ) { PageSource = val.ToString(); } Greg

How To Set Attribute Option Element In OpenWebkitSharp C#

Here's how you set option element attribute using OpenWebKitSharp. foreach (WebKit.DOMNode optionElement in nodeItem.ChildNodes) { if (searchInnerHtml && optionElement.TextContent.Equals(searchInnerString)) { WebKit.InteropIDOMHTMLElement el = (WebKit.Interop.IDOMHTMLElement)optionElement.GetWebKitObject(); el.setAttribute( "selected" , "selected" ); } }

Retrieving the COM class factory for component with CLSID {D6BCA079-F61C-4E1E-B453-32A0477D02E3} Openwebkitsharp3.0

If you encountered an error while running OpenWebkitSharp in your workstation or production server with the specific details below: Retrieving the COM class factory for component with CLSID {D6BCA079-F61C-4E1E-B453-32A0477D02E3} failed due to the following error: 800736b1 The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail. (Exception from HRESULT: 0x800736B1). The solution is to download Microsoft Visual C++ 2005 Service Pack 1 Redistributable Package MFC Security Update here: Visual C++ 2005 Service Pack 1 Redistributable and install it in your server/workstation. Greg

Donate