Calvin Hsia's WebLog
thoughts from a professional developer
String Optimization. How does it work?
In this post: Quiz: String performance optimization, I showed some very similar code with...
Author: CalvinH Date: 09/29/2005
Quiz: String performance optimization
This code takes .03 seconds to run on my computer Try running it on yours. ns=SECONDS() x="" FOR i =...
Author: CalvinH Date: 09/28/2005
Get the available paper bins from a printer
Sometimes you might want to find out how many paper bins a printer has. (Thanks to Barbara P for...
Author: CalvinH Date: 09/27/2005
GetLastError: how does it work with DECLARE DLL ?
Many Windows APIs can fail for various reasons. For example FormatMessage indicates failure by...
Author: CalvinH Date: 09/26/2005
GetLastError is a number. What does it mean?
A customer asked I'm getting an error 12 back from a GetLastError call, and I've seen a number of...
Author: CalvinH Date: 09/22/2005
How to filter out unwanted sounds via Fourier Transform
In this post about The Fast Fourier Transform, I described how simple it was to create a filter to...
Author: CalvinH Date: 09/20/2005
The Fast Fourier Transform
A long time ago in college, I learned a lot about signal processing. A microphone produces a signal,...
Author: CalvinH Date: 09/16/2005
A difficult debugging scenario
A customer had a problem with printing. I don’t know all the details about the setup. Trevor had a...
Author: CalvinH Date: 09/14/2005
Getting parameters from inherited classes
Visual Foxpro allows you to create a class that inherits behavior from another class. This includes...
Author: CalvinH Date: 09/13/2005
Creating a quick report from any cursor
For probably more than a decade, Fox can create a “quick report” from any table or cursor. CREATE...
Author: CalvinH Date: 09/09/2005
Binding to Internet Explorer Instances
A customer wanted to run code whenever a user started Internet Explorer. A possible solution is to...
Author: CalvinH Date: 09/07/2005
Strongly typed methods and properties
VFP allows you to generate COM servers using the OLEPUBLIC keyword. These objects can have custom...
Author: CalvinH Date: 09/02/2005
How to use DEVMODE
I received a question about how to use DEVMODE. Below is some sample code that retrieves the...
Author: CalvinH Date: 08/31/2005
Computer music on the radio
If you listen to an AM radio that’s placed near a computer, you can hear interference. I can put my...
Author: CalvinH Date: 08/30/2005
The .Object member
If you have an ActiveX control and you want intellisense to show just the control’s members, you can...
Author: CalvinH Date: 08/30/2005
What printers are available to your program?
The APRINTERS function allows you to enumerate all the printers to which your application can print....
Author: CalvinH Date: 08/26/2005
How do I backup files that are still in use without shutting down the application?
In my prior post (Puzzle: Why does backing up a data file require web application shut down?) the...
Author: CalvinH Date: 08/24/2005
Puzzle: Why does backing up a data file require web application shut down?
A customer reported a problem: Customer has a VB/ASP .NET web app that uses VFP data via the...
Author: CalvinH Date: 08/23/2005
Inheritance levels
The program below generates code to demonstrate 1000 levels of inheritance of VFP objects. The code...
Author: CalvinH Date: 08/22/2005
Foxpro Language into a table
Sometimes it’s useful to get the VFP language into a table, including commands, functions,...
Author: CalvinH Date: 08/19/2005
The mechanics of Sudoku
The rules of Sudoku are so simple (see Sudoku puzzles screen capture) that it seems easy to write...
Author: CalvinH Date: 08/18/2005
Sudoku puzzles screen capture
I love doing crossword puzzles: I’m a huge fan of Merle Reagle (I have all his books...
Author: CalvinH Date: 08/17/2005
Move your "My Documents" folder
The “My Documents” special folder feature of Windows helps users to separate their programs from...
Author: CalvinH Date: 08/16/2005
Have you used remote assistance ?
I wanted to demonstrate something on my machine to somebody in another location. Using remote...
Author: CalvinH Date: 08/15/2005
Use Windows 2003 Server and remote desktops for debugging
When debugging a process, you are often examining the context of a process at a breakpoint. When...
Author: CalvinH Date: 08/14/2005
Why a large picture works, but a small one fails?
In my last post Enable crop and zooming in on your digital photograph display form there is code...
Author: CalvinH Date: 08/12/2005
Enable crop and zooming in on your digital photograph display form
I wanted to add the ability to zoom into a portion of a photograph on my photo viewer. Below is some...
Author: CalvinH Date: 08/11/2005
Print method parameters are undocumented
The Print method of the Form or _screen shows only one parameter (the text to print) is accepted....
Author: CalvinH Date: 08/10/2005
Interesting form paint behavior
A customer sent us a repro scenario of a problem. There was a fairly complicated form with a...
Author: CalvinH Date: 08/09/2005
Puzzle: Creating an INDEX requires EXCLUSIVE use of the table, doesn't it?
A coworker asked a question about some code. It creates a table with 2 fields, reopens the table...
Author: CalvinH Date: 08/08/2005
Remove double spaces from pasted code samples in blog
If you highlight a recent code sample from my blog and paste it into VFP, you might see the code...
Author: CalvinH Date: 08/08/2005
Generating VBScript to read a blog
Sometimes I need to test something using VBScript. A user sends a code snippet and asks why it...
Author: CalvinH Date: 08/05/2005
Watch the Autocomplete values change as you enter data
Here is some code to demonstrate the AutoComplete property Its behavior is very similar to Outlook...
Author: CalvinH Date: 08/04/2005
Internet Explorer wordwrap doesn't break at commas
I was modifying my web based thumbnail image viewer. Under each thumb I wanted the description of...
Author: CalvinH Date: 08/03/2005
Reacting to Windows Session events.
Sometimes it’s useful to run some code in response to an event like somebody locking or unlocking...
Author: CalvinH Date: 08/02/2005
Creating shortcuts for fast access to programs and favorites
The Windows Start menu is very useful. I typically access some programs more than others. You can...
Author: CalvinH Date: 07/31/2005
Call GDI+ JPG manipulation from Excel, Word, Powerpoint, VB.NET
Here’s a way to manipulate photos from within some Microsoft products. In the prior post, I wrote...
Author: CalvinH Date: 07/25/2005
Draw text or graphics directly onto a JPG file
Here’s some code to manipulate photos using the GDIPlus class library that ships with VFP 9. It...
Author: CalvinH Date: 07/25/2005
GDI+ can't handle some malformed JPG files
I received a comment on my blog VFP handles some images differently with GDIPlus Here's another...
Author: CalvinH Date: 07/25/2005
ActiveX Controls don't treat Focus the same
If a RichText control on a form doesn’t have focus yet, it responds to being clicked on by calling...
Author: CalvinH Date: 07/22/2005
Accessing embedded files can have problems
FoxPro allows users to embed files into an APP or EXE file using the project manager. That means an...
Author: CalvinH Date: 07/21/2005
Create thumbnails of all your digital photos in a single table
At least once a week I download my photos to a new folder on one of my computers. As part of that...
Author: CalvinH Date: 07/20/2005
Simple demo of Customer/Orders one to many form with conflict detection and resolution
Often I’m asked to demo Foxpro to people who’ve never seen it before. In one demo I show how simple...
Author: CalvinH Date: 07/15/2005
VFP handles some images differently with GDIPlus
Visual Foxpro 9 uses GDIPlus to handle certain kinds of image files, such as JPG, GIF. Because the...
Author: CalvinH Date: 07/14/2005
New MSN Search Toolbar allows Tabbed Browsing
Several months ago, I saw an article about the FireFox browser, and how it could do “Tabbed...
Author: CalvinH Date: 07/07/2005
Is your Outlook mailbox overflowing? TreeMap it!
In this post I published 100 lines of code that showed how to get a visual representation of your...
Author: CalvinH Date: 07/01/2005
Bigger than Google: formatting very big numbers in Grids/Browse
An Exabyte is 10^18 bytes. (Exa, Peta, Tera, Giga, Mega) A Googlebyte is 10^100 bytes (1 followed by...
Author: CalvinH Date: 06/29/2005
Watch out when you use another computer for a demo
Wow…. I just had a nightmare of a time using a computer. A colleague asked me if I could do a demo...
Author: CalvinH Date: 06/24/2005
What is taking up the space on your hard disk? TreeMap it!
Several years ago, I saw a presentation from Microsoft Research about online communication in...
Author: CalvinH Date: 06/17/2005