[Bash] Quick file renaming

November 28, 2007

I had a bunch of .deb packages from the apt archive. But the problem was that in the names of the packages, there was a “%3″ in the places where there should be a “_”. We found that the symbol was corresponding to the underscore character and it was somehow getting replaced in the name. Hence we needed to rename all filenames, changing the ‘%3′ to ‘_’ and I was requested to write a quick script. As my usual bash buddy was busy, I resolved to some Google’ing and found this.

I first started by trying to echo the file name, then replace the ‘%3′ with ‘_’, print it, and finally rename the file.

for FILE in `ls`; do echo $FILE; done;
for FILE in `ls`; do NEWFILE=`echo $FILE | sed 's/%3a/_3a/g'`; echo $NEWFILE; done;
for FILE in `ls`; do NEWFILE=`echo $FILE | sed 's/%3a/_3a/g'`; mv "$FILE"  $NEWFILE ; done;

But when I execute my final script, it informs that the oldfile and newfile to the `mv` command are the same. Think the `sed` command itself renamed the file. Anyways, it did the job I wanted it to :)

Updates from floyd_n_milan:

for file in *; do mv -v “$i” “${i/\%3a/_3a/}”; done;


if you are in a mailing list

November 28, 2007

Still I remember the day I joined my first ever mailing list, with a warning from my mentor not to immediately jump into mailing the list. It was followed by 3/4 months of observation period where I just kept reading mails, queries and replies. I was asked to learn how people ask questions, how people answer questions and how you shouldn’t ask/answer a question. It also helped me understand the entire idea about mailing list. I also learned about flaming and when did people landed in the middle of one. The monthly reminders on Net-etiquette where quite useful and kept me reminded on what I shouldn’t do. Still there were certain instances where my butt got burnt a little, but its quite normal.

Of late I got an additional responsibility in the ubuntu-in team, as a moderator for mailing list. Since then I have been seeing the inner world of mailing list, only known to the mail admins, about spams, over-the-limit mails, etc. That’s why I decided to write this post, of what not to do and what to do when you are in a mailing list.

  1. Read the mailing list guidelines, otherwise called as netiquettes, and follow them.
  2. Try to improve your linguistic skills, so that you can ask better understandable questions and offer clear replies.
  3. Observe the mailing list before you take active participation. This helps in knowing the unwritten rules followed within the list community and understand better the common participants in the list.
  4. Observe the common participants and pick up a mailing style, while still following the list guidelines such as “do not top post”, “do not over quote”, “crop unwanted text” etc.
  5. Most mailing lists are enabled with “reply-to munging”, which means when you press the reply-to option in your mail client it automatically selects the list mail address as the reply-to address. Be careful, especially when you trying to mail the OP offline and do not want the list to know about it ;)
  6. Please do not indulge in personal duel. Mailing list is also a community and has people who differ in their way of life, profession, experience, expertise, ideologies etc. If you are not ok with anyone’s idea, just state you do not agree, place your points. If the conversation seems to digress somewhere, please remind silent so your butt is not burnt.
  7.  Please answer things which you are very sure of. Try to understand what the conversation or query is actually about before trying to post a reply. Its quite embarrassing to be pointed out that you misunderstood and gave some crap as a reply.
  8. Do not repeat points already posted by others. If you want to second on a posted opinion use “+1″ to mark you support the idea.
  9. There might be a lot of discussions happening in the list. No one tries to participate in everything, though you might follow them up. Please think twice before venturing into unknown lands.
  10. Please stick to the purpose of the list and do not digress. Though many list allow off-topic posting with a “[OT]” tag, that doesn’t mean you can ask anything under the sun.
  11. I seriously advice to use a separate mail account for mailing list subscriptions. This is not just to manage the huge amount of mails you get, but to prevent unknowingly sending personal stuffs, forwards and spam mails to the list.
  12. Those who send “join me in foobar social networking service” are considered to be the worst type of spammers and the list administrator might resolve to kick such people out from the list. Beware!
  13. If the mailing list doesn’t welcome wishes and greeting mails, like “Happy New year!”, please refrain from sending one to the list.
  14. Do not talk about food, religion or politics in a mailing list. These are topics where people have their own preferences and are quite strong in them. Indulging so might lead to people’s sentiments getting hurt and you getting flamed at the end.
  15. Even when pointing others about their mistakes, please be polite. Do not make fun of other’s innocence or negligence. If you are proved wrong, just accept your mistake and learn from it.
  16. New members of the list will be quite enthusiastic (may be they didn’t read a post like this ;) ). Please understand it, give them time and support to learn. Flaming their butt will just create fear and they might leave the list calling it to be unfriendly or egoistic.

