Saturday, July 31, 2004

No more VFP10?

No more VFP10? A message posted by a UT member :
*** The Loop *** From: "Gary Shurman"
OK. I had lunch with Ken Levy at DevEssentials in Kansas City last month. I
asked if they were working on version 10. His response was basically -
what new features would you like added? He felt that the product was
very complete now and unless we as a VFP developers could come up with
enough new ideas to make the product sell more, there would be no 10.
He also said that members of the VFP team at Microsoft have been
working with the .Net team to port the VFP functions to .Net. He
didn't say that VFP will become part of .Net, only that functions are
being ported.

As far as VFP and Longhorn were concerned, he said that it would be
like going from DOS to Windows. Most older apps would run, but would
be ugly. Since Longhorn isn't expected until sometime in 2006 and it
will take some time after that before our clients buy PCs with
Longhorn installed, I'm sure Microsoft will have solutions for us with
either a new version of VFP or a .Net that will be easy to port our apps to.


Let's see what Ken Levy said :
Much of what Gary Shurman posted (copied at the end of this message for reference) is either out of context or incorrect. In every case someone asked me about what will be done after version 9.0 of Visual FoxPro is released, I basically responded with a question asking people what features they would like to see.

I also mentioned what some people have commented that Visual FoxPro is very mature. In no way did I mention anything about us not enough features being suggestion had any impact on decisions. Also, unlike what was posted by Gary, there are no members of the Visual FoxPro team working on Visual Studio or .NET. The Visual FoxPro team is working on Visual FoxPro 9.0 only. What I said was that many people on the Visual Studio and the .NET Framework teams have been and are continuing to review Visual FoxPro and add new features based on it.

Many of the great data-centric and other features in Visual FoxPro are being added to future Visual Studio and .NET products and technologies. Refer to Alan Griver's recent blog post at http://blogs.msdn.com/vsdata/archive/2004/07/29/201070.aspx (Data/Language Integration in .NET (by yag)). Similarly, the Visual FoxPro team continues to review Visual Studio .NET and SQL Server features and add them to Visual FoxPro 9.0 like the XMLAdapter enhancements, Data Server Explorer, new DBF data types, new SQL language extensions, and more.

I did not mention any specifics about Longhorn or any release dates. I did not make any comments about anything about porting Visual FoxPro applications for Longhorn or .NET, that part is completely fabricated and I don't even know where that summary was derived from based on the conversation.Suggested references are to read this recent interview with Bill Gates discussing Longhorn... especially the part with:
"Question: What about legacy application support? Is there a straightforward path for moving older applications into the Longhorn era?: Answer: We demonstrated VisiCalc running on Longhorn today, to show that 20 years of compatibility is a serious thing--people who want to run Electric Pencil and dBase and early versions of 1-2-3 if they want. We have built a compatible operating system. That's one of the things that Microsoft does. We have put a lot of resources into it. Even if we are providing new capabilities, we run those existing applications and make sure there are benefits with those applications. The greatest benefit comes with a new application written for Longhorn."

I have not talked to Tore Bleken since I was in Europe last month, but I can see he has a great memory from the conversations in Kansas City (DevEssentials) and other Visual FoxPro events last in June. The response message Tore posted on the UniversalThread.com about this original post from Gary Shurman is completely correct and accurate. Here is what Tore posted on the Universal Thread...

> Tore Bleken #009436
> Bleken Elektronikk AS
> Stokke, Norway
> Forum: Thread ID: 929312
> Category: Message ID: 929746
> Title: Re: Ken Levy Speaks?
> I had dinner with Ken in KC, and I can confirm that Ken said something like what is written in your message. However, we > was very clear not to give any indications about any potential versions after VFP9. His comments was basically that the > decision about that was not taken, and would not even be discussed within Microsoft before VFP9 is released, and 'the dust > > has settled'. As you may know, I spent more than a week with Ken a month ago since he drove with me in my car around > > > Europe. During that time, the topic was mentioned many times, and he always made it clear that the Visual FoxPro team was totally > focused on VFP9, and that since no discussions had been held within Microsoft, no conclusion or indications could be given.
> Tore

When I ask someone a question, it does not imply anything. For example, if I ask someone "What do you think of adding feature...to Visual FoxPro?" in no way implies that we are planning on adding that feature to Visual FoxPro. Please, if something important about Visual FoxPro does not come from a Microsoft web site or an email/message posted online directly by me, then you should first assume that it is possibly incorrect and out of context. It is not advised that anyone makes decisions or spread rumors based on information that was possibly altered by mistake and turned into gossip. :)

