Introduction To PHP 7: What’s New And What’s Gone

PHP 6 was ambitious, but rubbish. That’s how we ended up with PHP 7, skipping version 6 in the process.

One of the most exciting events in 2015 in the PHP world was the release of PHP 7, 10 years on from the release of the last major version, PHP 5. With a major step forward, PHP 7 introduces plenty of new features and performance upgrades.

However, it also removes old, deprecated functionality, which introduces some compatibility breaks, making it harder for older applications to migrate to the new version. This guide should serve as a quick tour on what to expect if you plan on moving your existing applications, or building new ones, on top of PHP 7.

But Wait, Where Did PHP 6 Go?

If you haven’t been working with PHP lately, you might wonder what happened to PHP 6, why the skip from PHP 5 to PHP 7? Well, long story short, PHP 6 was a failure. The main feature of version 6 was native support for Unicode characters since PHP is used mainly in web development and the web needs Unicode, so the move to bring Unicode to PHP made sense.

The idea was to bring complete support for Unicode to the core itself. It would have brought extended capabilities to the language, from the ability to use silly emojis as variable and function names, to powerful international string functionality. For instance, when another language uses upper and lower case letters differently from English, or when a name in Chinese characters needs to be converted to English.

PHP 6 was ambitious, but rubbish. That’s how we ended up with PHP 7, skipping version 6 in the process.

PHP 6 was ambitious, but rubbish. That’s how we ended up with PHP 7, skipping version 6 in the process

Continue reading

JavaScript Prototype Chains, Scope Chains, and Performance: What You Need to KnowJavaScript Prototype Chains, Scope Chains, and Performance: What You Need to Know

JavaScript: More than meets the eye

JavaScript can seem like a very easy language to learn at first. Perhaps it’s because of its flexible syntax. Or perhaps it’s because of its similarity to other well known languages like Java. Or perhaps it’s because it has so few data types in comparison to languages like Java, Ruby, or .NET.

But in truth, JavaScript is much less simplistic and more nuanced than most developers initially realize. Even for developers with more experience, some of JavaScript’s most salient features continue to be misunderstood and lead to confusion. One such feature is the way that data (property and variable) lookups are performed and the JavaScript performance ramifications to be aware of.

In JavaScript, data lookups are governed by two things: prototypal inheritance and scope chain. As a developer, clearly understanding these two mechanisms is essential, since doing so can improve the structure, and often the performance, of your code.

Property lookups through the prototype chain

When accessing a property in a prototype-based language like JavaScript, a dynamic lookup takes places that involves different layers within the object’s prototypal tree.

In JavaScript, every function is an object. When a function is invoked with the new operator, a new object is created. For example:

