free hit counter

Tuesday, January 31, 2006

boost::format

boost::format is pretty dang cool. But they don't do a good job in their examples illustrating the all important str() function. So here it is:

std::string portKeyString= (boost::format("Vid_%04x&Pid_%04x&Mi_00\\%s_00\\Device Parameters\\") % vid % pid % ser).str();

Software Design Questsion and answers

based on Humphrey's PSP book, chapter 10:

What is the purpose of conceptual design?
The purpose of conceptual design is to find the correct abstractions to use in solving the problem at hand, and those which will have appropriate scalability.


Given the notions from section 10.6 (Old book 10.2) on “Design Quality”, how might you use risk management to determine how much design to do?
The factors of number of users, expected number of developers, expected size of system, safety criticality, and business criticality can be used to help gauge how much design to do. The higher any of these factors the more design should be done.


According to section 10.4 (Old book 10.3), what is the key difference between a requirements definition and design specification?
requirements are a problem with no answer. Specifications assume there is an answer, and put boundry conditions and invariants on it.


What are the key decisions that are typically made during High-Level Design (HLD)?
During HLD, decisions about how much and what to reuse, what new stuff to make reusable, and broad architecture decisions are made in the context of schedule, development cost, and product content


Why are abstractions needed in software development?
Software needs abstractions becuase it has few physical laws or constraints


Why is detailed design important for large, safety-critical systems? Should you do detailed design for small, non-critical programs?
detailed design is necessary for large safety critical systems because design is the best way to make sure that these systems are safe and can be constructed on time and on budget. Design is important for small systems b/c it makes for more reliable, secure programs, and helps in estimation.


7. Question: Why are implementation-level design decisions and changes common in complex software?

What are a few potential approaches or strategies for dealing with large scale development?
I think prototyping during design is one of the most effective strategies for dealing with large scale development as it sheds light on previously unknown elemnts early. A complementry devleopment strategy is functional enhancement- where you start with something that works, and you add features one at a time, verifying each works and does not break the system.


Why should the development strategy be defined explicitly?
The development strategy should be explicitly stated to keep all stakeholders expectations in sync.

Thursday, January 19, 2006

QT Graphing packages

QWT looks quite nice, maybe not as polished as KDChart, but definitly the nicest log/log graphs I've seen.

You have to use the still beta v1.5 if you using QT 4.0.

To build with MSVC-2005 you need to change the scope variable on the LIBS. There's no such scope as win32-msvc !!



Qwt (opensource)
KDChart (not free, but quite nice IIRC)

Tuesday, January 17, 2006

longing for a win32 getopt

Why doesn't windows have a getopt / getoptlong library function? Why doesn't QT? Why doesn't boost?

I've found ports for the vanilla getopt function, but if I had my druthers I'd have a singleton class that took argc, argv as parameters, and had stl::map like key/value access

froglogic - ClassGetOpt
free getopt

my Blackberry 7290 is on crack

It drops calss frequently, often loses GPRS coverage and doesn't try and regain it, and will sometimes just turn off the radio.

The direct upgrade link for Cingular on Blackberry's site:
https://www.blackberry.com/SoftwareDownload/index.jsp?client=Rc4cZBaBN

Cingular Support Linkage

Monday, January 16, 2006

Everything you need to know about floating point under Windows

Visual C++ 8.0 (aka VC-2005) has pragmas for controling the floating point environment on a function by function basis.

Aparantly you can't just use the float.h and fpieee.h functions like _controlfp, you need to set the pragmas (or command equivilent line switches) properly as well.

MSVC++ Floating Point Optimization
_controlfp
float_control
/fp command line option

What Every Computer Scientist Should Know About Floating-Point Arithmetic

This is the definitive document if you're working with numbers where you must be precise.

What Every Computer Scientist Should Know About Floating-Point Arithmetic

priority calculation for bugs

This was the method I used in a past life, and found it very helpful for prioritizing bugs:

Priority = 6 - Severity + Frequency + Workaround + Customer Request

Severity = 2 High
1 Low (Enhancements and low severity issues)

Frequency = 2 High (happens all the time)
1 Low

Workaround = 0 None
-2 There is an easy workaround
-1 There is a hard workaround

