Friday, December 23, 2016

Bootstrap navigation collapse and Fix navigation till 3 level on scrool beginner.


Below is the process to fix the navigation on mouse scroll on top of site, Mobile tab and desktop flexible.


<!DOCTYPE html>
<html>
<head>
    <title>Bootstrap Example</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <style>
        /* Note: Try to remove the following lines to see the effect of CSS positioning */
        .affix {
            top: 0;
            width: 100%;
        }

            .affix + .container-fluid {
                padding-top: 70px;
            }
    </style>
</head>
<body>

    <div class="container-fluid" style="background-color:grey;color:#fff;height:110px;">

        <h3>Fixed (sticky) navbar on scroll</h3>
        <p>Scroll this page to see how the navbar behaves with data-spy="affix".</p>
        <p>The navbar is attached to the top of the page after you have scrolled a specified amount of pixels.</p>
    </div>

    <nav class="navbar navbar-inverse" data-spy="affix" data-offset-top="197">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <!-- <a class="navbar-brand" href="#">WebSiteName</a> -->
        </div>
        <div class="collapse navbar-collapse" id="myNavbar">
            <ul class="nav navbar-nav">
                <li class="active"><a href="#">Home</a></li>
                <li>
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">Page 1 <span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li><a href="#">Page 1-1</a></li>
                        <li>
                            <a lass="dropdown-toggle" data-toggle="dropdown" href="#">Page 1-2 <span></span></a>
                            <ul class="dropdown-menu">
                                <li><a href="#">Page 2-1-1</a></li>
                            </ul>
                        </li>
                        <li><a href="#">Page 1-3</a></li>
                    </ul>
                </li>
                <li><a href="#">Page 2</a></li>
                <li><a href="#">Page 3</a></li>
            </ul>
        </div>
    </nav>

    <div class="container">
        <div class="row">
            <div class="col-md-12">dfsd</div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label for="email">First name :</label>
                    <input type="text" class="form-control" id="email">
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label for="email">Last name :</label>
                    <input type="text" class="form-control" id="email">
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label for="email">Date of birth :</label>
                    <input type="date" class="form-control" id="email">
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label for="email">Contact Number :</label>
                    <input type="text" class="form-control" id="email">
                </div>
            </div>
        </div>
        <div class="row">

            <div class="col-sm-12">
                <div class="form-group">
                    <input type="submit" id="submit" class="btn btn-success" />
                    <button class="btn btn-danger">Cancel</button>
                </div>
            </div>
        </div>
    </div>
    <div class="container">
        <h2>Contextual Classes</h2>
        <table class="table">
            <thead>
                <tr>
                    <th>Firstname</th>
                    <th>Lastname</th>
                    <th>Email</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>Default</td>
                    <td>Defaultson</td>
                    <td>def@somemail.com</td>
                </tr>
                <tr class="success">
                    <td>Success</td>
                    <td>Doe</td>
                    <td>john@example.com</td>
                </tr>
                <tr class="danger">
                    <td>Danger</td>
                    <td>Moe</td>
                    <td>mary@example.com</td>
                </tr>
                <tr class="info">
                    <td>Info</td>
                    <td>Dooley</td>
                    <td>july@example.com</td>
                </tr>
                <tr class="warning">
                    <td>Warning</td>
                    <td>Refs</td>
                    <td>bo@example.com</td>
                </tr>
                <tr class="active">
                    <td>Active</td>
                    <td>Activeson</td>
                    <td>act@example.com</td>
                </tr>
            </tbody>
        </table>
    </div>

    <div class="container-fluid" style="height:1000px">
        <h1>Some text to enable scrolling</h1>
        <h1>Some text to enable scrolling</h1>
        <h1>Some text to enable scrolling</h1>
        <h1>Some text to enable scrolling</h1>
        <h1>Some text to enable scrolling</h1>
        <h1>Some text to enable scrolling</h1>
        <h1>Some text to enable scrolling</h1>
        <h1>Some text to enable scrolling</h1>
        <h1>Some text to enable scrolling</h1>
        <h1>Some text to enable scrolling</h1>
        <h1>Some text to enable scrolling</h1>
    </div>
