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

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

Vista sidebar and a blue tint

edit

I use Windows Vista. The Windows Sidebar on my system runs 4 gadgets, all from Microsoft: Clock, CPU Meter, Slide Show, and Weather. A few days ago, everything in the sidebar acquired a blue tint. The CPU Meter gauges go from white to light blue to deep blue, rather than going to red; my photos in "Slide Show" have people with blue faces in them. Right-clicking in the Sidebar area and choosing "Properties" doesn't display anything valuable. The rest of my monitor is unaffected; only the Sidebar has become tinted. How do I chase away this odd coloring? Tempshill (talk) 04:23, 21 September 2009 (UTC)[reply]

Unfortunately because i'm on my school computer i can't go to many message boards. I did find this though. I hope this helps. Also could you provide information about your video driver, video card, and whether the OS is 64-bit or 32-bit? Thanks!
--JD's Web Service 13:42, 21 September 2009 (UTC)
The problem seems to have fixed itself, possibly via a reboot. I doubt that the video card data would help diagnose the problem unless I had been complaining about a full-screen tint change, yes? Tempshill (talk) 05:45, 25 September 2009 (UTC)[reply]

Trouble with Java

edit

I bought a book to teach myself Java and have this weird error that doesn't seem should be. The code goes like this:

System.out.print("Enter the assessed value of the property: ");
property = keyboard.nextDouble();
System.out.print("Enter the property owner's name: ");
holder = keyboard.nextLine();

Basically it is a simple tax program to see if I could do it. The print lines asks for input and the other lines place them into variables. This works fine for the variable property, but as soon as I hit ENTER to submit the number it skips the line where Im supposed to enter the name and goes right down to the output of the tax, correctly. It prints the line to ask for input but doesn't stop there.

The output comes out like this:

Enter the assessed value of the property: 150000
Enter the property owner's name:   (It should stop here but doesn't)
Taxes on $150,000.00 are $885.00.

All the variables are initialized, but I can't see the problem. Any help? 134.126.192.188 (talk) 13:44, 21 September 2009 (UTC)[reply]

