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.
sqlite3 Bulk Import CSV from command line
I absolutely love SQLite, be it windows, linux or mac, this light weight database never stops to amaze me.
Few days ago I wanted to import a chunk of CSV data, which was 4 GB in size into a table in SQLite.
I generally use Firefox ’s sqlite-manager plug-in for usual tasks with SQLite database ,hence decided to use the import interface .
I have had a very good experience with this GUI tool and it has rarely failed me, but this time I was disappointed.
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.