Archive for the ‘Programming’ Category

Debuggine Embedded C

http://www.embedded.com/design/205205942

Almighty vim

http://cscope.sourceforge.net/cscope_vim_tutorial.html
http://likunarmstrong.bokee.com/viewdiary.13313563.html
http://andrewtw.wordpress.com/2006/12/25/gvim-%E5%A5%BD%E7%8E%A9%E8%80%B6%EF%BD%9E/
http://www.vim.org/scripts/index.php

Code Complete

“Willingness to perform this kind of check is a key difference between efficient and inefficient programmers. Efficient programmers do the work of mental simulations and hand calculations because they know that such measures help them find errors. Inefficient programmers tend to experiment randomly until they find a combination that seems to work.”

Exact Science

For accounting is also not an exact science, how can we do better in programming?

“In our opinion, the financial statements … present fairly, in all material respects … in conformity with generally accepted accounting principles …

This wording emphasizes that accounting and auditing are not exact sciences. Because the framework of GAAP provides room for interpretation and the application of GAAP necessitates the making of estimates, the auditor can render only an opinion about whether the financial statements present fairly or conform in all material respects to GAAP.” – Financial Accounting 9th Edition – Needles Power

How to Recognize a Good Programmer

How to recognise a good programmer

I think passion and continuous learning and improvement on your own is very important.

Exception Handling in C

http://www.on-time.com/ddj0011.htm
http://sourceforge.net/project/showfiles.php?group_id=4184&package_id=4200
http://en.wikipedia.org/wiki/Exception_handling

“Some programmers use exceptions to handle errors just because their language provides that particular error-handling mechanism… a classic example of programming in a language rather than programming into a language.” – Code Complete 2nd Edition

Write Debug Output to Console Window

http://www.codeguru.com/cpp/v-s/debug/article.php/c1249/

#ifdef _DEBUG
    FILE* __fStdOut = NULL;
    HANDLE __hStdOut = NULL;
#endif

// width and height is the size of console window, if you specify fname,
// the output will also be writton to this file. The file pointer is
// automatically closed when you close the app
void startConsoleWin(int width=80, int height=25, char* fname = NULL);

void startConsoleWin(int width, int height, char* fname)
{
#ifdef _DEBUG
	AllocConsole();
	SetConsoleTitle("Debug Window");
	__hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);

	COORD co = {width,height};
	SetConsoleScreenBufferSize(__hStdOut, co);

	if(fname)
		__fStdOut = fopen(fname, "w");
#endif
}

// Use wprintf like TRACE0, TRACE1, ...
// (The arguments are the same as printf)
int wprintf(char *fmt, ...)
{
#ifdef _DEBUG
	char s[300];
	va_list argptr;
	int cnt;

	va_start(argptr, fmt);
	cnt = vsprintf(s, fmt, argptr);
	va_end(argptr);

	DWORD cCharsWritten;

	if(__hStdOut)
		WriteConsole(__hStdOut, s, strlen(s), &cCharsWritten,
				NULL);

	if(__fStdOut)
		fprintf(__fStdOut, s);

	return(cnt);
#else
	return 0;
#endif
}

The C++ Programming Language

Barcode Security

Let’s take a look what GNU Barcode can do later, haha

http://www.heise-security.co.uk/news/101151