Sunday, June 5, 2011

UNIX Command History

All the commands typed by the user are stored in a file named ".bash_history" (for bash) in the Home directory of the User. It is a hidden file as its name is preceded by a dot (.) and therefore you can view this  in the File manager only when you hit the Ctrl-H combination. To view this file in "bash" the option -a has to be used with the ls command, i.e., to view this file in the command line interface, the command ls -a has to be used.

This file contains the list of all the commands typed since the system formatting. The operations on the command history such as retrieval or reuse of the commands depends on the contents of this file.

Type history at the command prompt and you will get the last 500 commands used. If you only want to look at the last 10 commands, you could type the command history 10. Commands are remembered so you can reuse them.



You can reuse any command in the history list by typing its number (as shown by the history command), preceded by an exclamation mark (!). If you want a view a file listing of the Documents folder, and ls Documents is command #31 in the list, you could type !31.




Say you’ve just typed a long file-name copy (cp) command, and want to use it again. Typing !cp will find the last line in your history list that begins with cp and reuse it.



Typing two bangs (!!) will cause the last command you typed to be reused. Finally, typing !? and then part of a recently-typed command will cause bash to auto-complete using the nearest match it can find in the history.


Wednesday, May 25, 2011

What went wrong in Natty Narwhal Ubuntu 11.04

It was 29th of April, 2011 and I just completed my exams. I was so excited to try the new release of Ubuntu as I knew that Ubuntu is going to concentrate much on the User Interface part of the Operating System this time. I really thought it would be a success compared to the earlier versions and new users would definitely try it. But after trying it, I was hugely disappointed.

We understand that user interface is important. But it is not a crucial element in an operating System. Many other things such as the performance, the hardware utilization, memory management determine the success of an operating system. In addition to this, it would be a basic thing to provide software without bugs. The earlier versions of Ubuntu also had some issues. But we cannot expect everything to be perfect, especially for an open source software. On the other hand, if the bugs occur every now and then when we use it; it would be irritating for any kind of a user. Remember its not an alpha or a beta release, its the final release.

There are many issues with this release, which are listed below:

  • Not responding state: The users able to control the system under this state is one area where Windows is way ahead of Linux. The Windows Task Manager does a very good job, allowing the user to control the System.
    • We have an applet namely Force Quit that ends any application forcibly. This applet in the previous releases used to be a decent application, which responded quickly and took control of the system immediately, when invoked. However, the new release of Ubuntu has not got any such applet and the system often goes into the not-responding state. 
    • In addition to this, this release does not respond well to the Hot Keys. Even if we use Ctrl-Alt-Backspace, which is used to kill the X server and log out of the system; we are logged out of the system, which does not display the login screen, thus posing problem to most of the beginners. In this scenario, we are left with using the system in command-line through Ctrl-Alt-(F1 to F6). Thus, the not-responding state eventually makes us to use the Power Button for restarting the system, rather than the conventional way of shutting the machine down. 
    • Banshee Music Player is good when compared to Rhythm box Music player regarding the ease of use. It is selected as a default music player this time instead of Rhythm box Music Player. This crashes every now and then irritating us to the maximum. To some extent, Rhythm box Music Player was better and can be used.
  • Customization reduced: One main reason, I use Ubuntu is the customizations in it. However, this release left me with dissatisfaction giving absolutely no customization to the panel.
    • The earlier releases had given control to the user as far as the panel is concerned, through which I was able to add the applets to the panel, which I found to be useful. But now, the panel at the top has got minimum customizations and gives zero control to the user. 
    • The menu bar is another disappointing change made in the interface. The menu bar appears on the top panel according to the active window or the active application. 
    • The Launcher is a new idea and it is good when it comes to look and feel. But a huge deal of it still has to be improved. Many parameters of the Launcher are pre-defined and cannot be changed by the user and the drag and drop option for the launcher is not complete. However, after using it, one makes a statement that literally everything has to be done through the launcher only, allowing minimum customization. 
    • The interface sometimes crashes out, especially in the case of drag and drop. When I tried to move the files from one folder to another by using the drag and drop in the Nautilus File manager, I experienced it to be an absolute prison with the not-responding state again. Interesting point to make a note of is that the previous releases all remained stable with the same kind of mouse drag-and-drop action on the file manager. 
    • The old Compiz settings are far better than the changed ones.
  • Untested Software: I got a feel of using an alpha or beta release when I was using the final release of Natty Narwhal.
    • The mouse and keyboard listeners are not well programmed and have to be looked into once again. Sometimes, the Close, Maximize and Minimize buttons for a window disappear suddenly. We do not know what to do under these circumstances and use the System Monitor to kill that specific application. 
    • The themes sometimes get changed by themselves. These new themes are out of control of user, as they do not get changed the way we want. In such cases, the previous theme is restored only after the system is restarted and there are situations where even  the system restart does not help. 
    • The dialogs or the wizards for the settings in applications especially is cumbersome as the wizard is found to be defective if it is un-maximized. 
    • Under some circumstances, I came across a situation where the items in the panel are not listed. This makes us difficult to control the system, as the menu for any application appears in the panel. 
    • There is another situation where everything was going well with my modem and a bug appeared in the Network Manager applet while trying to connect to the Internet. But the Network Manager applet says it does not identify network devices in-spite of everything being fine with the devices.