I'd guess that keyboard object is a java.util.Scanner, which you've got reading from System.in? If so, you can hack it by putting keyboard.nextLine(); after the property = keyboard.nextDouble(); line (to eat the linefeed that's causing you problems). There's probably a paradigmatically sanitary way of doing this. however. -- Finlay McWalterTalk 15:36, 21 September 2009 (UTC)[reply]
Try this to understand the behaviour:
        String surname;
        String holder;
        double property;

        System.out.print("Enter the assessed value of the property followed by the property owner's name,");
        Sytem.out.print(" followed by newline: ");

        Scanner keyboard = new Scanner(System.in);
        property = keyboard.nextDouble();
        holder = keyboard.nextLine();
    
        System.out.print("Enter fred's surname ");
        
        keyboard = new Scanner(System.in);
        surname = keyboard.nextLine();

        System.out.println(property);
        System.out.println(holder);
        System.out.println(surname);
Note that - for your example you need to enter "1000 Brown" not "1000" //newline// then "Brown" ie the scanner class is a file input type of thing - so it stops after a newline (thinks it's finished - meaning in your example the name is null..)
You could start a new Scanner to get past any newlines -Also try printing out holder string in your example to see what has happened.
Experiment and you should get what is going on.. Hopefully. (are you familiar with file reading commands ala C or Pascal?).Sorry if that explanation was a mess -83.100.251.196 (talk) 15:59, 21 September 2009 (UTC)[reply]
Also scanner.hasnextline might be a good idea here as part of a program http://java.sun.com/j2se/1.5.0/docs/api/java/util/Scanner.html#hasNextLine() there are so many ways to do it it's difficult to give a definative answer.83.100.251.196 (talk) 16:40, 21 September 2009 (UTC)[reply]

Anyway, it gets fiddly anyway - if you accidentally don't enter a number for the float problems arise, (unless you catch errors) for this reason many will resort to reading input character by character. Luckily David Eck has created a javaIO class that behaves better - as part of his java tutorial (which has been recommended by others before) - http://math.hws.edu/javanotes/ his input stuff is here http://math.hws.edu/javanotes/c2/s4.html it might be just what you want, unfortunately it's not a lesson in using the scanner class which should be found at sun.83.100.251.196 (talk) 17:59, 21 September 2009 (UTC) And don't forget to close the scanner object.[reply]

The OP might be interested in an EasyReader class. I used it back when I was learning Java and didn't yet understand I/O and how to get user input from the command line. Read the annotations for one of the .java files from that search and find one you like. Usually it's just as easy as instantiating the class and calling its methods for user input. Really streamlines the process for you.--el Aprel (facta-facienda) 22:12, 21 September 2009 (UTC)[reply]

Many windows opening very fast, screen flickering very fast

edit

Earlier today I started my desktop tower computer as normal, running XP SP3. But when I clicked on a folder icon on my desktop, the computer went nuts. It seemed to be opening many windows very rapidly. The screen was also flickering very fast. The one window I noticed seemed to be the window for the desktop. I did a forced shut-down by pressing and holding the power button. It re-started normally. I ran an Avast! anti-virus boot-time scan - nothing found. Did another anti-virus scan - nothing found. I have clicked on the same folder icon again and it behaves normall. What could have been the problem please? All Microsoft security patches are up to date. 78.144.198.168 (talk) 13:49, 21 September 2009 (UTC)[reply]

I don't have an answer as to why this bizarre behavior took place, but I do have a couple of tips for what to do if it occurs again. It is always best to do a "Shut Down" or "Restart" operation rather than turning off your computer with the Power button. The latter may damage your files, especially if the computer happens to be writing to a file right when the power goes off. In a chaotic situation like the one you describe, I would possibly first try to sleep or hibernate the computer by pressing the Sleep button on your keyboard, if there's one there. (The hope is that whatever crazy stuff is occurring will magically stop when you wake up the computer.) If not, try pressing Control-Alt-Delete, which should display the Windows Task Manager. In Windows XP, the Task Manager has a "Shut Down" menu. The Task Manager is displayed on top of all other windows, so you may be able to (carefully) navigate the Task Manager's menus normally, even though all that crazy activity is occurring in the background. Click the "Shut Down" menu, then click "Restart" to restart the computer safely. Of course, this will get old if you have to restart your computer every hour or whatever; hopefully it doesn't occur again. Comet Tuttle (talk) 17:31, 21 September 2009 (UTC)[reply]
It was impossible to do the above due to the computer being busy with the flickering screen etc - I did try. Its like criticising someone who's just survived a motorway/freeway crash and telling them that they should have parked the car and left it in neutral rather than coming to a sudden stop. 78.147.85.67 (talk) 18:55, 21 September 2009 (UTC)[reply]
No, it's more like telling an anonymous person on the Internet, about whom no information is known, and who has provided insufficient context for a perfect answer, about shutting down their computer properly. Comet Tuttle (talk) 19:07, 21 September 2009 (UTC)[reply]
You might have had a stuck Enter key, or something sitting on it. Other than that, I would run a Spyware scan, as that could have been an Ad-Bot trying to fire off popup ads. If you have a popup blocker enabled, that would explain the flickering as your blocker fought with the bot... ArakunemTalk 17:50, 21 September 2009 (UTC)[reply]
Yes, it could be a stuck key on the keyboard or maybe one on the mouse. Inspect both devices and make sure the keys and buttons all move freely. StuRat (talk) 22:11, 22 September 2009 (UTC)[reply]

Perhaps you managed to select every file in the folder and executed/opened it, eg "select-all" or control-A this causes computers to go crazy! why is there no article on control-A? Graeme Bartlett (talk) 11:22, 22 September 2009 (UTC)[reply]

Here Control key does CTRL-C really need an article83.100.251.196 (talk) 12:25, 22 September 2009 (UTC)[reply]

Change the page title in firefox, with greasemonkey

edit

Would it be possible with a greasemonkey script to change the Page Title to something custom based on the url? For example, a web page at "http://example.com/pages/123456.html" has the page title of "example.com" only. I would like it to display "example.com Page 123456" instead. Would this be possible? I would be a great benefit as it would mean saving pages would be much easier than having to copy and paste into the save box. Thanks!

Sure. The following will do just that:
if (location.href.match(/([^/]+)\.html$/))
    document.title = location.hostname + ' Page ' + RegExp.lastParen;
--Sean 17:14, 21 September 2009 (UTC)[reply]
YES! This is perfect, It's Sean to the rescue yet again, you're awesome you are so awesome THANK YOU!
But that seems to have a dependency on the URL ending in .HTML, no? Not sure if that's a problem, but. --Tagishsimon (talk) 18:00, 21 September 2009 (UTC)[reply]
Sure, of course, but that's what was given in the example, and I didn't want to cloud the solution by handling guesses at other requirements. --Sean 18:48, 21 September 2009 (UTC)[reply]

Extract WAV sound from AVI video

edit

Hullo clever people! I've been trying to put together a bunch of scripts to rotate a video from a digital camera. It works great, using mainly very specific MJPEG and JPEG utilities, but there's one problem: the yuv2wav command from the MJPEG tools can't see the sound in my videos, and the only thing I've found that can is ffmpeg - which is ten times as big as the rest of the scripts put together!

So, is there a small Windows command-line utility out there that can extract the sound from an AVI file? The only ones I found were pretty ancient; in fact the only one I could actually download and run was AVI2WAV 3.5, which didn't work on my files. There's also the weird avi2wav-mpg, which unzips to a file called avi2wav-mpg.mbd, which I have no idea what to do with! - IMSoP (talk) 18:36, 21 September 2009 (UTC)[reply]

Are you sure your camera encodes the audio in the AVI as WAV format? Does it use some kind of non-standard encoding? You can use ffmpeg to identify the type of audio encoding it's using, by just doing "ffmpeg -i filename". Indeterminate (talk) 02:11, 22 September 2009 (UTC)[reply]
Hmm, good question... ffmpeg says it's "adpcm_ima_wav", which doesn't mean a lot to me beyond having PCM and WAV in the name; does it to anyone else?
Full ffmpeg output
Y:\Projects\VidRotate\trunk\bin>ffmpeg -i "c:\Temp\V\CIMG1637.AVI"
FFmpeg version SVN-r19926, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --enable-memalign-hack --prefix=/mingw --cross-prefix=i686-ming
w32- --cc=ccache-i686-mingw32-gcc --target-os=mingw32 --arch=i686 --cpu=i686 --e
nable-avisynth --enable-gpl --enable-zlib --enable-bzlib --enable-libgsm --enabl
e-libfaad --enable-pthreads --enable-libvorbis --enable-libtheora --enable-libsp
eex --enable-libmp3lame --enable-libopenjpeg --enable-libxvid --enable-libschroe
dinger --enable-libx264
  libavutil     50. 3. 0 / 50. 3. 0
  libavcodec    52.35. 0 / 52.35. 0
  libavformat   52.38. 0 / 52.38. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libswscale     0. 7. 1 /  0. 7. 1
  built on Sep 20 2009 04:03:00, gcc: 4.2.4
[avi @ 0x3ecdb0]non-interleaved AVI
Input #0, avi, from 'c:\Temp\V\CIMG1637.AVI':
  Duration: 00:00:01.29, start: 0.000000, bitrate: 9917 kb/s
    Stream #0.0: Video: mjpeg, yuvj422p, 640x480, 25 tbr, 25 tbn, 25 tbc
    Stream #0.1: Audio: adpcm_ima_wav, 44100 Hz, 1 channels, s16, 177 kb/s
At least one output file must be specified
Incidentally, does anyone know how to stop ffmpeg outputting its entire version and configuration details every time I run it? - IMSoP (talk) 19:53, 25 September 2009 (UTC)[reply]
You could put it in a .bat file and use the @echo off command ... Nimur (talk) 20:13, 25 September 2009 (UTC)[reply]
Setting "echo off" stops CMD.EXE (or COMMAND.COM, under MS-DOS) "echoing" each line of the batch file before it runs it; it doesn't make any difference to what the commands themselves display. What I need to do is redirect the output of the command, but >NUL didn't seem to work.
To answer my own question, it turns out CMD.EXE does actually use standard streams in the same way a Unix shell would, and the same redirection rules apply, as explained admirably here. So what I need to do is redirect "standard error" using ffmpeg ... 2>NUL, or redirect stderr and stdout using ffmpeg ... >NUL 2>&1.
I still want a smaller program to extract my WAV streams though... ;) - IMSoP (talk) 18:38, 26 September 2009 (UTC)[reply]

