Wednesday, 25 December 2013



I have taken up an academic project to work with the imaging devices, like video and still image capture. I have read about TWAIN and WIA as the popular toolkits or APIs available for the purpose. I need help in deciding as to which API is good to go with and guidance on any other tools or SDKs would also be of help.

By: Matt Charles


You are right that TWAIN and WIA are the widely used APIs for applications around image acquisition. The choice of the toolkit can be made by looking at the following criteria:

  • OS Support: Microsoft's Windows Image Acquisition apparently works only on Windows platform. But TWAIN works on Windows, Linux and Mac. If your project requires cross platform solutions, then look at TWAIN or else WIA is preferred for its other advantages. While TWAIN is an offering of TWAIN Working Group having leading device vendors as its members, WIA is Microsoft's offering which builds on top of low-level hardware abstraction STI and is available with Windows Me or later.
  • Programming Support: Working with TWAIN API require C/C++ skills. There are commercial high level libraries which expose various programming language specific APIs for ease of use. WIA, though primarily designed for C/C++ development, it offers ease of use with .NET programming languages as well.
  • Device Support: Most of the windows compatible imaging devices including digital cameras, webcams, video cameras and scanners are WIA compatible. But not all devices come with TWAIN support. The list of devices supported by the TWAIN specification 2.3.0 can be found here

TWAIN though originally developed in 1992, it is a sophisticated API and its portability across various platforms. TWAIN also offers a 'native' (Device Independent Bitmap) transfer mode in addition to the modes 'memory' and 'file' offered by WIA. WIA provides a TWAIN compatibility layer that allows TWAIN-aware applications to communicate with WIA devices, though such applications will not have full access to WIA functionality.

Here are some cool references or code samples for image acquisition using WIA

ADF Scanner Library
OpenNETCF WIA Library

Some of the commercial APIs that make building TWAIN aware applications a lot easier are:

EZTwain Pro 4.0
csXImage - ActiveX Image edit and Twain control

You may also want to explore JS-Feat a javascript library.

Assuming that your project is of academic nature and that you would be looking at a windows specific solution, I would recommend you to explore WIA.

Sunday, 24 November 2013

Chrome on Windows 8 Freezes often


I have been experiencing issues while using Chrome on Windows 8. Randomly the system PC become unresponsive to keyboard and mouse. While some times the freeze is for a few seconds, most of the times it never comes back. The PC then had to be hard rebooted. Though I have been experiencing more with Chrome on rare circumstances, the system did froze even when I was not using Chrome at all, For your information, I have applied all windows updates and the device drivers seem to be upto date. Any help in resolving this is highly appreciated.

By: Mohan Ramalingam


There is no straight fix for this problem, as the cause for this issue could be many fold. For example, I have come across issues around solid state disks with inappropriate hardware and driver configurations. Generally, try these fixes and one of that could work for you.

  • Run the following command bcdedit /set disabledynamictick yes using the command prompt as an administrator and then reboot the system. Dynamic ticks, which exists in Linux for over a decade, is implemented in Windows 8 for the first time. This does not significantly benefit desktops, but mobile devices such as laptops, smartphones and tablets, are expected to be benefited in the form of extended battery life. Unfortunately, Microsoft’s implementation of dynamic ticks in the Windows 8 kernel does not go well, may be due to its dependency on some hardware devices and/or related drivers and thus causing the issue that you have described above. Disabling this on a desktop is unlikely to have any significant adverse impact.
  • It is widely reported that using a solid state disk with older SATA controllers, which are not designed to manage the higher speeds of SSDs could also cause similar issues. It is recommended to use SATA II controller based mother boards. Just in case if you are using an SSD, you may want to check the underlying hardware specifications and fix them if needed.
  • Other possible solutions include:
    • If the issue is specific to chrome, try disabling the chrome extensions on a trial and error basis and some users how found success in resolving the issue by disabling some of the fixes.
    • Ensure that all your hardware devices have latest drivers supported by Windows 8.
    • Run System File Checker tool to see if there are corrupt system files. For this, you may run the command sfc /scannow in a command prompt with administrator privileges. This will report if there are issues with system files and if so, you may want to reinstall or reset the Windows 8 operating system.
    • Defrag your hard drives
    • Clear history and temporary files

