29/07/2008

MOVING MY BLOG

Dear Reader My Bloged Moved to http://weblogs.asp.net/muhanadyounis/ hope you join me there too.

08:58 Posted in ASP.NET & C# | Permalink | Comments (0) | Trackbacks (0) | Email this

28/07/2008

Register User Web Controls (ascx) Globally

One of the most impotent OPP principles is encapsulation!. We do encapsulate anything or code that varies. So what about the user interface (aspx pages I mean) are we able to encapsulate some lines that varies between pages?

Actually; YES! But not for everything, here I want to show you a way to encapsulate a user web  control (ascx)  to be used in any page that you want without registering it every time. This feature came with .net 2.0 and cannot be used with .net 1.1. all you have to do is;

  1. Create a new web.config file ( if you do not have one on your project)
  2. Add or use the controls section on the web.config file as below;

Let us say that I have a use control that is tagnamed as “myUserC” so I can use it this way

<sysetm.web>

<pages>

      <controls>

        <add tagPrefix="MyC" src=~/siteControls/ myUserC.ascx"

tagName=" myUserC " />

               </controls>

</pages>

                               </sysetm.web>

Here the tag prefix is the tag that will be used on user interface line like this

< myUserC:ARWebViewer ID="usercontol1" runat="server" />

Hope This Helps

 

 

Ref:

http://msdn.microsoft.com/en-us/library/ms164640.aspx

 

09:40 Posted in ASP.NET & C# | Permalink | Comments (0) | Email this

06/07/2008

Do not Repeat Your Self

One of the most power things in OOP programming is Encapsulation. What can encapsulation do for your! It does more than you think. Every programmer knows that while coding you may repeat many code lines; the point starts when you want to refactoring. Here this principle starts to have life in your code, Do Not Repeat Your Self! By encapsulating your code lines and properties you start to have more functional and flexible code. 

23:50 Posted in OOP Principles | Permalink | Comments (0) | Email this

05/07/2008

Hollywood Principle

This principle rearrange the relation between high and low level components. here low level components allowed to be in the system, but they are not allowed to call a high level component. The high level component know when and how to call a low level component. So High level component controls the whole workflow!.
This principle is used in a great way within Template Method.

23:45 Posted in OOP Principles | Permalink | Comments (0) | Email this

04/07/2008

Least Knowledge Principle

In this principle we try to reduce the interaction between object. But not all objects! only classes or objecst which are close are not included. Here you must take care about the number of classes interact together and the way they interacts.
In this way you reduce the number of unnecessary class chains! and rise the class flexibility and cohesion.
example :


public decimal getDist() // without the principle
     {
          City city= startCity.getDist();
          return ctiy.getDist();
     }

public decimal getDist() // with the principle
     {
          return startCity.getDist();
     }

 

 

 

ref. : http://www.headfirstlabs.com/

23:30 Posted in OOP Principles | Permalink | Comments (0) | Trackbacks (0) | Email this

03/07/2008

(SRP) Single Responsibility Principle

This is one of the most great principles in OOP programming which we must apply while coding. This principle tells us to give our class one reason to change and give the class one responsibility to do. The more responsibilities the more reasons to change.

Let us think it this way; if we have a class which holds many deferent methods (that is most possible) and these methods do serve unrelated functions; that means when we are doing some refactoring this class will change a lot and my loss its functionality!. So try to keep your methods related and give the class ONE REASON TO CHANGE.

Do not forget; class adhere to this principle tend to be more maintainable and more flexible than class which holds multiple responsibilities.

22:05 Posted in OOP Principles | Permalink | Comments (0) | Email this

21/06/2008

GO TURKEY GO

Last night I watched an Unbelievable match between Turkey and Croatia. I thought that the match will never end. Lost all hope to win! But on 120+2 min Semih Şentürk did the miracle.

Thank you Turkey thank you GREAT TEAM. Thank you for the great gift in my Birthday. Love you