Windows Vista hijacks my programs

edit

Hi, I recently started using Vista. I now experience that the system sometimes declares that a program has crashed, and that the program will now be shut down. I can see that this is probably helpful in some situations. However, this mostly happens with programs ported from Linux or older programs, which I support do not tell Vista in the "proper" way that they are just spending some time doing their task (long filesystem operations, Internet searches or downloads), they have not actually crashed. Is there any way to disable this unhelpful "feature" in Vista? I've tried using "compatibility mode" for Windows XP (where I never had this problem). Thanks! Jørgen (talk) 18:48, 21 September 2009 (UTC)[reply]

You might try right-clicking and running the program "as administrator". Indeterminate (talk) 05:28, 22 September 2009 (UTC)[reply]
Thanks, I'll try that when I get home, but the whole point of running as non-administrator is that I do not want my programs to have admin access, plus it will be a bit cumbersome to enter admin password every time I start the program. This "feature" was not there in XP, so I am hoping there is some way to disable it? Jørgen (talk) 06:23, 22 September 2009 (UTC)[reply]
I've never encountered a program being forced to crash in Vista. When I do encounter a program has crashed Windows, I'm usually pretty sure it has crashed. You do however get Vista saying the program is not responding and may have crashed and giving you the option to wait (well this was in XP too but I encounter it more in Vista). If Vista says the program has crashed, are you sure the program hasn't really crashed, e.g. did something invalid? Just because the program worked in XP doesn't mean it will work in Vista. Also with Vista's UAC, you don't have to run with a non admin account to give programs no admin access. They don't have admin access by default. If you are running in an admin account, you need to give permission if a program requests adminstrative access (or you tell Vista to run the program in admin mode). You don't need to enter a password. This behaviour is somewhat changed in Windows 7 so running in a non admin mode may be necessary again Nil Einne (talk) 13:19, 22 September 2009 (UTC)[reply]