This release has got many attractive features as well. The interface has been the focus of the development team this time. But there are some other encouraging features as well.
  • Ubuntu Software Center: With every release, the Ubuntu Software Center is getting better and better. The encouraging feature this time is the reviews and ratings added to the softwares. The reviews put in by various users and their ratings are given.
  • Easy access to items in Launcher: The launcher may not be good at the customization but it certainly gives easy access to the items in the Launcher through the simple shortcuts.
  • Unity Applications Menu Support: This is a welcome development. Unity now lists the installed applications under a section "Installed". Though it looks good, it is not very user friendly yet. There are no categories as we saw in GNOME Shell before and it is not very stable as well. This still requires a lot of work. 
  • Improved Search Options in the Unity: The Search options certainly have been very good compared to the previous versions. The categories such as Frequently used, Installed applications are included which makes it much more easy for the users. However the auto-completion option has not been added yet. With that option, the Search functionality would become a true class application.
  • Improved Window movements: Like in Windows 7, the windows can be thrown to the corners and edges on the environment resulting in maximization, minimization of the windows.
The strategy of the Ubuntu developers must certainly change now. Anything overdone is dangerous. All the operating system concepts must be kept in mind while development and bug-free software is essential in the increase of popularity of a software and Ubuntu is no exception to that. It has been good and sticking to the right areas till Maverick Meerkat. But this time, the interface frequently leads to Force Restarts, which is not a good sign. However, there are many positives that can be made out of this release. What everyone needs is a bug-free software and good user-friendliness; both have to be taken care of. I just think that the next release is going to be a success as the testing will become important this time and will lead to error-free system.

Thursday, February 24, 2011

Firewalls in Ubuntu -- details and configuration

Ubuntu Linux has mainly two strong firewalls, namely:
  1. Netfilter
  2. Firestarter

Netfilter firewall:

Ubuntu has a powerful firewall called netfilter that is part of the central kernel program. The ufw command at the terminal allows us to configure the firewall. However, this command needs you to be root of the system. For this purpose, we add sudo in before the command. For example, to enable the netfilter firewall we type the command as: sudo ufw enable. The manual pages for this firewall can be seen by typing the command: man ufw
However, this firewall can be operated in a more user-friendly way, by installing the package named Firewall Configuration. This package supports common tasks such as allowing or blocking pre-configured, common p2p, or individual ports, and many others. Rules can be easily added, removed and edited with the help of this interface. The interface is simple with easy usage and is recommended for beginner users.


We can configure the netfilter firewall by --
  1. Adding allow, deny and limit rules.
  2. Enabling, disabling and reloading the firewall.
  3. Deleting and Inserting rules.
  4. Displaying the information and status of the firewall.

Firestarter firewall:


Another user-friendly Firewall in Ubuntu is Firestarter. On the start-up for the first time, a wizard will be run, for configuring the network states. You can read the manual pages of this firewall by the command: man firestarter. There are three pages/tabs in the Firestarter interface, namely --
  1. Status page giving an overview of the firewall state. 
  2. Events page, where blocked intrusion attempts and the firewall history is shown.
  3. Policy page for altering the behaviour of the firewall.


This firewall can be in one of these three states: Active, Disabled and Locked (Nothing is allowed through the firewall, neither in nor out). The Network section of the status page gives an overview of the network resource usage. In addition, the status page also lists the Active connections, the firewall is tracking every moment. The entries in the Active connections are color coded as: Gray for a terminated connection and black for a currently active connection. However, terminated connections are removed from the list after 10 seconds.
The Events page shows the history of connections blocked by the firewall. The entries in the Events page can be allowed connections from source, port or everyone or can be disabled events from source or port. The Firestarter colour codes the entries as:
  1. Black -- A regular connection.
  2. Red -- A possible attempt to access a non-public service and needs special attention.
  3. Gray -- Harmless connections, mostly broadcast.

The third page, Policy can add, edit or remove rules for the firewall. Two types of rules can be created: Inbound rules, that allow through connections from the network or Internet, and Outbound rules, that can block unauthorised data emissions from your computer, such as those from potential virus infections, or spyware. Inbound rules allow you to filter all incoming connections. When it comes to blocking data emanating from your computer, Firestarter can enact two different modes:
  1. Whitelist: In this mode, network traffic is not allowed out of the computer unless a rule allows it. This is also known as restrictive policy. 
  2. Blacklist: In this mode, which is default, all traffic is allowed out of the computer unless a rule specifically forbids it. This is also known as permission policy.

Monday, February 14, 2011

Java Swing applications -- Telephone and Address Book -- II

Implementation:


The Telephone Book application is now designed and we need to just put the coding for that. We already know which objects in swing package are used as the components in the panels for the application. For example, we have mentioned in the last post about some components such as Drop-down list (JComboBox), Labels for the appropriate components(JLabel), Buttons (JButton), Text-Boxes (JTextBox), Scroll Panes (JScrollPane), Results displayed in Tables (JTable), Confirmation of the results through Dialogs (JDialog) etc.

