This is basically a summary from Clean code : A handbook of agile software craftsmanship written by Robert C. Martin. This is done as an assignment work which is targeted at making programming students to read books for themselves. If this violates any copyright laws please let me know, although i had used my opinion as possible.
You can find the original book at this amazon page.
Note: This blog article is still under construction.
Names can talk for themselves
- If a variable, class or method name needs a separate comment to identify itself, the name probably needs to change.
- Names should not include misinformation. For example, a grouped set of subscribers should not be identified as ‘subscriber_list’ if it’s not a list.
- Names should not look similar at the first sight, as people who are reading code often don’t read the full name.
- Avoid using l and O in small variable names as it could be easily misread for 1 and 0 ( one and zero).
- Do not use misspelling as a tool to create new names (ex: listenToAdapter, listenToAdaptor).
- Use pronounceable names as possible, which could be easy when at the code reviews.
- Remove obvious redundant words from the names like the, a , an, class, var.
- Names should be unique enough to easily search, if needed. This is strictly needed if the scope is high.
- No need to shorten names as we have more advanced languages and GUI tools now days.
- Use nouns (or nouns which can be used as verbs) for class names and verbs for method names.
- Any name should be generally understood by any programmer of any demographics.
- Use one word for a similar concept throughout the code base.
The site is in the process of moving to linux.lmpeiris.com in the hope to enable additional services than just wordpress.
All the new posts will be posted to the new blog address above; so it is recommended to visit the above site.
Possibility to redirect lmpeiris.wordpress.com to linux.lmpeiris.com by automatic redirection is under consideration, but it comes at a financial charge. At the mean time, you may need to click the above hyperlink to visit the new site.
Malshan Peiris (lmpeiris)
There are many popular audio players for linux; to name a few they would be XMMS, audacious, amarock . But all of these players are GUI-based; and they does not feel like ‘home’ when you are so addicted to using the command line. So i did some searching on possible options, and i found many. I’m only listing two of the best here, mplayer and Music On Console (Player) or MOC. The command line players have the advantage of less crashes, less usage of resources, playability in CUI only OS’s, remote logging to play sound files on a remote machine. The MPD (music player daemon) server can stream audio using any sound output server to a remote machine.
Music on Console (MOC or MOCP) (homepage)
The MOC has a decent UI for a CLI program. Consists of two panes, one displaying the music files in the current directory and the other showing the current playlist. Play stats and tag info are displayed in the bottom, with the progress bar. Navigation within playlist and song can be done using keyboard. It’s updated support for pulse, OSS and alsa output.
for debian based sytems use, sudo apt-get install moc
for rpm based systems, it is unlikely that moc would be on the repository. Try yum install moc and see. If that’s the case, we need to compile from source which can be downloaded from this link. You would need following packages
for mp3 support: yum install libmad-devel libid3tag-devel
for wma,mp4,aac,ra support: yum install ffmpeg-devel (This caused a compile error due to ffmpeg-devel relocating its .h files .. so please don’t do this if you know how to use linking). To activate support for other codecs, see README.
then decompress the file, go to the folder and type usual
./configure && make && install as root to compile and install. See my article on compiling from source for more information.
After installation to run, type
press q and type mocp -x to end program. Otherwise the server will still be running🙂
This doesn’t need much introduction; which is as my perception is the best multimedia player ever, which can play videos too. Apart from the gmplayer (or mplayer-gui), the mplayer command can be used to play music on command line, with showing in depth info. Mplayer can play any audio file, it’s heavily stable and takes less resources. You can see my previous post on mplayer.
sudo apt-get install gmplayer (for debian based systems)
yum install mplayer-gui (for rpm based systems)
Mmmmm…….. it’s me after a long time writing on this blog. I’ve almost forgotten that there was a blog of mine just waiting to be refreshed by it’s author. Within the last year i changed my PC and the operating system twice, and now using the Fedora 14 x86/64 edition. So I guess we should start from some ascii arts on the terminal to show up whenever it’s started. This type art is familar to the Linux Mint users who will see an animal saying something in ascii art upon start of each terminal. However, it requires use of multiple commands. This post is part one.
Figlet – print a text as a logo http://www.figlet.org
How to install – figlet is not provided with most of the Linux distributions, and it’s not included in their package hosting servers. Hence using yum or apt-get simply may not work. If that’s the case, we need to compile it from the source. You can download the source from here. Decompress it and change in to it’s directory in the terminal and type;
to compile figlet. For further information on compiling from source, see my article. Unfortunately, there’s no make install here so we need to change in to figlet directory always to use the command (you can copy the binaries and man pages in to correct directories but this is complex).
cd <path to figlet folder>/figlet222/
./figlet <the text you want to show as a logo>
I’ ll be mentioning only the important ones here.
Change style/font : A sub directory called fonts holds some .flf files which contains style info.
./figlet -f <fontfile_name> text
ex: ./figlet -f script Happy new year will produce something like above picture.
change alignment : To center -c , -l for left and -r for right
change right to left: -R
layout: -t will fit the text to terminal width, -P paragraph mode
There’s a lot more; see figlet man page for more details. http://www.figlet.org/figlet-man.html
Part 2 of the post is about using cowsay and fortune-mod. Will be followed soon.