Breaking

Sunday, July 5, 2020

11:30 PM

What are the Google Chrome DevTools?


The Google Chrome Developer Tools, also known as Chrome DevTools, are web authoring and debugging tools built right into the browser. They provide developers deeper access into their web applications and the browser. You can do everything from testing the viewport on a mobile device to editing a website on the fly, and even measuring the performance of an entire website or individual assets.
To use the latest version of the developer tools, you may want to use Chrome Canary, which is the experimental version of Chrome that is updated nightly. Chrome Canary can be run side by side with Chrome so you can check any issues that may arise.

You can enhance your development by going to chrome://flags and enabling the Developer Tools experiments feature. You can then use the settings panel in developer tools to toggle individual experiments.

We will be mentioning some of the Chrome DevTools keyboard shortcuts below, but you can see a full list of them on the Google Developer website.

Opening Chrome DevTools
#

There are a few ways to open Chrome DevTools, which means you can use the method that works best for you.

Open from browser menu
#

You can open Chrome DevTools from the Chrome menu. Go to More Tools and then click Developer Tools.

Open by right clicking
#

You can also open Chrome DevTools from the right click menu. Right click on any page element and then click Inspect (or Inspect Element).

Open with keyboard shortcuts#

You can also use the following shortcuts:
  • Mac: Cmd + Opt + I
  • Windows: F12 or Ctrl + Shift + I

Wednesday, July 1, 2020

11:58 PM

To Sign in Remotely, You Need the Right to Sign in Through Remote Desktop Service

When connecting to a Windows computer or server over the RDP, you may encounter an error:
To sign in remotely, you need the right to sign in through Remote Desktop Services. By default, members of the Administrators group have this right, or if the right has been removed from the Administrators group, you need to be granted this right manually.
A common user (non-administrator) can also connect to a computer via RDP if his account is added to the local group Remote Desktop Users (Members in this group are granted the right to logon remotely).
In the same lusrmgr.msc snap-in, check out these group members. If you have administrator privileges on this computer, you can add a user account to this group by clicking the Add button. Enter the name of the user or security group and click OK twice to save the change.
Due to this, the user will have the permission to remotely logon via Remote Desktop, but won’t have local administrator privileges on the computer.

Wednesday, June 24, 2020

9:55 AM

What Is Email Harvesting ?


Most of the Website, we have if ContactUs page where we give company email in normal format (abc@viastudy.com) .the normal format it is easy to pick for email harvester bots which scan or spider through webpages and get your email id to send spam emails. to prevent it you can use below format (abc[at]viastudy[dot]com).

e.g abc@viastudy.com | abc[at]viastudy[dot]com
1:11 AM

How to Increase Import Size Limit in phpMyAdmin ?


I had the same problem
with my working correctly by doing the following
changes into the php.ini file

post_max_size = 800M
upload_max_filesize = 800M
max_execution_time = 5000
max_input_time = 5000
memory_limit = 1000M
now restart for the changes to take effect.

#viastudy
#DurgeshSingh

Tuesday, June 23, 2020

2:37 AM

SQL Server Management Studio performance reports.



Activity Monitor Activity Monitor is one of the features available in SQL Server Management Studio that quickly provides a set of most common performance metric values. What makes it more useful is that no previous setup is needed. Metrics are available at just a couple of clicks.
  1. In SQL Server Management Studio Object Explorer, right-click the SQL Server instance if you want the instance level reports, or the database object node for adequate standards reports
  2. In the context menu, select Reports | Standard reports
  3. Select the report from the list
  1. If you have already viewed some of the reports, the most recent ones will be listed below Custom Reports
  2. If you select Custom reports, you’ll be prompted to navigate to the folder where custom reports are saved. These are the .rdl and .rdlc files. If you haven’t created or used any custom reports on this SQL Server instance, the menu will be empty.
  3. Right-click the report and print it or save as an Excel or PDF file

If you’re looking for quick and basic details about SQL Server performance, SQL Server Management Studio standard reports can help. If you want to monitor your servers constantly, be able to select the performance metrics to monitor and configure their thresholds for alerting, keep history for later analysis, this is not the tool. A specialized SQL Server performance monitoring tool is highly recommended in these cases.


1:55 AM

What is SQL Server Activity Monitor ?


