06 January 2017

Oracle problem - Multiple sessions being opened when querying a table

Recently we were facing an issue in Oracle where SELECT queries on a particular transaction table was opening multiple sessions in Oracle (both 11g and 12c versions).

We checked in multiple environments and using various IDEs/Tools (Toad, SQL Developer etc) and it occurred everywhere.

We also noticed that this issue was happening with only one particular table alone and irrespective of indexes on table or joins in query.

Finally we figured out the reason for this.

The table was created with parallelism option.This is identified by DOP (Degree of Parallelism) setting. For this we have to check 'degree' column in user_table system view against the table. If it shows a value greater than 1, then it means that table has been created with parallelism option ON and Oracle might open multiple sessions when querying the table.

20 December 2016

Measuring performance of User Interface and REST service layer separately

Recently we were working on a project where we were looking to separately measure performance of UI (User interface) and REST service layer separately.

Technology involved were- C#.Net 4.5, MVC5.0, JQuery, JSON, XML, Restful Services

So we were searching for a profiling tool which can server our purpose with minimum cost and time/effort involved.

We found several tools that can be used -
Hope this helps someone who is looking for similar profiling tool.

18 December 2016

Few points about Micro-services architecture


Micro-services are not meant to be scaled down version of SOA (Service oriented architecture). They should be based on business context and should not be created based on technical refactoring viewpoint.

Ideal platforms for microservices would be cloud were you can easily scale any one component we want. Example if we notice that one business component (say UI) need support 1000 instances and rest every thing can be 1 or 2 instances then decompose the UI component into a microservice

Cloud platforms and dockers are good area to experiment with micro-services as scaling, and management of  multiple versions can be easily accomplished there.

Few no's for microservices -
  • No clustering should be planned
  • Try to make integrations independent of programming language (rest, http, xml)
  • Avoid single database for multiple microservices

Finally one word of caution, managing multiple microservices is very important. Otherwise after 5 to 6 microservices people loose track of which version is integrated to what.

09 December 2016

jQuery data-table with features similar to excel

Recently in one of our projects, we were looking for a jQuery data-table with basic features similar to excel viz. -

  • Navigate from cell to cell in a row using right arrow/tab 
  • Enable cell edit key press after selecting the cell 
  • Enable auto suggest based on the existing data in the column 
  • Enable copy of cell and paste to another cell 
  • Enable drop-down  to chose values rather than free text 
  • Enable column freeze 
  • Enable column wise filters
While researching for it, we found few useful components that provides these functionalities. 

  1. Slickgrid jQuery plugin
  2. Handson table
  3. JQGrid
Hope this will help in any teams looking for data-tables with similar functionality.




30 November 2016

Best practices for Enterprise level logging

Unless mandated by business requirements, all the log statements should be at minimum logging level. The idea is to reduce the logging overhead as much as possible. Sometimes the overhead is significant to impact application performance.

Use asynchronous logging wherever possible.

Use file rolling and archiving features of the logging framework instead of re-inventing the wheel.

It is a practice among developers to log method entry/exit for troubleshooting. This kind of logging should be done using AOP framework such as Spring AOP, and at debug/trace level. A better practice will be log at only those places where there is a significant processing/turning point.

Do not log any kind of sensitive information such as passwords, credit card numbers, national ids, Personal Identifiable information etc. which could lead to privacy and security issues.

Do not hard-code any credentials (e.g. database credentials when doing database based logging) etc. in logging configuration file.

Do not log huge payloads (such as SOAP request/response etc.) in production but log the important details going out and coming in.

Benchmark the log file growth as per production peak volumes and identify storage requirements (SAN/NAS).

Check regulatory/enterprise guidelines (if any) for the retention period of logs. Device the backup/archival/purge policy accordingly.

Suggest use of log analysis tools such as Splunk or ELK stack for monitoring, troubleshooting, quick searches, dashboards etc.

Secure the log files/sources from external access.

Design a new Framework or Use Existing Framework with a wrapper that can help you capture details better.

Make sure the exception or event is logged only at source. Most of the times, every component participating, in the process, logs the exception/event . This not only leads to unnecessary logging but also sometimes logs incorrect information for tracing the issue.

