Reference desk/Archives/Computing/2013 September 9

From formulasearchengine
Jump to navigation Jump to search

Template:Error:not substituted

{| width = "100%"

|- ! colspan="3" align="center" | Computing desk |- ! width="20%" align="left" | < September 8 ! width="25%" align="center"|<< Aug | September | Oct >> ! width="20%" align="right" |Current desk > |}

Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


September 9

4K pass-through on A/V receivers - Is it a scam/marketing hype or a real feature?

My brother is looking for a new receiver. I went shopping with him today and noticed that a number of A/V receivers are claiming to be "4K ready". However, these receivers only seem to be offering:

  1. 4K Upscaling
  2. 4K Passthrough

The first is largely irrelevant as a 4K TV will upscale anyway. My question is about the second bulletpoint. If all the receiver is doing is a pass-through, how is that different from any other HDMI connection? IOW, if all the receiver is doing it passing through an HDMI connection, what difference does it make if it's HD or 4K? A Quest For Knowledge (talk) 02:22, 9 September 2013 (UTC)

HDMI is a digital standard. When something has passthrough, it mostly likely isn't referring to simple passive passthrough but ability of the receive to receive the signal, use the audio and retransmit the video. (And probably the ability to have multiple HDMI inputs and only output one.) If the receiver isn't capable of receiving the signal because it's too highbandwidth or otherwise beyond the capabilities of the device, then it obviously cannot retransmit it. (Even if we were talking about a completely passive passthrough which is rather unlikely, if the device has some sort of switching then this needs to be capable of transmitting the frequencies and other requirements required by the link.) HDCP may further complicate matters. Nil Einne (talk) 00:10, 11 September 2013 (UTC)

Resetting my default monitor resolution in Linux Mint

I've been running Linux Mint with the Cinnamon desktop on my laptop for the last few weeks, much of the time using an external monitor. A couple of days ago I ran a game which resized my external monitor to 640x480 and now it is stuck in that resolution; the laptop screen is not affected. Mint's display tool seems to hang when I try to resize the external monitor back to something more useful. How can I get Cinnamon or X or Mint to forget it ever saw the external monitor, so next time I plug it in, it will go "Ah, a new monitor; let get the best screen resolution"? Astronaut (talk) 04:31, 9 September 2013 (UTC)

mv /etc/X11/xorg.conf /etc/X11/xorg.conf.backup and then reboot. -- Finlay McWalterTalk 10:34, 9 September 2013 (UTC)

Running first Java program on Eclipse

I've typed out the introductory program in Java in a Nutshell into Eclipse exactly as the program is shown but I'm getting an exception. Could someone explain what I'm doing wrong? The program is:

public class Factorial {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		int input  = Integer.parseInt(args [0]);
		double result = factorial(input);
		System.out.println(result);
		
	}

	private static double factorial(int x) {
		if (x < 0)
			return 0.0;
		double fact = 1.0;
		while (x > 1) {
			fact = fact * x;
			x = x - 1;
		}
		return fact;
	}

}

And the exception that I'm getting is: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at Factorial.main(Factorial.java:8)

I've double checked my typing and it's the same as what's in the book. Line 8 is the line with Integer.parseInt in it and the parseInt is in italics but I'm not sure why. What am I missing? Is it something in the way I've set up Eclipse? Thanks, Dismas|(talk) 10:53, 9 September 2013 (UTC)

The line int input = Integer.parseInt(args [0]); is accessing the first member of the array args, which is supplied to the program by the OS when it starts the program. That array contains, as Strings, the command-line arguments sent to the program. It looks like you're running the program without specifying any arguments, so args is == [], which means it doesn't have an element at position 0, hence the exception. A program really shouldn't throw an exception like this simply on seeing unexpected input - it could check args.length>0 (and complain if it isn't), like this:
    public static void main(String[] args) {
	if(args.length !=1){
            System.err.println("error: factorial program needs exactly one argument");
            return;
        }

        int input  = Integer.parseInt(args[0]);
        double result = factorial(input);
        System.out.println(result);
    }
