Wikipedia:Reference desk/Archives/Computing/2007 July 12

=July 12=

.bat file help
i just finished creating a batch file for fun. it is a login screen(you enter a user name and password),and once you logged in you can open cmd and log off from it.

the first time i ran it, it kept popping up on the screen, and on the bottom of the screen (that shows what you have opened) it said the number of them kept on increasing it wouldn't stop, so i had to restart my computer. on the cmd window (where there should be the batch file) it just said the location of where i started my batch file from. after that i tried starting the file 2 more times, with the same results.

note- i saved it as a batch file in notepad. (i saved it as login.bat and changed .txt to all files)

you can view the code here

I would truly appreciate any ideas for fixing this code. Thanks —Preceding unsigned comment added by 71.175.54.183 (talk • contribs)


 * The script, as you wrote it, appears to run cmd over and over and over and over - which will launch command prompt windows until your computer chokes. Now, I could be wrong (since I don't use Windows), but each of your little sections should have an "end" or "break" command to keep it from running the next section.  If you did that, it should fix your problem. -- Kainaw (what?) 02:58, 12 July 2007 (UTC)


 * The Windows Batch "language" does not provide any 'end' or 'break' functionality, unfortunately. But that's really not important, because Batch does not really provide any user input functionality.  The "echo" commands are putting text on the screen, but Jake's program seems to assume that they will pause for user input.  That won't happen.  Also, variables are being set to a specific value and then compared to that value immediately, so the "if" statements are always true -- e.g.

set username=admin if '%username%'=='admin' goto password
 * username is set to 'admin' and then we check to see if username is admin. Which of course it is, so the program takes the good path from "start" to "password" then to "thankyou", then falls through to "thankyou2" then to "logoff" where these two lines -

set yes=y if '%yes%'=='y' goto start
 * always execute, beginning the loop all over again. You can get single-character input from a batch program using the "choice" command, but as I mentioned, Batch is really not meant for any meaningful type of user interaction.  (avoiding the temptation to talk about batch processes on mainframes, etc....)  -- LarryMac  | Talk  13:53, 12 July 2007 (UTC)
 * Oh heck, looks like "choice" went away after Windows ME. Sorry about that..... -- LarryMac  | Talk  14:04, 12 July 2007 (UTC)

alarm clock
Hi all

I'm looking for a program to work as an alarm clock on my computer that will play an mp3 to wake me up. I've downloaded a couple that don't run on vista - does anyone know of a trustworthy program that will work with vista (and windows media player)?

Thanks a lot,

Aaadddaaammm 04:44, 12 July 2007 (UTC)


 * Can't you use the windows task scheduler, which can run winamp for example? Sandman30s 12:48, 12 July 2007 (UTC)


 * Or maybe you could just use Winamp and get an alarm clock plugin? Like this, this, this, this or even . &mdash;  Shinhan  &lt;&thinsp; talk &thinsp;&gt; 12:45, 13 July 2007 (UTC)

Computer mathematics question
I don't know if this belongs here or the mathematics reference desk, but I thought I'd write it here. I got an idea to make a Java framework to accurately model topological mathematics. But I fear this is impossible. I made a Java class that accurately models rationals. But irrationals are a whole different issue. Algebraic irrationals could be modelled with a rational mantissa and a rational exponent, but how would I know (1) whether the result is rational or irrational, (2) whether the result is smaller or greater than another number? Transcendental irrationals are even worse, they would perhaps just have to be stored as magic numbers. Is there any hope, or is modelling irrationals on a computer a lost cause? J I P | Talk 07:17, 12 July 2007 (UTC)


 * I think this belongs to the Maths desk... --antilivedT 08:12, 12 July 2007 (UTC)


 * Perhaps symbolic computation could help? --cesarb 09:44, 12 July 2007 (UTC)


 * You will not be able to completely model all irrationals as some are not computable. For some you could symbolically express them, you can have a formula that calculates each decimal place one position at a time - eg π, or as an equation that the value is a solution of.  You will have to think exactly what kind of properties that you want modeled.  But if a human can model it on a piece of paper, then you should be able to do it in Java (ar any other language). So don't give up yet!


 * To compare numbers to see if they are larger or smaller, generate the decimal expansion one digit at a time and compare. I expect that there are numerical methods to evaluate  algebraic numbers into decimal expansions such as Newton Raphson method.  You do not have to exactly evaluate them, only close enough to see if there is a difference. GB 03:17, 13 July 2007 (UTC)

Thanks for your answers! I am currently implementing arbitrary-degree rational-coefficient polynomials. Next I shall have to implement a method for calculating the value of a polynomial given all the values of the variables. My Polynomial class can handle addition, subtraction, and multiplication of polynomials, but not division. Polynomial division is way hairier than constant division so I am not sure I know how to implement it. I am thinking of adding a PolynomialExpression interface that can hold addition, subtraction, and multiplication expressions of polynomials, but I am not sure if it's needed, because the calculations could be done directly on the Polynomial objects too. Statements about polynomials pose another question: would there be much point in equality and inequality statements for polynomials in their symbolic form? Because the result would vary according to the values of the variables. For example, x=x² is true when x=0 or x=1, but false otherwise. Should I just have those statements regarding the actual values of the polynomials?

Over at the mathematics desk, I have gotten well over my head about quantifiers ("exists" and "for all"). I do not know at all how to implement them, and by the looks of it, neither does almost anyone else. I have devised a procedure for testing a single existential quantifier for a variable that is only used in the first degree, but the procedure can't handle anything more complicated. So it would be pretty useless, wouldn't it? If we were only dealing with finite sets, this could be handled trivially by brute force tests, but even countably infinite sets make such an approach impossible. I think that part of the problem is that computers can't hold an abstract idea of an arbitrary real number as well as humans can. J I P | Talk 13:45, 13 July 2007 (UTC)

Urgh
I've finally switched to Vista, and now Firefox (and only firefox) seems to have problems interpreting certain keyboard buttons (I can't use quotation marks, pound signs or tildes without typing them in notepad and doing a Ctrl-V, which I think you'll agree is slightly problematic). Anyone have the solution? I did a quick google and found some obscure blogger with the same problem, but that's about it. Thanks, yandman  09:54, 12 July 2007 (UTC)
 * Which FF version? Prior to version 2.0.0.2 had a lot of problems. --soum talk 09:58, 12 July 2007 (UTC)
 * 2.0.0.4. Strange, eh? yandman  13:00, 12 July 2007 (UTC)
 * "finally switched to Vista"? You're saying that like its a good thing. Btw, are you using fresh install of Firefox? If you copied your preferences and cache from old FF install, that might be whats causing the problem... And whats the problem with using quotation marks and other? Are they not displayed, something different is displayed or are you quotation marks recognized as some kind of keyboard shortcut? &mdash; Shinhan  &lt;&thinsp; talk &thinsp;&gt; 12:51, 13 July 2007 (UTC)
 * Sorry, should have been clearer. It was a clean 2.0.0.4 install, and it'd replace symbols with others. I reinstalled the os and it's working fine. Interesting... 07:44, 14 July 2007 (UTC)

Floppy Disks & XP
We have a very old piece of CNC machinery and the only way we can transfer programs to it is via floppy disk. We appear to have encountered a very odd problem. We can take a blank floppy fresh out of the box and copy files to it using DOS and everything works OK and we can use the floppy over and over without a problem, but as soon as we copy a file to that floppy using XP the floppy becomes unreadable by the CNC machine and even reformatting it (in DOS) won't cure the problem and the floppy becomes useless. So my question is... Does anyone know if XP places some sort of marker on a floppy disk in any way? We've tried various formatting programs that claim to totally erase floppies but we've yet to find one that can make a floppy re-usable. Short of getting them magnetically wiped I'm totally stumped as to how we can re-enable them for re-use. Thanks. - X201 10:24, 12 July 2007 (UTC)


 * AFAIK, it doesnt. It uses regular FAT12 file system. Perhaps the floppy drive in the XP machine is faulty, so when you are writing using that its permanently damaging the disc. I personally havent used floppies in XP though. Last time I used them was 8 years back!


 * Btw, your question has made me nostalgic reminiscing the good old days when floppies used to wear out every other day and half the time spent cursing the floppies over lost data!!! --soum talk 11:22, 12 July 2007 (UTC)


 * We eliminated the floppy drive being the cause - unless we have 10 faulty drives. I've just used a strong magnet to wipe one of the faulty floppies. I then formatted it, copied a file to it and the CNC machine read it without a problem. Then copied a file form XP and it stopped working again. A very odd problem indeed. - X201 11:31, 12 July 2007 (UTC)


 * Me thinks it's some bug in XP (I've tried using a floppy with XP once but I didn't work very well and when I build my new pc I couldn't be bothered putting the drive in) and the wiping software is somehow missing it. Strange. Do you have an old 98, try just copying from the floopy to a thumbdirve (Note: You will have to install the thumbdrive's drives) -- C h r i s   g 11:56, 12 July 2007 (UTC)


 * Maybe the CNC machine can only read the very-original DOS format (with directories that contain nothing but "8.3" filenames)? Any recent Windows system maintains at least some additional information on the floppy in support of the richer filenames now supported. We've seen similar (but non-fatal) problems using older Tektronix oscilloscopes with floppy drives.


 * Atlant 12:45, 12 July 2007 (UTC)


 * A standard FAT12 floppy has one special file, marked as a "volume file", that's used to store the disk name. A FAT12 floppy with long filenames has many files marked as volume files used to store the long filenames, and one to store the disk name.  These extra volume files are ignored by most programs (including disk erasers), but some programs get confused by the extras.  If this is the problem, then a full format should fix it, as should re-formatting to a different filesystem, then formatting back to FAT12. --Carnildo 20:21, 12 July 2007 (UTC)

Have you tried using a Linux LiveCD, such as Knoppix? You could at least prove without a doubt this way that it's nothing related to hardware, bad cables, etc. -- L augh! 12:47, 12 July 2007 (UTC)


 * One possible explanation is or some other change Windows is making to the boot sector. The boot sector might not be rewritten when you reformat the disk. -- BenRG 13:01, 13 July 2007 (UTC)

Looking for a program or something
I need to compare two lists of addresses, and compare driving distances between them. Is there a program that will let me do that or do i need to do each by hand?

Thank you

74.37.228.44 12:51, 12 July 2007 (UTC)


 * Question: You say "two lists". Do you mean "two addresses" or "two lists of addresses"? Rfwoolf 13:00, 12 July 2007 (UTC)


 * He/she probably means two lists, like they said. If it were just two addresses they could easily just pop them into Google Maps, I imagine. --24.147.86.187 13:09, 12 July 2007 (UTC)

Exactly as i said, two lists of addresses. I am looking to find which ones on list 1 are closer to which ones on list 2 74.37.228.44 13:17, 12 July 2007 (UTC)


 * I can't see why any publicly available existing program would do this. They only do two addresses (not lists).  However, it would be rather trivial to write a screen scraper that sends two addresses to whatever your favorite mapping site is and parses out the total drive time.  This seems to be what you want.  Any GPS-based program would give a direct distance, not a drive time. -- Kainaw (what?) 13:57, 12 July 2007 (UTC)

If you're on OS X or Linux or similar, and you have a file "from.txt" like this: 100 Main St, Raleigh, NC 100 Main St, Brooklyn, NY and a file "to.txt" like this: 100 Main St, Seattle, WA 100 Main St, Phoenix, AZ 100 Main St, Charlotte, NC then you can get output like this: 100 Main St, Raleigh, NC => 100 Main St, Seattle, WA   is 2905.3 miles 100 Main St, Raleigh, NC => 100 Main St, Phoenix, AZ   is 2884.3 miles 100 Main St, Raleigh, NC => 100 Main St, Charlotte, NC is 168.7  miles 100 Main St, Brooklyn, NY => 100 Main St, Seattle, WA  is 2813.3 miles 100 Main St, Brooklyn, NY => 100 Main St, Phoenix, AZ  is 2909.8 miles 100 Main St, Brooklyn, NY => 100 Main St, Charlotte, NC is 648.5 miles by running this program: use URI::Escape; use LWP::Simple; use strict; open FROMS, "from.txt" or die $!; open TOS,  "to.txt"   or die $!; my @froms = map { chomp; $_ } ; my @tos  = map { chomp; $_ } ; foreach my $from (@froms) {    foreach my $to (@tos) {        my $from_url = uri_escape($from); my $to_url  = uri_escape($to); my $url = "http://maps.yahoo.com/dd_result.php?q1=$from_url&q2=$to_url"; my $page = get($url) or die $url; my ($miles) = $page =~ /Distance: (\S+) miles?/ or die "Bad addresses: $from => $to\n"; print "$from => $to is $miles miles\n"; } } --TotoBaggins 14:14, 12 July 2007 (UTC)
 * 1) !/usr/bin/perl -w

