Skip to main content

Posts

We newbies and the application design and architecture

After being around for some time in this world of IT I have started to realize why these experienced guys are so furious with the newbies. I use to read a lot of newbie bashing on web and use to think WTF. Now, I must say "Old is Gold". There are three types of newbies I have come across. One who really do not want to design and just wants to get the job done in a procedural way. Second who know a thing or two about design and want to design there application the best possible way (constraint being there knowledge). Third who thinks they know everything about design and that is how things should be designed. The real problem arises when they are working on an application from scratch. The first type may come up with a class or two and finish the code in a monolithic manner. The third type will create a design either too good or to brittle. These two types will surely get the work done even though extensibility and maintainability may not be there and thus the cost of e...

Learning C and or C++ on windows

If you want to start learning C/C++ and still want to use windows, you can either use Microsofts Managed C++ with a great IDE (Visual Studio) or GNU C/C++ compilers. Microsoft has invested a lot in C++ and Visual Studio. The powerful IDE really enhance the productivity. There is lot online documentation using which one can learn Microsoft's Managed C++ thick and fast. You can download Visual Studio Express for free and can start learning. Download Visual Studio 2010 express from here . Learning resources . If you want to learn GNU C / C++ you can start with downloading CodeBlocks. It is an IDE for GNU C / C++  and it comes bundled with the compiler which makes it really easy to install the compiler and avoid the complexities of getting the things in place pieces by pieces. You can download CodeBlocks from here .

The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid

It was 2 o'clock at night when I was creating a model (MVC) using Entity Framework. I thought of creating a UnitTest project to follow some TDD. When I tried to run my first TestMethod I got this vague exception. After investigating further with half closed eyes I found out, how dumb I was to not to include App.config in the test project.  Basic concept is pretty straight forward and logical. We generally add entity framework to a class library project in order to be able to reuse the library. The library project is not an executable in its own. Thus we need to add this project in some executable say a console App, windows App, ASP.NET or UnitTest. The runtime will then expect the executable to have a config associated with itself which will have the connection string, which entity framework library is looking for. Thus, the solution is pretty simple. Add the app.config to the project you are trying to run or add connection string to the config if the project you are ...

Difference between ASP.NET web application and ASP.NET website

When we create web projects with ASP.NET we can either choose Web Application or Web Site. Both of these project types function and perform similarly, but they differ in many important ways which may impact are decision while creating the projects. Few of the differences are as follows: Reference - MCTS self-paced training kit (Exam - 70-515) 1.     You can create an MVC application. 2.     Visual Studio stores the list of files in a project file (.csproj or .vbproj), rather than relying on the folder structure. 3.     You cannot mix Visual Basic and C#. This is because files are stored .csproj or.vbproj and we have only one proj file. 4.     You cannot edit code without stopping a debugging session.  5.     You can establish dependencies between multiple web projects. 6.     You must compile the application before deployment, which prevents you from testing   a page i...

Maintain scroll position on postback in ASP.NET

ASP.NET provides lot of cool and handy features and one of them helps us to maintain the scroll position on postback. This is how we implement it : <% @ Page Language ="C#" AutoEventWireup ="true" CodeBehind ="Home.aspx.cs" Inherits ="Ay.LearningApp.Home" MaintainScrollPositionOnPostback ="true" %> This will make sure that scroll position will be maintained at the page. In order to maintain the scroll position for all the pages we can change config file as follows: < configuration >     < system.web >         < compilation debug = " true " targetFramework = " 4.0 " />           < pages maintainScrollPositionOnPostBack = " true " />        </ system.web >    </ configuration > Happy coding!!! Cheers!!!

Working with BacgroundWorker class c#

Microsoft has provided BackgroundWorker class which make it really easy to create background threads easily. Sometimes we need to implement so functionalities in background threads so that UI will not freeze, that is when this class comes handy. Obviously we can create our own threads and manage there lifecycle ourselves but not everyone is efficient with threads and also sometimes the complexity hits back by consuming lot of time which we really do not have in case of rapid application development. When to use : Downloading a large file and showing progress bar. Uploading some information in background but letting the user to work. Creating a polling application etc. Usage: BackgroundWorker is also present in the toolbox and you can drag it from there or like any other control you can create an object at runtime and use it on the fly. It comes with various events and properties, few of them which are really important are: DoWorkEventHandler (event) Thi...

Introduction to Design Patterns

This will  be a series of posts and I will keep updating the posts with new links. Design Patterns In software engineering, a   design pattern   is a general repeatable solution to a commonly occurring problem in software design. A design pattern isn't a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations. Uses of design patterns Design patterns can speed up the development process by providing tested, proven development paradigms. Effective software design requires considering issues that may not become visible until later in the implementation. Reusing design patterns helps to prevent subtle issues that can cause major problems and improves code readability for coders and architects familiar with the patterns. In addition, patterns allow developers to communicate using well-known, well understood names for software interactions. Analogy ...