Showing posts with label application. Show all posts
Showing posts with label application. Show all posts

Thursday, August 7, 2014

Agile and Developer

If you are a developer working in an organization where everyone is talking about agile and only your project manager seems to be excited about it. Here are the things you need to do as a developer.

Before you go any further about TDD, BDD and all test driven approach, take a moment and think about what you could do adopt right away if your manager is talking about agile. No doubt that you need to write Unit tests, TDDs but before we need to understand what it is.

Agile manifesto says

“Individuals and interactions over processes and tools
Working software over comprehensive documentation
Customer collaboration over contract negotiation
Responding to change over following a plan”

Now from developer’s perspective lets look at the highlighted lines.

“Working Software over…”, says that you starts showing the working software and demo it often. But this requires that you to build something that can be demoed, not shown as a presentation or as a code. You could do this only if you have very small requirement and they are independent

Now, first part is easy. Product owner can breakdown the features. But second part is tougher one. This is where you need to pitch in. But verifying if the feature can be implemented with writing the code required only for this feature is your job. This is when you break down the story and suggest PO.

Lets take an example, where you need to show a webpage where based on the role you need to implement a feature say an admin action. If you have to implement this feature end to end you need following features ready

  1. Login implemented
  2. Role assignment implemented
  3. Role to feature mapping done
  4. New feature itself

say you implement this in the same order and say you take a sprint to implement each, then every demo what you are showing is what stake holder has seen elsewhere. Something like role and feature mapping might not even go beyond the code and unit test.

 

So what did stake holder get in first 3 sprints?

Close to nothing.

 

Now what if you implement the new feature(say showing some grid with all data) without any security implementation. During the demo you can show, how will data look. Is this the right presentation, can we do anything better and you are giving good time for your stake holders to sleep over it and come back with all possible related stories. Now during next demo, you show login and apply the effect of authentication to the feature built. 

 

Did we turn the world upside down in the name of Agile? But did we get right feedback and testing done soon? That’s the beginning!

Monday, April 30, 2012

TFS Reports–Expose through TFS Web

If you are allowing TFS access over internet, reports will be one thing that you would find difficult to expose over internet as this might sit in your SQL server.

image

What about the web access? Where is report page on team foundation web access? There is none!

So, What you could do is, move the SSRS service to the Web Server or a new server hosted outside.

image

Both requires IT’s involvement and support. No one would be ready to move the DB server out or even SSRS server out of the firewall if it’s a shared server. If you have your other reports than the TFS reports hosted on this server, this might not be received well from the IT.

So to solve this, I created a new page in TFS and exposed all the reports from the TFS web page. Which just embeds the report viewer control and renders the report on the TFS webpage.

image

Here are list of changes you will have to do for implementing this reporting plug-in.

  • Open C:\Program Files\Microsoft Team Foundation Server 2010\Application Tier\Web Access\Web\UI\Controls\PageHeader.ascx. And insert a new row
