HIPAA Compliant Cloud Storage

What Is File Compression?

Target audience

This article is good for general audiences and provides an introduction to data compression techniques and uses.
.

Introduction

File compression is a technique for “squeezing” data files so that they take up less storage space, whether on a hard drive or other media. Many different kinds of software, including backup programs, operating systems, media apps, and file management utilities, use this technique. While the type of source file and the type of compression algorithm determines how well compression works, a compressed set of an average mix of files typically takes about 50 percent less space than the originals. This technology has applications ranging from archives and backups to media and software distribution.
.

Effectiveness

Most compression techniques work by reducing the space redundant information in a file takes up. The more redundancy the compression algorithm detects, the smaller the compressed file becomes. Text files, for example, may have many repeated words or letter combinations that can produce significant compression–as much as 80%, in some cases.

Databases and spreadsheets often also make good candidates for file compression because they, too, typically have repeated content. Conversely, files that have already been compressed, such as MP3s and JPEGs, have low redundancy. Compressing them further yields results only a few percent smaller than the originals–in some cases, they may become slightly larger when compressed, since the compression can add a small amount of management data to the file.
.

Lossless vs. Lossy Compression

Compression comes in two basic types, lossless and lossy. A lossless compressed file retains all information so that decompressing it restores the original file in its entirety. Most lossless compression algorithms build upon the work Abraham Lempel and Jacov Ziv pioneered in the late 1970s in creating the algorithms that would be called LZ (many subsequent compression algorithms build upon this work, so their names begin with this pattern: LZO, LZW, LSWL, LZX, LZJB, etc.). The algorithm uses an adaptive technique that analyzes the source file for strings of characters that repeat. The larger the string it can find, and the more often that string recurs through the file, the more it can compress the output file. Documents, spreadsheets, and similar other files are often compressed with lossless techniques like these LZ-based algorithms.

Lossy compression can often produce more compact results by discarding data that may not affect the final resolution of the file. Files relying upon human perception often utilize lossy compression, since the source material may have more resolution than we can realistically perceive. For example, a photo in its raw form may take 5MB, but if you want to use it on a web page, using that photo would cause the page to load more slowly. Using an image editor and lossy compression, you might create a compressed version of that photo that is 200KB. It may lose some of the clarity of the original but is still perfectly usable and is far quicker to download.
.

Archiving

It is frequently convenient to package many files and/or folders into a single compressed file, such as for emailing a collection of files or distributing a complex software application. This packaged collection of files is called an archive. Some compression programs also let you combine multiple files together, providing the dual benefit of smaller space and archival packaging. Other programs, particularly in the Linux/Unix domain, only handle compression of one file at a time. Archiving usually requires a separate program.
.

Windows Compression Software

PKZIP, a commercially-available utility program first introduced in the late 1980s, has become a de facto compression standard for the Microsoft Windows environment. PKZIP compresses, decompresses, and allows the creation of complex archives, saving them with the file extension .zip. In recent years, Microsoft has bundled PKZIP technology into Windows, allowing the operating system to automatically recognize and open most zip files. Open-source compression utilities are also available, such as Peazip, 7-Zip, and gzip. Windows has its own built-in software that lets you designate files, folders, and entire drives as compressed, extending the capacity of storage media.
.

Linux Compression Software

Linux has several different useful utilities for file compression, such as bzip2, gzip, and xz. These utilities are single-purpose and compress single files only–they do not by themselves create archives. The tar package (from “Tape ARchive”) often does archiving in conjunction with other utilities. Linux, like Windows, uses the combination of compression and archiving to reduce the space some files (such as log files) take up.
.

Conclusion

File compression lets you pack more data into a given amount of storage space. In addition to saving space on hard drives and other media, compression can dramatically improve the speed of file downloads. The technology is available as an integral part of most modern operating systems or as stand-alone programs.

 

Atlantic.Net

Atlantic.Net offers state of the art cloud servers to handle huge amounts of data for over 50,000 customers on a daily basis.   Redundant backup, excellent customers service, and technical support go hand in hand with our popular hosting solutions like Cpanel and HIPAA Storage Hosting.
.
.


What is PHP7 Vs. HHVM

Origin Story of the Rivalry Between Facebook and PHP

Back in 2010 Facebook developers announced that they had been working on a solution to the rising costs of running Facebook’s cloud servers. Due to the ever-growing resource demands being placed on Facebook, they needed to develop a solution that would not require them to make substantial changes to their source code but would still offer optimized performance.

