Tuesday, January 15, 2013

Why upgrade to Gimp 2.8

After a rather long wait, Gimp has finally rolled out the new version 2.8 . This version comes with most of the features I was missing in the previous version. The new Gimp 2.8 has

Single window mode : I am out of words how much I was waiting for this.

Multi-column dialogs : It's just so useful when you are doing some complex designs. and have to use two dialogs at the same time without letting yourself bogged down with multiple windows.

Group Layers: Anybody who worked on Photoshop was missing this here. Thanks to the developers for this nice update.

Detailed release notes : http://www.gimp.org/release-notes/gimp-2.8.html

Monday, January 14, 2013

.htaccess in apache2.2/2.4 on Ubuntu LAMP setup

.htaccess not working after installing Apache

htaccess files don't work on Apache server server by default and anybody who moved from using wamp/xampp to apache encounter this problem.

htaccess is a file which can be placed in the folders of document root and is meant to override apache configurations for that particular folder. It is loaded by apache while serving request i.e. during runtime. htaccess being located inside the document root can be accessed by anybody editing the application and thus pose a security risk by it's ability to override server configuration. Hence, an Apache installation installed with default virtual hosts in /etc/apache2/sites_available/ have htaccess disallowed.

But wait! I have used wamp without any such configuration. Why this mess? If you have any experience with XAMPP or WAMP, you might have noted they allow the htaccess files by default. The reason is that while these two are for development purposes only, Apache on Linux is built for production environments. Hence, it has most of the security arrangements in place by default.

So what should you do?

It is therefore recommended to add the htaccess commands inside a directive tag in the apache configurations. Edit the virtual host file under
/etc/apache2/sites-available/
and replace
Allowoverride None with Allowoverride all . Save the file and reload apache server with

sudo service apache2 reload

Now the .htacces files located in the document folder should start working.

Why not to use .htaccess? What could be problems with .htaccess?

On a production environment, if you have access to the apache configuration files, it's always better to edit apache.conf or virtual-hosts file instead of allowing .htaccess. Why?
It decreases server load, decreases page load time resulting in better user experience. If htaccess is set to allowed and you are serving a request for /scripts/js/jslib/myjavascript.js, the server searches for a .htaccess at each folder i.e. it first searches for /.htaccess, then /scripts/.htaccess ,then /scripts/js/.htaccess ,then /scripts/js/js-lib/.htaccess . This has a direct effect on server load.

How to edit apache configuration instead of allowing .htaccess?

Case: You need to put a .htaccess file in the folder /var/www/master/ to redirect users from example.com to www.example.com. Thus, the contents of your .htaccess should be roughly the following
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php

Alternative: Edit the apache virtual host file corresponding to your site and add the following directive instead inside the virtual host tags

<VirtualHost *:80>
 ......
 <Directory /var/www/master/>
  RewriteEngine on
  # if a directory or a file exists, use it directly
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  # otherwise forward it to index.php
  RewriteRule . index.php
 </Directory>
 .....
</VirtualHost>

Reference :
1. http://httpd.apache.org/docs/2.2/howto/htaccess.html#when

Tuesday, May 29, 2012

Bandwidth Optimization



don't let your website crash at that crucial point


Imagine an online contest taking website, or railway ticketing website, as soon as the clock strikes, there are hundreds or thousands of visitors thronging their bandwidths. Such website often get crashed or hanged. They need to make the most of the bandwidth alloted. Bandwidth optimization has grown into an essential topic for Web developers around the world. It's of vital importance to commercial websites especially those which have timed events. There are several examples where this aspect requires a good deal of thought.

Let's look at a closer picture. Imagine data coming out of the server, when a number of users come to the site at one time. The hundreds of HTTP-request made to the server are queued. While the server is a single computer(if we ignore a cloud platform where the request is redirected to another server in place of being queued) . It can handle a limited number of requests at a time. Several requests get timed out either from client or server side resulting in a small percentage of successful requests. The number of requests that a server handles at a time is the bandwidth. This is different from the one which is expressed as the amount of total data which the server provides in a given time often expressed as GB per month, but is generally unlimited if you are ready to spend a little. Such crowded scenario can be avoided by using certain bandwidth optimization techniques. I know a few of them so sharing with you. Don't let your website crash at crucial moments.
  1. Using image sprites Image sprites is a technique where a number of images are clubbed into one single image or a image and it's on-hover image are clubbed together. Such techniques are generally in use for toolbar icons or even those which are to be loaded again and again.
  1. Compress images Images can be hugely compressed to reduce it's size and scrap all unwanted hidden data from the image. For example, in Photoshop you can “save for web” instead of normal save. Similarly, large images can be substituted for SVG vector graphics. A cleverly made vector graphics can be made very small in size, though this is not always feasible. Use a compressed JPEG image whenever possible.
    Use polyclip.js for adding alpha channel to JPEG images. It'a a useful javascript library developed by Zoltan "Du Lac" Hawryluk using HTML5.
  1. Cache images Images often tend to be bandwidth extensive resource. It is best if you ask the user to cache it in the browser. This can be achieved by javascript and is recommended when an image is to be loaded in almost every page.
  1. Minification The script files can be minified to a large extent and it's an obvious first step towards decreasing the total size transferred to the client for a complete page loading. Mnification is the process of compressing script. Minificaton finds out the repeating group of words in file and tries to reduce them to numbers. It also removes all unwanted spaces and trailing tabs to make up a small script file.
  1. Clubbing together the imported files Every web page page is accompanied with a host of supporting files, the stylesheets and script files. All these files are requested from the server in separate HTTP-requests. These requests often increases the loading time. If there are more than three or four such files they can be clubbed as single stylesheet and single script file. The backend can also be programmed to bundle all these files together before sending to the client.
  1. Avoiding Flash I am discouraging Flash but Flash is actually a very high bandwidth consumer. Using Flash content increases the loading time on the client side as well. With the advent of HTML5, SVG etc. (I am not very sure how WebGL ranks in this respect) , it is recommended to avoid flash wherever possible.
  2. Moving to a cloud platform/higher bandwidth At the end, when all the above means fail to make your website stand against a wave of traffic, it is always advisable to shift to a better host providing a wider bandwidth. You are lucky enough to get such huge traffic go ahead and spend that extra dollar to get a next generation cloud platform.
