Wednesday, December 22, 2010

How wrong we are to foresee future

As I was wandering in internet from one article to another, I stumbled upon a very interesting discussion between Andrew S. Tanenbaum
and
Linus Torvalds. Here is the discussion. Discussion took place early 92 and it is about Tanenbaum attacking the new kid on the block (read Linux) and Linus defending his brain child. I am quoting some excerpts from that discussion because it depicts how wrong Tanenbaum was to foresee the future.

"While I could go into a long story here about the relative merits of the two designs, suffice it to say that among the people who actually design operating systems, the debate is essentially over. Microkernels have won. MINIX is a microkernel-based system. LINUX is a monolithic style system. This is a giant step back into the 1970s."

"MINIX was designed to be reasonably portable, and has been ported from the Intel line to the 680x0 (Atari, Amiga, Macintosh), SPARC, and NS32016. LINUX is tied fairly closely to the 80x86. Not the way to go."

"I still maintain the point that designing a monolithic kernel in 1991 is a fundamental error. Be thankful you are not my student. You would not get a high grade for such a design :-)" -> I guess Mr. Tanenbaum would be more than proud to find such a brilliant student. Alas!!!

"When MS-DOS was written specifically for the 8088 ten years ago, this was less than brilliant, as IBM and Microsoft now only too painfully realize. Writing a new OS only for the 386 in 1991 gets you your second 'F' for this term. But if you do real well on the final exam, you can still pass the course." -> How wrong, how wrong?

As you can see how wrong his predictions were. He developed a portable system but what did he get? x86 is the clear winner and all those SPARC and other architecture are nowhere. His boasting about micro-kernel is also short lived because Linux is one of the major OS out there having monolithic kernel. As another fact most popular OS (read Windows) on planet is hybrid-kernel based OS which is closer to monolithic kernel.

All this wrong predictions remind me of a quote by Bill Gates-

"We always overestimate the change that will occur in the next two years and underestimate the change that will occur in the next ten. Don't let yourself be lulled into inaction."

Monday, December 20, 2010

Future of Silverlight

Microsoft did not give proper focus to Silverlight sessions in PDC 2010. Apart from this the on going work on HTML 5 standard and Microsoft’s commitment to make IE9 a HTML 5 compliant browser has raised questions on future of Silverlight. There are many capabilities which were exclusive to Silverlight are part of HTML 5 standard. I found somewhat convincing answer to future of Silverlight on Silverlight team’s blog.

However if you are thinking that confusion is all cleared now then read some words from Bob Muglia, the Microsoft President in charge of the company’s server and tools business.

Live in confusion!!!

Thursday, December 16, 2010

Using soapUI to consume a WS-Addressing service

Today I downloaded the latest verion (3.6.1) of soapUI and wanted to test a WCF service. I added the service reference to soapUI and it was able to find WSDL but when I tried to execute the service, it gave me following error:

<s:Reason>
<s:Text xml:lang="en-GB">The message with To '' cannot be processed at the
receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check
that the sender and receiver's EndpointAddresses agree.</s:Text>
</s:Reason>

I quickly googled and found that somebody had already hit this problem and he has dissected the problem properly and then provided solution here. Hope this can help you as well.

Wednesday, November 24, 2010

Using Web Helpers in ASP.Net MVC 3

If you had been following the development of WebMatrix and Razor view engine, you would have found a new way of developing cool features in form of Web Helpers. Now if you want to implement same cool factor in your ASP.Net MVC 3 application or ASP.Net web application, you won’t be able to do it at least with ASP.Net MVC release candidate.

Reason being most of those web helpers like @Bing, @Twitter, @Video, @ReCaptcha, @FileUpload etc. are defined in “Microsoft.Web.Helpers.dll” which is not part of either WebMatrix Beta or ASP.Net MVC RC installation. To get this dll you will need to get a “micorosft-web-helpers” library package from internet. http://www.mikesdotnetting.com/Article/162/Using-Web-Pages-Helpers-in-ASP.NET-Web-Forms is the link where author is details out each step needed to download “microsoft-web-helpers” package from internet repository. He also details out how to use these web helpers in vanilla ASP.Net Web forms application.

Once you download this library package, then you can use each and every web helper in your ASP.Net MVC 3 application or in ASP.Net Web form application too.

Starting with WebMatrix/Razor view engine

As ASP.Net MVC 3 RC is released, Razor view engine should start getting more and more adoption. To start learning Razor here is a great start. Though this link seems to be talking about WebMatrix but WebMatrix is nothing but Razor view engine. There are bunch of articles which are talking about analytics, captcha etc which are equally applicable to ASP.Net MVC 3. Overall a very good kick start for understanding Razor view engine.

Sunday, August 22, 2010

