Saqib Ullah

BootStrapper Know How

  Home  |   Contact  |   Syndication    |   Login
  112 Posts | 1 Stories | 1121 Comments | 15 Trackbacks

News



Article Categories

Archives

Post Categories

Blogging websites

Favourite Blogs

Private Links

Sites

Friday, February 22, 2013 #

I have found very nice definition of Cardinality and its types.

Definition

In SQL (Structured Query Language), the term cardinality refers to the uniqueness of data values contained in a particular column (attribute) of a database table. The lower the cardinality, the more duplicated elements in a column. Thus, a column with the lowest possible cardinality would have the same value for every row. SQL databases use cardinality to help determine the optimal query plan for a given query.

 

Values of Cardinality

When dealing with columnar value sets, there are 3 types of cardinality: high-cardinality, normal-cardinality, and low-cardinality.

High-cardinality refers to columns with values that are very uncommon or unique. High-cardinality column values are typically identification numbers, email addresses, or user names. An example of a data table column with high-cardinality would be a USERS table with a column named USER_ID. This column would contain unique values of 1-n. Each time a new user is created in the USERS table, a new number would be created in the USER_ID column to identify them uniquely. Since the values held in the USER_ID column are unique, this column's cardinality type would be referred to as high-cardinality.

Normal-cardinality refers to columns with values that are somewhat uncommon. Normal-cardinality column values are typically names, street addresses, or vehicle types. An example of a data table column with normal-cardinality would be a CUSTOMER table with a column named LAST_NAME, containing the last names of customers. While some people have common last names, such as Smith, others have uncommon last names. Therefore, an examination of all of the values held in the LAST_NAME column would show "clumps" of names in some places (e.g.: a lot of Smith's ) surrounded on both sides by a long series of unique values. Since there is a variety of possible values held in this column, its cardinality type would be referred to as normal-cardinality.

Low-cardinality refers to columns with few unique values. Low-cardinality column values are typically status flags, Boolean values, or major classifications such as gender. An example of a data table column with low-cardinality would be a CUSTOMER table with a column named NEW_CUSTOMER. This column would contain only 2 distinct values: Y or N, denoting whether the customer was new or not. Since there are only 2 possible values held in this column, its cardinality type would be referred to as low-cardinality.

 


Tuesday, March 13, 2012 #

The following exception is very common type of exception for .net developer and oracle user.         
       
ORA-12154:TNS:could not resolve the connect identifier specified

Especially when you are using Oracle Data Provider for .Net and getting the above exception because of wrong connection string. So whenever you are using ODP you must following the connection string in the following pattern.

string connString = "user id=*****;password=*****;data source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST= IP Address or Host Name)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME= *****)));";              
oracleConnection1.ConnectionString = connString;  
oracleConnection1.Open();


Thursday, March 8, 2012 #

I found a very nice collection of JavaScript libraries called Microjs, so I want to share its with you guys. I hope the following link will be very fruitful.

MicroJS


Thank


Friday, October 14, 2011 #

Yesterday we need a customized configuration section in my application and I don’t want write xml schema and C# code for configuration loadingJ. My required configuration pattern for the application
is give below.


<configuration>

  <configSections>

    <section name="platformProvider" type="xxx.Configuration.Design.PlatformProvider, xxx.Configuration.Design" />

  </configSections>

  <platformProvider xmlns="urn:xxxx.Configuration.Design" name="Azure">

    <services name="Main Services">

      <service name="fam">

        <settings name="fam_setting">

          <values name="fam_values">

            <value data="fam_data_1"  name="1"></value>

            <value data="fam_data_2"  name="2"></value>

          </values>         

        </settings>       

        <modules name="fam_module">

          <types name="fam_types">

            <type name="IfamCache" assembly="IfamCache_Ass"></type>

            <type name="IfamTrans" assembly="IfamTrans_Ass"></type>

          </types>

        </modules>

      </service>

    </services>

  </platformProvider>
</configuration>


If we need to load the above configuration in our application we need to writing different classes and verify them all manually. Thank God I found a very useful add-in for Visual Studio 2010 called Configuration Section Designer and it’s free. You only need to installed CSD add-in and open the new project under the option General -> Configuration Section Project.



Fig 1:  Design your customized configure using Configuration Section Designer

When your design is finished press save button and it will prompt you to save the file. When it’s done a xxx.dll file will be created in the bin folder. Now open the Solution Explorer Window and then open nested files.



Fig 2:  C# and schema files are showing in the Solution Explorer.

So you are ready to test your dll in your sample application. Add Reference in your sample project and start writing code that manipulates your custom section.

            xxx.Configuration.Design.PlatformProvider providers = (xxx.Configuration.Design.PlatformProvider)ConfigurationManager.GetSection("platformProvider");

 

            string str = providers.Services.Name;

            Console.BackgroundColor = ConsoleColor.Blue;

            Console.ForegroundColor = ConsoleColor.White;

            Console.WriteLine("Platform Name '{0}'.", providers.Name);

            Console.WriteLine("Platform Services Name '{0}'.", providers.Services.Name);

            foreach (xxx.Configuration.Design.Service service in providers.Services)

            {

                Console.WriteLine("Implementated Service Name '{0}'.", service.Name);

 

                foreach (xxx.Design.Value setting in service.Settings.Values)

                {

                    Console.WriteLine("Setting {0}={1}, for implementated Service Name '{2}'.", setting.Name, setting.Data, service.Name);

                }

 

                foreach (xxx.Configuration.Design.Type type in service.Modules.Types)

                {

                    Console.WriteLine("Module {0}={1}, for implementated Service Name '{2}'.", type.Name, type.Assembly, service.Name);

                }

            }

 

Fig 3:  Configuration access code.


Fig 4:  Configuration Output.

Aun this is very nice tool I was wrong.


Thursday, October 13, 2011 #

Error:

 


There is a temporary failure. Please retry later. (The request failed, because you exceeded quota limits for this hour. If you experience this often, upgrade your subscription to a higher one). Additional Information : Throttling due to resource : Connections."


If you Google this issue, you only find different blogs and forums where geeks discussing this issue and giving suggestion to each other.
Even when I counter this issue I also review my application architecture and I re-write the Azure Appfabric cache component on the
following concept.

 

One connection per web role instance for DataCacheFactory


Important thing that you want to keep in mind is only one instance of DataCache is created per instance of DataCacheFactory and
GetDefaultCache() returns back the same instance each time.

To get rid of from this error I created OnPremCache class that is accessible from Instance property (basically I implemented a singleton
class) and call my OnPremCache methods from WCF Web Role service. 

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.ApplicationServer.Caching;

namespace Saqibullah.Com
{
    public sealed class OnPremCache
    {
        private DataCacheFactory dataCacheFactory = null;
        private DataCacheFactoryConfiguration dcfc = null;
        private DataCacheLocalCacheProperties local = null;
        private DataCache dataCache = null;

        public static readonly OnPremCache Instance = new OnPremCache();

        private OnPremCache()
        {
            LoadCacheConfiguration("default");
            dataCacheFactory = new DataCacheFactory(dcfc);
            dataCache = dataCacheFactory.GetDefaultCache();
        }

        private void LoadCacheConfiguration(string defaultorSSLEndpoint)
        {
            dcfc = new DataCacheFactoryConfiguration(defaultorSSLEndpoint);
            local = new DataCacheLocalCacheProperties(1000, TimeSpan.FromMinutes(5), DataCacheLocalCacheInvalidationPolicy.TimeoutBased);
            dcfc.LocalCacheProperties = local;
        }

        public object Get(string key)
        {
            return dataCache.Get(key);
        }
      
        public void Put(string key,object obj)
        {
            dataCache.Put(key, obj);
        }
      
        public void Add(string key, object obj)
        {
            if (dataCache.Get(key) == null)
                dataCache.Add(key, obj);
        }
     
        public void Remove(string key)
        {
            dataCache.Remove(key);
        }

    }
}

 

WCF Web Role class and interface and sample Data class.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace Saqibullah.com
{
    [DataContract]
    public class Data
    {
        [DataMember]
        public string Emp_Id { get; set; }

        [DataMember]
        public string Emp_Name { get; set; }

        [DataMember]
        public string Emp_Designation { get; set; }

        [DataMember]
        public string Emp_Salary { get; set; }

        [DataMember]
        public string Emp_IsManager { get; set; }

        [DataMember]
        public string Emp_CasualLeaves { get; set; }

        [DataMember]
        public DateTime ServerDate
        {
            get
            {
                return DateTime.Now;
            }
            set { }
        }
    }

    [ServiceContract]
    public interface IService1
    {

        [OperationContract]
        Data GetData(string clientId);

        [OperationContract]
        void PutData(string clientId, Data obj);

        [OperationContract]
        void RemoveData(string clientId);

        [OperationContract]
        void UpdateData(string clientId, object obj);

    }

    public class Service1 : IService1
    {

        public Data GetData(string clientId)
        {
            return OnPremCache.Instance.Get(clientId) as Data;
        }

        public void PutData(string clientId, Data obj)
        {
            OnPremCache.Instance.Add(clientId, obj);
        }


        public void RemoveData(string clientId)
        {
            OnPremCache.Instance.Remove(clientId);
        }

        public void UpdateData(string clientId, object obj)
        {
            OnPremCache.Instance.Put(clientId, obj);
        }
    }
}


Wednesday, October 12, 2011 #

This issue is related to permission on MachineKeys folder. I think this is right place where you should know what the determination of MachineKeys folder is.

What is MachineKeys Folder?

 

The MachineKeys folder stores certificate pair keys for both the computer and users. Both Certificate services and Internet Explorer use this folder. 

Possible reasons for getting this error message in your application are, may be your application using a certificate or your application trying to access a private key.

There are two ways through which you can solve this error.

First Way (When you don’t know the certificate key)

Open this folder C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys


Fig 1: MachineKeys Folder is protected and showing lock sign.

Give “Read and Write” and “List Folder Contents” permissions in Security tab to the IIS worker processes impersonated account (IUSER_MachineName or Network Service or any other account) to below folder

Fig 2: Giving Rights to MachineKeys Folder.


Fig 3: MachineKeys folder is granted for IIS worker processes impersonated account and lock sign has gone.

Second Way (When you certificate key)

Open mmc from Start menu. Add certificates snap-In and open the respective certificate store folder and then follow the step.

“Certificate Name” -> (Right-click) -> All Tasks -> Manage private keys

Add the IIS worker processes impersonated account (IUSER_MachineName or Network Service or any other account).


Fig 4: Certificate Manage private keys property.


Tuesday, October 11, 2011 #

Sometime when you open asp.net project in Visual studio 2010 and you get the following error message. Even some time when IIS 7.x already installed and running different applications.


Fig a:

Error Message:

https://localhost/ClaimsEnableWebSiteEx01 : error  : Unable to open the Web site 'https://localhost/ClaimsEnableWebSiteEx01'. IIS is not installed on this computer. To access local IIS Web sites, you must install the following IIS components: 

      Internet Information Services

      IIS 6 Metabase and IIS 6 Configuration Compatibility

      ASP.NET

 In addition, you must run Visual Studio in the context of an administrator account.

 For more information, press F1.


Solution:

Open Control Panel-> Programs and Features->Turn Windows features on or off. Under the list of features open Internet Information Services tree and then open Web Management Tools and then select IIS 6 Management Compatibility checkbox. Click OK button and install the selected feature of IIS.


Fig: b

Enjoy guys....


Sunday, October 9, 2011 #

When you are going to join any computer from domain controller the following error will be appeared on your computer screen.

Full Error Message

Note: This information is intended for a network administrator.  If you are not your network’s administrator, notify the administrator that you received this information, which has been recorded in the file C:\Windows\debug\dcdiag.txt.

The following error occurred when DNS was queried for the service location (SRV) resource record used to locate an Active Directory Domain Controller for domain saqibullah.com:

The error was: “DNS name does not exist.”

(error code 0x0000232B RCODE_NAME_ERROR)
The query was for the SRV record for _ldap._tcp.dc._msdcs.saqibullah.com
Common causes of this error include the following:

- The DNS SRV records required to locate a AD DC for the domain are not registered in DNS. These records are registered with a DNS server automatically when a AD DC is added to a domain. They are updated by the AD DC at set intervals. This computer is configured to use DNS servers with the following

IP addresses:

192.168.109.143

- One or more of the following zones do not include delegation to its child zone:
Saqibullah
.com
. (the root zone)
For information about correcting this problem, click Help.

I am writing the following steps to resolve this common issue.

Solution:

When you take properties of Computer the following screen will appear.


Computer properties showing that your computer is not the part of and Domain, so if you want that your computer should be a part of the domain then click on the Change Settings links


Computer Name/Domain Changes screen will appear in which Member of group showing that your computer not a part of the domain. So click on domain and type your domain name in the textbox and press OK button.


Its mean your computer unable to find the Active Directory Domain Controller, so you need to tell your computer where it find the DNS server. Open Network and Sharing Center from the control panel and then click Changes Adapter Settings and take the properties of Local Area Connection, and then take properties of Internet Protocol Version 4. Click on Advanced button in the bottom and select DNS tab. Following screen will appear.


Add DNS server address in the list.


Preferred DNS Server automatically set, so click OK button and then close the Local Area Connection Properties.


Again open the Computer Name/Domain Changes screen by take properties Computer following screen appear, select Domain option and type domain name in the textbox and click OK button.

Windows security screen will appear in which type domain user name and password.

Welcome screen will appear shortly.

 Now your computer is a part of Domain.


Saturday, October 8, 2011 #

As a developer of Microsoft technologies I alway think about what programming model and tools are provided by the platform. On Microsoft new operation system Windows 8 developer write two type of applications first one is Metro Style Apps and second one is Desktop Apps.

Metro Style Apps
Metro style apps are full screen apps tailored to your users' needs, tailored to the device they run on, tailored for touch interaction, and tailored to the Windows user interface.

Desktop Apps
Normal Windows applications that we are using in Windows 7 and Windows Vista like msn messanger,
MS Word etc.

Following diagram show the programming model and Tools for Windows 8


Figure 1: Windows 8 Platform and Tools


I am very glad when I used Microsoft new Operation System. Following are the screens shots that I captured from Windows 8.

P1
Figure 1: New Windows 8 Metro Style

Figure 2: New Microsoft IE 10 in Windows 8 Metro Style I am searching my blog on "google" :)


Figure 3: New Metro Style Control Panel



Figure 4: Weather Reporting Application in Metro Style View


Figure 5: All Time Favorite MS Paint in Windows 8

I will share more experiences of Windows 8 in future so keep catching me guys.