GO GO GO TURKO

NOTICE : Now I started to believe that nothing is impossible until I die .

20:15 Posted in GENERAL | Permalink | Comments (0) | Email this

27/05/2008

Long Time

Before one year from today I wrote my last post on this blog. Maybe life forced me to stay away from my blog all that time. But from now on I’ll start to right in this blog as technical person and dig deeply in asp.net and c# technologies. I opened a newNewsLetter section, so if you want to be notified about new posts just subscribe your email.

See you son. 

09:05 Posted in ASP.NET & C# | Permalink | Comments (0) | Email this

18/05/2007

Random Numbers and GUID

Many of new developers keep wondering about how they create a random password or a random alphanumeric number, here I would like to show you an easy way to create such numbers. In the past it was hard to do such thing and need much lines of coding but now it is very easy. See the code below;

public string randoumNumber(int numberLen)
    {
       
        string gRes = System.Guid.NewGuid().ToString();

       
       gRes = guidResult.Replace("-", string.Empty);

      
        if (numberLen <= 0 || numberLen > gRes.Length)
             {
                        throw new ArgumentException("Length must be between 1 and " + gRes.Length);
             }

       
        return gRes.Substring(0, length);
    }

Here you can use the number that is created the way that you want. Plus, you can use this number in a GDI application which will give a graphic and numbers to gather!! Happy coding

11:45 Posted in ASP.NET & C# | Permalink | Comments (0) | Email this

24/03/2007

They are Seeking Open Directory Editors !

The Open Directory Project is an old project started many years ago, and all times the seek editors (and they still looking for that).

The most important thing about this project that it is a free project and who ever work there is a volunteer! This is a great thing. Because they believe that such huge internet can not be covered with a small group of people! There for they are trying to cover the whole internet by working with volunteers from all around the world. If you want to be on of those volunteers go on and click here. http://www.dmoz.org/

13:35 Permalink | Comments (0) | Email this

new turkish blog for marketing

if you are intersted in marketing espicialy unconscious marketing and how it can be done and offcourse if you know Turkish! I belive that this blog will be very importent for you.

http://www.pazarlik.blogspot.com

 

13:20 Posted in GENERAL | Permalink | Comments (0) | Email this

11/01/2006

AJAX in HOTMAIL

Today I received an email form hotmail about the new services that they add newly, and the thing that I saw shocked me…. What I saw is Microsoft after all that waiting started to use Ajax technology. Wow specially for Hotmail, which was great to see that we are going out of hotmail traditional style. Actually I’m very happy to see that even when it is still in the beta version, and hope soon that will be carried forward to be more helpful and more useable.

For more details you can check www.live.com   

00:10 Posted in GENERAL | Permalink | Comments (0) | Email this

05/12/2005

Table of Contents: GridView Examples for ASP.NET 2.0

This article illustrates how to accomplish a number of common tasks with the Microsoft ASP.NET 2.0 GridView control. Each task is accompanied by a description of the new concepts covered, and the complete working examples are available for download with this article. Read More...

11:56 Posted in ASP.NET & C# | Permalink | Comments (0) | Email this

Understanding and Extending the Site Navigation System in ASP.NET 2.0

 The ASP.NET 2.0 site navigation system is built on a powerful and flexible architecture that has been designed to be extensible. This article examines the site provider architecture, and includes a sample provider that exposes the file system as a data source for site navigation, as an alternative to the standard Web.sitemap XML file. Read More...

10:30 Posted in ASP.NET & C# | Permalink | Comments (0) | Email this

Visual Studio 2005 Starter Kits

A Starter Kit is essentially an enhanced project template that can be shared with other members of the community. This page contains links to the currently available Starter Kits with more to come in the future. Visit the How To: Create A Starter Kit page to learn how to create your own. Read More...

10:27 Posted in GENERAL | Permalink | Comments (0) | Email this