MongoDB: fixed not starting error

Just use these:

sudo -u mongodb mongod --repair --dbpath /var/lib/mongodb/
sudo service mongodb start

Of course change dbpath to your dbpath, this one is default.

Basic Auth .htaccess 101

All these are working on Ubuntu 13.04

1. Check if apache modules are loaded:

on ubuntu this one works find:
apache2ctl -M

 auth_basic_module (shared)
 authn_file_module (shared)
 authz_default_module (shared)
 authz_groupfile_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
not all required, but my config is loading these now. auth_... and authn_... are realy required for my example, but i don't know which of those authz are required..

How to make DOM not to wait till javascript is downloaded and just open the page?

That's easy. Just add async attribute to the script tag. DOM will be ready before Javascript is downloaded, so the visitor will see contents of the page faster. It's always better, when your JavaScript is only used for user's interaction.

How to check if image has no code injected?

If you let images with code injection be saved on your server, it is possible, that it's a highwayto your php files and whole database, so it is important to make sure, that if user uploads avatar, it is really an avatar, not some hacky stuff with code injected into the image.

Free Ajax URL shortening service with 1 letter domain!

Hey geeks! Today I will share with you my new Free Ajax URL shortening service with 1 letter domain! It is simple to use, just make POST or GET request to this url:


Google April Fools jokes 2013

Here you can see all Google April Fools jokes for 2013. If you know something more, please write about it in comments.

Symfony 2 and ZipArchive - class not found!

It was crazy. I was trying to make my ZipArchive work and I know now, that it was already working just Symfony2 did not knew about it!

Fatal error: Class 'Demo\AcmeBundle\Controller\ZipArchive' not found 





php5/ext/pcre/php_pcre.h:29:18: fatal error: pcre.h: No such file or directory while installing php zip

I was trying to use ZipArchive, but i got an error:
Fatal error: Class 'ZipArchive' not found
Then I started to Google how to install zip extension on my Ubuntu Apache 2 server. I have PHP version 5.3.10 and in configuration it says, that zip is enabled. This information you can get with these 2 simple commands:

How to use template engine in Symfony 2?

Symfony 2 comes bundled with Twig template engine, so you definitely want to use it. Twig template engine has everything what you need to keep your business logic out of templates and stay on MVC pattern, which is used in Symfony 2. The best thing about Twig template engine is that in many cases it is even faster than raw PHP, because finally it renders to raw and optimised PHP code.







How to join 2 SQL tables with PHP? Examples and visualisations


Often you need to join data from 2 tables. You can do it with several SQL queries and PHP, or just use JOIN functions. The JOIN keyword is used in an SQL statement to query data from two or more tables, based on a relationship between certain columns in these tables. Most popular joins are INNER JOIN, LEFT JOIN, RIGHT JOIN and FULL JOIN. It's always good to know the different.








How to hide post footer in blogger all posts or archive view?

In Blogger's configuration you can choose what to show in the footer of your posts, but there are only global footer options for all views of your posts - view of one post, view of all posts list or archive. To hide blogger's post footer in all posts view and in archive view, use this JavaScript custom code. It is fast and super lightweight:






How to add custom HTML/JavaScript to Blogger blog?

No matter what you need - add your custom adsense or analytics code or make some new feature, if you need to add your custom HTML/JavaScript code it is easy to do without changing your blog's theme. Follow these steps:







How to start with git versioning?

Git versioning is technique to make versions of your code. It's great for backuping and managing bugs in code. There are some popular sites which gives you ability to start versioning easy. Some of them are free only for public project, some are free for both public and private projects. Most of them are doing pretty same task - enabling you to versionise your precious code.






After update of VirtualBox virtual linux cannot see eth0 or eth1 network card devices. No connection, how to fix it?

 I have a local network with my virtual machine. I have updated VirtualBox and my network with virtual linux crashed. No network devices were found, nothing helped. The problem was with old configuration of network card's MAC addresses.







What is a Favicon? Where can I get it? How add favicon to my site?

Most website have favicon and it's great to have one. It helps your user to find your page easier between his/hers bookmarks or opened browser's tabs. Generally favicon means favorite icon, you can find it here:


What is the different between HTML CSS PHP and JavaScript?

What is the different between HTML CSS PHP and JavaScript?
That's a good question. It's very important to understand this different before starting to develop any website. So let's dive in:

HTML - it's like bones for your site. It says what to display on the user's browser: Tables, titles, paragraphs, lists, links etc. It is client-side language which is understood by browsers like Google Chrome, FireFox, Safari.





How to get free template for a website?


That's an easy question. Just go to free-templates.lt and you are almost done. There are lots of free templates for Joomla, Drupal, WordPress or Blogger. You can search by color and choose your best match for free.