Full Trust European Hosting

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

Node.js Hosting Europe - HostForLIFE.eu :: Sending Email Using Node.JS

clock May 22, 2019 07:42 by author Peter

For sending an email using Node.js, we need a node package called nodemailer. Before this, we need to set up the Node environment. To download the latest version of Node, click this link and download.

Once downloaded, install the local environment and make it ready. For confirming the Node installation, open command prompt and type the following command and press enter.
node -v

We will get the currently installed version of Node.js. After completion of all this, follow the below steps.

Install the nodemailer package using Node.js command prompt with this command.
npm install nodemailer –s

Once installed, the package.json file will be modified with the dependencies of the nodemailer package.
After installing nodemailer package, import the file to our node.js file which we are using for sending an email. For importing any node package, we need to use -
var nodemailer = require('nodemailer'); 

Here, we have created an instance for nodemailer package as nodemailer. Now, we need to use the createTransport method for assigning the host and credentials for authentication. Find the below one.
var transporter = nodemailer.createTransport({ 
    host: 'mail.yourserver.com', 
    auth: { 
        user: mymailID@gmail.com', 
        pass: 'password' 

Once we're finished with the above things, we need to construct the list of objects which are required to send an email. Check below.
var mailOptions = { 
    from: emailFrom, 
    to: emailTo, 
    cc: emailCc, 
    bcc: emailBcc, 
    subject: emailSubject, 
    html: emailContent 

Now, we need to use the sendMail method with transporter instance as mentioned below. For this method, we need to pass the mailOptions variable which contains the details of sending an email and we have added the callback function.
transporter.sendMail(mailOptions, function(error, info) { 
        if (error) 
                result: "failed" 
                result: "success" 

Now, the below part will summarize everything.
const express = require('express'); 
const app = express(); 
var nodemailer = require('nodemailer'); 
app.get('/sendmail', (req, res) => { 
  var transporter = nodemailer.createTransport({ 
    service: 'gmail', 
    auth: { 
      user: 'gmail_user_account@gmail.com', 
      pass: 'gmail_account_password' 
  var mailOptions = { 
    from: 'DAEMON <gmail_user_account@gmail.com>', 
    to: 'to_user@gmail.com', 
    cc: 'cc_user@gmail.com', 
    bcc: 'bcc_user@gmail.com', 
    subject: 'Reg: Send Email using node JS', 
    html: 'Welcome to Node JS' 
transporter.sendMail(mailOptions, function (error, info) { 
    if (error) { 
        result: "failed" 
      console.log("failed" + error); 
    } else { 
        result: "success" 
const port = process.env.PORT || 3000; 
console.log('API server started on: ' + port); 

Just copy this all code and place it into a Node file and name that as Emailsending.js.
Now, open the Node js Command Prompt and execute the Node.js file.
For the execution of node js file, use
node file_name.js


Once the Node.js file is executed, just check this URL http://localhost:3000/sendmail. Here, sendMail is the get method for the above program.

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.


European Visual Studio 2017 Hosting - HostForLIFE.eu :: Using C# Regions To Improve Code Readability

clock May 17, 2019 09:44 by author Peter

An instructor I once had made a statement that has echoed in my head for years. When you are a programmer, you have two groups of end users, the people who will actually use the software, AND other programmers who may someday have to modify your code. With that in mind, I have always tried to write my code to be as easily readable to other programmers as possible.

Visual Studio .NET gives us some very handy tools to improve readability in our code. One that I am particularly fond of is the #region directive that allows us to collapse code in a customized manor.

Regions are created in this format,
#region MyRegion

your code here

Everything that falls within the directives will be collapsible.

The method I've chosen to adapt is to create regions for each different type of element in a class (i.e. constructors, variables, methods, properties, enumerators) so that my code can be easily navigated.

Here is an example,

Doing this will keep your code more organized, which in turn will increase efficiency. And someday down the road when another programmer comes across your source code, they will be very thankful.

Umbraco 8.0.2 Hosting UK - HostForLIFE.eu :: How to Reset Umbraco Password?

clock May 8, 2019 11:13 by author Peter

Every computer user both desktop and computer connected to the network would have to know the username and password. Username is your identity to enter into a network, including ATM networks. While the password is the key to your username can be identified and can enter the network.

Username and password are very useful and should not be underestimated, because if your username and password known to other people, then all the data and systems that you have can be problematic. Therefore username and password is one of the important facilities in the computerized system. Besides passwords should be updated or updated at any time. For the system to which you have remained safe and comfortable.

The requirement to use a password:

  • Use a password that's at least 8 characters mixed with numbers and uppercase and lowercase letters.
  • Do not show while typing passwords on those around you.
  • Always remember your password.

Passwords are the key words that you have to remember, but there are times when you forgot your password. In this article, I will discuss how to reset the password on Umbraco 7 manually via database.You try to log into Umbraco but it turns out your password is incorrect. Not a problem as long as you have access to the database and filesystem. 

The first thing you should do is open SQL Manager later locate the folder umbracoUser. Umbraco user passwords stored in your database Umbraco in the umbracoUser table, in userPassword column.

In the table, look for your account to be reset, and make a note to Id you want to update. The password will be encrypted for security reasons, and the password will be stored as a hash for security. So we can not just simply typing long passwords in plain text and expect to get the results directly. We need to know the hash code for several common passwords.

userPassword Value :   /7IIcyNxAts3fvQYe2PI3d19cDU=
Password :             password
userPassword Value :   d9xnUXsUah9gycu7D0TpRYcx19c=
Password :             admin
userPassword Value :   bnWxWyFdCueCcKrqniYK9iAS+7E=
Password :             default

But Umbraco using hashing simple with just a few lines of code. You can generate your hashed password and put it in the user table Password column in umbracoUser table for your user account.

  1. string password = "mypassword";  
  2. HMACSHA1 hash = new HMACSHA1();  
  3. hash.Key = Encoding.Unicode.GetBytes(password);  
  4. string encodedPassword = Convert.ToBase64String(hash.ComputeHash(Encoding.Unicode.GetBytes(password))); 

You just use the generated hash the password and then update records in the table. After that you can log back into Umbraco with your new password.

HostForLIFE.eu Umbraco Hosting

HostForLIFE.eu revolutionized hosting with Plesk Control Panel, a Web-based interface that provides customers with 24x7 access to their server and site configuration tools. Plesk completes requests in seconds. It is included free with each hosting account. Renowned for its comprehensive functionality - beyond other hosting control panels - and ease of use, Plesk Control Panel is available only to HostForLIFE's customers. They offer a highly redundant, carrier-class architecture, designed around the needs of shared hosting customers.

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

clock April 18, 2019 11:46 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.

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}">  

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:
    <input ng-model="name" type="text" />
    <button ng-dblclick="Msg='Hello '+name">
        Double Click

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>
    <script src="angular.min.js"></script>
    <input ng-model="name" type="text" />
    <button ng-dblclick="Msg='Hello '+name">
        Double Click

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.

European Entity Framework Hosting - HostForLIFE.eu :: What Is Entity Framework And How Entity Framework Core Is Different?

clock April 12, 2019 12:13 by author Peter

Entity Framework (EF) is Object Relational Mapper(ORM) for .NET. In simple words, it is a collection of libraries that connect the objects in code with the schema. EF is a bit different than other ORMs. It has a mapping layer between domain classes and schema. It is Microsoft’s recommended data access technology. Of course, data access can be achieved by writing your own DAL (Data Access Layer) using ADO.NET or by using third-party mappers like Dapper but EF is a persistent and open source framework supported by Microsoft. It is possible to perform full CRUD (Create, Read, Update, Delete) operations. EF can help in the consistency of task, developer's productivity, and LINQ syntax helps to use any RDBMS (regardless of SQL writing style ie: Oracle or SQL Server). Actually, the purpose of EF is to let developers focus on the domain, not on the database.

There are mainly three workflows for Entity Framework.

Database-first approach
In this workflow, a database is created first with all tables and related objects (i.e, stored procedures). Entity Framework creates domain classes using the Entity Data Model Wizard. In this approach, most of the efforts are focused on designing database structures. It is a traditional approach which many developers are doing for years.
This approach suites when different teams like DBA design the database and programmers are supposed to integrate the database with an application or when requirements/goal are not clear and changes in the database are incremental. Or, if you have already one long-lasting stable database and you have a scenario to use an existing database – well, it is still possible to convert an existing database to code-first approach (reverse engineering is challenging in some scenarios but it is doable).

  • You can start initial development soon.
  • Existing databases can be utilized easily
  • If there are requirements like to have stored procedures, triggers, and table columns in a certain order (this feature is added in EF 2.1 now) then this workflow has an advantage over code first
  • If you need GUI for designing. For example: In SQL Server you can generate database diagrams and create or update objects from there.


  • The sync of changes is not easy. For example, you make changes in schema or table which you need to sync on your different working environments. You would need an external tool or do it manually.
  • If you are interested in version control like Git or SVN, then you cannot do it with database first. EDMX has no history of changes.
  • Sometimes, changes in structures of the database are complicated to update EDMX
  • Classes generated in this approach are auto-generated

Code-first approach
In this approach, we first create domain classes and then EF generates database tables. It is possible to create POCO classes (business objects) and you have complete control of it. You can write classes with properties which generate tables with columns using Migration process. Along with migration, the History table is also generated which can give you a version control feature.
This is a good approach if you are the programmer and you are the one who designs the database as well. This approach is useful if changes in the database are more, the application is scalable and needs tracking as well.
The database sync is easy for environments using migration. It is a really needed feature which makes it possible to upgrade or downgrade any change/commit.
You get control on the code so you can validate fields from classes as well

No GUI so you need programming experience
We do not have real full control on the database, of course, EF is releasing a new version with many new features but let's say: It is not possible to create or remove trigger or stored procedures from EF until we use SQL in Context class.

Model-first approach
In simple words, this approach is based on the GUI. All you need is to create entities and relationships on EDMX design surface so it is like a UML diagram. From the Entity Data Model wizard, you can choose the Designer model and create your entities all in GUI. When you are done with your design, you can choose “Generate Database from model” to auto-generate domain classes and database. This approach can be useful if a data structure is big and you need very little control on the database. For example, if you need triggers or stored procedures or custom business logic on fields of entities, then you should consider either database first or code first.
The visual design interface can help to create entities easily in a short time
Programming experience not needed

Auto-generated code is a limitation here
Little control on database
Sometimes, EMDX auto-generated scripts still need modification which needs good SQL level of expertise to get a workaround.

How Entity Framework Core is different than Entity Framework?
Entity Framework Core(EF Core) is lightweight (collection of composable API), cross-platform (Linux, Windows, UWP) and extensible (with modern software practices). EF Core works with .NET Core but with .NET Core, it is recommended to use EF Core. Of course, all the features are not released yet and there are many features which are missing. The EDMX/Designer is missing in EF Core so model first is not possible with EF Core without using third party tools. EF Core supports both, database-first and code-first, approaches. Database first with EF Core is like; it reverse engineers the existing database which later can be used as code first. So, if you want to say strictly then database first is not fully supported. EF Core supports not only RDBMS(SQL Server, Oracle, etc.) but also non-relational stores and in-memory databases which can be used for unit testing.
In my opinion about workflows, there is no good or bad approach but our specific requirement helps to decide which one to choose. But, whatever flow you choose - never mix different workflows in one project.

European Visual Studio 2017 Hosting - HostForLIFE.eu :: Visual Studio Short Keys And Tips

clock March 22, 2019 11:01 by author Peter

Every developer who uses Visual Studio should know or be familiar with the shortcuts which I am going to share here. I hope it will be helpful to the freshers and even the experienced software developer friends.

Visual Studio Shortcut Keys and Tips

  1. Every developer should learn the difference between the concept of running an application in normal mode and in debug mode. Most of the freshers do not know this concept and run the application using F5 or clicking the RUN button in the menu bar of Visual Studio. But when it comes to the performance of Visual Studio and speed, we should know that F5 is used for running the application in debugging mode and for running the application without debugging, it is Ctrl+F5.

    So, in simple words, if the developer wants to start the application in debugging mode, press F5; otherwise press Ctrl+F5.
  2. To put the breakpoints in the code use F9. For this, we have to put the control at the specific line of code and press F9. Debugging is basically used to check the result or see the values which is coming as per expectation. Now if we run the application the control will come to that specific control and then we can see whether the values are coming as per our expectation or not. If it is the method then we have the concept of step in and step out. We use step in  to get into that specific method and to inspect the values in the method; for this we use F11. Step Out is used to see the output of the method, and the F10 key is used.
  3. As a developer, it is very important to write the code in proper format but most of the developers do not follow it (laughing) as their mind and soul waits to complete the task or module. But after some time of development of the code, they feel that the code should be formatted properly for the sake of better understanding and to troubleshoot (i.e debugging). For that purpose Visual Studio has a formatting concept through which we can format the document. To format the document we can use Ctrl+K,d.
  4. Sometimes, we write code which is not used at present but maybe it will  be needed for some other cases or for some specific attribute afterward for any specific conditions. We can comment the code by using Ctrl+K, C which will comment on the selected code.
  5. To remove a comment for the specific code, we can use Ctrl+K, U in Visual Studio.

Hope these small and useful tips will help you guys. I will provide more shortcuts for developers in the next blog.


Windows Server 2016 SSD Hosting - HostForLIFE.eu :: Server And Service Health Check And IP Capture For Bulk Servers

clock March 14, 2019 11:40 by author Peter

This Script will help in checking the below basic functionalities of the Bulk Servers. It will do so during Migration, Patch and Monthly Restart activities

This Script is added with the below functionalities, 

  1. IP Capture -- >Collects the DNSHostName,Description,DHCPEnabled,IPAddress,IpSubnet,DefaultIPGateway,MACAddress,DNSServerSearchOrder for all Enabled and IP Discovered NICs
  2. Services Status -- >It checks all the Services Automatic set and not Stopped services and provides the output.
  3. Server Status –- >Checks the Servers reachability and provides the output on screen
  4. Server Shutdown/Reboot -- >Checks the server status and perform Bulk Shutdown / Restart at once with Event Description Keyed.

Output Samples

European Visual Studio 2017 Hosting - HostForLIFE.eu :: How To Organize Classes Using Namespaces?

clock February 13, 2019 10:23 by author Peter

Today, in this article, we shall see what namespace actually does and how to organize the classes using namespaces. We use namespaces to organize classes into a logically related hierarchy. Namespaces function as both an internal system for organizing our application and an external way to avoid name collision between source code and application. Because more than one company may create a class with the same name, such as Employee, when we create code, that may be seen or used by third parties. It’s highly recommended that we shall organize our classes by using a hierarchy of namespaces. By practising this, we can avoid interoperability issues on application.

To create a namespace, we simply type a keyword namespace followed by the name. It is recommended to use Pascal case for namespaces.

It is also recommended that you create at least two-tiered namespaces, which is one that contains two levels of classification, separated by a period.

Let us see sample example of a two-tiered namespace.

namespace Infosys.Sales {  
    //define your classes within the namespace  
    public class customer() {}  

Above two-tiered namespace declaration is identical to writing each namespace in nested format, as shown in the following code. 


namespace CompanyName {  
    namespace Sales {  
        public class Customer() {}  

In both cases, we refer to class by using the following code.



We should avoid creating a class with the same name as namespace.

Commonly used namespaces in .NET Framework
Microsoft .NET Framework is made of many namespaces, the most important one being System. The System namespace contains classes that most of the applications use to interact with operating system.

For example, the system namespace contains the console class which provides several methods, including WriteLine, which is a command that enables us to write code to an on-screen console.

We can access WriteLine method of console as follows.

System.Console.WriteLine("Prem Kumar Rathrola");   

A few of other namespaces that are provided by .NET Framework through the system namespace are listed below. 

  • System.Windows.Forms
    Provides the classes that are useful for building applications based on windows. 
  • System.IO
    Provides classes for reading and writing data to files

  • System.Data
    Provides classes that are useful for data access

  • System.Web
    Provides classes that are useful for building web forms applications

Europe SQL 2017 Hosting - HostForLIFE.eu :: Delete Duplicate Rows From a Table in MSSQL 2017

clock January 24, 2019 10:34 by author Peter

For every table, we tend to use a primary key or distinctive key for distinct values, however generally we'll encounter a problem with duplicate records. it's a significant issue with duplicate rows. thus we want to delete duplicate records to resolve it. So here i'll make an example to explain delete duplicate rows in MSSQL 2017 Hosting.

First we create a simple database with one table for membership that contains: a Member's ID, Membership type, Firstname,  Lastname and Birthday:
CREATE TABLE [dbo].[Membership](
[MemberID] [varchar](20) NOT NULL,
[MemberType] [int] NOT NULL,
[Firstname] [varchar](80) NOT NULL,
[Lastname] [varchar](80) NOT NULL,
[Birthday] [date] NOT NULL

Now, insert the following rows into this table:

INSERT INTO dbo.Membership (MemberID, Firstname, Lastname, MemberType, Birthday) VALUES
('001', 'Peter', 'Smith', 1, convert(datetime, '05/23/1988', 0))
INSERT INTO dbo.Membership (MemberID, Firstname, Lastname, MemberType, Birthday) VALUES
('002', 'Scott', 'Davidson', 1, convert(datetime, '07/10/1983', 0))
INSERT INTO dbo.Membership (MemberID, Firstname, Lastname, MemberType, Birthday) VALUES
('002', 'Scott', 'Davidson', 1, convert(datetime, '07/10/1983', 0))

INSERT INTO dbo.Membership (MemberID, Firstname, Lastname, MemberType, Birthday) VALUES
('003', 'Kevin', 'Richard', 1, convert(datetime, '04/24/1985', 0))

We currently have duplicated Scott Davidson’s entry (MemberID 2), with no clearly safe method of removing the duplicate, whereas leaving at least one entry intact. Now, imagine if you had a complete databse of information with a whole lot or thousands of duplicates. Fixing this by hand quickly becomes an impossible task!

To solve this, first we can add an column using the IDENTITY keyword so we currently have a unique method of addressing every row:

We can then we can use:
FROM dbo.Membership GROUP BY MemberID)

Which will properly choose all duplicated records in our database (always worth checking before running the delete query!).  Once we are happy this is working for us, we can then run the delete query:

FROM dbo.Membership GROUP BY MemberID)

Windows Hosting Europe - HostForLIFE.eu :: How To Use ServerSide Processing With jQuery Datatable?

clock January 15, 2019 10:37 by author Peter

What is the benefits of using  ServerSide Processing with JQuery Datatable? I personally found two important benefits of using ServerSide Processing with Datatable. We can handle more data using JQuery Datatable. Data can load quickly from the Database server .

Follow the following steps to use ServerSide processing with Datatable.

Step 1
Add JQuery  Js file  ,and Jquery Datatable css and Js file as shown in the below figure.

Add the following script to your .aspx page.
<!-- DataTables CSS --> 
<link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css"> 

<!—jQuery Js --> 
<script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js"></script> 

<!-- DataTables  JQuery file--> 
<script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js"></script> 

Step 2
Create one WebService to Getdata (Here I am using asp.net WebService to get data). You can see  my Solution Explorer . I have two web pages and one service, and the name of the service is webService.asmx.


Step 3
Create method inside service which will return data to bind Jquery Datatable.
    public void HelloWorld() 
        List<MyClass> lst = new List<MyClass>(); 
        int i = 0; 
        while (i < 10000) 
            lst.Add(new MyClass() { Empid = "1", Name = "Ar"}); 
            lst.Add(new MyClass() { Empid = "2", Name = "Br" }); 
            lst.Add(new MyClass() { Empid = "3", Name = "Cr" }); 
            i = i + 1; 
       var mydata=new DataTable() 
        JavaScriptSerializer js=new JavaScriptSerializer(); 
        js.MaxJsonLength = int.MaxValue; 

In the above code you can see that I have defined one function named HelloWorld. editsInside the HelloWorld function I have used three classes.These three classes are MyClass, DataTable and JavaScriptSerializer. Now defined the MyClass inside the service class as I have defined below.

public class MyClass 

    public string Empid { get; set; } 
    public string Name { get; set; } 

Now define the second class DataTable as I have defined below.
public class DataTable 

    public int iTotalRecords { get; set; } 
    public int iTotalDisplayRecords { get; set; } 
    public List<MyClass> aaData { get; set; } 

JavaScriptSerializer class is  available inside System.Web.Script.Serialization namespace.Add this namespace to your service class.

Design Table from the following code.
<table id="example" class="display" width="100%" cellspacing="0"> 
        <th >Employee Id</th> 
        <th >Name</th> 

Step 5
Now use Ajax to call Service method and bind data to Jquery Datatable as shown in the below code.

$(document).ready(function () 

"bProcessing": true, 
"sAjaxSource": "WebService.asmx/HelloWorld", 
"sServerMethod": "post", 
"aoColumns": [ 

               { mData: 'Empid' }, 
               { mData: 'Name' },  



Step 6
Now run your application and see the result.

About HostForLIFE.eu

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 offered the latest Windows 2016 Hosting, ASP.NET Core 2.2.1 Hosting, ASP.NET MVC 6 Hosting and SQL 2017 Hosting.

Tag cloud

Sign in