Wikipedia:Reference desk/Archives/Computing/2015 April 17
Computing desk | ||
---|---|---|
< April 16 | << Mar | April | May >> | April 18 > |
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. |
April 17
[edit]How can you visualize offline the running of a Python script?
[edit]For educational purposes, what tool could you use for seeing what your code is doing? I want something like variables being assigned, memory allocated and the like. I know of some online tools, but would like to have an offline equivalent. --ListCheck (talk) 14:09, 17 April 2015 (UTC)
- Do you mean that you wish to visualize the control flow graph of a Python program, akin to visualizations produced by the Xcode clang/llvm static analyzer for a C (or other language) program?
- This type of static code analysis is very difficult for Python, because Python is a very weakly-typed language. Some commercial tools exist: for example, SourceGraph, PySonar, and so on. These are not very user-friendly.
- If I needed to analyze and debug Python, I would use pdb (part of the reference CPython implementation). This tool is decidedly not graphical : it produces no visualization, but it does allow me to "see what my code is doing" in a manner that is more powerful and interactive than simply printing log messages. In actual practice, I rarely do actually use pdb: I try to keep my control flow in Python sufficiently simple so that it does not require a lot of serious analysis; and I find that incorporating pdb requires non-trivial changes to my deployed Python software infrastructure. Your use-cases may vary.
- Nimur (talk) 17:17, 18 April 2015 (UTC)
- According to the Python article, the language is not weakly typed. Do you maybe mean that static code analysis is difficult for Python, because it is dynamically typed?
- Well, as our article on strong and weak typing makes clear, there is no universally-agreed definition of what "weak typing" means. For clarity, refer to the Python language reference (I use Python 2.7 for all purposes, so: Data Model: Object values and types). In Python, an object's type is unchangeable; but Python syntax allows a programmer to easily create a new object by silent type-conversion. The difficulty is that this process is not explicit - so to determine program behavior, you must actually evaluate (run) the program. The type of an object may be unchanged; but the object (and hence, the type) referred to by any specific identifier token may vary at run-time. This makes code analysis hard.
- You could make the same argument about any programming language - e.g., determining an object's type could be construed as an instance of the halting problem. However, certain languages are rooted in syntax that is so abundantly explicit with respect to data typing that simple heuristics can be implemented to accurately and quickly perform static data-flow and control-flow analysis. For an introduction to how this works in practice, consider reading about LLVM's clang-analyzer; or read some of the links provided by the GNU project's webpage on Code Analysis open issues.
- From the viewpoint of pure theory, any Turing-complete languages are somehow reducible to an equivalent representation; therefore, any static analysis tool for the C programming language could (in principle) be converted to analyze code in some other high-level language. In practice, this is not how static analysis works: static analyzers must take realistic but provably-correct shortcuts when evaluating program syntax. Certain languages contain syntax that make it difficult to guarantee correctness while also efficiently analyzing source code.
- But, to make a long story short, yes: when I say Python is "weakly" typed, I am referring to the fact that its type system is dynamic.
- Nimur (talk) 20:42, 21 April 2015 (UTC)
- According to the Python article, the language is not weakly typed. Do you maybe mean that static code analysis is difficult for Python, because it is dynamically typed?
After an update, why does my screen look different and why am I not an authorized user?
[edit]HP Pavilion KT369AA-ABA a6512p Intel Pentium Dual CPU E2200 @2.20 Ghz, 4 GB RAM, 64 bits. Windows is 89583-OEM-7332157-00061 (all 2009).
I had a Windows update earlier this week and have used the computer today for the first time since I clicked to shut down the computer so the changes could be made. The update didn't happen normally because every other time it happened, I was given a "Stage 3" message and a percentage along with a message not to turn off my computer. This time, it just said "Please wait", and then I was told to enter my password, which I didn't since I was through for the day. I turned off the computer and didn't turn it back on until today.
There is a little box that looks like a stack of three books I've never seen in the lower left corner beside the little e to the right of a blue square which shows the desktop, which is in turn to the right of the start button, which is rectangular now instead of round as it has been all these years. If I click on the little box, I'm being told "C:Users\Vchimpanzee\Downloads\20100104-004-i64.exe" (my real first name is where "Vchimpanzee" is) wants access to my computer. That's less scary than the first message I got, which said Windows couldn't find something it needed. When I denied this "unknown" program access, things worked normally but everything looks strange. The taskbar is black on light gray instead of the other way around, and the name of the web page followed by "Windows Internet Explorer" is appearing at the top of the page for the first time in years, though it is black on blue rather than light gray or white on a black background.
My warranty has long since ended, so I'm not aware of anyone I could ask since this probably isn't related to my McAfee virus software, but maybe there's something online.— Vchimpanzee • talk • contributions • 18:34, 17 April 2015 (UTC)
- I think this has got to be some sort of malware, and you should use System Restore to roll back to before it was installed.
- "20100104-004-i64.exe" has the name format of a Norton/Symantec Antivirus update file ([1]), but there's no reason you'd suddenly be prompted to run an antivirus update from 2010, especially since you use McAfee. More likely it's malware using the name of a legitimate file that was commonly found on users' systems at one time. You could upload it to VirusTotal, which might identify the malware, which might be helpful if System Restore doesn't work. -- BenRG (talk) 20:42, 17 April 2015 (UTC)
- Just thinking aloud... Do you know how to run this in a virtual machine. You could keep the original OS running but then mess around with 'this' update in VM to discover what's happening. Being lazy, I like to run updates in a VM first, until I'm sure they are stable. Updates, are often rushed out before they are proven.--Aspro (talk) 21:10, 17 April 2015 (UTC)
- I've used System Restore before, but with Tech Support helping. I did something wrong, but everything looks normal again and three books are gone. I'll just hope for the best. Thanks.— Vchimpanzee • talk • contributions • 22:24, 17 April 2015 (UTC)
- Just to clarify (I'm at a library since I don't have much to do, it's nearby and it's easier than turning on my own computer and waiting and waiting for everything to happen) I saw a blue screen and was never given a choice of restore points. When the blue screen didn't go away, I unplugged the computer and started over. I don't think turning it off worked either. I'll look for online information but if it doesn't happen again maybe I'm all right.— Vchimpanzee • talk • contributions • 17:34, 18 April 2015 (UTC)
- As I figured, I don't know what to search for. I found something from 2009 but it wasn't helpful. And I should mention I told McAfee to do a full scan because that's something I do on Friday.— Vchimpanzee • talk • contributions • 17:38, 18 April 2015 (UTC)
- Also, I kept being told to use Windows Defender because I was not protected. I have been told this is not needed if I have McAfee, so it gave me the option to exit and I did. That was before all this happened.— Vchimpanzee • talk • contributions • 17:42, 18 April 2015 (UTC)
- As I figured, I don't know what to search for. I found something from 2009 but it wasn't helpful. And I should mention I told McAfee to do a full scan because that's something I do on Friday.— Vchimpanzee • talk • contributions • 17:38, 18 April 2015 (UTC)
- Just to clarify (I'm at a library since I don't have much to do, it's nearby and it's easier than turning on my own computer and waiting and waiting for everything to happen) I saw a blue screen and was never given a choice of restore points. When the blue screen didn't go away, I unplugged the computer and started over. I don't think turning it off worked either. I'll look for online information but if it doesn't happen again maybe I'm all right.— Vchimpanzee • talk • contributions • 17:34, 18 April 2015 (UTC)
- I've used System Restore before, but with Tech Support helping. I did something wrong, but everything looks normal again and three books are gone. I'll just hope for the best. Thanks.— Vchimpanzee • talk • contributions • 22:24, 17 April 2015 (UTC)
Google Chrome no longer supporting JavaScript ?
[edit]I got a message from my EA games account claiming this. They said there was a way to retain support until September, but not after that. Is this correct ? If so, why ? Here's the link the email I received points to:
http://help.ea.com/en/article/google-chrome-no-longer-supports-java/
Thanks, StuRat (talk) 19:11, 17 April 2015 (UTC)
- I think they mean Java, not JavaScript. Google plans to phase out any and all plugin support still using NPAPI in favor of their own Native client, and Java does not support that (yet?).
-- [[User:Edokter]] {{talk}}
19:12, 17 April 2015 (UTC)
- They don't just mean Java, but in the link above, they say Java, which is completely unrelated to JavaScript. --ListCheck (talk) 01:35, 18 April 2015 (UTC)
- NB: Java is not JavaScript - this page [2] from the Chrome dev blog says they will stop supporting NPAPI, hence Java. They say it has something to do with mobile support. Here's some more coverage [3]. Really, NPAPI came out in 1995, and there are probably much better modern alternatives. Apparently there are some security concerns with Java, and that's also part of it. Anyway, to continue playing java-based web games after September, just use Firefox or some other decent (i.e. not IE) browser. SemanticMantis (talk) 19:15, 17 April 2015 (UTC)
- They want to drop NPAPI plugins because they're insecure. Mobile support doesn't really have anything to do with it—they just pointed out in the article that NPAPI is already absent on mobile (and the world hasn't ended). The security concerns with Java aren't really the problem either—any NPAPI plugin with an exploitable bug makes Chrome's sandbox moot. Java is apparently worse than the others (at least the others that are widely deployed), but they probably all have exploitable bugs.
- There doesn't appear to be any good modern alternative to NPAPI. Chrome has PPAPI, but Mozilla isn't interested in supporting it and I doubt Microsoft is. Mozilla is opposed to new plugin APIs because it wants to ban all plugins and do everything in Javascript, but that seems unlikely to happen for a while, if ever. For the time being it looks like people will have to develop three versions of their plugins: one for IE, one for Chrome (and Opera) and one for all the other browsers.
- Use Firefox to run Java games if you want, but there's nothing wrong with (modern) IE. -- BenRG (talk) 05:15, 18 April 2015 (UTC)
- I can't really search for the correct link as my internet usage is limited, but I can provide you this,[1] hope this helps -- Mr. Prophet (talk) 18:49, 18 April 2015 (UTC)
- Opera will probably lose NPAPI support as well, since it's now based on Chromium's layout engine. See this thread. -- BenRG (talk) 19:03, 18 April 2015 (UTC)
References
Algorithmic composition software
[edit]Per edit request. ―Mandruss ☎ 20:03, 17 April 2015 (UTC)
Is there any algorithmic composition software for Windows which I can use to create classical music melodies automatically without knowing anything about music? Thanks — Preceding unsigned comment added by 93.126.105.41 (talk) 19:59, 17 April 2015 (UTC)
- You could give Wolfram a try: [4], the music is not very good though. --ListCheck (talk) 21:05, 17 April 2015 (UTC)