Code snippets that illustrate various programming techniques.

You may use or adapt code found in this section for programs for any of my classes.  You must attribute your usage.  Write either "Code used with permission from Prof. Cole's Web page," or "Code used with permission from Prof. Cole's Web page and modified."


Android Programming

Android File I/O examples
Android File I/O problem and solution
Code snippets for animation using a thread on a timer
Low-Pass Filter
Array Adapter for ListView

Database Programming

C++ Binary File I/O Sample
C++ Random-Access File I/O Sample
Java Random-Access I/O Sample
Connect to a MS SQL Server database from Java
Connect to a MySQL database from Java

C# Programming

Maximizing the screen and adjusting controls
Comparator Class for ListView
Capturing keystrokes at the Form level

C++ Programming

Example of "friend" classes

MIPS Assembly Language

Fibonacci numbers -- Good, well-written code
Fibonacci numbers -- Reasonably good, but not great
Fibonacci numbers -- Warning: May cause nausea and eyestrain
SysCalls.asm -- Symbolic definitions for system calls