Tuesday, December 12, 2017

How to create a file, write, read and append to file in python

In the post I will show how to create a File, Write, read and append in python.

Before that lets see the File Modes in Python


File Modes in Python
Mode
Description
'r'
Open a file for reading. (by default)
'w'
Open a file for writing. Creates a new file if it does not exist or deleates the file if it exists.
'x'
Open a file for exclusive creation. If the file already exists, the operation fails.
'a'
Open for appending at the end of the file without replacing it. Creates a new file if it does not exist.
't'
Open in text mode. (by default)
'b'
Open in binary mode.
'+'
Open a file for updating (reading and writing)


Sunday, November 26, 2017

Saturday, July 1, 2017

How to set up your user account to Hibernate on critical battery level in Ubuntu

In this post I will show how to hibernate Ubuntu on critical battery level.
In the previous posts I had shown How to...
Set critical battery percentage using the command in terminal

gsettings get org.gnome.settings-daemon.plugins.power percentage-critical

To modify this value, set to 20% by using the below command in the terminal

How can I hibernate on Ubuntu 16.04?

In this post I will show how to Enable Hibernate in Ubuntu.

In the previous posts I had shown How to...
OutPut:

Cannot Start Omnisharp [ERROR] Error: spawn cmd ENOENT VS Code

In the previous posts I had shown How to...

As the title says Cannot Start Omnisharp [ERROR] Error: spawn cmd ENOENT VS Code in Windows 10, follow the below steps.

Press WindowsKey + x and select System as shown below

Sunday, June 11, 2017

How to create cron job in ubuntu

In this POST I will show how to create a cron job in Ubuntu. For this we will use python script to print current date and time in log file.

In the previous posts I had shown How to....
OutPut:

2017-06-10 21:35:01.655477
2017-06-10 21:36:01.686346
2017-06-10 21:37:01.711900
2017-06-10 21:38:01.740353
2017-06-10 21:39:01.767497
2017-06-10 21:40:01.792622
2017-06-10 21:41:01.823149

Saturday, June 10, 2017

How To Install WordPress, Apache, MySQL and PHP on Ubuntu 16.04

In this post I will show, how to install WordPress, Apache, MySQL and PHP on Ubuntu 16.04.

Install Apache:

When you’re done installing Apache2, the below commands allow you to start it up

sudo apt-get update
sudo apt-get install apache2

sudo systemctl start apache2
         OR
sudo service apache2 start

Failed to start mongod.service unit mongod.service not found. ubuntu 16.04

In this post I will show you how to resolve Failed to start mongod.service unit mongod.service not found.

Previously I had shown how to install MongoDB on Ubuntu & Windows

First Open Terminal and enter the below command.

sudo vim /etc/systemd/system/mongodb.service
Now it should look as shown below.























How to Install MongoDB on Ubuntu 16.04

In this post I will show how to Install MongoDB on Ubuntu 16.04.
Previously I had shown how to install MongoDB on Windows

Execute the following commands in the terminal one by one

Wednesday, May 24, 2017

Reset MySQL root password in Ubuntu

In this POST I will show how to reset MySQL Server root password in Ubuntu

In the previous posts I had shown how to .....

Use the following steps to reset a MySQL root password by using the command line interface in Linux.
Stop the MySQL service
  

sudo /etc/init.d/mysql stop

Start MySQL without a password

Tuesday, May 23, 2017

Send Email Using ASP.NET CORE 1.1 With MailKit using VS Code in Ubuntu

In this post I will show you how to Send Email Using ASP.NET CORE 1.1 With MailKit using Visual Studio Code in Ubuntu.

OutPut:




















Saturday, May 20, 2017

Asp.Net MVC Core in UBUNTU and VS Code

In the previous POSTS I had shown how to
Previously I had shown CRUD operations Using Asp.Net MVC Core with Visual studio 2017 in Windows. 
IN this post I will show how to create new Asp.Net MVC project and how to use Visual Studio Code.

Starting with Asp.Net Core using Visual Studio Jquery DataTables

In this post I will show you how to use Jquery DatTables in Asp.Net MVC Core 1.1, EntityFrameworkCore, LINQ Dynamic Core. Previously I had shown how to...
OutPut:

Thursday, March 16, 2017

Starting with Asp.Net Core using Visual Studio to Display Employee List

In this post I will show you how to ADD EntityFrameworkCore Packages and Display the list of Employees.

In the Previous post
01 - Starting with Asp.Net Core using Visual Studio
I used Visual Studio 2015 Update 3. But unfortunately it is not working as Expected, so from this post I will use Visual Studio 2017.
Out Put:

Saturday, March 4, 2017

FileUpload in ASP.Net MVC using Ajax

In this post I will show you how to upload multiple files using Ajax in MVC.
Continuing the previous post FileUpload in ASP.Net MVC or you can create new project.
Previously I had shown How to...
MVC:
Output:

how to use ckeditor in asp.net mvc

In this post I will show you how to use ckeditor in asp.net mvc.
Previously I had shown How to...
MVC:

Output:



















FileUpload in ASP.Net MVC

Here I will show you How to upload files in Asp.Net MVC.
Previously I had shown How to...
MVC:
Output:

Friday, February 17, 2017

