Efficiently distributing of incoming network traffic across a group of backend servers, also known as a server farm or server pool is called Load Balancing.. Modern high-traffic websites must serve thousands, of concurrent requests from users/clients and should return the correct text, images, video, or application data, all in a fast and reliable manner. To cost-effectively scale our server architecture ... Read More »
Abstract Class vs Interface in php
In this article along with the demo project I will discuss Abstract class vs Interface in php. The concept of Abstract classes and Interfaces is a bit confusing for beginners of Object Oriented programming. Therefore, I am trying to discuss the theoretical aspects of both the concepts and compare their usage. And finally I will demonstrate how to use them ... Read More »
Install oauth wampserver
To install Oauth on wampserver, please follow undermentioned steps: Ok I’m admittedly new to this Oauth business but I’m trying to build an app that uses it. I searched around and it looks like the easiest way to get Oauth installed on a windows machine is to get a precompiled dll from here. (ctrl-f and search for ‘oauth’, choose the ... Read More »
UML interview questions and answers
UML interview questions and answers are as follows: What is UML? UML is Unified Modeling Language. It is a graphical language for visualizing specifying constructing and documenting the artifacts of the system. It allows you to create a blue print of all the aspects of the system, before actually physically implementing the system. What is modeling? What are the advantages ... Read More »
OOPS interview qestions in PHP
There are few OOPS based questions that are frequently asked in interviews. So, here are few OOPS interview questions in PHP. Abstraction vs. Encapsulation encapsulation is wrapping up of a data into single unit and abstraction is hiding unnecessary background details and representing only important and essential detail Encapsulation protects abstractions. Encapsulation is the bodyguard; abstraction is the VIP. Encapsulation ... Read More »
Convert pdf to png ImageMagick
Convert pdf to png imagemagick can be done as convert input.pdf output.png Or if you have PHP5 and the ImageMagik library… $image = new Imagick(‘input.pdf[pagenumber]’); $image->setResolution( 300, 300 ); $image->setImageFormat( “png” ); $image->writeImage(‘output.png’); Read More »
get dpi of image in php
To get DPI of image in PHP, you can use the following code <?php function get_dpi($filename){ // open the file and read first 20 bytes. $a = fopen($filename,’r’); $string = fread($a,20); fclose($a); // get the value of byte 14th up to 18th $data = bin2hex(substr($string,14,4)); $x = substr($data,0,4); $y = substr($data,4,4); return array(hexdec($x),hexdec($y)); } // sample, output the result: print_r(get_dpi(‘demo_files/abc.png’)); ... Read More »
Increase website performance
Hi All, The following are few points that I just wanted to share with you all. These points are the basic that should be kept in mind to increase website performance . HAPPY CODING Don’t use .htaccess Lock all ports down Stop ping Cut Apache modules down to bare minimum required for security Do not install all PHP modules Benchmark ... Read More »
Image manipulation class in php
/* Image Manipulation class in php */ class ImageManipulation { /** * An array to hold the settings for the image. Default values for * images are set here. * * @var array */ public $image = array(‘targetx’=>0, ‘targety’=>0, ‘quality’=>75); /** * A boolean value to detect if an image has not been created. This * can be used to ... Read More »
change image color using php
You can change image color using PHP GD library to sepia or b/w or grayscale. Here is the sample example. Change Color to Greyscale //to black and white if(!file_exists(‘dw-bw.png’)) { $img = imagecreatefrompng(‘dw-manipulate-me.png’); imagefilter($img,IMG_FILTER_GRAYSCALE); imagepng($img,’db-bw.png’); imagedestroy($img); } Change Color to B/W //to negative if(!file_exists(‘dw-negative.png’)) { $img = imagecreatefrompng(‘dw-manipulate-me.png’); imagefilter($img,IMG_FILTER_NEGATE); imagepng($img,’db-negative.png’); imagedestroy($img); } Change Color to Sepia //to black and white, ... Read More »