What is SQL Server Activity Monitor?
SQL Server Activity Monitor is a feature in SQL Server Management Studio that displays information about the SQL Server processes and their effect on SQL Server performance.
Activity Monitor panes
Activity Monitor consists of several panes – Overview, Processes, Resource Waits, Data File I/O, and Recent Expensive Queries. Panes can be expanded and collapsed. The activities are queried only when the specific pane is expanded
“Activity Monitor runs queries on the monitored instance to obtain information for the Activity Monitor display panes. When the refresh interval is set to less than 10 seconds, the time that is used to run these queries can affect server performance”.
The Overview pane
The Processes pane
Task State – the task state, blank for tasks in the runnable and sleeping state. The value can also be obtained using the sys.dm_os_tasks view, as the task_state column. The states returned can be:
“PENDING: Waiting for a worker thread.
RUNNABLE: Runnable, but waiting to receive a quantum.
RUNNING: Currently running on the scheduler.
SUSPENDED: Has a worker, but is waiting for an event.
DONE: Completed.
SPINLOOP: Stuck in a spinlock.”
The Resource Waits pane
The Data File I/O pane
The Recent Expensive Queries pane
Requirements to use Activity Monitor
How to start Activity Monitor
There are several ways to start Activity Monitor – in the SQL Server Management Studio toolbar click the activity Monitor icon, use the keyboard shortcut Ctrl+Alt+A, or in Object Explorer right-click the SQL Server instance and select Activity Monitor
One more option is to set Activity Monitor to be opened when SQL Server Management Studio is started
1.     In the SQL Server Management Studio menu click Tools and then Options
2.     Open the Environment | Start Up tab
3.     Select the Open Object Explorer and Activity Monitor option
On the next SQL Server Management Studio start up, Object Explorer will be shown on the left and Activity Monitor on the right
Activity Monitor is a SQL Server Management Studio feature that tracks some of the most important metrics that affect performance. It shows the metrics in real time, without the out-of-the-box solution to save them for later analysis. Filtering by a specific database/parameter is easy, but excluding a specific value is not possible. Monitoring additional metrics is also not possible. Due to its limited set of features and monitored metrics, it’s not recommended for in-depth performance monitoring.

Thursday, June 18, 2020

2:40 AM

XAMPP, Apache - Error: Apache shutdown unexpectedly


I've just re-installed XAMPP, and when I try to start my Apache server in the XAMPP Control Panel, I now get the following errors:

16:50:25  [Apache]     Status change detected: running
16:50:26  [Apache]     Status change detected: stopped
16:50:26  [Apache]     Error: Apache shutdown unexpectedly.
16:50:26  [Apache]     This may be due to a blocked port, missing dependencies,
16:50:26  [Apache]     improper privileges, a crash, or a shutdown by another method.
16:50:26  [Apache]     Press the Logs button to view error logs and check
16:50:26  [Apache]     the Windows Event Viewer for more clues
16:50:26  [Apache]     If you need more help, copy and post this
16:50:26  [Apache]     entire log window on the forums


Answers : 

As I am working in a corporate environment where developers faces firewall issues, none of the other answers resolved my issue.
As the port is not used by Skype, but by some other internal applications, I followed the below steps to resolve the issue:

Step 1 - From the XAMPP Control Panel, under Apache, click the Config button, and select the Apache (httpd.conf).
Inside the httpd.conf file, somehow I found a line that says:
Listen 80
And change the 80 into any number / port you want. In my scenario I’m using port 8080.
Listen 8080
Still from the httpd.conf file, I found another line that says:
ServerName localhost:80
Change 80 to 8080.
ServerName localhost:8080

Step 2 - From the XAMPP Control Panel, under Apache, click the Config button again, but this time select the Apache (httpd-ssl.conf). Inside the httpd-ssl.conf file, find line that says
Listen 443
And change the 443 into any number / port you want. I’ll using 4433 as the new port number.
Listen 4433
Still from the httpd-ssl.conf file, find another line that says

<VirtualHost _default_:443>
ServerName localhost:443
And change 443 to 4433.

<VirtualHost _default_:4433>
ServerName localhost:4433


Remember to save the httpd.conf and httpd-ssl.conf files after performing some changes. Then restart the Apache service.

Wednesday, June 17, 2020

9:44 PM

How to define Methods in Controller ?


Normally, one would want to define multiple methods in the controller to separate the business logic.
For example, suppose if you wanted to have your controller do 2 basic things,

Perform the addition of 2 numbers
Perform the subtraction of 2 numbers
You would then ideally create 2 methods inside of your controller, one to perform the addition and the other to perform the subtraction.

Let's see a simple example of how you can define custom methods within an Angular.JS controller. The controller will simply return a string.

<!DOCTYPE html>
<html>
<head>
 <meta chrset="UTF 8">
<title>Event Registration</title>
 <link rel="stylesheet" href="css/bootstrap.css"/>
