This article may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. To maintain the flow of the article, we've left these URLs in the text, but disabled the links.


MIND


GEEK

Robert Hess

GEEK I would like to display some data in text format from a database in an ASP page and keep the formatting (spaces, line breaks, and so on) in the text. Is there a way to do this?
GEEK You could either simply wrap the data in a <pre> </pre> container, which will treat the text as preformatted (preserving all formatting) or you could parse the text in your ASP code, replacing multiple spaces with &nbsp; and putting in a <br> every time you come across a newline.
      The first method is easiest, but it also provides the least amount of flexibility for managing other aspects of how the information is being displayed. While parsing the code yourself will be more difficult, once you get the base code done, you will have a lot of freedom to add other features and capabilities to control how the information gets displayed.

GEEK If I were to write a program to search through each eBay category and extract a list of the most bid upon items, would I use JScript or do I need to learn a more complex language?
GEEK The best way to create reports or lists of the most bid upon items from eBay would be to have your code reside on eBay's server, where it would have direct access to the database servers that they use. It would only require you to construct a simple query, which could easily be done in a dozen or so lines of server-side script code.
      However, chances are good that eBay won't let you put your code on their server, which means you need to write code that performs what is commonly referred to as screen scraping. Screen scraping essentially means that you take a rendered view of some form-based document or display, then extract the necessary data from this display without any direct support from the software that actually generated the display to begin with.
      This solution will primarily consist of writing code that walks through the HTML code that eBay sends back, either by evaluating the raw HTML or using the Document Object Model (DOM) to treat the document as a hierarchically structured document, then locating and interpreting the appropriate information. This can be rather involved and problematic, especially since you have no control over when or how eBay might someday modify the formatting of the pages they send back. And almost any change can potentially affect how you are extracting the data.
      Many Web sites that primarily return database query results will eventually switch to, or also provide, information that is formatted using XML. XML is very similar to HTML, but when used to format data reports, it provides a more structured approach that is far easier to examine and interpret by client-side code. For now, you'll have to stick with writing JScript or VBScript to perform the manual parsing of the data stream to extract the information you're after.
      Before you actually try tackling this task, I would recommend that you get familiar with the DOMs of both Netscape Navigator and Microsoft Internet Explorer and learn how to walk through HTML data.

GEEK I'm trying to use favicon.ico to represent my Web site, based on the tip in your September 1999 column. I've littered the folders in my Inetpub directory with this file, putting it in wwwroot, my Web folder, and so on. Still, no luck. When I go to the site with Microsoft® Internet Explorer 5.0, I continue to get the standard icon. Am I missing something simple?
GEEK Internet Explorer 5.0 implements the favicon.ico functionality by looking for the file in the root of the domain at which your Web site is located. So for instance, if your Web site is http://www.example.com/PersonalArea/MyPage.html, then the favicon.ico file would need to be accessible at http://www.example.com/favicon.ico. You didn't indicate the actual location of the site you are working on, but when I looked in the home directory of the site off your email domain, I couldn't find favicon.ico.
      You can also indicate on individual pages that you want to load a specific icon for that page or site. The format is:


 <LINK REL="SHORTCUT ICON" href="/path/foo.ico">
      MSDN™ Online provides some additional information about favicon.ico, as well as tips about using Internet Explorer 5.0. See http://msdn.microsoft.com/workshop/essentials/versions/ICPIE5.asp.

GEEK I am trying to use a GIF file in a project that I'm working on in Visual Basic® 6.0. The bitmap doesn't animate when I place it in an image control on a Visual Basic-generated form, but it does work on an HTML document that I wrote. What am I doing wrong?
GEEK To the best of my knowledge, while the intrinsic (built-in) Image and PictureBox controls of Visual Basic are able to display GIF images, they do not support the method of animated GIFs that has become popular through Web browsers. There are several ways of producing animation using Visual Basic. One is to simply change the image source being displayed in either an Image or PictureBox control. Another is to use the Animation control and a silent AVI file, which is how Windows® itself presents the folder animation when you copy a file from one folder to another.
      Technically, there really isn't any reason why a control that supports the display of GIF images can't also be designed to support animated GIFs. However, most of these controls are designed to display graphics files of many different formats, and GIF is one of the few that directly supports multiple images in this fashion. Thus, adding support for animated GIFs to a control is primarily considered to be a programmable item. This can present some confusion to a programmer who finds various properties and methods that control animation within the control when they're only designed to work with multiple-image GIF files.
      GIF files themselves are not truly designed to support animation, but they were adapted for that role when it was noticed that they supported the storage of multiple images in a single file. Someone exploited this specification to provide a cheap way to get animated images on the Web. In the first edition of the book Encyclopedia of Graphics File Formats, by James D. Murray and William vanRyper (O'Reilly & Associates, 1994), this multi-image format is described:

[The] GIF [format] is also capable of storing multiple images per file, but this capability is rarely utilized, and the vast majority of GIF files contain only a single image. Most GIF file viewers do not, in fact, support the display of multiple image GIF files, or may display only the first image stored in the file. For these reasons, we recommend not creating applications that rely on multiple images per file, even though the specification allows this.

GEEK I want to create a Visual Basic-based component that will accept a user's login credentials, check their validity, then check whether that user is a member of a given domain group. I don't want to track user security in a database, but instead rely on the existing security model of Windows NT. All authorized users of my application will be members of a particular group in the domain. How can I do this with the Win32® API?
GEEK When you say "accept a user's login credentials," do you mean that you want your application to display a dialog box in which the user enters their user name and password, which your application in turn passes on to the system? If so, this is a dangerous thing, since you would essentially be impersonating the security of the system. This is not something that can be provided without consequences.
      The user should have already been required to authenticate themselves to the system if they're working directly from a networked workstation that is part of the specified domain. If the user is accessing your system via the Web, then again, this can be accomplished within the confines of the OS by simply assigning the appropriate privileges to the files that the user might be trying to access. The system will then issue a challenge/response, which will force a login request.
      Your application's simple attempt to open a file to which only the appropriate users would have read access would be a quick way to test for authentication.
      If you're attempting a Web-based login, essentially the same process could be used. Access privileges would be set not against a file, but against the Web pages that users are trying to access. This would tie the security directly to the Web access via the Windows NT-based user database.

From the December 1999 issue of Microsoft Internet Developer