Home

Archiver

way to memories

Journal Info

isn't it??, colorful
Name
Pravin

View

Advertisement

July 29th, 2009

Many times, I have felt irritated with default command prompt.

It normally includes PWD (Present working Directory) path in each command.
When you are working in directories with descriptive names and depth of 6 to 10,
command prompt takes lot of screen-space. When you are dealing with long commands
which are inherently complicated, this stupid prompt causes them to overflow into another line..!!!
It is *really* annoying situation.

Finally, I decided to waste few hours for cleanup of my prompt.

It's not very complicated work. It needs editing few lines in ~/.bashrc file.
The $PS1 is the variable which controls the behavior of the prompt.

The PWD path information is undoubtedly useful and should be accessible,
but we don't need it embedded in prompt for each command.
The username, machine name and whole path is always visible on the Title bar of terminal window,
and is updated automatically with each directory change. So, lets drop this information.

I still add '\W' option, which gives the name (and not whole path) for the working directory.
It gives the context of each command without wasting lot of screen space.

Other options added are
'\t' - tells time of command execution
'\${?}' - tells the success or failure of last command. (0 represents success)

So, my $PS1 variable looks like this.
PS1='[\t][${?}][\W]\$ '


With some Google search, it was easy to figure out how to have colors.
And after adding colors, my PS1 became
PS1='\[\033[01;32m\][\t]\[\033[01;34m\][${?}]\[\033[01;32m\][\W]\[\033[01;34m\]\$\[\033[00m\] '

Another improvement was done by modifying the root prompt in a similar way but to use RED color
which will warn user to be careful. Following will generate similar (but reddish) prompt for the root.
PS1='\[\033[01;31m\][\t]\[\033[01;34m\][${?}]\[\033[01;32m\][\W]\[\033[01;31m\]# \[\033[00m\]'



Here is a screenshot showing my new prompt in action !!

PWD is having depth more than 10 which can be seen from the title bar, but still the command prompt is clean.
It also includes the color switch when logged in as root.
Also, one wrong command is executed whose return status can be seen on the following prompt.


Here is the link
which will give information about other possibilities with the prompt.

The various possible color codes that can be used are given here.

Here is my ~/.bashrc file with important line highlighted.

June 14th, 2009

Recently I ended up in little heated discussion which (I think) is related to moral policing.

I am working on an open source project and I was responsible to add a powerful feature to it.
This tool has plethora of ways by which user can shoot himself in his foot. And I made integration of this
new tool with an existing (and quite safe) system very easy. My initial approach was to make this integration as simple
and as powerful as possible. And pass the responsibility of proper usage of such tools to the users.

When the implementation was done, we had a discussion about making it so easy for naive users to add
tools which can hurt. Other developers had concerns that such easy integration will cause more accidents than use
and proposed to use little non-trivial way of same integration. This way, the user need to go out of the box for this integration.

We had some discussions about whose moral responsibility it is. If some stupid user does something without understanding it
and shoots himself in foot, are developers responsible for making those options available for naive users?

On other hand, we can always add speed-bumps to make the access, interface and syntax of these tools harder,
by which we can hope to discourage such naive users. But then we are forcing genuine users (who wants to use that tool)
go through lot of hassles. And this difficult syntax may cause some accidents.

Someone has to decide on trade offs between adding more speed-bumps to discourage naive users and making the actual use of
tool hassle-free for genuine users. But who should make this decision?

Here, the creators of the tools are making that decision, and not the users of the tool.
I was wondering if this is a type of "moral policing" ?
Moral policing is that someone else is making policy what is correct for us and what is incorrect,
and then there are direct or indirect attempts to enforce those policies.
In this case, where creators of the tools are making policies about what is safe for users and what is risky,
and these policies are enforced in form of speed-bumps.

One of the historical example for such case is "dd" command in Unix. It is very useful command
and many times it saves a day when you are interacting with system at little low level.
But there are multiple speed-bumps so that naive users will not mess up this command.
It needs root privileges, the command name syntax is ODD. I guess that they have managed to
keep the naive users on the bay, but on the cost of creating a fear in heart of legitimate users.
I always need to refer the man page to make sure that I have entered arguments in correct way,
and I think twice before pressing enter. If there is a way to avoid the use of "dd", I normally end
up choosing that way.

