Check Telephone.com our new website using .netframework 3.5

You can now add your own twist to telephone.com and personalize your messaging style by writing your own SMS applications to implement any feature you would like to add to your messaging experience using our wcf rest API

Regards

reCAPTCHA is a free CAPTCHA service that helps to digitize books, newspapers and old time radio shows.

Interactive Web applications may need to dynamically create the reCAPTCHA widget in response to user input. To support such applications, RECAPTCHA offers an AJAX API.

 

Heres a simple Demo on how to create and validate recaptcha using clientside web service call

 

<script type="text/javascript" src="http://api.recaptcha.net/js/recaptcha_ajax.js"></script>
<script src="Scripts/jquery-1.2.6.js" type="text/javascript"></script>

 

 

<script type="text/javascript">
        $(document).ready(function() {   showRecaptcha('recap') ;    });

        function GetWebService()
        {
            return DemoProject.Services.WebService1;
        }

        function showRecaptcha(element) {
            var RecaptchaOptions = {
                theme: 'custom',
                lang: 'en',
                custom_theme_widget: 'recaptcha_widget'
            };
            Recaptcha.create("xxxxxxxxxxxxxxxxxxxx", element, RecaptchaOptions);
            RecaptchaStr_en.play_again = "replay";
            RecaptchaStr_en.cant_hear_this = "can't hear";
        }

        function ValidateRecaptcha() {          
            GetWebService().ValidateRecaptcha(Recaptcha.get_challenge(),  Recaptcha.get_response(), onValidateRecaptchaSuccess, onValidateRecaptchaFailed);
        }

        function onValidateRecaptchaSuccess(ret) {
            if (ret == true)
            {
                alert('success');
            }
            else
            {
                alert('failed');

                //Reload recaptcha in case it fails
                Recaptcha.reload();
            }

        }

        function onValidateRecaptchaFailed(ret) {
           alert('an error has occured'); 
        }
</script>

 

//Add a scriptmanager to your page

<asp:ScriptManager ID="ScriptManager1" runat="server">
    <Services>
        <asp:ServiceReference Path="~/Services/WebService1.asmx" />
    </Services>
</asp:ScriptManager>

<div id="recap">
        <div id="recaptcha_widget" style='display: block'>
            <span>Please type in both words separated by a space. Words are not
                case-sensitive.</span>
            <div class="recaptcha_only_if_image">
                <span>Having trouble? <a href="javascript:Recaptcha.switch_type('audio')">
                    listen</a> to an audio captcha or <a href="javascript:Recaptcha.reload()">load</a>
                    a different image.</span>
            </div>
            <div class="recaptcha_only_if_audio">
                <a href="javascript:Recaptcha.switch_type('image')">Go back</a>to the image, or
                <a href="javascript:Recaptcha.reload()">load</a> a different audio captcha
            </div>
            <div id="recaptcha_image">
            </div>
            <div class="recaptcha_only_if_incorrect_sol">
                Incorrect please try again</div>
            <span class="recaptcha_only_if_image">Enter the words above:</span> <span class="recaptcha_only_if_audio">
                Enter the words you hear:</span>
            <input type="text" id="recaptcha_response_field" name="recaptcha_response_field"  />
        </div>
</div>
<input type="button" value="validate" onclick="ValidateRecaptcha();"  />

 

//WebService1.asmx


    [WebMethod(true)]
    [System.Web.Script.Services.ScriptMethod()]
        private bool ValidateRecapatcha(string challengeValue, string responseValue)
        {
            try
            {
                Recaptcha.RecaptchaValidator captchaValidtor = new Recaptcha.RecaptchaValidator
                {
                    PrivateKey = "xxxxxxxxxxxxxxxxxxxx",
                    RemoteIP = HttpContext.Current.Request.UserHostAddress,
                    Challenge = challengeValue,
                    Response = responseValue
                };
                Recaptcha.RecaptchaResponse recaptchaResponse = captchaValidtor.Validate();
                return recaptchaResponse.IsValid;
            }
            catch (Exception)
            {
        //log the error

                return false;
            }
        }

 

 

 

 

