Contact us

Blogs by

karalmax

knackforge blog

How to enable Gzip compression in Apache

The mod_deflate module provides the DEFLATE output filter that allows the output from your server to be compressed before being sent to the client over the network. mod_deflate is the replacement of mod_gzip which was used with an older version of Apache.

Enable Gzip Module in Apache

       By default, mod_deflate module is enabled in Apache. To make sure that it is enabled, check following line in Apache configuration file.

Continue reading →
knackforge blog

How to automate backup for our codebase & database

Most of the sites rely on codebase & database which we can't afford to loose. We definitely need to implement a backup procedure in that case, otherwise we may loose our valuable data due to some kind of mishap (manually delete some data by mistake, software errors, hardware errors, server compromise, etc).

We can use the following shell script to make backup (codebase and database).

First let's create the backup script file:

nano /path/to/script/backup.sh 

and add the following code:

Continue reading →
knackforge blog

Expanding the Storage Space of an EBS Volume on Linux

This guide applies to increasing the root volume size of an EBS EC2 Linux instance on AWS. By default most Linux instances come with an 8GB root volume unless you changed it at first launch. If you are one of the people that forgot to do this or you just simply need to extend the volume take a look at this guide.

I started out with an Amazon Linux instance and an 8GB volume.

1. First you want to navigate to you EC2 console at https://console.aws.amazon.com/ec2/

Continue reading →
knackforge blog

CDN Module, and Amazon Cloudfront in Drupal 7

Recently I decided to check out Amazon CloudFront to use it as a CDN. I felt delighted as it was so easy to setup with drupal and configuring it involving just a few steps. Another thing that excited me was its cost. It is really really cheap, just costs about 12 cents per gigabyte of transfer.

Step 1: Create a CloudFront Web Distribution

     To create a CloudFront web distribution

Continue reading →
knackforge blog

Redirecting the site using the htaccess

You can redirect your website to another by using RewriteRule in .htaccess.

For example:

If your website URL is example.eu, it can be redirected to another URL example.ch using htaccess.
If suppose your URL is example.eu/blog then the URL will be redirected to the same page.

The below rule have done this

RewriteCond %{HTTP_HOST} !^m\.
RewriteRule ^$ http://example.eh [R,L]

 

Continue reading →
knackforge blog

How to set up a video background in Drupal 7 using the jquery.videobackground plugin

I’ve recently been working on a jQuery plugin that uses a HTML5 video as the background for a page. An idea that perhaps owes far too much of it’s inception to splash pages, it was worth investigating; as a test for HTML5 video player development and because of it’s interesting use of the video element.

This blog explains about how to set up video background in drupal. There are many plugins available to create background video in drupal and I am going to discuss jQuery videobackground plugin. The plugin should work in any browser that supports HTML5 video.

Continue reading →
knackforge blog

How to deal with hover on touch screen devices

Links with hover styles on touch devices are a bit of a complication. In short, they don’t really exist on these devices. Creating fancy :hover styles can really add to the browser experience and help simplify your layout, but they simply will not work on a touch device. When a tablet or smartphone user taps your hover-styled link elements, the hover style shortly appears, and immediately the underlying link is followed/activated.
 
So how do we handle this problem?

Continue reading →
knackforge blog

How to install XHProf (for Drupal)

XHProf is a hierarchical profiler for PHP. It reports function-level call counts and inclusive and exclusive metrics such as wall (elapsed) time, CPU time and memory usage. A function's profile can be broken down by callers or callees. The raw data collection component is implemented in C as a PHP Zend extension called xhprof. XHProf has a simple HTML based user interface (written in PHP). The browser based UI for viewing profiler results makes it easy to view results or to share results with peers. A callgraph image view is also supported.

Continue reading →
knackforge blog

To check Caps lock is on/off status in jQuery

I'm sure that this script will help you in some of your projects that needs a username and password.
Sometimes when we want access to a secure page that asks for a username and password and we submit the information but we didn't know that the password was submitted in upper case, we get an error.
 
Solution: 
jQuery('#username').keypress(function(e) {
  var s = String.fromCharCode( e.which );
  if ( 

Continue reading →
knackforge blog

How to Enable MySQL Log

If you are a Web Developer, you need reference to various log files, in order to debug your application or improve its performance. Logs are the best place to start troubleshooting.

Continue reading →