Consider avoiding viewport values that prevent users from resizing documents Validation Error

So apparently this new rule/standard went into effect December 2016 causing this “Consider avoiding viewport values that prevent users from resizing documents” HTML5 validation error. To fix it make sure your:

 

Tag does not have the “maximum-scale=1.0” value, it’s that simple :)

 

*** UPDATE***

make sure you remove the following values:

  1. maximum-scale=1.0
  2. user-scalable=no

Source: https://github.com/validator/validator/commit/7cfc964d343cbd677beee32dad8f8e6ecab1210b

Thanks to Gaspard d’Hautefeuille for the update notice.

The Shady SEO Email Sales Pitch & Why I’m building A Public API To Stop IT!

Doing legitimate business now days is becoming quite cumbersome but you know what really grinds my gears (Peter Griffin reference lol…)? Shady SEO sales emails, I have a lot of SEO clients who seem to be receiving emails from salesmen with fake GMail accounts promising them better ranking through their site’s contact forms. The problem is the clients receiving these emails are clients already Ranking 1-5 on Google, Bing & Yahoo. Here is an example of what these sales emails look like…

Cristina Matthews
phone:206-309-XXXX
email:matthewscristina12@gmail.com

we can help your website to get on first page of google and increase the number of leads and sales you are getting from your website. please email us back for full proposal.

best regards,
cristina

It takes in some cases a lot of work to get these clients to the first page of any search engine and these clowns try to take advantage of uninformed business owners by getting them to try to switch to them. Now I have no problem with honest business but this is just shady period!. If you’re so confident about your process, business or model why send out covert emails? Why would you be pitching SEO incognito?
People like this make me sick and have no sense of honor, most likely trained by some sales clown with a suit in a call center (shell company) who resells one-size-fits-all SEO packages for another “SEO” company who wants to make easy money from people who already have put in the hard work. I have already built an anti-solicitation framework for internal business operations to try to eliminate these type of sales pitches but now I’m going to take it a step further.
For the next few weeks I will be working on a public API to stop all people with flagged email and IP addresses associated with these types of sales tactics. Just for fun I am thinking of also putting up a public wall of shame for people to view the type of shady emails sales pitches to look out for.

Updating To PHP 5.4 On Ubuntu Server 12.04 LTS

If you use php web applications then your know a lot are now demanding to be updated to php 5.4 or higher. To do this in Ubuntu 12.04LTS simply do the following…

If you haven’t already used ppa then you will have to first install python software properties, make sure you’re the root user… ( sudo bash )

apt-get install python-software-properties

PHP 5.4.x run:

add-apt-repository ppa:ondrej/php5-oldstable

PHP 5.5.x run:

add-apt-repository ppa:ondrej/php5

Once you’ve added the repo simply update and upgrade current packages & distribution packages with one simple command :)

apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y

Another Flash Project Originally Designed For Web Semantics in 2008

I was going through an old hosting account making sure I had backed up everything before it deletion and found some old work. This is was a flash project I originally created for Web Semantics (Web Symantecs) during its early conception. Considering this was done in 2005 and then updated in 2008 I have to say it’s still a pretty cool animation design. I’m just glad I was able to find it, I still can’t believe I was doing this with Macromedia Flash 7 and 8 (Macromedia was later bought out by Adobe), you can view the actual flash animation by clicking here.

Installing OwnCloud On Ubuntu Server 12.04 With SSL Support

Tired of paying for dropbox services? Why not use owncloud to setup your own personal and secure dropbox for free :)

 