File times changes when copying between hard drives

edit

Hi, I've copied a lot of pictures from my external hard drive (SD4000, shows as "USB device", FAT32) to the local hard drive ("SCSI Disk Device", NTFS) using drag-and-drop in Windows Vista. However, I now see that the timestamps are two hours apart on the two drives (which corresponds to the time difference between me and UTC, not sure if that is a coincidence or not). The digital camera that took the pictures was at some points set to a third time zone, so I suspect the time zone on the camera does not matter here. This is annoying as it confuses file synchronization software. My questions are:

  • Why do the timestamps behave this way?
  • Any easy way in Windows Vista to adjust the timestamps in bulk?

Thanks! Jørgen (talk) 18:52, 21 September 2009 (UTC)[reply]

Update: It seems to be a problem specific to Microsoft SyncToy 4.0 - the "dir" command reports similar file times. My question stands, in addition to one more: any suggestions for good synchronization software? (gwsync only crashes, synctoy has this problem). Jørgen (talk) 19:02, 21 September 2009 (UTC)[reply]

I don't know the tool you're using, but I know a lot of *nix OSes use UTC as the system clock and then modify in userspace for display and otherwise, though windows OSes will set the system clock to the local time. This causes file-time issues. I don't know if windows 7 continues this windows practice. Shadowjams (talk) 06:58, 23 September 2009 (UTC)[reply]

S3 as file backup

edit

