Telerik blogs

Latest

  • Web

    Encode and Decode strings using JavaScript

    In order for a string to be read from all computers sometimes it is useful to encode and decode it. This can be easily achieved using the JavaScript built-in escape() and unescape() methods. Both the escape() and the unescape() methods have the same argument – the string which will be escaped or unescaped. The escape() method returns a string value (in Unicode format) that represents the encoded contents of the function argument. All spaces, punctuation, accented characters, and any other non-ASCII characters are replaced with %xx encoding, where xx is equivalent to the hexadecimal number representing the character. For example, a space is returned as "%20". Additionally, having...
    January 15, 2009
  • Web

    BDD. At first I was afraid, I was petrified.

    Yes, seriously, my first reaction to a post in which I noticed BDD-kinda-tests was something like "whoa, interesting naming convention for test method names, and all these underscores...". After that I came upon several other blog posts containing BDD tests and I still didn't get the idea. Then I read Dan North's post introducing the idea of Behavior Driven Development and I finally started catching the point. But catching the point at that time was not like "well, it's worth it and I'll try it" but rather like "ok, it's a TDD variation with some funky new lingo, so... ok". I could abandon...
    January 14, 2009
  • Web

    Customizing the Radial RadGauge

    Hello everyone and happy new year. Today I decided to break the lengthy silence on my blog with an example on how to customize the RadGauge. Since there were a couple of requests for custom Radial Gauge, I will present a way to create a semi-circle gauge. That is generally achieved in two steps: Customize the radial scale range Four parameters define the radial scale range: StartAngle, SweepAngle, Radius and Center. The StartAngle and SweepAngle are specified in degrees (0 to 360), starting from the right side of the gauge, going clockwise (note, that positive angle direction is starts from positive X and goes to the positive...
    January 13, 2009
  • Web

    Comparing Generic Types

        Today I was dealing with the problem of comparing generic types in Silverlight. After researching the problem I found many similar issues for which I couldn't find any straightforward solution on the web. So here we go - a post on the issue how to compare generic types. First, let’s say we have a simple generic class which is composed of two generic properties A and B, and a method that we will later use to compare these two properties. Moreover, I will constraint the class to invoke the constructor of the generic type argument by using where T : new()      public class GenericClass<T> where T : new()       {...
    January 10, 2009
  • Web

    Encode and Decode URI(Uniform Resource Identifier) using JavaScript

    The current article is taken from https://developer.mozilla.org/ In some scenarios it is useful to encode and decode the URI. For example: To avoid unexpected requests to the server, you should call encodeURIComponent on any user-entered parameters that will be passed as part of a URI. For example, a user could type "Thyme &time=again" for a variable comment. Not using encodeURIComponent on this variable will give comment=Thyme%20&time=again. Note that the ampersand and the equal sign mark a new key and value pair. So instead of having a POST comment key equal to "Thyme &time=again", you have two POST keys, one equal to "Thyme " and another...
    January 08, 2009