Wednesday, April 23, 2014

DataGrids - Everything you ever wanted to Know

(fyi - most of this in your local QuickStarts website)

<asp:SqlDataSource  CacheDuration="5" EnableCaching="True"...

============================================================================
w/TextBox
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.filterexpression.aspx
============================================================================

SIMPLEST WAY
============================================================================================================================
http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/samples/data/DataBind4.src
http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/samples/data/DataBind7.src
============================================================================================================================

***pretty cool*** could rearange code to print out comment below the paged GRIDVIEW
============================================================================
http://quickstarts.asp.net/quickstartv20/aspnet/samples/data/DataKeys_vb.aspx
http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/samples/data/DataKeys.src
============================================================================

GridViewStoredProc
=========================================================================================
http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/samples/data/GridViewStoredProc.src
=========================================================================================


w/DAL objects
============================================================================
http://quickstarts.asp.net/QuickStartv20/aspnet/doc/data/objects.aspx#dal
http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/samples/data/GridViewDAL.src



GridViewPagingSettings - First, Next , Previous, Last  (w/NO TEMPLATE)
=========================================================================================
http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/samples/data/GridViewPagingSettings.src
http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/samples/data/GridViewPagingSettings.src


Advanced Paging & Sorting
============================================================================
http://quickstarts.asp.net/quickstartv20/aspnet/doc/data/advanced.aspx#pagesort
http://quickstarts.asp.net/quickstartv20/aspnet/doc/data/advanced.aspx#pagesort
http://quickstarts.asp.net/quickstartv20/aspnet/doc/data/advanced.aspx#pagesort
============================================================================
http://quickstarts.asp.net/quickstartv20/aspnet/doc/ctrlref/data/objectdatasource.aspx
http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/samples/data/GridViewDAL.src&file=GridViewObject_cs\App_Code\AuthorsDB.cs&lang=C%23+Source
============================================================================


w/BLL objects
============================================================================
http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/samples/data/GridViewObject.src
http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/samples/data/GridViewObject.src
http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/samples/data/GridViewObject.src&file=GridViewObject_cs\App_Code\AuthorsComponent.cs&lang=C%23+Source


OptimisticConcurrencyDataObject
http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/samples/data/OptimisticConcurrencyDataObject.src
http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/samples/data/OptimisticConcurrencyDataObject.src&file=GridViewObject_vb\OptimisticConcurrencyDataObject.aspx&lang=VB+Source
============================================================================



**would be good for coments as detail - for long comments
Gridview w/ related Details view   (PAGER TEMPLATE)
============================================================================
(run-it) http://quickstarts.asp.net/quickstartv20/aspnet/samples/data/PagerTemplate_vb.aspx
(src) http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/samples/data/PagerTemplate.src
AND
(run-it) http://quickstarts.asp.net/QuickStartv20/aspnet/samples/data/GridViewMasterDetails_vb.aspx
(src) http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/samples/data/GridViewMasterDetails.src





VERY COOL --Page.DataBind()   <asp:label ID="Label1" text='<%# StateList.SelectedItem.Text %>' runat="server"/>
============================================================================
http://quickstarts.asp.net/quickstartv20/aspnet/samples/data/DataBind2_vb.aspx
http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/samples/data/DataBind2.src
http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/samples/data/DataBind2.src


*Databind directly to Grid*
============================================================================
http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/samples/data/DataBind4.src
http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/samples/data/DataBind7.src


**ASP.NET Quickstart Tutorials - TRee menu **(below)
Databinding in TEmplates
============================================================================
http://quickstarts.asp.net/quickstartv20/aspnet/doc/data/templates.aspx



**Drop down in a GridView** (but uses table adapters)
============================================================================
http://quickstarts.asp.net/quickstartv20/aspnet/doc/data/templates.aspx
http://quickstarts.asp.net/quickstartv20/aspnet/samples/data/PhotoAlbum_vb/AlbumsDataSetDropDown.aspx
http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/samples/data/PhotosAlbumDropDown.src







VALIDATION
============================================================================
http://quickstarts.asp.net/quickstartv20/aspnet/doc/validation/default.aspx
==================================================================
Server-Side RequiredFieldValidator Sample