</head>
<body ng-app="DemoApp">
<h1> ViASTUDY Global Event</h1>
<script src="lib/angular.js"></script>
<script src="https://code.angularjs.org/1.6.9/angular.js"></script>
<script src="lib/bootstrap.js"></script>
 Tutorial Name :<input type="text" ng-model="tutorialName"><br>
<script src="lib/jquery-1.11.3.min.js"></script>
<div ng-app="DemoApp" ng-controller="DemoController">
 <br>
 This tutorial is {{tutorialName}} 
</div>
 $scope.tName = function() {
<script>
var app = angular.module('DemoApp', []);
app.controller('DemoController', function($scope) {
    $scope.tutorialName = "Angular JS";
</html>
return $scope.tName;
    };
});
</script> 
</body>
    Code Explanation:
    1. Here, we are just defining a function which returns a string of "AngularJS". The function is attached to the scope object via a member variable called tutorialName.
    2. If the command is executed successfully, the following Output will be shown when you run your code in the browser.

angular.module('app',[]).controller('HelloWorldCtrl',function($scope)
{
 $scope.message = "Hello World"
});
    The above code does the following things,
    1. Define a module called "app" which will hold the controller along with the controller functionality.
    2. Create a controller with the name "HelloWorldCtrl". This controller will be used to have a functionality to display a "Hello World" message.
    3. The scope object is used to pass information from the controller to the view. So in our case, the scope object will be used to hold a variable called "message".
    4. We are defining the variable message and assigning the value "Hello World" to it.
    Step 2) Now, in your Sample.html file add a div class which will contain the ng-controller directive and then add a reference to the member variable "message"
    Also don't forget to add a reference to the script file app.js which has the source code for your controller.
    <!DOCTYPE html>
    <html ng-app="app">
    <head>
     <meta chrset="UTF 8">
     <title>Event Registration</title>
     <link rel="stylesheet" href="css/bootstrap.css"/>
    </head>
    <body>
    <h1> ViASTUDY Global Event</h1>
     <div ng-controller="HelloWorldCtrl">{{message}}</div>
    <div class="container">
    </div>
    <script src="lib/angular.js"></script>
    <script src="https://code.angularjs.org/1.6.9/angular.js"></script>
    <script src="app.js"></script>
    <script src="lib/bootstrap.js"></script>
    <script src="lib/jquery-1.11.3.min.js"></script>
    </body>
    </html>
    If the above code is entered correctly, the following Output will be shown when you run your code in the browser.
9:37 PM

AngularJS Controller Tutorial with Example

A Controllers in AngularJs takes the data from the View, processes the data, and then sends that data across to the view which is displayed to the end user. The Controller will have your core business logic.

The controller will use the data model, carry out the required processing and then pass the output to the view which in turn is displayed to the end user.

Following is a simple definition of working of Angular JS Controller.
  • The controller's primary responsibility is to control the data which gets passed to the view. The scope and the view have two-way communication.
  • The properties of the view can call "functions" on the scope. Moreover events on the view can call "methods" on the scope. The below code snippet gives a simple example of a function.
    • The function($scope) which is defined when defining the controller and an internal function which is used to return the concatenation of the $scope.firstName and $scope.lastName.
    • In AngularJS when you define a function as a variable, it is known as a Method.

  • Data in this way pass from the controller to the scope, and then the data passes back and forth from the scope to the view.
  • The scope is used to expose the model to the view. The model can be modified via methods defined in the scope which could be triggered via events from the view. We can define two way model binding from the scope to the model.
  • Controllers should not ideally be used for manipulating the DOM. This should be done by the directives which we will see later on.
  • Best practice is to have controller's based on functionality. For example, if you have a form for input and you need a controller for that, create a controller called "form controller".

    How to build a basic Controller

    Before we start with the creation of a controller, we need to first have our basic HTML page setup in place.
    The below code is a simple HTML page which has a title of "Event Registration" and has references to important libraries such as Bootstrap, jquery and Angular.
    <!DOCTYPE html>
    <html>
    <head>
     <meta chrset="UTF 8">
     <link rel="stylesheet" href="css/bootstrap.css"/>
    </head>
    <body>
    <h1> ViASTUDY Global Event</h1>
    <script src="https://code.angularjs.org/1.6.9/angular.js"></script>
    <script src="lib/angular.js"></script>
    <script src="lib/bootstrap.js"></script>
    <script src="lib/jquery-1.11.3.min.js"></script>
    </body>
    </html>
      1. We are adding references to the bootstrap CSS stylesheets, which will be used in conjunction with the bootstrap libraries.
      2. We are adding references to the angularjs libraries. So now whatever we do with angular.js going forward will be referenced from this library.
      3. We are adding references to the bootstrap library to make our web page more responsive for certain controls.
      4. We have added references to jquery libraries which will be used for DOM manipulation. This is required by Angular because some of the functionality in Angular is dependent on this library.

