Factory Pattern

The factory method pattern is an object-oriented design pattern. Like other creational patterns, it deals with the problem of creating objects (products) without specifying the exact class of object that will be created. The factory method design pattern handles this problem by defining a separate method for creating the objects, whose subclasses can then override to specify thederived type of product that will be created. More generally, the term factory method is often used to refer to any method whose main purpose is creation of objects.

EXAMPLE:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
 
namespace Army
{
    interface ISoldier
    {
        int Rank();
    }
 
    abstract class Soldier : ISoldier
    {
        public abstract int Rank();
    }
 
    class Infantry : Soldier
    {
        override
        public int Rank()
        {
            return 1;
        }
    }
 
    class Marine : Soldier
    {
        override
        public int Rank()
        {
            return 2;
        }
    }
 
    class Commando : Soldier
    {
        override
        public int Rank()
        {
            return 3;
        }
    }
 
    class HeadQuarter
    {
        public enum SoldierType
        {
            Infantry,
            Marine,
            Commando
        }
 
        public static ISoldier createSoldier(SoldierType soldierType)
        {
            switch (soldierType)
            {
                case SoldierType.Infantry:
                    return new Infantry();
                case SoldierType.Marine:
                    return new Marine();
                case SoldierType.Commando:
                    return new Commando();
            }
            throw new ArgumentException("The soldier type " + soldierType + " is not recognized.");
        }
    }
 
    class Troops
    {
        public static void Main(string[] args)
        {
 
            HeadQuarter.SoldierType[] soldierTypes = { HeadQuarter.SoldierType.Commando,
                                                HeadQuarter.SoldierType.Infantry,
                                                HeadQuarter.SoldierType.Marine};
            foreach (HeadQuarter.SoldierType soldierType in soldierTypes)
            {
                System.Console.WriteLine("Rank of " + soldierType + " is " +
                    HeadQuarter.createSoldier(soldierType).Rank());
            }
        }
    }
 
    //Output:
    //Rank of Commando is 3
    //Rank of Infantry is 1
    //rank of Marine is 2
}

Rebuild all indexes in your SQL Server by db names

DECLARE @Database VARCHAR(255)
DECLARE @Table VARCHAR(255)
DECLARE @cmd NVARCHAR(500)
DECLARE @fillfactor INT

SET @fillfactor = 90

DECLARE DatabaseCursor CURSOR FOR
SELECT name FROM master.dbo.sysdatabases
WHERE name IN (‘   ‘)  — [ WRITE HERE YOUR DB NAMES,… ]
ORDER BY 1

OPEN DatabaseCursor

FETCH NEXT FROM DatabaseCursor INTO @Database
WHILE @@FETCH_STATUS = 0
BEGIN

SET @cmd = ‘DECLARE TableCursor CURSOR FOR SELECT table_catalog + ”.” + table_schema + ”.” + table_name as tableName
FROM ‘ + @Database + ‘.INFORMATION_SCHEMA.TABLES WHERE table_type = ”BASE TABLE”’

— create table cursor
EXEC (@cmd)
OPEN TableCursor

FETCH NEXT FROM TableCursor INTO @Table
WHILE @@FETCH_STATUS = 0
BEGIN

SET @cmd = ‘ALTER INDEX ALL ON ‘ + @Table + ‘ REBUILD WITH (FILLFACTOR = ‘ + CONVERT(VARCHAR(3),@fillfactor) + ‘)’
EXEC (@cmd)
FETCH NEXT FROM TableCursor INTO @Table
END

CLOSE TableCursor
DEALLOCATE TableCursor

FETCH NEXT FROM DatabaseCursor INTO @Database
END
CLOSE DatabaseCursor
DEALLOCATE DatabaseCursor

VML & SVG

Vector Markup Language (VML) is an open and standards-based XML language used to producevector graphics.

VML was submitted as a proposed standard to the W3C in 1998 by AutodeskHewlett-Packard,MacromediaMicrosoft, and Visio.[1]

Around the same time other competing W3C submissions were received in the area of web vector graphics, such as PGML from Adobe SystemsSun Microsystems, and others.[2] As a result of these submissions, a new W3C working group was created, which produced SVG.