You may write a response to this post in the form of comments, if any of the above has helped resolve your issue.


If your experience of freeze is not specific to Chrome or any one application, then you have reason to suspect the hardware. Overheating CPU has been found to be one of the most common cause of such freezes. Ensure that the fan mounted on the Processor and other fans attached to the chassis are working fine. Use the hardware monitoring tools supplied by the manufacturer to keep a watch on the CPU temperature.

The next possible cause would be incompatible drivers. Ensure that you have all the hardware drivers updated. Usually, when you have upgraded your Windows 7 to Windows 8, it might be possible that the old drivers continue to be in use and Windows OS might not find updates. But driver updates could in fact be available from the device manufacturers. Better search for the appropriate updated drivers and apply them.

Saturday, 26 October 2013

Web Application - Vulnerability Testing


I am a software tester with 11 months experience. I want to explore security testing area and would like to know more about vulnerability testing more specifically about SQL injection attack. Also guide me as to how these testing can be performed manually.

By: Saran Satyan


Vulnerability Testing is a practice area for security professionals. There is no simple or one solution that will work in all cases. One has to go through a structured approach to accomplish this testing. The high level steps include scoping, information gathering, tool selection, and then performing the scanning. Most of the vulnerabilities require in-depth knowledge on the internals of the web application like its design and architecture in addition to the tools and technology used in its build. Manual methods or techniques may not help in identifying most of the vulnerabilities.

As we all know, SQL query language is used to retrieve data from the databases and a technique to exploit the the query language to fetch unintentional data by injecting unexpected input data is referred to as SQL Injection attack. As an example, typical where clause in a query used to authenticate a user would be like where userid = <user_id> and password = <password>. The user id and password as entered by the user would be substituted in this where clause in run time before execution. Programmers adopt different techniques to dynamically bind the input variables to build the needed where clause. One such simple method of dynamically building the where clause is by concatenating the input data like "... where userid = " + user_id + " and password = " + password = ";" In this case for instance, if the user inputs the password with something followed by "or 1=1" then the where clause of the final query will look like where userid = user_id and password = password = password or 1=1; As we all know, this query when executed will retrieve all the rows in the user table because of the condition or 1=1.

Here is an article worth referring to know more about SQL injection attacks.You may also check out the following links to know more about vulnerability testing:

Web Application Security Testing Cheat Sheet
The world's most advanced Open Source vulnerability scanner and manager
Web application security: Testing for vulnerabilities

Hope you will find this response useful.

Wednesday, 23 October 2013

Website Scalability Test - JMeter Listeners


I am on a task to perform a scalability test of a website. I am new to JMeter and I want to know how to capture and analyze the test results using JMeter. More specifically I need to capture the response time of the pages that I would be testing.

By: Saran Sathyan


You need to add a listener and configure to write the test results into a Log file. You have the option of using a csv or xml file format. You can do this visually, by right clicking on your test project shown in the left explorer bar and then add-> Listner->... JMeter provides many listeners and you may just choose either Simple Data Writer or View Results in a Table. In the resulting window, you will find options to specify the output file location and configure the data elements that you want to capture. JMeter captures two time fields, one being the elapsed time and the other being latency. While the latency indicates the time to the first response, the elapsed time indicates the total time to load the page completely. With this listener, all your test results will be logged, and you may use simple tools like excel or import into MS Access or such other database as you may be comfortable and then get the necessary summary data by grouping on appropriate fields.

Generally to assess the scalability of your website, you also need to monitor and collect stats from the server(s) on which your website is running at the same time your tests are run. You may have to engage your system administrators to help you in collecting the performance statistics on server resource utilization like, CPU, Memory, Network bandwidth, Disk IO, etc. As you simulate more load from JMeter, the utilization of the resources on the server will go up. The ideal approach is to plan to have multiple tests starting with 50 or 100 users and ramp up the load until you the resource utilization on the server hits the maximum (say 90%). This way you may also benchmark the site performance on the given server hardware and network bandwidth.

