Hack – The Language Behind Facebook

Posted by Harshad

Hack – The Language Behind Facebook

Hack – The Language Behind Facebook

Posted: 08 Apr 2014 08:01 AM PDT

Hack is the new language behind Facebook, which is still the most popular social network to date. It’s a web programming language invented and (recently) open-sourced by Facebook. The company claims that the language helps programmers to code programs faster and avoid errors early and easily.

(Image credit: guardianlv.com)

Hack is a language used to build complex websites at great speeds while still ensuring that the site’s source code is well organized and comparatively free of errors. Its "safety net" features allow programmers to write safer code which reduces the chances of later stepping into troubles.

In this post, we’ll look into Hack and some of its features which are arguably better than PHP, currently the most popular web programming language driving most websites. Hack is built to run on the Facebook’s HHVM virtual machine, which is known to deliver superior performance.

The Dynamics Of A Problem

Back in 2003, when Mark Zuckerberg started building Facebook, he used a web development language called "PHP". It was the most popular and (relatively) easy programming language at the time to create dynamic websites, with great speed.

PHP is a dynamically-typed language, which means you need not spend time in defining variables and once you finish your code, you can almost run it instantly. This eases the coding and decreases the development time and effort, but heavily increases the chances of getting into errors, which only shows its ugly head at the time of execution.

Can’t Afford To Have Mistakes

This further intensifies the problem as you need to run the code in order to find errors (unlike statically-typed languages). Thee errors continue to grow with the growth of the codebase. Small projects may not face a big issue, but with a large codebase with 5 errors per thousand-line code potentially carrying up to 5000 errors – that’s a lot to debug.

The situation worsens with Cloud-scale companies like Facebook when thousands of programmers write and ship new code every day. They also can’t afford to have errors in their code, which may lead to user data being compromised. So what is there to do?

Reinventing The Wheel

Since Facebook’s front-end was mostly written in PHP, switching to a new language would mean having to migrate the whole site code, which is not just impractical but also not feasible. Plus, if the programmers are already used to PHP, this calls for a massive reboot in human resource.

Luckily there is a better solution – they re-invented a language, derived from PHP, which can co-exist with this traditional language.

"Thus, Hack was born. We believe that it offers the best of both dynamically typed and statically typed languages, and that it will be valuable to projects of all sizes," it was announced on Facebook’s Engineering blog.

Hack Is Simply Better PHP

Essentially, Hack is "better PHP". Derived from PHP, it inter-operates seamlessly with PHP for faster and safer web development. You can have a project containing PHP and Hack code side-by-side and still, the project runs as required. This is the key feature that is going to attract PHP developers to try Hack. And possibly encourage them to gradually migrate their PHP code to Hack.

Hack primarily adds to PHP the power of static typing along with many more features found in other modern programming languages. It’s a language developed for HHVM (HipHop Virtual Machine), an open-source runtime platform built by Facebook to execute programs written in Hack and PHP.

The Hack and HHVM combo is targeting one of the foundations of modern web: rapid app development. It’s never been easy to test and debug web applications, but Hack is changing that by allowing programmers to detect errors early on without compromising the development cycle of PHP. The conclusion from several tech sites has been that Hack is good news.

Advantages Of Hack

The greatest enhancement that Hack provides over PHP is the removal of unnecessary and error-prone features. Hack adds safety nets (without slowing you down) so you make less errors. It also adds various features found in modern programming languages which makes writing code in Hack enjoyable.

Hack is both a dynamically typed and statically typed web development language, thus bringing the best of both typed languages. This is actually called "gradual typing," a type system which allows variables to be typed either at compile-time or at run-time. It can run your code without compiling – you can edit a file and reload the webpage and see the changes instantly.

Other Features

Hack brings in features such as collections, lambda expressions, and run-time enforcement of return types and parameter types, addition of generics, asynchronous programming, etc.

These new features are non-obstructive, thus the code written using Hack will still look and feel like the traditional dynamic code created using PHP. Moreover, engineers will better understand the code as static typing acts a lot like documentation.

What’s Not So Advantageous

The greatest disadvantage of Hack is that it has abandoned the features that make PHP a simpler language for beginners. You cannot embed the HTML directly in your source code, and you can’t have a code written outside of a function or class. But this is a relatively small problem. While it may deter beginners, PHP programmers would not find it hard to adapt to Hack and will probably deem the advantages of Hack convincing enough for adoption.

