Saturday, July 23, 2016

Mythological Animal Exists

Hi Friends,

You might have heard lot of stories about mythological animals or birds. Few famous creatures like Unicorn, Phoenix, Pegasus, Sphinx, Airavat, Makara, Centaur, Mermaids and so on. Most of the countries have a list of such kind of mythological animals. 

Today morning after a long gap I went for a walk. It was somewhat cloudy day. Sun and clouds were playing hide and seek game. I completed around half of distance to my target and I saw few vehicles with Maharashtra passing. Surrounding to those vehicles peoples created some temporary huts. 

Curiously I went near to those vehicles and I enquired those peoples from where you have came and some more details we shared each other. And saw one OX seating near to one vehicle and felt I should take the snap of that ox and share with you all.

Then I asked the guy, how it could be three horns on bull head. Very honestly he told it's god grace. Without speaking much i left the place with two beautiful snaps. But still remember his words God's Grace.



Tuesday, July 12, 2016

Humanity Repay Instantly

It was a rainy season and mid of August month. Although I visited Mumbai several times before, I was very much interested to visit Mumbai (Financial Capital of India) this time. Reason to my Mumbai visit was quite special for me and my family, because my younger brother (around 5 year younger to me) got a State Government job through State Public Service Commission.

He was staying with his friends who were working in Maharashtra State Police department. So just to visit this gang of government employees I booked to and fro Railway tickets. I started my journey, it was as usual for me because I travel most of the time by train to my home town.
 
My brother came to pick me at Chatrapati Shivaji Terminal railway station. We were having a plenty of time so we roamed around the Nariman Point and his working place, we took some food parcel outside and went to his residence. I had a nice dinner with brother and his roommates. I stayed one night with them, during that night brother was curious to tell me about his job and responsibilities he delivers.
 
Next day we both went to one of our cousin sister and my maternal aunt's house. As my journey was schedule only for two days, I have to start my backward journey. I was having return journey from Kalyan to Bangalore City via Udyan Express. I boarded the train from Kalyan. My seat number was 71 usually it will be at the end of the coach and no one like to get that seat due to bad smell of toilets, but it's beyond our control to get seat berth.
Around 10:30 AM at Lonavala railway station one mid age lady with two big luggage bags and a small baby boarded the train and sat near the coach door. I guess her ticket was not confirmed so she was waiting for Ticket Checker. Finally TC Came and after having a look on her ticket promised her to get seat allotted before night. Keeping hope that lady sat waiting TC to come back with some seat number.
 
Afternoon some peoples offered her temporary seat to feed the baby and take some rest. I was monitoring it throughout the day, felt very bad that no one was with that lady. After her interactions with other passenger I came to know that baby was just 20 day's old. Whenever wind passes over baby face, baby used to turn red in color. It was obvious that 20 days old baby skin will be too much delicate.

Here I have to mention berth no 72, the person holding this berth was a Muslim young age IT professional guy. We had a discussion over technology and rest other matters like family, politics, education etc. Finally a small talk on lady which I mentioned earlier. I kept my proposal of giving her my seat and share his seat for seating purpose because his berth was side lower, on that talk and with mutually understanding we both made a decision to offer my berth to that lady and his berth we will share as RAC allotment.

Around after having our dinner we all acted as per our plan. I was suffering with backache prior to journey, so I made my decision to sleep on floor and informed the other fellow to relax on berth. Somehow we all passed that night. And next day morning we all got down to desired destination. But still I was wondering no one came to pick that lady, few passengers helped her to get down her luggage. Anyhow it was none of my business to know why someone didn't came to pick or drop her. Humanity grounds I supposed to help her and I did with own satisfaction.

After two to three months time later my brothers marriage got fixed. Marriage date was 26 March. And same time our family was having another good news that I was going to become second time father (my wife was carrying for second child). So I supposed to pre-pone my elder kids exams in month of Feb and travel towards hometown. Again I did our journey ticket booking, but I couldn't got confirmed tickets, all passengers ticket status was waiting list.
 
