2008 Mar 27 - Thu
I DOS'd Myself (created a slashdot effect with out slashdot)
I wrote a short article comparing ODF with OOXML and posted it on DZone. It ended up being
linked up on reddit. Then I got a bunch of traffic. Way lots too much traffic for my
poor ineffecient blosxom based server to handle. It is time to upgrade. Sorry about that folks.
[/Personal]
permanent link
2008 Mar 26 - Wed
C++ Custom Containers and Iterators
I'm using the
HDF5 File System for holding
time series information. Rather than writing my own binary search implementation to find
particular elements within a particular saved time series, I thought it would be
clever if I designed the
interface so I could use the Standard Template Library's 'find' iterator. If I can make the
STL's 'find' work, then all the other iterators should work just as well, and thus I'll have
an
easy mechanism to access time series with very little programming involved.
I can find any number of web sites containing information on how to work with C++'s
standard containers and iterators. When it comes to finding information on custom
containers and iterators, the information is not quite so plentiful.
The first article I came across was one from TechRepublic called
Extending the C++ STL with custom containers. It didn't quite have the meat I was
expecting.
Bjarne Stroustrup's book, The C++ Programming Language, does have a section on
iterators and a section on containers. In retrospect, they are quite good introductions
to the concept, but I didn't feel the examples were as informative as I would have liked.
Microsoft's MSDN has an article called
C++ and STL: Take Advantage of STL Algorithms by Implementing a Custom Iterator, but
this article only covers the custom iterator side of things, it doesn't discuss how it would
interact with a custom container.
Dr. Dobbs inherited an article entitled
Custom Containers & Iterators for STL-Friendly Code:
A pair of approaches for creating custom containers from the March 2005 issue of C++
Users Journal. Some code extracts are included but there are some pieces missing, such as
the begin() and end() methods and how they are put together. The link in the article to the
original code no longer works. However, I did find that I have the Dr. Dobbs Developer
Library DVD Release 4. On it resides the full example code. That was much more
informative.
Now that I have a better understanding for what I'm looking, I see that the
STL compliant container example has some useful information. In the same vein,
CodeProject has another example:
An STL compliant sorted vector.
Finally, I came across Ulrich Breymann's book called Desiging Components with the C++
STL. It provided all the necessary background to pull it all together. I always thought
there was more to it, but custom containers and iterators may not be so hard after all.
Once I have the code finished, I'll try to have it posted one way or another.
[/Personal/SoftwareDevelopment/CPP]
permanent link
2008 Mar 25 - Tue
How Not To Form a Standard
Rob Weir has a blog called An Antic Disposition where he discusses
The Disharmony of OOXML.
The eloquent center piece of his article is a table representing how various applications represent a smiple
text string with one word in red, represented here verbatim:
| Format | Text Color | Text Alignment |
|---|
| OOXML Text | <w:color
w:val="FF0000"/> | <w:jc w:val="right"/> | | OOXML Sheet | <color
rgb="FFFF0000"/> | <alignment horizontal="right"/> | | OOXML Presentation | <a:srgbClr
val="FF0000"/> | <a:pPr algn="r"/> | | ODF Text | <style:text-properties
fo:color="#FF0000"/> | <style:paragraph-properties fo:text-align="end" /> | | ODF
Sheet | <style:text-properties fo:color="#FF0000"/> | <style:paragraph-properties
fo:text-align="end"/> | | ODF Presentation | <style:text-properties
fo:color="#FF0000"/> | <style:paragraph-properties fo:text-align="end"/> |
Some wag once mentioned that a standard is nice, you have so many from which to choose. The standards
writers for OOXML must have had this in mind when they allowed the diversity of Text Coloration and Alignment into
the standard. Oh, wait. The applications were written first, then some general bucket was designed to hold
the output these applications produced.
As the writer says, it would have been nice to create a 'single standard' and then retrofit the application's output
to conform to the file format. If an application needs to store it differently internally, so be it, but conform
to some level of operability in the file format. Hmmm, can each application read each other's handiwork? If not, what
good is a standard?
The article indicates that once ODF was established, Open Office changed to match the standard. And from the table
above, we can see all the tools within Open Office conform, with the result of twin goals of true universality of information interchange
and simplicity of software design have been reached.
That would be a high standard for OOXML to achieve.
[/Personal/Technology]
permanent link
Who Needs a SafeD Net?
Bartosz Milewski, a member of the 'D' design team,
wrote an article
about making the
programming language D even safer than it purportedly already is. He called that subset:
SafeD. In the process of making D and SafeD look good, the failings of C++ were highlighted
in comparison. To his credit, the author was able to list a few good features:
performance, low-level access, and powerful abstractions (the latter being slighted at
the same time for apparently only being useful in operating systems or large systems design).
On the other hand, it is nice to hear that whenever people feel they have to make their
language-of-choice look good, inevitably some subset of C++ comes in as a benchmark. I
include the word 'subset' on purpose. There are specialized, productive, easy to learn
languages out there. I've even used a few of them. Each of them is better than some
specific aspect of C++, but few if any, can beat C++ in many areas. Ok, maybe Lisp does
better.
B Milewski did acknowledge that "There are many other simplifications and safety
improvements over C++. Unfortunately they all come at the expense of expressive power and
performance." well said.
I used C# for a couple of years, buying into the theory that automated memory management
and suborned pointers would be a good thing for me. Ah, no. I like the ability to be able
to 'shoot myself in the foot'. Really good gun-slingers know their guns, know where to
point them, know how to maintain them, know their useful range, and clean often to ensure
good performance. Would a gunslinger hand his gun over to an acolyte for cleaning and
maintenance? The same could be said of a programmer handing over memory management and
object manipulation to some hidden behind-the-scenes mechanism which may not be optimal for
the job.
Perhaps I'm just a control freak, but I had to depart C# and return to the wild west of
C++ programming in order to feed my adrenalin requirement of walking the fine edge of
writing elegant, flexible code.
Isaac Asimov wrote a book called the End of Eternity. The moral of that story was that
if humanity is not allowed to push the boundaries, and get hurt a little in the process,
stagnation sets in. Also, the hero of the story wouldn't have been able to look off
into the sunset with the heroine at his side.
Perhaps C++ is indeed a difficult language to master. It's flexibility may
be its
undoing,
but the for the tenacious learners, it provides a high level of satisfaction for allowing
one
to
come up with good solutions for tough problems, big or small... and for being able to
devise an
appropriate solution from an excellent collection of varied tools.
Scott Meyers, in his book, Effective C++, eloquently expresses why C++ has the feel of an
elephant being touched by a number of blind men. C++ is actually a federation of
languages.
- Deep down, C++ is the structured
programming language known as C.
- C++ is C with Object Orientedness added on.
- C++ is
Generic
Programming, template metaprogramming, which is said to rarely interact with mainstream C++
programming.
- STL is a sub-language of C++ based upon algorithmic programming, as defined by
Alexander Stepanov.
In the referenced article from the last point above, a few enlightning quotations about
Stepanov's strong views of C++ strengths and weaknesses:
"STL is the result of a bacterial infection", "STL is not object oriented. I think that
object orientedness is almost as much of a hoax as Artificial Intelligence.", "Always start
with algorithms.", "Generic programming is a programming method that is based in
finding the most abstract representations of efficient algorithms", and "So far, C++ is the
best language I've discovered to say what I want to say".
O how they cling and wrangle, some who claim
For preacher and monk the honored name!
For, quarreling, each to his view they cling.
Such folk see only one side of a thing.
Jainism and Buddhism. Udana 68-69:
Parable of the Blind Men and the Elephant
For those hoping to find the perfect language, here is what
The Architect has to
say about that:
"Hope, it is the quintessential human delusion, simultaneously the source of your greatest
strength, and your greatest weakness."
Perhaps C++'s flexibility is both its greatest strength as well as its greatest weakness.
[/Personal/SoftwareDevelopment]
permanent link
Programming Chaos on the Wings of a Butterfly
From xkcd, a webcomic of romance,
sarcasm, math, and language.
[/Personal/SoftwareDevelopment]
permanent link
2008 Mar 24 - Mon
Open Source Site of the Day -- Processing
This should actually be filed under a few different headings (which is something I'll do
once I get the new blog software in place). Those headings being programming, software
development, visualization, animation, imaging, interacting, and open source.
It is some software called
Processing of which I speak. It is
hard to put into words what this is. I first took a look at some animation samples that
were produced for a FOX station's movie slot. They need to be seen to be believed. My next
step was to look at programming examples. The programming examples included visualization
of programming techniques...self referential, eh! More advanced examples provided the
ground work for how to do some of the flocking behaviour I viewed in the first animation
samples I viewed.
This site caters to the young and the old, programmers and visualizers. If only for the
eye-candy, it is a site to be viewed.
[/OpenSource/SiteOfTheDay/D200803]
permanent link
2008 Mar 23 - Sun
C++ Implementation of Wu Manber's Multi-Pattern Search Algorithm
I'm finding that this algorithm is useful in a number of situations. Out in the
real world, it is found in Network Intrusion Scanners, grep engines, as well as
text processing.
For me, I'm working on an implementation for a RADIUS server for authorizing and
logging calls for a voice over ip service. Some vendor specific attributes don't
have a unique numeric identifier, the identifier is simply a string. Being able to do a
fast match would be nice in this situation. Currently I'm using C++'s unordered_map
to facilitate identification of the string. The Wu Manber algorithm may be a suitable
alternative.
On another front, I subscribe to a real time news service. Passing this news service
through a Multi-Pattern Search Algorithm would make for a processor efficient method of
filtering for news items in which I'm interested.
Wu-Manber
stand on the
shoulders of their Multi Pattern Search predecessors: Aho and
Corasick (with a linear time scanner based upon an automata approach), Commentz-Walter
(who combined Aho-Corasick with the Boyer-Moore string search algorithm), and Baeza-Yates
(with a slightly different combination of Aho-Corasick and Boyer-Moore-Horspool).
For those who are interested, here is a Visual Studio implmentation of Wu Manber's
algorithm. It should be
readily transportable to other platforms with little or no change, other the the _tmain
construct. The implementation relies on C++ Standard Template Library for various
containers. A table driven character comparison approach is used to make it easy
to choose between case sensitive and case insensitive matches.
The next step would be turn it into a template to make it useful on various types of
alphabets. It all needs to be redone a bit in order to accept a 'functor' or a 'delegate'
so that when a match is found, an appropriate routine can be invoked.
There is another paper out there called "An Improved Wu-Manber Multiple Patterns Matching
Algorithm" that purports to be faster. The charts in the paper say it is a bit faster. I'm
wondering if it is 'faster enough' to be of value implementing.
[/OpenSource/Programming]
permanent link
2008 Mar 21 - Fri
The ODF - OOXML Three Ring Circus
I've been following along with the standards-wannabe known as OOXML. Microsoft's want
this proprietary standard so much, you can feel the flames of hell leaping higher. Ok, so
my visual metaphors are getting out of hand. I recently did lighting for a sketch for
BMDS's production of GUMS, which in itself is
a series of comedic sketches. Anyway, the sketch of which I'm speaking is where the Devil,
played by Steve Watts, delivers a monologue about recent arrivals in Hell. For example, the
atheists are called a bunch of nitwits, the Christians are scoffed at due to the Jews being
right. Very few groups were left out. And I must say, my 'fires of hell' lighting worked
out quite well.
In reading various blogs and articles regarding Microsoft's process of stacking the
National Standards Bodies with Microsoft's influence peddlers and lackeys brings forth
strongly the image of "selling one's soul for something one believes in". But corporate
greed and monopolostic habits die hard. Even bending to the level of
personal slurs, with this not being the first documented one.
The Standards Blog sprouts forth a bright flower from the sewage of vitriol
currently being spouted regarding incomplete standards, lockins, patent protection, and
selfishness. He has exerpted comments from South African Minister of Public Service and
Administration Geraldine Fraser-Moleketi. I'll reprint them here as representing a voice
calling out from the desert:
...This past year has been marked by a raising in the tension between the traditional
incumbent monopoly software players and the rising champions of the Free Software movement
in Africa. The flashpoints of conflict have been particularly marked around the development
and adoption of open standards and growing concerns about software patents..
It is unfortunate that the leading vendor of office software, which enjoys considerable
dominance in the market, chose not to participate and support ODF in its products, but
rather to develop its own competing document standard which is now also awaiting judgement
in the ISO process. If it is successful, it is difficult to see how consumers will benefit
from these two overlapping ISO standards. I would like to appeal to vendors to listen to the
demands of consumers as well as Free Software developers. Please work together to produce
interoperable document standards. The proliferation of multiple standards in this space is
confusing and costly..
An issue which poses a significant threat to the growth of an African software
development
sector (both Free Software and proprietary) is the recent pressure by certain multinational
companies to file software patents in our national and regional patent offices. Whereas open
standards and Free Software are intended to be inclusive and encourage fair competition,
patents are exclusive and anti-competitive in their nature. Whereas there are some
industries in which the temporary monopoly granted by a patent may be justified on the
grounds of encouraging innovation, there is no reason to believe that society benefits from
such monopolies being granted for computer program .inventions.. The continued growth in the
quantity and quality of Free Software illustrates that such protection is not required to
drive innovation in software. Indeed all of the current so-called developed countries built
up their considerable software industries in the absence of patent protection for software.
For those same countries to insist on patent protection for software now is simply to place
protectionist barriers in front of new comers. As the economist, Ha-Joon Chang, observed:
having reached the top of the pile themselves they now wish to kick away the ladder.
African software developers have enough barriers to entry as it is, without the introduction
of artificial restrictions on what programs they are and aren.t allowed to write. When
Steven Biko wrote .I write what I like. he was not referring to computer programs but it
would certainly be an apt motto for today.s generation of African Free Software developers.
It will become increasingly important for FOSSFA to continue to lobby and mobilize to keep
this intellectual space open.
One cannot be in Dakar without being painfully aware of the tragic history of the slave
trade. For three hundred years, the Maison des Esclaves (Slave House) on Gorée Island, was a
hub in the system of forceful transportation of Africans as slaves to the plantations of the
West Indies and the southern states of America. Over the same period people were being
brought as slaves from the Malay Archipelago and elsewhere to South Africa. The institution
of slavery played such a fundamental role in the early development of our current global
economy, that by the end of the 18th century, the slave trade was a dominant factor in the
globalised system of trade of the day.
As we find ourselves today in this new era of the globalised Knowledge Economy there are
lessons we can and must draw from that earlier era. That a crime against humanity of such
monstrous proportions was justified by the need to uphold the property rights of slave
owners and traders should certainly make us more than a little cautious about what should
and should not be considered suitable for protection as property..
Her comments are far ranging, but for me being a software developer, being sued for
creating a smiley face that has already been patented is not my idea of a good time... as an
example.
We do
need a reality check regarding patents on software. We do have good corporate citizens like
IBM who build real products, and obtain real patents, and make real money. Yes, I know
there is dirt under the carpet over there, but still, with over 100,000 employees, they must
be doing something correct.
Here's hoping that Microsoft will somehow get its comeupance regarding bullying a
6000 page incomplete document through what was, at one point in time, a relatively
decent standards process.
[/Personal/Technology]
permanent link
2008 Mar 18 - Tue
Cygwin Ports Project for KDE
Downloading Cygwin from Cygwin gets
you a basic Cygwin configuration. I also wanted KDE, which isn't part of the basic stuff.
The site Cygwin/XFree seems
to have subsided a while ago. But that site did point me to the
Cygwin Ports Project. As of this
writing, they have KDE 3.5.8, but not KDE 4 yet. Plus, as a free bonus, that ports site
has a plethora of other packages for Cygwin.
[/OpenSource/Linux]
permanent link
2008 Mar 16 - Sun
Don't Use Defined Macros, Use Templated Inline Functions Instead
In the olden C days, one would use #define MACRO .... to build an inline macro
for computationally quick evaluation of some calculation. When using that method
of programming, one needed to remember to parenthesize extensively in order to prevent
wierd things from happening when calling the function with an expression.
The modern approach is to use a template for an inline function, which yields
all the efficiency of a macro, plus all the predictable behavior and type safety
of a regular function (item #2 in the book Effective C++. An example declaration follows:
template<typename T>
inline void DoWithMax( const T& a, const T& b ) {
f( a > b ? a : b );
}
[/Personal/SoftwareDevelopment/CPP]
permanent link
|