Saturday, June 28, 2014

Best webpage downloader

So far, the best I have used is: http://www.sitesucker.us/mac/mac.html

Friday, June 27, 2014

Unable to use Fontawesome because of library PIL

Was trying to use fontawesome library to generate PNG files. However, met many errors along the way. In simple steps:

1. downloaded and installed brew

2. sudo brew install freetype

3. sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install pillow

4. python fontawesome.py --size 128 play

Wednesday, May 7, 2014

Warning: mysql_connect(): No such file or directory in but file exists in terminal

This will fix the issue:

sudo su
ln -s /Applications/xampp/xamppfiles/var/mysql/mysql.sock /tmp/mysql.sock
mkdir /var/mysql
ln -s /Applications/xampp/xamppfiles/var/mysql/mysql.sock /var/mysql/mysql.sock

Sunday, May 4, 2014

Custom files redirection error on wordpress

Even though the permissions for the folders and files are correct, a 404 error kept showing on the wordpress site. This can be resolved by modifying the .htaccess file and modifying the headers to something like this (the highlighted section is what is new):


RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/rest/(.*)$ [OR]
RewriteRule ^.*$ - [L]

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


# END WordPress

Wednesday, April 30, 2014

Persistent ampersand/html entities in jquery
















You can solve it by doing this: $('
').html("HTML YOU WANT TO CONVERT").text()



Sunday, April 27, 2014

SimpleXML error - unterminated entity reference.

While repurposing a blog today into XML doc, ran into the usual ampersand error. Warning
: SimpleXMLElement::addChild(): unterminated entity reference.

The error is a result of addchild inside SimpleXML, which does not automatically escapes ampersand. The best way to fix this problem is to simply not use the addchild method but instead of going direct:

// change the following:
// $childnode = $xml->addChild( $key, $value, 'url' );

// into this:
$xml->addChild( $key );
$xml->$key = $value;

Weird characters in PHP crawler/curl such as รข€™s...

Solution is to convert the doctype to UTF with the following line of code at the header:

header('Content-Type: text/html; charset=utf-8');