Saturday, August 29, 2009

There is no place like 127.0.0.1 :) - errr....come again

Q : 'There is no place like 127.0.0.1 :)' ....errr...come again

Chances are that either you are a techie, and you exactly know what this statement mean, which means that you can totally understand how true it is. And there is also a chance that you are not-so-techie, you saw this statement and thought, 'uh huh, some other stupid, stinky, meaningless tech/mathematical gibberish - oh God! why don't we just keep the technology but get rid of the tech crowd.' In that case, let me explain the statement to you.

We all have heard and believed the phrase that 'There is no place like home.' In the tech world, what's your home ?....mmm....your PC. And in simple, plain English, 127.0.0.1 == your personal PC. For a more technical definition,

127.0.0.1 is a special Internet Protocol (IP) address that points to your own computer. It is also referred to as the local host or loopback address. Local host is sometimes commonly referred to as My computer.
So..now...you see...it wasn't such a meaningless gibberish :) There is definitely no place like my personal computer 127.0.0.1


Q : ...mmmmk...so did you really came up with this statement all by yourself ?

Good Question. Though I do like to think that I can come up much cooler statements, but still, I didn't came up with this one. It's quite a well known saying in the tech crowd. I saw it on a website selling T-Shirts for geeks, and there were some other shirts with statements like 'I failed the Turing test' or 'No, I won't fix your computer!' and yes it took some gigantic efforts on my part to not go ahead and place an order for each and every one of them....:S

Q : .Okay, whatever! I always knew you are a geek.

Nopes, I'm still not a geek! Here are my reasons,

