Monday, July 21, 2014

Flyway - DB Migration Made Easy

Flyway : It is an automated DB migration tool which is suitable for Agile development environments. Existing source controls like SVN / CVS / TFS would take care of the issues at code base side but it is doesn’t address DB side. 

 

Flyway would address it and can be integrated with the Marven / Gradle / Ant / SBT [Simple Built Tool] / Command Line. Also it supports most of the popular DBs like Oracle, SQL Server, SQL Azure , MySQL, PostgreSQL, DB2 and SQLLite.

 

Thursday, July 17, 2014

New Programming Languages on the Market

These are some of the programming languages that made debut in 2014 barring GO.

HACK – Developed by Facebook.  FB is eventually planning to replace its PHP with Hack.  It supports both static and dynamic typing without making any compromise on the performance. Critics are saying it already go the endorsement that it is being used by FB at the same time it looks like a upgrade of PHP.

Swift – Developed by Apple. It is for developing the applications for iPhone, iPad and Mac.  It is expected to gain traction due to large market (App Store) and ease to use it compare to objective-C.  and it got 16th spot in the Tiobe programming trend index.  Its main feature is playground, which has two windows. Code will be displayed on a window and Application will be running on other window.  Make the changes in the code window it will be automatically reflected in the application window without compiling it. This feature is inspired from a language called Ligth-Box, creator of Swift claiming that this feature will reduce the learn curve drastically.

GO – Developed by Google.

Tuesday, October 29, 2013

Acronyms / Abbreviations

Though to consolidating the acronyms / abbreviations that are used across in the industry (Software).

A
ADO - Activex Data Object
AOP - Aspect Orient Programing
API - Application Programming Interface

AJAX - Asynchronous Javascript And XML
ASP - Active Server Pages
AUP - Agile Unified Process

B
BYOD - Bring Your Own Device

C
CDO - Collaboration  Data Objet
CLR - Common Language Runtime
CORBA - Common Object Request BRoker
COM - Component Object Model
COTS - Commercial Off the Shelf 
CSS - Cascading Style Sheets
CVS - Concurrent Version System


D
DHCP - Dynamic Host Configuration Protocol
DLL - Dynamic Link Library
DRY - Don't Repeat Yourself
DDD - Domain-Driven Design
DTO - Data Transfer Object

E
EAR - Enterprise ARchive
EJB - Enterprise JavaBeans

F
FTP - File Transfer Protocol

G
GPL - General Public License

H
HATEOAS - Hypermedia As The Engine Of Application State
HTTP - Hyper Text Transfer Protocol

I
IaaS- Infrastructure As A Service
IDE - Integrated Development Environment
IEEE - Institute Of Electrical and Electronics Engineers
IIS - Internet Information Service

J
JSON - Javascript Object Notation

K
KISS - Keep It Simple Stupid

L
LINQ - Language Integrated Query

M
MAPI - Messaging Application Programming Interface
MOSCOW - Must,Should, Could , Would 
MSIL - Microsoft Intermediate Language
MTOM - Message Transmission Optimization Mechanism
MVA - Model View Adapter
MVC - Model View Controller
MVP - Model View Presenter
MVVM - Model View View Model

O
OLAP - On-Line Analytical Processing
OLTP  - On-Line Transaction Processing

P
PaaS - Platform As A Service

POCO - Plain Old CLR Object
POGE - Principle of Good Enough
POJO - Plaing Old Java Object

R
RAD - Rapid Application Development
REST - REpresentational State Protocol
RFC - Remote  Function Call
RFC - Request For Comments
RMI - Remote Method Invocation
RSS - Rich Site Summary 
RPC -  Remote Procedure Call
RUP - Rational Unified Process

S
SaaS - Software As A Service
SAPI - Server Application Programming Interface
SEO - Search Engine Optimization 
SOA - Service Oriented Architecture



SOAP - Simple Object Access Protocol
SoC - Separation  of Concerns
SOLID - Single responsibility, Open close,  Liskov Substitution, Interface Segregation and Dependency Inversion
SPA - Single Page Application
SQL - Structured Query Language
SSH - Secure Shell
SSIS - Sql Server Integration Service
SSRS - Sql Server Reporting Service
SVN - Sub Version

T
TDD - Test Driven Development


U
UML - Unified Modelling Language
URI - Uniform Resource Identifier

