Wikipedia:Reference desk/Archives/Computing/2013 October 9
Computing desk | ||
---|---|---|
< October 8 | << Sep | October | Nov >> | October 10 > |
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. |
October 9
editIPC: Shared memory V.S. Unix domain socket, which one is faster?
editShared memory is the most basic, primitive way to communicate between processes or threads if I understand correctly. Most of IPCs should be built on top of it (probably in kernel level). ... yes, using shared memory to communicate often means a need of proper locking/synchronization which slows down the communication, but don't other IPCs use locking/synchronization internally to coordinate stuff between processes/threads? Thus in my opinion, theoretically there should be no other IPCs (including Unix domain socket) could beat shared memory. Is it true? -- Justin545 (talk) 02:45, 9 October 2013 (UTC)
- It's comparing apples to oranges. Sockets can give you guaranteed, in-order delivery, flow control, and will prevent accidental overwriting of transmitted data before the other side had a chance to read it, which you may need to reimplement if you use shared memory. Shared memory, measured in isolation, is very likely to beat sockets, but once you've added all the necessary synchronization to actually have a robust and usable communication channel, the differences may have evaporated. Unilynx (talk) 19:46, 9 October 2013 (UTC)
Imgur URLs
editI wouldn't know if this would be the correct place to these types of questions but.. how Imgur redirects to some image after you upload it? in the network viewer when you POST an image you can't see the url where your image is being uploaded so how imgur redirects me there? 190.156.129.50 (talk) 04:37, 9 October 2013 (UTC)
- What do you mean by "the network viewer"? Marnanel (talk) 10:03, 9 October 2013 (UTC)
- Actually an understandable synonym for the browser, in case of people who are in the process of warming to the fact that it's not only for viewing. --SCIdude (talk) 15:58, 9 October 2013 (UTC)
It's javascript. You only need a single line of code.
function getImageUrl() { return "8eBynOh" }
window.location.href = "http://imgur.com/" + getImageUrl();
→Σσς. (Sigma) 11:23, 13 October 2013 (UTC)
Header of the browser
editI am going to ask a hipothetical question here. If someone has downloaded a component of Mozilla Firefox that change the banner of the browser in Linux. How can I add it to a PC that runs Windows 7 wothout being connected to the internet. Which are the folders in Linux that I have to copy and paste to Windows? Miss Bono [hello, hello!] 13:03, 9 October 2013 (UTC)
- If it specifically changes it in Linux then it probably won't work in Windows. Without an internet connection, you could transfer something by a usb drive. --.Yellow1996.(ЬMИED¡) 22:22, 9 October 2013 (UTC)
- I want to a place with Internet and downloaded a theme for Windows and copied it to a flash memory, but when I went home and I replaced the Mozilla Firefox it didn't change the header in my laptop. Miss Bono [hello, hello!] 12:23, 11 October 2013 (UTC)
- I have never done this, but I found this article which mentions a program called MozBackup; apparently, this program can backup all your profile configurations (themes, bookmarks etc.) into one file that you can then transfer onto the other computer via USB. I think you'd have to add the theme to the firefox that's on the computer with internet first; then, use that tool and transfer the data file from that to your Win7 computer... now that I think about it you should probably make a backup of your regular firefox on your own computer before you do this, just in case something goes wrong. Good luck! --.Yellow1996.(ЬMИED¡) 22:18, 11 October 2013 (UTC)
Why does this HTML snippet crash Internet Explorer?
editsource code
|
---|
From crashie8.com: <head>
<style type="text/css">
#page_wrapper {
margin:0 10px 10px;
}
#apply-form {
width:100%;
}
</style>
<title>Internet Explorer Crasher (IE6, IE7, IE8, IE9 and early releases of IE10)</title>
</head>
<body>
<h1>This page crashes Internet Explorer, even version 9 and <abbr title="10 crashed in betas, latest RC doesn\'t, we\'ll see when it goes gold.">10</abbr>. So if you see this, thanks for using a good browser!</h1>
<table>
<tbody><tr>
<td>
<div id="page_wrapper">
<form id="apply-form" action="#" method="post">
<div style="display:none"><input type="text" name="test"></div>
</form></div>
</td>
<td width="1"></td>
</tr>
</tbody></table>
<p>Questions or comments? I\'m on twitter <a href="http://twitter.com/ecaron">@ecaron</a> or you can read the MSDN
discussion on this bug at <a href="http://groups.google.com/group/microsoft.public.internetexplorer.general/browse_frm/thread/80a2645dc598a4b2">http://groups.google.com/group/microsoft.public.internetexplorer.general/browse_frm/thread/80a2645dc598a4b2</a>.
This is where the <a href="https://connect.microsoft.com/IE/feedback/details/554467/loading-page-with-unclosed-form-crashes-ie9-and-all-previous-versions">Internet Explorer team said it isn\'t a bug</a>.</p>
<!-- This javascript is just so I know who is viewing this page. It has nothing to do with the crashing. -->
<script type="text/javascript" async="" src="http://www.google-analytics.com/ga.js"></script><script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push([\'_setAccount\', \'UA-17290068-4\']);
_gaq.push([\'_trackPageview\']);
(function() {
var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;
ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';
var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
|
Czech is Cyrillized (talk) 13:38, 9 October 2013 (UTC)
Without examining IE's source code it's anyone's guess. Anyway, seems to have been fixed in IE10. Sebastian Garth (talk) 13:50, 9 October 2013 (UTC)
The trigger seems to be that there is no closing form tag, as mentioned in the discussion linked from that page. The CSS seems to be essential as well. Anything more we could do to explain what specifically leads to that causing a crash in IE would be speculation. Katie R (talk) 17:26, 9 October 2013 (UTC)
Are my eyes deceiving me or isn't there a closing form tag at the start of the second line after the opening form tag? Looks like moderately well formed HTML to me though I would be inclined to put the table inside the form rather than vice versa. 86.147.202.194 (talk) 21:13, 9 October 2013 (UTC)
- Could someone hide the code or something so that it doesn't screw up the sideways formatting of the page? I tried using Template:HAT but that defaults to "This discussion has been closed. Please do not modify it." which is not what I want. I want to help the OP but I don't want to have the formatting of the overall page messed up. Thanks, Dismas|(talk) 21:21, 9 October 2013 (UTC)
- The code should be something like:
- {{hat|click to view source code}}
- <the code>
- {{hab}}
- But every time I try it the hat bottom template appears to fail, and the hat spans the entire thread... --.Yellow1996.(ЬMИED¡) 22:32, 9 October 2013 (UTC)
- I've collapsed with cot/cob. RudolfRed (talk) 01:41, 10 October 2013 (UTC)
- Ah that's much better. I now realise I may have been placing the hab template within the code by mistake... that probably was what was causing the trouble I had. --.Yellow1996.(ЬMИED¡) 03:04, 10 October 2013 (UTC)
- Thank you! Dismas|(talk) 16:12, 10 October 2013 (UTC)
- I guess you're right - I assumed it was the same structure as in the discussion linked from that page. The example code given there was simpler and did not close the form tag. Katie R (talk) 17:15, 10 October 2013 (UTC)
Finding and deleting copy files/pics
editOver the years and using several different computers and external hard drives, I now have acquired a vast collection of mainly digital pics, many of which have been copied from C to D to external drives and back again, thus also creating many duplicates. I am now spending my retirement tidying my files and want to have a sanitised master external hard drive to store all my pics, but only one copy of each. Is there a way I can instruct my laptop to search for and delete all these duplicated files. Many thanks in anticipation. 80.6.13.178 (talk) 16:19, 9 October 2013 (UTC)
- Some people use Duplicate Cleaner -- Finlay McWalterჷTalk 16:22, 9 October 2013 (UTC)
notepad
editHow many assembly instruction a notepad is composed of? — Preceding unsigned comment added by 199.188.236.165 (talk) 19:00, 9 October 2013 (UTC)
- Notepad wouldn't have been written in assembly, but the compiler would eventually have created an assembly representation. The .text segment of the notepad executable on my Windows 7 Pro system is 42,864 bytes. (The rest of the executable is resources and data.) Quick googling shows that the average x86 instruction length in a sample of open source projects is around 3 bytes, but it varies quite a bit depending on the reference you find. That gives a rough estimate of about 14,000 instructions. Katie R (talk) 19:47, 9 October 2013 (UTC)
- ...plus the size of the DLLs that are used, depending on what you want to measure. You probably cannot replicate all of the functionality of NotePad from scratch in 40k of assembly. --Stephan Schulz (talk) 21:55, 9 October 2013 (UTC)
- Windows Notepad in fact uses the standard Windows text edit control, which is implemented elsewhere (possibly in user32.dll). -- BenRG (talk) 07:34, 11 October 2013 (UTC)
- ...plus the size of the DLLs that are used, depending on what you want to measure. You probably cannot replicate all of the functionality of NotePad from scratch in 40k of assembly. --Stephan Schulz (talk) 21:55, 9 October 2013 (UTC)
- (ec with Stephan) I ran notepad.exe (the same as version as Katie Ryan A discussed) through objdump -d and then processed its output slightly. It reports 13,931 instructions and a further 754 no-op instructions. But disassembly like this is an imperfect business, as the disassembler sometimes gets out of sync with the code stream - in this run the disassembler reported 169 bad instructions, each the locus of such a problem. So the 14,000 estimate is right on the money. But I don't think this really tells us very much, as (like almost every other modern Windows program) notepad.exe imports a bunch of DLLs - including USER32.DLL, which supplies the library function CreateWindowEx - a call which can be used to create a multi-line editable scrollable text widget. So while notepad itself is about 14,000 instructions, much of the real work is done by this DLL (and the 12 others it imports). -- Finlay McWalterჷTalk 22:03, 9 October 2013 (UTC)
- Wow - that was a surprisingly good estimate. I figured I would be close, but not that close. The way I see it, if you wanted to write an exact copy of Notepad in assembly, you would end up with (probably less than) 14,000 instructions because you would be using all the same dlls and API calls and not writing them yourself. If someone asks how many likes of C it would take to write Notepad it seems silly to include the number of lines of code in user32. Katie R (talk) 12:01, 10 October 2013 (UTC)
- Um, Katie, did you really mean 3 bytes for the average x86 instruction length in a sample of open source projects? Nyttend (talk) 23:02, 10 October 2013 (UTC)
- That sounds reasonable to me. Most common instructions encode to 1-6 bytes. -- BenRG (talk) 07:34, 11 October 2013 (UTC)
- Um, Katie, did you really mean 3 bytes for the average x86 instruction length in a sample of open source projects? Nyttend (talk) 23:02, 10 October 2013 (UTC)
- Wow - that was a surprisingly good estimate. I figured I would be close, but not that close. The way I see it, if you wanted to write an exact copy of Notepad in assembly, you would end up with (probably less than) 14,000 instructions because you would be using all the same dlls and API calls and not writing them yourself. If someone asks how many likes of C it would take to write Notepad it seems silly to include the number of lines of code in user32. Katie R (talk) 12:01, 10 October 2013 (UTC)
- Yep, like BenRG says, they encode to just a few bytes. An individual instruction is generaly very simple. I settled on 3 for my estimate by searching things like "x86 average instruction length" and skimming the results. Plenty of people have done simple studies and shared their results. I didn't link any as a reference because the numbers had a decent amount of variance and I didn't want to share one without confirming the methodology. I just picked one that seemed representative of the estimates I saw. (Sorry if there are bad grammar/typo issues above - I just corrected about half a dozen of them after writing this, far more than normal, so I may have missed more. I think I'm going to go find some caffeine.) Katie R (talk) 11:46, 11 October 2013 (UTC)