<table cellspacing="0" cellpadding="0" class="mainTab">
<tr>
<td class="<%=(Request.Url.AbsolutePath.Contains("/UI/Pages/Reports/Reports.aspx") || Request.Url.AbsolutePath.Contains("/UI/Pages/Reports/Viewer.aspx") ? "att" : "ptt")%>">
<a class="<%=(Request.Url.AbsolutePath.Contains("/UI/Pages/Reports/Reports.aspx") || Request.Url.AbsolutePath.Contains("/UI/Pages/Reports/Viewer.aspx") ? "att" : "ptt")%>"
href="/tfs/web/UI/Pages/Reports/Reports.aspx?pguid=<%=this.Locator.ProjectUri.Segments[3] %>"><span class="ptt">Reports</span></a>
</td>
<td></td>
</tr>
</table>




  • Create a project visual studio, ASP.Net Web page project. Create a new page and call it as Reports.aspx. In this page we will list all the reports and give a link to access all the reports.


  • Open the reports.aspx and add a data list control to it. Your mark up should look like

    <asp:Content ID="c" ContentPlaceHolderID="c" runat="server">
    <asp:DataList ID="ReportList" runat="server">
    <itemtemplate>
    <td>
    <asp:HyperLink ID="reportLink" runat="server">
    <%
       1: # DataBinder.Eval(Container.DataItem,"Name") 
    %>
    </asp:HyperLink>
    </td>
    </itemtemplate>
    </asp:DataList>
    </asp:Content>





  • Change the base page to WebAccessPage, this is how you access the TFS connection details that are buried in the base page.





  • public partial class Reports : WebAccessPage





  • In the code behind, In page initialization set the current tab and subscribe to list binding event.







  • protected override void OnInit(EventArgs e)
    {
    base.OnInit(e);
    ActiveTab = "Reports";
    ReportList.ItemCreated += new DataListItemEventHandler(ReportListItemCreated);
    }









  • On Load method, connect to the reports server and fetch all the reports using reporting services. Before adding the code, add a service reference to the  SSRS service by Project->Add Service Reference –> URL as http://sqlserver:5050/ReportServer/ReportService2010.asmx. I have given the name for the service reference as ReportingService2010.


    protected void Page_Load(object sender, EventArgs e)
    {
    ReportList.DataSource = GetProjectReports(this.Connection.CollectionName + "/" + this.CurrentProject.Name); ;
    ReportList.DataBind();
    }


    private ICollection<CatalogItem> GetProjectReports(string path)
    {
    WindowsImpersonationContext ctx = WindowsIdentity.Impersonate(IntPtr.Zero);
    CatalogItem[] reports = null;
    try
    {
    ReportingService2010 reportService = new ReportingService2010();
    // get the URL from the config http://sqlserver:5050/ReportServer
    reportService.Url = config.ReportServerURL + "//ReportService2010.asmx";
    reportService.UseDefaultCredentials = true;
    reports = reportService.ListChildren(path, true);
    }
    finally
    {
    ctx.Undo();
    }
    return reports;
    }











  • Assumption above is, workerprocess is running under the identity which has access to reporting server. So we are impersonating to default and reverting back while connecting to SSRS.










  • Now we need to make all the report list as hyper links with proper navigation set, in the item created event of the list we would implement this.

    void ReportListItemCreated(object sender, DataListItemEventArgs e)
    {
    CatalogItem currItem = (CatalogItem)e.Item.DataItem;

    HyperLink link = (HyperLink)e.Item.FindControl("reportLink");

    if (currItem.TypeName == "Folder")
    {
    link.Attributes.Add("style", " color:Gray; font-size:16px");
    link.Enabled = false;
    }
    else if (currItem.TypeName == "Report")
    {
    e.Item.Enabled = true;
    link.Attributes.Add("style", "font-size:13px; padding-left:30px;");
    link.NavigateUrl = base.ResolveUrl("~/UI/Pages/Reports/Viewer.aspx") + "?pguid=" + this.Locator.ProjectUri.Segments[3] + "&rep=" + currItem.Path;
    }
    else
    {
    link.Visible = false;
    e.Item.Visible = false;
    }
    link.Text = currItem.Name;
    }













  • We don’t have the report viewer implemented yet, so lets create a new page called viewer.aspx and add report viewer control to it. Mark up would look like

    <%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>


    <asp:Content ID="c" ContentPlaceHolderID="c" runat="server">

    <rsweb:ReportViewer EnableViewState="true" AsyncRendering="true" ID="ReportViewer" runat="server"
    Width="100%" Height="100%"
    BackColor="#f8f8f8" ForeColor="#555555" InternalBorderColor="#cccccc"
    BorderColor="#dddddd" BorderStyle="Solid" BorderWidth="1px"
    ProcessingMode="Remote">

    </rsweb:ReportViewer>
    </asp:Content>















  • In  the code behind,  binding to the control is straight forward once we have the path

    public partial class Viewer : WebAccessPage
    {
    protected override void OnInit(EventArgs e)
    {
    base.OnInit(e);
    ActiveTab = "Reports";
    Page.EnableViewState = true;
    Master.EnableViewState = true;
    ReportViewer.ReportError += new Microsoft.Reporting.WebForms.ReportErrorEventHandler(ReportViewerReportError);
    }

    void ReportViewerReportError(object sender, ReportErrorEventArgs e)
    {
    if (TimeSheetHelper.IsUserAdministrator(Request.LogonUserIdentity.Name))
    {
    Response.Write(e.Exception.ToString());
    }
    else
    throw new Exception("Report exception", e.Exception);
    }

    protected void Page_Load(object sender, EventArgs e)
    {
    if (!IsPostBack)
    LoadReports(Request.QueryString["rep"]);
    }

    private void LoadReports(string reportPath)
    {
    ReportViewer.ServerReport.ReportServerCredentials = new ReportServerCredentials(CredentialCache.DefaultCredentials);
    ReportViewer.ServerReport.ReportPath = reportPath;
    ReportViewer.ServerReport.ReportServerUrl = new Uri(config.ReportServerURL );
    ReportViewer.ServerReport.Refresh();
    }
    }
















  • That’s it! You should be able to see the pages something like this..image








    image








Monday, May 25, 2009

Launchy - No more start menu navigation

Most of my work begins with Windows+Space key. Thats the shortcut I have assigned for the Launchy tool.
What lauchy does is it indexes shortcuts on your start menu, plus some other applications.
I have bunch of stand alone applications that i use often and i have added this to the indexing catalog. You can type and look for the application, and Launch. Once installed you would never go back to start menu or any applicatoin folder to launch.

I even use it on my development debug folder, So that i dont waste time in looking for an application to launch.

Download Launchy