Your report should also report the server utilization details in addition to the page response time and the bytes received so as to make it useful for the report users to make further decisions. Also be aware that if you perform the load tests from one location, your test results might be biased as you may hit the bandwidth limitation on your end. Hope this helps.

For more details on JMeter listeners, check out the documentation available online at

Saturday, 28 September 2013

Setting up Second Wi-Fi Router to LAN


My office has two sections operating on different floors of the building. We are using a Wi-Fi router for our office LAN & Internet access, but the range of this router is not enough to support the other floor area. We understand that connecting another router would need a different subnet and what we need is just a switch. Is there a way to have the second router setup to just function as switch?

By: Arun Viswa


While there are specific devices that will meet this requirement, yes, this can be achieved using Wi-Fi routers as well (Some routers may have hardened the configuration and thus restricting this ability). The routers have the switching function within it and you just need to use the switching function alone. You can achieve this by configuring your second router as below: For this purpose, let us assume that your first router is setup to have your office network as / with a gateway address as and DHCP Server enabled for a range of IP addresses.

  1. Some routers automatically setup the WAN port upon connecting the network cable on the WAN port. And so, do not connect your network cable into any of the ports yet.
  2. Just connect a PC or Laptop to one of the LAN ports(usually numbered) and just go to the LAN setup section using the web based setup portal. Usually this can be accessed using the URL Consult your router manual for the default IP and the admin credentials.
  3. Disable the DHCP Server and assign a static LAN IP within the same subnet, that is outside the DHCP range of the primary router. In our case, let us assign with the same subnet and gateway as that of the first router.
  4. Now connect your LAN cable from the first router into another numbered LAN port(not the WAN port).
  5. Make sure that your primary router's DHCP range is wide enough to support the number of computers and devices that you would be connecting from both the floors of your office.

Incidentally, if you setup your Wi-fi with the same SSID and security setup as that of your first wi-fi router, you have wi-fi roaming also working. i.e. your office wi-fi devices configured to connect to your first router will automatically connect to the second router when they move into the wi-fi range of second router. Please note that as I have indicated, some router's have pre-configured firmware restricting this kind of setup.

You can always reach me for further clarification on this.

Saturday, 21 September 2013

How to take Screen Shot in Android Phone?


I have seen my friends taking and sharing screen images using their iPhone. While I think that this should be possible in Android Phones as well, I could not figure out how to take screen shots in my HTC One M7 running Android Jelly Bean.

By: Niranjan Babu


Yes, Android natively supports taking screen shots in Ice Cream Sandwitch and Jelly Bean versions. It is not an explicit menu or a built in app though. The trick is that while you are at a screen that need to be framed, press and hold the Power button and the Volume Down button simultaneously. You may have to hold press and hold these buttons for about two seconds or little more, until you hear the camera click sound and visually see the screen being framed and saved into the Pictures/ScreenShots folder. Some specific vendor tweaked versions may have explicit touch buttons within certain applications.

For those who are using older Android versions like Gingerbread or earlier, then you are left with the option of using an application. You may search through the app store and find as many applications that facilitate taking screen shots. Beware that some of such apps may require you to root your OS, which is not recommended as certain manufacturer specific features may stop working once you root your phone.

Saturday, 10 August 2013

Why Active / Active DC Design is not preferred by many yet?


We all know that Active / Active is always there as an option for a Data Center design. But We could not find many actual implementations out there. While everyone think that the Active / Active DC solution maximizes the DR investments, not many are getting in there. Can you highlight the challenges and issues that holds this option back?

By: David Matt


