Jump to content

Wikipedia:Reference desk/Archives/Computing/2012 November 17

From Wikipedia, the free encyclopedia
Computing desk
< November 16 << Oct | November | Dec >> November 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.


November 17

[edit]

An inexpensive video game gameplay capture device?

[edit]

What are some particularly inexpensive (under $30) gameplay capture (audio and video) devices? Or do they not exist at a price this low? Nicholasprado (talk) 18:27, 17 November 2012 (UTC)[reply]

Console games? Which console? Or do you mean PC games? Fraps is free has a free trail version! Trio The Punch (talk) 12:38, 17 November 2012 (UTC)[reply]
Fraps is shareware... AndyTheGrump (talk) 14:07, 17 November 2012 (UTC)[reply]
Oops. Andy is right, just because I downloaded a torrent doesn't mean it is free. Trio The Punch (talk) 14:16, 17 November 2012 (UTC)[reply]

I mean for console games, yes. Nicholasprado (talk) 18:27, 17 November 2012 (UTC)[reply]

for best quality wise- you need to look for an hdmi based pci-e card or possibly a usb card, like those by Avermedia and BlackMAgic. Although they aint under the 30 bucks price range level, but do give you almost uncompromising 1 to 1 quality to what you actually see on the tv screen when playing console games. There are also kinds of cards like the Hauppauge HD PVR and cheaper ones such as dazzle and easycap(crap really) but all of those though to a different degree in terms of the extent they impair the original quality of the signal, they all perform a digital to analog and back to digital conversion which is really something unnecessary and undesirable since you want digital to digital, not some extra converting which adds impurity to the signal and making it less precise and crisp. So if your goal is to have as best quality as possible then go for an hdmi capture card , if money is an object, then you might consider cheaper solutions but again the end quality would be far less superior than with an hdmi card. — Preceding unsigned comment added by 77.35.43.160 (talkcontribs)

Which is better? Windows 8 or Ubuntu 12.10?

[edit]

Which one should I use? Write English in Cyrillic (talk) 05:34, 17 November 2012 (UTC)[reply]

They both have pretty silly default UIs, but you can change the one on Ubuntu more easily, and the base system should be comparatively more reliable, secure, etc.. ¦ Reisio (talk) 06:19, 17 November 2012 (UTC)[reply]
If you want to play first person shooters... use Windows. If you want to edit video, buy a Mac. If not, use Ubuntu (or any other *nix distro). Trio The Punch (talk) 12:56, 17 November 2012 (UTC)[reply]
Wow wow!! Only for shooters? And if you plan to use Premiere? Or Composite? Or Lightworks ? or 3ds Max???
And no, win8 is not silly… its very very silly, I don’t understand why they do it this way, I even had to input some stupid code in the cmd to get the netframework 3.5 installed (I need it from my old and expensive autodesk software)
the result right now I have 1 machine with win8 and all the others with 7
my modest opinion:
If you want to see movies, listen music, web browsing etc. ->Ubuntu (and there is no way somebody tell you that is as silly as win8)
If you need to work with adobe, autodesk, solidworks… (and play shooters/cars/anything) -> win7
Lastly if you want to spend a lot quantity of money in a system… say welcome to Mac, and congratulations! now you “think different” 

Iskánder Vigoa Pérez 15:05, 17 November 2012 (UTC) — Preceding unsigned comment added by Iskander HFC (talkcontribs)

Refresh rates of 59 and 60 Hz

[edit]

I've noticed that many modern computer display drivers and graphics-intensive applications (including but not limited to simulations and video games) offer exactly two refresh rates: 59 Hz and 60 Hz. I can understand the 60 Hz: 60 is a nice "round" number (more precisely, highly composite number) and 60 cycles per second nicely fits the pattern of 60 seconds per minute and 60 minutes per hour. So, two questions:

  1. Why is the other option always 59 instead of, say, 61 (that is, why always 1 under 60 instead of 1 over 60), or some "rounder" (more composite) number like 30, 50, 80, or 120?
  2. Why is this option offered at all? Under what circumstances would you want to choose 59 Hz over 60 Hz, or 60 Hz over 59 Hz?

SeekingAnswers (reply) 06:38, 17 November 2012 (UTC)[reply]