<!DOCTYPE html>
<html>
<head>
 <meta chrset="UTF 8">
 <link rel="stylesheet" href="css/bootstrap.css"/>
</head>
<body>
<h1> ViASTUDY Global Event</h1>
<script src="https://code.angularjs.org/1.6.9/angular.js"></script>
<script src="lib/angular.js"></script>
<script src="lib/bootstrap.js"></script>
 Tutorial Name : <input type="text" ng-model="tutorialName"><br>
<script src="lib/jquery-1.11.3.min.js"></script>
<div ng-app="DemoApp" ng-controller="DemoController">
 app.controller('DemoController', function($scope){
 This tutorial is {{tutorialName}}
</div>
<script>
 var app = angular.module('DemoApp',[]);
$scope.tutorialName = "Angular JS";
 });
</script>
</body>
</html>
    Code Explanation:
    1. The ng-app keyword is used to denote that this application should be considered as an angular application. Anything that starts with the prefix 'ng' is known as a directive. "DemoApp" is the name given to our Angular.JS application.
    2. We have created a div tag and in this tag we have added an ng-controller directive along with the name of our Controller "DemoController". This basically makes our div tag the ability to access the contents of the Demo Controller. You need to mention the name of the controller under the directive to ensure that you are able to access the functionality defined within the controller.
    3. We are creating a model binding using the ng-model directive. What this does is that it binds the text box for Tutorial Name to be bound to the member variable "tutorialName".
    4. We are creating a member variable called "tutorialName" which will be used to display the information which the user types in the text box for Tutorial Name.
    5. We are creating a module which will attach to our DemoApp application. So this module now becomes part of our application.
    6. In the module, we define a function which assigns a default value of "AngularJS" to our tutorialName variable.
    If the command is executed successfully, the following Output will be shown when you run your code in the browser.

    How to define Methods in Controller ?

5:58 AM

AngularJS Hello World Application: Your First Example Program

The best way to see the power of an AngularJS Application is to create your first basic program "Hello World" app in Angular.JS.
There are many integrated development environments you can use for AngularJS development, some of the popular ones are mentioned below. In our example, we are using Webstorm as our IDE.
1. Webstorm:
2. Sublime Text
3. AngularJS Eclipse
4. Visual Studio

Hello world, AngularJS

The example below shows the easiest way to create your first "Hello world" application in AngularJS.

<!DOCTYPE html>  
<html lang="en">  
<head>  
    <meta charset="utf 8">
<title>ViASTUDY</title>     
<h1 ng-controller="HelloWorldCtrl">{{message}}</h1>
</head>  
<body ng-app="app">
<script src="https://code.angularjs.org/1.6.9/angular.js"></script>
<script>  
    angular.module("app", []).controller("HelloWorldCtrl", function($scope) {  
</html>
$scope.message="Hello World" 
    } )
</script> 
</body>  
</html>
Code Explanation:
  1. The "ng-app" keyword is used to denote that this application should be considered as an angular js application. Any name can be given to this application.
  2. The controller is what is used to hold the business logic. In the h1 tag, we want to access the controller, which will have the logic to display "HelloWorld", so we can say, in this tag we want to access the controller named "HelloWorldCtrl".
  3. We are using a member variable called "message" which is nothing but a placeholder to display the "Hello World" message.
  4. The "script tag" is used to reference the angular.js script which has all the necessary functionality for angular js. Without this reference, if we try to use any AngularJS functions, they will not work.
  5. "Controller" is the place where we are actually creating our business logic, which is our controller. The specifics of each keyword will be explained in the subsequent chapters. What is important to note that we are defining a controller method called 'HelloWorldCtrl' which is being referenced in Step2.
  6. We are creating a "function" which will be called when our code calls this controller. The $scope object is a special object in AngularJS which is a global object used within Angular.js. The $scope object is used to manage the data between the controller and the view.
  7. We are creating a member variable called "message", assigning it the value of "HelloWorld" and attaching the member variable to the scope object.
