Wikipedia:Reference desk/Archives/Computing/2012 March 10

Computing desk
< March 9 << Feb | March | Apr >> March 11 >
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 10

edit

Forcing Windows to choose a static IP only on a certain wireless network

edit

I am setting up a VNC server on a laptop for my mother so that I can connect to it remotely and troubleshoot her machine. The only way I know to do this is to turn on port forwarding on my router (WRT54G, fwiw). However, the router dynamically sets the IP address of each machine behind the firewall dynamically, so I don't have a machine to forward the port to.

I've tried to fix this by making Windows (Windows 7) automatically connect via a static IP address every time. It is successful at this, but with a caveat: it will try to connect to every wireless machine with the same IP. It does not seem I can set it to only connect to a given wireless connection via static IP, and another static IP or dynamic for others.

What can I do? 68.232.119.30 (talk) 00:33, 10 March 2012 (UTC)[reply]

I don't understand what you mean by "it will try to connect to every wireless machine with the same IP". Can you rephrase that? 87.112.245.215 (talk) 00:38, 10 March 2012 (UTC)[reply]
I believe the complaint is that the querent's mom's laptop will attempt to connect to the local coffee shop's wireless router with a static IP instead of accepting a dynamically assigned IP address. To the original poster: Are you sure you can't configure your mom's router to assign your mom's laptop a static IP address? I just checked my WGR614v8 router, which probably has similar firmware, and you do this on the "LAN Setup" page under "Address Reservation". Get this working, and the laptop can just be set up to accept a dynamically assigned IP address in all cases. Comet Tuttle (talk) 02:06, 10 March 2012 (UTC)[reply]
Comet Turtle has properly understood my complaint, yes. Oddly, I don't remember seeing that as a setting on the menu (I'm not on site so I can't check at the moment). If feasible, I assume this would be done via MAC address, correct? (OP) 98.235.166.47 (talk) 02:34, 10 March 2012 (UTC)[reply]
As an alternative, you might be able to set the DHCP server on the router to serve only a single address. Obviously this won't work with multiple clients, but would do if there's only a single device that uses the network.--Phil Holmes (talk) 11:47, 10 March 2012 (UTC)[reply]
Also, you could use the VNC server to "dial out" to your computer. That way, your Mom only has to click a "help me" icon, and it would start to connect to your computer. For this to work, you need a static IP or a dynamic DNS service provider, and a port forwarding for port 5500 on your router - but none on your Mom's router, and it would work from everywhere (coffee shop WiFi etc.), not only if she's at home. -- 88.67.157.60 (talk) 14:33, 10 March 2012 (UTC)[reply]

FYI, the router does not have an address reservation slot. But I may be able to get around the issue via port triggering. But I will have to find a utility online to dial out. 68.232.119.30 (talk) 19:37, 10 March 2012 (UTC)[reply]

If your usage will be non-commercial, you can install TeamViewer on the target laptop. It functions much like VNC but works from dynamic IPs and through firewalls, and is free for personal use. gnfnrf (talk) 12:20, 11 March 2012 (UTC)[reply]

Most routers will have no problem forwarding a port to a dynamic IP, as they will usually store the MAC adress to forward the port to. This means that if the laptop gets a different IP, the port forwarding is automatically updated and will still work. Edokter (talk) — 12:28, 11 March 2012 (UTC)[reply]

Help me ID a former warez group member.

edit

I've heard of this guy before, but I forgot his real name, alias, or as to what group was he from. All I know was he ran for public office in the U.S. after his stint at being a software pirate. Blake Gripling (talk) 03:55, 10 March 2012 (UTC)[reply]

Hm, this sounds suspiciously like you have actually have never heard of such a guy, and are hoping someone on the Reference Desk is ready to out a friend. Comet Tuttle (talk) 23:15, 12 March 2012 (UTC)[reply]
No, not really, I think I've read it here on a certain warez group article. Blake Gripling (talk) 09:29, 15 March 2012 (UTC)[reply]
EDIT 2 - That guy turned out to be Tony Krvaric, who's a former member of Fairlight and a San Diego Republican representative. Blake Gripling (talk) 09:29, 15 March 2012 (UTC)[reply]

RfC: What is the difference between information technology and computing?

edit

The articles information technology and computing appear to be about the same thing.