More information about Visual FoxPro as well as announcements about upcoming version 9.0 can be found at http://msdn.com/vfoxpro, especially in the monthly letters (including archive) at http://msdn.com/vfoxpro/letters. When the August letter is posted online next week, it will include some answers to common questions that have been asked lately, so be sure to check it out. I will probably use some of the information in this post in the letter as well. :)

Friday, July 30, 2004

Misleading ASP error message.

I am maintaining on a small web application written in classic ASP. It access VFP database via ODBC. I get misleading error while running the program. After debug it for few hours, finally I found the cause and solution.

Error 1 : 'Cannot open file'
Cause : Database path is incorrect.
Solution : Correct connection string
Error 2 : Unspecified error on second run the ASP page
Cause : Wrong version of MDAC driver.
Solution : Install the latest MDAC driver.

Data and Language integration in .NET, in progress ...

.NET team has started to think about big issues of next version of Visual Studio including integration of data and language. Interesting ... can't wait to see how good would the data and language integration in .NET. Since, As I have been VFP developer for quite long time. This feature is my favourite.

Read more ...
Data/Language Integration in .NET (by yag)
Paul's blog

Thursday, July 29, 2004

Do you believe that?

Craig has blogged about his problems and comments on installing Visual Studio 2005 beta in FoxBlog. So suprisely, he get reply from Kevin Morrill of the DevDiv Setup Team.

As craig mentioned, Kevin doesn't subsribe to his blog. Kevin found his comments while doing a search at Feedster. Unbelievable! Do you ever have such experience? Does it seem Microsoft is going to be more customer focused strategy? Of course, it would be good for us. Am I right?

Wednesday, July 28, 2004

.NET whitepapers and samples for VFP developer

From message posted in UT's "Dot net class libraries and VFP ?" thread by Ken Levy, FoxTeam (I suppose) is working on some great new material that will be released in August to help VFP developer to learn .NET - stay tuned!

Tuesday, July 27, 2004

Review APRESS books to get three books FREE??

A Foxpro programmer is blogging about his experience on learning .NET.
He blogs that, he get three APRESS books FREE by reviewing a .NET APRESS books. Unbelievable!

Monday, July 26, 2004

My books are arrived !

The books I ordered last month have been arrived. Code Complete Second Edition, Rapid Development by Steve C McConnell are on my book shelf now. But Software Project Survival Guide is out of stock.

I am reading Code Complete Second Edition.

Utility to call .NET class in VFP, bye bye!

If you are following my blog (this, this) or Dot net class libraries and VFP ? thread in UT thread, you may heard of utility to call .NET class from VFP natively. This utility is written in C++, unmanaged code by FoxTeam. Ken Levy asked opinions from community to determine to ship it or not, depending on community needs with convincing reasons. Finally, FoxTeam has decided not to ship this utility after reviewed thread on this issue, however any suggestions are still open.

Before this, I asked myself, do I need to call .NET class from VFP? My answer is NO or may be. May be it could help, but I have no idea why and when I would do that. Since I am not using .NET at this moment, even though I am learning .NET. I would think that it is better to let FoxTeam to tell us, why do they think we need it. May be they may give us some clues. Anyhow, since the utility won't be shiipped ... game is over!

I felt that, Rick Strahl's and John Peterson's comments are the main reason for FoxTeam to make such decisions. Both of them are experienced developers. They have given FoxTeam very good and pratical comments.

Beside, John Peterson has suggested FoxTeam should better spend their effort more on other tools fox community requested for long time, such as COM debugging and etc. Fox developers need them more compare with utility mentioned above. Yes, I agree. It is the first time I stand on John Peterson side.

Friday, July 23, 2004

GDI+ FFC? Hooray!!!

I just finished reading article Using Using GDI+ in VFP 9.0 with the FFC Library, Part 1, FoxTalk August issue. According to author, a new set of GDI+ FFC graphics library would be shipped with VFP9 final released. And, it would be available for download in early of August or soon thereafter. It is really a great news! I have sent email to FoxTeam for requesting this library. Finally, here it is. Are they "listening" to me, or some other VFPer or it is already in their plans? Anyway, I don't care. I just want the library ... yes!!!!!

IF you haven't read this article, go ahead now. Because you can read it online, FREE!
If you haven't subscribe FoxTalk 2.0, I would strongly recommend to subscribe it now. FoxTalk 2.0 always give me suprises!!! Great Job!

Thursday, July 22, 2004

New XML tool in Visual Studio 2005

Let's get first look at new XML tool in VS 2005.

An open minded article : VFP and .NET

You may hearing discussion of VFP vs .NET in UT forum recently, again, again and again. The discussion is very "hot", and some replies are "too much" which may personal attack to other members.