Remember, these aren’t rules but just some tips I learnt through the experience of participating in various mailing list for the past few years. Hope it does some help people who are venturing into the new world of Mailing Lists. Good Luck! :)


its foss.in time!

November 28, 2007

One more week to go, will begin one of India’s famous FOSS conferences foss.in 2007. I have been attending it for the past 2 years, first time as a mere delegate and last time as a part of sponsor’s team from NRCFOSS. This time, am taking up a new avatar, experiencing it more closer by being a volunteer myself. This gives me a chance to be a part of such a big conference, though volunteering is not new to me. This experience might prove useful in future endeavors when I take up more responsible roles.

What brings the people, especially a major part of the community, is an opportunity to meet one another, to match names with nicks (especially true for the #linux-india guys) and meet some international contributors of FOSS projects. Last time I had the opportunity of interacting with Aaron Seigo, and eventually I became Pradeepto’s K-convert ;) (a new term for people converted to KDE, especially from GNOME) It was also an occasion for me to meet people I knew through IRC like t3rminator, tazz, barkha, devmodem|anurag, ubunturos, derek_, n3003n and many more.

This foss.in is special because for another main reason, Ubuntu India LoCo team is participating under the Ubuntu-In banner. Though the team had been in existence for quite sometime, this is the first major event its going to show itself up (after Carte Blanche of course, where we had a stall). We have joined with the Debian-In team and participating in the Project Days. Thus we will be enlightening the junta about “how to contribute to the Ubuntu project?” and “how to become one among the proud (contributing) ubunteros?”. We also managed to put ourselves with the Debian-In team in the FOSS Expo as well. One thing to remind is that this endeavor is purely by the Ubuntu-In LoCo team and has no commercial interests. We need to say this because often people relate us to the commercial side of Ubuntu Project, the Canonical Ltd.

We are getting some stickers and bookmarkers printed. We are also expecting some Ubuntu CDs to arrive (some customs and courier issues are holding it back). We might get some t-shirts printed as well, as a token of appreciation for those speakers who spoke for us (mean the Debian/Ubuntu Project Day). We are also getting some handouts printed, about the LoCo team. Similar things are happening in KDE-In team as well, so do in Fedora and Gentoo teams. I hope to get some laptop stickers to fill the empty space in my laptop ;)

I am also hosting some of my buddies, as I have some extra beds in my house and I am allowed to have another 3 people with me. Though there is enough space to accommodate more, some issues in the water line is prohibiting me to host more people. As Kushal is coming back by Dec 1st after more-than-a-month of rest following his arm operation, we have another place to accommodate some of our buddies. The only thing which makes me feel a bit uncomfortable is this is happening during the weekdays and I have to take 5 days off. May be I can compensate by working weekends following the event (as I have no plans to go $HOME before New Year).

All said, its time to clean my house and make it ready for a few visitors. Hope to have an amazing time this year at foss.in 2007 :) As a part of foss.in volunteers I wish my best that the event rolls out to be a success :)


(Python) PyProgram #6 - Finding weeks of a month

November 24, 2007

