Türkçe   |   English
Calendar
Categories
Archive
Links
Blogroll
Files

23.06.2008
Yazgelistir - CodeSnippets And Open Source Projects
Turkey's Developer Platform Yazgelistir.com has opened two new categories. These categories are Code Snippets and OpenSource Projects. From now on the users will not only read the topics that they intrested, bur also wil have the chance to download the code of an application that they are intrested in. Since the software industry is also based on practical knowledge and experience as teorical knowledge, this is an excellent improvement.
Codes,News,Open Source
Comments(0)

10.05.2008
T.C. Identity Number correctness validation

There is a hash algorithm which makes us able to validate T.C. Identity Number that we take as an input in our projects. You can find the method that checks this hash below.

        private bool ValidateNumber(string parNumber)

        {

            for (int i = 0; i < parNumber.Length; i++)

            {

                if (!(char.IsNumber(parNumber[i]))) return false;

            }

 

            return true;

        }

        public void ValidateTCIdentityNumber(string TCIdentityNumber)

        {

            if (ValidateNumber(TCIdentityNumber.Trim()))

            {

                if (TCIdentityNumber.Trim().Length < 11)

                {

                    throw new Exception("T.C. Kimlik Numarası 11 karakterden az olamaz. Lütfen kontrol ediniz.");

                }

                else

                {

                    decimal identityNumberDecimal = Convert.ToDecimal(TCIdentityNumber.Trim());

                    decimal temp = Math.Floor(identityNumberDecimal / 100);

                    decimal temp1 = Math.Floor(identityNumberDecimal / 100);

                    int[] D = new int[10];

                    for (int n = 9; n >= 1; n--)

                    {

                        D[n] = (int)temp1 % 10;

                        temp1 = Math.Floor(temp1 / 10);

                    }

                    int oddSum = D[9] + D[7] + D[5] + D[3] + D[1];

                    int evenSum = D[8] + D[6] + D[4] + D[2];

                    int total = oddSum * 3 + evenSum;

                    int ChkDigit1 = (10 - (total % 10)) % 10;

                    oddSum = ChkDigit1 + D[8] + D[6] + D[4] + D[2];

                    evenSum = D[9] + D[7] + D[5] + D[3] + D[1];

 

                    total = oddSum * 3 + evenSum;

                    int ChkDigit2 = (10 - (total % 10)) % 10;

                    temp = (temp * 100) + (ChkDigit1 * 10) + ChkDigit2;

                    if (temp != identityNumberDecimal)

                    {

                        throw new Exception("T.C. Kimlik Numaranızı kontrol ediniz.");

                    }

                }

            }

            else

            {

                throw new Exception("T.C. Kimlik Numarası yalnızca rakamlardan oluşmalıdır. Lütfen kontrol ediniz.");

            }

        }

 

Clues,Codes
Comments(4)

20.01.2008
ExtendedDataTable @ Codeplex

I've enhanced some properties and uploaded the ExtendedDataTable component which I previously wrote an article about. You can view and download it with the source code.
http://www.codeplex.com/ExtendedDataTable

Codes,Open Source
Comments(0)

17.01.2008
Wireless Signal Strength
I was researching how to get wireless signal strength with .Net. I'd like to share the resource i found.
http://www.microsoft.com/technet/scriptcenter/resources/qanda/mar07/hey0322.mspx

And also you can write the WMI Query in .Net as shown below.

ManagementObjectSearcher searcher = null;
searcher = new ManagementObjectSearcher(@"root\WMI", "select Ndis80211ReceivedSignalStrength from MSNdis_80211_ReceivedSignalStrength");
ManagementObjectCollection adapterObjects = searcher.Get();
foreach (ManagementObject mo in adapterObjects)
{
string s = mo["Ndis80211ReceivedSignalStrength"].ToString();
}
Codes
Comments(0)

15.01.2008
Passing Objects Between Pages
In order to pass objects within pages we commonly add objects to session at first page, and we remove objects from session just after reading values at redirected page. It is more manageable to use Context.Item for this purpose since it relases objects automaticly. In order to make this technique redirection should be made by Server.Transfer method.
Clues,Codes
Comments(0)

12.01.2008
location.replace
We commonly set the new page address to window.location.href property to redirect a page at client side via javascript. window.location.replace is a function that provides same functionality however it also loads the new url over current history entry. Redirection with this function does not allow users navigate to the previous URL by using browser's Back button. And finally window.location.relpace('newPage.html') is the syntax of this function.
Clues,Codes
Comments(0)

10.01.2008