Have a unique event ID(within application & combination with an application id should make it unique across applications) for every Exception/Process/Event so the Support Group can triage, without much hassle.


18 November 2016

Test SMTP server for DEV/Testing

Many times we face problem testing email settings/code in our development environment if we don't have a SMTP server in our development environment.

There is a easy solution for it.

Use dummy SMTP server - SMTP4DEV available in CodePlex at following location -

http://smtp4dev.codeplex.com/

Once it is launched, it sits in your system tray and listens on port no. 25 of your localhost (127.0.0.1) server. This helps in receiving and viewing messages and verifying their format/structure.

It however cannot be used for sending messages.

Detailed instructions for installing and using this nifty tool can be found at its CodePlex location.



30 September 2016

MSDN Subscriptions is now Visual Studio Subscriptions

From Oct 4, 2016, MSDN subscriptions will be re-christened as Visual Studio subscriptions.

After 4 October 2016, you need to go to the new Visual Studio Subscriptions portal to access your subscription.

Please note that you will have no access to the current MSDN Subscriptions portal between 9:00 pm (PST) 3 October and 9:00 pm (PST) 4 October, while we complete the migration.

In case of any questions, check the FAQ or contact Visual Studio Customer Service

27 September 2016

Tech Trivia


  • The word 'Robot' comes from Czech word 'ROBOTA'. In English, it translates to 'forced labor'. 
  • A Red Panda is an animal native to the Himalayas and Southwestern China. The English word for Red Panda is Firefox which is where the browser gets its name from. So the Firefox Logo is actually a Red Panda and not Fox as thought by many (including me!).
  • Android is Andy Rubin who is the co-creator of Android. It was a nick-name given to him at Apple before he joined Google, for his obsession and love for robots.
  • Creators of PNG file format wanted it to be pronounced as PING.
  • Nothing can be compared to the human mind. If a computer is designed which is as powerful as the human brain, then it would be able to perform about 38 thousand trillion operations per second. Also, it will be able to hold about 3584 terabytes of memory.
  • HP, Microsoft & Apple have one not so obvious thing in common - they all started in a garage.
  • If you find a security bug in Facebook, they are willing to pay money ($500 and upwards) for you to tell them about it.
  • 160 billion emails are sent daily, 97% of which are spam.
  • Wikipedia uses an army of anti-vadal bots. These bots prevent vandalism of wiki pages. As per them, vandalism is anyone signing up and editing pages with an intent to destroy or alter content in a negative manner.
  • Ubuntu is one of the most popular distribution channels of Linux. The word Ubuntu comes  from the African word meaning 'I am because of you'.
  • The actual name of Android mascot is 'Bugdroid', though it is not official, the team at Google refer to it by this name.
  • The first known cell phone virus, Cabir.A, appeared in 2004.

26 September 2016

C# - Serialize Object to XML HttpResponseMessage

Sometimes we have an explicit requirement to serialize a C# object to XML HttpResponseMessage format.

This generic function can be used to achieve this conversion -

public static HttpResponseMessage CreateXmlResponse<T>(T objectToSerialize)
{
    return new HttpResponseMessage(HttpStatusCode.OK)
    {
        Content = new ObjectContent<T>(objectToSerialize,
                                        new System.Net.Http.Formatting.XmlMediaTypeFormatter
                                        {
                                            UseXmlSerializer = true
                                        })
    };
}


The function takes an object of type 'T' as input and serializes it using XMLMediaTypeFormatter XML serializer available in .NET namespace System.Net.Http.Formatting.

A sample function call be like this - 

var response = CreateXmlResponse<ObjectClass>(object);

19 September 2016

C# - Convert JSON string to JSON HttpResponseMessage

Use following method/function to convert string having JSON data to JSON HttpResponseMessage -

public static HttpResponseMessage CreateJsonResponse(string json)
{
    return new HttpResponseMessage()
    {
        Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json")
    };

}

Following code can be used to call this method/function

var response = CreateJsonResponse(jSonString);

Following code can be used to call this method/function