February 24, 2013

How to find the count of physical processors, cores and threads on Solaris?

Let’s first understand the terms and relationship between the same quickly.

Physical processor – processor that is actually / physically present
Core – further division of physical processor i.e. a physical processor can contain multiple cores
Thread – a distinct execution path provided by a core i.e. a core can support multiple threads
Virtual processor – can be considered equivalent to a thread

That means, Number of virtual processors in a physical processor = count (cores) * count(threads).

psrinfo -p gives the number of physical processors

psrinfo -pv gives the number of virtual processors per each physical processor

But, how does one find the number of cores / threads on a physical processor? The only way that this could be found out is by going to the specs page on Sun/Oracle website. However, recent updates of Solaris 10 did include a fix to report this kind of detail. In case the fix is not there, it can still be found out from the command “kstat cpu_info”. For more details, you may refer to http://blogs.oracle.com/sistare/entry/cpu_to_core_mapping.

February 16, 2013

Unix: Why do “df” and “du” report different disk usages?

Let's understand the fundamental difference between the two commands first.

  • "df" reports usage based on details available at filesystem-level (inodes)
  • "du" reports usage based on the actual contents (files) of a directory

There are many reasons for the discrepancy between the numbers reported by the two commands. However, it is _mostly_ because of removal of a large file, the file handle of which is still present with a process (the file was opened by the process). When a file is removed, "du" no longer takes it into consideration although "df" counts it as the file inode is still present because of the open file handle - which is why "du" reports free usage where as "df" does not.

How do you fix the discrepancy in such cases? Simplest is by not removing the files that are held open by some process. However, if you do run into a situation of accidentally removing such files, restart the application/process that held the open file descriptor - this is the proper way to clean up. There is also a workaround of clearing the file descriptor manually/directly although it is not recommended procedure.

Another reason for the mismatch is that "df" counts the complete blocks (8 KB blocks, for example, as seen in the above techbit) where as "du" counts the actual file sizes (like 1 KB if the file is actually only 1 KB). If there is a large number of such small files, then the difference can show up significantly.

There are many other possible reasons as well for the mismatch. Provided below are few links for further reading:

http://linuxshellaccount.blogspot.com/2008/12/why-du-and-df-display-different-values.html
http://blog.thilelli.net/post/2008/10/18/Discrepancies-Between-df-And-du-Outputs
http://sysunconfig.net/aixtips/df_du_diff_out.txt

February 9, 2013

HJSplit: Split & Join Files

Have you ever wished you had the ability split a huge file into smaller files and then merge the smaller files back to recreate the original file?

Maybe, when you wanted to transfer the file from a computer to another using a USB drive but the USB cannot hold the whole file due to insufficient capacity? Or how about when you want to send a file over email but cannot either because the mail server does not allow attachments beyond a specific size? Or may be, the mail server allows but you want to avoid any issues with intermittent network connectivity breaks / issues by sending over the file in several different chunks?

If you answered a "Yes" to any of the above questions or if it simply sounds interesting/useful to you, then you should try HJSplit. It is a free file splitter and merger. It is obtainable from http://www.hjsplit.org/.

By the way, do let me know if you have any comments. If you find the posts helpful or if you think someone else can benefit from them, feel free to share the same.

February 3, 2013

TrueCrypt: Disk Encryption Software

Here is an excellent open-source disk encryption software: TrueCrypt @ http://www.truecrypt.org/.

TrueCrypt can be used to realize wonderful use-cases from a security standpoint.

For example, what if you wanted a document like text file or an excel or a word document or a PDF on your computer that ONLY you should be able to access? TrueCrypt can do it for you.

As another example, you've a USB stick that is currently unprotected i.e. if you lose your USB stick, then whoever finds it has access to all of your data! TrueCrypt can create an entire encrypted partition on the storage device to meet this need.

January 30, 2013

FileZilla – A (or The?) FOSS FTP Client

Firstly, what’s the fuss about FOSS? Well, it’s an acronym for “Free and Open Source Software”.

If you've worked on transferring files from one system to another, then you might already be aware of this tool. If not, then this is for you.

FileZilla is a very good free, open source and GUI-based FTP client. Something like this is always preferred to command-line utility that comes by default with the desktop/laptop. http://filezilla-project.org/ is where you can download the software from. Note that it also has a server edition that you can try if interested.

January 28, 2013

Being helpful


What better way to start blogging in the new year than to write about what has been close to my heart.

To have a mindset to be of help to others, to assist the needy & deserving, and to bring about a change in the society are some of the qualities that one should inculcate. We start consuming from the society right from the time we're born. Not many even pay attention to this. We should not only realize this but also start contributing and giving back to the society. I'm fortunate to have been brought up by my parents and teachers who had placed a lot of emphasis on these aspects. I'd forever be indebted to them for creating an environment conducive to such wonderful thoughts.