Please help solve this problem and edit the articles, or join the discussion at RfC: What is the difference between information technology and computing?

Thank you. The Transhumanist 15:47, 10 March 2012 (UTC)[reply]

As a quick short answer, IT is about the computers themselves and computing is about doing things with them (primarily). An analogy is building a car or working on it to make it run versus driving the car. Bubba73 You talkin' to me? 17:22, 10 March 2012 (UTC)[reply]
And IT concentrates on data, whereas computing is more general. Bubba73 You talkin' to me? 20:35, 10 March 2012 (UTC)[reply]

Compiling if statements with final booleans

edit

Hi everyone. I unfortunately don't understand the Java compiler as much as I would like to. Consider the following code:

public class MyTestClass {

public final boolean DEBUGGING = false;

public void doSomething() {
if(DEBUGGING) {
//several statements of code
}
}
}

As you can see, the code inside the if statement will never be executed. My question: Is the compiler "smart" enough to know the code won't be executed and exclude its corresponding bytecode from the application? I would think so, but if you put "bad" code in the if statement, like below:

if(DEBUGGING) { //final DEGUGGING == false
Object obj = "Test";
String test = obj; //won't compile without explicit re-cast to String
}

it won't compile, even though if the compiler doesn't create bytecode for the always-false if statement, what's inside shouldn't matter. I'm specifically interested in the behavior of the Oracle Java compiler, but would also be interested to hear whether compilers of Java and other languages differ on how they handle this. Thank you--el Aprel (facta-facienda) 19:50, 10 March 2012 (UTC)[reply]

Yes, because the bool is final the compiler won't emit code (which is essentially how one does conditional compilation in Java). I think that's part of the standard (and not just an obvious, but optional, optimisation). But this, as you note, doesn't allow you to have invalid code in the unexecuted section. When a a compiler builds a binary from a parse tree, it doesn't start at the top, but at the leaves, and fuses leaves. Sure, they could add support for this (for most languages the compiler has to walk back up the tree to look at containing blocks to resolve data references) but why would they? 91.125.155.37 (talk) 20:23, 10 March 2012 (UTC)[reply]
I'm confused. Did you mean the compiler will emit code?--el Aprel (facta-facienda) 20:32, 10 March 2012 (UTC)[reply]
No, it won't, but it doesn't know that it won't when it's generating a code fragment for the body of the if. Only once it's completed doing that will it evaluate the if and realise it can dump the code fragment it's just generated. 91.125.155.37 (talk) 20:45, 10 March 2012 (UTC)[reply]
According to what I understand about Java compilation, the above is very much correct. This is pretty much equivalent to:
if (false) {
  Object obj ="test";
  String test = obj;
}
The compiler doesn't have the intelligence we humans do. It can't deduce "this part will never be executed anyway, so it's not worth the bother checking the syntactic rules for it". It will check the syntactic correctness of every statement anyway. JIP | Talk 22:03, 10 March 2012 (UTC)[reply]
Actually, I'd say that a compiler that checks syntax for code whether it is going to be executed or not is more useful than one that excludes such code from checks. It is otherwise possible that an apparently minor change elsewhere in the code, which then meant that the code would be executed, would then result in a stream of error messages: not exactly helpful... AndyTheGrump (talk) 22:28, 10 March 2012 (UTC)[reply]
Consider: at a minimum, the compiler has to at least parse the <stuff> which follows JUST to know when it hits the matching }, right?
--184.100.83.209 (talk) 23:42, 10 March 2012 (UTC)[reply]
el Aprel's question is rather deeper than that; his code is lexically and syntactically correct, it only founders on Java's type semantics. So the fact that it errors gives a deeper insight into how the compiler works. The fact that C's #ifdef does allow any junk to be in a false section shows how how differently that works than Java's if(false) 91.125.155.37 (talk) 10:17, 11 March 2012 (UTC)[reply]
Not really: a conventional C compiler never gets to see the junk in the first place: the source code goes through the preprocessor first, which strips out all the junk, along with all the preprocessor operators. AndyTheGrump (talk) 14:06, 11 March 2012 (UTC)[reply]
Am I correct, then, that in C, code stripped out by the preprocessor only has to be lexically and syntactically valid, not actually pass compilation? Therefore, this should be valid:
#include <stdio.h>
int main(void) {
#ifdef NOT_DEFINED
  int a = 1;
  printf("%d\n", b); /* the variable is named a, not b */
#endif
  printf("Hello world!\n");
}
but this should not:
#include <stdio.h>
int main(void) {
#ifdef NOT_DEFINED
  Hello everybody! This is my first ever C program! Hope you like it... =)
  /* Syntax error: the preceding line has a right parenthesis without a preceding left parenthesis */
