Wednesday, November 30, 2011

ssTitleBar2

You may ask me, why have I created yet another title bar class again?  And the answer is because I want to give more to the users.

All my previous title bar class are dependent of images I designed using Adobe Photoshop and though those looks good per my own taste, creating yet another look or simply just colors takes time.  And so I want to get out of that bond I inadvertently created for myself, therefore ssTitleBar2.

What has this new titlebar class has to offer that those previous ones can't?

  • Less Images - This new class is designed mostly using native VFP shapes and are positioned properly to give it a good look.  The shapes are the whole titlebar component itself including the control box.  Now it is easier for me to create new themes and color, whenever the mood hits me.
  •  Additional objects
    • Another subclass in the appearance of a printer icon is created so users can switch their default OS printer on the ply (optionally shown)
    • Time is optionally shown
    • ssChkBox is embedded to allow movement of the form or not (optionally shown)
  • Resizable - Whereas the old titlebar classes cannot be resized when the lShowBorder parameter is set to .T., this one now can.  In addition, borderline is now better looking
Here is an image of this class:



One major improvement of ssClasses this week is the creation of ssColors which will allow me to make new color combinations that will affect all my sub-classes that needs it.  Like I said, creating new themes and colors next time will be easier (because of ssColors).  Not to mention that ssSkinner is also using this so you can extend color-theming on the ply even to native VFP objects much easier.


Friday, November 25, 2011

Troubleshoot Sending Email from Outlook

Due to intermittent connection with internet resulting from Degradation of Service on our VSAT, we constantly have problems sending emails. In addition, there are few minor reasons why email sending fails. So this blog is meant to give guide to those who have problems sending emails.

Reason: Invalid email address(es). Users kept telling me that their email is not delivered properly. And I kept telling them to check the email addresses because if you have more than one recipient or have some more on CC and BCC, a single invalid email will give you that undeliverable error report.

Solution: Confirm that you have the proper email addresses.

Reason: Dangling Reference - Because email sending is taking the user so much time, the tendency is they will close Outlook, Open it again, then try sending the email once more. They may repeat doing this but got no luck. The reason is (per our experience on several units here), there are dangling references of outlook in the system processes.

Solution: Right-click taskbar, activate Task Manager, Click Image Name Header to sort the processes alphabetically either ascending or descending, and kill all Outlook instances there. Ensure that there is no more outlook instance before reopening outlook again. I am not sure if this is a bug of Outlook 2007 or not but that happens.

Reason: Add Ins. For some more reasons, some add ins affect also the way how outlook works smoothly.

Solution: Open outlook in Safe Mode. Few users know about this feature. You can easily do this by pressing Ctrl button while clicking outlook. It will inform you that it has detected you pressing the Ctrl key and will ask you if you want to start outlook on Safe Mode. Click ok then try sending your email again.

Reason: Blocked outgoing port. In some cases, you may not know that your unit is spewing out SPAMs due to undetected malwares on your unit. When this happens, your ISP may block your outgoing port (default is 25) and you won't be able to send out email.

Solution: Try the alternate port 587. Click on Tools, Account Settings, double-click your account, More Settings, Advanced, then change your outgoing port (SMTP) to 587.

Reason: Your recipients admins has made some protection on their end against SPAMS. When attempting to send an email, you may see either a relay error stating, Relaying Not Allowed, or an alert box requesting you enter your password. This would be an indication you need to check Outgoing SMTP authentication on your mail client program.

Solution: To avoid the possibility of your email being treated as SPAM, ensure that your email is authenticated by your Outgoing Mail Server. To do this: On outlook, click Tools, Account Settings, double-click your account, More Settings, Outgoing Server Tab, tick My Outgoing Server requires authentication, Log to Incoming Mail Server before Sending Mail.

Well, that wraps up the way I troubleshoot our sending of emails problem over here. If I suddenly think of some more reasons and the ways to counter those, I will update this blog.

Hope this helps!

Tuesday, November 22, 2011

Importing from an xlsx file via automation Part II

Last time I created an entry in weblogs about the automation approach of importing an xlsx file because with the change of format on Excel 2007 onwards, VFP is generating an error now on importing it.  Since importing has no problem on lower versions of Excel files, the solution I have proposed is to save the sheet to a lower version, preferably XL5 format for backward compatibility reason.

Now, a new question is raised.  Though that approach works fast and is easy, how can we import from a specific worksheet inside the excel workbook?

If you use the approach that I have shown, it will always get only the first sheet.  Here is another trick though so we can do a selective import of an existing sheet inside that workbook.  And as a bonus due to another question raised inside Foxite Forum, here is also a way on how to replace the column names with the contents of the first row so Field Names will be better and proper instead of Field Name A, B, C.... and so on:

ssTab

ssTab is the latest on my ssclasses family.  I originally created ssPage before but since I am still new with classes way back then, although the class produces an appealing tab appearance, it is messier and harder to use.

ssTab is better in a lot of ways than ssPage.  It also offers more feature than ssPage.  Here are the parameters of ssTab:

Lparameters cCaption, cToolTip, nTab, cPageFrame, nColor, nStyle, cIcon, nIconStretch, lShowFold, lActiveTab