There are three key issues or challenges that when addressed will result in higher investment than expected and / or increase the complexity. The three challenges are explained further as below:

  1. Network Latency - To be Active / Active, the data created in on DC should also be created in the other DC with least latency, so that the user requests land on either DC would happen to see the most current data. Though there are tools and technologies to offer active / active solution, they are constrained by a minimum network latency between the DCs. For instance, EMC offers VPLEX based active / active DC solution, but requires that the latency be 50 ms or less. Considering the speed of light and the availability of the optic fiber channels, theoretically, this is achievable within reasonable distance, but in practice, there are various other factor that would have impact on achieving the required latency consistently.
  2. Network capacity - When we talk about active / active data centers, it is not just the database replication, it also requires the application state and associated data to be replicated in real time. More over, given the actual fluctuates, there is a need to provision for the peak time capacity so as to ensure that the latency does not go down in peak periods. Thus, the network capacity needs can easily be three times or even four times of that needed for an active /passive DC design.This need will straight away beat the assumed cost advantage of using the DR site for production as well.
  3. Overall DR Capacity - Assuming that the DR site will also be active for read and write, there is a tendency size the Primary and DR sites to half or little over half of the planned production capacity so that both put together would meet the production demands. Now, in such a scenario, if the either of the site fails, the production capacity comes down to half leading to ineffective DR.

 Given the above key challenges and other related issues, organizations end up with Active / Passive DC solutions or a hybrid solution, where specific applications are partitioned to run out of specific Data Center.

Sunday, 14 July 2013

Testing SOAP Webservice APIs


I am working on an integration project where the components that we build need to consume a set of Webservice APIs. While the vendor has shared the documentation and test accounts for us, I am curious if there would be a simple tool which help me to browse through the various methods and test the same on the fly. I know that we can quickly build a test driver using the proxy class for the given wsdl. However, a generic tool might be of great use as it saves time and it can be used for different services as well.

By: Kathiravan Venkatesan


As you have acknowledged, it is quite easy to quickly build a proxy component and then write simple methods around the exposed web methods to test the webservice APIs. And yes there are tools to test SOAP web services as well that can be used to test a multitude of service APIs. One such tool that I have used in the past is SoapUI by SmartBear, which has a professional and a free open source edition. The free version is good enough to browse through the various web methods and test them as well.

I would suggest you to explore the features of SoapUI to know more about the tool's capabilities. The usage is simple and straight forward. Once you create a new project the tool helps build a tree of web methods based on the wsdl of the service. You can create as many test data against each services and execute instantly to see the output as well Moreover, the test data can be dynamic from a wide range of external data sources. Thus this tool can be very handy for performing the functional testing of webservices.

In addition, the tool can be used to perform load testing and security testing as well. The tool can also supports simulation, i.e. mock the services, which will be very useful during the development stage. There is more to it and I would suggest you to explore, though some of the features are part of the pro version.

Saturday, 15 June 2013

Image Drag, Drop and Zoom using HTML5 Canvas


How can I perform drag and drop of images and the zoom in and out of images using HTML5 Canvas element?

By Iyappan Ranganathan


There are many free Javascript libraries out there to accomplish many drag and drop and other image manipulation features. The one that I have used and satisfied with is KineticJS library. KineticJS exposes events and methods to manage multiple layers, shapes, images, grouping which in combination would help achieve your needs. Specifically the dragstart and dragend events will be the ones you would be interested to implement the drag and drop feature. For zoom in and out you should be using the setScale method.

Check out these links demonstrating the needed features:

HTML5 Canvas KineticJS Scale Animation Tutorial
HTML5 Canvas Drag and Drop an Image

As I said, there are many Javascript libraries and you may pick the one that best suits your needs.

Thursday, 13 June 2013

Unknown device on DELL XPS 13


I use a DELL XPS 13 Ultrabook. Though Windows 7 was the bundled operating system, I have upgraded to Windows 8. Though it all work fine, I see a device in device manager marked as unknown. The properties dialog lists the hardware IDs as ACPI\VEN_INT&DEV_33A0, ACPI\INT33A0 and *INT33A0. My attempts to search DELL driver download have failed as I could not find the appropriate driver. Can you help me find and fix this?

By: Rakesh Sharma