Asynchronous Requests for CRUD operations in Asp.Net MVC

In this post I will show how to use Asynchronous Requests in Asp.Net MVC. To continue this POST lets go through
for better understanding. we will change the above Synchronous post. In this post we can do CRUD operations using Bootstrap Modal, display data using Jquery DataTables and printing, exporting using jquery DataTables buttons.

Output:
According to Microsoft Asynchronous Requests means:
In web applications that sees a large number of concurrent requests at start-up or has a bursty load (where concurrency increases suddenly), making these web service calls asynchronous will increase the responsiveness of your application. An asynchronous request takes the same amount of time to process as a synchronous request. For example, if a request makes a web service call that requires two seconds to complete, the request takes two seconds whether it is performed synchronously or asynchronously. However, during an asynchronous call, a thread is not blocked from responding to other requests while it waits for the first request to complete. Therefore, asynchronous requests prevent request queuing and thread pool growth when there are many concurrent requests that invoke long-running operations.

Wednesday, February 1, 2017

Jquery validator with custom messages

In this post I will show how to use jquery validator with custom error messages.
Containing the How to use Jquery Validator

Output:

Sunday, January 29, 2017

How to use AutoMapper

Here in this Post I will show How to use AutoMapper.
Before that what is the necessity to use AutoMapper, when we are using ViewModels in Asp.Net MVC we need to map each and every column individually.

Suppose take a table of Employee with multiple columns as shown.
(Table) Employee: ID, FirstName, LastName, Gender, Salary, DOJ and DeptID

(ViewModel) EmployeeVM:

public int ID { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Gender { get; set; }
public int Salary { get; set; }
public DateTime DOJ { get; set; }
public int DeptID { get; set; }

To Insert New Employee, we need to map (ViewModel) EmployeeVM and (Model) Employee as shown below.
  

public void ADDEmployee(EmployeeVM e)
{
 Employee emp = new Employee();
 emp.ID = e.ID;
 emp.FirstName = e.FirstName;
 emp.LastName = e.LastName;
 emp.Gender = e.Gender;
 emp.Salary = e.Salary;
 emp.DOJ = e.DOJ;

 ent.Employees.Add(emp);
 ent.SaveChanges();
}

Supplose the Employee table had more columns like 20+... We need to map them one by one. Instead of doing that manually we will use AutoMapper.
Now Lets see how to use it for the above Employee table and EmployeeVM (ViewModel).

CRUD operations using Bootstrap Modal in Asp.Net MVC

In this post I will show how to CRUD operations in Asp.Net MVC using Bootstrap Modal and display records using Jquery DataTables with Exporting and printing.

Previously I had shown how to....
MVC:
Output:

Sunday, January 22, 2017

Display message when user is not authorized in mvc

In this post I will show how to Display Error message when user is not Authorized, Continuing the previous POST i.e.,
Customizing Authorize attribute or Role based Authentication or Authorization in MVC

Previously I had shown how to....
DataTables in MVC:
OutPut:

Customizing Authorize attribute or Role based Authentication or Authorization in MVC

As the TITLE says Customizing Authorize attribute, In this post I will show how to create a Customized Authorize attribute and use it. This is used to redirect the user to Home Page when he/she is authenticated and not authorized i.e, when the Authorize attribute generated 401 response it will redirect to Login page.
Previously I had shown how to...
DataTables in MVC:
AngularJS:
By creating a CustomAuthorize class which inherits AuthorizeAttribute we can redirect the user to home page instead of a login page.
How to use?
  

[CustomAuthorize(Roles = "Admin")]
public ActionResult Index()
{
 return View();
}

Friday, January 20, 2017

How to create Extension Methods in C#

In this post I will show you how to create Extension Methods for Date Format (dd-MM-yyyy).
In the previous posts I had shown How to...

DataTables in MVC:
AngularJS:

Ajax helper Based Search in MVC

In this post I will show how to use Ajax Helper for searching as shown below.
Previously I had shown How to use
DataTables:  Code First Migrations in MVC 5Jquery DataTable in MVCJquery DataTable multisearch paging and Sorting in MVC server sideJquery DataTable paging, Sorting and Multi search with datepicker in MVC server sideCascading DropDowns in Asp.Net MVC


Out Put:














Thursday, January 19, 2017

AngularJS with Web Api in Asp.net MVC using Token based Authentication

Here in this Post I will show how to use Token based Authentication using AngularJS and Web Api 2 in Asp.Net MVC. Previous posts I had shown how to
DataTables in MVC:
AngularJS:



















Datatable Exporting with AngularJS and asp.net mvc

Continuing the previous Posts in AngularJS
In the previous posts I had shown

DataTables in MVC:
AngularJS:
Image and video hosting by TinyPic

















Datatables Column Filter with AngularJS and asp.net mvc

Continuing the previous Post from HERE
In the previous posts I had shown
DataTables in MVC:

AngularJS:

Image and video hosting by TinyPic

















Datatables in AngularJS and asp.net mvc

Here I will show how to use JQuery DataTables with AngularJS in Asp.Net MVC.
In the previous posts I had shown

DataTables in MVC:
AngularJS:
Image and video hosting by TinyPic















Thursday, January 5, 2017