<script>  below for multilevel menu dropdown
$(document).ready(function() {
    $('.navbar a.dropdown-toggle').on('click', function(e) {
        var $el = $(this);
        var $parent = $(this).offsetParent(".dropdown-menu");
        $(this).parent("li").toggleClass('open');

        if(!$parent.parent().hasClass('nav')) {
            $el.next().css({"top": $el[0].offsetTop, "left": $parent.outerWidth() - 4});
        }

        $('.nav li.open').not($(this).parents("li")).removeClass("open");

        return false;
    });
});

</script>
</body>
</html>





Wednesday, December 21, 2016

Web config for basicHttpBinding for windows authentication only with errors. solved

List of web.config error in WCF.

Below is the process 

Use basicHttpBinding with Windows Authentication and TransportCredentialOnly in WCF from Windows Forms.

I checked so many solution and found the final solution.

1. The provided URI scheme 'https' is invalid; expected 'http'.

2. Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service.

Below is the correct web.config file. and tested by me.
<bindings>
      <basicHttpBinding>
        <binding name="BasicHttpEndpointBinding2">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service name="MyTestServicesProject1.MyTestService">
        <endpoint  binding="basicHttpBinding" bindingConfiguration="BasicHttpEndpointBinding2"
          name="BasicHttpEndpoint" contract="MyTestServicesProject1.IMyTestService">         
        </endpoint>       
      </service>
    </services>
    <behaviors>

Note:

1. In the Service name tag attribute (<service name="") name must be followed by project name and service name(Interface name without I). Not interface Name.

2. In the endpoint tag (<endpoint  ), Contract must be project name and then Interfacename(Including I).

3. We can also put address="" attribute value to blank for windows authentication with http.
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpEndpointBindin

Friday, December 2, 2016

WCF Error

The authentication schemes configured on the host ('IntegratedWindowsAuthentication') do not allow those configured on the binding 'BasicHttpBinding' ('Anonymous').  Please ensure that the SecurityMode is set to Transport or TransportCredentialOnly.  Additionally, this may be resolved by changing the authentication schemes for this application through the IIS management tool, through the ServiceHost.Authentication.AuthenticationSchemes property, in the application configuration file at the <serviceAuthenticationManager> element, by updating the ClientCredentialType property on the binding, or by adjusting the AuthenticationScheme property on the HttpTransportBindingElement.


Solved
refered url:https://msdn.microsoft.com/en-us/library/ff648505.aspx
http://www.c-sharpcorner.com/uploadfile/Mahadesh/wcf-series-using-the-wcf-service-configuration-editor/
http://stackoverflow.com/questions/2435823/the-provided-uri-scheme-https-is-invalid-expected-http-parameter-name-via

Tools:
Microsoft Service configuration editor.

Step 2: Configure the WCF Service to Use basicHttpBinding

In this step, you configure your WCF service endpoint to use basicHttpBinding.
  1. Right-click the Web.config file of the WCF service and then click Edit WCF Configuration.
    If you do not see the Edit WCF Configuration option, on the Tools menu, click WCF Service Configuration Editor. Close the WCF Service Configuration Editor tool that appears. The option should now appear on the web.config context menu.
  2. In the Configuration Editor, in the Configuration section, expand Service and then expand Endpoints.
  3. Select the first node [Empty Name]. Set the name attribute to BasicHttpEndpoint.
    By default, the name will be empty because it is an optional attribute.
  4. In the Service Endpoint section, set the binding attribute to basicHttpBinding by choosing this option from the drop-down list.
  5. In the Configuration Editor, on the File menu, click Save.
  6. In Visual Studio, verify your configuration settings in Web.config. The configuration should look as follows:
    
    <services>
      <service behaviorConfiguration="ServiceBehavior" name="Service">
        <endpoint address="" binding="basicHttpBinding"
            name="BasicHttpEndpoint"
            bindingConfiguration=""
            contract="IService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding"
           contract="IMetadataExchange" />
      </service>
    </services> 
    
    
    

Step 3: Configure basicHttpBinding to use Windows Authentication with TransportCredentialOnly

