Jump to content

Wikipedia:Reference desk/Archives/Computing/2010 May 6

From Wikipedia, the free encyclopedia
Computing desk
< May 5 << Apr | May | Jun >> May 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.


May 6

[edit]

MySQL question

[edit]

Hi, I'm currently using the following query

SELECT * FROM `mytable` 
  WHERE mainproperty=`foo` 
  GROUP BY `mainproperty`, `datetime`, `property` 
  ORDER BY `datetime` DESC, `property` ASC

Which returns something like

id;mainproperty;property;value;datetime           ;
01;         foo;    bar1;    1;2010-05-05 01:14:59;
02;         foo;    bar2;    0;2010-05-05 01:14:59;
03;         foo;    bar1;    1;2010-05-05 01:04:15;
04;         foo;    bar2;    0;2010-05-05 01:04:15;
05;         foo;    bar3;    4;2010-05-05 01:04:15;

What I'd like it to output is:

id;mainproperty;property;value;datetime           ;
01;         foo;    bar1;    1;2010-05-05 01:14:59;
02;         foo;    bar2;    0;2010-05-05 01:14:59;
05;         foo;    bar3;    4;2010-05-05 01:04:15;

==> Always show only the newest entry for each property belonging to mainproperty='foo'. (Since there is no property 'bar3' dated '2010-05-05 01:14:59', the one from '2010-05-05 01:04:15' is shown).

What would the proper query string for that look like? -- 78.43.60.58 (talk) 08:28, 6 May 2010 (UTC)[reply]

What you want is the DISTINCT statement. --Mr.98 (talk) 10:46, 6 May 2010 (UTC)[reply]
I don't think DISTINCT will do it. If you put DISTINCT in his original query string you'll end up with exactly the same as his first example output. I think he needs something like:
SELECT * FROM `mytable` A 
  WHERE A.mainproperty=`foo`
  AND   A.datetime = (SELECT MAX(B.datetime) FROM `mytable` B
                      WHERE B.mainproperty=`foo`
                      AND   A.property = B.property)
  GROUP BY A.`mainproperty`, A.`datetime`, A.`property` 
  ORDER BY A.`datetime` DESC, A.`property` ASC

--Rixxin (talk) 13:52, 6 May 2010 (UTC)[reply]

It isn't necessary to add "AND A.property = B.property" in the subquery. It will return the max datetime and will ignore any record where A.datetime is not equal to the max datetime. -- kainaw 14:02, 6 May 2010 (UTC)[reply]
It seems Rixxin was right, as removing the part kainaw suggested returns only a single line, whereas Rixxins solution does what I want (or at least it seems to do so in the tests I just ran ;-)). Thanks! -- 78.43.60.58 (talk) 16:10, 6 May 2010 (UTC)[reply]
I wanted to see if it was possible to avoid having to mention "foo" twice, so I changed the query to
SELECT * FROM `mytable` A 
  WHERE A.mainproperty=`foo`
  AND   A.datetime = (SELECT MAX(B.datetime) FROM `mytable` B
                      WHERE B.mainproperty=A.mainproperty
                      AND   A.property = B.property)
  GROUP BY A.`mainproperty`, A.`datetime`, A.`property` 
  ORDER BY A.`datetime` DESC, A.`property` ASC
which seems to work just as well. -- 78.43.60.58 (talk) 16:14, 6 May 2010 (UTC)[reply]
The reason that clause that kainaw disputed is actually needed is because without it, the subquery only returns the maximum date from the whole table, whereas you were looking for the maximum date per property. --Rixxin (talk) 08:00, 7 May 2010 (UTC)[reply]

Odd Flash crashing issue

[edit]

I've been trying to set up a SWF that plays a Flash video (FLV) format, which is usually not a huge problem (I've done it before, I'm not doing anything weird in the FLV conversion). For some reason Flash is occasionally bugging out on me and crashing. In Safari, the Flash applet suddenly goes white and is replaced by an upside down caution sign (like File:Caution sign used on roads pn.svg this but upside down). I then need to reboot Safari before it will even run Flash again. On Firefox it seems to just crash out usually silently (but sometimes with a funny little blurt as the audio skips for a second) — suddenly my video is gone and Firefox won't run any Flash again until reboot either. Both of these are on Mac OS X 10.4.11.