The Front end is Java Swing while the application has a database connectivity with MS Access database. As mentioned in the previous post, there is only one table in the database. The coding is done in two packages: 
  1. TeleAddress package for Component design and Action listeners &
  2. dao package for accessing database from the MS Access database through JDBC API
In all the classes, the constructors play a key role with initializing the frame window processing purposes. Mouse action listeners are applied to the buttons in the interface that interacts with the user, most of them being applied when the user clicks the mouse.

The confirmation dialogs are present in a separate class, named Dialogs with separate dialogs for contact creation, updating contacts and contact-deletion. The Dialogs class contains the following:
  1. Two Constructors -- one for Deletion and the other for Updation / Addition of contacts
  2. dialog( ) and deldialog( ) functions for processing one of the two constructors.
The TelephoneBook class in TeleAddress package is the main class in the application and binds all the classes together. The TelephoneBook class contains the following:
  1. All the Interface-Components such as Buttons, Drop-down lists, Text-Boxes,Labels,Tables etc. are defined in this class.
  2. 5 Panel functions for adding the components into each panel.
  3. A Constructor having function calls to the Action-listeners.
  4. A function named initComponents( ) for the lay-out of components.
  5. All Action-listeners for all the buttons such as Create, Delete, Update, Refresh, Cancel etc.
The SearchTable class allows the user to view the results in a table in a different Frame window. The Database class consists of all the database-connections, where we use the JDBC-ODBC Bridge Driver for connecting to MS Access. The static methods in this class are used for every database operation being done in the application. The dao package makes use of PreparedStatement and Statement for database query executions. The Database connectivity with MS Access can be done as shown clearly in these posts as part 1, part 2 and part 3. The dao package has the data access objects listed below:
  1. Database class for Database connection.
  2. AddDAO class for insertion of new contact into the database table.
  3. DeleteDAO class for deletion of contact records from the database table.
  4. OtherDAO class to get all the records from the database table
  5. SearchDAO class to facilitate searching upon inputs given in the Search and Delete panels.
  6. UpdateDAO class for updating contact details.
The documentation for the classes of this application have been automatically generated by NetBeans IDE through Javadocs which can be downloaded here.

Installation and Configuring the application:

Pre-requisites:
  1. The system should have Java (JDK and JRE) installed on your system, which can be downloaded from this page.
  2. The system should have Microsoft Office Access DBMS.
