Quote of the Day

Friday, December 23, 2005

RSSFeeder .NET

Spending some time on my day off just trying to catch up on all the new stuff in the world of software and came across this little gem called RSSFeeder .NET:



I was reluctant to purchase a license for Feeddemon until I knew if I would really use an RSS aggregator. I had switched to using Newsgator online, which is nice (and free), but I missed the robustness of a client-side program. Until I found RSSFeeder .NET. I have not thoroughly explored this software yet, but so far, I am impressed.

The article at codeproject goes into some interesting technical background on the development of RSSFeeder .NET - I'm hoping to learn a little more about Atom vs. RSS 2.0 in hopes of getting my Open Wiki to consume Atom feeds.

Hope everyone has a very Merry Christmas and Happy Holidays!

Tuesday, December 20, 2005

Finding Text in Files Using Windows Search

I was growing increasingly frustrated at not being able to search for text using Windows XP search to search within .ASP or .PRG files. (But Visual Foxpro Filer works great!) Searching for text in specific files is a common task a programmer needs to perform from time to time. I had no idea why it wasn't working until a co-worker sent me this link today:


I normally don't use registry "hacks" like this, but in this case I think it may be worth it. Hope this helps another frustrated Windows developer out there.

How to force SQL Server Query to be Case-Senstive

By default, SQL Server instances are non-case sensitive. In order to force a case sensitive comparison to a literal value you need to change the collation. To find out the valid collation values, use the following query:

FROM ::fn_helpcollations()

Here is an example of getting a query to be case sensitive:

select count(*)
from tsfile
where left(digitalphotoloc,2) = 'g:'
collate SQL_Latin1_General_CP1_CS_AS

Wednesday, December 14, 2005

Robin Williams in Battlefield 2

Looks like some famous people like playing the same online video game as I do:



Way cool.

Tuesday, December 13, 2005

View Editor 3.6 Released

White Light Computing News Release

Well, this holiday season is bringing lots of new versions of software and White Light Computing's View Editor is no exception. If you are a Visual Foxpro developer and are using local or remote views, this is a must have tool. Rick Schummer has been doing an excellent job at supporting and enhancing this awesome program.
Merry Christmas!

Dean Gray Tuesday

Dean Gray Tuesday

Friday, December 09, 2005

Visual FoxPro 9.0 Service Pack 1 Released

Download Visual FoxPro 9.0 Service Pack 1 (SP1). SP1 provides the latest updates to Visual FoxPro 9.0 combining various enhancements and stability improvements into one integrated package.

Wednesday, December 07, 2005

FireFox & Security

I've been a Firefox user for quit a while. I was one of those "who needs anything but Internet Explorer" people ever since IE jumped past Netscape with version 5. But when I finally (reluctantly) installed and tried Firefox I've been a big fan ever since.

However, tonight I learned about an unsettling "feature" that to me is MAJOR security hole. I had used a friends PC to log on and get my email, check my newsfeeds at newsgator, etc. when I was in California last week. Now, I don't remember answering "Yes" to save any passwords, but that's besides the point. He called me tonight and informed me there is an option under Security where you can actually "Show" the saved passwords and he just stumbled on it! He's not even a geek like I me so I was a little embarrassed to admit I didn't know about this.

But, my embarrassment was really overshadowed by my shock: No application should EVER allow a user to see passwords and it should absolutely not be the default setting if it does! Fortunatetly, this was a friends computer and not a public one. You can set a master password that protects this password list from prying eyes and I highly recommend you do this immediately if you are a Firefox user.

For all the talk about Windows and Internet Explorer having security flaws, to me, this hole in Firefox would be the easiest to exploit. I've never seen anything in Windows or IE that let's me actually view passwords!

This type of exploit is what is commonly referred to as "social engineering". For instance: an office that has a lot of Firefox users is open to a major compromise of user passwords by someone just walking cubicle to cubicle and writing this information down. In my opinion this "feature" should be taken out altogether. It's just an awful, horrible idea to ever be able to "show" a password unmasked. This is exactly the type of thing that scares me about "open source" software - who is accountable for this design flaw? Who are the shareholders? And why would a company ever assume that only 1 person uses a computer with their software?

I would be interested in hearing any feedback. Are you as shocked as I am to know about this?

XFRX 11.2 just released

The latest version of XFRX reporting addon for VFP has just been released.

XFRX 11.1 Info

Now supports output to OpenOffice which uses OASIS (Open Document Format). Several other office application vendors use this same format.

We've been using 11.1 for a little over a month and have incorporated it into the VFE framework. If you want to easily allow your users to output to a variety of file types, this one of the best components I've seen for doing it quickly and easily and does not require using any other 3rd party components.

Tuesday, December 06, 2005

VFP Cross Tab Query vs. Excel Pivot Table

Today I learned how to automate Excel from VFP to create pivot tables. This totally rocks and is a much more powerful option than trying to output VFP cross tab data (created by the cross tab wizard or foundation classes) to FRX reports.

I was able to show my client how to easily create charts from the same pivot table in a variety of ways.

A great resource for getting started in doing this is the book Microsoft Automation with Visual Foxpro. I used a combination of the examples in the book, recording Excel macros, etc.

