Jump to content

Wikipedia:Reference desk/Archives/Computing/2013 December 28

From Wikipedia, the free encyclopedia
Computing desk
< December 27 << Nov | December | Jan >> December 29 >
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.


December 28

[edit]

Why isn't "United States" is not on the list for Countries on YouTube on account settings?

[edit]

Venustar84 (talk) 04:20, 28 December 2013 (UTC)[reply]

This is NOT a computational question. No concepts of Computer Science can explain this observation. Perhaps you should post this question in the Humanities section. 220.239.51.150 (talk) 06:41, 28 December 2013 (UTC)[reply]
I think it's fine to post Q's related to computers here. As for the answer, I would guess that US is the default, so you don't have to select it. I've seen this in other US-based sites, where the largest group of users is in the US, so they assume that each user is in the US, unless told otherwise. StuRat (talk) 14:18, 28 December 2013 (UTC)[reply]

Type punning and CPU microarchitecture

[edit]

Do modern Intel and AMD CPUs have microarchitectural limitations that would affect the performance of a program that accessed both members of a C/C++ union {int; float} or union {long; double} in the same inner loop? Is this an exception to the general rule that a mix of integer and floating-point arithmetic improves instruction-level parallelism compared to using one or other exclusively? For example, does the FPU have a separate register file, and if so, do transfers between an integer register and a floating-point register have to go through the cache? NeonMerlin 06:40, 28 December 2013 (UTC)[reply]

I don't know enough to answer the general question but processors using AMD's Bulldozer (microarchitecture)'s have modules which (again this is probably over simplified) have the performance of two independent cores (albeit with shared L2 cache and some other portions) for integer calculations but only really have sufficient resources to perform as one for floating point. I imagine this is likely to have an effect if you're combining floating point and integer compared to just integer although probably in complicated ways (e.g. [1] suggests if one of the cores is dedicated to floating point and one to integer you should get roughly the performance you would expect from two cores). I would imagine though if you're running two such loops, one per core you would generally expect it to be slower if it mixes the two on a Bulldozer microarchitecture process than if you were running two such loops that only use integer although it would likely depend on your specific code as my understanding is considering all the optimisations and other features, it's frequently impossible to predict predict precisely how fast any specific code will run without benchmarking when you make such substanially changes. Nil Einne (talk) 07:24, 28 December 2013 (UTC)[reply]
SSE floating point uses registers that also support integer operations and can be transferred directly to and from general purpose registers, but the x87 FPU has its own register file and the only way to transfer those bits to/from a general purpose register is via memory. Aside from that, I'm pretty sure there are no performance problems with type punning. If there are they'll be documented somewhere in the official manuals. For Intel you probably want this one and AMD's should be here somewhere.
On a related note, using a union for type punning is not safe. The C and C++ standards permit the compiler to assume that variables of different non-char types don't alias, even if they're members of the same union. This means, for example, that the load from one union member might be reordered before the store to the other. The only safe way to do what you want is with memcpy or some equivalent. A modern compiler with optimizations on and an intrinsic memcpy will probably produce optimal code from this. That said, the Win32 API uses unions for punning, so any C or C++ compiler that works on Windows must be stricter about aliasing than the standard requires. But I don't know whether they're stricter always or if there's some magic in the Windows header files. -- BenRG (talk) 08:22, 28 December 2013 (UTC)[reply]
NeonMerlin, the behavior also depends on whether your instructions - punned or non-punned - imply a data hazard due to writeback. If so, then any correctly-functioning CPU will stall until the hazard clears, forcing serialization and creating a pipeline bubble in your intended instruction-level parallelism.
If floating-point hardware acceleration has a separate register bank, you can bet that any correctly-functioning CPU must use a snooping algorithm to check for data-hazards: data shared across two banks must either be guaranteed coherent or guaranteed to have serial-only access.
Here's a good read, right at the edge of the state of the art: Architecture-Independent Data Flow Tracking, from the fine folks who brought you the LLVM compiler technology. In this case, "architecture independence" means the same high-level llvm compiler logic works on the CPU, the FPU, the whatever-Intel's-latest-AVX accelerator, the ARM core, the ARM Neon core, ... this is quite different from, say, gcc, in which the gnu intermediate representation language was compiled by a specific piece of back-end logic based on its pre-determined target, excluding an entire category of possible optimizations. Nimur (talk) 15:39, 28 December 2013 (UTC)[reply]
As far as I know the Intel core processors apply register renaming to memory locations as well as to registers so the value stored to memory may be passed back to a following instruction without reading the cache. Besides compilers can often avoid actual memory reads and writes for type conversion using unions. Dmcq (talk) 17:40, 28 December 2013 (UTC)[reply]
The paper you linked seems irrelevant. The question is about x86 CPUs specifically, and it's about speed, not instruction semantics. -- BenRG (talk) 21:39, 29 December 2013 (UTC)[reply]
You should be okay directly changing a union in C, see [2]. I really don't see C++ violating that. The strict standards way if you're desperate is to use memcpy but I think that will lead to more bugs than it solves! Dmcq (talk) 15:57, 28 December 2013 (UTC)[reply]
According to that document, C99 added a paragraph allowing type punning through unions, which I didn't know. The original C++ standard doesn't include that paragraph, or anything else from C99. The document is careful to say that the union solution doesn't work in C++, presumably meaning the original standard. I don't know whether C++11 added the paragraph (though it seems likely). Compilers can still use the old rules if you don't compile in C99 mode (or C++11 mode, maybe). The document that I linked recommends using memcpy for maximum portability, and says that it's just as efficient as the union solution in gcc 4.4.1. -- BenRG (talk) 21:39, 29 December 2013 (UTC)[reply]
As to the original question yes some processor implementations have a problem moving between ints and floats and it takes longer than one might expect. This can affect some code that for instance looks at the exponent of a floating point number and chooses different cases dependent on that. Dmcq (talk) 16:03, 28 December 2013 (UTC)[reply]

