Udostępnij za pośrednictwem


Calvin Hsia's WebLog

thoughts from a professional developer

Fish vs Sharks: Predator Prey simulation

Many years ago, A.K. Dewdney wrote an article in Scientific American Magazine (December 1984) about...

Author: CalvinH Date: 09/30/2014

Logo Turtle Graphics in WPF

Logo is a programming language that somehow involves a turtle. Imagine a turtle on a large piece of...

Author: CalvinH Date: 08/29/2014

How to monitor and respond to memory use

A colleague asked me how to run code in response to low memory condition. Apparently, data is...

Author: CalvinH Date: 05/29/2014

Async methods failures can be hard to diagnose

Using asynchronous programming can make your application be more responsive and seem faster....

Author: CalvinH Date: 04/25/2014

The Enum changed to int: How do you convert the int back to a name?

I wrote a tool that loaded some binary data and displayed it in a nice form, where the user could...

Author: CalvinH Date: 03/26/2014

See how often your code runs and how much time it takes

Last post I showed how to create your own CLR profiler. This time, we’ll add a little code to run...

Author: CalvinH Date: 02/26/2014

Create your own CLR Profiler

A CLR profiler is a very powerful way to examine your managed code. Let’s create your own CLR...

Author: CalvinH Date: 01/30/2014

Use reflection from native C++ code to run managed code

In the prior post (Use Reflection to create instances of objects) I showed how to create a plain C#...

Author: CalvinH Date: 12/05/2013

Manipulate managed and native objects in C++ to show the registry in a WPF TreeView

Last time, we looked at how easy it is to add managed code to your existing C++ application. (Call...

Author: CalvinH Date: 09/27/2013

Call managed code from your C++ code

Over the decades of writing code, I’ve found that writing managed code (C#, VB) is much more...

Author: CalvinH Date: 08/30/2013

Use Custom Attributes to initialize test environments

Some tests can be quite complex, perhaps having prerequisites that consist of various steps,...

Author: CalvinH Date: 06/28/2013

Use status events to log and analyze an application

Applications can get quite complex, with multiple components, assemblies, subsystems, etc....

Author: CalvinH Date: 05/29/2013

Does the CLR release memory when no longer needed?

A colleague asked the other day if the CLR releases memory when it’s no longer needed. Suppose you...

Author: CalvinH Date: 04/30/2013

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

Author: CalvinH Date: 04/01/2013

The Visual Studio Feedback tool

  Sometimes when you use Visual Studio, or any application on a computer, there’s a notable...

Author: CalvinH Date: 03/28/2013

Compiling code at runtime and MVP program is 20

This month marks the 20th anniversary of the Microsoft MVP program, so MVPs were in the news....

Author: CalvinH Date: 02/27/2013

Windows Error Reporting and the Appdomain.UnhandledException Event

Sometimes applications fail. If you are the author and it fails on your machine, typically you fire...

Author: CalvinH Date: 01/31/2013

Create a logger for watching your test progress as it runs.

  I was creating a project that’s a Windows Service, which has components running in multiple...

Author: CalvinH Date: 12/29/2012

Turn your tests into stress tests easily

It’s great to be able to write tests and execute them while developing a project. While I’m...

Author: CalvinH Date: 11/30/2012

Its easy to Create your own FrameWorkElement in WPF

Sometimes you want to have very fine control of how your application looks and behaves. Other times,...

Author: CalvinH Date: 10/30/2012

The number of Garbage Collections indicate how much memory is used

One of the performance improvements we made in .Net was with System.Text.StringBuilder....

Author: CalvinH Date: 09/28/2012

Performance of Memory vs Disk

There is a comment on this Visual Studio Blog post (about how we made Visual Studio faster): “Focus...

Author: CalvinH Date: 08/10/2012

Examine the layout of managed strings in memory

Suppose you wrote some C# code like this: var str1 = "ThisIsAString"; var str2 =...

Author: CalvinH Date: 07/19/2012

Increase the memory available to your tests

    I love having test projects included in my solutions. Software is alive. I’m...

Author: CalvinH Date: 06/27/2012

Create multiple threads to see if work is done simultaneously

When you hear about threads and threading, you hear that they allow concurrent execution of code,...

Author: CalvinH Date: 05/25/2012

Tetris

A long time ago I worked in the Green Building (building 54 at MIT).   Several NASA Apollo...

Author: CalvinH Date: 05/08/2012

Examine your program's available memory: is it leaking?

  Sometimes your program wakes up and finds itself running in an environment that might not be...

Author: CalvinH Date: 03/31/2012

Process Windows Messages in your WPF application

  I have some code that attaches and injects code into a target application (like Visual Studio...

Author: CalvinH Date: 02/27/2012

Be careful about nothing in managed code

  Here’s a pattern of code use I’ve seen in a few places. There’s a function DeserializeList...

Author: CalvinH Date: 01/30/2012

Advanced debugging: change your program execution without Edit and Continue

Last time (Improve your managed debugging skills: examining registers and memory) we examined some...

Author: CalvinH Date: 12/20/2011

Improve your managed debugging skills: examining registers and memory

  I was helping a colleague and we were deep in the middle of a debug session, single stepping...

Author: CalvinH Date: 11/29/2011

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

Author: CalvinH Date: 10/31/2011

Using and styling a treeview in WPF

  As you know, a treeview control is very useful for viewing hierarchical information. Each...

Author: CalvinH Date: 09/27/2011

Automatic tests protect your code

  Last month  in  Dynamically create huge tooltips in WPF TreeView and ListView I...

Author: CalvinH Date: 08/31/2011

Dynamically create huge tooltips in WPF TreeView and ListView

  Tooltips are useful. When the mouse hovers over a button a tip can indicate what happens when...

Author: CalvinH Date: 07/29/2011

Returning data from a recursive method

Sometimes you need to write a method that requires recursion to be elegant. Often that method needs...

Author: CalvinH Date: 06/30/2011

Embed a ListView inside another ListView for one to many relationships

In the old days (about 16 years ago), FoxPro’s object, containership and inheritance models made it...

Author: CalvinH Date: 05/31/2011

Use colors in WPF to show virtual memory fragmentation

In this post What is your computer doing with all that memory? Write your own memory browser is...

Author: CalvinH Date: 04/29/2011

The cost of using nothing

What is the cost of using nothing? Seems like a silly question. Suppose you see code like this: void...

Author: CalvinH Date: 03/28/2011

See and hear the effects of Garbage Collection

Sometimes you forget that GC’s occur: it’s hard to see it’s effect, but what does...

Author: CalvinH Date: 02/26/2011

Are you running out of disk space? Treemap your files to see what's eating the most

I was running out of disk space and wanted to see what was eating the most. About 6 years ago I...

Author: CalvinH Date: 01/26/2011

Write your own Linq query viewer

Sometimes you just want to see data in a tabular format. It could be stored in a server somewhere in...

Author: CalvinH Date: 12/30/2010

Adding a new ADO.NET Entity Data Model "Error HRESULT E_FAIL has been returned from a call to a COM component"

I tried adding a new ADO.NET Entity Data Model item to a VS 2010 solution, but I got this error...

Author: CalvinH Date: 12/27/2010

Why does your code take so long? Profile it!

Why does your code take so long to run? How do you improve its performance? When examining code,...

Author: CalvinH Date: 11/30/2010

<Previous Next>