The Causes of Crime

Common sense combined with education (biology, chemistry, psychology…) and observation (statistics, history…) points to three root causes of crime. Crime is usually if not always a function of one or more of money, hormones, and mental defect.

Money is an easy one. The vast majority of crimes are due to money. Robberies, theft, muggings, embezzlement, extortion, kidnapping, the list goes on. Nobody is immune to it either. The poor are susceptible to money-crimes because they need it and don’t have it (desperation). The rich are prone to money-crimes because they have a taste of it and want more (greed). It is not generally treatable other than with money. Unfortunately, society is not likely to vanquish hunger, homelessness, and such anytime soon since it is just too pervasive, so until Star Trek replicators are invented, this will continue to be the most common cause of crime. “Money is the root of all evil” indeed.

Hormones are pretty easy too, they are the second leading cause of crimes. Rape, adultery, pedophilia, assault, battery, manslaughter. Again nobody is immune to hormone-crimes since we all have them and frankly there is no defense against them; they affect our brains directly. Usually they are caused when a person has too much of a hormone, although a deficiency can also cause it. There are two kinds of hormone-crime, sex and violence which can even be combined. Hormones are the best candidate for treatment. They are not something that is overwhelmingly widespread like money, nor is it a permanent condition like mental defect. When properly diagnosed in time, the right medications or therapy can help treat or even cure hormonal imbalances and thus prevent hormone related crimes.

Mental defect is rarer than the other two. Mental defect-crimes are popular material for books and movies because they allow for unusual characters and an edgy and uncomfortable scenario. Crimes committed by people with mental defects don’t really have a tangible motivation; they commit them because the act itself gives them satisfaction—the act is the goal not the tool to achieve something else. Serial killers, people who delight in the torture and maiming of people and animals, pyromaniacs, kleptomaniacs, and the like all have some sort of defect in their brains that causes them to behave in an abnormal and destructive way. Mental defects are not usually curable. Like height, gender, skin color, etc. they are just part of who the person is since the brain cannot currently be “re-wired”. Unfortunately those who are “criminally insane” are more or less condemned to being put away in a state hospital for life. “Crimes of passion”, those done for love can be caused by either mental defect or possibly just a hormonal imbalance (ie, temporary insanity). A less movie-worthy cause of crime due to mental defect is when a person simply does not understand what they are doing is wrong because they either do not have the mental capacity in general (a “mentally-handicapped” person) or they have a defect that prevents them from understanding why it is bad (eg a sociopath who cannot relate to their victims).

When To Pull the Cord

Having involuntarily had to ride the bus for many years, I’ve gotten to know the experience very well. One thing I’ve learned is when to pull the cord. While most people probably don’t give much thought to the timing (and I know this to be the case), it is not as simple as you would think.

The ideal time to pull the cord varies depending on several factors, but there are two main things you need to consider. Don’t pull it too early and don’t pull it too late.

Too late is obvious, it means that you shouldn’t pull it when the bus is too close to your stop since it will be difficult or even impossible, and certainly dangerous for the driver to stop in time, particularly if it’s snowy or rainy.

You may wonder what’s wrong with too early; what could be bad about pulling it immediately after you pass the stop before yours? This one’s not a safety issue, it’s a convenience issue. If you pull it too early, then the driver will start slowing down too early and it will take a little longer to get to your stop. Granted it may only be a few seconds more, but that’s still a few seconds you get back which can add up day in and day out, also anyone who’s missed the bus, train, or anything else by just a few seconds can attest to the importance of a few seconds.

There is no simple number such as four seconds before the stop, ¾ of the way between the two stops, etc. that can be used universally. It’s really just up to each person to use good judgment and common sense to figure it out. If you ride the same route often then it will be all the easier to figure out.

Bad RAM? Maybe Not.