“When traffic comes grab it with both hands”

The trick is to reduce the number of HTTP-requests made to the server and compressing a complete page into the smallest possible size. There are many other methods that I don't know and would love to hear from you. Please mention those methods in the comments.

Saturday, April 21, 2012

Touchegg!! WoW!!

No, that's not Mac.. that's Ubuntu *grins*. No, you don't need to write out everything you want on a Ubuntu. You actually don't need to open a terminal unless you love to do so...


That's my usual reply to a window user amazed at the beauty of my beloved 'Ubuntu'. Powered on a gnome 3.2 shell and Ubuntu 11.10, studded with diamond like extensions and completed with touchegg customization my OS is at it's best. So, I thought it is the right time to share with you my Ubuntu desktop.

Monday, April 9, 2012

An Obituary


शोक-समाचार - 'संयुक्त प्रवेश परीक्षा ने ली अंतिम सांस
संयुक्त प्रवेश परीक्षा (जेईई)
(9 अप्रैल 1960 – 8 अप्रैल 2012)

लंबे समय से कपिल चप्पल की मार झेल रही 'संयुक्त प्रवेश परीक्षा' ने अंततः 8 अप्रेल, सांयकाल 5 बजे दम तोड़ दिया| आप 52 वर्ष के थे|

आप प्रारम्भ से ही बड़े सख्त मिजाज थे| बच्चों के देखकर ही आपका पारा चढ जाता और आप उन्हें डराने धमकाने लगते| फलस्वरूप छोटे बालकों में आपका आतंक व्याप्त हो गया| लेकिन बढ़ती उम्र के साथ आपके मिजाज़ में कुछ नरमी आई|

'मानव संसाधन विकास मंत्रालय' के साथ लगभग तीस वर्षों तक आपके मधुर वैवाहिक सम्बन्ध रहे| जिसके फलस्वरूप अपनी युवावस्था में आपके सात पुत्र हुए| सभी ने बड़े होकर अलग-अलग शहरों में अपने पिता का नाम रोशन किया| लेकिन इतने से उनकी सांसारिक इच्छाएँ खत्म नहीं हुई| अपनी ढलती उम्र में भी आपने 'फाईट मार कर' आठ कमजोर-कुपोषित बच्चों को जन्म दिया| ऐसा प्रतीत हुआ मानो वे 'क्वालिटी' की बजाए 'क्वांटिटी' पर ज्यादा ध्यान दे रहें है|

बाद में आपका रुझान कोटा नामक 'कोठे वाली' की तरफ बढ़ने लगा| उनकी पत्नी (मानव संसाधन विकास मंत्रालय) ने कोटा से उनका पीछा छुड़ाने के लिए 2006 में उनका पूरा हुलिया ही परिवर्तित कर दिया| लेकिन कोटा ने उन्हें फिर भी पहचान लिया और तब से उनके सम्बन्ध और भी प्रगाढ़ हो गए| अंततः कोई चारा ना देख उनकी पत्नी ने अपने 'सीरिअल किलर - खूंखार दरिंदे – राजनेता भाई' कपिल चप्पल के साथ मिल कर अपने पतिदेव 'जेईई' के क़त्ल की साजिश रची| अपनी राजनीतिक शक्तियों का प्रयोग करते हुए 'श्री चप्पल' ने 2010 में 'जेईई' पर घातक हमला किया तब से वे जिंदगी और मौत के बीच झूल रहे थे|

लेकिन जेईई के आई.सी.यु. में भर्ती रहने के दौरान ही उनकी पत्नी 'मंत्रालय' ने ISEET नामक अज्ञात शख्स के साथ अपने संबंधों का खुलासा कर दिया| उन्होंने ये भी घोषणा कर दी की 2013 में वे परिणय सूत्र में बंध जाएंगे| मृतक जेईई के १५ बच्चों के साथ अब सौतेला व्यवहार होने की आशंका है|

लेकिन लगता है 'मंत्रालय' की खुशी अधिक दिनों तक नहीं टिकने वाली क्योंकी 'कोटा' नामक उसी 'कोठे-वाली' ने अभी से उसके मंगेतर ISEET पर डोरे डालने शुरू कर दिए है|

शोकाकुल आई.आई.टी बोम्बे, आई.आई.टी दिल्ली, आई.आई.टी कानपुर एवं समस्त आई.आई.टी परिवार|

(इस आलेख का उद्देश्य किसी को ठेस पहुंचाना नहीं है, और अगर आपको ठेस पहुचती है तो इसे मात्र एक संयोग कहा जाएगा ... सायोनारा)
Share it till 'Kapil Chappal' read this :P
with - Rajneesh meena & jotoo !
Shared by Rishabh Jain on Facebook.