Jump to content

Wikipedia:Reference desk/Archives/Computing/2007 September 21

From Wikipedia, the free encyclopedia
Computing desk
< September 20 << Aug | September | Oct >> September 22 >
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.


September 21

[edit]

xbox live speed problems

[edit]

I have problems playing xbox live games online because the response is way too slow. Nothing uses the connection while I play and the upload speed is approx 90 - 100 kbps (tested on two different sites). The games I tried are Sonic 2 and Lumines which should be very quick games. What can I do to increase the response time, will a faster upload speed help? Thanks 86.41.159.42 04:01, 21 September 2007 (UTC)[reply]

Online games transmit lots of tiny bits of data, so upload speed really isn't an issue. However it does need a steady uninterrupted flow of data. Perhaps your connection has lots of noise? I would contact your cable or DSL company and complain. Do you get reasonable upload speeds on your computer? Is your 360 connecting to the net wirelessly? --24.249.108.133 18:36, 25 September 2007 (UTC)[reply]

Computer tower

[edit]

Is it normal for a computer desktop tower to start making noise after several months of use. Or could that mean that the computer fan needs cleaning.--logger 04:37, 21 September 2007 (UTC)[reply]

Yes and yes. Or it could be your optical drive if there's a CD spinning. --frotht 04:40, 21 September 2007 (UTC)[reply]
I'd say no, it's not normal, any new sound could be a sign of trouble. The fans or hard drive are the most likely problems, but cleaning isn't very likely to solve it. With any luck, you may just have something loose (like a screw) that's vibrating. StuRat 04:45, 21 September 2007 (UTC)[reply]
Cheap fans get noisy after a bit of use, nothing to worry about... If it's the hard drive you have serious problems but I doubt that's the case. Open it up while it's running (dont leave it open long, it's bad for airflow and cooling) and listen for where it's coming from --frotht 04:52, 21 September 2007 (UTC)[reply]
Actually, I think most computers cool themselves better without the cover, but the noise and ugliness convince most people to put the cover back on. StuRat 05:40, 21 September 2007 (UTC)[reply]
I've done tests on this and my PC runs hotter with the cover off. I have to admit it was a rather small sample size that is most likely fuelled by the fact that my computer is under my desk with little ventilation. With the cover on it was drawing cold air from the front and pushing it out the back hot, whereas with the cover off it was just kind of wallowing in hot air. Capuchin 08:02, 21 September 2007 (UTC)[reply]
Yeah, there's no way to get cool air if it's just heating all the air around it. What could be better for cooling than cool air roaring through the thing and out the back? --frotht 13:47, 21 September 2007 (UTC)[reply]
Radiation will work better with the cover off, as will convection. The fan will also still blow air through the computer with the cover off, probably even better than before, since now the air flow isn't impeded by the case (having to pass through vents). Capuchin's case may be an exception, where removing the cover has little effect either way, because the computer is in an enclosed space either way. Another exception might be if they clamped hot components directly to the case so that heat conducted to the case then radiated out from there. I'm not aware of any computer that uses this strategy, however.
Also, a well designed "wind tunnel" design with one fan blowing in and another fan exactly opposite blowing out, with little blocking the flow of air in between, would work well, but computers I have seen just have one fan blowing out, and maybe another CPU fan blowing nowhere in particular, and many components blocking the air flow. This makes for rather inefficient air flow. StuRat 17:12, 21 September 2007 (UTC)[reply]
How is a little case fan going to pull hot air away from components if the case is open? It'll just pull air from the sides instead of from the components. And any decent case will have a fan in front and back to get that "wind tunnel" design, and most high end cases will have a small side fan to provide additional cool airflow directly onto the GPU & motherboard. --frotht 22:08, 21 September 2007 (UTC)[reply]
I work with computers yet have yet to see a case with a fan in the front. You must work with some high-end equipment. StuRat 03:38, 23 September 2007 (UTC)[reply]
I've got fan mounting space in the front right in front of the hard drives, and my case is some cheapo no-name brand one... --antilivedT | C | G 04:47, 23 September 2007 (UTC)[reply]
"Fan mounting space" presumably means you don't have an actual fan there, though. StuRat 16:45, 23 September 2007 (UTC)[reply]
It didn't come with one but I put one in to cool my hard drives (they are just a few degrees below my CPU even with the fan). --antilivedT | C | G 11:17, 25 September 2007 (UTC)[reply]
I see. This would tend to support my assertion that most computers don't come with a fan in front. I hope you have one fan blowing in and one blowing out. Otherwise, they are working against each other rather than with each other. Also, if the hard drives have those rubber covers, take them off, they tend to hold the heat in. StuRat 14:02, 25 September 2007 (UTC)[reply]

