Adsense_TOP

Tuesday, 4 November 2014

How to change the console screen color.

For changing the background color in a console screen

Console.BackgroundColor = ConsoleColor.Red 

For changing the color of the fonts in foreground

Console.ForegroundColor = ConsoleColor.Red 

Thursday, 30 October 2014

adding a Snippet to your Visual studio.


for adding a CODE SNIPPET  for CONSOLE.READLINE

Code snipets in vs

try this out
for FOR loop
just write
For
then press tab two times..

for WHILE loop ,write

while
then press tab tab .

for DO WHILE loop, write

do
press tab tab

for CONSOLE.WRITELINE , write

cw
then press tab tab..

Saturday, 18 October 2014

Create an N-tier Architecture application.

In this Architecture we have multiple application . Where we bi-fercate a single application into multiple application .
Generally we use a single application to have the data model and the multiple application.
But for a N-tier architecture the application is divided into multiple application
like

DAL (Data Access Layer )
BAL (Business Access Layer )
Presentation Layer( It include MVC , ASP.Net )

Here we have a concept  in which we use a wrapper class where wrapper class represents the DataBase.

if we have a table in data base table like Employee the attributes are Emp_id , Emp_name , Emp_age , Emp_address

then you will have to make a class in your class library .

we have to make a GET or SET function with the use of encapsulation method .

Saturday, 11 October 2014

Type conversion in Visual Basic.

There are many different type of casting by which we can convert the data from one format to another.

CBool - converting to boolean .
CByte - converting to Byte .
CInt - converting to int .
CLng - Converting to long .
CDes- converting to decimal .
CStr - converting to string.
CUint - converting to int .
CUlng - convertingto ultra long .

Wednesday, 8 October 2014

How to add constructor to a clasS in VB.NET

While making  the class create a function named "new"

public class  NameOfTheClass

public sub new ()
End sub

public Sub new( str As String , Str1 As String )
End Sub
End class



This is a small example to show how to make the constructor

how to initialize variables in VB.NET

VB is a very basic language. Its has a very was history .Is not type safe is C#.NET.
VB was created for the ease and flexibility in programming.

NOW, initializing variable in VB.

Dim var As Integer 
Dim str As String  

Here we have initialize two different variable to int  and string Data Type.
We do not need to write semicolon (;) in the end of  the code a VB script .

Tuesday, 7 October 2014

What to choose from Inherits or Implements in VB

Its very simple to understand that ,
when we are having two  class  CLS1 & CLS2
then we have to use INHERITS

but in case we are having a class and a interface  CLAS1 & INTERFACE
then wee have to use  IMPLEMENTS 

Tuesday, 30 September 2014

AngularJs is a Framework of the Jscrit to work in a better way .

A basic knowledge of HTML,cssand JScript is requiredbefore starting angular js.
ng-directives are uses to extentHTML content.
and we need to download the AngualrJs
CLICK HERE
After adding the AngularJs to your web page it will automatically gets loaded to your web page .
'ng-app' directive is added to div which tells the js that div is the owner of the AngularJs  applicaion

<div ng-app="">
------
------
</div> 

"ng-model" it binds the inserted values with a variable name

<p>The name of the User is <input type="text" ng-model="first_name"/></p>

here the firstname is the variable is which the value is being entered
now we will bind this value to any other component . which is called as two way binding
this can be get by 'ng-bind'

<p>The name of the User is <input type="text" ng-model="first_name"/>>/p>
<p ng-bind='first_name'>
</p>

Links from making the animation in XAML.

Monday, 29 September 2014

How to post data in MVC using form collection for Beginners.

Here we can simply put the data into the form tag and give each component an name .We are creating a login form using the MVC Architecture.

<form method="post" action="Name_of_the_function>
<input type="text" name=username id=username>
<input type="password" name =pass id=pass>
<input id=submit type="submit">

on controller
[httppost]
public ActionResult Name_of_the_function(formcollection form)
{
string str=form["username"];
string str1= form["pass"];
}

How to post data using J-Query

Here we are making a post method using the J-Query.
Firstly we specify the component which is calling the function.
Here "btn" is the component Id which is calling the post method .
The post function is AssignVal().

