Friday, February 17, 2012

Good mobile development company for school apps

Hey guys, check out this company. Best option for mobile development for school apps.

http://www.crescerance.com/

Tuesday, April 05, 2011

Back to technology

After spending more than a year in project management, hopefully I will go back to technology arena. Back to technology means more blogs. So please stay tuned for some interesting blogs.

Monday, December 06, 2010

Is NoSQL a game changer?

NoSQL databases like MongoDB and CouchDB have been here for quite some time but now a new majority of developers has started to take this movement seriously. Whats your thought? Will we see Microsoft and Oracle supporting NoSQL in near future?

http://yoshinorimatsunobu.blogspot.com/2010/10/using-mysql-as-nosql-story-for.html

Sunday, July 12, 2009

He is unstoppable!!!

Office 2010 - checkout this video, this is really funny. Brilliant!!!

Saturday, July 04, 2009

WCF Sessions

In WCF, sessions are seen as group of ordered conversation in oppose to object centric behavior in ASP.NET. If the messages are exchange with same contract and contract specifies the session, a session is established for these messages. Following are the major differences between asp.net session and WCF session.

ASP.NET

WCF

Session is initiated by the server.

Session is initiated and terminated by the client.

Ordered processing (Messages are processed in sequence).

Unordered Processing

Provides general data storing mechanism

No such mechanism


In simplest form, we can specify session in following way:

[ServiceContract(SessionMode.SessionModeRequired)]

Public interface ICalculator { …}


WCF session has resemblance with local object. So by default, all subsequent requests are handled by same service instance.

Initiating operations are like constructors and Terminating operations are like destructors and requests between these two are like operation called on object.

[ServiceContract(Namespace="http://Microsoft.ServiceModel.Samples", SessionMode=SessionMode.Required)]

public interface ICalculatorSession

{

    [OperationContract(IsOneWay=true, IsInitiating=true, IsTerminating=false)]

    void Clear();

    [OperationContract(IsOneWay = true, IsInitiating = false, IsTerminating = false)]

    void AddTo(double n);

    [OperationContract(IsOneWay = true, IsInitiating = false, IsTerminating = false)]

    void SubtractFrom(double n);

    [OperationContract(IsOneWay = true, IsInitiating = false, IsTerminating = false)]

    void MultiplyBy(double n);

    [OperationContract(IsOneWay = true, IsInitiating = false, IsTerminating = false)]

    void DivideBy(double n);

    [OperationContract(IsInitiating = false, IsTerminating = true)]

    double Equals();

}


For detail: WCF Sessions.


Monday, June 08, 2009

C# 4.0 – the features I like most.