1. I have never watched Star Trek (though I do have a feeling that I'll love it if I ever got to watch it :s)

2. I have no interests in Diana sours, animated or real, never even watched Jurassic Park!

3. I do not have any weird collection of comic characters

4.I never played the quiz 'The one super hero who could become your life partner.'

So...nopes...not a geek!

Microsoft Architecture Journal - Business Intelligence - Call for Paper

First thing first, If you work on Microsoft technologies and don't know about Microsoft Architecture Journal, then you should definitely go ahead and immediately get all the necessary information from their site. Here is a small excerpt from their site,

The Platform Architecture Team is composed of architects focused on architecture guidance and research on upcoming technologies and trends. We are committed to providing thought leadership in order to help every stakeholder in this value chain (users, business managers, IT managers, developers, etc.) understand how today’s business challenges are being addressed by the upcoming wave of technologies and practices. Our intention with all these is to help you get better software that is timely, more maintainable and evolvable.
More details can be found here . And every quarter, they issue a really very valuable magazine, comprising of articles addressing a specific concept from the perspective of different stake holders. You can see all their past magazines on their site and I'll recommend you to take out time and go through them all. They are truly informative.

So, they are making a call for articles for their upcoming issue, it's main theme is 'Business Intelligence'

Dear architect,

We are pleased to announce the call for papers for the 22nd Microsoft Architecture Journal.

Information is at the core of a business's ability to make effective decisions. Architecture initiatives that increase the quality, timeliness, and usefulness of information have a direct correlation to increased revenue and competitiveness. As a result, Business Intelligence is top of mind for business and technology leaders.

For this edition of the Microsoft Architecture Journal, we are looking for interesting, thought-provoking, and insightful articles about effective architecture and Business Intelligence.

Some suggestions for Business Intelligence focus areas include (but are not limited to):
Enterprise Business Intelligence strategy and architecture: Effectively reconciling the explosion of data across Operational Data Stores (ODS) and Data Warehouses (DW), building BI solutions that consolidate and work across heterogeneous data sources, successfully leveraging MOLAP, ROLAP and HOLAP for analysis, and integrating enterprise data with integration services, and Information As A Service (IaaS) across on-premises and cloud models.
Embedding business insights into your applications: How to embed reports and analysis capabilities into your custom and line of business applications.
Infrastructure and performance: Architectural considerations for BI & data warehouse solutions with high-volume, low-latency, low-cost access to data.
End-user and self-service Business Intelligence: Empowering end users to build BI solutions with little to no dependence on IT while enabling IT to maintain monitoring & management of end user built solutions. Helping people access, visualize and model disparate data to improve their ability to quickly make decisions and take action.
Delivering an effective Business Intelligence project: Structuring an effective BI project, including building an effective team, requirements gathering, change management, customer-connected engineering, success criteria, etc.
If you like to share your wisdom and experience with Business Intelligence with the architecture community, this is your chance. To submit your proposal, please send the following before September 11, 2009:
An abstract of between two and four paragraphs.
A short list (2-3 items) of reader's takeaways from business and technical perspectives. This determines the relevance of your value proposition.
A short bio (1-2 paragraphs).
A list of previously published articles, if any.
Submissions must be made to archjrnl@microsoft.com (we receive many submissions for each issue, so we encourage you to put time and thought into yours).

After the call for articles has ended, everyone who has submitted an idea will be notified via e-mail as to whether their submission was accepted or not. If it is accepted, your article must follow this schedule:
September 18. Acceptance notified.
October 8. A first draft (possibly unfinished) is due.
October 22. Final draft is due.*
Mid December. The Journal containing your article is ready and published.
* We recommend that articles be between 2,500 and 3,500 words in length.

For more information, check out this link or contact us at archjrnl@microsoft.com. Good luck!



Sincerely,
Diego Dagum
Editor-in-chief
So if the topic comes under your expertise and you do feel like writing a paper then this might be a chance of addressing a large number of reader. Best of luck!

Weekly Article Recommendation

1. Multi-Targeting Support (VS 2010 and .NET 4 Series) from ScottGu's Blog

Microsoft's Scott Guthrie talks about the improvements in VS 2010 with regards to multi targeting of Dot Net version's.

2. Distributed Caching On The Path To Scalability

An article in MSDN, discussing pretty much everything major about distributed caching for large size applications.

3. Cloud Computing with Amazon Web Services

All that you need to know about cloud computing with Amazon web services.

That's all for this week.

Tuesday, August 18, 2009

Extension less URLs in ASP.Net

Problem Statement
Your Web Server :
IIS 6 or below

You need extension less URLs, like they have in twitter, eg. www.twitter.com/beenish ,. If you notice, it doesn't have any extension like PHP or ASPX, so IIS won't know which dll to call and execute this request, it will simply show you a Page not found - 404 error.

Note : IIS7 supports this feature and Apache has a very simple rewrite module for it.

Solution
Your best bet would be to use an ISAPI rewriter. Ionic ISAPI rewrite is probably the best free one out there. The one drawback it has is the regex formats used, which are a little different from the ones used in Apache, so if you are use to Apache's rewrite module, you might have to make some adjustments. I found it's installation to be quite simple.

You can find all the help at their site.

Apart from this, Scott Guthrie has discussed some nice tips and tricks for URL rewriting, which you can check here : URL Rewriting - Tips/ Tricks

ASP.Net - Single Sign On & Session Handling

The part 1 of this post can be read here.

Problem Statement
So single sign on is all up and running and users are able to login once and access all the sub domains. Now, if you are saving any user data in session then you should remember that every time the user jumps to another sub domain, application reloads the session, which means that your application would be performing the tasks added to any session based event every time user changes the domain. This can become a performance nightmare depending on how much data you are storing and if you are making any db calls.

Another problem would be that you won't be able to share data across sub domains like some kind of flag etc., because session is getting initialized every time the sub domain changes.

Solution
The simplest solution is that you share the session across all sub domains. Here's what you need to do,

1. Make your custom session class by simply inheriting the

System.Web.SessionState.SessionIDManager, System.Web.SessionState.ISessionIDManager

and implement the ISessionIDManager interface's methods. Here's what the end result will be,

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public class MySession : System.Web.SessionState.SessionIDManager, System.Web.SessionState.ISessionIDManager

{

#region ISessionIDManager Members

string System.Web.SessionState.ISessionIDManager.CreateSessionID(HttpContext context)
{
return base.CreateSessionID(context);
}

string System.Web.SessionState.ISessionIDManager.GetSessionID(HttpContext context)
{
return base.GetSessionID(context);
}

void System.Web.SessionState.ISessionIDManager.Initialize()
{
base.Initialize();
}

bool System.Web.SessionState.ISessionIDManager.InitializeRequest(HttpContext context, bool suppressAutoDetectRedirect, out bool supportSessionIDReissue)
{
return base.InitializeRequest(context, suppressAutoDetectRedirect, out supportSessionIDReissue);
}

void System.Web.SessionState.ISessionIDManager.RemoveSessionID(HttpContext context)
{
base.RemoveSessionID(context);
}

void System.Web.SessionState.ISessionIDManager.SaveSessionID(HttpContext context, string id, out bool redirected, out bool cookieAdded)
{
base.SaveSessionID(context, id, out redirected, out cookieAdded);
HttpContext.Current.Response.Cookies["ARSessionCookie"].Domain = FormsAuthentication.CookieDomain;
}

bool System.Web.SessionState.ISessionIDManager.Validate(string id)
{
return base.Validate(id);
}

#endregion
}


2. Add the following to your web.config

[sessionState sessionIDManagerType="MySession" cookieName="MySessionCookie"][/sessionState>]

Note : Replace [ with <> .

You are done! Now user's session will be shared across all the sub domains (considering that it's the same server) .

Friday, August 7, 2009

Binary Search

The Algo as I can recall

So this quick discussion about Binary search is because one of the readers namely 'alifnoon' on my other blog wanted to see how many software engineers can actually write a correct binary search algorithm, which we all feel is quite simple. I agreed to do the exercise and post the results on this blog.

This code piece is something which I studied in Robert Sedgwick's book some years back,

public bool SearchItem(object itemToSearch, object[] itemList)
{
int leftIndex =1;
int rightIndex = itemList.Length;
int median=0;

while(rightIndex >= leftIndex)
{
median = (leftIndex + rightIndex) / 2;

if(itemToSearch == itemList[median])
return true;

if(itemToSearch < itemList[median])
rightIndex = median - 1;
else
leftIndex = median + 1;

}

return false;

}
I believe this is the code which follows divide and conquer approach. I stayed true to my words and gave you what I had in my mind.

My Two Cents
In the second part of this post, let me add a few things. I went ahead and searched around and came across this

http://googleresearch.blogspot.com/2006/06/extra-extra-read-all-about-it-nearly.html

where the writer has mentioned that there is a major flaw in binary search.

So alifnoon, I do want to give my two cents. I don't think that this is a flaw in the algo , it's more about scope definition. We can easily add the information to algo that it will work for values up to XYZ. It's understandable that they couldn't cover such scenarios mainly because they never really had to deal with such large values. If I look in this direction then right and left indexes are defined as int, and their values can become too large to beat an int.

If we would try to come up with applications which would work for every scenario and would have undefined scope then I doubt there is any chance of making one.

So just like any other field, algorithms are continuously evolving depending on changing requirements. That's how I feel :)

Conclusion
Thanks alifnoon for raising this issue, I sort of enjoyed this exercise and have decided to do some exercises out of programming pearls, it's almost an year that I last touched it.