Calvin Hsia's WebLog

thoughts from a professional developer

Collect system info for your application's runtime environment

Often your code gets run on a machine far away and it’s useful to gather some information...

Author: CalvinH Date: 10/28/2010

Out of memory? Easy ways to increase the memory available to your program

When you run your VB or C# application, you might get an OutOfMemoryException thrown, even if your...

Author: CalvinH Date: 09/27/2010

Use Perfmon to analyze your managed memory

You can learn all sorts of information about your application using Perfmon. You can also inspect...

Author: CalvinH Date: 08/27/2010

Use inline XAML with clr-namespace to create a Styled Treeview

Writing WPF code is made easier in VB because of the built in XML features (XAML is really XML)....

Author: CalvinH Date: 07/28/2010

Using multiple heaps efficiently

You can inspect the processes that run on your machine using Task Manager (Ctrl-Shift-Escape) or ,...

Author: CalvinH Date: 06/25/2010

Managed code using unmanaged memory: HeapCreate, Peek and Poke

In the old days of Basic (starting over 4 decades ago), there were functions called Peek and Poke...

Author: CalvinH Date: 05/30/2010

Sometimes you want 2 returned values: playing around with Tuples

When writing code in various languages, you’ll write functions from which you get a return value....

Author: CalvinH Date: 04/29/2010

Use Named Pipes and Shared Memory for inter process communication with a child process or two

I wanted to inject some very low impact code that would run in any “parent” process, like Notepad or...

Author: CalvinH Date: 03/30/2010

Use a Custom Allocator for your STL container

Last time in Play around with .Net Dictionaries and STL maps, we talked about various containers....

Author: CalvinH Date: 03/16/2010

Play around with .Net Dictionaries and STL maps

Last time (Adventures in interop code: explore string interop memory) we investigated sharing memory...

Author: CalvinH Date: 02/15/2010

Adventures in interop code: explore string interop memory

In Create an ActiveX control using ATL that you can use from Fox, Excel, VB6, VB.Net, I showed how...

Author: CalvinH Date: 01/29/2010

You can develop code faster

You can make your Visual Studio experience faster. Often you write some code in Visual Studio, hit...

Author: CalvinH Date: 12/16/2009

Look at some hdden code in your VB project