<html>
<head>
    <script language="C#" runat=server>

        void ValidateBtn_Click(Object Sender, EventArgs E) {

           if (Page.IsValid == true) {
              lblOutput.Text = "Page is Valid!";
           }
           else {
              lblOutput.Text = "Some of the required fields are empty";
           }
        }

   </script>

</head>

=========================================================================================
        <asp:RequiredFieldValidator id="RequiredFieldValidator2"
            ControlToValidate="TextBox1"
            Display="Static"
            Width="100%" runat=server>
            *
        </asp:RequiredFieldValidator>

...

<ASP:Button id=Button1 text="Validate" OnClick="ValidateBtn_Click" runat=server />



==================================================================
Client-Side RequiredFieldValidator Sample
============================================================================
http://quickstarts.asp.net/quickstartv20/aspnet/samples/validation/ClientSideValidation_vb.aspx

<head>

    <script language="C#" runat=server>

        void Page_Load() {
            if (!IsPostBack) {
                // Validate intially to force *s to appear before the first round-trip
                Validate();
            }
        }

        void ValidateBtn_Click(Object Sender, EventArgs E) {

           if (Page.IsValid == true) {
              lblOutput.Text = "Page is Valid!";
           }
           else {
              lblOutput.Text = "Some of the required fields are empty";
           }
        }

   </script>

</head>
<body>

<form runat="server">

....
      <td>
        <ASP:TextBox id=TextBox1 onchange="ClientOnChange();" runat=server />
      </td>
      <td>
        <asp:RequiredFieldValidator id="RequiredFieldValidator2" runat="server"
            ControlToValidate="TextBox1"
            ErrorMessage="*"
            Display="Static"
            Width="100%">
        </asp:RequiredFieldValidator>


</form>

<script language=javascript>
<!--
    function ClientOnChange() {
       if (typeof(Page_Validators) == "undefined")
          return;
       document.all["lblOutput"].innerText = Page_IsValid ? "Page is Valid!" : "Some of the required fields are empty";
    }
// -->
</script>


</body>
</html>

============================================================================
SetFocusOnError="true"
============================================================================
http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/samples/tipstricks/FocusAPI.src
============================================================================

 <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
      <asp:RequiredFieldValidator SetFocusOnError="true" ErrorMessage="TextBox1 is empty"
        ID="RequiredFieldValidator1" ControlToValidate="TextBox1" Display="Dynamic" runat="server">*</asp:RequiredFieldValidator>

C# Neato- FindControlRecursive Function



Ever have trouble finding a buried control "n" layers deep on a page ?

 

