29 Dec 2009

Happy New Year

Looking behind
   A decade of War
   Beginning through 9/11
   Leading into 7/7
   Destroying pride in 26/11

Looking behind
   A decade of Crisis
   Plunging into financial depression
   Suffering Recession

Looking behind
   A decade to Cherish
   Producing Sporting Legendary
   Exploding technology
   Flourishing Entertainment Activity

We extend hands
   Besides all above
   To Welcome Twenty Ten
   With harmony and fun

Copyright © Sivi 29-Dec-2009

24 Dec 2009

.NET/VB 2008 Code – To Retrieve the list of space occupying folders from your PC

Very recently I required to find the list of folders occupying maximum bytes in my notebook for housekeeping purposes, and was stumped to realise that its no simple task. So here I come with a code snippet, which scans the given drive and writes into an excel file - the folders, and bytes occupied by files in those folders, in KB units. As a pre-requisite, one need to create a directory named “Foldersize” under C: drive and want to place a button (named button1) in winform. Copying the following piece of code and executing will result in creation of an excel file under "c:\foldersize". Open the created excel file, sort the contents in descending order to spot the top culprit folder(s) occupying maximum space in your hard drive. I can guarantee that the code is not performance friendly, however does the required job with ease for me.

It takes circa 30 minutes to scan C: and 15 minutes to examine D:, in my PC.

The following lines scrutinizes D: drive alone, however one can modify the statement in bold with the drive subject to examination. All the best and happy coding.

Imports System.IO
Imports Microsoft.Office.Core

Public fdirsize As Double = 0
Public tmpfdirsize As Double = 0

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

  Dim eapp As New Excel.Application
  Dim wb As Excel.Workbook = eapp.Workbooks.Add
  Dim ws As Excel.Worksheet = wb.Worksheets.Add
  Dim irow As Integer = 2
  Dim icol As Integer = 2
  Dim fname As String

  GetDirectorySize("D:\", wb, ws, irow, icol)

  fname = "C:\FolderSize\fsize" & Mid(Now, 1, 2) & Mid(Now, 4, 2) & Mid(Now, 7, 4) & ".xls"
  wb.SaveAs(fname)
  MsgBox("Scan Complete")
  wb.Close()
  eapp.Quit()
End Sub

Public Function GetDirectorySize(ByVal dirpath As String, ByRef wb As Excel.Workbook, ByRef ws As Excel.Worksheet, ByVal irow As Integer, ByVal icol As Integer) As Double
  tmpfdirsize = 0
  Dim fsizekb As Double
  If System.IO.Directory.Exists(dirpath) = False Then
     GetDirectorySize = fdirsize
     Exit Function
  End If
Try
  Dim dirinfo As New System.IO.DirectoryInfo(dirpath)
  Dim oFiles As System.IO.FileInfo() = dirinfo.GetFiles()
  If CInt(oFiles.Length) > 0 Then
     Dim nFileLen As Integer = oFiles.Length
     For i As Integer = 0 To nFileLen - 1
        fdirsize += oFiles(i).Length
        tmpfdirsize += oFiles(i).Length
    Next
  End If
  fsizekb = Math.Round(tmpfdirsize / 1024, 2)
  If fsizekb > 0 Then
      ws.Cells(irow, icol) = fsizekb
      ws.Cells(irow, icol + 1) = "KB"
      ws.Cells(irow, icol + 2) = dirpath
      irow += 1
  End If

  Dim oDirectories As System.IO.DirectoryInfo() = dirinfo.GetDirectories()
  If dirinfo.GetDirectories.Length > 0 Then
     Dim nDirLen As Integer = dirinfo.GetDirectories.Length
     For i As Integer = 0 To nDirLen - 1
        fdirsize += GetDirectorySize(oDirectories(i).FullName, wb, ws, irow, icol)
        irow += 1
    Next
  End If
  Catch ex As Exception
      MsgBox(ex.Message & " " & dirpath)
      Exit Function
  End Try

End Function

23 Dec 2009

Takanobu Ito - Man with a vision


Having witnessed his interview in CNBC, one can vouch for the straightforwardness in his approach to target customer’s thoughts. Takanobu ito, President and CEO of Honda Motor, an engineering graduate who aspired to build aeroplanes, said to have joined Honda visualising his dream to be fulfilled one day. However things took a sweet turn after 30 years, only to make him a CEO of one of the most powerful Motor companies in Asia. Ito screamed simplicity on explaining the pulse of a biker; he believes what makes bike special over car is the 360 degree view and the air hitting the drivers' body based on the speed he/she travels. As a person who travelled at the back seat of a motorbike, even i have experienced those magical moments. 



Here the visionary talks about going green; the next gen electric sports cars.

Despite of Honda market being challenged by rivals from China and South Korea, Ito believes that Honda has earned the good will which will help them satisfy their customers with new innovative ideas for long future.

11 Dec 2009

The Lost Symbol - Book Review

I vaguely recall reading “The Count of Monte Cristo” by Alexander Dumas, when I was hardly 10 years old. I have been reading since then; lots of authors, various categories of publications in the quest of figuring out which genre is my cup of tea. And then I sank into Angels n Demons; a compelling and gripping read which made me wake up till early morning to complete the book. Dan Brown the master story teller who awed us with his chef d'oeuvre in the past, has come back after 6 years with his latest The Lost Symbol”. Unfortunately Lost Symbol fails to match its predecessors not just in plot but also in pace. In reviews, the book got crucified by his fraternity and lashed out by readers across the globe. My verdict – Read it; Come on – It’s not that bad!!

The book promisingly opens with Masonic ritual performed on the antagonist and an invitation to Robert Langdon for an emergency Seminar. Soon characters Katherine Solomon, Malakh, Director Sato unfold before our eyes with an incident in U.S Capitol. The plot thickens from this point and story, instead of taking new pace becomes a documentary. The justification of brilliant Langdon’s arrival to Washington, sans logic. For some readers the biggest let down might be the suspense of who Malakh was.

However the book has Mr.Brown moments to cherish. Be it emoting Langdon’s frustration through “Google is not a synonym for research” or be it his elaboration on Thermal Imaging, TLV and Noetic Sciences, Mr.Brown excels in presentation. He once again proves his acumen in history and efficacy in his detailing. He is one author who analyses all possible cultures to connect the similarities. This read may not elate one as Da Vinci and Angels n Demons, but will enlighten us with new concepts and will raise new questions on Noetic Science and its capability.


Copyright © Sivi 11-Dec-2009