leopathu's blog

Optimizing JPEG Images

image

JPEG is a lossy format, which means you lose information every time you save it, even if you choose 100% Quality, But all the JPEG images have some information (comments/Meta) data within it without losslessly. A tool does this magic is called JPEGTran and is likely already have an UNIX/Linux , If not see how to install it in linux and windows exe file here.

So optimize the JPEG information without losslessly with removing meta information and comments, The following command would do the magic,

Tips to Speed Up your Website

seo

Speed up the website loading time is one of the option to increase the site SEO performance which means to get more visitors for the site. The following would happen for a second delay page load time, 

  • 11% Fewer page views 
  • 16% decrease customer satisfaction 
  • 7% loss in conversion 

And also some studies founds the following interesting results, It might be shock you, 

PHP Array Overview

Array is a structured data which holds different types(string, array, object) of values and one or more values in a single variable, for example if you want to store 50 different types of values in a single variable instead of storing in 50 separate variables the array would help in that situation.

There is three different types of array available,

1. Numeric Array :

The array stored value's index will define by numbers, the index will be starting from zero.

Sample :

OOP (Object Oriented Programming) in my Style

oops

Download : 

Sample Code

1. Class :

         It is a template definition of the methods and variables (properties) in a particular kind of object

         1.1 Methods :

                 It is similar to function attached to specific classes.

         1.2  Variables

                A symbol of a name that stands for value.

 

Prevent Browser to take more memory from system

browsers

We all know our all browsers are memory eaters especially Chrome, Firefox. So when we open the more no of tabs and using more no of time everyting slows down and sometimes its crashes the browser, The worst part of this is it would affect the performance of the system as the tabs continue to run background processes and feed on your system's memory.

Chrome have a great tool to solve the issue without any headache,

Drupal Tricks - 1

drupal-tricks

I needed a way to check the currect user has permission to view the currect/particular page, Searched lot finally got the exact way, going to show the tricks to you in this blog.

Drupal has an api called " drupal_valid_path " , Normally it used to test the url is valid or not. but the trick is that, It also check the user has permission to view the currect/particular page.

String Quotes in YAML File

yaml

 

We all know YAML is "a human friendly data serialization standard for all programming languages". In Drupal 8, the old .INFO files are now gone and have been replaced by YAML files - pronounced “yamel” (rhymes with camel). The following will show the tricks on strings,

Strings : Strings in YAML can be wrapped both in single and double quotes. In some cases, they can also be unquoted:

A string in YAML

'A singled-quoted string in YAML'

"A double-quoted string in YAML"

 

Install Drupal Using Drush

drush

Most of the times developers don't like the GUI, It makes feel lazy. Drupal has a tool (Drush) to do some management work from command line.

And also the installing the drupal site makes very lazy while doing with browser, The Drush has an option to install the full site with a single command.

The Following command will install the drupal in standard method,

drush site-install standard --account-name=admin --account-pass=[useruser_pass] --db-url=mysql://[db_user]:[db_pass]@localhost/[db_name]

Best Way to Install Python in Linux Mint

python

In this blog, I am going to share the best way to install python in linux mint.

First, We have to install some depedencies,

sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

Then Download the python source for the linux environment by the following commands.

cd ~/Downloads/
wget https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tar.xz

Extract and goto the libraries,