This function is super awesome, and works flawlessly (so far). Thought you all might like it ( if you don't have it already )

 

       public static Control FindControlRecursive(Control Root, string Id)

        {

            // Finds a Control recursively. Note finds the first match and exists

            // USAGE: protected Label _lblError = null;

            // USAGE: protected void AssignControls(){

            // USAGE:   this.lblError = FindControlRecursive(this.Page, "lblError") as Label;

            // USAGE:   this.dgItemList = FindControlRecursive(this.Panel1, "dgItemList") as DataGrid;

            // USAGE: }

            // USAGE: otherwise use: this.lblError = this.Master.FindControl("Content").FindControl("lblError") as Label;

 

            if (Root.ID == Id)

                return Root;

 

            foreach (Control Ctl in Root.Controls)

            {

                Control FoundCtl = FindControlRecursive(Ctl, Id);

                if (FoundCtl != null)

                    return FoundCtl;

            }

            return null;

        }

 

Masterpage asp:Content - script language=JavaScript

To place JavaScript inside the child pages is simple...
 
 <asp:Content ID="Content1" ContentPlaceHolderID="mainCopy" runat="server">
 <script language="JavaScript" type="text/javascript" src="../Includes/CookieFunct.js"></script>
 <DIV>
 <DIV>
 </asp:Content>

C# XSSCheck code for the tech blog



 private void CreateXSSCheck()
    {
      if (!Page.ClientScript.IsClientScriptBlockRegistered("XSSCheck"))
      {
        string sUniqueID = UserLogin.UniqueID.ToString().Replace(Convert.ToChar("$"), Convert.ToChar("_"));
        StringBuilder sbCheck = new StringBuilder();
        sbCheck.Append("function CheckXSS()\n");
        sbCheck.Append("{\n");
        sbCheck.Append("var IsChecked = true;\n");
        sbCheck.Append("IsChecked = CheckValue(document.getElementById('{0}_UserName').value);\n");
        sbCheck.Append("if (IsChecked)\n");
        sbCheck.Append("{\n");
        sbCheck.Append("IsChecked = CheckValue(document.getElementById('{0}_Password').value);\n");
        sbCheck.Append("}\n");
        sbCheck.Append("if (!IsChecked)\n");
        sbCheck.Append("{\n");
        sbCheck.Append("alert('Invalid data entered for UserName and/or Password');\n");
        sbCheck.Append("}\n");
        sbCheck.Append("if (!IsChecked)\n");
        sbCheck.Append("{\n");
        sbCheck.Append("document.getElementById('{0}_UserName').value = '';\n");
        sbCheck.Append("document.getElementById('{0}_Password').value = '';\n");
        sbCheck.Append("document.getElementById('{0}_UserName').focus();\n");
        sbCheck.Append("}\n");
        sbCheck.Append("return IsChecked;\n");
        sbCheck.Append("}\n");
        Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "XSSCheck", sbCheck.ToString().Replace("{0}", sUniqueID), true);
      }
      this.Form.Attributes.Add("onsubmit", "Javascript: return CheckXSS();");
    }


    private void AddPrivacyScript()
    {
      Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "OpenPrivacyPolicy", PrivacyPolicy(), true);
      lnkPrivay.OnClientClick = "javascript: return OpenPrivacyPolicy();";
    }


    protected string PrivacyPolicy()
    {
      string[] strIP = HttpContext.Current.Request.Url.ToString().Split(Convert.ToChar("/"));

      string sURL;

      HttpCookie myCookie = new HttpCookie("Theme");
      myCookie = Request.Cookies["Theme"];

      if (myCookie != null)
      {
        switch (myCookie.Value)
        {
          case "AnthemBCBS":
            sURL = "http://www.mywebsitesetup.com/default.htm&rootLevel=3&label=PrivacyStatement";
            break;
          default:
            sURL = "/PrivacyNotice.aspx";
            break;
        }
      }
      else
      {
        sURL = "/PrivacyNotice.aspx";
      }

      StringBuilder sbPrivacy = new StringBuilder();
      sbPrivacy.Append("function OpenPrivacyPolicy()\n");
      sbPrivacy.Append("{\n");
      sbPrivacy.Append("document.open('{0}', '', 'resizable=1,scrollbars=1,width=500,height=500');\n");
      sbPrivacy.Append("return false;\n");
      sbPrivacy.Append("}\n");
      return sbPrivacy.ToString().Replace("{0}", sURL);
    }



    public ParticipantWebServices.Ras.Commuter.CommuterAccountSummary[] GetCommuterAccountSummaryList(Security.ParticipantAccount account)
    {
      string key = string.Format("{0}:{1}:{2}", "CommuterAccountSummaryList", account.ServerId, account.ParticipantId);

      ParticipantWebServices.Ras.Commuter.CommuterAccountSummary[] summaries = HttpContext.Current.Cache[key] as ParticipantWebServices.Ras.Commuter.CommuterAccountSummary[];

      if (summaries == null)
      {
        using (var client = new SafeProxy<ParticipantWebServices.Ras.Commuter.CommuterAccountServiceClient>(new ParticipantWeb.ParticipantWebServices.Ras.Commuter.CommuterAccountServiceClient()))
        {
          summaries = client.Proxy.GetCommuterAccountSummary(account.ServerId, account.ParticipantId, DateTime.Now);
          HttpContext.Current.Cache.Add(key, summaries, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(0, GetCacheDuration(), 0), System.Web.Caching.CacheItemPriority.Normal, null);
        }
      }
      return summaries;
    }

DIY firewalls, tiny to wow



 
The BrazilFW Firewall_Router is secure enough, but do you really want to use a floppy drive for your firewall? I think the DD-WRT might be better, get a 64MB or larger Compact Flash card and an IDE  to CF adapter, and follow the instructions here, although you could use an old hard drive instead of the CF card and adapter.
 
Ubuntu is so last century, besides if its more than a year old you are missing out on the latest features. .. Try Linux Mint, the XFCE has a faster GUI, but if you're putting it on a machine less than 7 years old you can go with whatever. Sounds like you want the 64 bit version, BTW since you need that to run 64bit VMs.
 
