Wikipedia:Reference desk/Archives/Computing/2007 June 6

Computing desk
< June 5 << May | June | Jul >> June 7 >
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.


June 6 edit

Midtown Madness-Type Games edit

My brother is very fond of realistic car simulation games, in which the user is allowed to drive freely in a large city, such as Midtown Madness and Midtown Madness 2. These games, however, are quite old, and he would really love a more recent game of this genre. The desired platform is Microsoft Windows (Vista). Could anyone please recommend me a suitable software for my brother? --81.231.187.228 11:26, 6 June 2007 (UTC)[reply]

Midnight Club II is a game by the same company that is a slightly more recent (2003). He might also be interested in the Grand Theft Auto series which are probably the best of the free-roam type games. There is some driving in it, but it is more focused on shooting people. The cities are huge though and you can do pretty much whatever you want in them. See also Sandbox (video games). Recury 14:10, 6 June 2007 (UTC)[reply]
Need for Speed: Most Wanted and Need for Speed: Carbon - both involve very large cities and lots of racing around them (circuit tracks, sprints, drags, drifts in the latter, etc.). x42bn6 Talk Mess 14:12, 6 June 2007 (UTC)[reply]
For mindless driving, I like Carmageddon and Carmageddon II. You don't always have to worry about some mission. You can just aimlessy race around and run over people. --Kainaw (talk) 17:37, 6 June 2007 (UTC)[reply]

Rounding error with doubles edit

I have rounding errors with the C# doubles that I'm subtracting, because the two numbers are only slightly different and really long and so their difference just gets cut off, and, while I know this will make my answer slightly incorrect, it's better than dividing by zero, so what I figured out is that I just have to multiply one by a number, e.g. 99% (the exact number is my question), to change it a little then subtract. So my question is: what is the smallest number I can make the number that I multiply by without the computer rounding it back to the original? The reason I want to know this is I don't need a perfect number but it shouldn't be too far off from the original, thanks for the help, Jeffrey.Kleykamp 17:23, 6 June 2007 (UTC)[reply]

Not knowing much about C#, might a simpler solution be declaring your variable as long double; assuming this is allowed and works the way it does in C, this should give you about 18 more decimal digits of precision: http://babbage.cs.qc.edu/courses/cs341/IEEE-754references.html

Dlong 17:47, 6 June 2007 (UTC)[reply]