The immediate next and straight question that follows is: how to do it? The answer is also equally straightforward: in whatever possible way that one could. If you've the will, you'll easily find ways. There're many different ways. Listed below are few examples:

  • You could help someone around you whom you've seen in need of assistance.
  • You could become a member of volunteering organizations in your area.
  • You could contribute to charities, about which you know for sure, established for a good cause.
  • You could look out for articles seeking help in credible newspapers and televisions.
  • You could start sharing your learnings and knowledge via blog posts if you've access to computer/Internet!

Personal life, busy schedules and work pressures are always going to be there. Nonetheless one has to try, accommodate and allocate time (even if it is just an hour per week!) to volunteer for service activities.

The message is clear and simple: If you're in a position of being capable of providing assistance to others, then just use the opportunity that you've and help.

December 31, 2012

Find alternative web sites

If the last Techbit was to find similar software, then what is this one for? Similar people? Nah, this one is for similar web sites.

http://www.similarsites.com/ is where you can find sites similar to something.

As an example, a search for sites similar to sourceforge.net lists several good ones like those that can be seen from http://www.similarsites.com/site/sourceforge.net.

December 28, 2012

Find alternative software

You’ve some software but you’re not satisfied with it and need to find alternative options to the same? If so, then http://alternativeto.net/ is where you would need to go to. It is a great site and rates the software based on user recommendations.

December 8, 2012

How to find filesystem block size on Solaris?

Firstly, what is a filesystem block?

It is the smallest piece/size of the disk allocated or accessible on the filesystem.

Can you explain a bit more?

Having a larger block size helps in achieving better performance due to lesser number of disk reads and lower metadata overhead. However, it is a disadvantage for files of smaller size. For example, assuming block size of 8 KB, 8 KB is allocated even if the file size is only 1 KB.

Tell me how do I find the filesystem block size on Solaris?

There’re couple of ways:

  1. From “df -g”; example: df -g | grep "block size" | awk '{print $1 " " $4}'
  2. From “fstype –v”; example: fstyp -v /dev/dsk/c0t1d0s0 | grep ^bsize

November 25, 2012

System Explorer: Alternative to Windows Task Manager

System Explorer is an alternative to and a much better version of Windows Task Manager.

It provides you with an in-depth view of your system functioning and performance. It gives you much more detail than Task Manager that comes by default with Windows. For example, the list of files opened by a particular process, the list of network connections, process hierarchy (which process is invoked by which other process) etc. are some of the interesting additional features provided by this tool.

Download it from http://systemexplorer.net/.

November 18, 2012

How to delete browser autofill field value(s)?

Have you ever mistyped a username or a word in a text field of a form on a website? If autofill is enabled, the browser stores the (mis)typed word in its cache and associates it with the dropdown of that text field. In such cases, have you wanted to delete such words from the browser cache?

One way is to delete/clear all of your browser cache – which is not effective though as it wipes out all of the cache.

The way to delete only a specific entry from the cache is to use keyboard to navigate to the required value in the dropdown list and hit “Del”. In some of the older browser versions, “Shift” + “Del” may be needed. Note that this holds good for URLs in location bar as well.

November 11, 2012

µTorrent (uTorrent): Torrent Client

If you’re looking for a torrent client to download material like Linux ISOs, training videos or digital copies of CDs/DVDs that you own, then µTorrent (uTorrent) is the one you should go for. It is an excellent and lightweight torrent client while providing rich functionality and performing wonderful as well. Yeah, it's not for downloading movies or songs - remember that! ;)

µTorrent (uTorrent) can be downloaded from http://www.utorrent.com/.

October 29, 2012

Ninite: Install / Update Multiple Apps at Once

Got a new computer and need to set it up with your favourite applications? Ninite helps you to install and update multiple applications at once. It is available for download @ http://ninite.com/.

Note that it does not contain all the software/applications. However, it is still a very good idea and tool to be aware of.

October 25, 2012

Rename Multiple Files in Windows

“Bulk Rename Utility” is a utility that helps you rename multiple files in a jiffy. Few very good ways you can benefit from this tool are listed below:

  • Add/replace/remove text to/from the file names.
  • Support for regular expressions is a big plus.
  • Rename the files based on the EXIF header data of images.
  • Rename the files based on the ID3 tag data of MP3 files.
  • Preview the changes before applying.

The tool is available for download @ http://www.bulkrenameutility.co.uk/.

One downside is that the interface appears quite cluttered and not easily usable. As such, it takes a little time to get used to it.

October 22, 2012

Techbits #25: Cygwin – Unix on Windows!

Have you ever wished if you had the ability to use UNIX shells (like “bash”), commands or scripts on Windows to make yourself more productive from the resulting power and flexibility? And, should it be something free and not commercial like “MKS Toolkit”? If so, then this Techbit is for you.

Cygwin is what you are looking for and accessible from http://www.cygwin.com/. There are a huge number of packages available that you can install additionally to spruce up and spice up your Cygwin setup.

Go on and wake up your Windoze with Cygwin! :)

October 11, 2012

Techbits #24: “nslookup” works but “ping”, “telnet” etc. don’t?

