I have never missed someone so much since my late father died in April of 2001.
I do miss Seattle Jazz Icon Floyd Standifer. His gig at The New Orleans kept me sane through many a grim Seattle winter. My wife Juliet and I have a nice Wednesday nights dating ritual since we first started going out together. I used to work for Amazon.com when we first met, and after long, crazy hours of laboring over the ordering system code, I used to call her at home: "Hey Babe, I am walking down Jackson street, see you at the New Orleans in a few?"
I have taken close friends there to share the Floyd Experience, and family, and people from out of town (Andra and Cristian who visited us from Spain last year had a blast). The staff at the New Orleans is friendly, and the band casual. Clarence Acox reminds me of James Earl Jones, only cooler: he can roll. And the Garfield kids that he coaches are amazing.
Jim Wilke, John Gilbreath, Bud Young and many many others gathered tonight at Seattle's First Baptist Church to honor Floyd.
As an immigrant to this Great Country, I cannot but stand by one of the participants' quote: "You cannot talk about America, without talking about Jazz".
And viceversa. I am lucky to be here.
Monday, February 05, 2007
Friday, February 02, 2007
Genuinely Numb
Does it matter if your copy of Windows is genuine? According to Microsoft, yes. If I understand correctly the gist of what they are saying, genuine Windows is less dangerous to its users.
It actually appears that the world is awash in counterfeit products. In Russia alone, 43,000 people die annually as a direct consequence of drinking counterfeit alcohol. Tragically enough, the fake beverages also cause losses estimated to $300 million!
And counterfeit cigarettes were reported to have "75% more tar, 28% more nicotine and about 63% more carbon monoxide" than genuine cigarettes in the UK market.
For Goodness sake, please make sure your smokes are genuine!
Oddly enough, I haven't heard of a genuine Apple computer yet.
And genuine Linux comes with ABSOLUTELY NO WARRANTY.
It actually appears that the world is awash in counterfeit products. In Russia alone, 43,000 people die annually as a direct consequence of drinking counterfeit alcohol. Tragically enough, the fake beverages also cause losses estimated to $300 million!
And counterfeit cigarettes were reported to have "75% more tar, 28% more nicotine and about 63% more carbon monoxide" than genuine cigarettes in the UK market.
For Goodness sake, please make sure your smokes are genuine!
Oddly enough, I haven't heard of a genuine Apple computer yet.
And genuine Linux comes with ABSOLUTELY NO WARRANTY.
Monday, January 29, 2007
A Ghost in Fremont
What follows is an essay that I wrote in the Summer of 2004 after listening to a talk by Andrei Codrescu. For those of you who didn't know: there IS a statue of Lenin in Fremont, Seattle, United States of North America, Planet Earth.
Last night J. and I went to the Rialto Theater in Tacoma to listen to The Writer’s ruminations on Woolworth, on escaping from the Stalinist East and the aroma of strudel in old Hermannstadt.
I don’t know where he pulled this strudel business from; the city did definitely smell of many things, but apple pie was not one of them, as I recall from back when I was stationed there (drafted by a communist army at age eighteen); yet I share some of his Transylvanian nostalgia. Only I reminisce drinking beer in smoky cellars, places such as “La Bolta Veche”, with the entrance mischievously winking at the old cathedral, and the cobble stone alley that lead to it; the alley narrowed as it spiraled downhill, descending into the outer circles of the Inferno. The cellar with its many corridors could have as well been a real place of torture, back in medieval times; I always wondered if there was some sort of vertical secret passage, a shaft to connect it with the cathedral above. Sinners would have been thrown down through a secret trap in the confessional’s floor.
Later, The Writer signed for me a copy of his book and I was standing there, shaking and feeling dumb, so much intimidated by the proximity of one of my favorite Romanians; he is also Jewish and therefore related to God: one more reason for me to be shy. He asked what I was doing in the States and I could only utter: “I hang out in Redmond, like many others do these days” – since I assumed that everyone knows that Microsoft’s headquarters are in Redmond, and that makes it the Capital of the Software industry, which made me a programmer.
The Writer talked about Woolworth and I was thinking about The Waffle House (a favorite hangout back in my Atlanta days); one generation apart, we had different hangouts, different experiences. Yet somehow I felt as the only person in the theater that could see The Ghosts. I mean, how could one expect those nice Tacoma bourgeois ladies and gents to grasp the paranoia I breathed while growing up? Of course, as fine intellectuals with a cult for Freedom, they read Soljenitsin and Codrescu.
Yet one might think that all the descriptions of the life behind the Iron Curtain are but the fabrication of a sick mind's exercises in exploring the absurd, rhinoceroses metamorphosed into giant roaches. The reality of suburbia, the hard evidence of the two-car garage, and the proof of the barbecue in the backyard all strongly dismiss such aberrations. “Yeah, they say life in the Eastern Block was tough, but that was just an excuse for drinking vodka and seeking asylum in the West”. The Ghosts of the past, I have to live with; I gave up explaining how the communists used to shut down the power in winter, several hours a day, how the children and the elderly had to wait in line for bread, while the working adults went to jobs where they had to listen to propaganda, and spy on each other, to make sure that no one else spies on them on behalf of the government. There was a secret police that watched over the other secret police, making sure that they are loyal to the regime and promptly sent to jail anyone who seemed to display any sign of discontent with the government. The “suspects” used to disappear as if through a secret trap in the floor.
When I moved to Seattle a few years ago, I almost bumped into one of the Ghosts while walking on the street in plain daylight. I was strolling through Fremont on a sunny Saturday afternoon. It was spring and people were out everywhere, enjoying the first day with blue sky in six months or so. The colorful mass of yuppies wearing shorts and flip-flops flowed slowly by the souvenir and coffee shops, by the Greek restaurant in the corner, some even ventured downstairs in the old Dusty Strings music store.
I was going with the flow, absent-minded, smiling at the sun, when I saw the statue: a two stories high bronze monument of no one else but the father of communism, the root of all evils, the Mummy. I froze; time bent for a while, slowed down, then came to a full stop: the colors of the crowd, and its noise blurred away. Hypnotized, I couldn’t take my eyes off Lenin, afraid that he might actually move. I quickly examined the possibility that I had come upon a breach in time, where the Universe, in some Carl Sagan-esque sort of stunt bent over backwards, stuck its head up the Milky Way’s butt, and opened a Stargate passage to the Soviets world of the Fifties. I kept looking at Vladimir Ilich, terrified at the thought that some tanks and soldiers with 7.62-mills may rush through the secret opening, through some sort of reversed shaft, ascending from the Inferno back into the gothic cathedral of our daily lives.
Then, my heart, and time with it, slowly resumed back to their normal beat, and I glanced at the people around: do they see what I see? Are they running in terror? The street was filled with chatter: passers by seemed to ignore the statue of Lenin; the taco place was full of customers. Was I the only one that could see The Ghost (as I would, few years later, in the Tacoma Rialto Theater)?
And then, paying closer attention to the crowd, I realized that most of the kids out there in the street were generations and thousands of miles apart from the Iron Curtain.
With the long coat, the visor cap, and the daring beard, the statue could as well pay tribute to a local fishing boat captain who sunk up by Alaska.
“Vladimir Ilich” – in Russian prose all characters are addressed by their both names, which in a funny way ties Georgia to the other Georgia, “Vladimir Ilich”, I chuckled, “none of these good folks strolling here know who you are. Maybe not even the fool who rescued your statue from the ashes of the dieing U.S.S.R. knew very well who you were.
“You see, my dear Vladimir Ilich, this is your epitaph: small time fishing boat Captain Anonymous, sunk into The Oblivion Sea, west of Bering. And that is History’s revenge; it’s blessing, it’s curse: a very short memory”.
Last night J. and I went to the Rialto Theater in Tacoma to listen to The Writer’s ruminations on Woolworth, on escaping from the Stalinist East and the aroma of strudel in old Hermannstadt.
I don’t know where he pulled this strudel business from; the city did definitely smell of many things, but apple pie was not one of them, as I recall from back when I was stationed there (drafted by a communist army at age eighteen); yet I share some of his Transylvanian nostalgia. Only I reminisce drinking beer in smoky cellars, places such as “La Bolta Veche”, with the entrance mischievously winking at the old cathedral, and the cobble stone alley that lead to it; the alley narrowed as it spiraled downhill, descending into the outer circles of the Inferno. The cellar with its many corridors could have as well been a real place of torture, back in medieval times; I always wondered if there was some sort of vertical secret passage, a shaft to connect it with the cathedral above. Sinners would have been thrown down through a secret trap in the confessional’s floor.
Later, The Writer signed for me a copy of his book and I was standing there, shaking and feeling dumb, so much intimidated by the proximity of one of my favorite Romanians; he is also Jewish and therefore related to God: one more reason for me to be shy. He asked what I was doing in the States and I could only utter: “I hang out in Redmond, like many others do these days” – since I assumed that everyone knows that Microsoft’s headquarters are in Redmond, and that makes it the Capital of the Software industry, which made me a programmer.
The Writer talked about Woolworth and I was thinking about The Waffle House (a favorite hangout back in my Atlanta days); one generation apart, we had different hangouts, different experiences. Yet somehow I felt as the only person in the theater that could see The Ghosts. I mean, how could one expect those nice Tacoma bourgeois ladies and gents to grasp the paranoia I breathed while growing up? Of course, as fine intellectuals with a cult for Freedom, they read Soljenitsin and Codrescu.
Yet one might think that all the descriptions of the life behind the Iron Curtain are but the fabrication of a sick mind's exercises in exploring the absurd, rhinoceroses metamorphosed into giant roaches. The reality of suburbia, the hard evidence of the two-car garage, and the proof of the barbecue in the backyard all strongly dismiss such aberrations. “Yeah, they say life in the Eastern Block was tough, but that was just an excuse for drinking vodka and seeking asylum in the West”. The Ghosts of the past, I have to live with; I gave up explaining how the communists used to shut down the power in winter, several hours a day, how the children and the elderly had to wait in line for bread, while the working adults went to jobs where they had to listen to propaganda, and spy on each other, to make sure that no one else spies on them on behalf of the government. There was a secret police that watched over the other secret police, making sure that they are loyal to the regime and promptly sent to jail anyone who seemed to display any sign of discontent with the government. The “suspects” used to disappear as if through a secret trap in the floor.
When I moved to Seattle a few years ago, I almost bumped into one of the Ghosts while walking on the street in plain daylight. I was strolling through Fremont on a sunny Saturday afternoon. It was spring and people were out everywhere, enjoying the first day with blue sky in six months or so. The colorful mass of yuppies wearing shorts and flip-flops flowed slowly by the souvenir and coffee shops, by the Greek restaurant in the corner, some even ventured downstairs in the old Dusty Strings music store.
I was going with the flow, absent-minded, smiling at the sun, when I saw the statue: a two stories high bronze monument of no one else but the father of communism, the root of all evils, the Mummy. I froze; time bent for a while, slowed down, then came to a full stop: the colors of the crowd, and its noise blurred away. Hypnotized, I couldn’t take my eyes off Lenin, afraid that he might actually move. I quickly examined the possibility that I had come upon a breach in time, where the Universe, in some Carl Sagan-esque sort of stunt bent over backwards, stuck its head up the Milky Way’s butt, and opened a Stargate passage to the Soviets world of the Fifties. I kept looking at Vladimir Ilich, terrified at the thought that some tanks and soldiers with 7.62-mills may rush through the secret opening, through some sort of reversed shaft, ascending from the Inferno back into the gothic cathedral of our daily lives.
Then, my heart, and time with it, slowly resumed back to their normal beat, and I glanced at the people around: do they see what I see? Are they running in terror? The street was filled with chatter: passers by seemed to ignore the statue of Lenin; the taco place was full of customers. Was I the only one that could see The Ghost (as I would, few years later, in the Tacoma Rialto Theater)?
And then, paying closer attention to the crowd, I realized that most of the kids out there in the street were generations and thousands of miles apart from the Iron Curtain.
With the long coat, the visor cap, and the daring beard, the statue could as well pay tribute to a local fishing boat captain who sunk up by Alaska.
“Vladimir Ilich” – in Russian prose all characters are addressed by their both names, which in a funny way ties Georgia to the other Georgia, “Vladimir Ilich”, I chuckled, “none of these good folks strolling here know who you are. Maybe not even the fool who rescued your statue from the ashes of the dieing U.S.S.R. knew very well who you were.
“You see, my dear Vladimir Ilich, this is your epitaph: small time fishing boat Captain Anonymous, sunk into The Oblivion Sea, west of Bering. And that is History’s revenge; it’s blessing, it’s curse: a very short memory”.
Saturday, January 27, 2007
I Do Not Like Hungarian...
... oh... not because I am Romanian and we have a millenium old feud over Transylvania with these folks. No. The beauty of their women (which have a soft spot for Romanian men) totally makes up for it.
What I was going to say is that I do not like the Hungarian Notation which is complete crap, and I am puzzled that the guy who invented it receives so much praise, to date.
I read in the New York Times today that he is going to visit the Space Station in a Soyuz rocket. Ok, Mr Wile E. Coyote, bon voyage and good riddance. Too bad the control systems for that rocket don't run on Microsoft software.
... oh... not because I am Romanian and we have a millenium old feud over Transylvania with these folks. No. The beauty of their women (which have a soft spot for Romanian men) totally makes up for it.
What I was going to say is that I do not like the Hungarian Notation which is complete crap, and I am puzzled that the guy who invented it receives so much praise, to date.
I read in the New York Times today that he is going to visit the Space Station in a Soyuz rocket. Ok, Mr Wile E. Coyote, bon voyage and good riddance. Too bad the control systems for that rocket don't run on Microsoft software.
Thursday, January 25, 2007
The Steve Yegge Factor
Who is Steve Yegge? Oh, just some guy I did not meet while I was working for Amazon, either because my short (two and a half years, from April 2001 to November 03) tenure has not overlapped with his, or maybe just because I do not seek the benevolent companionship of self-appointed software rock stars. Who knows?
While I agree with some of his views on the Agile Process, I am not sure that I fancy his style, for several reasons:
I know from experience that blogging and participating in forums while enjoying a glass of wine inevitably leads to my offending someone needlessly (I have done it more times than I would like to admit, and trust me: I love my reds).
Arguing over development processes (and programming languages, and OS-es) gets people so worked up to the point it becomes a huge time sink, a distraction from what I like doing best, which is writing code. Sometimes I would rather not say what I truly think.
Agile is a necessary evil because it keeps management happy and deluded, thinking they have a grip over the development process (and thus less dangerous).
And finally, why tell people the truth on Agile? Society needs dumb people. If everybody smartens up overnight, then who's gonna pick the garbage? Not Pinocchio, I hear he wants to be a real boy now.
While I agree with some of his views on the Agile Process, I am not sure that I fancy his style, for several reasons:
I know from experience that blogging and participating in forums while enjoying a glass of wine inevitably leads to my offending someone needlessly (I have done it more times than I would like to admit, and trust me: I love my reds).
Arguing over development processes (and programming languages, and OS-es) gets people so worked up to the point it becomes a huge time sink, a distraction from what I like doing best, which is writing code. Sometimes I would rather not say what I truly think.
Agile is a necessary evil because it keeps management happy and deluded, thinking they have a grip over the development process (and thus less dangerous).
And finally, why tell people the truth on Agile? Society needs dumb people. If everybody smartens up overnight, then who's gonna pick the garbage? Not Pinocchio, I hear he wants to be a real boy now.
Tuesday, January 23, 2007
Sunday, January 21, 2007
I Wanna Kick Some Ass. But Whose?
So I have been having more "fun", trying to get Linux to work on my new Pavilion box.
Redhat Enterprise Linux AS 64bit gives this error when booting on the HP Pavilion a1600n:
I got past that by booting with noapic, but I cannot partition the disc, since it is not seen by the kernel.
On the other hand, Suse 9.3 boots but does not recognize the DVD drive after that.
As of now the bets are on Suse 10.2... Fingers crossed... It is installing...
Seems to me that Linux distros are quite challenged in the 64-bit space. It could've been worse though, better be bitter for spending $500 on a piece of hardware that Linux does not support well rather than spending $3000... But the worst thing is that I want to frigging yell at someone, call them names, and... I do not know who the culprit is? HP? The given distros that I am trying to install?
Here's an interesting business idea: open a call center in Romania, hire some cave men to answer the phone, but not give any customer support, just listen while they are being yelled at and insulted.
Last edit: the network card on the Pavilion a1600n died last night, a mere week in service. Conclusion: I am taking it back to FRYS and have them make lemonade.
So I have been having more "fun", trying to get Linux to work on my new Pavilion box.
Redhat Enterprise Linux AS 64bit gives this error when booting on the HP Pavilion a1600n:
...MP-BIOS bug: 8254 timer not connected to IO-APIC
I got past that by booting with noapic, but I cannot partition the disc, since it is not seen by the kernel.
On the other hand, Suse 9.3 boots but does not recognize the DVD drive after that.
As of now the bets are on Suse 10.2... Fingers crossed... It is installing...
Seems to me that Linux distros are quite challenged in the 64-bit space. It could've been worse though, better be bitter for spending $500 on a piece of hardware that Linux does not support well rather than spending $3000... But the worst thing is that I want to frigging yell at someone, call them names, and... I do not know who the culprit is? HP? The given distros that I am trying to install?
Here's an interesting business idea: open a call center in Romania, hire some cave men to answer the phone, but not give any customer support, just listen while they are being yelled at and insulted.
Last edit: the network card on the Pavilion a1600n died last night, a mere week in service. Conclusion: I am taking it back to FRYS and have them make lemonade.
AMD64 Dual Core, HP, Linux and VMWARE
How nice (if at all) to the above play with each other?
I work two jobs. I program using C++ on Windows as my day job, and I am working on my own Linux-based startup at night (doubles as my hobby, too). In both worlds, 64-bit computing is the growing trend. But while at work the Windows 2003 Server 64-bit edition runs happily on the dependable Opteron-based workstation from HP, my private experience is not as successful.
I have a Pavilion a810n that I bought in January of 2005 (added 512 MRam since) and it runs Fedora Core 5, x86_64 edition. So far, so good. Stable as a rock. On top of it, I run VMWare so that I can simulate 32-bit environments running Fedora 4, 5, and 6, respectively. All stable and fun.
But I cannot run a 64-bit machine in the VMWare, because the CPU is not "version D, or later"... whatever the heck that means, it is not related to the D Programming Language (which I hope to fully support in Zero, one day).
So I hit the coffers and bought a dual core laptop, to build my product on it (I just want to support as many distros as possible). Mandriva 2007 is the only distro that runs without hanging randomly on my HP dv6000z lappy. So far, point for French Engineering, and bad bad karma for Fedora and Ubuntu (which utterly suck on said laptop, both hanging tight as a drum).
VMWare seems to emulate 32-bit architectures fine on top of Mandriva on the HP dv6000z laptop, but 64-bit architectures hang badly during install (tried tweaking the Options, did not work). I had consistently bad results while trying several versions of Open SUSE and one RHEL 4 AS 64-bit.
Because I am trying really hard to get out a build of the Zero Debugger for the x86_64 versions of Suse, I bit the bullet one more time, went to FRYS this Sunday and got a HP Pavilion a1600n... Between waiting for AMD's Barcelona chip to come out and getting an unexpensive machine that will become obsolete the next month, I chose the later.
While I am ranting here, the jury is still out, running memory tests:) I am anxious to see how well 64-bit Suse installs natively on this machine.
How nice (if at all) to the above play with each other?
I work two jobs. I program using C++ on Windows as my day job, and I am working on my own Linux-based startup at night (doubles as my hobby, too). In both worlds, 64-bit computing is the growing trend. But while at work the Windows 2003 Server 64-bit edition runs happily on the dependable Opteron-based workstation from HP, my private experience is not as successful.
I have a Pavilion a810n that I bought in January of 2005 (added 512 MRam since) and it runs Fedora Core 5, x86_64 edition. So far, so good. Stable as a rock. On top of it, I run VMWare so that I can simulate 32-bit environments running Fedora 4, 5, and 6, respectively. All stable and fun.
But I cannot run a 64-bit machine in the VMWare, because the CPU is not "version D, or later"... whatever the heck that means, it is not related to the D Programming Language (which I hope to fully support in Zero, one day).
[cristiv@newfoundland ~]$ cat /proc/cpuinfo
processor : 0
vendor_id : AuthenticAMD
cpu family : 15
model : 12
model name : AMD Athlon(tm) 64 Processor 3300+
stepping : 0
cpu MHz : 2400.000
cache size : 256 KB
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext lm 3dnowext 3dnow up
bogomips : 4823.30
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management: ts fid vid ttpSo I hit the coffers and bought a dual core laptop, to build my product on it (I just want to support as many distros as possible). Mandriva 2007 is the only distro that runs without hanging randomly on my HP dv6000z lappy. So far, point for French Engineering, and bad bad karma for Fedora and Ubuntu (which utterly suck on said laptop, both hanging tight as a drum).
VMWare seems to emulate 32-bit architectures fine on top of Mandriva on the HP dv6000z laptop, but 64-bit architectures hang badly during install (tried tweaking the Options, did not work). I had consistently bad results while trying several versions of Open SUSE and one RHEL 4 AS 64-bit.
Because I am trying really hard to get out a build of the Zero Debugger for the x86_64 versions of Suse, I bit the bullet one more time, went to FRYS this Sunday and got a HP Pavilion a1600n... Between waiting for AMD's Barcelona chip to come out and getting an unexpensive machine that will become obsolete the next month, I chose the later.
While I am ranting here, the jury is still out, running memory tests:) I am anxious to see how well 64-bit Suse installs natively on this machine.
Thursday, January 11, 2007
Tell HP Your Opinion
Over the last two years or so, I have switched from using Dell computers to HP, mainly because I was interested in 64-bit computing, and for a while Dell did not sell any computers with AMD64 chips. They seem to have shifted away from the Intel-only policy but as far as I am concerned, it is too late.
Besides, I like the sturdiness of HP machines better (I own an Pavilion desktop and a DV6000z laptop). Great hardware.
They also work great with Linux, which brings me to the point of this post. We do not use Windows at home, yet anytime I buy a new machine, I have to pay for Winblows. There's no way to find a bare-bones HP machine. I sent them an email to express my frustration, and I invite you to do the same.
They are already being sued in Europe (http://www.itworld.com/Comp/1214/061215frenchhp/) and I hope it sends them the right signal.
Over the last two years or so, I have switched from using Dell computers to HP, mainly because I was interested in 64-bit computing, and for a while Dell did not sell any computers with AMD64 chips. They seem to have shifted away from the Intel-only policy but as far as I am concerned, it is too late.
Besides, I like the sturdiness of HP machines better (I own an Pavilion desktop and a DV6000z laptop). Great hardware.
They also work great with Linux, which brings me to the point of this post. We do not use Windows at home, yet anytime I buy a new machine, I have to pay for Winblows. There's no way to find a bare-bones HP machine. I sent them an email to express my frustration, and I invite you to do the same.
They are already being sued in Europe (http://www.itworld.com/Comp/1214/061215frenchhp/) and I hope it sends them the right signal.
Wednesday, January 10, 2007
Counting Bits
This code is a solution to the problem of counting the "1" bits in a variable of integral type. It uses recursive templates to generate a table of precalculated values for 0 through 255, then breaks the input value into bytes that are looked up into the table:
This code is a solution to the problem of counting the "1" bits in a variable of integral type. It uses recursive templates to generate a table of precalculated values for 0 through 255, then breaks the input value into bytes that are looked up into the table:
#include <cassert>
#include <cstdlib>
// Recursive template, computes the number of bits set
// in an integer (e.q. Bits<127>::count == 7)
template<int N>
struct Bits
{
static const unsigned count = (N & 1) + Bits<(N >> 1)>::count;
};
template<> struct Bits<0>
{
static const unsigned count = 0;
};
// This template recursively generates a constructor
// that will populate a table of 256 entries
template<int N>
struct Table : public Table<N - 1>
{
Table<N>()
{
this->bitcount_[N - 1] = Bits<N - 1>::count;
}
};
template<> struct Table<0>
{
unsigned bitcount_[256];
};
static const size_t BYTE_SIZE = 8;
static Table<256> table;
template<typename T>
unsigned count_bits(T value)
{
size_t result = 0;
for (size_t i = 0;
value && (i != sizeof(T));
++i, value >>= BYTE_SIZE)
{
result += table.bitcount_[value & 0xff];
}
return result;
}
unsigned count_bits(unsigned char value)
{
return table.bitcount_[value];
}
unsigned count_bits(char value)
{
return count_bits(static_cast<unsigned char>(value));
}
// test
int main()
{
assert(Bits<127>::count == 7);
assert(count_bits(0) == 0);
assert(count_bits(1) == 1);
assert(count_bits(-1) == 32);
assert(count_bits((char)-1) == 8);
assert(count_bits(3) == 2);
assert(count_bits(127) == 7);
assert(count_bits(1023) == 10);
assert(count_bits(1025) == 2);
return 0;
}
Monday, January 08, 2007
Zero Debugger News
The latest version of the Zero Debugger includes fixes for a couple of bugs reported by Christoph Borgolte (thank you, sir) and optimizations of the memory usage in symbol tables.
I have also played some more with the graphical installer script for Redhat 9 / RHEL (see installer.py in http://zero-bugs.com/8001/builds/zero-i686.010807.tgz).
Santa brought a license of the Intel Compiler 9.1, so I ran the test suite with it. The results are very satisfactory: Zero Debugger works great on binaries compiled with icc! The only (minor) quirk I found so far is with functions returning long double on the x86_64 platform, which require a special compiler command line flag to work correctly.
Thursday, December 21, 2006
UI Python Source for ZeroBugs Opened
As the song goes, when I was younger, so much younger than today...
But that was in the 90s. Today, as somewhat hinted by one of the Mac commercials, C++ GUI Programming is boring, unproductive and uncool. Using a scripting language like Python for UI development gets the job done faster.
But C++/Python hybrid programming is fucking awesome. And hybrid is the mantra of the decade.
This is the project that I was talking about in an older post, "Protoyping with Python".
Download the code archive here.
Why did I chose Python as the scripting language for ZeroBugs? My first thought was to use a well-known, popular language, and what won me over was the boost python library, which makes integration with C++ a breeze. The documentation at boost.org is very clear and easy to follow. By contrast, SWIG is a pig.
[...] I found my code in tons of trouble,
Friends and colleagues came to me,
Speaking words of wisdom:
"Write in C."
But that was in the 90s. Today, as somewhat hinted by one of the Mac commercials, C++ GUI Programming is boring, unproductive and uncool. Using a scripting language like Python for UI development gets the job done faster.
But C++/Python hybrid programming is fucking awesome. And hybrid is the mantra of the decade.
This is the project that I was talking about in an older post, "Protoyping with Python".
Download the code archive here.
Why did I chose Python as the scripting language for ZeroBugs? My first thought was to use a well-known, popular language, and what won me over was the boost python library, which makes integration with C++ a breeze. The documentation at boost.org is very clear and easy to follow. By contrast, SWIG is a pig.
Wednesday, November 22, 2006
Why Open Source Does Not Work (For Me)
When freedom is compulsory, can it still be called freedom?(anonymous ftp)
While I can't help applauding some practical consequences of the Open Source movement, I find the ideology behind it rather scatological.
As it stands, there is balance in the force. But not necessarily due to the quality of say, ahem, Linux, but thanks rather to the suckiness of some of the non-Open Source players. Apple stands proof that brilliant products are indeed possible in the world of proprietary designs.
I enjoy writing software and I take pride in my work. I am most happy when my code helps people solving practical problems. But I also enjoy getting paid for my work, at the fair market rate.
Yet the collaborative model of Open Source is effective. When people work together, they tend to become a distributed system with tolerance to faults, and with opportunities for major fun. What lacks is the opportunity (for the worker bees) to make a major buck. Once the Source goes Open it somewhat starts attracting more dung flies than worker bees.
What I would love to see is a system where people have fun building a cathedral right next to the bazaar.
The two-digit IQ-ers (merchants, thieves, and bums that frequent the bazaar) have to pay to enter the cathedral, and cathedral builders share the profits (which may be monetary or otherwise, as some may chose to contribute for good karma or posthumous glory, and have their source code shine in its eternal simplicity and elegance).
How can we achieve a development model that accommodates a pragmatic mix of open and closed source, thus satisfying the individual needs of the people involved?
There are technical and non-technical options. The possible non-technical include:
- have all contributors adhere to a honor system (weak, because we all know how human nature works);
- have everybody sign NDA-s and contracts (may quickly degenerate into "my lawyers against their lawyers" situations);
- have someone of good morals and notorious character appointed (elected?) leader, arbiter, gatekeeper and distributor of profits, after careful weighing every body's contribution (yeah right, look at our elected leaders).
The major challenge for this approach of mixing and matching open and closed modules is the lack of binary standards in environments such as C++ (the Itanium ABI is still young) and Linux. This fluidity is purposely perpetrated by Linux and GCC, and even enforced by the LGPL that prevents statical linkage as a workaround for runtime "platforms" that are as stable as quicksand.
In a future installment, I will go over my attempts to create a platform that allows a mix of open source and closed IP within the same project, when I started the Zero Debugger project.
Tuesday, November 14, 2006
Saturday, November 04, 2006
Clever Design or Fancy Hack? You Decide.
When I started designing the Zero Debugger Engine a couple of years ago, I also slapped together a Gtk-based user interface plugin. The engine has an API for extending the debugger with plugins.
The purpose of my UI plugin was to drive the design of the API that the engine should expose. It was intended to be a throw away. There wasn't much design behind the UI, I thought of it more in terms of a test bed than even a prototype.
Yet as it happens so many many times in software (and in life), at some point I got stuck with it. Once I was ok with the engine API, I should've started working on the "real" UI plugin. Clean room design, right?
In the process of developing the engine and its C++ API which I dubbed the Zero Development Kit, it became evident that for some simple customizations C++ was overkill, and a scripted language API would be easier and more intuitive for most users. With this idea in mind, and with all the lessons learned from the "mock" UI, I started drafting a design of a Python-written UI.
But because Zero is my witching hours project, and most of the time I get distracted by annoying things such as having a day job, the Python UI had not seen the light of day until the last few months (see my previous post).
Meanwhile it was essential for the debugger to have an UI, to appeal to users as an interesting proposition... So the "throw away" UI project outlived its initial scope. But there was a problem:
The C++ written UI was based on gtk-- 1.2 (the ancestor of Gtkmm, a C++ wrapper for the Gtk library). I should've started with the newer technology, Gtkmm 2.x, but I was hoping to get someone interested in a business proposition, and their company was running on RedHat 7. But I also needed to show something that worked on the more modern Linux distros.
To cut to the chase, I decided to write some adaptation layers so that my initial code would compile both on gtk-- and Gtkmm. For classes such as Gtk::CTree, that have been completely replaced with Gtk::TreeView, Gtk::TreeModel and such, I just created a minimal implementation of CTree.
But there are also classes that have retained most of their interface in between the 1.2 and 2.x versions of the Gtkmm, give or take a couple of deprecated methods and some new ones. For example: the Gtk::Notebook class has a new family of overloaded methods, append_page. Concise and self-documenting, they allow one to write code such as:
To achieve the same effect in the old code I had to say:
Very verbose, and the simple intent to append a page with a given tab label text kind of gets lost...
The new append_page method can be implemented in the terms of the older API, like this:
Now only if I could replace Gtk::Notebook with Notebook_Adapt in the gtkmm 1.2 compilation... and here's where the hack comes in: Notebook_Adapt does not add any member data to the Gtk::Notebook, just non-virtual methods. So a Notebook_Adapt class instance could be overlayed on existing Notebook instances, hmmm.
Enter the adapting pointer:
Armed with this template, and a..., yuck, yeah, some precompiler help, I can now say:
Inside of the class above, calls to:
now compile (i.e. are source-level compatible) with either gtk-- 1.2 or Gtkmm 2.x
Voila.
When I started designing the Zero Debugger Engine a couple of years ago, I also slapped together a Gtk-based user interface plugin. The engine has an API for extending the debugger with plugins.
The purpose of my UI plugin was to drive the design of the API that the engine should expose. It was intended to be a throw away. There wasn't much design behind the UI, I thought of it more in terms of a test bed than even a prototype.
Yet as it happens so many many times in software (and in life), at some point I got stuck with it. Once I was ok with the engine API, I should've started working on the "real" UI plugin. Clean room design, right?
In the process of developing the engine and its C++ API which I dubbed the Zero Development Kit, it became evident that for some simple customizations C++ was overkill, and a scripted language API would be easier and more intuitive for most users. With this idea in mind, and with all the lessons learned from the "mock" UI, I started drafting a design of a Python-written UI.
But because Zero is my witching hours project, and most of the time I get distracted by annoying things such as having a day job, the Python UI had not seen the light of day until the last few months (see my previous post).
Meanwhile it was essential for the debugger to have an UI, to appeal to users as an interesting proposition... So the "throw away" UI project outlived its initial scope. But there was a problem:
The C++ written UI was based on gtk-- 1.2 (the ancestor of Gtkmm, a C++ wrapper for the Gtk library). I should've started with the newer technology, Gtkmm 2.x, but I was hoping to get someone interested in a business proposition, and their company was running on RedHat 7. But I also needed to show something that worked on the more modern Linux distros.
To cut to the chase, I decided to write some adaptation layers so that my initial code would compile both on gtk-- and Gtkmm. For classes such as Gtk::CTree, that have been completely replaced with Gtk::TreeView, Gtk::TreeModel and such, I just created a minimal implementation of CTree.
But there are also classes that have retained most of their interface in between the 1.2 and 2.x versions of the Gtkmm, give or take a couple of deprecated methods and some new ones. For example: the Gtk::Notebook class has a new family of overloaded methods, append_page. Concise and self-documenting, they allow one to write code such as:
void TabLayoutStrategy::add_registers_view(Widget& w)
{
rightBook_->append_page(w, "Registers");
}
To achieve the same effect in the old code I had to say:
void TabLayoutStrategy::add_registers_view(Widget& w)
{
rightBook_->pages().add(w);
rightBook_->pages().back()->set_tab_text("Registers");
}
Very verbose, and the simple intent to append a page with a given tab label text kind of gets lost...
The new append_page method can be implemented in the terms of the older API, like this:
struct Notebook_Adapt : public Gtk::Notebook
{
void append_page(Gtk::Widget& w, const Gtk::nstring& text)
{
this->add(w);
this->pages().back()->set_tab_text(text);
}
// ...
};
Now only if I could replace Gtk::Notebook with Notebook_Adapt in the gtkmm 1.2 compilation... and here's where the hack comes in: Notebook_Adapt does not add any member data to the Gtk::Notebook, just non-virtual methods. So a Notebook_Adapt class instance could be overlayed on existing Notebook instances, hmmm.
Enter the adapting pointer:
template<typename S, typename T >
class APtr
{
S* p_;
public:
explicit APtr(S* p) : p_(p) { }
T* operator->() const
{
BOOST_STATIC_ASSERT(sizeof(S) == sizeof(T));
return static_cast(p_);
}
S& operator*() { assert(p_); return *p_; }
const S& operator*() const { assert(p_); return *p_; }
operator const void*() const { return p_; }
};
Armed with this template, and a..., yuck, yeah, some precompiler help, I can now say:
#ifdef GTKMM_2
typedef Gtk::Notebook* NotebookPtr;
#else
typedef APtr NotebookPtr;
#endif
//
// ...
//
class TabLayoutStrategy : public LayoutStrategy
{
// ...
// ...
private:
// old:
// Gtk::Notebook* rightBook_;
// replaced with:
NotebookPtr rightBook_;
};
Inside of the class above, calls to:
rightBook_->append_page(widget, labelText);
now compile (i.e. are source-level compatible) with either gtk-- 1.2 or Gtkmm 2.x
Voila.
Sunday, October 29, 2006
Prototyping with Python

This is the new look and feel of the Zero Debugger User Interface that I was talking about in my previous post. I like the idea of having more "real estate" for the source code window.
The prototype is written using Glade and Python, which allow for rapid development, taking advantage of the PythonGate plugin that exposes the Zero API to Python.
Drop me a message if you would like to try out the Python code for yourself, I'll email it to you!
I finally got around to installing the i386 version Fedora 6, and building Zero on it. In the process, I figured out that a while ago I made an incorrect assumption about the CLONE and FORK events as reported by ptrace... Consequently Zero happened to hang (depending on the kernel version) while debugging multi-threaded programs, or code that called fork(). The problem is now fixed I will be rolling it out over the next couple of days.
I have fixed one bug reported by Marco Bacchetta (a "virtual dso read" error message popped up right at the beginning of the debugging session).
Also fixed a bug in processing command line arguments, and another one dealing with anonymous structs, both reported by Massimiliano Pagani. L'Italia è campione del Mondo!
And squashed a problem with detecting signal handler trampolines, when handler was being installed by sigaction().
I have fixed one bug reported by Marco Bacchetta (a "virtual dso read" error message popped up right at the beginning of the debugging session).
Also fixed a bug in processing command line arguments, and another one dealing with anonymous structs, both reported by Massimiliano Pagani. L'Italia è campione del Mondo!
And squashed a problem with detecting signal handler trampolines, when handler was being installed by sigaction().
Saturday, July 15, 2006
After a few frantic nights of debugging the debugger, I think I have a stable version again... (there are a few minor issues still, but no show stopper that I know of). Sheesh.
As I was cleaning up some code, I came upon a few warnings, where signed values are compared against unsigned. The types are well chosen IMHO, for example in one case the unsigned is a memory address, and the signed is a relative offset (which may be negative). The assertions are more informative than anything else. The code is prepared to deal with the case when the assertion fails, I am just curious to see whether my assumption that a given condition should never happen is correct (and it's not the end of the world if it isn't). I would call this a soft assert in case the term is not coined already.
Here's the code I came up with, that silences down the compiler warnings about signed vs. unsigned, and throws an exception rather than calling
Oh, and the
Specializing the templates for double and float is left as an exercise for the reader.
As I was cleaning up some code, I came upon a few warnings, where signed values are compared against unsigned. The types are well chosen IMHO, for example in one case the unsigned is a memory address, and the signed is a relative offset (which may be negative). The assertions are more informative than anything else. The code is prepared to deal with the case when the assertion fails, I am just curious to see whether my assumption that a given condition should never happen is correct (and it's not the end of the world if it isn't). I would call this a soft assert in case the term is not coined already.
Here's the code I came up with, that silences down the compiler warnings about signed vs. unsigned, and throws an exception rather than calling
abort on failure.
#include <assert.h>
#include <limits>
#include <stdexcept>
#include <boost/format.hpp>
class assert_error : public std::logic_error
{
public:
assert_error(const char* file, size_t line)
: std::logic_error((boost::format(
"Assertion failed at: %1%:%2%") % file % line).str())
{ }
};
// Assert functions that avoid the signed vs. unsigned compiler warnings.
namespace detail
{
template<typename T, typename U, int>
struct numeric_assert
{
static bool gt(T lhs, U rhs) { return(lhs > rhs); }
static bool eq(T lhs, U rhs) { return(lhs == rhs); }
};
template<typename T, typename U>
struct numeric_assert<T, U, 1>
{
static bool gt(T lhs, U rhs)
{ return((lhs >= 0) && (static_cast<U>(lhs) > rhs)); }
static bool eq(T lhs, U rhs)
{ return((rhs >= 0) && (rhs == static_cast<U>(lhs))); }
};
template<typename T, typename U>
struct numeric_assert<T, U, -1>
{
static bool gt(T lhs, U rhs)
{ return((rhs < 0) || (lhs > static_cast<T>(rhs))); }
static bool eq(T lhs, U rhs)
{ return((rhs >= 0) && (lhs == static_cast<T>(rhs))); }
};
}
template<typename T, typename U>
void __assert_gt(T lhs, U rhs, const char* file, size_t line)
{
typedef detail::numeric_assert<T, U,
std::numeric_limits<T>::is_signed -
std::numeric_limits<U>::is_signed> Assert;
if (!Assert::gt(lhs, rhs))
{
throw assert_error(file, line);
}
}
template<typename T, typename U>
void __assert_eq(T lhs, U rhs, const char* file, size_t line)
{
typedef detail::numeric_assert<T, U,
std::numeric_limits<T>::is_signed -
std::numeric_limits<U>::is_signed> Assert;
if (!Assert::eq(lhs, rhs))
{
throw assert_error(file, line);
}
}
#define assert_gt(x,y) __assert_gt((x), (y), __FILE__, __LINE__)
#define assert_eq(x,y) __assert_eq((x), (y), __FILE__, __LINE__)
Oh, and the
sed command I was talking about the other day is:
sed -e 's/</\</g; s/>/\>/g'
Specializing the templates for double and float is left as an exercise for the reader.
Monday, July 10, 2006
Oops. Found quite a few issues with the Zero UI. The builds that I posted on my site on July 8th have a few known issues. Nobody has complained yet, though.
Anyway, here's a piece of code that I wrote in the process of fixing things.
Note to self: write a sed script for "fixing" templates and pointers in code snippets posted on this blog.
Second note to self: make a custom T-shirt on Zazzle, printed with said sed script.
Anyway, here's a piece of code that I wrote in the process of fixing things.
/**
* Pick the first available monospace font in a widget's
* Pango context
*/
bool
get_monospace_font(Pango::FontDescription& font, Gtk::Widget& w)
{
bool success = false;
if (Glib::RefPtr<Pango::Context> ctxt = w.get_pango_context())
{
Glib::ArrayHandle<Glib::RefPtr<Pango::FontFamily> > ff =
ctxt->list_families();
Glib::ArrayHandle<Glib::RefPtr<
Pango::FontFamily> >::const_iterator
i = ff.begin(), end = ff.end();
for (; i != end; ++i)
{
if ((*i)->is_monospace())
{
font = Pango::FontDescription((*i)->get_name());
w.ensure_style();
if (Glib::RefPtr <Gtk::Style> style = w.get_style())
{
font.merge(style->get_font(), false);
}
if (Glib::RefPtr<Pango::Font> f = ctxt->load_font(font))
{
font = f->describe();
}
success = true;
break;
}
}
}
return success;
}
Note to self: write a sed script for "fixing" templates and pointers in code snippets posted on this blog.
Second note to self: make a custom T-shirt on Zazzle, printed with said sed script.
Friday, July 07, 2006
ZeroBugs' New Look

I am experimenting with the UI for the Zero debugger (www.zero-bugs.com) The new look and feel allows for several source files / disassembly views. This should alleviate the screen flickering that I have previously experienced with the gtksourceviewmm widget.
Subscribe to:
Posts (Atom)