Their solution was “HipHop for PHP” (HPHPc), which translated the PHP codebase of Facebook into heavily optimized C++ and then compiled that code with g++. The project’s success was considerable–Facebook boasted that they were able to reduce CPU usage on their web servers by around 50%, translating to a significant reduction in the overhead cost of running their servers.

Because of this success, Facebook open-sourced the project with the goal of showing the web community how easy it was to enhance website performance without having to make major changes to their codebase. Facebook developers often stated during presentations that PHP’s interpreter needed optimization and that that was one of the primary reasons behind their development of the Hip Hop Platform.

PHP’s development team may have taken this criticism by Facebook to heart when they began development of the next generation of PHP; the result of PHP7’s development (which began in 2014) has produced in significant performance upgrades when compared to PHP 5.X. They started by analyzing PHP’s performance on popular platforms such as WordPress, Drupal, and phpBB. By focusing on enhancing performance on these popular web platforms, the development team was able to make small but numerous changes to the existing source code. After over a year of finding, improving, and testing these changes, they found they were able to considerably reduce the source code of PHP, resulting in a faster and more lightweight programming language.
.

The Goals and Features of HHVM

After the success of HPHPc, Facebook decided to invest in developing HPHPc more to push for a more substantial increase in performance and a greater reduction of resources necessary to run one of the internet’s most high-traffic websites. Their next step was to create a virtual machine to execute the HPHPc code, a VM that came to be called the HipHop Virtual Machine (HHVM).

HHVM is a virtual machine that executes programs written in PHP or Facebook’s own Hack programming language. It works by taking PHP or Hack code and converting it into untyped bytecode and metadata, using their own Abstract Syntax Tree to convert PHP and Hack into bytecode that they call HipHopByteCode (HHBC).

HHVM then analyzes the HHBC and converts it into a typed Intermediate Representation(IR). HHVM then converts the IR into x64 machine code and executes the program off the x64 machine code.
.

Summary of HHVM Execution Flow:

PHP source–(parse)–> Abstract Syntax Tree–(emit)–>Bytecode–(analyze)–(intermediate representation)–(codegen)–> x64 machine code.
.

Why Does HHVM Use C++?

It may be confusing to some as to why you would convert PHP code to C++ code. Facebook argues that C++ gives developers a much-needed balance between performance and maintainability, noting that C++ offers many convenient features, such as:

  • virtual methods
  • multiple inheritances
  • templates
  • macros
  • reinterpretcast vs. dynamiccast
  • plain old data vs. constructors/destructors
  • raw pointers vs. references vs. smart pointers
  • stack allocation vs. malloc vs. new

One important thing to take away from these features is that you have to know what your bytecode will look like at compile time to be able to properly customize HHVM to optimize your code.
.

The Goals and Features of PHP 7

PHP 7’s development team sought to improve the performance of their source code with the end goal of having the ability for any website to update to PHP7 to see a substantial increase in performance without having to make any changes to the site’s current code.

They boast that, with the source code streamlining, the decreased memory usage, and the inclusion of an Abstract Syntax Tree to boost the performance of the PHP parser, users can see as much as a doubling in performance compared to PHP 5.x. The addition of a secondary file-based cache for OPcache also further augments the OPCache introduced in PHP 5.3.x.
.

The Major Difference Between HHVM and PHP 7

While HHVM and PHP7 have the same goal of improving the speed and performance of executed PHP code, they both have vastly different ways to accomplish these improvements. One noteworthy difference between the two is the inclusion of the “Just in Time” (JIT) compiler in HHVM. The PHP 7 development team attributed this inclusion as the reason many early benchmarks showed HHVM outperforming PHP 7. So while much of PHP7’s efforts focused on optimizing the source code of PHP, they were also able to include an Abstract Syntax Tree (AST) in the source code for the language. With the inclusion of the AST, PHP7’s development team has set up for the inclusion of a JIT compiler in a future version of PHP 7. A JIT compiler should allow PHP7 to significantly outperform HHVM in any non-Facebook application.
.

Who is the winner?

Despite the rivalry between PHP’s and Facebook’s development teams, both acknowledge that performance will widely vary from system to system. Because both projects are open source, they encourage community feedback to help them further develop and optimize their code. Developers with a large PHP code base now have the potential ability to increase the performance of their PHP code base with HHVM. For those who mostly handle small websites that don’t quite have the resource requirements of Facebook, the optimization and performance updates that PHP 7 brings will help enhance user experience so websites will be able to run as fast as those with any large code base do.
.
.


Features to Simplify Your Cloud Hosting Comparison

