Full Trust European Hosting

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

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.



Node.js Hosting Russia - Use Simple Example Code to GET and POST in Node.js

clock January 27, 2015 06:05 by author Peter

With this post, I will write about using simple Example Code GET and POST in Node.js. In this post, I use this library (Simplified HTTP request client.) And here is the code:

GET
var request = require('request');
// Set the headers
var headers = {
    'User-Agent':       'Super Agent/0.0.1',
    'Content-Type':     'application/x-www-form-urlencoded'
}
// Configure the request
var options = {
    url: 'http://hostforlife.eu',
    method: 'GET',
    headers: headers,
    qs: {'key1': 'xxx', 'key2': 'yyy'}
}

// Start the request
request(options, function (error, response, body) {
    if (!error && response.statusCode == 200) {
        // Print out the response body
        console.log(body)
    }
})

Above code will do GET https://localhost:8080/?key1=xxx&key2=yyy

POST
var request = require('request');
// Set the headers
var headers = {
    'User-Agent':       'Super Agent/0.0.1',
    'Content-Type':     'application/x-www-form-urlencoded'
}

// Configure the request
var options = {
    url: 'http://hostforlife.eu',
    method: 'POST',
    headers: headers,
    form: {'key1': 'xxx', 'key2': 'yyy'}
}
// Start the request
request(options, function (error, response, body) {
    if (!error && response.statusCode == 200) {
        // Print out the response body
        console.log(body)
    }
})

Above code will do POST https://localhost:8080/ with key1=xxx&key2=yyy in the body.

Handling gzip encoding
To handle gzip encoded response, you will need the compress-buffer library.
var uncompress = require('compress-buffer').uncompress;
// Set the headers and options ...
request(options, function (error, response, body) {
    if (!error && response.statusCode == 200) {
        // Handle gzip
        var encoding = response.headers['content-encoding']
        if(encoding && encoding.indexOf('gzip')>=0) {
            body = uncompress(body);
        }
        body = body.toString('utf-8');
        // Print out the response body
        console.log(body)
        // If it is json
        var json_body = JSON.parse(body);
    }
})

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 Proudly Launches Sitefinity 7.3 Hosting

clock January 26, 2015 10:13 by author Peter

HostForLIFE.eu, a leading web hosting provider, has leveraged its gold partner status with Microsoft to launch its latest Sitefinity 7.3 Hosting support.

European Recommended Windows and ASP.NET Spotlight Hosting Partner in Europe, HostForLIFE.eu, has announced the availability of new hosting plans that are optimized for the latest update of the Sitefinity 7.3 hosting technology.

HostForLIFE.eu supports Sitefinity 7.3 hosting on our latest Windows Server and this service is available to all our new and existing customers. Sitefinity 7.3 offers a natural extension to all customer SharePoint workflows and wrap a compelling presentation around client core business documents. Contextual task-oriented approach to organizing documentation on any topic.

HostForLIFE.eu hosts its servers in top class data centers that is located in Amsterdam, London, Paris and Seattle (US) to guarantee 99.9% network uptime. All data center feature redundancies in network connectivity, power, HVAC, security, and fire suppression. All hosting plans from HostForLIFE.eu include 24×7 support and 30 days money back guarantee. All hosting plans from HostForLIFE.eu include 24×7 support and 30 days money back guarantee. The customer can start hosting our Sitefinity 7.3  site on our environment from as just low €3.00/month only.

Sitefinity 7.3 is a Web Content and Experience Management Platform that enables business to engage, convert and retain customers through multiple channels. Sitefinity 7.3 is the only truly mobile web content management on the market that supports all three mobile strategies out of the box – responsive design, mobile apps and mobile sites.

Sitefinity 7.3’s intuitive user interface delights both developers and business users alike, making it a more efficient environment to get more work done faster. There’s no long training required, so even new non-technical users will be up and running in no time. Because it’s built on a modern code-base, Sitefinity is best equipped to meet the long term needs of today’s expanding businesses, including tackling challenges like mobile, ecommerce, multisite management, content personalization, and so much more.

HostForLIFE.eu is a popular online Windows based hosting service provider catering to those people who face such issues. The company has managed to build a strong client base in a very short period of time. It is known for offering ultra-fast, fully-managed and secured services in the competitive market. Our powerful servers are specially optimized and ensure Sitefinity 7.3 performance.

For more information about this new product, please visit http://hostforlife.eu/European-Sitefinity-73-Hosting

About HostForLIFE.eu :
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.



DotNetnuke 7.3.4 Hosting - HostForLIFE.eu :: How to Fix DotNetNuke Redirect Loop and 404 Not Found Error ?

clock January 13, 2015 05:40 by author Peter

This problem happens especially in the latest versions of DotNetNuke (7.0 or later). It is shortly represented like this: when you install DotNetNuke and everything appearance fine. You log in to your system using your host account and so your homepage keeps refreshing indefinitely. you'll not get rid of that “Getting Started” pop-up. after you manually instert the url of different pages in your web browser url bar (like yoursite.com/contact.aspx), you get a 404 not found error.

To solve this problem, apply the steps below:
1. Find the folder within which your DotNetNuke web site is installed and find your web.config file there and open it (normally, i open it with a development application like Visual Studio or notepad++ for better undestanding however classic Notepad can do fine, too).

2. On the web.config file, you should find the <system.webserver> tag.

3. On this tag, find <modules> tag. And update this tag:
<modules runAllManagedModulesForAllRequests=”true”>

4. Then, Save your web.config file. Close your browser, open it again and open your website. Log in with your host or admin account. You will see that the problem is fixed.

Obviously there may be different components which cause this issue yet i have made bunches of DNN establishments and i've generally figured out how to settle this issue by applying the steps above.

Note: If you have done all the steps and still get a 404 error, than check your default documents in IIS and see if there is default.aspx in there. If not, add it.



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