Follow the steps below as root:

 

  1. Bash in to get root access… ( sudo bash ).
  2. Install server dependances ( apt-get install apache2 php5 php5-gd php-xml-parser php5-intl vim-nox ).
  3. Install more server dependances ( apt-get install php5-sqlite php5-mysql php5-pgsql smbclient curl libcurl3 php5-curl ).
  4. Download owncloud source files from http://owncloud.org/sync-clients/#linux
  5. Upload extracted files to your apache root ( default is located at /var/www ), you can install vsftpd server( apt-get install vsftpd )or any other type of ftp server service.
  6. Inside your owncloud root directory create a new folder called “data” ( mkdir data )
  7. For owncloud to configure & work correctly apache needs to be given ownership of certain folders so their is no problem for apache to read and write data inside your website.Run the following commands.
    ( chown -R www-data:www-data /var/www/apps )
    chown -R www-data:www-data /var/www/config )
    chown -R www-data:www-data /var/www/data )Note: Keep in mind that /var/www is just the default root folder of apache yours might be different, just make sure you make the appropriate changes so they point to your apache/web install.

     

  8. Your going to want to enable mod_rewrite ( a2enmod rewrite ).
  9. Restart your apache service ( service apache2 restart )
  10. Create a new database in mysql and call it owncloud, create a new user and password with specific access to the owncloud database. These credentials will be used later in the process.

 