For any developers, adding the options which will reduce the use of their tool is hard.
But then, sometimes you have to make such choices, and do such moral policing.

Notes :
-- I do agree with my mentors on their inclination for adding more speed-bumps,
even though it means less users for tool.
-- I have not mentioned the tool here because it is still "work under progress" and I do not want
readers of this blog to shoot themselves in their foot.
-- Being an Open source project, anyone who do not agree with this policy is always welcome
to modify it to suit his/her needs.

December 22nd, 2008

I had a deadline for submission of report at 11.59 PM. I managed to submit it by 11 PM. In next 6 hours I am leaving Amsterdam for Europe trip (covering Germany, Austria and France) with friends for next 10 days. So, I had to finish with packing also. By the time I had finished with packing, I had only 2 hrs left to get my sleep :-(. I decided against it, and spending that time to upload some photos and writing this blog. I have been postponing the completion of my half-written blog about First few months in Amsterdam for more than a month, now I am doubtful if I will ever finish that blog.

My old habit of doing things in last moment is still stuck with me. Last week, I had another submission, whose deadline was known to me from past one month, but I did whole work in last 2 days, and submitted it on last possible moment. The problem is that, I always manage to get out of such situations unhurt, and hence not learning the lesson, waiting for one more last moment to trigger the staring of the work. The only thing that worries me is that I may end up paying dearly for this habit.

After three hectic months, next 10 days will be welcome break.

September 19th, 2008

Week in Amsterdam.

Add to Memories Tell a Friend
isn't it??, colorful
It has been a week for my arrival in Amsterdam, and I am still busy in adjusting with it. The way things work here are tooo different for me. Other than the fact that it's expensive place, I haven't found any problem in this place. There are few things that I would like to mention about this place.

The first odd thing that you will find here is in the way of pronunciation. Dutch people pronounce "V" as "F". Trust me, It really creates huge confusion. The name of my university is pronounced as "Fri" University instead of "Vrije" University. The short-cut for University name is "VU", but here they call it "FU". Everything over here is written in Dutch (with very few exception), but good thing is that, most people understand and speak English. And they are not hostile about English, and I have always found them helpful.

The most unique thing about this city is, it's a city of bicycle. As Amsterdam is not very big city, you can walk most of the distances. If you can't walk then you can cycle them. There are not only separate roads for cycles and separate roads for walking, but also separate signals. Highest priority is given to people on foot, followed by cycles and then four-wheelers. If any person or cycle is crossing the road, then four wheeler has to stop there. There are special buttons on all signals for people on foot and for cyclist, which changes the signal, and allows them to cross first. Even I had few experiences that when I just reached zebra-crossing, the cars on road do actually stop, even if they are on full speed, and allowed me to cross first.

Another wired thing is dutch cycles. They don't have brakes !!!!!. To stop the cycle, you have to reverse-paddle it, and believe me, its very un-natural.

Even the way university functions is quite different for me. There is no concept of batch. There is huge flexibility given to you, you can attend any courses that you like after having after informing your mentor. There won't be any attendance. No one knows or cares if you are attending the lectures. You can skip all lectures and directly give the exams. I have been assured by seniors that, I will never find all my batch-mates at one place. Either there will be students from other departments/Universities, or student of your batch won't be there. It is quite true, because I have attended a lecture where I was the only student from my batch. The best part is, I can register for courses in any university in Amsterdam!!!

Anyways, All those things that you have heard or read about Amsterdam are true, without any exaggeration. The smallest example that I can give for it is alcohol as cheap as food.


By da way, this blog is becoming quite big, and there are too many things to list....
So, better I stop here. Sorry that I can't provide any pic's as I don't have digital camera.
If I get one, then I will surely upload photo's from this place.

April 5th, 2006

An Accident

Add to Memories Tell a Friend
isn't it??, colorful
Today, when I left home 4 C-DAC, I missed my first train, it just went in-front of me, I was running and trying to catch the train. The people standing in the door were looking at my poor attempt and few were indicating that I can still catch the train. I could have catch-ed it if I had tried little more hard, but i was quite risky, so I let it go, as next train was just after 15 minutes.

I was waiting for next train, one cop was sitting next to me in civil dress, I came to know that he is cop from the phone call he received. He was talking something "manus padala" ( means man felled ) and kharghar station on his phone. After that he was busy arranging for coolies.

Then train came, I got in and train left. I was as usual standing in the door. Then something unususal happened, train stoped in midway. It never happens on this route as it is single route. suddenly I noticed that 5 - 6 people jumped from the next compartment from me, I recognized few of them as coolies that I had seen on station today. Then I saw something lying near track, It took some time for me to figure out that it was a man. Those coolis also brought one stretcher with them, then they put that man on the stretcher and started bringing him back to local. I was certain that he was dead, when i saw that body falling from the stretcher like big bulky bag. Those coolies again put him back and brought in train. Then they signaled the motorman ( train driver) and train started.

When train stopped at kharghar, I jumped out and rushed to next compartment where everything was happened.
I saw that person,He was around 30-35, not neatly shaved, even clothes were dirty, now turned red because of blood stains. May be a he was a worker or someone doing physical work. Those coolies and cops in civil dress (i guess they were cops) were discussing something about "memo" with one cop in uniform. I was standing there, next to them. One cop showed one valet to that uniformed cop and said he got it with that person. Meanwhile motorman was eagerly waiting for the signal from these people so that he can move the train. Someone said in meanwhile that Khandeshwar station (the previous station ) should give "memo" as accident was in their area. They agreed and train left.

I was standing there, trying to remember his face, may be he was one of the person who was looking at me when i was running for train or may be he was one who was encouraging me to catch that train. I cant remember.

Those coolies and cops behaved quite professionally (if u can call it so) in all this incident. That person was treated as a "something" and not as "someone", and may be he was now "something" only. I guess those people are used to it.

I considered the journey between kharghar and panvel quite safe as it is always less crowed. I don't know how he felled from train. Maybe he was standing in the door, just like me.

March 27th, 2006

My Trek

Add to Memories Tell a Friend
isn't it??, colorful
Hi,
I seems i missed nice picnic of NCST on a Sea fort(murud Janjira)....
But, even I also enjoyed my time on another fort "Sudhagad" of shivaji.
It is somewhere after Pali ( around 2 and 1/2 hrs from Panvel).
We were group of nine...., but i knew only one person before this trek :-(
He invited me for this, and I accepted the invitation.....

We did night trek, we started around 9 o'clock in night, and reached at top at 12 o'clock.
That was the best part of the trek... climbing the huge mountain in the dark night in the jungle :-).
There was a big plateau on the top of that mountain... with few old structures still standing there..

The biggest surprise was that one old lady (maybe around 75) was staying over there all alone.
It was quite shocking that such a old lady can survive there without much help from anyone else there.
She was quite nice, and provided us with tea and milk over there.
We came to know that she is from quite well to do family from one of the villages at bottom of mountain,
but she didn't liked staying there, so she was staying here on the top alone....

Another miracle was of water, there were huge water tanks built by Shivaji.
These water tanks have water throughout da year, we don't know how.
There are supposed to be some 30 such tanks as per history records, but we managed to find only 3 of them :-(.
Even these tanks were quite far for us, and we have to walk quite a lot to get the water.

We were there for two days, cooking our own food, searching for water, dealing with wild animals, and sleeping in open sky...
We were totally with nature, without any electricity and any other modern age help.
even our mobiles were not working as there was no network coverage...
We learned there rappeling ( descending down from a wall using ropes) there.
There were many other things that we wanted to do, but even two days were not enough for us.
Most of the time went into managing survival only.

Overall it was nice experience, I am looking forward for some more such experiences.
Tags: ,

February 14th, 2006

Intro

Add to Memories Tell a Friend
isn't it??, colorful
Hi,
I am Pravin Shinde, new informal project trainee in NCST Kharghar.

Well not exactly new, I am here for last one and half months.
And informal because I am not officially recruited by NCST,
I have been just alloted the project by sasi sir.

Don't ask me why my ID is lvalue, I have tried 2 get all possible IDs
I tried xor, gabbar, _gabbar_, pshinde, _pshinde_, ping_pong, tcpip, 111 and many more.... but in vain :( . Finally I managed 2 get this id. Well, Its very hard to get good ID now days :( .

Well, this is quite a good place 2 work. U get 2 do whatever u want ( atleast 2 me ). Good quality research work is going on here. I will get lot 2 learn here ( including blogging ).

This is my first blog, so I wont bore u much....
Powered by LiveJournal.com