Wikipedia:Reference desk/Archives/Computing/2008 December 12

Computing desk
< December 11 << Nov | December | Jan >> December 13 >
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 12

edit

What's the largest wikipedia disambiguation page and how many entries does it have?

edit

I'm just curious. I like the idea of a versitle concept. 75.71.18.225 (talk) 04:53, 13 December 2008 (UTC)[reply]

Perhaps you should ask at WP:HD... flaminglawyercneverforget 14:15, 13 December 2008 (UTC)[reply]
A complete guess would be People with the surname Smith. 83.250.202.208 (talk) 14:48, 13 December 2008 (UTC)[reply]
That's more of a 'list of...' page than a disambiguation. SteveBaker (talk) 06:08, 14 December 2008 (UTC)[reply]
It's not properly a HD question. I have no desire to edit the page, just to see it. Balonkey (talk) 06:50, 15 December 2008 (UTC)[reply]
edit

I'm trying to write a regex (in .net) to extract a url given the linked text (eg: <a href="http://www.yahoo.com">foo</a></nowiki> should give me: "http://www.yahoo.com")

I have tried: "<a href=(?<url>.*?)>foo</a>" but it fails when there are many urls (eg: <a href="http://www.google.com">google</a> <a href="http://www.yahoo.com">foo</a>" gives me: "http://www.google.com">google</a> <a href="http://www.yahoo.com")

thanks —Preceding unsigned comment added by 96.15.145.57 (talk) 00:46, 12 December 2008 (UTC)[reply]

Regular expressions are greedy and will match as much as possible. Some implementations have a non-greedy option you can use. I don't use .net, so I don't know if you just turn off the greediness. If not, you have to tell it that > will not appear the URL. Using normal RegEx syntax, it looks like: "<a href=([^>]*)>". Of course, that will fail if you have something like <a href='somelink.html' style='color:red;'>. So, you need to assume that there are quotes of some kind around the URL and use <[aA] [^&gt]*[hH][rR][eE][fF]\s*=\s*['"]([^'"]*). Notice that I capture both upper/lower cases. I allow for any garbage between the a and href. I start after the ' or ". I don't need any more because it will stop looking as soon as it hits the next ' or ". -- kainaw 03:56, 12 December 2008 (UTC)[reply]
If it doesn't have quotes, you can extract it using the fact that urls can't contain spaces. Something like:
<a href="?([^" ]*)
should match it fine. It wont work if the link is like <a style="something" href="http://example.com">, so you might want to use
<a [^>]*href="?([^" ]*)
instead. That should work, but I haven't tested it. If it doesn't, report back. 83.250.202.208 (talk) 19:58, 12 December 2008 (UTC)[reply]
Oh, yeah, about case-sensitivity: perl has an option (/i) to specify that the pattern matching is case-insensitive. Don't know if .net has such an option. That's the simplest way to make sure it works. Otherwise, replace "a" with "[Aa]" and "href" with "[Hh][Rr][Ee][Ff]" in my regex. Then it should work perfectly. 83.250.202.208 (talk) 20:02, 12 December 2008 (UTC)[reply]

