Posts

JQuery binding / unbinding event in Firebug

This article provides a good overview of what's going on in Jquery during bind/unbind of an event in firebug. http://ajaxian.com/archives/jquery-bondage#comments

WCF: This collection already contains an address with http scheme.

Ran into this problem earlier. The solution can be located here http://social.msdn.microsoft.com/forums/en-US/wcf/thread/12003fe3-917b-47fa-b768-a7914a374e66/ and http://geekswithblogs.net/robz/archive/2007/10/02/WCF-in-IIS-with-Websites-that-have-Multiple-Identities.aspx o

User control event/viewstate missing during postback

User control event/viewstate missing during postback Question : Some of your web control's events goes missing or cannot be caught when you load it in a user control? Answer: Always use the Control.UniqueID generated for you by ASP.Net when assigning it to a NAME property of your control. The complete Control.UniqueId is available when you assess this in OnPreRender stage. Check your Control.UniqueID which is render into the NAME property of your control on a HTML page. ASP.Net keeps track of the control using Control . UniqueID which makes events / viewstate works. If you override your UniqueID (for javascript manipulation) you might get this problem. Why does it work on your Page but not in user control? On a page, when your control is renders, it probably use name like “MyControl” but in user control this is automatically change to “ctl$_MyControl”. ASP.Net is no longer able to resolve your control id if you override your Control.ID. For example, I created a...

ASP.Net and JQuery

Anyone looking to get JQuery working on ASP.net can try this link : http://blog.dreamlabsolutions.com/post/2009/02/24/jQuery-document-ready-and-ASP-NET-Ajax-asynchronous-postback.aspx It describes everything you need to know to get it working together.

Using JQuery to retrieve elements outside of IFrame

Let's say you have a AJAX-enabled Dialog box and you used IFrame to load a page (php / aspx) . Retrieving any element outside of this page requires asking JQuery to go out of its scope. You can use the following code to retrieve element outside of your IFrame. $("#myDiv", top.window)

ASP.net ListView

The following examples give an overview of how to use ListView. Simple ListView <%@ Page Language="C#" AutoEventWireup="true" CodeFile="JL.aspx.cs" Inherits="JL" %> <%@ Register Assembly="SystemCore.CommonAppControls" Namespace="SystemCore.CommonAppControls" TagPrefix="cc1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:ListView ID="ListView1" runat="server"> <LayoutTemplate> <asp:PlaceHolder ID="itemPlaceholder" runat="server" /> </LayoutTemplate> ...

SSIS package throwing "the type initializer for 'System.Data.SqlClient.SqlConnection'

SSIS package throwing "the type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception" I'm running SSIS package which references an assembly which calls a WCF web service. Everytime i run it, i get this weird "the type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception". So i decided to check on app.config setting in the following files located in C:\Program Files\Microsoft SQL Server\90\DTS\Binn folder. a) DTExec.exe.config b) DtsDebugHost.exe.config c) dtshost.exe.config It has nothing to do with these configurations. Solution Try installing Microsoft .Net Framework 3.0 (in my case) and it solve my issue.

TransactionScopeOption vs TransactionScopeOptions

TransactionScopeOption in System.Transaction What is the differences between TransactionScopeOptions when we use it to create TransactionScope. We have the following option at our disposal. 1. TransactionScopeOption.Required TransactionScope created here is dependent on the root TransactionScope. 2. TransactionScopeOption.RequiresNew Creates an entirely new TransactionScope 3. TransactionScopeOption.Suppress TransactionScope created here is independent of root TransactionScope. Code below shows an example of how transactionScope takes effect when you stop your application in s1.Complete(); Data gets committed in TransactionScopeMixRequiresNew and TransactionScopeMixSupress method but not TransactionScopeMixRequires. using (TransactionScope s1 = new TransactionScope(TransactionScopeOption.Required)) { TransactionScopeMixRequires(); TransactionScopeMixRequiresNew(); TransactionScopeMixSupress(); /// if you stop your application here /// TransactionScopeMixRequiresNew and Tra...

Testing Code Contracts

Normally you would add reference to System.System.Diagnostics.Contracts to define your code contracts. To test it, here's how you do it. Download Contract checker from the following url http://research.microsoft.com/en-us/downloads/4ed7dd5f-490b-489e-8ca8-109324279968/default.aspx Install it and then open your Visual Studio 2010, goto Project Explorer's Properties. You are able to locate "Code Contracts" you're good to go :)

Nunit2.5 giving System.NullReferenceException when you're trying to add assembly?

Create your NUnit GUI project, ("C:\Program Files\NUnit 2.5\bin\net-2.0\nunit.exe") and then drag + drop your assembly into NUnit. That should do it. :) It is that easy.

Ferdinand : Scalable Query Result Caching for Web Applications

Summary : Uses disk caching method to enhance performance for database application. Users connect directly to a proxy. Each proxy consist of STATIC web cache. These servers are connected to each other via DHT and commmuicate with each other using publish / subscribe infrastructure. If a request is in the cache, it is retrieve immediately. If not, it is query from database. Cache is expected to be huge, therefore disk caching method is used. Ferdinand uses database template request and offline analysis to gurantee consistency of data in database. Notification is sent to master group and everybody synchronize their data. Prototype implementation Apache as the web server. MySQL - webservier Ferdinand - custom JDBC driver Pastry - DHT's related task. Scribed - Publish / Subscribe component