I've never seen 59 and 60... I've seen 50 and 60 though. If you're seeing 59 it could just have to do with how the equipment is measuring the input Hz more than it has anything to do with it actually being actually technically pegged at 59. You would need an oscilliscope to know for sure, but if you're using North American power I'd suspect it's at 60, and Europe, 50 (although sort of a moot point with modern LCD monitors and DC run equipment). Shadowjams (talk) 09:37, 17 November 2012 (UTC)[reply]
I find it strange that you've never seen 59 and 60, as they are extremely common values (Googling 59 Hz 60 Hz will return 13.4 million results as of this writing, and those top results all discuss how screens and software offer the choice between those two values, though the top results don't really explain very well why those two values are so commonly used). And the hardware isn't measuring and reporting the refresh rate back as 59 Hz; instead, hardware (multiple different systems by different manufacturers) and software (by many different developers and publishers), are offering the choice between setting the refresh rate to 59 Hz or 60 Hz. —SeekingAnswers (reply) 19:54, 17 November 2012 (UTC)[reply]
This is discussed in numerous forums (example). 60 Hz is a common refresh rate for computer monitors, presumably because it corresponds to the North American mains frequency. 59.94 Hz (approximately) is the NTSC refresh rate. As explained in our NTSC article, in the early days of colour TV they discovered that 'dot crawl' was a problem so they had to move the refresh rate slightly away from the mains frequency. Your graphics driver is helpfully offering you the standard monitor refresh rate and the television refresh rate. Presumably (that word again) Windows rounds 59.94 Hz down to 59 Hz, but if you select it you will actually get 59.94 Hz. --Heron (talk) 11:47, 18 November 2012 (UTC)[reply]

ATX start up

[edit]

IS there any difference for an ATX PSU and all of the associated hardware in the PC if you turn it on and off just by pushing the power-switch on the back of the PSU(most have them) - and when you leave the switch always on and just plug/unplug the mains cord from a plug socket extension adapter or a wall outlet directly??

Could there be any damage done to the hardware in the latter case?? — Preceding unsigned comment added by 77.35.43.160 (talk) 07:57, 17 November 2012 (UTC)[reply]

Basically no. The switch at the back just interrupts the mains. However, the switch is usually equiped with a capacitor to prevent arcing between the contacts when switching off, which may prevent nasty spikes that could damage the PSU or PC. Edokter ( talk) — 09:52, 17 November 2012 (UTC)[reply]
Well, when you just plug-unplug the mains cord leaving the psu switch on, does that capacitor which protects from electric arcs also take effect or it doesn't get to do its stuff to deter those arcs from happening and potentially damaging your pc parts? — Preceding unsigned comment added by 77.35.43.160 (talk) 10:31, 17 November 2012 (UTC)[reply]
That is true, it still offers some protection. But using the plug to switch the PC on and off is still not advisable; when not seated properly, it may still cause trouble due to poor contact between the socket and the plug. Edokter ( talk) — 11:00, 17 November 2012 (UTC)[reply]
But then what about those PSUs that don't have a power-switch on them, how are you supposed to turn them completely off-on if not by the power-cord??? I mean would that risk damaging your pc still be there?
I guess there is a low risk to broke the psu or the system by doing that… at least if the psu is high-quality, if the psu is generic, or low-q there are greater chances of troble, (having or don’t having the switch)
Once I had a 300watts ASUS that doesn’t had power switch, and erroneously put it in a 220 volts outlet with the volt selector in 115… the thing make a strident noise that make me think that the whole system was fried… but the psu had some kind of protection and I didn’t even had to go to an electrician, just switch a fusible, put the selector in 220 and everything fine
I had this pc for a while and resolve the switcher problem by buying a extension cord that had one, but I did it just for convenience, not for fear or avoiding risks
Iskánder Vigoa Pérez (talk) 15:45, 18 November 2012 (UTC)[reply]

What is more "expensive" in Java, memory operations or arithmetic operations?

[edit]

Say I want to write a Java program that involves computing powers of two with even exponents like 22, 24, 26, 28, 210 and so on for all exponents in some interval, like say [2, 1000000] or something. It is clear that once I have computed the lowest such power, I could compute the next one by simply multiplying the previous result with 4. So lets suppose I want to compute the powers of two for all even exponents in the interval [109, 1010]. Which of the following two methods will be faster?

1. computing 22 and then multiplying the result with 4, multiply that result with 4 and so on or

2. computing all powers separately, thus computing 22, 24, 26, etc.

Of course there might be no significant difference when the exponents are small, but if I am using very large exponents (using a package for large integer arithmetic), which will be faster? -- Toshio Yamaguchi (tlkctb) 17:51, 17 November 2012 (UTC)[reply]