Are photos from here copyrighted?

[edit]

I want to use photos of peoples in my android app.
I understood that certain people wouldn't want me to use their photos... Can I use photos from wiki-commons without a problem? br /> If its a problem - can I upload a new version for the app anytime someone asks me to remove him, or would I be sued? br /> The app should be free, with commercials (if that matters). רן כהן (talk) 17:01, 28 December 2013 (UTC)[reply]

Just because an image is hosted on Wikimedia Commons does not mean you may freely use it for all purposes. Many image licenses specifically forbid commercial re-use.
Each image has a license tag stating how it may be used. Even still, you should use caution, as some images may be incorrectly labeled. Nimur (talk) 17:16, 28 December 2013 (UTC)[reply]
I would suggest Commons:Commons:Reusing content outside Wikimedia before anything.
Anyway, for clarification, Wikimedia Commons does not allow any form of nonfree media. The definition of free used by wikimedia commons, as with wikipedia and all wikimedia licences, requires that the content including derivatives be reusable for any purpose provide they obey the other terms. The terms may require you give attribution, include the licence and share the content under a compatible licence and some other things, but cannot restriction you from using it for certain purposes like commercial ones (beyond the burdens obeying the licence may place on any commercial aims).
In other words, while you do have to obey the terms of the licence, the licence cannot forbid commercial re-use. (While some other free content projects may include allow such restrictions, many definitions of free content don't allow such restrictions.) Edit: Actually more correctly, while the content could include a licence preventing commercial use, it will also need another free licence which does allow such use.
You are right that either way, beyond obeying the terms of the licence, reusers should bear in mind we try to but have no way to stop content being mislabelled.
In addition, for cases where the content is in the public domain or where otherwise the content is claimed free based on some element being uncopyrightable, wikimedia commons only requires this for the country of origin and the US. The former because this hopefully means it will be likewise in other countries. But the later because it's not always the case. (And if the material has been taken from somewhere else like a website, we require it be free in the country of that as well.)
Note that the policy Commons:Commons:Licensing is sometimes said to be free in the country of origin and US but if someone tried to release content under a free licence but only for the US and where they live, their content will almost definitely be rejected. (Or will be if anyone who knows enough sees it.)
But anyway, the main point is that, if you live outside the US, you have to consider the possibility the content could actually be covered by copyright and non-free in your jurisdiction even if it is in the US and in the country of origin. And even if you live in the US, there's plenty of cases like Commons:Commons:Requests for comment/Non-US Freedom of Panorama under US copyright law and possibly Commons:Commons:Copyright rules by subject matter#Graffiti (although it looks like we may have gotten better here since I raised the issue) where we are uncertain (or not uncertain but wrong) of how US courts would treat the copyright claims but allow them anyway.
Oh and if you so happen to be in the country of origin, bear in mind there are a few cases there the wikimedia commons doesn't require the content be free in the country of origin (like faithful reproductions of public domain 2D artwork).
Also we only care about copyright restrictions. There may be some non copyright restrictions which will apply to reusers but not to wikimedia commons, particularly in the case of commercial reusers and images of living people.
And remember, even if your use is perfectly fine under US or whatever country law, this doesn't stop someone taking you through a long court battle.
P.S. As a final example of how careful you have to be, some of the licences we allow such as the Creative Commons ones, allow licensors to specify the manner of attribution. It's generally suggest our ToU [3] limit how wikimedia contributors may request attribution although IANAL it doesn't seem so clear cut to me for non text. But either way we will accept content from elsewhere which does specify a different manner of attribution. From some experience I would have to say I'm not sure how well people actually pay attention to such things even on wikimedia projects.
For example images which require visible in image attribution may be allowed even though we don't like such things and people may even remove the attribution. Or images which require attribution in the caption of wherever the image appears even though we don't actually follow that most of the time. So far, this hasn't cause any major problems to use, but a reuser may not be so lucky. Hence as said before, you will need to check the terms yourself, even if you discount all the other potential pitfalls.
Nil Einne (talk) 17:35, 29 December 2013 (UTC)[reply]

How to edit a BCD file?

[edit]

Hello there,

I just tried to open my BCD file (Windows 7) and realized that it is all encrypted. I have two OS's and I have to remove mentioning of one of them to clear the way for Linux. I remember years ago BCD files were plain text, easily editable. Not anymore. Any suggestions? Thanks --AboutFace 22 (talk) 18:01, 28 December 2013 (UTC)[reply]

There are binary editors that will display the source as some combo of octal, hex, decimal, and ASCII. One I used a long time ago was called beav (for Binary Editor And Viewer). As I recall, you couldn't shorten or lengthen the file, as they use direct memory addressing and that would cause the index to point to the wrong place, but you could change text strings to new ones of the same length (possibly including spaces). So, rather painful to use, but it is possible to edit a binary directly using such tools. I found it most useful to fix annoying typos in executables, where I didn't have the source code. StuRat (talk) 18:15, 28 December 2013 (UTC)[reply]

OK, I just found out that bcdedit.exe located in Windows\system32 is the answer but this is what happens. When I try to run it it flashes cmd prompt which then disappears. So, I went to cmd prompt, ran it as administrator and was able to print the content. Now I have to find out how to edit it. OMG, I forgot so many things! StuRat, thank you. It is interesting. --AboutFace 22 (talk) 18:19, 28 December 2013 (UTC)[reply]

OK, there is a bcdedit command in cmd prompt DOS emulation and most likely I will be able to edit the bcd file with no problems. --AboutFace 22 (talk) 18:42, 28 December 2013 (UTC)[reply]

Cool. This is a good opportunity for you to refresh your old knowledge, before it's lost for good. StuRat (talk) 21:07, 28 December 2013 (UTC)[reply]

Refresh rate on power consumption.

[edit]

I just got a second monitor, which I'm not going to use for games or anything more than multitasking stuff. Would it save any amount of power to change the refresh rate to 50 from 60Hz? Is there any point to turn the refresh rate down? This was question that popped into my head when I was setting it up. Thanks. Bluefist talk 21:17, 28 December 2013 (UTC)[reply]

I wouldn't expect a significant power savings. AFAIK, the only reason to lower the refresh rate is if it doesn't display properly at the higher rate. StuRat (talk) 07:57, 29 December 2013 (UTC)[reply]

Unicode characters in Firefox

[edit]

I'm somewhat ashamed to ask as I'm usually the IT guy myself, and I did enjoy this cool video about how Unicode is supposed to work. In theory. Yet I can't get it to work on my own PC. All I see is FireFox (or Windows XP itself, maybe) giving up, showing a little box with numbers in it. Even Google lets me down on this. TIA! Joepnl (talk) 23:56, 28 December 2013 (UTC)[reply]

If you see a little box with numbers, it means that the font Firefox is using does not support the characters you are asking it to display. Looie496 (talk) 01:03, 29 December 2013 (UTC)[reply]
Yes, maybe Help:Multilingual support can help. At http://rishida.net/tools/conversion/ you can copy-paste the characters into the "Characters" field and click "View names" to see the names of the charaters and see them as graphics. PrimeHunter (talk) 00:44, 30 December 2013 (UTC)[reply]
Mmm, Tahoma doesn't work either. Even a font called Unicode doesn't. Joepnl (talk) 21:54, 2 January 2014 (UTC)[reply]