Importance of Data in Business Applications

22 12 2009

Right after moving into my new company, i started googling about data warehouses, marts and several other ways of data storing. I’ve compiled my thoughts and understanding of the concepts that i’ve been through so far in this article.

Developers, in general, never realize the importance of ‘data’ while developing applications. People relatively tend to use junk data during development. In environments like Business Intelligence, data plays THE major role. Terminologies and Structures are the key here, unlike the traditional market applications.

Data (or) information is:
> An asset/property
> Can be sold in different forms like reporting, mining, analysis etc

Why will people buy data?
Data is really essential for any company to make their business decisions. Business decisions of any company is usually based on their own performance and the market performance. Here by ‘market’ we mean companies of their genre or their industry type; and the country’s economy which includes several things. So its obvious that one needs ‘market’ data and a better form of data presentation for analysis





Troubleshooting issues during MySQL Instance Configuration

17 12 2009

Several times one might face issues while configuring MySQL instance. This often happens at the time of installation and also during new instance creation on an existing server.

Most of the times the configuration wizard hangs without any error of it an error is thrown it is probably “Cannot Create Windows Service dor MySQL.Error:0″ or “Apply Security Settings.Error:2017″. The second scenario can happen if a firewall is running on your machine, if so, then please make sure you have opened the TCP port 3306 for connections. Otherwise no client applicantion can connect to the server. After you have opened the port please press [Retry] to apply the security settings. The first scenario might happen due to improper installation. Then its better to un-install the MySQL and re-install it again. If you are re-installing after you just uninstalled the MySQL server please note that the data directory was not removed automatically. Therefore the old password from your last installation is still needed to connect to the server.

Even after both the above mentioned workarounds, if you still face the issue, then there are two checks that you can make. #1 is to make sure that the directories are properly updated after the re-install, for which restarting the system is more than enough; the other check is to open the config files and make sure that the self locatory is mentioned as ‘localhost’ rather than the system IP. MySQL sometimes differentiates localhost and the IP, it doesn’t always understand that both are same.

The above are some observations that i had while doing a local set-up for domain; i’m sure there would be more issues, which i’m not aware of. But i think, in 90% of the scenarios, the above things should help.





Software Testing Terminologies – Types of Testing

3 12 2009

Following are the list of terminologies or types of testing which i derived from several sources on the web. As a geek/product guy, i never followed terminologies earlier. But i feel to have a general idea of these (irrespective of we follow or not), it gives you a better glimpse of classifying the ways of testing you do.

Black box testing – Internal system design is not considered in this type of testing. Tests are based on requirements and functionality.

White box testing – This testing is based on knowledge of the internal logic of an application’s code. Also known as Glass box Testing. Internal software and code working should be known for this type of testing. Tests are based on coverage of code statements, branches, paths, conditions.

Unit testing – Testing of individual software components or modules. Typically done by the programmer and not by testers, as it requires detailed knowledge of the internal program design and code. may require developing test driver modules or test harnesses.

Incremental integration testing – Bottom up approach for testing i.e continuous testing of an application as new functionality is added; Application functionality and modules should be independent enough to test separately. done by programmers or by testers.

Integration testing – Testing of integrated modules to verify combined functionality after integration. Modules are typically code modules, individual applications, client and server applications on a network, etc. This type of testing is especially relevant to client/server and distributed systems.

Functional testing – This type of testing ignores the internal parts and focus on the output is as per requirement or not. Black-box type testing geared to functional requirements of an application.

System testing - Entire system is tested as per the requirements. Black-box type testing that is based on overall requirements specifications, covers all combined parts of a system.

End-to-end testing – Similar to system testing, involves testing of a complete application environment in a situation that mimics real-world use, such as interacting with a database, using network communications, or interacting with other hardware, applications, or systems if appropriate.

Sanity testing – Testing to determine if a new software version is performing well enough to accept it for a major testing effort. If application is crashing for initial use then system is not stable enough for further testing and build or application is assigned to fix.

Regression testing - Testing the application as a whole for the modification in any module or functionality. Difficult to cover all the system in regression testing so typically automation tools are used for these testing types.

Acceptance testing -Normally this type of testing is done to verify if system meets the customer specified requirements. User or customer do this testing to determine whether to accept application.

Load testing – Its a performance testing to check system behavior under load. Testing an application under heavy loads, such as testing of a web site under a range of loads to determine at what point the system’s response time degrades or fails.

Stress testing – System is stressed beyond its specifications to check how and when it fails. Performed under heavy load like putting large number beyond storage capacity, complex database queries, continuous input to system or database load.