NOTE: The ng-controller directive is a keyword defined in AngularJS (step#2) and is used to define controllers in your application. Here in our application, we have used the ng-controller keyword to define a controller named 'HelloWorldCtrl'. The actual logic for the controller will be created in (step#5).
If the command is executed successfully, the following Output will be shown when you run your code in the browser.
Output:
The message 'Hello World' will be displayed.
5:45 AM

What is AngularJS? Architecture & Features !

AngularJS is an open source Model-View-Controller framework which is similar to the JavaScript framework.
Angular JS is probably one of the most popular modern day web frameworks available today. This framework is used for developing mostly Single Page applications. This framework has been developed by a group of developers from Google itself.
Because of the sheer support of Google and ideas from a wide community forum, the framework is always kept up to date. Also, it always incorporates the latest development trends in the market.

AngularJS Features

Angular has the following key features which makes it one of the powerful frameworks in the market.
  1. MVC – The framework is built on the famous concept of MVC (Model-View-Controller). This is a design pattern used in all modern day web applications. This pattern is based on splitting the business logic layer, the data layer, and presentation layer into separate sections. The division into different sections is done so that each one could be managed more easily.
  1. Data Model Binding – You don't need to write special code to bind data to the HTML controls. This can be done by Angular by just adding a few snippets of code.
  2. Writing less code – When carrying out DOM manipulation a lot of JavaScript was required to be written to design any application. But with Angular, you will be amazed with the lesser amount of code you need to write for DOM manipulation.
  3. Unit Testing ready – The designers at Google not only developed Angular but also developed a testing framework called "Karma" which helps in designing unit tests for AngularJS applications.

AngularJS Architecture

Angular.js follows the MVC architecture, the diagram of the MVC framework as shown below.
  • The Controller represents the layer that has the business logic. User events trigger the functions which are stored inside your controller. The user events are part of the controller.
  • Views are used to represent the presentation layer which is provided to the end users
  • Models are used to represent your data. The data in your model can be as simple as just having primitive declarations. For example, if you are maintaining a student application, your data model could just have a student id and a name. Or it can also be complex by having a structured data model. If you are maintaining a car ownership application, you can have structures to define the vehicle itself in terms of its engine capacity, seating capacity, etc.

AngularJS Advantages

  • Since it's an open source framework, you can expect the number of errors or issues to be minimal.
  • Two-way binding – Angular.js keeps the data and presentation layer in sync. Now you don't need to write additional JavaScript code to keep the data in your HTML code and your data later in sync. Angular.js will automatically do this for you. You just need to specify which control is bound to which part of your model.
  • Routing – Angular can take care of routing which means moving from one view to another. This is the key fundamental of single page applications; wherein you can move to different functionalities in your web application based on user interaction but still stay on the same page.
  • Angular supports testing, both Unit Testing, and Integration Testing.
  • It extends HTML by providing its own elements called directives. At a high level, directives are markers on a DOM element (such as an attribute, element name, and comment or CSS class) that tell AngularJS's HTML compiler to attach a specified behavior to that DOM element. These directives help in extending the functionality of existing HTML elements to give more power to your web application.

Saturday, June 13, 2020

10:35 PM

How can I list all foreign keys referencing a given table in SQL Server?


Not sure why no one suggested but I use sp_fkeys to query foreign keys for a given table:

EXEC sp_fkeys 'TableName'

You can also specify the schema:

EXEC sp_fkeys @pktable_name = 'TableName', @pktable_owner = 'dbo'

Without specifying the schema, the docs state the following:

If pktable_owner is not specified, the default table visibility rules of the underlying DBMS apply.

In SQL Server, if the current user owns a table with the specified name, that table's columns are returned. If pktable_owner is not specified and the current user does not own a table with the specified pktable_name, the procedure looks for a table with the specified pktable_name owned by the database owner. If one exists, that table's columns are returned.

Friday, June 5, 2020

12:39 AM

How to make MySQL public access from aws server ?

If you're reading this article you've probably attempted to access the phpMyAdmin link in XAMPP only to receive the following "Forbidden Access" error:

When you try to access through ip: 198.162.1.1:80/phpmyadmin

This article will show you how to fix this issue on Mac. If you're using a PC the solution is the same but navigating the steps will look a little different on your computer.

I am using a MacBook Pro running macOS Mojave v.10.14.6

Before we get started make sure you have completed the following:
  • Installed and opened XAMPP
  • Started running your stack services: ProFTPD, Apache, and MySQL

How to Fix XAMPP Error 403

Step 1: Open Volumes tab in XAMPP app
Step 2: Goto the Config -> httpd-xampp.conf -> then go to below block of code:

Alias /phpmyadmin "C:/xampp/phpMyAdmin/"
    <Directory "C:/xampp/phpMyAdmin">
        AllowOverride AuthConfig
        Require local // change to Require all granted
        ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var

    </Directory>

Yuck! during development and seeing unforced/unwanted errors… after all a few mins R&D and research , i got a solution at two different websites … but individually they were bit incomplete and on combining both solutions , i got the issue resolved 🙂