Jump to content

Wikipedia:Reference desk/Archives/Computing/2011 December 5

From Wikipedia, the free encyclopedia
Computing desk
< December 4 << Nov | December | Jan >> December 6 >
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.


December 5

[edit]

for loop / actionlisteners (Java)

[edit]

Hi All.

Can any one point me in the direction of where I can find out...

in Java, what is the proper way to use a for loop to automatically add an actionlistener to all the object of a certain type in a container. For example:

for (JMenuItem m : myJMenuBar.getComponents)
{
m.addActionListener(this);
}

Is this the proper way to do this?

Thanks

Duomillia (talk) 13:56, 5 December 2011 (UTC)[reply]

Sure, that looks fine. -- Finlay McWalterTalk 14:05, 5 December 2011 (UTC)[reply]
But the for-loop method isn't by any means the only way to sensibly add actionListeners - there's plenty of other ways to do it, and which is best depends on your code. It's often sensible to addActionListener immediately after you've constructed each component (rather than waiting for later). If the components are your own classes (say you subclassed JMenuItem and had a bar full of those) you could pass an ActionListener into their constructor, and have them addActionListener that after the superclass constructor. -- Finlay McWalterTalk 14:26, 5 December 2011 (UTC)[reply]

Backwards E: no final verdict

[edit]

Referring back to this question and others that preceded it, I'm back on that computer but not allowed to do any of the things suggested. I went to the one website showing cursor types but nothing gave me that backwards E.Vchimpanzee · talk · contributions · 14:19, 5 December 2011 (UTC)[reply]

The other request was to attempt to open the cursor settings, which shows the computer's local cursors - one of which could be messed up. -- kainaw 15:29, 5 December 2011 (UTC)[reply]
I think that was something I was not allowed to do since it wasn't my computer. The backwards E did show up this morning, but I think it has something to do with the web site being slow to come up and isn't a clue to another problem that's actually preventing me from doing anything.Vchimpanzee · talk · contributions · 18:20, 5 December 2011 (UTC)[reply]

Almost certainly a total waste of time. ¦ Reisio (talk) 20:31, 5 December 2011 (UTC)[reply]

For the record, I was thoroughly amused by this mystery. TheGrimme (talk) 16:31, 6 December 2011 (UTC)[reply]

Copying and pasting from a web site into an email that is not plain text

[edit]

I asked this question several years ago and was unable to get an answer. I emailed User:Nil Einne a screenshot of the phenomenon, something I should have thought to do back when I first asked. And this is the text I was trying to copy this morning, which I copied again at a different library which had screen shot capability.

The solution is to use a plain text email or Wikipedia sandbox to format the information before I send it. If the email address I happen to be using will allow plain text I can use that once I discover I am having the problem. If I can remember and can use plain text, I can set the email to plain text. There are any number of reasons why I might want to use a specific email address to save the information and send it to myself, but I can usually find a way to make the email plain text.

The problem is when I try to type information alongside what I have copied and pasted, and any attempt to do so gives me a gray rectangle with squares in the corners and halfway between the corners. I get arrows pointing in all four directions when I try to type in that space. Nil Einne has the screenshot of the gray rectangle. I just want to know what's going on because I've never seen it addressed in any Wikipedia article or anywhere else.Vchimpanzee · talk · contributions · 18:34, 5 December 2011 (UTC)[reply]

It depends on your mail client, but it sounds like it has inserted this formatted web text either as an image, or as a text-box object. I sometimes find that if I drop it into a text editor like notepad first, that removes the formatting leaving me with just the text to then cut&paste into my email. Windows programs might also offer a little pop-up menu to insert just the text or the fully formatted text into the email - look for a little clipboard icon (I think) with a down-arrow when you hover over it. Astronaut (talk) 18:50, 5 December 2011 (UTC)[reply]
Well, I did explain my solution, and what you're suggesting may not work with anything I'm doing. This morning I was using Lycos, which I went to by typing lycos.com and clicking on mail and signing in. This afternoon, I typed yahoo.com and went to mail. I'm just trying to find out what is happening and where it's explained in Wikipedia or anywhere else.Vchimpanzee · talk · contributions · 19:05, 5 December 2011 (UTC)[reply]
Wait, I see what you mean. There's an "insert image/photo" icon.Vchimpanzee · talk · contributions · 19:16, 5 December 2011 (UTC)[reply]

Searching for satellite images

[edit]