Firstly, it's not especially relevant that you're talking about Java; it's much the same problem in C or assembly or anything else that compiles down (by one path or another) to concrete machine instructions. In general, you won't get concrete answers to specific questions like this without reasoning about the real characteristics of implementations of algorithms, and the concrete characteristics of the real microprocessor you intend to run this on. To understand the relative costs of procedures, you need to know the relative costs of the primitives that comprise them. For your example, you'll need to figure out:
  1. the cost (in instructions) of calculating the nth member of the sequence from whole cloth
  2. the cost of calculating the nth member when you already know the (n-1)th member
  3. whether these operations can be achieved solely in the register set of the target machine, and if not how many load/store operators (moving data between registers and cache) are involved, per iteration
  4. to what extent the working set of your program fits into the (data) cache of your target processor
  5. and if it doesn't fit, figure out how many put/gets between cache and system RAM the process will take
  6. and, from the concrete characteristics of your given CPU and its memory interface (and actual memory) you have to figure out the cost of those reg-cache and cache-ram operations
Hopefully, from this you'll end up with two equations, one for the time taken for your first method and one for the second, and the answer to your question (with I think will be unique, but needn't be) will be the point at which the two cross. In practice, as CPU cores have gotten faster, they've progressively outpaced their caches, and the caches have in turn outpaced RAM, so the breakeven point between calculating and storing has moved outward with time. But where they cross right now, for your algorithm on your cpu, will take a more thorough calculation. -- Finlay McWalterTalk 18:49, 17 November 2012 (UTC)[reply]
Thank you. I have indeed a concrete mathematical problem that I am personally interested in and want to write a Java program for computing solutions to that problem. In particular, I want to compute solutions of the congruence -- Toshio Yamaguchi (tlkctb) 19:40, 17 November 2012 (UTC)[reply]
I know this is a digression but — why would you want to use Java for that? If you're writing a program to solve a problem for yourself personally, you don't need platform-independence, and you should get better performance in C or C++. (Of course, it could make sense if you just know Java better.) --Trovatore (talk) 19:46, 17 November 2012 (UTC)[reply]
Mainly because I am unfamiliar with C and only know little C++. -- Toshio Yamaguchi (tlkctb) 19:50, 17 November 2012 (UTC)[reply]
I already thought about possibly using Python. I haven't done much with Python so far, but from what I read on the web it seems to be relatively easy to learn and has built in arbitrary precision arithmetic for integers. -- Toshio Yamaguchi (tlkctb) 19:54, 17 November 2012 (UTC)[reply]
If you only want to go up to 1000000 (and you're using something later than an 80386) I suppose you really shouldn't much have to worry about speed anyway. But if you are worried about it, which your question seems to suggest, then an interpreted language like Python should be the last choice, even worse than Java.
You don't need arb-precision arithmetic to solve this problem (again, assuming you're only going up to 1000000). --Trovatore (talk) 20:01, 17 November 2012 (UTC)[reply]
Well, I planned for the program to be able to also search intervals with larger bounds. For example, if I want to be able to still use the program when I am somewhere around 1015 for n then I would indeed need arb precision arithmetic. -- Toshio Yamaguchi (tlkctb) 20:13, 17 November 2012 (UTC)[reply]
In any case I don't think either of your proposed algorithms is anywhere near optimal. What I would do is, for each value of n, compute by successive squaring mod (n+1)^2, using the binary representation of n. There are even better algorithms but that one is very easy to implement. It does mean that the work that you do for n=17 is irrelevant to the case n=19, but that's a small price to pay. --Trovatore (talk) 20:21, 17 November 2012 (UTC)[reply]
Thanks. I think I will have to study this problem more thoroughly before implementing something. At least I've got some good ideas now that I can investigate. -- Toshio Yamaguchi (tlkctb) 21:17, 17 November 2012 (UTC)[reply]
What language you use doesn't matter much, since most of the time will be spent in your bigint library, so use a fast one like GMP (library). The python wrapper for this is gmpy (www.gmpy.org). Java's bignum library is also reasonably good, though possibly optimized for cryptographic-sized numbers. The arithmetic will be slower than the memory transfers once the numbers start getting big. 67.119.3.105 (talk) 21:56, 17 November 2012 (UTC)[reply]
Well, not up to 10000000, it won't. You don't need bignums at all for that; you can do everything with 32-bit ints 64-bit long long ints. --Trovatore (talk) 22:37, 17 November 2012 (UTC)[reply]
To store 21000000 you will need 1000000 bits. So you would need bignums. Which is another argument for calculating the modulo value directly. Taemyr (talk) 19:20, 18 November 2012 (UTC)[reply]
You don't need to store 2^1000000. --Trovatore (talk) 19:30, 18 November 2012 (UTC)[reply]
Right, I see, modding out by (n+1)^2. 10^20 won't quite fit in 64 bits though. 67.119.3.105 (talk) 22:31, 18 November 2012 (UTC)[reply]