Which cloud hosting provider is the best option out there? When you look at infrastructure-as-a-service companies, you will find that the public cloud offered through Atlantic.Net is stronger than those of major competitors including AWS, Digital Ocean, Linode, and Rackspace.

  • Cloud Hosting Comparison
  • Features at Atlantic.Net
  • The Choice is Simple

Cloud Hosting Comparison

Every cloud provider out there wants to differentiate itself from the competition. The fact is that some companies try to outperform their rivals primarily through branding and becoming a recognized name rather than by developing a truly higher-quality product. That is why you see a lot of disappointment in many cloud hosting reviews.

Read More


How to Install and Configure Fail2ban on CentOS

Verified and Tested 4/28/16

Introduction

Fail2ban is a great, wonderful service that is primarily used to stop brute forcers from accessing your system. It’s simple to install and configure and works great at deterring your basic attackers away.

This article is specifically for installation on Centos. To install  and use Fail2Ban in Ubuntu and Debian, check out our how-to on that here.

Installing and configuring Fail2Ban on CentOS

We will be performing steps below as the root user. You will just need to sudo if you are using another user. For all editing of configuration files, we will be using vi. However, you can use whichever editor you are comfortable with. This installation is performed on a clean CentOS 6.5 64bit cloud server.

Read More


How to: FTP Uploads with Python

Introduction

In another article on using ftplib in Python, we talked about using Python’s ftplib library to connect to an FTP server and download both binary and text files to our local machine. In this segment, I’ll introduce several new concepts, including uploading text and binary files, error handling, and common directory commands using the same imported library.
.

Prerequisites

It is difficult to experiment with many of these calls with a server that you don’t own–most FTP servers will not allow anonymous logins. Assuming you do not have access to a web-based FTP server, your best bet is to install a server on your local machine (see “Installing an FTP server“) and test your code using localhost as the target server.
.

FTP Uploads

As with downloads, you’ll need to specify whether a file you wish to upload to a server is a text file or a binary file since each uses a different method. You can upload text files using the storlines() method and binary files with the storbinary() method. A nice feature of these functions is that neither one requires you to write a separate function to handle reading the source file: storlines() calls the readline() method on each line in the file until it reads the last line, while storbinary() uses the read() method until there is no more data to read and upload.

Read More


How to Install Your Own FTP Server

Introduction

If you’re interested in learning about networking, or if you have files that you would like to share with the world at large, then at some point you’re probably going to want to get an FTP server running on a machine. There is a vast array of options for a server, depending on what operating system your server is running and how much work you want to put in to setting it up. Read on for instructions on how to get free FTP servers up and running quickly using Linux, Mac, or Windows. All of the software mentioned here is free; paid FTP server programs do exist, but almost anything you need to do with an FTP server can be done with an open-source program.

Read More


How to: Useful pip Commands

Introduction

A good knowledge of how to use the pip command to manage Python packages can make the difference between a jumbled mess of spaghetti code and a nicely organized codebase. This guide will teach you the basics of using pip effectively so you can spend more time writing, and less time wrangling code.

.

Prerequisites

Read More


A Tale of Stack-Worthiness: The Rise of Nginx

Nginx has accrued increasingly impressive market share in recent years. What’s its story?

  • WordPress Developer Switches to LEMP
  • Nginx is Not Slowing its Pace
  • How the Web is Being Won
  • Growth of Nginx & LEMP to Fuel Your Own Project

WordPress Developer Switches to LEMP

The LAMP stack (open source development environment using Linux, Apache, MySQL, and PHP) has always been incredibly popular among developers, but in the past few years, that has started to change. What people are starting to use instead is called a LEMP stack, which replaces the Apache web server with a Russian little-engine-that-could competitor, Nginx (pronounced “Engine X” – hence the E in LEMP). Keep in mind that the code for Nginx is free, open-source, and is identified by the official site as both NGINX and nginx.

Read More


How to Install LEMP on Ubuntu 15.10 (Linux, Nginx, MySQL and PHP)

Verified and Tested 10/26/15

Introduction

This how-to will go through the process of installing at LEMP stack on Ubuntu 15.10. LEMP is very similar to LAMP, with one significant difference, you are installing NGINX instead of Apache. NGINX development has focused on performance, which is why many are beginning to migrate to NGINX web servers and away from Apache. This guide will still be using MySQL and PHP.

Prerequisites

A server with Ubuntu 15.10 installed.

Installing LEMP on a Ubuntu 15.10 Cloud Server

First we want to make sure that your server is up to date by running the commands:

sudo apt-get update

Note: Depending on your installation you may need to remove apache2. You can do that by running the commands:

sudo apt-get remove apache2*

Followed by:

sudo apt-get autoremove

 