Performance testing - Term often used interchangeably with ’stress’ and ‘load’ testing. To check whether system meets performance requirements. Used different performance and load tools to do this.

Usability testing – User-friendliness check. Application flow is tested, Can new user understand the application easily, Proper help documented whenever user stuck at any point. Basically system navigation is checked in this testing.

Install/uninstall testing - Tested for full, partial, or upgrade install/uninstall processes on different operating systems under different hardware, software environment.

Recovery testing - Testing how well a system recovers from crashes, hardware failures, or other catastrophic problems.

Security testing – Can system be penetrated by any hacking way. Testing how well the system protects against unauthorized internal or external access. Checked if system, database is safe from external attacks.

Compatibility testing - Testing how well software performs in a particular hardware/software/operating system/network environment and different combination s of above.

Comparison testing – Comparison of product strengths and weaknesses with previous versions or other similar products.

Alpha testing – In house virtual user environment can be created for this type of testing. Testing is done at the end of development. Still minor design changes may be made as a result of such testing.

Beta testing – Testing typically done by end-users or others. Final testing before releasing application for commercial purpose.





MS Office 2010 beta is ready for download

19 11 2009

MS Office 2010 beta is ready for download.
This beta version will expire on October 2010.

Download: http://www.microsoft.com/office/2010/en/download-office-professional-plus/default.aspx
Features of Office: http://www.labnol.org/software/microsoft-office-2010-review/11132/

Courtesy: labnol.org





Testing your code. How? Why?

18 02 2009

Obviously you have to test your code to get it working in the first place

> You can do ad hoc testing (running whatever tests occur to you at the moment), or
> You can build a test suite (a thorough set of tests that can be run at any time)

Disadvantages of a test suite

> It’s a lot of extra programming
(This is true, but use of a good test framework can help quite a bit)
> You don’t have time to do all that extra work
(False—Experiments repeatedly show that test suites reduce debugging time more than the amount spent building the test suite)

Advantages of a test suite

> Reduces total number of bugs in delivered code
> Makes code much more maintainable and refactorable
(This is a huge win for programs that get actual use!)

In the Extreme Programming approach,

> Tests are written before the code itself
> If code has no automated test case, it is assumed not to work
> A test framework is used so that automated testing can be done after every small change to the code
(This may be as often as every 5 or 10 minutes)
> If a bug is found after development, a test is created to keep the bug from coming back

Consequences

> Fewer bugs
> More maintainable code
> Continuous integration—During development, the program always works—it may not do everything required, but what it does, it does right

There are two major java testing framework.

> JUnit is written by Eric Gamma of the GoF fame and Kent Beck. JUnit has long been un-unchallenged in the testing framework arena.
> TestNG, written by Cedric Beust is a newer framework, which uses innovative concepts, much of which have been picked up by JUnit in the 4.x versions.

JUnit

> JUnit is a framework for writing tests
> JUnit was written by Erich Gamma (of Design Patterns fame) and Kent Beck (creator of XP methodology)
> JUnit uses Java’s reflection capabilities (Java programs can examine their own code)
> JUnit helps the programmer:
# define and execute tests and test suites
# formalize requirements and clarify architecture
# write and debug code
# integrate code and always be ready to release a working version

> JUnit is not yet (as far as I know) included in Sun’s SDK, but an increasing number of IDEs include it
> BlueJ, JBuilder, and Eclipse now provide JUnit tools
> A test fixture sets up the data (both objects and primitives) that are needed to run tests
Example: If you are testing code that updates an employee record, you need an employee record to test it on
> A unit test is a test of a single class
> A test case tests the response of a single method to a particular set of inputs
> A test suite is a collection of test cases
> A test runner is software that runs tests and reports results
> An integration test is a test of how well classes work together
> JUnit provides some limited support for integration tests

How to write a JUnit test class

> A JUnit test class is a class you write that extends junit.framework.TestCase
# As usual, you can use the default constructor or write your own constructors
> Your test class will inherit the following methods:
# protected void setUp()
$ This a method that will be called before each of your test methods
$ Typically, you will override this method and use it to assign values to some instance variables you need in testing
# protected void tearDown()
$ This a method that will be called after each of your test methods
$ Typically you will just ignore this method, unless you need to close files
> You will also write any number of test methods, all of which have the form public void testSomething()
> Something is usually, but not necessarily, the name of the method you want to test.

How to write a JUnit test method