Facebook has already deployed Hack on its website, which serves more than 1.2 billion people in the world. "We have deployed Hack at Facebook and it has been a great success. Over the last year, we have migrated nearly our entire PHP codebase to Hack," stated the article on the Facebook Engineering blog.

The Future

It’s going to be interesting to see how the PHP community at large will adopt this new language. We hope to see Hack supported on other PHP virtual machines and parsers, which will simplify code migration.

An open source project also means it’s not dependent on its original creators for new features and bug corrections. We may encounter some awesome feature in the future suggested or added by the open source developers community to this new language.

Moreover, Facebook is also working to improve Hack. They did create the language after all. "This is just the first step, and we are dedicated to continuing to evolve this software to make development even easier for both our own engineers and the broader community," as posted on the Facebook Engineering blog.

What do you think about Hack? Do you think Hack is better than PHP? Can it replace PHP? Please post your answers through comments.

9 Tips To Help You Keep Your Windows XP Safe After End-Of-Life

Posted: 08 Apr 2014 06:01 AM PDT

Microsoft Windows XP will no longer be receiving anymore security updates beyond April 8, 2014. What this means to most of us who are still on the 13-year-old system is that the OS will be vulnerable to hackers taking advantage of security flaws that will never be patched.

Windows XP End Of Life

According to Net Applications, 30% of the world’s PCs are still running on Windows XP. That is a huge bulk of the market, a portion that cannot be neglected. Microsoft and other security vendors have been actively encouraging users to migrate to the latest OS, where security updates are regularly issued, but for some people, this is not possible.

No matter what their reasons are, even though they may run into security risk because of the ended support, there are several ways to mitigate most of risks and to reduce the chances of being attacked. Here are 9 tips to help you survive the end-of-life for Windows XP.

1. Back Up Everything, Every time

Not a tip specific to Windows XP but a valuable one nonetheless. It should be emphasize that although the tips here will help you mitigate risk, they will not eliminate them and therefore, having a regular, working backup is crucial in case anything goes wrong.

Make sure you back up what you cannot afford to lose, properly and securely if case your XP machine runs into an exploit that could corrupt your data. XP doesn’t come with its own backup tool but there are multiple ones available online.

2. Keep Your Antivirus Updated

XP may not be getting any updates anymore but that doesn’t mean that it won’t be getting antivirus updates. The majority of security vendors will still be providing update to their software running on XP, including Microsoft’s own Microsoft Security Essentials (MSE).

Windows XP End Of Life

This won’t help you if an exploit targets a vulnerability in the operating system but will protect your system from day-to-day malware.

3. Don’t Use Internet Explorer

Internet Explorer 8 was the last version of IE to be released for Windows XP. The OS never got a newer version of the web browser so XP is stuck with an outdated and unguarded attack gateway via browser.

Windows XP End Of Life

If you are on Internet Explorer, but have the option to change to another, more modern and secure browser, consider changing to browsers like Mozilla Firefox or Google Chrome. Unlike IE, these browsers are still being maintained for XP and will be for the near future.

4. Remove Java, Adobe Flash and Reader

Many security breahes nowadays use third-party plugins as an attack vector, with Java, Adobe Flash and Adobe Reader being the usual suspects. If you are not using any of them on a regular basis, remove them completely and you will remove the biggest attack vector on your computer.

However, if you still need them because of the good work that they do, compromise by installing only the Java functions you need; opt for HTML5 or use click-to-flash add-ons to replace Adobe Flash and do consider third-party PDF readers that are available for free online.

5. Choose Your Software And Keep It Updated

Installing third-party software will always introduce a new attack vector into your PC so choose what you install carefully. Remove those that are no longer being used. Also, make sure you keep those programs updated as developers will always add in bug fixes and patches with the latest updates.

6. Always Scan Your USB Drives Before Connecting

Perhaps the most common way to spread malware is via the unassuming USB drive. Computers you find in colleges and cybercafes are common victims of USB-transmitted malware as they are passed around unawares by one user to the next. If you have no idea where that USB drive has been, always scan it before using them with your XP machine.

7. Use A Limited Account

A study done by Avecto states that 92% of severe vulnerabilities reported by Microsoft can be mitigated by removing admin rights from your account. An attacker can only execute an exploit if they can get the access to do so and using a Limited account is the easiest to block them.

