Full Trust European Hosting

BLOG about Full Trust Hosting and Its Technology - Dedicated to European Windows Hosting Customer

AngularJS with Free ASP.NET Hosting - HostForLIFE.eu :: How to Show ngCloak usage with AngularJS?

clock April 17, 2015 07:42 by author Peter

In this post, I will explain you about How to Show ngCloak usage with AngularJS. AngularJS gives ngCloak directive to control the glimmering issue when application is bootstrapping. AngularJS adds the ngCloak class to the component if the application is not bootstrapped and removes this class once the application is bootstrapped and prepared. Now, write the following code:


<!DOCTYPE html>
<html ng-app="myApp">
<head>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular-resource.min.js"></script>
<meta charset="utf-8">
<title>AngularJS ngCloak Example</title>
<style> [ng:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak { display: none !important; } </style>
</head>
<body ng-controller="MyController" ng-cloak>
<h3>ngCloak Example</h3>
 <ol >
        <li ng-repeat="item in myData"> {{item.title}} </li>
</ol>
 </body>
<script> var myApp= angular.module("myApp",['ngResource']); myApp.controller("MyController", ["$scope", "$resource","$timeout", function($scope,$resource,$timeout){ $scope.myData =[]; var youtubeVideoService = $resource("https://gdata.youtube.com/feeds/api/videos?q=googledevelopers&max-results=5&v=2&alt=jsonc&orderby=published"); youtubeVideoService.get() .$promise.then(function(responseData) { angular.forEach(responseData.data.items, function(aSingleRow){ console.log(aSingleRow); $scope.myData.push({ "title":aSingleRow.title }); }); }); }]); </script>
</html>

I hope this tutorial helps you!

AngularJS with Free ASP.NET Hosting

Try our AngularJS with Free ASP.NET Hosting today and your account will be setup soon! You can also take advantage of our Windows & ASP.NET Hosting support with Unlimited Domain, Unlimited Bandwidth, Unlimited Disk Space, etc. You will not be charged a cent for trying our service for the next 3 days. Once your trial period is complete, you decide whether you'd like to continue.



SQL Server 2014 with Free ASP.NET Hosting - HostForLIFE.eu :: How to Create an Encrypted Backup in SQL Server 2014?

clock April 14, 2015 07:18 by author Peter

Encryption for Backups could be a new feature introduced in SQL Server 2014 and therefore the advantages of this feature are:   

  • Encrypting the database backups helps secure the data.
  • Encryption also can be used for databases that are encrypted encryption TDE.
  • Encryption is supported for backups done by SQL Server Managed Backup to Windows Azure, that provides extra security for off-site backups.
  • This feature supports multiple encoding algorithms as well as AES 128, AES 192, AES 256, and Triple DES

You'll be able to integrate encryption keys with Extended Key Management (EKM) providers. The following are pre-requisites for encrypting a backup:
Let’s Create a Database Master Key for the master database.
USE master;
GO
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'yourpassword@word123';
GO


And then Create a certificate or asymmetric Key to use for backup encryption and write the following code:
Use Master
GO
CREATE CERTIFICATE CertforBackupEncryption
   WITH SUBJECT = 'Certificate for Backup Encryption ';
GO

Then Backup the database with encryption:
BACKUP DATABASE [PeterSQL]
TO DISK = N'C:\Backup\PeterSQL.bak'
WITH
  INIT,
  COMPRESSION,
  ENCRYPTION
   (
   ALGORITHM = AES_256,
   SERVER CERTIFICATE = CertforBackupEncryption
   ),
  STATS = 10
GO


Restoring the encrypted backup:
SQL Server restore doesn't need any encryption parameters to be specified during restores. It will need that the certificate or the asymmetric key used to encrypt the backup file be out there on the instance that you simply are restoring to. The user account performing the restore should have read DEFINITION permissions on the certificate or key. If you're restoring the encrypted backup to a different instance, you must confirm that the certificate is offered on it instance.


SQL Server 2014 with Free ASP.NET Hosting

Try our SQL Server 2014 with Free ASP.NET Hosting today and your account will be setup soon! You can also take advantage of our Windows & ASP.NET Hosting support with Unlimited Domain, Unlimited Bandwidth, Unlimited Disk Space, etc. You will not be charged a cent for trying our service for the next 3 days. Once your trial period is complete, you decide whether you'd like to continue.



Angular.js Hosting Italy - HostForLIFE.eu :: AngularJS Directive for Email

clock April 7, 2015 11:52 by author Peter

In this article, I will explain you about AngularJS directive for email. At the point when executing a Single Page Application utilizing WebAPI and AngularJS, you experience numerous uses of filters and directives to meet requirements specified by clients. The accompanying code tokenizes the info and presentations it in a different square inside a particular placeholder, in any case it checks the data for a substantial email address first and then the information token is not rehashed inside the same placeholder. And now, write the following code:

<body ng-app="tokenizer"> 
    <div ng-controller="tokenizerController"> 
        <tag-input taglist='email' placeholder="Emails"></tag-input>   
    </div> 
</body> 


    var sample = angular.module('tokenizer', ['ngRoute']);              
    sample.controller('tokenizerController', function ($scope) {               
      }); 
             sample.directive('tagInput', function ()
    { 
           return
            { 
               restrict: 'E',                 
               scope:
                { 
                  inputTags: '=taglist', 
                   autocomplete: '=autocomplete' 
                  }, 
                   link: function ($scope, element, attrs)
                  { 
                   $scope.defaultWidth = 200; 
                   $scope.tagText = ''; 
                   $scope.placeholder = attrs.placeholder; 
                   $scope.tagArray = function ()
                      { 
                       if ($scope.inputTags === #ff0000)
                       { 
                           return []; 
                       } 
                       return $scope.inputTags.split(',').filter(function (tag)
                       { 
                           return tag !== ""; 
                       }); 
                   }; 
                   $scope.addTag = function ()
                       { 
                       var EMAIL_REGEXP = /^[_a-z0-9]+(\.[_a-z0-9]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/; 
                       var tagArray; 
                       if ($scope.tagText.length === 0) { 
                           return; 
                        } 
                       if (!EMAIL_REGEXP.test($scope.tagText))
                       { 
                           return $scope.tagText = ""; 
                       } 
                       tagArray = $scope.tagArray(); 
                       if (!(tagArray.indexOf($scope.tagText) >= 0))
                       { 
                           tagArray.push($scope.tagText); 
                           $scope.inputTags = tagArray.join(','); 
                       } 
                       return $scope.tagText = ""; 
                   }; 
                   $scope.deleteTag = function (key)
                       { 
                       var tagArray; 
                       tagArray = $scope.tagArray(); 
                       if (tagArray.length > 0 && $scope.tagText.length === 0 && key === #ff0000)
                      { 
                           tagArray.pop(); 
                       }
                       else
                         { 
                           if (key !== undefined)
                           { 
                               tagArray.splice(key, 1); 
                           } 
                       } 
                       return $scope.inputTags = tagArray.join(','); 
                   }; 
                   $scope.$watch('tagText', function (newVal, oldVal)
                    { 
                       var tempEl; 
                       if (!(newVal === oldVal && newVal === undefined))
                          { 
                           tempEl = $("<span>" + newVal + "</span>").appendTo("body"); 
                           $scope.inputWidth = tempEl.width() + 5; 
                           if ($scope.inputWidth < $scope.defaultWidth)
                           { 
                               $scope.inputWidth = $scope.defaultWidth; 
                           } 
                           return tempEl.remove(); 
                       } 
                   }); 
                   element.bind("keydown", function (e) { 
                       var key; 
                       key = e.which; 
                       if (key === 9 || key === 13) { 
                           e.preventDefault(); 
                       } 
                       if (key === 8) { 
                           return $scope.$apply('deleteTag()'); 
                       } 
                   }); 
                   return element.bind("keyup", function (e) { 
                       var key; 
                       key = e.which; 
                       if (key === 9 || key === 13 || key === 188) { 
                           e.preventDefault(); 
                           return $scope.$apply('addTag()'); 
                       } 
                   }); 
               }, 
               template: "<div class='tag-input-ctn'><div class='input-tag' data-ng-repeat=\"tag in tagArray()\">{{tag}}<div class='delete-tag' data-ng-click='deleteTag($index)'>×</div></div><input type='text' data-ng-style='{width: inputWidth}' data-ng-model='tagText' placeholder='{{placeholder}}'/></div>" 
           }; 
       });  

HostForLIFE.eu AngularJS Hosting
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



Angular.js Hosting UK - HostForLIFE.eu :: Double Click Event in AngularJS

clock March 30, 2015 09:06 by author Peter

This article explains double-click events in AngularJS. we've already explained mouse events exploitation AngularJS in my previous article Mouse Events exploitation AngularJS. currently during this article i'm explaining the ng-dblclick directive of AngularJS.

ng-dblclick
This allows you to specify custom behaviour on a double-click event of the mouse on the web page. we will use it (ng-dblclick) as an attribute of the HTML component like:
<ANY_HTML_ELEMENT  ng-dblclick="{expression}">  
  ...  
</ANY_HTML_ELEMENT>

Use the subsequent procedure to make a sample of a double-click event using AngularJS. First of all, you would like to add an external Angular.js file to your application, for this you'll be able to visit the AngularJS official website or transfer my source code then fetch it or click on this link and download it: ANGULARJS. once downloading the external file you would like to add this file to the head section of your application. Now, I'll show you the way to use the ng-dblclick directive. I am making a TextBox and button and binding the TextBox using the ng-model directive and therefore the button using the ng-dblclick directive. The code is as follows:
<body>
    Name:
    <input ng-model="name" type="text" />
    <button ng-dblclick="Msg='Hello '+name">
        Double Click
    </button>
    </br>
    <h3>
        {{Msg}}</h3>
</body>


Here the TextBox ties with ng-demonstrate, The catch is bound with ng-dblclick and inside the ng-dblclick I have composed 'Hello  '+name. Where Hello is a string and name is a variable that contains the value of the input TextBox. This button will work when you double-click on it.

And here is the code that I used:
<!doctype html>
<html ng-app>
<head>
    <script src="angular.min.js"></script>
</head>
<body>
    Name:
    <input ng-model="name" type="text" />
    <button ng-dblclick="Msg='Hello '+name">
        Double Click
    </button>
    </br>
    <h3>
        {{Msg}}</h3>
</body>
</html>

Here is the Output, when Page loads:

HostForLIFE.eu AngularJS Hosting
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



Node.js Hosting UK - HostForLIFE.eu :: Cluster Server Object in NodeJS

clock March 17, 2015 06:44 by author Peter

In this tutorial , I will discuss about Cluster Server in NodeJS. That is a group of two or more computers that work together to provide availability, reliability and scalability that can be obtained using a single computer. In a server cluster, each server owns and manages devices and applications or services that are managing local cluster. 

To make the new Node Web Application open Visual Studio then select "File" -> "New Web Site" then select "Node Web Application" as in the accompanying figure:

Create a new Script file from the Solution Explorer as in the following figure:

And then select the new JavaScript file as in the following figure:

 

Write the following code in a JavaScript File.
(function () {
    '';
    var cls = require('cluster'),
        http = require('http'),
        os = require('os'),
        ClsServer = {
            clusname: 'ClusterServer',
            cpus: os.cpus().length,
            autoRestart: true,
            start: function (server, port) {
                var me = this,
                    i;
                if (cls.isMaster) {
                    for (i = 0; i < me.cpus; i += 1) {
                        console.log(me.name + ': starting worker thread #' + i);
                        cls.fork();
                    }
                    /*cls.on('death', function (worker) {
                        console.log(me.clusname + ': worker ' + worker.pid + ' died.');
                        if (me.autoRestart) {
                            console.log(me.clusname + ':thread restart');
                            cls.fork();
                        }
                    });*/
                } else {
                    server.listen(port);
                }
            }
        }
        helloWorldServer = http.createServer(function (request, response) {
           response.writeHead(200, {
                'Content-type': 'text/plain'
            });
                        response.end('Hello World!');
        });
    ClsServer.name = 'hello World Server';
    ClsServer.start(helloWorldServer, 8081);
}());

In the above case we make a ClusterServer article to begin multi-strung server examples by passing the server item to ClusterServer.start(server,port). Servers are naturally begun with various strings proportional to the quantities of CPUs reported by the os module.Debug the application by pressing F5 and the output will be demonstrated in a reassure application as in the accompanying figure: 

HostForLIFE.eu Node.js Hosting
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



HostForLIFE.eu Launches New Data Center in Frankfurt (Germany)

clock March 10, 2015 11:59 by author Peter

HostForLIFE.eu, a leading Windows hosting provider with innovative technology solutions and a dedicated professional services team proudly announces new Data Center in Frankfurt (Germany) for all costumers. HostForLIFE’s new data center in Frankfurt will address strong demand from customers for excellent data center services in Europe, as data consumption and hosting services experience continued growth in the global IT markets.

The new facility will provide customers and our end users with HostForLIFE.eu services that meet in-country data residency requirements. It will also complement the existing HostForLIFE.eu. The Frankfurt (Germany) data center will offer the full range of HostForLIFE.eu web hosting infrastructure services, including bare metal servers, virtual servers, storage and networking.

HostForLIFE.eu expansion into Frankfurt gives them a stronger European market presence as well as added proximity and access to HostForLIFE.eu growing customer base in region. HostForLIFE.eu has been a leader in the dedicated Windows & ASP.NET Hosting industry for a number of years now and we are looking forward to bringing our level of service and reliability to the Windows market at an affordable price.

The new data center will allow customers to replicate or integrate data between Frankfurt data centers with high transfer speeds and unmetered bandwidth (at no charge) between facilities. Frankfurt itself, is a major center of business with a third of the world’s largest companies headquartered there, but it also boasts a large community of emerging technology startups, incubators, and entrepreneurs.

Our network is built from best-in-class networking infrastructure, hardware, and software with exceptional bandwidth and connectivity for the highest speed and reliability. Every upstream network port is multiple 10G and every rack is terminated with two 10G connections to the public Internet and two 10G connections to our private network. Every location is hardened against physical intrusion, and server room access is limited to certified employees.

All of HostForLIFE.eu controls (inside and outside the data center) are vetted by third-party auditors, and we provide detailed reports for our customers own security certifications. The most sensitive financial, healthcare, and government workloads require the unparalleled protection HostForLIFE.eu provides.

Frankfurt (Germany) data centres meet the highest levels of building security, including constant security by trained security staff 24x7, electronic access management, proximity access control systems and CCTV. HostForLIFE.eu is monitored 24/7 by 441 cameras onsite. All customers are offered a 24/7 support function and access to our IT equipment at any time 24/7 by 365 days a year. For more information about new data center in Frankfurt, please visit http://hostforlife.eu/Frankfurt-Hosting-Data-Center

About HostForLIFE.eu
HostForLIFE.eu is an European Windows Hosting Provider which focuses on the Windows Platform only. HostForLIFE.eu deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.

HostForLIFE.eu is awarded Top No#1 SPOTLIGHT Recommended Hosting Partner by Microsoft (see http://www.asp.net/hosting/hostingprovider/details/953). Our service is ranked the highest top #1 spot in several European countries, such as: Germany, Italy, Netherlands, France, Belgium, United Kingdom, Sweden, Finland, Switzerland and other European countries. Besides this award, we have also won several awards from reputable organizations in the hosting industry and the detail can be found on our official website.



AngularJS Hosting UK - HostForLIFE.eu :: The .directive and .filter Service in AngularJS

clock March 10, 2015 07:03 by author Peter

This article clarifies the .directive and .filter service in AngularJS. Precise gives numerous sorts of administrations, two of them are directive and filter. In this article I will demonstrate to you an application in which both of the administrations are utilized.

Most importantly you have to add an outside Angular.js record to your application, as it were "angular.min.js".  For this you can go to the AngularJS official site.In the wake of downloading the external file you have to add this document to the Head segment of your application.
<head runat="server">
    <title></title>
    <script src="angular.min.js"></script>
</head>

After add the External JS file, the first thing you should do is to add ng-app in the <HTML> Tag otherwise your application will not run.
<html ng-app xmlns="http://www.w3.org/1999/xhtml">


On the JavaScript function, write the following code in the head section:
    <script>
        var x = angular.module('x', []); 
        function ctrl($scope) {
            $scope.name = 'testing';
       }
        angular.module('mod', [])
          .filter('ifarray', function () {
              return function (input) {
                  return $.isArray(input) ? input : [];
              }
         })
          .directive('list', function ($compile) {
              return {
                  restrict: 'E',
                  terminal: true,
                  scope: { val: 'evaluate' },
                  link: function (scope, element, attrs) {
                      if (angular.isArray(scope.val)) {
                          element.append('<div>+ <div ng-repeat="v in val"><list val="v"></list></div></div>');
                      } else {
                          element.append('  - {{val}}');
                      }
                     $compile(element.contents())(scope.$new());
                  }
              }
         });
        angular.module('x', ['mod']);
     </script>

Here I made a module whose name is "x", this module will be brought in the g-app directive. After this I made a functionwhose name is "ctrl", in this function one introductory value is passed in the variable "name".  After making the function, I utilized the filter and directive administrations, in the directive administration I passed limit as "E". In this directive service I connected an "if" circle that will check whether the Array is utilized, if the array is utilized then it will attach a few controls to the component. I utilized a <list> control that is not a control, it’s an customized control that is not accessible in HTML. Now our work on JavaScript is completed and we can move to the design part of our application. Write this code in the body section:
<body>
    <form ng-app="x" id="form1" runat="server">
    <pre>
        <list val="['item1','item2',['item3','item4']]">
        </list>
    </pre>
    </form>
</body>

Here I bound the module name with the form using the ng-app directive. I utilized the custom component that was pronounced in the second step, in this <list> I bound some beginning values that will be seen in the yield window. Now, our application is made and is prepared for execution.

Output
When you running the application you will get a output like this:

You can see that the <list> is showing the output but it was not any official element.
The complete code of this application is as follows:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="JavaScript1.js"></script>
    <script>
        var x = angular.module('x', []);
        function ctrl($scope) {
            $scope.name = 'testing';
        }
        angular.module('mod', [])
          .filter('ifarray', function () {

              return function (input) {
                  return $.isArray(input) ? input : [];
             }
          })
          .directive('list', function ($compile) {
              return {
                  restrict: 'E',
                  terminal: true,
                  scope: { val: 'evaluate' },
                  link: function (scope, element, attrs) {
                      if (angular.isArray(scope.val)) {
                          element.append('<div>+ <div ng-repeat="v in val"><list val="v"></list></div></div>');
                      } else {
                          element.append('  - {{val}}');
                      }
                      $compile(element.contents())(scope.$new());
                  }
              }
          });
        angular.module('x', ['mod']);
    </script>
</head>
<body>
    <form ng-app="x" id="form1" runat="server">
    <pre>
        <list val="['item1','item2',['item3','item4']]">
        </list>
   </pre>
    </form>
</body>
</html>

HostForLIFE.eu AngularJS Hosting
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



Ajax Hosting UK - HostForLIFE.eu :: How to Edit the GridView Row Values in ASP.NET with Ajax ?

clock March 3, 2015 08:40 by author Peter

In this post, I explain you about how to edit the GridView Row Values in ASP.NET with Ajax. First, create a new project on Visual Studio. In ASP.NET write the following code:

 

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title> How to Edit the GridView Row Values in ASP.NET with Ajax </title> 
<style type="text/css">
    .modalBackground
    {
        background-color: black;      
        opacity: 0.7;      
    }
 #grd
 {
     margin:25px;
}
</style>
</head>
<body>
   <form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:DropDownList></asp:DropDownList>
<h4>Details</h4>
<div>
      <asp:GridView ID="grd" runat ="server"  GridLines="Both" BorderColor="#4F81BD" BorderStyle="Solid"
                            BorderWidth="1px" Style="position: static"  AutoGenerateColumns="false" >          <Columns>
              <asp:BoundField DataField="User_id" HeaderText="User ID" SortExpression="User_id" />
              <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />              <asp:BoundField DataField="Email_Address" HeaderText="Email Address"                  SortExpression="Email_Address" />          
           <asp:BoundField DataField="Mobile" HeaderText="Mobile No" SortExpression="Mobile" />
                             <asp:TemplateField HeaderText="Edit">
<ItemTemplate>
    <asp:LinkButton ID="lnkBtn" runat="server" OnClick="lnkbtn_Click">Edit</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
          </Columns>

<RowStyle BorderColor="Red" BorderWidth="2px"></RowStyle>
         </asp:GridView>
</div>
           <asp:Button ID="btnShow" Visible="true" runat="server" />
            <ajax:ModalPopupExtender ID="ModalPopup" runat="server" TargetControlID="btnShow"
                BackgroundCssClass="modalBackground" PopupControlID="PnlShow">
            </ajax:ModalPopupExtender>
                      <div ID="PnlShow" runat="server" style="display: none;background-color:white;">
             <span style="float: right; padding-right: 0px; margin: 0px;">
                         <asp:Button ID="btnClose" Text="X" runat ="server" />
             </span>
                <div style="margin:25px;">
<table >
<tr>
<td colspan="2" >User Details</td>
</tr>
<tr><td>User Id</td>
<td>Name</td>
<td>Email_Address</td>
<td>Mobile No.</td>
</tr>
<tr>
<td><asp:Label ID="lblID" runat="server" /></td>
<td><asp:TextBox ID="txtName" runat="server" /></td>
<td><asp:TextBox ID="txtEmail" runat="server" /></td>
<td><asp:TextBox ID="txtMobile" runat="server" /></td>
</tr>
<tr>
<td>
<asp:Button ID="btnUpdate" CommandName="Update" runat="server" Text="Update" onclick="btnUpdate_Click"/>
<asp:Button ID="btnCancel" runat="server" Text="Cancel" />
</td>
</tr>
</table>
                </div>                          
            </div>
</form>
</body>
</html>


In C#.NET
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class AjaxModalPopUp : System.Web.UI.Page
{
    SP obj = new SP();
    protected void Page_Load(object sender, EventArgs e)
    {
        BindData();
        btnShow.Visible = false;
    }
   protected void BindData()
    {    
        DataSet ds = obj.Display();
        grd.DataSource = ds;
        grd.DataBind();
    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        obj.id = Convert.ToInt32(lblID.Text);
        obj.name = txtName.Text;
        obj.email = txtEmail.Text;
        obj.mobile = txtMobile.Text;
        obj.Update();
        Response.Write ("<script>alert('Details Updated Successfully');</script>");    
        BindData();
    }
    protected void lnkbtn_Click(object sender, EventArgs e)
    {
        LinkButton LNK = sender as LinkButton;
        GridViewRow gvrow = (GridViewRow)LNK.NamingContainer;
        lblID.Text = gvrow.Cells[0].Text;
        txtName.Text = gvrow.Cells[1].Text;       
        txtEmail.Text = gvrow.Cells[2].Text;
        txtMobile.Text = gvrow.Cells[3].Text;
        btnShow.Visible = true;
        ModalPopup.Show();
    }
 }


In App_Code/SP.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using System.Configuration;
using System.Data.Common ;
public class SP
{
    public int id { get; set; }
    public string name { get; set; }
    public string email { get; set; }
    public string mobile { get; set; }
    public int studentId { get; set; }
    public string item { get; set; }
    public DataSet Display()
    {
        DataSet ds;
        try
        {           
            DbCommand cmd = sqlCon.GetStoredProcCommand("Display_Users");
            ds = sqlCon.ExecuteDataSet(cmd);
            return ds;
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    public int Update()
    {
        int checkUser;
        try
        {

            DbCommand cmd = sqlCon.GetStoredProcCommand("Update_user");
            sqlCon.AddInParameter(cmd, "@userId", DbType.String, id);
            sqlCon.AddInParameter(cmd, "@name", DbType.String, name);
            sqlCon.AddInParameter(cmd, "@email", DbType.String, email);
            sqlCon.AddInParameter(cmd, "@mobile", DbType.String, mobile);
            checkUser = sqlCon.ExecuteNonQuery(cmd);
            return checkUser;
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
}

In VB.net
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Data
Imports System.Data.SqlClient
Partial Public Class AjaxModalPopUp
    Inherits System.Web.UI.Page
    Private obj As New SP()
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        BindData()
        btnShow.Visible = False
    End Sub
    Protected Sub BindData()
        Dim ds As DataSet = obj.Display()
        grd.DataSource = ds
        grd.DataBind()
    End Sub
    Protected Sub btnUpdate_Click(ByVal sender As Object, ByVal e As EventArgs)
        obj.id = Convert.ToInt32(lblID.Text)
        obj.name = txtName.Text
        obj.email = txtEmail.Text
        obj.mobile = txtMobile.Text
        obj.Update()
        Response.Write("<script>alert('Details Updated Successfully');</script>")
        BindData()
    End Sub
    Protected Sub lnkbtn_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim LNK As LinkButton = TryCast(sender, LinkButton)
        Dim gvrow As GridViewRow = DirectCast(LNK.NamingContainer, GridViewRow)
        lblID.Text = gvrow.Cells(0).Text
        txtName.Text = gvrow.Cells(1).Text
        txtEmail.Text = gvrow.Cells(2).Text
        txtMobile.Text = gvrow.Cells(3).Text
        btnShow.Visible = True
        ModalPopup.Show()
    End Sub
End Class


In App_Code/SP.vb
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Data
Imports System.Data.SqlClient
Imports Microsoft.Practices.EnterpriseLibrary.Data
Imports Microsoft.Practices.EnterpriseLibrary.Data.Sql
Imports System.Configuration
Imports System.Data.Common
Public Class SP
    Public Property id() As Integer
        Get
            Return m_id
        End Get
        Set(ByVal value As Integer)
            m_id = Value
        End Set
    End Property
    Private m_id As Integer
    Public Property name() As String
        Get
            Return m_name
        End Get
        Set(ByVal value As String)
            m_name = Value
        End Set
    End Property
    Private m_name As String
    Public Property email() As String
       Get
            Return m_email
        End Get
        Set(ByVal value As String)
            m_email = Value
        End Set
    End Property
    Private m_email As String
    Public Property mobile() As String
        Get
            Return m_mobile
        End Get
        Set(ByVal value As String)
            m_mobile = Value
        End Set
    End Property
    Private m_mobile As String
    Public Property studentId() As Integer
        Get
            Return m_studentId
        End Get
        Set(ByVal value As Integer)
            m_studentId = Value
       End Set
    End Property
    Private m_studentId As Integer
    Public Property item() As String
        Get
            Return m_item
       End Get
        Set(ByVal value As String)
            m_item = Value
       End Set
    End Property
   Private m_item As String
    Public Function Display() As DataSet
        Dim ds As DataSet
       Try
            Dim cmd As DbCommand = sqlCon.GetStoredProcCommand("Display_Users")
            ds = sqlCon.ExecuteDataSet(cmd)
            Return ds
        Catch ex As Exception
            Throw ex
        End Try
    End Function
    Public Function Update() As Integer
        Dim checkUser As Integer
       Try
            Dim cmd As DbCommand = sqlCon.GetStoredProcCommand("Update_user")       sqlCon.AddInParameter(cmd, "@userId", DbType.[String], id)
            sqlCon.AddInParameter(cmd, "@name", DbType.[String], name)
            sqlCon.AddInParameter(cmd, "@email", DbType.[String], email)
            sqlCon.AddInParameter(cmd, "@mobile", DbType.[String], mobile)
           checkUser = sqlCon.ExecuteNonQuery(cmd)
            Return checkUser
        Catch ex As Exception
            Throw ex
        End Try
    End Function
End Class

HostForLIFE.eu Ajax Hosting
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.

 

 



Node.js Hosting Russia - HostForLIFE.eu :: How to Clustered HTTP Server in Node.js ?

clock February 24, 2015 07:39 by author Peter

In this short article, let me tell you about How to Clustered HTTP Server in Node.js. Now this is the code that I ued to clustere the HTTP Server:

function () {
    'use strict';
        var cluster = require('cluster'),
        http = require('http'),
        os = require('os'),       
        /*
         * ClusterServer object
         *
         * We start multi-threaded server instances by passing the server object
         * to ClusterServer.start(server, port).
         *
         * Servers are automatically started with a number of threads equivalent
         * to the number of CPUs reported by the os module.
         */
        ClusterServer = {
            name: 'ClusterServer',           
            cpus: os.cpus().length,           
            autoRestart: true, // Restart threads on death?
                        start: function (server, port) {
                var me = this,
                    i;                
                if (cluster.isMaster) { // fork worker threads
                    for (i = 0; i < me.cpus; i += 1) {
                        console.log(me.name + ': starting worker thread #' + i);
                        cluster.fork();
                    }                   
                    cluster.on('death', function (worker) {
                        console.log(me.name + ': worker ' + worker.pid + ' died.');
                        if (me.autoRestart) {
                            console.log(me.name + ': Restarting worker thread...');
                            cluster.fork();
                        }
                    });
                } else {
                    server.listen(port);
                }
            }
       },       
        /*
         * Simple example HelloWorld HTTP server
         *
         * Repsonds to any request with a plain txt "Hello World!" message.
         *
         * You can replace this with much more complex processing, naturally.
         */
        helloWorldServer = http.createServer(function (request, response) {
            response.writeHead(200, {
                'Content-type': 'text/plain'
            });
                        response.end('Hello World!');
            console.log('helloWorldServer: Served a hello!');
        });   
    ClusterServer.name = 'helloWorldServer'; // rename ClusterServer instance    ClusterServer.start(helloWorldServer, 8081); // Start it up!
}());

I hope it works for you!

HostForLIFE.eu Node.js Hosting

HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



AngularJS Hosting - HostForLIFE.eu :: How to Create Alert Box with AngularJS?

clock February 10, 2015 17:14 by author Peter

In this short tutorial, I will show you how to create an alert box using AngularJS. There is the difference between JavaScript and AngularJS. In AngularJS "$window" is need to referring to global Window Objects. If you want to show the alert in Angular then you need to pass it as $window.alert. First step is you need to add an external Angular.js file to your app. You need to visit the AngularJS website. After downloading the external file, you should add the following code to the Head section of your application.

 

 <head runat="server">
    <script src="angular.min.js"></script>
    <title></title>
</head>

Next step, I will create a function and write this function in the head section of your apps:
<script>
        function greet($window, $scope) {
            $scope.hello = function () {
                $window.alert('Hi!! ' + $scope.name);
            }
        }
</script>

We created a function named "greet", in $scope function and $window are passed as objects as a result of scope is used to pass a value to the controller and as you recognize we are going to show an alert window. that's why $window is used.

An alert is used but have $window before it, during this alert the message "Hi!!" are displayed at the side of some value that will be passed through a TextBox. This will be done using the $scope.name. Now you'll be thinking that I have neither declared name anyplace nor provided an initial value to the scope, you'll pass the initial value before this hello function however that may solely help to point out some text by default and nothing much more than that.

Now write this code in the body section:
  <body>
    <div ng-controller="greet">
      Name: <input ng-model="name" type="text"/>
      <button ng-click="greet()">Greet</button>
    </div>
  </body>

Here first I have applied a controller to a div, then an input tag is used in which "name" is applied through the ng-model, thus no matter is entered into the TextBox are shown within the alert box on the click of a button. The button click is sure to greet using the ng-click(). currently our work on this application is completed and it's complete code is as follows:
<head runat="server">
    <script src="angular.min.js"></script>
    <title></title>
    <script>
        function greet($window, $scope) {
            $scope.hello = function () {
                $window.alert('Hi!! ' + $scope.name);
            }
        }
    </script>
</head>
    <body>
    <div ng-controller="greet">
      Name: <input ng-model="name" type="text"/>
      <button ng-click="greet()">Greet</button>
    </div>
  </body>
</html>

On running the application you will see a TextBox and a Button.

If now I click on the Button then an Alert message will be shown but in the alert box "Hello Undefined" will be shown because nothing is provided through the TextBox and no initial value was passed through the $scope.

HostForLIFE.eu AngularJS Hosting
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



About HostForLIFE

HostForLIFE is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.

We have offered the latest Windows 2019 Hosting, ASP.NET 5 Hosting, ASP.NET MVC 6 Hosting and SQL 2019 Hosting.


Tag cloud

Sign in