> Your test method should start with
public void testSomething(), where Something is any name you like (typically the name of the method you are testing)
> This is a normal Java method; you can put any Java in it that you like
> Your method will typically use one of the “assert methods”, such as assertEquals(expected_value, computed_value) or assertTrue(boolean_condition)
> You do not need to call these methods; as long as they are defined as above, they will be called automatically
> You do not need to do anything if the tests fail; the framework will take care of this for you

A simple example

> Suppose you have a class Arithmetic with methods int add(int x, int y) and boolean isPositive(int x)
public class ArithmeticTest extends junit.framework.TestCase {
 public void testMultiply() {
assertEquals(4, Arithmetic.add(2, 2));
assertEquals(-15, Arithmetic.multiply(3, -5));
}
 public void testIsPositive() {
assertTrue(Arithmetic.isPositive(5));
assertFalse(Arithmetic.isPositive(-5));
assertFalse(Arithmetic.isPositive(0));
}
}

BlueJ

> BlueJ provides support with commands such as Create Test Class and Create Test Method
> You can create objects on the test bench and move them to the fixture (and back again)
> BlueJ also has a “recording” mode where you create and manipulate objects, and BlueJ turns your actions into test code
> This is a first implementation and is still quite buggy
> It’s worth experimenting with, but you have to check the code produced to see if it makes sense
> BlueJ also makes it easy to run a single test, a suite of tests, or all tests
> BlueJ’s display of JUnit results is virtually identical to the way results are displayed by commercial IDEs, such as JBuilder

Test-Driven Development (TDD)

> It is difficult to add JUnit tests to an existing program
> The program probably wasn’t written with testing in mind
> It’s actually better to write the tests before writing the code you want to test
> This seems backward, but it really does work better:
> When tests are written first, you have a clearer idea what to do when you write the methods
> Because the tests are written first, the methods are necessarily written to be testable
> Writing tests first encourages you to write simpler, single-purpose methods
> Because the methods will be called from more than one environment (the “real” one, plus your test class), they tend to be more independent of the environment

Stubs

> In order to run our tests, the methods we are testing have to exist, but they don’t have to be right
> Instead of starting with “real” code, we start with stubs—minimal methods that always return the same values
> A stub that returns void can be written with an empty body
> A stub that returns a number can return 0 or -1, or whatever number makes least sense
> A stub that returns a boolean value should usually return false
> A stub that returns an object of any kind (including a String or an array) should return null
> When we run our test methods with these stubs, we want the test methods to fail—to report all kinds of errors
> This helps “test the tests”





How to be a good programmer?

11 02 2009

One good article i found online about how to be a good programmer

Its a little lengthy, but its worth it. Especially for people who are in a sick working environment, and in a paradigm of identifying themselves as a good engineer vs good programmer.





Cache – Explained

6 02 2009

This term, as most heard by web-bies, is temporary data storage mechanism. Well, most people are concerned about cleaning it though; after doing a lot of junk browsing etc.

The files you automatically request by looking at a Web page are stored on your hard disk in a cache sub directory under the directory for your browser (for example, Firefox). When you return to a page you’ve recently looked at, the browser can get it from the cache rather than the original server, saving you time and the network the burden of some additional traffic. You can usually vary the size of your cache, depending on your particular browser.

Internal-Mechanism:

Well, there are a couple of basic terminologies here. ‘Hit’ and ‘Miss’. When we request a URL to the browser, then the client looks for the file if preserved in cache, if it is available, it fetched the file from cache. This is a hit. Miss is the opposite of it. The efficiency/usage of the cache is evaluated by the hit ratio.

How is it maintained?

Now, the question arises, how we manage cache data. The important point is that cache uses very limited storage memory of the hard-drive/memory. So data has to be managed i.e, delete some and add some frequently. This is all done by ‘Cache-Algorithms’. One famous one is least recently used (LRU) which replaces the least recently used with the most recently used. There are several algorithms followed though, I would blog about it sometime later.

General Usage:

Computers include caches at several levels of operation, including cache memory and a disk cache. Caching can also be implemented for Internet content by distributing it to multiple servers that are periodically refreshed. (The use of the term in this context is closely related to the general concept of a distributed information base.)

Altogether, we are aware of these types of caches:

• International, national, regional, organizational and other “macro” caches to which highly popular information can be distributed and periodically updated and from which most users would obtain information.
• Local server caches (for example, corporate LAN servers or access provider servers that cache frequently accessed files). This is similar to the previous idea, except that the decision of what data to cache may be entirely local.
• Your Web browser’s cache, which contains the most recent Web files that you have downloaded and which is phyically located on your hard disk (and possibly some of the following caches at any moment in time)
• A disk cache (either a reserved area of RAM or a special hard disk cache) where a copy of the most recently accessed data and adjacent (most likely to be accessed) data is stored for fast access.
• RAM itself, which can be viewed as a cache for data that is initially loaded in from the hard disk (or other I/O storage systems).
• L2 cache memory, which is on a separate chip from the microprocessor but faster to access than regular RAM.
• L1 cache memory on the same chip as the microprocessor.





