Speaking of programs that only work on the computer you wrote it on, if your Delphi program is like the picture — the right side of the form can’t be seen — the program is probably running on a Windows system where the fonts are set to “large” (right-click the desktop / properties / settings / advanced — at least W98 2ED) — and of course it was written on a normal decent “small fonts” system. After confusing myself with endless agonizing I found on the web, it fixed itself when I set the form’s autoscroll property to false. That’s it. ... If you actually want autoscroll, all that seemed to require was setting it back to true in the form’s OnCreate event. This is really too stupid to think about — but I did, for hours and hours....
... And then recently, as I toiled on my endless OwenShow — the exact same bug occurred in Linux! ... How’s that for cross-platform stupidity!
— Monday, August 1, 2005 8:15 pm
Print publications have come upon hard times, particularly computer mags, and Dr. Dobbs is no exception — they’ve come on such hard times, they can’t afford a letters page!
... I, on the other hand, have derived immense enjoyment over the years shooting-off cranky letters to the editor, particularly to technical magazines. So to satisfy these mutual unmet needs, I inaugurate my own private Dr Dobbs letter to the editor section....
A Single Letter on the Letters Page
Well as it turned-out, this was the only Dobbs’ letter-to-the-editor I felt moved to document, I can’t imagine why, but the subject turned-out to require another imaginary letter, for a surprise ending....
And Then Again....
In the 11/07 issue, the editor explained how vicious fascist Republican capitalists were responsible for Wikipedia vandalism — “we know now why university professors don’t encourage its use as a valid bibliographic source” — and it occurred to me, perhaps they want to encourage us to go to their pitiful web “presence”? ... I mean, it’s obviously inflammatory as well as stupid, and the normal reason for doing this — I mean aside from the pitiful progressive cri de coeur — is to stir-up debate, controversy, response. ... But no; it’s just the poor editor’s brain flying to pieces; there’s no prominent box or something with their web page or anything....
Microsoft’s “program manager on the CLR team” contends that “generally speaking, any data- or compute-intensive tasks should be done on a separate thread, even if that incurs overhead for worker synchronization”. The article does not discuss the typical order-of-magnitude increase in debugging difficulties that attends multiple thread use.
MY CRANKY LETTER TO THE LETTERS-PAGELESS DR DOBBS
1. If you are doing compute-intensive tasks, one obvious way to avoid slowdown is not to use an interpreted environment like NET.
2. In Delphi, there’s “Application.ProcessMessages” which one can call now and then so the user can click a cancel button and/or see the progress bar update etc.; I assume NET has something comparable. I fail to see how spawning another thread to do the compute-intensive task would improve this situation much.
That is, programming magazines and environment vendors may find it fun and profitable to cook-up reasons for more threads, but the practice is still unsavory and, in many typical suggested cases — i.e., NET — silly.
Obviously there are occasions for multitasking — operating systems, say — but I have yet to be convinced that the execution of these kind of activities in complicated object-oriented environments is much of an improvement over simpler C-language constructs — or assembly language, for that matter.
— Monday, September 25, 2006 3:34 pm
P.S. (10/4/06) Apparently I have been parroting John Ousterhout’s 1996 (!) Usenix presentation Why Threads are a Bad Idea (for most purposes). ... Of course, that was before computer scientists discovered NET....
There, I feel so much better. ... Although perhaps it’s fortunate I’m the only one who reads this site....
But loyal readers of these pages will be gratified to know there probably is a reason for Microsoft’s strange desires, also revealing the puerility of my imaginary letter. Which is that Moore’s Law is feeling poorly, and the only way the software industry — Microsoft, approximately — can get back on top is to multi-process the heck out of stuff! ... But it’s hard to multi-process with a single thread, hence the friendly monopoly’s advice as above.
See, one of the reasons we were going to learn to love NET and its scripty ways was because every year in every way, or about every 18 months, computers would get twice as fast as per Moore’s law. I’d guess Microsoft was counting on this, or at least the small-country-sized section of Microsoft in charge of NET was. ... But it didn’t happen! Moore’s law got sick! ... So if your NET thing is ever going to be more sprightly than GWbasic, you gotta multi-task, and then everything will be new and glistening and much faster than GWbasic!
But then again, Microsoft might be able to multi-task your single-threaded program if you happened to write it in SQL. ... And I very much suspect this is the plot behind the newly-introduced LINQ feature, where you can stuff SQL-like statements right into your C# scripts — which I must say, struck me as odder than the usual Microsoft standard when I first learned of its approach. ... But as explained in Parallel LINQ: Running Queries on Multi-Core Processors, p 70, MSDN Mag, 10/07, any day now those queries’ll easily run in parallel you lucky scripters, and perhaps ameliorate the Moore’s-lawless pokiness of your C# and VB code — and so all is revealed! ... It appears the approximate plan today is to enhance/convert the cavorting CLR languages into declarative-type SQL-like things, and the many processors in your box will race away with the logic and all will be for the best....
Davey is deputized to announce the obvious:
The general message coming from Microsoft is:
Then he proceeds to pontificate on the endless elaboration of NET LINQ etc. features and the consequent glorious rewards thereof; particularly if somehow we can get hold-of giant cluster-scale versions of these earth-shaking technologies.
MY SECOND CRANKY LETTER TO THE LETTERS-PAGELESS DR DOBBS
I’m glad even at this late date you’ve finally come-around to admitting the obvious. I mean, it’s certainly taken you a while, since the ancient times I announced all these things above (and elsewhere). ... Although I notice you still hedge your bets by claiming this amazing breaking news comes from Microsoft, and the pure Dr. Dobbs doesn’t necessarily concur in these astonishing revelations. ... But the only really intriguing question is, why the assiduous cover-ups and lying all these years? I mean, aside from the obvious sheer fun of making stuff up in the pages of the remaining dying computer magazines?...
Owen’s insightful opinion: a dark fearsome nullity faced industry insiders (and outsiders, for that matter): we suspected Moore’s law was a-trembling on the cliff, but some of us couldn’t get past the denial stage. ... On the other hand, a deus ex machina like a supposed physical law has its attractions, certainly in comparison to the obvious reality — that the buggy-whip industry was finished. ... Because it’s apparent that even before Moore’s law got so cranky, the marvelous menagerie of microcomputers was headed south. ... I.e., the day of the dot-com crash still had a few years of increasing computer performance ahead, before the tragic ramifications of too much heat and too little physics caught up with us; but that still-increasing performance was not accompanied by any particular recovery of industry activity or, crucially, employment. ... And the computer magazines kept dying....
So while I appreciate your admitting the truth belatedly in an obscure column — well, sadly, everything in Dobbs is obscure in these latter days — it would have been more fun if you could have done it while your magazine was still printed on real paper, instead of this strange flimsy plastic stuff; or, better yet, when you still printed letters.
A Final Validation
And then @ 11/13/16 the revered slashdot posted a “Here Be Dragons: The Seven Most Vexing Problems In Programming” from an Infoworld article with this:
Multithreading. “It sounded like a good idea,” according to the article, but it just leads to a myriad of thread-managing tools, and “When they don’t work, it’s pure chaos. The data doesn’t make sense. The columns don’t add up. Money disappears from accounts with a poof. It’s all bits in memory. And good luck trying to pin down any of it...”
And there you have it; confirmation of my simple observations of years past....
Among other tantalizing treasures, Microsoft’s NET environment/religion provides EZ Windows forms composition — i.e. a GUIRAD, q.v. ... Like Microsoft’s Visual Basic did years ago; the distinction between Microsoft’s products and Borland/Codegear’s (also GUIRAD) Delphi and C++Builder was that the latter are compiled (fast) languages, while Microsoft, from the old Visual Basic to all today’s NET languages, is interpreted (generally accompanied by hypey and imaginative sentiments about how fast interpretation can be under proper planet alignment). ... Except for Microsoft’s unmanaged C++ flavor, which is available by specifying “#pragma unmanaged” in your VS2005 C++ source (or by setting the entire project to “no CLR”).
Nishant Sivakumar wrote a lovely book “C++/CLI In Action” all about Visual Studio 2005 and C++, and how it can help you resurrect tired old C/C++ code, especially the tired old MFC variety. ... I must admit I thought the book was about interoperating managed and unmanaged C++. ... But as I got within shouting distance of the end, I noticed that he hadn’t shown me what I had innocently imagined to be the piece de resistance: a winforms application that worked with unmanaged C++. ... As I finally realized, that would be because
You may wonder how I can make such an assertion after the thoughtful Sivakumar wrote an entire book about NET and C++, and of course I may be wrong since no technical source including Sivakumar and Microsoft ever admits what can’t be done with a product. ... But I’m probably right because (1.) Sivakumar never gets around to it and (2.) I tried.
How to Compile Unmanaged Code with Windows Forms — and Crash
I wrote a Macintosh program mostly in C++ code + Xcode Objective-C++ for the Mac GUI; the plot was to perform a similar underhanded trick with NET winforms code and the same C++ guts. ... Sadly it was not to be; the following steps produced a winforms C++ project which crashes before it gets to main, with a “failed assertion”, “_CrtIsValidHeapPointer(pUserData)”:
... Casual googling suggests that the _CrtIsValidHeapPointer assertion failure is something that just happens when the code is rotting in the darkness but no one really knows why. ... And apparently “Crt” is supposed to signify “C run time”, not Cathode Ray Tube....
Please understand, VS2005 can compile average C++ programs to 80x86 binary executables just as good as it ever did. ... The magic and mystery department is the combination of NET C++ and binary-compiled C++ aka “unmanaged”....
Sure, I can compile a managed version of my test program — with /clr:pure and without the #pragma unmanageds — which doesn’t crash.
But what’s the point? Why would we do this? ... For the Macintosh, the Objective-C/C++ approach makes sense for new software, as you get real compilation + the pool of skilled professionals like myself who know C++. ... A NET/C++ scheme makes sense C++ expertise-wise, but doesn’t provide real compilation; and both features are probably still available with Borland’s C++Builder....
So NET/C++ probably doesn’t make sense for new products; even the straggling hordes of MFC code might still be supported by C++Builder, although VS2005 MFC has a few special NET features (see the book).
Must You Be So Negative, Owen?!
Well I would suggest that if for whatever reason you must contrive NET software, the C++ flavor might be good. ... There’s even a “/clr:safe” setting which restricts you to CLR types but still with C++ syntax (+ a few odd magic words to be sure). For some organizations this could be an attractive alternative to C# or VB, the other two major flavors....
... OK OK the cries of the multitudes have persuaded me; here is upw.zip which will flawlessly compile in Visual Studio 2005 (double-click “upw.sln”) to a program which doesn’t do anything — I stopped after I managed to load the encrypted records’ titles into the list box as beautifully suggested above but you’ll only get the single default record — but it doesn’t crash! — at least until you set it to “/clr” and uncomment the #pragma in managed.h....
the obviously confused programmer
1. I believe many Windows projects wouldn’t be adversely affected by the interpreted slow-down of NET C++; some might, however, and it’s one less thing to worry about. ... Also I assume that most prospective project-creators would still prefer to use native compilation rather than the NET interpreter, no matter how wonderful Microsoft says it is.
3. Well I found at least one annoying bug without really trying that hard: in /clr, the VS2005 debugger doesn’t properly render values of any globals. ... Which does suggest that any serious investigation is likely to turn-up more parts on order....
My late departed appliance, living-on for a little while in the frozen North after I escaped to a better life. ... It has a microprocessor. Very very advanced. So naturally it has a snit mode: it will refuse to wash, light odd lights, and never say why. My brilliant technical assistant here figured out that if we turn the child lock feature on and then off, it would condescend to start (this has worked twice now 6/26/2001 11:43 am [tuesday]). It might be something to do with the little detergent door being opened. I mean, who knows? ... The really stupid thing is it won’t tell you; it just sits there with all these dumb LEDs on saying nothing. Why didn’t they skip that stupid LED that begs for more rinse-aid, and instead have a “trouble” LED? The caption would say, “trouble: check manual”. And the helpful manual would tell you to examine the other LEDs, and have a chart showing you how to interpret them when the trouble LED is on. ... But no of course that would be too smart.
Another charmer is that when the GFI (ground fault interrupter) that the thing is typically plugged-into goes off in a lightning storm, the script-reading morons at their 800 number didn’t know about it. We had scheduled a service call before I figured that out. (The dishwasher is attached to a GFI, which are outlets with red and black buttons on them that have been installed in kitchens/bathrooms in homes built over the last few decades. The thing goes off when a shock threat is sensed, and then you have to press one of the buttons to make it work again. Of course, you can’t see the dishwasher is attached to it; that’s done behind the wall and I forgot everything.)
In a shower head of course. There have been reports of fellows who carry a kit with them and do this to motels but I have no such ambitions: if the motels want to provide three-drops every 15 minutes and pretend it’s for the children, fine. ... But I do want my dwelling places to provide actual showers, and the communist tyranny now allows shower heads to be sold only with “water misers” installed.
So naturally we have to uninstall them. I have to say over the years it does seem to be getting harder. I will only hint here at what I think is a likely procedure:
Might work. ... It kinda worked this time....
When I was a feckless youth, I got in the habit of updating Apple operating systems when they were free, because I, to a regrettable extent, bought the uplifting notion that Apple was different and wouldn’t try to screw me, at least not so hard as Usux™. ... Foolish geezer!...
But now I know that the only reason a profit-making company gives away software is to make money. It’s not a bad thing; lying about it is probably morally corrupt, but doing it isn’t. ... Whatever; I can say with fair certainty that the last 37 OSX/iOS upgrades have not been particularly-helpful, providing no features I was deeply lusting after. Indeed, in most cases even ’though the flatulently-suck-up magazines and web sites’d would puff the bee-jeezus for the cause, the upgrades were mostly unnoticeable....
Except, of course, the afflicted machine would run slower. ... Amazing how consistent that is, eh?
And now Usux™ has joined the “free” upgrade frolics. ... Over the weary years, new Usux™ OSs always made the hardware run slower — not of course because of any restraint-of-trade conspiracy between Usux™ and the hardware manufacturers. ... Now that they’re givin’ ’em away, whaddya think? ... I had already concluded it was folly to pay for a Usux™ Windows upgrade. If so, how foolish to take it for free? ... Really the lingering “get windows 10” spam icon tells me all I need to know.
With Apple, I’ve found the annoyanceware icon can be dismissed, at least this last time, by clicking, and then refusing the ridiculous terms in that endless 237-page document they want you to accept....
But of course, as the giant never-restrain-trade-what-R-U-thinking monopolies try to force system software on us, there will also, inevitably, be intentional bugs. ... No incriminating emails necessary — all software is buggy, and all one has to do is leave one or two annoying things, perhaps even stuff that’ll work so much better on the latest/greatest hardware — just leave ’em in, until the next update, or who knows when ... by “accident”. ... It’s so EZ!
... So I sullenly updated my hand-me-down iPhone 5, in hopes that the every 15-minutes touch freezes would abate (didn’t; turned-out phone was broke). But before I updated my pitiful antediluvian iPad 2 — whose role in life seems to be providing me with random factoids as I loll-about on the couch, for which usage the execrable Safari hangs-up at every other page — I realized, why not use Chrome instead?!?!? ... But it was worse....
... But then ...
Of course, the ipad chrome was even worse, and so I updated in the end. I haven’t the strength of character to deny them. And the performance didn’t deteriorate, noticeably, at least this time, with the iThings. ... Didn’t get any better of course....
One tremendous advantage of my antique iphone 4 is that it won’t upgrade to iOS 9; it has fallen too far behind the herd, they shun it now. And also — it’s significantly smaller than the ever-enlarging modérne iphones. A Mac|Life magazine letter begged for a new iphone that was as small as the version five! Another victory for obsolescence. ... And I believe Apple has responded!
... And indeed, an iOS 9 iPhone 5 we’ve been beating back to functionality has a new trick: it requested “Apple id verification” in the locked screen. Which, no doubt, would open one’s beautiful wonderful everybody-must-love-it-since-we-have-to-trick-everyone-into-using-it iCloud access....
The Walking Dead
But in my pitiful blissful days, as the Ibi wander my lawn in paradise, I can see two derelict computers next to each other, with the moribund mac iMini (c. 2011 & >2 years old) pestering me about logging onto the iCloud everybody loves, and the broken HP Windows laptop upon which I play beautiful background music, advising me how everybody loves Windows 10 — get it now! ... Remorselessly, I crushed the Windows pester; I never spent enough time with the Mac to learn how to do that there. ... Right and I could’ve put my iphone 5 next to it, begging for the all-important “Apple ID Verification” which, while of course I haven’t tried, I assume sneaks you into the precious beloved incredibly-popular iClod....
Tue 12/22/15 7:28 am. And then Apple must’ve tricked me into updating the iMini in a moment of weakness — well, no, it must’ve done it without asking, and without me accepting the holy conditions! — and now it takes 5 minutes to boot — the boot ritual for the rest of us, at least us sluggards who refuse to keep up and buy new hardware but nevertheless foolishly update our software. ... And then it died....