Wednesday, July 29, 2009

Managing Azure Storage with ‘Cloud Storage Studio’


Recently I had an opportunity to explore the private beta of ‘Cloud Storage Studio’ by Cerebrata

Cloud Storage Studio is a WPF app which allows you to manage your tables, queues and blob containers for Windows Azure Storage. Although there are limited features right now in the app but I really liked the overall simplicity and ease of use. 

 image

Also there are various configuration settings available which can be applied on all Tables, Queues and Containers like Maximum Tables, Entities, Queues and Blobs per Request, Request Timeout.

The one that I liked the most is the Block Size Settings for Upload/Download Blob Size. This is very important when you are uploading a large chunk of blob data. The CSS would automatically divide a large Blob data in block based on this configuration so that its faster and easier for uploading.

image 

I would definitely recommend everybody to get its private beta from here,  try out yourself and provide your valuable feedback as they are really listening with big ears :-)

Also I had a chat with Gaurav Mantri (owner of Cerebrata) about the upcoming features and vision of CSS and believe me it was super exciting, so please stay tuned and keep your eyes on this . . .  

Thursday, July 23, 2009

“Gestalt” - Writing XAML code inside your HTML


Gestalt is a library released by MIX Online Labs that allows you to write Ruby, Python & XAML code in your (X)HTML pages. It enables you to build richer and more powerful web applications by marrying the benefits of expressive languages, modern compilers, AJAX & RIAs with the write » save » refresh development model of the web.”

My First Thoughts:
· It’s a great entry point for someone to learn and try out XAML (especially for web designers)
· It is not so intuitive for building complete business apps in something like silverlight

Any more thoughts are welcomed  !!!
Cheers . . .

Monday, July 13, 2009

SharePoint 2010 Sneak Peek . . . .


Last 2 weeks were full of excitement, thrill, lots of sleepless nights and several barrels of fluids . . . . all this for :

image

The SharePoint 2010 Sneak Peek site is launched today. The site previews some of the upcoming features in SharePoint 2010. Again a good project completed with an excellent team . . .

Cheers . . . . .

Saturday, June 20, 2009

Opera Unite - Reinventing Web?


Opera Unite : “A new technology that shakes up the old client-server computing model of the Web”.

Opera unite provides the following services:


Here is good post on installing and configuring these services. The only service that I felt interesting was the ‘Web Server’. So I tried it and the first cut really went well. Below is the link of a file hosted on my laptop by unite:
http://home.jomitvaghela.operaunite.com/webserver/content/

My first impression:
While the services being offered are not at all new, the crux here is the ease of sharing this from your own device using a simple browser.


Try it out yourself and share your thoughts. . . . .

Friday, June 19, 2009

Rebuilding Microsoft.com/SharePoint


Since last couple of months I, along with my wonderful team including
Todd, Vivek, Meeta and Ritu had been working with Tony on rebuilding the Microsoft's SharePoint web site.

The web site went live last month :
http://www.microsoft.com/sharepoint . . . .


and now, there is also a 'How we did it' article on MSDN describing goals and technicals details of how we developed all the pieces and fitted it together.

Tuesday, June 02, 2009

Loading .xap files OnDemand using Composite Client Application Guidance (PRISM)


One of the challenges of porting large business applications on silverlight is the size of .xap file. A typical business app would have multiple screens, rich data visualization and lots of user interaction which would in turn increase the overall size of the xap file. Also it would have users with multiple roles and each role would have specific permissions to specific screens. 
So wouldn’t it be nice to divide the entire app into multiple silverlight modules and than load them only when required  ? This is where PRISM can help us . . .

Composite Client Application Guidance (PRISM) provides us a rich framework to divide a silverlight application into various Modules and also load them ‘on demand’. A module can be a separate silverlight app. You can watch Erick’s video for creating the basic structure of a PRISM Project.

The solution structure for our scenario would be a bit different with multiple Silverlight Applications linked to a Single Web App as below :

image

image

Now what we need is a Default View which would be loaded first and than some triggers/events which would load the other on-demand views. 
In our case “DefaultView” is in “MyPortal” app and the “VoterModule” inside MyVoterModule Application would be loaded on-demand when a button is clicked from “DefaultView”.

Next, we need to add our Modules into the ModulesCatalog :

image

ModulesCatalog.xaml

 image

The important thing to note here is that we can create groups of modules and than can specify when do we want to initialize the modules being loaded in that particular group. We can also add modules via code instead of loading it from a xaml file.

Than we need to create some event on the DefaultView which would load the VoterModule. I have created a simple button as under, but we can also add more complex business logic to drive the loading of modules :

image

That’s all we need. The VoterModule would add the appropriate view onto the region and since we have specified to load this “OnDemand” the entire .xap for that application would be loaded when we click on the button.

