Sunday, 15 July 2018

Azure Essentials - Most Popular Questions & Answers 44

1. Azure is Microsoft’s ___________ as a Service Web hosting service.
Ans: Infrasturcture
2. When using Azure Resource Manager, you can use a _______________ for deployment, which can build identical environments for different work scenarios such as testing, staging, and production. 
Ans: Template
3. Which one of the following serives is a NoSQL datastore? 
Ans: Tables
4. If you have to replace your current on-premise services in the form of virtual machines, then you can use Microsoft Azure cloud categorized as ____________. 
Ans: IAAS
5. You can view the latest data center map and Pay as You Go subscription information in (the) ________? 
Ans: Azure Dash Board
6. In which operating system, we can use Azure PowerShell? 
Ans: Windows OS
7. Which cloud offering focuses on the consumption of services? 
Ans: SaaS
8. Which of the following is the older service management model, where cloud services contain your cloud resources? 
Ans: Classic Portal
9. The new Azure Portal is accessed using ___________.   
Ans: https:\\portal.azure.com
10. Which Azure networking component is the core unit from which administrators can have full control over IP address assignments, name resolution, security settings, and routing rules? 
Ans: Virtual Networks (VNETs)
11. Which connection configuration offers faster speeds, higher security, lower latencies and higher reliability? 
Ans: ExpressRoute
12. When should you use a static IP address? 
Ans: DNS Server
13. A subnet is a range of IP addresses in a 
Ans: VNet
14. Default Private IP address allocation method is _________. 
Ans: dynamic
15. ___is used to route the traffic between virtual machines inside your pirvate virtual network. 
Ans: Azure Internal Load Balancers
16. The smallest recommended virtual machine size in Azure for a production environment is 
Ans: A1
17. You can estimate costs you will incur on Azure by using which tool 
Ans: Pricing Calculator
18. You need to deploy a virtual machine on Azure with a low memory entry level requirement. Which virtual machine sizes should you consider choosing? 
Ans: Basic_A0- Basic_A4
19. To how many resource groups can a resource be added 
Ans: 1
20. Which of the following Windows Server roles is not supported on Azure Virtual Machines 
Ans: Hyper-v
21. Most types of resource can be moved to a different resource group at 
Ans: Anytime
22. Which of the following helps Azure maintain high availability and fault tolerance when deploying and upgrading applications.
Ans: Availability set
23. Azure supports both .vhd and .vhdx file formats for Virtual Machines. 
Ans: False
24. Azure Virtual Machines only support VM's running Microsoft Windows operating system. 
Ans: False
25. The VM size determines the number of __________. 
Ans: Nic
26. Which type of storage offering uses SSDs and is intended for use with Virtual machines 
Ans: Premium
27. Geo Redundancy is to provide high availability in ________. 
Ans: Geographically
28. What type of storage account is backed by magnetic drives and provides the lowest cost per GB 
Ans: Standard
29. Premium storage disks for virtual machines support up to 64 TBs of storage 
Ans: True
30. If you choose this redundancy strategy, you cannot convert to another redundancy strategy without creating a new storage account and copying the data to the account. 
Ans: ZRS
31. Geo-replication is enabled by default in Windows Azure Storage 
Ans: Yes
32. In which type of Storage replication, data is not replicated across multiple datacenters? 
Ans: LRS
33. The maximum size for a file share is 5 TBs. 
Ans: True
34. Your Azure storage account is always replicated to ensure durability and high availability. By default, which of the following replications schemes is used? 
Ans: RA-GRS
35. You add a data disk to an Azure virtual machine. What drive type is created? 
Ans: SCSI
36. Is it possible to create a custom Domain name, or use your organizations domain name, such as fresco.com, in Azure Active Directory? 
Ans: True
37. Microsoft Azure Active Directory can be integrated with on-premises Active Directory to allow single sign-on. 
Ans: True
38. Which of the following individual components are included on HDInsight clusters 
Ans: Spark
39. Which of the following is also known as Compute 