C#, unfortunately, doesn't have long double, however, that link might help, I need to study it first before I can say if it does. Jeffrey.Kleykamp 17:59, 6 June 2007 (UTC)[reply]
I take it that what you want is the greatest double  , where the circle-times represents floating-point multiplication of doubles. This x is simply the greatest double less than 1, which is  . (I did numerical testing of this; in some 50 million tests I seemed to find one counterexample, but I don't know what multiplicand it was.) There's no way that you're going to improve the quality of your final answer with this trick, though. You're evaluating   as  , and your original error will just be regenerated by the catastrophic cancellation of f and 1. --Tardis 19:38, 6 June 2007 (UTC)[reply]
Don't you mean  , i.e. the maximum x so that x float-multiplied by any y is less than that y? That's the way I learned mathematical notation. JIP | Talk 19:53, 6 June 2007 (UTC)[reply]
I think that's equivalent; I was just writing "the greatest double-value x such that, for all y, x float-times y is less than y". I'll admit the switch out of English was somewhat weird; I don't know (or don't remember, one) a better way of referring to the greatest object with a property without constructing the set of all objects with that property. --Tardis 23:20, 6 June 2007 (UTC)[reply]
Would it be possible for you to code your own long double from a fixed-length string representation? all you would need is some simple math functions, which you can write, (im no C# expert, but can you overload operators and do something at least like an enum?) then use some type conversion afterwards to go back to a double if you need. I remember having to do something similar to this in some CS courses. -wizzard2k (CTD) 22:33, 6 June 2007 (UTC)[reply]
Why not use the decimal type? Splintercellguy 22:56, 6 June 2007 (UTC)[reply]
Good call. That appears to be the equivalent of a long double (16 bytes) in C#. [1] -wizzard2k (CTD) 23:09, 6 June 2007 (UTC)[reply]

You may have already considered this and found it infeasible, but if at all possible, I'd suggest changing your algorithm so that you're not doing what you describe above. Subtracting two nearly identical floating point numbers is one of the best ways of getting rounding errors, no matter how you do it. (Another one is adding very small floating point numbers to very large ones.) —Ilmari Karonen (talk) 11:53, 7 June 2007 (UTC)[reply]

Unfortunately it's math that was made by someone else and there is no other way, and I tried to make my own code for numbers but it's too complicated and I'm not motivated enough, the Decimal type, however, says the largest number is 79228162514264337593543950335m, it seems smaller than the double because the highest double is 1.79769e+308, and does Decimal have decimal spaces? Jeffrey.Kleykamp 13:30, 7 June 2007 (UTC)[reply]
What is the mathematics involved? The mathematics desk may be a better place for the question. BTW the Decimal type is for exact decimal representation with decimal point IIRC, not the powers of 2 representation you get with floating point. It would seem this is not the route you want. Floating point values are precise in binary notation. Values of the Decimal type are precise, in, well, decimal notation. Root4(one) 21:12, 7 June 2007 (UTC)[reply]
If you are concerned about dividing by zero, how about just assigning System.Double.PositiveInfinity, System.Double.NaN, or System.Double.NegativeInfinity to the result and/or test for one of those conditions in later processing? Root4(one) 21:18, 7 June 2007 (UTC)[reply]
I guess I will have to "test for one of those conditions in later processing", I would just like to know: does the Decimal type store numbers like 0.1 or does it round it down to 0? And the math has nothing to do with it, unless someone wanted to go over the work (it's not my work, so I didn't make any errors, and I tested the math and, if I don't get zero at that one spot, it works fine) and reformat it to make sure that I don't get problems but I don't really need that. Jeffrey.Kleykamp 09:00, 8 June 2007 (UTC)[reply]

Gateway GM5048 edit

Hello. I have a Pentium 4 and a Gateway GM5048. To unplug a peripheral using a USB port from my Pentium 4 and plug it into my Gateway (rear), I must rotate the USB cable 180 degrees before plugging it into my Gateway. Why is this so? --Mayfare 17:40, 6 June 2007 (UTC)[reply]

Probably because one computer has the USB port oriented 180 degrees rotated compared to the other. There is no standard which defines the orientation of the USB port, so that happens quite often. The USB port on my old laptop is perpendicular to the ports on my new one. By the way, a Pentium 4 is a CPU, and not a PC manufacturer.

Follow-up question: why are USB A plugs rectangular? Even a slight trapezoidification (a la D-subminiature) would (of course) reduce plugging time by a third... --Tardis 19:51, 6 June 2007 (UTC)[reply]

No idea, but mini-USB are shaped too. Probably a design flaw they didn't think about till stuff started being released, and thus was incorporated into USB type B and mini-USBs. --Wirbelwindヴィルヴェルヴィント (talk) 04:53, 7 June 2007 (UTC)[reply]

Movies on a playstation 2 edit

How come when I put a movie in my playstation 2 , it doesnt always play the movie , but when i put the movie in the computer , it always works? (for example the playstation 2 can play batman begins but it cant play superman but the computer can play both)Wookiemaster 18:41, 6 June 2007 (UTC)[reply]

Drive quality is the first thing I thought of. I tried my brother's Spider-man 2 in my two laptops as well as my desktop, and it didn't work in either. However, it worked in my parent's desktop as well as their DVD player. The disc may be scratched and some drives are just better at dealing with that than others. Dlong 21:25, 6 June 2007 (UTC)[reply]

Which DVD player is the most effective? and how much does it cost? thank u for answering. Wookiemaster 23:41, 6 June 2007 (UTC)[reply]

I have a chinese cheapo "nintaus" dvd player I got for about $80 probably four years ago now and it plays everything I've ever put in it, including divx, wma, photos, videos, audios, vcd, burns, rips, + - RW disks, NTSC and PAL, any zone, the thing is amazing... Vespine 04:50, 7 June 2007 (UTC)[reply]
Ironically the ones made for Chinese market would probably be more able in reading scratched and otherwise "bad" discs as the demand to play pirated stuff, which aren't very well cared for, is quite high. --antilivedT | C | G 08:22, 7 June 2007 (UTC)[reply]
DVD region codes?58.28.151.180 11:19, 7 June 2007 (UTC)[reply]


BEST DVD PLAYER EVER=LG DK142

plays a lot of formats including the following: DVD+/-R/RW and CR/RW that contains audio titles, DivX, MP3, WMA, XVID and/or JPG files. DivX (R) VOB (Video on Demand). VCD 1.1, SVCD, Karaoke CD/DVD

Playable Codec Formats: DivX 3.xx, 4.xx, 5.xx, XVID, MP4/3, 3IVX

Subtitle in format: SubRip(*.srt/*.txt) SAMI(*.sim) SubStation Alpha(*.ssa/*.txt) MicroDVD(*.sub/*.txt) SubViewer 2.0(*.sub/*.txt) TMPlayer(*.txt) DVD Dub System(*.txt) VobSub(*.sub)->Sub/idx, stream based

Sorry it was a long post xD but i would not rant about a product unless it was this good, you can also download firmwares and mod them to make your own background,screen saver, etc and then burn it on a disc and upgrade it on your player. 200.12.231.42 19:05, 7 June 2007 (UTC) Ag for MemTech[reply]

Playstation 2 does not support the current trend of copy protection on DVDs. Therefore, it fails to play many movies. I couldn't even play the Scene It DVD game on my Playstation 2. --Kainaw (talk) 19:12, 7 June 2007 (UTC)[reply]

Automatic resizing of JPG images on Linux edit

I was photographing a body painting event, and the artist later phoned me and asked for thumbnails of every picture I took, so she could display them on her own site. I could make the thumbnails manually with GIMP on my Fedora Core 5 system, but it would be very tedious. Is there a way to automatically resize a number of JPG images to make them a smaller size, which would be the same for all images? JIP | Talk 18:56, 6 June 2007 (UTC)[reply]

You can certainly do it in PHP with GD. If you want me to help you code this (or just do it for you), leave a message on my talk page. JoshHolloway 21:11, 6 June 2007 (UTC)[reply]
ImageMagic! --h2g2bob (talk) 22:26, 6 June 2007 (UTC)[reply]
To get ImageMagick to resize them to a maximum of 640 pixels wide by 480 pixels high while maintaining the correct aspect ratio, do the command below. --TotoBaggins 03:20, 7 June 2007 (UTC)[reply]
for i in *.jpg; do
    convert -resize 640x480 $i thumb-$i
done
You may want to use -thumbnail instead of -resize; the difference is that -thumbnail will also remove any Exif metadata, color profiles and other junk that might otherwise bloat up the resulting files. —Ilmari Karonen (talk) 11:44, 7 June 2007 (UTC)[reply]
Thank you! I used ImageMagick to resize all my pictures to 320*240 (there were 115 of them) and sent them all to the artist. When she has picked her favourites I will send the originals of them to her. JIP | Talk 20:35, 7 June 2007 (UTC)[reply]
You may want to check that a good method is used to resize the images or you may have aliasing issues with the images. Bi-Cubic is an often used filter (I don't now if that is an option or not for this program, I'm just saying that if you are going to resize some images, be prepared to handle the potential problems. Root4(one) 20:52, 7 June 2007 (UTC)[reply]