VFP and .NET are Microsoft development tools. Each of them has their unique strength and weakness.
Article VFP and .NET : The Best of Both World from VFPConversion.com discussed about this, and demontrated how could we have the best of both world!

Sunday, July 18, 2004

Andrew Ross MacNeill's White Papers, Conference Notes and Articles

Andrew MacNeill has setup a white paper site. Waiting for his great articles post. Thank you Andrew MacNeill.

Saturday, July 17, 2004

VFP July letter is online

Check out VFP July Letter for latest VFP9 information.

The great news is FoxTeam has created VFP9 Beta Samples of various VFP9 enhancements, and available for download. Download sample and try it now! Thank you FoxTeam. Fox Rock!

And, the bad news is FoxTeam has no plans to to extend the 2 GB database size limit in Visual FoxPro due to many reasons including the 32-bit architecture that already exists within the product. No plans now, would it be for next version of VFP? Since future application would be 64 bits application, I think VFP should move to 64bits world. Otherwise, VFP will die. FoxTeam know about it better than anyone else. :(

Friday, July 16, 2004

Why VFP is not in MSDN product feedback center?

Why? Why? Why? Tell me why VFP is not there? Let's see what does John Kozial from Microsoft say ...

Refresh MS Graph data in VFP

VFP doesn't come with Graph control. However, VFP provides wizard for us to generate graph using MS Graph. It would be a static graph. It doesn't refresh by itself even your query result has changed. It is because VFP has "hard coded" data into graph's datasheet while generating.

Fortunely, we still able to change your graph content programmatically through automation. Here is a simple sample which would "refresh" MS Graph content generated by VFP's graph wizard. It shows :
  1. How to change value of particular column/row in MS Graph's datasheet.
    THISFORM.oChart.OBJECT.Application.DataSheet ;
    
    .Range("A2").Value = "10"
  2. How to import XLS file to MS Graph and display it.
    THISFORM.oChart.OBJECT.Application.FileImport(lcXLS)
    
I would prefer to use import XLS way to refresh the graph because VFP could export VFP cursor to XLS file easily with command
     COPY TO drive:\myXLS.xls TYPE XLS
NOTE: Before this, please make sure MS Excel (full pack version) is installed in your machine. Otherwise you would cause OLE error.

Beside, we also able to customize our graph just simple as automation. What we need is VBAGR10.chm, help file of MS Graph which come along with MSDN library. It shows MS Graph object hierarchy and interfaces. Have a look and try it now! Have fun!

Thursday, July 15, 2004

Char VS VarChar

That is an interesting question posted on regarding the topic of Char or Varchar? - You Decide (by John Koziol). The question asked, Char data type is faster or VarChar?

While waiting for reply from John Koziol, I have a simple test on this as code below. The result is, using Char data type would be slighly faster than VarChar. The differences is about 100 - 200 miliseconds. Most importantly, this test is run on PII 266, 128 RAM, WinXP machine. You may not see any difference in fast machine. Therefore, in my opinion, you decide which data type you want to use.
CLEAR ALL


LOCAL lcUnique

SET TALK OFF

CREATE CURSOR myCursor (Field1 C(20))

FOR I = 1 TO 1000
lcUnique = SYS(2015)
INSERT INTO myCursor VALUES ;
(lcUnique + REPLICATE("A", INT(RAND() * 10)))
NEXT

INDEX ON Field1 TAG Field1

SET VARCHARMAPPING OFF

lnSecond = SECONDS()
FOR I= 1 TO 1000
SELECT * FROM myCursor WHERE .T. INTO CURSOR TEMP
NEXT

?SET("VARCHARMAPPING") + [ - ] + TRANSFORM(SECONDS() - lnSecond)

SELECT TEMP

lnSecond = SECONDS()
FOR I = 1 TO 100
LOCATE FOR Field1 = lcUnique
NEXT

?[LOCATE - ] + TRANSFORM(SECONDS() -lnSecond)
Instruction
1. Run the code above
2. Record the elapse time
3. Change setting SET VARMAPPING OFF to SET VARMAPPING ON, and run it again.

Do you get same result as me, CHAR would perform slightly faster than VarChar?
If my memory serve me right, one of UT member explained that, this behavior caused by VFP need extra steps to take care of VARCHAR.

For example, you have a Name field with VARCHAR data type, length 30. If user key in 15 characters, VFP would replace the remaining spaces with CHR(0), and last byte with the actual number of characters stored in this field, which is value 15 in this case.

Wednesday, July 14, 2004

Tips to optmize SQL query Part II

Beside of SQL statement itself, there are other issues could effect query performance.

1. SET TALK OFF, SET ECHO OFF, SET ESCAPE OFF
Turn these settings OFF could speed up your query for 2X.

2. Close your result set once your don't need them anymore before run your next query.
I have a complex report that requires 10 tables with more than 1,000,000 records to be processed. It takes 10 minutes to be generated. After I placed code to close any intermediate resultset once no longer need, the performance is much improved by only require 4~5 minutes to process all.

If your machine has 512KB, or up to GigaByte of RAM, these tips may not help much. However, it may safe your life on machine with limited memory spaces. It is a best practise while writing code.

Even though the tips above are the most basic technique for optimization. However, we always forgot or undertake it.

Hope it helps

Calling your VFP program using OLE-DB provider

I never use VFP OLE-DB provider in my life. I am using VFP in my development, so I would access VFP database natively. I thought it is just as similar as other OLE-DB provider, only support SQL statement and stored procedure.

Today, I only realize we could run our prg from provider.

Here is the sample code provided by Aleksey Tsingauz (Microsoft) in UT. You could find out what commands are supported/unsupported in VFP OLE-DB provider here. Thank you Aleksey Tsingauz for sample code and David Stevenson (Editor of Foxtalk) for pointing me the url.
LOCAL oConn as ADODB.Connection


TEXT TO cPRG NOSHOW
RETURN "Here is the result"
ENDTEXT

STRTOFILE(cPRG,"c:\testPRG.prg")

oConn=CREATEOBJECT("ADODB.Connection")
oConn.Open("Provider=VFPOLEDB.1;Data Source=c:\")

oRS=oConn.Execute("testPRG",,4)
?oRS.Fields(0).Value

DELETE FILE c:\testPRG.prg
RETURN

VB.NET, C#, what else?

While talking about .NET, VB.NET and C# will come to our mind at first. Of course, there are still others .NET languages available such as J#.NET, Delphi.NET and etc.
Boo, a new object oriented statically typed programming language for the Common Language Infrastructure with a python inspired syntax and a special focus on language and compiler extensibility. [This definition is taken from Boo web site.]

[Original posted by Don Box]

Tuesday, July 13, 2004

General Programming and Database

C# 3.0 would be on integrating database language into general programming languages (OOP).
Check out interview video of Anders Hejlsberg.

BTW, Is it sound familiar? OOP + SQL ... doesn't VFP and Delphi already has these features?
Hope .NET bring more exciting features on data centric aspect.

Monday, July 12, 2004

VFP syntax coloring

Do you realize that, VFP code posted recently is more "colorful"? Thank you for Mike Helland's tool that converts Visual FoxPro code to HTML, preserving syntax coloring. It is a powerful and fast.

However, the VFP code is not converted on te fly while you visit this blog. It is "hard code". I copy the result converted by the tool and paste it directly to blog. Since, I haven't apply any web hosting service. :)

You could download the tool from UT and get the latest VFP syntax table from PDM project by EQEUS.COM.

Sunday, July 11, 2004

Enhance VFP9 Report using GDI+

During this weekend, I have came up a simple sample that enhance VFP9 report using GDI+, by refering couple of resources, such as GDI+ on MSDN library, www.News2News.com, FoxProAdvisor and helps from UT members especially Lisa Nicholls and Anatoliy Mogylevets.
Some wrapper classes and methods are implemented. It does not cover all of GDI+ functions, only those used in this project. It would take quite long time to implement all of them. Therefore, it would be good if FoxTeam could provide GDI+ wrapper classes, since they should be more familiar with GDI+ functions.

During this VFP9 Report project, I was stuck on couple of places which I think should be pay attention on:

1. Don't call GDI+ cleanup code while graphics object killed (GdiplusShutdown & GdipDeleteGraphics) if you are using GDI+ graphic handle from VFP report for drawing. Otherwise, your report will hang.

2. GDI+ use ARGB (Alpha, Red, Green, Blue) color value instead of RGB. I have wrriten color class to handle the conversion.

3. Some GDI+ API GdipFillRectangle doesn't work for me. I got to use GdipFillRectangleI instead. The difference between both functions is GdipFillRectangleI receive coordinate parameter as INTEGER, but GdipFillRectangle receive REAL. I used to change my data type to LONG in API declaration, but doesn't help.

4. Function GdipDrawLineI works fine in drawing non-straigt line.
x1 = 100

y1 = 175
x2 = 500
y2 = 176
But not horizontal or vertical line.
x1 = 100

y1 = 175
x2 = 500
y2 = 175

= GdipDrawLineI(x1, y1, x2, y2)
if anyone has any ideas, pls comment.

Back to the sample. This sample generate student exam score report, displaying student score field by text and graphically (thermometer). [Screenshot]

Here is the code in ReportListener.Render()
LPARAMETERS nFRXRecno, nLeft, nTop, nWidth, nHeight, ;

nObjectContinuationType, cContentsToBeRendered, ;
GDIPlusImage

LOCAL loGraphics, loColor, loSolidBrush, loPen, lnScoreWidth

THIS.setFRXDataSession()

SELECT frx
GO (nFRXRecno)

*-- I have keyed in "CHART" in Rectangle control's user column
*-- to indicate that is the control used for drawing purposes.
*-- Check if it is the border we want
llChart = frx.User = "CHART"

this.setCurrentDataSession()

IF llChart
loGraphics = CREATEOBJECT("Graphics")

*-- Set report GDI+ handler to custom graphics class
loGraphics.GetFromExternal(THIS.GDIPlusGraphics)

*-- Get color ARGB value from color class
*-- Red color is used in this sample.
loColor = CREATEOBJECT("Color", 255,255,0,0)
loPen = CREATEOBJECT("Pen", loColor.Color, 4)

loSolidBrush = CREATEOBJECT("SolidBrush", loColor.Color)

*-- Draw thermometer rectangle border
loGraphics.DrawRectangle(loPen.Pen, nLeft , nTop , ;
nWidth , nHeight )

*-- Calculate the width thermometer value bar width
lnScoreWidth = (Exam.Score / 100 * nWidth)

*-- Fill color into rectangle but adjust the position and ;
*-- reduce size from original one to have special effect.
loGraphics.FillRectangle(loSolidBrush.SolidBrush, ;
nLeft + 20 , ;
nTop + 20 , ;
lnScoreWidth - 40, ;
nHeight - 40)

STORE .NULL. TO loSolidBrush, loColor, loGraphics
NODEFAULT
ELSE
DODEFAULT(nFRXRecno, nLeft, nTop, nWidth, nHeight, ;
nObjectContinuationType, cContentsToBeRendered, ;
GDIPlusImage)
ENDIF


Click here to download the full sample, for those whose interested.

[NOTE: It is a test program. Run / use this program at your own risk.]

Saturday, July 10, 2004

Polyphonic C#

Distributed programming is one of most important technology in enterprise application. Therefore, many development tool, such as .NET also supports asynchronous method call.

Indeed, .NET already has a widely-used set of library classes which allow any method to be invoked asynchronously (though note that in this standard pattern it is the caller who decides to invoke a method asynchronously, whereas in Polyphonic C# it is the callee (defining) side which declares a particular method to be asynchronous). The significant innovation in Polyphonic C# is the way in which method bodies are defined.

FoxProWiki syndication channel updated

FoxProWiki add more flavors of the RSS feed. Check out Wiki RSS Documentation for details.

Mozilla browsers are exploited, patch it now!

The Mozilla Foundation has confirmed findings that its Mozilla and Firefox browsers are vulnerable to attacks using the "shell:" scheme, which execute arbitrary code under Windows without the user having to click a link. This fix is for users of all Mozilla products on Windows XP. More info here.

Friday, July 09, 2004

Tip to optimize SQL query

VFP has a very fast data engine. However, it could be slow if your SQL statement is not written efficiently.

I have written a simple test program here. Try run this program, record the elapse time, close VFP application and run it again for couple of times.
LOCAL lnCount1, lnCount2, lcUnique, lnSecond


CREATE CURSOR myTable1 (myField1 C(10))
CREATE CURSOR myTable2 (myField2 C(10))

FOR lnCount = 1 TO 100000
lcUnique = SYS(2015)

INSERT INTO myTable1 VALUES (lcUnique)

FOR lnCount2 = 1 TO 10
INSERT INTO myTable2 VALUES (lcUnique)
NEXT
NEXT

SELECT myTable1
INDEX ON myField1 TAG myField1
SELECT myTable2
INDEX ON myField2 TAG myField2

CLEAR
lnSecond = SECOND()

*-- This SQL is most commonly use
SELECT * ;
FROM myTable1 INNER JOIN myTable2 ON ;
myField1 == myField2 ;
WHERE myField1 == lcUnique ;
INTO CURSOR myTemp

?SECOND() - lnSecond

lnSecond = SECOND()

*-- This is "optimized" SQL
*-- Break the SQL into two, filter out one of these table first,
*-- then only join them up.
SELECT * ;
FROM myTable2 ;
WHERE myField2 == lcUnique ;
INTO CURSOR csrTemp

SELECT * ;
FROM csrTemp INNER JOIN myTable1 ;
ON myField2 == myField1 ;
INTO CURSOR csrTemp

?SECOND() - lnSecond
You may found that, the time taken by commonly used SQL is much longer than the optimized.
Here is the result in my test.
Common Use SQL : 0.189
Optimized SQL : 0.001 ~ 0.002

This blog is listed ! Any guest?

This blog is listed in FoxPro Wiki. Who does it? Honestly, not me! Does anyone ever visit here?

Anyway, thank you for adding this blog to FoxPro Wiki list.

You are welcome !

Sample : How to send images in XML in VFP 8.0 by AlexFeldstein

AlexFeldstein has posted sample code How to send images in XML in VFP 8.0 in his blog. Thank you Alex.

You may get error if you run the code. Just replace variable mObs with mImages to make it works.

Thursday, July 08, 2004

Clarification from Ken Levy

Ken has back from Europe trip and posted a clarification message in UniversalThread.com about The first 'great news' after VFP9 Beta.

The VFP [Team] is not spending anytime on significant efforts in working on anything beyond VFP 9.0, and nothing has been said or announced about a version after 9.0. Keep in mind that this is the same as was the case during the development of VFP 8.0, and VFP 7.0. At Prague DevCon, I commented to a small group of people about some utilities we were "considering" to release after VFP 9.0, and they are not part of the core VFP product but add-ons written as DLLs or VFP Xbase components. This utility we have a prototype for to call .NET framework classes from within VFP is only a prototype, not part of the VFP product but a separate utility, and may or may not be released depending on the scenarios and needs by customers based on feedback like in this thread. There won't be anything announced about what the VFP team works on post version 9.0 until after we launch VFP 9.0


Having web conference

Andrew MacNeill has come out an idea of Confenrence on web. I haven been expecting this kind of conference for VFP since few years ago. Most of the VFP conferences are held in US, Europe and Australia. Thereofre, I don't have luck to attend any of them. Attend FoxPro Conference is my dream. It would be great if Andrew MacNeill can make it.

Is MS Window secure and safe?

As we always heard, MS Windows is not secured because there are a lot of "hole" that allow hacker to control/access your system remotely. IOH, Linux and MacOS is more secure.

Craig has posted the link of Computer Weekly that points to research done by the Danish security firm Secunia. The research statistics show that MS Windows is more secured than we thinked. Because of the popularity of MS Window, it become the main target of hackers/virus authors to attack. That is why more vulnerabilities against MS Windows compare with others.

You may think that MS Windows is secured now. However, do you think it is safe? In my opinion, SECURE is NOT equal to SAFE! The chances to get infected in MS Windows is still higher than others because these viruses are designed for MS Windows.
[This is my opinion, it may be right, or may be wrong.]

So, should we keep on MS Windows or move to Linux or other OS? It depends on yourself. For me, I will stick on MS Windows for this moment.

Guidance for Securing Microsoft Windows XP

NIST Special Publication 800-68 has been created to assist IT professionals, in particularly Windows XP system administrators and information security personnel, in effectively securing Windows XP systems. Check here for more details.

Wednesday, July 07, 2004

MyFoxBlog has new name

Just to inform that, I have changed blog name from MyFoxBlog to Kok Kiet's Blog. I feel it is more suitable for this blog. This blog is not only limited to Visual FoxPro, but also dotNET and others IT related information.

Vote to Include Visual FoxPro Feedback Center

Jim Nelson posted suggestion to include Visual FoxPro as a selectable product in Feedback Center. Please vote for it. Thank you

Tuesday, July 06, 2004

FoxPro Advisor Article: Using GDI+ in VFP9 Report Writer

Finally, article about using GDI+ to enhancement VFP9 report, with chart sample were published in FoxPro Advisor. I had been waiting for it since VFP9 Beta released. Christof, author of the article introduces some GDI+ features, and show how easy to draw chart using GDI+ in VFP9 report using his GDI wrapper program.

The thing I feel dissapointed is the wrapper program only avaliable for Professional Resource CD subscriber. :( I have send an email to FoxTeam, suggest to have native or FFC graphics related class to make "drawing" easier for VFP developer to produce modern and more advance report/UI. Hope to hear good news on this.

Monday, July 05, 2004

One of the possible cause VFP table corruption

If you are using VFP table in your application, you may ever get headache of table corruption espcially if your table contains memo field. It doesn't meant VFP table is not stable, instead, it usually caused by hardware failure, power failure, bad memory, unstable network and etc. Therefore, for those who plan to use VFP table as your storage, make sure you use good hardware and build up a stable network.

For last few days, one of our clients reported data loss in our system. We go to check out the problem immediately. We don't have any repair tool, so we use our cheapest and stupid way to repair it :
  USE myTable EXCLUSIVE

SELECT * FROM myTable WHERE .T. INTO CURSOR csrTemp NOFILTER
SELECT myTable
ZAP
APPEND FROM DBF("csrTemp")
The code above alway works fine to repair table, may be memo field data will be lost. Anyway, it would be re-keyin manually without a big problem. However, it didn't help for them. We start suspecting hardware problem in one the pc. Since, we are using file sharing technique, data processing is done in workstation. We have difficulty to check every workstation. The biggest problem is system can't be stopped at that time. Finally, we found that is Window's "problem".

The problem is caused by the difference between the file locking in Windows 98 and earlier, and the file locking in Windows XP. Mirosoft Knowledge Base reported the error
Error 41: "Memo file is missing or invalid" error message when you access tables on computers that are running Windows 98 or earlier from computers that are running Windows XP.
From this experience, we know that this problem may not cause error 41 but corrupt your table without notice.

Resolution, Use a computer that is running Windows XP as the file server.

Hope this case study solve your future table corruption problem (of course, we never wish to has any corruption). :)

Sunday, July 04, 2004

UT Magazine, July 2004 issue is up.

There are couple of great topics in UT Magazine, July 2004 issue. The topics I like most are
  • Developing FLL Libraries
  • What's new in Visual FoxPro 9 Beta

FLL is VC++ written DLL, but only able to be used in FP/VFP environment. You can use SET LIBRARY TO myFLL.fll to open the library. Then, you could call it just as native function call. It is written to extend VFP functionality that usual difficult/impossible to be solved using VFP code. However, there are not much FLL around in market. One of the famous FLL would be Focus.fll. Developing FLL Libraries gives you some details about FLL, and help you to develop your first basic FLL step by step. This topic is new to me, since I never develop FLL.

Topic of "What's new in VFP9 Beta" is late for me. Why? It is because VFP9 Beta is avalaible for download at the beginning of June, before UT Mag June issue released. I expected there should be at least one topic about it in June issue. But, it doesn't. OTOH, Foxtalk is the first magazine talk about VFP9 Beta. Good Job! Anyway, we got it in UT July issue, and it covers more topics of enhancement features than Foxtalk and FoxPro Advisor. In fact, I am waiting for any article about generate custom report format in details. I have go thru _htmlreportlistener code, but still not able to catch it up. :(

Subscribe UT magazine now, if you interested. It covers topics about VFP and .NET as well. It is one of the best VFP $ .NET magazine.

Saturday, July 03, 2004

MIND Gathering of July

As usual, I attend MIND gathering at Microsoft Auditorium from 2:00PM to 5:30PM held every first saturday of month. Today is not exception either.

Gathering today seem not being "scheduled" well, because we have alot of "free time" there. Anyhow, the topics covered are excited.

First, Suresh to show us some extra IT knowledge like recent viruses list. Then he try to show us how to call DTS from .NET. Even though it is not running, but it is a good presentation.

Next, Andy from SAGEM show us Windows Mobile 2003 2nd Ed Smartphone. I am not familiar with smartphone, but I am quite interested on it. I don't need to mention, you should know our "inspector gadget" is the honest fan/expert on smartphone. He keep asking a lot of technical question and playing the smartphone. Mobile application seem to be the trend.

DataGrid, is a control that allow us to show and manipulate a list of records. Nick Seng presented how to extend datagrid functionality such as data binding and showing custom control in datagrid's column and auto row height fit. In Nick Seng's demo, he tried to add combobox control to datagrid's colunmn to let user select gender instead of key in manually. I felt it is quite complicated. Alot of steps and codes are required, including handle visibility of combobox while column getfocus and lostfocus. Just for sharing, you could accomplish the task above easier in Visual FoxPro. Check out sample code below for VFP sample code if you interesed. Anyway, there are some enhancements on databinding in VS.NET 2005. I hope it will include cool features found in VFP. I don't mind to switch if it is cool product. Change alway happen in IT industry.

Lastly, Azazi, our "Cikgu" give us a very practical and useful presentation - Coding Technique. He explained all the best practises for coding and why there are important. Azali is a very good presenter, and always present his topics with good real-world example.

Here is the Grid sample code :

PUBLIC loForm AS Form

CREATE CURSOR csrEmployee (Name C(50), Gender C(1))

FOR i = 1 TO 10
INSERT INTO csrEmployee VALUES (SYS(2015), ;
IIF(I % 2 = 1, "M", "F"))
NEXT

CREATE CURSOR csrGender (Gender C(1))
INSERT INTO csrGender VALUES ('M')
INSERT INTO csrGender VALUES ('F')

loForm = CREATEOBJECT("Form")

loForm.AddObject("myGrid", "Grid")

WITH loForm.myGrid AS Grid
.ColumnCount = 2

*-- Bind data to grid
.RecordSourceType = 1
.RecordSource = "csrEmployee"


*-- Setup combobox into grid's column

WITH .Column2 AS Column
.AddObject("cboGender", "ComboBox")

WITH .cboGender AS ComboBox
.BorderStyle = 0

*-- Bind Gender list to combobox for selection
.RowSourceType = 2
.RowSource = "csrGender"
.Style = 2
.Visible = .T.
ENDWITH

*-- Set newly added combobox as default control in that column
.CurrentControl = "cboGender"
.Sparse = .T.

*-- Set Sparse property to false
*-- if you want to show combobox all the time
* .Sparse = .F.
ENDWITH

.Visible = .T.
ENDWITH

loForm.Show()

The key properties setting are bolded.

Update - SQL enhancement in VFP9

I have a small batch processing module that do something similar as cascade update. Any changes to master table's primary key will also change the foreign key value of child table.

Prio to VFP9, your code may do this by :
  1. Call stored procedure from update trigger

  2. Add new column to store original PK value, update PK value and then poop thru master table records and update child table FK field accordingly

In my testing, both ways work extremely slow. Thank to FoxTeam on enhancement of Update - SQL in VFP. Now, I can use SINGLE Update - SQL statement to solve my problems above and the performance is much much better.

Here is the testing setup code :
CREATE CURSOR tmpMaster (PK C(10))


FOR I = 1 TO 100
INSERT INTO tmpMaster VALUES(SYS(2015))
NEXT

CREATE CURSOR tmpChild (PK C(10), FK C(10))

SELECT tmpMaster
SCAN
FOR I = 1 TO 100
INSERT INTO tmpChild VALUES (SYS(2015), tmpMaster.PK)
NEXT
ENDSCAN

ALTER TABLE tmpMaster ADD COLUMN OriginalPK C(10)

REPLACE OriginalPK WITH PK ;
PK WITH SYS(2015) ALL ;
IN tmpMaster

*-- Code used prio VFP9
?SECONDS()

Here is the cascade update code used prio to VFP9 :
*-- Cascade update

SELECT tmpMaster
SCAN
SELECT tmpChild
LOCATE FOR FK == tmpMaster.OriginalPK
IF FOUND()
REPLACE FK WITH tmpMaster.PK
ENDIF
ENDSCAN

?SECONDS()
Replace the code after *-- Cascade update comment with the code below and run the code again.

Update - SQL in VFP9
?SECONDS()

UPDATE tmpChild SET FK = ;
(SELECT PK FROM tmpMaster WHERE OriginalPK == tmpChild.FK)

?SECONDS()


You may found that Update-SQL in VFP9 work 10X faster than the code used prio to VFP9.

Thursday, July 01, 2004

Reply of Future as a VFP Developer by John Koziol

Since 10 years ago, everybody is talking about VFP is die. However, VFP7, 8 and 9 Beta are released either.

One of the message posted in UT.
A company interviewer told a VFP developer , he is suicide because he learn/use VFP as development tool.

There are ton of reply for this message. Some of them agree, and some don't. John Koziol from Fox Team, Microsoft has post his opinion on this message. He feel that
Visual FoxPro is actually a great training ground for moving on at some point .. or not as the situation dictates. Again, computer languages don't last forever.

These messages have blighten my mind. I have thinking of should I move to .NET or stay for VFP for long time. Seem, .NET is getting stronger and stronger but VFP is limited as tradisional pattern. Here is the answers: Use the right and most comfortable tool for your job. Aside, keep your eye at other technologies and development tools as well. MOVE when necessary, at the right time. When is the right time? When you feel you should move. :) It is my opinion.

Be ready to move, it is the fact of IT.

I have registered for TechEd 2004

I have just faxed my bank-in slip to TechEd 2004 organizer. That meant, I have registered myself for TechEd 2004, finally.

Why I say finally? Because, I should be registered two weeks ago. I was waiting for their online registration ready, since I would like to pay by credit card(got points ma..). Who know they delay it for couple of times. And, even it is ready, no online payment feature built-in. It is really dissapointed me. Due date discount for early birds is coming soon. I have no other choices but bank in to organizer's account directly.

Anyway, see you all in TechEd 2004 at Palance of Golden Horse Hotel. chaos..