Installing Webuzo Control Panel on Linux

Webuzo is a web hosting control panel for Linux. The few things that set Webuzo apart from other LAMP (Linux Apache MySQL and PHP) stack web hosting control panels is that it is a single user control panel, easy to install but most notably is that it is free. They do have a paid version, and the difference between the free and paid version is the number of scripts available—55 scripts and 391 scripts, respectively. These scripts allow you to install web applications with 1 click and integrates fully into the Webuzo control panel framework.

You can install Webuzo on any of the popular Linux distributions. According to their system requirements, it works for 32-bit (x86) but the installer gave me some issues so I installed it on 64-bit (x86_64). The indicated minimum requirement for RAM is 512mb but it does work on 256mb of RAM.

For this tutorial, I am using CentOS 7 64-bit so if you are using Debian, you will need to use the apt-get counterpart instead of yum.


Webuzo Screenshot

Continue reading “Installing Webuzo Control Panel on Linux”

Throttling CPU Usage for Applications (Windows)

This is for CPU throttling on the application level, and is different than dynamic frequency scaling, which is used to prevent overheating and save power. CPU throttling for applications allows you to control how much overall CPU usage a specific application is allowed to use.

Sometimes applications can go rampant on CPU consumption, which may cause other applications or even the operating system to become unstable. This can happen if the application was designed for a smaller use case and you are pushing the application’s boundaries–for example, a CSV editing application may be designed and tested for up to thousands of records but if you open a CSV file with 10 million records, it max out your computer’s CPU cycles.

I recommend using a software called BES, which stands for Battle Encoder Shirase (no idea what this means). It is a simple piece of software that allows you to Target and Limit the CPU usage by percentage for up to 3 applications.

Download BES

The website says it is compatible with Windows 7/XP/2000 but if you have Windows 8/ 8.1/10, you can still use it without any issues. Below is a screenshot of the software—not the prettiest user interface but it gets the job done.

Bulk Linux Server Management Automation

One of the problems that techies who like to get their hands dirty with the nitty gritty of their server configuration and management is scaling the management of their Linux dedicated servers or VPSes (virtual private servers). To clarify, I am not referring to basic server management that comes included with most higher end server packages—I am referring to automation services that need to be done on a regular basis.

As an example, if you have 20 servers and on a regular basis, you need to bulk restart Apache, Exim, MySQL or the servers altogether, this method would save a ton of time in contrast to logging into each server individually using SSH and running these commands.

Here is how you would do it:

  1. Make sure you have PuTTY, and you can download it here (download putty.exe).
  2. In the same folder that you have putty.exe, create a .bat text file using Notepad in this case I am calling it servers.bat and create a .txt file using Notepad in this case I am calling it server_exec.txt
  3. Inside servers.bat, you want to put putty.exe root@server.com -pw password -m servers_exec.txt and repeat each server on a new line.
  4. Inside server_exec.txt, you want to put the SSH commands, one per line.
  5. Now, double click on servers.bat and it’ll login to each server and run your commands.

This concept can be taken and expanded on for more complex automation. For example, if each of your servers requires its own set of commands, you can create a separate .txt file for each server and update it in the corresponding line in your .bat file.

Importing Large Data Set (2GB CSV File) Into MySQL Database

As a digital marketer, sometimes you have to deal with large data sets—large enough that Microsoft Excel will be unable to open it. Microsoft Excel has a tendency of truncating data once it reaches a million records. In order to manipulate the data, I imported the CSV file into a MySQL database table so I can run SQL queries to pull the data that I need. The challenge comes with importing the 2GB CSV data because the web based MySQL client phpMyAdmin or even desktop MySQL clients will not be able to do the import without crashing.

What I did was upload the CSV file to the web server and used MySQL’s LOAD DATA command to do the import. The CSV file was 2GB with 9.2 million records and upon importing it, it took up 1.4GB of space on the database server.

LOAD DATA LOCAL INFILE '/home/user/dataset.csv' INTO TABLE `tablename` FIELDS TERMINATED BY ',' (col1, col2, col3, col4, col5);

Simply replace the CSV file path, table name and column IDs.

If you need to remove all of the duplicate entries, here is the SQL query to do so:

DELETE FROM tablename 
WHERE id IN (SELECT * 
             FROM (SELECT id FROM tablename 
                   GROUP BY col1, col2, col3 HAVING (COUNT(*) > 1)
                  ) AS A
            );

Simply replace the table name and column IDs.

And, if you need to do a bulk find and replace, here is the SQL query:

