Jump to content

Wikipedia:Reference desk/Archives/Computing/2006 July 22

From Wikipedia, the free encyclopedia
Humanities Science Mathematics Computing/IT Language Miscellaneous 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 at one of the pages linked to above.

< July 21 Computing/IT desk archive July 23 >


Wouldn't quite call it computer SCIENCE, but...

[edit]

I just got a new computer. I'd put avg on my old one because someone had suggested it, and I didn't get any viruses or anything. the new computer comes with a trial version, 6 months, i believe, of mcafee. it's bugging the hell out of me, (constant security pop-ups im having trouble turning off, prohibitively large cpu usage at computer startup, causing a long, long, startup) and im considering deleting it before the trial expires. is this a bad idea if i have avg? does avg work fine? should I renew my mcafee or can i just delete it and be perfectly safe. thanks sasha

  • Hey, Sasha. Just remove it through Add/Remove programs in the Control Panel. Won't do any harm. Then just install AVG, or something else if you want, although AVG is very good in my opinion. Hope I was of some help. Stewart 14:42, 22 July 2006 (UTC)[reply]
  • Yes. AVG is popular and effective. --Proficient 14:54, 24 July 2006 (UTC)[reply]
  • I'd agree that AVG is excellent. I also use ZoneAlarm which allows the user to allow or block any programs that try to access your computer, or any programs that try to access the internet. --Tadhg 22:53, 26 July 2006 (GMT)
  • Or you might want to try Avast which tends to catch things that AVG doesn't it's also free for home users. Whispering 22:08, 28 July 2006 (UTC)[reply]

Thanks

how to control the keyboard using java script

[edit]

pls tell me how to control teh key board using java script

What exactly do you mean by "control the keyboard"? What do you want to do with it? The keyboard is just an input device; if you want to simulate the usage of an input device, there are ways to do that within the constraints of the Javascript DOM, but you can't do it outside of that. --Fastfission 14:57, 22 July 2006 (UTC)[reply]
Use AutoHotKeys (freeware) to control the keyboard with macros, easily. --Proficient 14:56, 24 July 2006 (UTC)[reply]

GIMP: I just go this program and...

[edit]
Moved here from Talk:GIMP

...well I need to learn how to do something. It says I have not installed the help program so if anyone can tell me how to do that, it would probably clear it up for me. Anyway, my question is how do I get a transparent background. --WillMak050389 20:53, 21 July 2006 (UTC)[reply]

Either by selecting what you want to keep, making a new layer (Layer -> New -> Transparent) and pasting it to the new layer, or by cutting what you want to lose from the existing layer. You may have to delete a white background layer. All that happens in the layers dialogue, one of the windows that opens automatically at startup. As for installing the help, you'll have to first tell us what platform you're working on. - Samsara (talkcontribs) 22:10, 21 July 2006 (UTC)[reply]
I'm working from Windows XP is that what info you wanted? Oh and I realized I probably should have put this on the Media reference desk and not this talk page. Sorry for that. --WillMak050389 01:47, 22 July 2006 (UTC)[reply]
I strongly suggest searching google for "Beginner's Lessons for Gimp". It is almost as hard as Photoshop for a beginner to learn. But, once you get the idea of layers and selections, you will be able to quickly pick up all kinds of tricks. I made the mistake of trying to jump from MS Paint to Gimp with just the Gimp help manual. You do not want to try that. --Kainaw (talk) 14:14, 22 July 2006 (UTC)[reply]
I found a good beginners help course here. Thanks for the tip, Kainaw! --WillMak050389 00:28, 23 July 2006 (UTC)[reply]
Hello.

In 10 steps or less, open the image you want. Find the layers toolbar and right click on the "Background" layer. Select "Add Alpha Channel" This adds the "Transparent" color to the image. Find the Tools box and pick a selection tool. The Lasso lets you select an irregular shaped area by hand. The box lets you select a rectangle. The magic wand lets you select an area based on GIMP's guess of where the area starts and ends. (It's pretty cool.) Once you've selected the area you want to make transparent press Ctrl-K to clear the area and let the transparency show through. You can also use the eraser tool to erase as well. When you save your image, make sure you pick a format that supports transparencies like GIF, PNG, and Gimp's format XCF.

One more thing. When you select an area in GIMP, it becomes the "working" area. This means you can't use tools like the eraser and paintbrush outside of a selected area. When your tools aren't working, try going up to the edit menu and clicking Edit->Select->None EjayHire 02:42, 28 July 2006 (UTC)[reply]

doc2odt

[edit]

is there some command line tool that would allow conversion from Microsoft Word format to .odt? Along the lines of $doc2odt file.doc > file.odt? Does OpenOffice have some sort of script language (analogous to Script-Fu for the GIMP)? dab () 16:47, 22 July 2006 (UTC)[reply]