While Microsoft continues to document VML,[3] development of the format ceased in 1998.[4] VML is implemented in Internet Explorer 5.0 and higher and in Microsoft Office 2000 and higher. Google Mapscurrently uses VML to make vector paths work when running on Internet Explorer 5.5+, and SVG on all other browsers.[5]

The Vector Markup Language is now specified in Part 4 of the Office Open XML standards ISO/IEC29500:2008 and ECMA-376.[6][7]

Scalable Vector Graphics (SVG) is a family of specifications of an XML-based file format for describing two-dimensional vector graphics, both static and dynamic (i.e. interactive or animated).

The SVG specification is an open standard that has been under development by the World Wide Web Consortium (W3C) since 1999.

SVG images and their behaviours are defined in XML text files. This means that they can be searched, indexed, scripted and, if required, compressed. Since they are XML files, SVG images can be created and edited with any text editor, but specialized SVG-based drawing programs are also available.

All major modern web browsers except Microsoft Internet Explorer support and render SVG markup directly.[3] To view SVG files in Internet Explorer, either users have to download and install a browser plugin, or the webmaster can include SVG Web, a JavaScript library currently under development atGoogle Code[4].

SVG is also well-suited to small and mobile devices. The SVG Basic and SVG Tiny specifications were developed with just such uses in mind and many current mobile devices support them.

Source : wikipedia

Together one column’s data in one string

There is a useful expression in T-SQL  “COALESCE()” we can use it for combining a column data into a string easyly

For example

Declare @sumtextnvarchar(100)
select top 5 @sumtext = Coalesce(@sumtext + ‘;’ ,) + Cast(Name as nvarchar)
from Country
print @sumtext

Output:

Afrika;Australi en Nieuw-Zeeland;Belgi;Benelux;Bulgarije;Canada;China;Duitsland;EU-landen;Frankrij

May the code be with you !

Some technologies about Publishing,XML,Feed’s and Blog’s

APML:

APML allows users to share their own personal Attention Profile in much the same way that OPML allows the exchange of reading lists between News Readers.

http://apml.areyoupayingattention.com/

OPML:

OPML (Outline Processor Markup Language) is an XML format for outlines (often blogrolls). Originally developed by Radio UserLand as a native file format for an outliner application, it has since been adopted for other uses, the most common being to exchange lists of web feedsbetween web feed aggregators.

http://www.opml.org/

http://en.wikipedia.org/wiki/OPML

SIOC:

Semantically-Interlinked Online Communities Project (SIOC – pronounced “shock”) is a Semantic Web technology. SIOC provides methods for interconnecting discussion methods such as blogs, forums and mailing lists to each other. It consists of the SIOC ontology, an open-standard machine readable format for expressing the information contained both explicitly and implicitly in Internet discussion methods, of SIOC metadataproducers for a number of popular blogging platforms and content management systems, and of storage and browsing/searching systems for leveraging this SIOC data.

http://sioc-project.org/

http://en.wikipedia.org/wiki/SIOC

 RSD:
Really Simple Discovery (RSD) is an XML format and a publishing convention for making services exposed by blog, or other web software, discoverable by client software. It is a way to reduce the information required to set up editing/blogging software to three well known elements:
Username,Password, andHomepage URL.
Any other critical settings should either be defined in the RSD file related to the blog, or discoverable using the information provided.

ASF:

 Argotic Syndication Framework A powerful and extensible .NET web content syndication framework for RSS, Atom, OPML, APML, BlogML, RSD and more. The Argotic Syndication Framework is a Microsoft .NET class library framework that enables developers to easily consume and/or generate syndicated content from within their own applications. The framework makes the reading and writing syndicated content in common formats such as RSS, Atom, OPML, APML, BlogML, and RSD very easy while still remaining extensible enough to support common/custom extensions to the syndication publishing formats. The framework includes out-of-the-box implementations of the most commonly used syndication extensions, network clients for sending and receiving peer-to-peer notification protocol messages; as well as HTTP handlers, modules, services and controls that provide rich syndication functionality to ASP.NET developers.

http://www.codeplex.com/Argotic

BlogML:

BlogML is an open format derived from XML to store and restore the content of a blog.