Serve the contents of any directory with Python’s SimpleHTTPServer
Generally, when I am in a middle of prototyping a concept or in a need of quickly executing Ajax requests or using browser features which would need the page to be hosted on a web server, I use Python’s SimpleHTTPServer module.
Python’s SimpleHTTPServer is a great way of serve the contents of the current directory,all one needs to do is change directory and execute a command which will expose all contents as if they were hosted in a web page.
Avoid console errors in browsers that lack a console
I love JavaScript and code a lot in it .Since I code, I also encounter problems and bugs from time to time and therefore need a Debugger and a debug mechanism to view whats going on.
In good old days when I learned this language, I used JavaScript’s inbuilt alert mechanism to view the value of a variable or a property of an object. This was a terrible mechanism, calling alert was blocking, one had to press OK to continue and if you had to take a look inside an array then well it was emotionally an overwhelming task is all I would say here.
Position div in the center of the page using css
When I first started web programming, creating a center aligned div was one of the most common task that I saw myself doing.
since div is a block element, i.e. it takes up the full width available, and has a line break before and after it, it can easily be centered using relative styling
{ margin-left:auto; margin-right:auto; width:70%; background-color:#b0e0e6; } However lately I have preferred using absolute positioning technique over relative, this works for all browsers and is best for login screens or alert messages over a translucent shim.
A guide to hosting in Red Hats OpenShift PaaS
In this post,I am going to write about OpenShift, which is Red hat’s free, auto-scaling Platform as a Service (PaaS) for applications.
OpenShift to me is very similar to Google’s app engine in some ways,but openshift’s offerings are quite diverse, for instance support for ruby, php, Perl, node.js, etc..
Openshift is not like a traditional VPS hosting , although once registered with them, user does get a shell access,but its quite limited , instead OpenShift has a concept of gears and cartridges.
gzip compression in apache using mod_deflate
HTTP Compression is a very simple and effective way to save bandwidth and improve web applications performance over network.
Output compression is basically a process of compressing web servers response by using a loss-less compression algorithm called gzip.
This technique is fairly modern and almost all modern browsers honor it, however if a page is requested from a browser which does not send a header Accept-Encoding: gzip,deflate then the response comes back uncompressed.