Approach to studying C++
Question: My development background primarily involves COBOL and BASIC on UNIX platforms. I decided to further my language knowledge and branched out into C & C++. I’ve largely been teaching
Question: My development background primarily involves COBOL and BASIC on UNIX platforms. I decided to further my language knowledge and branched out into C & C++. I’ve largely been teaching
Question: Given an exception, how do I convert the stack trace into a string? I want to capture the entire contents, the message and the trace, to a string. Answer:
Question: Why should some of the statements that might throw an exception be in try/catch block (otherwise the compiler reports a syntax error), and some need not be, even though
Question: How do you dynamically allocate memory for a two-dimensional array? This is what I had, and my g++ compiler didn’t like it: int **m;m= new int [100][100]; Answer: Yep.
Question: How do I use one application to close another application in Windows 95? I need to overwrite a loaded DLL, so I have to close the application that loads
Question: Is it possible to make recursive subroutine calls in Java? Answer: Yes, you can make recursive method calls in Java.Just make sure you have a termination condition to avoid
Question: Does Java have a command that does what thesystem() function does in C, or a way to emulatethis action? For example, in C, system(“ls”); would call “ls” from the
Question: I have a data structure similar to this: struct SPRITE { int x, y; int jumping;}; This struct is easy to use in a game, because I can just
Question: I know how to fetch content of a URL address in Java, but what do I to write to a CGI script using the HTTP POST method? Answer: Passing
Question: I’m using Borland C++ to perform some data conversion, and I have had some difficulties. Is it possible to convert all the text (including nonreadable text) within a text
Question: I want my Web page to have three frames: one for my applet and the other two for information. How can I make it so my applet updates both
Question: I am trying to program my own custom controls in C++ in the old, traditional style (using WNDPROCS, etc.), and I don’t want to use ActiveX. I’d like to
Question: I am urgently looking for information regarding Year 2000 compliancy for Borland’s C++ compilers, esp. versions 3.1 and 4.02. Answer: I can’t imagine anything about C++ or the compiler
The java.awt.TextComponent class (from which TextArea is derived) has three methods to retrieve mouse selection information. The getSelectedText() method will return a String containing the selected text, and the getSelectionStart()
Many programmers like to use Java to automate access to network resources because it is so easy to write networking code with the Java networking classes. Accessing URLs through Java
The Java core API provides classes in the java.net package to handle basic networking functions. The URL class represents a pointer to a network resource, like the actual address. The
Everyone loves a good sound bite. You can use the PlaySound() function in the Windows Multimedia DLL (WINMM.DLL) to play a wave (WAV) file that is stored as a resource.
You can easily duplicate the tooltips that appear when you float the mouse over a button in Microsoft’s products. This code displays the tooltip in the lower right-hand corner of
This code produces a “random” sequence of integers between specified Lower and Upper values without duplication. On the first call to the Shuffle routine with new values for Upper and
When writing a game for Windows 95, set the display resolution to 640-by-480, set the color palette to True Color when it runs, and restore it to its initial mode
VB provides only single-line comment functions: “REM” and “‘”. If you’re looking for another way to comment out a block of code, use conditional compilation in VB4 instead. Define “COMMENT
When doing animation, such as scrolling a label or using picture boxes, I first used the method described by Eric Bernatchez (“Smoother Control Animation,” “101 Tech Tips for VB Developers,”
You can use subscripts and superscripts in a RichTextBox control. To prevent the control from truncating text that is raised or lowered too far, reduce the characters’ size accordingly: Private
Use this code to get data out to different formats without requiring a complete copy of the DBMS on the user machine. Create a new project with a command button,
When the focus of a graphical user interface shifts to an empty TextField, you type the desired input and step to the next one. But if the TextField is not
Numerous awt Components provide their own Scrollbars when needed. However, when you first employ one explicitly, perhaps for adjusting colors, you may encounter a frustrating problem. On some platforms the
A TextArea is ideal for presenting tabular results from an applet or application. It provides Scrollbars automatically when the text exceeds the available screen space. But despite careful use of
On some platforms, hitting the “Enter” key to terminate input to a TextField will cause the whole dialog box to disappear, as if you had clicked an “OK” button. If
It’s tempting to use an HTML file to provide help for a Java application, but how do you know which browser is installed on the run time platform and where
There are circumstances in which classes refer to one another: //file: bank.hclass Report{public:void Output(const Account& account); // compile time error; class Account is not declared yet};class Account {public:void Show() {Report::Output(*this);}};