We can also verify this using Fiddler . . .

Sunday, May 10, 2009

Diving & Exploration


Internet is like a deep ocean with many hidden gems so I just thought to wear my scuba suit and find those gems and share them. This is what I found last month :

Sunday, March 15, 2009

Re-Sizing .VHD Files


While creating a Virtual Disk (.VHD) for Virtual PC we need to allocate a maximum size for both Dynamic and Fixed sized disks. Now once we set this size it’s really difficult to change it. I had a similar issue last week and luckily I happen to find a solution for it which I am going to share here.

Firstly we would need the Vhd Resizer tool from the vmToolkit. This tool would copy sector by sector all the contents of a VHD and create a new VHD with the new size.

vhdresizer

Once the resize is complete the added GB’s/MB’s would be shown as an unallocated partition in the new VHD file. (To view the partitions, start the VPC (with the new VHD) -> Right Click My Computer > Click Manage -> Disk Management)
Now to merge this unallocated partition we need to use a command line utility ‘diskpart’ as follows:

Open command prompt and type diskpart, press enter and you would get this prompt

diskpart

· Type list disk (this would list all the disks)

· Type select disk # (select the disk number in which you want to merge the unallocated partition)

· Type detail disk (this would display all the volumes of the disk)

· Type select volume # (select the volume number in which you want to merge the unallocated partition)

· Finally Type extend (this would merge the unallocated partition on the selected disk & volume)

Open the Disk Management again and you should see the new size of the VHD. We can also use other tools like Partition Magic for merging the unallocated partitions.

Friday, March 06, 2009

How to create context menus and capture right click event in Silverlight


Context menus & right click event is something which is not out of the box supported in silverlight but I think they prove to be very crucial while developing LOB applications. So here is a workaround on how you can create them. Basically I am using HTML/Javascript to create and render menus on top of silverlight but it involves a few tweaks which are listed below.

First tweak is – How to display a HTML Menu on top of silverlight control.
For this we need to change 2 properties on the .aspx or .html page where the silverlight control is being hosted.

      <param name="background" value="transparent" />
  
<param name="windowless" value="true" />


Than capturing the right click event in HTML and displaying our menu.

<
script language="javascript">

  function click(e) {
     if (navigator.appName == 'Microsoft Internet Explorer' && event.button == 2) {

                var menu = document.getElementById('myMenu');
                menu.style.left = event.clientX + 'px';
                menu.style.top = event.clientY + 'px';
                menu.style.visibility = 'visible';
                return false;
            }
            return true;
  }
  document.onmousedown = click

</script>

'myMenu'
is a <div> I have created on the html page which contains a simple table as below:

<
div id="myMenu" style="position: absolute; visibility: hidden; width: 75px">

   <table width="100%" style="background: #000000" cellspacing="1" cellpadding="1">
    
<tr style="background: #FFFFFF">
         <td onclick="SomeFunctionWhichCallsSilverlight()" style="cursor: hand">
             
Edit
        
</td>
    
</tr>
     <tr style="background: #FFFFFF">
         <td onclick="SomeFunctionWhichCallsSilverlight()" style="cursor: hand"> 
              Save

        
</td>
    
</tr>
     <tr style="background: #FFFFFF">
         <td onclick="SomeFunctionWhichCallsSilverlight()" style="cursor: hand"> 
              ________

        
</td>
    
</tr>


     <tr style="background: #FFFFFF">
         <td onclick="SomeFunctionWhichCallsSilverlight()" style="cursor: hand"> 
              Exit

        
</td>
    
</tr>

   </table>


</
div>

The SomeFunctionWhichCallsSilverlight() function would be the interop function to call the relevant Silverlight function as described in my earlier blog.

Now the last thing is to disable the default ‘SilverlightConfiguration’ menu

<body oncontextmenu="return false">


You can download the sample code from here

Monday, February 23, 2009

‘OneNote on Cloud’ – First bits deployed on MESH


I have deployed the first bits of my OneNote application on Cloud. Currently I have created a very basic version with Pen / Text for writing the notes.

onenotemesh

Overall the aim is to get the know how of Windows Azure platform including .Net Services, Mesh Enabled Web Applications (MEWA) and SQL Data Services.

 image

I have already created the SDS Proxy WCF Service. So the next step is to configure and deploy it on Azure. Than finally to tie all the pieces together . . .

Wednesday, February 18, 2009

Accessing SQL Data Services from Silverlight


“OneNote on Cloud”…  This is something I have started exploring on since last couple of days. 
The idea is to have a OneNote type application experience on web, using Silverlight and SQL Data Services.