Simulated JUnit tests for Web Applications using HTTPUnit

23 01 2009

HttpUnit is a suite of Java classes to test Web applications over HTTP. Coupled with JUnit, HttpUnit is a powerful tool for creating test suites to ensure the end-to-end functionality of your Web applications.

While JUnit itself can test server-side Java code by writing test harnesses for individual classes, HttpUnit extends JUnit to test the integration over the Web by emulating the way a Web browser works and working through a Web server. This article will explain how you can take advantage of HttpUnit.

One great aspect of HttpUnit is that it can test entire Web applications, not just single pages. Because it honors form information and cookies, you can write tests to cover a whole session. For example, if your Web application includes a shopping cart, you could write a test to try logging in, selecting an item, placing it the shopping cart, and checking out. Since the tests are written in Java, there’s no limit to how in-depth your tests can be. Let’s get started by looking at a simple HttpUnit test.

Making a request
Since HttpUnit can emulate an entire session and not just a single request, the system uses a class, called WebConversation, to manage the requests, handle the cookies, and resolve relative URLs. As you write more complicated tests, the WebConversation class will become more important. Usually, the class simply creates a request to the URL base_url. The response from this request is stored, and the JUnit method assertEquals() tests whether the response was 200, which is the HTTP response for a successful request.

Parsing a response
Once you’ve made a successful request to a Web server, it’s time to parse the result of the request. HttpUnit makes use of the JTidy package, which is included in the HttpUnit distribution, to parse the resulting HTML into a Document Object Model (DOM) tree. For those who aren’t familiar with DOM trees, they offer a uniform way to manipulate a document in a hierarchical data structure. JTidy provides a standardized way to manipulate the HTML result.

You should note, however, that the DOM tree that JTidy builds represents the structure that a document should have, not necessarily what it does have. That means that JTidy may add structural elements to the document tree that aren’t in the HTML source but should be. That includes head and body markers, paragraph marks, font tags, and more. Iterating through a DOM tree and visualizing the output, can be helpful.

Shortcuts through the DOM
Navigating through the DOM can be difficult and time-consuming. Fortunately, HttpUnit includes tools to make quick work of dealing with some HTML elements.

Navigating links
HttpUnit offers much more than just parsing the result of a single connection. The real power comes from being able to make multiple requests through the WebConnection object. The easiest way to make multiple requests is by following HTML links.





Vista SP2 Beta is out

4 12 2008

Microsoft is continuing to broaden the pool of Windows Vista Service Pack 2 (SP2) testers beyond the fairly small, select group who’ve been working with test builds for the past few months.

On December 2, Microsoft made the latest beta build of SP2 available for download by any TechNet and Microsoft Developer Network (MSDN) subscribers.

The highlights of the Service Pack includes native Blu-ray burning, VIA 64bit security support, Hyper-V hypervisor, WMP upgrade DRM issues fixed, feature pack for WiFi, event logging support in SPC, reduced resource hogging by sidebar gadgets and improved power settings for Windows Server 2008. Along with these, Microsoft also promises to include support for proprietary file systems used in Flash memory like exFAT/FAT64.

As per sources on the web, SP2 beta download size will vary from 302MB to 390MB for 32-bit version supporting five or 36 languages. Download size of Vista SP2 64-bit version will vary from 508MB to 644MB including support for five or 36 languages.





Good, Better, Best! This is the integration graph of gtalk!!

23 11 2008

Google has made some improvements to the Gtalk integration within Orkut to make it “spam free” and slightly intelligent.

Google mentions in a blog post that they have come up with a formula that automatically predicts which of your Orkut friends you probably want to chat with, and only tells those people that you’re signed into Google Talk. This automatic filtering of contacts is dependent on your account activity, recent scrap conversations and the category of friends you have added the person to.

For example, a best friend with a recent scrap history would be able to see you online because Google thinks you will obviously want to chat with him. This, however, is not a great idea if you do not want to bump into someone with whom you had a not-so-memorable recent scrap conversation!

Google has, of course, provided the option to customize your contacts and you will have the final say on who will be able to see you online. The enhancements also enable you to chat within an open Orkut window. These tools though have not been fully implemented in all accounts as of now.