What If?

Wondering what if Sony comes up with see through Vaio ;).

Friday, August 06, 2010

Know Your TempData

Here is a good article detailing how TempData works. It uncovers that behind the scene TempData uses Session. Hence you are bound to get all the issue those are there with Session. For example – if you decide to disable Session in your website then TempData will not work or if you change your Session mode to State server or SQL server then you will not be able to store objects which are not serializable to TempData.

But to rescue above article also mentions how you can create your own custom TempData provider. For bonus it does it using MongoDB. Enjoy overriding ASP.Net MVC default behavior and having some exposure to MongoDB.

Friday, April 09, 2010

Scalability: Distributed Cache

When we talk about scalability and stories around scalability, one component that is talked about quite a lot is distributed cache. One such tool I knew about is Velocity. It is a Microsoft offering. I tried searching more on Velocity and on other distributed caching systems out there. I bumped on one interesting article. I will not write all of that here again.

Whatever I could check quickly was that Velocity is still in its infancy and nowhere a production system. One another distributed caching system that is mentioned in that article is Memcached. Navigate to its homepage and see the impressive list of its clients. Everybody out there is using memcached; Twitter, flickr, youtube, wikipedia, facebook. Do you need more names to get impressed? At least I don’t. I didn’t really try it but any day if I need to build such a large scale application, I will definitely give memcached a shot. It deserves it.

Update: Velocity is now clubbed into Windows Server AppFabric.

Thursday, April 08, 2010

XAMPP: Friends of Apache

Recently I am getting attracted to non microsoft technologies. Reason behind that is that I am trying to spawn the knowledge of things beyond microsoft based things. So I was trying to setup PHP on my system and obviously I was trying to set it up on IIS :). This is because I had heard that PHP possibly runs on IIS. Yes it does and I was trying to do the same. However my friend Saran mentioned me about XAMPP. This is an installer which bundles  Apache, MySql, PHP and some more coolness with it. This was like hitting two birds with one stone. Initially I was trying to setup only PHP but using XAMPP I was able to setup PHP on Apache with backend as MySql. What more do I need? ;) Now I will try my hands in MySql also. WOW!!!

And you won’t believe me if I say that all I did was double click on XAMPP installer. It managed rest of the installation (of everything) in pretty much the same way as Microsoft does. XAMPP is cool!!!

Thursday, April 01, 2010

My Article is on PCQuest

Recently I worked on twitter integration and how any business can take benefit of twitter. I wrote a small article summarizing my experience with twitter development. Here is the link to my previous blog which was discussing about development resources and how your business can take benefit of twitter and Here is the link to my article published in PCQuest.

Wednesday, March 31, 2010

Something about security

I won’t say it is everything about security that you wanted to know, however it is quite something. In this video Scott and Phil discuss some of common security loop holes and how we can fix them. They mostly talk in context of MVC.Net but I am sure the discussion is very useful for any web application. So here is the link http://live.visitmix.com/MIX10/Sessions/FT05.

Go watch it and develop some secure web applications.

Tuesday, March 30, 2010

Useful Links

Today I was browsing aimlessly and hit upon some useful links, reading material etc. Following are those and I hope you will find them useful:

Monday, February 01, 2010

Twitter for Business

At first when I was approached with the idea of searching public tweets and finding what people are talking about your business, I really got excited. I thought this would be a WOW concept to try out. However I had my doubts as well because of the limit of characters in a tweet. My thought was like “will it really make any sense within 140 character limit?” and you know what, it really makes sense. People out there who are tweeting are able to squeeze enough in 140 characters.

As soon as I was done with initial coding and did few dry runs, I found quite a lot of information about my current employer. Some was good, some was bad. But that was enough and that is what my employer wanted. Following are some resources that will get you going with twitter:

TwitterVB – This is a .net library to access twitter APIs.
LinqToTwitter – It is a LINQ provider for the twitter. I used this library because of LINQ way of accessing twitter records. Home page of LinqToTwitter on codeplex and this article should be enough for you to start playing with twitter.

Happy Twittering!!!

Wednesday, January 20, 2010

Form validation using jQuery

If you are using jQuery, you can certainly get the jQuery Validation plugin to implement your client side validations. Plugin is available at jQuery Validation Plugin and it comes with Demo. Look at the source code of demo and I believe that is the only thing you need to know to use jQuery Validation.

Lack of proper validation model in MVC 1.0

Now I have been working with MVC 1.0 for quite some time and figuring out some short comings. One major short coming is that there is no proper model for implementing validations. Validation at server side and client side. There are n number of open source tools but none of them are so mature that you can promote them to production. Following are some tools that I evaluated:

MVC.Net Validation toolkit (http://mvcvalidatortoolkit.codeplex.com/) – This toolkit is good in terms of defining server side and client side validations. We just need to define all validations at server side and it automatically takes those validations to client side. However the advantage of this toolkit is disadvantage as well. Validations are defined outside the domain model (your entity). This approach of defining domain validations is not a very good approach and I would opt for it as a last resort.

Data Annotations – .Net Framework 3.5 there is a new functionality of Data Annotations (System.ComponentModel.DataAnnotations). Data annotations have very rich functionality where we can decorate each property of our domain entity. MVC.Net has good integrations with data annotation. If you make your MVC.Net view a strong typed view then MVC.Net framework starts understanding the data annotations of our domain entity. However this model is giving us only server side validation. xVal (http://xval.codeplex.com/) is one tool that can actually retrieve the domain validations from server and can populate those validations as client side validations. However in my evaluation I found that xVal is not able to retrieve all domain validations and whatever it retrieved were also not functional.

But all this is applicable only for MVC 2.0. MVC 1.0 does not understand data annotations and to get it working you need to download non production ready code from codeplex. Basically you need to get DataAnnotations model binder for MVC 1.0 and configure it. For more detail on this please visit ASP.Net MVC Validation.

Enterprise Library Validation Block – In order to achieve our purpose we don’t need to implement EL Validation Block. We can just use the assembly which gives us the functionality to decorate our domain entity with some validations. Use of this block gives us server side validation and then we need to use MVCValidator (http://www.codeplex.com/aspmvcvalidation) library which works with EL Validation block to implement client side validations. However MVCValidator library is also not so good for production as it does not provide support to validate value types. It works only with string data type.

Given all this I decided that I am not going to take any more pain of evaluating open source libraries. I am going to wait for MVC 2.0 where I get proper validation model inbuilt. Till then I will live only with client side validation by implementing jQuery validation plugin. To save myself from corrupt data I can implement proper constraint at database. This is temporary arrangement till MVC 2.0 comes out.

Wednesday, January 06, 2010

jQuery Hide/Close link

Phil Haack has written about how to close a “div” area using jQuery in his article here http://haacked.com/archive/2009/12/25/jquery-hide-close-link.aspx. However in his article he is demoing “slideUp()” function of jQuery which enables you to close the div. To show the same div again you will need to provide another link which will call “slideDown()”.

However there is another method “slideToggle()”. This method can toggle the visibility of div. If it is visible it will be hidden and if hidden it will be shown again. Following is demo of the functionality:

Welcome to ASP.NET!

To learn more about ASP.NET visit www.asp.net.

Following is the HTML markup for the same:

<div><a id="myLink" onclick="javascript:$('#myLink').html($('#myLink').html() == 'Show Info' ? 'Hide Info' : 'Show Info');$('#myDiv').slideToggle();" href="#">Hide Info</a></div>


<div id="myDiv">


  <h2>Welcome to ASP.NET! </h2>


  <p>To learn more about ASP.NET visit <a title="ASP.NET Website" href="http://www.asp.net">www.asp.net</a>. </p>


</div>


If you notice the onclick() of anchor tag, you will definitely frown on my inline javascript. But that is because I was not able to get Script tag working with Blogger and anyway I quickly wanted to show you slideToggle() functionality of jQuery.

Tuesday, January 05, 2010

SQLite

SQLite is a compact database engine. Here is the brief description about SQLite, “SQLite is an embedded SQL database engine. Unlike most other SQL databases, SQLite does not have a separate server process. SQLite reads and writes directly to ordinary disk files. A complete SQL database with multiple tables, indices, triggers, and views, is contained in a single disk file. The database file format is cross-platform - you can freely copy a database between 32-bit and 64-bit systems or between big-endian and little-endian architectures.”

There is no need of any installation here. You just copy your database file along with rest of your application and you are off using all database capabilities. You have tables, views, triggers, transactions everything barring SP support. Lack of SP support might be an issue but do you really need SPs in small level applications where most of the things might be mere CRUD. You will not get these features if you are using flat/xml file or for that sake windows registry also. This makes this small database eligible for all your quick applications. It also supports most of SQL-92 standard, so if you grow big and need enterprise level server, you can move to SQL Server/Oracle any day. Here is the list of links that you will find helpful when working with SQLite.

  1. SQLite dll - http://www.sqlite.org/
  2. SQLite Tutorial - http://souptonuts.sourceforge.net/readme_sqlite_tutorial.html
  3. SQLite with .net - http://www.mikeduncan.com/sqlite-on-dotnet-in-3-mins/
  4. SQLite .net data provider - http://sqlite.phxsoftware.com/
  5. SQLite Administrator - http://sqliteadmin.orbmu2k.de/ 

Good luck with SQLite.