It has become more and more popular to blame computer problems on bad RAM—poor RAM. While it’s certainly possible to have a RAM module with a problem, it’s not as common as people would have you believe. In the past few years with the release of various RAM testing apps, there has been a surge of comments to the effect of “test your memory”, “you’ve probably got bad RAM”, “you need to replace your RAM” in response to posts about computer problems. It is just so easy to blame the RAM since it’s one of the only things that can successfully explain intermittent or unexplainable problems. The snafu is that even when the RAM is at fault, it’s not necessarily because the RAM is bad, it could—and usually is—because the connection is bad.

There are three common ways that RAM can be the cause of a problem. The way that everyone is raving about is a defective RAM module, that is a problem in a RAM chip or circuitry. This would render it useless (for all intents and purposes) and require just chucking it and getting a new one. Another problem could be the contacts on the edge of the RAM module could be dirty or have a patina on them, which impedes contact with the socket. In this case, the RAM may or may not be detected and could work partially or not at all. Finally, the RAM socket itself could have a problem. It could be that the contacts are dirty or the pins/pads are bent. Fortunately the contact problems are more common and easily fixed.

If the contacts on the RAM module are dirty, then simply using a little water to dampen a small sponge can be used to clean them. There are fancy patina cleaners, but all you really need to do is to clean those little pins on the edge. Pretty much anything will do, even alcohol or solvents, as long as you don’t let them dissolve the metal, just clean them and wipe it off. The best solution of course is to use some good old soapy water and some toilet paper.

The RAM socket is a little more tricky. If the pins are dirty, an effective solution is to lightly wet a used toothbrush, and gently scrub the socket up and down with it. This will do a good job of cleaning it.

If the pins on the socket are bent, then it may not make proper contact with the RAM module and will be a problem. More often than not, you will have to abandon the socket or even the whole motherboard, but with a little dexterity and the right tools you can fix it. You will need a long, find-tipped object, like a dentist pick, or something. It must be long enough so that your hands don’t obstruct your view, and pointy enough so that you can work with the tiny pins. You will probably need two so that you can grasp them and bend them back. You will also need good lighting and perhaps a magnifying glass. Take a good look at the socket and locate the bent pin. Examine it carefully to determine exactly what the problem is and which way you need to bend it to fix it. Use the tools to carefully bend it back to match the others. Plug in the RAM and give it a test. Be aware however, that they are metal and can only be bent so many times before snapping.

In conclusion, don’t throw away your RAM just because someone told you that it’s the cause of a problem or because a testing app said there’s problem(s). Before heading to the store, clean the RAM edge and run it through the test app. If that doesn’t fix it, clean the socket. If that doesn’t fix it, check for bent pins. If that doesn’t fix it, then go to the store.

Me and I

Your teacher always told you to say “so and so and I” instead of “me and so and so”. This is correct (most of the time), but did they explain why? It is often a point of confusion for most people because while teachers usually remember to teach that, they often do not explain the reason for it, which leaves people not understanding, which in turn can lead to problems such as using it incorrectly or not at all.

Many people think (and some are even taught!) that it is just more polite to put the other person first but that is NOT the reason. There is a legitimate grammatical reason.

In a proper English sentence, the first-person singular pronoun I is used where speaker is the subject of the sentence. That is, when the person is the one doing something. When the person is the object in the sentence, me is used instead. This is when the person is having something done to them. Examples of the former include I went there and I didn’t know what it was. Examples of the latter include He gave it to me, They helped me, and It happened to me too.

That’s great, but there is a much easier and faster way to determine whether a given sentence is grammatically correct. Since “blah and I” or “me and blah” are conjunctions (they combine two objects), you can break it down to its constituent parts to see if it still works. This is a simple method to show the proper usage. When do you use “…and I” and when do you use “…and me / me and…”? It’s simple; just separate the compound sentence by rewriting it with each subject, or object as the case may be, then test the sentences with each individually.

For example: “Bob and I saw the movie” becomes “Bob saw the movie” and “I saw the movie”. Both of those work fine, and so the sentence is fine as is.

What about “Me and Bob saw the movie” (or “Bob and me saw the movie”)? They become “Bob saw the movie” and “Me saw the movie”. Clearly, “Me saw the movie” is incorrect and so should be changed to “Bob and I”.