INT33A0 should be the port for Intel Smart Connect Technology (iSCT). Given that Windows 8 is designed as the OS for PCs and as well as smart devices, there is a need to use the communication components even when the device is in sleep mode. Intel's iSCT enables this feature and this feature is controlled by the System BIOS. Not all hardware may have support for this feature, but those that have the support would have a setting in BIOS to enable this capability. Just make sure, you may check out your BIOS and try disabling this feature and you may notice the 'Unknown device' disappear in the device manager.

The driver for this feature can be downloaded here on the Intel website. Try installing this component and see if your problem gets resolved. You may have to run the installer using 'Run As Administrator', even though the user account with which you have logged in has Administrator privileges.

Saturday, 8 June 2013

Image Capture Component for Web Applications


I am working on a project, which requires acquiring images from scanners in a web browser. I am curious to know if HTML5 / CSS3 in any way help accomplishing this feature or if there are any javascript libraries out there so that the implementation can work across all browsers. Or else, you may suggest various other options available for me to meet this need.

By: Anonymous


The HTML5 and CSS3 specifications are all about presentation and thus will be able to detect output devices like print, tv, handheld devices, etc, but there isn't any support for input devices like image scanner or camera. Interacting with such devices can however be achieved using javascript and browser specific ActiveX, Browser Plugin or an Applet. There are many third party libraries with varying capabilities and support for a multitude of programming languages, which can be wrapped within an appropriate component and then use Javascript to interact with it.

I have personally used the EZTwain Library for the windows platform by building a Visual Basic based ActiveX component earlier on and later using VB.NET based library and used it within IE successfully. This library however has support for very many programming languages including C++ and Java. Its usage can be extended across various other browsers by wrapping it within an appropriate component. EZ Twain seems to be reasonably priced and comes with royalty free runtime distribution.

If you are a hardcore programmer, this Code Project Article is worth a look, where the author demonstrates building a C++ wrapper using the TWAIN_32.DLL which used to be distributed by Microsoft in earlier versions of Windows. In later versions of Windows (Windows XP SP1 and later), Microsoft has Windows Image Acquisition Automation Layer, which is worth exploring.

ByteScout Scan SDK is another free (FreeBSD License) library for .NET based applications which can also be explored for its extensibility into other environments. Dynamsoft has an image capture suite with pre-built and ready to consume components for various browsers, but carries a hefty price tag though.

The following are few other Tool kits that are worth exploring.

LeadTools Twain SDK
Acusoft's ImageGear for .NET
Victor Image Processing Library

Almost all of the solutions above are targeted at Windows platform. If you are expecting your solution to work on Non windows platform, you should look for similar libraries and build similar wrapper components for the target browser / platform combination.

Friday, 10 May 2013

JMeter for Scalability Testing


In on of your own blog post, you have indicated the use of JMeter for Stress Testing a Game Application. I have a web application to be tested for its scalability. Do you recommend using JMeter for simulating load? You may also share some thoughts on its ease of setting up and usage and generally about Scalability testing. You may also recommend using any other tools together with JMeter.

Question By: Natarajan Ganesh


Scalability testing is about testing how the application scales in or out under different load conditions, and yes we need tools to simulate the load. It is about specifically testing the deployment model of the application as to how it makes use of additional computing resources when the load increases. Needless to mention, it involves testing both scale up and scale down. The actual test cases for scalability testing depend on the application design and architecture as to how it is expected to scale.

For example, in case of a cluster of application servers used, the test case should be to verify that the load on all the servers in the cluster are evenly distributed or as designed and that no server in the cluster is idles out when one or more other servers are peaking beyond a threshold. Another related test case could be to examine the application behavior when one of the server in the cluster is pulled out.

Thus scalability testing involves in addition to simulating required load or stress on the application, examining whether the scale up or down happens as designed or architected.