function Person(firstName, lastName) {
  this.firstName = firstName;
  this.lastName = lastName;

var p1 = new Person('John', 'Doe');
var p2 = new Person('Robert', 'Doe');

In the above example, p1 and p2 are two different objects, each created using the Person function as a constructor. They are independent instances of Person, as demonstrated by this code snippet:

console.log(p1 instanceof Person); // prints 'true'
console.log(p2 instanceof Person); // prints 'true'
console.log(p1 === p2);            // prints 'false'

Since JavaScript functions are objects, they can have properties. A particularly important property that each function has is called prototype.

prototype, which is itself an object, inherits from its parent’s prototype, which inherits from its parent’s prototype, and and so on. This is often referred to as the prototype chain. Object.prototype, which is always at the end of the prototype chain (i.e., at the top of the prototypal inheritance tree), contains methods like toString(), hasProperty(), isPrototypeOf(), and so on.


Each function’s prototype can be extended to define its own custom methods and properties.

Continue reading

Guide To Budget Friendly Data Mining

Unlike traditional application programming, where API functions are changing every day, database programming basically remains the same. The first version of Microsoft Visual Studio .NET was released in February 2002, with a new version released about every two years, not including Service Pack releases. This rapid pace of change forces IT personnel to evaluate their corporation’s applications every couple years, leaving the functionality of their application intact but with a completely different source code in order to stay current with the latest techniques and technology.

The same cannot be said about your database source code. A standard query of SELECT/FROM/WHERE/GROUP BY, written back in the early days of SQL, still works today. Of course, this doesn’t mean there haven’t been any advancements in relational database programming; there were, and they’ve been more logical than technical.


Data warehouse design hasn’t changed much over the years. However, the way we extract and employ data is evolving and creating new possibilities.


Continue reading

Google Cardboard Overview: VR On The Cheap

Imagine if you will, standing on the surface of the moon, overlooking a crater from your lunar rover, listening to mission control chatter. Or don’t. Instead of imagining it, just order a cheap Google Cardboard VR set instead, stick your phone in it, and start exploring the solar system, museums, tourist spots, coral reefs and much more. Let the Imagination Technologies GPU in your phone live up to its name and do your imagining for you.

Google Cardboard is hardly a new concept. It was unleashed on the unsuspecting geekosphere at Google I/O 2014, roughly 18 months ago. Since then, Google has tweaked the Cardboard reference design, but the concept hasn’t changed; Google Cardboard was envisioned as the cheapest Virtual Reality (VR) solution on the planet, and at this point, nothing else comes close in terms of pricing.


Google Cardboard is significantly cheaper than competing VR platforms, so why is adoption so slow?

If you keep track of tech news, you are probably aware that Oculus Rift started shipping a few days ago. The news even made it to mainstream media, and CNN interviewed a few Oculus execs, who discussed the future of Oculus and VR in general. Demand for the Rift appears to be high because the pre-order website crashed hours into the launch, which coincided with the Consumer Electronics Show (CES) in Vegas. The Oculus Rift is priced at $599, and you also need a $1,000-plus computer to use it properly, but the high price obviously didn’t faze the loads of consumers who pre-ordered one.

I could try to explain what makes Oculus different and why it costs so much, but that’s beside the point. It’s a product for enthusiasts and connoisseurs, people who don’t mind spending a lot of money for a great gaming user experience or for some niche professional applications. Compared to Google’s VR platform, Oculus Rift is a technological tour de force, but for the price of a single Oculus headset, you can get more than 50 prefabricated Google Cardboard headsets. Mind you, I am not talking about cardboard DIY sets, but proper headsets made out of plastic, with soft padding and a few straps to keep the contraption on your head.

Considering that you can get a Google Cardboard compatible set for $10 to $20, you’d expect that loads of people are buying them, but that’s not the case. Let’s take a closer look at Google’s platform and try to figure out what’s going on.


Continue reading

Separation Anxiety: A Tutorial for Isolating Your System with Linux Namespaces

With the advent of tools like Docker, Linux Containers, and others, it has become super easy to isolate Linux processes into their own little system environments. This makes it possible to run a whole range of applications on a single real Linux machine and ensure no two of them can interfere with each other, without having to resort to using virtual machines. These tools have been a huge boon to PaaS providers. But what exactly happens under the hood?

These tools rely on a number of features and components of the Linux kernel. Some of these features were introduced fairly recently, while others still require you to patch the kernel itself. But one of the key components, using Linux namespaces, has been a feature of Linux since version 2.6.24 was released in 2008.

Anyone familiar with chroot already has a basic idea of what Linux namespaces can do and how to use namespace generally. Just as chroot allows processes to see any arbitrary directory as the root of the system (independent of the rest of the processes), Linux namespaces allow other aspects of the operating system to be independently modified as well. This includes the process tree, networking interfaces, mount points, inter-process communication resources and more.

Why Use Namespaces for Process Isolation?

In a single-user computer, a single system environment may be fine. But on a server, where you want to run multiple services, it is essential to security and stability that the services are as isolated from each other as possible. Imagine a server running multiple services, one of which gets compromised by an intruder. In such a case, the intruder may be able to exploit that service and work his way to the other services, and may even be able compromise the entire server. Namespace isolation can provide a secure environment to eliminate this risk.

For example, using namespacing, it is possible to safely execute arbitrary or unknown programs on your server. Recently, there has been a growing number of programming contest and “hackathon” platforms, such as HackerRank, TopCoder, Codeforces, and many more. A lot of them utilize automated pipelines to run and validate programs that are submitted by the contestants. It is often impossible to know in advance the true nature of contestants’ programs, and some may even contain malicious elements. By running these programs namespaced in complete isolation from the rest of the system, the software can be tested and validated without putting the rest of the machine at risk. Similarly, online continuous integration services, such as, automatically fetch your code repository and execute the test scripts on their own servers. Again, namespace isolation is what makes it possible to provide these services safely.

Namespacing tools like Docker also allow better control over processes’ use of system resources, making such tools extremely popular for use by PaaS providers. Services like Heroku and Google App Engine use such tools to isolate and run multiple web server applications on the same real hardware. These tools allow them to run each application (which may have been deployed by any of a number of different users) without worrying about one of them using too many system resources, or interfering and/or conflicting with other deployed services on the same machine. With such process isolation, it is even possible to have entirely different stacks of dependency softwares (and versions) for each isolated environment!

If you’ve used tools like Docker, you already know that these tools are capable of isolating processes in small “containers”. Running processes in Docker containers is like running them in virtual machines, only these containers are significantly lighter than virtual machines. A virtual machine typically emulates a hardware layer on top of your operating system, and then runs another operating system on top of that. This allows you to run processes inside a virtual machine, in complete isolation from your real operating system. But virtual machines are heavy! Docker containers, on the other hand, use some key features of your real operating system, including namespaces, and ensure a similar level of isolation, but without emulating the hardware and running yet another operating system on the same machine. This makes them very lightweight.

Process Namespace

Historically, the Linux kernel has maintained a single process tree. The tree contains a reference to every process currently running in a parent-child hierarchy. A process, given it has sufficient privileges and satisfies certain conditions, can inspect another process by attaching a tracer to it or may even be able to kill it.

With the introduction of Linux namespaces, it became possible to have multiple “nested” process trees. Each process tree can have an entirely isolated set of processes. This can ensure that processes belonging to one process tree cannot inspect or kill – in fact cannot even know of the existence of – processes in other sibling or parent process trees.

Every time a computer with Linux boots up, it starts with just one process, with process identifier (PID) 1. This process is the root of the process tree, and it initiates the rest of the system by performing the appropriate maintenance work and starting the correct daemons/services. All the other processes start below this process in the tree. The PID namespace allows one to spin off a new tree, with its own PID 1 process. The process that does this remains in the parent namespace, in the original tree, but makes the child the root of its own process tree.

With PID namespace isolation, processes in the child namespace have no way of knowing of the parent process’s existence. However, processes in the parent namespace have a complete view of processes in the child namespace, as if they were any other process in the parent namespace.


Continue reading

A New Challenge Thrown To Google By CyanogenMod CEO Kirt McMaster!

Google has been slammed over their control over Android by CyanogenMod’s CEO Kirt McMaster. The CEO has indicated that the company wants to shift from the Google-focused version of Android and in order to do that they want to launch their own app store.

Google, Android, CyanogenMod, Kirt McMaster, new challenge for Google, CyanogenMod’s own app store, non-Google Android, OnePlus, Micromax, future of Android
As per Android Authority, at an event in San Francisco, McMaster had declared that they will try to take Android away from Google. His company will work on making a more open version of Android, which is not possible by Google, at least for now. Android Authority has also quoted him saying that they are making a more open version of Android so that they can collaborate with more partners for better services. Hence from now onwards, startups working on artificial intelligence don’t need to depend on Google or Apple to launch their applications.

Now they will also have an option of non-Google Android. He also added that Cyanogen currently depends on Google but it might not be the same from the next day, as he said, in next three to five years, they will no more depend on Google. McMaster has also proposed that Cyanogen will have their own app store in 18 months. Cyanogen is also stuck in disputes between OnePlus and Micromax as the OS is being used by both the companies. McMaster has also confirmed that OnePlus would also receive Android Lollipop update this month.

In India the OS is available with the Micromax Yu Yureka device and OnePlus device. So we can wait for the next phase of Android now, which will be a truly open source platform the world has been waiting for. It’ll be really interesting to see what Cyanogen will come up with in next few years and what will be the future of Android. We also have to watch out how Google tackles this challenge in the coming days.