Calvin Hsia's WebLog

thoughts from a professional developer

Browse by Tags

Tagged Content List
  • Blog Post: WPF immediate mode graphics

    Windows Presentation Foundation (WPF) is a retained mode graphics system (see Retained Mode Versus Immediate Mode ). That means when you write code to draw something, you’re actually declaring a set of graphics objects (like lines or shapes) to use. The graphics library then creates a model in memory...
  • Blog Post: Use Reflection to create instances of objects

    You can use reflection (specifically classes in the System.Reflection namespace) to create instances of objects. Last time ( Create and play your own Breakout game ) , I showed a Windows Form application that is a Breakout game. This time, let’s see if we can create and run that WinForm game (Paddle...
  • Blog Post: Create and play your own Breakout game

    I remember pouring quarters into a video game called Breakout a few decades ago. The summer of 1975, I spent at Rensselaer PolyTechnic Institute (RPI) in Troy, NY. I was taking a structured programming course using Fortran on an IBM 360, using punched cards. The student union building had an arcade in...
  • Blog Post: Cartoon animation works great on Surface Pro

    I showed my 9 year old son a cool drawing program called Physamajig , in which users can draw objects, which behave like real physical objects, including reacting to gravity, friction, and bounce. He was having fun with it on my Surface RT and it reminded me of another program. Years ago (around 1981...
  • Blog Post: More fun with the Fast Fourier Transform

    The sounds that we hear can be recorded via a microphone and can be graphed as a signal of amplitude versus time. Low notes show as a lower frequency wave, and high notes show as higher frequency waves. Over the past few decades, some music players, like a car radio or stereo amplifier, have an “equalizer...
  • Blog Post: Using and styling a treeview in WPF

      As you know, a treeview control is very useful for viewing hierarchical information. Each node in a tree can have its own parent/child relationships.   Some of these trees can be extremely large, and can thus be prohibitively expensive to calculate completely. Windows Explorer comes to mind...
  • Blog Post: Stack overflow, expand your stack? Change your algorithm!

    In the last post, Area fill algorithm: crayons and coloring book , I showed a program that emulates a kid drawing in a coloring book. However, the algorithm wasn’t very efficient, and would explode even if you had a simple drawing: it was using the stack to store where to go. The heart of...
  • Blog Post: Unorthodox chopsticks

    Several years ago, my wife and I were walking through a local shopping mall. At the time, there was some sort of Asian festival. At a display booth there was a table upon which were two trays, side by side. One was empty, and the other had many beans. The sign challenged visitors to see how many beans...
  • Blog Post: Cartoon animation program

    A cartoon can be thought of as a series of drawings. To simulate movement, the drawings can be slightly different from each other. Remember drawing simple cartoons using a pad of paper? Simply flipping through the pages made the drawings come to life. This was tedious work: a computer can...
  • Blog Post: Use a dictionary to help create a mnemonic

    I was using a program that was yet another TLA and I wanted to create a mnemonic to help me remember what it was. One of the letters was “k”, so I wanted to find a word that starts with “k” Simple: load a dictionary, search for words starting with “k” and browse through them: “Killer” sounded fine...
  • Blog Post: Write your own hangman game

    Many years ago (1985) I wrote a C program to play Hangman. I had decoded a word processor spelling dictionary for my word source. More recently, I have encoded 2 spelling dictionaries for general purpose use: 1 with 171201 words, the other with 53869. There’s some pretty serious compression to...
  • Blog Post: The Nametag Game

    When I took my 3 year old son for the first day of preschool, there was a table with several nametags for the students. I asked him if he knew which one was his, and he correctly pointed out the right one. Below is sample code in Fox and VB.net that is a game that I wrote for him. It shows ...
  • Blog Post: Create your own typing tutor!

    Here’s an idea to teach somebody the positions of the letters on the keyboard: letters fly in randomly from the right for 30 seconds. Hit the letter on the keyboard for points. Miss and lose points. As time goes on, the letters move faster and there are more of them. More points are earned for faster...
  • Blog Post: Carburetor is a car part, but prosecutable is not

    My wife and I like to listen to PuzzleMaster Will Shortz.on NPR. This week’s challenge is from one of my favorite puzzle makers Merl Reagle : Take the word carburetor, add two letters and rearrange the result to name another car part. And the answer is one word. What car part is it? ...
  • Blog Post: A Discounter Introduces Reductions: Multiple Anagrams

    Many moons ago, I was playing with spelling dictionaries (see What is an index anyway? ) and anagrams. After decoding a spelling dictionary for a word data base in the early 1980s, I wrote some word games, like scrabble and anagrams. APT, PAT, and TAP are 3 words that are anagrams of each other...
  • Blog Post: Create your own Word Search puzzles

    I wrote a Word Search generating program in C++ (308 lines) years ago: my brother used it to generate a puzzle including all the girls in his 8 th grade class, which was 22 years ago: about 1984 (sounds Orwellian<g>). I wrote one in C# (456 lines) about 3 years ago. I wrote a VFP version (180 lines...
  • Blog Post: The mechanics of Sudoku

    The rules of Sudoku are so simple (see Sudoku puzzles screen capture ) that it seems easy to write the mechanics of the puzzle in Fox. It took 20 minutes to write this. Move the mouse over a desired square and type a digit key. ‘0’ means erase what’s there. It doesn’t know any of the rules, but is a...
  • Blog Post: Sudoku puzzles screen capture

    I love doing crossword puzzles: I’m a huge fan of Merle Reagle (I have all his books www.sundaycrosswords.com ) and I love the NY Times Sunday puzzles, both of which come in the Seattle Times. We also love listening to the NPR Sunday Puzzle by Puzzlemaster Will Shortz, from whom we first heard about...
Page 1 of 1 (18 items)