Installing Nginx on Ubuntu 15.10

To install Nginx, use the command:

sudo apt-get install nginx

Hit Enter, when it asks,”Do you want to continue?”

Start the Nginx service with the following command:

sudo service nginx start

Verify that NGINX is working by opening your browser and entering your IP address or hostname.

Don’t know your IP address? No problem, run the following command:

ifconfig

You will get an output similar to the one below. Next to eth0 we can see that the inet addr is 192.168.0.192. That is your IP address.

This is an example of ifconfig that shows the IP address of 192.168.0.192

This is an example of ifconfig that shows the IP address of 192.168.0.192

So in our browser we would go to http://192.168.0.192.

Once you have entered your IP address or Hostname, you should get a web page similar to the following.

This is an example of the default web page for NGINX on Ubuntu 15.10

This is an example of the default web page for NGINX on Ubuntu 15.10

Now that Nginx is installed, we can move on to installing MySQL.

Installing MySQL on Ubuntu 15.10

Install MySQL with the command:

sudo apt-get install mysql-server

Hit Enter, when it asks,”Do you want to continue?”

During the install, a screen similar to the one below will pop up. You need to create a MySQL root password. Choose a password of your choice, It should be a strong password.

Set a secure password for the MySQL root password

Set a secure password for the MySQL root password

Hit enter to continue. Once you have hit enter, a new screen will appear prompting you to re-enter the password you just picked.

Reenter your MySQL root password

Reenter your MySQL root password

MySQL is now installed, but we add some basic security by running the MySQL secure installation:

sudo mysql_secure_installation

It will first prompt you to enter your MySQL root password, which you can do so.  After it will ask you to “Change the root password?”, type N and then press Enter. The rest of the question you can hit Enter for the defaults unless there are certain things you would like to keep open.

This is an example of the MySQL secure installation

This is an example of the MySQL secure installation

Now that MySQL is installed, we can now install PHP.

Installing PHP on Ubuntu 15.10

Install PHP with the following command:

sudo apt-get install php5 php5-fpm php5-mysql

Hit Enter, when it asks, “Do you want to continue?”

To get Nginx to work with PHP correctly, we need to make changes to the Nginx configuration file. This guide we will be using a simple Nginx config file.

First, we are going to move the original configuration file to a new filename. Run the command:

sudo mv /etc/nginx/sites-available/default /etc/nginx/sites-available/default.old

Next using a text editor of your choice, we are going to make a file called default in /etc/nginx/sites-available. For nano use the command:

sudo nano /etc/nginx/sites-available/default

Copy the following into your text editor:

server {
        listen       80;
        server_name  your_site_name.com;
        root /usr/share/nginx/html;
        index index.php index.html;

        location / {
                try_files $uri $uri/ =404;
        }

        error_page 404 /404.html;
        error_page 500 502 503 504 /50x.html;

        location = /50x.html {
                root /var/www/html;
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
}

In nano, to exit and save, hit Ctrl+x , Ytype , and then Enter.

Since we made changes to the configuration file, we need to restart Nginx, by running the command:

sudo service nginx restart

To test PHP, we are going to create a file called info.php.

Using a text editor of your choice, create info.php in /usr/share/nginx/html/.

sudo nano /usr/share/nginx/html/info.php

Copy the following into your text editor.

<?php
phpinfo();
?>

In your browser, you can go to http://Your-Hostname/info.php or http://Your-IP-Address/info.php. As above, in this example, we would use http://192.168.0.192/info.php.

You should get a web page that shows the version of PHP among other things, it will look like the image below.

This is an example of the PHP.info page on Ubuntu 15.10

This is an example of the PHP.info page on Ubuntu 15.10

Now that we verified that the info.php is working, it is a good idea to remove it as it gives a potential attacker information that can be used to craft a particular attack against your server. To do that run the command:

sudo rm /usr/share/nginx/html/info.php

Congratulations, you have installed LEMP on Ubuntu 15.10. Thank you for following this how-to. Please check back for more updates, or learn more about our reliable HIPAA-compliant cloud storage solutions.


What is: PHP7 – Breaking Changes from PHP5

PHP7 Elephant created by Walker Cahall http://www.waltronic.net/

PHP7 Elephant created by Walker Cahall

Target Audience

This article is geared toward readers with at least a working knowledge of PHP or a thorough knowledge of programming.
.

Introduction

PHP is one of those ubiquitous programming languages that underpins many of the most popular web platforms. With the release of PHP7–the first major revision to PHP in years–the governing body has taken the opportunity to add new features, deprecate others, and remove those that were previously deprecated. To make the transition from older versions to PHP7, developers will likely want to familiarize themselves with these changes to take advantage of the increased performance and to learn how these improvements may affect their code.

In this article, we focus on some of the breaking changes from PHP5 to PHP7.

 

Uniform Variable Syntax

Nested variables often resulted in code that was difficult to read as variable assignment was read right-to-left. Variable resolution now happens left-to-right in an effort to make code-writing and -reading a simpler task.

// code // old evaluation // new evaluation
$$atlantic[‘dot’][‘net’] ${$atlantic[‘dot’][‘net’]} ($$atlantic)[‘dot’][‘net’]
$atlantic->$dot[‘net’] $atlantic->{$dot[‘net’]} ($atlantic->$dot)[‘net’]
$atlantic->$dot[‘net’]() $atlantic->{$dot[‘net’]}() ($atlantic->$dot)[‘net’]()
atlantic::$dot[‘net’]() atlantic::{$dot[‘net’]}() (atlantic::$dot)[‘net’]()

.
Old code can achieve the same effect in PHP7 with the use of braces ({}) as in the center column above.
.

Removal of ASP and Script Tags

PHP7 will no longer recognize alternative tags such as <%, <%=, %>, and <script language="php">. PHP7 will only recognize the traditional <?php and ?>.
.

Removal of Deprecated Extensions and Features

The ereg extension and all ereg_* associated functions have been removed (deprecated in PHP 5.3) and replaced by the PCRE extension: preg_*.

The MySQL function (deprecated since PHP 5.5) has also been changed from mysql_* to mysqli_*.

The assignment of new by reference will now produce an error.

.

Multiple Default Cases Disallowed in a Switch

In what might qualify as an outlier intended usage, switch will no longer accept multiple default statements. In earlier PHP versions, switch would have evaluated the final default in the example below.

switch ($expr) {
default:
neverExecuted();
break;
default:
executed();
}

But in PHP7, the result of this code will be: Fatal error: Switch statements may only contain one default
.

PHP4 Constructors Are Now Deprecated

PHP4 constructors are methods that have the same name as the class they are defined in. PHP7 will emit an E_DEPRECATED when encountering a PHP4 constructor (in PHP8 this method will no longer be recognized as a constructor). This change may only produce problems with custom error handlers.
.

Redefinition of Function Parameter when the Name is Duplicated

In a fashion similar to the behavior of multiple defaults in a switch statement (see above), using duplicate parameter names within a function definition would return the final value. In PHP7, this redefinition attempt will produce an error.

function foo($bar, $bar) {....} // Return Fatal error: Redefinition of parameter $bar in /duplicate_names.php

.

Hex String No Longer Recognized as Numerical

To clear up inconsistent handling of hexadecimal numbers, PHP7 will no longer recognize a hex string as a number. This change will primarily affect the is_numeric() function and the mathematical operators (e.g., ==, +, -, *, /, %, **, ++, and –)

// In PHP5
var_dump(is_numeric('0x16a'));
// Return bool(true)

// In PHP7
var_dump(is_numeric('0x16a'));
// Return bool(false)

.

Invalid Octal Error

An invalid octal literal (such as one containing a non-octal digit) will now produce an error, instead of making a best-effort to render the value.

 // In PHP5
$octal = 0149;
echo $octal; // Display 12 (rendering octal value 0014)

// In PHP7
$octal = 0148;
echo $octal;
// Return: Parse Error: Invalid numeric literal...

.

Division by Zero Results Change

PHP7 adjusts how it reacts to situations in which it attempts to divide a value by zero. In previous versions, division by zero resulted in a boolean false. Now, dividing (/) by zero will return a float INF or NAN; using a zero divisor in a modulus (%) operation will return an error.

var_dump(5/0); // will result in float(INF)
var_dump(0/0); // will result in float(NAN)

var_dump(5%0); // will produce DivisionByZeroError

 

 

Thank you for reading, and good luck as you migrate your code to PHP7. Check out our how-to’s on installing PHP7  and try it yourself (CentOSDebian, Ubuntu).  For a more comprehensive dive into all the changes and the reasons behind those changes, see the PHP7 RFC list.   Altantic.Net offers many cloud hosting solutions, managed cloud hosting, one-click application installs and many other hosting solutions.

Learn more about our reliable HIPAA-compliant storage hosting solutions..


New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2323 Bryan Street,

Dallas, Texas 75201

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4

Canada

London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom

Resources

We use cookies for advertising, social media and analytics purposes. Read about how we use cookies in our updated Privacy Policy. If you continue to use this site, you consent to our use of cookies and our Privacy Policy.