W
WAS - Websphere Application Server / Windows Process Activation Services
WMQ - Websphere Message Queue
WCF - Windows Communication Foundation
WWF -  Windows Workflow Foundation
WWW - World Wide Web
W3C - Word Wide Web Consortium
WYSIWYG - What You See Is What You Get
WOFF - Web Open Font Format

X
XP - eXtreme Programming
XML  - eXtensible Markup Language
XSL - eXtensible Stylesheet Language
XSLT - eXtensible Stylesheet Language Transformation
XHTML - eXtensible Hyper Text Markup Language

Y
YAML  - Yet Another Markup Language
YAGNI - You Aren't Gonna Neet It

Friday, September 06, 2013

Scaling : Horizontal and Vertical Scaling

Recently I came across the term Horizontal and Vertical scaling of infrastructure. Though I am aware about the scaling but I couldn't differentiate differences between these two scaling. After some googling these are difference between these two scaling.

Horizontal Scaling
  • It also described as Scale-out.
  • In Horizontal scaling, additional nodes / computers will be added for scaling.
  • Due to low cost in hardware and introduction of VM, now people are moving towards it.
  • One of the main downside of Scaleout option would be latency and maintenance hardware.
Vertical Scaling
  • It also described as Scale-up.
  • Adding of memory / CPU to a server is called as Vertical Scaling.
  • Downtime is required during the up gradation.  


References
http://en.wikipedia.org/wiki/Scalability#Horizontal_and_vertical_scaling

http://pic.dhe.ibm.com/infocenter/brdotnet/v7r0m2/index.jsp?topic=%2Fcom.ibm.websphere.ilog.brdotnet.doc%2FContent%2FBusiness_Rules%2FDocumentation%2F_pubskel%2FRules_for_DotNET%2Fps_RFDN_Global478.html

Monday, June 11, 2012

Security Series: Session Hijaking / Cookie Stealing

ASP.Net identifies users by means of session ID Cookie [ASP.Net_SessionID].  In case of form authentication it uses additional cookie called .ASPXAUTH.
   
    If an attacker get these cookies then they can impersonate as valid user. Eventhough modern browser restrit to alter these cookies if you access it from differnt site but if the attackers is able to inject the script in our page then they will gain the access to these cookies.
   
This attack can be prevented be these methods
Client IP Address Check:  
Track the client IP address on which the session has been initiated. Deny if the request if the client IP address is different from the initiated IP address. 
       
    Even though this is nice solution but it suite for corporate LAN scenario but not suitable for Internet application. It will reject the client request in these scenarios
        * Connection has been reset and client go new IP Address.
        * ISP provider process all the HTTP through different set of load balance proxy server.
       
HTTPOnly Cookie: 
Mark a Cookie with HTTPOnly flag. This will hide the existance of the cookie to JavaScript but it will pass it with HTTP requests. Mark all the sensitive cookies as HTTPOnly ntill or unless you have a specific reason to access it through Javascript.
       
    By default ASP.Net marks both ASP.Net_SessionID and .ASPXAUTH cookies as HTTPReadonly. You can set it HTTPOnly as mentioned below
       
    Response.Cookies.Add(new HttpCookie("Cookie1")
    {
        Value = "Values",
        HttpOnly = true
    });
   
    It’s not a complete defense against cookie stealing, because you might still inadvertently expose the cookie contents elsewhere.


References
1. Pro ASP.Net MVC 3 Framework by Adam Freeman & Steven Sanderson
2. https://www.owasp.org/index.php/Session_hijacking_attack

Tuesday, June 05, 2012

Book: The Passionate Programmer

The Passionate Programmer by





Saturday, June 26, 2010

Inspiration

I am getting inspired by my kid.. She is 1 year old..
Whenever she watches new thing / animal / item. She gets excited and enjoy watching it.
But once got mature / grow old we start ignoring the new things instead we would satisfy with what we have.. And draw our own circle.

After watching her I have made resolution to explore new thing instead of ignoring it.

Saturday, May 16, 2009

Bubbling Exceptions in Threads

Bubbling the exception from the thread is altogether different from bubbling the exception.

In normal scenario, we will bubble the exception just by throwing the exception in the catch block, but if you do so in the multi thread applications these exceptions will be lost in transition.