This is a new HP computer i got just yesterday and it is still nice and quiet. It has an AMD CPU with cool and quiet on it.--logger 06:44, 21 September 2007 (UTC)[reply]

By the way, is this a continuous noise, or only when your acessing files etc? Think outside the box 16:20, 21 September 2007 (UTC)[reply]

Learning C++

[edit]

What would be a good text to read to learn the basics of C++ if I already know C? I'd prefer if it was available online. Thanks. —Bromskloss 10:11, 21 September 2007 (UTC)[reply]

I highly recommend TC++PL; it's not just a good book about C++ but a good book about programming in general. Any tutorial you find online will (probably) be vastly inferior to this book. The free online C++ FAQ Lite is pretty good, but it's not really a tutorial. It has some more book recommendations. -- BenRG 11:14, 21 September 2007 (UTC)[reply]
If by "online" you mean "free", check your local library. C++ is big enough that lots of libraries have a book, and I find it's much easier learning the concepts from a paper copy. --h2g2bob (talk) 11:36, 21 September 2007 (UTC)[reply]
Thinking in C++ by Bruce Eckel is a free online e-book. His stuff seems to come highly recommended, and I found his similar book on Java very good. --Kateshortforbob 23:52, 21 September 2007 (UTC)[reply]

URL Questions

[edit]
Is this a joke? Are you wanting more people to unwittingly follow the link too? You will be better off asking the FBI what they will do, but I suspect nothing at all, since it looks like a prank. I have broken the link to stop others from clicking! Graeme Bartlett 12:22, 21 September 2007 (UTC)[reply]
It looks like just a direct link to a search of fbi.gov for "CHILD UNDERAGE KIDDIE PORN". I doubt anyone will notice unless it starts showing up on a list of frequently-searched terms, in which case they'll probably figure out what's going on --frotht 13:49, 21 September 2007 (UTC)[reply]

In Internet Explorer, it's black, but in Mozilla Firefox, it's purplish pink.

Stop linkifying that URL, someone's going to click it. I almost clicked it. --frotht 15:48, 22 September 2007 (UTC)[reply]

OMG, then the FBI would be watching you TOO! --24.147.86.187 23:27, 22 September 2007 (UTC)[reply]

US consumers contract with broadband companies

[edit]

Is there any limit on the number of PCs that a person can connect to a single broadband connection? For example, If a person has a PC, a iPod touch (which has wifi) and a blackberry which has WiFi, can we connect all three devices to the modem simultaniously? There may not be enough ports available. But thats something technical. On the legal side of it, can we connect any number of devices? If I have a device, say, which can be used to split a modem into three parts, can we use all the devices at the same time? Can I connect two PCs at the same time? —Preceding unsigned comment added by 59.96.28.68 (talk) 11:27, 21 September 2007 (UTC)[reply]