As for VM I know that it can be done, and I believe you can even convert MS VM images to run under a Linux VM, but I haven't played with it yet. Anyways there is LOTS of help out there from the Linux crowd.
 
If you're using DD-WRT, you don't need to setup your Linux/VM box to do firewall.
 
http://www.linuxquestions.org/ is one of the best resources for all things Linux, you might consider signing up a free account there.
 

WPF - DataContext As Object (MVP data binding)


Public Property DataContext As Object

     Member of System.Windows.FrameworkElement

Summary:

Gets or sets the data context for an element when it participates in data binding. This is a dependency property.

 

Return Values:

The object to use as data context.

 

 

      Private Sub Context_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)

            Dim menu As System.Windows.Controls.MenuItem = TryCast(e.OriginalSource, System.Windows.Controls.MenuItem)

 

            If menu IsNot Nothing Then

 

                Try

 

                    Me.SelectedObjectInOut = DirectCast(menu.DataContext, ObjectInOut)

 

                                …..

                End Sub               

 

 

       Public Property SelectedObjectInOut() As ObjectInOut

            Get

                Return Me._selectedObjectInOut

            End Get

            Set(ByVal value As ObjectInOut)

 

                If value Is Nothing Then

                    Me._selectedObjectInOut = Nothing

                    Me.Presenter.SelectedObjectInOut = Nothing

                Else

                    Dim objInOut As New ObjectInOut

                    patInOut.AccountNum = value.AccountNum

                    patInOut.AccountType = value.AccountType

                    patInOut.AltPhone = value.AltPhone

                    patInOut.ID = value.ID

                    patInOut.InTime = value.InTime

                    patInOut.CCode = value.CCode

                    patInOut.Date = value.Date

                    patInOut.Name = value.Name

                    patInOut.SetStateTypeUnChanged()

 

                    Me._selectedObjectInOut = objInOut

                    Me.Presenter.SelectedObjectInOut = objInOut

                End If

 

                Me.Presenter.Refresh("SelectedObjectInOut")

            End Set

        End Property

 

        Public ReadOnly Property Presenter() As ShellPresenter

            Get

                Return TryCast(DataContext, ShellPresenter)

            End Get

        End Property

 

        Sub Refresh(ByVal propertyName As String)

            OnPropertyChanged(propertyName)

        End Sub

 

 

(DbConnection)Activator.CreateInstance(Type.GetType(provider), connectionString))




Hey, which ever way we go, this is a good idea…

 

From Blog Post:

==========================================================

 

Here's some code that i think is what you want.

Everything uses the system.data.common,

and the only oracle specific part is the value of the 'provider' string:

 

The generic class in the 'DbConnection conn' variable will handle

both SQL and Oracle (and more).

==========================================================

using System;

using System.Collections.Generic;

using System.Text;

 

using System.Data.Common;

 

namespace OdpTest

{

class Program

{

static void Main(string[] args)

{

string connectionString = "Data Source=(DESCRIPTION=

                                              (ADDRESS=(PROTOCOL=TCP)

                                              (HOST=MYHOST)(PORT=1527))

                                              (CONNECT_DATA=(SID=MYSERVICE)));

                                              User Id=MYUSER;Password=MYPASS;";


string provider = "Oracle.DataAccess.Client.OracleConnection, Oracle.DataAccess";

 

Console.WriteLine("Connecting");

 

using (DbConnection conn = (DbConnection)Activator.CreateInstance(Type.GetType(provider), connectionString))

{

conn.Open();

Console.WriteLine("Connected");

string sql = @"

select distinct owner

from sys.all_objects

order by owner";

Console.WriteLine("Looking for all DB owners, wait a few seconds:");

using (DbCommand comm = conn.CreateCommand())

{

comm.CommandText = sql;

using (DbDataReader rdr = comm.ExecuteReader())

{

while (rdr.Read())

{

string owner = rdr.GetString(0);

Console.WriteLine("{0}", owner);

}

}

}

}

}

}

}

 

The FindAll function returns a list of people.

This list would be usable to bind to grid-views or the like so would be almost as useful as a data-set, minus all the complication. Hope this helps.

 

public class People

{

public static List<person> FindAll()

{

string connectionString = "Data Source=(DESCRIPTION=

                                              (ADDRESS=(PROTOCOL=TCP)

                                              (HOST=MYHOST)(PORT=1527))

                                              (CONNECT_DATA=(SID=MYSERVICE)));