Where:

  • cCaption - is the caption of the tab
  • cToolTip - is the tooltiptext of the tab (optional)
  • nTab - is the tab number of the PageFrame to be binded to ssTab
  • cPageFrame - is the name of the PageFrame to be binded to ssTab
  • nColor - is a numeric color (right now only 1 to 4) to dictate what color of the tab will appear
  • nStyle - is the BackStyle of the tab (1 for Opaque, 0 for Transparent).  This produces extra appearances on ssTab
  • cIcon - is the icon of the tab (optional, use bmp or jpeg; preferably .bmp)
  • nIconStretch - will the icon stretch or not?
  • lShowFold - whether ActivePage (clicked page) shows a folded section on the right or not 
  • lActiveTab - to specify which one of the ssTabs you want to be the Active Tab (and which Page of the PageFrame to start active)
 Right now, here are the possible look of Active ssTab (all with lShowFold = .T.)



Of course, in the future I may create more.

Among the sample given to subscribers is this:


Enjoy!

Friday, November 18, 2011

Extending FastXtab (Cross Tab)

What is a Cross Tab?

Cross tabulation is the process of creating a contingency table from the multivariate frequency distribution of statistical variables. Heavily used in survey research, cross tabulations (or crosstabs for short) can be produced by a range of statistical packages, including some that are specialised for the task. Survey weights often need to be incorporated. Unweighted tables can be easily produced by some spreadsheets and other business intelligence tools, where they are commonly known as pivot tables.  - Wiki

===========

FastXTab is another cross tab utility developed and shared to us by Alexander Gorovlev which aims to replace the cross tab utility shipped with VFP (VFPXtab).  Its name lives to its reputation of being faster than VFPXtab.  It can be downloaded here: http://www.universalthread.com/ViewPageNewDownload.aspx?ID=9944

Originally I do cross-tabbing (pivoting) inside Excel via automation and it has its own merits but though it offers more features that after the pivot sheet is created that you can still manipulate it, it appears to be slower and of course you have to do a lot of codings to attain it.

Enter FastXTab, as I mentioned a very fast cross tabulating utility.  One thing though that I noticed with it is on the bottom, the author has placed these:


* TODO:    Support for long field names
*        lTotalRows property

And I needed at that time that lTotalRows property.  So since it is not yet there (in the downloadable zip), I took the liberty to add that feature on my end and now decided to create this entry so interested users of FastXTab who has not added or made that property work yet can add it on their end as well.  Here is infused portion for lTotalRows:



Set Talk &cTalkStat
Set Null &cNullStat
Wait Clear

* If rows are totalled
If This.lTotalRows
      Alter Table Alias() Add Column "Total" N(12,2)
      Local lcField, lnTotal, lnloop
      Scan
            lnTotal = 0
            For lnloop = 2 To Fldcount() - 1
                  lcField = Field(m.lnloop)
                  lnTotal = lnTotal + &lcField
            Endfor
            Replace Total With m.lnTotal In Alias()
      Endscan
Endif

If This.lBrowseAfter
      Browse Nowait Normal
Endif



Ignore the ones colored in red.  Those are already there.  I just copied it here so you will know where I inserted the lTotalRows feature.

And if you are a user of ssToExcel, then combining FastXTab with that class will allow you to create your report in excel very fast and with good formatting plus column totals as well like this:





Tuesday, November 15, 2011

Restrict users from changing time on their local unit

Here is a trick on Restricting users changing the local CPU time.  Some people need it especially when a software is based on the running local unit’s clock, so by restricting the users’ ability to change it, they cannot cheat.

There are several ways to restrict it, but we will focus on Group Policies and some outside tricks.  To start, open Group Policy Editor by clicking Start button, Run, typing GPEDIT.MSC and hitting enter.

Once inside, navigate to these Folders:

a. Local Computer Policy
b. User Configuration
c. Administrative Templates

* Hiding the clock on system tray of Taskbar (User Notification Area)

On Start Menu and Taskbar Folder:
- Remove Clock from the system notification area – set to Enabled

* Hiding the Date and Time icon on Control Panel

Steps to Remove Recycler Folder

What is Recycler folder anyway?  Is it really part of Windows or not?

When you delete a file in Windows NT Explorer or My Computer, the file is stored in the Recycle Bin (if this feature is not turned off). The file remains in the Recycle Bin until you empty the Recycle Bin or restore the file.

The Recycler folder is used only on NTFS partitions. The RECYCLER folder is the recycle bin for every drive that has read/write capability. Naturally CDROM won’t have that. Saying another way, the Recycle Bin on your desktop is simply a shortcut to all the RECYCLER folders in your computer. If you have a C: and D: drives on your unit which is of read/write capability (harddrives, USB Mass Storage Devices); then your recycle bin shows the contents of C:RECYCLER and D:RECYCLER. Having these RECYCLER folders on each drive saves the OS from having to physically move/copy a deleted file or folder into one fixed location which maybe on another drive.  Needless to say, retaining an individual RECYCLER folder for each drive is way much reasonable, easier and faster.

Now, why in the heck would I want to “Remove Recycler Folder?” as the title suggests?