KOffice has kconverter with allows you to do "kconverter file.doc file.odt" to convert types. There is a generic program called "convert" also. It will attempt to convert from any format to any other format. Mine is configured to all popular graphics and music formats. I've never tried it with doc/odt because I normally just open the doc in OpenOffice and click Save As to save it as an odt file. --Kainaw (talk) 20:04, 22 July 2006 (UTC)[reply]
Abiword has a pretty good converter (use: $ abiword --to=file.odt file.doc). I'm sure OOo does as well. Googling "openoffice automate" brings up a few likely pages. EdC 02:40, 24 July 2006 (UTC)[reply]

Cyberspace

[edit]

(new fangled computing desk, eh?) After reading Neuromancer, I'm interested to see if anyone's ever made a 3D representation of the internet (i.e. Cyberspace) which actually works, in that you can go from site to site, sites are represented geographically, etc. It might be a little complicated but I'd be surprised if no one's actually tried. Know ye of any software like that? Sum0 18:16, 22 July 2006 (UTC)[reply]

the problem here is the metric. Representations of the internet I've seen usually take address space as their basis; this is contrary to the idea of cyberspace as I understand it (think distributed peer-to-peer etc.), physical (or ICANN) address space does not need a relation to the logical topology of data. But unless I know exactly what I mean by "logical topology of data", I cannot build a model of the internet, 3D or otherwise. All you get is a boring diagram of how the hardware is wired. 62.202.70.34 19:55, 22 July 2006 (UTC)[reply]
See VRML for the first version of 3D internet and X3D for the second version. Neither caught on. In my opinion it is because it is too hard to develop your own 3D homespace, so there's no added benefit to slowly sliding around a large empty void with random flat webpages. --Kainaw (talk) 19:59, 22 July 2006 (UTC)[reply]
It's also generally harder to manipulate information in a fake-3D world than it is in a series of flat webpages (which can be also easily "stacked" on top of each other and moved around in multiple windows and tabs). I don't see any great advantage to adding a Z dimension, which would just take up extra time to get in between X and Y, if that makes any sense. Fun for games and sometimes models, but not useful for general internet use. --Fastfission 14:40, 23 July 2006 (UTC)[reply]

Can you suggest an software to separate video from sound?

[edit]

I have this video, but I just need the audio part of it,is there any way to seperate it? Ziyi_cai841117

Sure, there are plenty of applications that would do just that. If the source is DVD, DVD Shrink would work. Probably wouldn't work with video files unless they were VOB files. Check out Afterdawn.com, and you're bound to find something. Hope that helps. Debigulator 01:22, 23 July 2006 (UTC)[reply]
VirtualDub or VirtualDubMod or avidemux will probably do the trick. - mako 08:23, 23 July 2006 (UTC)[reply]
If you're using linux, mplayer video.whatever -dumpaudio -dumpfile audio.whatever will supposedly extract the audio track from any media file. (Though it seems to die with my current build on Ubuntu Dapper. Time to file another bug report...) grendel|khan 14:15, 23 July 2006 (UTC)[reply]


Thank you!- Ziyi_cai841117

Good old Windows Movie Maker should work, I think.--epf 21:57, 26 July 2006 (UTC)[reply]

Grabbing printable versions of some Wikipedia articles

[edit]

Hi all, I have been playing with migration schemes for the articles listed in User:Hillman/Archive. I have already succesfully used to a simple shell script to download the raw wiki code using the utility wget

#!/bin/sh
# grab raw wiki code for given version of given Wikipedia article
# syntax getrawver ARTICLENAME version
# This saves raw wikicode in file ARTICLENAME in this directory
wget -O $1 "http://en.wikipedia.org/w/index.php?title=$1&oldid=$2&action=raw"

I used another simple shell script to massage User:Hillman/Archive into a file called "runme" which looks like

getrawver Constraint_counting 39565830
getrawver Tidal_tensor 28781955
...

Then I ran another small script

#!/bin/sh
# Syntax
#       getmyn LIST
# Here LIST is ASCII file whose lines each have a unix command with appropriate arguments
# We run each command and quit
exec < $1
while read line
do
        $line
done

I am sure this could be further improved, but it worked fine for the small number of articles I wanted to grab, and that task is now done.

I am now working on the hard part, a wiki2tex utility and hope to semiautomagically latexify these for use on my local machine. For debugging, it would be useful to also have printed versions of the "printable versions" of these articles. To see what I want, go to Constraint counting, look in the history file for the last version edited by User:Hillman, go to that, click on "printable version" and then (if you are using Firefox) click on File -> Save Page As and use the "Web page, complete" option. When you navigate on your local machine to the directory where you saved the file, you should see index.php.html plus a directory called index.php_files which contains all the .png files containing images of in-line mathematical equations from the original, any figures, etc.