That is the reason you say “Bob and I”. Technically, you could also say “I and Bob” in a sentence like this, but most people would agree that it sounds and feels pretty awkward: “I and Bob saw the movie”

However, you do not always use “…and I”. For example, “You saw Bob and I” is incorrect because breaking it down becomes “You saw Bob” which is fine and “You saw I” which is wrong. The correct sentence would be “You saw Bob and me” or “You saw me and Bob”. This breaks down to “You saw Bob” and “You saw me” which is correct. At this point, the order of the subjects is up to the writer. Both “You saw Bob and me” and “You saw me and Bob” are valid, and there are no official rules to their order.

One hiccup comes in the form of the possessive personal pronoun, namely “my” or “mine”. This does not really work in the same way, though it is somewhat easy to figure out by simply trying the different forms. It would be “His any my cars were parked” as opposed to “His and mine cars were parked” (alternately, though somewhat awkwardly, “My and his cars were parked” instead of “Mine and his cars were parked”). Similarly, “They liked his and my food” is correct where “The liked his and mine food” is not. Where “mine” is correct, it is rarely combined due to its usage: “it was mine and his” (or “it was his and mine”) is usually just written as “it was ours”. Note, this can also be applied to the other forms as well: “We saw the movie”, “You saw us”, “Our cars were parked”, and “They liked our food”.

i.e.: e.g.

To avoid looking foolish, it is a good idea to learn to properly use the Latin abbreviations eg and ie. Think about what they mean, does the sentence sound right when you replace them with their English meanings?

AbbrLatinEnglish
EGExempli GratiaFor Example
IEId EstThat Is
  

Use a web-browser, eg: IE, FireFox, Opera.
Use a web-browser, for example: IE, FireFox, Opera.
Use a web-browser, that is, IE, FireFox, Opera.

He ruined the project, ie, he couldn’t finish it on time.
He ruined the project, that is, he couldn’t finish it on time.
He ruined the project, for example: he couldn’t finish it on time.

It is not difficult to use them properly when you know what they mean.

Self-Viewing Data Files

This article shows one way of creating self-viewing data files. Examples of such things include self-extracting archives and self-playing videos. Self-viewing data files are executable files that put the data and the viewing program together in a nice neat little packa-ge.

This will require two programs, the player and the creator. The player will be embedded as a resource inside the creator. The creator extracts the player (aka the “stub”) and saves it as the target file, then embeds the data file in that as a resource. The player, when run will read the data file from it’s resources and display it.

To accomplish this, there will need to be a few functions that access or manipulate resources. Here are the ones required and who the onus falls on:

StepFunctionResponsible
1Insert  viewing program as   resource into creator program   You, programmer
2Extract viewing program from resource and save to file       Creator program
3Insert  data file       as   resource into viewing program   Creator program
4Extract data file       from resource and save to file/displayViewing program

The obvious way to do this is to use the native resource functions. Unfortunately, the functions for updating resources is not available for Win9x systems, only the ones for reading them are. There is a way to add the missing support by using the MSLU but that adds to the size and requires including a DLL with the program. An easy alternative is to manually handle the “resources” by injecting them in and extracting them from the stub. This is the method used in this article. We’ll break down the work into the separate programs. First the player.

The Player (stub.exe)

Step 4
The viewing application (the stub) will need to be able to extract the data from itself. The data will be located at the end of the executable, followed by the size of the data (so that we know how much data there is), and finally a signature. Here is some (surprisingly) simple code—sans error checking—to read a chunk of plain text:

void ReadResource() {
    CFile f;
    DWORD sig =0;
    LONGLONG size =0;
    CString t =_T("");
    //open itself for reading
    if (f.Open(__argv[0], CFile::modeRead)) {
        //read the last 4 bytes of the file and check if it is the signature
        f.Seek(-((LONGLONG)sizeof(sig)), f.end);
        f.Read(&sig;, sizeof(sig));
        if (sig==0x12344321) {
            //read the size
            f.Seek(-((LONGLONG)(sizeof(size)+sizeof(sig))), f.end);
            f.Read(&size;, sizeof(size));
            if (size) {
                //seek to the start of the data
                f.Seek(-((LONGLONG)(size+sizeof(size)+sizeof(sig))), f.end);
                //allocate a buffer for the data and read it
                f.Read(t.GetBufferSetLength((UINT)size), (UINT)size);
                //display the read data in the edit control
                GetDlgItem(IDC_EDIT1)->SetWindowText(t);
            }
        }
        f.Close();
    }
}

