So I haven't been blogging lately -- to be honest; I had hoped to let this blog die a natural death and so on and move to different (PHP5 supporting) hosting but I was inspired a bit back and am taking baby steps on this blog.
The plans to move this blog are still underway, just a bit blocked by certain other stuff I'm doing right now. How many of these posts survive the transition is a point I have not yet decided. A few certainly; all -- definitely lot.
Back to the point -- from The Ground Beneath Her Feet / Salman Rushdie
These things are bad for you: sex, high-rise buildings, chocolate, lack of exercise, dictatorship, racism! No, au contraire! Celibacy damages the brain, high rise buildings bring us closer to God, tests show that a bar of chocolate a day significantly improves children's academic performance, exercise kills, tyranny is just a part of our culture so I'll thank you to keep your culture-imperialist ideas of my fucking fiefdom, and as for racism, let's not get all preachy about this, it's better out in the open than under some grubby carpet. That extremist is a moderate! That universal right is culturally specific! this circumcised woman is culturally happy! That Aboriginal whistlecockery is culturally barbaric! This image has been faked! Free the press! Ban nosy journalists! The novel is dead! Honor is dead! God is dead! Aargh, they're all alive, and they're coming after us! That star is rising! No, she's falling! We dined at nine! We dined at eight! You were on time! No, you were late! East is West! Up is Down! Yes is No! In is Out! Lies are Truth! Hate is Love! Two and two makes five! And everything is for the best, in this best of all possible worlds.
Another passage, after a long long time
Food. Warmth.
These were the thoughts that scurried through his brain. Over and over.
Times were harsh. Friends and family were disappearing; and no one knew where they went. Those sent on foraging missions disappeared, and some were found -- dead -- after an extremely long time.
It had been generations since the world had been warm. He had been born in hardship; suffering was all that he knew. No one alive knew what it had been like before. But they all agreed on one thing: life had been much better then. It was much worse now.
It wasn't like they hadn't tried. There had been attempts to go to better places; but none had been successful as far as they knew. There had only been one survivor from their expeditions -- and he had arrived half-mad, half-dead and died quickly afterwards. The only things he spoke of was some poison air, a great white light and giants.
Giants! Hah. There were always rumours, but none had been proven. All they saw was simply a result of nature... Giants. Stuff of dreams and nonsense. All of them dismissed all claims.
But there were always those awful rumours, always whispered. Of the mountains moving, killing them, hitting them. Covering them with their poisonous breath... But that was all they were -- rumours.
He was suddenly woken from his reverie by his brother. It was happening again! The gate to salvation -- to heaven was opening! And he had been chosen to investigate! He was afraid, true, but it was for the good of the colony.
He quickly, nervously, scurried through the gate.
Where I stepped on it, and ended another pain-in-the-neck ant's life.
Xenocide
- A complete redesign of this blog, from the ground up.
- Editing and trimming posts I like, and deleting those I don't.
- Handling tweets better.
- Creating a personal framework of Javascript MVC to interact with CodeIgniter.
- An adobe AIR Application for making and saving notes.
- A fb extension for said application.
- A web based feed reader.
- Tutorials for most of the stuff above on this blog.
The best laid schemes o' mice an' men
Gang aft agley.-Robert Burns
Plans.
So today's post begins with a question: what editor is your favourite? Do you have separate editors based on different contexts (eg. Netbeans for Java, Dreamweaver for sites), or do you tend to stick to a single Man Friday to fulfill all your needs? Do you prefer IDEs or simple text editors?
My answer for the above questions:
I love gVIM (graphical VIM). I've set it up to work over SSH in Windows (I work on a different box and merely use my laptop as a convenient interface), hidden all menu bars and installed a colour theme pack of which I'm currently using "Evening". And I've started using VIM for every code related task I do. In defence of my choice, allow me to introduce some of the basic functionality included in VIM and some practical use cases: (Not intended as a tutorial, but a quick glimpse at the great functionality on offer)
- Simple Editing
Typographical errors are the programmer's bane. And if they're not shown as errors (occasionally the case with various Javascript libraries), life becomes hell. Quick correction options in vim:- dw, dd, etc. Basically, both for deleting and cutting text. dw deletes till the end of the line. d2w deletes 2 words. dd deletes the current line. Entering %d on the command line (i.e. using : ) deletes the full file. D deletes until the end of the current line. Considering standard equivalents, I'm always astonished by what I can accomplish so quickly in VIM.
I really tend to use d...d to quickly get rid of large chunks of commented code. Or simply for moving code around very very quickly. - r, rw, etc. d was for delete. r is for replace. Need I elaborate?
I tend to mis-type certain words a lot. Really easy for me to just go over the offending character and type in rx, where x is the new character I want to replace it by. - o, i, a, A, etc. Single keypresses for: 0: add a new line after current one and start editing, O: add a new line before the current line and start editing, a: start appending after cursor, i: start inserting before cursor, A: insert stuff at end of the current line.
A is the forgetful programmer's boon. Really useful for adding ; at the end of lines.
- dw, dd, etc. Basically, both for deleting and cutting text. dw deletes till the end of the line. d2w deletes 2 words. dd deletes the current line. Entering %d on the command line (i.e. using : ) deletes the full file. D deletes until the end of the current line. Considering standard equivalents, I'm always astonished by what I can accomplish so quickly in VIM.
- Editing over scp/ftp/etc.
Vim comes with a special plugin (NetRW) that lets you quickly edit files over your protocol of choice. I regularly use
:e scp://<username>@<host>/path/
to get a directory listing of all the files in that path; choose your file and edit away. - Search and replace
Ever changed a variable at the last minute and had to change it? Easily carry out regular expressions over very simply defined yet complex range of lines using /<pattern>/ or :s/<pattern>/<substitute>/flags. You can even carry out commands on matching portions. One of the most useful features I've used once I got the hang of it. - Ranges
Vim's flexibility in terms of defining ranges for substitution/deletion/anything you'd care to mention is amazing. One of the features I most constantly use is 'marks' that allow you to mark certain positions to be easily referenced later. - Too many colour themes
The amount of possible colour themes available is astonishing. And allows a UI freak like me to be completely satisfied with what I'm coding in. And switching quickly when I want to. - Registers
Registers allow you to cut/copy and store stuff in different named "registers and then paste where and when you want. Anyone who's shuffled through various files can easily comprehend the huge help this is. - Buffers and Tabs
Tabs are essential to any decent program today. Buffers are tabs without the graphical interface indicating their presence. The best part is while using Vim in linux I tend to use
gVIM -p *.php
and other such commands to quickly open all files of a single type in tabs in a single window. Really makes finding the right file much much easier. - Sessions
Using :mksession and :source allow you to quickly open all the files you had open the last time you sat down to work. And as you get to choose where the file containing the session is saved, handling sessions becomes really simple and easy. - Abbreviations
How many times do you find yourself using common stuff like console.log() or error_log() while debugging? Just use the command
:ab cl console.log
and every time you type cl( (followed by a space/newline/./(/etc.) it will be automatically expanded. I imagine you can see the possibilities. Interestingly, abbreviations can be saved in sessions so if you don't want to keep an abbr. around for a long time, or have something specific (such as a class name) just use and save it in the session. - Key Mapping
Map keys to carry out your most often used commands. - An awesome community
There are thousands of sites out there with pointers on using VIM as well as an excellent Vim tips twiki. Be sure to check out the VIM tips twiki and this presentation on VIM for PHP programmers by Andrei Zmievski to get a much better idea of what VIM is capable of.
Also, for those of you who edit a lot of stuff on the web (using text boxes), install It's all text to edit any text box's contents using your favourite editor (VIM, anyone?). This post was written in gVIM, opened via "It's all text" on the excellent blogging platform provided by Wordpress.
Editors for coding?
So. My second Saturday went marginally better. Why?
No movie.
2 books this time around. (PHP/Rasmus; Legacy/Salvatore).
Spent far more time sleeping and far less time roaming around aimlessly.
Tonight seems promising (in terms of stuff done).
And also managed to arrange clean clothes for next week
.
And the second Saturday
Tangent isn't working right now. The Yahoo Context Extractor service seems to be down / not accessible in IIT (maybe our IP is making >5000 requests/day).
Sad.
This means the amount of work I have to do to get it back to work just tripled.

Recent Comments