Fedora 17 to 18: An Itchy Upgrade

After being spoilt by one of the best maintenance-free rolling release distros EVER invented by mankind (aka ArchLinux), moving to a “traditional” distro following a cyclic release system was not a very comfortable perspective to look at (special thanks to the “upgrade hell” people sometimes have to go through when switching from a major version to the next major version). But I decided to take the risk anyway and install Fedora 17. The reasons I chose this distro were obvious (to me atleast) – it has amazing developer support, bleeding edge packages and all the latest jazz in development tools getting released early, and to top it all, it offers a “semi” rolling release option – fedora seems to be the best when it comes to an in-place major version upgrade. And finally came the time to upgrade a few months back and I followed the usual wiki to get the job done. This post is to document all the things I did along the way (and I’ll keep it updated because I never really finished performing the upgrade as I was spending very little time on my laptop anyway).

Using FedUp

Fedora 18 brought with it a brand new tool to let Fedora 17 users upgrade. It’s called FedUp. This is the current recommended in-place upgrade mechanism for movers from Fedora 17 to Fedora 18. SWEET! I simply followed the instructions in the wiki page. Yup, its as simple as that. Do whatever the nice guys say and you’re all ready to go.

Messed up KDE Desktop

For some reason, KDE was all messed up after the upgrade. Deleted my .kde folder and it took care of the problem. I guess I still need to do some minor tweaking around global settings, but I think I’ll get to there later.

Unable to install setup.noarch during upgrade

Did some googling around just now to fix it (procrastination and the fact that this seemed to do hardly have any effect on my limited laptop use should be blamed I guess). Thanks to the guys here. One of the better things about using a popular distro (Ubuntu is a favourite of mine for this reason alone) is that almost ALL possible problems would typically be those encountered already by someone else and the internet is usually loaded with forum posts, wikis, tutorials, blog posts and articles which can be retrieved via the ever helpful Google search.

Insane amount of left-over configuration junk in /home/$USER folder

I only realized how much trash had accumulated in my home directory over the last 6 years of using linux (yeah, I still had crap left over from the time I installed Ubuntu 7.04). This was basically because I never bothered cleaning up the mess in there as I went from one distro to another during my hippie distro-hoping days on my ancient Pentium 4 desktop and when I got my laptop I simply copied the whole /home partition from the desktop onto the corresponding partition on my laptop. I deleted each folder that didn’t make any sense to me or which had the name of an app I do not use. This itself freed up lots of space.

Cleaning up unwanted packages and/or repositories

I seem to have installed a lot of unnecessary stuff just to check it out and now my system is sort of bloated. One of the two main things a fresh install every 6 months (during the half-yearly major version upgrade) gives you is a chance to review if you really want all that crap you installed and reduce the burden on your hard drive (for the record, the other is that your OS install, setup and configuration skills, especially those involving drivers and custom hacks to get things up and running never become too rusty). Anyway to cut a long story short, I’m yet to get to this stage. I’ll either figure out a way to get rid of all that crap or do a clean reinstall depending on whatever strikes me as the most hassle-free option.

Tabs vs Spaces: My take on a Holy War

One of the holy wars in programming is the issue of tabs vs spaces for indention. Opinions seem to vary a lot, so I think I’ll put in mine too just for the record. I’ll start off by defining what a tab character does: It moves right as many times as needed so that the column you are in is a multiple of <TABWDITH>, which is variable (but according to most historical contexts, is defined as 8). You can read more about it if you want.

Team Tabs

A tab is just ONE character in your source code. You only need to press the button on your keyboard that says “Tab” and voila! It indents your code by a certain width. If you are using an editor which doesn’t automatically detect indention convention from the document (such a dumb editor, by the way, you SHOULDN’T be using in the first place), all it takes is a press of the tab button and your code has been indented.