Other types of data can be read in the same manner.

The Creator (create.exe)

Step 2
We can use the same technique as above to read the stub from the end of the creator program, but here is a way to do it with the normal method of using resources (which is supported):

//search for and locate the stub resource
HRSRC shstub=FindResource(NULL, MAKEINTRESOURCE(IDR_STUB), _T("BIN"));
if (shstub) {
    //verify the size of the stub
    DWORD rs=SizeofResource(NULL, shstub);
    if (rs) {
        //load the stub resource
        HGLOBAL hstub=LoadResource(NULL, shstub);
        if (hstub) {
            //lock the stub resource to get a pointer to it's first byte
            BYTE* stub=(BYTE*)LockResource(hstub);
            if (stub) {
                //create an executable file
                CFile stubf;
                if (stubf.Open("stub.exe", CFile::modeCreate|CFile::modeWrite)) {
                    //copy the stub to the file
                    stubf.Write(stub, rs);
                    stubf.Close();
                }
                UnlockResource(hstub);
            }
        }
    }
}

Step 3
The stub is now written to the disk but is just a viewer. We have to inject the data file for it to display:

//get the data to be injected (simple edit box in this case)
UpdateData();
CString  t =::GetWindowText(GetDlgItem(IDC_EDIT1));

CFile    f;
LONGLONG size=0;
DWORD    sig =0;

//open the player file
if (f.Open("myfile.exe", CFile::modeReadWrite)) {
    //we need to check if there's already something there
    //read the last 4 bytes from the player file and check if it's a signature
    f.Seek(-((LONGLONG)sizeof(sig)), f.end);
    f.Read(&sig;, sizeof(sig));
    if (sig ==0x12344321) {
        //there's already a resource there, so we'll have to replace it
        //read the size of the existing resource
        f.Seek(-((LONGLONG)(sizeof(size)+sizeof(sig))), f.end);
        f.Read(&size;, sizeof(size));
        if (size) {
            //add the size of the size and signature
            size+=sizeof(size)+sizeof(sig);
            //truncate the file, leaving just the stub
            f.SetLength(f.GetLength()-size);
        }
    }

    //seek to the end of the file
    f.Seek(0, f.end);
    size=t.GetLength();
    //write the data file to the stub
    f.Write(t.GetBuffer(), (UINT)size);
    //write the size of the data
    f.Write(&size;, sizeof(size));
    //write the signature
    sig=0x12344321;
    f.Write(&sig;, sizeof(sig));

    f.Close();
}

Step 1
Finally, we need to insert the stub into the creator program. If you are using the resource method, then it can be added as any other resource, making sure to use type BIN and using stub.exe as the source. If you are using the manual method, then you will need to manually append stub.exe to creator.exe, add the size of stub.exe, then the signature.

Now, just compile stub.exe, then creator.exe. Run the creator program and create some data. Click the export player button, and select the filename to save. The creator will read the stub, save it to disk, and inject the data. Now run the self-contained data/viewer file. It will extract the data from itself and display it.

Note: there are a couple of drawbacks to using this method. First, while it works, it is not part of the PE format standard. Future revisions of the PE format may break this, especially with the crackdown on code execution. Another potential problem is that some virus scanners may detect the modification of an executable as suspicious activity and thus have a bad reaction, causing itchy, watery eyes and a runny nose. The virus scanner can be circumvented however, by writing the stub to a non-executable file (say myfile.bin), then renaming it after the data has been injected.

Quieter, Smoother Computer

