.NET QUEST for me is not just something, but everything that I have read, learned, searched, thought.. from my work & my experience. This website reflects my QUEST on .NET
April 6, 2014
base keyword in c#
The base keyword in C# is used from within the derived class to access the members / constructor of the base class. What i mean here is if the derived class wants to use a method of the base class that is overridden by another method or the derived class wants to specify which base class constructor should be used while creating instance of the derived class.
Example to come...
Thanks,
Hussain
April 1, 2014
Using Remote Desktop Connection Manager with Windows Azure Virtual Machines
In the Earlier post, I
have explained how to use (RDP Man) to Remote Desktop machines, recently I was in
a situation where in I had to work on Windows Azure Virtual machines.
The Network team who
created the VM’s had sent an email with the DNS names and the port numbers (of course
login details in separate email. To my surprise, there was no ip address mentioned
for the VM’s in the email. (I could have got it sending an email).
Below are the steps to add / manage connections to virtual
Machines in Windows Azure using the Remote Desktop manager (Rdp Man)
1. Open
RDP Manager (if not installed here is the link )
2. Now Add
a Server Group (just to separate these servers from other servers and put it in
a separate Group).
Note: The actual benefit of
adding a group (in case you are managing large number of connections) is you
can navigate quickly and manage setting for a single point (specifying the
settings that are common to all servers in the group properties, which will be
inherited by all the servers in the group) Although this is not a mandatory setting
/ option
3. Right
click on Group and select Add Server. This will bring up the add Server dialog
box.
4. In this
dialog box you have to add the Windows Azure server (vm’s) details. Note: The
only difference as compared to normal server is the port number and the DNS
name (In case you don’t have the ip address).
a.
Click on Server settings tab and enter the DNS name / ip address
next to Server Name
b.
Type some description (optional) next to Description.
c.
Now click on the connection Settings tab, in this tab un-check
the option inherit from parent and Connect to console, enter the port number
next to port
d.
You can also add login details by clicking on the login
Credentials tab (or can set it for once in the Group that was created in step 2
above)
5. Now you
can simply double click to connect to the machine whenever you want.
Remote Desktop Manager - Excellent Tool
I have been using this
tool for almost a year now and found to be the best tool for Remote Desktop.
If you are using Remote
Desktop to login into machines many times a day, for your work and you are
using mstc to remote desktop or have created .rdp files. There is a solution
for this.
Use Remote Dektop
Manager.
Grab a copy of the same
from here Remote
Desktop Manager
Details on how to add the
server and login Details.. ( coming)
March 28, 2014
Dependency Injection - Design Patterns
Dependency Injection
Definition:
Dependency injection is a technique used in Oops. in this technique the component are loosely coupled by passing the dependencies to the object, rather than the object instantiating it own dependencies.
Explain in detail dependency injection?
Definition:
Dependency injection is a technique used in Oops. in this technique the component are loosely coupled by passing the dependencies to the object, rather than the object instantiating it own dependencies.
Explain in detail dependency injection?
March 15, 2014
Understanding Namespaces in c#
Understanding Namespace in C#
1000’s and 1000’s of classes are defined in .NET framework and all these classes are organized under different Namespaces. You can think of Namespaces as boxes with Names on it and all the classes relevant to the box are put in it – Under that namespace, so when a class is used we can refer to the class as namespace.class name.
In C# namespaces are used extensively - first while using the .NET classes, their respective namespaces are used and secondly while creating our own types – we are creating our own / user defined namespaces.
Having namespaces helps you to control the scope of the class and its methods. If there are no namespaces, we would not be able to use multiple classes having same name. Eg. we can have a class called Console having a method WriteLine under namespace MyNamespace – (MyNameSpace.Console.WriteLine - . I agree - it’s a bad idea to create such class and method. As we already know there’s a similar class in .NET framework under System Namespace. System.Console.WriteLine.
But in reality we might come across such situation where in we have same class name as a class in .Net framework or a third party dlls is having a same class name, in such cases namespaces help us to differentiate the classes and use them efficiently.
Note: Visual Studio IDE helps us to organize the classes under different namespaces, by defaulting the project name as namespace of the class, but it is not mandatory. Namespaces do not refer to or correspond to a file or a directory.
Using namespaces:- A class can be invoked from a namespace
using 3 ways.
- Writing the fully qualified name ( see below example)
- Implementing the using directive,
- Implementing using alias ( see below example
Note: The above ways are used for calling classes for both
.NET namespaces or from custom/ own namespaces.
The using directive allows us to use the classes / types without
having to specify the namespace.
The using alias allows us to create and identifier for a namespace
or class. The identifier is assigned a fully qualified name. Ex using project
= MyNamesapce.MyClassName;
Namespace alias qualifier:
The namespace alias qualifier (::) is used search for
identifiers. It is used to reference a namespace alias and global:: us used to
reference the global namespace. (Note: global is not an predefined alias qualifier,
it gets this special status after its used with (::). Also you cannot used the
global word with using alias (eg. Using global = MyNamespace.MyClass), this is a
compiler error, because as mentioned earlier, global:: always reference the global
namespace and not and alias.
Use of Global namespace alias:-
global:: - is used to access
the global namespace.
The global namespace access is required in scenarios where
the user defined class / type has the same name as the system defined .NET class
and the System defined class is now hidden from in the current namespace – See below
example.
March 11, 2014
Open Visual Studio IDE from Run command of your choice ( when you have 2 different versions of Visual Studio)
Question:
When you have two
versions of Visual Studio installed on the same machine, for example Visual
Studio 2010 and Visual Studio 2012, you want to always open Visual Studio 2012 as
default?
Solution:
When you have two
versions of Visual Studio installed, say first you installed Visual Studio 2010
and then installed Visual Studio 2012. If you are using shortcut to open Visual
Studio IDE
Start - Run - devenv.exe
By default Visual Studio
2010 will be opened. As Visual Studio 2010 was installed first and a register
entry was done.
Now that you have
installed Visual Studio 2012 without uninstalling Visual Studio 2010, this
registry entry is not made for Visual Studio 2012
You can make Visual
Studio 2012 to open as default, by modifying the registry entry. See below the
steps.
- Click on Windows Start button.
- Type regedit.exe in the search text box, regedit.exe
will appear.
- Click on the regedit.exe. This will open the Registry
Editor.
- Navigate to the following path in the left section
- HKEY_LOCAL_MACHINE
=> SOFTWARE => Microsoft => Windows => CurrentVersion =>
App Paths => devenv.exe
- Click on devenv.exe you will see the default key on the
right section.
- Double click on default to change the value.
- In this case for Visual Studio 2010 the value would be
(C:\Program Files (x86)\Microsoft
Visual Studio 10.0\Common7\IDE\devenv.exe)
- Change this value to the path where Visual Studio 2012 devenv.exe is located, in this case (C:\Program Files(x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe) and click Ok.
- Close Registry editor.
- Now when you type devenv.exe from Run it is open Visual
Studio 2012.
Following are default
path where Visual Studio IDE is installed by default
Visual Studio 2008
C:\Program Files
(x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe
Visual Studio 2010
C:\Program Files
(x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe
Visual Studio 2012
C:\Program Files
(x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe
Thanks,
Hussain Patel
March 5, 2014
How to: Set the Startup Form in a WPF Application
Question: In my WPF project, I have two .xaml WPF forms (MainWindow.xaml and Window1.xaml), how do I set Window1.xaml as a startup form for my WPFproject.?
Solution:
- Double click on the App.xaml file, in the Solution Explorer window.
- App.xmal file would open and would have the following xml
<Application x:Class="WPFTutorialDemo.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>
You need to change the StartupUri attribute (highlighted yellow) with the name of the form you want to set as startup, in this case Window1.xaml, Save and close the file.
Thanks,
Hussain Patel
January 14, 2014
Refactoring
Refactoring
Refactor:
Definition: I will go with the dictionary definition
Refactoring (noun): A change made to the
internal structure of software to make it easier to understand and cheaper to
modify without changing its observable behavior.
So, what is refactoring?
Does it mean just cleaning of code, the answer is just, but I
feel it’s more than just cleaning code. Refactoring provides a technique for cleaning
code in a more controlled manner and efficiently.
Developer productivity will increase the more they learn
about refactoring methods, the more they use them the more they can reduce bugs
in their code.
Purpose of refactoring:
- Make the code easier to understand and modify
- Refactoring make little or no changes to the overall functionality of the component (observable behavior)
- Like Performance tuning – helps in improving the speed of the application, without altering the actual functionality, similarly refactoring help in cleaning small amount of internal code without changing the actual functionality.
In next post i will start with other refactoring methods
Thanks,
Hussain Patel
January 13, 2014
Categories of Patterns - Design Pattern
Types of Design Patterns
As mentioned in earlier
post, there are 3 categories of deign patterns.
- Creational Patterns
- Structural patterns
- Behavioral Patterns
The names creational itself conveys, that the design patterns under this category, all revolve around object creation in terms of who, what, how and when. Creational patterns all the systems separate the process of object creation, composition and representation. Creational pattern hide the detail of how the object / instance of classes are created.
Patterns falling under this category are:
- Singleton pattern
- Factory pattern
- Abstract factory pattern
- Prototype and
- Builder pattern
Structural patterns revolve around the class and object
composition, what I mean is it helps us to understand how different classes in
a system are glued together in a extensible and flexible manner. The object composition
shows ways to compose objects to obtain new functionality.
Patterns falling under this category are
- Adapter pattern
- Bridge
- Composite
- Façade
- Proxy
- Flyweight
- Decorator
Behavioral pattern
Describe the way object and classes behave / interact and
divide the responsibility among them. Thee pattern are more concerned with the
communication between objects and classes.
Pattern falling under this category are:
- Command
- Interpreter
- Iterator
- Mediator
- Observer
- State
In the next post I will tart explaining in detail patterns
falling under Creational pattern
Thanks,
Husain Patel
Husain Patel
Labels:
Behavioral,
creational,
Design,
patterns,
structural
Installing IIS 8.0 in windows 2012
Installing IIS 8.0 on windows 2012 and Windows 8.0
Note: IIS 8.0 is only available on windows 8.0 and windows
2012.
IIS is cannot installed as per the traditional method in
windows 2012, the introduction of Server Manager in 2012 has changed the user
experience as well
Prerequisites:
- Windows
Server 2012 has been installed.
- Open Server Manager.
- Under Manage menu, select Add Roles and Features:
- Select Role-based or Feature-based Installation:
- Customize your installation of IIS, or accept the
default settings that have already been selected for you, and then click Next:
- Click Install:
- When the IIS installation completes, the wizard
reflects the installation status:
- Click Close to exit the wizard.
Hussain Patel
January 12, 2014
Chromecast
Hi,
Yesterday i got a chrome-cast for $35 for tax, and here are some of my review comments.
Pros and cons
Pros
Yesterday i got a chrome-cast for $35 for tax, and here are some of my review comments.
Pros and cons
Pros
- Easy to setup the devices
- Quick install of the software
- Easy /two click cast
- Sharing Desktop (Crashes sometimes)
- Streams you tube and chrome apps from dongle rather from the laptop / tablet
Cons
- Needs Chrome to be installed for casting internet stuff
- Does not allow screen extending. ( i know its a streaming dongle)
- Only Google apps ( are cast in full screen) - eg - you tube
- app that are not tied to Google are not cast full screen, so user cannot do any thing if the laptop screen is made full.
More details on this..
Hussain Patel
Hussain’s Quest…
Thanks for reading my new blog. I welcome you all.
Who am I?
- A Developer /Consultant
- Photographer / Capturing world in pixels - Passion (http://digitaldays2.blogspot.com)
- Travel freak
- Loves cooking the most / Eating variety of foods..
- Learning to Speak different languages
- Whistling on Songs..
I was born in India. I grew up in Mumbai and have a post-graduate degree in Computer Management . Currently am working for a software company;
What this blog contains?
This blog is my quest – Search for something and everything … , It contains good Quotes, travel guides, entrepreneurship, motivation, productivity, tips & tricks, links and hacks and more. It is also an online diary of my quest for all.. and everything I think about.
If you are someone like me and share the same quest like me, motivated, inspired and wondering to be something of your own, you might find some of my post useful..
Signing off
Hussain
Mistake… Humans
The Greatest mistake we HUMANS make in our Relationships: “We listen Half,Understood Quarter , Think Zero and React DOUBLE !!! :)..
January 2, 2014
Displaying Curly Braces { } in Console ouptut
Recently I was working on a sample console application for my tutorial and I happen to have a requirement, where in I had to display the curly braces as part of the formatted output.
Here’s the example ; Output of the console program should be: The number is -{124}
Solution:
As you are completely aware that curly braces is part of the c# keywords, for formatting object (e.g. numeric or string or class object etc.)
{
string x = “124″;
Console.WriteLine(“The number is -{x}”, x);
}
{
string x = “124″;
Console.WriteLine(“The number is -{x}”, x);
}
output : The number is -124
in the above example the output is still missing the curly braces, the solution to this is adding twice open and close {{ }} curly braces to get the desired output. Note is only for curely braces for all other special characters you need to use ‘\’
{
string x = “124″;
Console.WriteLine(“The number is -{{x}}”, x);
}
{
string x = “124″;
Console.WriteLine(“The number is -{{x}}”, x);
}
output : The number is -{124}
Thanks,
Hussain Patel
Design patterns – Introduction
Design Patterns
Every one who is in the software industry has heard it about design pattern,have worked on it (knowingly an unknowingly) . Software engineers with 1-2 years of experience gets impressed with people, who is talking on design patterns and explaining one or two patterns. Everyone is interested in learning and knowing design patterns, a single search in Google would give 1000 of search pages, explaining design but for some reason it never been explained in a simple or lucid way. At least the type of material available make it more complex and second most important is the time invested in understanding them and trying to implement them.
In this and future post I will explain what design patterns are in an easy and simple language (avoiding the jargon).
Take an example.. while making a recipe /cooking, we do one of the two things, 1. start cooking (if we know cooking ) or 2. search on the web for recipes before we start to cook, so that we can get help and make make a dish.. We try following exactly the same steps, use the same same ingredients and quantity, so that recipe comes out good, a lot of them succeed in getting the recipe to the mark and this continues.. people follow it..
Design pattern are some what, recipes – they were tried and tested solutions and now they have been documented for other to use. Design pattern are not a complete solution to software problem, but guide you to in getting started to solve the problem..
The 3 mains areas where in design pattern are in creating objects.., defining structure of software solution/ Architectural and defining communication between objects. This clearly indicates design patterns revolve around object creation, architectural structure and object communication..
They are broadly classified..
1. Creational
2. Structural
3. Behavioral.
Thanks,
Hussain
Console.WriteLine(“Welcome to {0}{{days}}{1}”, x,y);
input- x = “dotNET”, y = “2″;
output – Welcome to dotNET{days}2
My name is Hussain Patel, Thanks for reading my new blog. I welcome you all.
Who am I? I am .NET Solutions Developer / Consultant. I was born in India. I grew up in Mumbai and have a post-graduate degree in Computer Management . I am working for a software company;
What this blog contains?
This blog speaks about Microsoft .NET and technologies. This blog will contains day to day to learnings in C#, wcf, wpf, silverlight, CCF, asp.net , .NET code, video’s, FAQ’s, links, work arounds and lot of Knowledge Sharing……
Why 2 after dotnet days … actually thats my birthdate day….
signed off dated Dec 6th 2009
-Hussain
Debugging a Javascript in ASP.NET
There are two ways you can debug a javascript code in ASP.NET (visual Studio IDE)
I. Usingthe Internet Explorer Process in the Attach to Process window
II. Using the debugger keyword.
Method I
- In the Visual studio IDE open javascript .js file and a breakpoint at the line you want to start debugging the code. Now click on the menu (Debug | Attach to Process) on the top to open the Attach to Process dialog window (see below) select the Internet Explorer process (iexplore.exe) from the list of available process a. Execute the code you want to debug in Internet Explorer.
Method II
- In the Visual studio IDE open javascript .js file and type the keyword debugger where you want the code to break in to debugging. this
- . Write your JavaScript and place the debugger keyword where ever you want the code to break into debugging. The JavaScript interpreter hits this keyword and halts execution and returns the control back to the IDE. This is like setting a breakpoint inside of Visual Studio.
Note: you must enable script debugging in Internet Explorer to be able to debug. Go to Internet Options inside Internet Explorer and then go to the Advanced tab. Uncheck Disable script debugging (Internet Explorer).
Labels:
asp.net,
debugging,
javascript,
visualstudio
Microsoft® SQL Server® 2008 Management Studio Express
Microsoft® SQL Server® 2008 Management Studio Express is completely free for download.
It can be used for accessing, configuring, managing, administering, and developing all components of SQL Server.
It can be used for accessing, configuring, managing, administering, and developing all components of SQL Server.
Click the below link to download
Cheers,
Hussain
Hussain
How to completely remove TFS (source control) bindings from a visual studio 2008 solution
There are two ways to remove source control bindings for a solution:
1. Open the solution in VS, then click on File Menu – - >> Source Control –>> Change Source Control and then unbind and/or disconnect all projects and the solution. This changes will remove all bindings from the solution and project files on the local folder.
This solution when distributed or provide will not poup for TFS connection or TFS ofline when opened in VS IDE.
Once this is done you can again you can switch the Souce Contro provider in Tools -> Options -> Source Control -> Plug-in Selection) to get TFS
1. Open the solution in VS, then click on File Menu – - >> Source Control –>> Change Source Control and then unbind and/or disconnect all projects and the solution. This changes will remove all bindings from the solution and project files on the local folder.
This solution when distributed or provide will not poup for TFS connection or TFS ofline when opened in VS IDE.
Once this is done you can again you can switch the Souce Contro provider in Tools -> Options -> Source Control -> Plug-in Selection) to get TFS
2. The simplet way to unbind a solution from TFS is to, open the solution you want to clean in VS IDE and remove the TFS Plugins from IDE using Tools menu –>> Options –>> Source control –>> Plug-in Selection. Select None from the dropdown and click ok. Visual Studio will ask to remove source controls bindings
Close the solution and reopen the solution. THe solution is now completely unbinded from TFS..
Close the solution and reopen the solution. THe solution is now completely unbinded from TFS..
signed off
Hussain Patel
Subscribe to:
Posts (Atom)