overflow of box in html

[edit]

Hi folks, I'm using SimpleModal with jQuery for dialog boxes, as found here, but I'm using it for a simple, general alert box, to override the ugly standard one you get with javascript/ html. But because I use it to add my own custom messages, the text overflows the alert box, and for some strange reason, the browser/ html standard doesn't get that I don't want text hovering in mid-air. How to I make a box resize itself when the text gets too long? The css currently has {height: 140px}. I know I could allocate size on a case-by-case basis, but it strikes me as frightfully simple, so surely there must be an option in standard css. I really can't believe it isn't already the default functioning. Every single google search takes me to an absurd array of things that are not connected, such as the function to allow the user to resize a window, when I want to make html do the automatic resizing. Setting "height: auto" simply doesn't work, and neither do any clearfix workarounds that I've tried, and I've been hunting for at least two hours, so this is driving me mad. Any help appreciated. IBE (talk) 21:11, 17 November 2012 (UTC)[reply]

Can you link to the specific code you're using? ¦ Reisio (talk) 22:52, 17 November 2012 (UTC)[reply]

Certainly: the link for demos is here, and the demo in question is the "confirm override" section. However, I think I know what's happening. Based on using Firebug, it seems that the program itself is asserting the css style, that is, Firebug shows the css as @element.style, rather than giving the original css file. I was thrown by the fact that the css contains the height data, but presumably, the javascript takes that css and applies it directly and forcefully, which is absurdly annoying. If anyone can either back this or refute it, I would be interested, but it's probably something like this, rather than a misunderstanding of css rules of precedence, or html/dom manipulation. Any insights welcome, but save yourselves the time if you think I'm right about the basic cause. I'm solving the problem by allocating the height as a parameter, which is easy enough, I just hate not having a general solution. IBE (talk) 14:14, 18 November 2012 (UTC)[reply]