The reason I needed a good cross tab solution was that a long time client of mine had used Foxfire for many years. However, I just recently upgraded them to VFP9 and SQL Server and was evaluating the effort required to move to the next version of Foxfire which is still in beta. Needless to say, I was not having much luck. So, long story short, they needed the ability to run several reports from their new app ASAP. Many of these were cross-tabs which Foxfire did a pretty good job of making easy (but not an option for now). I wanted to keep it just as simple and was looking for a more dynamic alternative to Foxpro reports (FRX) to handle the output.

My co-worker Andy Needham suggested I take a look automating Excel. Great idea! In a single day I had 5 cross-tabs created in Excel and the client loves it!

Here is some sample code from the class I created: (Note: VFP cursor already loaded in Excel using COPY TO TYPE XL5 before this method is called)

LOCAL llReturn, ;
loExcel, ;
loBook, ;
loPivot, ;
loSourceData, ;
loDestination, ;

llReturn = .T.

lobook = GETOBJECT(This.cExcelfile)
loExcel = lobook.Application
loexcel.Visible = .T.
loExcel.ActiveCell.FormulaR1C1 = "Customer Name"
loSourceData = lobook.Sheets[1].Range("A1:C"+TRANSFORM(this.nlastline))
loDestination = loBook.Sheets[2].Range("A1")
loPivotTable = lobook.Sheets[1].PivotTableWizard(1,loSourceData,loDestination,This.cReporttitle,.T.,.T.)

WITH loPivotTable
.AddFields("Customer Name","order_month")
.PivotFields(this.ccountcolumn).Orientation = 4
.PivotFields("Order_Month").NumberFormat = "mmmm-yyyy"
.NullString = ""
.PageFieldOrder = 2
.PrintTitles = .F.
.RepeatItemsOnEachPrintedPage = .F.
.PrintTitles = .T.
.RepeatItemsOnEachPrintedPage = .T.
.PivotSelect("", 0)

WITH loBook.Sheets[2].Cells

loExcel.Selection.RowHeight = 16.5

WITH loBook.Sheets[2].PageSetup
.PrintTitleRows = "$1:$2"
.PrintTitleColumns = "$A:$A"
.LeftHeader = "&D&T"
.CenterHeader = This.cReporttitle
.RightHeader = "Page &P"
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = loExcel.InchesToPoints(0.25)
.RightMargin = loExcel.InchesToPoints(0.25)
.TopMargin = loExcel.InchesToPoints(.25)
.BottomMargin = loExcel.InchesToPoints(.25)
.HeaderMargin = loExcel.InchesToPoints(0.25)
.FooterMargin = loExcel.InchesToPoints(0.25)
.PrintHeadings = .F.
.PrintGridlines = .F.
.PrintComments = -4142
.PrintQuality = 600
.CenterHorizontally = .F.
.CenterVertically = .F.
.Orientation = 2
.Draft = .F.
.PaperSize = 1
.FirstPageNumber = -4105
.Order = 2
.BlackAndWhite = .F.
.Zoom = .F.
.FitToPagesWide = 1
.FitToPagesTall = .F.



loPivotTable = null
loSourceData = null
loDestination = null
loExcel = null
loBook = null

RETURN llReturn

A couple things to note: the structure of all these particular cross tabs is the same except for the count column (cu_name, order_month, my_count), so I set that to the cCountColumn property before calling this execute method. nLastLine is set from the RECCOUNT() of my result set. I change the header column of cu_name to Customer Name to make it look nicer.

Fun with Hyperlinks and IE

I just got a call from a client saying that they were trying to email from their application and their PC had opened up hundreds of instances of Internet Explorer and was continuing to load IE windows even as you tried to close them. Very strange.

The method we use for automatically opening a new email message window is based on a hyperlink class in the framework we use which instantiates IE and calls the navigate method. If it starts with "mailto:" it's supposed to open a new mail message using the default mail client (in this case, Outlook 2000). Here is the code that is called when the click the email label on the form:

* NavigateTo method of hyperlink class:
loBrowser = GETOBJECT("","InternetExplorer.Application")
IF TYPE("loBrowser.Name") = T_CHARACTER
WITH loBrowser
.Navigate(tcTarget, tcLocation, tcFrame)
* Do not display the browser if the URL is a mail to address.
IF NOT UPPER(LEFT(tcTarget,7)) == "MAILTO:"
.Visible = .T.
DoDefault(tcTarget, tcLocation, tcFrame )

Notice if it sees MAILTO: IE should not be made visible. This method has worked great for years. So I had them reboot the machine and try again with the same email address. Same thing. IE continued to load in some kind of endless loop fashion. Tried from another PC with same email address and it worked fine. Tried with a different email address on the PC with trouble and it worked fine, too. So what was up with this email address? It looked normal. I checked the contacts in Outlook and it looked like a normal entry there, too. Then my client noticed there was an email saved in the Drafts folder in Outlook. Lo and behold it was a blank email to this same address! We deleted it from Drafts and the problem went away! I tried re-producing the same thing on my development PC and could not get it to happen.

Don't you love it? It seems I spend more time supporting these type of Windows/Office issues than I do writing code sometimes. Anyway, just another glimpse into the typical day of a VFP programmer. Have a great day!