In my Console, I get the following message whenever it happens in FIrefox:

Inconsistent heap state: Failed to abort
error: out of memory

Does this just mean that my FLV is too big for my computer, or for Flash, or...? I've never had issues with FLVs being too large before, and Googling the error message didn't come up with very much that was useful. Any thoughts? It seems to happen with large FLVs (e.g. over 100MB in file size), but also when I open smaller FLVs via the browser sequentially with these files (so I open a 10MB FLV and then a 50MB FLV and it crashes, whereas if I had only opened one or the other it would have been fine).

Is this a Flash issue, a hardware issue (I have plenty of RAM free), something wrong with these particular FLVs, or...? Any thoughts? I find it odd since I would expect that if this were something common, YouTube would crash out on me or something like that, not just my own custom Flash player (which is just a pretty standard Flash template). --Mr.98 (talk) 13:45, 6 May 2010 (UTC)[reply]

Do you see any error messages when you test your movies in Flash Professional (i.e., by pressing CTRL + ENTER)? Also, what version of the Flash Player are you targeting? If you publish for an older version of the Flash Player, the Flash Player will emulate that version, with older bugs and everything. Try to target the newest version of the player and see if that helps. (Newer SWF formats run faster, anyway.)--Best Dog Ever (talk) 18:55, 6 May 2010 (UTC)[reply]
Hello?--Best Dog Ever (talk) 23:22, 7 May 2010 (UTC)[reply]

Backup

[edit]
Resolved

I need to backup 900GB from one hard drive to another. I've tried SyncToy and it works, but I was wondering if anyone here had suggestions for other good, preferably free, backup programs? 82.43.89.71 (talk) 14:54, 6 May 2010 (UTC)[reply]

rsync is the standard on Unix, and can be used on Windows via a port. See, for example, prebuilt binaries for the operating system of your choice. Nimur (talk) 15:15, 6 May 2010 (UTC)[reply]
What features missing from synctoy do you want? Is this a one off backup or something you're going to be doing permanently? I ask because a lot of software give you a ~30 day trial. Akamad (talk) 16:27, 6 May 2010 (UTC)[reply]
List of backup software is our article. If this is a one-off then of course you could just drag the folder(s) from one drive to another. Comet Tuttle (talk) 16:39, 6 May 2010 (UTC)[reply]

Thanks everyone. I've installed the windows version of rsync but I don't know how to use it. What would be the command to copy all of c:\ to f:\ for example. And I'd like to do a backup every month or so, would it need to copy all the files each time or only the new/changed ones? 82.43.89.71 (talk) 17:58, 6 May 2010 (UTC)[reply]

Could you explain a bit further your setup? Laptop/Desktop? External/Internal drives? There may be much easier ways. --rocketrye12 talk/contribs 22:14, 6 May 2010 (UTC)[reply]
I want to back up my local drive c:\ to an external 1TB hard drive. I've been using SyncToy but it reduces my RAM to 100MB and basically leave the system unusable while it works. I can't really leave it going at night either. I'm mainly looking for backup software that does the same thing as SyncToy but without using so much RAM. Sorry I wasn't clear in my opening question, I was planning to just test all of the suggestions one by one to see which was the best. Thank you everyone who has replied so far! :) 82.43.89.71 (talk) 23:16, 6 May 2010 (UTC)[reply]
I don't know if I'd recommend rsync since it understands weird Unix filesystem features (devices, symlinks and hardlinks...) but probably not weird Windows filesystem features (reparse points, named data streams, encryption...). You'll be safer with robocopy, which does understand those things. Are you sure that SyncToy is eating all of your RAM? If you're talking about the "free physical memory" statistic in Task Manager, then there's nothing to worry about; that number is almost meaningless. -- BenRG (talk) 02:41, 7 May 2010 (UTC)[reply]
I'm certain it's using all the RAM because it shows RAM go down from 900MB free to almost nothing, and the entire computer becomes horribly slow and unusable until SyncToy is stopped. Thank you for suggesting robocopy, I will check that out. 82.43.89.71 (talk) 07:55, 7 May 2010 (UTC)[reply]
If you just want to do a monthly backup (or even weekly, which would be better) using xcopy and a batch file with the correct xcopy syntax will work perfectly well - it's what I do every week (using 2 hard disks, which I rotate). xcopy /s /d /y /C d:*.* e:\PCBackup\*.* will backup a d drive to an e drive, only copying new or changed files. xcopy /s /y d:*.* e:\PCBackup\*.* will copy all files. I suggest checking the syntax of xcopy yourself by typing xcopy /? into a command window, so that you understand what's going on. --Phil Holmes (talk) 08:33, 7 May 2010 (UTC)[reply]
I suggest downloading an app called FreeFileSync. Not only will it perform simple copyovers at the click of a button, it can also compare files between two locations and overwrite in one direction or cross-update. Very simple, very easy, nice GUI, and free. 218.25.32.210 (talk) 08:44, 7 May 2010 (UTC)[reply]
YES! THANK YOU THAT'S PERFECT! It's only using 150mb of RAM for the same job SyncToy was using 600MB thank you thank you thank you! 82.43.89.71 (talk) 19:01, 7 May 2010 (UTC)[reply]