Thanks guys. Both of your suggestions worked very well. I've combined elements of both and ended up with: <a[^>]* href\s*=\s*['"]([^'" ]*)['"]> as it turns out that .net has a ignore case option. In the first one I was trying to use the non-greedy option, but I think it only works right to left, not left to right, if that makes any sense. 98.134.241.110 (talk) 20:49, 12 December 2008 (UTC)[reply]

Just one thing: I'm not sure that will work if the link-tag doesn't use quotes (that's bad html-writing, but it happens). I'd use ['"]? instead of ['"] just to be sure. 83.250.202.208 (talk) 21:23, 12 December 2008 (UTC)[reply]

C++ question!

edit

the second expression is wrong. because in array declaration, the size of the array must be constant.

Ok now assume i've written 2 lines like this:

int n=10;

char name[n];

Don't think the following question is a stupid one before reading my argument! Now assuming these two statements are part of a bigger program.Would you say that this is a correct intialisation or a wrong one? Is it necessary to have the keyword "const" (constant) before the "int n=10;" making it "const int n=10;"??? And if it is a correct one then is it a static allocation or a dynamic one? My argument is that it is a correct one. Even if these two lines are part of a much bigger program when the compiler first compiles the program ,it will come to this line "int n=10;" and EVEN THOUGH there is no const keyword it will intialise n with the value 10 and right after that the intialisation of the char array is taking place,so the value of n DOESN'T CHANGE during runtime, so technically it should reserve the memory of 10 bytes for the array "name".So whatever be the value of "n" before this line,but at this moment right here it is 10 and it ain't changing so technically it should work and reserve 10 bytes. Which means that it is a static allocation right?Because the memory is being reserved during the compilation period. But most people claim this is a dynamic allocation.Does anyone have a logical explanation to this? Oh and yes i have tried the above code and it gives no error whatsoever. I extended it to two more lines after that and it got initialised.

int n=10;

char name[n];

gets(name);

puts(name);

And it executed perfectly and takes the input properly and outputs it.But even then most claim that "theoritically " it shouldn't work . So if anyone has an explanation of some kind i would love to hear it. —Preceding unsigned comment added by Vineeth h (talkcontribs) 08:48, 12 December 2008 (UTC)[reply]

In your example, n is a variable. It is not a constant. So, you are using a variable length for the name array. Doing so means you have a dynamic array. You claim it worked, but did it really work. Did you verify you didn't have a memory leak since you didn't delete the name array when you were done with it? A memory leak means it isn't working properly. -- kainaw 14:30, 12 December 2008 (UTC)[reply]
It's wrong because the C++ standard says it's wrong. C++ does not have dynamic arrays. It's true that it would be easy for a language to support the feature you describe (C99 does), but C++ does not. The fact that it works for you means that your compiler does not conform to the C++ standard in this instance. You may be able to pass it some flag like "-pedantic" to get it to complain about non-standard constructs like this, which will make your programs more portable across compilers. --Sean 15:08, 12 December 2008 (UTC)[reply]
The compiler knows that the expression n is constant due to Constant folding. The type of name is char[10], which is a fixed sized array type. The C99 extension defines dynamically sized arrays; looks similar but works quite different. Whether name is allocated dynamically or statically depends on where you write that code snippet. In a function body, name will be part of the stack frame of the function, which means dynamic memory. —Preceding unsigned comment added by 84.187.56.177 (talk) 22:58, 12 December 2008 (UTC)[reply]
Also, the values in the name array are uninitialized, thus the call to gets is undefined. From the gets manpage*: "gets() reads a line from stdin into the buffer pointed to by s until either a terminating newline or EOF, which it replaces with '\0'. No check for buffer overrun is performed (see BUGS below)."
The note in BUGS referenced in the quote applies to reading from the standard input stream (it turns out to be a security risk. The first sentence in the section BUGS is "Never use gets()."*
Because it's uninitialized, you can't be guaranteed than either a terminating newline or an EOF will be within the array size. My point is, if the 4-line example you gave above runs correctly, you simply happen to be lucky. --Silvaran (talk) 01:46, 13 December 2008 (UTC)[reply]

Sal ex

edit

oes anyone know where i can find info on this virus? 147.197.229.134 (talk) 09:26, 12 December 2008 (UTC)[reply]

Look for virus library on google or go to McAfee's website and look for info there. There are quite detailed lists about viruses on most of the major virus-scanning/protection websites. 14:05, 12 December 2008 (UTC) —Preceding unsigned comment added by 194.221.133.226 (talk)

Xbox 360 Arcade Bundle

edit

My Xbox red ringed and I got a $300 check from dell to replace it. Since I can't just buy a core system through them I wanted to buy this bundle and attach the hard drive from my busted Xbox to it. Will it work? [1] Strifeblade (talk) 20:14, 12 December 2008 (UTC)[reply]

Sure, no reason it wouldn't. The Arcade doesn't come with a hard drive, but the console is otherwise the same, and you can still connect a hard drive to it. You'll probably want to run this after. -- Consumed Crustacean (talk) 20:27, 12 December 2008 (UTC)[reply]
Thanks for the help! Strifeblade (talk) 20:30, 12 December 2008 (UTC)[reply]
How sure are you that the cause of the Red-ring isn't a failed hard drive? SteveBaker (talk) 06:04, 14 December 2008 (UTC)[reply]
A typical RRoD is a result of overheating in the 360. It causes the solder to melt inside the Xbox 360 and as far as I know the HDD doesn't overheat. My suggestion is keep that beast some where very open and cool. Rgoodermote  08:24, 14 December 2008 (UTC)[reply]

Building a PC

edit

I'm interested in building my own PC, but I'm afraid I don't know too much about it. If anyone could offer some insight, I would be immensely grateful.

First of all, should I build a laptop or a desktop? I would prefer to have a laptop, but I've heard they're more expensive and difficult to build. How expensive is it to build a computer? I'm not going to buy a lot of expensive graphics cards or whatever, just stuff that's good enough to run some games on- I'm not a big gamer. I especially would like to know how expensive the OS would be. I do not want Linux, I want Windows. Also... how difficult is it to build a computer and how long will it take? Are there any online tutorials I can use to help me through the process and where should I buy the parts from?

If there's anything else you think would help me, please tell me. As I said, I don't know much about building computers, so I may not know what questions to ask. Thanks! 24.180.87.119 (talk) 20:35, 12 December 2008 (UTC)[reply]

Building a PC is much easier then you would think! First, go to a website like newegg.com to look up parts. You should build a desktop because building laptops are literally impossible. Things you will need for a custom PC is a 'computer case', a motherboard, RAM, a hard drive, keyboard, mouse, monitor, and a CD drive if you want to install Windows. Get those things together in a list, suiting your needs, I build powerful PC for less then $500 dollars! So, budget won't be a problem, Building it is a diffrent story. You might want to hire an expert for that. That's my recommendations. --Randoman412 (talk) 21:13, 12 December 2008 (UTC)[reply]

OK, thanks. I'll definitely be building a desktop, then... is there any site that has directions or tutorials? How difficult would it be to put it together on my own? 24.180.87.119 (talk) 04:19, 13 December 2008 (UTC)[reply]
A 2 second Google search turns up this as the 1st result. flaminglawyercneverforget 06:10, 13 December 2008 (UTC)[reply]
It used to be cheaper to build your own, but nowadays unless you've a good reason otherwise I'd advise against it. Dmcq (talk) 17:32, 13 December 2008 (UTC)[reply]
Note that "build your own PC" has two meanings:
1) Buy all the components and assemble it yourself.
2) Specify each component and have the retailer assemble it for you.
Do you mean option 1 ? StuRat (talk) 18:14, 13 December 2008 (UTC)[reply]
Yes, I did mean option 1. I would also like to point something out to CheeseDreams- Google is good for finding basic information, but note I wanted a recommendation of a good tutorial site. Google cannot tell me whether a site is good or bad; you guys can. Hence the reason I asked here. Before rudely pointing someone to Google, consider why they're asking, not just what they're asking. 24.180.87.119 (talk) 23:26, 13 December 2008 (UTC)[reply]
The trick is to go someplace like Fry's (assuming you're in the USA) - they will be able to sell you a case plus power-supply (which is generally cheaper than a power-supply by itself!!) - let you pick a motherboard - tell you what memory and CPU options you have to choose from. Getting a CPU and memory that works with a particular motherboard can be tricky - so getting some expert advice is strongly advised. Then you'll probably want a graphics card - plus a hard drive and a DVD-player/writer, keyboard and mouse...pretty much anything works with anything else there. The actual assembly is really very easy - the toughest part is typically getting the CPU plugged into the motherboard with its heatsink and/or fan. You have to squirt thermal paste between the CPU and the heatsink and the clips to hold the fan in place can be fiddly. But plugging everything else together is pretty simple - most of the time there is only one way to do it - so you can't get it wrong. Once the machine will boot into the BIOS ROM, you should be able to run some self-tests to make sure that everything works - so now you can install your operating system. Be patient - take each step carefully. I've done it a bazillion times - it's not hard. I'm a big fan of building your own PC. My PC originally ran Windows 3.1 - and has been upgraded over and over for about 15 years! At no time have I ever replaced the whole thing - but not one part of it (except maybe the power cord) is original - most things have been replaced 5 or 10 times over! SteveBaker (talk) 06:03, 14 December 2008 (UTC)[reply]

online guitar auto tuner

edit

hi,

is there anywhere on the web where a free guitar auto tuner can be found, with a sound input as a microphone or something? thanks, --84.69.235.69 (talk) 20:56, 12 December 2008 (UTC)[reply]

I don't know what you mean by an auto tuner, but will this suffice? Google is your friend. edit: I see you're looking for something that'll tell you whether you're out of tune, and by how much. I can't help you with that, but it may be worth learning how to tune it yourself. Sorry! [ cycle~ ] (talk), 21:49, 12 December 2008 (UTC)[reply]
Did a google search with the keywords "guitar", "tuning" and "software" a la this. I try not to hassle people too much about not googling for stuff, unless I'm convinced by their experience that they should know better. Sometimes it's difficult to find just the right keywords to use in a search, after all. But kudos for leaving your original comment there instead of removing it completely :). To the original poster of the question: I would strongly suggest that you try not to rely on auto-tuning software. Sometimes struggling to get the strings just the right pitch can help improve your ability to distinguish between slight pitch differences. Also, remember that tuning a guitar is not just about twisting the keys on the headstock. Especially when installing new strings, you should check your guitar's intonation. I only mention it because I got hung up with this when I first started learning guitar. --Silvaran (talk) 23:14, 12 December 2008 (UTC)[reply]
There is, of course, this alternative! [ cycle~ ] (talk), 11:35, 13 December 2008 (UTC)[reply]

OS X language oops

edit

I used the program 'Monolingual' (search for it on the Google) to remove some languages I didn't need from my hard drive. By accident, I deleted a language I needed (japanese) and now i cant get it back. I don't wanna have to reinstall OS X just to get 1 language back, what do I do? --67.81.115.70 (talk) 21:04, 12 December 2008 (UTC)[reply]

Just a guess, check the Startup Disk to see if it has any single install for a language. I haven't ever experienced this problem myself, and in trying to remember my past experience with the startup disk, I can't think if it has something of that sort. Hope I could help, Mastrchf (t/c) 15:05, 19 December 2008 (UTC)[reply]

Debian package manager: Manually installed packages

edit

How do I list the packages that were marked as manually installed? Can I remove this "manually installed" status from the package, so it appears as no longer needed when I remove dependent packages? --Silvaran (talk) 22:51, 12 December 2008 (UTC)[reply]