Posts

How to implement Linux tail command in Perl

I have tried writing a Perl script to simulate Linux tail command - print last n lines from a file. This is one of the common interview questions in Perl. This can be extended to print selected lines of other Linux commands like head. It works perfectly fine. print "\nImplements linux tail command in perl \n\n"; $file   =  $ARGV[0]; $n = $ARGV[1]; open(FILE, $file); @arr = ; close(FILE); $length  = scalar(@arr); $n = $length  - $n; while($n<$length ) { print $arr[$n]; $n =$n + 1; } Comment  below if you have a better option

Converting number into text - spellnumber excel function

It is often useful to have a function to convert numbers into words in Excel. It will be very handy in accounts. I have written an Excel macro to convert numbers into text. I have already created a macro which will convert a number in Indian system - that is ##,##,### format, to words. You can find it here  Now I have come up with a macro which does the same thing with the western numbering system, that is 3 digits separation like ###,###,###. The dollar is used as currency, but it can be changed to any currency just by changing the text "Dollar". You can do that by finding replacing. How to use it: 1. Download the Excel VBA macro module from here      Spellnumber module 2. Open Excel  3. Press Alt + F11      A window will open, it is called Visual Basic Editor aka VBA editor.  4. In the VBA editor select Insert, Module.      A new module will be created at the left side pane, on the ...
Image
The latest version of SpellNumber The latest version 4.0 of MS Excel currency converter has been released. It has the following bug fixes. See here how to use it in your excel workbook. https://www.youtube.com/watch?v=t-PE5h6rGrQ&feature=youtu.be It used to give the wrong result for a value between 1,99,999 to 9,99,999. It has been fixed now in version 4.0 download the latest module here  https://docs.google.com/file/d/0B4UB3eOhhY26YnFucWJjWHhYM28/edit You can download the complete excel file here https://drive.google.com/#folders/0B4UB3eOhhY26MHdzd1MyMkEyVVk Direct access  https://drive.google.com/file/d/0B4UB3eOhhY26OTA1UGRSQUNYdjA/view?usp=sharing

MS Excel currency converter - Number to words Latest version

MS Excel currency converter 3.0 has been updated with bug fixes. This is the new version of my amazing currency converter VBA utility for MS Excel. The macro will convert the currency number which is in number to text. For example, Rs. 14,250 is a common standard to represent the money of Indian Rupees Fourteen Thousand, Two Hundred and Fifty. This VBA code takes the input as 14250 and prints as 'Fourteen Thousand, Two Hundred and Fifty'. It can be used in writing cheques, generating financial reports, MIS reports, and other accounting purposes. If you are familiar with accounting software such as Tally, you will know that the current number is converted into text. But this feature is not available in MS Excel. The earlier version had few bugs which were reported by the users. I have fixed them in this version.  Below is the list of bugs fixed 1. For 1000 and 100000 it was resulting in a null string. Now it has been fixed. You can download the VBA module here. A...

Excel VBA macro to swap 2 values in cells

Image
It is very useful sometimes to have a shortcut to swap 2 cell values. I have created a macro in VBA to do this. Just copy paste the code below in your VBA module. This video will help you with the procedure VBA Code ------------- Sub Swap2Values()     Dim Value1 As Range, Value2 As Range     Dim TempValue1 As String, TempValue2 As String     If Selection.Cells.Count > 2 Or Selection.Cells.Count < 2 Then         MsgBox "Please select only 2 cells. For other options check back soon!"         End     End If       If Selection.Areas.Count > 1 Then         Set Value1 = Selection.Areas(1).Cells(1, 1)         Set Value2 = Selection.Areas(2).Cells(1, 1)     ElseIf Selection.Rows.Count > Selection.Columns.Count Then         Set Value1 = Selection.Range("A1")         Set Value2 = Se...

Connecting Bluetooth headset with laptop - Bluetooth A2DP

A normal phone Bluetooth headset can be easily connected to a laptop and it can be used as earphones or headphones while using skype, gtalk, WhatsApp, or any other voice chat services or of course to listen to your favorite music. All you need to do is a Bluetooth device and the Bluetooth driver with the A2DP(Advanced Audio Distribution Profile) profile. Amazon Web Services Quiz: Essential AWS Concepts Here is the detailed procedure the setup Bluetooth device with your laptop. Download the A2DP Bluetooth driver from the link provided below. Extract the zip file 'Bluetooth A2DP Driver For Windows.zip'. Go inside the folder 'Bluetooth A2DP Driver For Windows', double-click on the installer file 'anyone-Bluetooth-usb2x0-WindowsXP-v2-1-0-4.exe'. Follow the onscreen instruction to complete the installation.  Once the A2DP driver is installed successfully, Switch on the Bluetooth in the Laptop and Headset. Look for the Bluetooth device the list of ...

How to make an Excel macro available for entire excel in a PC - Excel add-ins

This post will show you how to make an Excel macro available for entire MS Excel in a PC. Whatever macro you write will only be available to that particular file. When you open a new Excel file you need to copy-paste or rewrite the entire macro again in the new excel workbook. You can avoid this by making an Excel Add-In. You can place the excel macro somewhere and make it as an add-in. whatever functionality present in the macro(add-in) will be available to the entire excel in your PC. It will be similar to your =SUM() function. When you try to insert the function, you can see your own functions in the “ User Defined Functions ” category Let’s do it 1.        Open an Excel workbook 2.        Press ALT+F11 3.        In the project explorer( left side pane) select “ VBA Project (book2) ”, right-click Insert, then select Module. A blank page opens in the middle. 4.    ...