UPDATE us_emails SET col1 = REPLACE(col1,'find_this','replace_with_this');

Lastly, if you need to export the MySQL database tables as CSV files, you can do so in phpMyAdmin but for really large files it may time out. In this case, you would need to use SSH and use the following command:

mysql -u root -ppassword database_name -e "SELECT * INTO OUTFILE '/full_server_path/filename.csv'  FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"'  LINES TERMINATED BY '\r\n' FROM table_name;"

Simply replace the root username, password, database name, output file full path and file name, and table name.

Below is a screenshot of the MySQL database:


Importing 2GB CSV File into MysQL Database

Download Full List of United States Cities CSV

As a digital marketer, especially for businesses that provide location based services that span across the United States, sometimes it can be an annoyance finding a list of every United States based city. Fortunately, Google has thought ahead and provides all this information and it spans across the globe so it is not restricted to just the United States.

In Google Developers’s Reference Data, there is a section called Geographical Targets that allows you to specify the Country Code and Target Type. In my scenario, the Country Code would be US and the Target Type would be City, but you can filter this out to provide data such as Airports, County, Districts, Regions, Universities and much more!

Once you have set your Geographical Target, you can download a CSV file and import it into Excel or Google Sheets for further data manipulation and filtering. For those who just want to download the CSV without using Google Developers, I have provided the CSV download below.

Download Full U.S. Cities CSV


Full List of United States Cities CSV

PHP Array vs. MySQL Query Performance Test

Why is this important in relation to digital marketing? Google. Along with the Google mobile friendly algorithm update, the search engine power house also attributes page speed with SERP (search engine results page) rankings. This is relevant to developers, entrepreneurs and business executives who have websites containing a lot of data.

What is a PHP array?
In simple terms, an array is a list, which can be a linear list or a multi-dimensional list. The data from a SQL database can be stored into an array to be interpreted and manipulated by PHP, which lives in the RAM or memory of the server.

What is a MySQL query?
A MySQL database holds information stored within tables with columns and rows as would in an Excel document, and these tables can be “queried” for the specific data arranged in the manner that you want.

In this specific case scenario, I have a database table of contacts with 26 columns and 100,000+ rows and I need to display the total number of contacts per unique company for each state in an HTML table. The first approach would be the easier approach of looping through each state and querying the total from the database, resulting in an output of 1 row per request across 50 requests. The second approach would be to load all 50 rows into a PHP array, resulting in an output of 50 rows per request across 1 request, and then looping through the array to search for the matching state, 50 times.

Initial Run

The PHP array approach completely annihilated the MySQL query approach. Pingdom’s page speed test showed that the PHP array script executed in 1.28 seconds while the MySQL query script took 56.76 seconds to execute. Both approaches return the exact same resulting HTML.

pagespeed-initial-sql pagespeed-initial-php
Continue reading “PHP Array vs. MySQL Query Performance Test”

Sauce Labs Review: Cross Browser Testing Across Every Desktop, Tablet and Mobile Platform

While you can resize your screen and use browser emulation such as the Toggle Device Mode within the Inspect Element tool in Google Chrome, you can get an idea of how your responsive website looks across different devices, there are still quirks within each device operating system that will render specific elements differently. To get an idea of how your website actually looks across the different platforms, you would need to test on the actual device or have an emulator that emulates everything from the operating system level—and that is exactly what Sauce Labs offers:

Pros:

  • Affordable for small business owners, entrepreneurs, web designers and web developers
  • Ability to rotate certain device platforms including iPhone and iPad
  • Automated testing is available for tech start ups and larger businesses
  • Cross platform test across virtually any major OS and browser
  • Can test across multiple OS (operating systems) simultaneously and toggling between OS by clicking the corresponding Tabs
  • Ability to view another user’s quality assurance session with Spy feature
  • Ability to create sub accounts
  • Detailed logs so you can recreate any previous environment and runtime settings via Appium Log and Metadata
  • Highly scalable for quality assurance professionals and large companies with the Selenium automation support

Cons:

  • Automated Testing is complex and not easily deployable by the average entrepreneur, business owner or webmaster
  • Cannot see in 100% zoom of emulation OS, which causes the screen elements to display blurry
  • Hard to manually log multiple bugs individually via video Snapshots since it captures the whole session with Manual Testing

Ratings:

Accuracy
Features
Pricing
Usability
Overall

Screenshots:



Continue reading “Sauce Labs Review: Cross Browser Testing Across Every Desktop, Tablet and Mobile Platform”