The first hurdle was to access SDS from silverlight. We can’t directly use the SDS from silverlight because of some known limitations. So the option that I thought of was to use some Proxy Services in between the Silverlight Client and SDS, which was also suggested by the guys who developed the Omega.SDSClient

Now there are few gotchas while developing these proxy services for silverlight client which I am listing below :

  1. We need to Change the service bindings to ‘basicHttpBinding’ as silverlight doesn’t support any other bindings.
  2. We need to set the AspNetCompatibilityRequirements attribute to ‘Allowed’ for all the service implementations
  3. (If we add the services using the ‘Silverlight-enabled WCF Service’ template than the above changes are done automatically.)
    silverlightenabledservice 
  4. The last thing is to add the cross-domain policy file at the root of in case of IIS hosted services it should be on the root of the mapped directory. 

     crossdomainfile

    The important thing to note in this file is the SOAPAction headers which are required to be enabled for SOAP based messages transfers from silverlight.

Friday, February 06, 2009

Getting started with ‘Microsoft Surface’ development


This week I went on a roller coaster ride of formatting & configuring my laptop for Surface development. I will just brief out the steps that I had to do before installing the Surface SDK 1.0 :

(You would need a monitor that is capable of 1280 × 960 screen resolution or a widescreen monitor that is capable of 1440 × 900 screen resolution to start the Surface Simulator)

Now lets build our first surface application using Visual C# 2008 Express Edition :

  1. Under the Create New Project you should be able to see couple of VS Templates for surface apps:

    new project 
  2. Select the Surface Application (WPF) and you would see the default template as below :

    template
  3. The First interesting control to look at is the ScatterView control.
    (The ScatterView control is the control that you should use when you have one or more UI elements that you want users to be able to move, rotate, or resize freely within a fixed area)

    scatterview
  4. Once you build the application first open the Simulator and than press F5 to run the application and it would automatically get displayed on the simulator . . .

    surface
    As you can see I have added multiple fingers on the screen so you can use your mousepad (on laptop) and your external mouse as two fingers and than can stretch or rotate the images . . . .

Enjoy Learning !!!

Thursday, January 29, 2009

Disposing SharePoint 2007 and WSS 3.0 Objects


Here is an excellent article by Roger Lamb explaining the various design patterns to be used for disposing various SharePoint and WSS objects before deploying to the production environment.
Some of these may cause serious implications and memory leaks if not addressed correctly. In particular there are 3 objects to be taken care of,  Microsoft.SharePoint.SPSite , Microsoft.SharePoint.SPWeb and Microsoft.SharePoint.Publishing

There are also couple of White Papers by Scott Harris's on MSDN for more details:
Best Practices: Using Disposable Windows SharePoint Services Objects
Best Practices: Common Coding Issues When Using the SharePoint Object Model.

Also recently there is a Tool published on the MSDN Code Gallery which provides assistance in correctly disposing of certain SharePoint objects to help us follow these best practices.

SPDisposeCheck.exe is a command line tool which takes the path to a managed .DLL or .EXE or the path to a directory containing many managed assemblies. It will recursively search for and analyze each managed module attempting to detect coding patterns based on the MDSN article.

Below is the screenshot of the actual output generated which running the spdisposecheck on the sample exe. Reading the command line output is a bit tedious. Although the documentation states that this tools has an -xml option to output the details to an xml file but it doesn't seem to work for me..SpDisposeCheck

Friday, January 23, 2009

Live Mesh Beta & Live Mesh Tech Preview


I just installed the Live Framework SDK and started playing around with the Live Mesh and came up with some interesting things to share.

The first thing to remember is that "Live Mesh Beta" and "Live Mesh CTP" are two different Mesh Environments.

The Live Mesh CTP : https://developer.mesh-ctp.com/ installed from the Live Framework SDK is a developer sandbox environment with limited options and doesn't include the File/Folder Synchronization functionality.  

The Live Mesh Beta : https://www.mesh.com/ is preview environment with full set of options including the File/Folder Synchronization functionality. 

For developing Mesh Applications we have to use the Live Mesh CTP only.

If you have registered for both these services than probably you would have 2 clients installed on your machine :


clients

Initially while signing in for the Live Framework client I got a message box popup saying :

---------------------------------------------------------------------------------
Unable to sign in to Live Mesh.

Please make sure your user name and password are correct.

Request to MOE failed with return code "0x80070005"
---------------------------------------------------------------------------------

Finally I got this resolved by disabling the antivirus software running in the background and now my laptop is "meshified" and ready to mess around inside the sandbox :-)  

mymesh

Monday, January 05, 2009

Bits on 'Cloud Computing' . . . . . !!!


