Featured post

Concepts of Object-oriented programming: classes & objects

Object-oriented programming:  classes and objects Object-Oriented programming ( OOP's ) is style that follow certain pattern ...

15 Sept 2017

Concepts of Object-oriented programming: classes & objects

Object-oriented programming: 

classes and objects


Object-Oriented programming (OOP's) is style that follow certain pattern to keep in mind about objects for design and develop any application. Object means actual implementation of the raw plan which shows actual result. Here we will understand the Objects and Class in simple way.

you will get many technical details about Objects and Classes in various blogs so we will not discuss here in technical, we will get a simple and practical example that we are seeing in daily life around us.

here you will find more OOP's concept Click here

Here we start,

Class:- 

Class is a model (some technical words i used here but don't worry it will not eat your head) of something that we want to create in real world. lest consider one example we want to create roof garden for our house. then roof garden creator will create the plan for it. using that plan actual look and feels will come in reality. it means plan is a blue print not actual implementation. using that plan we can create many roof gardens. now may be you understood that class is a just plan (blue print).  
Class (roof garden plan) 

Objects:- 

An object is instant of the class, means actual implementation of the plan. in class explanation we have take example of roof garden plan as a class then actual (physically present) roof garden is a object. here we understood that object is a actual presence of the thing which shown in plan (class).
so here we followed the all instruction and restrictions defined in our plan. using that plan we can create many roof gardens.  
Object(Actual implementation) 

To understand in more example we can take one more example for house construction
before building a house we need to take construction plan which will keep all instructions and rules inside it, and that will need to be followed while constructing a house.

using that plan we can build multiple house. means construction plan is a class and actual build house is a objects.

hey!  we understood the class and object in simple words and example. I hole you enjoyed this knowledge. 
here you will find more OOP's concept Click here


21 Jan 2016

Useful Tricky stuffs with VS 2013.


Hear I am going to share very cool and important stuff for Visual Studio 2013 which will make happy coding. The stuffs which will make your development so easy and faster. So hear you are to experience easy coding with VS 2013.



1.  Property:-
For creating property in a class, we need to write access specifier, data type, name and getter and setter.

Ex:-
public int myproperty {get; set;}

Instead of writing all, you can use
Prop (word) and click tab tab (2 times) on keyboard. It will generate property for you. Isn't it cool.

After Tab Tab:-


2.  Foreach:- Instate of writing foreach syntax manually, Just write foreach and press Tab Tab (2 times). VS will write code for you. As same as above.




Note:- Same thing you can use for For loop ,Do While loop,Create class, If statement etc as well.

3.  Improve Vertical Scrollbar:- Normally we used vertical scrollbar for viewing window vertically. In normal scroll bar we can not see Error, change code, unchanged code,current cursor position, break point etc. but using customise scroll bar in VS you can make happy and easy coding :-). For make easy coding you just need to activate customise vertical scrollbar. How you can do this? Just Go to Tools-> Options->Text Editor->All Language->Scroll Bar->Use Map mode for vertical scroll bar




Show preview Tool Tip:- you can magnify the code from scroll bar using this option. this option will find in same location under scroll bar option. look at the above image.

Colour indicates:- In above image colours indicates something.  What is that?
1. Green:-Unchanged code.
2. Yellow:-Changed code.
3. Blue:- Error in code.
4. Red:- Break Point
5. Blue Line:- Its shown current cursor position.
6. Orange:- Find results.
oh! some colours are not visible in image because code doesn't have all conditions given here..

4.  Text Wrap:-
Some time the portion of a code (line) extend beyond code window, its difficult to read. we have to scroll horizontal scroll bar to read code. instate of doing this you can choose option for text wrap mode. you will find same in to Tools->Options->Text Editor->All languages
checked the option for word wrap.




5.  Look into Definitions(Alt+F12):-
look in to Definitions, lets you take a quick view at a class or method definition without opening the actual file. You have to hit F12 to go to an object's definition, but here if you hit Alt+F12 instead, you will be able to take a look up into the definition just below its usage. As shown in Fig, cursor is on "new ContentLibrary()" and  when I hit Alt+F12, bringing up the definition of the class right inside my code window below cursor.




Happy coding.....


8 Aug 2015

How to remove enter (new line) space from column value in sql

Line break


I was recently doing a SQL table data export in to excel that included a plain-text data fields with  New line (Enter) in to same column. On data insertion in to column some time we put Bullets, Numbering and Enter(New line). When business required to get that data we can simple use select query its fine for get data in our application or in SQL grid result. But if we required the same data to export in to Excel or CSV file then you will find some strange result. In my condition there is requirement to get data in to Excel which is having New line into column data. When I tried to copy data from SQL query result to Excel uunfortunately, in Excel result i found new row, where line break exist in query result.
Then I tried to do Trim (LTRIM/RTRIM) for result column, Still problem was same. As we know TRIM does remove White Space, blank space.
  • SELECT LTRIM(RTRIM(YourColumnName)) FROM TableName

I started how is it happening then, I tried to get ASCII char for New line (\n). When I tried to print the new line character using the ASCII function it was showing 10 which is new line character and 13 for carriage return(\r).
  • Declare @myVar VARCHAR(100);
  • SET @myVar='My new line string';
  • SET @myVar=@myVar+CHAR(10)+'Here new line';
  • SELECT @MyVar;

Result:- 
My new line string
Here new line.
  • Declare @myVar VARCHAR(100);
  • SET @myVar='My new line string';
  • SET @myVar=@myVar+CHAR(13)+'Here carriage return';
  • SELECT @MyVar;
Result:- 
My new line string 
Here carriage return.

After digging in to code finally I got solution with replacement function with ASCII code. Here is the exact solution.
    • Declare @myVar VARCHAR(MAX);
    • SET @myVar = 'My new line string';
    • SET @myVar = @myVar + CHAR(13) CHAR(10) 'Here result for single line';
  • SELECT REPLACE(REPLACE(@myVar, CHAR(13), ' '), CHAR(10), ' ');
Result:- 
My new line string Here result for single line.
Finally i got expected result..Happy coding :-).