Wednesday, September 11, 2013

XLSM: A macro function for excel-sheet to find the Value of a selected Key

Type the text below in the excel-sheet formula bar

=Trouver(ResultSheet!A1, SourceSheet!A1, SourceSheet!A20, SourceSheet!B1)

'Name: Trouver (Find)
'Creator: Abhishek Kumar
'On: 16 May 2011
'For: Vijay Kumar Mittal

Public Function Trouver(searchKey, fromKeyRef, toKeyRef, getValFrom)
   Dim rCell As Range, foundVal As String
   For Each rCell In Range(fromKeyRef, toKeyRef)
        If (searchKey = rCell.Value) Then
            foundVal = Sheets(getValFrom.Parent.Name).Cells(rCell.Row, getValFrom.Column)
        End If
   Next rCell
   Trouver = foundVal
End Function

To reduce pics size without reducing it's quality

Download the Google's Picasa from this link []

Follow these steps:
  1. Install Picasa on your system and follow the instruction while installation
  2. After installing, let it search for all the photos on your system
  3. When searching completes then look for your desired pics in Picasa 
  4. Select the pics that you want in reduced size
  5. Then press Cntrl+Shift+S or alternately FileExport Picture to folder ...
  6. Set the saving location etc in the opened popup
  7. Choose 'Resize to' option in the 'Image size' section
  8. Click on Export button to get the selected pics in reduced size
  9. Look for the reduced size pics in the folder where you set the saving location
  10. You are done!

To extract pics from video using any media player

Few years back a non-technical person asked me how to get an image out of the video. So I suggested him to follow these steps:
  1. Run the video in full screen mode. 
  2. Pause it at required scene. 
  3. Press the [prt sc] button on your keyboard that stands for 'Print Screen'. In case you don't find it then look for the button lable variances, like [prt scrn], [prnt scr], etc. 
  4. Then open MS-Paint from the StartAccessories 
  5. Press Cntrl+V to paste the taken screen-shot. Re-adjust or customize if necessary. 
  6. Save the pic wherever you want at your system's disk. Try to save it in *.png format. It's quality is better than *.jpg. 
  7. You are done!
Later on I thought why not to put it on my blog. Who knows it may help somebody else. 

Now see the beauty of Internet; few years later somebody out of blue (actually anonymous) left a comment on my blog that we can get do this more easily by following these steps:
  1. Run the video on VLC player.
  2. Pause it at required scene.
  3. Click on the VideoSnapshot under menu to get the snapshot of that paused screen.
  4. The screenshot will automatically get saved at C:\Users\\Pictures; so go to this location where you will find the image with a name as vlcsnap-.png
Well I don't know why I didn't recommended this method earlier, though I'm sure I couldn't missed it. So I assume that the version of VLC player I was using at that time may not had this feature. 

Anyway, now I think to make this blog more generic to make it relevant by changing the article title from To extract pics from VLC video to To extract pics from video using any media player.

JS: The complete code example of Crypto.js (DES)

For one of the project I was trying to use crypto.js but I found that the Quick-start Guide have some deficiency in terms of library usage. So I am writing it here as a useful note for memory recap.
<script src=""></script>
    var encrypted = CryptoJS.DES.encrypt("The secret message", "secret_key");
    var e_msg = encrypted.toString();
    var decrypted = CryptoJS.DES.decrypt(e_msg, "secret_key");
    var d_msg = decrypted.toString(CryptoJS.enc.Utf8);