So What is Cloud Computing ?
"Cloud computing is Internet-based ("cloud") development and use of computer technology ("computing"). The cloud is a metaphor for the Internet, based on how it is depicted in computer network diagrams, and is an abstraction for the complex infrastructure it conceals."
Live Services, Live Mesh, Live Platform, Windows Azure, SQL Services, .Net Services . . .
these are some of the titles associated with the cloud offerings from Microsoft.
So where should we start from ?

I would recommend to start with the Live Framework. Here is a brief description of some of the basic concepts of live framework including some of the common application models and different flavors of Live Operating Environments available today. ( What is Live Framework and Why Should I Care? )

( Mike Taulty has written some good posts describing his development experience with Live Framework SDK which might be useful for all. )


The next step could be to explore the Azure Services Platform, which includes .Net Services, SQL Services, SharePoint Services and Live Services as well. 

azureservicesplatform

( Here is a good list of Links and Resources from Sriram Krishnan on Windows Azure. )

Tuesday, December 30, 2008

Loading & Unloading Assemblies from GAC on runtime


Recently we developed a tool for Inspecting whether the system has the required components for Silverlight SharePoint Integration.
This tool provides a checklist of things which are required & not installed on the users system and then allow the user to install them and re-run the Inspection.

The tricky part was to re-run the inspection for the assemblies in GAC. We were using the Assembly.Load method to dynamically load the assemblies from GAC and than just have a null check against it.
But the issue was that once we load the assemblies it doesn't allow to unload it. Which means that this would not work as expected when we try to re-run the inspection and try to re-load the same assembly within the same application domain.

The solution was to create a separate application domain and than load the assembly in that appdomain and than unload the appdomain once used.

Here is a sample code of the Inspection button click :

image

Wednesday, December 03, 2008

Creating a Tag Cloud in Silverlight


For one of our Data Visualization projects I wanted to create a Tag Cloud type UI in Silverlight. Googling around I found this very nice article on this.

I decided to reproduce the user control so I could learn more about Silverlight and also added few customizations and some mouse enter and leave events to highlight the selected tag.
I also made some other small modifications to clean up the code a bit.

Here is the screen of the control :

tagcloud

You can download the source code from here.

Sunday, November 30, 2008

‘Concurrency’ – The elephant in the room . . .


Concurrency is one of the biggest challenges the industry is working on now days. Anders mentioned about the details of this in his talk ‘Future of C#’ at PDC.
So what’s the problem about?
Concurrency is about doing multiple tasks simultaneously. Most of our applications today do this asynchronous programming using multiple threads/processes but they all work on a Single CPU.
This worked fine until now as the single CPU’s were getting faster and faster as per the Moore’s Law and hence the applications would also just run faster without us having to do anything.
But now we are facing some physical limitations increasing the speed of a Single CPU. So to increase the processing power we need to have multiple CPU’s in a single machine. Hence we are already getting many core machines with 2, 4, 8 to 64 CPU’s.
So how does this impact us as a Developer?
With this solution in place the traditional asynchronous programming isn’t going to help us scale our applications. We would have to create programs which can divide their workload into tasks that can be executed in parallel on Multiple CPU’s.


Parallel FX (PFX)

Microsoft is developing a number of technologies to simplify parallel programming. Parallel Extensions for the .NET Framework (PFX) is an example of this. It is a managed programming model for data parallelism, task parallelism, scheduling, and coordination on parallel hardware. This technology was first discussed by Anders Hejlsberg and Joe Duffy in Oct 2007 and was initially provided as an extension library but it’s now deeply integrated into the .Net Framework 4.0.


Task Parallel Library (TPL)
The basic unit of parallel execution in the TPL is a ‘Task’. The Parallel.For() and Parallel.ForEach() static methods create a Task for each member of the source IEnumerable and distribute execution of these across the machine’s available processors using User Mode Scheduling.

ParallelFor
Parallel LINQ (PLINQ)
We can setup a LINQ query for parallel execution using PLINQ. We just need to wrap IEnumerable<T> in an IParallelEnumerable<T> by calling the AsParallel() extension method.
PLINQ

Daniel Moth did an excellent presentation on PFX at Tech-Ed which you can watch here.

For more details you can go to the PFX Team blog site which contains lots of videos and tutorials on parallel programming.

Monday, November 17, 2008

First Look at - "Windows 7"


Install Experience :

1

2

3

Its just a 2 step pretty smooth installation procedure. Took me about an hour to finish the entire thing.
The theme and the UX looks similar to Vista with a few tweaks here and there.

The wordpad has the office ribbons and the calculator has a new UI with additional modes :

wordpad_calc

Another good feature is the new search capabilities.
Open the search and type this " How much RAM is on this computer " -> and than click on the result link . . . .

search

that would take you to the system properties . . . isn't that cool !!!

There are many other refinements to poke around so worth having a look . . .

AddIn