Some code is always added to your VB project. Try this: Start VS (2008 or 2010 beta: the numbers...

Author: CalvinH Date: 11/30/2009

What is your computer doing with all that memory? Write your own memory browser

What is your computer doing with all that memory? There are various kinds of memory allocated and...

Author: CalvinH Date: 10/19/2009

Its easy to create a graph of memory use in Excel

In this post Examine .Net Memory Leaks I showed how to find a .Net managed memory leak. Now let’s...

Author: CalvinH Date: 09/28/2009

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...

Author: CalvinH Date: 08/21/2009

Process Explorer and Process Monitor can help you understand a program

Process Explorer and Process Monitor are must-have free utilities that you can download from...

Author: CalvinH Date: 07/29/2009

You can use Visual Studio to debug itself!

How do you find out why your computer or a running program is so slow? Here’s one way. Let’s attach...

Author: CalvinH Date: 06/08/2009

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...

Author: CalvinH Date: 05/28/2009

Area fill algorithm: crayons and coloring book

Kids know how to use crayons and a coloring book. How do you write such a program? In my last post...

Author: CalvinH Date: 04/30/2009

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...

Author: CalvinH Date: 03/30/2009

Comment/Uncomment code to switch versions quickly without using macros

In a typical day, I write or debug programs in several languages: typically Foxpro, C#, VB, C++ and...

Author: CalvinH Date: 03/28/2009

Cartoon animation program

A cartoon can be thought of as a series of drawings. To simulate movement, the drawings can be...

Author: CalvinH Date: 01/29/2009

Overload Operator new to detect memory leaks

There are various leak detection methods for memory allocators. A popular one is to tag each...

Author: CalvinH Date: 01/19/2009

Write simple Debug helpers to help you debug and maintain your code

Much of my time is spent using the Visual Studio debugger examining code to figure out how it works...

Author: CalvinH Date: 12/03/2008

You can use HWndHost to host a Win32 HWnd window inside a WPF element

Suppose you have some old code lying around that creates a Win32 window with an HWnd (perhaps ATL,...

Author: CalvinH Date: 11/29/2008

Dynamically load a DLL from a runtime specified path

When running VB.Net or C# code, often it’s useful to call native code. One way is using PInvoke....

Author: CalvinH Date: 10/28/2008

Synchronize your files across machines with Mesh

I have a collection of almost 30,000 pictures and videos. When I add new pictures to the collection,...

Author: CalvinH Date: 09/23/2008

Magnify your pictures using a PictureBox so that you can zoom with the Mouse Wheel

Today’s digital cameras take pictures with much higher resolution than many computer screens. My...

Author: CalvinH Date: 08/21/2008

Make your code more maintainable: The evils of the Return statement

What does it mean to make code more maintainable? Certainly obfuscated code is hard to understand,...

Author: CalvinH Date: 07/28/2008

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...

Author: CalvinH Date: 07/14/2008

A WPF version of the Typing Tutor game

In my prior post I show a Windows Form version of the typing tutor game. Here is a WPF version....

Author: CalvinH Date: 07/02/2008

The VB WinForm version of the typing tutor game

In this post, Create your own typing tutor! is code to create a game for learning the letters of the...

Author: CalvinH Date: 06/30/2008

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...

Author: CalvinH Date: 06/06/2008

How fast is interop code?

How fast is interop code? If you’re in one kind of code and your calling another, what is the cost...

Author: CalvinH Date: 05/28/2008

How to interrupt your code

I received a question: Simply, is there a way of interrupting a vfp sql query once it has started...

Author: CalvinH Date: 05/15/2008

Examine .Net Memory Leaks

Writing programs using .Net is very productive. One reason is because much of memory management is...

Author: CalvinH Date: 04/11/2008

Persist user form size and location settings per session

My prior post (Create your own Test Host using XAML to run your unit tests) shows how to create a...

Author: CalvinH Date: 04/02/2008

Create your own Test Host using XAML to run your unit tests

A few days ago, somebody came into my office and plopped down a box. It seemed very light. He said...

Author: CalvinH Date: 03/27/2008

Compress and timestamp your pictures to gain disk space

I was running out of space again on my notebook. As years go by, digital cameras can take pictures...

Author: CalvinH Date: 03/13/2008

Find the Executing function's name

Often I want to write the SAME code that will display the name of the currently executing method or...

Author: CalvinH Date: 02/27/2008

Use Visual Studio Test framework to create tests for your code

While writing software over a period of weeks or months, various components of the software get...

Author: CalvinH Date: 02/25/2008

Use XLINQ to query the references in your project

Visual studio creates project files for you for the various languages, such as C++, C#, VB. These...

Author: CalvinH Date: 01/29/2008

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...

Author: CalvinH Date: 01/07/2008

Use WPF and inline XAML in your Fox, Excel or VB6 applications

My prior post showed how to create XAML WPF and put it on your Winform App. We can go one step...

Author: CalvinH Date: 12/12/2007

Use ElementHost to Add WPF to your Wndows Forms or put your WinForm controls in your WPF app using WindowsFormsHost

Many of you already have a Window Forms application. You can add WPF to your existing application...

Author: CalvinH Date: 12/11/2007

How to Create dynamic XAML to display arbitrary XML

Here's a sample of creating dynamic XAML to display arbitrary XML You can use the XML DataProvider...

Author: CalvinH Date: 12/06/2007

Use LINQ to Foxpro or any SQL data and display it in a WPF form using DataSetExtensions and DataRowExtensions

In the last post Create your own media browser: Display your pictures, music, movies in a XAML...

Author: CalvinH Date: 11/30/2007

Create your own media browser: Display your pictures, music, movies in a XAML tooltip

In my prior post, I showed how to use XAML and XAMLReader to create inline XAML to display the...

Author: CalvinH Date: 11/29/2007

<Previous Next>