Calvin Hsia's WebLog

thoughts from a professional developer

Browse by Tags

Tagged Content List
  • Blog Post: Fish vs Sharks: Predator Prey simulation

    Many years ago, A.K. Dewdney wrote an article in Scientific American Magazine (December 1984) about a world called Wator, which is a world of fish and sharks. The world is a cellular automaton with each cell being in one of three states: empty, a shark, or a fish. The world is calculated repeatedly,...
  • Blog Post: Logo Turtle Graphics in WPF

    Logo is a programming language that somehow involves a turtle. Imagine a turtle on a large piece of paper on the floor. The  turtle has a pen. You can command the turtle to go forward, turn right, then repeat 4 times to draw a square. The last time I wrote about Logo (in 2006) I hadn’t read the...
  • 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: 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: Compiling code at runtime and MVP program is 20

    This month marks the 20 th anniversary of the Microsoft MVP program, so MVPs were in the news. Apparently I had a lot to do with the founding of the program J Wikipedia: http://en.wikipedia.org/wiki/Microsoft_Most_Valuable_Professional Microsoft News: http://www.microsoft.com/en-us/news/features/2013...
  • Blog Post: Tetris

    A long time ago I worked in the Green Building (building 54 at MIT) .   Several NASA Apollo lunar missions (I think 11, 12, 14… I know it wasn’t 13 J ) placed seismometers on the moon, in various locations. They didn’t detect earth quakes. The Moonquakes were quite small but still measurable.  ...
  • 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: Make your Task Switcher Window bigger

    One of the best features of Windows is the ability to Cut and Paste data within an application or from one application to another. You can alt-tab or click on the task bar to switch between actively running applications, like Word and Visual Studio. When you hit Alt-Tab, a window comes up. ...
  • Blog Post: Which pixels do you turn on when you draw a line?

    When I wrote my cartoon animation program almost 30 years ago (see Cartoon animation program ) I needed to know how to draw a line. Of course, nowadays, we just call a library function that will draw a line given two points. If you think about it, the problem is quite complex. Imagine a rectangular...
  • 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: Cellular Automata: The Game of Life

    I remember my dad getting a copy of Scientific American magazine every month when I was a kid. He kept back issues on a shelf in our living room. I remember being fascinated by the issue (Oct 1970) which described John Conway’s Game of Life . A few decades later, in the mid 80’s I wrote my own...
  • Blog Post: Examine .Net Memory Leaks

    Writing programs using .Net is very productive. One reason is because much of memory management is “managed” for you. In C, C++ and other “native” languages, if you allocate memory, you’re responsible for freeing it. There were stopgap measures, like destructors, SmartPointers and reference counting...
  • Blog Post: Uninstall VB6 causes error message: You do not have a license to use this control

    I was running out of disk space on one of my machines, so I used my TreeMap program to see where I could delete files to save space. I saw that I still had VB6 on the machine, and I didn’t need it on that machine any more, so I uninstalled it. It's amazing how little disk space VB6 occupied...
  • Blog Post: Run your application forms on the web

    I received a customer question: I have looked all over the web and still searching, and found your blog. I have a very specific issue and I need to ask whether this is doable first of all and how to do it after. First of all, I need to make a foxPro app that wll also run as a web application...
  • Blog Post: The MVPs are coming!

    I was quoted in this Computerworld article about the MVP summit, which is happening this week in Seattle . The author says I compiled a “spreadsheet that ranked the most prolific posters on the FoxPro forum”. That is slightly incorrect: obvious to Fox users, I used Fox to maintain a database...
  • 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: Visual Sorting Algorithm comparison

    When I bought my first IBM PC around 1981, I wrote a program to demonstrate the speed of various sorting algorithms. It filled the screen with random characters, then the user could choose amongst a few sorting techniques and watch the sort algorithm in action as the data moved around on the screen....
  • Blog Post: Turtle Graphics Logo Program

    Warning: this simple program produces mesmerizing spirographic images that seem hallucinatory in nature! Discretion is advised! Do not drive while watching these graphics! Almost 30 years ago, I had heard about a concept developed by Professor Seymour Pappert at MIT that would make it easier...
  • Blog Post: What was that strange character? The mystery deepens

    In my last post, What's that funny character? , I asked about a particular character. In fact, another mystery character can occur. Embarassingly, SET CARRY ON was set on my machine when I ran the code, and I didn’t add it to the sample. It’s off normally (choose Tools->Options->General->Fill...
  • Blog Post: What's that funny character?

    Run this code: CREATE CURSOR foo ( line c( 100 )) LIST STRUCTURE TO t.txt APPEND FROM t.txt sdf GO RECNO ()- 1 FOR i = 1 TO LEN ( TRIM ( line )) ?i, SUBSTR ( line ,i, 1 ), ASC ( SUBSTR ( line ,i, 1 )) ENDFOR It produces t.txt which looks like this: ...
  • Blog Post: National Public Radio Car Talk

    You may have heard a radio show on National Public Radio called Car Talk hosted by Tom and Ray Magliozzi, aka Click and Clack. It’s a call in show, where audience members call in with their car problems, and Click and Clack offer advice in a humorous way. My freshman year roommate at MIT, John...
  • Blog Post: Are there any pots inside?

    I was watching my 9 year old daughter deftly manipulating the joystick on our original Sony PlayStation (predecessor of the Play Station 2) and that reminded me of a story. I lived in Boston from 1976 to 1984. I liked to hang out in a surplus electronics store called Eli Heffron’s.. There were...
  • Blog Post: Digging through old code: Chess program

    There is a lot of waiting for parents at a chess tournament (see Eliminating Fire Alarm sound at Chess Tournament Awards Ceremony ). I had my computer, and I was asked if I had a chess program on it. The answer is a little bit complicated: I wrote one over 2 decades ago that still works on Windows...
  • Blog Post: Phone number and wife haven't changed in 11 years

    There’s a sporting goods store that I’ve visited on occasion over the last 11 years. It’s a membership cooperative, which mails a percentage rebate check back to customers annually. I signed up as a member 11 years ago, which meant yet another card to keep in my wallet. For convenience, the store could...
Page 1 of 2 (43 items) 12