WHAT'S NEW?

Random Code snippets 1

Was trying few things in random and came across this.
How to call a non-static method inside a static method which belong to the same class. Here is the sample.
question framed myself.


Small Talk :: WCF :: RESTful service basics


I came across one question too many times on multiple websites and from multiple persons -
"What is REST and RESTful service?" or "Please tell me how to define RESTful service?" or "What is the significance of RESTful service?"

So, I have decided to write this post and believe this will clear the air about the basic understanding of RESTful service.

Here we go:

  • REST stands for Representational State Transfer.
  • RESTful service says that any service should be treated as a RESOURCE and it should be available and be accessible using simple HTTP binding.
  • It says that any operations that we perform on database are resource operations. So, RESTful service should also be able operate in the same manner.
  • Thus, all the CRUD operations, called the VERBS- that is actions should be performed using the REST.
  • So they are – GET(), POST(), PUT(), DELETE().



What next? Think about ODATA services? .... sure, will take this up too for the benefit of all of us here, in the next post. Happy Coding!!! 

Instant Calculator using Google

Need an instant calculator in your web browser. Here it is from Google. Few of you might already know this yet sharing it for the benefit of larger audience.

Converting a normal ILINQ query to parallel linq query


A simple example for converting the normal linq query to a Parallel Linq query in dotnet.


public void NormalLinqQuery()
        {
            IEnumerable<int> localRange = Enumerable.Range(1, 100000000);
            Stopwatch watch = Stopwatch.StartNew();
            var output = localRange
                .Where(getNum => getNum % 1234567 == 0)
                .Select(rangeNum => rangeNum);
            foreach (var num in output)
                Console.WriteLine(num);
            Console.WriteLine("Normal Query in millisec: {0}",watch.ElapsedMilliseconds);
        }

        public void ParallelLinqQueryExample()
        {
            IEnumerable<int> localRange = Enumerable.Range(1, 100000000);
            Stopwatch watch = Stopwatch.StartNew();
            var output = localRange
                .AsParallel()
                .Where(getNum => getNum % 1234567 == 0)
                .Select(rangeNum => rangeNum);
            foreach (var num in output)
                Console.WriteLine(num);
            Console.WriteLine("Parallel Query in millisec: {0}", watch.ElapsedMilliseconds);
        }

Django +Python coming up


Its over 2 weeks, that I have not posted anything here. Wondering what I am up to? 
The pic below describes all. So, stay tuned for a tiny sample code in our Github soon. Happy coding.