RAM

[edit]

Is it possible to limit the amount of RAM a specific program on Windows can consume? I realize this might make the program unstable or unusable, but I would like to test limiting RAM on several programs that take too much and make my overall system unusable while they're running. Thanks. 82.43.89.71 (talk) 18:49, 6 May 2010 (UTC)[reply]

Not that I can know of. But you can tell which app is using the most ram. To do that press ctrl+⇧ Shift+esc. That will call up the Windows Task Manager as shown in the image on the left.

Step 2: Select the Processes tab. Check or click on show processes from all users. If you have Windows Vista you may have to allow the UAC Window that appear.

Step 3: Press "Memory" twice. That will order the processes from those using the most memory to the one using the least.

--Tyw7  (☎ Contact me! • Contributions)   Changing the world one edit at a time! 13:52, 8 May 2010 (UTC)[reply]

Thanks but I already know which program is using the RAM and exactly how much it's using. I just want a way to limit the available RAM the program can access to 300MB or so 82.43.89.71 (talk) 14:50, 8 May 2010 (UTC)[reply]
I doubt you can restrict the RAM available to the app. Perhaps put it in sandbox? Just for information for other users please see the PDF document I created. http://upload.wikimedia.org/wikipedia/en/b/b9/Help.pdf --Tyw7  (☎ Contact me! • Contributions)   Changing the world one edit at a time! 15:04, 8 May 2010 (UTC)[reply]

Dancing arrow

[edit]

At one library I go to there is a relatively new HP mouse. I'm not touching it and as far as I know nothing is moving. I think it uses a red light rather than a ball. The arrow keeps moving all over the place, and it's hard for me to make it stand still in order to click. It will turn stuff blue at the slightest provocation, or fail to turn anything blue when I want it to, when I am copying and pasting or even just clicking to change the URL at the top of the screen.Vchimpanzee · talk · contributions · 19:57, 6 May 2010 (UTC)[reply]

The mice that use the red light are called optical mice. I have one right here that has similar problems; it tells the computer to make the mouse pointer drift. One thing to try is a different mouse pad under it, or try a couple of different magazines. If nothing works, the mouse should be replaced. Comet Tuttle (talk) 20:28, 6 May 2010 (UTC)[reply]

They did just replace the mouse. Another one was having a great deal of difficulty doing anything. The pad is kind of rough, so I'll mention that to them. Thanks.Vchimpanzee · talk · contributions · 20:36, 6 May 2010 (UTC)[reply]