#endif
  printf("Hello world!\n");
}
JIP | Talk 22:17, 11 March 2012 (UTC)[reply]
As far as I'm aware, a C preprocessor knows nothing about C syntax: as far as it is concerned, it is simply processing a text file, substituting and omitting text based on preprocessor operators. Nothing else gets analysed at all. AndyTheGrump (talk) 23:03, 11 March 2012 (UTC)[reply]
Annoyingly, the C preprocessor knows tiny crappy bits of C syntax, which makes using it for other purposes (like an HTML macro expander) difficult. In particular, it knows about string literals, and elides adjacent ones, it knows about character literals (and so complains about things like 'foo' that aren't valid character literals in C). In some cases it also quibbles about character sets and even trigraphs. It would be much better if the preprocessor didn't do anything to lines that didn't begin with (spaces)# other than expand macros, but that's not to be. 87.115.67.78 (talk) 00:00, 12 March 2012 (UTC)[reply]
Ah yes - I've just dragged out my old copy of K&R, to check what exactly the preprocessor is supposed to do: a rather unfortunate combination of too much, too little, and things that should never be done at all. (Yes, like everyone else who's ever programmed in C, I've tied myself in knots trying to write clever macros, only to be frustrated by the arcane rules. I think it was this that finally convinced me that I was never cut out to become a professional programmer) AndyTheGrump (talk) 01:53, 12 March 2012 (UTC)[reply]
Sorry to show up late! The answer is, of course, "it depends." First, as has correctly been stated above, most standard Java does not use a preprocessor; though nothing forbids you from writing a Makefile and running the C preprocessor on your Java source files. So if you wanted to use C-style macros and ifdefs, that is possible, but fairly uncommon. As far as dead code elimination - yes, Sun Hotspot supports this optimization. If you're using the Hotspot compiler, now provided by Oracle, your "if false" block will be stripped during the compiler's optimization phase. Other Java compilers may support this optimization, but I'm uncertain if it's on by default in OpenJDK javac or in IBM javac. But, even in HotSpot javac, optimization occurs after compilation, so your "if false" block must still contain legal Java code, or it won't compile. Nimur (talk) 16:16, 11 March 2012 (UTC)[reply]
Actually, Dead Code Elimination is only available on the HotSpot Server Compiler (javac), (which is free to download, but is not free software). These optimizations do not appear to be available on the HotSpot Client Compiler nor on more recent Oracle Java SE 7 javac releases (or, they are present and undocumented). You might consider contacting the OpenJDK compiler-dev email list - details on their website - to ask them. If anyone on the planet knows which of the JavaEE compiler and VM internals made it into the OpenJDK javac, it'll be those folks. (As you're no doubt aware, "Server Compiler," "Enterprise Edition," and so on - the "marketing names" - got a bit munged up when Java migrated to Oracle; and a lot of the details of licensing changed, affecting the specifics of the open-source and free-to-use Java incarnations. Much of this knowledge is a bit buried behind corporate internals. Nimur (talk) 19:23, 11 March 2012 (UTC)[reply]

Advertising Malware on Wikipedia

edit

Hi, I commented the other day on the Help desk [1] because I have large and obtrusive banner adverts at the top of every Wikipedia page I visit. I was directed from there to here, and the discussion on the 8 March with an IP user [2]. Unlike that user, I have run the malwarebytes free scan, but nothing came up (I have Norton Anti-Virus, which normally sweeps this kind of thing up no problem). Does anyone have any further suggestions - right now there are dancing iphones all over the place and I can't concentrate on the articles?--Jackyd101 (talk) 21:06, 10 March 2012 (UTC)[reply]

Try a different browser and see if that fixes it. I have Internet Explorer, Firefox, and Opera, myself, but Google Chrome and a few other browsers are also popular. You can download them all for free. StuRat (talk) 22:19, 10 March 2012 (UTC)[reply]
I've tried that and it does - but does this mean that I can no longer use Wikipedia on Firefox without adverts (which is comfortably my most prefered browser)?--Jackyd101 (talk) 11:54, 11 March 2012 (UTC)[reply]
If it doesn't show up in other browsers but does in Firefox then try disabling all Firefox add-ons (extensions and plugins). If that still isn't enough check the Firefox proxy settings (Tools, Options, Advanced, Network, Settings) and delete any proxy info that's unwanted. If that still isn't enough, come back here. Once you've worked out what the problem is, you may want to work out how it got there. And avoid relying on Norton to have to mop up problems in the first place by being more selective in what you choose to run or install. Nil Einne (talk) 13:58, 11 March 2012 (UTC)[reply]
Disabling the add-ons did it - I found three I didn't recognise, disabled them and the ads have disappeared. Thankyou very much for your help. As for how they got there, I have just got this laptop back from my cousin who borrowed it to take to university - I dread to think what he was doing with it. --Jackyd101 (talk) 15:06, 11 March 2012 (UTC)[reply]
Can you tell us the names of the add-ons? I'd like to know, since there seems to be a minor adware epidemic right now. -- BenRG (talk) 03:33, 12 March 2012 (UTC)[reply]
A process of elimination has determined that the one responsible for (or at least facilitating) the Adware was named "Silverlight plug-in". The other two I wasn't vcertain of, which I have since re-enabled without a reappearance of the adverts, were "Shockwave Flash" and "Shockwave for Director".--Jackyd101 (talk) 18:06, 12 March 2012 (UTC)[reply]
You mean Microsoft Silverlight?--Jac16888 Talk 18:16, 12 March 2012 (UTC)[reply]
I don't know for sure - I don't remember downloading it, which means my cousin probably did. The add-on is titled "Silverlight Plug-In 4.1.10111.0" and unlike all the others, has no description when you click on "more" - it doesn't say "Microsoft" anywhere on the add-on, and when I go to the Microsoft Silverlight webpage [3], it does not recognise Silverlight on my system and suggests that it install it. All I do know is that when it is enabled, Wikipedia is covered in banner ads.--Jackyd101 (talk) 22:59, 12 March 2012 (UTC)[reply]
Well my Silverlight which I'm quite sure is legitimate is basically the same so I don't think it's a help. However the Microsoft site should recognise Silverlight as installed provided the plugin is enabled. (If the plugin is disabled of course there's no way it will know it's installed.) Presuming the Microsoft site does not recognise Silverlight as installed even when the plugin is enabled I guess you at the very least have a fake plugin. If it does recognise it as installed, this doesn't prove the Silverlight you have isn't fake since it's likely a fake plugin could link to Silverlight in such a way that it will work while doing whatever dodgy stuff it does. On the other hand, if you have the genuine unmodified plugin which is also a possibility if the Microsoft site does detect Silverlight, this would actually be more concerning in some ways. It suggests you haven't actually found the problem but simply hidden one of the obvious signs as I guess the malware is using Silverlight to serve ads. Nil Einne (talk) 14:26, 13 March 2012 (UTC)[reply]
That is quite worrying - my anti-virus doesn't pick up anything at all. At least the ads are gone.--Jackyd101 (talk) 21:45, 13 March 2012 (UTC)[reply]

Discovering my password

edit

If I am at a computer, under Windows XP, being the admin and connected to the Internet through a router. How can I see the password of this router? I have to connect another but have no idea how to see it. — Preceding unsigned comment added by 186.206.246.99 (talk) 21:14, 10 March 2012 (UTC)[reply]

If you don't remember your password, usually there is a reset that will set the password back to the factory default, which depends on who made the router. Bubba73 You talkin' to me? 21:52, 10 March 2012 (UTC)[reply]
They generally never display passwords, even to the Admin, as somebody could see it who shouldn't. Also, passwords might be dirty words and such that should be kept private. StuRat (talk) 22:17, 10 March 2012 (UTC)[reply]
For wireless routers or hubs, often the password can be found on a tag stuck to the device. Is that what you have? Looie496 (talk) 04:11, 11 March 2012 (UTC)[reply]
Solved! I whether needed reset, nor was it not displayed, nor was it attached to the device. I logged into the router through 192.168.1.1 using a standard password, and could see directly the wireless password. — Preceding unsigned comment added by 186.206.246.99 (talk) 04:46, 11 March 2012 (UTC)[reply]
  Resolved

encryption

edit

Is 7zips ASE encryption as good as true crypt? — Preceding unsigned comment added by 98.145.71.230 (talk) 21:57, 10 March 2012 (UTC)[reply]

If i understand correctly, 7zip encryption uses cbc, but truecrypt uses xtx, which means, that it is possible to access any part of data set directly (in truecrypt), but in order to access any random part of cbc encrypted data, all data before it must be decrypted first. Security wise they seems to be equal for most purposes. -Yyy (talk) 05:27, 11 March 2012 (UTC)[reply]
The short answer is yes. The long answer is "it's complicated". For example, to view or edit a file in an encrypted 7-Zip archive you'll have to extract it, which will probably store it unencrypted on your hard drive. Truecrypt doesn't have that problem. On the other hand, Truecrypt's volumes are accessible to all software when they're mounted, and some software might (innocently) save copies of your document elsewhere. 7-Zip archives don't have that problem. -- BenRG (talk) 07:31, 11 March 2012 (UTC)[reply]

Audio in/out

edit

Hey gang, I hope you'll forgive my embarrassing lack of the right terms...

I have a Macbook Pro 13-inch, it has one "audio input/output" port. Is there any device that you know of that would allow me to plug in an input device (my bass with a 1/4 inch-to-8th inch adaptor) and then still have all the audio of the computer go to headphones?

My old computer had two ports and I liked to practice through garageband (a program on the mac) without disturbing my roomies.

So is there such a device that I could use?66.30.10.71 (talk) 22:17, 10 March 2012 (UTC)[reply]

I doubt it. It sounds like it must set the jack to either input or output mode inside, so you'd need to rip open the cover and alter the electronics to be able to have both inputs and outputs at once, if it's even possible. StuRat (talk) 22:25, 10 March 2012 (UTC)[reply]
There is such a device, but it doesn't plug into the audio port - it's called a USB sound card, searching for "USB sound card mac" should give you a large number of options to choose from (no idea if they are generally platform specific - but better to be safe than sorry). Prices seem to range from a few dollars for a bargain basement unbranded model with one input and one output, to a few hundred dollars for professional versions with about 8 outputs. Equisetum (talk | contributions) 22:45, 10 March 2012 (UTC)[reply]
It's better not to use a normal sound card's MIC or LINE ports, as the impedance doesn't match that of the electronics in a guitar or bass. To properly faithfully connect such an instrument, one should use a USB instrument adapter like a Behringer UCG102 (or one of the many competing brands; I know the Behringer works, but I don't have enough experience of the others to say it's any better). 91.125.155.37 (talk) 09:43, 11 March 2012 (UTC)[reply]

Explicit instantiation

edit

In C++, why should explicit instantiation not use the 'inline' specifier? Also, am I correct in thinking that the purpose of explicit instantiation is to generate code for a specific template, so that it can be used in another translation unit? --140.180.0.112 (talk) 22:38, 10 March 2012 (UTC)[reply]

The answer to your second question is yes, and I think that answers your first question. (Inline functions have to be defined in every translation unit where they're used, which would defeat the purpose of explicit instantiation.) -- BenRG (talk) 07:36, 11 March 2012 (UTC)[reply]

How much for 13" MBP 2010?

edit

I am looking to buy a used 13" MacBook Pro, from mid-2010, Intel Core 2 duo 2.4 Ghz, 250GB, 4GB RAM from a classified ad for $300. I'm not sure how much macbooks can resale for, but this seems a bit cheap to me. I fear it might be stolen, but the seller says 2 years of Applecare is still included on the laptop. Does the existance of Applecare on the laptop help verify its authenticity? Acceptable (talk) 23:43, 10 March 2012 (UTC)[reply]

I think that is does, since I also think that you can only buy AppleCare when you first purchase the device. — Preceding unsigned comment added by 85.211.130.94 (talk) 06:27, 11 March 2012 (UTC)[reply]

... provided, of course, that you can verify that the registered owner of the AppleCare is indeed the seller. Dbfirs 07:55, 11 March 2012 (UTC)[reply]
$300 sounds very cheap to me. A quick search on eBay revealed $900+ to be a more typical asking price. Maybe there's something wrong with it? - faulty in some way or stolen. Astronaut (talk) 13:29, 11 March 2012 (UTC)[reply]