Apart from capacity share getting lower and lower, the limit is likely to be physical ports as you suggest, or the number of IP numbers available from the DHCP server. If you check your IP mask (perhaps with ipconfig) you can figure out how many numbers you can have: 255.255.255.0 can have 254 numbers, 255.255.0.0 can have 65534 numbers, so it can be large. The DHCP range will be smaller than this, but may just be one less. Graeme Bartlett 12:15, 21 September 2007 (UTC)[reply]
That's the whole point of NAT routers. Do you have such a router? The NAT router would appear to be one computer and use one IP no matter how many things are behind it. If you own the router, you can set how many IPs it gives out. Now I guess, depending on the model of the router, there might be a limitation by design as to how many devices it supports on its local network side; but that doesn't prevent you from putting more NAT routers behind it. --Spoon! 12:48, 21 September 2007 (UTC)[reply]
It is not unimaginable that some broadband provider would attempt to put some limit on the number of devices into their contract, and I believe such clauses were found before the NAT router became ubiquitous. However the question can not be addressed from a "US Consumer" point-of-view, as each provider will have its own set of byzantine rules and regulations. --LarryMac | Talk 12:59, 21 September 2007 (UTC)[reply]

regex question

[edit]

I run into this a lot and I've never found the proper way to handle it. I want to find all relative links in HTML. It is a link in the form "a href='somepage.html'" as opposed to "a href='http://wikipedia.com/sompage.html'. What's the regex for saying "not html" as in "/a href='[^html]/"? I know that won't work (it will look for ' followed anything other than h, t, m, or l). I also know [^h] won't work because it will mistake "home.html" for being "http". I know [^h][^t][^m][^l] won't work for the same reason. -- kainaw 18:38, 21 September 2007 (UTC)[reply]

