BYNET In Teradata – What are you

As we have talked about before, Teradata embraces the concept of SMP and MPP. Within the hardware context, there are two componets that build up this platform. The first if the Processor Node, this is responisble as the name implies for the data processing. This is mostly related to the concept of SMP. Within the realm of MPP, the BYNET is responsible for providing the interprocessor network that link together the components of the MPP system. This can take many forms, including broadcast, multicast, or point-to-point communication. The one that I had the most questions about was the BYNET thing.

The BYNET simply acts as the interconnect hub. Just think of it as the torso while the remaining SMP‘s are the limbs of the overall architecture. Most Teradata architects would poo-poo this description as it doesn’t embrace the concept of everything that the BYNET does but for the sake of my development it is the connector of a series of nodes (I am a Microsoft developer at the end of the day). Important thing to remember is that BYNET‘s in a multinode system can be load balanced and follow a standard TCP/IP protocol for inter-messaging. But, for the nodes to be aware of process oriented directions, load balancing is actually not required, just refines the process. At the end of the day, within all this, you end up with the overall MPP. If the BYNET is a single node, a virtual BYNET is used for simulation.

 

 

 

 

 

Share

Using Telerik RadUpload Control with SharePoint Document Libraries ASP.NET

The RadUpload control is probably my favorite control out of the Telerik suite. I really dig the progress indicators, and have used both the ASP.NET and Silverlight ports thoroughly in client applications. In this post I am going to show you how to use the ASP.NET control when you want to upload documents to a SharePoint document library. Since the Silverlight control requires a custom HTTP handler, the two approaches are going to be very different. However at the end of the day the end result will be through since I will also demonstrate how to push the requisite parameter based metadata ala a HashTable.

Firstly, let’s go through the easy one, the ASP.NET control. Next post, I will show you the Silverlight approach (which is more complex). In this example, I am going to scrap a Control for all the RadUpload controls by recurring through the available ControlCollections by Type, then get all the files specified within the upload control, and push em to a literally defined document library. Firstly, to get the controls by Type I am going to use the following static method:

[csharp]      
public static List FindControlRecursiveByType(Control root) where T : Control
{
List res = new List();
if (root != null)
{
Stack tmpStack = new Stack();
tmpStack.Push(root);
while (tmpStack.Count > 0)
{
Control ctrl = tmpStack.Pop();
if (ctrl is T)
{
res.Add(ctrl as T);
}
foreach (Control childCtrl in ctrl.Controls)
{
tmpStack.Push(childCtrl);
}
}
}
return res;
}
[/csharp]

This part is pretty straightforward. Next, I am going to use this method to expose the RadUpload controls, get the files, and push them to the appropriate document library. So that the method is more portable for the folks reading this post, I have put it in a copy-and-paste ready static format that is easy to integrate into your application.

[csharp]
public static void IterateAllUploadControls(Control wiz, SPListItem item)
{
SPSecurity.RunWithElevatedPrivileges(delegate
{
List x = FindControlRecursiveByType(wiz);
foreach (RadUpload upload in x)
{
foreach (UploadedFile file in upload.UploadedFiles)
{
SPSite initialSite = new SPSite(SharePointHelpers.SiteUrl);
using (var site = new SPSite(SharePointHelpers.SiteUrl, initialSite.SystemAccount.UserToken))
{
{
using (var web = site.OpenWeb())
{
SPDocumentLibrary library = (SPDocumentLibrary) web.Lists[“Documents”];
SPFolder folder = library.RootFolder;
Hashtable metaData = new Hashtable
{
{
Something, item[“Something”].ToString()
}
};
web.AllowUnsafeUpdates = true;
folder.Files.Add(String.Format(“{0}/{1}”, folder.Url,file.FileName), file.InputStream,metaData, true);
}
}
}
}
}
});
}
[/csharp]

None of this is very fantastic. Basically, we are surfacing all the RadUpload controls on a Control, iterating through all the uploaded files, and adding them to the RootFolder of the SharePoint document library. Simple, yet effective. Next post I will show you how to accomplish the same thing in Silverlight. Which is not nearly as straightforward :)

Share

Programatically Highlighting Current Step In ASP.NET Wizard

This was frustrating, so gonna save some folks the time that are using the ASP.NET wizard in a SharePoint WebPart.

I found a lot of examples of how to highlight the current step in the ASP.NET wizard control via WebForm markup, but there was a severe lack of examples that show how to do it in straight code behind. In essence you are relegated to implement various sets of ITemplates for the ASP.NET wizard corresponding DataList, notably instantiating against the SelectedItemTemplate and ItemTemplate properties. ITemplates defines the behavior for populating a templated ASP.NET server control with child controls. The child controls represent the inline templates defined on the page, or in this case, within a composite control. The important part to remember when creating the various templates is the SideBarList control must contain an IButtonControl with ID SideBarButton in every item template, this may include ItemTemplate, EditItemTemplate, SelectedItemTemplate or AlternatingItemTemplate if they exist. As stated before, we just need to focus on two properties.

So, firstly for your strongly typed Wizard object in CreateChildControls or wherever set the SideBarTemplate

[csharp]

[SomeAspNetWizardObject].SideBarTemplate = new SideBarHighlighter();

[/csharp]

Now onto ITemplate fiesta:

[csharp]

public class SelectedItemTemplateMerged :ITemplate
    {
        public void InstantiateIn(Control container)
        {
            LinkButton activeSideBarButton = new LinkButton();
            activeSideBarButton.ID = “ActiveSideBarButton”;
            LinkButton sideBarButton = new LinkButton();
            sideBarButton.ID = “SideBarButton”;
            sideBarButton.Visible = false;
            container.Controls.Add(activeSideBarButton);
            container.Controls.Add(sideBarButton);
        }
    }

    public class SideBarItem :ITemplate
    {
        public void InstantiateIn(Control container)
        {
            LinkButton sideBarButton = new LinkButton();
            sideBarButton.ID = “SideBarButton”;
            container.Controls.Add(sideBarButton);
        }
    }

    public class SideBarHighlighter : ITemplate
    {
        public void InstantiateIn(Control container)
        {
            DataList sideBarList = new DataList();
            sideBarList.ItemDataBound += SideBarList_ItemDataBound;
            sideBarList.SelectedItemTemplate = new SelectedItemTemplateMerged();
            sideBarList.ItemTemplate = new SideBarItem();
            sideBarList.ID = “SideBarList”;
            sideBarList.SelectedItemStyle.Font.Bold = true;
            sideBarList.RepeatLayout = RepeatLayout.Flow;
            container.Controls.Add(sideBarList);
        }

        private void SideBarList_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            WizardStep stepCurrent = (WizardStep) e.Item.DataItem;
            if (stepCurrent.Wizard.ActiveStepIndex == e.Item.ItemIndex)
            {
                LinkButton activeSideBarButton = (LinkButton) e.Item.FindControl(“ActiveSideBarButton”);
                activeSideBarButton.BorderStyle = BorderStyle.Solid;
                activeSideBarButton.BorderColor = Color.White;
                activeSideBarButton.BackColor = Color.White;
                activeSideBarButton.Font.Bold = true;
                activeSideBarButton.Style.Add(HtmlTextWriterStyle.Color, “#000000”);
                activeSideBarButton.Text = string.Format(“>> {0}”, stepCurrent.Title);           
            }
        }
    }

[/csharp]

 The obvious important part is the ItemDataBound event, since that’s where the text is mutated.

Share