Consider creating a Limited account (find out what a Limited account is here) for your day-to-day activities as most of the time you will only be using your admin rights to install or update programs on your computer.

8. Use XP In A Virtual Machine

Here’s another reason many users are reluctant to upgrade their Windows XP to a newer OS version – they lose out on the third-party software that they are using on their Windows XP because a newer version is not available on the latest OS; or they have to repurchase a newer version.

XP Mode
(Image Source: Ars Technica)

If this is the case with you, consider running third-party software on a virtual machine. This will put the OS in its own self contained system within your computer. Microsoft provides a free "XP mode" for those who have Window 7 Professional and above. If you don’t have the version required, try VMware Player, which is free for personal use (you will need a copy of XP to install).

9. Disconnect From The Internet Completely

When all else fails, and you are bent on keeping your XP machine unchanged, consider cutting off all connection between your computer with the World Wide Web. If you take this route, you can ignore the majority of the tips mentioned above. If the only reason you are running XP is to support legacy software or hardware and you don’t need the internet, simply disconnect.

(Image Source: digitalprotalk)

This will remove virtually all the ways that an attacker can exploit your computer. If they can’t reach it, they can’t attack it.


By following these simple tips, you will be able to reduce the risk of your XP machine being compromised. However, the best way to be safe is to move on to a modern operating system. If the newer Windows isn’t to your liking, consider switching to a Linux distro as they have advanced a lot when it comes to ease of use, plus they are generally safer than the Windows family.

Sideload iOS Apps With iEmulators [No Jailbreak]

Posted: 08 Apr 2014 03:01 AM PDT

Apple has a few restrictions when it comes to apps in the App Store. It doesn’t allow video game emulators, bittorrent clients and screen recorders. Usually the only way to get them on your iOS device is to jailbreak your device.


There is a way to sideload apps without jailbreaking, using Apple’s Enterprise Certificate, which allows companies to sideload their private apps. By obtaining one, developers can easily install their non-Apple-approved apps on iOS devices.

Using this method, many developers have started releasing apps without the use of the App Store. A website called iEmulators.com gathered these apps and have set up a way to install them on your iOS device, all through the web browser. Below we will show you how to easily install a sideloaded app on your device.

How To Sideload iOS Apps

Firstly, go to the iEmulators home page with your iOS device. From here you can choose an app you would like to download to your device. Open it and tap "Download" or follow the link if it’s an external site. If a prompt appears, confirm your download.

If it does not, you will need to change the Date & Time (instructions in the next section), then press "Download" again for it to start.


Changing The Date & Time

Note: After downloading the app but before you open it, you need to change the date & time of your iOS device. The OS will confirm if the app is using a valid enterprise certificate based on the certificate’s time stamp. This date will be different, depending on the app you have downloaded (refer to the individual app instructions for the proper date to set).

Go to Settings > General > Date & Time and switch it to an earlier date, and turn off Set Automatically. Then, open the app. Next, toggle Set Automatically back ON within Date & Time to restore your device to the current date.

iOS Date Change

If all goes well, your brand new, sideloaded app will now be on your non-jailbroken iOS device. If your app stops working, try setting your time back to 2012 and reopen the app. This may be needed every once in a while to keep the app in working order.

GBA4iOS Mario


You should now have a side loaded app on your device. The site contains a plethora of video game emulators as well as a few apps that some may find useful, such as the ability to use bittorrent on your device. Installation may not work sometimes, so you may have to try several times before it successfully installs. It’s not perfect but it’s currently the only way to sideload apps on iOS sans jailbreaking.

Small Businesses: Why You Should Focus on Your Visual Content

Posted: 07 Apr 2014 10:01 PM PDT

Editor’s note: This is a contributed post by Payman Taei, founder of HindSite Interactive, an award-winning web design and development company that creates custom web and mobile sites and applications for businesses and organizations.

You’ve been working hard and churning out long-ish blog posts and articles along with a few images but to your dismay, you’re still not getting enough traffic or engagement on your blog. In this age of all sorts of big data, people are often bombarded with a lot of information they either don’t need or don’t know how to consume.

Three-sentence paragraphs, bullet points, sub-headings and bold font can only do so much to hold someone’s attention on your blog. It’s probably time to take your visual strategy to the next level.