The point is that you should now be able to view and/or print this locally even if you are not connected to the internet. (Links to other Wikipedia articles may be represented by internal links which might be broken, but I am not worrying about that right now since I only want to print the article.) If you didn't choose "Web page, complete", you'd just get one html file with external links to all the various .png images.

It must be possible to write a simple script getprintablearts using something like

wget -nc -S -P./Wikipedia/HTML/$1 "http://en.wikipedia.org/w/index.php?title=$1&oldid=$2&printable=yes"

Unfortunately, this seems to save the nonprintable web page with links to the original URLs with the .png files. I tried adding the -r option but this also doesn't seem to give the desired result. Any suggestions? ---CH 22:02, 22 July 2006 (UTC)[reply]

The "printable" and normal versions of the pages are exactly the same; the only difference is that the "printable" version always use the print stylesheet, while the normal version only uses the print stylesheet when printing (try it: do a print preview of any Wikipedia page, and notice it is identical1 to what you would get with the printable version). The "printable version" link was added to reduce confusion from people who are used to seeing it on other sites; it's in fact not needed at all.
What you need is -p (to download the images, stylesheets and scripts used by the page) and -k (to rewrite the downloaded page to point to the objects downloaded by -p). You probably will also need a combination of -H and -D to allow it to get the images from the image server, and possibly other switches; see the wget manual for more information. I would also recomment the use of -w (to add a delay) and a explicit delay between each download, to avoid hammering the Wikimedia servers. --cesarb 16:59, 23 July 2006 (UTC)[reply]
1 Well, almost identical; there are a few style rules that, even in the "printable" version, are only enabled when actually printing. --cesarb 17:04, 23 July 2006 (UTC)[reply]

Hi, CesarB, thanks, but if you mean that I should run

wget -nc -p -k "http://en.wikipedia.org/w/index.php?title=$1&oldid=$2&printable=yes"

or

wget -nc -p -k "http://en.wikipedia.org/w/index.php?title=$1&oldid=$2

this don't behave anything like what you said. ---CH 23:36, 23 July 2006 (UTC)[reply]

What I meant is wget -nc -p -k -H -D wikipedia.org,wikimedia.org "http://en.wikipedia.org/w/index.php?title=$1&oldid=$2". Unfortunately, at least the version of wget I have here does not understand the @import used to load the CSS files; you will have to edit each downloaded file yourself to point it to the correct places, and download the CSS files by hand. --cesarb 02:23, 24 July 2006 (UTC)[reply]

Hi again, thanks, I think you are right, the problem is that wget doesn't play nicely with CSS. Regarding the claim that downloading the "nonprintable" html version and choosing "Print Preview" in my browser being equivalent to downloading printable version, at least on my system these are definitely not equivalent at all! Oh well, fortunately I don't really have so very many files to download so I'll do it "by hand" after all. ---CH 02:43, 24 July 2006 (UTC)[reply]

Python

[edit]

In python, you can make a string "raw" by putting an r in front of it. e.g. r"this string is now raw"

If I have a variable, x, which is a string, how do I make it raw?

Strings aren't inherently raw or non-raw. All the r does is alter the escaping. In a normal string, the backslash has all kinds of magical connotations for the parser, but (nearly) all of these vanish for raw strings. Eg:
>>> "foo\x61bar"
"fooabar"
>>> r"foo\x61bar"
"foo\\x61bar" #note the escaping here.
What I think you might want is repr, which escapes all the backslashes and weird characters in a string, but I'm not too sure. If you'd explain your motivation a little, a better/more fitting solution could be offered. --Sam Pointon 23:07, 22 July 2006 (UTC)[reply]
I'm asking the user for the path of the file that is to be opened and I don't want him to have to type an r in front of his response (it's bad enough to have to type in the quotes) like this: r"<path>"
here's my code:
loc = str(input("enter file path:"))
f = file(loc, "r")
of course, this won't work because all the icky "\"s fuddle things up. Using:
f = file(repr(loc), "r") seems to double up the "\"s for some reason..
f = file(repr(loc), "r")
IOError: [Errno 2] No such file or directory: "'C:\\\\test\\\\test.txt'"
but a simple f = file(r"C:\test\test.txt") does work.
Perhaps you should use raw_input, then you don't need to use anything special when typing your pathname. E.g.

loc = raw_input("Filename: ")
f = file(loc, "r")

"input(prompt)" is just a shortcut for "eval(raw_input(prompt))", and you're trying to get around the "eval" bit...-gadfium 05:45, 23 July 2006 (UTC)[reply]