Tuesday 19 April 2022

Fatal error: Cannot redeclare Function() in PhP

Fatal error: Cannot redeclare count_words() (previously declared) in PhP
Solution
1. Don't declare a function inside a loop. Declare before them.
or
You should include the file (wherein that function exists) only once. So instead of
include ("function.php");
use     
include_once("function.php");


Monday 18 April 2022

Integrate TinyMCE Editor in PhP

1. Download the latest version of TinyMCE SDK 

    https://www.tiny.cloud/get-tiny/

2. Extract the folder [tinymce] and put in your application root folder.

eg: C:\xampp\htdocs\tinymcedemo\tinymce [tinymcedemo is the root folder]

3. Create a php file "test.php" and place the below code 

<!DOCTYPE html>
<html>
<head>
  <script src="tinymce/tinymce.min.js"></script>
  <script type="text/javascript">
  tinymce.init({
    selector: '#mytextarea'
  });
  </script>
</head>
<body>
  <h1>TinyMCE </h1>
  <form method="post">
    <textarea id="mytextarea"></textarea>
  </form>
</body>
</html>

How to disable phpinfo() in a hosting environment?

Login to server WHM as a root user

Edit the php.ini file. Add below line

disable_functions = phpinfo

Restart the server

Friday 15 April 2022

Fatal error: Cannot pass parameter by reference in PHP

Fatal error: Cannot pass parameter  by reference in PHP.

$stmt->bind_param("ssss",$userid,$theme,$title,"test");

The error is with 'test' in the bind_param call.

All parameters to bind_param must be passed by reference. A string is a primitive value, and cannot be passed by reference.

You can fix this by creating a variable and passing that as a parameter instead:

$testvar="test";

$stmt->bind_param("ssss",$userid,$theme,$title,$testvar);

Enable or disable the "Powered by TinyMCE" branding.

Tinymce branding property allow you to enable or disable the "Powered by TinyMCE" branding.

tinymce.init({
  selector: 'textarea',  
  branding: false
});

Thursday 14 November 2019

Adding Excel export button hides/removes the Page Length Dropdown in Data Tables

Add below line in javascript table initialization

"dom": '<"top"Bf>rt<"bottom"lip><"clear">'

Complete Code 
<script>
        $(document).ready(function () {       
        $('#example').DataTable( {
                "processing": true,               
                "lengthMenu": [[25, 50, -1], [ 25, 50, "All"]],
                "dom": '<"top"Bf>rt<"bottom"lip><"clear">',
                "serverSide": true,
                "ajax": "server_processing.php"
            } );
        });                     

</script>

Friday 27 May 2016

Cloud Computing

Cloud computing is a model for enabling ubiquitous,convenient,on- demand network access to a shared pool of configurable computing resources(e.g.,networks, servers, storage, applications, and  services) that can be rapidly provisioned and released with minimal management effort or service provider interaction.(byNIST)

“an Internet based computing paradigm that delivers on-demand software and hardware computing capability as a ‘service’ through virtualization where the end user is completely abstracted from the computing resources”

3-4-5 Rule

3 : Services
4 : Deployment Models
5 : Characteristics

3 : Services

1. IaaS (Infrastructure as a Service)

The capability provided to the consumer is to provision processing, storage, networks, and other fundamental computing resources where the consumer is able to deploy and run arbitrary software, which can include operating systems and applications. The consumer does not manage or control the underlying cloud infrastructure but has control over operating systems, storage, deployed applications, and possibly limited control of select networking components (e.g., host firewalls)





2. PaaS (Platform as a Service)

The capability provided to the consumer is to deploy onto the cloud infrastructure consumer-created or acquired applications created using programming languages and tools supported by the provider. The consumer does not manage or control the underlying cloud infrastructure including network, servers, operating systems, or storage, but has control over the deployed applications and possibly application hosting environment configurations


Windows Azure, Google App Engine, Hadoop, etc. are some well-known PaaS platforms

3. SaaS (Software as a Service)

The capability provided to the consumer is to use the provider's applications running on a cloud infrastructure. The applications are accessible from various client devices through a thin client interface such as a web browser (e.g., web-based email). The consumer does not manage or control the underlying cloud infrastructure including network, servers, operating systems, storage, or even individual application capabilities, with the possible exception of limited user-specific application configuration settings



Moto: “No Software
Ex: Salesforce.com for CRM, Google Docs for document sharing, and web email systems like Gmail, Hotmail, and Yahoo! Mail


Cloud Service Models