Editors have the ability to define the tab-width of text. So if you prefer a larger indentation width like 8, you can view the code written by someone who has used a width of 2 as if the width was 8 to begin with. Something you cannot do, if the code had been indented with spaces. You are DOOMED to use the indentation width set by the document author and this is not nice. (or if you’re more cunning, you’ll set your own code indentation and formatting preferences in eclipse and do a Ctrl+Shift+F to automatically format the code the way YOU want it to be).

Team Spaces

Tabs don’t always have the same width of 8. Some people prefer tabs of width 4. Others prefer 2. If you have used tabs to align stuff, it’ll never look proper unless the intended tab width was set. So if a code is aligned with spaces, it ALWAYS looks the same, regardless of who is reading it. Indiscriminate use of tab characters assuming the whole world uses YOUR tab width is a sin. Period.

Another problem with tabs is that if you include it after typing some text, it doesn’t always move <TABWIDTH> characters. It moves only as much as needed until the column number is a multiple of <TABWIDTH>. So if you have set <TABWIDTH> as 8, and you are on the 2nd column and press the Tab key, it moves right 6 places. This is one of the chief problems with using tabs for aligning elements (and not just indenting them into blocks).

Besides, the space bar is the largest key in the keyboard. Who doesn’t like banging away on it like there’s no tomorrow ? GO SPACEBAR!!! 8)

Going back and forth between the two worlds…

If you tend to code using tabs out of habit and realize that the project you’re working on follows a “4 spaces for indention” policy and the nasty Checkstyle (setup according to project policies) insults you when you run your code through it, be not disheartened. If you are using eclipse, simply go to window->preferences and set preferred formatting for the languages you use and do a Source->Format (or a Ctrl+Shift+F). If there are tabs still lying around, just do a regex based search and replace; search for “\t” and replace with ”    ” (assuming there’s 4 spaces there). Regex based search and replace is a feature which almost ALL editors worth looking at have (and no, the default editor shipped in an OS developed by a bunch of people from Redmond ISN’T worth looking at).

If you use spaces for indentation and want to use tabs instead, the same is once again accomplished easily by the above method.

Another thing you could do if you NEED to use spaces, but don’t want to jab at the space key multiple times for each indentation level, is to map the tab key within your editor to perform the indent operation (which could be a fixed number of spaces set in preferences or the tab key itself), so that pressing the tab key equals “indenting by one level”, in a way which abstracts you from the actual rule of indentation. Here the tab key no longer inserts one “\t” character unless you specifically ask it to.

Conclusions ??

The main fault is the way people treat tabs. Tabs in code are supposed to do just ONE thing. That is to indent the code. If I use tabs, I only use them at the beginning of a line to indent and indicate the block level I am working at. I never use tabs for formatting my code.

But when it comes to aligning stuff (like you might want to align variable names or function arguments nicely) I prefer spaces. Spaces look the same everywhere, and all your effort to make your aligning pretty looking will not mess up on someone else’s workstation.

This approach fails to solve one problem that spaces alone can solve – fixing the width of the page beyond which code shouldn’t be typed (to ensure that one needn’t scroll left or right to see code). In these scenarios (although I don’t usually enforce the fixed-code-width rule), I suppose it is better to either stick to using spaces or pre-define the tab width of a project and expect everyone working on the project to set their editor’s tab width. And if you DO go about using a fixed space width or a pre-decided tab width for indentation, PLEASE use a width of at the least 4 characters so that guys with not-so-good eyes would be able to NOTICE that the code is indented in the first place. ;)

As always, formatting problems and ease of indentation are issues best taken care of by an IDE where you can set preferences ONCE and forget about it and let it abstract the task of indentation and formatting techniques from you. I have raved about eclipse several times in this post for a good reason. Eclipse has allowed me to set coding standards, formatting rules, code clean up rules, etc in the beginning and be done with them. Once they are set, all I do is focus on my actual work: coding. My IDE takes care of everything else for me. This means higher productivity, neater work and faster results :)

Bangalore to Hyderabad

Since I last blogged…. (and inspired by a certain random full time blogger I’ve decided to blog “regularly”)