Yes, JMeter is a good tool for simulating the necessary load or stress on the application. Setting up JMeter and using it is easy and intuitive. The following simple steps would help you to get JMeter up and running the tests on a Windows box:

  1. Make sure that you have JRE or JDK installed the bin folder is included in the system path.
  2. Navigate to the bin folder of the JMeter installation folder and run the JMeter.bat. Just in case if it errors out, view or edit the JMeter.bat file to see if there is any other settings that need to be modified.
  3. Right Click on the Test Plan in the vertical explorer pane on the left and add a Thread Group (Add -> Threads -> Thread Group).
  4. Right Click on the newly added thread group and add a Sampler -> HTTP Request. In the resulting window make sure that you fill out appropriate vaules. Repeat this step to add as many HTTP Requests to be sampled.
  5. Use an appropriate Listener to gather the data. This can be done again by adding a Listener to the Thread Group.

You could observe from the Add menu that you have options to add configuration elements, pre and post processors, assertions and logic controllers. Depending on your test scenario, use a combination of these components an build your test plan accordingly. Consult the JMeter documentation to to know more about effectively using JMeter.

While JMeter is just a tool simulate the stress or load, you need tools to gather server perormance data and as well as the application performance. While the native performance monitoring tools on Windows could b very useful, for Linux, you can try out NewRelic, a hosted remote monitoring tool. As I have described in one of my blog post, the application should have been designed to generate necessary data for further review and examination to spot probable or potential bottlenecks that need to be further tweaked.

Good luck with your testing.

Saturday, 20 April 2013

Zoom and Pan Background Image


We are working on a project that needs quite a bit of complex image handling in a web browser. For simple image viewing as a gallery there are quite many Javascript libraries out there. Our unique requirement is to load template images with standard body part markings and then allow medical practitioners to mark their observations against the specific body parts. With the introduction of canvas element, HTML5 has made this a little bit easier. As the use cases need us to have multiple layers of images and markers with ability to zoom and pan, we were exploring options to have the ability to zoom and pan a background image so that we would be able to overlay additional layers containing markers and labels on top of it. Can you suggest how to get this done?

Question by: Sangeetha Sundram.


Kinetic Javascript library is a good candidate for accomplishing lots of image handling abilities that you have described here. It supports adding a wide ranging shapes and even SVG paths into layers and then on to a stage container. In terms of HTML, these are canvas elements.

Since your specific question is about the ability to zoom and pan the background image, I suggest the following approach using jQuery library:

Use the Mouse Move in conjunction with the Mouse Down and Mouse Up events to do the image panning. This can be accomplished by manipulating the background-position-x and background-position-y css properties based on the current mouse co-ordinates as the mouse move happens. Use the Mouse Down event to initiate the pan action and then Mouse Up event to stop the pan. It would be appropriate to use the Mouse Up on the document as against the specific element as moving outside the element's boundary should mean to end the panning.

For Zoom in and Out, the background-size is the css property that you should be manipulating and you may derive a suitable algorithm to set a higher (for Zoom In) or lower (for Zoom Out) percentage to this attribute and you will have the background image zoomed in or out accordingly. Depending on your needs, you may want to use the background-position property as well to have the image zoomed in at the point of click and thus keeping the point of click in the visible frame.

Check out the Javascript code in action for simple image pan here on jsfiddle. I have extended it a bit to make the pan to happen on mouse click and move (drag) and also for Zoom In and you can check this out here at jsfiddle. You may further improve this code to suit your needs and do share it here so that it will be useful for all the developers.

Hope this is of help to you.

Sunday, 14 April 2013

How to Integrate a POS device in a .NET Windows Forms Application


One of our recent project requires integrating our Windows Forms application with point of sale devices like barcode scanner, check reader etc. I could find out that there is a POS.NET library that can be used for the purpose, but it seems to have been built for .NET 1.12 and no updates after that. Can you suggest me if there is any other .NET libraries that can be used for the purpose. You may also help me by sharing your thoughts and ideas.

Question by Selvamurugan N.


Answering your first part of the question - Why there are n't any updates to this library? - I can only guess the answer for this and that I feel is due to the fact the device manufacturers lag behind in updating the communication protocols, which is more so because typically these devices are built for a low cost specific purpose operating environments. For instance, the POS terminals don't have to be on a Windows 7, it would just be enough for them to be on Windows XP or even older operating system. That probably is the reason, why the Library continues to be based on COM components and does not need an update.