Hi, I am looking for an easy way to backup my pictures online. I do not want to use image sharing services such as Flickr (I want my files to be mine only, and potentially to be able to save any type of file) and I need more than 5GB (which I think is the current limit for some free services). Paying some dollars a month is not a problem. Would Amazon S3 be a feasible choice for such a thing? Would it be easy for someone who is not a programmer to set up? (I'm decent with computers if I do not have to program anything myself). Any other recommendation for good such services? Ideally, I would like something that does not tie me into a particular piece of software as my experience with proprietary "uploaders" is that they are buggy - and I might want to move from Win32 (which I use now) to Linux one day. Thanks! Jørgen (talk) 18:56, 21 September 2009 (UTC)[reply]

I like dropbox personally (2GB on the free service). It supports Windows, Mac, and Linux, and is $100/year if you want 50GB. I have not spent that much time exploring the other options since earlier this year, so I do not know how it compares to other services currently. Caltsar (talk) 19:46, 21 September 2009 (UTC)[reply]
I just noticed that you don't want proprietary uploaders. Dropbox does have one, and I do not know of any major services that do not as most website based ones are a bit slow to use for large numbers of files, and the sync features of these services tend to rely on the ability to track changes over multiple computers. That said, many of these services offer a free version that you can try to see which has the best software. Caltsar (talk) 19:52, 21 September 2009 (UTC)[reply]
Here is a list of s3 based backup services - http://jeremy.zawodny.com/blog/archives/007641.html (the list is quite old, but a bunch of the programs mentioned are still in development, and people have added info in comments). Personally I wouldn't use an online backup service without client-side encryption (as otherwise you're trusting Amazon or whoever to never goof and allow access to your s3 buckets to someone else). Given the bandwidth limitations (and the charges amazon adds for data transfer), I'd backup genuinely important stuff (documents, local emails, probably photos), but not ripped audio and probably not home videos. It is nice to have an offsite backup solution, as no amount of local redundant storage and thorough backups will survive a serious fire. -- Finlay McWalterTalk 19:54, 21 September 2009 (UTC)[reply]
I use s3sync (a functional copy of rsync for s3). It works well. I have a lot of files stored there and it costs me about $3/month. -- kainaw 21:08, 21 September 2009 (UTC)[reply]
I know you said no photo-sharing websites, but you might consider SmugMug. It's less of a community sharing site than Flickr and more of an archiving site; they explicitly advertise it as a backup service. Galleries can be public or private. The price is a flat $40/year for any number of photos. There are a bunch of third-party batch uploading tools for it. -- BenRG (talk) 00:49, 22 September 2009 (UTC)[reply]
Thanks all, the answer to the question "is S3 as backup feasible" seems to be "yes". I'll look into your suggestions. Jørgen (talk) 06:21, 22 September 2009 (UTC)[reply]

PS2 to USB adapter for keyboard

edit

My old keyboard is not working with a PS2-USB adapter that I got. It is not one of those connector cords, it is just a short adapter plug. When I plug it into the USB port, the lights on the keyboard flash once, and then nothing. My PC never detects the hardware, and the keyboard just doesn't work at all. Where is the problem? Is it the keyboard (it worked last time I plugged it into a PS2 port on my old comp), the adapter, or Vista (I tried it on two vista laptops, same result)? Thanks —Akrabbimtalk 21:04, 21 September 2009 (UTC)[reply]

It's hard to really tell as you'd need to try it with another PS2 keyboard and another USB adapter to narrow down the problem, but from personal experience I know that not all PS2 devices will work via a USB adapter, I don't know whether this is because they're picky about the power requirements or just that there's something missing in the adapter that they need, but I'm thinking this is your problem, but like I mentioned above, you'd really need another keyboard at least to try it with. ZX81 talk 21:36, 21 September 2009 (UTC)[reply]

Direct communication between PCs

edit

Just wondering: is there any way to stream bytes from one personal computer to another over the Internet without some server or middleman in-between? Thank you!--el Aprel (facta-facienda) 22:16, 21 September 2009 (UTC)[reply]

If we discount the plethora of routers & switches that packets of data traverse, then in short, yes. Your client PC or Mac is getting this page full of bytes directly from a wikipedia server, without any middleman activity (bar the aforementioned routers & switches). I suspect you have something more specific in mind - it would help to elaborate your question, perhaps by way of an example of the sort of streaming you have in mind, so that we can provide a slightly better answer. --Tagishsimon (talk) 22:40, 21 September 2009 (UTC)[reply]
Well, specifically I was thinking about running the Java Virtual Machine on two different computers and having them send objects from one JVM to the other in real time without having to sign up for some kind of P2P service or whatever. Is this possible?--el Aprel (facta-facienda) 01:03, 22 September 2009 (UTC)[reply]
Yes, this is the basic idea behind Peer-to-peer networks. At least one of the computers will have to act like a server, so it needs to have a routable ip address (or at least Port forwarding from its home router) so the "client" computer can connect to it. The "server" also needs to have an available open port on its firewall. You can check if your computers are accessible from the internet by searching for an online port scanner and entering the computer's ip address and the port number you want to use. Indeterminate (talk) 01:55, 22 September 2009 (UTC)[reply]
If you own both machines, neither one must be the server (meaning both can be the server - waiting to see if anyone connects). This is not something new. Remote objects have been around in Java for at least 10 years. There are two levels of remote objects. In one level, the object is instantiated on a remote machine and communication with the object goes over the network. The other level uses the class definition on the remote machine to instantiate the object locally. At one time, there was a believe that by now nearly all programming would be done with remote objects. I don't see it happening any time soon. -- kainaw 04:13, 22 September 2009 (UTC)[reply]
El Aprel may simply be seeking the Java Sockets tutorial, from Sun. If both machines have routable IP addresses, this is the simplest way to send bytes from one to the other; although technically it is not a "Stream" - that would be an InputStream attached to a socket object (which is also common). As the above users have hinted, these connections need not be a direct "client-server" design; but in Java, you need one server to host the socket ("listen") while another connects. Nimur (talk) 17:52, 22 September 2009 (UTC)[reply]
  Resolved
Thanks, everybody! All your responses were very helpful.--el Aprel (facta-facienda) 22:06, 22 September 2009 (UTC)[reply]