Cloud computing and Data Analysis.

Daniel Abadi in Data Management In the Cloud concludes that cloud computing is more suitable for large scale data analysis as oppose to transactional based system. Thus more research is expected in this area. Part of the reason why are as follows:- 1. Transactional application does not necessarily adopt a share nothing model. 2. Maintaining ACID properties for transaction over cloud is complex. More research in cloud computing's database evolve around the following areas: a) fault tolerance - continue query execution in the advent of failure b) heterogeneous cluster c) easy of use

Installing PHP on Apache 2.2.11 (Win32) PHP/5.2.5

Please download your Apache server and PHP. I'm assuming you installed your PHP into C:\PHP folder. Please modify your httpd.conf file located in your conf folder with the following settings. LoadModule php5_module "c:/php/php5apache2_2.dll" AddType application/x-httpd-php .php Restart your server. That's it. Apache Configuration Sample using Redirect Redirect /myservice http://localhost:8080/service Sample using Alias Alias /svc c:/test/appfolder Allow from all

Building Hadoop on Windows

Hadoop requires the following application :- 1) Ant (unzip and set PATH to point to this folder) 2) JDK (unzip and set PATH to point to this folder). I'm using JDK 1.6 Update 14 for this build. 3) Cygwin (svn + openssh) Download hadoop source code using svn from the following url: http://svn.apache.org/repos/asf/hadoop/core/trunk Go to the folder that you've download and build by typing ant (Press enter) That's all.

Configure PHP on Window 7 IIS

Assuming that you have downloaded and unzip php-5.2.9-2-Win32.zip to c:\php5. Here's how you configure PHP 1. Start IIS -- Start->Run->Inetmgr 2. Switch to Feature View, then click on Handler Mappings. 3. Add Script Map and use the following configuration a) Request Path = *.php b) Executable = C:\php5\php5isapi.dll c) Name : PHP_SCRIPT (You can use other name if you want) 4. Try running your PHP. That's it. (You might want to do a iisreset). I've enable ALL World Wide Web Services ---> Application Development Features ---> ISAPI Extension & ISAPI Filters ON in Turn Windows features on or off. If you face issue connecting to mysql :- a) Try troubleshoot using phpinfo(); Try to see if you have configure mysql correctly. b) you can copy php_mysql.dll & php_mysqli.dll to c:\windows\system32;

DataTable does not have AsEnumerable

I have problem locating my AsEnumerable extension method in my DataTabe (System.Data). Thank god for this post by Angel (http://blogs.msdn.com/angelsb/archive/2007/02/23/does-not-contain-a-definition-for.aspx) I was able to find this method once i have added reference to the following assembly. C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll Try to do a dummy Build and you should be able to get it.

Building IKVM Source

Building IKVM Source Setup 1. Download IKVM source code from http://sourceforge.net/project/showfiles.php?group_id=69637 2. Download classpath-0.95 from (http://www.frijters.net/classpath-0.95-stripped.zip) 3. Download openjdk6-b12 from (http://www.frijters.net/openjdk6-b12-stripped.zip) Unzip openjdk6-b12 and classpath-0.95 into the unzipped IKVM Source. For example ikvm-0.38.0.2 --- classpath-0.95 --- openjdk6-b12 Tool required (Other version of these tools might work) :- 1. Nant (i used 0.86 Beta1) 2. JDK 1.6 Update 13 (or lower) 3. VS 2008 or 2005 4. .Net Framework in particular (cl - vc compiler, ilasm) To Compile ---------------------------------- 1. Run nant to compile the required assembly 2. Use VS2008 to build IKVM source (CTRL + Shift + B) That's it.

Example JQuery event when posting Form using multipart/form-data

JQuery event to use once your form is fully posted to the server $(document).ready(function() { $("#target_upload").load(function () { //// Put in code to execute after the iframe is loaded or posted //// }); }); Sample of your Form :- <form id="uploadPhotoFrm" enctype="multipart/form-data" action="upLoaderPhoto.php" method="POST" onsubmit="return true;" target="target_upload"> <iframe id='target_upload' name='target_upload' src='' style='width:1px;height:1px;border:0'></iframe> <li> <input id="uploadedfile" type="file" title="Upload a file to showcase your portfolio" size="20" name="uploadedfile"/> </li> <li> <input type="submit" name="subBtn" class="standardButton" value="Upload" onclick="uploadImageCmd...

Unity - Dependency Injection Types

You can use RegisterType or App.config to achieve the same objectives. static void Main(string[] args) { IUnityContainer container = new UnityContainer(); UnityConfigurationSection section = (UnityConfigurationSection)ConfigurationManager.GetSection("unity"); section.Containers.Default.Configure(container); //// You can override with container.RegisterType (); CoreService svc = container.Resolve (); svc.ExecuteService(); } Sample Service classes public class CoreService { [Dependency] public IService MyService { get; set; } public void ExecuteService() { MyService.SayHello("Jeremy"); } } public class CustomerService : IService { string IService.SayHello(string Username) { return "Customer Service " + Username; } } Sample App.Config File <?xml version="1.0" encoding="utf-8" ?> <configuration...
Sample App.Config type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration" />