On using the POS.NET library, yes, you can still use it in the later frameworks of .NET, but be aware of some of the constraints or issues as described in this blog post. The blog author calls out issues with 64 bit environment and also with .NET Framework 4.0. Don't miss out the comments, as there are some valid opinions and observations in the form of comments. You may also want to check out the Microsoft's publication on using the POS.NET titled as Creating a Proof of Concept POS Application.

If that does not suit you, then go ahead and learn to access and work with USB devices using HID (Human Interface Device), but you need to know the communication protocols and the data structures as specified by the device manufacturer. This will for sure will give you a better control over your integration, but you would be re-inventing the wheel. Here is a nice introduction to working with USB devices in .NET.

My recommendation is that check out if the device vendor provides you a .NET or a COM Library and if yes, using that will be the best option as some device manufacturers may have built certain proprietary protocols, which would work best with their own drivers. If that is not the case, then evaluate POS.NET whether it fits your use cases. Most of the times it should be fine, unless you meet up with some of the constraints when using with later versions of .NET Framework. If left with no choice, use HID interface to have your requirements met. You may also want to check out this msdn article on using Alternate Input Devices.

Monday, 25 March 2013

IIS - Nested Web Applications & web.config dependency


I tried deploying a child web application in IIS7 as a virtual directory, but I could not get it working as it was throwing exceptions as an assembly was not found. The issue remained the same even when the virtual directory was converted as an Application. The child application has no reference to the missing assembly, but the parent application does use it and the assembly is found in the parent bin folder. How to break this web.config dependency between the parent and child web applications?

Question by: Sangeetha Sundaram


The dependency between the parent child web applications can be separated using the <location> config element in the parent web.config. Wrap the <system.web> node and the <system.webserver> elements within a <location> element and specify the inheritInChildApplications attribute to false. For example:

<location path="." inheritInChildApplications="false">
       <!-- ... -->

<location path="." inheritInChildApplications="false">
       <!-- ... -->

The location element extends the flexibility to have different system.web and system.webserver nodes for different folders within the website. When the inheritInChildApplications attribute is set to true, the parent web.config will be inherited in all the locations including applications within the parent website.

This location element can also be used to specify different configuration attributes for different resources. For example the use of the location element as below will set the uploaded file size to 128 KB for this specific page alone.

  <location path="UploadPage.aspx">
      <httpRuntime maxRequestLength="128"/>

For more information on the location element check out the following reference links:

Breaking parent web.config dependencies in sub applications

Sunday, 17 February 2013

Simple and efficient word count

Question by Cheliyan Natarajan

I need a technical help. How to find the number of occurrence of a all words in a string. the criteria is that it should be simple and with less complexity. I used the split function to put the words in an array and used a for loop to count. But this increases complexity as split uses one for loop internally also. Can you give me some idea


I presume that you need the solution in C#.NET and that your need is not to count the occurrence of a specific word in the string. Split function may not be a best fit to count the words as you may still have to deal with the split strings for punctuations or other white spaces like tab, line feed, etc. The other options are to use the Regular Expression or to use a character array and looping through to find out the words.

The following code will give you the count of words using regular expression:

MatchCollection collection = Regex.Matches(textBox1.Text, @"[\S]+");
int x = collection.Count;

Depending on the definition of a word, the regular expression string may have to be redefined.

