Welcome to blogs.conchango.com Sign in | Join | Help

Welcome to blogs.conchango.com

Jomit's Blog

Technical Enthusiast

  • Whoa! Google Chrome has crashed. Restart Now ?

    Google Crome

    This was the first message I got after installing google’s new browser Google Chrome . . .

    But since then its working like a charm. . . . . Here are some of the features I like the most :

    Thumnail view of the ‘Most Visited’ sites when you first open the browser

    Google Crome Most Visited


    Opening ‘incognito window’ for private browing (seems similar to IE-8 privacy feature )

    Google Crome incognito window


    ‘Inspect Element’ to see the HTML source code of that element along with the DOM

    Inspect Element

    Inspector Window

    John and Rory have also posted some interesting performance benchmarks and memory usage stats compared to IE7 here and here.

  • A-Z Guide to being an Architect

    While reading the Architecture Journal I came across this excellent thought of skills from A-Z which really depicts that

    "architecture is as much about softer skills—good judgment, balance, and other wisdom—as it is about understanding the broad technical landscape, or the skills required to design and implement an architecture"

    I have compiled this table to stick it on my desk This would always remind me 'where I need to improve myself'...

    architect

  • Live Mesh - gone public now


    Live mesh is a new technology and platform that enables synchronization and storage "to the cloud."  A Software + Services platform and ecosystem that enables unique new customer value with the core philosophy to make it easy to manage information in a world where people have multiple computing experiences (i.e. PCs and applications, web sites, phones, video games, music and video devices) that they use in the context of different communities (i.e. myself, family, work, organizations).


    More details on history and future of this technology on  Channel9 Interview - Ray Ozzie: Introducing Live Mesh

     

    (After signing in it says that the "tech preview program is currently full". So we have to fill up a registration form to get informed whenever the space is available)

  • Configuring Windows Live Writer


    I just started using
    'Windows Live Writer'  (in fact I am using it right now for this post) and thought it would be good to share, how to configure it for our conchango blogs.

    Open Windows Live Writer
    Goto -> Weblog -> Add Weblog Account

    step-1

    step-2

    step-3

    step-finish 

    One thing which I found very quick and easy via live writer is uploading and managing images for posts.

  • Windows Sharepoint Services (WSS) - Groups, Roles & User management API’s

     

     

    Last week I worked on a pretty basic Sharepoint requirement but while developing the solution I came across few interesting things which I am going to share here.

     

    Requirement:
    The overall requirement was to provide a document sharing web application which can be accessed by different types of users with different permissions on different documents. Also all these users would be stored in SQL Server database.

     

    Solution:
    My solution to this was to create a set of Groups and Document Libraries in Sharepoint. Assign Groups to Document Libraries with Specific permissions and then add Users to these Groups via a Custom Membership Provider.  Here is how I am implementing it.

     

    Initial MOSS Configuration:

    The next steps were to write the following pieces of interesting code:

     

    [Create Site Groups]

     

     Create Sharepoint Groups


    [Assign Site Level Roles to Groups]

     

    Assing Roles to Group 


     

    [Add Groups to Document Libraries with Roles]

     

    Add Groups to Document Library 


    The important thing to note here is the “BreakRoleInheritance” method which I had to add to remove this error:
    This operation is not allowed on a object that inherits permissions.”


     

    [Add Users to Groups]

      

     Add Users to Groups 

     
    The field “loginName” here accepts a semicolon delimited string where the first value is the ‘CustomMembershipProvider’ name assigned in the web.config file.

     

     

    Apart from few initial configuration issues in the FBA the code is now working all ok in the Proof Of Concept project. I am going to integrate the same in my LIVE Project and would post any more useful stuff.

     

     

     

  • WebParts and Dynamic UserControls in MOSS


    I have recently started working on my first MOSS project and came up with a very common scenario of wanting to use UserControls into WebParts simply because of the great Designer support for UserControls in Visual Studio. (Usercontrols vs WebParts)


    Also I wanted my WebParts to just act like a shell and provide me the build in features of serializing, storing, and retrieving the site customization and member personalization data without being worried about rendering of the actual UI controls.


    So, I created a WebPart which can host any Usercontrol dynamically and also expose the configured properties of the usercontrol onto a custom editor. It sounds like re-creating your own SmartPart but I thought to give it a try to understand how things work.



    Ok, here is an overview of some of the important bits that I did :

    -         Created a property on the WebPart for storing the path of the Usercontrol and loaded the usercontrol dynamically using Page.LoadControl function in the CreateChildControls method of the WebPart.

    -         Created a custom editor part by inheriting EditorPart and in the CreateChildControls method extracted all the editable properties of the UserControl currenly loaded on the WebPart using TypeDescriptor.GetProperties()method.

    -         Then I added a TextBox control for each of these properties on the custom editor. ( We can further add a smart selection of controls based on the types of the properties eg: Checkbox for Boolean property, DropDownList for List and RadioButtons for Enums)
    Now the most important thing was to make sure that the values typed in from the custom editor part should be passed on to the actual UserControl hosted in the WebPart.

    -         So I created an ArrayList of controls added for properties, on the custom editor part and a Hashtable of propertynames, on the WebPart. On the ApplyChanges()method of the custom editor part I looped through all controls ArrayList and assigned the value of the control to the Hashtable in the WebPart with the key as the property name.

    -         Then it was just a matter of looping through the Hashtable and setting the values back to the UserControl in the CreateChildControls method of the WebPart.



    I have attached the code below along with a sample ASCX file to use. I kept the ascx file in the IIS webapplication folder under a sub folder named “UserControls”.
    eg: C:\Inetpub\wwwroot\wss\VirtualDirectories\[WebAppDirector]\UserControls

  • Alphabetical Grouping with Nested Datalist

    Recently working on an ecommerce project I came across a good functionality for asp.net wherein the data needs to be grouped by the alphabets across multiple columns as below:

     

     

     

     

    I tried searching the net but couldn’t find anything very similar, apart from a grouped repeater control but that needed some fixing so I thought to build it from scratch and share it.

     

    Description

    The used datatables and nested datalist controls to created the above functionality. The outer datalist control is binded with a datatable containing unique first letters from the data. While the inner datalist is binded, in the ItemDataBound event of the outer datalist, with the data starting from the letter in the outer datatable.

     

     

     

     

    I have attached a sample code of what I have build. The code needs some minor configurations for the fieldnames. I have also added a function to Sort the datatable which may not be required if we are already fetching sorted data from database.

     

    There may be other ways to do it but this is what came to my mind first and I implemented it instantly J

     

    All inputs are welcomed,

     

     

    -Jomit

  • Editable Custom Visualizer

    We all know that Visualizers are a great feature of Visual Studio 2005 debugger UI. It gives us a really nice meaningful way to look at the data.


     

    Visualizer Sample


     

    Visual Studio also enables us to create Custom Visualizers using DialogDebuggerVisualizer class. A long time back Howard van Rooijen had created a great tool using visualizers.


    There are 4 in-build visualizers available with VS 2005 among which only the dataset visualizer is editable and rest all are read-only visualizers. This gave a thought to

    how can I make a custom visualizer editable ?  


    The answer is : Simply using the ReplaceObject method


     

    public class NewTextVisualizer : DialogDebuggerVisualizer

        {

            override protected void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)

            {

                String sourceString = objectProvider.GetObject().ToString();

                Form1 form = new Form1();

                form.txtData.Text = sourceString;

                windowService.ShowDialog(form);

                sourceString = form.txtData.Text;

                //Replaces the debugee object with the debugger object.

                if (objectProvider.IsObjectReplaceable)

                {

                    objectProvider.ReplaceObject(sourceString);

                }       

    }

        }

    Above is the normal code for creating a custom visualizer which uses the ReplaceObject method. This method replaces the object provided with the edited object, which makes this an editable visualizer.

     

    (Added end result preview) :

     Result

     

    I have attached a sample solution with a custom Text Visualizer just to make sure that this works. For more details on creating and deploying visualizers Click here.

    -Jomit

  • Using Windows Forms Controls in WPF Applications

    We all know that WPF provides a very rich environment for creating applications. But even though sometimes we may want to use windows forms controls to get some specific functionality. For Example you may want to use the DataGrid control or MaskEdit textbox in your WPF application, which is not currently in the control library of WPF.

     

    WindowsFormsIntegration library helps us achieve this in a very easy way. Let’s see how:

    There are 2 important classes in this library
    ElementHost and WindowsFormsHost.

    For instance, if you want to use the DataGrid control in your existing WPF application the first you need to do is add the reference to these assemblies:

    ·         Windows Forms assembly.

    ·         WindowsFormsIntegration assembly. (The default location for this file is %programfiles%\Referencessemblies\Microsoft\Framework\v3.0\WindowsFormsIntegration.dll )

     

    And then write the following code to instantiate the control:

    XAML

    <Window x:Class="WPFIntegration.Window1"
         xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation
         xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
         Title="WPFIntegration" Height="300" Width="300">

       
    <
    Grid Name="grid1">

    Window x:Class="WPFIntegration.Window1"
         xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation
         xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
         Title="WPFIntegration" Height="300" Width="300">

       
    <
    Grid Name="grid1">

           

        </Grid>

    </Window>

     

    C# Code

    System.Windows.Forms.Integration.WindowsFormsHost frmHost = new System.Windows.Forms.Integration.WindowsFormsHost();

    DataGrid myGrid = new DataGrid();

    frmHost.Child = myGrid;
    this.grid1.Children.Add(frmHost);

     

    Similarly we can also use WPF controls in Windows Forms using ElementHost. You can find more details Here.

     

    There are few Layout Considerations for the WindowsFormsHost Element but still I think it provides a good integration between both control libraries.

     

     

    -Jomit

  • Interesting WPF Problem !!!

    I was creating a small WPF application and found an interesting thing while playing around with some properties and events. Let me first explain what the application does. (I have also attached the code for more details)


     

    It’s a simple application which lists down all the contacts from a text file and displays its details like first name, last name, email etc. I am using a Contact class to hold all the contact details and I am using a PageFunction to display the contact details on the main window. I have added a few more fancy things to it but that’s not relevant to this context.

    The Main Window of the application has a ListBox on the left DockPanel which is bound with the contacts.txt file using ObjectDataProvider. The right DockPanel displays a PageFunction on the ListItemSelected event of the ListBox, which displays the contact details.

    WPF Application

    Initially the Main Window had the following xaml code:

    <Window x:Class="AddressBook.Window1"

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        Title="AddressBook"

        Loaded="WindowLoaded"

        SizeToContent="WidthAndHeight"

        MinWidth="640"

        MinHeight="480"

        >
    ...

    The WindowLoaded eventhandler contains the code to set the DataContext property of the left DockPanel to the contacts data.

    private void WindowLoaded(object sender, RoutedEventArgs e)

    {

    DockPanel_LeftPane.DataContext = Application.Current.Properties["ContactList"];

    }

    This code was working fine and I was getting the contact details of the first item when I started the application. Then I tried changing the width and height of the window to
    MinWidth="1200" and MinHeight="800" and to my surprise the application stopped showing the contact details on the startup. I was only able to view the contact details once I clicked on the ListBox item.

    I was playing with the values and when I changed it to MinWidth="1079" and MinHeight="800" it started working again!!!

    I thought it might be something to do with the SizeToContent so I tried removing that but it again stopped working after removing it. I also tried various other things but it didn’t worked.


     

    So finally to make the code work with 1200 * 800 I added the SizeChanged eventhandler and wrote the same code as in the WindowLoaded eventhandler.

    <Window x:Class="AddressBook.Window1"

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        Title="AddressBook"

        Loaded="WindowLoaded"

        SizeChanged="WindowSizeChanged"

        SizeToContent="WidthAndHeight"

        MinWidth="1200"

        MinHeight="800"

        >

    I have no idea what the problem was?  Why does the size of the window affect the loading of the data ?  Is the SizeChanged event fired every time after the Loaded event and it just unbinds everything done in the Loaded event ? This can’t be possible but this is what’s happening!!

     

    While I am still trying to find the problem, I thought to share this in case anyone can find something useful and make this understandable to me.

     

    All inputs are welcomed.

     

     

    -Jomit

  • Visual Studio 2005 Shortcuts in a nice poster format.

    Its really strange that the link which I just accessed before some time is not working now for many of us.
    So i thought to upload it here for an easy access to everybody.
    (Please find the attachment below)
  • First Look at Visual Studio "Orcas"

    .Net 2.0 ("Whidbey")
    .Net 3.0 (Vista)
    .
    .
    .
    and now its  "Orcas"

    .Net 3.5 ("Orcas")


    Here is a video covering some of the great new features that will be coming soon with Visual Studio and ASP.NET “Orcas”.   

    The presentation was done by Scott Guthrie, co-creator of ASP.NET at Microsoft. The event was hosted by Visual Studio User Group Belgium

    Video Podcast: Scott Guthrie's First Look At Visual Studio "Orcas"


    -Jomit

  • .NET Framework 3.0 and Windows Vista Development Resources

    Here is a great list of resources for .Net Framework 3.0 and Windows Vista Development created by Ron Cundiff.

    I added a few more into it and thought to put it on our blog for easy reference :

    Window Presentation Foundation (WPF)

     

    Windows Communication Foundation (WCF)

    Windows Workflow (WF)

    Windows CardSpace

     

    Windows Vista

    .NET Framework 3.0 Virtual Labs, which are walkthroughs for all of the technologies

     

    Jomit

  • Vista in Less than Zero Degrees

    If you think vista is HOT than check this out...

    Digital Ice House for Vista.

     

  • Office 2007 Beta 2 Technical Refresh

    Hi All,

     

    Last couple of months I have been working with some of the developer tools of Office 2007 Beta 2 (courtesy: John Rayner) and it all worked pretty well until I installed an update of it ‘Beta 2 Technical Refresh’.    

    After installing the Technical Refresh update I was not able to open the existing word 2007 documents. The document contained some basic text, VB Macros and few Content Controls. There was some problem in the ‘word/vbData.xml’ file.

     

    Later on I found that there were few changes in the namespace locations and also a new namespace added in the Word xml files. I thought it would be good to list out those namespaces for reference.

     

    Word 2007 Beta 2 (Old Namespaces)

     

    xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/3/main"

     

    xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/3/wordprocessingDrawing"

     

    xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/3/main"

     

    xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/3/picture"

     

              

    Word 2007 Beta 2 Technical Refresh (Namespaces Updated)


    xmlns:w
    ="http://schemas.openxmlformats.org/wordprocessingml/2006/main"

     

    xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"

     

    xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"

     

    xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"

     

    Word 2007 Beta Technical Refresh (New Namespace)

    xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"

     

     
Powered by Community Server (Personal Edition), by Telligent Systems