or it could do better, and iterate over args and print the factorial of each argument, making main() look like this:
   public static void main(String[] args) {
        for (String arg: args){
            int input  = Integer.parseInt(arg);
            double result = factorial(input);
            System.out.println(result);
 	}
    }
As you're running in Eclipse, you'll have to find the dialog which allows you to specify the command line args that are passed when a program is run, and there you'd put the value you wanted to pass into the running program. Or you could run the program yourself from the command line, simply by saying e.g. java Factorial 13      -- Finlay McWalterTalk 11:04, 9 September 2013 (UTC)
On Eclipse(3.8) in my machine one can set the command line args by:
  • run -> run_configurations
  • go to "arguments" tab
  • add (e.g.) 13 to "program arguments" box
-- Finlay McWalterTalk 11:13, 9 September 2013 (UTC)
Ah! That makes sense. I never gave it a way to accept an initial value. The book uses the official JDK and runs the programs via command line. Thanks much for pointing out my error. Dismas|(talk) 13:22, 9 September 2013 (UTC)

Yahoo mail with mpop

I'm trying to get my mail from Yahoo with mpop (ver. 1.0.27) using the following command:

mpop --host=pop.mail.yahoo.com --delivery=maildir,/var/spool/mail --auth=user --user=[USERNAME]

(then it asks for my password)

and I get:

mpop: authentication failed (method USER)

mpop: POP3 server message: -ERR [AUTH] Access to this service is not permitted.

mpop: error during mail retrieval


What is wrong? It works under Windows with POPPeeper.

79.134.238.136 (talk) 14:03, 9 September 2013 (UTC)

Hmm, it works okay with mpop for me, with the options you give. The only suggestions I have is that a) you make sure POP access is enabled for the account (it's an option you set in the webmail interface) and b) the username you specify is just the username, not the full email address: e.g. joe_blogs not joe_blogs@yahoo.com      . Note that, once you have got it working, you probably want at least to add the option --tls-starttls=on       -- Finlay McWalterTalk 16:48, 9 September 2013 (UTC)
I should say that the problem you're having appears not to be an incorrect password (as the error that gives is mpop: authentication failed (method USER) mpop: POP3 server message: -ERR [AUTH] Incorrect username or password. (#MBR1212). And, for an experiment, I set the username to have the @yahoo.com, contrary to my B idea above, and it still works (they're smart enough to accept it with or without). -- Finlay McWalterTalk 16:58, 9 September 2013 (UTC)

how can facebook.com freeze my whole PC (including mouse cursor) for a few seconds when I enter it?

I'm perplexed how my first visit each day (in private mode) to www.facebook.com can freeze my whole PC, including making the mouse cursor unable to move, for a few seconds, both in Firefox and in Chrome?

1) what is it doing during this time

2) how is this technically possible?

My best guess based on Zuckerberg's hacker past is that the 'application' is somehow clocking the whole PC in a tight internal loop, to make sure that it is not running inside a VM. However, what software can specifically do this? Is it the Flash plugin? how come the plugin does not behave this way on any other site? It's doubly weird as the page that does load is super-simple and does not need to depend in any way on anything complicated or any calculation, no animation or flash movies or anything else complicated follows...