By default, the basicHttpBinding security mode is None. This default setting means that you do not have authentication and that neither transport nor message security is enabled. By enabling Windows authentication with TransportCredentialOnly, you will get authentication, but no message protection; this is similar to how an ASMX Web service works.
  1. In the Configuration Editor, in the Configuration section, select the Bindings folder.
  2. In the Bindings section, choose New Binding Configuration.
  3. In the Create a New Binding dialog box, select basicHttpBinding.
  4. Click OK.
  5. Set the Name of the binding configuration to some logical and recognizable name; for example, BasicHttpEndpointBinding.
  6. Click the Security tab.
  7. Set the Mode attribute to TransportCredentialOnly by choosing this option from the drop-down menu.
  8. Set the TransportClientCredentialType to Windows by choosing this option from the drop-down list.
    In this case, the Windows option represents Kerberos.
  9. In the Configuration section, select BasicHttpEndpoint.
  10. Set the BindingConfiguration attribute to BasicHttpEndpointBinding by choosing this option from the drop-down list.
    This associates the binding configuration setting with the binding.
  11. In the Configuration Editor, on the File menu, click Save.
  12. In Visual Studio, verify your configuration, which should look as follows:
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpEndpointBinding">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="ServiceBehavior" name="Service">
        <endpoint address="" binding="basicHttpBinding"
          bindingConfiguration="BasicHttpEndpointBinding"
          name="BasicHttpEndpoint" contract="IService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding"
            contract="IMetadataExchange" />
      </service>
    </services>
    

Tuesday, November 22, 2016

Show balloon at startjup of Windows. NotifyIcon in c# windows form application.



Step1: New Project => Windows application project.
Step2: From the toolbaar Insert tool "NotifyIcon"
Step3: Write the code.
Step4: Make one folder in bin directory i.e. exe file image and paste the graph.ico

Below is the code for the Windows form application.


namespace TaskbarPOP
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

        }
        Form form = null;
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
              string name =      
                System.DirectoryServices.AccountManagement.UserPrincipal.Current.DisplayName;
                notifyIcon1.Icon = new System.Drawing.Icon(Path.GetFullPath(@"image\graph.ico"));
                notifyIcon1.Text = "Welcome";
                notifyIcon1.Visible = true;
                notifyIcon1.BalloonTipTitle = "Welcome ASHWIN.";
                notifyIcon1.BalloonTipText = "Have a good day.";
                notifyIcon1.ShowBalloonTip(800);
                /////// hiding th form  //////////
                form = (Form)sender;
                form.ShowInTaskbar = false;
                form.Opacity = 0;
                //form.Close();                
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        private void notifyIcon1_BalloonTipClosed(object sender, EventArgs e)
        {
            if (form != null)
                form.Close();
        }
    }
}

To Make startup at windows: Run type=> shell:startup, Then paste the application or shortcut of application. OR below locaion
C:\Users\asharmax087101\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace StartUpNotification
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                this.Hide();
               
                string[] lines;
                var list = new List<string>();
                var fileStream = new System.IO.FileStream(@"C:\InUse\info.txt", System.IO.FileMode.Open, System.IO.FileAccess.Read);
                using (var streamReader = new System.IO.StreamReader(fileStream, Encoding.UTF8))
                {
                    string line;
                    while ((line = streamReader.ReadLine()) != null)
                    {
                        list.Add(line);
                    }
                }
                lines = list.ToArray();
                if (lines.Count() >= 2)
                {
                    notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
                    notifyIcon1.BalloonTipText = lines[0];
                    notifyIcon1.BalloonTipTitle = lines[1];
                    notifyIcon1.ShowBalloonTip(5000);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(@"File not found:C:\InUse\info.txt;1.Title,2.Message--" + ex.Message);
            }
        }

        private void notifyIcon1_BalloonTipClicked(object sender, EventArgs e)
        {
            this.Close();
        }
    }

}

Wednesday, August 17, 2016

Angular JS CRUD Operation in single page without data base-Angular JS Basic tutorials

Angular JS CRUD Operation in single page, Angular JS CRUD in table simplee-Angular JS Basic tutorials


To Achieve
 Java Script code(Angular)

HTML


Tuesday, July 5, 2016