Most computers come with fans to keep them running cool enough to avoid problems. Unfortunately, fans have moving parts, move fast, and stir air. All this results in quite a bit of noise which can cause headaches, not to mention being down right annoying. It also causes a lot of vibration which further adds to the noise, headaches, and annoyance. Some people get rid of their fans and use alternative cooling methods, however most of these are just too expensive for the regular computer user, and worse, too complicated. Good computer cases will come with rubber feet instead of the hard plastic ones that cheaper cases have. The rubber feet will absorb the vibrations instead of passing them to the desk, floor, or whatever surface the computer rests on. If your case does not have rubber feet, then you can add them if you are comfortable/able to open the case. If not (or even if your case does have rubber feet), there is a quick, easy, and cheap trick that can help to reduce vibration which will result in less noise and provide quieter, smoother computing environment.

Simply place a couple of foam-rubber mouse-pads beneath the computer. You’ve probably got a few lying around somewhere, or can easily buy a couple for under a dollar. The design does not matter, so you can get generic ones for less. The thick, foam-rubber kind work best, although even the thin rubber kinds are better than nothing. In either case, you just slip in under the computer to cushion it from the desk, making sure that the rubber side faces the computer. Even better, fold it in half (rubber side out), and you’ve got a vibration damping, noise canceling, double-cushioned, non-slip shim between the computer and the desk.

*UPDATE*
Here is a blog entry which says pretty much the same thing and includes pictures.

Tip: Smooth Mouse Scroll Wheel

Here’s a tip for those with scroll mice. Take the clicker out of the wheel. Scroll mice usually accomplish the clicking of the scroll wheel by means of a spring or metal stick that press inside the wheel. Take this out, the wheel will turn nice and smooth. It may take a little getting used to, but it will soon feel great.

Of course you should realize that the clicking serves a function: to limit the movement of the wheel. If the scroll wheel is too loose, it may spin out of control without it, but normally it won’t. In fact, in some mice, the clicker may cause unwanted scrolling, so removing the clicker will eliminated that.

(The little metal stick inside my mouse broke recently, and I panicked because it was a fairly new, expensive mouse, but before I knew it I was hooked—pun intended. I never want to use a clicker again.)

Outlook Express Folder Compaction Error

If you get the following message for FOLDERS.DBX when trying to “compact all folders” in Outlook Express

The folder is currently in use by Outlook Express or by another application.

there is a simple solution. The error message is deceptive since the actual cause has nothing to do with being in use. The problem occurs when you try to compact all folders and not all folders are actually present on disk. This can happen if a .DBX file got deleted somehow (for example if you decided to save some space by deleting the .DBX files of empty folders.) When OE tries to compact, it checks the folders.dbx file to see what .DBX files to expect, and when it can’t find one, it complains with the inaccurate message above.

The fix is simple, just replace or recreate the files. The easiest way to do this is to simply open the missing folders in OE because it will automatically create a .DBX file if one does not exist.

If you do not know which ones are missing, you can click on “Local Folders”, press the * key on the keypad to expand all branches, then click on each and every folder—you could also use the Down key instead of clicking, but then you have to wait a second on each folder for OE to open them, clicking opens them instantaneously.

After you’ve ensured that all .DBX files exist, you can successfully compact all folders.

Registry Cleaners/Repairers: Caveat Usurpator

The registry is where Windows keeps most of it’s settings. It is also where most programs keep their settings. Ever since it was introduced in Windows 95, it has been a mysterious place where some people have dared to venture in the hopes of finding computing treasure. There are all kinds of articles on how and where to make modifications and tweaks to improve system performance, increase stability, add new features, and other enhancements to the OS.

One aspect of the registry that has been popular is the concept of cleaning or repairing it. The idea that it can get cluttered with traces of old, uninstalled programs, invalid file references, corruption, and manipulation by nasty programs, and that cleaning these out and repairing them, will help a system run better. There is of course truth in this, and making sure that the registry is free of debris is certainly a good thing. Unfortunately, doing so requires some skill and more patience than even the best of us have. It is now a vast storage with more entries than there are stars in the sky. A proper audit would take far too long. As a result, numerous programs have been written to help automate this process. They scan the registry for what they consider to be problems and list them for the user, eager to delete them. Unfortunately, few if any such programs does the job adequately or even properly. Most of them do little more than look for references to files that do not exist. Some will check other components as well, but searching for missing files tends to be the most popular function of these programs.