Configuring and Installation:
  1. Invoke Control Panel -- Administrative Tools -- Data Sources (ODBC). Go to UserDSN tab and click on Add button.
  2. Select Microsoft Access Driver (*.mdb, *.accdb) and click on Finish button.
  3. Give the Data Source Name as TeleAddressBook and select the Database Select button and give the path of the database file which can be downloaded from here. After selecting the .accdb file, click OK. Any doubts regarding the configuration of DSN (Data Source Name) can be clarified with the tutorial specified previously at this post with screen-shots.
  4. Download the JAR file which can be downloaded here.
  5. After configuring the DSN and downloading the JAR file, double-click on the JAR file to invoke the application. If its not invoked with the double-click then open Command-Prompt and type the one specified as: java -jar "/* Complete Path of the JAR file */"

    Sunday, February 13, 2011

    Java Swing applications -- Telephone and Address Book -- I

    Before starting the design and implementation of Telephone cum Address Book, I recommend you to go through the following post which gives an insight of how a layout should be in Java Swing.
    How to choose a layout in Java Swing

    It is quite common to have a telephone book to note the contact numbers, addresses and other notes of relatives, colleagues, acquaintances and so on. The search operation still has be improved under such circumstances. We need to find the contact quickly in the telephone-contacts book. In addition to that, updation, deletion of contacts is quite cumbersome in such circumstances. I have come up with a typical CRUD (Create, Read, Update, Delete) kind of an application built on Java -- a Java Swing application to be precise, which provides the following:
    1. Create / Add a new contact to the Telephone book
    2. Update the details of a contact
    3. Delete the contact details
    4. Search functionality based on many parameters such as Name, City, Contact Numbers, Address etc.
    5. List the entire list of contacts
    6. Refresh capability for the changes to be applied to the database.

    Advantages over the normal telephone book:

    1. Quick search and display of details
    2. Easy updation and deletion of contacts
    3. Robust contact addition

    User Interface Analysis and Design:

    The entire application is built on tabs, rather than using Menus and sub-menus in the application as most of them do. But to avoid complexity in the application, the results are maintained in tabs (JPanel). The results of the search and listing functionality are displayed in a Scroll Pane (JScrollPane). The items in individual panels are programmed in separate functions to provide easy maintainability. There are 5 panels in the application which are listed below:
    1. Create Panel
    2. Delete Panel
    3. Update Panel
    4. Search Panel
    5. List Panel
    The search results and the listing operations are displayed in a tabular format (JTable), with 7 different contact details. The operations on the table can be made by clicking on that particular cell and deleting the corresponding record. The table is added to the Scroll Pane (JScrollPane) with vertical and horizontal scroll bars as needed.

    The form-elements in the panels such as Create, Update and Search Panels is arranged in Grid Layout. Go through the guidelines to use Grid Layout. All the guidelines listed to use Grid Layout will have to be followed for better look and feel. The text-boxes (JTextArea) and buttons (JButton) are mainly used in all these forms, with the drop-down lists (JComboBox) also being added to the Search and Update Panels for better functionality and ease of use. The screen-shots can be downloaded here.

    Database Analysis and Design:

    This is a simple application with only a few contact-details which allows us to design the entire database using a single table. The main motto of this series of posts is to work with Java Swing and database is the easiest way to access data. So, we make an assumption that a contact has only single Office, Residence and Mobile contact numbers. The Normalization is not needed as per this assumption and a single table prevents the joining of tables. The database table telephone consists of fields listed below:
    1. Contact-Name
    2. Street, Area and City details of the person's residence
    3. Office, Residence and Mobile phone numbers 

    Monday, February 7, 2011

    The Best Instant Messengers in Ubuntu Linux

    As many of us use Instant messengers, we need to select the best of the best on any platform and Linux is not an exception to this. There are as many as 18 Instant messengers for various chat networks in the Ubuntu Software Center. While Windows has Digsby judged as the best and most popular Instant messenger, Ubuntu has three of them that are popular. If Digsby were in Linux also, I would be more than satisfied to use it because of its real time notifications, the look and feel and the features it provides. But unfortunately, Digsby is currently unavailable on Linux and Mac platforms and works only on Windows. But well, there is no need to worry as there are others which fulfill your requirements. I found the following three to be interesting in Ubuntu:
    1. Pidgin
    2. Kopete
    3. Empathy

    Pidgin:

    Pidgin was the most popular IM in Windows (and Linux) before Digsby came into picture. It was the default IM till Ubuntu version 8.10, but from Karmic Koala, Empathy became its default IM. It is an impressive master piece with a lot of features, with as many as 30 useful plugins and support for over 15 different protocol services such as AIM, MSN, Google Talk, Jabber, Yahoo etc. The only disadvantage I found with this IM is the slow start-up though it might not be a problem with the modern hardware configurations.
    Some of the plugins are listed below:
    • Voice and video chat support
    • Message highlighting
    • Enhanced history
    • SSL plugins
    • Topic change notification
    • Spell checker
    • Recent conversations and many more
    As you can see from the above plugin list, this IM has something for every level of user. It suits advanced users, beginners and intermediate users as well. Pidgin is quick at mail notifications, buddy status notifications. I would recommend you this IM if you have not got any on your Linux (not just Ubuntu).


    Kopete:

    Kopete is an instant messaging and chat application with support for a wide variety of services, such as AIM, Yahoo, ICQ, MSN, IRC, and Jabber. This package is part of the KDE 4 networking module. The layout of Kopete is glossy as it is available in KDE desktop environment. One good feature of Kopete is the KDE Wallet, which acts similar to the master password in Web Browsers. The KDE Wallet has passwords, cookies which once lost cannot be recovered. Besides this, the IM provides indexing for faster file search. Unlike Pidgin, it starts quickly with its look and feel being an extra asset. Notifications part is pretty good. It has got an extensive range of plugins including:
    • Video, voice chat support
    • Translator
    • Logging of all messages
    • Statistics
    • Bookmarks
    • Auto replace
    • Message highlighting and so on...

    Empathy:

    The Empathy Instant messenger is now the default IM in Ubuntu Linux. The premier advantage of this IM is the notifications. This supports as many as 20 different protocol services including Google talk, Facebook chat, Yahoo etc. It supports all protocols supported by Pidgin. It has support for voice, video chat, file transfers. Apart from this, it supports logging of messages according to date and it is quick.

    Sunday, February 6, 2011

    Gedit -- The complete Text Editor


    Gedit is the default text-based editor for GNOME desktop. I can say its complete because of its enormous features. Gedit is an open source text based text editor that can be installed in operating systems such as Windows, Linux and Mac (not just Linux). It is powerful for programmers with its wide range of features and plugins, which makes it appealing to any level and type of user. 

    Computer world is changing from time to time and I can say there is a considerable transition in the field of the text editors. In the early days,  many machines were GUI less and the users had to learn vi editor. Well, fewer and fewer machines are GUI less now. However, it is always important and is considered an extra edge to learn the vi editor, which is more often than not, useful to edit configuration files. Gedit gives more productivity than all the other predecessor editors such as vi, emacs etc.


    Syntax Highlighting:

    Gedit provides syntax-highlighting capability with a large number of
    1. Programming languages, 
    2. Hardware programming, 
    3. Scripting languages, 
    4. Markup languages and 
    5. Scientific purposes. (FCL, Octave, GAP, R)

     
    To select the highlighting mode, select View -> Highlighting mode -> Select the mode from the drop down list.

    Gedit Features and Plugins:


    In addition to the highlighting mode, Gedit supports a number of features such as:
    1. Bracket Completion -- Automatically adds closing brackets
    2. Change case  -- Inverts the case in the entire file
    3. Commenting or uncommenting a selected block of code.
    4. Document statistics -- Gives some information about the number of characters, words, lines etc., of the file
    5. Embedded Terminal
    6. Spell checker
    7. Tag list -- Inserts commonly used tags and words into document
    8. Word completion
    9. Sorting a document or selected text
    10. Snippets -- Insert often used pieces of text quickly mostly becoming the templates of documents with a specified highlighting mode
    11. Python console in the bottom pane and thus can run python programs.
    12. Language Support
    However, some of the above plugins will work only if you add the external plugins, which can be installed with the help of Ubuntu Software Center, by typing in the filter text as "gedit-plugins" and click Install.

    Colour Schemes:


    Apart from all these plugins and features, Gedit consists of some Colour Schemes which customise the environment of this text editor. Some of the colour schemes can be downloaded here. These colour schemes can be installed by selecting Edit -> Preferences -> Font and Colors tab and then adding the schemes (.xml files) by clicking on the Add button there under.

    Saturday, February 5, 2011

    10 Beginner Mistakes to be avoided by Linux newbies

    Ever increasingly, Linux is becoming more and more popular. Along the way, there are several common mistakes that users new to Linux tend to make. In fact, from time to time, you can even find some seasoned Linux users making some of these same mistakes. If you can avoid these mistakes, the transition to Linux will be a lot easier.


    1. Installing from outside the official repositories:

    This mistake is generally done by those who have used mostly Windows before. They try to programs and software from outside the official repositories just as  in Windows. Almost all Linux distributions have official repositories and the software packages need to be installed from them. For example, in Ubuntu, install the software from the Ubuntu Software Center. This Center contains a list of all the softwares available officially. If you have installed the software outside the official repositories, there is a little chance to get assistance.


    2. Doing selective updates:

    This undoubtedly will make your system unstable mostly by broken links. It's considered a good practice to install all the updates periodically. To install all the updates, goto System > Administration > Update Manager. Not only this, but delaying these updates would be costly for you. So, it is always suggested to do complete update periodically.


    3. Linux is not Windows:

    There may be a lot of similarities in between Linux and Windows. But, don't expect Linux to be exactly like Windows. The similarities help in making an easy transition towards Linux.


    4. Avoid learning command line:

    The computer world has been changing continuously in the field of user interfaces. Its getting easier and easier for the users to use many operating systems and applications now-a-days. But, the whole process started with the command line user interface. And Linux is an operating system which expects you to learn a bit of command-list. Command line way of doing things is a lot quicker than the GUI. Besides all this, some things can be done only through the command line. So, if you have decided to work with Linux, then learn commands.


    5. Misusing the help forums:

    Even though Linux is free, help for getting started is close at hand, and available from multiple sources. There are help files, user manuals, and even the "man pages" that are easily accessed through either the command line or the other graphical way. For each Linux distribution, there is a separate user forum for getting help regarding all the operating system issues. By searching, you are likely to learn other important things. So, get the most of these user help forums.


    6. Avoid running as root (when needed):

    Running the operating system with root privileges will surely inflict some damage to your system. So, avoid running as root as far as possible.


    7. Avoid relying too much on WINE:

    WINE is a utility to run Windows executable programs on Linux. Find Linux software counterparts and try using that instead of installing all the softwares through WINE.


    8. Ignoring the system messages and errors.



    9. Its not Ctrl-Alt-Delete:

    In Windows, this shortcut gives you the Task Manager. However, Linux restarts when these buttons are toggled. There is an applet named "Force quit" which can be used for force quitting unresponsive programs.


    10. Giving up too early:

    This happens mostly as far as Linux is concerned. Everyone must realise that they are not born knowing Windows. So, put some efforts to learn Linux and you will get rich dividends.

    Sources: PC Linux OS Magazine

    Thursday, February 3, 2011

    Ubuntu -- Analysis of the versions 8, 9 and 10

    Ubuntu, a variant of Linux is continuously making its mark in the race among the operating systems as advancements are being made continuously with respect to many operating system aspects. I found huge advancements in regions such as GUI, CPU Utilisation, Networking, booting time etc. though some features were getting down. The Ubuntu Operating system versions will be released in the April and October months of every year with advancements made in some operating system aspects.

    The versions and the code names of Ubuntu are given below:

    8.04          HARDY HERON
    8.10          INTREPID IBEX
    9.04          JAUNTY JACKALOPE
    9.10          KARMIC KOALA
    10.04        LUCID LYNX
    10.10        MAVERICK MEERKAT


    The Ubuntu versions 8.04 and 8.10 had nothing to talk much about them. The software packages were not efficiently run besides the high CPU utilisation. The security settings were also not that strong. Networking was not good and connection to Internet through DSL was not present in Ubuntu 8.04. The look and feel was not appealing and the dependencies had to be looked after every now and then while installing the software packages. The Web Browser consumed much of the CPU resources when it was running, making it uncomfortable to use.

    The Ubuntu versions 9.04 and 9.10 started using ext4 file system which made them to reduce the boot times three times than that of the 8.10 version. These versions boot in 25 seconds much better than the 65 seconds taken by the previous version (8.10). With the same, it managed to efficiently improve the system performance. These versions also made the look and feel better by introducing an absolute candy for notification purposes. The Empathy Instant messenger came into play with the version 9.10. The wireless network support was included in the 9.04 version. However, the network applet had some bugs, which made the connection to Internet (Wired using DSL) difficult. Besides all this, the Jaunty Jackalope newly had Tablet and Netbook support.


    I should say that Ubuntu 10.04 and Ubuntu 10.10 are the best which we are having at present. These versions take only 10 seconds for the booting purpose, much better than the previous releases (25 seconds in the previous releases). In addition to the booting time, the software seemed to start quickly. The GUI has changed suddenly and the default theme settings are appealing to the eyes. The Internet got very much slowed down in Ubuntu 10.04 but all those major issues in Ubuntu 10.04 have been rectified now. The security settings are improving version after version in Ubuntu. I can find a lot of difference in the security in Ubuntu 8.10. The Ubuntu Software Center has undoubtedly become charming and more handy than ever, especially in the categorisation of the software. I should say, users had to face a bit of problem with the dependencies, broken links earlier; but now everything is managed so well by the Ubuntu software center, making it more user-friendly. Apart from this, the Instant messaging has added the new features of audio and voice chatting using Empathy Instant Messenger. I found that when the system files are being accessed, the system was taking so much time and was consuming large amount of CPU (almost 90% of CPU utilisation). This is the case when we open it in the GUI. The situation is however different when accessed through the Linux terminal. The authentication is a bit slow in Ubuntu 10.10 even though it was alright in Ubuntu 10.04.

    Wednesday, February 2, 2011

    Linux -- User Communication -- Part-3 -- news command

    The system administrator is the sole person who can make news under the Linux. He types the information which he wants everyone on the network to know of in different files in /var/lib/sysnews directory. 

    Whenever we log in if any fresh news has come in since we logged out last time then a message is displayed on our terminal saying, news: appeal rally where appeal and rally are the names of files in which the news items are available. We may either choose to ignore it, or if any news item interests us we may decide to pursue the same.
    • First, we can look at the names of the news articles by the command news with -n option. Similarly, to know the number of unread news articles that are present in the /var/lib/sysnews directory, we use the command news with -s option. If you try news -s after you have gone through all the news items it promtly displays the message "NEWS: 0 news articles".




    • The command without any options would yield the list of unread news articles one after another.


    • At the same time, the user can pursue only a particular news article  from several items by specifying the article name after the command. For example, if you want to pursue the article named appeal, then you can run the command at the prompt as news appeal


    • If the user decided to pursue all the news articles (read and unread), then the option -a has to be used with the command.

    Linux -- User Communication -- Part-2 -- wall command

    The write command is used for communication between two users connected to a network. However, if a user wants to send a message to everyone in the network; then the wall command will be used. The command is mostly used by the administrators for purposes such as the situation where the Unix/Linux system will be shut down in 10 minutes. He does so using wall. After giving the entire message, Ctrl - D must be pressed. The default behaviour of wall command is as shown in the below figure:



    Another important thing to note about this command is that it writes to all the terminals irrespective of whether the users have given write permission to their terminals or not, as important messages are often posted using the wall.

    Thus, this command is used to broadcast a message to everyone on the network and the necessary message is written onto the terminals of all the users.

    A variation of wall would be to broadcast the contents in a file to all the terminals. This is done by the command given as: "wall < [file-name]". In this case, Ctrl-D need not be pressed. This is shown in the below figure:



    To know about the next part of the Linux user communication, click here.

    Tuesday, February 1, 2011

    Linux -- User Communication -- Part-1 -- write command

    The communication between/among different users in Linux systems connected in a network is actually just as simple as running some commands. A direct application of a network system, communication is handled expertly by Unix. The commands used for such a communication are as follows:
    1. write
    2. wall
    3. news
    4. mail
    The "write" command:
    The write command can be used by any user to write something on someone else's terminal, provided the recipient of the message permits communication. There are two pre-requisites for a smooth write operation:
    • The recipient must be logged in, else an error message is inevitable.
    • The recipient must have given permission for messages to reach his or her terminal.
    If you do not want the messages to be posted on your terminal, just type the command: mesg n. But, by default the terminal allows messages to be posted on it. To know if the messages can be posted on your terminal or not, just type the command mesg. If the command returns "is y", then messages can be posted on your terminal, otherwise they cannot be posted. Before using the write command, it is a good idea to first ascertain who all are logged in and who allow messages to their terminals.

    finger is one command that tells you which users are connected and which, if any can receive messages. It displays a list of all those who have logged in and places a * next to those terminals where mesg is set to n.


    Another command that may be used for this purpose is who -T. The command who lists all the users who are currently logged in. When used with -T option, it places a '+' next to users who have allowed messages and a '-' sign beside others.



    Now, the default behaviour of write command is as shown below. The first screen-shot is the terminal on the sender side and the second on the receiver side.





    Variations of write:
    • Writing to somebody who has set mesg to n on his terminal. The permission gets denied on such occasions. However, if the sender has mesg set to n and the receiver has mesg set to y then the reply to the message is not possible.


      • A user logged in at more than one terminal and you want to send a message only to one terminal. The terminal specified in the command will be sent a message simply. If we do not mention the terminal to which the message should be sent, then the write command comes up with a smart solution in case of confusion. In all the above screen-shots the user is logged in at more than one place. For example, write user tty9 writes to the terminal tty9 of user-name user.
      To know about the next part in Linux user communication to know the wall command, click here.

        Monday, January 31, 2011

        Linux -- Directory Stack

        I am just surprised at the way Data Structures are used in our day-today life not just the computers field. Now, its time to discuss the directory stack. The basic idea of stack is also applied to the directory stack, a list of recently-visited directories. Like any other stack, the directory stack also allows us to view the contents of stack, push an element into the stack, pop an element from the stack. But the difference is that the insertion and deletion operations can be done on any element in the stack, not just the top element of the stack.

        Push operation is carried upon by the pushd command while Pop operation is carried upon by the popd command. These two operations can quickly navigate around the file-system. If the pop operation is issued when the stack is empty, the appropriate message is issued. The cd command changes the current element at the top of the stack i.e., the $DIRSTACK variable. The dirs builtin displays the contents of the directory stack. The contents of the directory stack are also visible as the value of the DIRSTACK shell variable.

        In short, the pushd builtin adds directories to the stack as it changes the current directory, and the popd builtin removes specified directories from the stack and changes the current directory to the directory removed.

        The pushd command is similar to the cd command, but pushd retains the directory that you are currently in, in its directory-stack. For example, the command pushd /usr/share displays the entire directory-stack. It knows that I came to /usr/share from the home directory. If I issue popd, this is going to take my directory-stack and bring me back to the previous directory in the directory-stack. The command saves the current directory on the top of the directory stack and then cd to dir. With no arguments, pushd exchanges the top two directories.

        The popd command removes the top entry from the directory stack, and cd to the new top directory. When no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory.

        The basic behavior of pushd, popd and dirs are shown in the figure below:



        The DIRSTACK array needs some explanation at this point in time. The contents of the array can be displayed by the command "echo ${DIRSTACK[*]}". If only the second element in the array needs to be printed, then "echo ${DIRSTACK[1]}" as the arrays start with index as 0. The DIRSTACK array is shown in the below figure:




        Variations of dirs:
        dirs [+N | -N] [-clvp]
        +N: Displays the Nth directory (counting from the left of the list printed by dirs when invoked without options), starting with zero.
        -N: Displays the Nth directory (counting from the right of the list printed by dirs when invoked without options), starting with zero.
        -c: Clears the directory stack by deleting all of the elements.
        -l:  Produces a longer listing; the default listing format uses a tilde to denote the home directory.
        -p: Causes dirs to print the directory stack with one entry per line.
        -v: Causes dirs to print the directory stack with one entry per line, prefixing each entry with its index in the stack.

        The variations of the dirs command are shown in the below figure:


        Variations of pushd:
        pushd [dir | +N | -N]
        +N: Brings the Nth directory (counting from the left of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
        -N: Brings the Nth directory (counting from the right of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
        dir: Makes the current working directory be the top of the stack, and then executes the equivalent of `cd dir'.

        Variations of popd:
        popd [+N | -N] [-n]
        +N: Removes the Nth directory (counting from the left of the list printed by dirs), starting with zero.
        -N: Removes the Nth directory (counting from the right of the list printed by dirs), starting with zero.
        -n: Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated.

        The variations of pushd and popd are shown in the figure below:




        Sources: Bash Reference

        Sunday, January 30, 2011

        Linux terminal - Mathematics

        Important mathematical calculations can be done by using the Calculator application available with the Linux applications. But these calculations and can be made by the following commands in the terminal:
        1. bc
        2. expr
        3. factor
        4. units
        1. The "bc" command:
        The programmable calculator called bc gets you into the calculator mode, and the $ prompt disappears. The command gives almost all the basic mathematics calculations. The input  to this calculator is taken line by line. Enter an expression and the result supplied in the next line. The inputs and results are self-explanatory. Typing "quit" gets you out of the calculator mode and ends your tryst with bc. The basic mathematical calculations can done using bc command as follows:


        One of the useful features of bc is that of a base conversion. The variables ibase and obase are set such that ibase gives the base of the input and obase gives the radix or base of the output number. As shown in the figure below, the number is given in base 10 and the input is converted into base 2.


        In addition, bc also supports functions like sqrt, cosine, sine, tangent etc., The trigonometric functions sine and cosine ( s() and c() respectively)would work only when the bc command is used with the -l option. The trigonometric functions expect their arguments in radians not in degrees.



        A for loop can also be run in the calculator mode as shown below.


        2. The "expr" command:
        In addition to bc, the expr command is used for evaluating basic mathematical calculations dealing with only integers. The expr command cannot perform calculations on data other than integers. The operators must be surrounded on both sides by a space. When using * operator, use the backslash ( \ ) for the purpose of escape-sequencing since * operator is a meta-character.



        3. The "factor" command:
        The factor command takes as input an integer and gives the output all the prime factors of the input; each one is printed the proper number of times. To end it, press Ctrl - D. The command factor when used with the argument as the input, it returns all the prime factors of that number.


        4. The "units" command:
        The units command is another handy utility, which converts quantities expressed in various standard scales to their equivalents in other scales. It works interactively in this fashion:


        Algorithm design --- Iteration, Recursion or Tail recursion

        The best method for solving a problem has to be chosen under many circumstances. Techniques such as Greedy method, divide and conquer method, dynamic programming etc., are used to solve the problems under different constraints.

        In some cases, the method followed to solve a problem might be easy to program but might not deliver good performance due to more space and time complexities; Recursion is one such example. Recursion is a master technique to solve many complicated problems, but the space and time complexity are higher than those in the conventional program without having the recursion. It is trouble using recursion as there is no portable way to tell how deep recursion can go without causing trouble (how much 'stack space' the machine has), and there is no way to recover from too-deep recursion (a 'stack overflow'). Recursion requires more number of steps to solve a problem.

        Iteration can do things faster for us. However, in some problems, using iteration becomes too cumbersome and tedious to be applied especially when the problem is naturally recursive. Thus, the time taken for designing the algorithm and the efficiency of the algorithm must be taken into consideration while devising a method to solve a problem.

        If iteration is getting complicated, then you always have the weapon of TAIL RECURSION. With Tail recursion you can get the advantages of recursion while overcoming the defects in the iteration method. Tail recursion is a process of using the function call as the last executed statement in the function definition. Here, we take the return value as one parameter of function itself. We use stack to maintain all the functions but here it will not append new function in stack but it will overwrite the value of previous function with the current one. Thus, the function call time and stack implementation time will be reduced giving better performance.

        Let us solve the problem of finding factorial of a number using these three methods:

        CASE 1: Using Iteration:
        int factorial ( int no){
                 int i, fact=1;
                 for (i=no; i>1; i--)
                        fact=fact*i;
                 return fact;
        }

        CASE 2: Using Recursion:
        int factorial ( int no) {
                int fact=1;
                if (no > 1)
                       fact=no * factorial (no - 1);
                return fact;
        }
        This process is implemented in stack as-

        CASE 3: Using Tail Recursion:
        int factorial ( int n, int fact)
        {
                     if ( n==1 )
                            return fact;
                     else
                            factorial ( n-1, n*fact);
        }

        This will be implemented in stack as-


        Here, the tail recursion takes only 4 steps for getting factorial of number 4. It reduces both space and time and improves the performance.

        References: "Data Structures Through C" By S.K. Srivastava.

        Friday, January 14, 2011

        MacBuntu and Compiz effects --Make Ubuntu look like Mac OSX

        After a long gap, I have something interesting for you. The first part is to make Ubuntu look like Mac OS-X and the next part giving you some of the very interesting features of Compiz which I tried.

        Unlike the earlier editions of Ubuntu which had a very dry default theme, the latest versions 10.04 and 10.10 have an interesting theme by default. Ubuntu must have definitely looked into this aspect and the booting process. The booting process is so fast that it takes hardly 20 seconds for the booting to take place. On the other hand, the Internet speed also has increased reasonably well over the Lucid Lynx (which had disastrously slow Internet). However, the look and feel of Mac-OS is top-class with glossy finishes and high resolutions.




        How to make Ubuntu look like Mac OS X:


        In order to get the Mac look-and-feel, a package named "Macbuntu" has to be installed. The process for the installation is given below:
        1. Download the Macbuntu package from the links given below:
          • https://downloads.sourceforge.net/project/macbuntu/macbuntu-10.04/v2.2/Macbuntu-10.04.tar.gz for Lucid Lynx (Ubuntu 10.04).
          • https://downloads.sourceforge.net/project/macbuntu/macbuntu-10.10/v2.3/Macbuntu-10.10.tar.gz for Maverick Meerkat (Ubuntu 10.10).
        2. After changing the present working directory to the folder which contains the downloaded file, extract the contents inside this compressed file to /tmp folder by using the following commands in the Terminal:
          • tar xzvf Macbuntu-10.10.tar.gz -C /tmp
          • cd /tmp/Macbuntu-10.10/
          • ./install.sh
        3. In the steps that follow the installation, give the  appropriate values to the questions at each stage.
        4. Now restart your system to get the new look-and-feel of Mac OS.


        Compiz Settings:


        Getting to the later part of the discussion,  Compiz effects are something that anyone would like to have for better animations, extras, effects, Window management, Utility, Desktop effects etc.

        The things I tried in Compiz are pretty easy ones and Desktop cube, cube reflection and deformation, Scale and Negative are the ones that I predominantly used. 

        The negative  plug-in does get the negative version of the environment which we are working on. 


        The Scale plug-in gives a list of all the windows maximised at the center of the screen just giving some amazing desktop eye candy as shown in the figure below. It is always handy to have these kinds of plug-ins.


        The Wobble windows plug-in though is a good piece, seemed to be an unstable one as far as the look in the environment and the wobbling to the eyes are concerned. Among the others, all the plug-ins related to Cube are a treat to the eyes. But one should see that the performance does not get disappointed when you have an extra set of these animations enabled. Cube Atlantis and Cube gears are master-pieces in this section but demand very good hardware all around.

        A balance between the performance and the look-and-feel  is the one we should look at because an operating system is not solely about the look-and-feel. Therefore, it is always recommended to think for a while before switching to high graphic oriented plug-ins.
        Related Posts Plugin for WordPress, Blogger...