This Techbit is for those souls that work on Solaris platform. It may be applicable on other Unix-based platforms as well but I've not verified it.

A friend of mine told me he has configured the name servers correctly in /etc/resolv.conf after which he could get "nslookup" working but not the other commands like "ping", "telnet" etc. Why?

The answer lies in that "nslookup" does DNS lookups using /etc/resolv.conf where as "ping", "telnet" etc. refer to /etc/nsswitch.conf to find out the mechanisms to use for name resolutions.  If DNS is not listed here, then /etc/resolv.conf is not going to be referred to. Therefore, make sure DNS is listed as a source for host resolution in /etc/nsswtich.conf.

Another command to do such verification is 'getent hosts' - this is like nslookup but pays attention to /etc/nsswitch.conf additionally.

Thus, to summarize which configuration file does each of the commands depend on:

nslookup - /etc/resolv.conf

ping - /etc/nsswtich.conf

telnet - /etc/nsswtich.conf

getent hosts - /etc/resolv.conf, /etc/nsswtich.conf

October 5, 2012

Techbits #23: Export comments from Word document

There could be scenarios where one encounters the need to export/extract all the comments from a word document into - say, a word document or an excel sheet. This techbit is precisely going to address such usecase.

All that you would need to do is define the following Macros and just use (run) them afterwards. The Macros can be seen by following the Word document's menu path "View >> Macros >> View Macros".

Exporting comments into an Excel file

Create a Macro named exportCommentsIntoExcel with the following definition:
Sub exportCommentsIntoExcel()

Dim cmt As Word.Comment
Dim doc As Word.Document
Dim commentsFile As String
Dim row As Integer

commentsFile = ActiveDocument.FullName & " - Comments.xls"

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True

Set objWorkbook = objExcel.Workbooks.Add()

row = 1

For Each cmt In ActiveDocument.Comments
    objExcel.Cells(row, 1).Value = cmt.Initial & cmt.Index
    objExcel.Cells(row, 2).Value = cmt.Range.Text
    row = row + 1
Next

objWorkbook.SaveAs (commentsFile)

End Sub
Select the Macro thus created and "Run" it.

The comments should be available in an excel file in the same directory as the source word document and with the suffix "- Comments" in its name.

Exporting comments into a Word document

Create a Macro named exportCommentsIntoWord with the following definition:

Sub exportCommentsIntoWord()

Dim s As String
Dim cmt As Word.Comment
Dim doc As Word.Document

commentsFile = ActiveDocument.FullName & " - Comments.doc"

For Each cmt In ActiveDocument.Comments
    s = s & cmt.Initial & cmt.Index & "," & cmt.Range.Text & vbCr
Next

Set doc = Documents.Add
doc.Range.Text = s
doc.SaveAs (commentsFile)
End Sub
Select the Macro thus created and "Run" it.

The comments should be available in a word document in the same directory as the source word document and with the suffix "- Comments" in its name.

September 5, 2012

Techbits #22: How to find out if Oracle is SE or EE?

If you want to find out whether Oracle is Standard Edition (SE) or Enterprise Edition (EE), then this is for you. Now, why would someone be interested in finding it out? One reason could be to check which licensing option is the Oracle based on and correspondingly find out which features can be used.

There are several ways some of which are listed below; if you do not see “Enterprise”, it means it is “Standard”.
  1. banner displayed at sqlplus prompt
  2. select * from v$version
  3. If the above methods do not work (which could be because of DB not being created using Database Configuration Assistant aka DBCA), then do this: In the file “$ORACLE_HOME/inventory/Components21/oracle.server/*/context.xml”, check the value (VAL) of the parameter ‘s_serverInstallType’ – SE or EE.

Source for this Techbit is at http://vicker313.wordpress.com/2009/05/16/how-to-check-oracle-10g-is-standard-or-enterprise-edition/.

How is Oracle licensed or what kinds of features does one get to use based on EE etc.? These are going to be addressed as part of upcoming Techbits.

August 26, 2012

Techbits #21: 7-Zip File Archiver

Here is a very good and popular file archiver: 7-Zip.

You might ask why would one require this when we already have WinZIP or WinRAR? Well, the first and major difference is that 7-Zip is open source while the others are commercial. The second difference is that 7-Zip supports better compression ratios.

7-Zip is available for download at http://www.7-zip.org/.

August 13, 2012

Techbits #20: Taskbar Sorter & Taskbar Shuffle

If you’re someone who is used to having the application windows in a specific order, like having Mail Client (Outlook) as the first window, Browser (Firefox) as the second window etc., then the utilities "Taskbar Sorter" & "Taskbar Shuffle" are for you.

While Taskbar Sorter only has functionality to sort/order the taskbar items, Taskbar Shuffle has additional functionality like the ability to reorder the tray icons as well.

Taskbar Sorter >> http://www.codeproject.com/KB/shell/taskbarsorter.aspx
Taskbar Shuffle >> http://nerdcave.webs.com/