Posts

How to change the Database Connection of LINQ to SQL Class

Image
Introduction Its very common that couple of developers are working on a single project. Me and one of my friend are also working on a .NET project. We are using LINQ to SQL class to query on the database. This is a desktop Windows Form project and we are maintaining our code as dumbest way possible. That is, when i update on any part, i just mail him the file and he replaces the file. So far so good. Problem statement But when I sent him my project, he couldn't run the database queries. Because the connection string embed on the DataContext.dbml class was not changed. He couldn't find a good way to change the connection string value. So I was searching for a better solution, and at last I found it today. Solution 1. Double click on the DBML file of your project.   2. Now right click on the work area of the DBML file (Start sign in the image) 3. Expand the connection property and check the Data Source value. in my case, it is 'Magicbox' since it is my machin...

HTML Document Object Model

Image
What is it? The HTML DOM defines a standard way for accessing and manipulating HTML documents. The DOM presents an HTML document as a tree-structure. In the DOM, everything in an HTML document is a node. The DOM says: The entire document is a document node Every HTML element is an element node The text in the HTML elements are text nodes Every HTML attribute is an attribute node Comments are comment nodes Example Node tree: From the HTML above: The < html > node has no parent node; it is the root node The parent node of the < head > and < body > nodes is the < html > node The parent node of the "Hello world!" text node is the < p > node and: The < html > node has two child nodes; < head > and < body > The < head > node has one child node; the < title > node The < title > node also has one child node; the text node "DOM Tutorial" The < h1 > and < p > nodes are siblings, a...

ASP.NET MVC Custom Routing Problem (Solved by Areas)

ASP.NET MVC 3 has a built in feature for sub folders. That is called   Areas   (thanks @Morten for let me know the word). But after finishing the   MSDN Walkthrough   for Areas, I was still unable to run the web application. The error was showing   Configuration errors . Then I searched and found that, the   Web.config files in the sub folders shouldn't contain application specific properties . So, I removed those properties from the Web.config files. Then I was able to run. But there were some runtime errors when I wanted to navigate to my sub folder/area views. The error was   "Could not load type ‘System.Web.Mvc.ViewPage<..<>’"   when I click on the links for the views of the Areas folder.   Then I again searched and found helpful   this   post. And then my application successfully run and I can navigate all of the pages.

Introducing Object Oriented Concept

     In this section we will learn about 'How to think in Object Oriented way'.        Objectives       After completing this unit we should be able to:   * Think the real world in object oriented way * Understand what really object and class means * Describe what are attributes and responsibilities of an object.     Topics   In this unit, we will learn about the following topics: * What's wrong with starting of Object Oriented Programming * Philosophy of OOP * Mapping Object Oriented Thoughts to Object Oriented Programming   What's wrong with starting of Object Oriented Programming Unfortunately most of us start Object Oriented Programming (OOP) jumping into a language book like C++, Java or C# etc. But it's not a good start at all. Starting with OOP language book, we may learn writing package/namespace, class, object, interface, etc. But writing class, interface, object etc. does not guarantee good software design. OOP is totally useless if we can't use this c...

Code Smells : The Manual [Part 1]

       Code Smells By the definition i found in    Wikipedia , code smell is: " In  computer programming ,  code smell  is any  symptom  in the  source code  of a  program  that possibly indicates a deeper problem. " We do mistakes while we code. Its very certain. Some of us know about the smell while we code, others don't. But if someone just avoid the common smells in coding, his/her code will be increased a lot in quality. So, to write a quality code, we must know what are the code smells and we MUST avoid it.  My personal opinion is, don't be a procrastinator in coding. Remove the smells after a single method or at least after completing a feature.  In below these are the code smells that a beginner in coding should know. I will add more explanation to each of the smells in future.  [Black circled point is the name of the smell and while circled point is the solution to remove the smell from ...

Implementing database concepts to develop an application in agile approach : Part 1.3 (Coding)

Image
Hello everyone. In my last two post, i have showed how to create a database according to the user's story. In this post, i will show you how to develop/code the application to access the database. I am assuming you all know how to create an application in visual studio 2008 and run it. So, i am not discussing the steps of creating a windows application in Visual Studio IDE. If you have problem in this, please find my other posts in where i have discussed about creating the desktop application in C#. Ok. Lets start. Open Visual Studio 2008 Create a desktop application named ‘ABCUniversityApplication’ Create a windows form named ‘StudentEntryUI’ We have found an object student from our problem domain. So create a class Student which have name, email address, address and phone number as its data. Create a constructor to assign these values when creating a new student object.  public class Student       {   private string name;    ...

Implementing database concepts to develop an application in agile approach : Part 1.2 (Database Server)

Image
Hello everyone. In my last post, i have showed how to create a table schema from real time problem domain, which is now we called as user story. But to work on a database, we need to create tables in a database server. Since i am working on .NET Platform, i am using Microsoft's SQL Server  2005. Installing Microsoft SQL Server 2005: This server is automatically installed when we install Visual Studio 2008. Or you can download the server file from  http://www.microsoft.com/Sqlserver/2005/en/us/express.aspx . Installing Microsoft SQL Server 2005 Management Studio Express: To working on the SQL Server, you need to install a management tool. You can download this from  http://www.microsoft.com/downloads/details.aspx?familyid=C243A5AE-4BD1-4E3D-94B8-5A0F62BF7796&displaylang=en  this location. OK. Now we are ready to work on the SQL Server. When you lunch the management studio express, the following window will appear. Figure 1: SQL Server Management Studi...

Implementing database concepts to develop an application in agile approach : Part 1.1 (Database Concept)

Image
Waterfall vs Agile: Most of the developers in the world start making their software in the traditional way . Traditional means first they gather most of the requirements of the client and then start designing the database where the data will be stored. After designing the database, which is called Entity-Relationship Diagram (ERD), they start coding. This approach is called waterfall . This is a very inefficient approach and it is turning obsolete day by day. New types of thinking and implementations are coming one by one to make a software robust and easily maintainable. The most popular thinking approach now a days is. AGILE The main part of agile is to start the working without waiting for the whole requirement of the client and evolve the application on the requirement of the client [Details] . In agile, we don't use 'Requirement' types of word. We rather use 'User Story' as the specification of the software given by the client. I have used a traditiona...

Introduction to C# : A hands on approach (Part 2)

Image
Introduction to C#: Day 2                         In this lesson you will be familiar with different types of C# syntax some conceptual things.             Objectives:             After completing this unit you should have a clear concept on: *         Data types *         Expressions *         Conditional statements *         Iteration statements *         Methods in C# *         Enum You will be able to create applications using the following controls: *         ComboBox *         ...