I’m finally done with the boring part of my education (read: horrible college curriculum) and am a happy intern at Amazon India Development Center, Hyderabad. This involved moving from Bangalore (the city I’ve been in for 14 years and honestly find overrated) to Hyderabad (one really hot city with barely any food – more on that later….)

At first, I got accommodation in Red Fox Hotel for a week from my company (and I must say, this is one really cheap hotel for the kind of facilities and experience it offers). This was on friday (1st Feb, 2013). Flew here in the morning with dreams of awesome Biryani. That never happened immediately. At first, I tried searching for a place to stay after my hotel accommodation expires. The one funny thing about Hyderabad is you never really need a broker if all you are looking for is a working men’s lodge/hostel. All you need to do is to scan the city walls. They are covered in advertisements for these places (I bet classified newspapers don’t make as much money here either) and it didn’t take me longer than a day to find a place. After that it was Biryani eating that I looked forward to. And to be totally honest, with no offence intended to hardcore Hyderabadi Biryani lovers, the Biryani here SUCKS. There! I’ve put it on record in my blog.

Today was a day long orientation at work, and made some new friends. A 21 year old fresher from Delhi who is a billiards champion and an ice-cream fan and a 31 year old fat supergenius from Mumbai who blogs, cooks and talks (via ISD phone calls) like nobody else.

So that’s it for today! I’ll try writing more often. And if the guys mentioned in the above line are reading this, here’s a big WASSUP! to you ;-)

PS: Try Margherita pizza with paneer tikka toppings at Pizza Corner. Amazing stuff for 233 rupees :D

PS2: Property is dead cheap if you buy or rent a house but lodging is dead expensive. And internet is the fastest and cheapest in India.

Quick and Dirty: When WiFi does not work on Linux

There are still a lot of laptops that have trouble with WiFi when powered by Linux. Its usually the Broadcom devices that create such trouble. After searching around a lot, I installed broadcom-wl driver to get things working on my laptop.

Here is a page that will help you select which driver to use. Hats off to the excellent ArchLinux documentation by the way.

But what if time isn’t enough ? What if you need to get WiFi running urgently without having to modify your system ? For these situations, I present a quick and dirty solution I used to get WiFi running, that only needs you to own an Android phone and sacrifice a USB port.

Tethering Android Phone for use as WiFi Router

  1. Turn on WiFi on your phone and connect to required network
  2. Enable USB Tethering in Phone
  3. Connect Phone via USB Cable to your Laptop for use as a modem
  4. Network Manager should auto-detect the phone as  a router and try to auto connect via DHCP

Voila! WiFi is here. You may now use this temporary solution to find a more permanent solution… ;-)

Setting up a LAMP Stack on Fedora and Ubuntu

A lot of people have been asking me how to set up a LAMP stack on GNU/Linux (usually for development purposes), and these are all first timers who usually end up running either Fedora or Ubuntu. The internet is full of resources on this, so I wouldn’t write another post. Instead here are 2 links I found most comprehensive and useful.

How to install LAMP Stack in Fedora – Courtesy Unixmen.com

How to install LAMP Stack in Ubuntu – Courtesy help.ubuntu.com

Its as simple as it can get in the links above :D

Random Rants: 2012-04-28