Journey day arrived but still out status was waiting list with reduced numbers. So we made a courage to travel let the ticket get confirmed or not. As per the railway department policy somehow we got the RAC for both of us in same coach, at least this was helpful us to be together. We decided that wife will sleep on berth and I will sleep on floor.
 
Ticket Checker arrived to our coach and checked all the tickets in our coach, so I requested him to allot at least one berth, but he said it is not possible. After listening our discussion one young guy came to me and said I have one extra seat as one of our passenger is not travelling, you can accommodate your wife in that berth.
 
Here I remembered our Hindi phrase saying "Jaisa Karoge Vaisa Paoge". Then I reiterated the Bombay story to my wife and we both learned a lesson from personal experience that always help needy persons, some other day someone will help you.
 
Thanks to read.

 

Tuesday, March 29, 2016

Tech Lead Roles and Responsibilities

Tech Lead - Roles and Responsibility 

We can divide the Responsibilities for the Technical Lead position in following two ways

1.  Project Responsibility
      2.  General Responsibility
    Project Responsibility:
    1. Own the Responsibility of the overall sprint or iteration outcome
    2. Use project’s best practices and coding standards
    3. Prepare and help team to prepare the design; should have a very good understanding of the project architecture
    4. Coding and unit testing including JUnits
    5. Conduct peer review and provide feedback
    6. Remove the technical impediments
    7. Update regular associates RAG (Red, Amber, Green) status; discuss the Red cases on the immediate basis with the project manager to help the manager in the attrition management
    8. Update sprint tracker with accurate information to identify the risk and issues proactively at the sprint level
    9. Conduct project risk identification and mitigation action planning with the PM at the project level
    10. Participate in CAR and help in preparing the data
    11. Conduct FIR; Process check master – to make sure that his team is following all the listed procedures
    12. Constantly looking for ways to increase the team’s velocity/productivity by eliminates the waste. This should be one of the discussion points in the annual appraisal.
    13. People management & Technical management
    14. Help PM in the annual and mid-year appraisal process
    15. Assist project manager in the project coordination/management
    16. Report the status with alarms, explanations and solutions;
    •       Promptly escalate issues to the reporting manager
    •       Track and resolve issues
    1. Target - Zero surprises; proactively react to the surprises with the detailed written explanation
    2. Last but not the least, tech lead should be a reference book for your team members

    General Responsibility:
    1. Interface between team and management
    2. Write quality code, set an example of quality in front of the team members
    3. Gain the team’s respect with the quality of your work and by doing what you are preaching
    4. Define early on what success means for you, the team and the business
    •       Set reasonable expectations in front of the team
    1. Should be part of the design team
    •       Should have design vision and understanding
    1. Be firm but fair
    2. Admit your mistakes
    3. Build and maintain high team morale
    4. Should not be biased towards any individual professionally but personally you can J
    5. Task assignment should be fair
    •       Tasking should be done with the team together
    •       Match people and tasks based on their skills and their personal preference
    •       Work the estimate with the team
    1. Try to become a role model for the team
    2. Take necessary measures to avoid centralization of knowledge. There should not be any dependency in the project on anybody.
    3. Mentor people; It is your job to raise the education level of your team
    4. Quality with on time delivery of agreed deliverable
    5. Team can approach lead any time for any functional or technical concern
    •       Tech lead requires balancing between technical and leadership talents.
    1. Lead should Motivate/encourage the team members
    •       Especially when team is under pressure with the tight deadline
    1. Lead should share the limelight with the team
    2. Don’t blame anybody publicly for anything
    3. Work as hard or harder than anyone else in the team
    4. Focus on the technologies associated with the software or application you are building. Learn those technology thoroughly
    5. Flexible enough to work under different work environments settings
    6. Fun @ work

    Thursday, January 14, 2016

    How to get the Last Restored Database details

    How to get SQL Last restored database details

    Hi Friends,

    Sometimes we need the details of database which restored last, following query will help you to get those details


    SELECT
    Destination_Database_Name,
        Restore_Date,
    database_name AS Source_Database,
        Physical_device_name as Backup_File_Used_To_Restore
    FROM
    msdb.dbo.restorehistory rh
    INNER JOIN msdb.dbo.backupset bs
    ON rh.backup_set_id=bs.backup_set_id
    INNER JOIN msdb.dbo.backupmediafamily bmf
    ON bs.media_set_id =bmf.media_set_id
    ORDER BY
    [rh].[restore_date] DESC


    Thanks.

    Monday, December 22, 2014

    Get End Of Month in SQL Query

    There is in built function of SQL is available to get the End of the Month Date.

    EOMONTH(StartDate, MonthToAdd)



    Examples:

    SELECT EOMONTH ( GETDATE() ) AS 'This Month';
    SELECT EOMONTH ( GETDATE(), 1 ) AS 'Next Month';
    SELECT EOMONTH ( GETDATE(), -1 ) AS 'Last Month';

    How to Get the logged in SQL User Name

    Hi Dear All,

    There is small in build function of SQL to get the logged in SQL User,

                  SUSER_SNAME ( [ server_user_sid ] ) 
    server_user_sid (Security Identification Number) is optional parameter for the function, it can be SQL Server Login or Windows User.
    If this parameter is not passed it will result the currently logged in user name.
    
    
    Use:
    SUSER_SNAME can be used as DEFAULT constraint for the column values.
    
    
    
    
    
    

    Sunday, November 09, 2014

    Best Practice to write SQL - Stored Procedure.

    Hi Friends,

    As every application has a Database, and some objects which are helping us to perform the actions on our Data, here I am going to tell Stored Procedure SQL Object related best practices.

    • Use the SET NOCOUNT ON statement as the first statement in the body of the procedure. That is, place it just after the AS keyword.
    • Use schema names when creating or referencing database objects in the procedure. It will take less processing time for the Database Engine to resolve object names if it does not have to search multiple schemas.
    • Avoid wrapping functions around columns specified in the WHERE and JOIN clauses. Doing so makes the columns non-deterministic and prevents the query processor from using indexes.
    • Avoid using scalar functions in SELECT statements that return many rows of data. Because the scalar function must be applied to every row, the resulting behaviour is like row-based processing and degrades performance. 
    • Avoid the use of SELECT *. Instead, specify the required column names.
    • Use explicit transactions by using BEGIN/END TRANSACTION and keep transactions as short as possible. Longer transactions mean longer record locking and a greater potential for deadlocking.
    • Use the Transact- SQL TRY…CATCH feature for error handling inside a procedure.
    • Use the DEFAULT keyword on all table columns that are referenced by CREATE TABLE or ALTER TABLE Transact-SQL statements in the body of the procedure. This will prevent passing NULL to columns that do not allow null values.
    • Use NULL or NOT NULL for each column in a temporary table.
    • Use the UNION ALL operator instead of the UNION or OR operators, unless there is a specific need for distinct values. The UNION ALL operator requires less processing overhead because duplicates are not filtered out of the result set.


    hope it will help to increase your application performance.


    Write exceptions to System Event Log.

    Hi Dear friends,

    I was in need to use the Operating System Event Logs, to save the c# exceptions, where I got the following information from our coder's guru... (Google)

    Namespace to be included : System.Diagnostics
    Classes: All classes in above mentioned namespace allow us to communicate with the System Processes, Event Logs and Performance Counters.

    Following is the code snippet where I have used EventLog class default constructor to log the event to the system event viewer

    Output to the above Code snippet

    Thanks,
    Hope it helps.

    Tuesday, July 08, 2014

    Find column exists in SQL database (COL_LENGTH)

    COL_LENGTH

    It is a built in function, which returns the length in bytes of the column.

    COL_LENGTH('Table_Name','Column_Name')

    Table_Name: Name of the table for which column length info required, it is nvarchar type expression.
    Column_Name: Name of the column who's length is required, it is also nvarchar type expression.

    It returns NULL on error or if users do not have permission to view object.

    Wednesday, July 02, 2014

    Bramhakamal (Orchid Cactus)

    Hi Dear all,

    Near to my home (in Bangalore) I have captured the growth of Bramhakamal flower growth, please have a look, snaps are here with little information for you all....
    Early Stage - Bud
    It belongs to Cactacease. Also known as Night Blooming Cereus, Queen of the Night or Lady of the Night, it is beautiful lotus like flower.


    For planting, you can cut the stem / leaf and plant in the soil which has acidic features, or you can put the stem / leaf in water for around 3 weeks, after 3 week it will produce roots and then you can plant it in soil.











    This flower bloom only for a night, blooming will start around 1900 hours and after 2 hours it blooms fully, early in the morning it drops.










    Flower




    Nice use by Mother for worshiping



    Thursday, June 13, 2013

    Limiting SQL Query Result Set to few number

    Hi All,

    With TABLESAMPLE keyword we can restrict the Result of the SQL Query, where rows will be selected randomly from the table

    For example one table have 10000 Rows, then with following query we will get approximate 10 % of the rows from table

    SELECT * FROM [TABLE_NAME] TABLESAMPLE (10 PERCENT)

    If the requirement is for the same set of records every time then we have to use REPEATABLE keyword at end with some seed value as shown below

    SELECT * FROM [TABLE_NAME] TABLESAMPLE (10 PERCENT) REPEATABLE (205)

    Tuesday, June 11, 2013

    Find empty tables in SQL Database

    Hi friends,

    Here is the SQL code to find the Table Names and their owner of the Database where 0 records are available.

    ;With CTE(TableName, SchemaName, RowCnt)
    As
    (
     Select
    T.Name As TableName, S.name As SchemaName, R.RowCnt
     from Sys.tables As T Inner Join
     (
    Select
     ID, rowcnt As RowCnt
    From SysIndexes Where IndId < 2
     ) As R On T.[Object_Id] = R.Id
     Inner Join sys.schemas As S On S.[schema_id] = T.[schema_id]
    )

    Select
     TableName, SchemaName
    From CTE Where RowCnt = 0 

    Thursday, June 06, 2013

    Convert Money to Varchar using SQL

    Hi,

    When we try to convert Money variable to Varchar in SQL it automatically round off the value to 2 decimal places.

    Following is example

    DECLARE @UnitCost MONEY

    SET @UnitCost = .0167

    SELECT
       @UnitCost,
       CAST(@UnitCost AS VARCHAR(30)),
       CAST(@UnitCost AS DECIMAL(30, 4)),
       CAST(CAST(@UnitCost AS DECIMAL(30, 4)) AS VARCHAR(30))


    but if you want value to be rounded off upto 4 decimal places then please see the following code

    DECLARE @UnitCost MONEY

    SET @UnitCost = .016789

    SELECT
        @UnitCost, convert(varchar(10),@unitcost,2),

    Thursday, April 25, 2013

    How to add other ASP.Net Page events apart from Page_Load

    Dear Friends,

    When we add any new ASP.Net page in solution, By default we will get Page_Load event in the code behind file. But if we want to add other Page Life Cycle events and write some logic on it, here is the way to do it.

    1.  Open Solution Explorer
    2.  Select the Asp page on which you want to add events
    3.  Right click on page and select View Component Designer as follows


    4.  Then click on the Properties or Press F4 button and click on the yellow button to get list of all page life cycle event as follows


    Happy coding.....

    Monday, April 15, 2013

    Sequence of ASP.Net events including Application, Page and Control

    Application: BeginRequest

    Application: PreAuthenticateRequest

    Application: AuthenticateRequest

    Application: PostAuthenticateRequest

    Application: PreAuthorizeRequest

    Application: AuthorizeRequest

    Application: PostAuthorizeRequest

    Application: PreResolveRequestCache

    Application: ResolveRequestCache

    Application: PostResolveRequestCache

    Application: PreMapRequestHandler

    Page: Construct

    Application: PostMapRequestHandler

    Application: PreAcquireRequestState

    Application: AcquireRequestState

    Application: PostAcquireRequestState

    Application: PreRequestHandlerExecute

    Page: AddParsedSubObject

    Page: CreateControlCollection

    Page: AddedControl

    Page: AddParsedSubObject

    Page: AddedControl

    Page: ResolveAdapter

    Page: DeterminePostBackMode

    Page: PreInit

    Control: ResolveAdapter

    Control: Init

    Control: TrackViewState

    Page: Init

    Page: TrackViewState

    Page: InitComplete

    Page: LoadPageStateFromPersistenceMedium

    Control: LoadViewState

    Page: EnsureChildControls

    Page: CreateChildControls

    Page: PreLoad

    Page: Load

    Control: DataBind

    Control: Load

    Page: EnsureChildControls

    Page: LoadComplete

    Page: EnsureChildControls

    Page: PreRender

    Control: EnsureChildControls

    Control: PreRender

    Page: PreRenderComplete

    Page: SaveViewState

    Control: SaveViewState

    Page: SaveViewState

    Control: SaveViewState

    Page: SavePageStateToPersistenceMedium

    Page: SaveStateComplete

    Page: CreateHtmlTextWriter

    Page: RenderControl

    Page: Render

    Page: RenderChildren

    Control: RenderControl

    Page: VerifyRenderingInServerForm

    Page: CreateHtmlTextWriter

    Control: Unload

    Control: Dispose

    Page: Unload

    Page: Dispose

    Application: PostRequestHandlerExecute

    Application: PreReleaseRequestState

    Application: ReleaseRequestState

    Application: PostReleaseRequestState

    Application: PreUpdateRequestCache

    Application: UpdateRequestCache

    Application: PostUpdateRequestCache

    Application: EndRequest

    Application: PreSendRequestHeaders

    Application: PreSendRequestContent

    Thursday, March 28, 2013

    Disable UAC (User Account Control) Setting in Windows 8

    Disable UAC (User Account Control) Setting in Windows 8

    Hi,
    This post i want to tell that in Window's 8 OS, although we Enable / Disable the UAC setting. It didn't affect in Registry (REGEDIT).

    First we will see what is UAC
    UAC (User Access Control):

    It notifies us before changes are made to our PC that require administrative permissions. Mean once we change the UAC Setting from "Always Notify" to "Never Notify" we can Install Programs / Software which Window's OS thinks as harmful to system.

    How to launch UAC Setting Screen: 

    Open windows Run
    Type "MSCONFIG" and press enter
    Select Tools tab
    Select "Change UAC Setting" tool and
    Click on "Lauch" button

    or

    UAC Application Location:
    C:\Windows\System32\UserAccountControlSettings.exe

    Issue with Windows 8:

    Althoug you change the UAC Setting with appliction. It didn't get changed in the Windows Registry, so in that case we have to change the value against concern Key in Registry as follows

    Open the registry with REGEDIT command from Windows RUN and locate the following key in registry

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System

    here in right pane change the value for EnableLUA from 1 to 0 and restart you machine and enjoy...



    Bye.


    Monday, March 25, 2013

    Computed Column in SQL Table


    Computed Column:

    We can add computed column in SQL Database tables where the value of one column is calculated from one or more columns of the same table. While creating table we have to use the column name for calculation of computed column.

    Example:

    I want to calculate the Square, Cube etc of the Number and store in database. For this i have the following create table statement

    CREATE TABLE ROOTS
    (
    Num Int,
    Sq As (Num * Num),
    cub As (Num * Num * Num)
    )

    Here first column of the table definition is number for which I want to calculate the Square and Cube, so while adding second column as Sq (Square) I have used first column name Num * Num, and same way for cube.

    Insert values in table.

    Insert one value at a time into table.
    INSERT INTO ROOTS VALUES (-1)

    Insert more than one value into table.
    INSERT INTO ROOTS VALUES (1) , (2) , (3) , (4) , (5) , (6) , (7) , (8)


    One computed column we can not use for the calculation of another Computed column. If we try to create table definition as shown below

    CREATE TABLE ROOTS
    (
    Num Int,
    Sq As (Num * Num),
    cub As (Sq * Num)
    )

    SQL Query Analyser will throw the following error

    "Msg 1759
    Computed column 'Sq' in table 'Roots' is not allowed to be used in another computed-column definition."

    Friday, March 22, 2013

    Take SQL Database Backup using C#


    Take SQL Database Backup using C#

    Hi Dear,

    I have studied it from one of the Blog. Where using SQL Server SMO (Server Management Object) in C# how to take a SQL Server Database Backup. There are other ways also to take database backup like through wizard in SQL Management Studio.

    1.  Add following references to your project

    a.  Microsoft.SqlServer.ConnectionInfo
    b.  Microsoft.SqlServer.Management.Sdk.Sfc
    c.  Microsoft.SqlServer.Smo
    d.  Microsoft.SqlServer.SmoExtended
    e.  Microsoft.SqlServer.SqlEnum

    2.  In your CS file add folliwing 2 Usings statements

    a.  Microsoft.SqlServer.Management.Smo;
    b.  using Microsoft.SqlServer.Management.Common;


    following classes objects used to take Backup

    a.  Backup
    b.  BackupDeviceItem
    c.  ServerConnection
    d.  Server
    e.  Database

    and following enums are used for assgning values

    a.  BackupTruncateLogType ( it contains NoTruncate, Truncate and TruncateOnly)
    b.  BackupActionType (it contains Database, Files and Log)


    Steps to take Backup:
    1.  Create object of Backup Class
    2.  Assign Action, Database, BackupSetDescrption, Checksum, Intialize, ContinueAfterError, ExpirationDate etc properties.
    3.  Create object of BackupDeviceItem class
    4.  Create object of ServerConnection class
    5.  Create object of Server class with ServerConnection object
    6.  Add object of BackupDeviceItem class as Device to object of Backup Class
    7.  Call SqlBackup method of object of Backup Class
    8.  Remove Device from object of Backup Class

    Code:

    public void BackupDatabase(string databaseName, string userName, string password, string serverName, string destinationPath)
                {

                    try
                    {                  
                        Backup BKP = new Backup();

                        BKP.Action = BackupActionType.Database;
                        BKP.BackupSetDescription = "BackUp of: " + databaseName.ToUpper() + "on" + DateTime.Now.ToString();
                        BKP.BackupSetName = databaseName.ToUpper();
                        BKP.Database = databaseName.ToUpper();

                        BackupDeviceItem deviceItem = new BackupDeviceItem(destinationPath + databaseName.ToUpper() + "_" + DateTime.Now.ToString("ddMMyyyyHHmmss") + ".bak", DeviceType.File);

                        ServerConnection connection = new ServerConnection(serverName, userName, password);

                        Server sqlServer = new Server(connection);
                        sqlServer.ConnectionContext.StatementTimeout = 60 * 60;
                        Database db = sqlServer.Databases[databaseName];

                        BKP.Initialize = true;
                        BKP.Checksum = true;
                        BKP.ContinueAfterError = true;
                        BKP.Devices.Add(deviceItem);
                        BKP.Incremental = false;
                        BKP.ExpirationDate = DateTime.Now.AddDays(3);
                        BKP.LogTruncation = BackupTruncateLogType.Truncate;
                        BKP.FormatMedia = false;
                        BKP.SqlBackup(sqlServer);
                        BKP.Devices.Remove(deviceItem);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                        Console.Read();
                    }
                }
            }