My colleague had a problem, he needed to separate the dates in a month according to weeks. That is, given a month, he has to find the dates in 1st week, dates in 2nd week and so on. This is need to query and collect a weeks data for a given month. He was trying to write his own solution which we Python guys around thought was a bit non-straight forward. My other colleague Jacob sat and wrote a small Py script to order the dates per week of a given month,

from datetime import datetime, timedelta

current_date = datetime.now() year, month = current_date.timetuple()[:2]

first_day_of_month = datetime(year, month, 1)

if month == 12:

    first_day_of_next_month = datetime(year+1, 1, 1)

else:

    first_day_of_next_month = datetime(year, month+1, 1)

#Subtracting 1 day

last_day_of_month = first_day_of_next_month - timedelta(1)

#First and Last days of the month

print first_day_of_month, last_day_of_month

#Computing start and end week days

first_week_day = first_day_of_month.weekday()+1

date_range = [0]*first_week_day + range(first_day_of_month.day,

last_day_of_month.day+1)

month = []

while date_range:

    if len(date_range) >= 7:

        week = date_range[:7]

        date_range = date_range[7:]

    else:

        week = date_range

        date_range = None

     month.append(week)

for week in month:

    print week

for week in month:

    start_week, end_week = min(week), max(week)

    if start_week==0:

        start_week = 1

    print start_week, end_week

the “dog” joke

November 23, 2007

<He`> not as risky as naming your dog “sex” though

<He`> no as it after the dog runs away at night … and you go looking for him

<He`> and have you explain to the night beat cops… that you are out looking for sex

<He`> it’s rather long one
<He`> he gets married.. and his wife forces him to give up the dog

<He`> they decide to get divorced later.. and he tells the judge.. I had sex before marriage.. and my wife made me give it up after marriage
<He`> and the judge says … welcome to the club

<He`> he goes looking for an apartment .. and tells the landlord .. he needs a room for sex

