Wikipedia:Reference desk/Archives/Computing/2017 March 16

= March 16 =

System Event Log Including Stop, Start, etc.
With Windows 10, is there a log file where Windows logs system events such as start and stop, and preferably sleep and wake up, and errors? Where? Robert McClenon (talk) 05:52, 16 March 2017 (UTC)


 * Yes - Control Panel -> Administrative Tools -> Event Viewer. 196.213.35.146 (talk) 07:15, 16 March 2017 (UTC)
 * Thank you.  The Event Viewer has an unfriendly user interface.  Is it documented?  Robert McClenon (talk) 19:12, 16 March 2017 (UTC)


 * Run EVENTVWR -- Hans Haase (有问题吗) 10:56, 16 March 2017 (UTC)
 * User:Hans Haase - Is it the same as what is mentioned above, or is it something else? Robert McClenon (talk) 19:12, 16 March 2017 (UTC)
 * It's the same thing, EVENTVWR is just the filename of the executable. ᛗᛁᛟᛚᚾᛁᚱPants   Tell me all about it.  19:20, 16 March 2017 (UTC)
 * Yes and it is amazing that it was kept since Windows NT. Its just the way to run the eventvwr. Maybe one user likes the GUI, another perferes the CLI. -- Hans Haase (有问题吗) 19:51, 16 March 2017 (UTC)

Collision detection with oriented rectangles
I'm working on something where I have to code from scratch (in VBA no less) a function that will detect collisions between 2d rectangles that may or may not have different z-axis rotations. Detecting the collision is easy enough: I've already written functions that check if a point lies within a polygon. The thing is, I need to be able to distinguish between 3 different zones on each face of the rectangle, to determine where the collision is taken place.

In the interest of avoiding the XY problem, the specific function I'm writing is supposed to document both which rectangle collides or intersects with the tested rectangle, as well as generally where the intersection/collision occurs. To take that even further, this is to automatically handle matchlines in Microstation sheet sets, so our drafters don't have to look up and type out each matchline themselves.