I am looking for images taken from high up, either satellite or very high altitude plane flight - the problem is when I Google 'satellite view' I get pictures of satellites. I am looking for images taken from a vertical/near-vertical angle. Any suggestions on making my googling more accurate? (I am looking for images of refugee camps for preference, but these will be source images for a creative work so anything will do. I could screen grab Google Maps but they would be low-res and too high an altitude in the places I am looking for - ie I could zoom in quite low on my house but not on Darfur.

Thanks FreeMorpheme (talk) 19:55, 5 December 2011 (UTC)[reply]

I doubt if such hi-res pics are available. The reason they provide hi-res satellite pics of your house is so you will visit their site, see the ads, and maybe buy those products. Refugees aren't much of a market, and most other people probably aren't much interested in satellite views of refugee camps. StuRat (talk) 20:10, 5 December 2011 (UTC)[reply]
(ec)Beyond the resolutions available in Google Maps and Bing Maps, detailed satellite imagery isn't freely available. Commercial providers like DigitalGlobe provide occasional samples of notable places on their website, as an advertisement for their services, but their business is to sell lowered-resolution images to mapping services and sell specific high-res images to people who pay for just those specific images (and they'll capture stuff bespoke for you, if you pay for that). Such services also specifically target metropolitan parts of developed countries, as that's mostly what their customers want to buy. In addition, for the US only, you can get aerial photos from USGS sweeps over some metropolitan areas (NASA World Wind has them). You can also get low-resolution Landsat images (again World Wind), but it's much less detailed than even the public stuff Google Earth shows. I can't suggest a better search term than "satellite imagery" or "aerial photo"; I'm sure there exists exponentially less high-res imagery of Sudan than San Francisco. -- Finlay McWalterTalk 20:18, 5 December 2011 (UTC)[reply]
A quick search for 'satellite refugee camp' finds [1]. From there you can find satellite images like [2] although whether they are high resolution enough for your purposes I don't know. They are also annotated. If that doesn't work, in the same search other results like [3] [4] (think it's similar to the first result) [5] [6] [7] [8]. A search for 'google maps refugee camps' finds [9] which is Google Earth but looks like may be of interest (I haven't checked it though). A search for 'bing maps refugee camps' finds this site stuff on this site [10] and a search there find stuff that may be of interest, e.g. [11] although Google Maps seems to have the best maps for most refugee camps I saw (only those in the Palestinian territories seemed to be similar between BM and GM). In the earlier search, there is also mention of [12] (in [13]) but I'm not that sure there's anything there likely to be of interest to you. I have no idea if any of these are high res enough for you, but I think these illustrate it's worth remembering that refugee camps in particular are often of interest so are likely to be more widely available then stuff covering the general vicinity. A fair amount of this is likely copyrighted with limited licenced re-use offered barring that guaranteed under law where you live, I presume you've considered such issues since you mentioned Google Maps. Nil Einne (talk) 22:53, 5 December 2011 (UTC)[reply]
If you're willing to stretch to 'a few boxes of beer' you might be able to find some higher res stuff at the locations mentioned here, though it's a guide aimed towards scientific use and includes some sources which don't include part of the visible light spectrum. A lot of people would just use Google Earth with the 'Terrain' layer turned off for anything less than a report to a client. With GE, it's easy enough to turn off all the interface rubbish, and you can then save an image. Nevard (talk) 05:58, 6 December 2011 (UTC)[reply]

Kaspersky backup quirk

[edit]

I have Kaspersky "Pure" configured to make a backup every week of files that have changed in the last week. It seems to do this okay but it also regularly backs up two files that have NOT changed. One is a tiny ten line txt file I created, the other a pdf I downloaded months ago. Neither line has been changed in months.

I know that making unneeded backups is not a big deal in itself but I am suspicious about a program that makes unneeded backups. Does it also miss files that it should be backing up?

Is there a convenient way, independent of Kaspersky, to create a list of files that have changed in the past week and therefore should be backed up?

And please can anyone suggest why the program might be making backups of unchanging files? Thank you, CBHA (talk) 22:11, 5 December 2011 (UTC)[reply]

If Kaspersky checks and resets the archive file attribute, you might be able to tell what files have been modified since the last backup by running "dir /AA /S" from the root of your drive(s). However, I don't know how well current versions of Windows and various applications behave as far as setting the archive attribute when a file has been modified. --LarryMac | Talk 22:41, 5 December 2011 (UTC)[reply]

Computer keeps losing track of file

[edit]

My computer (WinXP, SP3) has lost track of \WINDOWS\SYSTEM32\CONFIG\SYSTEM and will not start up, and chkdsk opines that there's an unrecoverable problem on the volume it is on. Do any of you have any idea as to how to fix this? —Jeremy v^_^v Components:V S M 23:01, 5 December 2011 (UTC)[reply]

As a bit more info, I can't copy the directory. Every time I attempt in recovery console it tells me it can't be copied. —Jeremy v^_^v Components:V S M 23:11, 5 December 2011 (UTC)[reply]
Tried doing a 'chkdsk c: /R' from the recovery console yet? Worth a go. Nevard (talk) 06:07, 6 December 2011 (UTC)[reply]
Yes, and all it tells me is that the drive has one or more unrecoverable problems. —Jeremy v^_^v Components:V S M 06:27, 6 December 2011 (UTC)[reply]
Ah.. then that would be the point where I'd do a reinstall. Needs doing regularly anyway. If you've got a Linux livecd around, or something else with SMART utilities, it might be worth checking the SMART stats to make sure the disk isn't stuffed. Nevard (talk) 07:06, 6 December 2011 (UTC)[reply]
I have neither because I don't use any Unix variant. —Jeremy v^_^v Components:V S M 07:36, 6 December 2011 (UTC)[reply]
I don't see why that is a problem. We have a comparison of S.M.A.R.T. tools which lists software for Windows, DOS, Max OS, Linux and others. The purpose of a Live CD is to boot up an operating system from the CD/DVD/USB stick without touching the hard disk. This gives you a working operating system you can use to examine and fix problems with your installed OS. It is trivial to create a live CD for any number of OSs (there is no reason why you can't use a different OS to the one installed on your hard disk), if you have a CD or DVD writer or USB stick, and a reasonably fast internet connection (we have a List of live CDs). 130.88.99.218 (talk) 15:52, 6 December 2011 (UTC)[reply]