Wikipedia:Reference desk/Archives/Computing/2007 February 24

From Wikipedia, the free encyclopedia

Computing desk
< February 23 << Jan | February | Mar >> February 25 >
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.


Contents


[edit] February 24

[edit] Tracing School Vandals

Supposing you traced and IP vandal-edit to a particular school and the school IT people were willing; would it be possible for them to trace it to the individual logged-in user and give them detention? --Seans Potato Business 00:04, 24 February 2007 (UTC)

Potentially yes, if:
  • they have cameras in their computer labs
  • computers are assigned IP addresses statically.
On that last point, they wouldn't have to- they could keep DHCP logs --frothT 00:44, 24 February 2007 (UTC)
On the first point, if the computer system requires individuals to log in or whatever, then they could check those login logs. --Spoon! 00:48, 24 February 2007 (UTC)
Quite true, but most schools IT departments aren't that intellectually adept, nor do they require students to have individual logons. Of course, that all depends on the school. Some are better than others in that respect.
Worse, if you share my POV --frothT 07:19, 24 February 2007 (UTC)

[edit] Formatting Flash Cards

I take a bunch of pictures in a short period of time with my digital camera, so usually if I need to free space and get ride of them I just reformat the card. Are there any repercussions to reformatting a flash card often and/or is it "safer" to delete them one-by-one? --Cody.Pope 03:49, 24 February 2007 (UTC)

