Tuesday, April 28, 2015
Properties in C++ Part II
Posted by
Chris Bensen
at
7:00 AM
0
comments
Labels: C++, Code, programming
Monday, April 20, 2015
Properties in C++
Posted by
Chris Bensen
at
7:00 AM
0
comments
Labels: C++, Code, programming
Monday, October 27, 2014
Strip Invalid Identifier Characters
I don't do much Delphi anymore (any really) but this has been hanging around in my inbox for a while so I cleaned it up. This is a simple function that is a modification of IsValidIdent to strip invalid characters from a string.
function StripInvalidCharacters(const Ident: string): string;
function Alpha(C: Char): Boolean; inline;
begin
Result := TCharacter.IsLetter(C) or (C = '_');
end;
function AlphaNumeric(C: Char): Boolean; inline;
begin
Result := TCharacter.IsLetterOrDigit(C) or (C = '_');
end;
var
I, L: Integer;
begin
L := Length(Ident);
if (L > 0) and Alpha(Ident[1]) then
Result := Ident[1];
for I := 2 to L do
if AlphaNumeric(Ident[I]) then
Result := Result + Ident[I];
end;
var
LocalVal: string;
LocalHash: Integer;
begin
if IsValidIdent(Value) then
LocalVal := StripInvalidCharacters(Value)
else
Posted by
Chris Bensen
at
7:00 AM
0
comments
Labels: Delphi, programming
Tuesday, October 21, 2014
Simplicity
A simple design always takes less time to finish than a complex one. Maybe not always. But it should. So always do the simplest thing that could possibly work. If you find something that is complex replace it with something simple. It's always faster and cheaper to replace complex code now, before you waste a lot more time on it. Keep things as simple as possible as long as possible by never adding functionality before it is scheduled. Beware though, keeping a design simple is hard work.
Simplicity!
Posted by
Chris Bensen
at
7:00 AM
2
comments
Labels: programming
Thursday, October 16, 2014
GDB
Oh GDB. I have not much to say. You are there.
The most useful GDB command is printing a string:
(gdb)p /c *str@20
http://www.yolinux.com/TUTORIALS/GDB-Commands.html
Posted by
Chris Bensen
at
7:00 AM
0
comments
Labels: programming