First, you should use an HTML-parsing library if at all possible. It will handle all the corner cases that you are certain to forget or ignore. Second, it's easiest just to do the regex in two steps. Here's an example in Perl:
$string = "<a href='http://wikipedia.com/somepage.html'>";
if ($string =~ /\bhref='([^']+)'/)
{
  $url = $1;
  if ($url =~ /^http:/) {
    print "Url is absolute\n";
  } else {
    print "Url is relative\n";
  }
}
But again, this code misses a *lot* of cases (upper/lower case, URLs with passwords, missing/different quote marks, "href" not in an "A" tag, etc. You should really avoid parsing HTML for anything but a toy project. Also, if you're hellbent on using a single regex, search for "negative lookbehind" here. But don't do that. --Sean 19:14, 21 September 2007 (UTC)[reply]
You can get the literal effect you ask for by looking for ([^h]...|.[^t]..|..[^m].|...[^l]|.{0,3}$), where the last bit (which could also be written .?.?.?$) applies when the line or string or file (depending on how your matcher operates) ends in less than 4 more characters:
<a href='b'>
Hullo!
</a>
It's really annoying that it's hard to implement negative regexps even though we know that the complement of a regular language is regular. Hope that helps. --Tardis 19:50, 21 September 2007 (UTC)[reply]
(?<!html)$ --Spoon! 02:12, 22 September 2007 (UTC)[reply]

What can back up old versions of text files each time they change?

[edit]

What can back up old versions of text files each time they change? Is there any software that can make backups whenever a text file is overwritten like the Rewind software for the Macintosh but for PC? And the wikipedia article rewind (software) is some other software than what I'm talking about. William Ortiz 19:41, 21 September 2007 (UTC)[reply]

How much do you want to spend? There are specialized filesystems that do this (we call it snapback. That might or might not be the proper name). Or, there are myriad versioning systems that you might like. Wikipedia itself manages diffs of text through its MediaWiki software. CVS and Subversion are other options. --Mdwyer 20:15, 21 September 2007 (UTC)[reply]


I recommend using Subversion (or more specifically TortoiseSVN http://tortoisesvn.tigris.org/ from Tigris) Ronnystalker 20:45, 21 September 2007 (UTC)[reply]
It sounds like you're asking for a versioning filesystem. I'm not aware of any current operating system that supports such a feature. --Carnildo 22:51, 21 September 2007 (UTC)[reply]
It's been a standard feature of OpenVMS since it was RSX.
Atlant 13:46, 24 September 2007 (UTC)[reply]
Like I said, current operating system. --Carnildo 22:25, 25 September 2007 (UTC)[reply]
OpenVMS is a current operating system.
Atlant 11:42, 26 September 2007 (UTC)[reply]

MySQL Ordering results that have been Grouped

[edit]

I have stumbled across a problem that appears to have a simple solution but has, so far, taken up 8 hours of my life trying to solve.

The situation:

I am designing an online photo gallery. 
I have a Mysql table that holds a record for each 'media file' in the web application - tbl_media_files.
I have another table that holds a record for each 'media item' in the web application - tbl_media_items.

A media item could be, for example, a picture of a Dog - lets call it 'Dog'. This 'media item' could be associated with 4 images, hence 4 records in the tbl_media_files table;

a tinythumbnail of dog (10 px by 10 px),
a Thumbnail picture of Dog (100px by 100 px),
a Midsize picture of Dog (300px by 300px) and
a large picture of Dog (1200px by 1200px).

Lets say we have another media item called Cat that is only represented by 2 files of different sizes.

a tinythumbnail of cat (12 px by 12 px),
a Thumbnail picture of cat (150px by 200 px),


Lets say we want to look at an overview of a picture gallery that shows pets. I am trying to use Mysql to;

SELECT
the file attributes
(width multiplied by height) as AREA
FROM
my media files table
WHERE
(the files have a width below=150px
AND
the files have a height below=300px
AND
the file is the picture of the Dog
)
OR
(the files have a width below=150px
AND
the files have a height below=300px
AND
the file is the picture of the Cat
)

But, I only want the largest file that represents each media item within this scale criteria . So, in some way:

Grouped by media item
ORDERED BY Area Descending

Then, lets say, i want to show the midsize item on its own. So, in theory, i should run the same query but change the max width and height to bring up the best sized image within the pages size e.g below 800 px width. For the dog, i'll get the mid size image. But becuase the largest picture of cat is 100px by 100 px, we shall have to settle with this one.

The idea is to be able to always select the largest file that represents each media item for a given 'view'. In theory it can then be extended to say, retrieve a thumnail of a video 'media item' for a gallery overview and the actual video file of the video at larger scales.

I thought i could do this query in one go using a Group by media_item_id and Order By image Area Descending. But the ordering does not seem to make any difference - thus causing a tinythumbnail's attributes to be retrieved when i know that i much bigger version of the media item is available.

I've resorted to using procedural code in a loop issueing one query per media item with a limit of 1 ORDERED by area descending. However, it seems such a simple problem that I feel I'm missing an obvious single Mysql select/join that could achieve the desired results in one query.

I look forward to any suggestion or further questions. —Preceding unsigned comment added by Ronnystalker (talkcontribs) 20:39, 21 September 2007 (UTC)[reply]

Thanks for your suggestion. I would appreciate it any one can help me further and indicate how the HAVING could be used, i tried a quick test with the HAVING to see if it pulled up the correct file for each media item, but it only seemed to pull 2 items out of a possible three that i have in my test table:

SELECT
t1.col_width,
t1.col_height,
max(t1.col_width) as mw,
max(t1.col_height) as mh,
(t1.col_width * t1.col_height) ,
t1.*
FROM
tbl_media_files as t1
GROUP BY
t1.col_media_item_id
HAVING
t1.col_width =mw
AND
t1.col_height=mh

Any other ideas? —Preceding unsigned comment added by Ronnystalker (talkcontribs) 22:14, 21 September 2007 (UTC)[reply]

How about using the MAX function to return only the records with the maximum areas which meet the given criteria ? As a shortcut, you could just take the max height or width, since the pic with the max height, max width, and max area will presumably be the same (assuming the pics have the same aspect ratios). StuRat 03:29, 23 September 2007 (UTC)[reply]

Thanks for the suggestion. I think you are right. I think I'll try first selecting the max widths, say, of all the media items I want (that are below the scale criteria) grouped by media item. Then join the results onto the same table selecting the records ON the width column AND media item column. I have not tried it, yet, cos I have circumvented the problem with a less efficient script in order to get on and finish the rest of the gallery a.s.a.p. - i will update this post once i've cracked it. Ronnystalker 03:56, 23 September 2007 (UTC)[reply]

Your welcome. I hope it works out for you. I'll be watching for your follow-up post. StuRat 16:39, 23 September 2007 (UTC)[reply]