Skip to main content

Posts

Showing posts from 2017

Wanna Cry - A Ransomware

WANNA CRY ( A Ransomware ), the popular word today.  Ransomware is a malicious application which can be triggered by clicking on a phishing mail, image, docs, etc. and it will block the access of your data until a certain amount is not paid. And display a message for payment to unblock it. its basically based on cryptography. It will encrypt the victim files.  Payment should be in digital currency Bitcoin(1 Bitcoin=113190.04 Indian Rupee). They are giving you a time period in which you have to make the payment to take files back. After run-out of the time the amount increases and then again a time window popup. But after passing that time window, if the payment is not done, then you will lost your access to the files permanently. The concept of file-encrypting ransomware was invented and implemented by Young and  Yung  at  Columbia University  and was presented at the 1996 IEEE Security & Privacy conference. It is called  cryptoviral extortion  and is the following 3-roun

What Make Facebook page load faster ?

Facebook has a “ Lazy Loading ” system they call “ BigPipe ” that helps the pages load fast. Facebook breaks each page down into sections they call “ Pagelets” , and using Javascript only load the most important Pagelets first then load the less important ones shortly afterward. And pipeline them through several execution stages inside web servers and browsers, as the modern microprocessor do to serve the various request in an order to increase the productivity. Big Pipe is totally implemented in PHP and javascript. By loading and rendering the main page structure first with minimal info on it, the page appears to load quicker than having to wait for a complete page to download and then render. To exploit the parallelism between web server and browser, BigPipe first breaks web pages into multiple chunks called pagelets. Just as a  pipelining microprocessor  divides an instruction’s life cycle into multiple stages (such as “instruction fetch”, “instruction decode”, “executio

Object Cloning in PHP

In simple words 'object cloning' can be defined as copying the object property and assigning to a different object. But when we copy an object then it only owns the reference, not the value. In PHP this is done by two method- 1) By using clone Keyword- In this, a shallow copy of the object is made. It means the internal object of the objectA is not cloned to the internal object of objectB. class CloneableClass { private $_internalObject ; public function __construct () { // instantiate the internal member $this -> _internalObject = new stdClass (); } } $objectA = new CloneableClass (); $objectB = clone $objectA ; 2) By using __clone() method- if your object holds a reference to another object which it uses and when you replicate the parent object you want to create a new instance of this other object so that the replica has its own separate copy. In this the magic method __clone() is

What are the effects of indexing on database tables?

The working of Index in database tables is the same as index work in a Text Book . It will help to browse the desired content faster in a book. we use to see the index on the first page then we check the page where it is in the book and then we directly come to that page, instead of going through all pages. Now databases , same happen with tables, if you are applying select query on the table, it will also check for the index and then return you the required field. It will return the field faster on which index is applied. Or in language, we can say that the index one query will execute faster instead of the non-indexed one. Join will execute faster on indexed one. eg- Consider a Table Product with `id` as Primary Key  id name price category_id  location_id                Table Info- Now  Applying Index on category_id  SELECT category_id FROM product WHERE category_id='5'; SELECT category_id FROM product WHERE location_id='10'; Firs

Magic Function in PHP (__sleep() and __wakeup() )

There are many magic methods in PHP like  __construct(), __destruct(), __callback(), __get(), __set(), __sleep(), __wake() and many more. But we will be takingon  on  __sleep() and  __wake(). __sleep() : serialize() checks if your class has a function with the magic name __sleep(). If so, that function is executed prior to any serialization. It can clean up the object and is supposed to return an array with the names of all variables of that object that should be serialized. If the method doesn't return anything then NULL is serialized and E_NOTICE is issued. serialize() is used for the representation of the storage class for storing the value. Serializing   an object means converting it to a byte stream representation that can be stored in a file. The use of __sleep()  to commit the pending task. If a bulk data is being inserted then at that time __sleep can be used. it will not release the object unless the work is not completed. Or if a table is being altered and