Posted by: sanjeewa | September 17, 2008

75 (Really) Useful JavaScript Techniques

Posted by: sanjeewa | September 14, 2008

Importing Text Files to Excel which are larger than 65,536 rows

When you try to import a Text file or an Access database table which has got more than 65,536 rows, you get it in to a ‘Capital F situation’ because Excel cant except more than 65,536 rows in a single work sheet. The only way some one would suggest will be :

1. Import the maximum number of rows which is allowed in a single work sheet first, (Which is 65536)  

2. Open a new worksheet use text Import wizard and in ‘Start Import at Row’ filed enter 32,767. (Because it’s the maximum integer value the field can accept)

3. Import it the new work sheet and manually delete the rows which are repeated.

Something which doesn’t sound geeky at all. :-)

Same thing can be achieved without much of a stress using the following macro.

Sub LargeFileImport()

      ‘Dimension Variables
      Dim ResultStr As String
      Dim FileName As String
      Dim FileNum As Integer
      Dim Counter As Double
      ‘Ask User for File’s Name
      FileName = InputBox(“Please enter the Text File’s name, e.g. test.txt”)
      ‘Check for no entry
      If FileName = “” Then End
      ‘Get Next Available File Handle Number
      FileNum = FreeFile()
      ‘Open Text File For Input
      Open FileName For Input As #FileNum
      ‘Turn Screen Updating Off
      Application.ScreenUpdating = False
      ‘Create A New WorkBook With One Worksheet In It
      Workbooks.Add template:=xlWorksheet
      ‘Set The Counter to 1
      Counter = 1
      ‘Loop Until the End Of File Is Reached
      Do While Seek(FileNum) <= LOF(FileNum)
         ‘Display Importing Row Number On Status Bar
          Application.StatusBar = “Importing Row ” & _
             Counter & ” of text file ” & FileName
          ‘Store One Line Of Text From File To Variable
          Line Input #FileNum, ResultStr
          ‘Store Variable Data Into Active Cell
          If Left(ResultStr, 1) = “=” Then
             ActiveCell.Value = “‘” & ResultStr
          Else
             ActiveCell.Value = ResultStr
          End If
         
          ‘For Excel versions before Excel 97, change 65536 to 16384
          If ActiveCell.Row = 65536 Then
             ‘If On The Last Row Then Add A New Sheet
             ActiveWorkbook.Sheets.Add
          Else
             ‘If Not The Last Row Then Go One Cell Down
             ActiveCell.Offset(1, 0).Select
          End If
          ‘Increment the Counter By 1
          Counter = Counter + 1
      ‘Start Again At Top Of ‘Do While’ Statement
      Loop
      ‘Close The Open Text File
      Close
      ‘Remove Message From Status Bar
      Application.StatusBar = False

   End Sub

More information can be found here.

Posted by: sanjeewa | March 11, 2008

The page cannot be displayed error when viewing CHM files

If you are having problems viewing CHM files, like when you click on any of the subject headings in the file and it shows a ”Page can’t be displayed” IE screen, right-click on the CHM file and select Properties from the context menu. Then click on the Unblock button at the bottom. This might fix the problem.

chm error

In case this didnt fix the problem try renaming the file. As it might create problems when the file name contains special characters like “#”, etc.


Bookmark and Share

Posted by: sanjeewa | February 22, 2008

< / J K C S >

It was 2nd of October 2006 the HR executive took me around JKCS and it appeared to be just another software development company. but it took only few months for me to realize that JKCS truly is “More Than Just a Work Place..”

The most wonderful part of the JKCS is the people in it. JKCS has got “Computer Geeks” as most of the other software development companies but what makes JKCS different is, those “Computer Geeks” have not lost their Common Sense like others. The team i was in called “CSC” or “Braathens” lead by a wonderful PM. No matter whether you are “Bill Gates” or “Steve Jobs” they accept you as you are, most of the people including the management will never try to change you. Instead they identify your good and bad qualities and immediately start loving your good qualities ignoring the bad qualities. Even a less talkative alien type guy like me could easily get along with almost everyone and could make lot of cool friends as well..

So then you might ask what made me to leave such a nice place.. Well.. all I can say is.. We face such situations that, Though it is a bad practice, We end up leaving no choice other than taking things to runtime even it can be done at compile time. Same here :)  

Posted by: sanjeewa | February 22, 2008

Sky Drive goes 5GB

Ya.. I’m not a Sky Drive fan. I didnt try it at all, that was because It was offering just 1GB which I thought its quite a limited storage.. But not any more..

Picture Says it All… Check it yourself

Posted by: sanjeewa | February 15, 2008

My First O’reilly Book is Released :-)

 

I wish I could write this book one day. :-D I designed this book cover using a funny online tool called O’relly Book Maker.

If you have ever thought who is behind most of these strange book designes, it is Lorrie Lejeune, a free lance artist. There is a nice article which  explains how the animals ended up on O’reilly books and what sort of process they go through when drawing those animals. Read it here.  

Posted by: sanjeewa | January 23, 2008

WordPress increases free space from 50MB to 3GB.

I came across this news today that wordpress now offers 3GB. I quickly checked the storage capacity of my blog and it shows..

As Matt Mullenweg says :
“Today, one of those developments comes to fruition — everyone’s free upload space has been increased 60x from 50mb to 3,000mb. To get the same amount of space at our nearest competitor, Typepad, you’d pay at least $300 a year. Blogger only gives you 1GB. We’re doing the same thing for free.”

ya..he is not kidding..and this is how they are able to do it..

“Over the past year we’ve developed our file infrastructure, replication, backup, caching, and S3-backed storage to the point where we don’t feel like we need to artificially limit what you folks are able to upload just to keep up with growth. We’re ready for you.”

Read entire article.

Posted by: sanjeewa | December 18, 2007

"Api Wawamu…Rata Hadamu.."

pregnant_20stick

I just happened to know a hot secret of a good old friend of mine by a mistake. Funniest part is she doesn’t want any of our friends to know it. Lets see how long she can hide it..lolz.. anyway great work..keep it up…

Posted by: sanjeewa | December 11, 2007

Do you allow your browser to remember your passwords..?

image

We all know that we can configure the browser, when ever we enter a password in a web form, browser prompts us asking whether we need to save it in the browser. When it happens to me in my home PC most of the time I say yes without bothering much about where it is saved or whether it is encrypted..etc..

But today I came to know that there is a serious risk in allowing the browser to save the login credentials. Specially when it is FireFox anyone who can access the system can see your passwords. All they have to do is go to,

Tools -> Options -> Security -> Show Passwords.

Try this if you were not aware about this and you will get surprised to see all your stored passwords are revealed.

Microsoft has gone one step forward by storing them encrypted in the registry, but I came to know that still there are tools like IE PassView which enable anyone to get them.

To disable this option in IE we can uncheck the ‘ Prompt me to save passwords ‘. and in Firefox it is ‘ Set Master Password ‘.

So next time be aware when you say ” Remember ” to save your passwords in the browser.

Posted by: sanjeewa | November 23, 2007

Silverlight Tutorials.

I came across a nice collection of another silverlight tutorials at Linda.com. Check them here.

Older Posts »

Categories