Thursday, March 29, 2012

Lotus Script File Exists Function

Have you ever needed to verify that a file was really there before you opened it in LotusScript?  Nothing is more fun than to try and access a database that's not there.  So what do you do?  How about checking to see if it exists first?

Now I didn't write this function, so I'll not take 100% credit for it.  But I did make some changes so that it returns either True or False when you use it.

If your LotusScript says Print "File Names.nsf is present is " & FileExists("names.nsf") you should get:

Files Names.nsf is present is True since you must have this file in order to run your client or server.


Here is the code:


Function FileExists(filenm As String) As Boolean
    ' Tests if file exists, returns True for yes, False for no
    On Error GoTo FErrorHandler 'Bail on an error
   
    'Test file
    If (Dir$(filenm)="") Then
        'No file exists
        FileExists = False
    Else
        'File exists
        FileExists = True
    End If
    Exit Function

FErrorHandler:
    'We had an error, so we assume there was no file found
    FileExists = False
    Exit Function
End Function

Tuesday, March 13, 2012

Wrong Image Count On Android Gallery - Part 2

As I mentioned in my first post on this issue, there seems to be multiple ways to cleanup you Android Gallery image counts.  Here's the last one I tried (and came up with). 

If you have folder called "Pictures" that shows 100 images, but really has on 10 you can do the following to correct.  1) Using a file system tool such as Astro, rename your folder from Pictures to Pic.  This should make your SD cards be rescanned. 2) Open the Gallery app and you should now see a Pictures folder and a Pic folder.  Pictures should still show 100 images and Pic should show 10.  3) Long press on the Pictures folder and select delete to remove it. 4) Exit Gallery.  5) Open Astro again and this time rename Pic back to Pictures.  Open Gallery again and you should see the Pictures folder with the correct image count.

I'm not sure what the issue is with Gallery on Android 2.x, but this sure is an annoying problem.  I know that I don't have this issue on my Acer A500 running Android 3.x.  And most of the time I like to use QuickPic as a Gallery replacement.

Enjoy!