It takes longer to format the card. It is much quicker to select all files and press shift-delete. Instead of updating all the bits on the card to be a zero, you just blank out the inodes. It appears that you haven't tried selecting all the files at once (crtl-a usually works fine) and then immediately deleting (shift-delete is the normal key-combo for that). --Kainaw (talk) 04:26, 24 February 2007 (UTC)
Ah no, I'm formating with the card in the camera. It takes about 3 secs. --Cody.Pope 04:45, 24 February 2007 (UTC)
That is completely different. In a camera you can rarely select multiple pictures. You have to select one at a time. Then, you have to jump through hoops to delete an image. I assumed that if you are deleting the pics, you must have saved them somewhere - meaning that you must have connected the camera to a computer. --Kainaw (talk) 04:49, 24 February 2007 (UTC)
Sort of (sometimes I'm blanking a whole card on the fly when I need more space and/or the pics I took were uninteresting blah blah blah), really I'm specifically wondering if formatting-often effects card life-span. Thanks! --Cody.Pope 05:41, 24 February 2007 (UTC)
Not much effect on lifespam, so go ahead! Splintercellguy 05:43, 24 February 2007 (UTC)
Normal formatting does NOT change every bit to 0, it just changes the allocation table in the file system to mark all area as empty space (that's why you can recover things after formatting or deleting if you haven't done anything else afterwards). Formatting does this in one go while deleting individally does this each time you press delete. Since flash memories have finite write cycle, formatting is actually better for your flash card than deleting individually, but not that much that it is noticeable. --antilivedT | C | G 07:04, 24 February 2007 (UTC)
According to the page Flash memory many cards come with a 1,000,000 programming cycles guarantee. You would have to be using your camera/making read writes a lot to use that up. If you took 50 shots a day (and delete them individually) that would be 100 cycles (50 writes, 50 deletes). You could do that for 10,000 days before you hit 1m cycles. 10,000 days is about 27 years. I'm guessing that it isn't quite as simple as this but I suspect that most flash-cards will outlast the product they are in so I personally think you can delete as a group, or individually and not worry at all about the impact. It is also fair to note that just because the lifetime is 1m cycles doesn't mean that under normal cicrumstances that can't be hugely higher. ny156uk 14:35, 24 February 2007 (UTC)

Thanks, that was my intuition but I wasn't sure. --Cody.Pope 01:18, 25 February 2007 (UTC)

[edit] Old Game, New Machine

Why would a game designed for an inferior machine play more slowly (while using 100% CPU) on a newer machine? --Seans Potato Business 06:41, 24 February 2007 (UTC)

A machine is only as good as its weakest link. Also check drivers, patches, updates etc. Or give us more detail (specs of your computers, what game etc.). --antilivedT | C | G 07:05, 24 February 2007 (UTC)
It may be using some automatic-slowdown system to gear the execution speed to the machine. On very fsat machines these systems don't work very well; they may trigger divide-by-zero errors or produce inaccurate speed estimates. User:Ben Standeven : 209.210.225.6 23:08, 26 February 2007 (UTC)

[edit] Data

I like to get information from websites such as www.abbreviations.com for my website.

I wonder how I get all data available from those sites and need script or software for that so that I could start similar websites. —Preceding unsigned comment added by 80.7.69.103 (talk • contribs)

This is possibly copyright infringement, and definitely plagiarism unless you clearly state your sources. You could use an automated web downloader like wget to download an entire site, then process the resulting HTML. Droud 15:36, 24 February 2007 (UTC)

Comment below moved from inside question above: --h2g2bob 16:48, 24 February 2007 (UTC)

I like to display search results from websites like wikipeia.com, answers.com on my web pages and I like to get the script to do that. Could you please tell me how to write such script or where to download it?
thanks--80.7.69.103 10:35, 24 February 2007 (UTC)
You may use material from Wikipedia, if you keep to the terms of the GNU Free Documentation License. An example of this is answers.com. If you plan to use more than a handful of pages, you should use the database dumps. --h2g2bob 16:52, 24 February 2007 (UTC)

[edit] WindowsExplorer, need help

Hello there. Sorry to use you guys as some help-center though I just can't fix this. First of all; I'm running windows vista (can't be that diffrent from XP).

Secondly; In Folder options > View i reset the folder views. Resulting in that Start>Computer now wont group the objects anymore (harddrives, portable media etc, etc, like XP does too), do anyone know how to fix it back?

Thirdly; The explorer got this sidebar, as it should. Though from the begining it also had a few buttons at the bottom. I somehow removed them, and now I can't get them back again. Any ideas?

All help will be, and are, appriciated! Big thanks! 213.64.150.116 16:50, 24 February 2007 (UTC)

Well for your second point, presuming it is indeed the same in XP, just open My Computer, go to the View menu and select 'Details'. Go back to the View menu and select 'Arrange icons by' then select 'Show in Groups'. Then finally go back to the View menu then 'Arrange Icons By' and then select type. That should be it. Johnnykimble 17:35, 24 February 2007 (UTC)

[edit] How do I train myself not to open so many terminal windows?

At the end of the day I might have 20 or moer console windows open on my desktop. (on linux with kde right now) I'll open a new shell to do just about anything, my command history gets all messed up and i often end up having to look through all the minimized terminals to find something. I know the desktop paradigm is that I am supposed to do most tasks through the file manager/browser but then you have to get everthing configured right first :P the command line is always quick and easy. How do I wean myself off of starting so many terminal windows and cluttering up my desktop? WHat is your strategy for having the CLI and desktop coexist peacefully? ---- Diletante 18:15, 24 February 2007 (UTC)

Don't use X at all! --frothT 21:56, 24 February 2007 (UTC)
In every default install of KDE/Gnome that I've seen, at least 4 desktops are set. I normally put a full-screen konsole on destop 4 and jump there whenever I want to do something at the command prompt. If I need more than one konsole, I double-click by the tab at the bottom to open another screen in the single-instance of konsole. --Kainaw (talk) 21:58, 24 February 2007 (UTC)
Virtual desktops are your friend, I'll echo that.
Er... Make good use of GNU screen and perhaps find a terminal emulator that supports tabs? Also, virtual desktops and edge flipping are your friends. -- mattb @ 2007-02-24T23:10Z
For most file-management tasks, a GUI desktop will basically never be faster than a skilled CLI user, so I think your goal of moving away from that as an end unto itself is questionable. As people said, just keep a few open, and use whichever one's handy to do your task. --TotoBaggins 23:49, 24 February 2007 (UTC)
This is entirely dependant on the software used to manage files. Some shells are very powerful, like bash, while others are very limited, like MS-DOS. The same applies for GUI software. 68.15.208.73 18:12, 25 February 2007 (UTC)

Thanks for the tips. I guess the solution is the same as for web browsers, tabs. -- Diletante 16:21, 25 February 2007 (UTC)

I usually keep three or four "terminal" (shell) windows open. I'll emphatically echo what TotoBaggins said about the power of a good CLI -- the reason the "desktop paradigm" is so popular is not that it's more powerful (in fact, quite the opposite).
It is often the case that a particular terminal window has a fair amount of state in it: what directory you're in, what task you're working on, what your recent (and easily-recallable) command history is, etc. I'm usually working on two things at once, so my top two windows will be for those two tasks. The third window is for miscellaneous stuff, in case the first two windows are both "frozen" -- for example if they're both in the middle of more-ing something, or if there's stuff visible in the window that I want to look at for reference, and not scroll away with the output of a new command. If I end up with three windows frozen like this, I'll open a fourth. But the majority of the time I'm not working on so much that I need five or more windows. (I start losing track of things, myself, at that point.)
Having 20 or more open terminal windows to close when you log out does not strike me as a problem in and of itself. But if you find yourself rummaging through them all to find things, then yes, that's a nuisance (or worse). What you need to do is imagine that each new terminal window is expensive -- which it is, if not in computer resources, then in screen real estate and in your brain's own capacity to keep track of it. Whenever you find yourself having the urge to "open a new shell to do just about anything", try to catch yourself, and re-use one of your already-open windows instead.
History management is an interesting issue. I've often through that It Might Be Nice If a shell could somehow retain multiple history files, one for each window, and keep track of them somehow and re-use them in the analogous windows each time you log in. In fact, at times I've gotten the impression that bash was somehow doing that for me already, in that my history (across multiple windows) wasn't getting as messed up as I would have expected. But trying to actually do this could easily turn into an unmanageable can of worms that would cause more problems and nuisances than it would solve, so I haven't pursued it (yet). —Steve Summit (talk) 23:19, 25 February 2007 (UTC)

I used to need to have many UNIX windows opened at once, so came up with some strategies to find the right one. I color-coded the foreground and background, using one color scheme for writing code, another for compiling and linking, another for running, etc. I also split them up by desktop, with one for coding, one for research on existing code, one for applications, one for general reference, etc. I also gave each window a descriptive title. A typical startup command was something like 'xterm -fg yellow -bg saddlebrown -T "Compile and link" -sb -sl 3000 &', as I also like lots of scroll lines. I added the typical startups to my root menu using the appropriate resource files. StuRat 05:56, 28 February 2007 (UTC)

[edit] XML Parsing with Perl

Hi, I'm having trouble parsing an XML document using Perl. I'm trying to get the information inside the <title> element inside all the <page> elements. Here is my code:

#!/usr/bin/perl
use WWW::Mechanize;
use XML::Simple;
use Data::Dumper;


my $mech = WWW::Mechanize->new;
$mech->agent_alias('Windows IE 6');
$mech->get('http://en.wikipedia.org/w/query.php?format=xml&what=allpages&aplimit=20&apnamespace=10&apfilterredir=nonredirects&');
my $list=$mech->content;
my $xml = new XML::Simple (KeyAttr=>[]);
my $data = $xml->XMLin($list);
open (LOG, ">>a.txt");
foreach $e (@{$data->{page}})
{
        print LOG $e->{title}, "\n";
        print LOG "\n";
}

Comments:

  1. The Perl Monks website's Seekers of Perl Wisdom area will probably get you better/faster help than you'll get here.
  2. You should look over How do I post a question effectively?. In particular, you never told us what your code was doing wrong.
  3. You should always use strict;
  4. If you insert a print Dumper $data after the call to XMLin(), you'll see that you missed a level in the structure (see below). You need to change your list to @{$data->{pages}->{page}}. It's pretty weak that Perl let you treat the non-existent $data->{page} as a listref, but that's dynamic languages for you. --TotoBaggins 00:19, 25 February 2007 (UTC)
$VAR1 = {
            ...
          'pages' => {
                     'page' => [
                               ...

Thanks

[edit] Dual monitors at different heights auto-aligning.

Something weird has happened! I have two monitors, one which is my laptop screen and another an old CRT - they're in dual monitor configuration. Thing is, the CRT monitor is about 5cm higher than the TFT one, this used to mean a noticeable jump in cursor height when moving between monitors and when having windows spanning both you'd see they didn't match.

Something seriously weird has happened recently: Without any intervention, they've auto aligned, so now there is now jumping, and i can't physically move the cursor from top of my CRT to the TFT one as there is no adjacent "Monitor Space":

-I ASCII'd a diagram but wikicode screws it up :P-

Question is, how the hell does it know!? I haven't done anything to show the monitors positioning, it just seems to have worked it out - but how?

Thanks!

-Benbread 22:12, 24 February 2007 (UTC)

In Display Properties -> Settings you'll have both the monitors, 1 and 2, shown there. You can drag them up and down and about, whatever you want. If one's smaller and has a lower resolution than the other then it'll be noticably shorter in the Settings page. By moving monitor two up slightly or down slightly you can choose whether you want it to be physically impossible to move your mouse from the top of your CRT to the TFT one, or from the bottom of the CRT to the TFT.
I'm not sure why it would have auto-aligned without you doing anything, but if you installed some new software this may have aligned it for you. JoshHolloway 22:28, 24 February 2007 (UTC)
I'm not sure that this is an adequate answer.. regardless of the resolutoin, there's no reason for Windows to know the physical size of your screen --frothT 23:38, 24 February 2007 (UTC)