Wednesday, 25 December 2013

TWAIN vs WIA

Question:

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

Answer:

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

Question:

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


Answer:

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.

Update:

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

Question:

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

Answer:

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

Question:


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


Answer:

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 http://jmeter.apache.org/usermanual/listeners.html

Saturday, 28 September 2013

Setting up Second Wi-Fi Router to LAN

Question:

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

Answer:

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 192.168.3.0 / 255.255.255.0 with a gateway address as 192.168.3.250 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 http://192.168.0.1. 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 192.168.3.255 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?

Question:

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

Answer:

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?

Question:

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

Response:

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.