But there’s an easy way to do it. If you want more people to read, share and engage with your content, visual content is a perfect answer to hold the attention of busy, distracted and hyper-engaged people.

Visual includes everything you can think of and have seen on a blog — infographics, graphs, piecharts, videos, memes, cartoons, maps etc. Using visuals, your message is conveyed much quicker and more effectively than writing a 1000-word article. Not only that, visuals get shared a lot more than text.

Still not convinced? Here are 6 reasons why you should consider going visual.

1. Visuals are snackable

Big data is making people restless – we want to consume more and in less time. Visuals fit the bill perfectly. They are snackable, yet provide immense value.

The Two Leaves tea company’s website hardly looks like your typical e-commerce site. It’s got stunning photos of their products and a tea-picker as the background of the site’s pages. This sets them apart from their competition as a refreshing brand and also highlights their hand-picked tea. Natural!

2. Visuals are Memorable

Depending on how you utilize them, visuals have the potential to be as memorable as you want them to be. Who can forget the success kid meme used so cleverly by Virgin Media? Surely this made you chuckle, didn’t it? There’s nothing more “visible" than visuals.

(Image Source: newrisingmedia.com)

Another example is the yTravel Blog. Run by a husband and wife team, their Facebook page regularly posts of travel tips among other visuals on their social media page. They’ve obtained 26,000+ likes on Facebook and 4.3 million followers on Pinterest by using this simple visual strategy.

(Image Source: facebook.com/ytravelblog)

3. Visuals are attractive

Open a magazine and you’ll notice the first thing that grabs your attention is a visual. It could be an ad or a featured article. Heck, you probably bought the magazine in the first place because of its cover, right?

Design-made-easy program Canva uses a lot of beautiful and shareable design tips that don’t need much text to accompany them.

(Image Source: blog.canva.com)

(Image Source: blog.canva.com)

The point here is that visuals attract attention. It’s all about making sure that you use the right visual for your marketing to create an impact in your customer’s mind.

4. We’re wired for this stuff

Did you know that cute images arouse the same pleasure centers in your brain the same way sex, a good meal or drugs does? 90% of the information that come to our brain is visual. It’s also processed 60,000 times faster than text.

Hence, why your brain just loves visual content. This is why marketing company and blog, HubSpot, uses cheeky YouTube videos to teach marketing lessons. Their YouTube channel page uses humor to present a point in their videos. And what’s not to love about their Gangnam Style parody, aptly titled "Inbound Style"?

The work that they’re doing using visuals must be working as they’ve now got more than 200,000 likes on YouTube.

5. Everyone "Gets" Visuals

The great thing about visuals is that they’re in a universal language that everyone can understand and remember. Take a look at your social media feed and you’ll realize that what cuts the noise is probably an image or a video.

The reason is visuals will simplify complex ideas (infographics, graphs), tell a story or teach a concept (video scribes, illustrations) and overall, improve a reader’s experience. Dan Zarrella explains the effect of hashtags and quotes using two simple graphs.

(Image Source: danzarella.com)

He found that the effect of hashtags boosted retweets by 55% and tweets with quotation marks increased retweets by 30%.

(Image Source: danzarella.com)

But what if your clients are businesses? Can you use visual marketing successfully? Turns out, yes you can.

B2B email marketing company, Constant Contact, is killing it on Pinterest. Their “Quotes for Small Business Owners" board ranks #2 on Google, with more than 6,000 board followers. To top it off, they’ve neatly divided their page into 111 boards so there’s something is for everyone. The result? More than 21K followers on Pinterest.

6. Visuals are like roadmaps

A good visual strategy will show your readers what they should do next. Should they click on an “Add to Cart" button? Do they leave a comment? Where do they go next?

In this way, they build trust. They lay a roadmap for your visitors while humanizing your interaction with them, as demonstrated by the previous HubSpot video. Once people “like" you, they become better prospects and are more receptive to what you suggest.


Visual marketing should be one of your objectives in 2014. You may want to hire a graphics person to design visual elements. Yes, it could be an expensive investment but in the long run, it should pay off.

But, if you’re lacking in finances or more of a DIY person, there are easy-to-use online tools that you can use to create infographics, CTA banners, presentations, animations etc for free.

Don’t just stop there – make sure you also test your efforts. Measure what’s working and what’s not. You never know, 2014 could be the year that you go viral!


Post a Comment