I'm on XP, how would that work then? 74.37.228.44 14:17, 12 July 2007 (UTC)
 * Search out and install a Perl interpreter for XP. (You can tell that's what TotoBaggins used from the first line in the program.) -- LarryMac  | Talk  14:56, 12 July 2007 (UTC)


 * ... Wow... Kudos to you on this one. As a software developer I would have thought this would have been much more of a mission than that. Rfwoolf 14:20, 12 July 2007 (UTC)


 * the gods hacked the universe together with perl! -- L augh! 15:53, 12 July 2007 (UTC)


 * This place is starting to look more and more like perlmonks . I wonder when people can start voting on answers. dr.ef.tymac 16:23, 12 July 2007 (UTC)

The program seems to run only a set number of times, sometimes working through the first from address, but never continuing past. What is going on? 74.37.228.44 01:59, 13 July 2007 (UTC)


 * Too big "from" and "to" lists? Google maps doesnt like it when somebody requests 1000 pages in a couple of minutes without the API key? Some other memory or network limit? &mdash; Shinhan  &lt;&thinsp; talk &thinsp;&gt; 12:58, 13 July 2007 (UTC)

i feel i am decieved while i purchased Licensed Norton Antivirus
i purchased Norton Antivirus Software (Licensed), i am delivered a CD in paper envelope labelled as ' Intel Desktop Boards' which included Norton Antivirus 2006 as well (containing other softwarte as kingsoft, desktop utilities, kaspersky antivrus etc.) i want to know 'Is this the genuine product Norton Antivirus or not? nothing else just one CD. can i know what comes when this product is purchased? it cost US 40 $. what is standard packing and what about license certificate, thanks. Raja Mazhar ([email removed to prevent spam])
 * Where did you purchase the software from?--GTPoompt (talk) 15:39, 12 July 2007 (UTC)


 * Most likely, it's cracked, which means not only is it illegal, but you wasted your money when you could've got it free. If it isn't in the box, it's almost certainly illegal. Alternatively, what it says on the envelope might indicate it's an OEM install disk, but I doubt that somewhat. -- L augh! 15:52, 12 July 2007 (UTC)


 * It sounds like the disk that comes with a motherboard; if that's true then it's just a worthless trialware version. -- Finlay McWalter | Talk 16:27, 12 July 2007 (UTC)


 * I would recommend purchasing such software direct from the manufacturer ( for example). Nimur 17:06, 12 July 2007 (UTC)


 * Isn't it free? You pay for the subscription, not the program.  Or, has all that changed recently? -- Kainaw (what?) 18:18, 12 July 2007 (UTC)


 * Ha. Symantec will charge for anything they can possibly think of.  There are, however, several well-respected Windows anti-virus programs that are completely free -- Avast and Grisoft off the top of my head.  -- LarryMac  | Talk  18:47, 12 July 2007 (UTC)


 * I wouldn't recommend Norton in the first place, anyway; it's bloated and horribly slow. Just get a free antivirus like AVG or Avast! like LarryMac recommended. bCube (talk &middot; contribs) 22:15, 13 July 2007 (UTC)

Question about Java generics
I am having trouble understanding Java generics. For the mathematics experiment I wrote about above, I created the following interfaces (simplified):

public interface Real extends Expression, Comparable { public T add(T other); }

public interface Expression { public T evaluate; }

public class AdditionExpression implements Expression { private Expression addend1; private Expression addend2; public AdditionExpression(Expression addend1, Expression addend2) { this.addend1=addend1; this.addend2=addend2; }  public T evaluate { return addend1.evaluate.add(addend2.evaluate); } }

The compiler cannot compile the class AdditionExpression, saying that the method call to add(T) is really an unchecked call to add(Real), and halts at a type mismatch error because the method add wants a T, but the compiler is giving it a Real. Why is it doing so? Do I have to abandon generics and go back to plain old type checking and casting? J I P | Talk 17:15, 12 July 2007 (UTC)


 * May I suggest that you go through this tutorial and get a solid handle on Java generics before starting on your project using them? --TotoBaggins 19:49, 12 July 2007 (UTC)

Perl Programming
I would like to get the results of a .pl to either remain on the screen long enough for me to copy down, or, even better, export to a .txt file.

thank you 74.37.228.44 18:07, 12 July 2007 (UTC)
 * Simply redirect the output to a text file. You don't say what your operating system is, but at least in Windows and Linux this can be done with . Note that this only redirects system standard output. Anything interfacing directly with the console will still appear on the console.  J I P  | Talk 18:11, 12 July 2007 (UTC)


 * (ec) You beat me to it! --soum talk 18:14, 12 July 2007 (UTC)


 * I assume the questioner is double-clicking a pl icon in Windows, which causes the command prompt to appear, show output, and quickly close again. So, the issue is simply typing at the command prompt.  Go to Start&larr;Run and type "cmd".  From there,   to the directory with the pl script and run  . -- Kainaw (what?) 18:17, 12 July 2007 (UTC)


 * Or, create a batch file, "perl.bat" which has the contents:
 * @echo off
 * perl file.pl
 * pause
 * Josh Holloway  19:12, 12 July 2007 (UTC)


 * You could also modify the original program (as mentioned in an earlier question) to have the output write to a file. For example, create an output file at the top where you open the other files:

open OUTPUT, ">", "output.txt"   or die $!; Then, when you're printing out the results, change the print statement to: print OUTPUT "$from => $to is $miles miles\n"; This will write all the output to the file output.txt instead of the command shell. -- JSBillings  22:04, 12 July 2007 (UTC)

Ipod Nano Shutting Off
I need some help with my Ipod. When I am in my car listening to music on my Ipod, I have a tendency to search thru songs rapidly especially if I don't feel like listening to a particular song at that moment. When I do this about thru 20 songs, the Ipod shuts off. The only way I could prevent this from shutting off is to search through the songs s-l-o-w-l-y. Does anyone know why this happens?


 * I don't know if this applies to the Nanos, but on the old school iPods, whenever you select a song, it would read that song and a few songs following it, before placing them in the RAM, or cache or something. This would use a lot of battery power and so if you keep changing your mind about the music you want to listen to rapidly then it would just drain the battery.  However the Nano has flash memory instead of a hard drive so I don't know if it would have the same affect.  Have you tried it with a car charger?  Mix Lord 00:46, 13 July 2007 (UTC)


 * iPod firmware has been known to have a bug or two in it and you might be experiencing one (I have no data on whether your complaint is a known bug or not). Forcing a reboot of the iPod may help (and I'll bet our iPod article describes how to do this or links to a description). Checking for the newest firmware update may also help.


 * Atlant 12:55, 13 July 2007 (UTC)

Quicktime issues
All web sites that have Quicktime display a broken quick time image. Youtube, jkr.com & many, many others display this message. How can I restore Firefox to play these again? PS: these two sites worked before, I just don't know what I did to Quicktime. Movies directly accessed from Quicktime work fine. Thanks AL 18:53, 12 July 2007 (UTC)
 * I'm not sure what's going wrong, but both those sites use Adobe Flash, not Quicktime. -- JSBillings  19:25, 12 July 2007 (UTC)


 * Check the archives. I seem to remember somebody having problems with Youtube and the problem was about flash/quicktime. &mdash; Shinhan  &lt;&thinsp; talk &thinsp;&gt; 13:31, 13 July 2007 (UTC)

I think i once had the same problem as you did, i told ffx to handle flash files with qt cos qt said it could do so. only to find out qt was more mouth than trousers and failed rather miserably to play any flash content. the solution came from mozilla's help page and requires the deletion of a couple files and then it will all work again. the only problem is i forgot which files =]

Vectorizing
Does anyone know how to vectorize a raster image using photoshop?Elatanatari 19:58, 12 July 2007 (UTC)
 * None that I know of. But, you could consider using Inkscape, a free vector drawing package that allows you to trace bitmaps. See the Inkscape bitmap tracing tutorial for more information. (Donovan|Geocachernemesis|Interact) 22:37, 12 July 2007 (UTC)


 * Photoshop is not good at vectors (though it has some mild support of them). It primarily deals with bitmapped (raster) images. You will need to use a vector editing program — Inkscape is a good one (and free!), Adobe Illustrator is another (with good Photoshop support). Depending on the image, it is usually easier and better looking to just trace over it by hand in a vector program. Auto-vectorizers usually end up with very clunky and ugly results unless the image is already basically line-art to begin with (and even then, if it has thin lines they usually screw them up, in my experience). --24.147.86.187 22:57, 12 July 2007 (UTC)


 * Thanks, Inkscape worked perfectly.68.42.172.103 02:37, 13 July 2007 (UTC)

You have new messages
I was wondering if it is possible to change the "You have new messages" bar that displays at the top of the page. For instance how could I change the color of the bar? -- Tλε Rαnδom Eδιτor  ( ταlκ )  23:38, 12 July 2007 (UTC)
 * The default code in your /monobook.css (append that to your userpage) for the message bar is:

/* user notification thing */ .usermessage { background-color: #ffce7b; border: 1px solid #ffa500; color: black; font-weight: bold; margin: 2em 0 1em; padding: .5em 1em; vertical-align: middle; }
 * Just change it to whatever you want.  -wizzard2k  ( C - T - D ) 00:10, 13 July 2007 (UTC)


 * Thank you. -- Tλε Rαnδom Eδιτor  ( ταlκ )  18:34, 13 July 2007 (UTC)