Wikipedia:Reference desk/Archives/Computing/2014 March 14

Computing desk
< March 13 << Feb | March | Apr >> March 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.


March 14 edit

Maze generating with recursive backtracker edit

Please comment the (pseudo)code given in the article.

Talk:Maze generation algorithm#Recursive backtracker

CiaPan (talk) 09:01, 14 March 2014 (UTC)[reply]

Jumping into a register edit

What modern CPUs, if any, can fetch an instruction directly from a register, to optimize the case where it is being written just before being stepped into? (As an example of a use for this feature, during an undergraduate assignment, I had a program that worked by copying an instruction from an array on each pass of a loop, then stepping onto the address where it had been copied; on the virtual CPU architecture we were coding for (which had no caches), this was more efficient than a jump table, because all the subroutines were a single instruction. But as I understand Intel and AMD's x64 architectures, this would not be efficient on them, because the fetch/decode for the affected thread would stall while the instruction was being written from the register to the L2 cache to the L1 instruction cache.) NeonMerlin 13:58, 14 March 2014 (UTC)[reply]

It's hard to see how that would work, since (a) lots of machine instructions make use of bytes that immediately follow the instruction pointer, and (b) how would the machine know what instruction to execute after the one that is encoded by the register? Looie496 (talk) 14:25, 14 March 2014 (UTC)[reply]
I'm pretty sure that no modern (or ancient) architecture supports this. It would presumably be pretty inefficient anyway, since decoding would be stalled until the register's value was available. Not to mention that it would introduce a dependency of the decoding unit on the value of a general-purpose register, which would probably require a lot of new wiring and control logic for an extremely rare use case. -- BenRG (talk) 20:02, 14 March 2014 (UTC)[reply]
The ICT 1900 computers allowed this. The address space was given by a base and limit and the first few words were identified with the registers - and they could be executed like normal store. A quick search with Google doesn't get me a match, but I see an ad "Great deals on ICL 1900. Grab a bargain on eBay today!" No eBay, that's a big fat porky pie!, you do not have ICL 1900's for sale! Ah just found it on Wikipedia ICT 1900#Architecture of the 1900 series second paragraph. Dmcq (talk) 21:55, 14 March 2014 (UTC)[reply]
This is one of the things which look great to a pure computer scientist, but are Bad IdeasTM in real life. Self-modifying code is hard to debug, so the usual programs avoid it; viruses use it to hide their true nature. In decades long gone, self-modifying code was a powerful tool to write compact code. You could change a MOV AX,... instruction to ADD AX,... or SUB AX,... by changing its first byte. I have seen at least one program that does exactly that to avoid having three subroutines for those.
In many newer OSes, code cannot modify itself any more, mostly because the savings are insignificant now. - ¡Ouch! (hurt me / more pain) 07:12, 17 March 2014 (UTC)[reply]

can't play wikipedia audio video on safari edit

How do i play the embedded audio and video directly in my safari browser?Kshah13788 (talk) 17:31, 14 March 2014 (UTC)[reply]

See Wikipedia:Media help (audio and video), which should be linked from videos and audio in browsers like Safari which lack native support. The Mac OS X section for Quicktime should work for both Windows and Mac OS X although I don't think you need to install iTunes on either OS, only the XiphQT codec [1].
On OS X it looks like you can also add WebM support via [2] although I've seen reports it doesn't work very well and unlike the IE plugin it doesn't seem to be recommended by WebM. Perian may also work [3] although it's been abandoned by the official developers (but is still newer than the WebM plugin). I believe the wikimedia software is set up to provide Theora versions of every video so you shouldn't need WebM (except in rare cases such as when the conversion has not yet happened and the upload was in WebM) and it could potentially make things worse if the Quicktime codec does have problems.
As per the page, you have no option on iOS devices to playback on Safari.
Nil Einne (talk) 04:11, 15 March 2014 (UTC)[reply]