Jump to content

Wikipedia:Reference desk/Archives/Computing/2016 January 14

From Wikipedia, the free encyclopedia
Computing desk
< January 13 << Dec | January | Feb >> January 15 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


January 14

[edit]

GPS Vehicle Tracking

[edit]

I have a truck fitted with gps. Once the vehicle is loaded with goods an automatic entry (truck loaded:with place and time) should be made in my home computer. And same when unloading. Is it possible to do? Is there any software which can help me? — Preceding unsigned comment added by 117.216.166.50 (talk) 11:15, 14 January 2016 (UTC)[reply]

Possible? Sure. Software? You'd probably need something custom. A service like Life360 will record the GPS location at all times. The driver can check-in to highlight locations. You can look at the GPS history of the truck and see where it was all day and when it had check-ins. You can also set locations and get a text or email alert when the truck arrives and leaves set locations. 199.15.144.250 (talk) 13:46, 14 January 2016 (UTC)[reply]
I guess the problem here is that while the truck knows where it is - GPS can't tell you that it's being loaded or unloaded - and with just a GPS unit, there isn't a way to transfer that information to your home computer. So you'd need something more complicated than just that. Instead of just a GPS, you'd want to use a cellphone - which includes a GPS and also has the means to send the results elsewhere. You'd also need to find a way for this device to conclude that the truck is being loaded or unloaded rather than just stopping some place en-route for donuts. Automating that by (let's say) measuring the weight of the truck would be difficult with off-the-shelf equipment - so you'd probably be reduced to knowing that it's been stationary for a certain amount of time within some specified distance of the known loading and unloading locations.
You could just have the driver send a text message when loading or unloading - using the hints HERE, you can arrange to have the GPS coordinates included in the text message - the time is already there. Providing your drivers actually do this, you'd have pretty much all you need.
SteveBaker (talk) 15:40, 14 January 2016 (UTC)[reply]
If the truck is being completely unloaded each time, there are several options, e.g. a light gate or a simple pressure sensitive switch. Takes a bit of fiddling to get the signal out, but nothing too hard. Might not be the most reliable unless you can ensure that the switch is always active when there is stuff in the truck, and nothing can activate the switch when it is unloaded (e.g. the driver putting their lunchbox in the back). If you don't mind adding some steps for the driver, then barcodes/RFID on the packages and a barcode/RFID scanner (which can just be a smartphone camera/NFC reader) could be used to mark what is unloaded and loaded. Either way, it's probably going to take some custom software to get what you want. MChesterMC (talk) 16:56, 14 January 2016 (UTC)[reply]
Well, a truck has no scale installed inside the suspension, but opening a door is an event. When grabbing the NMEA protocol lines from the GPS, send the last line when the door opens. --Hans Haase (有问题吗) 21:11, 14 January 2016 (UTC)[reply]
Opening the doors are an event, but even if restricted to certain locations and requiring the door to be open for certain periods of time you are still likely to get inaccurate results unless the door is really only ever opened once for loading/unloading and closed soon after the loading/unloading is completed and never opened again for long periods until the next loading/unloading. If the door is opened for loading/unloading then closed again when the people go to lunch, you're likely to get confusing results. Or if you can't really program every place the truck is likely to be loaded/unloaded or some loadings/unloadings are likely to be short. It depends significantly on what the OP is trying to do, the size of the truck, the behaviour of the people involved, how bad it will be to have the occasional wrong or confusing results etc. Nil Einne (talk) 15:58, 15 January 2016 (UTC)[reply]

When a courier guy delivers a package, he says me to sign on his mobile. and after signed, package delivered is updated on their website . What is the software they use? I feel that I can use that idea for loading/unloading. — Preceding unsigned comment added by 59.88.196.26 (talk) 17:56, 15 January 2016 (UTC)[reply]

Do you need the same knowledge or steps to compile and decompile (or to assemble and disassemble)

[edit]

Is compilation and de-compilation (or assembling and disassembling) just like the difference between 3 * 4 and 4 * 3? Or is it like the difference between multiplying 101701 by 101719 (= 10344924019) or factorizing 10344924019 (factors 101701, 101719)?--Llaanngg (talk) 15:34, 14 January 2016 (UTC)[reply]

We could come up with lots of clever analogies, but it would be best to refer you to a book on computer theory or compiler design... why don't you start with Patt and Patel? It's a great book for beginning to understand the great depths of computer systems theory.
You can think of a compiler as a piece of software that implements a mathematical function to project from one set onto another set; this is strictly the part of the compiler called "translation." This mapping function is neither complete, nor "one-to-one" nor easily-invertible; so the process of "decompiling" is not well-defined. That leaves a lot of room for interpretation. It is probably not a good idea to confuse this ambiguity even further by introducing complicated and tenuous analogies.
Nimur (talk) 15:48, 14 January 2016 (UTC)[reply]
OK. I'll check the ref. Llaanngg (talk) 15:51, 14 January 2016 (UTC)[reply]


Compilation and assembling is an automatic process - no special skill or knowledge is really needed. De-compilation and dis-assembling is a much harder process. Firstly, the compilation/assembly process throws away a ton of information that you simply cannot get back. Typically, you'll lose the names of all of your variables - so you start with:
  double Pythagoras ( double width, double height )
  {
     // Calculate the length of the hypotenuse of a right triangle
     double hypotSquared = width * width + height * height ;
     return sqrt ( hypotSquared ) ;
  }
...and after compilation and de-compilation, you might get something like:
  double f1 ( double v1, double v2 )
  {
    double v3 = v1 * v1 ;
    double v4 = v2 * v2 ;
    double v5 = v3 + v4 ;
    double v6 = f2 ( v5 ) ;
    return v6 ;
  }
...which would take some skill to understand for what it is.
This is an especially simple example - in the real-world, it's vastly harder because we have things like inlined functions, automatic loop unrolling, memory location re-use, statement re-ordering, register use optimisation.
These things destroy the original human-readable code and produce something that is best for the CPU to execute. When you de-compile, its up to the decompiler to try to deduce what humans would prefer to see...but that's often an aesthetic choice - and not one that the decompiler can make.
SteveBaker (talk) 15:51, 14 January 2016 (UTC)[reply]
They are not very different really. As you say, decompilers optimize for "understandability", which is less well defined than execution speed/size, but that doesn't mean there's nothing you can do to improve it. A decent decompiler would at least produce something like return f2(v1 * v1 + v2 * v2); rather than your five-line version. A better one would recognize that f2 is a standard library function and automatically rename it to "sqrt", and an even better one might recognize f1 also.
The main thing that makes decompilation of x86/ARM/etc. difficult is that it's impossible to prove the correctness of most transformations, because it's so open-ended what machine code is allowed to do. Any instruction could be the target of a computed jump, for example. Most surely aren't, but generally you can't prove it. But this isn't a problem of all decompilers, or only decompilers. Java bytecode is much easier to decompile, and Python is very difficult to compile. -- BenRG (talk) 21:58, 14 January 2016 (UTC)[reply]
Do you mean Python is difficult to decompile, that is, the python bytecode? I suppose compiling is also difficult, but that's the same case of any dynamic language by design. Denidi (talk) 00:11, 15 January 2016 (UTC)[reply]

Mobile Phone Blocking

[edit]

Do hospitals in the UK block mobile phones, and if so, how? KägeTorä - () (もしもし!) 16:35, 14 January 2016 (UTC)[reply]

They prohibit using them to breach privacy of patients. They don't block them. They could using a really big Faraday cage, but they don't. How can you tell? Go to the hospital and use your phone. 199.15.144.250 (talk) 17:05, 14 January 2016 (UTC)[reply]
Many schools in the US have blocked cell phones without the need for a gigantic Faraday cage. See Mobile phone jammer. Dismas|(talk) 18:17, 14 January 2016 (UTC)[reply]
Do you have any reference for this Dismas? I doubt they can do this legally. Cell-phones are an authorized and licensed technology, which could be literally life-saving in an emergency.
According to the fcc site "CONSUMERS BEWARE: It is Unlawful to Use “Cell Jammers” and Other Equipment that Blocks, Jams, or Interferes with Authorized Radio Communications in the U.S."
--Scicurious (talk) 19:07, 14 January 2016 (UTC)[reply]
They've run into problems with parents, of course. This is just one related story. I'm sure I could find more about schools proposing this, at least, if I looked for a bit more. Dismas|(talk) 00:30, 15 January 2016 (UTC)[reply]
The article you linked to doesn't say that at all. They have not run into problems with parents. Of course not. Parents could even agree with such measures and anyone is free to propose it. It remains illegal. The teacher was suspended for 5 days without pay since he wrongly assumed that jamming is only illegal if used with a malicious intent. Silly guy. Please read the FCC link above. No school in the US can do this legally. --Scicurious (talk) 01:27, 15 January 2016 (UTC)[reply]
Yeah I think the take away message from this is teachers, parents, administrators and boards can propose whatever they want. Hopefully before they actually implement it, they'll take legal advice or at least do an internet search and find like these people did [1] [2] (see comment by Lefttowonder) they're likely to have problems if they try. It sounds like teachers at least often get off lightly, per the earlier source and [3] and possibly others who don't do anything too out there (e.g. I don't see any mention of fines for anyone but the seller here [4]. Still not something to mess with. Note the FCC document mentions that even local and state law enforcement can't use jammers without permission. Nil Einne (talk) 16:36, 15 January 2016 (UTC)[reply]
They are also illegal in the EU, but there are special circumstances, such as use in British prisons. 199.15.144.250 (talk) 20:13, 14 January 2016 (UTC)[reply]

Notepad file size

[edit]

According to this, a file should not exceed 45K in Notepad. What is that in pages? Thanks, Dismas|(talk) 18:13, 14 January 2016 (UTC)[reply]

"Pages" of what? Are you talking about memory pages? If you mean "pages as printed on paper", there is no answer to that question. Notepad is a text editor that edits plain text files. How many pages text will take up when printed depends on a whole bunch of things that are independent of the text, like the font size chosen for printing, paper size, margins, and so on. Now, some "document publishing formats" like PostScript (which is used in PDF) do arrange the document in terms of pages; they're intended to represent a document in a fixed, device-independent matter. This might be where you're getting the idea from. Doing this involves adding instructions to the file describing the layout, which the computer follows when it renders the document. Plain text files don't have any of this. They're "just text". --71.119.131.184 (talk) 19:13, 14 January 2016 (UTC)[reply]
This Knowledge Base article applies to Windows 3.0 (et al.), which ran on (mostly) computers of the Intel 386 vintage. Those systems ran with complex, segmented memory management, so page size is not as clean as it is on newer processors that we lump in as "x86" systems. For most practical purposes, you could categorize the Windows 3.x memory model as one that used 4096-byte pages.
Nimur (talk) 19:17, 14 January 2016 (UTC)[reply]


1 kilobyte = 1000 bytes, and a letter can occupy 1 byte (or more). If we assume the average word to be 5 letters long, that gives us 200 words by kilobyte. That is, your 45K is equivalent to only one page. That seems too little, even by Microsoft standards. Are you using notepad or notepad++? I suppose probably the last one.--Scicurious (talk) 19:18, 14 January 2016 (UTC)[reply]
How do you make the jump from 200 words per KB being one page? That would equate to 9,000,000 words. Are you claiming there are 9 million words per page? 199.15.144.250 (talk) 20:18, 14 January 2016 (UTC)[reply]
Think you made a mistake somewhere. 200 words per kilobyte and 45 kilobytes means 9000 words. That said the Scicurious does seem to have an excessively high expectation of words per page. A search suggests 500 for single space A4 with reasonable margins and font size. They also forgot punctuation, particularly spaces. And as a minor nitpick, I'm fairly sure the ancient Microsoft document is using 1 kilobyte = 1024 bytes not 1000. Nil Einne (talk) 21:32, 14 January 2016 (UTC)[reply]
Sorry, got the rate of words/page wrong. 500 seems reasonable. So, 18 pages for the 45K.--Scicurious (talk) 21:45, 14 January 2016 (UTC)[reply]
Notepad++ helps. --Hans Haase (有问题吗) 20:04, 14 January 2016 (UTC)[reply]
Fairly sure Notepad++ does not now and has never supported Windows 3.x. V1.0 was released in 2003 after all, post XP. It's open source so guess you could port it, but why? Admittedly the limit isn't much better in 9x still the OP was referring to a 3.x document. The limit in XP and newer versions of Windows is quite high [5]. IIRC Notepad++ isn't much higher if at all, so while there are advantages of Notepad++ I'm not sure file size limits are one of them. Except perhaps in 9x, presuming any versions of ++ work in them. Both need to load the entire file to memory although Notepad++ is possibly a little faster at processing IIRC. If really working with very large text files bigger than 1GB, it may be better to use something which doesn't need to load it all to memory. Nil Einne (talk) 21:57, 14 January 2016 (UTC)[reply]