Sign In
Calvin Hsia's WebLog
thoughts from a professional developer
Translate This Page
Translate this page
Powered by
Microsoft® Translator
Options
Email Blog Author
RSS for posts
Atom
RSS for comments
OK
Search
Advanced search options...
Search In:
Everything
Blogs
Forums
People
Groups
Places
Pages
Date range:
All Time
Last Year
Last 6 Months
Last 3 Months
Last Month
Last Week
Last Two Days
Tags
64bit
C++
CSharp
Debugging
FunGames
History
LINQ
Memory
Mesh
Miscellaneous
Pictures
Programming
SmartPhone
Testing
VB
Vista
Visual FoxPro
Visual Studio
Web
Windows API
WPF
Archive
Archives
January 2012
(1)
December 2011
(1)
November 2011
(1)
October 2011
(1)
September 2011
(1)
August 2011
(1)
July 2011
(1)
June 2011
(1)
May 2011
(1)
April 2011
(1)
March 2011
(1)
February 2011
(1)
January 2011
(1)
December 2010
(2)
November 2010
(1)
October 2010
(1)
September 2010
(1)
August 2010
(1)
July 2010
(1)
June 2010
(1)
May 2010
(1)
April 2010
(1)
March 2010
(2)
February 2010
(1)
January 2010
(1)
December 2009
(1)
November 2009
(1)
October 2009
(1)
September 2009
(1)
August 2009
(1)
July 2009
(1)
June 2009
(1)
May 2009
(1)
April 2009
(1)
March 2009
(2)
February 2009
(1)
January 2009
(2)
December 2008
(1)
November 2008
(1)
October 2008
(1)
September 2008
(1)
August 2008
(1)
July 2008
(3)
June 2008
(2)
May 2008
(2)
April 2008
(2)
March 2008
(2)
February 2008
(2)
January 2008
(2)
December 2007
(3)
November 2007
(8)
October 2007
(6)
September 2007
(4)
August 2007
(9)
July 2007
(2)
June 2007
(2)
May 2007
(11)
April 2007
(5)
March 2007
(2)
February 2007
(2)
January 2007
(1)
December 2006
(2)
November 2006
(1)
October 2006
(4)
September 2006
(6)
August 2006
(10)
July 2006
(13)
June 2006
(11)
May 2006
(7)
April 2006
(8)
March 2006
(14)
February 2006
(5)
January 2006
(21)
December 2005
(9)
November 2005
(19)
October 2005
(20)
September 2005
(12)
August 2005
(23)
July 2005
(12)
June 2005
(8)
May 2005
(7)
April 2005
(4)
March 2005
(1)
February 2005
(2)
January 2005
(13)
December 2004
(9)
November 2004
(4)
October 2004
(10)
September 2004
(4)
August 2004
(8)
July 2004
(1)
June 2004
(10)
MSDN Blogs
>
Calvin Hsia's WebLog
Posts
Subscribe via RSS
Sort by:
Most Recent
|
Most Views
|
Most Comments
Excerpt View
|
Full Post View
Calvin Hsia's WebLog
Be careful about nothing in managed code
Posted
9 days ago
by
CalvinH
0
Comments
Here’s a pattern of code use I’ve seen in a few places. There’s a function DeserializeList that returns an array of various sizes, depending on the input. This code can be called to deserialize (rehydrate) an object from a stream. For example,...
Calvin Hsia's WebLog
Advanced debugging: change your program execution without Edit and Continue
Posted
1 month ago
by
CalvinH
1
Comments
Last time ( Improve your managed debugging skills: examining registers and memory ) we examined some debugging techniques to understand the behavior of managed code. It might take a long time or many manual steps to reproduce a particular software...
Calvin Hsia's WebLog
Improve your managed debugging skills: examining registers and memory
Posted
2 months ago
by
CalvinH
1
Comments
I was helping a colleague and we were deep in the middle of a debug session, single stepping some code and we wanted to see a value in the debugger. The debugger showed either nothing, because the intermediate value has been optimized out, or a...
Calvin Hsia's WebLog
More fun with the Fast Fourier Transform
Posted
3 months ago
by
CalvinH
2
Comments
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...
Calvin Hsia's WebLog
Using and styling a treeview in WPF
Posted
4 months ago
by
CalvinH
0
Comments
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...
Calvin Hsia's WebLog
Automatic tests protect your code
Posted
5 months ago
by
CalvinH
0
Comments
Last month in Dynamically create huge tooltips in WPF TreeView and ListView I showed some code that creates large tooltips to present lots of data. Today, we’ll talk about creating automatic tests for this feature. Testing...
Calvin Hsia's WebLog
Dynamically create huge tooltips in WPF TreeView and ListView
Posted
6 months ago
by
CalvinH
0
Comments
Tooltips are useful. When the mouse hovers over a button a tip can indicate what happens when it’s clicked. The mouse move does not actually invoke the button, but can give information in a passive way. Sometimes I want to make huge tooltips...
Calvin Hsia's WebLog
Returning data from a recursive method
Posted
7 months ago
by
CalvinH
1
Comments
Sometimes you need to write a method that requires recursion to be elegant. Often that method needs to accumulate data between recursion levels There are many ways to do so, and some are more elegant than others. I like the Optional Parameter method...
Calvin Hsia's WebLog
Embed a ListView inside another ListView for one to many relationships
Posted
8 months ago
by
CalvinH
0
Comments
In the old days (about 16 years ago), FoxPro’s object, containership and inheritance models made it easy to put objects inside other objects. So, for example, a FoxPro grid of Customers could have a column containing a grid of each customer’s orders,...
Calvin Hsia's WebLog
Use colors in WPF to show virtual memory fragmentation
Posted
9 months ago
by
CalvinH
0
Comments
In this post What is your computer doing with all that memory? Write your own memory browser is sample code that shows how to create a WPF grid view of a memory map of a process. You can click on a column header to sort, and you can see the various loaded...
Calvin Hsia's WebLog
The cost of using nothing
Posted
10 months ago
by
CalvinH
0
Comments
What is the cost of using nothing? Seems like a silly question. Suppose you see code like this: void * MyClass::DoSomething() { int size = sizeof(MyThing) * m_NumItems; var ptr = malloc(size); return ptr; } It’s a method...
Calvin Hsia's WebLog
See and hear the effects of Garbage Collection
Posted
11 months ago
by
CalvinH
2
Comments
Sometimes you forget that GC’s occur: it’s hard to see it’s effect, but what does Garbage Collection do to your code? A long time ago (3 decades!) I used Fortran and Assembly code for a PDP-11 16 bit computer to design real time...
Calvin Hsia's WebLog
Are you running out of disk space? Treemap your files to see what's eating the most
Posted
over 1 year ago
by
CalvinH
1
Comments
I was running out of disk space and wanted to see what was eating the most. About 6 years ago I wrote a FoxPro version of a TreeMap program that shows a rectangle subdivided into various subrectangles, each proportional to the amount of space...
Calvin Hsia's WebLog
Write your own Linq query viewer
Posted
over 2 years ago
by
CalvinH
0
Comments
Sometimes you just want to see data in a tabular format. It could be stored in a server somewhere in the cloud, in a SQL server, a FoxPro database, an EntityFramework object, or just a local object. You’d like to see all columns, without having...
Calvin Hsia's WebLog
Adding a new ADO.NET Entity Data Model "Error HRESULT E_FAIL has been returned from a call to a COM component"
Posted
over 2 years ago
by
CalvinH
5
Comments
I tried adding a new ADO.NET Entity Data Model item to a VS 2010 solution, but I got this error message: Error HRESULT E_FAIL has been returned from a call to a COM component. It worked just a few days ago…hmmm…. I had another...
Calvin Hsia's WebLog
Why does your code take so long? Profile it!
Posted
over 2 years ago
by
CalvinH
0
Comments
Why does your code take so long to run? How do you improve its performance? When examining code, it’s very difficult to know which piece takes the longest, and thus should be the target of you optimization efforts. For example, you won’t...
Calvin Hsia's WebLog
Collect system info for your application's runtime environment
Posted
over 2 years ago
by
CalvinH
1
Comments
Often your code gets run on a machine far away and it’s useful to gather some information about that machine automatically, perhaps for error reporting or statistics gathering. This information could include the Operating System version, how...
Calvin Hsia's WebLog
Out of memory? Easy ways to increase the memory available to your program
Posted
over 2 years ago
by
CalvinH
7
Comments
When you run your VB or C# application, you might get an OutOfMemoryException thrown, even if your machine has lots of memory. Every 32 bit process has a 2^32 bit (4 Gig) address space. That means every pointer has a size of 32 bits (4 bytes) and...
Calvin Hsia's WebLog
Use Perfmon to analyze your managed memory
Posted
over 2 years ago
by
CalvinH
0
Comments
You can learn all sorts of information about your application using Perfmon. You can also inspect various aspects of managed memory. How much time is spent in garbage collection? When managed code runs, memory management is done for you, but at...
Calvin Hsia's WebLog
Use inline XAML with clr-namespace to create a Styled Treeview
Posted
over 2 years ago
by
CalvinH
0
Comments
Writing WPF code is made easier in VB because of the built in XML features (XAML is really XML). Here is a sample that creates a TreeView of some folders on disk. Suppose we want to add a Trigger style that will fire when the mouse is over an item...
Calvin Hsia's WebLog
Using multiple heaps efficiently
Posted
over 2 years ago
by
CalvinH
1
Comments
You can inspect the processes that run on your machine using Task Manager (Ctrl-Shift-Escape) or , Process Explorer from Sysinternals Or you can write your own: here’s source code: What is your computer doing with all that memory? Write your...
Calvin Hsia's WebLog
Managed code using unmanaged memory: HeapCreate, Peek and Poke
Posted
over 2 years ago
by
CalvinH
0
Comments
In the old days of Basic (starting over 4 decades ago), there were functions called Peek and Poke that would allow you to read and write memory directly. These were incredibly powerful commands: you could, for example, read and write directly to the hardware...
Calvin Hsia's WebLog
Sometimes you want 2 returned values: playing around with Tuples
Posted
over 2 years ago
by
CalvinH
2
Comments
When writing code in various languages, you’ll write functions from which you get a return value. Sometimes you’ll want to get 2 return values. A common way to handle this is to use parameters to pass a variable by reference that will get one of...
Calvin Hsia's WebLog
Use Named Pipes and Shared Memory for inter process communication with a child process or two
Posted
over 2 years ago
by
CalvinH
0
Comments
I wanted to inject some very low impact code that would run in any “parent” process, like Notepad or Excel or Visual Studio. I wanted to have some User Interface for the data that my injected code gathered about the parent process, and that would work...
Calvin Hsia's WebLog
Use a Custom Allocator for your STL container
Posted
over 2 years ago
by
CalvinH
0
Comments
Last time in Play around with .Net Dictionaries and STL maps , we talked about various containers. Today we’ll write our own allocator for a particular STL container. A general purpose allocator, like malloc in the C Runtime library or HeapAlloc...
Page 1 of 16 (394 items)
1
2
3
4
5
»