Now lets install our SSL and get it configured correctly:

 

  1. Enable SSL Module ( a2enmod ssl )
  2. Now your going to want to create a directory to store your SSL certs ( mkdir /etc/apache2/ssl )
  3. now lets generate a general cert with the following command ( openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt )

    Note: Your going to be asked a couple of questions after you run this command, answer them as accurate as possible as this will be displayed on your cert when people try to access your site.
  4. Edit default-ssl in sites-available folder in your apache install ( vim /etc/apache2/sites-available/default-ssl ) and comment out lines add the following lines 51 & 52 (use a #).
    Then add the following lines right under
    (

    SSLCertificateFile /etc/apache2/ssl/apache.crt

    SSLCertificateKeyFile /etc/apache2/ssl/apache.key 

    )

     

  5. Finally run ( a2ensite default-ssl )
  6. Restart your apache service ( service apache2 restart )

 

At this point your should be able to visit your box’s url ( https://localhost or https://127.0.0.1 or https://www.yourdomain.com ) and finish installing owncloud with the native install wizard.
Once your install is complete you will be able to download ownclouds own filesync client or you can use a WebDAV client to navigate through your files. You can do the same for your mobile device or tablet.

Google Maps Error 610 Bad Key, Responsive HTML5 Google Map API V3

 

Getting a 610 error response from Google lately? Perhaps you have a bad API key? Not really it actually might be because Google deprecated support for their API V2…

 

Want to learn how to make a responsive google map for your site using PHP & HTML5 on API 3? here is how…

 

Note: In API V3 you do not require or use an api key.

 

Objectives:
Create a quick solution to produce responsive HTML5 Google Maps on the fly.

  1. write HTML
  2. write CSS
  3. write php/curl function
  4. example of use
  5. sample

First we will begin with a quick HTML wrapper and to place our iframe in…

1
<div class="wrapper"></div>

 

Use CSS to control the iframe and wrapper, this will also keep iframe in widescreen/16:9

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
.wrapper

{
height: 0;
padding-bottom: 56.25%; /* 16: 9 */
position: relative;
width: 100%;
margin: 0;
overflow: hidden;
}
iframe

{
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
border: 0;
overflow: hidden;
}

 

Now lets create the function that will generate a iframe tag on the fly by simply passing 1 value… an address

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# google map iframe generation
function gMap($a)
{
// setting up vars
$lat = '';
$lon = '';
$addr = $a;
$addr = urlencode($addr);
$u="http://maps.googleapis.com/maps/api/geocode/json?address=".$addr."&amp;sensor=false"; // URL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $u);
curl_setopt($ch, CURLOPT_HEADER,0);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);
// Comment out the line below if you receive an error on certain hosts that have security restrictions
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$d = curl_exec($ch);
curl_close($ch);
$g = json_decode($d, true);
// Debugging Purposes... or if you wanna use additional data...
//echo '
<pre>';
//print_r($g);
//echo '
</pre>
';
// If the Json request was successful...
if ($g)
{
$lat = $g['
results'][0]['geometry']['location']['lat'];
$lon = $g['
results'][0]['geometry']['location']['lng'];
$m = '
<iframe src="https://maps.google.com/?q='.$addr.'&amp;ie=UTF8&amp;ll='.$lon.','.$lat.';t=m&amp;z=15&amp;iwloc=&amp;output=embed" width="320" height="240"></iframe>';
echo $m;
} else {
echo "

No Map Available

";
}
}

 

Our php then goes inside the div

1
2
3
4
5
6
7
8
9
<div class="wrapper">

<?php
// you can insert a var instead of string if you wish ex: gMap($address)
gMap('48034 Rancho Way Temecula CA, 92592');

?>

</div>

 

An example of a running script

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php

# google map iframe generation
function gMap($a)
{
// setting up vars
$lat = '';
$lon = '';
$addr = $a;
$addr = urlencode($addr);
$u="http://maps.googleapis.com/maps/api/geocode/json?address=".$addr."&amp;sensor=false"; // URL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $u);
curl_setopt($ch, CURLOPT_HEADER,0);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);
// Comment out the line below if you receive an error on certain hosts that have security restrictions
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$d = curl_exec($ch);
curl_close($ch);
$g = json_decode($d, true);

// Debugging Purposes... or if you wanna use additional data...
//echo '
<pre>';
//print_r($g);
//echo
;
// If the Json request was successful...

if ($g)
{
$lat = $g['
results'][0]['geometry']['location']['lat'];
$lon = $g['
results'][0]['geometry']['location']['lng'];
$m = '
<iframe src="https://maps.google.com/?q='.$addr.'&amp;ie=UTF8&amp;ll='.$lon.','.$lat.';t=m&amp;z=15&amp;iwloc=&amp;output=embed" width="320" height="240"></iframe>';
echo $m;
} else {
echo "

No Map Available

";
}
}

?>


<div class="page">
<div class="wrapper">
<?php
// you can insert a var instead of string if you wish ex: gMap($address)
gMap('48034 Rancho Way Temecula CA, 92592');
?>
</div>
</div>

Let me know if you have any questions. :)

Installing And Securing phpmyadmin In Ubuntu Server 12.04/12.04.2

This post is important because phpmyadmin no longer just works after apt-get install, it requires additional steps to get working.
Aside from these changes, due to recent reports on phpmyadmin being exploited it’s important to secure it, you can do this in a couple of ways but I am going to assume you want access to it via web.

2 Parts

  1. Installation of phpmyadmin
  2. Securing the installation via htaccess
  3. Discussing more secure methods of accessing phpmyadmin

 

Lets begin the install muahahaha…

 

Enter root mode:

sudo bash

 

Install:

apt-get install phpmyadmin

 

Open Apache Config File

vim /etc/apache2/apache2.conf

 

Insert the following line at the very bottom of apache2.conf

Include /etc/phpmyadmin/apache.conf

 

Restart Apache server:

service apache2 restart

 

Securing phpmyadmin from public access to web panel…

 

Edit phpmyadmin’s apache configuration file:

vim /etc/phpmyadmin/apache.conf

 

Under the directory section (<Directory /usr/share/phpmyadmin>), add the line “AllowOverride All” under “Directory Index”:

        <Directory /usr/share/phpmyadmin>
        Options FollowSymLinks
        DirectoryIndex index.php
        AllowOverride All

 

create .htaccess file in phpmyadmin’s root directory:

vim /usr/share/phpmyadmin/.htaccess

Copy the following into the newly created .htaccess file:

AuthType Basic
AuthName "Restricted Files"
AuthUserFile /var/.htpasswd (make sure you set this path to a secure place outside your web root)
Require valid-user

 

Generate the password file where passwords will be stored for authentication/access to phpmyadmin root

htpasswd -c  /var/.htpasswd username (username should be your username, you will be asked for your password once you execute the command)

 

Restart Apache so updates can take effect:

service apache2 restart

 

If you want this to be more secure then I would suggest rethinking your server/network architecture…

  1. seperate your apache and mysql services into their own box
  2. only have apache server open on port 80 (public) and have it talk to your mysql server locally.
  3. if you need to change something in your database or need to access phpmyadmin I would vpn into your local network and access the mysql/phpmyadmin box.

If you have any questions or comments use the section below :)

iPhone HTML 5 App Mode jQuery Undefined URL Link Error…

So I figured I would write a post about this because I could not find any information regarding this type of error except lots of confusion on multiple forums, hopefully this post will shed some light on the error and will help you fix yours :)

If you are developing HTML 5 Apps for mobile devices and are using jQuery you are most likely going to run in a few errors which you’re going to have to debug. In this case I am going to talk about an error inside Full Screen mode (App mode) for the iPhone which takes you to an “undefined URL” error page when clicking on a link…

image

When using using <a href> links in APP mode you have 2 issues:

  • App Mode Minimizes and opens up Safari to open the selected page
  • You get an undefined URL Page Error

If you’re having problems like the first error description (closing app mode and opening safari when clicking page links) you are going to want to use some jquery to handle the loading of the link internally, this can be done with the following line of code:

1
2
3
4
5
$( document ).on("click", "a", function( event ){

event.preventDefault(); location.href = $( event.target ).attr( "href" );

});

But what if you are using <a> links without a “href” attribute as triggers for slide effects in jquery? This will give you an “underfined URL” error page. In my case it was due the code above, because jQuery was looking for an href attribute that was not present inside the <a> element and was not able to “define” a valid URL. To fix this I rewrote my script in order to first check if the <a> element had a “href” attribute, if it did then proceed with the internal loading, If not then prevent the default behavior of the <a> element, after all I was simply using an “<a>” (<a class=””></a>) element as a trigger to slide in and out a sub menu. To fix this and control both “href” and non href links use the following code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$( document ).on("click", "a", function( event ){

if($( event.target ).attr( "href" ))
{

event.preventDefault(); location.href = $( event.target ).attr( "href" );

}
else
{

event.preventDefault();

}

});

This will allow you to use <a> elements as triggers and regular internal links without sending you to an undefined URL error page. Anyways I hope this helps :)
If you need further assistance use the comment functionality on this post.

