Showing posts with label Tools. Show all posts
Showing posts with label Tools. Show all posts

Monday, 13 March 2017

Windows Service - How To Setup Email Notification On Service Failure

Problem:

We have designed a scheduler engine, which runs as a windows service and is used for executing different kinds of scheduled tasks. At times, the service stops and we get to know that only when some users complain of not being able to see the outcome of a scheduled task. Since then we have put this scheduler under the monitoring checklist, so that the windows monitoring team have a check on this service. But it would be even more effective, if this is automated. Wonder if Windows offers an easy way of setting up an alert on service stoppage.

Solution:

Windows does offer an option to configure email notification for one or more specific events occuring. If you have built your service application to handle the exceptions and write the exception information into the windows event log, then the easier approach is to leverage the windows event notification. If you have not aready used the Windows event log, in your service application, it is recommended to do so, as windows event log is the best place to look for errors and other events. Check out Stuart Lange's article on Handling Windows Service Errors. It is a series of six articles and you may want to check out all of them. Check out the Technet article Configure Notification Options to know more about setting up email notifications using the Windows System Resource Manager.

Just in case, you don't have the option of leveraging the Windows System Resource Manager as above, then you may make use of the Recovery options under the service properties dialog. You may double click on your service on the services console window and you will see a Tab named Recovery. The Recovery option enables you to specify a recovery action three times. See the figure below:


As you may observe, you four options to choose when a service fails: Take No Action, which is the default; Restart the servive; Run a program; and Restart the computer. While Restarting the computer is not a good idea if the computer also serves various applications and services, Though you have option to specify a delay for restart and
to send out messages to other connected computers that the computer is being restarted.


But certainly Run a Program option can be leveraged to send out an email notification. You may also notice that you have option to specify different actions for the first, second and subsequent failure. It would be a good idea to to try restarting the service atleast once or twice and then try using a custom program to send out an email notification. The custom program can even be a Power Shell script.

A simple PowerShell script to send out email notification could be as below:

$Username = "MyUserName";
$Password= "MyPassword";
$message = new-object Net.Mail.MailMessage;
$message.From = "YourName@gmail.com";
$message.To.Add($email);
$message.Subject = "subject text here...";
$message.Body = "body text here...";
$smtp = new-object Net.Mail.SmtpClient("smtp.gmail.com", "587");
$smtp.EnableSSL = $true;
$smtp.Credentials = New-Object System.Net.NetworkCredential($Username, $Password);
$smtp.send($message);


While there are more ways you can handle this problem, I hope this helps you to 

Sunday, 12 March 2017

MS Excel - Copy Sum of Selected Cells

Problem:


Mirosoft Excel is a wonderful office product and is an essential tool in our work life for most of us. But still many would have not discovered its capabilities to the fullest. Here is a problem that I wanted to solve. Typically, techies don't like to do same thing repeatedly and would look for a possible shortcut for that. I have been working through multiple excel sheets, where in have to find totals for a group of cells, without any specific parameters to determine the qualifying cells. If there is a shortcut to accomplish this it would be of help to many.


Solution:


Given that there are no parameters that determine the qualifying cells, it is difficult to come up with a an algorithm to automate the selection and totalling. But it would be possible to leave the selection to the users and then facilitate the summing part. We can leverage the clipboard to achieve this. Let the users select the desired cells and then invoke the macro using the assigned short cut key combination and the total is copied into the clipboard and available for pasting any where.

Here is the macro that does the work:

Sub mySum()   
 Dim MyDataObj As New DataObject   MyDataObj.SetText Application.Sum(Selection)   MyDataObj.PutInClipboard 
End Sub

I am sure every one knows how to create a macro and assign a short cut key for it. You may find a lot of resources on creating a macro in excel.

Sunday, 29 November 2015

How to Create '|' (Pipe) Delimited Files in Excel

Problem:

Microsoft Excel is a very useful tool for data analysis. It supports import of data from various sources and formats into it for analysis. But, though it supports export of data in various common formats, it does not natively support export of data in a delimited text format with the delimiter other than Comma and Tab characters. This post explains how to get the excel data exported into a "|" (pipe) delimited text file.

Solution:

Excel does not directly support export or saving the data delimited with a pipe or such other characters. It supports comma delimited files (.csv) or tab delimited files though. The csv file generator however uses the List Separator as set in the windows Regional Settings as the delimiter. With this you can change this value in the regional settings and the csv file option will now produce a delimited file with the delimiter of your choice as set in the regional settings. For those not familiar with the regional settings, here is how to get this accomplished:

If you are using Windows 8 or 8.1, you will find the Regional Settings option under the "Clock, Language and Region"  category.