In fact, I think I've found it: here is the code fragment, where i.b.e. refers to my own comments:

	$.modal.impl = {
		/*
		 * Contains the modal dialog elements and is the object passed
		 * back to the callback (onOpen, onShow, onClose) functions
		 */

		//blah blah lots of stuff

		update: function (height, width) {
			var s = this;
			//...
			// reset orig values
			s.d.origHeight = s.getVal(height, 'h');
			s.d.origWidth = s.getVal(width, 'w');

			// hide data to prevent screen flicker
			s.d.data.hide();

			//[i.b.e.] this seems to be the offending bit
			height && s.d.container.css('height', height);
			width && s.d.container.css('width', width);

			//...
		},

		//...


So this more or less resolves it, but since I'm here, if anyone has come across similar problems and knows good workarounds, please share them. I get that I could just fiddle with those lines, or even comment them out, but some gurus here might know a better way. Also, for other dummies who are following this for interest, the lines "height && " and "width && " are apparently just to ensure conditional execution of the second part of the line. This took me a while to figure out, so I thought I'd share it. IBE (talk) 14:42, 18 November 2012 (UTC)[reply]

Mouse repeatedly click when button is held down?

[edit]

I have a Logitech G500 gaming mouse with the SetPoint software. Is there any macro I can do to program my left click (or another button) to repeatedly register left-clicks when the button is held down? For example, when playing a shooting game and using a semi-automatic weapon, this allows me to continuously fire the weapon just by holding down the button, rather than repeatedly clicking. Acceptable (talk) 22:50, 17 November 2012 (UTC)[reply]

There are many different programs who do that, if you Google "auto clicker" you'll find quite a few. Do you want a fish, or do you want to learn how to catch fish? I would recommend learning AutoIt.
I wrote this script for you based on an example I found somewhere:
The following discussion has been closed. Please do not modify it.
HotKeySet("{F2}", "ToggleOnOff")
HotKeySet("{ESC}", "Terminate")

Dim $On = 0

While 1
	if $On = 1 Then
		MouseClick("left")
		Sleep(0) ;you can control the click interval by increasing this number, which is the amount of waiting time between clicks (in milliseconds)
	Else 
		Sleep(100)
	EndIf
WEnd

Func ToggleOnOff()
	If $On = 0 Then
		$On = 1
	Else
		$On = 0
	EndIf
EndFunc

Func Terminate()
	Exit
EndFunc
This is just a quick example, you can customize it however you like. The advantage of learning AutoIt compared to simply downloading a program made by someone else is that you are not restricted to mouseclicks. You can move the mouse and use the AutoIt function Send to send keystrokes. If you want to you can even make the script detect the amount of health your character has by checking the color of a couple of the pixels in the healthbar, if they are red you know you have at least that amount of health left. Trio The Punch (talk) 00:19, 18 November 2012 (UTC)[reply]
Updated version:
The following discussion has been closed. Please do not modify it.

;I used F2 and F4 because F1 is Help and F3 is Search
;I used two different methods to detect keypresses (HotKeySet for F2 and _IsPressed for F4 so if you want to change them both you have to look in two different lists so I added the URLs of the lists in the sourcecode


#include <Misc.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("MagiClick", 366, 77, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate")
$Label2 = GUICtrlCreateLabel("Press F2 to start the AutoClicker. Press F2 again to stop.", 8, 32, 269, 17)
$Label1 = GUICtrlCreateLabel("How many milliseconds should I wait after each click?", 8, 8, 257, 17)
$Input1 = GUICtrlCreateInput("0", 280, 8, 73, 21, $ES_NUMBER)
GUICtrlSetLimit(-1, 10)
$Label3 = GUICtrlCreateLabel("If you hold the F4 button the software will keep clicking until you release it.", 8, 56, 353, 17)
$Label4 = GUICtrlCreateLabel("0 - 2147483647", 280, 32, 79, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$hDLL = DllOpen("user32.dll")
$delay = 0
$guidelay = 0

HotKeySet("{F2}", "ToggleOnOff") ;You can find the list of keys you can use with hotkeyset here: http://www.autoitscript.com/autoit3/docs/functions/Send.htm
HotKeySet("{ESC}", "Terminate")  ;You can find the list of keys you can use with hotkeyset here: http://www.autoitscript.com/autoit3/docs/functions/Send.htm

Dim $Active = 0

While 1 = 1 ;loop
		
	
    If _IsPressed("73", $hDLL) Then ;Is someone holding F4?  You can change the key by changing the number, 73 is F4, here is the full list:  http://www.autoitscript.com/autoit3/docs/libfunctions/_IsPressed.htm
		WinSetTitle ($Form1, "", "MagiClick - Clicking!" )
		CheckDelay()
        While _IsPressed("73", $hDLL) ;Repeat the following actions until the F4 key is released
			MouseClick("left")
			Sleep($delay)
		WEnd
		WinSetTitle ($Form1, "", "MagiClick" )
	Else ;Is the autoclicker toggled on or off?
		if $Active = 1 Then
			MouseClick("left")
			Sleep($delay)
		Else 
			sleep(100)
		EndIf
	EndIf
WEnd

Func ToggleOnOff()
	If $Active = 0 Then
		$Active = 1
		WinSetTitle ($Form1, "", "MagiClick - AutoClicking!" )
		CheckDelay()
	Else
		$Active = 0
		Local $a = AutoItWinGetTitle()
		If $a = "MagiClick" Then
		
		Else
			WinSetTitle ($Form1, "", "MagiClick" )
		EndIf
	EndIf
EndFunc

Func Terminate()
    DllClose($hDLL)
    Exit
EndFunc


Func CheckDelay()
	
	$guidelay = GUICtrlRead ( $Input1 )
		
	If $guidelay <> $delay Then
		;delay must be under 2147483647 (less than 24 days in milliseconds)
		If $guidelay > 2147483647 Then 
			$guidelay = 2147483647
			GUICtrlSetData ( $Input1, "2147483647" )
		EndIf
		$delay = $guidelay
	Endif

EndFunc


You can use something like this to count the clicks. If you want to test it without installing AutoIt you can download the compiled version here. Trio The Punch (talk) 04:53, 18 November 2012 (UTC)[reply]

Thanks! Acceptable (talk) 18:17, 18 November 2012 (UTC)[reply]