Rough is probably OK - what you don't want is something like a mirror or glass; you want something that has visual texture to it. Try a few random flat objects and see if that helps. Comet Tuttle (talk) 21:25, 6 May 2010 (UTC)[reply]
I doubt they would use one in a public space like a library, but is it a wireless mouse? RF interference, perhaps from other wireless mice, can interfere with the signal between the mouse and its receiver. Astronaut (talk) 10:42, 7 May 2010 (UTC)[reply]
I would have said if it was wireless. I don't know if this is a factor, but my grandfather had a problem with his hands shaking, similar to people with Parkinson's, which my mother inherited, and now I have it. I looked at the article and it says the tremor happens at rest, but this shaking doesn't happen for me when I just hold my hand in the air, so that's not likely Parkinson's. I have to be touching something, like a mouse. But one would think the mouse would quit shaking (though the mouse itself doesn't; just the pointer) once I let it go. And it doesn't happen at home.Vchimpanzee · talk · contributions · 20:41, 7 May 2010 (UTC)[reply]
If it keeps shaking or drifting when you're not even touching it, it's a problem with the mouse and it has to be replaced. One last thing to check is whether the cable is damaged at its point of contact with the mouse. Rough handling may have damaged one of the wires inside that cable; you may want to try tilting the cable a little to the left / right / up / down to see if that stops the drifting. (Of course kinking the cable will damage it even more.) Comet Tuttle (talk) 23:50, 7 May 2010 (UTC)[reply]
Just so you know, virtually all computer mice nowadays are optical, and most of them work just fine. Check the lens. It may have come gunk or dust on it. (In my experience they don't normally collect dust, but who knows what it's picked up in a public library.) APL (talk) 22:03, 8 May 2010 (UTC)[reply]
I'm at that library. Someone blew on it and asked someone else where the canned air was. He didn't find it, but the problem seems to have been solved.
Except when my Parkinson's acts up.Vchimpanzee · talk · contributions · 19:25, 11 May 2010 (UTC)[reply]

Trend Line on Microsoft Excel 2008 for Mac

[edit]

Hi all, I'm plotting some data on Excel and I'm fitting a least-squares line to it by using the "Add trendline" option on the plot of the data. I need to show where the x-intercept of the line occurs (standard addition curve, so I don't have data that far back) and I can't get excel to predict back that many periods. How can I extend the line back? Thanks for your help.169.229.76.114 (talk) 20:12, 6 May 2010 (UTC)[reply]

If you want to manually extend the line back, doing the calculations yourself, that's a good Q for the Math Ref Desk. StuRat (talk) 13:20, 8 May 2010 (UTC)[reply]

I didn't want to do that just because I didn't want an actual data point way back there, but anyways the whole thing is a moot point now. Thanks for the suggestion, though.169.229.76.114 (talk) 20:21, 8 May 2010 (UTC)[reply]

I didn't reply here because I wasn't sure it was entirely the same, but here's what I was thinking: Excel seems basically unable and unwilling to extrapolate data for graphs, even when it is very simple, or even if we are just talking about connecting two datapoints and ignoring a missing one in between. It has driven me a bit nuts in the past and I've always had to do my own interpolation for even very simple graphs. --Mr.98 (talk) 00:06, 11 May 2010 (UTC)[reply]

which java

[edit]
Resolved

Hello! I have a 64-bit system with the 64-bit JRE but I also had to install the 32-bit JRE so I can run applets in Firefox, which is 32-bit. I just want to make sure that I'm using the 64-bit JRE for everything else, mainly when I call java -jar myJar from the command prompt. java -version doesn't tell me what architecture. What's the command that will tell me what .exe file java is associated with? I think Linux has which to do this, but I'm looking for how to do this with Windows. Thanks!--el Aprel (facta-facienda) 20:32, 6 May 2010 (UTC)[reply]

At the terminal, you can type echo %PATH% to print your path. The rightmost entry that contains a Java binary is being used. Alternately, from within your Java program, you can call System.getProperties(), which will spit out a bunch of parameters, including java.home, the Java installation directory currently in use. Alternately, you can install a 3rd-party version of which for Windows. GnuWin32 provides one. Nimur (talk) 21:59, 6 May 2010 (UTC)[reply]
Thank you, Nimur.--el Aprel (facta-facienda) 20:15, 7 May 2010 (UTC)[reply]

Import messages from Live Mail to Outlook Express

[edit]

Is it possible to import messages from Live Mail to Outlook Express? I tried Live Mail for a couple of days, and I don't like it, so I'm going back to Outlook Express. It would be handy to be able to import those messages which arrived in the time I was using Live Mail. They are still on the Googlmail server. I tried the Import wizard on Outlook Express, but it didn't give Live Mail as an option to import from. DuncanHill (talk) 23:17, 6 May 2010 (UTC)[reply]

I doubt you can do the import, since M$ regard Live Mail as an upgrade. But if they're still on the server, can't you grab them with POP3? --Phil Holmes (talk) 08:28, 7 May 2010 (UTC)[reply]
Well, I managed to get them by using the "recent" mode - grabs the last 30 days off the server. DuncanHill (talk) 12:02, 7 May 2010 (UTC)[reply]