HTH

Regards

Bilal Shouman

Add LINQ to SQL Debug Visualizer to your VS2008, here is a link for the add-in.
The download contains both a binary .dll assembly version of the visualizer (within the \bin\debug directory below), as well as all of the source code for the visualizer.

 

To install the LINQ to SQL debug visualizer, follow the below steps:

1) Shutdown all running versions of Visual Studio 2008

2) Copy the SqlServerQueryVisualizer.dll assembly from the \bin\debug\ directory in the .zip download above into your local \Program Files\Microsoft Visual Studio 9.0\Common7\Packages\Debugger\Visualizers\ directory

 

 

Regards

A shortcut I was searching for along time CTRL + "M" + "M"

This one will collapse the region your cursor is at whether its a method, namespace or whatever for collapsing code blocks, regions and methods. The first will collapse only the block/method or region your cursor is at while the second will collapse the entire region you are at.

 

Here's a reference for more Visual Studio Shortcuts

Enjoy :)

A helper class that might help, when you are developing with TFS:

using System;
using System.Collections.Generic;
using Microsoft.TeamFoundation.WorkItemTracking.Client;
using System.Net;
using Microsoft.TeamFoundation.Client;

namespace Utilities
{
    public class TFSHelper
    {
        private WorkItemStore MyStore { get; set; }

        public TFSHelper()
        {
            NetworkCredential cred = new NetworkCredential("userName", "password", "domain");
            TeamFoundationServer tfs = new TeamFoundationServer("serverName", cred);
            tfs.EnsureAuthenticated();
            MyStore = (WorkItemStore)tfs.GetService(typeof(WorkItemStore));
        }

        /// <summary>
        /// Get AllowedValues by workItemId and fieldName
        /// </summary>
        /// <param name="workItemId"></param>
        /// <param name="FieldName"></param>
        /// <returns></returns>
        public AllowedValuesCollection GetAllowedValues(int workItemId, string FieldName)
        {
            WorkItem WI = MyStore.GetWorkItem(workItemId);
            AllowedValuesCollection states = WI.Fields[FieldName].AllowedValues;
            return states;
        }


        public WorkItemCollection GetWorkItems(string queryName, string projectName)
        {
            Project project = MyStore.Projects[projectName];
            Dictionary<string, string> values = new Dictionary<string, string>();
            values.Add("project", projectName);

            foreach (StoredQuery projectQuery in project.StoredQueries)
            {
                if (projectQuery.Name == queryName)
                {
                    WorkItemCollection workItems = MyStore.Query(projectQuery.QueryText);
                    return workItems;
                }
            }
            throw new Exception("Query does not exists");                     
        }


        public void UpdateWorkItem(int workItemId, string Description, string tag)
        {
            WorkItem WI = MyStore.GetWorkItem(workItemId);
            WI.Open();
            WI.Fields["Description"].Value = Description;
            WI.Fields["tag"].Value = tag;
            WI.Save();
        }
    }
}

 

 

Regards

A great post written by my friend Ralph about binding asp.net treeview

check it out: Binding ASP.NET TreeView to a DataSet or an ObjectDataSource

 

 

Regards

Today my teammate and my friend, [MVP] Wessam Zeidan, will leave Telephone.com to join Microsoft. It's a huge loss for Telephone.com team. Wessam is a great guy, with a huge amount of technical information. We are going to miss him, and we all wish him a good luck.

 

Reveals extensive enhancements for simplified application life-cycle management, provides sneak peek at all key focus areas for Visual Studio 2010("Rosario") and the .NET Framework 4.0.


Stay tuned to http://channel9.msdn.com/VisualStudio/  for all of the action


Regards
More Posts