$("#btn").click(function(){
$.(post)("AssignVal",{ARG1:$('#Component1_Id ').text(), empid:$('Component2_Id').text()});
location.reload();
 });


Sunday, 28 September 2014

Delete a specific row using LINQ

Here we are having a table in the Database name DBentities .
The name of the table is Employee.
here we are deleting a row where emplyee_id is emp_id

var v = from row in dbentities.employee 
where employee_id==emp_id select row


if(v != null)
{
dbentities.employee.remove(v);
}



Saturday, 27 September 2014

Inserting Data using EF with MVC4.

I think you can add EF in your project.
Then open model1.edmx or what ever is the name of your file .noe go to it property and change  the property CODE GENERATION STRATEGY to default.
Now delete the 2 xyz.tt file from the model1.edmx.

Firstly add your model on the file like
using PROJECT_NAME.model

den u can add your model entity as

modelentities obj= new modelentities ();
then creating a function in the controller as .

public void addintotable()
{
table1s obj1= new table1s();
obj1.atribute1= value;// adding string value
obj1.attribute2=convert.toint32(value); // adding an int value 
// you can add as many as atttribute you ant to add .

Friday, 26 September 2014

For Beginers on Entity Framework (EF.)

Enitity Framework is another way to ad database to your  project.Here can add a model in the solution so that we can link the database. Here we don't need to write the SQL connection again and again. this also uses LINQ. that is the  another way to insert or fetch the data from the database..
firstly right click on the solution in the solution explorer window. then we can add ADO entity model from the "Data" section.then give the server name and select your database then select the table you want to add.
NOTE:  primary key is required in  every table for EF to work on that specific table .

Some more links for Angular js

How to fetch the image from database using linq , where image is stored in byte code in DataBase.

Here we are having a database model as dbtest, where pictures is the
Table name the Column name is img.
There is panel named ImgPanel where we are Getting the images

dbtestEntities db = new dbtestEntities();
var images = from p in db.Pictures
     select Image.FromStream(new MemoryStream(p.img.ToArray());

foreach (Image image in images)
{
    ImgPanel.Controls.Add(image);
}

Thursday, 25 September 2014

Refrences regarding the AngularJS some of the best links..

Using AJAX for getting data on web pages without reloading them ?

We have to be a bit familiar with the Java script for the use of ajax.
In this example ,a java script function which is calling the post function using ajax.
<script type="type/javascript" >
function ajaxunload()
{
//here we created the obj of the xmlhttprequest , which is a mile stone to ajax .
//all latest browser like internet explorer 5 or abve uses activeXobject
//this object exchanges the data with the server ..
obj  = new XMLHttpRequest();
//It stores the function or the name of the function to be called automatically when the readystate //property changes 
 obj.onreadystatechange = function ()
 {

   if (obj.readyState == 4 && obj.status == 200)
{
// here we are storing the data which is returend from the ajax function.
  var s = obj.responseText
   obj.abort();
  }
 }

  obj.open("POST", "postfunction", true);
  obj.send();
}
</script>

using session for login and logout in asp.net

firstly open the "Global.aspx".

then create a function there
 protected void Application_Start()
{
//we give the name of the session  here and declare it null ..username is the name of the session
//we can change it according to our needs
Sesssion["username"]="";
}


now we can create the function where we are login as
function boolean login( string username, string password)
{
  // firstly we match the login details from the database.

if(username == logincredintialfromdb && password ==logincredintialfromdb )
{
// the values are matched here so are assiging the value to the session variable
Session["username"]= username ;
return true;
}
else
{
return false;
}

}




How to use lamda expression for updating using LINQ

This is small example showing how we use lamda expression in the programming section , Generally we use lamda expression when working wiht LINQ , or the classs of list type where need to get the data based on any where clause.


public Boolean Update(string id)
{
int flag = 0;
string str = DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year;
foreach (var c in obj.Task_Details.Where(x => x.task_no == id))
{
c.task_date = str;
flag = 1;
c.status = "Complete";
}
obj.SaveChanges();
if (flag == 1)
{
return true;
}
else
{
return false;
}
}