free hit counter

Thursday, December 29, 2005

How to Access Serial Ports Greater Than COM9 Using C/C

All I can say is, what a pain in the ass.

char* portName= "\\\\.\\COM17";

COM ports greater than 10 must be accessed using their full path. But in all the create file documentation around comports it doesn't say anything about this. You have to stumble upon KDB-227.

linkage

Ok, and while I'm bitching about windows, why should it be so damn hard to format an error message?

void ErrorExit(LPTSTR lpszFunction)
{
LPVOID lpMsgBuf;
LPVOID lpDisplayBuf;
DWORD dw = GetLastError();

FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
dw,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0, NULL );

lpDisplayBuf = LocalAlloc(LMEM_ZEROINIT,
strlen(lpMsgBuf)+strlen(lpszFunction)+40);
wsprintf(lpDisplayBuf,
"%s failed with error %d: %s",
lpszFunction, dw, lpMsgBuf);
MessageBox(NULL, lpDisplayBuf, "Error", MB_OK);

LocalFree(lpMsgBuf);
LocalFree(lpDisplayBuf);
ExitProcess(dw);
}

Keyspan USB serial support

Wow. I never expected support this good for a little serial to usb adapter!

Keyspan : Support : Developer : Win :

Wednesday, December 28, 2005

bitchen: boost::lexical_cast

Boost makes C++ more of a usable language.

The lexical_cast operation is simpler than the previously recommended stringstream just what you need much of the time.

linkage

declaring functions static is passe

OMG, It's like, so C to declare a function static.

I guess static is an overused keyword.

You should now declare funtions you don't want called outside of this file (excuse me, "translation unit")in an unnamed namespace like this:


//static functions and data that shouldn't be referenced outside this file
namespace
{
int foo();
void bar();
std::string baz;
}



linkage

Exceptions and error handling [C++ FAQ Lite]

I'm always looking to refine my error handling and exceptions- they're so critical to systems, and so rarely done well.

This link from the C++ FAQ confirmed and reinforced my usual practices:
* throw exceptions in constructors (being wary that the destructor won't be called)
* don't throw execptions in destructors
* don't use exceptions like error codes

[17] Exceptions and error handling, C++ FAQ Lite

Tuesday, December 27, 2005

Category:T43 - ThinkWiki

All the info I'll should hope to ever need on my Thinkpad t43 laptop:

Category:T43 - ThinkWiki

Labels:

subversion repository choices

So, I'm still not 100% sure what works best for me with respect to subversion repository configuration, but I'm definitly sure that tools, installs, and really large binary files that don't change a whole lot should not be in any principly source code repositories, but stored away in thier own repository.

I'm writing this right now as I wait for a 30mb zip file to transfer over as I check out an old version of the repository.

(nope, still not done transfering...)

Wednesday, December 21, 2005

Geometria Noir Icons

Cool , free, lowkey set of abstract icons

Geometria Noir Icons

Tuesday, December 20, 2005

manifest files and msvcp80.dll

I appreciate that these side-by-side assemblies and manifests are looking to solve the dll hell problem, but man there just isn't much comprehensible user level documentation about it.

My app wouldn't run on my target system, so I downloaded dependency walker to find out what DLLs weren't loading. Funny, I had msvcp80.dll in the same directory as my application, but the application couldn't load it. So, I found out you have to copy the magic side-by-side assembly files into your %WINDIR%/WinSxs/ directory.

Don't forget to copy manifest files, policy directory, and the directory if interest!

Linkage:
http://www.dependencywalker.com/

Troubleshooting C/C Isolated Applications and Side-by-side Assemblies

Friday, December 16, 2005

curing those boost C4996 warnings

define _SCL_SECURE_NO_DEPRECATE

Microsoft has their own "SAFE" version of the C++ library, but boost is trustworthy enought to not use it.


linkage

STL Error Decryptor for C ++

Wow. I hate those damn incomprehensible STL errors. I want to install this right now, but I need to fix my cygwin install first! Ah, not enough time in the day

STL Error Decryptor for C

Tuesday, December 13, 2005

XEmacs still has the edge over visual studio

nothing beats the paren highlighting ala (paren-mode 'sexp nil (paren))

to make a tagfile for a whole source tree add the following to you makefile:
(assuming nmake on WIN32 w/ cygwin)

tags:
cd ..
echo #!/usr/bin/bash > _tmpTags.sh
echo etags `find -iname "*.cpp"` `find -iname "*.h"` >> _tmpTags.sh
bash _tmpTags.sh
rm _tmpTags.sh


commands I'd like to try out:
M-tab, tag-complete-symbol
M-?i
tag-table-include-files


Would like to check out:
http://olympus.het.brown.edu/cgi-bin/info2www?(emacs-21/ebrowse)Overview

Two helpful articals for tag completion:
etags | Linux Journal
Making Emacs Stand Up To Visual Studio 7 || kuro5hin.org

Thursday, December 08, 2005

Free Screen Recorder

So cool, this captures the output of a VNC session into a Flash movie.

vnc2swf - Screen Recorder

Wednesday, December 07, 2005

Rolling back changes in Subversion

Ok, so here's where ClearCases's config specs and dynamic views are nice. Once you grok them its a pretty simple matter to work with older files.

In SVN I used the merge tool to roll back some changes on two semi isolated filees. It would have been just as easy to grab copies of those revisions and paste them in by hand.

Hmph, still learning...

Common Use-Cases

Labels:

Tuesday, December 06, 2005

Google: Ten Golden Rules

Five words:

fluff and fold laundry service

Google: Ten Golden Rules - Issues 2006 - MSNBC.com

Monday, December 05, 2005

CSP - better than threading?

Using threads has always rubbed me a little wrong. It just doesn't seem right to have locks sprinkled throughout code and have the spectre of deadlock looming over everything.

When I have more time I'd like to check out an alternative concurency tactic:

The Kent C CSP Libary

syntax highlighter for the web

Here's an opensource PHB syntax highlighter that could likely be used to color code c/c++ files served up by subversion

http://qbnz.com/highlighter/

Friday, December 02, 2005

User interface building with QT 4.0

I jumped into using QT4 assuming it was just like QT3. Three weeks in, and it's slowly dawning on me that if it was maybe they wouldn't have bumped the major revision number!

The most major difference so far is what they did with the QT Architect and its .ui files:

Qt 4.0: Porting .ui Files to Qt 4