Ans: Set of virtual machine instances
40. Which of the following is a worldwide content caching and delivery system for Windows Azure blob content 
Ans: CDN
41. Microsoft and Hortonworks joined their forces to make Hadoop available on ___________ for on-premise deployments
Ans:
Windows Server
42. The connection between storage and Microsoft’s CDN (Content Delivery Network) is stated to be at least _______ percent available
Ans: 99.9
43. Azure Storage plays the same role in Azure that ______ plays in Amazon Web Services. 
Ans: S3
44. What’s the maximum bandwidth provided by ExpressRoute? 
Ans: 10 Gbps

45. What is the format of an Azure Resource Template? 

Ans: JSON

46. Azure data is replicated ________ times for data protection and writes are checked for consistency.

Ans: Three


If you have more collection of questions?? or If you find any wrong answers from the above?? Feel free to comment below.



Saturday, 17 February 2018

Solution: How to get single column value returning from mysql function 1

Are you using MySQL function? Is it returning any single value? Then you may confused, how to get that value from record set after executing query. You will get idea after reading this detailed post.

Okay... Let we write one simple function named mytest(), and make it returns TRUE. Then we will see how to get and assign that TRUE to our server side script variable. 
DELIMITER $$
CREATE  FUNCTION `mytest`() RETURNS char(100) CHARSET utf8
BEGIN
RETURN 'TRUE';

END$$
DELIMITER ;
To run this function we need to use this below query.
SELECT mytest();
After running this query, We will get an out put like this below screenshot.

MySQL function return




So, We can't consider mytest() as column name when your are trying to get the value TRUE from returned record set because of that parenthesis. Correct?

To solve this we are just going to assign Alice name to that function.
SELECT mytest() AS returnval;
After running this query, We will get an out put like this below screenshot.





Now, We can use returnval as a column name and we can able to get it's value TRUE from returned record set.

Have any doubt??? Feel free to comment here!!!

Saturday, 13 May 2017

Add number of days to a Date in javascript 1

Problem:

Add number of days to a Date in javascript / Add number of days to current date in javascript

Solution:

To add number of days to a Date, we need to convert our date string to a date object. Here we are going to use javascript inheritance property (prototype) to do that.

Actual function :

Date.prototype.addDays = function(days){
     return new Date(this.getTime()+days*24*60*60*1000);
 }
In this function we are going to convert days to milliseconds using days*24*60*60*1000 and adding to our date object.

Code usage :

var ourDate = new Date('2014','11','12');
/*for current date just use below line of code instead of above line
var ourDate = new Date();
*/
//Now we are going to add 100 days to our date object.
var futureDate = ourDate.addDays(100);



How to set root password for mysql server 2

Simply follow these two steps.

open command prompt or console. change control to in where mysql.exe is located. Mostly it will located inside mysql's bin directory.

You have to execute the following command

mysqladmin -u root password 'your_root_password'

replace 'your_root_password' with your desired password.

or simply you can run this sql command in your query window.

SET PASSWORD FOR root@localhost = PASSWORD('your_root_password');




Saturday, 27 February 2016

[Solution] How to limit text in php? 0

Do you wanna show limited text of long text content? if you are using php, then use this simple handy function, else use this logic to build your own function in your programming language.

Here is the procedure we used to create our handy function.

  • First we will apply strip_tags() function on our string to avoid breaking any html. 
  • And then compare our string length with limit parameter. If string length is lesser than limit parameter value, then return the same string. If it is greater than limit parameter value, then turncate the string using substr() function with our limit parameter.
  • To avoid breaking word, check the string ending with any words, If it is a separated with space,  then break it up.


Function definition:
function limitText($string, $limit=200, $concatStr){
     //strip tags to avoid breaking any html
     $string = strip_tags($string);
     if(strlen($string) > $limit){
          //turncate string
          $stringCut = substr($string,0,$limit+1);
          //make sure it ends in a word.
          //if the ending word is a long text and it exceeds the limit, then break it up
          $string = (strrpos($stringCut, ' '))?substr($stringCut,0,strrpos($stringCut, ' ')).$concatStr:$stringCut.$concatStr;
     }
     return $string;
}
Function usage:
$limitedText = limitText($string, 100, '...');

Have any doubt, feel free to comment here!

Saturday, 11 July 2015

[Solution] Unable to load or find PHP extension php_intl.dll in WAMP 0

Recently I was started to working with CakePHP 3.x. The latest version of CakePHP needed intl extension to work with it. But I could not enable intl extension in my latest version of Wamp 2.5. So, I have got an error,