Hello Everyone! Its time for a random rant. I type on the constraints of two things that shall stop me from ranting too long. One is my laptop’s hour long battery life, and the other is the hour long Beethoven’s 9th Symphony that soothes the insides of my ears through tiny speakers. Constrained as I am by time, I glance at the date on my taskbar. Its the 28th of April – according to Facebook, this is apparently the date of birth of 5 of my friends. My hearty wishes to them all. Impossible it is to miss birthdays – if you are within the domains of your Facebook account. Facebook is not the medium I am using for typing this entry (though it would shortly end up there). I type into a nifty but highly underrated piece of software – LibreOffice Writer. The name “Writer” amuses me, and the reason would be perhaps be best known to all the teachers I have had the privilege of learning under during my almost 18 year long period of formal education. I posses what could perhaps qualify to be the worst handwriting in the world. Its not entirely a fault of mine. Arguing in my defense, thoughts enter my head at a much faster speed than what my ordinary mortal hands can process, and this creates a mess of ink on paper that, according to my primary school English teacher resembled the markings of a cockroach dipped in ink and left to walk randomly on a notebook. Cockroaches are extremely durable insects. They have the capacity to survive a nuclear holocaust. Neither do they fear slippers nor are they killed by brooms. Most unexpectedly (and much to the horror of many a homo sapien female) they can pop wings out of nowhere and fly. It annoys me whenever I find these little organisms lurking around a corner in my room. Room is one thing India seems to lack – A quick google search reveals that India has over 10x the population density of USA. This is amusing as well, because Indians tend to be extremely conservative and cranial feelings are frowned upon in Indian culture. Americans on average have cranial knowledge several times more than Indians, and yet we add an Australia to our population each year. This is the year 2012 – supposedly the end of the world according to mayan beliefs. Did the Mayans know that in India, “maya” means “illusion” ? Sometimes, life resembles one really big illusion – an illusion of emotions where everything seems so strong and real and yet nothing matters in the end. For years, I searched for that one source that would provide me with a constant stream of happiness only to finally realize that happiness was an illusion by itself. I was always free to imagine it. And why shouldn’t anyone imagine ? Imagination has contributed to over 90% of the Fortune 500 companies’ profits. But that is because those were imaginations that could be realized as real world entities. Except maybe Walt Disney Imagineering. It simply operates by publishing its imaginations as such. Watching disney cartoons is one of the earliest memories I remember from my childhood. My childhood was full of Mickey, Donald, Bugs, Daffy, Tom and Jerry (sorry if I missed anyone else, but mentioning everyone would need an entire page!). Its interesting to note that these cartoons were not created exclusively for children – many of them were comic depictions of several cultural phenomenon during the 1930′s. Today children are not as fortunate as those from my time. Children’s TV today is filled with plain garbage that comes nowhere close to the cultural extravaganza on television during my toddler years. Today children don’t listen to awesome compositions of Beethoven, Bach and Mozart while watching cartoons. Lack of culture today reminds me – today was the third and final day of ASE-B’s “cultural fest” Kalanjali. I don’t think it deserves anything more than a mention in my rant; I’m sure there are others who are currently writing grand pieces of literature about it at this very moment. At this moment I have under 7 minutes of Beethoven’s 9th left. So I guess its time to wrap everything up. Time flies. Does it also run and swim ? Enough of ranting now. I wish you all a good day. Until next time!

 

With Regards,

Gautham

 

PS: The signature above is dedicated to some amazing humans I got to know in the last one week :D

Random Thoughts: 2012-03-08

Today, I tried an experiment to see what I can write when I’m thinking of nothing in particular, and just let the thoughts jump onto paper as they appear and put it in blank verse. Then typed it down and here it is…

Read more of this post

The Apple iPad 2 Mini Review: From a Productivity Perspective

Its been long since I’ve blogged about anything at all, and I doubt I’ll be blogging regularly for the next two years thanks to severe shortage of time.

Recently, I managed to get my hands on the Apple iPad 2 16GB WiFi-only model. Well, I got it for free and its mine to keep. As to HOW, that’s not the scope of this blog post. Anyway, I decided to set it up and use it. When I initially got my iPad 2, I hoped to convert it into an awesome productivity device that I can carry around everywhere. Think the style of a powerful PDA. But in the course of my usage, it ended up doing something which I had not envisioned. How and what ? Read on… Read more of this post

If You’re Happy and You Know It, Scratch Your Ass!

Another classic children’s poem ruined for my personal pleasure, courtesy yours truly :D

Read more of this post

The Realms of Eternity

OK, so here is something I wrote an year back. Thought I’d publish it on my blog since it is going through some massive restructuring, from being tech-only to a more general “blog” :D

This is an Insomnaic’s attempt at blank abstract rhymeless verse :D :D :D

Read more of this post

Follow

Get every new post delivered to your Inbox.