If anyone here has worked on anything similar to this, I'd really appreciate any insights you may have to offer. ᛗᛁᛟᛚᚾᛁᚱPants  Tell me all about it.  14:52, 16 March 2017 (UTC)


 * So your problem as far as I can see is defining where a collision occurs. And by collision you don't mean a single point but an overlap area. The best indication I can think of for where an overlap is would be the center of gravity of the overlap area, though others indications like the nearest point or including the area might give something. I don't know what matchlines are in aid of but hopefully it means a small overlap so you don't have things like crossed rectangles. ANyway there's an article Collision detection which might be of use. Dmcq (talk) 15:20, 16 March 2017 (UTC)
 * The best indication I can think of for where an overlap is would be the center of gravity of the overlap area Dude*, that is freaking brilliant. I've been poring over collision detection articles (and I've done my own collision detection before in 2d games) and this is the first time I've seen that idea. (I need to detect rectangles that are very close to each other and abutting as well, but this should still work if I just define a collision box on the primary rectangle to be slightly larger than the rectangle itself.)
 * the paragraph below is just me documenting why this is a good idea for the sake of curious readers.
 * So if I do that, I will get a point that will be within a certain radius of the edge of the primary rectangle or inside of the primary rectangle, at which point I can just get the angle from that to the center of the primary rectangle to determine the quadrant, then check whether the x or y offset divided by the median x or y dimension (respectively) in a shared coordinate system (halfway between the angles of the rectangles) is greater to determine which side to apply the collision to.
 * * I am assuming you are male which is slightly presumptuous but works for the sake of the prosaic flow of of my response. ᛗᛁᛟᛚᚾᛁᚱPants   Tell me all about it.  15:42, 16 March 2017 (UTC)
 * "('Dude') can encompass either sex.". For similar reasons, many wikepedians and internet fora users have come around to see the functionality appeal of the singular they. SemanticMantis (talk) 19:54, 16 March 2017 (UTC)
 * Aha! I see you living up to your name and appreciate it ;). You're right, and I'm a big fan of the singular they myself, as it's so much less silly than "xe" or "thon". ᛗᛁᛟᛚᚾᛁᚱPants   Tell me all about it.  15:27, 17 March 2017 (UTC)
 * Actually, it doesn't need to be the center of mass, the geometric center will work just fine (possibly better, though that's just a gut feeling I get from having run a few test cases). ᛗᛁᛟᛚᚾᛁᚱPants   Tell me all about it.  15:59, 16 March 2017 (UTC)


 * To reduce the processing as much as possible, if you could find the two points where the edges of one rectangle intersect the edges of the other, and find the midpoint, that would be simple. You could then find the midpoint of that point and the corner point of the one rectangle which is within the other. StuRat (talk) 18:40, 16 March 2017 (UTC)


 * That's exactly the tactic I ended up taking (which actually is, I believe the center of gravity/mass or at least the equivalent in mass-less 2d shapes, but I'm too caught up in code to think it through enough to know if that's right). I've already written down the logic in OneNote and run a few quick tests to make sure the results match my expectations, and it's looking good so far. I'm writing the code as we speak, broken up into nested functions that start by taking an individual rectangle, checking for rectangles close enough to intersect and then running the actual collision detection only on those that do. The rectangles can be of different sizes, as well as orientations, so I had to do it that way. ᛗᛁᛟᛚᚾᛁᚱPants   Tell me all about it.  19:07, 16 March 2017 (UTC)


 * Excellent. Let us know how it works out. StuRat (talk) 04:36, 17 March 2017 (UTC)
 * It's not the centre of mass - for an easy counterexample, consider the case of two rectangles with the same orientation, overlapping such that the overlap area is a square. StuRat's technique would not give the centre of that square (which is not to say it's not useful for your purposes). It would also not be the centre of mass of a triangle, though adjusting it to go only 1/3 of the way to the corner point in the final step would give the centroid (i.e. centre of mass) of the triangle. MChesterMC (talk) 09:44, 17 March 2017 (UTC)
 * You are, of course, correct. I was wrong above because I didn't think it though (though to be fair, I knew I wasn't thinking it through, lol). I've actually abandoned this approach.
 * While this approach was producing results, the buggy and somewhat random nature of VBA was causing problems. In all my VBA development for any application outside of Office, I've found that lines of code sometimes get skipped at run time when a script is too complex or when a modal dialog box remains loaded for too long. In this case, when I finished coding the solution and started testing, it was producing the exact result I wanted ~90% of the time, and throwing exceptions the rest of the time. I have error handling in my code of course, but that just told me what the errors were, and they changed each time an exception was thrown, so there was no way to really make it reliable. I've come up with a similar method that should require a lot less code and I'm working on that today. Cross your fingers for me. ᛗᛁᛟᛚᚾᛁᚱPants   Tell me all about it.  13:38, 17 March 2017 (UTC)


 * As far as I can get it, you define some rectangle-of-reference (a vieport? a sub-sheet of printout?) over a CAD project space, populated with multiple rectangles (objects?) and want to know which objects are visible in the rectangle of reference, and in which part of it. Is that correct?
 * I'm not quite sure what are "3 different zones on each face of the rectangle". Are those "a mid part" and two "end parts" of a side of the big rectangle?
 * Additional question. I understand you want to assign a rectangle collision to one of four sides or one of four corners of your rectangle of reference. How would you like to solve the case of a long, narrow object crossing two opposite sides of the rectangle of reference, similar to the black stripe on the Flag of Botswana?
 * And what about a rectangle covering the whole edge, like the lowermost red stripe on the flag of the USA?
 * And if the object crosses all sides, like a yellow stripe on the flag of the Solomon Islands or a black stripe on the flag of Tanzania?
 * What should be done if the object happens to be bigger that the rectangle of reference and actually cover whole of it? --CiaPan (talk) 15:04, 17 March 2017 (UTC)


 * Yes, a viewport. More to the point, it is a cell (known to AutoCAD users as a "Block") which represents the extents of an individual paper space viewport. It is also an object in the CS sense, in that I have an class which references that cell and extracts data from it to provide an interface with the rest of my code that isn't as clunky as directly accessing the cell each time. This class gets a new instance which is bound to each cell in the model space.
 * Yes, a middle and two ends.
 * That doesn't need to be handled, as those cases would represent detail sheets and there would already be a reference to them, created by the CAD tech.
 * That would need to be handled by the program, but is already caught in a "pre-screen" function that is called before I call the more complex collision detection function. For the sake of the original question, nothing really needs to be done for those.
 * This would represent another detail sheet, so would not need to be handled.
 * Then the sheet in question would be a detail sheet. So not handled.
 * To be perfectly clear, I have a working solution and am in the process of implementing it. But I understand the interest here, and I'm always open to new ideas, hence my answers. (I've added numbers to them in your comment for clarity, I hope you don't mind.) ᛗᛁᛟᛚᚾᛁᚱPants   Tell me all about it.  15:24, 17 March 2017 (UTC)
 * To be perfectly clear, I have a working solution and am in the process of implementing it. But I understand the interest here, and I'm always open to new ideas, hence my answers. (I've added numbers to them in your comment for clarity, I hope you don't mind.) ᛗᛁᛟᛚᚾᛁᚱPants   Tell me all about it.  15:24, 17 March 2017 (UTC)


 * For anyone who's interested: I finished it and it's working properly. The actual method I ended up using was much simpler: I took the scales of the two rectangles, the angles of each rectangle and the distance between their center points, and calculated whether they were overlapping based on that (there's a finite and rather small list of possible scales and aspect ratios, so this was very simple to do). Then I simply took the angle of the second rectangle's center relative to the angle of the first, and used that to determine where the overlap was. As is usually the case, the correct solution was extraordinarily simple, compared to the previous solutions I tried. ᛗᛁᛟᛚᚾᛁᚱPants   Tell me all about it.  18:59, 20 March 2017 (UTC)

Disaster - .CRYPTED files replacing .doc files
Something happened to the directory on my Windows 10 Dell desktop machine last night, and now all of my former .doc files (Word 97-2003) have a filetype of .doc.crypted, and appear to have actually been encrypted, at least in that if I open them, they contain gibberish. Does anyone know: (1) what would cause this (2) is there any way of recovering from this short of reloading the files from a backup to flash drive? Thank you in advance. Robert McClenon (talk) 19:22, 16 March 2017 (UTC)
 * For a likely cause, see Ransomware. It could be one of several variants. There may be a recently created readme file lying around, but you might want to ignore its contents other than to gain clues to its identity. Do not insert a flash drive containing your only backups unless you know the cause has been fixed. -- zzuuzz (talk) 19:34, 16 March 2017 (UTC)
 * Shut the computer down immediately and unplug it, then take it to the geekiest computer geek you can find, preferably one who specializes in cybersecurity and charges a lot of money. This is a cryptolocker ransomware. With just a few files (especially small ones, especially when you know the exact contents) you can probably find someone to brute force it for you, but not if you let it keep going, which it will do if you don't shut it down now. ᛗᛁᛟᛚᚾᛁᚱPants   Tell me all about it.  19:36, 16 March 2017 (UTC)
 * No need to take the whole computer, only the hard drive. Or you can scan it with an anti-virus software yourself (after connecting to another computer). Ruslik_ Zero 20:10, 16 March 2017 (UTC)
 * No need to take the whole computer, only the hard drive. I once advised a coworker to remove their hard drive and take it to a friend's repair shop. The next day, my friend called asking why I'd sent someone in to recover data from his PSU. I'm still chuckling about that as I write this, but I recognize that not everyone is going to be comfortable removing their HDD, so taking the whole tower is what I recommend these days.
 * Or you can scan it with an anti-virus software yourself (after connecting to another computer). I wouldn't recommend that; if the malware is not detected by the AV, it could spread, and it won't be fixed. Plus, the AV's generally can't decrypt the data, whereas a specialist can., I just want to be clear that when I said "preferably one who specializes in cybersecurity and charges a lot of money" what I meant was someone professional and specialized. You don't actually have to take it to the highest-charging IT consultant in town, just a reputable repair shop that can do ransomware removal. ᛗᛁᛟᛚᚾᛁᚱPants   Tell me all about it.  20:20, 16 March 2017 (UTC)


 * The answers I see here have to do with "how do I fix it." I do not see anything about "what could cause this." It is called ransomware (as noted above). It doesn't magically appear on your computer. You installed it. I know that you didn't go out and hunt down some ransomware to install. You were trying to install something else. What was it? Where did you get it from? You don't have to answer. Nobody ever wants to admit that they were trying to load a video of Obama and Hillary bumping uglies on Air Force 1 and it required some special video player that could only be found on a website that said "Absolute free and secure! Look at all the official-looking stamps of approval all over this page!" You know that you did it and that is what caused it. 209.149.113.5 (talk) 12:28, 17 March 2017 (UTC)
 * Umm... You have to read the comments before you can accurately state what's missing from them. "Ransomware" appears three times above your comment in this thread. And while I'm assuming your comments about how he got it were meant to be funny, they are also rather demeaning and inaccurate: Ransomware can be pushed remotely, and quite often is. Many security vulnerabilities can be exploited to allow an attacker to surreptitiously install software onto a target machine. A person need not be trying to look at Rule 34 porn to encounter attack sites, nor need they be gullible enough to install obvious trojans to get hit with ransomware. ᛗᛁᛟᛚᚾᛁᚱPants   Tell me all about it.  14:59, 17 March 2017 (UTC)
 * In this thread, some posts have said or strongly implied "run an antivirus and it will clear your problems" and "don't click on shady websites and you will be fine". Both of these are attractive propositions from a moral point of view (white knight Norton triumphs over the wretched hackerz for a small fee, sinful web users get punished) but are more wrong than right in 2017 (the latter might have had some reality ten or so years ago). Antivirus software is more preventive than curative (and even then, some will claim it is closer to snake oil than TO an effective vaccine). Tigraan Click here to contact me 16:50, 17 March 2017 (UTC)


 * I don't have faith in antivirus programs. While I do not do desktop management (thank god!), I do assist those who do when a problem requires experience. Every time - absolutely no exception - I have traced the problem (be it ransomware or just a basic virus) to a specific action by the user. The biggest culprit among business employees has been installing video codecs or players (including audio codecs or players). Over in academics, it is installing "free" software, usually games. I have never had a case that I had to chalk up to having software magically pushed onto a machine. 209.149.113.5 (talk) 16:57, 17 March 2017 (UTC)
 * The company I'm working for right now has had ransomware pushed to their machines twice through security vulnerabilities. In one case, we suspect it was offline social engineering that compromised a user's login and password. Just saying "Don't click on suspicious links, even if they swear they're not suspicious" doesn't even begin to address the problem. ᛗᛁᛟᛚᚾᛁᚱPants   Tell me all about it.  17:03, 17 March 2017 (UTC)
 * For me, I tell the people to use their phones. I don't care if they are trying to watch porn or download music. Use your phone. Get it screwed up. Leave the work PC alone. But, compromised passwords is an entirely different security threat that, in my opinion, is far greater than people installing junk. If we could just remove humans from the whole security issue, it would be so much easier. 209.149.113.5 (talk) 17:13, 17 March 2017 (UTC)
 * "If you click on shady links/install dubious freeware, you are (much) more likely to get a virus" is true. You installed it. (...) You know that you did it and that is what caused it, which is equivalent to "If you got a virus, it is because you clicked on shady links/installed dubious freeware", is wrong. Tigraan Click here to contact me 17:26, 17 March 2017 (UTC)
 * That's exactly right. ᛗᛁᛟᛚᚾᛁᚱPants   Tell me all about it.  17:56, 17 March 2017 (UTC)


 * Another option, if you have external backups of everything important and have the install disk for the O/S, is to wipe the disk and reinstall the O/S, then read in your backup files. Downside is you will lose a lot of personalized settings, bookmarks/favorites, and software you loaded after.  On the plus side, this method is free, doesn't require letting somebody else mess with your PC, and is guaranteed to fix the problem. StuRat (talk) 20:00, 17 March 2017 (UTC)