                                              User Id=MYUSER;Password=MYPASS;";


string provider = "Oracle.DataAccess.Client.OracleConnection, Oracle.DataAccess";

List<person> list = new List<person>();

 

using (DbConnection conn = (DbConnection)Activator.

CreateInstance(Type.GetType(provider), connectionString))

{

conn.Open();

using (DbCommand comm = conn.CreateCommand())

{

comm.CommandText = "select id,first_name,last_name from people";

using (DbDataReader rdr = comm.ExecuteReader())

{

while (rdr.Read())

{

Person p = new Person();

p.id = rdr.GetInt32(0);

p.firstName = rdr.GetString(1);

p.lastName = rdr.GetString(2);

list.Add(p);

}

}

}

}

 

return list;

}

}

 

public class Person

{

public int id { get; set; }

public string firstName { get; set; }

public string lastName { get; set; }

}

 

Source: http://splinter.com.au/using-the-new-odpnet-to-access-oracle-from-c

 

http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/482a773c-c215-4483-be78-670fddfe6dae/

 

WPF - Awesome format converter sample



Using IValueConverter to format binding values in WPF

First we need implement the value converter, to accomplish this we need to create a new class that implements System.Windows.Data.IValueConverter, this interface works only for simple binding. If you need to use multi-binding you will need implement System.Windows.Data.IMultiValueConverter. In the attached sample both interfaces are implemented.
After create the value converter class we have to define a resource (in XAML) pointing the class:
<loc:FormatConverter x:Key="formatConverter" /> 
Finally, we can use the FormatConverter class as follows:
<TextBlock Text="{Binding Text, Converter={StaticResource formatConverter},
                ConverterParameter=The text is \'{0}\'}" /> 
<TextBlock Text="{Binding DateTime, Converter={StaticResource formatConverter},
                ConverterParameter={}{0:d}}" />
<TextBlock Text="{Binding DateTime, Converter={StaticResource formatConverter},
                ConverterParameter={}{0:HH:mm:ss}}" />


Download the full sample here.

 

 

 

CDATA TAGS INLINE ASPX - <%# RssTitle %>



<%@ Page Language="C#" AutoEventWireup="true" ContentType="text/xml"

   EnableTheming="false"

   CodeFile="GetArticlesRss.aspx.cs" Inherits="GetArticlesRss" %>

<head runat="server" visible="false"></head>

 