Click on the Additional Settings button in the Formats tab of the Regional Settings dialogue box. In the Numbers tab of the resulting dialogue box, you will find the field List Separator (Highlighted in the image. By default, it displays ","(comma). Now set it to a character that you need the files to be delimited with. For instance, if you want export a pipe delimited text file from excel, enter the charcter "|" in this field and apply the change.



You are done. Close and re-open Excel with the data that you want to export. Now use the Save As option to save the sheet as a csv file (.csv). This will now produce a text file delimited with the pipe character. Unless you regularly use pipe as the delimiter, you may want to set it back to comma, so that it does not impact any other operations that dependent on the List Separator field.



Sunday, 20 September 2015

Powershell Script for Cleaning up Old Files

Poblem:

I am working on a project that creates 100s of files every hour which has led to creation of over few thousand files in a week. Due to the very high number of files, Explorer takes so long to list the files in the folder. As this could fill up the storage pretty fast, I need to delete files older than 7 days. Please suggest me how best to accomplish this, preferably using PowerShell and leveraging the Scheduled Tasks.

By: Anonymous

Solution:


Powershell is the way to go for these kind of tasks. For deleting old files, the following script will do the job:

Get-ChildItem –Path <Base Folder> –Recurse | Where-Object CreationTime –lt (Get-Date).AddDays(-7) | Remove-Item

Replace the <Base Folder> with the actual base folder  that need to be looked up for this task. Simiarly, you may observe the from the above script, this will delete the files based on the time of creation of the file. If you want to use the last modified time, replace the CreationTime with LastWriteTime

The above script can be executed from the PowerShell prompt or can be scheduled to run automatically using the Windows Task Scheduler. There are couple of things that you should take care of while scheduling:

  • By default, the deletion will fail as the execution policy may not permit the deletion. To override this set the parameter ExecutionPolicy to bypass
  • You may want to add the parameters - noninteractive. to enable to run automatically without needing user action. 
  • Do not place the script itself in the program field, Instead save the script as a .ps1 file and pass the script file with fully qualified path as a parameter in the parameter field.

Typically, the following should be added to the parameter field:

-noninteractive –nologo -ExecutionPolicy Bypass -command "& 'c:\datafiles\cleanup.ps1'"

Needless to mention that the progrm / script field shall contain the PowerShell executable with its fully qualified path, which will be like this:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
You may also want to have a look at the clean up script on the TechNet site, which has many more capabilities, like crating a log of files deleted and so on.

Sunday, 9 November 2014

Microsoft Expression Encoder

This post is not in response to a specific problem or question, but could be a response to a potential question from some one.

I was looking for a cost effective and easy to use tool for capturing screens and produce videos. There are many tools, in the freeware, shareware and commercial category for the purpose. But the one that I find interesting is the one from Microsoft, the Expression Encoder. While Microsoft has stopped supporting the commercial version of the product, the same is available as a free download. I am sure, many of you might know about this, but for those who are not, this post will give a glimpse, so that one can start using it and see its advantages.

Expression Encoder Pro is a component of the Expression Studio, which is currently not sold as a product. In addition to Expression Encoder Pro, the studio also bundles with it Expression Web, Expression Blend and Expression Design. Expression Web is intended for creation of responsive websites leveraging CSS3 and HTML5. Expression Blend is intended to build interactive UI for windows store applications. Expression Design, combined with Expression Blend and Visual Studio helps building innovative, user-centric, fast and fluid applications. Check out more about the changes and availability of Expression products on the microsoft site.

Let us look at what Expression Encoder can offer us. Expression Encoder 4 Screen Capture is also installed along with the Expression Encoder 4. The Screen Capture component offers you to record videos using the camera attached to the device / PC, record audio using the microphone, and to record the selected area of the screen.



On clicking the Record button, you will be prompted to select a rectangle area to capture and once done, you can continue with your actions on the screen as the recording continues.Once, done, you stop the recording and the output is produced as a .xesc file, which can be further edited using the Encoder.

To get your captured video encoded into a video output, you will perform the following using the Expression Encoder

  • Choose your project. 
  • Import your source video. 
  • Modify your video. 
  • Set preview and encoding options. 
  • Choose an output format. 
  • Render your video.
Getting used to was not very difficult and the product comes with a useful help document. The tool allows you to overlay visual still and moving image file, edit the sub titles, captions and descriptions, add audio streams, apart from allowing you to insert and cut parts of the source video.



Few of the limitations include, inabitlity to add more than one overlay, the supported output format limited to Windows Media Video (.wmv) and IIS smooth streaming. While the tool has much more capabilities, for the specific purpose of creating product demo or tutorial videos, this suits very well. As you know there are many tools out there to convert .wmv to other video formats, like .mp4.

Try it out and share your feedback here.

Thursday, 6 November 2014

Windows Steps Recorder - For Problem Reporting

Question:

I work in QA department, where reporting issues and defects with all supporting details to well describe the problem is key. We usually use a screen capture tool to capture the images, but then to assemble them as a problem report, we need to depend upon MS Word or such other tool. I am writing to you to check if there is a better tool that helps to perform this task even better.

By: Krishnan Sadasivam

Response:

If you are asking about a tool for screen capture, Snipping tool, which is part of Windows OS from version 7 onwards is a nice tool to capture parts of the screen. There is another tool which again is part of the Windows OS from version 7 upwards, which is called 'Steps Recorder'. This tool captures your actions and associated screen and produce a descriptive output, which will make it a lot easier for the problem reporter and the problem sover. Here is how it works in Windows 8 or 8.1:


  • Press Windows Key+Q to bring up the search panel on the right.
  • Type steps and you will see the "Steps Recorder" tool show up in the search results
  • Click on it and it will launch the Steps Recorder Tool

  • Click on the Record button and then start reproducing the problem you want to report. 
  • As the recording is in progress, you have the option of adding comments to certain specific area of screen by highlighting it.
  • Once done click on stop recording and your actions is compiled as multiple steps and optionally as a slide show.


  • You have option to save the steps as a compiled html and email it as well.


This free tool will certainly be handly for reporting computer software problems.

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

Sunday, 14 July 2013

Testing SOAP Webservice APIs

Question:

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

Response:

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, 8 June 2013

Image Capture Component for Web Applications

Question:

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

Response:

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


Question:

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

Response:

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.