Regards,

PHP Startup: Unable to load dynamic library ‘/usr/lib/php5/20090626/mcrypt.so’ – libmcrypt.so.4: cannot open shared object file: No such file or directory in Unknown on line 0

Ok so I decided to quickly make this post because it was such a bitch to figure this out, all the information regarding missing dynamic libraries are in many cases unclear and could not find anything specific on the mcrypt library.

if you get the:
PHP Startup: Unable to load dynamic library ‘/usr/lib/php5/20090626/mcrypt.so’ – libmcrypt.so.4: cannot open shared object file: No such file or directory in Unknown on line 0

Here is whats going on…
you are missing files that are part of Apaches/PHP’s resources or you php.ini has the “entension_dir” value duplicated/actively pointing to the wrong location or php-cli is using the wrong php.ini config file. In my case it was due to a glitch with Ubuntu servers live OS update to 12.04.1 LTS which removed the old libraries and never re-installed them as part of the update.
Here is the checklist that will save you a long-ass headache, one that I unfortunately went through…

1) check your php.ini and make sure your “extension_dir” value (typically between line 805-809) is nulled out so its not processed (usually has a ; in front of it) in some cases the php.ini can be in multiple locations for apache/php-cli etc…
2) your mcrypt.so library is missing or corrupt.

first lets remove any possible installations of mcrypt libraries by running this in a shell, if you don’t have it installed skip this step (or you can still do it and if its not installed it will do nothing)…

1
2
sudo apt-get remove php5-mcrypt
sudo apt-get purge php5-mcrypt

then run this in a shell…

1
2
apt-get install php5-mcrypt
/etc/init.d/apache2 restart

(or you can sudo reboot too ;))

once this is done you should no longer get this error. If you have any issues please leave me a comment below :)