C# 4.0 is coming up with following new features as of its documentation on MSDN now:

  1. Dynamic lookup (You don't need to worry about type of target; Runtime figures out what exactly the operation means to the object)
  2. Runtime lookup (Operation is dispatched through reflection at runtime)
  3. Named and Optional Parameters (default values can be set to function argurments)
  4. New features in COM Interop – Compiling without PIAs, Omitting Refs, Dynamic Import
  5. Variance (Automatic assignments where it is safe in case of Generics)
  6. Covariance (The new IEnumerable and IEnumerator interfaces, now sequence of strings is also sequence of objects; very useful in Linq queries)
  7. Contravriance (Type parameters can be declared as "in" in Generics; IComparer<object> can be used where we are expecting IComparer<string>)

Though I have been using dynamic languages like python and perl, I really need to explore features of Dynamic lookup. As of developer of so many APIs, I can say that Named and Optional Parameter feature is really cool. It will provides enormous flexibility to API developers as well as API users. Last one is Compiling without PIAs. The developers who have worked on PIA can only know how useful this feature is. It gives big relief from versioning and loading large assemblies.

Wednesday, May 27, 2009

Regular Expression - using back reference in javascript

Following code snippet shows how can we use back reference to remove duplicate word from string.

var test = "personal personal computers and super computers computers";
test = test.replace(/(\w+)\s+\1/g,"$1");
alert(test);

Thanks to Cracki for pointing out difference between back reference and back tracking.

Friday, March 27, 2009

Sixth sense technology

Checkout this link. This is amazing.

Technology Breakthrough by an Indian !!!!

http://www.ted.com/index.php/talks/pattie_maes_demos_the_sixth_sense.html

Friday, March 20, 2009

.NET String comparison benchmarking

I was just going through http://msdn.microsoft.com/en-us/library/ms973919.aspx on string comparison. My finding is little different. If you are comparing strings with the combination of Equals() and ToUpper(), it is much faster than the Equals() and Enum StringComparison. I have profiled the code using Ants profiler and below is the screenshot.

Sunday, March 15, 2009

Regular Expression Cookbook


I have been waiting for this Regex cookbook for long time. I will make sure that I am the first person to get this book from store as soon as it is available.
http://www.amazon.com/gp/product/0596520689?ie=UTF8&tag=slfb-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=0596520689

Thursday, March 05, 2009

IE 8 - New Ajax and DOM storage Features

Following are few new cool features in IE8:

  1. New Ajax Navigation
  2. DOM storage upto 10 MB
  3. Online/Offline detection in Javascript
  4. XmlHttpRequest Timeout
Check out this url for detail:
http://msdn.microsoft.com/en-us/magazine/dd458804.aspx#id0100180

Wednesday, March 04, 2009

Perl - Find and replace without Regex

Perl doesn't have built-in string replace function as we have in C# but using \Q operator you can achieve same effect.



my $pattern = '[lerp]+';
my $target = 'this is [lerp]+ perl';
(
my $output1 = $target) =~ s/${pattern}//g;
(
my $output2 = $target) =~ s/\Q${pattern}//g;
print $output1 , "\n";
print $output2 , "\n";




Ouput:
this is []+
this is perl

Becoming a great writer !!!

There was once a young man who, in his youth, professed a desire to become a "great" writer.

When asked to define "great" he said "I want to write stuff that the whole world will read, stuff that people will react to on a truly emotional level, stuff that will make them scream, cry, wail, howl in pain, desperation, and anger!"

He now works for Microsoft writing error messages.

Friday, January 09, 2009

Some common regexs

set COMMENT {/\*[^*]*\*+([^/*][^*]*\*+)*/} # regex to match a comment
set COMMENT2 "//\[^\n]*" # regex to match a C++// comment
set DOUBLE {"(\\.|[^"\\])*"} # regex to match doublequoted string
set SINGLE {'(\\.|[^'\\])*'} # regex to match singlequoted constant

Sunday, November 30, 2008

Paging in SQL Server 2005 using OVER

Full detail of "OVER" can be found on following link:

Following is the code snippet to show how quick and simply pagination can be done using OVER:



USE northwind
DECLARE  @startIndex INT,
         @pageLength INT
SET @startIndex = 6
SET @pageLength = 5

SELECT *
FROM   (SELECT o.shipname,
               o.shipaddress,
               Row_number()
                 OVER(ORDER BY o.customerid DESC) AS rownumber
        FROM   orders AS o
               JOIN [order details] AS od
                 ON od.orderid = o.orderid
        WHERE  o.customerid = 'VINET') AS shipmentdetail
WHERE  rownumber BETWEEN @startIndex AND (@startIndex + @pageLength - 1)


Sunday, November 23, 2008

Creating a user and giving permissions in database

Sometimes we need to create special users for our database. For example, in one of my applications, I need to provide appropriate permissions for remote server window service (which is running as a local system account on remote server), so that it can connect to my database and can perform read-write operations. I found following links helpful for understanding basics of SQL server security:

http://vyaskn.tripod.com/sql_server_security_best_practices.htm

http://msdn.microsoft.com/en-us/library/ms187750.aspx

To cut long story short, following is SQL command to create and give read-write permissions to remote machine. Suppose remore server name is 'TESTDOMAIN\testserver'.


Go
IF NOT EXISTS (SELECT * FROM master.dbo.syslogins WHERE loginname = N'testdomain\testserver$')
CREATE LOGIN [testdomain\testserver$] FROM WINDOWS
GO

IF NOT EXISTS (SELECT * FROM dbo.sysusers WHERE name = N'testdomain\testserver$')
CREATE USER [testdomain\testserver$] FOR LOGIN [testdomain\testserver$] WITH DEFAULT_SCHEMA=[dbo]
GO
GRANT CONNECT TO [testdomain\testserver$]
EXEC sp_addrolemember 'db_datareader', 'testdomain\testserver$'
EXEC sp_addrolemember 'db_datawriter', 'testdomain\testserver$'
GO
GO

Saturday, November 15, 2008

Mime Types for Office 2007 documents

Sometimes you need to correctly set the mime type of file for uploading or downloading purpose. I found this link to help you in this situation, for you convienence, content types are below for docx file.

+---------------------------------------------------------------------------+-------+
| application/vnd.openxmlformats-officedocument.wordprocessingml.document | .docx |
| application/vnd.openxmlformats-officedocument.wordprocessingml.template | .dotx |
| application/vnd.openxmlformats-officedocument.presentationml.presentation | .pptx |
| application/vnd.openxmlformats-officedocument.presentationml.slideshow | .ppsx |
| application/vnd.openxmlformats-officedocument.presentationml.template | .potx |
| application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | .xlsx |
| application/vnd.openxmlformats-officedocument.spreadsheetml.template | .xltx |
+---------------------------------------------------------------------------+-------+

Example of IEnumerable and Yield

Following is very basic code snippet to create a simple IEnumerable class. (Question (1): what's the difference between IEnumerable and IEnumerator? Question (2): does anyone in this world still  implement IEnumerator?) 
using System;
using System.Collections;

public class Person
{
    public Person(string fName, string lName)
    {
        this.firstName = fName;
        this.lastName = lName;
    }

    public string firstName;
    public string lastName;
}

public class People : IEnumerable
{
    private Person[] _people;
    public People(Person[] pArray)
    {
        _people = new Person[pArray.Length];

        for (int i = 0; i <>
        {
            _people[i] = pArray[i];
        }
    }

    IEnumerator IEnumerable.GetEnumerator()
    {
        foreach (Person p in _people) 
yield return p;
    }
}

public class MyClass
{
public static void RunSnippet()
{
Person[] peopleArray = new Person[3]
        {
            new Person("John", "Smith"),
            new Person("Jim", "Johnson"),
            new Person("Sue", "Rabon"),
        };

        People peopleList = new People(peopleArray);
        foreach (Person p in peopleList)
            Console.WriteLine(p.firstName + " " + p.lastName);
}
#region Helper methods
public static void Main()
{
try
{
RunSnippet();
}
catch (Exception e)
{
string error = string.Format("---\nThe following error occurred while executing the snippet:\n{0}\n---", e.ToString());
Console.WriteLine(error);
}
finally
{
Console.Write("Press any key to continue...");
Console.ReadKey();
}
}
#endregion
}

Thursday, October 16, 2008

Using Resource files in Web Service (.NET 3.5) and Regular expression with LINQ

/*
Those who has tried to use resource file in ASP.NET web service know well there is issue in using resource files in web service. Following code snippet targets 3 points:
1. Using resource file in web service or HttpHandlers.
2. Regular expression for converting resource strings with respective localized strings
3. LINQ integration in Regular expression.
Suppose placeholder for resource string in text is like ({BR[MyResourceString]BR}) . Following function will return localized string.
*/


public static string LocalizedHTML(string inputHtml)
{
if (string.IsNullOrEmpty(inputHtml)) return "";

Regex reg = new Regex(@"\(\{IA\[(.*?)\]IA\}\)", RegexOptions.Multiline | RegexOptions.Singleline
| RegexOptions.IgnoreCase | RegexOptions.Compiled);


System.Resources.ResourceManager RM =
new System.Resources.ResourceManager("Resources.Language",
global::System.Reflection.Assembly.Load("App_GlobalResources"));


return reg.Replace(inputHtml, m => (!string.IsNullOrEmpty(RM.GetString(m.Groups[1].Value)) ? RM.GetString(m.Groups[1].Value) : m.Value));

}

Monday, October 13, 2008

Finding installed FTS IFilters on SQL 2005

Following command can be used to find out installed IFilters on SQL2005:

select * from sys.fulltext_document_types

Saturday, August 30, 2008

10 Myths about Open Source Software in Business

ActiveState released this white paper on myths about Open Source Software.

Saturday, August 16, 2008

Easy log parsing with FileHelper

FileHelper is .NET library that provides a very easy and fast parsing methods for delimited or fixed length logs. You can import/export data in file, strings or steams. According to site:

The idea is very simple

You can strong type your flat file (fixed or delimited) simply describing a class that maps to each record and later read/write your file as an strong typed .NET array

Sunday, August 03, 2008

I want a better...

Ahh.. everybody is coming up with new idea and printing money. How about a site that have wish list of frustrated customers. Who knows you may get a new idea from the wish list. 'I-want-a-better' internet connection !!!

Every block - next level of public data processing

This site aggregates tons of public data source by geo location. You can search by various categories. For example, you can view all crime news local to your area in particular city. Currently site is supporting only few cities. According to site:

"EveryBlock is a new experiment in journalism, offering a Web "newspaper" for every city block in Charlotte, Chicago, New York, Philadelphia and San Francisco — with more cities to come. Enter any address, neighborhood or ZIP code in those cities, and the site shows you recent public records, news articles and other Web content that’s geographically relevant to you. To our knowledge, it’s the most granular approach to local news ever attempted."

Monday, July 28, 2008

Better searching with Cuil (hopefully)

Cuil was created by a former Google employee and has entirely different approach for indexing. Till now, this search engine has indexed 120 billion pages, 3 times of Google. Only the time will tell, how it goes, but its result formatting is much better than of Google. It gives results in magazine style formatting. One more thing I like - Home page with black background. I don't know whether it was intentional, but global warming fighter community will surely admire it.