<He`> and the landlord tells him he doesn’t care if he does it any room

ROFLMAO!! And, here is the original story.


printing tees

November 21, 2007

Its only a couple of week more before foss.in 2007 begins. Every team participating in Project Day are preparing something or other for the event, mostly are T-shirts and stickers for their project. Though ubuntu-in team had been discussing this for some time, we hadn’t actually put anything in to action. When we and tuxmaniac met this weekend in barcampbangalore, we decided to start some action.

We were pretty impressed with the stickers distributed during the barcamp. Instead of giving tags and coupons, they had print different kinds of stickers which can be stuck on to the shirts. There was sticker to write names, there was “this is my [nth] barcamp” sticker, there was “i am barcamped” sticker and there was a barcamp laptop sticker as well. We felt this idea was cool and we can also make use of it for the project day. We made some enquiries and found out it was well within our financial capacities. So we decided to print the stickers and sought Niyam’s help in designing one for us, as he had been desgining logos for foss conf chennai of late.

We might also be printing some Ubuntu posters to put up in the stall and around the venue. We had come out with a handout pamplet during Carte Blanche which we might use for this occasion as well. All we need is someone who can take a laser printout of the handout and make nice xerox copies of out, some 500-1000 nos will be enough.

We also were thinking about printing some 20 T-shirts to be distributed to the speakers and enthusiastic contributors. Initially there was Yahoo! interested in sponsoring us for the T-shirts. But there were lot of fluster as Y! is not a sponsor for this year’s foss.in and giving a T-shirt sponsored by them might be not welcomed, even might drag us into some unwanted problems. So, we have decided to make a pool of as much as we can and print some T-shirts for the speakers of Debian/Ubuntu Project Day. We are also enquiring whether it is monetarily feasible to print some mugs as well, may be replace t-shirts with mugs as every other team is printing tees.

To print T-shirts, we are looking for people to contribute to the money pool. As the Loco Team has to take care of itself and its needs this time, we are looking for contributions from the team members, from enthusiastic Ubuntu users as well as people from the community to help us in creating a pool so that we can print some nice t-shirts for those people who are speaking for us during the Project Day. We may also use the extra tees to reward people for their contributions and volunteering for various ubuntu-in activities (we do not promise this, but we will try to :) ).

Looking for your helping hands… :)


at Bar Camp Bangalore 5

November 17, 2007

Here am, successfully connected to the wifi (*sigh* there is a proxy) and unsuccessful in connected to irc (oh, am dead today) from the campus of IIM Bangalore. The event has just begun and instructions are being informed to the delegates.

I came here with Raj Shekar (lunatech) and thus arrived just in time. Raj is giving a talk on “Why MySQL Rocks for the Web” by 11 a.m. in the hall next to me. Iwill have to figure out what I do after that. Anyway will be hanging around here till the evening and will try to update as and when it is possible for me.

11.25 hrs, L12, IIMB:

Raj faced a minor confusion regarding the schedule. Raj had added his talk on the board, but when we entered the hall bloggers collective was trying to start. Thus we had to resolve it such that Raj’s talk will first happen, followed by the bloggers collective. Its going to be 10 mins since he started and talking about different ways you may employ MySQL for the web. Am also running out of battery, as I could not find a working power slot. Will power up my laptop in the next room we go ;)

12.00 hrs. :

Raj talk was successful and a lot of people came out with interesting queries. There were even few others who jumped on to the stage to add more points to the topic. Then we moved out, had chaai and were talking on random stuffs (about work, FLOSS, community, fossconf chennai and foss.in). Then we decided to attend some thing and made a move to socio tech collective. The discussion was about how and how now technology enhances our lives, especially in rural India.

13.30 hrs. :

Just had a nice lunch with a lot of jalebis. We finished our lunch within 15 mins and have come back to the central area. Lots of crowd is there, especially a hell of first timers. We couldn’t find many from the last bar camp. We found Shreyas and Tejas here, and got some nice stickers and Kart’s “indian contributor” poster.

15.00 hrs :

We thought of attending Photo collective, but none seem to be there for it. So we went in search of Collaboration collective and ended up with a few Spike Source guys who were trying to display their product. Then we say dumbhead and others arriving, also Vinayak Das started the Photo Collective. We stayed at IIMB till 17.00 hrs and then left home. When we were on our way out, we met Hobbes who was coming in. Hope to meet known faces, especially tuxmaniac tomorrow.

18.11.2007

Here am, the second day morning and tuxmaniac sitting next to me. Both of us are logged in, me completing this blog and he checking mails. Now we both plan to take our cameras out and go out hunting ;)

11.30 hrs :

Me, Aanjhan and one more guy have assembled for the Ubuntu collective in D5, which is nothing but a couple of bed with pillows under a nice tree shade. 30 more minutes and we expect at least a few others to join. We plan to talk about foss.in Project Day, Ubuntu-In team, hear other’s experiences with Ubuntu and help people if they need any.

13.00 hrs :

Ubuntu Collective can be termed as an unexpected success. When I was manning the registration desk, helping jace with new registrations I just queried tuxmaniac whether we can have a collective too. He gave “foss collective”, “free software collective” and I gave “Ubuntu collective” as suggestions. I wrote “ubuntu collective” on a couple of collective stickers and we stuck them to our T-shirts. With a few enquiries coming about where the ubuntu collective is, we decided to have it for sure. But we did not expect it to be attended by many. There was one lady from Australia and many from different perspectives. Our general topic of discussion was how the felt about Ubuntu and what are things they feel should be improved. We have collected a bunch of things and many of them will be conveyed to Ubuntu devels as feedback from the users.

15.00 hrs :

We were sleepy and found a nice shady place with lot of pillows to support us for a half-nappy discussion at the end of which we felt we needed to do something for foss.in and this led us to proceed to Coffee Day to discuss this further. We decided to print stickers for Ubuntu Project Day, something similar to what we have in bcb5. We have enquired about printing stickers and we may go with it this week, getting the stickers printer before this month end.

16.00 hrs :

Me and tuxmaniac are sitting in L21 where Photo collective is happening, with us busily updating things utilizing the wifi and occasionally looking at things being discussed here to improve our photographic skills.  tuxmaniac is yet to get his tees, while am wearing my bcb5 tee ;)

** will be updated time to time, so keep checking ;)


got the Gutsy

November 15, 2007

I had asked Ubuntu/Canonical to ship a couple of Gutsy CDs to me on 22nd October 2007 and the request was approved the next day. I almost forgot about it and when HereBeDragon reminded me about it a couple of days ago, I found it was 3 weeks since I put up a request. So I was expecting it to come in another week or so, but to my surprise it arrived at my table just a few minutes ago.

It always happen that the CDs arrive when I remember about them (after requesting for it, of course). The first time I requested Breezy, it took nearly a couple of months for it to arrive and then we could ask for more CDs. Now we can request a maximum of two and I usually get it before a month. It also comes with a few Ubuntu stickers, which am ready to give to others as I already have enough stock with me :)

Its a nice feeling when you have the Gutsy CDs sent from Netherlands in your hands :) Will now check whether I can get Kubuntu CDs ;)


Python BoF at foss.in

November 14, 2007

I was enquiring Baiju about the Python Collective at the Bar Camp Bangalore 5, which is scheduled for this weekend, as I hadn’t seen any discussion about it in the BangPypers list. This is when Baiju asked me about having a BoF during foss.in, which I readily seconded and as per his advice, start the discussion in BangPypers list for the same. And thats why this post comes out.

We plan to have a “Python BoF” during foss.in 2007, organized by BangPypers (the Bangalore Python User Group). The discussions will happen in the BangPypers Mailing List to decide the day and time, after which I will update the tentative date and time here, as well announce it in both BangPypers and foss.in mailing lists. Hope to see a lot of Pythonians at the BoF and interesting discussions happen :)


New Books

November 9, 2007

After a long time, a friend of mine gave me the opportunity to visit Landmark at Spencers today as well as provoked me enough to buy some books. This time I picked more of the pocket reference books than normal ones. The 5 books which I bought this time are,

  1. MySQL in a Nutshell, O’Reilly
  2. C++ Pocket Reference, O’Reilly
  3. Regular Expression Pocket Reference, O’Reilly
  4. Javascript Pocket Reference, O’Reilly
  5. HTML & XHTML Pocket Reference

To my surprise, the book #4 was given for a special price of 25 Rs while the original price was 65 Rs.  This made my friend go back again and look for the book, but unfortunately they had run out of stock  :(

I have been, for the past 3 months, taking books from my Chennai home to my Bangalore home in small number of books at a time that now my collection at Bangalore is sufficient for my normal requirements. I intend to take no more books from next time, rather start reading through the books I have moved there.


Where is my title ?

November 5, 2007

Was checking my RSS feeds after a couple of days when I discovered that all my posts from 29th October have been shown in Planet FLOSS India with a title “technofreak” rather than the actual ones in the post slug. I wonder how and why only mine got changed this way when other feeds are pretty normal. Have poked sayamindu who manages the planet, hope it gets alright soon :)


Read Today - 2nd November

November 2, 2007

Today, I read two interesting articles which I would like pointing out to my friends.

First is an Open Letter to Steve Ballmer from the lead of Mandriva. I too had my comments to this but as am running back home, will add it later. Nigerian Government has decided that they will replace Mandriva Linux,, which was actually customized for the Classmate PC going to be used, with M$ Windows though they will be paying for the Mandriva. Its not just a 100 or 1000 PCs but 17000 machines, which could have been otherwise running a GNU/Linux OS and the Nigerian kids would have got a chance to learn about Freedom in Software. Damn! :-x

Second is a wiki page pointed out by Onkar Shinde on OLPC in India. I was really impressed by their work and success. Hope more of such success stories follows :)