Modifying the registry is not always as hazardous as some would have you believe. There are plenty of changes that can be done or undone safely. Of course there are some which can make it extremely difficult to fix and can potentially require reinstalling the OS. Making changes to entries without noting what the previous value was, or deleting entries altogether, is an irreparable operation and so must be done carefully. The better cleaner/repair tools will allow you to back up the entries they modify before altering them, but some do not; be vary wary of these.

Another thing to look out for when using a registry cleaner/repair utility is whether or not it provides detailed explanations of the entries it deems problematic. If all it gives is a one-line reason (eg: missing file/invalid entry/etc) or says nothing at all, then you should be extremely careful. A proper utility will give you the option of viewing a thorough explanation of why they flagged an entry as being bad, and what it means. That way you can examine it and determine if it really is a problem or not.

The vast majority of these registry fixing applications return more false positives than they do genuine items to fix. There are numerous reasons why they can report a false positive:

MRUsA lot of apps keep track of files that have been opened with them and often the file no longer exists because they were temporary, moved, renamed, etc. So when the cleaner checks the MRU, it sees a file reference but the file is not there, so it complains.
Variables in filenamesMost of these types of apps are not capable of handling filenames that have variables in their path. For example while %systemroot%\explorer.exe is an existing file, the cleaner will nag that it can’t find it.
Other types of unsupported file pathThese apps usually only support simple filepahts (eg: c:\folder\file.exe) so they choke on other types of filenames like network paths (eg: “\\somecomputer\folder\file.exe”). Services often use this format: “\??\c:\myservice\service.sys” which they can’t read. URLs are another that can’t be checked by them. Some may, but most don’t support relative paths: “system32\blah.exe”.
Empty keysWhen some cleaners find an empty key(s) they figure that it’s just residue from an uninstalled program, and thus obsolete. This may be the case but no necessarily. It could just be that the app has not yet been run since installation, that the app hasn’t had reason to write to it yet, or that it uses the key itself as data: perhaps keeping a version number in the keyname, or using the fact that the key exists at all to indicate that the app is installed. Obviously removing it even though it’s empty, would mess things up.
Hidden/system files/folderSome of these apps are unable to determine if a file or folder exists if it is a hidden or system file/folder even if it does.
Special formatSome programs have entries that are in their own special format (eg: “something”=”c:\blah|The Blah Game|3|always”). These apps won’t be able to parse the value and identify just the file/folder part. (They should not be messing around with things they can’t handle anyway.)
Temp filesThere are often traces of temporary files, Internet caches, etc. left behind for a while. For example a browser may keep a list of it’s temporary files. When the user clears them out, they are still listed until the browser overwrites them with new entries, so the cleaner nags. Of course if the use cleared them through the browser, it should have wiped them from the registry as well, but the user may have manually cleared them or use another tool. In this case it’s perfectly fine since they are temp files, but the registry entries are still there. And, since the cleaner can’t tell the difference between an important file and a temp file, it complains about all.
Icon indexesPlain icon files (icon.ico) have a single icon while DLLs, ICLs, EXEs, and such may have more than one. In this case the specific icon inside is indicated in this manner: “c:\folder\icons.dll,32”. This means that the target is the 32nd icon in the file icons.dll. Almost all of these cleaners are unable to handle this and can’t find the file.

As you can see, the results from these apps are not very reliably and you should be wary of what they report. Not all of the entries they flag will be problems so you should examine them before making any changes. You should be aware that even if you run these programs immediately after a fresh installation of Windows, they will find quite a lot of things to complain about.

That’s not to say that you should not use these programs at all; they definitely have their use, just be careful. The best advice is to limit yourself to items you know for sure are incorrect, such as those for a program you have uninstalled, or for a file you deleted. If you are unsure about something, leave it be at least until after you have looked it up, and always make a backup (export a .REG file) so that you can recover from any mistakes.