public void Main()
{
try{
Thread MyThread = new Thread(new ThreadStart(ThreadMethod));
MyThread.Start();

MyThread.Join();
Console.Writeline("Completed Without Errors");
}catch (Exception ex){
Console.Writeline(ex.ToString());
throw;
}
}

private void ThreadMethod()
{
try{
Thread.Threading.Sleep(10000);
throw new Exception("Generated Error");
}
catch(Exception){
throw;
}
}

The exception generated in the ThreadMethod() won't be caught in the Main() catch block, rather it will print the statement "Completed Without Errors" in the console window. Because of the following reason, in the ThreadMethod() once the exception is generated and bubbled, but in the due course of time when it reaches the Main() method. Status of "MyThread" is completed and the it is removed from the memory.

Then, how to bubble the exception effectively to the calling program. In this case we need to assign the exception to the common variable and check the status in the Main() method.  



public class MyClass(){

Exception _ThrdMtdExp=null;

public void Main()

{
try{
_ThrdMtdExp =null;
Thread MyThread = new Thread(new ThreadStart(ThreadMethod));
MyThread.Start();
MyThread.Join();
if (_ThrdMtdExp!=null)
throw new Exception("Exception Raised by ThreadMethod()",_ThrdMtdExp);
else
Console.Writeline("Completed Without Errors");
}catch (Exception ex){
Console.Writeline(ex.ToString());
throw;
}

}

private void ThreadMethod()
{
try{
Thread.Threading.Sleep(10000);
throw new Exception("Generated Error");
}
catch(Exception ex){
_ThrdMtdExp = ex;
}
}
}

Now, the Main() method will capture the exception occured in the ThreadMethod().

Wednesday, May 21, 2008

Oracle Rownum Functionality in MySQL

In oracle we use the RowNum for various reasons. Here we are focusing on the usage of RowNum on Select statement.

In MySql Limit will be the alternate to the RowNum feature. Additionally it can be used along with the Update / Delete statement. Example for the Limit usage is
Select * from table order by column A LIMIT

Saturday, November 18, 2006

Find Locking Objects in Oracle

This article will be helpful to identify the objects which are locked, blocking locks and the exactly which row is locked in Oracle DB.

In order to execute these query you should have the select grant on the following Oracle System Tables
* v$session
* v$Locked_object
* v$lock


/* To Identify the Locking*/
SELECT a.object_name, a.owner object_owner,
decode(b.locked_mode, 0, 'None',
1, 'Null (NULL)',
2, 'Row-S (SS)',
3, 'Row-X (SX)',
4, 'Share (S)',
5, 'S/Row-X (SSX)',
6, 'Exclusive (X)', b.locked_mode) locked_mode,
b.session_id sid, b.oracle_username, b.os_user_name
FROM all_objects a, v$locked_object bWHERE a.object_id = b.object_id
ORDER BY 1

/* To Identify The Bolking Locks*/
select s1.username '@' s1.machine ' ( SID=' s1.sid ' ) is blocking ' s2.username '@' s2.machine ' ( SID=' s2.sid ' ) ' AS blocking_status
from v$lock l1, v$session s1, v$lock l2, v$session s2
where s1.sid=l1.sid
and s2.sid=l2.sid
and l1.BLOCK=1
and l2.request > 0
and l1.id1 = l2.id1
and l2.id2 = l2.id2 ;


/* To Identify Which Row is Locked*/
/* Replace the Tag <> with the appropriate SID*/
select row_wait_obj#, row_wait_file#, row_wait_block#, row_wait_row# from v$session where sid= <>;

/* To Identify Which Row is Locked*/
/* Replace the Tag <> with the appropriate SID*/
select do.object_name,
row_wait_obj#, row_wait_file#, row_wait_block#, row_wait_row#,
dbms_rowid.rowid_create ( 1, ROW_WAIT_OBJ#, ROW_WAIT_FILE#, ROW_WAIT_BLOCK#, ROW_WAIT_ROW# )
from v$session s,
user_objects do
where
s.ROW_WAIT_OBJ# = do.OBJECT_ID
and SID=<>;

Friday, November 17, 2006

Transparent Background For User Controls on C#

Inorder to set the Transparent property to your user control,

Please add the following code in the Construtor of your code

// Setting the Control's Style Property
this.SetStyle(System.Windows.Forms.ControlStyles.SupportsTransparentBackColor,true);

//Set the Backcolor of the Property to Transparent
this.Backcolor=System.Drawing.Color.Transparent;