Alternatively the word count can be performed by taking the string into a character array and then looping through it to determine the start of a word or end of the word. Here again, appropriately modify the condition to evaluate the word. Here is the code sample.

            int c = 0;
            string s = textBox1.Text;
            for (int i = 1; i < s.Length; i++)
                if (char.IsWhiteSpace(s[i - 1]) == true)
                    if (char.IsLetterOrDigit(s[i]) == true ||

Regular expression is found to be marginally slower than the char array alternative. Hope this helps.

Thursday, 10 January 2013

Enterprise Architecture - Conformance Vs Performance

Question by Ganesh Ramamurthy

I was hearing Erik Dornenburg of Thought Works in a on-demand InfoQ presentation on "Questions for Enterprise Architect" in which he was discussing about Evolutionary Architecture and was calling out Conformance as one of the issues. We have as many frameworks and standards in place and naturally we always aim to conform to these standards, practices and frameworks and even comply with legal framework. He was considering the case of overseeing the developers to conform to standards as parenting the kids. While it is agreeable that with the fast changing business and technology environment, expecting conformance may be a barrier to innovation, how can we ensure that we produce high quality products. Taking cue from this, I was trying to see if Performance is the answer to the Conformance issue. Your thoughts on this subject is welcome.

The Response

Ganesh, thanks for bringing this topic for discussion and yes, that was a good presentation and is a must watch for all aspiring Enterprise Architects.

Erik in this presentation suggests not to attempt building and enforcing standards and frameworks first and recommends that let these evolve over time in line with the business needs. His comparison of the Enterprise Architect to the City Planner or even latter a Gardener as against the a building architect was very apt.

Getting to your point, he even discusses a case of having the code unit tested by the developers and he highlights how conformance may not solve the problem. With conformance, the teams may just work towards just meeting it and no further. In the same example as he says, if 100% code coverage is required to pass the code move to the next phase, then yes, we may get the results of 100% coverage, but still the unit tests may be incomplete or ineffective in other contexts, like logic tests.

In a broader sense, conformance may be necessary in a highly mechanized or high productivity organization, where it is just the efficiency that matters. But this gives little or no room for doing things effectively and even differently fostering innovation. This is where, depending on the level at which the team operates, the standards or rules should be as open as possible and there must be a feedback loop to review and revisit the standards and rules constantly. Like we have moved from a paradigm of hard coded programming style in the early days of software programming to highly configurable software products, the standards and rules should evolve to a state where they are flexible in adoption for the changing needs.

As Erik also says in his presentation, Architects should refrain from detailing the micro level aspects of the systems and should leave it to the developers. This will go well based on the trust that the architects have on the development team, and that is where the Enterprise Architect has to consider or has a role to play in the Organizational culture and in building the necessary trust with various teams and if this important aspect of trust is missing, then conformance is the one that works better, but not any better than just meeting what was required.

In practice, we see developers with little or no accountability produce inferior code and this is what prompts us to put checks and controls all around and thereby not allowing the developers look beyond what is told to them to do. While just allowing them to do things in their own way is the other extreme, there should be high level norms or guidelines and allow the teams to leverage options without violating the higher level norms. This does not mean that such high level standards or norms should be rigid, and this is where the Enterprise Architect should be receptive to the feedback from all channels and should be more than willing to change these norms as we move on.

It may still be necessary to manage teams at the micro level, but the better way to look at this is about grooming or hand holding the teams to get upto the expected level of performance and then leaving them in a space where they can perform rather than just conforming.

Another way to look at this issue is the way we look at the popular saying "Operation Successful, but patient dead". Wherein conformance expects successful process performance, but it need not produce the desired outcome. So, it is important to measure and focus on the outcome as against the focusing on the conformance to the process.

While the functional or business requirements are written down and signed off, it is the non functional quality attributes of the software products like scalability, performance, maintainability etc where the developers tend to follow diverse practices, resulting in compromise in some such abilities of the systems in the longer term. The Enterprise Architect and in turn the Technical Architect or such other intermediate roles should appropriately interpret and translate the enterprise business strategies into the priorities for these non functional attributes and then let the teams to leverage other artifacts as they deem fit but at the same time not to ignore these priorities.

Yet another related issue which will help address the conformance issue is to have a well defined roles and responsibilities and when authority is delegated to roles, it should be coupled with the constraints attached to such delegation. This will help people perform their roles within the given constraints, leveraging the options they have with them to produce the expected outcomes.

This is a broad topic and applies not only to IT or the development function and this is now increasingly being looked at the enterprise level and even the Boards are expected to perform and not just conform. Change is at the center of everything that we have been talking about and an organization where every member realizes that change is the one thing that is constant we can see Performance as against just Conformance.