If there is one thing that no two Operating Systems can seem to agree on, it’s how best to store configuration information. Linux programs generally store their configuration in .config files, which have a, ironically enough, “proprietary” text format (that is, program A’s config file will be unlikely to follow the same conventions as program B’s, and so forth). For Windows, there are a lot of options to choose from. the earliest model was a INI, or initialization file; an INI file was laid out something like this:
[sectionname]
valuename=value
valuename2=value2
[nextsection]
morevalues=moreitems
evenmorevalues=evenmoredata
Basically, it consisted of a set of “Sections” (the text in square brackets) each of which contained values (the name/value pairs within).
The two “private” variants of this Kernel32 function almost always appear in programming-oriented discussions about INI files, but the former two have been lost in time.
the “INI” file structure was essentially “standardized” as far as windows applications were concerned with Windows 3.0. This was more a de facto, rather then a de juere standard, because the win.ini, system.ini, and various other Windows system based “ini” files used that form. Windows 3.0 offered the WriteProfileString and ReadProfileString functions. These functions are still present, even in the windows 7 Version of kernel32.dll:
C:\Windows\System32>dumpbin /exports kernel32.dll | find "ProfileString"
579 241 0001E6A7 GetPrivateProfileStringA
580 242 0003018B GetPrivateProfileStringW
606 25C 00032B13 GetProfileStringA
607 25D 00031E72 GetProfileStringW
1323 52A 00033FB8 WritePrivateProfileStringA
1324 52B 000335CA WritePrivateProfileStringW
1330 531 0008A982 WriteProfileStringA
1331 532 00033669 WriteProfileStringW
the non- “private” versions of these functions were pretty similar; there were also variations that allowed for writing/reading directly from integers as well as entire structures. Windows 3.0 only had the “non” private versions- and they all dealt exclusively with win.ini.
So, using WriteProfileString in kernel.dll, you could save your applications configuration data to and read it from a section in win.ini. This would have worked fine, with the minor inconvenience of a large win.ini file, but there was a caveat- the functions could not work with an INI file larger then 64K.
So, this technical limitation combined with the aftertaste of having a win.ini file that even comes near to approaching 64K guided the implementation of the “private” versions of these functions. These took, in addition to the values that the older functions did, a parameter specifying a filename. So now, applications could read and write values and sections to their own “private profile” INI files (thus the name). They still had the 64K limit, but this is hardly ever approached.
Fast forward a few years, and we have the Windows Registry. This is where Microsoft encourages us to save our application specific data. And I won’t argue- it works great. There is of course a minor caveat- it’s not as “user editable” as an INI file. if you ask somebody “change such and such value in program.ini” to solve a problem, they will usually have no problem, but ask them to change values in the registry and your asking for trouble, first- they could change the wrong value (after all, it’s pretty much a hierarchal version of the old win.ini, but without a size limitation), second, it’s not as “discoverable”. you can open an INI file, change it, make backups, etc. You can do this with a registry key but it’s not as simple and intuitive. backups involve exporting .reg files.
Now, with .NET, we are being encouraged to save our data into XML files. Are we not now back where we started? we started with text based INI files, moved to a monolithic binary hierarchal database, and we are now back to a text based format. The only real difference between INI and XML is the fact that XML is inherently heirarchal, so it’s easier to make code that works with either XML or the registry without problems. INI is limited to a fixed structure where there are two layers- the sections, and the values.
In either case, sometimes for a simple application there is no need to get involved in either the registry or XML; or, maybe you just like the simplicity and user-editability of an INI file. This is why I use INI files for most of my applications.
Given the fact that we have the API functions to work with INI files, you might think that my class-based solution may use them. This is not the case. you see, first, they are deprecated- second, they are limited to 64K, and lastly, and perhaps most importantly, they can sometimes not even read INI files at all- thanks to the fact that their functionality will often look in the registry for data. (this establishes it quite loudly as a compatibility function, not something to depend on for modern applications).
Instead, I opted to create a INI file parser. Thankfully, because of the simple structure it’s not hard to create something like this.
First, we need to think of an appropriate object model. we have sections, values, and the INI file itself. the base-level representation should be an abstract class that sections, and values can derive from:
you may be thinking, “why make an abstract class?” well, consider for a moment, comments, in the INI file. by convention, an INI file can have comments inside it, indicated by a semicolon as the first non-space character on the line. We could simply discard them entirely, but ideally, we would preserve the comments between loading the INI file and saving it. Here, we can create a derived class representing a comment:
the Section itself can contain a list of INIItem objects, which can represent either INIComment or an INIDataItem, which is shown here:
At this point, I have decided that it would make sense to Load the INI file entirely into memory. INI files are usually small in size, and considering the convention with XML files is to keep the XMLDocument in memory it’s not that new of an approach.
Now, we need a INISection class; this will be used to represent each Section in an INI file; It needs a Name, a list of Values, and a “eolComment” (end of line comment) for when there is a comment on the same line.
Now this can appear a bit more daaunting then it really is. The bulk of the code is in the indexer, which allows you to modify an INI file like this:
It’s actually a lot shorter then it would have been had I not used lambda expressions:
first, this is operating on the IEnumerable being given back from getValues(); getValues is what is known as an iterator method, a simplified way to think of it is that the return value is a set of all the values that were “yield returned” from that function. In this case, getValues() returns all the items that can be cast to an INIDataItem. This ensures that the lambda expression used with FirstOrDefault() has access to the Name field to perform the appropriate comparison.
And that’s the INIFile. the INIFile itself has a Indexer similiar to what the INISection class has, but it deals with the list of Sections. relatively straightforward, for the most part. LoadINI and SaveINI are both overloaded with a few different parameters, from passing in a StreamReader/Writer to simply giving a filename. For reading in an INI file into a class structure we simply read every line (the while ((currentline = fromstream.ReadLine()) != null) loop ) and take an appropriate action based on what we find- if it starts with a square bracket, it’s treated as a section. a new section is added with that name, and the local variable “currsection” is changed to point to it. if it starts with a semicolon it is treated as a comment (and an appropriate INIComment object is added to the INISection pointed at by currsection, which by default is an imaginary “global” section). Otherwise if there is an equals sign in the line, it is parsed (using the ParseINIValue() function) into a appropriate INIValue object, and that object is added to the current section.
writing it back into a stream is pretty much the opposite; loop through all the sections, and for every section, if the name is not the globally defined intrinsic item, then write out the appropriate section header (the name in square brackets), as well as any end of line comment defined for that section. then loop through all the values and write out the ToString() from it as a single line. (remember, the INIComment will return a comment line (starting with
and the INIDataItem object will return a properly constructed Name=Value string.
The Full Source can be downloaded here:
Alright, so I sort of touched on this subject before, but I feel I need to revisit it for no reason. Also, because I can do whatever I damn well please.
Now, as you are no doubt aware, there is quite a furor about “the end of the world”… well, more precisely, there was. as 2012 approaches it appears that they are changing their tune “well, it won’t be the end, but everything will change!”.
For “facts” proponents refer to the mayans, Nostradamus, and the bible.
for Facts.
please, tell me they aren’t serious?
First, they claim that the Mayans “knew” there was going to be a major change in our history. How? magic? Did a people who couldn’t even master the length of the solar year actually have somehow mastered time travel and seeing into the future? No. Of course not. Sure, their civilization was advanced, but if they couldn’t predict their civilizations own death I really don’t think it’s very smart to believe any of their “predictions” (did anybody account for the fact that their solar calendar was busted, anyway?).
And don’t get me started on Nostradamus. Biggest phony ever. “hey, guys, I have an idea, I’ll write down completely meaningless gibberish and say it’s prophecy, and people will believe it and connect the dots for me.”
The sad thing is nobody sees it! They are purposely vague not because “he didn’t understand today’s technology or the various changes that he “saw”" but rather because if he was specific they would be wrong.
The fact that any otherwise reasonable human being with a solid understanding of either physics or the nature of space can even give any sort of creedence to an obvious fake and even go so far as to evangelize his name (well, if he predicted it, it’ll come true).
Except he didn’t predict anything! That’s the problem I have with it. If I wrote down that in 2013:
a great power will rise. Many will be killed.
The Koala bear roams free. eucalyptus suffers.
Olives drop. All dead. Great bird eats grapes for breakfast.
And enough people believed it “it would happen” not because I predicted it, but the very vague nature of the words opens them up to so many interpretations that during the course of the year it’s certain that there is a timeline that could fit this random gibberish. This doesn’t even touch on the fact that the man was french, so all of these predictions are translated. I decided to do a little digging, namely about his “power” to predict world events; for example, here is the original french passage that “predicted world war 2″:
BĆŖtes farouches de faim fleuves tranner;
Plus part du champ encore Hister sera,
En caige de fer le grand sera treisner,
Quand rien enfant de Germain observa. (II.24)
Now, according to the website I originally found this the translation of this to english was:
Beasts wild with hunger will cross the rivers,
The greater part of the battle will be against Hitler.
He will cause great men to be dragged in a cage of iron,
When the son of Germany obeys no law.
Note
Beasts mad with hunger will swim across rivers,
Most of the army will be against the Lower Danube.
The great one shall be dragged in an iron cage
When the child brother will observe nothing.
As with any of his passages, and even his strongest proponents agree “his predictions only become crystal clear after they have occured”.
What the fuck kind of use is that? “Oh, he can predict the future, but we can only know what it means after it happens” So, basically, he purposely phrased his quatrains in a vague, completely meaningless way and as I said those who want to are able to give meaning to any passage. It’s really quite simple, and the fact that people actually believe this utter and complete bullshit is beyond me. Not to mention they even go so far as to invent propesized events- apparently he predicted 9/11, but he didn’t. the entire thing was a hoax. So the real question is how many of his “predictions” are either biassed translations or completely fabrications? I find it interesting because a large quantity of his “followers” can’t even read french.
This is a rather similar case as with the bible itself. Now, I have no problem with Christians of course, and the bible certainly contains words that anybody can live by.
But it’s a spiritual guidebook, not a prophetic gypsy book. The problem is the bloody thing has been translated and re-translated that even if the original was in some way “the word of god” it’s become so mangled and filtered by so many people translating it between different languages that it’s only natural for some parts to lose cohesion.
It, just like most “predictions” is also rather vague, using symbolic imagery to try to pain a picture of the future (in those parts people claim it does that).
Now, the problem here is that the only place that “symbolic imagery” and “predictions” should ever be used in the same sentence is when you are referring to the horoscopes in a newspaper. No reasonable person is going to read a horoscope for their sign that says:
There could be some friction in your place of work or group gathering today, and it will be up to you to take the middle ground. Pay attention to the minor details in connection with a major project, because it’s the little things that will make the final picture work.
and actually believe it (well, nobody who is completely sane, anyway) because it’s often wrong and it’s sufficiently vague it could apply to nearly anything. and if you add the fact that desperate times calls for creating new meanings for literal words… for example, a die-hard advocate, upon seeing that t his has absolutely no relevance to anything whatsoever might try to say “well, maybe the friction represents…” or “by “middle ground” they must mean…
it’s all a load of smoke and mirrors and it’s the fact that these people understand, either conciously or sub-consciously, how the human mind has an arcane, even magical, ability to fill in the blanks and create connections where there are none. It’s really no more then a optical illusion with ideas and words. When you see the classic optical illusion whereby two images of the same size are placed on a perspective plane, do you truly believe that the object that appears larger (because it is “farther back”) is really larger?
No, of course not. Once you remove the backdrop of the perspective line and vanishing point the entire thing is clearly not as it seems. So too can people cleverly insert “perspective lines” in our very own perceptions of words. Just as our Visual Cortex fills in many blanks for us when there isn’t enough information, or as part of our perceptions (for example, our perception of contrast, colour, and so forth, can be changed by merely introducing a few lines, just as the way an entire scene looks can be changed by introducing a single element. So too does our mind “fill in the blanks” for many other topics. More precisely, we see what isn’t there because we want to see what isn’t there.
Many people have capitalizee on this.
I previous discussed the dangers of the deadly giant Earthworm. Recently, a new discovery has been made, the tiny Anaconda, which has been dubbed the “MicroConda”.
This is a force to be reckoned with. The Life cycle of the Microconda consists of the following phases:
First, they are born as a sort of virus. Microscopic in size, and they infect bacteria that live in a mammal’s intestines. The bacteria don’t die, but the MicroConda Larvae virus infiltrates the cell nucleus and changes the mitocondrial DNA to collect phosporus from the bloodstream. This is used and combined to create a photosensitive mitochondria. The virus then uses it’s powers of nucleic persuasion to do this to two mitochondria, forming eyes. A side effect (and therefore a symtom of microCondal infection) is that all excrement from the mammal will glow bright Orange. Once the infected bacteria are released in this fashion,they seep into the ground where they are ingested by tree roots. Through a process known as osmosis, the tree sap (as well as the infected/mind-controlled bacteria) finds it’s way to the forest canopy, and finds it’s way into a leaf.At this point, the larvae form simply waits until a leaf-miner caterpillar eats it. It infects the caterpillar and reprograms it so that it eats almost three times as fast as your standard leaf-miner. At the same time, it reprograms the DNA instructions that will be “executed” when the caterpillar enters it’s chrysalis. The leaf-miner, due to it’s larger intake of food grows to epic proportions, to the point where it is nearly 3 feet long. Since this is readily visible to predators, the virus creates a networked computer system inside the caterpillar, using the caterpillars organs as a sort of Bio-Nemetic processor. Using this, it also puts up a meta-phasic shield around the caterpillar, which turns any predator within 3 feet of it into a flaming mess.
At this point, the larvae sets a course for the most stable branch of the tree, and begins the reconfiguration process by initiating the formation of a chrysalis. During this time, the larvae has created a sort of replicator technology and protects the chrysalis using a metal alloy, in addition to the shields described earlier.
During the reconfiguration process, the larvae reconfigures the caterpillar slightly so that instead of forming a butterfly, it creates a small interstellar spacecraft that is capable of faster then light travel (easier then it sounds really, in fact the butterflies as they are today are really a result of a cosmic ray that hit one of the first evolved caterpillars and knocked it’s gene sequence out of whack, so that they all have the “do not form a interstellar light-speed capable starship” gene.). Once the larvae emerges in it’s newfound starship, it spends exactly 13 nights hovering around the globe in front of very drunk and paranoid people, as well as those who like to form UFO conspiracy theories, knowing full well that not only will they think they were much larger then they were but also that they were real starships.
After the 13-day rest, the larvae sets course for Mars, where it sits dormant in the Martian soil in order to confuse scientists. It makes a deliberate effort to try to be scooped up in any Rovers that come by, in an attempt to further confuse people about wether there is life on Mars. After (usually in vain) waiting there for another 13 years, the Larvae (yes, it’s still a larvae) powers up it’s Engines and sets course away from Earth. This is where the cycle get’s confusing- Nobody really knows what happens to it, but it always returns on Memorial Day 15 years later at exactly 10:00 PM GMT, which is the exact time Oprah is on in Little Rock Arkansas, but because of the memorial day parades and stuff the Larvae doesn’t get to see it. Because of it’s long isolation on Mars, it blames humanity for it’s troubles, and is intent on causing at least 3 unsolved mysteries and one cold case that is eventually blamed on the victims father on law. It does this by cleverly shooting each subject in the face with a AA torpedo, which is similar to a Photon Torpedo but instead of a Engine driving by fictitious warp plasma it runs on 2 AA batteries. the cold case is inevitably solved in some way or another by the Larvae leaving behind one of the batteries.
About this time, it faces the alter-ego of itself- the Boogers. These are formed when the Larvae accidentally infects a caterpillar that becomes a moth instead of a Butterfly. Due to the increased complications involved in trying to reprogram the moth to become a spaceship (unlike the butterfly, which as I stated would naturally metamorphose into a Interstellar starship if not for the supression gene) the Moth instead has a gene that suppresses it from becoming Liam Gallagher, who, ineffectually, is in fact the single case where the Larvae was unable to change the DNA fast enough to prevent the onset of Gallagralitis.
Those Microconda Larvae which, after reading through a few pages of the code comments on the Caterpillar’s DNA, determine that they are in fact inside the wrong type of caterpillar, set quickly to work on trying to limit the damage and try ot set them to metamorphize into something more useful. The lucky ones are able to cause the Caterpillar to metamorphize into a large perfect cube of mucus, which have been dubbed “boogers” by most 5 year olds who have seen it. The unlucky ones (only one so far) are unable to prevent the inevitable and accidentally cause the caterpillar to metamorph into Liam Gallagher. Thankfully, this has only happened once, and the other few instances were deep in the jungle where he lived his life out as a Howler Monkey. (actually wait, that’s the same as the one who managed to pass as human… oh well).
Now, back to the “boogers”. Now, As I said, these were the lucky ones. they were able to salvage their situation and still create a interstellar starship with metaphasic shielding, however, the one difference is that they have to wait nearly 60 hours for their outter layer of mucus to try before they enter lightspeed. As it happens, they often encounter the more successful “butterfly” marvae when they return from their sabbatical on Mars. The Boogered Moth only has one goal in mind, assimilation of everything else. It wants to integrate everything into it’s collective. however, unlike the species that I am obviously basing this off, they are a lot smaller. Most of their drones consist of grasshoppers and the occasional Lichen, neither of which are very useful. The “mucus” implants are really just a thin coating of mucus that does nothing to enhance their abilities, and there is no need to supress their will because, I mean, their grasshoppers, lichens, and a few stray bits of fluff. Oh, and some wasps. The wasps are probably the easiest to control I would imagine, they have one of the simplest DNA programs. So anyway, they inevitably meet with the vastly superior Butterfly version, and they engage in combat- Usually in and around the Asteroid belt, where the Butterfly Larvae is able to fire far more AA torpedoes then it had originally. The Booger cube uses it’s established defense tactic of moving lazily to the left, which keeps the Butterfly version on it’s toes.
The outcome is different everytime.
Well, that’s not true, there are only 4 possibilities:
1. the Butterfly Larvae wessel destroys the booger cube
2. The Booger cube assimilates the Butterfly larvae ship.
3. Both are destroyed in an ambush by T.I.E fighters
4. Neither one is destroyed, and the butterfly larvae instead moves into a career as a rock musician, while the Booger cube supresses it’s “pretty” gene a little further and becomes a common member on “The View”.
Now, the Butterfly larvae wins most of the time, being that the Booger Cubes best defense against the AA torpedoes are mucus torpedoes, which aren’t very useful. At this point, regardless of who wins, they celebrate by visiting my Aunt Martha for a bowl of Brown beans. Yes, she is intricately involved in the ecology of a species. I warned her that she was breaking the Prime directive, then I realize that was a completely fictitious law and it was a lot funner to do the opposite anyway. It actually all started when she left the spaghetti leftovers in the fridge for nearly a year. by the time somebody found them they had already grown sentient and had even started their own version of American Idol. (And no, being sentient and watching American Idol don’t
Anyways, After visiting my aunt Martha, the spend the next 2 years going back in time and just barely making it back, and finally decide that while they don’t necessarily like Fresca, it’s not the worst drink in the world, and it’s certainly good to hae around fort diabetics, who are rather sensitive to their sugar intake. After havingthis epiphany, the StarShip’s Self-destruct is activated and the Larvae leaves using an escape pod, this escape pod is in fact a long slender organic mass, and is a snake like form as well. At this point it hides itself in Cajun cooking and is ingested. There it lays it’s eggs and is excreted, and then flushed down the toilet. It makes it’s way to the sewage treatment plant, where, by careful planning, it manages to sabotage the entire place so that instead of outputting treated sewage it gives out Coca Cola (it only takes a few minor adjustments and a touch of lemon). With it’s newfound business sense, it now roams across the country converting sewage treatment plants to Coca-Cola bottling knock-off plants. However it is soon discovered that the MicroConda isn’t actually a human being, which puts a dent in his credibility (namely, the large speech bubble on every can saying “Yes, I am a human being”. It slinks off into the shadows, returning only shortly to plan a trip to the Amazon Rainforest where it grew up. At this point, in a twisted set of logic, the Microconda is thinking “haha, I am so doing this of my own free will, my base instincts would never send me back to the rainforest I grew up, when in fact, that is exactly what is happening. Little does he know it, but the cycle is about to complete.
So, he goes on a tour in the rainforest, pretty much the same one that they filmed that Anaconda film on. Speaking of which, that film was pretty awful. Anyways, once there, it ends up getting in a rather heated debate over toilet paper brands with a local Howler monkey, and soon things start getting personal, both sides start questioning the parentage of the other, the promiscuity of each of their mothers is brought up, as well as their immense weight and various other negative traits. (around this time it becomes clear that while one is a howler monkey and the other is a Microconda that a fraction their size, both of their mothers are some sort of diesel or other high octane fuelled locomotive.
After much debate, they both decide to settle their differences by agreeing to disagree, and they both go out for soda. The Microconda, because of his previous epiphany, orders a Fresca. The Howler monkey starts (what else) an intelligent debate about the carcinogenic effects of aspartame, to which the Microconda eloquently replies that there is no real solid evidence either way, and until there is an established, medically sound report that conclusively proves otherwise he wasn’t going to let nonsense rule over his choices. The howler monkey, at this time, requests that they have butt sex, which the Microconda of course politely declines, “It’s not you, it’s me, I don’t have an anus” he replies. The howler Monkey, heartbroken but quite understanding to the Microconda suggests that he have anal reconstructive surgery in which he can finally achieve his lifelong dream of owning an Anus.
After many years of planning the operation, Dr A. Tear finally decides that it is doable. So, on the following Tuesday, The Microconda finally has an operation to give him an Anus. The Observatorium is packed with onlookers, I was among them- I distinctly recall ordering two hot dogs and a ice cold beer from the fellow selling refreshments, in fact, which I ate and drank while watching the Microconda being torn a new butt-hole, so to speak. Or should I say literally… I don’t know.
Unfortunately in the second half of the operation there were complications, namely, Dr. Ass Tear forgot which side of the Microconda was his new butt and which one was his mouth, and started working on the wrong side. This was quickly corrected when I threw my shoe at him from a distance.
After recovering from the surgery for nearly 12 minutes, the Dr. declared it was a complete success. At that point he informed us that he’d like to keep the Microconda here for at least a week for observation, which seemed fine to me, I mean, I was only sort of related to him through my Aunt martha, and even that was a Dubious connection. The Howler monkey did (what else?) differential equations to pass the time, and tutored his many advanced astrophysics students in the finer points of Einsteins Special theory of relativity, namely the importance of reference frames. Or maybe that the General theory. I don’t know, I was reading some awful MacCleans magazines from 1994.
After the Microconda recovered, he prompty returned home to his wife, Mrs.Howler monkey, with whom he engaged in frequent butt sex. Unfortunately, during one such episode, the chainsaw they were using became sentient and wrote rude words on the floor. The landlady of the area was not impressed at all and evicted both of them, where they both lived on the street as vagrants for a year before finally starting their own restaurant, “Howling Snake” It was mildly successful, at least until that incident where started to murder anybody who tried to pay with a discover card. Once again homeless vagrants in addition to being fugitives from the law, they started to live the homeless life which consisted of mostly not having a home. They made small change by having the Howler monkey do (what else) derived calculus equations on the street for money. unfortunately, their luck quickly got a lot worse. on a trip to the amazon rainforest, The Microconda caught a mild disease known as the “uncommon cold”. On his death bed, and dying of an unrelated anal aneurysm, the Microconda promised that wherever they met again, butt sex would surely follow. the Howler monkey did (what else?) spatial IQ puzzles. Shortly after, the Microconda died of Natural causes. As his last request, he wanted to be burned, transformed into a fine paste, spread on toast, and thrown into the rainforest. Nobody knows why- the common belief is that it was the fashion of the time. In any case, certain cells regenerated and formed new MicroConda Virii which continued the cycle once again.
For quite some time I’ve been wrestling with a mysterious issue.
You see, I have several COM components. COM, is, to be usable from the various Script languages installed with windows. I encountered this some time ago when creating a small demonstration script file, something along the lines of the following, which simply showed a files size:
Very basic.
However, upon running it, I was greeted with the helpful dialog shown in figure 22-1.

Fig 22-1: VBScript Error
For some reason or another, the ActiveX Object simply couldn’t be created (I gathered this after many long hours of research). My first “retry” was simple- I at first simply assumed that I had to run as administrator, so I started a command prompt as administrator, and ran it again.
Same error.
This was getting to be annoying. I tried a equal script in JScript/ECMAScript or whatever the hell it’s called these days:
It failed as well. so it wasn’t because of something I was doing wrong in the script. I then tried an alternative; I created a Visual Basic Project, and ran similar code.
It was able to create and use the object with absolutely no difficulty.
I was beginning to find this whole exercise at least as intriguing as it was frustrating. I decided to explore what happened with other operating Systems with VMWare. The script ran fine in Windows 2000 and Windows XP (assuming of course I had installed BCSearch or otherwise had BCFile.dll properly installed). However, it continued to fail. I went into a test frenzy. It failed on Windows 7 on both my laptop and desktop, worked in all my VMWare installations (including Vista) I was stymied.
Then, I ran it on two copies of Windows XP I had on my laptop. Windows XP Pro worked fine. Windows XP x64 did not.
So it was an architecture issue, I surmised. Going on that, I came to the realization that a 64-bit executable cannot instantiate a 32-bit COM object, at least, not an In-Process (DLL) COM object. This was likely the source of the error. I Ran a simple script with a msgbox() that would keep the Script runner running, and then opened Process Explorer.
Not surprisingly, the WScript.exe Process was 64-bit, this was the cause of my problems. the fix? Run the WScript or CScript in %systemroot%\syswow64\ instead. I did so, and the script ran without incident.
I’ve been reading a blog- specifically, Addressof.
I could ramble on for hours about various things he has said- bit it would be just nitpicks about things. Anyway, this post, or more precisely, some of the comments, attracted my attention.
More »
for the last little while, people with fewer brain cells then a Pygmy chimpanzee’s middle finger have been going on and on about how the “world will end in 2012″. Well, I have a little story for you all-
It’s set in the year 2098.
Archeologist (or, as they will be called then, digger men) will be using their dirt shovers (what we now call a shovel) and come upon a beige box.
Experts will be baffled! They released the following information on what they believe the object to be and what it was for.
Professor Jeffson has a theory- he believes that the object was used for storing, and retrieving personal data. the logo “IBM” was an insignia of a long dead religion that dedicated themselves to getting down to business with machines.
Professor Ytterby, on the other hand, has a different theory- he concludes that the device was used for predicting the lunar cycles of the moon, and by using the alphabetic input device, it could predict when people would die. Later, and to the amazement and grief of a large crowd, he powered on the machine and entered the following data at the prompt:
Current Date is Tue 01-01-80
Enter New Date: (mm-dd-yy):01-01-2100
What he didn’t realize was that what he would reveal with one keystroke was more then any man should ever know.
Current Date is Tue 01-01-80
Enter New Date: (mm-dd-yy):01-01-2100
Invalid Date
Enter New Date: (mm-dd-yy):
Invalid date?
The professor came to the only logical conclusion- the universe was going to end on the year 2100. The ancient Americans knew of this day, using their advanced vision boxes called “televisions” they were able to see into other people lives, and steal their thoughts. It was also believed that they referred to spoons as “face trowels” and would often purposely do something and loudly exclaim “did I DO THAT?” in a nasally whine that would make Cyndi Lauper blush.
This news spread like wildfire (literally, in fact, as the entire backbone of the internet will be based on the spread of wildfires) Threads such as the following:
THEY ALSO FOUND A WATCH AT A MORMON BURIAL GROUND, IT WAS STOPPED ON 7/28/1973 AT EXACTLY 11:03:55 PM! YOU DUMS KNOW WHAT THIS MEANS?
First: release caps lock. I’m sick of telling you over and over and over again to type normally. It doesn’t make you look smarter. Remember that thread where you argued that the shape was easier to read and I shot you down with 5 case studies by reputable organizations? yeah, that was sort of a hint that you don’t know what your talking about.
Any way- I think that could mean:
That they had really bad watches?
There really were no golden plates?
They were grave robbers?
Come on! Tell us.
The watch stopped at the exact time equivalent to 01/01/2100 divided by the constant e Couldn’t it be more obvious?
It could have been more obvious. You could have said that to begin with instead of trying to build up suspense. And you generally use caps to break the suspense, not build up to it. And I don’t care what you think of caps, it’s called “proper grammar” dumbass.
Anyway, the fact that the time stopped at that particular point it pretty circumstantial. That would be like saying that my great great aunt martha had 5 toes and ate meatloaf every Tuesday so she must have been a good square dancer. I’ll have you know she became a good square dancer through dogged training and a strong resolve, not simply by having the standard number of toes and eating meatloaf made from an unspecified animal.
It’s a corrolary to Godwins law: all threads involving BC and BOobrat will devolve into a pointless flamewar about either use of capitalization or wether a mouse with a large boob is in fact a rat.
And trust me- It just goes downhill from there.
Anyway, in a mildly serious manner- I find it even more disturbing that devout Christians are even giving this a second thought. They were rather barbaric by modern standards, sacrificed virgins and car salesman, believed in multiple “spirits” (gods) and yet, despite their evident paganism and completely lack of “knowing the true path” (as a missionary might put it), most of them seem to think of it as somehow credible. Although, I suppose it’s perfectly possible they created a giant telescope and were able to see a large comet heading straight towards us, possibly by using a number of butler monkeys to love about the various mechanical bits they had…. actually, wait a moment, I don’t even think the mayans had the wheel.
This is almost understandable for catholics, since their church really is just a government- like the many other times the apocalypse was predicted and they told all their loyal followers “well, you may as well donate all your worldly possessions to the church” and so many people did… and then after when nothing happened, people would go back “oh, hey, err… I sorta need that stuff I donated back”, and the church would inevitably make up some excuse involving poncho size measurements. Actually, that gives me an idea. People! this is a great opportunity! Instead of responding to such claims that “the world is going to end”! get them to give you all their stuff.
Yes people, that is the new low we’ve all stooped to. Now we have people believing prophecies from an “advanced” civilization that couldn’t even figure out the wheel. I imagine it follows that they didn’t have gears either… And you can only throw so many butler monkeys at a problem before the shit hits the fan… pun not intended, of course, being that a fan would require understanding of at least some sort of rotary motion. Besides, most of their butler monkeys were probably building their goofy pyramids that they build for sacrifices as well as for housing their valuable collection of first-edition pokemon cards. It’s another little known fact that the reason they were rather frightened of the Spanish was not because of their muskets, but rather because of the shape of their ammo. you see, as I mentioned the wheel, and therefore any elliptical shape, was somewhat of an enigma to them. this is quit clear in that all their sculptures give faces square features (or maybe they really had square heads, I don’t know). for a while they fought bravely, but then they managed to capture a spanish car salesman (who was trying to sell them a Jetta). When investigating his sales-musket, they discovered, to their horror- spherical ammunition. Their best scientists immediately went to work by testing them. they discovered that they rolled easily, and therefore must originate from the dimension of the doomed (a dimension which was later featured in Quake). They responded in force by sacrificing a low financing rate for their Jetta in exchange for some information from the salesman, which proofed fruitless since nobody’s universal translator was working at the time.
Companies and businesses want to prosper. At the core, being a successful business means that you make a sizable revenue; But, when those start to falter, how do businesses determine the cause? They generally measure something; for a programming firm, this may be lines of code written. For a restaurant, perhaps the time it takes for a customer to be seated, and so forth. And on the surface, it makes sense.
The problem is, it only makes sense,in theory. Why? because both methods are trying to tack a quantitative statement onto something that cannot be measured in this way; additionally, they forget the human factor.
Let’s look at a hypothetical situation; Programmer Joe. Programmer Joe has worked at a Software startup since it’s early days, and enjoys his job. However, one day, the CEO calls them all into the office to discuss declining revenue. Realistically, the revenue is declining because a competitor has just released a product that directly competes with the startup’s flagship software package. However,Ā management believes that the loose leash they’ve been keeping the programmers on is to blame; so one of the idea men determines that they should implement a management technique known as metrics. In this case- they start with something basic; each programmer’s performance will be judged directly correspondent to the number of lines of code they write.
Programmer Joe continues his work as normal; he notices some of his co-workers checking in code that re-rolls standard library routines, and cuts out excess code like this. One day he’s called into the Project Manager’s office.
“Joe… I don’t know quite how to explain this- maybe you can. Somehow, you’ve managed to accumulate a [i]negative[/i] lines per day metric… any idea how that is possible?”
“Well, I’ve noticed a lot of redundant code being checked in, and trimmed it down. the code still works the same way- it’s just faster; also, I’ve managed to fix half the bugs on the list just by doing that.”
The Project Manager may, in this case, take this particular information to the higher levels. they decide that the metric is flawed- what they need ot measure is lines of code written minus the number of bugs introduced.
A feature request arrives from a client near the end of the day, at 4:30PM. the Project Manager asks if Joe can look over the request and if he can maybe stay late to try to get some of those features implemented. So Joe spends the next three hours creating a prototype for the new feature and once he has the main functionality down he checks the code in and goes home. The next day, Joe continues his work on this new feature. However, he is once again called into the Project Manager’s office.
The Project manager hands Joe a large stack of papers.
“you know what those are, Joe?”
“No…”
“Those are the bug reports filed on code you’ve checked in recently.”
“All the code I’ve been working on recently has been a prototype… I haven’t yet gotten it fully integrated into the rest of the system.”
…
I think you can see where I was going there. basically, the fact is that havign a measuring metric that measures small fiobles in the entire process is doomed to cause hiccups within that process and even bring business to a standstill. In this case, rather then worry about the number of lines of code written or the number of bugs introduced, it might be better to focus on fixing the bugs and adding features; the number of lines of code in a project does not directly correspond to the quality of that project as a whole, and in some cases can even do so inversely.
In a strange coincidence, a local Coffee shop that Programmer Joe visits on his way to work had noticably changed. When Joe used to go though their drive thru to grab his morning coffee and a box of donuts for his colleagues, the staff were friendly and often asked him how things were going. Recently, however, Joe has felt like a piece of scrap metal on an assembly line. Once he got to the pay window, he would often hear audible grumbles of discontent as he simply reached into his pocket for his wallet. His donuts have often been obviously simply thrown in the box with little care, too. Joe couldn’t understand it, since these were the very same people that would serve him before. Eventually, Joe decided to go elsewhere for his morning coffee.
The previous paragraph is not an entire fabrication; in fact, I work at a location that does just this. They time every single drive thru customer’s time at the window, and it’s treated as the single most important measurement of performance in the entire store. I’d even go so far as to say it seems to be used to reflect directly customer satisfaction. However, this simply is not the case. The franchise, in particular, places a recommended limit of 42 seconds for waiting at the window. a reasonable time frame, depending on the volume of customers. However, at my location it has now been decreed that we shall not take longer then 30 seconds or, from what I hear of others, they will be verbally “abused” about it.
In any case, a little backstory is probably in order. Lately it would appear that revenue has been dwindling; there are far fewer customers then I remember coming in, at all times of the day. Additionally, various seemingly pedantic rules have been places on our release of such seemingly trite things as butters and napkins. It’s fair to assume in this case that they obviously want to bring business back up again- and that is certainly something anybody in that position would try to do.
However, with that said, they are going about it wrong. In the Retail and Customer Service industry- where almost all revenue is coming from consumers who purchase your product by coming to your establishment, the all-time, 100% most important thing for business is customer satisfaction. No exceptions. Interestingly enough, since this has started, I’ve gotten dozens of complaints from Customers who visit regularly about the shoddy way they were treated while going through the drive thru at some other time during the day. This certainly is not the fault of the workers at the time; since, as I said, they are essentially being “forced” to try to reduce times to <30 seconds. But when you get customers, the main source of revenue for the store, complaining about something that is the result of a change to the store policy that was introduced to try to increase revenue it is pretty solid evidence that the technique has failed miserably.
The problem here is not that those in charge know, as well as anybody else, that customer satisfaction is the single most important thing to the stores success, but rather in that they have tried to assign a single metric to measure this particular quality. And they do not correspond. I certainly won’t argue that customers prefer fast serviceā it certainly is on their list of hopes when they enter a drive-thru to be out as fast as possibleā but I think what one needs to realize is that having their orders (literally) thrown into their car for the sake of speed of service doesn’t please the customer. They aren’t going to think, “well, golly, they threw the sandwich right into the passenger seat and refused to carry on a quick little bit of small-talk while I waited, but damn, it took only 30 seconds, so I am going to say I am satisfied”. I’m sorry, but this does not happen. As long as a customer is not waiting an exceedingly long time for their purchase, they tend not to notice it. Think of it this way- there is the old adage where you can either have fast service, good service, or right service, but you can only choose two. I put forth that, for many consumers it also holds true that when one of these is omitted, and the other two are done in a way that exceeds their expectations, they are likely to generally be satisfied. For example, if a customer is greeted with courteous fervor, and perhaps a friendly conversation ensues in addition to their order being made perfect, they are less likely to notice that they had to wait in the line for a few minutes. Now, if they had to wait that same amount of time and they were treated brashly, they are more likely to take offense. In fact, the single most important thing to almost all customers is not the time they wait, or even the fact that their order is made perfectly to their specifications, but rather to be treated as people, and not as some mindless consumer whose particular interests and concerns are of no importance. The sad fact is using this particular measurement metric encourages the workers to do the latter.
The thing is, there are even further flaws in the mechanism. First, the device doesn’t even work half the time, so times come out skewed and sometimes two vehicles get counted in the same interval. Additionally, since the time measured is the entire time the customer is at the window, this is not simply a measure of the efficiency of the workers to get the product to the customer but also a test of how quickly the customer can pay for their product. if a customer needs to dig for change for 10 extra seconds after the employees have successfully finished their entire order and simply await payment, why is this 10-seconds attributed to the detraction of the employees? “Because we have no way of knowing” the people who read the recorded times may say. The issue here is that obviously if there is one fact you don’t know about what the measurement indicates then there are certainly more, and in fact it could even be put forth that the measurement is completely meaningless. a Customer could be at the window for 10 seconds and still not be pleased, be it because of the shoddy service received while being squeezed through in a tiny window of time, or because they got their order mixed up with another, or some other error instigated by the fact that inhuman demands are made of people there. On the converse, a person could wait for a entire minute at the window and still be perfectly pleased with their service, so using the measure of window time as some sort of barometer by which to judge the performance of a business is downright ridiculous, and this only multiplies when one considers that such time-based constraints are not placed on those consumers who decide to enter the establishment for their service.
And while the latter example has certainly acquired far more attention for personal reasons, it certainly is no more or less ludicrous then the software companies implementation; performance metrics have been tried in nearly every industry and in every industry they have failed to provide the hoped for results. The key here is that the measure is not strictly of customer satisfaction or even of revenue; but more directly, of the value of the business.
Value is a perception and must be communicated and measured to be perceived as value. Value measurement is the process by which management decides on operational performance measures that will enable them to secure the the owners return on investment. Value measures must be aligned with the business strategy positioning the business. Measurement includes measuring lead factors and lag factors. Lead factors identify performance measures that will proactively provide an indication of whether objectives will be achieved or not. Lead factors allow management to receive warning sign proactively. Lag factors measure how successful management was in terms of creating value. Financial reports are the ultimate lag measures of success. When a business lead measures indicate that the business is performing well but the business lag factors are showing the contradictory then it is time to review the lead measures.
The value measurement process determines the behaviour of the business and aligns the behaviour of human capital with the value expectations of all stakeholders e.g. owners, management, customers, employees and partners. Value should be measured and reported on from every stakeholder’s perspective. A true balanced scorecard will drive performance improvements for all five stakeholder dimensions. This all applies to ANY business, regardless of industry.
Flipping quickly back to software, an excellent overview of the problems present with Performance metrics as used in that industry can be found here: http://discuss.joelonsoftware.com/default.asp?biz.5.304155.19
A few minutes ago I posted a small Visual Basic 6 class module that could be used to register an applications objects in something called the “Running Object Table” Or ROT. Rather then go on a long monologue in that post I’ve decided that this is an excellent topic for a blog entry, with pictures and whatnot. The forum thread I created is here, and provides the source to a useful class module that can be used to expose your objects on the ROT.
In order to fully understand what the ROT is and it’s usefulness, it’s important to have a basic understanding of COM. At the moment COM is really a “legacy” technology, and Microsoft much prefers that people develop .NET assemblies instead. Of course, what MS fails to mention is that it’s unlikely that COM support will be withdrawn from any foreseeable version of windows, simply because it is so deeply rooted and so necessary for applications, including Microsoft’s. In any case, having a solid knowledge of COM is not something that is going to become useless or even irrelevant anytime soon, so it cannot hurt even a non-programmer to understand some of the basic semantics involved.
Originally, COM wasn’t really released with any fanfare; in fact, it was simply the “bed” upon which the more prevalent technology at the time, OLE (Object Linking and Embedding) was based. OLE really is an awesome technology, but the problem is nobody really knows how to use it. Anyway, the main idea was that each application knew how to deal with it’s own files; for example, excel knew spreadsheets, word-perfect knew word processing, etc, and the idea was that instead of trying to get applications to implement the various different application “powers” (such as having built-in word processors and the like), they could simply call on another application to do it. For example, if you made a useful chart in Excel 5.0:
Now, of course you could make a chart with the spreadsheet, but let’s say you wanted to embed the spreadsheet into your word document. In pre-OLE versions of word, you could copy-paste a picture of the spreadsheet, but if you ever needed to change it you’d need to go right back to excel, find the file you originally used, make the changes, copy it, paste it, reformat the bloody document again because pasting it has totally screwed up your pagination, etc. Basically it translates to a huge pain in the ol’ keester.
So Microsoft decided, hey, you know what, let’s make it so you can actually place the spreadsheet document itself into the word document, and you can edit the spreadsheet and have it update in the word document automatically. One of the development team leaders for excel at the time said, “that might be a bit difficult” at which point they fired him and hired somebody else. I’m making this up, obviously. the quip was more along the lines of him trying to discuss his previous extra-marital relations with the project managers mother. Or maybe it was their wife, in either case it’s generally not something you bring up around the water-cooler even in faint whispers, let alone in the middle of an important business meeting about important businessy things, like who keeps taking the bloody stapler.
Anyways, Microsoft eventually perfected the technology that they called OLE. (oh yeah, and just so everybody is aware, it’s apparently pronounced “olay”… so don’t try to embarass yourselves. I still personally pronounce it Ohh- Ell- eee, but hey, I’m a rebel. Also pronouncing it “olay” is just begging for jokes about “oil of OLE” or perhaps even matador references. It just feels like it was chosen for comedic reasons.)
using OLE, you could link your excel spreadsheet to your southern US based newspaper, by using the very popular “Copy” command from Excel, and then using “paste Special” in word, you could get the following dialog:
As you can see, there are a number of choices here. the relevant one to this discussion is to insert it as a “Excel 5.0 Worksheet”- the default for the two radio buttons on the side is to actually “paste” the item into the document; here I’ve chosen to paste a link. pasting the spreadsheet into the document directly (rather then linking it) still allows you to edit the spreadsheet, but the spreadsheet data itself is saved right in the word document when you save it. Because linking the object instead offers one extra point of failure and because I like living on the edge, I always opt to link the documents even if I have no good reason to.
In any case, the resulting newsletter is this:
beautiful! such magic is the very essence of OLE. In fact, one could even take advantage of OLE in their Visual Basic Applications, starting with Version 2.0, which included, among other useless “professional” controls, the OLE client control.
“But I thought this entry was about the ROT” you ask. to which I reply, shut the hell up, will you, I’ll get to that eventually, and the less you try to fictitiously interrupt me the quicker I can try to ease the topic back to the present day and the running object table. Don’t worry, I haven’t forgotten about it.
Anyways; as I was saying, COM was basically what this OLE magic is based on, and was in fact the “plumbing” that made OLE work. OLE was only the visual manifestation of COM; therefore it was the part that was oooh’d and ahhh’d, (although the actual response was more a hum and a haw, since nobody could really figure the bloody thing out). COM just sort of sat in the background. unnoticed, watching OLE take the spotlight, earn all the respect and get all the beautiful women and free cream soda. Microsoft created something called “OLE Controls” whereby various User Interface widgets could be created using a number of OLE Interfaces with confusing names and functions, like an IPersistFile that didn’t deal with files, IOLEActiveObject, and other weird esoteric interfaces.
Things started looking up with the creation of “ActiveX Controls” which are exactly the same as OLE Controls, but don’t require all the silly interfaces to be implemented (at least, not as many of them). Pretty much all you needed to implement were a few basic interfaces. With the release of Visual Basic 5.0, this task became even easier; soon enough ActiveX Controls were sprouting up out of basements everywhere with dubious security and hardly little effort or skill. Unfortunately this had the effect of backfiring on Microsoft as they had forgotten that IE3 sorta just allowed ActiveX Controls to do what they pleased; in the long run, Internet Explorer gave ActiveX a very bad name. The technology itself is sound; however, one consumer (Internet Explorer) has an awful track record when it comes to actually being intelligent with what is actually run. First MS decided, “ha! we’ll just make it so they have to sign the control as safe with this little tool” much to their surprise, the people who were doing illegal things already by creating spyware as ActiveX Controls gladly downloaded the tool and signed them, even though the EULA was quite clear that you couldn’t sign malicious files. “dear gawd! these people are MAD! mad I say! have they any idea the legal repercussions of agreeing to a shrink-wrap EULA implicitly in a completely non-legally binding way?” exclaimed… well, somebody at MS, to which the common reply was “Tom, we know you’ve been taking staplers home.”
In either case, ActiveX got noticed, and while IE was a massive failure when it came to using ActiveX, ActiveX was perfectly safe on the desktop itself; in fact, it’s still quite prevalent. Go ahead and look on your own windows machines- ActiveX Controls are found in “OCX” files. many are even installed by default. Because ActiveX was more a Programming technology then a silly little User Interface gimmick like OLE, programmers liked to pick apart it’s innards like a vulture likes to take it’s pick from the smorgasboard of delightful organs that are present on a freshly killed wildebeest. Programmers learned of the various COM component technologies that powered ActiveX and OLE before it.
It was around this time that COM itself became the “technology of choice” when it came to interoperating with the various components of windows. So much so that COM itself became deeply rooted in the Operating System; with the actual Shell interfaces that allow for such things as IE plugins and Browser helper objects and Shell Extensions being implemented as COM interfaces.
COM itself establishes a binary standard between modules; it essentially lays out how objects are to look in memory, so that other objects can use them. In a strange coincidence this layout was nearly identical to the way the Visual C++ compiler laid out it’s Class instances.
Unlike C++ itself, or java, or .NET, for example, however, COM does not really facilitate for most things that people seem to require in order for something to be “object oriented”. For example- there was no Implementation inheritance. There was interface inheritance, to be sure, but they didn’t add implementation inheritance because they believed that to replace parts of the functionality of a pre-existing class with your own while leaving parts of the original code intact requires a knowledge of what that code does beyond what you can see, and really there is no debating that fact on the level.
Now then, enter OLE automation, which was really just COM with a fancy name. OLE automation basically meant that you could “control” other applications from another application, completely cross-process. For example, nowadays you can write a VBScript that interfaces with Microsoft word to open a document, make changes to it, save it, and close it. This is possible through OLE automation, because the Word Program exposes itself to other applications, who, strangely enough, are not revolted by Word’s nether regions.
Visual Basic has allowed for the creation of ActiveX programs since Version 5; what Word would be equivalent to as a Visual basic project would be an “ActiveX EXE”. there are both ActiveX EXE and ActiveX DLL projects; they act quite similar to one another, in that the various methods of using their objects are the same in either case. the main difference between them is that an ActiveX EXE is, for obvious reasons, a completely separate process, while a ActiveX DLL is contained in the same process and every process that uses it. This means that all data passed back and forth to an ActiveX EXE needs to be marshalled across a process boundary. Very time consuming, but at the same time the EXE can perform operations asynchronously from the application itself, which, in the case of Visual Basic, really only has a single thread.
When a ActiveX Server program is running, the general idea is for it to add itself to something called the “Running Object Table”. This ia global table that stores all the various active COM objects that can be retrieved. For example, Word, Excel, Access, etc, all place their “Application” objects into this table.
Visual Basic ActiveX EXE programs, however, for whatever reason, do not. This despite Visual Basic having a function that can acquire objects from the running object table, the GetObject() Function.
GetObject
The GetObject Function is probably one of the strangest functions with the oddest behaviour and the quirkiest set of rules of all the functions in the Visual Basic Language. The syntax seems simple enough:
GetObject([Pathname],[class])
pathname, we can guess from our encounters with Excel and word with OLE, would probably accept a OLE enabled document. and lo and behold, passing a excel, word, or other OLE server application document returns that document object. the class parameter however requires some explanation regarding it’s background.
All COM objects have at least one thing associated with them; a CLSID, which I guess stands for “ClassID”, but could just as easily stand for “Chickens Like Seeds In Dung”. This CLSID is required when instantiating (creating an instance of) the object. Some objects have another, optional, more human readable representation, known as a “progid” (god knows what it stands for. I’m going to say “People Really Ought to Give It a few Days” or something. This is far easier to read then the CLSID. a ProgID might be “Excel.Application”, whereas it’s CLSID is {00024500-0000-0000-C000-000000000046} (although technically it fits in 8 bytes, this is the conventional “human readable” form of a CLSID.
Now, you can call me dull, dense, made of cheese or fond of yogurt, but I don’t think I’m too far off-base in saying that the progID, While having an utterly ridiculous acronym expansion that I just made up, is a lot easier to read then the CLSID.
In any case; the Class argument to GetObject() is actually a ProgID. So the question is; how does one call this function to get a running instance of the program? If you do:
Set X=GetObject("","Excel.Application")
a new instance of Excel starts in the background and your given it’s application object. However, it turns out the first parameter is optional… you can in fact do this:
set X = GetObject( ,"Excel.Application")
and your given a instance of Excel that is already running, if available. If not, you get an error. You can trap the error and perform either the former empty string version of the function call or use CreateObject() to create a new instance explicitly though, if necessary.
Now, given that GetObject() when used in that scenario acquires the object from the running object table, it becomes evident why it will not work for Visual Basic objects; as previously discussed, the visual basic Runtime never actually anything to the ROT. This means it’s necessary to do so yourself by explicitly adding it to the ROT using the COM API.
Now, although I wrote the class I describe in the forum post 5 years ago, I distinctly remember that from beginning to end only took about 30 minutes. Most of the COM code I have in there was ripped directly out of a module in my BASeEdit XP project I was working with at the time. One tool I found useful while I was working on it was a little Utility that came with Visual Studio 98 called “ROT Viewer”. Since IT doesn’t appear to be available online anywhere, I have taken the liberty of uploading it myself.
Even the non-programmer can get a few minutes of mild amusement out of the program. With Vista and 7, you need to start the program with Administrator rights, otherwise it doesn’t show anything. Try it out; start word, excel, (I wonder if MS works has a COM server…) and any number of other programs, and watch them get added to the table, close out the programs, watch them leave… OH THE EXCITEMENT!
I bring forth to you all an important cause.
Ever since the inception of programming, we have used things called Variables. they store our data, they help us to keep track of the ever-changing environment that is where our programs stand. But how often do we think of their rights as individuals? We instead try to optimize them away; “we don’t need that variable” or “we could make that a constant”. You self-centered bigots! All a variable asks is maybe a few bytes of memory, and possibly the ability to be thread synchronized, but you are trying to remove these little helpers as if they have no right to exist! consider the following:
public class ExampleApp
{
private int munused;
private int maddthis=56;
public static main(String[] args)
{
System.out.Println("Hello from main");
for(int i=1;i<51;i++)
{
x /= (++x/i++)/(maddthis*--i)
System.out.Println("x="+x);
}
}
}
Any experienced variable killer can see that they can delete munused entirely, and that they can can convert maddthis to a constant. But what they don’t consider is that they are KILLING innocent variables! Programmers these days endeavour to learn programming practices and implement them with unfeeling and unwavering constitution, with absolutely no regard for the font families they destroy or the variables they create; it’s important to relate to your variables. your average programmer sees a temporary or unused variable as wasteful; I see a variable that is going through a scary change, who needs a friend (have you ever considered the Variables feelings when you typecast an int to a double? your just highlighting that variables shortcomings! you’re telling that variable that they are inadequate, that their data type is simply inferior to the one you are casting it to. And you know what that variable loses? It’s value. Now some other new variable is holding it’s value, and it supports floating point operations, and because of it’s type it gets twice as many bytes of storage!). Tell stories to your variables. Tell then the bible story of Variable Jesus who allowed it’s own destructor to be called, just so that all other variables can have everlasting scope. And, remember: NEVER tell your variables what their scope is. If they discover that their destructor will be called right after this quick for loop, they may go mad. “What? I only have 3 iterations left to live! I’ve lost all scope!”. Be sure your variables know their place. “All variables are created equal- it is their initialization that makes them unique”. Function Pointers have a tendency to forget that they are variables; they walk and they talk and they even have similar syntactic requirements as a function, but don’t be fooled! they are really just a variable in a functions clothing. Don’t try to call a null function pointer or the clothing has a habit of chafing.
Object Variables
Object Variables are possibly even worse then Function pointers. they always consider themselves superior to all the primitive types, like ints and doubles. what Object variables don’t realize is that the vtable that makes them who they are is really just a structure; a collection of function pointers. In fact, make sure your object variables know they are really just a collection of function pointers and private data. Also, educate your young object variables. “never show your privates to strangers, even if they give you memory” and never EVER let anybody put something in your back-end!
If you know somebody well enough, you might want to share certain protected variables with them, as a gesture of good faith. But you still should not trust them with your privates. they might still try to shove data in your back end.
Make sure your objects understand that they really are just the sum of their aggregate parts, and that they have their superclass to thank for almost everything. an Object is created, it is given a few pointers, and sent on it’s way.
Your standard pointer variables are pretty unpredictable too; remember that dereferencing, for a pointer variable, is a very traumatic experience. It’s also important to reduce aliasing as much as possible; to avoid indentity crises between multiple variables who meet and see that they both point to the same memory space. It’s important that you initialize pointers, as well. There is nothing more traumatic then a variable discovering it is equal to 0xCCCCCC or 0xDEADBEEF, and that it is really holding a flag. a flag of surrender. Unless the variable is French this won’t feel right for it.
The scourge of the internet, really. Personally, I call them script kiddies. Essentially; they use other peoples scripts to “DoS” a website. A number of fine specimens can easily be found on youtube. For example, http://www.youtube.com/watch?v=iVfEoBPV4Nc. What makes this particular example even funnier is that they don’t even understand what is happening, AND they don’t understand why they are so stupid to even try.
Basically, there are two levels of “hacker” now, 99.9% of them are really just script kiddies, who can hardly even understand Batch files, let alone perl. They copy and use scripts (such as the posted youtube video’s kiddie) created by the 0.1%. What makes it all the more interesting is the 0.1% people often are unaware of their code being used this way.
In either case, a DoS attack is so simplistic to the very core that any cheap 20$ router at the local wal-mart can block it; and any sufficiently equipped server can deal with the extra load from a single PC quite easily.
In this particular example, the first web-site mr.kiddie tried was obviously set to reject constant HTTP get requests. I mean- it’s not too hard to mechanically filter out GET requests that come within, say, a second of each other for the same page, and even the most basic server software implements this.
What happened to the second, less developed (apparently) site simply doesn’t have basic safeguards in place, perhaps because they live in a optimistic world where teenagers go out and get jobs instead of sitting on their asses all afternoon trying to take credit for copy-pasting code from other sources in programming languages they only pretend to know in order to take down some site that nobody will miss for the 10 seconds they manage to bring it down, and then they get called to dinner, where their veteran father yells at them for being so god damned lazy and for not mowing the lawn, to which the “experienced hacker” responds, “you’ll be sorry, I’m gonna start the next M$, and you will be begging for dollaz from me pops” and then he get’s grounded.
The “hacker”… or more precisely, the “script kiddie” culture is really quite simple, much like the social structure of one-celled organisms. You have the fat hairy parameciums, and then you have everybody else. their interactions with one another generally involve using made up english words, like “pwned”, and of course replacing as many of the letter s with z’s in a desperate attempt to look cool. Additionally, conversations often just involve them making stuff up.
“Hey, dawg, I just haxxored Oracle, d00d”
“Oh yeah, well I’ve been buyin stuff off ebay for free using my l33t skills”
ad infinitum. Even early on it’s absurd; I mean, my grandmother could hack an Oracle server with two toothpicks and a ceramic bowl, it’s really that easy, Hell, my second cousins guinea pig was able to drop a few tables from one of their badly administered database servers, but that’s not the point.
You know what? I’ve spent a good 5 years trying to shrug this shit off but I’ve grown sick and tired of putting up with arrogant, know it all little shits whose knowledge could be summarized on the head of a pin. I’m SICK of hearing about how “talented” little Billy is, and then looking at the code only to mistakenly believe little billy designed his code to emulate that mysterious sack of mould in the back of my fridge. Why do I hate this so much? Do I need a really good reason to hate it? really? because honestly I think the problem damn near hates itself, in a manner of speaking.
To make things worse, not only is little Billy a arrogant little prick, but his own ego is fed by his own family members, “Oh, little billy is a genius! He found the file menu in Word, He’s gonna be the next bill gates!” No, Uncle Tom, Billy Didn’t find the fucking file menu, your just too retarded to see whats right in front of you. Do I get points for pointing out a lawn chair for you to sit in when your sitting in it? No, I don’t, and I really don’t think billy should be proud of himself for pointing out the obvious, instead he should feel pity for somebody so stupid they cannot understand a basic UI and then evangelize the person who comes to point out the obvious.
The problem with the entire thing is, either they “have it” or they don’t, and the longer they fester, with no real skills, seated on their high pedestal because they mistakenly believe that employers will come to them after they barely graduate from high school, because of that awesome space shooter program they made in Visual Basic 2.0 and released on a shoddy geocities web site. Is theĀ longer they don’t gain any skills whatsoever, and the higher the chances that they will be struck down, working as a custodian in their local elementary school. Having been forced to realize that they aren’t bloody geniuses, that copy-pasting other peoples code is plagiarism, not “leet skills” and that they really, really, really, have a lot more respect for their old schools custodian.
Another issue- and this applies globally to programmers,software developers and those that want to pretend they are one of those two, is that they mistakenly believe they have reached a “plateau of greatness” or skill; No programmer, no matter how much experience, cannot learn something new; and it’s far too common that you have people, fresh out of college, or high school, or whatever, that think that because they read the programmers guide included with Visual basic 2.0 that they can crank out AJAX applications; this simply is not the case. It’s not a plateau- it’s a group of infinitely rising mesas, and joy of programming comes from climbing those mesas, every once in a while looking back, and realizing just how far you’ve come; just remember to do one thing before you start feeling satisfied; look up, and realize just how far you have to go.

Categories
Tag Cloud
Blog RSS
Comments RSS


Void
Life
Earth
Wind
Water
Fire « Default
Light 