I find it so weird that a browser, which is kept up to date and used to not trusting anything coming over random internet pages (i.e. you're not supposed to just get 'hacked' by visiting a URL, both Firefox and Chrome are supposed to be able to not have to trust the data they get) can freeze the whole computer including mouse for several seconds.

It would be another matter if this were an installed application. But it's just a web URL. — Preceding unsigned comment added by 195.56.96.233 (talk) 17:47, 9 September 2013 (UTC)

What exactly is going on here? 195.56.96.233 (talk) 17:43, 9 September 2013 (UTC)

I think it's more likely that your computer is low on ram, and going to a website that requires a lot of ram temporarily chokes your computer as it pages things out to disk.
APL (talk) 17:49, 9 September 2013 (UTC)
Yeah, it's very likely you're very low on RAM when you open facebook, since it tends to load lots of images and JavaScript. 190.60.93.218 (talk) 17:52, 9 September 2013 (UTC)

Absolutely not. I have more than 1.5 GB of Free ram with almost no applications installed since hte installation of Windows, and the laptop also has an SSD. It also has not exhibited this behavior on anything else. There is no other site that would cause this behavior, except maybe if I have an inordinate number of tabs open or something, and load something with heavy Flash in it. The idea that images and JavaScript to open the Facebook front page would cause my cursor itself to be unable to move, in boht Chrome and Firefox, is ridiculous on its face. What do you propose all that Javascript is? And loading images does not exhibit this low-level Kernel usage - there is no way that simply going to a site with a lot of images would cause my cursor and entire PC to freeze for a noticeable number of seconds. As I said, there are almost no applications, an SSD, and more than a gig of free memory. If you Google my behavior there are other reports:

https://www.google.com/search?q=going+to+facebook.com+causes+pc+to+freeze+for+several+seconds

I find the same behavior as the first link: "I'm having the same issue... I have to wait about 10 seconds before it unfreezes then I can login. After that everything works fine."

There is literally one explanation that fits perfectly well: testing whether the application is in a VM by very tightly clocking something in hardware, and seeing if the resulting profile is in line with physical hardware, or with a VM. Other applications certainly do this. But my question is, by what mechanism is Facebook.com doing this? What loop can it run so tightly, for ten seconds, that regardless of whether I have switched away from that application, the entire Operating System (and believe me, Windows 7 isn't exactly built on the idea of 'cooperative multitasking) freezes, to where I could not even type in (or switch to with alt-tab) notepad.exe, nor even move my cursor (which is very low-level in Windows).

For any experts: WHAT exactly is Windows, Firefox/Chrome, Facebook, Flash etc, doing here? 195.56.96.233 (talk) 18:41, 9 September 2013 (UTC)

I still doubt that it is testing if it is in a VM. What possible motivation does Facebook have to slow some people's (but not most) computers to a crawl in order to detect that? They don't care if you're in a VM or not. I've had Flash do similar things to my computer in the past, although not with Facebook, and it is probably due to buggy implementation of Flash, not deliberate system profiling. Have you tried narrowing down what is causing it? Try disabling Flash. If you prove it is Flash you could try using a plugin to log requests, and then block individual swf files to figure out what one is causing it. I don't have a name (talk) 19:02, 9 September 2013 (UTC)
Template:Ec Does it still hangs when you disable flash?
The best way to be sure is to profile the facebook page using the dev tools your browsers have (the alternative way is reading it's obfuscated source), doing this, you may find where most of the processing power is going to. I would do this, but the results would be meaningless because for me facebook doesn't hang when loading. 190.60.93.218 (talk) 19:03, 9 September 2013 (UTC)

Algorithm to calculate exponentials with Decimals

This wikipedia article does well by explaining some of the exponentiation algorithms there are, however I did not find out algorithms that do calculate exponentials when these have decimals or are rationals, where can I find this information? 190.60.93.218 (talk) 17:46, 9 September 2013 (UTC)

It seems like the basic method is pretty simple to generalize to any base so you can change the division by two to a division by 10 by updating it to 10 cases. I don't know if there are any references out there for doing it that way, you may have to do your own analysis to see how efficient it is. The x^2 becomes x^10, so it seems like you lose quite a bit of speed right there. I don't have a name (talk) 18:13, 9 September 2013 (UTC)
Sorry, I just realized I misinterpreted your question. By "have decimals" I read it as meaning are encoded in a decimal format, and thought you were looking for an alogrithm similar to binary exponentiation that took advantage of fast base-10 operations instead of base-2 operations. Now I realize you meant that it should work with real exponents, not just integers. I'll see if I can find anything useful. I don't have a name (talk) 18:24, 9 September 2013 (UTC)
Oh, I didn't realize it could be misinterpreted this way, I'll try to be more clearer/careful next time. 190.60.93.218 (talk) 19:25, 9 September 2013 (UTC)
Real-to-real exponentiation is defined as , and that immediately suggests an algorithm: Compute the logarithm of x by power series (you need to do a little extra work because of the fact that the basic power series for is absolutely convergent only for , but this can be handled), multiply by y, and then take the exponential of the product using power series.
I'm not saying this is necessarily the best algorithm (certainly it would be annoyingly involved for pencil-and-paper), but it's at least one. --Trovatore (talk) 18:30, 9 September 2013 (UTC)
It is probably not worthwhile to calculate the log using a power series - just use the log function. Bubba73 You talkin' to me? 01:25, 10 September 2013 (UTC)
Huh? If you assume you have the log function available as a black box, then why not the function as well? --Trovatore (talk) 02:04, 10 September 2013 (UTC)
Most computer languages have log and exponential functions built in, but not raising a number to a real power, like the OP is asking about. Bubba73 You talkin' to me? 02:12, 10 September 2013 (UTC)
pow() is part of the C standard. (C and C++ are the only programming languages that really count.) --Trovatore (talk) 02:19, 10 September 2013 (UTC)
Then why is the OP asking? Since he is asking for an algorithm to do it, maybe he doesn't have it built in. Bubba73 You talkin' to me? 02:38, 10 September 2013 (UTC)
Very true. So why do you assume he has exp and log? --Trovatore (talk) 02:51, 10 September 2013 (UTC)
Just about everything I know of have them. And if he doesn't know about the method with exp and ln, telling him to calculate them with a power series is not a helpful answer (and that is not a good way to calculate them either). Bubba73 You talkin' to me? 02:55, 10 September 2013 (UTC)
Exponentiation#Rational_exponents and nth root algorithm should give you the information that you need. Real exponents can be approximated closely by a rational exponent. I don't have a name (talk) 18:33, 9 September 2013 (UTC)

old RAM

Hello, so I have a relatively new (if low-end) PC but it only has 4mb of RAM in it. I have been meaning to buy another 4mb of ram. And then at the weekend I found the motherboard from my 486, which is probably about 12-15 years old. It had a load of RAM in it. Can I put that RAM into my new computer, or is that a ridiculous thing to do? Thanks! Horatio Snickers (talk) 19:57, 9 September 2013 (UTC)

It's a ridiculous idea, especially because your 486 may have 4 MB of RAM, but your "relatively new" PC most likely has 4 GB. One per mil of old slow RAM won't make much of a dent (and no, it will not remotely work - the fastest 486 RAM was designed to work of a 50 MHz memory bus, and current PCs are somewhere near a GHz, and use a different bus, too). --Stephan Schulz (talk) 20:27, 9 September 2013 (UTC)
Your new computer likely has 4 gigabytes of RAM, or 4GB. The RAM modules in your old 486 machine likely won't fit the new machine (has a different pinout, clock rate and and architecture). It almost certainly won't work. Fast track obsolescence is the rule in computer hardware. --Mark viking (talk) 20:43, 9 September 2013 (UTC)
Concur with previous comments by Stephan Schulz and Mark viking. Old SIMMs are physically incompatible with current memory sockets.
Please see Single in-line memory module (SIMM), the first image on the page shows quite clearly the physical difference between early (30 pin) and later (72) pin memory modules. Secondly, if your new computer does already have 4 Gigabytes of RAM, then any extra compatible memory you install will be unusable unless you are using a 64 bit operating system. See Microsoft web page: Template:Cite web Also see Dual in-line memory module for what current memory 'sticks' look like. --220 of Borg 04:35, 10 September 2013 (UTC)