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:

http://rssfeederdotnet.sourceforge.net/

http://www.codeproject.com/smartclient/rssfeeder.asp

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:

http://www.mostlycreativeworkshop.com/article59.html

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:

SELECT *
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

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, ;
lnLastLine

llReturn = .T.

lobook = GETOBJECT(This.cExcelfile)
loExcel = lobook.Application
loexcel.Visible = .T.
lobook.Windows[1].Activate()
loBook.Sheets[1].Range("A1").Select
loExcel.ActiveCell.FormulaR1C1 = "Customer Name"
loBook.Sheets[1].Range("A2").Select
lobook.Sheets[1].Range("A1:C"+TRANSFORM(this.nlastline)).columns.Autofit()
loSourceData = lobook.Sheets[1].Range("A1:C"+TRANSFORM(this.nlastline))
loBook.Worksheets.Add(,loBook.Sheets[1])
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)
.Format(16)
ENDWITH

WITH loBook.Sheets[2].Cells
.Select
.Range("A6").Activate
ENDWITH

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.

ENDWITH

loBook.Sheets[2].PrintPreview

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.
ENDIF
NODEFAULT
ENDWITH
ELSE
DoDefault(tcTarget, tcLocation, tcFrame )
ENDIF


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!

Saturday, November 26, 2005

First Class All The Way!

Well, I wish we didn't live in a world with "classes" but... I decided to cash in some frequent flyer miles for first class this trip and boy howdy! It was everything I thought it would be and more! Actually, I have flown first class but it was quite a long time ago (my Dad is a retired airline mechanic). Anyway, it sure beat paying $5 for a "snack" and having to beg for coffee refills. Not to mention, the seats were actually pretty comfy. My "lite" lunch started with complimentary nuts. Not the packaged nuts, but served warm in a little bowl and followed up with a nice hot towel. I chose the shrimp chef salad over the grilled chicken breast. For dessert: a fresh baked, very large, tollhouse cookie. Still warm and chips melty. Definitely not the "airline" food I had come to expect. Now I'm spoiled and dreading the flight back home which will be, as they put it, in "the main cabin". Oh well, only a few thousand more miles until I qualify for my next upgrade.

Friday, November 25, 2005

MS Outlook User Hostile Interface

Yes, I have lost most of my remaining gray hairs over this, too:

MS Outlook hostile interface

In fact, the client I'm on my way to seeing now is always at risk of seeing this dialog if they happen to install the service pack that implements this. I know there are lots of third party "hacks" to get rid of this in Office 2000, but why can't it just be a user preference that persists? And, as Paul points out, my automation logic is not even coming near the address book in Outlook. I just need to have an email sent automatically when the user clicks a button in their VFP app. Sure, we could switch to SMTP or something, but the users like to see it in their Sent folder, etc. Seems like they could have done something a little more creative than this dialog to "fix" the problem.

Wednesday, November 23, 2005

SQL @@SERVERNAME can sometimes return NULL

In our SQL Server applications we have the need of connecting to different servers (ie. development, test, production). In order to know which server/database we are connected to I have some code that executes at startup after connecting to append this information to the _vfp.caption.


IF FILE("DEBUG.TXT") OR FILE("DISPLAYDBINFO.TXT")
lnResult = SQLEXEC(lnHandle,"SELECT @@SERVERNAME AS servername","servernamecursor")
IF lnResult > 0
_vfp.Caption = _vfp.Caption + " - "+ALLTRIM(servernamecursor.servername)
USE IN servernamecursor
lnResult = SQLEXEC(lnHandle,"SELECT DB_NAME() AS db_name","dbnamecursor")
IF lnResult > 0
_vfp.Caption = _vfp.Caption + "/"+ ALLTRIM(dbnamecursor.db_name)
USE IN dbnamecursor
ENDIF
ENDIF
ENDIF
This worked great for years until.... Not sure what SP or update caused it but @@Servername started returning NULL!

We've found 2 possible solutions to this:

1. Try using SELECT ServerProperty('servername') instead of SELECT @@SERVERNAME
2. Perform the following in Query Analyzer:
sp_dropserver 'MYSERVER'
sp_addserver 'MYSERVER', 'local'
Note: this requires you to restart SQL Server before @@SERVERNAME is fixed.

Additional info: http://www.sqlnewsgroups.net/group/microsoft.public.sqlserver.server/topic4087.aspx

Monday, November 21, 2005

FlyLady

Do you have a clutter problem at your house? We sure do! If you do too, then you should really check out FlyLady.

My Mom told me about this yesterday and said it has helped her a lot. So both my wife and I joined their mailing list. Fly Lady uses a "baby steps" approach to helping you get clutter free and organized. I'll let you know how it's working after a few months. My Mom said the email can get overwhelming so I've set it to just send me a daily digest of the mails.

Sunday, November 20, 2005

Ready or not, here comes my Blog!

Well, after several months of "blog envy" (ie. really enjoyable reading) I've decided to launch myself into the blogosphere.

Hopefully it will be much more successful than my wiki launch a couple of years ago. I think I got about 3 hits in the first 20 minutes and that's about it.

So, stay tuned for weekly (I hope) postings. I'm planning to blog about a myriad of topics but will probably try to stay focused on Visual Foxpro and IT related stuff. I have been employed with Orion Group going on 9 years.

I have been developing with Fox versions going back to Foxbase+ when I worked as a "computer operator" for an RV manufacturing company in 1988. I had a brief encounter with Dbase III+ but then soon discovered Foxbase, and the rest is history. About the only other database development tool I've worked with in that time (other than very limited Access work) was Uniface, which kind of gave me my first exposure to client/server databases as we used Oracle on the backend. This was for a mortgage servicing application.

This has been a very busy couple of years for me at Orion Group. Lots of new projects using VFP 9.0 as well as enhancements and maintenance of existing VFP apps.

This week I will be travelling to a client in Ca. to do a system cutover. I have been supporting them since 1993 when I wrote their first line of business app in Foxpro for Windows 2.5 (not long after it was realeased) We just finished up their second re-engineering project (last time was 1999) which will get them up on VFP9, VFE2005 and SQL Server 2000. They have been running on Fox tables all this time and have never had to purge or archive! Their first app was written in FPW2.6 and I used the Codebook 2.0 framework which I enhanced with my own toolbar icons, etc. The last re-write used VFP6 and VFE5.5 (VFE6 was still in early beta at the time or I would have gone with that) Oh yeah, and they also run Foxfire 3.0 and are eagerly awaiting the release of Foxfire 8. This is just one example of the type of projects I am currently involved with at Orion Group.

We are also keeping an eye on .NET and have been getting some people certified on that platform so we are ready when the right opportunity comes our way for that. In the meantime, VFP continues to provide a very rich development environment. I have also done some .NET interop (both ways) as well as published and consumed XML Web Services using VFP and .NET.

Well, enough about "work". In my "spare" time I am an avid Irish football fan. I live close enough to walk to the games. I've had season tickets the past 4 years and was at the ND vs. USC game which many in the media are saying is one of the best football games they've ever seen. My seats are 12 rows back in the end-zone where Matt Leinert was "pushed" in by Reggie Bush. One moment I will never forget as long as I live. My nephew was the lucky one who got to go the game with me for his 17th birthday.

When football season is over, I like to spend time tweaking my "gamer" PC and playing Battlefield 2 (much to the chagrin of my loving and very understanding wife, Pauline). I play with an online "clan" called "Matureasskickers"

Thanks for visiting and please come again.

- Randy Jean

P.S. Happy Thanksgiving!