PHP Startup : Unable to load dynamic library C:/wamp/path/to/php/ext/php_intl.dll - The specified module could not be found.

We can solve it in a two ways.

Solution 1:

  1. Just go to C:/wamp/path/to/bin/php/php5.5.12/. Copy all the files starts with icu* and paste it into C:/wamp/path/to/bin/apache/apache2.2.22/bin/  directory.
  2. To enable intl extension,
    • Click on the wamp icon
    • Click on PHP
    • Click PHP extensions
    • Click on php_intl
  3. Now Restart All Services. 
Thats all... Your intl extension is enabled now... 

Solution 2:

  1. Just include the PHP directory into the system's PATH variable.
  2. Install the full Microsoft VC++ 2012 Runtime Redistributable package. Make sure to get the 32 bit version for 32 bit PHP builds.
Have any doubt, feel free to comment here!

Friday, 3 July 2015

How to use plug-in's component in our application controller - CakePHP 3 0

Here is a small How to about creating and using plugin component in application controller.

Here we are going to create 'TestingComponent' inside of 'Test' plugin, Then get 'Hello world' text from component function and print it from our application's controller.

first create 'TestComponent' class in 'YourCakeDirectory\Plugins\Test\src\Controller\Component\TestComponent.php'

Here is the most important thing we have to do with our plugin load in CakePHP bootstrap. Before calling plug-in component in application controller, we need to auto load it in CakePHP. If our plugin created using bake method, we should autoload this class in 'composer.json'. If our plugin was manually created, then we should use 'autoload' parameter as a value 'true' as a configuration parameter while loading this plugin in application's 'YourCakeDirecctory\Config\bootstrap.php'.
The bellow one is a way to load component in controller on the fly.
Now we are going to load plugin's component. So we need to use our plugin component name followed by plugin name and dot('.'). Here we are going to load 'TestingComponent' from the plugin 'Test'. So, the code will be like the bellow,

Now we will get the output of plugin's component string 'Hello World' which is echoed from our application's controller.

Have any doubt, feel free to comment here!

Monday, 4 May 2015

How to get relative path in javascript 0

Problem

We can't easily get relative paths in javascript as like server side scripts. We have use our own logic to get it. Hard coding server root path in javascript is really bad idea. So, We are going to get our server root path from already loaded resource.


Why I need this?

If you are going to do use redirection or want to load any other resource which is located another directory in your server root directory, you may need server root path. On that time you should need this.

Solution

 Assume, we are having "http://sampledomain.com" and our assets in webroot directory. consider we have an external javascript file called "sample.js", add id attribute to your script tag.

And simply get the location of your javascript file during run time using javascript by parsing the DOM for the 'src' attribute that referred it:

Now we can call getRootPath() function to get the server root path. So, by our example our javascript function getRootPath() will return "http://sampledomain.com"

We can also use this as webroot path by removing "webroot" string from the replace function. If we did this, we will get "http://sampledomain.com/webroot" from the returned string.


Have any doubt, feel free to comment here!

Thursday, 26 February 2015

How to get sql dump using command prompt in WAMP 0

To get a mysql dump of a database in wamp, first we need to set our mysql path using set path command. The example is given below.
  

set path=c:\wamp\bin\mysql\mysql5.1.36\bin

Replace c:\wamp\bin\mysql\mysql5.1.36\bin with your mysql bin directory path.

Then use the below command to export our database.
 
mysqldump -u YourUserName -p YourDatabaseName > sqlDumpFileName.sql

YourUserName will be our mysql username. And YourDatabaseName will be our DataBase name. Then command prompt will ask for the mysql password. Your should enter your mysql password to get your sql dump of your database.

Have any doubt, feel free to comment here!

Tuesday, 4 November 2014

Live Digital Clock - Javascript 0

Here is the code for Live digital clock.

Just we are going write a function to get the current time and display it in span. We are calling that function for each 1000 milli seconds. so, live clock is working.

var int=self.setInterval("clock()",1000);
function clock(){
var now=new Date();
var time=now.toLocaleTimeString();
document.getElementById("clock").textContent=time;
};
 Here is the live Demo

Thanks Christian White