<asp:Repeater id="rptRss" runat="server">

   <HeaderTemplate>

      <rss version="2.0">

         <channel>

            <title><![CDATA[Mamas House: <%# RssTitle %>]]></title>

            <link><%# FullBaseUrl %></link>

            <description>Mamas House: the site for my big mama</description>

            <copyright>Copyright 2007 by Mamas Boy</copyright>

   </HeaderTemplate>

   <ItemTemplate>

      <item>

         <title><![CDATA[<%# Eval("Title") %>]]></title>

         <author><![CDATA[<%# Eval("AddedBy") %>]]></author>

         <description><![CDATA[<%# Eval("Abstract") %>]]></description>

         <link><![CDATA[<%# FullBaseUrl + "ShowArticle.aspx?ID="+

            Eval("ID") %>]]></link>

         <pubDate><%# string.Format("{0:R}", Eval("ReleaseDate")) %></pubDate>

      </item>

   </ItemTemplate>

   <FooterTemplate>

         </channel>

      </rss>

   </FooterTemplate>

</asp:Repeater>


Proxy sends HTTP Auth credentials in each web service request


 /// <summary>

    /// Customized proxy class for  API Web services. 

The customized proxy always sends HTTP Authentication credentials in every web service request.

    /// </summary>

    internal class EnhancedApiService : ApiServiceService

    {

        private string UserName;

        private string password;

        internal EnhancedApiService() : base() 

        {

            UserName = ConfigurationManager.AppSettings["User"];

            if (UserName == null)

                UserName = "myFantastica";

            password = ConfigurationManager.AppSettings["Password"];

            if (password == null)

                password = "myPassword";

        }

        protected override System.Net.WebRequest GetWebRequest(Uri uri)

        {

            // Get the original request

            WebRequest request = base.GetWebRequest(uri);

            // Add the authentication header

            string auth = UserName + ":" + password;

            byte[] UnicodeData = Encoding.UTF8.GetBytes(auth);

            string AuthHeader = "Basic " + Convert.ToBase64String(UnicodeData);

            request.Headers["AUTHORIZATION"] = AuthHeader;

            return request;

        }

    }

 

Resolving the “ORA-12514: No TNS Listener” error with Oracle XE


Resolving the "ORA-12514: No TNS Listener" error with Oracle X


The particularly nagging error with a personal install of Oracle XE (Oracle Database 10g Express Edition) on Windows XP laptop...

ORA-12514:No TNS Listener

The SQL Command prompt that came with Oracle XE would work but none of the other tools like Toad, SQL Plus or even the Oracle XE Database Homepage which would open in a browser window would work.


The final resolution after a lot of research seemed to be painfully simple:


1.    Run the LSNRCTL.EXE program from the BIN directory of your Oracle XE install (default: C:\oraclexe\app\oracle\product\10.2.0\server\BIN). You should even be able to run it from any command prompt since the BIN directory is generally added to your PATH environment variable by default.


2.    At the LSNRCTL> command prompt, issue the STOP command. It should say:

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
The command completed successfully


3.    Now, at the LSNRCTL> prompt, issue the START command. It should return:

Starting tnslsnr: please wait…

TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 – Production
System parameter file is C:\oraclexe\app\oracle\product\10.2.0\server\NETWORK\AD
MIN\listener.ora
Log messages written to C:\oraclexe\app\oracle\product\10.2.0\server\network\log
\listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC_FOR
_XEipc)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hostname)(PORT=port)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
STATUS of the LISTENER
————————
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 – Produ
ction
Start Date 14-MAY-2009 01:24:49
Uptime 0 days 0 hr. 0 min. 5 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service XE
Listener Parameter File C:\oraclexe\app\oracle\product\10.2.0\server\NETWORK\ADMIN\listener.ora
Listener Log File C:\oraclexe\app\oracle\product\10.2.0\server\network\log\listener.log
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC_FOR_XEipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hostname)(PORT=port)))
Services Summary…
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service…
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service…
The command completed successfully


That should resolve the problem. Verify by running "tnsping XE" or "tnsping dbname" at the command prompt. It should return OK.

All your tools like Toad, SQL Plus or Oracle SQL Developer should be able to connect to the database now!

 

Deployment Automation Sample Diagram


Goals for improving build and deployment processes. 


  • Solidify our branching / merging strategy
  • Conduct training with the team to understand the approach and their part in making this successful. 

      Something similar to the following:


  • Solidify an approach for refreshing our development and test databases.
  • Utilize a tool to general schema and data scripts. 
  • Refresh Test environment after each Production release. 
  • Use a tool to generate scripts to deploy to the Test environment for the next release. 

      After generating these scripts from Development to Test
1. Refresh Development from Production.
2. Apply the same scripts to bring Development up to the level of Test. 
3. Automate this process. 

  • Remove old build definitions and define new build definitions for Development, Test, and Production.
  • Create folders underneath the .NET solution in each branch containing the App.config settings for dev, test, and prod deployments. 
  • Create new build configurations that copy the correct App.config based upon the type of build.
  • Development – uses the new Development build configuration.
  • Build the .NET solution, using the default sequential versioning method by Microsoft. 
  • Move away from custom version schemes.
  • Automatically create a Click-Once deployment and copy to \\appsdev\mobileweb\click-once-deploy

TFS Powershell Script Deploy *.RPT mods


[string] $outputFile="C:\DeployedChangeSet\DeployedChangeSetLog.txt"
[bool] $OpenOutputFile = $true;
[string] $DestFile="C:\DeployedChangeSet\Scripts"
[string] $filepath= "C:/MobileWebsite_Root/Main"

$items=Get-TfsItemHistory "$/MobileWebsite/Main/" -Version "D01/02/2013~" -Server tfs01 -Recurse -includeItems|

Select-Object -Expand "Changes"|Select-TFSItem

Select ChangesetId,TFSItem   -exp WorkItems |
    Format-Table Id,Title -GroupBy ChangesetId -Auto

foreach($item in $items)
{

    $itemPath=$item.Path.Trim()
    $extension = [System.IO.Path]::GetExtension($itemPath) 
    Remove-Item $DestFile\* -recurse
   if($extension -eq ".rpt")
    {
    
     $test = $itemPath.substring($itemPath.lastIndexOf("/Reports/"))
     $fp= $filepath + $test
     Copy-item $fp $DestFile -Recurse -force |out-file "C:\DeployedChangeSet\Scripts\Error.txt"
     
    }
   
    Write-Host "**********Code for services*****"
    if($itempath -contains )
}

TFS Build Automation Deployment Script

>> TFSBuilder.bat
--------------------------------------------------------------
@ECHO ON

SET APP_VERSION=9.9.1.0
SET FOLDER_VERSION=9_9_1_0
SET RELEASE_DATE=01/01/2012
SET BUILD_DROP_FOLDER=C:\TFSBuildDrop\myReadyApp_20120101.1\Release

REM ================================================================

SET DEV_MANIFEST_FOLDER= C:\PostTFSbuild\manifests\Dev
SET DEV_STAGING_ROOT= C:\TFSBuildStaging\Application\Dev

SET TFS1_MANIFEST_FOLDER=C:\PostTFSbuild\manifests\TFS1
SET TFS1_STAGING_ROOT=C:\TFSBuildStaging\Application\TFS1

SET PROD_MANIFEST_FOLDER=C:\PostTFSbuild\manifests\Prod
SET PROD_STAGING_ROOT=C:\TFSBuildProd\Application\Prod

SET CERTFILE_FOLDER=C:\myReadyApp_20120101.1\Out

REM===========================================================

IF NOT EXIST %DEV_STAGING_ROOT% MKDIR %DEV_STAGING_ROOT%
 MKDIR %DEV_STAGING_ROOT%\Out_%FOLDER_VERSION%

IF NOT EXIST %TFS1_STAGING_ROOT% MKDIR %TFS1_STAGING_ROOT%
 MKDIR %TFS1_STAGING_ROOT%\Out_%FOLDER_VERSION%

IF NOT EXIST %PROD_STAGING_ROOT% MKDIR %PROD_STAGING_ROOT%
 MKDIR %PROD_STAGING_ROOT%\Out_%FOLDER_VERSION%


XCOPY /V /Y /S %BUILD_DROP_FOLDER%\*.*
 %DEV_STAGING_ROOT%\Out_%FOLDER_VERSION%\*.*

XCOPY /V /Y /S %BUILD_DROP_FOLDER%\*.*
 %TFS1_STAGING_ROOT%\Out_%FOLDER_VERSION%\*.*

XCOPY /V /Y /S %BUILD_DROP_FOLDER%\*.*
 %PROD_STAGING_ROOT%Out_%FOLDER_VERSION%\*.*


REM C:\PostTFSbuild\ReplaceTool.exe
 %DEV_STAGING_ROOT%\Out_%FOLDER_VERSION%\myReadyApp.exe.config DEV

COPY /V /Y C:\PostTFSbuild\Config_File\Dev\myReadyApp.exe.config
 %DEV_STAGING_ROOT%\Out_%FOLDER_VERSION%\myReadyApp.exe.config

REM c:\PostTFSbuild\ReplaceTool.exe
 %TFS1_STAGING_ROOT%\Out_%FOLDER_VERSION%\myReadyApp.exe.config TEST

COPY /V /Y C:\PostTFSbuild\Config_File\TFS1\myReadyApp.exe.config
 %TFS1_STAGING_ROOT%\Out_%FOLDER_VERSION%\myReadyApp.exe.config

REM C:\PostTFSbuild\ReplaceTool.exe
 %PROD_STAGING_ROOT%\Out_%FOLDER_VERSION%\myReadyApp.exe.config PROD

COPY /V /Y C:\PostTFSbuild\Config_File\Prod\myReadyApp.exe.config
 %PROD_STAGING_ROOT%\Out_%FOLDER_VERSION%\myReadyApp.exe.config


Mage.exe -New Application -ToFile
 %DEV_STAGING_ROOT%\Out_%FOLDER_VERSION%\myReadyApp.exe.manifest -Name
"myReadyApp" -Version %APP_VERSION% -FromDirectory
 %DEV_STAGING_ROOT%\Out_%FOLDER_VERSION%

Mage.exe -Sign
 %DEV_STAGING_ROOT%\Out_%FOLDER_VERSION%\myReadyApp.exe.manifest
 -CertFile %CERTFILE_FOLDER%\myReadyApp.pfx -pwd mypassword

Mage.exe -New Deployment -ToFile %DEV_STAGING_ROOT%\myReadyApp.application
 -Version %APP_VERSION% -AppManifest
 %DEV_STAGING_ROOT%\Out_%FOLDER_VERSION%\myReadyApp.exe.manifest
 -AppCodeBase Out_%FOLDER_VERSION%\myReadyApp.exe.manifest -providerUrl
 \\apps\Dev\myReadyApp\Application\myReadyApp.application

Mage.exe -Sign %DEV_STAGING_ROOT%\myReadyApp.application -CertFile
 %CERTFILE_FOLDER%\myReadyApp.pfx -pwd mypassword


Mage.exe -New Application -ToFile
 %TFS1_STAGING_ROOT%\Out_%FOLDER_VERSION%\myReadyApp.exe.manifest -Name
 "myReadyApp" -Version %APP_VERSION% -FromDirectory
 %TFS1_STAGING_ROOT%\Out_%FOLDER_VERSION%

Mage.exe -Sign
 %TFS1_STAGING_ROOT%\Out_%FOLDER_VERSION%\myReadyApp.exe.manifest
 -CertFile %CERTFILE_FOLDER%\myReadyApp.pfx -pwd mypassword

Mage.exe -New Deployment -ToFile %TFS1_STAGING_ROOT%\myReadyApp.application
 -Version %APP_VERSION% -AppManifest
 %TFS1_STAGING_ROOT%\Out_%FOLDER_VERSION%\myReadyApp.exe.manifest
 -AppCodeBase Out_%FOLDER_VERSION%\myReadyApp.exe.manifest -providerUrl
 \\apps\AppsTest\myReadyApp\Application\myReadyApp.application

Mage.exe -Sign %TFS1_STAGING_ROOT%\myReadyApp.application -CertFile
 %CERTFILE_FOLDER%\myReadyApp.pfx -pwd mypassword


Mage.exe -New Application -ToFile
 %PROD_STAGING_ROOT%\Out_%FOLDER_VERSION%\myReadyApp.exe.manifest -Name
 "myReadyApp" -Version %APP_VERSION% -FromDirectory
 %PROD_STAGING_ROOT%\Out_%FOLDER_VERSION%

Mage.exe -Sign
 %PROD_STAGING_ROOT%\Out_%FOLDER_VERSION%\myReadyApp.exe.manifest
 -CertFile %CERTFILE_FOLDER%\myReadyApp.pfx -pwd mypassword

Mage.exe -New Deployment -ToFile %PROD_STAGING_ROOT%\myReadyApp.application
 -Version %APP_VERSION% -AppManifest
 %PROD_STAGING_ROOT%\Out_%FOLDER_VERSION%\myReadyApp.exe.manifest
 -AppCodeBase Out_%FOLDER_VERSION%\myReadyApp.exe.manifest -providerUrl
 \\apps\Apps\myReadyApp\Application\myReadyApp.application

Mage.exe -Sign %PROD_STAGING_ROOT%\myReadyApp.application -CertFile
 %CERTFILE_FOLDER%\myReadyApp.pfx -pwd mypassword


COPY /V /Y %DEV_STAGING_ROOT%\myReadyApp.application
 \\apps\AppsDev\myReadyApp\Application\myReadyApp.application

XCOPY /V /Y /S %DEV_STAGING_ROOT%\Out_%FOLDER_VERSION%\*.*
 \\apps\AppsDev\myReadyApp\Application\Out_%FOLDER_VERSION%\*.*


COPY /V /Y %TFS1_STAGING_ROOT%\myReadyApp.application
 \\apps\AppsTest\myReadyApp\Application\myReadyApp.application

XCOPY /V /Y /S %TFS1_STAGING_ROOT%\Out_%FOLDER_VERSION%\*.*
 \\apps\AppsTest\myReadyApp\Application\Out_%FOLDER_VERSION%\*.*


COPY /V /Y %PROD_STAGING_ROOT%\myReadyApp.application
 \\apps\AppsTest\NewRelease\TFS1\ndtsnet\Application\myReadyApp.application

XCOPY /V /Y /S %PROD_STAGING_ROOT%\Out_%FOLDER_VERSION%\*.*
 \\apps\AppsTest\NewRelease\TFS1\ndtsnet\Application\Out_%FOLDER_VERSION%\*.*