Monthly Archives: November 2013

Bootstrap tools and generators

Roundup of Useful Bootstrap Tools and Generators

As we have mentioned previously, Twitter Bootstrap, being a complex yet quite intuitive framework for building websites, has numerous ready-to-use themes and templates that are made for those who want to quickly prototype its project. It includes numerous features as well as third-party jquery-based extensions that all together contribute to development.

Today we are going to take a look at other helpful assistants that were designed in order to even more lessen your efforts and save your time while the programming. We have listed useful Bootstrap tools and generators that embrace different aspects, providing integral instruments for creating marvelous web interfaces.

(…)

Read more at: http://ewebdesign.com/bootstrap-tools-generators/

 

php – directory size

I was trying to get a directory size with PHP under a *nix environment…
This is what I’v found on stackoverflow… and it works 🙂

**
 * Get the directory size
 * @param directory $directory
 * @return integer
 */
function dirSize($directory) {
    $size = 0;
    foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $file){
        $size+=$file->getSize();
    }
    return $size;
}

And to get it with Kb, Mb, Gb etc….

 function formatSizeUnits($bytes)
    {
        $symbols = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
        $exp = floor(log($bytes) / log(1024));
        @$bytes = sprintf('%.2f ' . $symbols[$exp], ($bytes / pow(1024, floor($exp))));
        return $bytes;
}

Call to undefined function json_decode()

My

tail -f /var/log/nginx/error.log

was getting me  the following error

2013/11/19 20:07:59 [error] 5561#0: *192 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Call to undefined function json_decode() in /home/webroot/domain.net/www/index.php on line 36" while reading response header from upstream, client: 84.91.4.220, server: domain.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "www.domain.net"

Simple solution

sudo apt-get install php5-json

and then restart php5-fpm

sudo service php5-fpm restart

Open-Sourced H.264 Removes Barriers to WebRTC

When it comes to making collaboration technology such as high-definition video open and broadly available, it’s clear that the web browser plays an important role. The question is, how do you enable real-time video natively on the Web? It’s a question that folks are anxious to have answered.

WebRTC–a set of enhancements to HTML5–will address the issue head on. But, there is an important hurdle that must first be cleared, and that’s standardizing on a common video codec for real-time communications on the web – something the Internet Engineering Task Force (IETF) will decide next week.

The industry has been divided on the choice of a common video codec for some time, namely because the industry standard–H.264–requires royalty payments to MPEG LA. Today, I am pleased to announce Cisco is making a bold move to take concerns about these payments off the table.

We plan to open-source our H.264 codec, and to provide it as a binary module that can be downloaded for free from the Internet. Cisco will not pass on our MPEG LA licensing costs for this module, and based on the current licensing environment, this will effectively make H.264 free for use in WebRTC.
Read more: http://blogs.cisco.com/collaboration/open-source-h-264-removes-barriers-webrtc

server_names_hash, you should increase server_names_hash_bucket_size

I was trying to start fresh installation of nginx, but nginx wasn’t staring….

We must always read the logs!

[email protected]:/etc/nginx/sites-enabled# tail -f /var/log/nginx/error.log

This was I was getting on it…

2013/11/17 10:56:34 [emerg] 12362#0: could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32

Easy! I searched for server_names_hash_bucket_size on  /etc/nginx/nginx.conf and uncommented that line…

 

nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)

While I was trying to start nginx after some reconfigurations… i was getting

* Starting nginx nginx
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)

Don’t know HOW/WHY I had apache running on 80…
I had to stop it and later uninstall it…

sudo apachectl stop

Remove nginx – the ultimate guide

I had some problems with nginx, ajenti and ajenti-v…

I’v removed nginx the easy way, with apt-get autoremove nginx etc, but when I tried to start the service after install it I was getting awk: cannot open /etc/nginx/nginx.conf and nginx didn’t started etc….

This is how I removed it!

sudo apt-get autoremove nginx
sudo apt-get --purge remove nginx
sudo apt-get autoremove -f && sudo apt-get autoclean -f
sudo find / | grep nginx | sudo xargs rm -rf