Monday, August 22, 2011

Visual Studio watch window

The watch window can do a lot more than simply displaying variables. The official documentation: "Variable Windows" in the MSDN. The article X64 Debugging With Pseudo Variables And Format Specifiers gives a few examples.

The watch window can also call functions. My favorites to display byte buffers in the watch window are: BitConverter.ToString(buffer) Encoding.ASCII.GetString(buffer, 0, buffer.Length)

And here are some tips mostly regarding the watch window GUI, but including also some other features: 10 Tips you should know about “Watch Window” While debugging in Visual Studio

If the format specifiers aren't sufficient, here are two articles that explain how to program Visual Studio to display your data structures the way you want using autoexp.dat:

See also Sara Ford's blog for more Visual Studio tips. Unfortunately she has left Microsoft.

Friday, August 19, 2011

Buchempfehlung: Baby-led weaning (BLW, Baby-geleitetes Abstillen)

Wenn das Baby mit aller Körperkraft und Geschicklichkeit versucht, am Tisch an unser Essen ranzukommen, dann will es was? Nein, keinen Brei in den Mund gesteckt bekommen: mitessen!

Bei BLW geht es nicht nur um's Abstillen - sprich wie schnell Muttermilch durch andere Nahrung ersetzt wird. Viel wichtiger ist die Entwicklung des Geschmacks an anderer Nahrung, der Fähigkeit selbstständig zu essen, dem Spaß dabei und das eigene Hungergefühl wahrzunehmen.

Es ist eine wahre Wonne, zu sehen, mit wieviel Freude und Geschicklichkeit unser 8 Monate alter Sohn, aussucht, was und wieviel er essen möchte. Und sich beschwert, wenn das, worauf er gerade Appetit hat, ihm ausgeht.

Die ausführliche Erklärung von BLW findet man hier: Baby-Led Weaning: The Essential Guide to Introducing Solid Foods and Helping Your Baby to Grow Up a Happy and Confident Eater

Das Kochbuch enthält nochmal eine kürzere Erklärung von BLW und dazu noch eine Menge Rezepte: The Baby-led Weaning Cookbook: Over 130 delicious recipes for the whole family to enjoy

Meine Empfehlung (auch wenn wir es andersherum gemacht haben): zuerst das Kochbuch anschaffen und wenn die Erklärungen dort nicht reichen, das dicke Buch nachkaufen.

Dazu empfehlen sich zum Beispiel diese Lätzchen.

Update 8.10.2011: Allerdings muss man sie einmal heiss waschen, damit sich die Schichten voneinander lösen; sonst sind sie zu steif.

Update 2.12.2011: Das heiße Waschen funktioniert nicht immer. Sowieso sind diese Lätzchen von Playshoes aber viel besser und auch wesentlich hübscher, auch wenn sie keinen Auffangbehälter habe wie die von J. J. Cole.

Top Agile Books 2011

If you don't know what to read: http://www.infoq.com/news/2011/08/top-agile-books

Blogger: CSS for markup of blockquote and code

I recently decided to switch to a more semantic markup for my posts. For example, I wanted to use the code element for pre-formatted multi-line code. This is what I came up with.

Set in Settings|Formatting the option Convert line breaks to No. Otherwise blogger will insert br elements for every line break in your post, which makes proper styling impossible. OTOH, formatting your posts with line breaks instead of HTML markup will of course not work any more.

Open the template (Design|Edit HTML) and add the following to the CSS within the b:skin tags: blockquote { font-style: italic; margin-top: 1em; margin-bottom: 1em; margin-left: 10px; } code { white-space: pre; font-size: 80%; display: block; margin-left: 10px; margin-top: 0em; margin-bottom: 1em; }

Thursday, August 18, 2011

Visual Studio: Setting multiple startup projects via macro

UPDATE: For Visual Studio 2010 (and later?) see http://tom.paschenda.org/blog/?p=44.

According to the documentation, this should work: Sub StartUpProj() Dim sb As SolutionBuild = DTE.Solution.SolutionBuild Dim startupProjects() As String = { "Project1.vcproj", "Project2.vcproj" } sb.StartupProjects = startupProjects End Sub Unfortunately, it also says in the MSDN here:

The StartupProjects collection in the current version of Visual Studio .NET allows you to set only a single startup project, but future versions will allow multiple startup projects.
This was written for Visual Studio .NET 2003 and still holds true for Visual Studio 2008. At least this works for setting a single startup project: Sub StartUpProj() Dim sb As SolutionBuild = DTE.Solution.SolutionBuild sb.StartupProjects = "Project1.vcproj" End Sub BTW: Above examples are for C/C++ projects. For other types of projects the extensions vary.

Monday, August 15, 2011

ZY1000

The ZY1000 is a JTAG adapter accessible over Ethernet instead of USB or similiar. It works driverless and also comes with a web interface. Supports RTCK/RCLK or adaptive clocking and has a built-in relay to power cycle targets remotely. Nice alternative to the standard JTAG dongles.

Sunday, August 14, 2011

PC-Lint: Interrupt Service Routines

PC-Lint regularly warns about Interrupt Service Routines (ISR) not being used. The simplest remedy is just an esym for every ISR: /*lint -esym(528,Interrupt_SCI0_ERI0) */ #pragma interrupt Interrupt_SCI0_ERI0(vect=VECT_SCI0_ERI0) static void Interrupt_SCI0_ERI0(void) { ... } But see how WET this code is? First you tell PC-Lint it's an ISR. Then you tell the toolchain it's an ISR. Then you write the function head, which - surprise! - has the signature of an ISR. We can do better than that: /* Define this once */ #ifdef _lint /*lint -e(961) Suppress MISRA warning for function-like macro */ #define INTERRUPT(VECT,HANDLER) \ /*lint -esym(528,HANDLER) Suppress warning for unused function */ \ static void HANDLER(void) #else #define DO_PRAGMA(X) _Pragma(#X) #define INTERRUPT(VECT,HANDLER) \ DO_PRAGMA(interrupt HANDLER(vect=VECT)) \ static void HANDLER(void) #endif /* And define all your ISR like this: */ INTERRUPT(VECT_SCI0_ERI0,Interrupt_SCI0_ERI0) { ... } More examples for different pragmas expected by other toolchains to follow.

Saturday, August 13, 2011

Language requirements for medical devices

The MDD leaves it to national law to decide about the language requirements for medical devices. The Europen Association of Notified Bodies for Medical Device has a nice overview of the resulting requirements on their website: Mandatory Languages Requirements for Medical Devices

Friday, August 5, 2011

PC-Lint: enum for constants

When using enum for constants, you should leave the enum anonymous like this:
enum { C = 123 };
Otherwise you'll get warnings like 641 when assigning from enum to integer or comparing enum and integer. This would trigger the warnings:
enum Tag { C = 123 };
You still might experience warnings because Lint assumes enums to be signed, so assigment to an unsigned integer raises a Lint warning. Consider to use #define or const for defining constants instead. Then you can clearly indicate the type of the constant.