Customer Request = 1 Customer found the problem
0 SQA (internal) found the issue

So know, Priority 1 = Critical
Priority 2 = High
Priority 3 = Normal
Priority 4 = Low
Priority 5 = Very low
Priority 6 = Detail

Tools for Debugging Stack Corruption?

Good range of suggestions for memory corrpution checking.

Slashdot | Tools for Debugging Stack Corruption?

Thursday, January 12, 2006

awk: yet another reason to love UNIX

So in past lives I have often used perl -ne to take care of super simple text processing, but for some reason I haven't gotten around to installing it in on my new machine yet.

I figured it might be faster to look at awk before installing perl, as it's already on my system. Even thought I've never used it before it took less than 15 minutes to get my text processing needs done.


#get the current revision number of the subversion repository
RepositoryRev=`svn info . | awk '/Revision:/ {print $2}'`


# count the number of modified files from the subversion repository
modifiedFileCount=`svn status .. | awk '/^M/ {numModified++} END {print numModified}'`


Linkage

Labels:

install applications

Innosetup is just so dang straight forward and feature complete.

I can't find a compelling reason to try and futz with windows standard MSI installs.

linkage

IT guy kills Subversion server, mild mannered SW Eng. recovers to new machine within the hour

Subversion works way better than I had imagined.

Since I was using the straight filesystem storage method, I just pulled my backups out of the freezer and onto the new server, reinstalled SVN and Apache 2 there, and copied in the old config files.

The most delicate part was making sure I moved all my orphaned local machine checkouts over to the new checkout dir.

Labels:

Monday, January 09, 2006

Top 10 Windows 2000 Command-Line Utilities

Good command line gems I found while looking for something totally different.

irFtp.exe

Top 10 Windows 2000 Command-Line Utilities

VS_VERSION_INFO

This is still a little raw, but here are the key elements. It would be best to put some #defines in a projectVer.h file that you regenerate with each build depending on the machine and release/debug config.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tools/tools/versioninfo_resource.asp
http://support.microsoft.com/kb/q237870

Include in the qmake file:


win32:RC_FILE = yourApp.rc

Resource file:



IDI_ICON1 ICON DISCARDABLE "yourApp.ico"

/////////////////////////////////////////////////////////////////////////////
//
// Version
//
#include "winver.h"
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "Sample Application\0"
VALUE "CompanyName", "Microsoft Corp.\0"
VALUE "FileDescription", "MyProject MFC Application\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "MyProject\0"
VALUE "LegalCopyright", "Copyright (C) 1999\0"
VALUE "OriginalFilename", "MyProject.EXE\0"
VALUE "ProductName", "MyProject Application\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

delayed initialization of std::auto_ptr<>


std::auto_ptr p(new int(42)) //ok
std::auto_ptr q;
std::auto_ptr r;

q = std::auto_ptr(new int(23)); //ok
r = new int(23); //BAD BAD

Because the constructor for auto_prt is explicit the inititialization of r will not do what you expect and should never be used. Unfortunatly, it does compile though...

Friday, January 06, 2006

Correctness by Construction: A Manifesto for High-Integrity Software - Dec�2005

I can't get enough of these kinds of articals where people have sofware defect rates as low as one or two bugs/month.

Goes to show that it is possible...

STSC CrossTalk - Correctness by Construction: A Manifesto for High-Integrity Software - Dec�2005

DEP - Data Execution Prevention

DEP is an important security feature, I wish I had more time to look into it and test my apps for compatability.

Changes to Functionality in Microsoft Windows XP Service Pack 2: Part 3: Memory Protection Technologies

Tuesday, January 03, 2006

The lead rack outer dimension of RG cables

I'm trying to buy a lead rack (referred to by Digikey as a HOLDER TEST LEAD), but the rack spaces are only specified in the RG cable size.

So I found this in a handy engineering reference book:
CABLE OD (inches)
RG58 .19
RG59 .24
RG213 .41
RG214 .43

Conclusion:


The Pomona 1508 lead holder (Digikey 501-1053-ND) accepts RG58 cables, so by my calculations has slots about 3/16 of an inch wide.

I'm still looking for something smaller